From fe2b5f00ed8bb21f05adfbd08034d7256f8c8a4f Mon Sep 17 00:00:00 2001 From: TanXin <83105156+newbietan@users.noreply.github.com> Date: Tue, 8 Sep 2026 22:36:58 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E5=8F=91=E5=B8=83=20v2.2.1=20AI=20A?= =?UTF-8?q?gent=20=E8=BF=9E=E7=BB=AD=E8=AE=B0=E5=BF=86=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=8E=E4=BA=A4=E4=BA=92=E5=A2=9E=E5=BC=BA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=20(#127)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 版本概述 发布 **v2.2.1** 版本,核心聚焦于 **AI Agent 连续运维记忆合并、实体对齐演进与前端交互体验增强**。彻底解决在复杂运维场景下,连续排查导致工作日志碎片化刷屏、记忆提炼过于草率简写、配置更新冲突并存以及前端卡片展示等痛点。 --- ### 更新内容 1. **任务快照锚定与连续运维任务合并**: - 逆序定位本轮任务起点用户诉求,确保复杂长交互(超过 16 步)不丢失初始核心目标与显式参数; - 引入时序紧邻度与连续任务强合并指引(30分钟内),指导大模型优先采用 `mode: "update_latest"` 承前启后地合并上一阶段成果,彻底解决排障过程中工作日志碎片化与 10 条配额被刷爆的问题; - 数据库 `UserDBDO` 支持原子合并更新最新一条工作历程,并在模型缺省时自动容错兜底。 2. **知识实体对齐与版本平滑演进**: - 提炼时注入当前服务器已存的知识项与凭据清单,强制约束修改配置或更换凭据时复用完全相同的 key 名; - 结合底层 SQLite 原生 `UNIQUE(user_id, server_id, key)` 与 `ON CONFLICT DO UPDATE` 实现原子更新,杜绝同一配置产生多条冲突脏数据; - 支持 `action: "delete"` 标记,允许用户明确废弃某项实体时在后台原子清理。 3. **长短时记忆职责彻底解耦**: - 会话内摘要(`this.state.summary`)专职保留未完结的任务目标、用户决策与待办上下文,彻底剔除冗长具体的命令流水账; - System Prompt 中对“当前会话未决任务与决策摘要”与“服务器近期工作历程与操作备忘”进行语义与注入层隔离,消除同类信息双份冗余堆叠。 4. **真实凭据流通与通用协议规范**: - 彻底移除 Agent 工具输出中的破坏性正则硬脱敏代码,解除密钥与 Token 自动回填流转的阻碍; - 移除非标准 `reasoning_effort` 参数,仅保留标准 `temperature: 0.1`,杜绝 OpenAI 官方 GPT-4o 等模型报 HTTP 400 校验错误; - 前置清洗 `` 思考标签,避免 DeepSeek-R1 / QwQ 等推理模型思考阶段的草稿代码块被错误截获; - 补充循环步数上限与异常终止时的阶段性记忆提炼兜底,并增加纯问候本地快速熔断与并发排队补偿。 5. **前端工作历程呈现与交互增强**: - 放宽提炼摘要字数限制至 100 字内(title 扩至 20 字内),引导大模型在不超过限制的前提下详实具体地记录排查背景、配置变更、服务状态及验证结果,消除草率简略; - 前端工作历程卡片应用 `-webkit-line-clamp: 2` 配合文本省略(`...`),保持整洁紧凑布局; - 支持鼠标悬停浮动展示完整文本 Tooltip,并支持点击直接展开/收起完整摘要内容。 --- ### 提交列表 - `d99bd7b` release: 发布 v2.2.1 AI Agent 连续记忆合并与交互增强版本 - `542381a` feat: 放宽工作历程摘要长度至100字并支持前端两行截断悬停与点击展开 - `8d55927` refactor: 重构与优化 AI Agent 上下文管理与长期记忆系统 --- ### 验证结果 全套本地门禁全部通过(`pnpm run verify`): - **TypeScript 类型检查**:双端全部通过(0 errors) - **单元与集成测试**:69 个测试文件、784 项用例全部通过(100% pass) - **前端生产构建**:Vite 生产构建与单文件 HTML 内联成功 - **Playwright E2E & 无障碍测试**:75 个端到端测试全部通过(100% pass) --- CHANGELOG.md | 26 ++ frontend/package.json | 2 +- frontend/src/agent/agent-panel.ts | 11 +- frontend/src/style.css | 19 ++ package.json | 2 +- src/server-memory-schema.ts | 87 ++++++- src/worker/agent/core.ts | 150 ++++++----- src/worker/agent/prompt.ts | 246 +++++++++++++++++- src/worker/agent/types.ts | 15 +- src/worker/html.ts | 66 ++--- src/worker/user-db.ts | 51 +++- tests/server-memory-schema.test.ts | 119 +++++++++ .../worker/agent/agent-memory-prompt.test.ts | 204 ++++++++++++++- tests/worker/user-db-memory.test.ts | 83 ++++++ 14 files changed, 952 insertions(+), 129 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a63ffcf..b3e186d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.2.1] - 2026-09-08 + +### Changed + +- **AI Agent 上下文管理与长期记忆系统深度重构与体验优化**: + - **任务快照锚定与多轮增量合并**: + - 逆序定位本轮任务起点用户诉求,确保复杂多轮交互(超过 16 步)不丢失初始核心目标与显式参数。 + - 引入连续运维任务强合并机制:提炼时动态感知上一条工作历程的时间间隔(30分钟内),指导大模型默认采用 `mode: "update_latest"` 承前启后地合并上一阶段运维成果,彻底解决排障过程中工作日志碎片化与 10 条配额轻易被占满的问题。 + - 数据库 `UserDBDO` 支持原子合并更新最新一条工作历程,并在模型缺省时自动容错兜底。 + - **知识实体对齐与版本平滑演进**: + - 提炼时注入当前服务器已存的知识项与凭据清单,强制约束修改配置或更换凭据时复用完全相同的 key 名。 + - 结合底层 SQLite 原生 `UNIQUE(user_id, server_id, key)` 与 `ON CONFLICT DO UPDATE` 实现原子更新,杜绝同一配置产生多条冲突脏数据。 + - 支持 `action: "delete"` 标记,允许用户明确废弃某项实体时在后台原子清理。 + - **长短时记忆职责彻底解耦**: + - 会话内摘要(`this.state.summary`)专职保留未完结的任务目标、用户决策与待办上下文,彻底剔除冗长具体的命令流水账。 + - System Prompt 中对“当前会话未决任务与决策摘要”与“服务器近期工作历程与操作备忘”进行语义与注入层隔离,消除同类信息双份冗余堆叠。 + - **真实凭据流通与通用协议规范**: + - 彻底移除 Agent 工具输出中的破坏性正则硬脱敏代码,解除密钥与 Token 自动回填流转的阻碍。 + - 移除非标准 `reasoning_effort` 参数,仅保留标准 `temperature: 0.1`,杜绝 OpenAI 官方 GPT-4o 等模型报 HTTP 400 校验错误。 + - 前置清洗 `` 思考标签,避免 DeepSeek-R1 / QwQ 等推理模型思考阶段的草稿代码块被错误截获。 + - 补充循环步数上限与异常终止时的阶段性记忆提炼兜底,并增加纯问候本地快速熔断与并发排队补偿。 + - **前端工作历程呈现与交互增强**: + - 放宽提炼摘要字数限制至 100 字内(title 扩至 20 字内),引导大模型在不超过限制的前提下详实具体地记录排查背景、配置变更、服务状态及验证结果,消除草率简略。 + - 前端工作历程卡片应用 `-webkit-line-clamp: 2` 配合文本省略(`...`),保持整洁紧凑布局。 + - 支持鼠标悬停浮动展示完整文本 Tooltip,并支持点击直接展开/收起完整摘要内容。 + ## [2.2.0] - 2026-09-08 ### Added diff --git a/frontend/package.json b/frontend/package.json index 108117e..17c3d9e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "cloudssh-frontend", - "version": "2.2.0", + "version": "2.2.1", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/agent/agent-panel.ts b/frontend/src/agent/agent-panel.ts index 5e9b811..1786434 100644 --- a/frontend/src/agent/agent-panel.ts +++ b/frontend/src/agent/agent-panel.ts @@ -1244,14 +1244,14 @@ export class AgentPanel {
- ${escapeHtml(log.title)} + ${escapeHtml(log.title)} ${escapeHtml(timeStr)}
-
${escapeHtml(log.summary)}
+
${escapeHtml(log.summary)}
`; }) @@ -1260,6 +1260,13 @@ export class AgentPanel { // pi-lens-ignore: no-inner-html, ts-xss-dom-sink this.memoryContentEl.innerHTML = logsHtml; + this.memoryContentEl.querySelectorAll('.agent-log-summary').forEach((el) => { + el.addEventListener('click', (e) => { + e.stopPropagation(); + el.classList.toggle('expanded'); + }); + }); + this.memoryContentEl.querySelectorAll('.agent-log-delete-btn').forEach((btn) => { btn.addEventListener('click', async () => { const logId = Number(btn.dataset.id); diff --git a/frontend/src/style.css b/frontend/src/style.css index c495700..4e646f8 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -736,6 +736,25 @@ select optgroup { background: color-mix(in srgb, var(--agent-agent-color) 8%, transparent); } +/* Agent Work Log Summary clamp and expansion */ +.agent-log-summary { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + line-clamp: 2; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-word; + transition: color 0.15s ease; +} + +.agent-log-summary.expanded { + display: block; + -webkit-line-clamp: unset; + line-clamp: unset; + overflow: visible; +} + /* ==================== User Space Styles ==================== */ .user-space-action-label { diff --git a/package.json b/package.json index 7129f57..c270145 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudssh", - "version": "2.2.0", + "version": "2.2.1", "packageManager": "pnpm@11.8.0", "description": "纯 Cloudflare 架构 Web SSH 工具", "main": "src/worker/index.ts", diff --git a/src/server-memory-schema.ts b/src/server-memory-schema.ts index 357b2a0..acdc2f4 100644 --- a/src/server-memory-schema.ts +++ b/src/server-memory-schema.ts @@ -63,13 +63,17 @@ export function isSensitiveKeyOrValue(key: string, value: string): boolean { return SENSITIVE_VALUE_PATTERNS.some((pattern) => pattern.test(value)); } +export type WorkLogMode = 'create' | 'update_latest'; +export type KnowledgeAction = 'set' | 'delete'; + /** * 校验并规范化工作记录输入 */ export function normalizeWorkLogInput(input: { + mode?: unknown; title?: unknown; summary?: unknown; -}): { ok: true; value: { title: string; summary: string } } | { ok: false; error: string } { +}): { ok: true; value: { mode: WorkLogMode; title: string; summary: string } } | { ok: false; error: string } { if (typeof input.title !== 'string') return { ok: false, error: 'titleRequired' }; const trimmedTitle = input.title.trim(); if (!trimmedTitle) return { ok: false, error: 'titleRequired' }; @@ -84,9 +88,12 @@ export function normalizeWorkLogInput(input: { return { ok: false, error: 'summaryTooLong' }; } + const mode: WorkLogMode = input.mode === 'update_latest' ? 'update_latest' : 'create'; + return { ok: true, value: { + mode, title: trimmedTitle, summary: trimmedSummary, }, @@ -97,10 +104,14 @@ export function normalizeWorkLogInput(input: { * 校验并规范化知识与凭据输入 */ export function normalizeKnowledgeInput(input: { + action?: unknown; category?: unknown; key?: unknown; value?: unknown; -}): { ok: true; value: { category: KnowledgeCategory; key: string; value: string } } | { ok: false; error: string } { +}): { + ok: true; + value: { action: KnowledgeAction; category: KnowledgeCategory; key: string; value: string }; +} | { ok: false; error: string } { if (typeof input.key !== 'string') return { ok: false, error: 'keyRequired' }; const trimmedKey = input.key.trim(); if (!trimmedKey) return { ok: false, error: 'keyRequired' }; @@ -108,6 +119,19 @@ export function normalizeKnowledgeInput(input: { return { ok: false, error: 'keyTooLong' }; } + const action: KnowledgeAction = input.action === 'delete' ? 'delete' : 'set'; + if (action === 'delete') { + return { + ok: true, + value: { + action: 'delete', + category: 'note', + key: trimmedKey, + value: '', + }, + }; + } + if (typeof input.value !== 'string') return { ok: false, error: 'valueRequired' }; const trimmedValue = input.value.trim(); if (!trimmedValue) return { ok: false, error: 'valueRequired' }; @@ -128,6 +152,7 @@ export function normalizeKnowledgeInput(input: { return { ok: true, value: { + action: 'set', category, key: trimmedKey, value: trimmedValue, @@ -255,3 +280,61 @@ export function formatTimestampWithRelative( return `${y}-${m}-${d} ${hh}:${mm} (${relative})`; } + +/** + * 从 LLM 提炼返回的原始文本中健壮地提取 JSON 对象。 + * + * 容错策略: + * 1. 优先清洗显式思考标签 (..., ..., ...),防止模型在思考阶段写出的草稿代码块干扰最终提取; + * 2. 尝试从 Markdown 代码块提取 (```json ... ``` 或 ``` ... ```); + * 3. 寻找最外层大括号边界 { ... },防御自然语言前缀/后序客套话与无代码块包裹; + * 4. 原始解析兜底。 + */ +export function extractDistillationJson(rawContent: string): any { + if (!rawContent || typeof rawContent !== 'string') return null; + + const trimmed = rawContent.trim(); + if (!trimmed) return null; + + // 1. 优先清洗思考或中间过程标签,避免思考阶段输出的草稿代码块干扰最终提取 + const cleaned = trimmed + .replace(/<(?:think|thought|scratchpad)>[\s\S]*?<\/(?:think|thought|scratchpad)>/gi, '') + .trim(); + + if (!cleaned) return null; + + // 2. 优先尝试从 Markdown 代码块提取 + const codeBlockMatch = cleaned.match(/```(?:json)?\s*([\s\S]*?)\s*```/); + if (codeBlockMatch) { + try { + const parsed = JSON.parse(codeBlockMatch[1].trim()); + if (parsed && typeof parsed === 'object') return parsed; + } catch { + /* 代码块解析失败则继续容错清洗 */ + } + } + + // 3. 寻找最外层大括号边界 { ... },防御自然语言前后缀客套话 + const firstBrace = cleaned.indexOf('{'); + const lastBrace = cleaned.lastIndexOf('}'); + if (firstBrace !== -1 && lastBrace > firstBrace) { + const candidate = cleaned.slice(firstBrace, lastBrace + 1).trim(); + try { + const parsed = JSON.parse(candidate); + if (parsed && typeof parsed === 'object') return parsed; + } catch { + /* ignore */ + } + } + + // 4. 兜底原始解析 + try { + const parsed = JSON.parse(cleaned); + if (parsed && typeof parsed === 'object') return parsed; + } catch { + return null; + } + + return null; +} + diff --git a/src/worker/agent/core.ts b/src/worker/agent/core.ts index 09f5f18..f3a2261 100644 --- a/src/worker/agent/core.ts +++ b/src/worker/agent/core.ts @@ -1,16 +1,22 @@ // Agent Core — control loop that runs inside Durable Object import { + extractDistillationJson, + type KnowledgeAction, normalizeKnowledgeInput, normalizeWorkLogInput, type UnifiedServerMemory, + type WorkLogMode, } from '../../server-memory-schema'; import { type AgentLocale, + extractDistillationSnapshot, + formatDistillationPromptInput, formatServerMemoryForPrompt, getResponseLanguageInstruction, getSystemPrompt, MEMORY_DISTILLATION_PROMPT, + shouldBypassDistillation, } from './prompt'; import type { TerminalContext } from './terminal-context'; import { ToolExecutor } from './tool-executor'; @@ -66,6 +72,7 @@ export class AgentCore { private userTimezone: string = 'UTC'; private unifiedMemory: UnifiedServerMemory = { workLogs: [], knowledge: [] }; private distillationInProgress: boolean = false; + private pendingDistillationSnapshot: ChatMessage[] | null = null; constructor( private terminalContext: TerminalContext, @@ -264,6 +271,7 @@ export class AgentCore { } agentAbort(): void { + this.pendingDistillationSnapshot = null; if (this.state.status === 'running') { this.abortController.abort('user_stop'); this.sendToFrontend({ @@ -381,24 +389,10 @@ export class AgentCore { }); // Execute tool call - let result = await this.toolExecutor.execute(toolCall.function.name, toolArgs, signal); + const result = await this.toolExecutor.execute(toolCall.function.name, toolArgs, signal); this.recordToolCall(toolCall.function.name, toolArgs); this.resetTimeout(); // 看门狗:工具执行成功,重置超时时间 - if (result) { - result = result - .replace( - /-----BEGIN[A-Z ]+PRIVATE KEY-----[\s\S]+?-----END[A-Z ]+PRIVATE KEY-----/g, - '[REDACTED PRIVATE KEY]' - ) - .replace( - /\bey[a-zA-Z0-9-_=]+\.[a-zA-Z0-9-_=]+\.?[a-zA-Z0-9-_=]*\b/g, - '[REDACTED JWT]' - ) - .replace(/\b(ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36}\b/g, '[REDACTED GITHUB TOKEN]') - .replace(/\b(AKIA[0-9A-Z]{16})\b/g, '[REDACTED AWS KEY ID]'); - } - // 必须先将 tool 结果加入 messages,否则后续轮次的 LLM 调用会因 // assistant.tool_calls 缺少对应的 tool 响应而触发 API 400 错误 this.state.messages.push({ @@ -437,7 +431,7 @@ export class AgentCore { content: choice.message.content || (this.preferredLocale === 'en-US' ? 'Task completed.' : '任务已执行完成。'), }); this.state.status = 'idle'; - const snapshotMsgs = this.state.messages.slice(-10); + const snapshotMsgs = extractDistillationSnapshot(this.state.messages); void this.triggerMemoryDistillationIfEligible(snapshotMsgs); return; } @@ -445,7 +439,7 @@ export class AgentCore { // Loop exited — notify frontend of the reason if (signal.aborted) { // 超时退出(排除用户手动停止,agentAbort 已自行通知) - if (!signal.reason?.includes?.('user_stop')) { + if (!String(signal.reason || '').includes('user_stop')) { this.sendToFrontend({ type: 'agent_frame', subType: 'response', @@ -453,6 +447,12 @@ export class AgentCore { }); } } + + // 迭代上限或非用户主动停止的退出:若已有实质性命令执行,触发阶段性记忆提炼 + if (this.state.iteration > 0 && !String(signal.reason || '').includes('user_stop')) { + const snapshotMsgs = extractDistillationSnapshot(this.state.messages); + void this.triggerMemoryDistillationIfEligible(snapshotMsgs); + } } catch (e) { // 仅处理非 abort 异常(abort 路径已在 while 退出后处理) if (!signal.aborted) throw e; @@ -830,7 +830,7 @@ export class AgentCore { parts.push(`## 交互式终端最近输出\n${this.terminalContextSnapshot}`); } if (this.state.summary) { - parts.push(`## 之前的对话摘要\n${this.state.summary}`); + parts.push(`## 当前会话未决任务与决策摘要\n${this.state.summary}`); } if (this.unifiedMemory.workLogs.length > 0 || this.unifiedMemory.knowledge.length > 0) { const memoryText = formatServerMemoryForPrompt( @@ -889,13 +889,13 @@ export class AgentCore { ? `\n\n已有摘要(请在其基础上合并新内容,不要丢失已有关键信息):\n${existingSummary}` : ''; - const summaryPrompt = `请将以下运维对话压缩为简洁摘要,保留关键信息: -- 用户的主要请求和目标 -- 已执行的关键操作和命令 -- 当前状态和未完成的任务 -- AI 提出的建议或需要用户确认的选项 - -要求:摘要控制在 500 字以内,使用要点列表格式。如有已有摘要,请在其基础上合并新内容,确保不丢失旧摘要中的关键信息。 + const summaryPrompt = `请将以下运维对话压缩为会话待办与决策上下文摘要,特别关注: +- 当前正在进行或未完成的运维任务目标 +- 用户明确的偏好选择或已做出的关键决策 +- AI 提出的建议及需要用户后续确认的选项 +- 任何阻碍当前任务的阻塞点或错误结论 +注意:无需罗列琐碎的具体命令执行日志(系统已有独立工作历程记录),专注于保持人机对话的决策连续性与未决状态。 +控制在 300 字以内,使用精炼的要点列表。如有已有摘要,请在其基础上合并新内容,不丢失关键决策。 对话内容: ${conversationText}${previousSection}`; @@ -941,7 +941,12 @@ ${conversationText}${previousSection}`; } private async triggerMemoryDistillationIfEligible(snapshotMsgs: ChatMessage[]): Promise { - if (!this.memoryProvider || this.distillationInProgress || snapshotMsgs.length < 2) { + if (!this.memoryProvider || snapshotMsgs.length < 2 || shouldBypassDistillation(snapshotMsgs)) { + return; + } + if (this.distillationInProgress) { + // 正在提炼中:记录最新排队快照,避免多轮连续交互直接丢弃最新结果 + this.pendingDistillationSnapshot = snapshotMsgs; return; } this.distillationInProgress = true; @@ -951,35 +956,39 @@ ${conversationText}${previousSection}`; // 提炼失败不得影响正常交互 } finally { this.distillationInProgress = false; + if (this.pendingDistillationSnapshot) { + const nextSnapshot = this.pendingDistillationSnapshot; + this.pendingDistillationSnapshot = null; + void this.triggerMemoryDistillationIfEligible(nextSnapshot); + } } } private async distillMemoryWithLLM(snapshotMsgs: ChatMessage[]): Promise { - const config = this.agentConfig; - if (!config || !this.memoryProvider) return; - - // 选取刚才同步快照的消息用于分析 - const recentMsgs = snapshotMsgs - .map((m) => { - if (m.role === 'user') return `用户: ${m.content}`; - if (m.role === 'assistant') { - if (m.tool_calls) { - const cmds = m.tool_calls.map((tc) => tc.function.arguments).join(', '); - return `AI执行命令: ${cmds}`; - } - return `AI回复: ${m.content}`; - } - if (m.role === 'tool') { - return `命令输出: ${m.content?.slice(0, 300)}`; - } - return ''; - }) - .filter(Boolean) - .join('\n'); - - if (!recentMsgs || recentMsgs.length < 20) return; - try { + const config = this.agentConfig; + if (!config || !this.memoryProvider) return; + + const latestLog = this.unifiedMemory.workLogs?.[0]; + const isRecentConsecutive = Boolean( + latestLog && + typeof latestLog.updated_at === 'number' && + Date.now() - latestLog.updated_at < 30 * 60 * 1000 + ); + + // 选取刚才同步快照的消息,并融合已有的近期 WorkLog 与 Knowledge 键值清单 + const promptInput = formatDistillationPromptInput( + snapshotMsgs, + this.unifiedMemory.workLogs, + this.unifiedMemory.knowledge, + { + now: Date.now(), + locale: this.preferredLocale, + timeZone: this.userTimezone, + } + ); + if (!promptInput || promptInput.trim().length === 0) return; + let cleanBaseUrl = config.base_url.replace(/\/$/, ''); if (cleanBaseUrl.endsWith('/chat/completions')) { cleanBaseUrl = cleanBaseUrl.slice(0, -'/chat/completions'.length); @@ -996,12 +1005,12 @@ ${conversationText}${previousSection}`; model: config.model, messages: [ { role: 'system', content: MEMORY_DISTILLATION_PROMPT }, - { role: 'user', content: `会话记录如下:\n${recentMsgs}` }, + { role: 'user', content: promptInput }, ], - max_tokens: 500, + max_tokens: 1500, temperature: 0.1, }), - signal: AbortSignal.timeout(10000), + signal: AbortSignal.timeout(25000), }); if (res.status >= 300 && res.status < 400) { @@ -1015,26 +1024,21 @@ ${conversationText}${previousSection}`; const rawContent = data.choices?.[0]?.message?.content?.trim(); if (!rawContent) return; - let jsonStr = rawContent; - const jsonMatch = rawContent.match(/```(?:json)?\s*([\s\S]*?)\s*```/); - if (jsonMatch) { - jsonStr = jsonMatch[1].trim(); - } - - let parsed: any = null; - try { - parsed = JSON.parse(jsonStr); - } catch { - return; - } - + const parsed = extractDistillationJson(rawContent); if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) { return; } - let workLogToSave: { title: string; summary: string } | undefined; + let workLogToSave: { mode?: WorkLogMode; title: string; summary: string } | undefined; if (parsed.workLog && typeof parsed.workLog === 'object') { + let desiredMode = parsed.workLog.mode; + // 容错兜底:若在近期连续会话中且模型未显式输出 mode,默认按 update_latest 合并更新 + if (!desiredMode && isRecentConsecutive) { + desiredMode = 'update_latest'; + } + const normLog = normalizeWorkLogInput({ + mode: desiredMode, title: parsed.workLog.title, summary: parsed.workLog.summary, }); @@ -1043,10 +1047,16 @@ ${conversationText}${previousSection}`; } } - const knowledgeToSave: Array<{ category: any; key: string; value: string }> = []; + const knowledgeToSave: Array<{ + action?: KnowledgeAction; + category: any; + key: string; + value: string; + }> = []; if (Array.isArray(parsed.knowledge)) { for (const k of parsed.knowledge) { const normK = normalizeKnowledgeInput({ + action: k.action, category: k.category, key: k.key, value: k.value, @@ -1062,7 +1072,9 @@ ${conversationText}${previousSection}`; workLog: workLogToSave, knowledge: knowledgeToSave.length > 0 ? knowledgeToSave : undefined, }); - this.unifiedMemory = await this.memoryProvider.fetchUnifiedMemory().catch(() => this.unifiedMemory); + this.unifiedMemory = await this.memoryProvider + .fetchUnifiedMemory() + .catch(() => this.unifiedMemory); this.sendToFrontend({ type: 'agent_frame', subType: 'memory_updated', diff --git a/src/worker/agent/prompt.ts b/src/worker/agent/prompt.ts index 87e4467..8058fd5 100644 --- a/src/worker/agent/prompt.ts +++ b/src/worker/agent/prompt.ts @@ -87,8 +87,11 @@ exec channel 会创建独立 SSH channel,返回 JSON: import { formatCurrentTimeAnchor, formatTimestampWithRelative, + type ServerKnowledgeItem, + type ServerWorkLog, type UnifiedServerMemory, } from '../../server-memory-schema'; +import type { ChatMessage } from './types'; export function getSystemPrompt(): string { return SYSTEM_PROMPT; @@ -170,30 +173,249 @@ export function formatServerMemoryForPrompt( return fullText; } -export const MEMORY_DISTILLATION_PROMPT = `你是一个服务器智能会话总结助手。请阅读刚才这轮人机交互记录,提炼以下两部分信息: +export const MEMORY_DISTILLATION_PROMPT = `你是一个服务器智能会话总结助手。请阅读本轮人机交互记录,并结合当前服务器已有的工作历程与已存知识清单,提炼以下两部分信息: 1. 本轮执行的工作概括 (workLog): - - title: 任务简述(如“检查硬件与系统资源”、“更新系统安装包”、“查看运行服务”、“排查 Nginx 故障”等,15字内) - - summary: 执行的主要操作与最终结论(如“查看了 CPU/内存/磁盘,资源正常;检查了 12 个可升级包”,60字内) - - 若用户仅打招呼(如单纯说“你好”)且未执行任何实质性查询或操作,workLog 设为 null。 + - 结合【执行操作】与【最终结论】生成运维工作概括; + - mode 模式判定(合并优先原则): + * 默认合并更新 ("update_latest"):只要服务器存在近期工作历程(特别是在同一会话、相近时间内的连续排查/修改/部署/验证流程),【必须输出 "mode": "update_latest"】!将上一条记录的要点与本轮新进展融合成一条承前启后的完整总结(title 20字内,summary 100字内),绝对避免把连续运维排障过程拆解成多条琐碎的碎片日志; + * 独立新建 ("create"):仅当服务器无任何历史记录、或者最近一条记录属于很久以前的历史日志(如数小时前或不同日期)、或者用户明确声明开启全新领域的独立任务时,才输出 "mode": "create"; + - title: 任务简述(20字内,概括本阶段或合并任务的核心目标,如“排查端口冲突并部署测试服务”); + - summary: 执行的主要操作与最终结论(100字内,在不超过限制的前提下尽量详实具体,完整保留排查到的异常、具体修改的端口/配置/服务状态、执行的测试与最终验证结论;合并任务时,承前启后地融合前序排查背景与最新成果,避免过于简略草率); + - 若用户仅打招呼且未执行任何实质性查询或操作,workLog 设为 null。 2. 用户在对话中主动提供或沉淀的上下文知识与凭据参数 (knowledge,数组,可为空 []): - - 提取用户主动告知的部署 Token、API Key、数据库或服务密码 (category: "credential"); - - 提取特定服务端口、自建仓库地址、特殊路径配置 (category: "config"); - - 提取用户指定的习惯偏好或命令约定 (category: "rule"); - - 提取重要的持久业务备忘 (category: "note")。 + - 实体对齐与更新:如果本轮涉及修改或更新【当前已沉淀的知识与凭据项】中的参数(如更换端口、更新密码),必须复用完全相同的 key 名,以便系统原子覆盖旧值! + - 新增实体:若为全新凭据或配置,使用规范的蛇形 key(如 deploy_token, app_port, redis_path); + - 废弃删除:若用户明确要求移除某项配置或服务(如“删除了测试库”),输出 { action: "delete", key: "xxx" }; + - 类别分类: + * "credential": 部署 Token、API Key、数据库或服务密码; + * "config": 服务端口、仓库地址、特殊路径配置、环境变量; + * "rule": 习惯偏好、命令约定; + * "note": 重要的持久业务备忘; - 【核心目的】:下次用户再次执行类似操作时,AI 可以直接复用这些参数与凭据,绝不再向用户重复索取! 输出格式:必须输出严格的单对象 JSON,严禁任何 Markdown 代码块标记(如 \`\`\`json)或多余文字。 示例格式: { "workLog": { - "title": "检查系统服务与安装包", - "summary": "检查了当前运行的 systemd 服务,并扫描了系统待更新软件包" + "mode": "update_latest", + "title": "排查端口并部署测试服务", + "summary": "检查系统内存与磁盘正常,排查8080端口后换用8090端口,成功启动Python HTTP服务,curl请求响应正常" }, "knowledge": [ - { "category": "credential", "key": "github_deploy_token", "value": "ghp_xxxxxx" }, - { "category": "config", "key": "docker_registry", "value": "reg.internal:5000" } + { "category": "config", "key": "app_port", "value": "8090" }, + { "action": "delete", "key": "old_backup_dir" } ] } 若本轮无任何有效工作或知识产出,返回空对象:{}`; + +/** + * 从多轮交互消息历史中抽取用于记忆提炼的快照。 + * + * 核心策略: + * 1. 过滤 system 消息; + * 2. 逆序寻找到本轮交互的起点 User 消息,保证提炼模型能看到用户最初的任务需求与参数; + * 3. 若本轮交互步骤过多(> 16 条),保留首条 User 消息与最近的 15 条消息,既防止超出提炼窗口,又绝不丢失核心目标; + * 4. 极端兜底时取最后 10 条非 system 消息。 + */ +export function extractDistillationSnapshot(messages: ChatMessage[]): ChatMessage[] { + if (!Array.isArray(messages) || messages.length === 0) return []; + + const nonSystem = messages.filter((m) => m.role !== 'system'); + if (nonSystem.length === 0) return []; + + // 从后往前查找最后一条 user 消息 + let lastUserIdx = -1; + for (let i = nonSystem.length - 1; i >= 0; i--) { + if (nonSystem[i].role === 'user') { + lastUserIdx = i; + break; + } + } + + if (lastUserIdx !== -1) { + const roundMsgs = nonSystem.slice(lastUserIdx); + // 若本轮步数较多(超过 16 条消息),保留首条 User 消息 + 尾部 15 条上下文 + if (roundMsgs.length > 16) { + return [roundMsgs[0], ...roundMsgs.slice(-15)]; + } + return roundMsgs; + } + + return nonSystem.slice(-10); +} + +function extractCommandSummary(toolCall: { function: { name: string; arguments: string } }): string { + const name = toolCall.function.name; + let args: any = {}; + try { + args = JSON.parse(toolCall.function.arguments); + } catch { + args = { command: toolCall.function.arguments }; + } + + if (name === 'execute_command' && args.command) { + return String(args.command).trim(); + } + if (name === 'service_manage' && args.service) { + return `systemctl ${args.action || ''} ${args.service}`.trim(); + } + if (name === 'docker_manage') { + return `docker ${args.action || ''} ${args.target || ''}`.trim(); + } + if (name === 'detect_environment') { + return 'detect_environment'; + } + if (name === 'list_processes') { + return 'ps aux'; + } + if (name === 'read_terminal_context') { + return 'read_terminal'; + } + return name; +} + +/** + * 将快照消息序列化为便于提炼模型理解的高信息密度紧凑文本。 + * + * 核心优化: + * 1. 彻底剔除所有 tool 输出(绝不传递冗长原始 stdout/stderr/日志); + * 2. 提取用户原始诉求(保留任务目标与显式提供的 Token/端口/配置参数); + * 3. 提取执行的关键命令简写(便于模型理解实际做了什么,即使 AI 最终回复较简短也能准确提炼); + * 4. 提取 AI 最终给出的结论; + * 5. 将 Token 消耗压缩 80%~90%,极大提升提炼响应速度并避免超长截断。 + */ +export function formatDistillationMessages(snapshotMsgs: ChatMessage[]): string { + const userPrompts: string[] = []; + const executedCommands: string[] = []; + let finalConclusion = ''; + + for (const m of snapshotMsgs) { + if (m.role === 'user' && m.content && m.content.trim()) { + userPrompts.push(m.content.trim()); + } else if (m.role === 'assistant') { + if (m.tool_calls && m.tool_calls.length > 0) { + for (const tc of m.tool_calls) { + const cmd = extractCommandSummary(tc); + if (cmd && !executedCommands.includes(cmd)) { + executedCommands.push(cmd); + } + } + } + if (m.content && m.content.trim()) { + finalConclusion = m.content.trim(); + } + } + } + + const parts: string[] = []; + if (userPrompts.length > 0) { + parts.push(`用户诉求: ${userPrompts.join('\n次要跟进: ')}`); + } + if (executedCommands.length > 0) { + const compactCmds = executedCommands + .slice(0, 10) + .map((c) => (c.length > 80 ? `${c.slice(0, 77)}...` : c)); + parts.push(`执行操作: ${compactCmds.join(', ')}`); + } + if (finalConclusion) { + parts.push(`最终结论: ${finalConclusion}`); + } + + return parts.join('\n'); +} + +/** + * 组装用于记忆提炼的输入上下文。 + * 注入已存的最近 WorkLog 与现有 Knowledge 键值清单, + * 赋能提炼模型进行多轮任务合并(mode: 'update_latest')与已有实体键对齐(Entity Alignment)。 + */ +export function formatDistillationPromptInput( + snapshotMsgs: ChatMessage[], + recentLogs: ServerWorkLog[] = [], + existingKnowledge: ServerKnowledgeItem[] = [], + options?: { + now?: number; + locale?: AgentLocale; + timeZone?: string; + } +): string { + const parts: string[] = []; + const now = options?.now || Date.now(); + const locale = options?.locale || 'zh-CN'; + const timeZone = options?.timeZone; + + const latestLog = Array.isArray(recentLogs) && recentLogs.length > 0 ? recentLogs[0] : null; + const isRecentConsecutive = + latestLog && typeof latestLog.updated_at === 'number' && now - latestLog.updated_at < 30 * 60 * 1000; + + if (latestLog) { + const timeStr = formatTimestampWithRelative(latestLog.updated_at, now, locale, timeZone); + const logLines = recentLogs.slice(0, 2).map((l) => { + const t = formatTimestampWithRelative(l.updated_at, now, locale, timeZone); + return `- [${l.title}] (${t}): ${l.summary}`; + }); + parts.push(`【服务器最近的工作历程】\n${logLines.join('\n')}`); + + if (isRecentConsecutive) { + parts.push(`【连续运维任务合并强指引(非常重要)】: +检测到最新一条工作历程【${latestLog.title}】记录于不久前(${timeStr}): +- 原标题:${latestLog.title} +- 原摘要:${latestLog.summary} +当前本轮操作属于该运维任务的后续推进(如排障后续、配置修改、部署验证等连续工作流)。 +【必须遵循】: +1. 必须输出 "mode": "update_latest"! +2. 请将原记录的核心背景与本轮新完成的进展/结论融合成一条承前启后的完整工作日志(title 20字内,summary 100字内,在不超过限制的前提下尽可能详实具体,保留排查背景、修改参数、服务状态及验证结果等关键细节,避免草率简写)。 +3. 严禁输出 "create" 造成连续操作被拆成多条琐碎的碎片日志!`); + } + } + + if (Array.isArray(existingKnowledge) && existingKnowledge.length > 0) { + const kLines = existingKnowledge + .slice(0, 30) + .map((k) => `- [${k.category}] ${k.key}: ${k.value}`); + parts.push(`【当前已沉淀的知识与凭据项(更新时请复用完全相同的 key 名)】\n${kLines.join('\n')}`); + } + + const conversation = formatDistillationMessages(snapshotMsgs); + parts.push(`【本轮会话记录】\n${conversation}`); + + return parts.join('\n\n'); +} + +const TRIVIAL_GREETING_PATTERN = + /^[\s\p{P}]*(?:你好|您好|hi|hello|hey|在吗|在么|哈喽|早上好|中午好|晚上好|test|ping)[\s\p{P}]*$/iu; + +const KNOWLEDGE_KEYWORD_PATTERN = + /(?:token|key|secret|password|passwd|pwd|credential|port|端口|http|\/|\b\d{2,5}\b|config|rule|偏好|记住)/i; + +/** + * 判断当前快照是否属于无命令执行的纯问候或无实质信息交互,从而在本地直接熔断跳过提炼。 + * 避免无意义的后台 LLM API 请求与 Token 消耗。 + */ +export function shouldBypassDistillation(snapshotMsgs: ChatMessage[]): boolean { + if (!Array.isArray(snapshotMsgs) || snapshotMsgs.length === 0) return true; + + // 1. 检查是否存在实质工具调用 + const hasToolCalls = snapshotMsgs.some( + (m) => m.role === 'assistant' && Array.isArray(m.tool_calls) && m.tool_calls.length > 0 + ); + if (hasToolCalls) return false; + + // 2. 无工具调用时,检查用户消息是否为纯寒暄且无任何知识/凭据特征 + const userContents = snapshotMsgs + .filter((m) => m.role === 'user' && typeof m.content === 'string') + .map((m) => m.content!.trim()) + .filter(Boolean); + + if (userContents.length === 0) return true; + + const isAllTrivial = userContents.every( + (text) => TRIVIAL_GREETING_PATTERN.test(text) && !KNOWLEDGE_KEYWORD_PATTERN.test(text) + ); + + return isAllTrivial; +} + + diff --git a/src/worker/agent/types.ts b/src/worker/agent/types.ts index e313cd9..8cb8487 100644 --- a/src/worker/agent/types.ts +++ b/src/worker/agent/types.ts @@ -89,18 +89,27 @@ export interface AIConfig { } import type { + KnowledgeAction, KnowledgeCategory, ServerKnowledgeItem, ServerWorkLog, UnifiedServerMemory, + WorkLogMode, } from '../../server-memory-schema'; -export type { ServerWorkLog, ServerKnowledgeItem, UnifiedServerMemory, KnowledgeCategory }; +export type { + ServerWorkLog, + ServerKnowledgeItem, + UnifiedServerMemory, + KnowledgeCategory, + WorkLogMode, + KnowledgeAction, +}; export interface AgentMemoryProvider { fetchUnifiedMemory(): Promise; saveBatchMemory(batch: { - workLog?: { title: string; summary: string }; - knowledge?: Array<{ category: KnowledgeCategory; key: string; value: string }>; + workLog?: { mode?: WorkLogMode; title: string; summary: string }; + knowledge?: Array<{ action?: KnowledgeAction; category?: KnowledgeCategory; key: string; value?: string }>; }): Promise; } diff --git a/src/worker/html.ts b/src/worker/html.ts index 39f2c62..f0fdf05 100644 --- a/src/worker/html.ts +++ b/src/worker/html.ts @@ -360,8 +360,8 @@ export const HTML = ` \`;try{const T={name:e,host:t,port:r,username:n,auth_method:d,tags:l,jump_server_id:c};if(u)T.credential=u;const k=document.getElementById("server-region");if(k&&c===null){T.region=k.value||""}let _;if(this.editingServerId){_=await fetch(\`/api/servers/\${this.editingServerId}\`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}else{_=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)})}if(!_.ok){const Q=await _.json();throw new Error(Q.error||"Save failed")}const C=await _.json();const w=Array.isArray(C._debug)?C._debug.filter(Q=>typeof Q==="string"):null;if(w){console.log("[locationHint 调试信息]");for(const Q of w)console.log(Q);this.showDebugNotification(w)}if(!w){if(c===null){const Q=C.inferred_hint||null;const D=T.region||null;if(D||Q){const I=D||Q;Y(g("server.savedRegion",{region:Gu(I)}),{variant:"success"})}else{Y(g("server.savedAuto"),{title:g("feedback.success"),variant:"warning"})}}else{Y(g("server.savedViaJump"),{variant:"success"})}}this.hideModal();await this.fetchServers()}catch(T){Y(T instanceof Error?T.message:String(T),{title:g("feedback.danger"),variant:"danger"})}finally{p.disabled=false;p.innerHTML=\` save \${this.editingServerId?g("server.update"):g("server.save")} - \`}}showDebugNotification(e){const t=document.createElement("div");t.className="fixed bottom-4 right-4 z-[200] max-w-md p-4 rounded-lg shadow-2xl border border-[var(--accent)] bg-[var(--bg-surface)] text-[var(--text)] font-mono text-[11px] leading-relaxed custom-scrollbar";t.style.maxHeight="300px";t.style.overflowY="auto";const s=document.createElement("div");s.className="text-[var(--accent)] font-bold mb-2 text-xs";s.textContent="[locationHint 调试信息]";t.appendChild(s);const r=document.createElement("div");r.className="text-muted whitespace-pre-wrap";r.textContent=e.join("\\n");t.appendChild(r);const n=document.createElement("button");n.className="absolute top-2 right-2 text-muted hover:text-[var(--accent)] cursor-pointer";n.innerHTML='close';n.onclick=()=>t.remove();t.appendChild(n);document.body.appendChild(t);setTimeout(()=>{if(t.parentNode){t.style.transition="opacity 0.3s";t.style.opacity="0";setTimeout(()=>t.remove(),300)}},8e3)}async logout(){try{await fetch("/api/auth/logout",{method:"POST"})}catch{}this.onLogout()}escapeHtml(e){const t=document.createElement("div");t.textContent=e;return t.innerHTML}escapeAttr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}}const x4="v1";const k4=58e3;function C4(i,e,t){return\`cloudssh-resume:\${x4}:\${i}:\${e}:\${t}\`}const T4="cloudssh_device_identity";const P4=1;const Mo="keys";const T1="share-device-signing-v1";function OO(){return typeof crypto!=="undefined"&&typeof crypto.subtle!=="undefined"&&typeof crypto.subtle.generateKey==="function"&&typeof indexedDB!=="undefined"}function $4(){return new Promise((i,e)=>{const t=indexedDB.open(T4,P4);t.onupgradeneeded=()=>{if(!t.result.objectStoreNames.contains(Mo)){t.result.createObjectStore(Mo)}};t.onsuccess=()=>i(t.result);t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))})}async function Pw(){const i=await $4();try{const e=await new Promise((s,r)=>{const n=i.transaction(Mo,"readonly");const o=n.objectStore(Mo).get(T1);o.onsuccess=()=>s(o.result);o.onerror=()=>r(o.error??new Error("IndexedDB read failed"))});if((e==null?void 0:e.publicKey)&&(e==null?void 0:e.privateKey))return e;const t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},false,["sign","verify"]);await new Promise((s,r)=>{const n=i.transaction(Mo,"readwrite");n.objectStore(Mo).put(t,T1);n.oncomplete=()=>s();n.onerror=()=>r(n.error??new Error("IndexedDB write failed"));n.onabort=()=>r(n.error??new Error("IndexedDB write aborted"))});return t}finally{i.close()}}function $w(i){const e=new Uint8Array(i);let t="";for(let s=0;s{const r=document.getElementById("auth-section");const n=document.getElementById("user-space-section");const o=document.getElementById("terminal-section");if(!r||!n||!o)return;n.classList.add("hidden");n.classList.remove("flex");o.classList.add("hidden");o.classList.remove("flex");r.classList.remove("hidden");r.replaceChildren(M4());cw(r);const a=document.getElementById("share-claim-btn");a==null?void 0:a.addEventListener("click",async()=>{if(t)return;t=true;a.disabled=true;Kp(a,true);const l=document.getElementById("share-claim-error");l==null?void 0:l.classList.add("hidden");try{const h=await Q4();const c=await fetch("/api/share/claim",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i,devicePubKey:h??void 0})});const d=await c.json().catch(()=>({}));if(!c.ok)throw new Error(Ka(d,"share.claimFailed"));e(d)}catch(h){t=false;a.disabled=false;Kp(a,false);if(l){l.textContent=h instanceof Error?h.message:g("share.claimFailed");l.classList.remove("hidden")}}})};s();On(()=>{if(!t&&document.getElementById("share-landing-card"))s()})}function Ew(){const i=document.getElementById("auth-section");if(!i)return;i.classList.remove("hidden");const e=Bt("main","w-full max-w-md relative z-10");const t=Bt("div","cyber-box p-6 text-center");const s=document.createElement("span");s.className="material-symbols-outlined text-muted mb-3";s.style.fontSize="42px";s.textContent="link_off";t.append(s);t.append(Bt("h1","text-base font-bold text-primary mb-3",g("share.endedTitle")));t.append(Bt("p","text-xs text-muted",g("share.endedDescription")));e.append(t);i.replaceChildren(e)}const _O=100;const vO=50;const yO=30;const bO=2e3;function nd(i,e,t){if(typeof i!=="string")return{ok:false,error:"nameRequired"};const s=i.trim();if(!s)return{ok:false,error:"nameRequired"};if([...s].length>vO){return{ok:false,error:"nameTooLong"}}if(typeof e!=="string")return{ok:false,error:"commandRequired"};const r=e.trim();if(!r)return{ok:false,error:"commandRequired"};if([...r].length>bO){return{ok:false,error:"commandTooLong"}}let n="";if(t!==void 0&&t!==null){if(typeof t!=="string"){return{ok:false,error:"categoryTooLong"}}n=t.trim();if([...n].length>yO){return{ok:false,error:"categoryTooLong"}}}return{ok:true,value:{name:s,command:r,category:n}}}class Vr extends Error{constructor(e){super(\`Snippet store error: \${e}\`);this.code=e;this.name="SnippetStoreError"}}function $1(i){if(i instanceof Vr){switch(i.code){case"nameRequired":return g("snippets.error.nameRequired");case"commandRequired":return g("snippets.error.commandRequired");case"nameTooLong":return g("snippets.error.nameTooLong",{max:vO});case"commandTooLong":return g("snippets.error.commandTooLong",{max:bO});case"categoryTooLong":return g("snippets.error.categoryTooLong",{max:yO});case"limitReached":return g("snippets.error.limitReached",{max:_O});case"notFound":return g("snippets.error.notFound");case"network":return g("snippets.error.network");default:return g("snippets.saveFailed")}}return g("snippets.saveFailed")}function Ku(i){return{id:String(i.id),name:i.name,command:i.command,category:i.category??"",createdAt:i.created_at??"",updatedAt:i.updated_at??""}}async function Ih(i){let e="network";try{const t=await i.json();if(t&&typeof t.error==="string")e=t.error}catch{}return new Vr(e)}class I4{async list(){const e=await fetch("/api/snippets");if(!e.ok)throw await Ih(e);const t=await e.json();return Array.isArray(t)?t.map(Ku):[]}async create(e,t,s){const r=nd(e,t,s);if(!r.ok)throw new Vr(r.error);const n=await fetch("/api/snippets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.value.name,command:r.value.command,category:r.value.category})});if(!n.ok)throw await Ih(n);return Ku(await n.json())}async update(e,t,s,r){const n=nd(t,s,r);if(!n.ok)throw new Vr(n.error);const o=await fetch(\`/api/snippets/\${encodeURIComponent(e)}\`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n.value.name,command:n.value.command,category:n.value.category})});if(!o.ok)throw await Ih(o);return Ku(await o.json())}async remove(e){const t=await fetch(\`/api/snippets/\${encodeURIComponent(e)}\`,{method:"DELETE"});if(!t.ok)throw await Ih(t)}}const E1="cloudssh_snippets";function D4(i){if(!i||typeof i!=="object")return false;const e=i;return typeof e.id==="string"&&typeof e.name==="string"&&typeof e.command==="string"&&(e.category===void 0||typeof e.category==="string")&&typeof e.createdAt==="string"&&typeof e.updatedAt==="string"}class z4{constructor(e=localStorage){this.storage=e}async list(){return this.read()}async create(e,t,s){const r=nd(e,t,s);if(!r.ok)throw new Vr(r.error);const n=this.read();if(n.length>=_O)throw new Vr("limitReached");const o=new Date().toISOString();const a={id:crypto.randomUUID(),name:r.value.name,command:r.value.command,category:r.value.category,createdAt:o,updatedAt:o};n.push(a);this.write(n);return a}async update(e,t,s,r){const n=nd(t,s,r);if(!n.ok)throw new Vr(n.error);const o=this.read();const a=o.findIndex(h=>h.id===e);if(a<0)throw new Vr("notFound");const l={...o[a],name:n.value.name,command:n.value.command,category:n.value.category,updatedAt:new Date().toISOString()};o[a]=l;this.write(o);return l}async remove(e){this.write(this.read().filter(t=>t.id!==e))}read(){try{const e=this.storage.getItem(E1);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(D4).map(s=>({...s,category:s.category??""}))}catch{return[]}}write(e){this.storage.setItem(E1,JSON.stringify(e))}}function Q1(i){var r;const e=/\\{\\{\\s*([^}]+?)\\s*\\}\\}/g;const t=new Set;const s=[];for(const n of i.matchAll(e)){const o=(r=n[1])==null?void 0:r.trim();if(o&&!t.has(o)){t.add(o);s.push(o)}}return s}function W4(i,e){return i.replace(/\\{\\{\\s*([^}]+?)\\s*\\}\\}/g,(t,s)=>{const r=s.trim();if(Object.hasOwn(e,r)){return e[r]}return t})}const q4="snippet-panel";const X4="snippet-panel-backdrop";const od="";const Jp="__UNCATEGORIZED__";function N4(i,e,t=od){const s=e.trim().toLowerCase();const r=t.trim().toLowerCase();return i.filter(n=>{if(r&&r!==od.toLowerCase()){const o=(n.category||"").trim().toLowerCase();if(r===Jp.toLowerCase()){if(o!=="")return false}else{if(o!==r)return false}}if(s){const o=n.name.toLowerCase().includes(s);const a=n.command.toLowerCase().includes(s);const l=(n.category||"").toLowerCase().includes(s);if(!o&&!a&&!l)return false}return true})}function ie(i,e,t){const s=document.createElement(i);if(e)s.className=e;if(t!==void 0)s.textContent=t;return s}function Ri(i,e="16px"){const t=ie("span","material-symbols-outlined",i);t.style.fontSize=e;return t}class F4{constructor(e){b(this,"panelContainer",null);b(this,"backdropElement",null);b(this,"snippets",[]);b(this,"editingId",null);b(this,"busy",false);b(this,"searchQuery","");b(this,"selectedCategory",od);b(this,"visible",false);b(this,"formExpanded",false);b(this,"localeCleanup",null);b(this,"keydownHandler",e=>{if(!this.visible||document.querySelector("dialog[open]"))return;if(e.key==="Escape"){e.preventDefault();this.close()}});this.deps=e;this.localeCleanup=On(()=>{if(this.visible){this.updateStorageBadge();this.render()}})}get store(){return this.deps.isAuthenticated()?new I4:new z4}async open(){this.ensureElements();if(!this.panelContainer||!this.backdropElement)return;this.visible=true;this.backdropElement.classList.remove("opacity-0","pointer-events-none");this.panelContainer.style.transform="translateX(0)";this.updateStorageBadge();await this.reload();window.addEventListener("keydown",this.keydownHandler);const e=document.getElementById("snippet-search-input");e==null?void 0:e.focus()}close(){if(!this.panelContainer||!this.backdropElement)return;window.removeEventListener("keydown",this.keydownHandler);this.visible=false;this.backdropElement.classList.add("opacity-0","pointer-events-none");this.panelContainer.style.transform="translateX(100%)";this.searchQuery="";const e=document.getElementById("snippet-search-input");if(e)e.value="";const t=document.getElementById("snippet-search-clear-btn");if(t)t.classList.add("hidden");this.collapseForm()}toggle(){if(this.visible){this.close()}else{void this.open()}}destroy(){var e,t;window.removeEventListener("keydown",this.keydownHandler);if(this.localeCleanup){this.localeCleanup();this.localeCleanup=null}(e=this.panelContainer)==null?void 0:e.remove();(t=this.backdropElement)==null?void 0:t.remove();this.panelContainer=null;this.backdropElement=null}async reload(){const e=document.getElementById("snippet-list");try{this.snippets=await this.store.list();this.render()}catch{if(e)e.textContent=g("snippets.loadFailed");Y(g("snippets.loadFailed"),{variant:"danger"})}}ensureElements(){if(this.panelContainer&&this.backdropElement)return;const e=ie("div","fixed inset-0 bg-black/40 z-[95] transition-opacity duration-300 opacity-0 pointer-events-none");e.id=X4;e.addEventListener("click",()=>this.close());this.backdropElement=e;document.body.appendChild(e);const t=ie("div","fixed top-0 right-0 h-full z-[96] flex flex-col bg-surface border-l border-outline-variant shadow-2xl transition-transform duration-300 ease-in-out text-on-surface");t.id=q4;t.style.width="min(clamp(440px, 45vw, 680px), 100vw)";t.style.transform="translateX(100%)";this.panelContainer=t;t.appendChild(this.createHeader());t.appendChild(this.createToolbar());const s=ie("div","px-3 py-2 border-b border-outline-variant bg-surface shrink-0 overflow-x-auto no-scrollbar flex items-center gap-1.5 select-none");s.id="snippet-category-chips";t.appendChild(s);t.appendChild(this.createForm());const r=ie("div","flex-1 overflow-y-auto p-3 space-y-2.5 custom-scrollbar min-h-0");r.id="snippet-list";r.addEventListener("click",n=>{void this.handleListClick(n)});t.appendChild(r);t.appendChild(this.createFooter());t.addEventListener("keydown",n=>{if(n.key==="Escape"){n.stopPropagation();this.close()}});document.body.appendChild(t)}createHeader(){const e=ie("div","sftp-panel-header flex items-center justify-between px-4 h-12 border-b border-outline-variant bg-elevated shrink-0");const t=ie("div","flex items-center gap-2 min-w-0");const s=Ri("code_blocks","18px");s.className="material-symbols-outlined text-primary-container";s.style.fontVariationSettings="'FILL' 1";t.appendChild(s);const r=ie("span","text-xs font-bold tracking-[0.1em] text-primary-container truncate",g("snippets.title"));t.appendChild(r);const n=ie("span","flex items-center gap-1.5 text-[11px] text-muted select-none");n.id="snippet-storage-badge";t.appendChild(n);e.appendChild(t);const o=ie("button","hover:opacity-80 transition-opacity cursor-pointer p-1 text-on-surface-variant");o.id="snippet-close-btn";o.type="button";o.title=g("snippets.close");o.setAttribute("aria-label",g("snippets.close"));o.appendChild(Ri("close","18px"));o.addEventListener("click",()=>this.close());e.appendChild(o);return e}createToolbar(){const e=ie("div","px-3 py-2 border-b border-outline-variant bg-surface flex items-center gap-2 shrink-0");const t=ie("div","flex-1 relative flex items-center min-w-0 h-[30px] rounded border border-outline-variant bg-surface-variant/20 focus-within:border-primary-container");const s=Ri("search","15px");s.className="material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-muted pointer-events-none select-none";t.appendChild(s);const r=ie("input","w-full h-full bg-transparent text-[12px] outline-none terminal-input border-0 font-ui");r.id="snippet-search-input";r.type="search";r.placeholder=g("snippets.searchPlaceholder");r.style.paddingLeft="32px";r.style.paddingRight="28px";const n=ie("button","absolute right-1.5 top-1/2 -translate-y-1/2 text-muted hover:text-primary p-0.5 cursor-pointer hidden");n.id="snippet-search-clear-btn";n.type="button";n.title=g("common.cancel");n.setAttribute("aria-label",g("common.cancel"));n.appendChild(Ri("close","14px"));n.addEventListener("click",()=>{r.value="";this.searchQuery="";n.classList.add("hidden");this.renderList();r.focus()});t.appendChild(n);r.addEventListener("input",()=>{this.searchQuery=r.value;n.classList.toggle("hidden",!r.value.trim());this.renderList()});t.appendChild(r);e.appendChild(t);const o=ie("button","flex items-center gap-1 px-2.5 py-1 h-[30px] text-[11px] font-bold tracking-wider cyber-button text-primary-container shrink-0 cursor-pointer");o.id="snippet-new-btn";o.type="button";o.appendChild(Ri("add","16px"));const a=ie("span",void 0,g("snippets.newSnippet"));a.id="snippet-new-btn-label";o.appendChild(a);o.addEventListener("click",()=>{if(this.formExpanded&&this.editingId===null){this.collapseForm()}else{this.expandForm()}});e.appendChild(o);const l=ie("button","p-1.5 h-[30px] w-[30px] hover:bg-surface-variant rounded transition-colors cursor-pointer text-muted hover:text-primary flex items-center justify-center shrink-0");l.id="snippet-refresh-btn";l.type="button";l.title=g("sftp.refresh");l.appendChild(Ri("refresh","16px"));l.addEventListener("click",async()=>{l.classList.add("animate-spin");try{await this.reload()}finally{setTimeout(()=>l.classList.remove("animate-spin"),300)}});e.appendChild(l);return e}createForm(){const e=ie("div","border-b border-outline-variant bg-surface-variant/10 p-3 space-y-2.5 shrink-0 hidden");e.id="snippet-form-container";const t=ie("div","flex items-center justify-between");const s=ie("div","text-xs font-bold text-primary-container flex items-center gap-1.5");const r=Ri("add_box","16px");r.id="snippet-form-icon";s.appendChild(r);const n=ie("span",void 0,g("snippets.newSnippet"));n.id="snippet-form-title";s.appendChild(n);t.appendChild(s);const o=ie("button","text-muted hover:text-primary text-xs cursor-pointer p-0.5");o.type="button";o.title=g("common.cancel");o.appendChild(Ri("close","14px"));o.addEventListener("click",()=>this.collapseForm());t.appendChild(o);e.appendChild(t);const a=ie("form","space-y-2.5");a.id="snippet-form";a.autocomplete="off";const l=ie("div","grid grid-cols-1 sm:grid-cols-2 gap-2");const h=ie("label","text-[11px] text-muted block",g("snippets.nameLabel"));h.htmlFor="snippet-name-input";const c=ie("input","terminal-input w-full mt-1 text-xs h-[28px] border border-outline-variant bg-surface");c.id="snippet-name-input";c.maxLength=vO;c.placeholder=g("snippets.namePlaceholder");h.appendChild(c);l.appendChild(h);const d=ie("label","text-[11px] text-muted block",g("snippets.categoryLabel"));d.htmlFor="snippet-category-input";const u=ie("input","terminal-input w-full mt-1 text-xs h-[28px] border border-outline-variant bg-surface");u.id="snippet-category-input";u.maxLength=yO;u.placeholder=g("snippets.categoryPlaceholder");u.setAttribute("list","snippet-category-datalist");d.appendChild(u);const f=ie("datalist");f.id="snippet-category-datalist";d.appendChild(f);l.appendChild(d);a.appendChild(l);const p=ie("label","text-[11px] text-muted block",g("snippets.commandLabel"));p.htmlFor="snippet-command-input";const m=ie("textarea","terminal-input w-full mt-1 font-code text-xs border border-outline-variant bg-surface custom-scrollbar");m.id="snippet-command-input";m.rows=3;m.maxLength=bO;m.placeholder=g("snippets.commandPlaceholder");p.appendChild(m);a.appendChild(p);const O=ie("p","text-[11px] text-muted opacity-80 select-none leading-relaxed font-ui flex items-center gap-1");const v=ie("span","text-primary-container font-code font-bold text-[11px]","[!]");O.appendChild(v);const T=ie("span",void 0,g("snippets.variableHint").replace(/^\\[!\\]\\s*/,""));O.appendChild(T);a.appendChild(O);const k=ie("div","flex items-center justify-end gap-2 pt-1");const _=ie("button","cyber-button px-3 py-1 text-xs text-muted cursor-pointer",g("common.cancel"));_.type="button";_.addEventListener("click",()=>this.collapseForm());k.appendChild(_);const C=ie("button","cyber-button text-primary-container px-4 py-1 text-xs font-bold flex items-center gap-1 cursor-pointer");C.type="submit";C.id="snippet-save-btn";C.appendChild(Ri("save","14px"));const w=ie("span",void 0,g("common.save"));w.id="snippet-save-label";C.appendChild(w);k.appendChild(C);a.appendChild(k);a.addEventListener("submit",Q=>{Q.preventDefault();void this.save()});e.appendChild(a);return e}createFooter(){const e=ie("div","h-10 border-t border-outline-variant bg-elevated px-4 flex items-center justify-between text-[11px] text-muted shrink-0 select-none");const t=ie("span");t.id="snippet-footer-status";e.appendChild(t);const s=ie("span","text-[10px] opacity-60","Esc");e.appendChild(s);return e}updateStorageBadge(){const e=document.getElementById("snippet-storage-badge");if(!e)return;const t=this.deps.isAuthenticated();e.textContent="";const s=ie("span",\`w-1.5 h-1.5 rounded-full shrink-0 \${t?"bg-primary-container shadow-[0_0_6px_var(--accent)]":"bg-muted/60"}\`);const r=ie("span","text-[11px] text-muted select-none",t?g("snippets.cloudSync"):g("snippets.localStore"));e.appendChild(s);e.appendChild(r)}render(){this.renderCategoryChips();this.updateCategorySuggestions();this.renderList()}updateCategorySuggestions(){const e=document.getElementById("snippet-category-datalist");if(!e)return;e.textContent="";const t=[...new Set(this.snippets.map(s=>(s.category||"").trim()).filter(s=>s.length>0))].sort((s,r)=>s.localeCompare(r));for(const s of t){const r=ie("option");r.value=s;e.appendChild(r)}}renderCategoryChips(){const e=document.getElementById("snippet-category-chips");if(!e)return;e.textContent="";const t=new Map;let s=0;for(const o of this.snippets){const a=(o.category||"").trim();if(!a){s++}else{t.set(a,(t.get(a)||0)+1)}}const r=[{key:od,label:g("snippets.allCategories"),count:this.snippets.length}];const n=[...t.keys()].sort((o,a)=>o.localeCompare(a));for(const o of n){r.push({key:o,label:o,count:t.get(o)||0})}if(s>0){r.push({key:Jp,label:g("snippets.uncategorized"),count:s})}for(const o of r){const a=this.selectedCategory.toLowerCase()===o.key.toLowerCase();const l=ie("button",\`shrink-0 text-[11px] px-2.5 py-0.5 rounded-full border transition-all cursor-pointer flex items-center gap-1.5 \${a?"bg-primary-container/20 text-primary-container border-primary-container font-bold shadow-sm":"border-outline-variant/60 hover:border-primary-container/60 text-muted hover:text-primary bg-surface-variant/20"}\`);l.type="button";const h=ie("span",void 0,o.label);l.appendChild(h);const c=ie("span",\`text-[10px] px-1 rounded-full \${a?"bg-primary-container text-on-primary font-bold":"bg-surface-variant/50 text-muted"}\`,String(o.count));l.appendChild(c);l.addEventListener("click",()=>{if(this.selectedCategory!==o.key){this.selectedCategory=o.key;this.render()}});e.appendChild(l)}}renderList(){const e=document.getElementById("snippet-list");const t=document.getElementById("snippet-footer-status");if(!e)return;e.textContent="";const s=N4(this.snippets,this.searchQuery,this.selectedCategory);if(t){t.textContent=\`\${g("snippets.statusCount",{filtered:s.length,total:this.snippets.length})} · \${g("snippets.capacity",{count:this.snippets.length,max:_O})}\`}if(this.snippets.length===0){const r=ie("div","flex flex-col items-center justify-center h-48 text-muted space-y-2");const n=Ri("inbox","36px");n.className="material-symbols-outlined opacity-40";r.appendChild(n);r.appendChild(ie("p","text-xs",g("snippets.empty")));e.appendChild(r);return}if(s.length===0){const r=ie("div","flex flex-col items-center justify-center h-48 text-muted space-y-2");const n=Ri("search_off","36px");n.className="material-symbols-outlined opacity-40";r.appendChild(n);r.appendChild(ie("p","text-xs",g("snippets.noMatches")));e.appendChild(r);return}for(const r of s){e.appendChild(this.buildSnippetCard(r))}}buildSnippetCard(e){const t=ie("div","border border-outline-variant/70 hover:border-primary-container/80 bg-surface-variant/10 rounded p-3 transition-all space-y-2");t.dataset.snippetId=e.id;const s=ie("div","flex items-start justify-between gap-2");const r=ie("div","flex-1 min-w-0");const n=ie("div","text-xs font-bold text-primary-container truncate",e.name);r.appendChild(n);const o=ie("div","flex items-center gap-2 mt-1 flex-wrap");if(e.category&&e.category.trim()){const c=ie("span","text-[11px] text-muted/80 flex items-center gap-0.5 select-none");const d=ie("span","text-primary-container font-code font-bold text-[11px]","#");const u=ie("span",void 0,e.category.trim());c.appendChild(d);c.appendChild(u);o.appendChild(c)}const a=Q1(e.command);if(a.length>0){const c=ie("span","text-[11px] text-muted/70 flex items-center gap-1 select-none font-code");const d=ie("span","text-secondary-container text-[11px]","{ }");const u=ie("span","font-ui text-[11px]",\`\${g("snippets.hasVariables")} (\${a.map(f=>\`{{\${f}}}\`).join(", ")})\`);c.appendChild(d);c.appendChild(u);o.appendChild(c)}r.appendChild(o);s.appendChild(r);const l=ie("div","flex items-center gap-1 shrink-0");l.appendChild(this.buildActionButton("copy","content_copy",g("common.copy"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("insert","input",g("snippets.insert"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("insert_and_run","play_arrow",g("snippets.insertAndRun"),"hover:text-secondary-container"));l.appendChild(this.buildActionButton("edit","edit",g("common.edit"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("delete","delete",g("common.delete"),"hover:text-error"));s.appendChild(l);t.appendChild(s);const h=ie("div","bg-surface-container-lowest border border-outline-variant/40 rounded p-2 text-[11px] font-code text-on-surface-variant break-all overflow-x-auto no-scrollbar max-h-[72px] leading-relaxed select-text",e.command);h.style.whiteSpace="pre-wrap";t.appendChild(h);return t}buildActionButton(e,t,s,r="hover:text-primary"){const n=ie("button",\`text-muted \${r} p-1 rounded hover:bg-surface-variant/40 transition-colors cursor-pointer shrink-0\`);n.type="button";n.dataset.action=e;n.setAttribute("aria-label",s);n.title=s;n.appendChild(Ri(t,"15px"));return n}expandForm(e){const t=document.getElementById("snippet-form-container");const s=document.getElementById("snippet-form-title");const r=document.getElementById("snippet-form-icon");const n=document.getElementById("snippet-name-input");const o=document.getElementById("snippet-category-input");const a=document.getElementById("snippet-command-input");const l=document.getElementById("snippet-save-label");const h=document.getElementById("snippet-new-btn-label");if(!t)return;this.formExpanded=true;t.classList.remove("hidden");if(e){this.editingId=e.id;if(s)s.textContent=g("snippets.editing");if(r)r.textContent="edit_note";if(l)l.textContent=g("common.save");if(n)n.value=e.name;if(o)o.value=e.category||"";if(a)a.value=e.command;if(h)h.textContent=g("snippets.newSnippet")}else{this.editingId=null;if(s)s.textContent=g("snippets.newSnippet");if(r)r.textContent="add_box";if(l)l.textContent=g("snippets.add");if(n)n.value="";if(o){o.value=this.selectedCategory&&this.selectedCategory!==Jp?this.selectedCategory:""}if(a)a.value="";if(h)h.textContent=g("common.cancel")}n==null?void 0:n.focus()}collapseForm(){const e=document.getElementById("snippet-form-container");const t=document.getElementById("snippet-new-btn-label");if(e)e.classList.add("hidden");if(t)t.textContent=g("snippets.newSnippet");this.formExpanded=false;this.editingId=null;const s=document.getElementById("snippet-name-input");const r=document.getElementById("snippet-category-input");const n=document.getElementById("snippet-command-input");if(s)s.value="";if(r)r.value="";if(n)n.value=""}async handleListClick(e){const t=e.target;const s=t==null?void 0:t.closest("[data-action]");if(!s)return;const r=s.closest("[data-snippet-id]");const n=this.snippets.find(a=>a.id===(r==null?void 0:r.dataset.snippetId));if(!n)return;const o=s.dataset.action;if(o==="insert")await this.insertSnippet(n,false);else if(o==="insert_and_run")await this.insertSnippet(n,true);else if(o==="copy")void this.copySnippet(n);else if(o==="edit")this.expandForm(n);else if(o==="delete")await this.deleteSnippet(n)}async copySnippet(e){const t=await Hn(e.command);if(t){Y(g("snippets.copied"),{variant:"success"})}else{Y(g("snippets.copyFailed"),{variant:"danger"})}}async insertSnippet(e,t){const s=this.deps.getTerminal();if(!s){Y(g("snippets.noActiveTerminal"),{variant:"warning"});return}let r=e.command;const n=Q1(e.command);if(n.length>0){const o={};for(const a of n){const l=await su({title:g("snippets.variableTitle"),message:g("snippets.promptVariable",{name:a}),label:a,placeholder:a,confirmText:g("common.confirm"),cancelText:g("common.cancel")});if(l===null){return}o[a]=l}r=W4(e.command,o)}if(!s.insertSnippet(r,t)){Y(g("snippets.insertFailed"),{variant:"warning"});return}this.close()}async save(){if(this.busy)return;const e=document.getElementById("snippet-name-input");const t=document.getElementById("snippet-category-input");const s=document.getElementById("snippet-command-input");const r=document.getElementById("snippet-save-btn");if(!e||!s)return;const n=e.value;const o=(t==null?void 0:t.value)??"";const a=s.value;this.busy=true;if(r)r.disabled=true;try{if(this.editingId){await this.store.update(this.editingId,n,a,o)}else{await this.store.create(n,a,o)}Y(g("snippets.saved"),{variant:"success"});this.collapseForm();await this.reload()}catch(l){Y($1(l),{variant:"danger"})}finally{this.busy=false;if(r)r.disabled=false}}async deleteSnippet(e){const t=await Ui({title:g("snippets.deleteTitle"),message:g("snippets.deleteMessage",{name:e.name}),confirmText:g("common.delete")});if(!t)return;try{await this.store.remove(e.id);Y(g("snippets.deleted"),{variant:"success"});await this.reload()}catch(s){Y($1(s),{variant:"danger"})}}}/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function R1(i,e){(null==e||e>i.length)&&(e=i.length);for(var t=0,s=Array(e);t2?s-2:0),n=2;n1?t-1:0),r=1;r1?t-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Ja;if(A1){A1(i,null)}if(!Fr(e)){return i}let s=e.length;while(s--){let r=e[s];if(typeof r==="string"){const n=t(r);if(n!==r){if(!Y4(e)){e[s]=n}r=n}}i[r]=true}return i}function n$(i){for(let e=0;e/g);const u$=Zt(/\\\${[\\w\\W]*/g);const f$=Zt(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/);const p$=Zt(/^aria-[\\-\\w]+$/);const N1=Zt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i);const m$=Zt(/^(?:\\w+script|data):/i);const g$=Zt(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g);const O$=Zt(/^html$/i);const _$=Zt(/^[a-z][.\\w]*(-[.\\w]+)+$/i);const F1=Zt(/<[/\\w!]/g);const Z1=Zt(/<[/\\w]/g);const v$=Zt(/<\\/no(script|embed|frames)/i);const y$=Zt(/\\/>/i);const vi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12};const b$=function i(){return typeof window==="undefined"?null:window};const S$=function i(e,t){if(typeof e!=="object"||typeof e.createPolicy!=="function"){return null}let s=null;const r="data-tt-policy-suffix";if(t&&t.hasAttribute(r)){s=t.getAttribute(r)}const n="dompurify"+(s?"#"+s:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch(o){console.warn("TrustedTypes policy "+n+" could not be created.");return null}};const U1=function i(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};const Er=function i(e,t,s,r){return St(e,t)&&Fr(e[t])?be(r.base?jt(r.base):{},e[t],r.transform):s};function Aw(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b$();const e=U=>Aw(U);e.version="3.4.13";e.removed=[];if(!i||!i.document||i.document.nodeType!==vi.document||!i.Element){e.isSupported=false;return e}let t=i.document;const s=t;const r=s.currentScript;i.DocumentFragment;const n=i.HTMLTemplateElement,o=i.Node,a=i.Element,l=i.NodeFilter,h=i.NamedNodeMap;h===void 0?i.NamedNodeMap||i.MozNamedAttrMap:h;i.HTMLFormElement;const c=i.DOMParser,d=i.trustedTypes;const u=a.prototype;const f=Gi(u,"cloneNode");const p=Gi(u,"remove");const m=Gi(u,"nextSibling");const O=Gi(u,"childNodes");const v=Gi(u,"parentNode");const T=Gi(u,"shadowRoot");const k=Gi(u,"attributes");const _=o&&o.prototype?Gi(o.prototype,"nodeType"):null;const C=o&&o.prototype?Gi(o.prototype,"nodeName"):null;const w=o&&o.prototype?Gi(o.prototype,"ownerDocument"):null;if(typeof n==="function"){const U=t.createElement("template");if(U.content&&U.content.ownerDocument){t=U.content.ownerDocument}}let Q;let D="";let I;let F=false;let X=0;const x=function U(){if(X>0){throw bn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')}};const y=function U(S){x();X++;try{return Q.createHTML(S)}finally{X--}};const $=function U(S){x();X++;try{return Q.createScriptURL(S)}finally{X--}};const E=function U(){if(!F){I=S$(d,r);F=true}return I};const R=t,A=R.implementation,B=R.createNodeIterator,M=R.createDocumentFragment,q=R.getElementsByTagName;const re=s.importNode;let ee=U1();e.isSupported=typeof Qw==="function"&&typeof v==="function"&&A&&A.createHTMLDocument!==void 0;const ne=c$,Ie=d$,pe=u$,De=f$,ke=p$,Ae=m$,lt=g$,di=_$;let Qi=N1;let ve=null;const ei=be({},[...z1,...ef,...tf,...sf,...W1]);let oe=null;const Vs=be({},[...q1,...rf,...X1,...Dh]);let Fe=Object.seal($o(null,{tagNameCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeNameCheck:{writable:true,configurable:false,enumerable:true,value:null},allowCustomizedBuiltInElements:{writable:true,configurable:false,enumerable:true,value:false}}));let Ys=null;let xa=null;const Yi=Object.seal($o(null,{tagCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeCheck:{writable:true,configurable:false,enumerable:true,value:null}}));let kh=true;let Bu=true;let J0=false;let e1=true;let Tr=false;let Pr=true;let vn=false;let Iu=false;let Ch=null;let Th=null;let Du=false;let mo=false;let Ph=false;let $h=false;let t1=true;let i1=false;const s1="user-content-";let zu=true;let Eh=false;let go={};let hs=null;const Wu=be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let r1=null;const n1=be({},["audio","video","img","source","image","track"]);let qu=null;const o1=be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]);const Qh="http://www.w3.org/1998/Math/MathML";const Rh="http://www.w3.org/2000/svg";const cs="http://www.w3.org/1999/xhtml";let Oo=cs;let Xu=false;let Nu=null;const LT=be({},[Qh,Rh,cs],Ju);const a1=Nt(["mi","mo","mn","ms","mtext"]);let Fu=be({},a1);const l1=Nt(["annotation-xml"]);let Zu=be({},l1);const MT=be({},["title","style","font","a","script"]);let ka=null;const BT=["application/xhtml+xml","text/html"];const IT="text/html";let He=null;let _o=null;const DT=t.createElement("form");const h1=function U(S){return S instanceof RegExp||S instanceof Function};const Uu=function U(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_o&&_o===S){return}if(!S||typeof S!=="object"){S={}}S=jt(S);ka=BT.indexOf(S.PARSER_MEDIA_TYPE)===-1?IT:S.PARSER_MEDIA_TYPE;He=ka==="application/xhtml+xml"?Ju:Ja;ve=Er(S,"ALLOWED_TAGS",ei,{transform:He});oe=Er(S,"ALLOWED_ATTR",Vs,{transform:He});Nu=Er(S,"ALLOWED_NAMESPACES",LT,{transform:Ju});qu=Er(S,"ADD_URI_SAFE_ATTR",o1,{transform:He,base:o1});r1=Er(S,"ADD_DATA_URI_TAGS",n1,{transform:He,base:n1});hs=Er(S,"FORBID_CONTENTS",Wu,{transform:He});Ys=Er(S,"FORBID_TAGS",jt({}),{transform:He});xa=Er(S,"FORBID_ATTR",jt({}),{transform:He});go=St(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES==="object"?jt(S.USE_PROFILES):S.USE_PROFILES:false;kh=S.ALLOW_ARIA_ATTR!==false;Bu=S.ALLOW_DATA_ATTR!==false;J0=S.ALLOW_UNKNOWN_PROTOCOLS||false;e1=S.ALLOW_SELF_CLOSE_IN_ATTR!==false;Tr=S.SAFE_FOR_TEMPLATES||false;Pr=S.SAFE_FOR_XML!==false;vn=S.WHOLE_DOCUMENT||false;mo=S.RETURN_DOM||false;Ph=S.RETURN_DOM_FRAGMENT||false;$h=S.RETURN_TRUSTED_TYPE||false;Du=S.FORCE_BODY||false;t1=S.SANITIZE_DOM!==false;i1=S.SANITIZE_NAMED_PROPS||false;zu=S.KEEP_CONTENT!==false;Eh=S.IN_PLACE||false;Qi=a$(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:N1;Oo=typeof S.NAMESPACE==="string"?S.NAMESPACE:cs;Fu=St(S,"MATHML_TEXT_INTEGRATION_POINTS")&&S.MATHML_TEXT_INTEGRATION_POINTS&&typeof S.MATHML_TEXT_INTEGRATION_POINTS==="object"?jt(S.MATHML_TEXT_INTEGRATION_POINTS):be({},a1);Zu=St(S,"HTML_INTEGRATION_POINTS")&&S.HTML_INTEGRATION_POINTS&&typeof S.HTML_INTEGRATION_POINTS==="object"?jt(S.HTML_INTEGRATION_POINTS):be({},l1);const L=St(S,"CUSTOM_ELEMENT_HANDLING")&&S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING==="object"?jt(S.CUSTOM_ELEMENT_HANDLING):$o(null);Fe=$o(null);if(St(L,"tagNameCheck")&&h1(L.tagNameCheck)){Fe.tagNameCheck=L.tagNameCheck}if(St(L,"attributeNameCheck")&&h1(L.attributeNameCheck)){Fe.attributeNameCheck=L.attributeNameCheck}if(St(L,"allowCustomizedBuiltInElements")&&typeof L.allowCustomizedBuiltInElements==="boolean"){Fe.allowCustomizedBuiltInElements=L.allowCustomizedBuiltInElements}Zt(Fe);if(Tr){Bu=false}if(Ph){mo=true}if(go){ve=be({},W1);oe=$o(null);if(go.html===true){be(ve,z1);be(oe,q1)}if(go.svg===true){be(ve,ef);be(oe,rf);be(oe,Dh)}if(go.svgFilters===true){be(ve,tf);be(oe,rf);be(oe,Dh)}if(go.mathMl===true){be(ve,sf);be(oe,X1);be(oe,Dh)}}Yi.tagCheck=null;Yi.attributeCheck=null;if(St(S,"ADD_TAGS")){if(typeof S.ADD_TAGS==="function"){Yi.tagCheck=S.ADD_TAGS}else if(Fr(S.ADD_TAGS)){if(ve===ei){ve=jt(ve)}be(ve,S.ADD_TAGS,He)}}if(St(S,"ADD_ATTR")){if(typeof S.ADD_ATTR==="function"){Yi.attributeCheck=S.ADD_ATTR}else if(Fr(S.ADD_ATTR)){if(oe===Vs){oe=jt(oe)}be(oe,S.ADD_ATTR,He)}}if(St(S,"ADD_URI_SAFE_ATTR")&&Fr(S.ADD_URI_SAFE_ATTR)){be(qu,S.ADD_URI_SAFE_ATTR,He)}if(St(S,"FORBID_CONTENTS")&&Fr(S.FORBID_CONTENTS)){if(hs===Wu){hs=jt(hs)}be(hs,S.FORBID_CONTENTS,He)}if(St(S,"ADD_FORBID_CONTENTS")&&Fr(S.ADD_FORBID_CONTENTS)){if(hs===Wu){hs=jt(hs)}be(hs,S.ADD_FORBID_CONTENTS,He)}if(zu){ve["#text"]=true}if(vn){be(ve,["html","head","body"])}if(ve.table){be(ve,["tbody"]);delete Ys.tbody}if(S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!=="function"){throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.')}if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!=="function"){throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.')}const N=Q;Q=S.TRUSTED_TYPES_POLICY;try{D=y("")}catch(se){Q=N;throw se}}else if(S.TRUSTED_TYPES_POLICY===null){Q=void 0;D=""}else{if(Q===void 0){Q=E()}if(Q&&typeof D==="string"){D=y("")}}if(Nt){Nt(S)}_o=S};const c1=be({},[...ef,...tf,...l$]);const d1=be({},[...sf,...h$]);const zT=function U(S,L,N){if(L.namespaceURI===cs){return S==="svg"}if(L.namespaceURI===Qh){return S==="svg"&&(N==="annotation-xml"||Fu[N])}return Boolean(c1[S])};const WT=function U(S,L,N){if(L.namespaceURI===cs){return S==="math"}if(L.namespaceURI===Rh){return S==="math"&&Zu[N]}return Boolean(d1[S])};const qT=function U(S,L,N){if(L.namespaceURI===Rh&&!Zu[N]){return false}if(L.namespaceURI===Qh&&!Fu[N]){return false}return!d1[S]&&(MT[S]||!c1[S])};const XT=function U(S){let L=v(S);if(!L||!L.tagName){L={namespaceURI:Oo,tagName:"template"}}const N=Ja(S.tagName);const se=Ja(L.tagName);if(!Nu[S.namespaceURI]){return false}if(S.namespaceURI===Rh){return zT(N,L,se)}if(S.namespaceURI===Qh){return WT(N,L,se)}if(S.namespaceURI===cs){return qT(N,L,se)}if(ka==="application/xhtml+xml"&&Nu[S.namespaceURI]){return true}return false};const $r=function U(S){So(e.removed,{element:S});try{v(S).removeChild(S)}catch(L){p(S);if(!v(S)){throw bn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}}};const Ah=function U(S){Ca(S);const L=O(S);if(L){const se=[];bo(L,le=>{So(se,le)});bo(se,le=>{try{p(le)}catch(me){}})}const N=k(S);if(N){for(let se=N.length-1;se>=0;--se){const le=N[se];const me=le&&le.name;if(typeof me==="string"){try{S.removeAttribute(me)}catch(Le){}}}}};const yn=function U(S,L){try{So(e.removed,{attribute:L.getAttributeNode(S),from:L})}catch(N){So(e.removed,{attribute:null,from:L})}L.removeAttribute(S);if(S==="is"){if(mo||Ph){try{$r(L)}catch(N){}}else{try{L.setAttribute(S,"")}catch(N){}}}};const NT=function U(S){const L=k(S);if(!L){return}for(let N=L.length-1;N>=0;--N){const se=L[N];const le=se&&se.name;if(typeof le!=="string"||oe[He(le)]){continue}try{S.removeAttribute(le)}catch(me){}}};const Ca=function U(S){const L=[S];while(L.length>0){const N=L.pop();const se=_?_(N):N.nodeType;if(se===vi.element){NT(N)}const le=O(N);if(le){for(let me=le.length-1;me>=0;--me){L.push(le[me])}}}};const FT=function U(S){if(!Pr){return}const L=[S];while(L.length>0){const N=L.pop();const se=_?_(N):N.nodeType;if(se===vi.processingInstruction||se===vi.comment&&bt(Z1,N.data)){try{p(N)}catch(me){}continue}if(se===vi.element){const me=N;const Le=He(C?C(N):N.nodeName);try{if(me.hasAttribute&&me.hasAttribute("patchsrc")){me.removeAttribute("patchsrc")}if(me.hasAttribute&&me.hasAttribute("for")&&Le!=="label"&&Le!=="output"){me.removeAttribute("for")}}catch(Ve){}}const le=O(N);if(le){for(let me=le.length-1;me>=0;--me){L.push(le[me])}}}};const u1=function U(S){let L=null;let N=null;if(Du){S=""+S}else{const me=M1(S,/^[\\r\\n\\t ]+/);N=me&&me[0]}if(ka==="application/xhtml+xml"&&Oo===cs){S=''+S+""}const se=Q?y(S):S;if(Oo===cs){try{L=new c().parseFromString(se,ka)}catch(me){}}if(!L||!L.documentElement){L=A.createDocument(Oo,"template",null);try{L.documentElement.innerHTML=Xu?D:se}catch(me){}}const le=L.body||L.documentElement;if(S&&N){le.insertBefore(t.createTextNode(N),le.childNodes[0]||null)}if(Oo===cs){return q.call(L,vn?"html":"body")[0]}return vn?L.documentElement:le};const f1=function U(S){const L=w?w(S):S.ownerDocument;return B.call(L||S,S,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)};const Lh=function U(S){S=Pa(S,ne," ");S=Pa(S,Ie," ");S=Pa(S,pe," ");return S};const ju=function U(S){var L;S.normalize();const N=w?w(S):S.ownerDocument;const se=B.call(N||S,S,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let le=se.nextNode();while(le){le.data=Lh(le.data);le=se.nextNode()}const me=(L=S.querySelectorAll)===null||L===void 0?void 0:L.call(S,"template");if(me){bo(me,Le=>{if(vo(Le.content)){ju(Le.content)}})}};const Mh=function U(S){const L=C?C(S):null;if(typeof L!=="string"){return false}if(He(L)!=="form"){return false}return typeof S.nodeName!=="string"||typeof S.textContent!=="string"||typeof S.removeChild!=="function"||S.attributes!==k(S)||typeof S.removeAttribute!=="function"||typeof S.setAttribute!=="function"||typeof S.namespaceURI!=="string"||typeof S.insertBefore!=="function"||typeof S.hasChildNodes!=="function"||S.nodeType!==_(S)||S.childNodes!==O(S)};const vo=function U(S){if(!_||typeof S!=="object"||S===null){return false}try{return _(S)===vi.documentFragment}catch(L){return false}};const Ta=function U(S){if(!_||typeof S!=="object"||S===null){return false}try{return typeof _(S)==="number"}catch(L){return false}};function ds(U,S,L){if(U.length===0){return}bo(U,N=>{N.call(e,S,L,_o)})}const ZT=function U(S,L){if(Pr&&S.hasChildNodes()&&!Ta(S.firstElementChild)&&bt(F1,S.textContent)&&bt(F1,S.innerHTML)){return true}if(Pr&&S.namespaceURI===cs&&L==="style"&&Ta(S.firstElementChild)){return true}if(S.nodeType===vi.processingInstruction){return true}if(Pr&&S.nodeType===vi.comment&&bt(Z1,S.data)){return true}return false};const UT=function U(S,L,N){if(!Ys[L]&&O1(L)){if(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,L)){return false}if(Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(L)){return false}}if(zu&&!hs[L]){const se=v(S);const le=O(S);if(le&&se){const me=le.length;for(let Le=me-1;Le>=0;--Le){const Ve=S===N?f(le[Le],true):le[Le];se.insertBefore(Ve,m(S))}}}$r(S);return true};const p1=function U(S,L,N,se){if(S.length===0){return L}return L===N||L===se?jt(L):L};const m1=function U(S,L){ds(ee.beforeSanitizeElements,S,null);if(S!==L&&v(S)===null){if(Eh){Ca(S)}return true}if(Mh(S)){$r(S);return true}const N=He(C?C(S):S.nodeName);ve=p1(ee.uponSanitizeElement,ve,ei,Ch);ds(ee.uponSanitizeElement,S,{tagName:N,allowedTags:ve});if(S!==L&&v(S)===null){if(Eh){Ca(S)}return true}if(ZT(S,N)){$r(S);return true}if(Ys[N]||!(Yi.tagCheck instanceof Function&&Yi.tagCheck(N))&&!ve[N]){const le=UT(S,N,L);if(le===false){ds(ee.afterSanitizeElements,S,null)}return le}const se=_?_(S):S.nodeType;if(se===vi.element&&!XT(S)){$r(S);return true}if((N==="noscript"||N==="noembed"||N==="noframes")&&bt(v$,S.innerHTML)){$r(S);return true}if(Tr&&S.nodeType===vi.text){const le=Lh(S.textContent);if(S.textContent!==le){So(e.removed,{element:S.cloneNode()});S.textContent=le}}ds(ee.afterSanitizeElements,S,null);return false};const g1=function U(S,L,N){if(xa[L]){return false}if(Pr&&L==="patchsrc"){return false}if(Pr&&L==="for"&&S!=="label"&&S!=="output"){return false}if(t1&&(L==="id"||L==="name")&&(N in t||N in DT)){return false}const se=oe[L]||Yi.attributeCheck instanceof Function&&Yi.attributeCheck(L,S);if(Bu&&bt(De,L));else if(kh&&bt(ke,L));else if(!se){if(O1(S)&&(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,S)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(S))&&(Fe.attributeNameCheck instanceof RegExp&&bt(Fe.attributeNameCheck,L)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(L,S))||L==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,N)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(N)));else{return false}}else if(qu[L]);else if(bt(Qi,Pa(N,lt,"")));else if((L==="src"||L==="xlink:href"||L==="href")&&S!=="script"&&B1(N,"data:")===0&&r1[S]);else if(J0&&!bt(Ae,Pa(N,lt,"")));else if(N){return false}else;return true};const jT=be({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]);const O1=function U(S){return!jT[Ja(S)]&&bt(di,S)};const HT=function U(S,L,N,se){if(Q&&typeof d==="object"&&typeof d.getAttributeType==="function"&&!N){switch(d.getAttributeType(S,L)){case"TrustedHTML":{return y(se)}case"TrustedScriptURL":{return $(se)}}}return se};const VT=function U(S,L,N,se){try{if(N){S.setAttributeNS(N,L,se)}else{S.setAttribute(L,se)}if(Mh(S)){$r(S)}else{L1(e.removed)}}catch(le){yn(L,S)}};const _1=function U(S){ds(ee.beforeSanitizeAttributes,S,null);const L=S.attributes;if(!L||Mh(S)){return}oe=p1(ee.uponSanitizeAttribute,oe,Vs,Th);const N={attrName:"",attrValue:"",keepAttr:true,allowedAttributes:oe,forceKeepAttr:void 0};let se=L.length;const le=He(S.nodeName);while(se--){const me=L[se];const Le=me.name,Ve=me.namespaceURI,ui=me.value;const fi=He(Le);const Vu=ui;let ti=Le==="value"?Vu:t$(Vu);N.attrName=fi;N.attrValue=ti;N.keepAttr=true;N.forceKeepAttr=void 0;ds(ee.uponSanitizeAttribute,S,N);ti=N.attrValue;if(i1&&(fi==="id"||fi==="name")&&B1(ti,s1)!==0){yn(Le,S);ti=s1+ti}if(Pr&&bt(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ti)){yn(Le,S);continue}if(fi==="attributename"&&M1(ti,"href")){yn(Le,S);continue}if(N.forceKeepAttr){continue}if(!N.keepAttr){yn(Le,S);continue}if(!e1&&bt(y$,ti)){yn(Le,S);continue}if(Tr){ti=Lh(ti)}if(!g1(le,fi,ti)){yn(Le,S);continue}ti=HT(le,fi,Ve,ti);if(ti!==Vu){VT(S,Le,Ve,ti)}}ds(ee.afterSanitizeAttributes,S,null)};const Bh=function U(S){let L=null;const N=f1(S);ds(ee.beforeSanitizeShadowDOM,S,null);while(L=N.nextNode()){ds(ee.uponSanitizeShadowNode,L,null);m1(L,S);_1(L);if(vo(L.content)){Bh(L.content)}const se=_?_(L):L.nodeType;if(se===vi.element){const le=T(L);if(vo(le)){Hu(le);Bh(le)}}}ds(ee.afterSanitizeShadowDOM,S,null)};const Hu=function U(S){const L=[{node:S,shadow:null}];while(L.length>0){const N=L.pop();if(N.shadow){Bh(N.shadow);continue}const se=N.node;const le=_?_(se):se.nodeType;const me=le===vi.element;const Le=O(se);if(Le){for(let Ve=Le.length-1;Ve>=0;--Ve){L.push({node:Le[Ve],shadow:null})}}if(me){const Ve=C?C(se):null;if(typeof Ve==="string"&&He(Ve)==="template"){const ui=se.content;if(vo(ui)){L.push({node:ui,shadow:null})}}}if(me){const Ve=T(se);if(vo(Ve)){L.push({node:null,shadow:Ve},{node:Ve,shadow:null})}}}};e.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};let L=null;let N=null;let se=null;let le=null;Xu=!U;if(Xu){U=""}if(typeof U!=="string"&&!Ta(U)){U=o$(U);if(typeof U!=="string"){throw bn("dirty is not a string, aborting")}}if(!e.isSupported){return U}if(Iu){ve=Ch;oe=Th}else{Uu(S)}if(ee.uponSanitizeElement.length>0||ee.uponSanitizeAttribute.length>0){ve=jt(ve)}if(ee.uponSanitizeAttribute.length>0){oe=jt(oe)}e.removed=[];const me=Eh&&typeof U!=="string"&&Ta(U);if(me){FT(U);const ui=C?C(U):U.nodeName;if(typeof ui==="string"){const fi=He(ui);if(!ve[fi]||Ys[fi]){Ah(U);throw bn("root node is forbidden and cannot be sanitized in-place")}}if(Mh(U)){Ah(U);throw bn("root node is clobbered and cannot be sanitized in-place")}try{Hu(U)}catch(fi){Ah(U);throw fi}}else if(Ta(U)){L=u1("");N=L.ownerDocument.importNode(U,true);if(N.nodeType===vi.element&&N.nodeName==="BODY"){L=N}else if(N.nodeName==="HTML"){L=N}else{L.appendChild(N)}Hu(N)}else{if(!mo&&!Tr&&!vn&&U.indexOf("<")===-1){return Q&&$h?y(U):U}L=u1(U);if(!L){return mo?null:$h?D:""}}if(L&&Du){$r(L.firstChild)}const Le=me?U:L;try{const ui=f1(Le);while(se=ui.nextNode()){m1(se,Le);_1(se);if(vo(se.content)){Bh(se.content)}}}catch(ui){if(me){Ah(U);bo(e.removed,fi=>{if(fi.element){Ca(fi.element)}})}throw ui}if(me){bo(e.removed,ui=>{if(ui.element){Ca(ui.element)}});if(Tr){ju(U)}return U}if(mo){if(Tr){ju(L)}if(Ph){le=M.call(L.ownerDocument);while(L.firstChild){le.appendChild(L.firstChild)}}else{le=L}if(oe.shadowroot||oe.shadowrootmode){le=re.call(s,le,true)}return le}let Ve=vn?L.outerHTML:L.innerHTML;if(vn&&ve["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&bt(O$,L.ownerDocument.doctype.name)){Ve="\\n"+Ve}if(Tr){Ve=Lh(Ve)}return Q&&$h?y(Ve):Ve};e.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Uu(U);Iu=true;Ch=ve;Th=oe};e.clearConfig=function(){_o=null;Iu=false;Ch=null;Th=null;Q=I;D=""};e.isValidAttribute=function(U,S,L){if(!_o){Uu({})}const N=He(U);const se=He(S);return g1(N,se,L)};e.addHook=function(U,S){if(typeof S!=="function"){return}if(!St(ee,U)){return}So(ee[U],S)};e.removeHook=function(U,S){if(!St(ee,U)){return void 0}if(S!==void 0){const L=J4(ee[U],S);return L===-1?void 0:e$(ee[U],L,1)[0]}return L1(ee[U])};e.removeHooks=function(U){if(!St(ee,U)){return}ee[U]=[]};e.removeAllHooks=function(){ee=U1()};return e}var w$=Aw();function SO(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var lo=SO();function Lw(i){lo=i}var Pn={exec:()=>null};function wo(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function xe(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(Yt.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var x$=((i="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\\s])\\s+(['"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:i=>new RegExp(\`^( {0,3}\${i})((?:[ ][^\\\\n]*)?(?:\\\\n|$))\`),nextBulletRegex:wo(i=>new RegExp(\`^ {0,\${i}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))\`)),hrRegex:wo(i=>new RegExp(\`^ {0,\${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)\`)),fencesBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}(?:\\\`\\\`\\\`|~~~)\`)),headingBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}#\`)),htmlBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}<(?:[a-z].*>|!--)\`,"i")),blockquoteBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}>\`))};var k$=/^(?:[ \\t]*(?:\\n|$))+/;var C$=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/;var T$=/^ {0,3}(\`{3,}(?=[^\`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~\`]* *(?=\\n|$)|$)/;var hh=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/;var P$=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/;var wO=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/;var Mw=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/;var Bw=xe(Mw).replace(/bull/g,wO).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:\`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,"").getRegex();var $$=xe(Mw).replace(/bull/g,wO).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:\`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex();var xO=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\\n)[^\\n]+)*)/;var E$=/^[^\\n]+/;var kO=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/;var Q$=xe(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace("label",kO).replace("title",/(?:"(?:\\\\"?|[^"\\\\])*"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/).getRegex();var R$=xe(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,wO).getRegex();var ru="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";var CO=/|$))/;var A$=xe("^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:[^\\\\n]*\\\\n+|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>\\\\n*|$)|\\\\n*|$)|\\\\n*|$)|)[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|<(?!script|pre|style|textarea)([a-z][\\\\w-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$))","i").replace("comment",CO).replace("tag",ru).replace("attribute",/ +[a-zA-Z:_][\\w.:-]*(?: *= *"[^"\\n]*"| *= *'[^'\\n]*'| *= *[^\\s"'=<>\`]+)?/).getRegex();var Iw=xe(xO).replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex();var L$=xe(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/).replace("paragraph",Iw).getRegex();var TO={blockquote:L$,code:C$,def:Q$,fences:T$,heading:P$,hr:hh,html:A$,lheading:Bw,list:R$,newline:k$,paragraph:Iw,table:Pn,text:E$};var j1=xe("^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)").replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\\\n]").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex();var M$={...TO,lheading:$$,table:j1,paragraph:xe(xO).replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("table",j1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex()};var B$={...TO,html:xe(\`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+? *(?:\\\\n{2,}|\\\\s*$)|\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))\`).replace("comment",CO).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b").getRegex(),def:/^ *\\[([^\\]]+)\\]: *]+)>?(?: +(["(][^\\n]+[")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:Pn,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:xe(xO).replace("hr",hh).replace("heading",\` *#{1,6} *[^ -]\`).replace("lheading",Bw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};var I$=/^\\\\([!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~])/;var D$=/^(\`+)([^\`]|[^\`][\\s\\S]*?[^\`])\\1(?!\`)/;var Dw=/^( {2,}|\\\\)\\n(?!\\s*$)/;var z$=/^(\`+|[^\`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\\`+)[^\`]+\\k(?!\`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",x$?"(?\`+)[^\`]+\\k(?!\`)/).replace("html",/<(?! )[^<>]*?>/).getRegex();var Ww=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/;var F$=xe(Ww,"u").replace(/punct/g,ma).getRegex();var Z$=xe(Ww,"u").replace(/punct/g,zw).getRegex();var qw="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)";var U$=xe(qw,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var j$=xe(qw,"gu").replace(/notPunctSpace/g,X$).replace(/punctSpace/g,q$).replace(/punct/g,zw).getRegex();var H$=xe("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var V$=xe(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,ma).getRegex();var Y$="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";var G$=xe(Y$,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var K$=xe(/\\\\(punct)/,"gu").replace(/punct/g,ma).getRegex();var J$=xe(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_\`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();var eE=xe(CO).replace("(?:-->|$)","-->").getRegex();var tE=xe("^comment|^|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^|^").replace("comment",eE).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s"'=<>\`]+)?/).getRegex();var ad=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|\`+(?!\`)[^\`]*?\`+(?!\`)|\`\`+(?=\\])|[^\\[\\]\\\\\`])*?/;var iE=xe(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",ad).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]*/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex();var Xw=xe(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",ad).replace("ref",kO).getRegex();var Nw=xe(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",kO).getRegex();var sE=xe("reflink|nolink(?!\\\\()","g").replace("reflink",Xw).replace("nolink",Nw).getRegex();var H1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var $O={_backpedal:Pn,anyPunctuation:K$,autolink:J$,blockSkip:N$,br:Dw,code:D$,del:Pn,delLDelim:Pn,delRDelim:Pn,emStrongLDelim:F$,emStrongRDelimAst:U$,emStrongRDelimUnd:H$,escape:I$,link:iE,nolink:Nw,punctuation:W$,reflink:Xw,reflinkSearch:sE,tag:tE,text:z$,url:Pn};var rE={...$O,link:xe(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",ad).getRegex(),reflink:xe(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",ad).getRegex()};var im={...$O,emStrongRDelimAst:j$,emStrongLDelim:Z$,delLDelim:V$,delRDelim:G$,url:xe(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",H1).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:xe(/^([\`~]+|[^\`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\":">",'"':""","'":"'"};var V1=i=>oE[i];function ws(i,e){if(e){if(Yt.escapeTest.test(i))return i.replace(Yt.escapeReplace,V1)}else if(Yt.escapeTestNoEncode.test(i))return i.replace(Yt.escapeReplaceNoEncode,V1);return i}function Y1(i){try{i=encodeURI(i).replace(Yt.percentDecode,"%")}catch{return null}return i}function G1(i,e){var n;let t=i.replace(Yt.findPipe,(o,a,l)=>{let h=false,c=a;for(;--c>=0&&l[c]==="\\\\";)h=!h;return h?"|":" |"}),s=t.split(Yt.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!((n=s.at(-1))==null?void 0:n.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.lengtht.remove();t.appendChild(n);document.body.appendChild(t);setTimeout(()=>{if(t.parentNode){t.style.transition="opacity 0.3s";t.style.opacity="0";setTimeout(()=>t.remove(),300)}},8e3)}async logout(){try{await fetch("/api/auth/logout",{method:"POST"})}catch{}this.onLogout()}escapeHtml(e){const t=document.createElement("div");t.textContent=e;return t.innerHTML}escapeAttr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}}const x4="v1";const k4=58e3;function C4(i,e,t){return\`cloudssh-resume:\${x4}:\${i}:\${e}:\${t}\`}const T4="cloudssh_device_identity";const P4=1;const Mo="keys";const T1="share-device-signing-v1";function OO(){return typeof crypto!=="undefined"&&typeof crypto.subtle!=="undefined"&&typeof crypto.subtle.generateKey==="function"&&typeof indexedDB!=="undefined"}function $4(){return new Promise((i,e)=>{const t=indexedDB.open(T4,P4);t.onupgradeneeded=()=>{if(!t.result.objectStoreNames.contains(Mo)){t.result.createObjectStore(Mo)}};t.onsuccess=()=>i(t.result);t.onerror=()=>e(t.error??new Error("IndexedDB open failed"))})}async function Pw(){const i=await $4();try{const e=await new Promise((s,r)=>{const n=i.transaction(Mo,"readonly");const o=n.objectStore(Mo).get(T1);o.onsuccess=()=>s(o.result);o.onerror=()=>r(o.error??new Error("IndexedDB read failed"))});if((e==null?void 0:e.publicKey)&&(e==null?void 0:e.privateKey))return e;const t=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},false,["sign","verify"]);await new Promise((s,r)=>{const n=i.transaction(Mo,"readwrite");n.objectStore(Mo).put(t,T1);n.oncomplete=()=>s();n.onerror=()=>r(n.error??new Error("IndexedDB write failed"));n.onabort=()=>r(n.error??new Error("IndexedDB write aborted"))});return t}finally{i.close()}}function $w(i){const e=new Uint8Array(i);let t="";for(let s=0;s{const r=document.getElementById("auth-section");const n=document.getElementById("user-space-section");const o=document.getElementById("terminal-section");if(!r||!n||!o)return;n.classList.add("hidden");n.classList.remove("flex");o.classList.add("hidden");o.classList.remove("flex");r.classList.remove("hidden");r.replaceChildren(M4());cw(r);const a=document.getElementById("share-claim-btn");a==null?void 0:a.addEventListener("click",async()=>{if(t)return;t=true;a.disabled=true;Kp(a,true);const l=document.getElementById("share-claim-error");l==null?void 0:l.classList.add("hidden");try{const h=await Q4();const c=await fetch("/api/share/claim",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i,devicePubKey:h??void 0})});const d=await c.json().catch(()=>({}));if(!c.ok)throw new Error(Ka(d,"share.claimFailed"));e(d)}catch(h){t=false;a.disabled=false;Kp(a,false);if(l){l.textContent=h instanceof Error?h.message:g("share.claimFailed");l.classList.remove("hidden")}}})};s();On(()=>{if(!t&&document.getElementById("share-landing-card"))s()})}function Ew(){const i=document.getElementById("auth-section");if(!i)return;i.classList.remove("hidden");const e=Bt("main","w-full max-w-md relative z-10");const t=Bt("div","cyber-box p-6 text-center");const s=document.createElement("span");s.className="material-symbols-outlined text-muted mb-3";s.style.fontSize="42px";s.textContent="link_off";t.append(s);t.append(Bt("h1","text-base font-bold text-primary mb-3",g("share.endedTitle")));t.append(Bt("p","text-xs text-muted",g("share.endedDescription")));e.append(t);i.replaceChildren(e)}const _O=100;const vO=50;const yO=30;const bO=2e3;function nd(i,e,t){if(typeof i!=="string")return{ok:false,error:"nameRequired"};const s=i.trim();if(!s)return{ok:false,error:"nameRequired"};if([...s].length>vO){return{ok:false,error:"nameTooLong"}}if(typeof e!=="string")return{ok:false,error:"commandRequired"};const r=e.trim();if(!r)return{ok:false,error:"commandRequired"};if([...r].length>bO){return{ok:false,error:"commandTooLong"}}let n="";if(t!==void 0&&t!==null){if(typeof t!=="string"){return{ok:false,error:"categoryTooLong"}}n=t.trim();if([...n].length>yO){return{ok:false,error:"categoryTooLong"}}}return{ok:true,value:{name:s,command:r,category:n}}}class Vr extends Error{constructor(e){super(\`Snippet store error: \${e}\`);this.code=e;this.name="SnippetStoreError"}}function $1(i){if(i instanceof Vr){switch(i.code){case"nameRequired":return g("snippets.error.nameRequired");case"commandRequired":return g("snippets.error.commandRequired");case"nameTooLong":return g("snippets.error.nameTooLong",{max:vO});case"commandTooLong":return g("snippets.error.commandTooLong",{max:bO});case"categoryTooLong":return g("snippets.error.categoryTooLong",{max:yO});case"limitReached":return g("snippets.error.limitReached",{max:_O});case"notFound":return g("snippets.error.notFound");case"network":return g("snippets.error.network");default:return g("snippets.saveFailed")}}return g("snippets.saveFailed")}function Ku(i){return{id:String(i.id),name:i.name,command:i.command,category:i.category??"",createdAt:i.created_at??"",updatedAt:i.updated_at??""}}async function Ih(i){let e="network";try{const t=await i.json();if(t&&typeof t.error==="string")e=t.error}catch{}return new Vr(e)}class I4{async list(){const e=await fetch("/api/snippets");if(!e.ok)throw await Ih(e);const t=await e.json();return Array.isArray(t)?t.map(Ku):[]}async create(e,t,s){const r=nd(e,t,s);if(!r.ok)throw new Vr(r.error);const n=await fetch("/api/snippets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.value.name,command:r.value.command,category:r.value.category})});if(!n.ok)throw await Ih(n);return Ku(await n.json())}async update(e,t,s,r){const n=nd(t,s,r);if(!n.ok)throw new Vr(n.error);const o=await fetch(\`/api/snippets/\${encodeURIComponent(e)}\`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n.value.name,command:n.value.command,category:n.value.category})});if(!o.ok)throw await Ih(o);return Ku(await o.json())}async remove(e){const t=await fetch(\`/api/snippets/\${encodeURIComponent(e)}\`,{method:"DELETE"});if(!t.ok)throw await Ih(t)}}const E1="cloudssh_snippets";function D4(i){if(!i||typeof i!=="object")return false;const e=i;return typeof e.id==="string"&&typeof e.name==="string"&&typeof e.command==="string"&&(e.category===void 0||typeof e.category==="string")&&typeof e.createdAt==="string"&&typeof e.updatedAt==="string"}class z4{constructor(e=localStorage){this.storage=e}async list(){return this.read()}async create(e,t,s){const r=nd(e,t,s);if(!r.ok)throw new Vr(r.error);const n=this.read();if(n.length>=_O)throw new Vr("limitReached");const o=new Date().toISOString();const a={id:crypto.randomUUID(),name:r.value.name,command:r.value.command,category:r.value.category,createdAt:o,updatedAt:o};n.push(a);this.write(n);return a}async update(e,t,s,r){const n=nd(t,s,r);if(!n.ok)throw new Vr(n.error);const o=this.read();const a=o.findIndex(h=>h.id===e);if(a<0)throw new Vr("notFound");const l={...o[a],name:n.value.name,command:n.value.command,category:n.value.category,updatedAt:new Date().toISOString()};o[a]=l;this.write(o);return l}async remove(e){this.write(this.read().filter(t=>t.id!==e))}read(){try{const e=this.storage.getItem(E1);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(D4).map(s=>({...s,category:s.category??""}))}catch{return[]}}write(e){this.storage.setItem(E1,JSON.stringify(e))}}function Q1(i){var r;const e=/\\{\\{\\s*([^}]+?)\\s*\\}\\}/g;const t=new Set;const s=[];for(const n of i.matchAll(e)){const o=(r=n[1])==null?void 0:r.trim();if(o&&!t.has(o)){t.add(o);s.push(o)}}return s}function W4(i,e){return i.replace(/\\{\\{\\s*([^}]+?)\\s*\\}\\}/g,(t,s)=>{const r=s.trim();if(Object.hasOwn(e,r)){return e[r]}return t})}const q4="snippet-panel";const X4="snippet-panel-backdrop";const od="";const Jp="__UNCATEGORIZED__";function N4(i,e,t=od){const s=e.trim().toLowerCase();const r=t.trim().toLowerCase();return i.filter(n=>{if(r&&r!==od.toLowerCase()){const o=(n.category||"").trim().toLowerCase();if(r===Jp.toLowerCase()){if(o!=="")return false}else{if(o!==r)return false}}if(s){const o=n.name.toLowerCase().includes(s);const a=n.command.toLowerCase().includes(s);const l=(n.category||"").toLowerCase().includes(s);if(!o&&!a&&!l)return false}return true})}function ie(i,e,t){const s=document.createElement(i);if(e)s.className=e;if(t!==void 0)s.textContent=t;return s}function Ri(i,e="16px"){const t=ie("span","material-symbols-outlined",i);t.style.fontSize=e;return t}class F4{constructor(e){b(this,"panelContainer",null);b(this,"backdropElement",null);b(this,"snippets",[]);b(this,"editingId",null);b(this,"busy",false);b(this,"searchQuery","");b(this,"selectedCategory",od);b(this,"visible",false);b(this,"formExpanded",false);b(this,"localeCleanup",null);b(this,"keydownHandler",e=>{if(!this.visible||document.querySelector("dialog[open]"))return;if(e.key==="Escape"){e.preventDefault();this.close()}});this.deps=e;this.localeCleanup=On(()=>{if(this.visible){this.updateStorageBadge();this.render()}})}get store(){return this.deps.isAuthenticated()?new I4:new z4}async open(){this.ensureElements();if(!this.panelContainer||!this.backdropElement)return;this.visible=true;this.backdropElement.classList.remove("opacity-0","pointer-events-none");this.panelContainer.style.transform="translateX(0)";this.updateStorageBadge();await this.reload();window.addEventListener("keydown",this.keydownHandler);const e=document.getElementById("snippet-search-input");e==null?void 0:e.focus()}close(){if(!this.panelContainer||!this.backdropElement)return;window.removeEventListener("keydown",this.keydownHandler);this.visible=false;this.backdropElement.classList.add("opacity-0","pointer-events-none");this.panelContainer.style.transform="translateX(100%)";this.searchQuery="";const e=document.getElementById("snippet-search-input");if(e)e.value="";const t=document.getElementById("snippet-search-clear-btn");if(t)t.classList.add("hidden");this.collapseForm()}toggle(){if(this.visible){this.close()}else{void this.open()}}destroy(){var e,t;window.removeEventListener("keydown",this.keydownHandler);if(this.localeCleanup){this.localeCleanup();this.localeCleanup=null}(e=this.panelContainer)==null?void 0:e.remove();(t=this.backdropElement)==null?void 0:t.remove();this.panelContainer=null;this.backdropElement=null}async reload(){const e=document.getElementById("snippet-list");try{this.snippets=await this.store.list();this.render()}catch{if(e)e.textContent=g("snippets.loadFailed");Y(g("snippets.loadFailed"),{variant:"danger"})}}ensureElements(){if(this.panelContainer&&this.backdropElement)return;const e=ie("div","fixed inset-0 bg-black/40 z-[95] transition-opacity duration-300 opacity-0 pointer-events-none");e.id=X4;e.addEventListener("click",()=>this.close());this.backdropElement=e;document.body.appendChild(e);const t=ie("div","fixed top-0 right-0 h-full z-[96] flex flex-col bg-surface border-l border-outline-variant shadow-2xl transition-transform duration-300 ease-in-out text-on-surface");t.id=q4;t.style.width="min(clamp(440px, 45vw, 680px), 100vw)";t.style.transform="translateX(100%)";this.panelContainer=t;t.appendChild(this.createHeader());t.appendChild(this.createToolbar());const s=ie("div","px-3 py-2 border-b border-outline-variant bg-surface shrink-0 overflow-x-auto no-scrollbar flex items-center gap-1.5 select-none");s.id="snippet-category-chips";t.appendChild(s);t.appendChild(this.createForm());const r=ie("div","flex-1 overflow-y-auto p-3 space-y-2.5 custom-scrollbar min-h-0");r.id="snippet-list";r.addEventListener("click",n=>{void this.handleListClick(n)});t.appendChild(r);t.appendChild(this.createFooter());t.addEventListener("keydown",n=>{if(n.key==="Escape"){n.stopPropagation();this.close()}});document.body.appendChild(t)}createHeader(){const e=ie("div","sftp-panel-header flex items-center justify-between px-4 h-12 border-b border-outline-variant bg-elevated shrink-0");const t=ie("div","flex items-center gap-2 min-w-0");const s=Ri("code_blocks","18px");s.className="material-symbols-outlined text-primary-container";s.style.fontVariationSettings="'FILL' 1";t.appendChild(s);const r=ie("span","text-xs font-bold tracking-[0.1em] text-primary-container truncate",g("snippets.title"));t.appendChild(r);const n=ie("span","flex items-center gap-1.5 text-[11px] text-muted select-none");n.id="snippet-storage-badge";t.appendChild(n);e.appendChild(t);const o=ie("button","hover:opacity-80 transition-opacity cursor-pointer p-1 text-on-surface-variant");o.id="snippet-close-btn";o.type="button";o.title=g("snippets.close");o.setAttribute("aria-label",g("snippets.close"));o.appendChild(Ri("close","18px"));o.addEventListener("click",()=>this.close());e.appendChild(o);return e}createToolbar(){const e=ie("div","px-3 py-2 border-b border-outline-variant bg-surface flex items-center gap-2 shrink-0");const t=ie("div","flex-1 relative flex items-center min-w-0 h-[30px] rounded border border-outline-variant bg-surface-variant/20 focus-within:border-primary-container");const s=Ri("search","15px");s.className="material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-muted pointer-events-none select-none";t.appendChild(s);const r=ie("input","w-full h-full bg-transparent text-[12px] outline-none terminal-input border-0 font-ui");r.id="snippet-search-input";r.type="search";r.placeholder=g("snippets.searchPlaceholder");r.style.paddingLeft="32px";r.style.paddingRight="28px";const n=ie("button","absolute right-1.5 top-1/2 -translate-y-1/2 text-muted hover:text-primary p-0.5 cursor-pointer hidden");n.id="snippet-search-clear-btn";n.type="button";n.title=g("common.cancel");n.setAttribute("aria-label",g("common.cancel"));n.appendChild(Ri("close","14px"));n.addEventListener("click",()=>{r.value="";this.searchQuery="";n.classList.add("hidden");this.renderList();r.focus()});t.appendChild(n);r.addEventListener("input",()=>{this.searchQuery=r.value;n.classList.toggle("hidden",!r.value.trim());this.renderList()});t.appendChild(r);e.appendChild(t);const o=ie("button","flex items-center gap-1 px-2.5 py-1 h-[30px] text-[11px] font-bold tracking-wider cyber-button text-primary-container shrink-0 cursor-pointer");o.id="snippet-new-btn";o.type="button";o.appendChild(Ri("add","16px"));const a=ie("span",void 0,g("snippets.newSnippet"));a.id="snippet-new-btn-label";o.appendChild(a);o.addEventListener("click",()=>{if(this.formExpanded&&this.editingId===null){this.collapseForm()}else{this.expandForm()}});e.appendChild(o);const l=ie("button","p-1.5 h-[30px] w-[30px] hover:bg-surface-variant rounded transition-colors cursor-pointer text-muted hover:text-primary flex items-center justify-center shrink-0");l.id="snippet-refresh-btn";l.type="button";l.title=g("sftp.refresh");l.appendChild(Ri("refresh","16px"));l.addEventListener("click",async()=>{l.classList.add("animate-spin");try{await this.reload()}finally{setTimeout(()=>l.classList.remove("animate-spin"),300)}});e.appendChild(l);return e}createForm(){const e=ie("div","border-b border-outline-variant bg-surface-variant/10 p-3 space-y-2.5 shrink-0 hidden");e.id="snippet-form-container";const t=ie("div","flex items-center justify-between");const s=ie("div","text-xs font-bold text-primary-container flex items-center gap-1.5");const r=Ri("add_box","16px");r.id="snippet-form-icon";s.appendChild(r);const n=ie("span",void 0,g("snippets.newSnippet"));n.id="snippet-form-title";s.appendChild(n);t.appendChild(s);const o=ie("button","text-muted hover:text-primary text-xs cursor-pointer p-0.5");o.type="button";o.title=g("common.cancel");o.appendChild(Ri("close","14px"));o.addEventListener("click",()=>this.collapseForm());t.appendChild(o);e.appendChild(t);const a=ie("form","space-y-2.5");a.id="snippet-form";a.autocomplete="off";const l=ie("div","grid grid-cols-1 sm:grid-cols-2 gap-2");const h=ie("label","text-[11px] text-muted block",g("snippets.nameLabel"));h.htmlFor="snippet-name-input";const c=ie("input","terminal-input w-full mt-1 text-xs h-[28px] border border-outline-variant bg-surface");c.id="snippet-name-input";c.maxLength=vO;c.placeholder=g("snippets.namePlaceholder");h.appendChild(c);l.appendChild(h);const d=ie("label","text-[11px] text-muted block",g("snippets.categoryLabel"));d.htmlFor="snippet-category-input";const u=ie("input","terminal-input w-full mt-1 text-xs h-[28px] border border-outline-variant bg-surface");u.id="snippet-category-input";u.maxLength=yO;u.placeholder=g("snippets.categoryPlaceholder");u.setAttribute("list","snippet-category-datalist");d.appendChild(u);const f=ie("datalist");f.id="snippet-category-datalist";d.appendChild(f);l.appendChild(d);a.appendChild(l);const p=ie("label","text-[11px] text-muted block",g("snippets.commandLabel"));p.htmlFor="snippet-command-input";const m=ie("textarea","terminal-input w-full mt-1 font-code text-xs border border-outline-variant bg-surface custom-scrollbar");m.id="snippet-command-input";m.rows=3;m.maxLength=bO;m.placeholder=g("snippets.commandPlaceholder");p.appendChild(m);a.appendChild(p);const O=ie("p","text-[11px] text-muted opacity-80 select-none leading-relaxed font-ui flex items-center gap-1");const v=ie("span","text-primary-container font-code font-bold text-[11px]","[!]");O.appendChild(v);const T=ie("span",void 0,g("snippets.variableHint").replace(/^\\[!\\]\\s*/,""));O.appendChild(T);a.appendChild(O);const k=ie("div","flex items-center justify-end gap-2 pt-1");const _=ie("button","cyber-button px-3 py-1 text-xs text-muted cursor-pointer",g("common.cancel"));_.type="button";_.addEventListener("click",()=>this.collapseForm());k.appendChild(_);const C=ie("button","cyber-button text-primary-container px-4 py-1 text-xs font-bold flex items-center gap-1 cursor-pointer");C.type="submit";C.id="snippet-save-btn";C.appendChild(Ri("save","14px"));const w=ie("span",void 0,g("common.save"));w.id="snippet-save-label";C.appendChild(w);k.appendChild(C);a.appendChild(k);a.addEventListener("submit",Q=>{Q.preventDefault();void this.save()});e.appendChild(a);return e}createFooter(){const e=ie("div","h-10 border-t border-outline-variant bg-elevated px-4 flex items-center justify-between text-[11px] text-muted shrink-0 select-none");const t=ie("span");t.id="snippet-footer-status";e.appendChild(t);const s=ie("span","text-[10px] opacity-60","Esc");e.appendChild(s);return e}updateStorageBadge(){const e=document.getElementById("snippet-storage-badge");if(!e)return;const t=this.deps.isAuthenticated();e.textContent="";const s=ie("span",\`w-1.5 h-1.5 rounded-full shrink-0 \${t?"bg-primary-container shadow-[0_0_6px_var(--accent)]":"bg-muted/60"}\`);const r=ie("span","text-[11px] text-muted select-none",t?g("snippets.cloudSync"):g("snippets.localStore"));e.appendChild(s);e.appendChild(r)}render(){this.renderCategoryChips();this.updateCategorySuggestions();this.renderList()}updateCategorySuggestions(){const e=document.getElementById("snippet-category-datalist");if(!e)return;e.textContent="";const t=[...new Set(this.snippets.map(s=>(s.category||"").trim()).filter(s=>s.length>0))].sort((s,r)=>s.localeCompare(r));for(const s of t){const r=ie("option");r.value=s;e.appendChild(r)}}renderCategoryChips(){const e=document.getElementById("snippet-category-chips");if(!e)return;e.textContent="";const t=new Map;let s=0;for(const o of this.snippets){const a=(o.category||"").trim();if(!a){s++}else{t.set(a,(t.get(a)||0)+1)}}const r=[{key:od,label:g("snippets.allCategories"),count:this.snippets.length}];const n=[...t.keys()].sort((o,a)=>o.localeCompare(a));for(const o of n){r.push({key:o,label:o,count:t.get(o)||0})}if(s>0){r.push({key:Jp,label:g("snippets.uncategorized"),count:s})}for(const o of r){const a=this.selectedCategory.toLowerCase()===o.key.toLowerCase();const l=ie("button",\`shrink-0 text-[11px] px-2.5 py-0.5 rounded-full border transition-all cursor-pointer flex items-center gap-1.5 \${a?"bg-primary-container/20 text-primary-container border-primary-container font-bold shadow-sm":"border-outline-variant/60 hover:border-primary-container/60 text-muted hover:text-primary bg-surface-variant/20"}\`);l.type="button";const h=ie("span",void 0,o.label);l.appendChild(h);const c=ie("span",\`text-[10px] px-1 rounded-full \${a?"bg-primary-container text-on-primary font-bold":"bg-surface-variant/50 text-muted"}\`,String(o.count));l.appendChild(c);l.addEventListener("click",()=>{if(this.selectedCategory!==o.key){this.selectedCategory=o.key;this.render()}});e.appendChild(l)}}renderList(){const e=document.getElementById("snippet-list");const t=document.getElementById("snippet-footer-status");if(!e)return;e.textContent="";const s=N4(this.snippets,this.searchQuery,this.selectedCategory);if(t){t.textContent=\`\${g("snippets.statusCount",{filtered:s.length,total:this.snippets.length})} · \${g("snippets.capacity",{count:this.snippets.length,max:_O})}\`}if(this.snippets.length===0){const r=ie("div","flex flex-col items-center justify-center h-48 text-muted space-y-2");const n=Ri("inbox","36px");n.className="material-symbols-outlined opacity-40";r.appendChild(n);r.appendChild(ie("p","text-xs",g("snippets.empty")));e.appendChild(r);return}if(s.length===0){const r=ie("div","flex flex-col items-center justify-center h-48 text-muted space-y-2");const n=Ri("search_off","36px");n.className="material-symbols-outlined opacity-40";r.appendChild(n);r.appendChild(ie("p","text-xs",g("snippets.noMatches")));e.appendChild(r);return}for(const r of s){e.appendChild(this.buildSnippetCard(r))}}buildSnippetCard(e){const t=ie("div","border border-outline-variant/70 hover:border-primary-container/80 bg-surface-variant/10 rounded p-3 transition-all space-y-2");t.dataset.snippetId=e.id;const s=ie("div","flex items-start justify-between gap-2");const r=ie("div","flex-1 min-w-0");const n=ie("div","text-xs font-bold text-primary-container truncate",e.name);r.appendChild(n);const o=ie("div","flex items-center gap-2 mt-1 flex-wrap");if(e.category&&e.category.trim()){const c=ie("span","text-[11px] text-muted/80 flex items-center gap-0.5 select-none");const d=ie("span","text-primary-container font-code font-bold text-[11px]","#");const u=ie("span",void 0,e.category.trim());c.appendChild(d);c.appendChild(u);o.appendChild(c)}const a=Q1(e.command);if(a.length>0){const c=ie("span","text-[11px] text-muted/70 flex items-center gap-1 select-none font-code");const d=ie("span","text-secondary-container text-[11px]","{ }");const u=ie("span","font-ui text-[11px]",\`\${g("snippets.hasVariables")} (\${a.map(f=>\`{{\${f}}}\`).join(", ")})\`);c.appendChild(d);c.appendChild(u);o.appendChild(c)}r.appendChild(o);s.appendChild(r);const l=ie("div","flex items-center gap-1 shrink-0");l.appendChild(this.buildActionButton("copy","content_copy",g("common.copy"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("insert","input",g("snippets.insert"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("insert_and_run","play_arrow",g("snippets.insertAndRun"),"hover:text-secondary-container"));l.appendChild(this.buildActionButton("edit","edit",g("common.edit"),"hover:text-primary-container"));l.appendChild(this.buildActionButton("delete","delete",g("common.delete"),"hover:text-error"));s.appendChild(l);t.appendChild(s);const h=ie("div","bg-surface-container-lowest border border-outline-variant/40 rounded p-2 text-[11px] font-code text-on-surface-variant break-all overflow-x-auto no-scrollbar max-h-[72px] leading-relaxed select-text",e.command);h.style.whiteSpace="pre-wrap";t.appendChild(h);return t}buildActionButton(e,t,s,r="hover:text-primary"){const n=ie("button",\`text-muted \${r} p-1 rounded hover:bg-surface-variant/40 transition-colors cursor-pointer shrink-0\`);n.type="button";n.dataset.action=e;n.setAttribute("aria-label",s);n.title=s;n.appendChild(Ri(t,"15px"));return n}expandForm(e){const t=document.getElementById("snippet-form-container");const s=document.getElementById("snippet-form-title");const r=document.getElementById("snippet-form-icon");const n=document.getElementById("snippet-name-input");const o=document.getElementById("snippet-category-input");const a=document.getElementById("snippet-command-input");const l=document.getElementById("snippet-save-label");const h=document.getElementById("snippet-new-btn-label");if(!t)return;this.formExpanded=true;t.classList.remove("hidden");if(e){this.editingId=e.id;if(s)s.textContent=g("snippets.editing");if(r)r.textContent="edit_note";if(l)l.textContent=g("common.save");if(n)n.value=e.name;if(o)o.value=e.category||"";if(a)a.value=e.command;if(h)h.textContent=g("snippets.newSnippet")}else{this.editingId=null;if(s)s.textContent=g("snippets.newSnippet");if(r)r.textContent="add_box";if(l)l.textContent=g("snippets.add");if(n)n.value="";if(o){o.value=this.selectedCategory&&this.selectedCategory!==Jp?this.selectedCategory:""}if(a)a.value="";if(h)h.textContent=g("common.cancel")}n==null?void 0:n.focus()}collapseForm(){const e=document.getElementById("snippet-form-container");const t=document.getElementById("snippet-new-btn-label");if(e)e.classList.add("hidden");if(t)t.textContent=g("snippets.newSnippet");this.formExpanded=false;this.editingId=null;const s=document.getElementById("snippet-name-input");const r=document.getElementById("snippet-category-input");const n=document.getElementById("snippet-command-input");if(s)s.value="";if(r)r.value="";if(n)n.value=""}async handleListClick(e){const t=e.target;const s=t==null?void 0:t.closest("[data-action]");if(!s)return;const r=s.closest("[data-snippet-id]");const n=this.snippets.find(a=>a.id===(r==null?void 0:r.dataset.snippetId));if(!n)return;const o=s.dataset.action;if(o==="insert")await this.insertSnippet(n,false);else if(o==="insert_and_run")await this.insertSnippet(n,true);else if(o==="copy")void this.copySnippet(n);else if(o==="edit")this.expandForm(n);else if(o==="delete")await this.deleteSnippet(n)}async copySnippet(e){const t=await Hn(e.command);if(t){Y(g("snippets.copied"),{variant:"success"})}else{Y(g("snippets.copyFailed"),{variant:"danger"})}}async insertSnippet(e,t){const s=this.deps.getTerminal();if(!s){Y(g("snippets.noActiveTerminal"),{variant:"warning"});return}let r=e.command;const n=Q1(e.command);if(n.length>0){const o={};for(const a of n){const l=await su({title:g("snippets.variableTitle"),message:g("snippets.promptVariable",{name:a}),label:a,placeholder:a,confirmText:g("common.confirm"),cancelText:g("common.cancel")});if(l===null){return}o[a]=l}r=W4(e.command,o)}if(!s.insertSnippet(r,t)){Y(g("snippets.insertFailed"),{variant:"warning"});return}this.close()}async save(){if(this.busy)return;const e=document.getElementById("snippet-name-input");const t=document.getElementById("snippet-category-input");const s=document.getElementById("snippet-command-input");const r=document.getElementById("snippet-save-btn");if(!e||!s)return;const n=e.value;const o=(t==null?void 0:t.value)??"";const a=s.value;this.busy=true;if(r)r.disabled=true;try{if(this.editingId){await this.store.update(this.editingId,n,a,o)}else{await this.store.create(n,a,o)}Y(g("snippets.saved"),{variant:"success"});this.collapseForm();await this.reload()}catch(l){Y($1(l),{variant:"danger"})}finally{this.busy=false;if(r)r.disabled=false}}async deleteSnippet(e){const t=await Ui({title:g("snippets.deleteTitle"),message:g("snippets.deleteMessage",{name:e.name}),confirmText:g("common.delete")});if(!t)return;try{await this.store.remove(e.id);Y(g("snippets.deleted"),{variant:"success"});await this.reload()}catch(s){Y($1(s),{variant:"danger"})}}}/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function R1(i,e){(null==e||e>i.length)&&(e=i.length);for(var t=0,s=Array(e);t2?s-2:0),n=2;n1?t-1:0),r=1;r1?t-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Ja;if(A1){A1(i,null)}if(!Fr(e)){return i}let s=e.length;while(s--){let r=e[s];if(typeof r==="string"){const n=t(r);if(n!==r){if(!Y4(e)){e[s]=n}r=n}}i[r]=true}return i}function n$(i){for(let e=0;e/g);const u$=Zt(/\\\${[\\w\\W]*/g);const f$=Zt(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/);const p$=Zt(/^aria-[\\-\\w]+$/);const N1=Zt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i);const m$=Zt(/^(?:\\w+script|data):/i);const g$=Zt(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g);const O$=Zt(/^html$/i);const _$=Zt(/^[a-z][.\\w]*(-[.\\w]+)+$/i);const F1=Zt(/<[/\\w!]/g);const Z1=Zt(/<[/\\w]/g);const v$=Zt(/<\\/no(script|embed|frames)/i);const y$=Zt(/\\/>/i);const vi={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12};const b$=function i(){return typeof window==="undefined"?null:window};const S$=function i(e,t){if(typeof e!=="object"||typeof e.createPolicy!=="function"){return null}let s=null;const r="data-tt-policy-suffix";if(t&&t.hasAttribute(r)){s=t.getAttribute(r)}const n="dompurify"+(s?"#"+s:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch(o){console.warn("TrustedTypes policy "+n+" could not be created.");return null}};const U1=function i(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};const Er=function i(e,t,s,r){return St(e,t)&&Fr(e[t])?be(r.base?jt(r.base):{},e[t],r.transform):s};function Aw(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b$();const e=U=>Aw(U);e.version="3.4.13";e.removed=[];if(!i||!i.document||i.document.nodeType!==vi.document||!i.Element){e.isSupported=false;return e}let t=i.document;const s=t;const r=s.currentScript;i.DocumentFragment;const n=i.HTMLTemplateElement,o=i.Node,a=i.Element,l=i.NodeFilter,h=i.NamedNodeMap;h===void 0?i.NamedNodeMap||i.MozNamedAttrMap:h;i.HTMLFormElement;const c=i.DOMParser,d=i.trustedTypes;const u=a.prototype;const f=Gi(u,"cloneNode");const p=Gi(u,"remove");const m=Gi(u,"nextSibling");const O=Gi(u,"childNodes");const v=Gi(u,"parentNode");const T=Gi(u,"shadowRoot");const k=Gi(u,"attributes");const _=o&&o.prototype?Gi(o.prototype,"nodeType"):null;const C=o&&o.prototype?Gi(o.prototype,"nodeName"):null;const w=o&&o.prototype?Gi(o.prototype,"ownerDocument"):null;if(typeof n==="function"){const U=t.createElement("template");if(U.content&&U.content.ownerDocument){t=U.content.ownerDocument}}let Q;let D="";let I;let F=false;let X=0;const x=function U(){if(X>0){throw bn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')}};const y=function U(S){x();X++;try{return Q.createHTML(S)}finally{X--}};const $=function U(S){x();X++;try{return Q.createScriptURL(S)}finally{X--}};const E=function U(){if(!F){I=S$(d,r);F=true}return I};const R=t,A=R.implementation,B=R.createNodeIterator,M=R.createDocumentFragment,q=R.getElementsByTagName;const re=s.importNode;let ee=U1();e.isSupported=typeof Qw==="function"&&typeof v==="function"&&A&&A.createHTMLDocument!==void 0;const ne=c$,Ie=d$,pe=u$,De=f$,Ce=p$,Ae=m$,lt=g$,di=_$;let Qi=N1;let ve=null;const ei=be({},[...z1,...ef,...tf,...sf,...W1]);let oe=null;const Vs=be({},[...q1,...rf,...X1,...Dh]);let Fe=Object.seal($o(null,{tagNameCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeNameCheck:{writable:true,configurable:false,enumerable:true,value:null},allowCustomizedBuiltInElements:{writable:true,configurable:false,enumerable:true,value:false}}));let Ys=null;let xa=null;const Yi=Object.seal($o(null,{tagCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeCheck:{writable:true,configurable:false,enumerable:true,value:null}}));let kh=true;let Bu=true;let J0=false;let e1=true;let Tr=false;let Pr=true;let vn=false;let Iu=false;let Ch=null;let Th=null;let Du=false;let mo=false;let Ph=false;let $h=false;let t1=true;let i1=false;const s1="user-content-";let zu=true;let Eh=false;let go={};let hs=null;const Wu=be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let r1=null;const n1=be({},["audio","video","img","source","image","track"]);let qu=null;const o1=be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]);const Qh="http://www.w3.org/1998/Math/MathML";const Rh="http://www.w3.org/2000/svg";const cs="http://www.w3.org/1999/xhtml";let Oo=cs;let Xu=false;let Nu=null;const LT=be({},[Qh,Rh,cs],Ju);const a1=Nt(["mi","mo","mn","ms","mtext"]);let Fu=be({},a1);const l1=Nt(["annotation-xml"]);let Zu=be({},l1);const MT=be({},["title","style","font","a","script"]);let ka=null;const BT=["application/xhtml+xml","text/html"];const IT="text/html";let He=null;let _o=null;const DT=t.createElement("form");const h1=function U(S){return S instanceof RegExp||S instanceof Function};const Uu=function U(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_o&&_o===S){return}if(!S||typeof S!=="object"){S={}}S=jt(S);ka=BT.indexOf(S.PARSER_MEDIA_TYPE)===-1?IT:S.PARSER_MEDIA_TYPE;He=ka==="application/xhtml+xml"?Ju:Ja;ve=Er(S,"ALLOWED_TAGS",ei,{transform:He});oe=Er(S,"ALLOWED_ATTR",Vs,{transform:He});Nu=Er(S,"ALLOWED_NAMESPACES",LT,{transform:Ju});qu=Er(S,"ADD_URI_SAFE_ATTR",o1,{transform:He,base:o1});r1=Er(S,"ADD_DATA_URI_TAGS",n1,{transform:He,base:n1});hs=Er(S,"FORBID_CONTENTS",Wu,{transform:He});Ys=Er(S,"FORBID_TAGS",jt({}),{transform:He});xa=Er(S,"FORBID_ATTR",jt({}),{transform:He});go=St(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES==="object"?jt(S.USE_PROFILES):S.USE_PROFILES:false;kh=S.ALLOW_ARIA_ATTR!==false;Bu=S.ALLOW_DATA_ATTR!==false;J0=S.ALLOW_UNKNOWN_PROTOCOLS||false;e1=S.ALLOW_SELF_CLOSE_IN_ATTR!==false;Tr=S.SAFE_FOR_TEMPLATES||false;Pr=S.SAFE_FOR_XML!==false;vn=S.WHOLE_DOCUMENT||false;mo=S.RETURN_DOM||false;Ph=S.RETURN_DOM_FRAGMENT||false;$h=S.RETURN_TRUSTED_TYPE||false;Du=S.FORCE_BODY||false;t1=S.SANITIZE_DOM!==false;i1=S.SANITIZE_NAMED_PROPS||false;zu=S.KEEP_CONTENT!==false;Eh=S.IN_PLACE||false;Qi=a$(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:N1;Oo=typeof S.NAMESPACE==="string"?S.NAMESPACE:cs;Fu=St(S,"MATHML_TEXT_INTEGRATION_POINTS")&&S.MATHML_TEXT_INTEGRATION_POINTS&&typeof S.MATHML_TEXT_INTEGRATION_POINTS==="object"?jt(S.MATHML_TEXT_INTEGRATION_POINTS):be({},a1);Zu=St(S,"HTML_INTEGRATION_POINTS")&&S.HTML_INTEGRATION_POINTS&&typeof S.HTML_INTEGRATION_POINTS==="object"?jt(S.HTML_INTEGRATION_POINTS):be({},l1);const L=St(S,"CUSTOM_ELEMENT_HANDLING")&&S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING==="object"?jt(S.CUSTOM_ELEMENT_HANDLING):$o(null);Fe=$o(null);if(St(L,"tagNameCheck")&&h1(L.tagNameCheck)){Fe.tagNameCheck=L.tagNameCheck}if(St(L,"attributeNameCheck")&&h1(L.attributeNameCheck)){Fe.attributeNameCheck=L.attributeNameCheck}if(St(L,"allowCustomizedBuiltInElements")&&typeof L.allowCustomizedBuiltInElements==="boolean"){Fe.allowCustomizedBuiltInElements=L.allowCustomizedBuiltInElements}Zt(Fe);if(Tr){Bu=false}if(Ph){mo=true}if(go){ve=be({},W1);oe=$o(null);if(go.html===true){be(ve,z1);be(oe,q1)}if(go.svg===true){be(ve,ef);be(oe,rf);be(oe,Dh)}if(go.svgFilters===true){be(ve,tf);be(oe,rf);be(oe,Dh)}if(go.mathMl===true){be(ve,sf);be(oe,X1);be(oe,Dh)}}Yi.tagCheck=null;Yi.attributeCheck=null;if(St(S,"ADD_TAGS")){if(typeof S.ADD_TAGS==="function"){Yi.tagCheck=S.ADD_TAGS}else if(Fr(S.ADD_TAGS)){if(ve===ei){ve=jt(ve)}be(ve,S.ADD_TAGS,He)}}if(St(S,"ADD_ATTR")){if(typeof S.ADD_ATTR==="function"){Yi.attributeCheck=S.ADD_ATTR}else if(Fr(S.ADD_ATTR)){if(oe===Vs){oe=jt(oe)}be(oe,S.ADD_ATTR,He)}}if(St(S,"ADD_URI_SAFE_ATTR")&&Fr(S.ADD_URI_SAFE_ATTR)){be(qu,S.ADD_URI_SAFE_ATTR,He)}if(St(S,"FORBID_CONTENTS")&&Fr(S.FORBID_CONTENTS)){if(hs===Wu){hs=jt(hs)}be(hs,S.FORBID_CONTENTS,He)}if(St(S,"ADD_FORBID_CONTENTS")&&Fr(S.ADD_FORBID_CONTENTS)){if(hs===Wu){hs=jt(hs)}be(hs,S.ADD_FORBID_CONTENTS,He)}if(zu){ve["#text"]=true}if(vn){be(ve,["html","head","body"])}if(ve.table){be(ve,["tbody"]);delete Ys.tbody}if(S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!=="function"){throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.')}if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!=="function"){throw bn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.')}const N=Q;Q=S.TRUSTED_TYPES_POLICY;try{D=y("")}catch(se){Q=N;throw se}}else if(S.TRUSTED_TYPES_POLICY===null){Q=void 0;D=""}else{if(Q===void 0){Q=E()}if(Q&&typeof D==="string"){D=y("")}}if(Nt){Nt(S)}_o=S};const c1=be({},[...ef,...tf,...l$]);const d1=be({},[...sf,...h$]);const zT=function U(S,L,N){if(L.namespaceURI===cs){return S==="svg"}if(L.namespaceURI===Qh){return S==="svg"&&(N==="annotation-xml"||Fu[N])}return Boolean(c1[S])};const WT=function U(S,L,N){if(L.namespaceURI===cs){return S==="math"}if(L.namespaceURI===Rh){return S==="math"&&Zu[N]}return Boolean(d1[S])};const qT=function U(S,L,N){if(L.namespaceURI===Rh&&!Zu[N]){return false}if(L.namespaceURI===Qh&&!Fu[N]){return false}return!d1[S]&&(MT[S]||!c1[S])};const XT=function U(S){let L=v(S);if(!L||!L.tagName){L={namespaceURI:Oo,tagName:"template"}}const N=Ja(S.tagName);const se=Ja(L.tagName);if(!Nu[S.namespaceURI]){return false}if(S.namespaceURI===Rh){return zT(N,L,se)}if(S.namespaceURI===Qh){return WT(N,L,se)}if(S.namespaceURI===cs){return qT(N,L,se)}if(ka==="application/xhtml+xml"&&Nu[S.namespaceURI]){return true}return false};const $r=function U(S){So(e.removed,{element:S});try{v(S).removeChild(S)}catch(L){p(S);if(!v(S)){throw bn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}}};const Ah=function U(S){Ca(S);const L=O(S);if(L){const se=[];bo(L,le=>{So(se,le)});bo(se,le=>{try{p(le)}catch(me){}})}const N=k(S);if(N){for(let se=N.length-1;se>=0;--se){const le=N[se];const me=le&&le.name;if(typeof me==="string"){try{S.removeAttribute(me)}catch(Le){}}}}};const yn=function U(S,L){try{So(e.removed,{attribute:L.getAttributeNode(S),from:L})}catch(N){So(e.removed,{attribute:null,from:L})}L.removeAttribute(S);if(S==="is"){if(mo||Ph){try{$r(L)}catch(N){}}else{try{L.setAttribute(S,"")}catch(N){}}}};const NT=function U(S){const L=k(S);if(!L){return}for(let N=L.length-1;N>=0;--N){const se=L[N];const le=se&&se.name;if(typeof le!=="string"||oe[He(le)]){continue}try{S.removeAttribute(le)}catch(me){}}};const Ca=function U(S){const L=[S];while(L.length>0){const N=L.pop();const se=_?_(N):N.nodeType;if(se===vi.element){NT(N)}const le=O(N);if(le){for(let me=le.length-1;me>=0;--me){L.push(le[me])}}}};const FT=function U(S){if(!Pr){return}const L=[S];while(L.length>0){const N=L.pop();const se=_?_(N):N.nodeType;if(se===vi.processingInstruction||se===vi.comment&&bt(Z1,N.data)){try{p(N)}catch(me){}continue}if(se===vi.element){const me=N;const Le=He(C?C(N):N.nodeName);try{if(me.hasAttribute&&me.hasAttribute("patchsrc")){me.removeAttribute("patchsrc")}if(me.hasAttribute&&me.hasAttribute("for")&&Le!=="label"&&Le!=="output"){me.removeAttribute("for")}}catch(Ve){}}const le=O(N);if(le){for(let me=le.length-1;me>=0;--me){L.push(le[me])}}}};const u1=function U(S){let L=null;let N=null;if(Du){S=""+S}else{const me=M1(S,/^[\\r\\n\\t ]+/);N=me&&me[0]}if(ka==="application/xhtml+xml"&&Oo===cs){S=''+S+""}const se=Q?y(S):S;if(Oo===cs){try{L=new c().parseFromString(se,ka)}catch(me){}}if(!L||!L.documentElement){L=A.createDocument(Oo,"template",null);try{L.documentElement.innerHTML=Xu?D:se}catch(me){}}const le=L.body||L.documentElement;if(S&&N){le.insertBefore(t.createTextNode(N),le.childNodes[0]||null)}if(Oo===cs){return q.call(L,vn?"html":"body")[0]}return vn?L.documentElement:le};const f1=function U(S){const L=w?w(S):S.ownerDocument;return B.call(L||S,S,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)};const Lh=function U(S){S=Pa(S,ne," ");S=Pa(S,Ie," ");S=Pa(S,pe," ");return S};const ju=function U(S){var L;S.normalize();const N=w?w(S):S.ownerDocument;const se=B.call(N||S,S,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let le=se.nextNode();while(le){le.data=Lh(le.data);le=se.nextNode()}const me=(L=S.querySelectorAll)===null||L===void 0?void 0:L.call(S,"template");if(me){bo(me,Le=>{if(vo(Le.content)){ju(Le.content)}})}};const Mh=function U(S){const L=C?C(S):null;if(typeof L!=="string"){return false}if(He(L)!=="form"){return false}return typeof S.nodeName!=="string"||typeof S.textContent!=="string"||typeof S.removeChild!=="function"||S.attributes!==k(S)||typeof S.removeAttribute!=="function"||typeof S.setAttribute!=="function"||typeof S.namespaceURI!=="string"||typeof S.insertBefore!=="function"||typeof S.hasChildNodes!=="function"||S.nodeType!==_(S)||S.childNodes!==O(S)};const vo=function U(S){if(!_||typeof S!=="object"||S===null){return false}try{return _(S)===vi.documentFragment}catch(L){return false}};const Ta=function U(S){if(!_||typeof S!=="object"||S===null){return false}try{return typeof _(S)==="number"}catch(L){return false}};function ds(U,S,L){if(U.length===0){return}bo(U,N=>{N.call(e,S,L,_o)})}const ZT=function U(S,L){if(Pr&&S.hasChildNodes()&&!Ta(S.firstElementChild)&&bt(F1,S.textContent)&&bt(F1,S.innerHTML)){return true}if(Pr&&S.namespaceURI===cs&&L==="style"&&Ta(S.firstElementChild)){return true}if(S.nodeType===vi.processingInstruction){return true}if(Pr&&S.nodeType===vi.comment&&bt(Z1,S.data)){return true}return false};const UT=function U(S,L,N){if(!Ys[L]&&O1(L)){if(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,L)){return false}if(Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(L)){return false}}if(zu&&!hs[L]){const se=v(S);const le=O(S);if(le&&se){const me=le.length;for(let Le=me-1;Le>=0;--Le){const Ve=S===N?f(le[Le],true):le[Le];se.insertBefore(Ve,m(S))}}}$r(S);return true};const p1=function U(S,L,N,se){if(S.length===0){return L}return L===N||L===se?jt(L):L};const m1=function U(S,L){ds(ee.beforeSanitizeElements,S,null);if(S!==L&&v(S)===null){if(Eh){Ca(S)}return true}if(Mh(S)){$r(S);return true}const N=He(C?C(S):S.nodeName);ve=p1(ee.uponSanitizeElement,ve,ei,Ch);ds(ee.uponSanitizeElement,S,{tagName:N,allowedTags:ve});if(S!==L&&v(S)===null){if(Eh){Ca(S)}return true}if(ZT(S,N)){$r(S);return true}if(Ys[N]||!(Yi.tagCheck instanceof Function&&Yi.tagCheck(N))&&!ve[N]){const le=UT(S,N,L);if(le===false){ds(ee.afterSanitizeElements,S,null)}return le}const se=_?_(S):S.nodeType;if(se===vi.element&&!XT(S)){$r(S);return true}if((N==="noscript"||N==="noembed"||N==="noframes")&&bt(v$,S.innerHTML)){$r(S);return true}if(Tr&&S.nodeType===vi.text){const le=Lh(S.textContent);if(S.textContent!==le){So(e.removed,{element:S.cloneNode()});S.textContent=le}}ds(ee.afterSanitizeElements,S,null);return false};const g1=function U(S,L,N){if(xa[L]){return false}if(Pr&&L==="patchsrc"){return false}if(Pr&&L==="for"&&S!=="label"&&S!=="output"){return false}if(t1&&(L==="id"||L==="name")&&(N in t||N in DT)){return false}const se=oe[L]||Yi.attributeCheck instanceof Function&&Yi.attributeCheck(L,S);if(Bu&&bt(De,L));else if(kh&&bt(Ce,L));else if(!se){if(O1(S)&&(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,S)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(S))&&(Fe.attributeNameCheck instanceof RegExp&&bt(Fe.attributeNameCheck,L)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck(L,S))||L==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&bt(Fe.tagNameCheck,N)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(N)));else{return false}}else if(qu[L]);else if(bt(Qi,Pa(N,lt,"")));else if((L==="src"||L==="xlink:href"||L==="href")&&S!=="script"&&B1(N,"data:")===0&&r1[S]);else if(J0&&!bt(Ae,Pa(N,lt,"")));else if(N){return false}else;return true};const jT=be({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]);const O1=function U(S){return!jT[Ja(S)]&&bt(di,S)};const HT=function U(S,L,N,se){if(Q&&typeof d==="object"&&typeof d.getAttributeType==="function"&&!N){switch(d.getAttributeType(S,L)){case"TrustedHTML":{return y(se)}case"TrustedScriptURL":{return $(se)}}}return se};const VT=function U(S,L,N,se){try{if(N){S.setAttributeNS(N,L,se)}else{S.setAttribute(L,se)}if(Mh(S)){$r(S)}else{L1(e.removed)}}catch(le){yn(L,S)}};const _1=function U(S){ds(ee.beforeSanitizeAttributes,S,null);const L=S.attributes;if(!L||Mh(S)){return}oe=p1(ee.uponSanitizeAttribute,oe,Vs,Th);const N={attrName:"",attrValue:"",keepAttr:true,allowedAttributes:oe,forceKeepAttr:void 0};let se=L.length;const le=He(S.nodeName);while(se--){const me=L[se];const Le=me.name,Ve=me.namespaceURI,ui=me.value;const fi=He(Le);const Vu=ui;let ti=Le==="value"?Vu:t$(Vu);N.attrName=fi;N.attrValue=ti;N.keepAttr=true;N.forceKeepAttr=void 0;ds(ee.uponSanitizeAttribute,S,N);ti=N.attrValue;if(i1&&(fi==="id"||fi==="name")&&B1(ti,s1)!==0){yn(Le,S);ti=s1+ti}if(Pr&&bt(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ti)){yn(Le,S);continue}if(fi==="attributename"&&M1(ti,"href")){yn(Le,S);continue}if(N.forceKeepAttr){continue}if(!N.keepAttr){yn(Le,S);continue}if(!e1&&bt(y$,ti)){yn(Le,S);continue}if(Tr){ti=Lh(ti)}if(!g1(le,fi,ti)){yn(Le,S);continue}ti=HT(le,fi,Ve,ti);if(ti!==Vu){VT(S,Le,Ve,ti)}}ds(ee.afterSanitizeAttributes,S,null)};const Bh=function U(S){let L=null;const N=f1(S);ds(ee.beforeSanitizeShadowDOM,S,null);while(L=N.nextNode()){ds(ee.uponSanitizeShadowNode,L,null);m1(L,S);_1(L);if(vo(L.content)){Bh(L.content)}const se=_?_(L):L.nodeType;if(se===vi.element){const le=T(L);if(vo(le)){Hu(le);Bh(le)}}}ds(ee.afterSanitizeShadowDOM,S,null)};const Hu=function U(S){const L=[{node:S,shadow:null}];while(L.length>0){const N=L.pop();if(N.shadow){Bh(N.shadow);continue}const se=N.node;const le=_?_(se):se.nodeType;const me=le===vi.element;const Le=O(se);if(Le){for(let Ve=Le.length-1;Ve>=0;--Ve){L.push({node:Le[Ve],shadow:null})}}if(me){const Ve=C?C(se):null;if(typeof Ve==="string"&&He(Ve)==="template"){const ui=se.content;if(vo(ui)){L.push({node:ui,shadow:null})}}}if(me){const Ve=T(se);if(vo(Ve)){L.push({node:null,shadow:Ve},{node:Ve,shadow:null})}}}};e.sanitize=function(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};let L=null;let N=null;let se=null;let le=null;Xu=!U;if(Xu){U=""}if(typeof U!=="string"&&!Ta(U)){U=o$(U);if(typeof U!=="string"){throw bn("dirty is not a string, aborting")}}if(!e.isSupported){return U}if(Iu){ve=Ch;oe=Th}else{Uu(S)}if(ee.uponSanitizeElement.length>0||ee.uponSanitizeAttribute.length>0){ve=jt(ve)}if(ee.uponSanitizeAttribute.length>0){oe=jt(oe)}e.removed=[];const me=Eh&&typeof U!=="string"&&Ta(U);if(me){FT(U);const ui=C?C(U):U.nodeName;if(typeof ui==="string"){const fi=He(ui);if(!ve[fi]||Ys[fi]){Ah(U);throw bn("root node is forbidden and cannot be sanitized in-place")}}if(Mh(U)){Ah(U);throw bn("root node is clobbered and cannot be sanitized in-place")}try{Hu(U)}catch(fi){Ah(U);throw fi}}else if(Ta(U)){L=u1("");N=L.ownerDocument.importNode(U,true);if(N.nodeType===vi.element&&N.nodeName==="BODY"){L=N}else if(N.nodeName==="HTML"){L=N}else{L.appendChild(N)}Hu(N)}else{if(!mo&&!Tr&&!vn&&U.indexOf("<")===-1){return Q&&$h?y(U):U}L=u1(U);if(!L){return mo?null:$h?D:""}}if(L&&Du){$r(L.firstChild)}const Le=me?U:L;try{const ui=f1(Le);while(se=ui.nextNode()){m1(se,Le);_1(se);if(vo(se.content)){Bh(se.content)}}}catch(ui){if(me){Ah(U);bo(e.removed,fi=>{if(fi.element){Ca(fi.element)}})}throw ui}if(me){bo(e.removed,ui=>{if(ui.element){Ca(ui.element)}});if(Tr){ju(U)}return U}if(mo){if(Tr){ju(L)}if(Ph){le=M.call(L.ownerDocument);while(L.firstChild){le.appendChild(L.firstChild)}}else{le=L}if(oe.shadowroot||oe.shadowrootmode){le=re.call(s,le,true)}return le}let Ve=vn?L.outerHTML:L.innerHTML;if(vn&&ve["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&bt(O$,L.ownerDocument.doctype.name)){Ve="\\n"+Ve}if(Tr){Ve=Lh(Ve)}return Q&&$h?y(Ve):Ve};e.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Uu(U);Iu=true;Ch=ve;Th=oe};e.clearConfig=function(){_o=null;Iu=false;Ch=null;Th=null;Q=I;D=""};e.isValidAttribute=function(U,S,L){if(!_o){Uu({})}const N=He(U);const se=He(S);return g1(N,se,L)};e.addHook=function(U,S){if(typeof S!=="function"){return}if(!St(ee,U)){return}So(ee[U],S)};e.removeHook=function(U,S){if(!St(ee,U)){return void 0}if(S!==void 0){const L=J4(ee[U],S);return L===-1?void 0:e$(ee[U],L,1)[0]}return L1(ee[U])};e.removeHooks=function(U){if(!St(ee,U)){return}ee[U]=[]};e.removeAllHooks=function(){ee=U1()};return e}var w$=Aw();function SO(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var lo=SO();function Lw(i){lo=i}var Pn={exec:()=>null};function wo(i){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=i(s),e[s]=r),r}}function ke(i,e=""){let t=typeof i=="string"?i:i.source,s={replace:(r,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(Yt.caret,"$1"),t=t.replace(r,o),s},getRegex:()=>new RegExp(t,e)};return s}var x$=((i="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\\s])\\s+(['"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:i=>new RegExp(\`^( {0,3}\${i})((?:[ ][^\\\\n]*)?(?:\\\\n|$))\`),nextBulletRegex:wo(i=>new RegExp(\`^ {0,\${i}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))\`)),hrRegex:wo(i=>new RegExp(\`^ {0,\${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)\`)),fencesBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}(?:\\\`\\\`\\\`|~~~)\`)),headingBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}#\`)),htmlBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}<(?:[a-z].*>|!--)\`,"i")),blockquoteBeginRegex:wo(i=>new RegExp(\`^ {0,\${i}}>\`))};var k$=/^(?:[ \\t]*(?:\\n|$))+/;var C$=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/;var T$=/^ {0,3}(\`{3,}(?=[^\`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~\`]* *(?=\\n|$)|$)/;var hh=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/;var P$=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/;var wO=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/;var Mw=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/;var Bw=ke(Mw).replace(/bull/g,wO).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:\`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,"").getRegex();var $$=ke(Mw).replace(/bull/g,wO).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:\`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex();var xO=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\\n)[^\\n]+)*)/;var E$=/^[^\\n]+/;var kO=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/;var Q$=ke(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace("label",kO).replace("title",/(?:"(?:\\\\"?|[^"\\\\])*"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/).getRegex();var R$=ke(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,wO).getRegex();var ru="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";var CO=/|$))/;var A$=ke("^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:[^\\\\n]*\\\\n+|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>\\\\n*|$)|\\\\n*|$)|\\\\n*|$)|)[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|<(?!script|pre|style|textarea)([a-z][\\\\w-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$))","i").replace("comment",CO).replace("tag",ru).replace("attribute",/ +[a-zA-Z:_][\\w.:-]*(?: *= *"[^"\\n]*"| *= *'[^'\\n]*'| *= *[^\\s"'=<>\`]+)?/).getRegex();var Iw=ke(xO).replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex();var L$=ke(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/).replace("paragraph",Iw).getRegex();var TO={blockquote:L$,code:C$,def:Q$,fences:T$,heading:P$,hr:hh,html:A$,lheading:Bw,list:R$,newline:k$,paragraph:Iw,table:Pn,text:E$};var j1=ke("^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)").replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\\\n]").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex();var M$={...TO,lheading:$$,table:j1,paragraph:ke(xO).replace("hr",hh).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("table",j1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:\`{3,}(?=[^\`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ru).getRegex()};var B$={...TO,html:ke(\`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+? *(?:\\\\n{2,}|\\\\s*$)|\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))\`).replace("comment",CO).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b").getRegex(),def:/^ *\\[([^\\]]+)\\]: *]+)>?(?: +(["(][^\\n]+[")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:Pn,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:ke(xO).replace("hr",hh).replace("heading",\` *#{1,6} *[^ +]\`).replace("lheading",Bw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};var I$=/^\\\\([!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~])/;var D$=/^(\`+)([^\`]|[^\`][\\s\\S]*?[^\`])\\1(?!\`)/;var Dw=/^( {2,}|\\\\)\\n(?!\\s*$)/;var z$=/^(\`+|[^\`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\\`+)[^\`]+\\k(?!\`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",x$?"(?\`+)[^\`]+\\k(?!\`)/).replace("html",/<(?! )[^<>]*?>/).getRegex();var Ww=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/;var F$=ke(Ww,"u").replace(/punct/g,ma).getRegex();var Z$=ke(Ww,"u").replace(/punct/g,zw).getRegex();var qw="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)";var U$=ke(qw,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var j$=ke(qw,"gu").replace(/notPunctSpace/g,X$).replace(/punctSpace/g,q$).replace(/punct/g,zw).getRegex();var H$=ke("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var V$=ke(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,ma).getRegex();var Y$="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";var G$=ke(Y$,"gu").replace(/notPunctSpace/g,PO).replace(/punctSpace/g,nu).replace(/punct/g,ma).getRegex();var K$=ke(/\\\\(punct)/,"gu").replace(/punct/g,ma).getRegex();var J$=ke(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_\`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();var eE=ke(CO).replace("(?:-->|$)","-->").getRegex();var tE=ke("^comment|^|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^|^").replace("comment",eE).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s"'=<>\`]+)?/).getRegex();var ad=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|\`+(?!\`)[^\`]*?\`+(?!\`)|\`\`+(?=\\])|[^\\[\\]\\\\\`])*?/;var iE=ke(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",ad).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]*/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex();var Xw=ke(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",ad).replace("ref",kO).getRegex();var Nw=ke(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",kO).getRegex();var sE=ke("reflink|nolink(?!\\\\()","g").replace("reflink",Xw).replace("nolink",Nw).getRegex();var H1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var $O={_backpedal:Pn,anyPunctuation:K$,autolink:J$,blockSkip:N$,br:Dw,code:D$,del:Pn,delLDelim:Pn,delRDelim:Pn,emStrongLDelim:F$,emStrongRDelimAst:U$,emStrongRDelimUnd:H$,escape:I$,link:iE,nolink:Nw,punctuation:W$,reflink:Xw,reflinkSearch:sE,tag:tE,text:z$,url:Pn};var rE={...$O,link:ke(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",ad).getRegex(),reflink:ke(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",ad).getRegex()};var im={...$O,emStrongRDelimAst:j$,emStrongLDelim:Z$,delLDelim:V$,delRDelim:G$,url:ke(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",H1).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:ke(/^([\`~]+|[^\`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_\`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\":">",'"':""","'":"'"};var V1=i=>oE[i];function ws(i,e){if(e){if(Yt.escapeTest.test(i))return i.replace(Yt.escapeReplace,V1)}else if(Yt.escapeTestNoEncode.test(i))return i.replace(Yt.escapeReplaceNoEncode,V1);return i}function Y1(i){try{i=encodeURI(i).replace(Yt.percentDecode,"%")}catch{return null}return i}function G1(i,e){var n;let t=i.replace(Yt.findPipe,(o,a,l)=>{let h=false,c=a;for(;--c>=0&&l[c]==="\\\\";)h=!h;return h?"|":" |"}),s=t.split(Yt.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!((n=s.at(-1))==null?void 0:n.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length=0&&Yt.blankLine.test(e[t]);)t--;return e.length-t<=2?i:e.slice(0,t+1).join(\` \`)}function aE(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s0?-2:-1}function lE(i,e=0){let t=e,s="";for(let r of i)if(r===" "){let n=4-t%4;s+=" ".repeat(n),t+=n}else s+=r,t++;return s}function J1(i,e,t,s,r){let n=e.href,o=e.title||null,a=i[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=true;let l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=false,l}function hE(i,e,t){let s=i.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(\` \`).map(n=>{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=r.length?n.slice(r.length):n}).join(\` @@ -423,14 +423,14 @@ export const HTML = ` \${e} \`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?\`<\${s} align="\${e.align}">\`:\`<\${s}>\`)+t+\` \`}strong({tokens:e}){return\`\${this.parser.parseInline(e)}\`}em({tokens:e}){return\`\${this.parser.parseInline(e)}\`}codespan({text:e}){return\`\${ws(e,true)}\`}br(e){return"
"}del({tokens:e}){return\`\${this.parser.parseInline(e)}\`}link({href:e,title:t,tokens:s}){let r=this.parser.parseInline(s),n=Y1(e);if(n===null)return r;e=n;let o='
",o}image({href:e,title:t,text:s,tokens:r}){r&&(s=this.parser.parseInline(r,this.parser.textRenderer));let n=Y1(e);if(n===null)return ws(s);e=n;let o=\`\${ws(s)}{let h=a[l].flat(1/0);s=s.concat(this.walkTokens(h,t))}):a.tokens&&(s=s.concat(this.walkTokens(a.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let r={...s};if(r.async=this.defaults.async||r.async||false,s.extensions&&(s.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===false&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),r.extensions=t),s.renderer){let n=this.defaults.renderer||new hd(this.defaults);for(let o in s.renderer){if(!(o in n))throw new Error(\`renderer '\${o}' does not exist\`);if(["options","parser"].includes(o))continue;let a=o,l=s.renderer[a],h=n[a];n[a]=(...c)=>{let d=l.apply(n,c);return d===false&&(d=h.apply(n,c)),d||""}}r.renderer=n}if(s.tokenizer){let n=this.defaults.tokenizer||new ld(this.defaults);for(let o in s.tokenizer){if(!(o in n))throw new Error(\`tokenizer '\${o}' does not exist\`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=s.tokenizer[a],h=n[a];n[a]=(...c)=>{let d=l.apply(n,c);return d===false&&(d=h.apply(n,c)),d}}r.tokenizer=n}if(s.hooks){let n=this.defaults.hooks||new el;for(let o in s.hooks){if(!(o in n))throw new Error(\`hook '\${o}' does not exist\`);if(["options","block"].includes(o))continue;let a=o,l=s.hooks[a],h=n[a];el.passThroughHooks.has(o)?n[a]=c=>{if(this.defaults.async&&el.passThroughHooksRespectAsync.has(o))return(async()=>{let u=await l.call(n,c);return h.call(n,u)})();let d=l.call(n,c);return h.call(n,d)}:n[a]=(...c)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(n,c);return u===false&&(u=await h.apply(n,c)),u})();let d=l.apply(n,c);return d===false&&(d=h.apply(n,c)),d}}r.hooks=n}if(s.walkTokens){let n=this.defaults.walkTokens,o=s.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ts.lex(e,t??this.defaults)}parser(e,t){return is.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let r={...s},n={...this.defaults,...r},o=this.onError(!!n.silent,!!n.async);if(this.defaults.async===true&&r.async===false)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(t):t,l=await(n.hooks?await n.hooks.provideLexer(e):e?ts.lex:ts.lexInline)(a,n),h=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(h,n.walkTokens));let c=await(n.hooks?await n.hooks.provideParser(e):e?is.parse:is.parseInline)(h,n);return n.hooks?await n.hooks.postprocess(c):c})().catch(o);try{n.hooks&&(t=n.hooks.preprocess(t));let a=(n.hooks?n.hooks.provideLexer(e):e?ts.lex:ts.lexInline)(t,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let l=(n.hooks?n.hooks.provideParser(e):e?is.parse:is.parseInline)(a,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,t){return s=>{if(s.message+=\` -Please report this to https://github.com/markedjs/marked.\`,e){let r="

An error occurred:

"+ws(s.message+"",true)+"
";return t?Promise.resolve(r):r}if(t)return Promise.reject(s);throw s}}};var Vn=new cE;function Qe(i,e){return Vn.parse(i,e)}Qe.options=Qe.setOptions=function(i){return Vn.setOptions(i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.getDefaults=SO;Qe.defaults=lo;Qe.use=function(...i){return Vn.use(...i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.walkTokens=function(i,e){return Vn.walkTokens(i,e)};Qe.parseInline=Vn.parseInline;Qe.Parser=is;Qe.parser=is.parse;Qe.Renderer=hd;Qe.TextRenderer=EO;Qe.Lexer=ts;Qe.lexer=ts.lex;Qe.Tokenizer=ld;Qe.Hooks=el;Qe.parse=Qe;Qe.options;Qe.setOptions;Qe.use;Qe.walkTokens;Qe.parseInline;is.parse;ts.lex;const dE=10;const uE=50;const fE=64;const pE=512;const mE=["credential","config","rule","note"];const gE=/^(.*_)?(password|passwd|secret|token|api_?key|auth_?token|credential|private_?key)(_.*)?$/i;const OE=[/-----BEGIN\\s+[A-Z\\s]*PRIVATE\\s+KEY-----/i,/(?:password|passwd|secret|api[_-]?key|access[_-]?token|auth_?token)\\s*[:=]\\s*[^\\s]+/i,/bearer\\s+[a-zA-Z0-9_.-]{16,}/i,/\\b(?:sk-[a-zA-Z0-9_-]{20,}|gh[pousr]_[a-zA-Z0-9]{20,}|xox[baprs]-[a-zA-Z0-9]{10,})\\b/i];function Fw(i,e){if(gE.test(i.trim()))return true;return OE.some(t=>t.test(e))}function _E(i){if(typeof i.key!=="string")return{ok:false,error:"keyRequired"};const e=i.key.trim();if(!e)return{ok:false,error:"keyRequired"};if([...e].length>fE){return{ok:false,error:"keyTooLong"}}if(typeof i.value!=="string")return{ok:false,error:"valueRequired"};const t=i.value.trim();if(!t)return{ok:false,error:"valueRequired"};if([...t].length>pE){return{ok:false,error:"valueTooLong"}}let s="note";if(typeof i.category==="string"&&mE.includes(i.category)){s=i.category}else if(Fw(e,t)){s="credential"}return{ok:true,value:{category:s,key:e,value:t}}}function e_(i,e){if(!e){const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:false,weekday:"short"});const s=t.formatToParts(new Date(i));const r={};for(const a of s){r[a.type]=a.value}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const o=n.includes(r.weekday)?n.indexOf(r.weekday):new Date(i).getDay();return{year:parseInt(r.year,10),month:parseInt(r.month,10),day:parseInt(r.day,10),hours:parseInt(r.hour,10)===24?0:parseInt(r.hour,10),minutes:parseInt(r.minute,10),seconds:parseInt(r.second,10),dayOfWeek:o}}catch{const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}}function vE(i,e=Date.now(),t="zh-CN",s){const r=t==="en-US";const n=e_(i,s);const o=e_(e,s);const a=v=>String(v).padStart(2,"0");const l=n.year;const h=a(n.month);const c=a(n.day);const d=a(n.hours);const u=a(n.minutes);const f=new Date(Date.UTC(n.year,n.month-1,n.day)).getTime();const p=new Date(Date.UTC(o.year,o.month-1,o.day)).getTime();const m=Math.round((p-f)/864e5);let O="";if(m===0){O=r?"Today":"今天"}else if(m===1){O=r?"Yesterday":"昨天"}else if(m===2){O=r?"2 days ago":"前天"}else if(m>2&&m<=30){O=r?\`\${m} days ago\`:\`\${m}天前\`}else{O=\`\${l}-\${h}-\${c}\`}return\`\${l}-\${h}-\${c} \${d}:\${u} (\${O})\`}const yE=new Set(["bash","cmd","fish","powershell","pwsh","sh","shell","shellscript","zsh"]);function Zw(i){return(i||"").trim().split(/\\s+/,1)[0].toLowerCase().replace(/^language-/,"")}function bE(i,e){if(!yE.has(Zw(i)))return null;const t=e.replace(/\\r\\n?/g,"\\n").trim();if(!t||t.includes("\\n"))return null;if(/[\\u0000-\\u001f\\u007f]/.test(t))return null;return t.startsWith("$ ")?t.slice(2).trimStart()||null:t}function SE(i,e){if(!i.trim())return null;return{content:i,sourceLabel:e.trim(),lineCount:i.split(/\\r\\n|\\r|\\n/).length,characterCount:i.length}}function wE(i,e){return g("agent.selectionContextPrompt",{source:e.sourceLabel||g("agent.selectionUnknownSource"),content:e.content,question:i.trim()})}Qe.use({gfm:true,renderer:{code({text:i,lang:e}){const t=Zw(e);const s=t?\`\${Te(t)}\`:'';return\`
+Please report this to https://github.com/markedjs/marked.\`,e){let r="

An error occurred:

"+ws(s.message+"",true)+"
";return t?Promise.resolve(r):r}if(t)return Promise.reject(s);throw s}}};var Vn=new cE;function Qe(i,e){return Vn.parse(i,e)}Qe.options=Qe.setOptions=function(i){return Vn.setOptions(i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.getDefaults=SO;Qe.defaults=lo;Qe.use=function(...i){return Vn.use(...i),Qe.defaults=Vn.defaults,Lw(Qe.defaults),Qe};Qe.walkTokens=function(i,e){return Vn.walkTokens(i,e)};Qe.parseInline=Vn.parseInline;Qe.Parser=is;Qe.parser=is.parse;Qe.Renderer=hd;Qe.TextRenderer=EO;Qe.Lexer=ts;Qe.lexer=ts.lex;Qe.Tokenizer=ld;Qe.Hooks=el;Qe.parse=Qe;Qe.options;Qe.setOptions;Qe.use;Qe.walkTokens;Qe.parseInline;is.parse;ts.lex;const dE=10;const uE=50;const fE=64;const pE=512;const mE=["credential","config","rule","note"];const gE=/^(.*_)?(password|passwd|secret|token|api_?key|auth_?token|credential|private_?key)(_.*)?$/i;const OE=[/-----BEGIN\\s+[A-Z\\s]*PRIVATE\\s+KEY-----/i,/(?:password|passwd|secret|api[_-]?key|access[_-]?token|auth_?token)\\s*[:=]\\s*[^\\s]+/i,/bearer\\s+[a-zA-Z0-9_.-]{16,}/i,/\\b(?:sk-[a-zA-Z0-9_-]{20,}|gh[pousr]_[a-zA-Z0-9]{20,}|xox[baprs]-[a-zA-Z0-9]{10,})\\b/i];function Fw(i,e){if(gE.test(i.trim()))return true;return OE.some(t=>t.test(e))}function _E(i){if(typeof i.key!=="string")return{ok:false,error:"keyRequired"};const e=i.key.trim();if(!e)return{ok:false,error:"keyRequired"};if([...e].length>fE){return{ok:false,error:"keyTooLong"}}const t=i.action==="delete"?"delete":"set";if(t==="delete"){return{ok:true,value:{action:"delete",category:"note",key:e,value:""}}}if(typeof i.value!=="string")return{ok:false,error:"valueRequired"};const s=i.value.trim();if(!s)return{ok:false,error:"valueRequired"};if([...s].length>pE){return{ok:false,error:"valueTooLong"}}let r="note";if(typeof i.category==="string"&&mE.includes(i.category)){r=i.category}else if(Fw(e,s)){r="credential"}return{ok:true,value:{action:"set",category:r,key:e,value:s}}}function e_(i,e){if(!e){const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}try{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:false,weekday:"short"});const s=t.formatToParts(new Date(i));const r={};for(const a of s){r[a.type]=a.value}const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const o=n.includes(r.weekday)?n.indexOf(r.weekday):new Date(i).getDay();return{year:parseInt(r.year,10),month:parseInt(r.month,10),day:parseInt(r.day,10),hours:parseInt(r.hour,10)===24?0:parseInt(r.hour,10),minutes:parseInt(r.minute,10),seconds:parseInt(r.second,10),dayOfWeek:o}}catch{const t=new Date(i);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),dayOfWeek:t.getDay()}}}function vE(i,e=Date.now(),t="zh-CN",s){const r=t==="en-US";const n=e_(i,s);const o=e_(e,s);const a=v=>String(v).padStart(2,"0");const l=n.year;const h=a(n.month);const c=a(n.day);const d=a(n.hours);const u=a(n.minutes);const f=new Date(Date.UTC(n.year,n.month-1,n.day)).getTime();const p=new Date(Date.UTC(o.year,o.month-1,o.day)).getTime();const m=Math.round((p-f)/864e5);let O="";if(m===0){O=r?"Today":"今天"}else if(m===1){O=r?"Yesterday":"昨天"}else if(m===2){O=r?"2 days ago":"前天"}else if(m>2&&m<=30){O=r?\`\${m} days ago\`:\`\${m}天前\`}else{O=\`\${l}-\${h}-\${c}\`}return\`\${l}-\${h}-\${c} \${d}:\${u} (\${O})\`}const yE=new Set(["bash","cmd","fish","powershell","pwsh","sh","shell","shellscript","zsh"]);function Zw(i){return(i||"").trim().split(/\\s+/,1)[0].toLowerCase().replace(/^language-/,"")}function bE(i,e){if(!yE.has(Zw(i)))return null;const t=e.replace(/\\r\\n?/g,"\\n").trim();if(!t||t.includes("\\n"))return null;if(/[\\u0000-\\u001f\\u007f]/.test(t))return null;return t.startsWith("$ ")?t.slice(2).trimStart()||null:t}function SE(i,e){if(!i.trim())return null;return{content:i,sourceLabel:e.trim(),lineCount:i.split(/\\r\\n|\\r|\\n/).length,characterCount:i.length}}function wE(i,e){return g("agent.selectionContextPrompt",{source:e.sourceLabel||g("agent.selectionUnknownSource"),content:e.content,question:i.trim()})}Qe.use({gfm:true,renderer:{code({text:i,lang:e}){const t=Zw(e);const s=t?\`\${Se(t)}\`:'';return\`
\${s}
-
\${Te(i)}
-
\`},codespan({text:i}){return\`\${Te(i)}\`},link({href:i,title:e,text:t}){const s=e?\` title="\${Te(e)}"\`:"";return\`
\${t}\`},image({href:i,title:e,text:t}){const s=e?\` title="\${Te(e)}"\`:"";return\`\${Te(t)}\`}}});function Te(i){if(!i)return"";return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}class xE{constructor(e,t,s){b(this,"panelEl",null);b(this,"messagesEl",null);b(this,"contextEl",null);b(this,"inputEl",null);b(this,"sendBtn",null);b(this,"isVisible",false);b(this,"isAgentRunning",false);b(this,"isWaitingConfirmation",false);b(this,"wsSend",null);b(this,"getTerminalFillTarget",null);b(this,"fillTerminalInput",null);b(this,"onLayoutChange");b(this,"streamingEl",null);b(this,"streamingText","");b(this,"thinkingProcessEl",null);b(this,"thinkingStepsEl",null);b(this,"thinkingCurrentEl",null);b(this,"thinkingStatusEl",null);b(this,"thinkingIsDone",false);b(this,"thinkingStepCount",0);b(this,"thinkingLiveEl",null);b(this,"thinkingAllSteps",[]);b(this,"livePreviewCache",[]);b(this,"localeCleanup",null);b(this,"pendingTerminalSelection",null);b(this,"pendingConfirmation",null);b(this,"isMemoryDrawerOpen",false);b(this,"activeMemoryTab","workLog");b(this,"unifiedMemory",{workLogs:[],knowledge:[]});b(this,"memoryDrawerEl",null);b(this,"memoryTabWorkLogBtn",null);b(this,"memoryTabKnowledgeBtn",null);b(this,"memoryContentEl",null);b(this,"memoryCountEl",null);b(this,"memoryAddBtn",null);b(this,"memoryAddFormContainerEl",null);b(this,"revealedSecretIds",new Set);this.parentEl=e;this.isLoggedIn=t;this.serverId=s}setServerId(e){this.serverId=e;this.revealedSecretIds.clear();if(this.isMemoryDrawerOpen){void this.fetchServerMemory()}else if(this.isVisible&&this.serverId){void this.fetchServerMemory()}}setLayoutChangeHandler(e){this.onLayoutChange=e}setWebSocketSend(e){this.wsSend=e}setTerminalFillHandler(e,t){this.getTerminalFillTarget=e;this.fillTerminalInput=t}render(){if(this.panelEl)return;this.panelEl=document.createElement("div");this.panelEl.id="agent-panel";this.panelEl.className="shrink-0 border-l border-[var(--border)] flex flex-col bg-[var(--bg)] overflow-hidden h-full relative";this.panelEl.style.width="min(clamp(420px, 40vw, 600px), 100%)";this.panelEl.style.display="none";this.panelEl.innerHTML=\` +
\${Se(i)}
+
\`},codespan({text:i}){return\`\${Se(i)}\`},link({href:i,title:e,text:t}){const s=e?\` title="\${Se(e)}"\`:"";return\`\${t}\`},image({href:i,title:e,text:t}){const s=e?\` title="\${Se(e)}"\`:"";return\`\${Se(t)}\`}}});function Se(i){if(!i)return"";return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}class xE{constructor(e,t,s){b(this,"panelEl",null);b(this,"messagesEl",null);b(this,"contextEl",null);b(this,"inputEl",null);b(this,"sendBtn",null);b(this,"isVisible",false);b(this,"isAgentRunning",false);b(this,"isWaitingConfirmation",false);b(this,"wsSend",null);b(this,"getTerminalFillTarget",null);b(this,"fillTerminalInput",null);b(this,"onLayoutChange");b(this,"streamingEl",null);b(this,"streamingText","");b(this,"thinkingProcessEl",null);b(this,"thinkingStepsEl",null);b(this,"thinkingCurrentEl",null);b(this,"thinkingStatusEl",null);b(this,"thinkingIsDone",false);b(this,"thinkingStepCount",0);b(this,"thinkingLiveEl",null);b(this,"thinkingAllSteps",[]);b(this,"livePreviewCache",[]);b(this,"localeCleanup",null);b(this,"pendingTerminalSelection",null);b(this,"pendingConfirmation",null);b(this,"isMemoryDrawerOpen",false);b(this,"activeMemoryTab","workLog");b(this,"unifiedMemory",{workLogs:[],knowledge:[]});b(this,"memoryDrawerEl",null);b(this,"memoryTabWorkLogBtn",null);b(this,"memoryTabKnowledgeBtn",null);b(this,"memoryContentEl",null);b(this,"memoryCountEl",null);b(this,"memoryAddBtn",null);b(this,"memoryAddFormContainerEl",null);b(this,"revealedSecretIds",new Set);this.parentEl=e;this.isLoggedIn=t;this.serverId=s}setServerId(e){this.serverId=e;this.revealedSecretIds.clear();if(this.isMemoryDrawerOpen){void this.fetchServerMemory()}else if(this.isVisible&&this.serverId){void this.fetchServerMemory()}}setLayoutChangeHandler(e){this.onLayoutChange=e}setWebSocketSend(e){this.wsSend=e}setTerminalFillHandler(e,t){this.getTerminalFillTarget=e;this.fillTerminalInput=t}render(){if(this.panelEl)return;this.panelEl=document.createElement("div");this.panelEl.id="agent-panel";this.panelEl.className="shrink-0 border-l border-[var(--border)] flex flex-col bg-[var(--bg)] overflow-hidden h-full relative";this.panelEl.style.width="min(clamp(420px, 40vw, 600px), 100%)";this.panelEl.style.display="none";this.panelEl.innerHTML=\`
smart_toy @@ -509,15 +509,15 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

\${g("agent.selectionAttachment")} - \${Te(g("agent.selectionAttachmentMeta",{lines:e.lineCount,characters:e.characterCount}))} + \${Se(g("agent.selectionAttachmentMeta",{lines:e.lineCount,characters:e.characterCount}))} -
\${Te(t)}
-
\${Te(e.content)}
+
\${Se(t)}
+
\${Se(e.content)}
@@ -537,7 +537,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

- \`;const t=e.querySelector(".tp-accordion");t==null?void 0:t.addEventListener("click",()=>{if(!this.thinkingIsDone)return;e.classList.toggle("tp-expanded")});this.thinkingProcessEl=e;this.thinkingStepsEl=e.querySelector(".tp-steps");this.thinkingStatusEl=e.querySelector(".tp-status");this.thinkingCurrentEl=e.querySelector(".tp-current");this.thinkingLiveEl=e.querySelector(".tp-live-preview");this.thinkingIsDone=false;(s=this.messagesEl)==null?void 0:s.appendChild(e);this.scrollToBottom()}updateLivePreview(e){if(!this.thinkingLiveEl)return;this.livePreviewCache.push(e);if(this.livePreviewCache.length>2)this.livePreviewCache.shift();const t=\`terminal\`;this.thinkingLiveEl.innerHTML=this.livePreviewCache.map(s=>\`
\${t}\${Te(s)}
\`).join("")}addThinkingStep(e,t){if(!this.thinkingStepsEl||!this.thinkingCurrentEl)return;this.thinkingAllSteps.push({tool:e,label:t});if(this.thinkingCurrentEl.childElementCount>0){this.thinkingStepsEl.appendChild(this.thinkingCurrentEl.firstElementChild);while(this.thinkingStepsEl.children.length>2){this.thinkingStepsEl.removeChild(this.thinkingStepsEl.firstChild)}}this.thinkingCurrentEl.replaceChildren();this.thinkingStepCount++;const s=document.createElement("div");s.className="tp-step tp-step-active";const r=e==="execute_command"||e==="terminal"?\`terminal\`:\`smart_toy\`;s.innerHTML=\`\${r}\${Te(t)}\`;this.thinkingCurrentEl.appendChild(s);if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g(this.thinkingIsDone?"agent.completedSteps":"agent.processingSteps",{count:this.thinkingStepCount})}this.scrollToBottom()}collapseThinkingProcess(){var s,r;if(!this.thinkingProcessEl||this.thinkingIsDone)return;this.thinkingIsDone=true;if((s=this.thinkingCurrentEl)==null?void 0:s.firstElementChild){(r=this.thinkingStepsEl)==null?void 0:r.appendChild(this.thinkingCurrentEl.firstElementChild)}this.thinkingCurrentEl.replaceChildren();if(this.thinkingStepsEl){this.thinkingStepsEl.replaceChildren();for(const n of this.thinkingAllSteps){const o=document.createElement("div");o.className="tp-step tp-step-done";const a=n.tool==="execute_command"||n.tool==="terminal"?\`check_circle\`:\`check_circle\`;o.innerHTML=\`\${a}\${Te(n.label)}\`;this.thinkingStepsEl.appendChild(o)}}this.thinkingProcessEl.querySelectorAll(".tp-step-active").forEach(n=>{n.classList.remove("tp-step-active");n.classList.add("tp-step-done");const o=n.querySelector(".tp-step-icon");if(o)o.textContent="check_circle"});if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g("agent.completedSteps",{count:this.thinkingStepCount})}const e=this.thinkingProcessEl.querySelector(".tp-icon");if(e)e.textContent="check_circle";const t=this.thinkingProcessEl.querySelector(".thinking-dots");if(t)t.style.display="none";this.thinkingProcessEl.classList.add("tp-done");if(this.thinkingLiveEl)this.thinkingLiveEl.replaceChildren()}removeThinkingProcess(){if(this.thinkingProcessEl){this.thinkingProcessEl.remove()}this.thinkingProcessEl=null;this.thinkingStepsEl=null;this.thinkingCurrentEl=null;this.thinkingStatusEl=null;this.thinkingLiveEl=null;this.thinkingIsDone=false;this.thinkingAllSteps=[];this.livePreviewCache=[]}addAgentResponse(e){this.collapseThinkingProcess();this.appendMessage("response",e||"")}handleStreamChunk(e){var s;if(!this.streamingEl){this.collapseThinkingProcess()}if(!this.streamingEl){this.streamingText="";const r=document.createElement("div");r.className="agent-message agent-response";const n="var(--agent-agent-color)";const o=\`smart_toy\`;r.innerHTML=\` + \`;const t=e.querySelector(".tp-accordion");t==null?void 0:t.addEventListener("click",()=>{if(!this.thinkingIsDone)return;e.classList.toggle("tp-expanded")});this.thinkingProcessEl=e;this.thinkingStepsEl=e.querySelector(".tp-steps");this.thinkingStatusEl=e.querySelector(".tp-status");this.thinkingCurrentEl=e.querySelector(".tp-current");this.thinkingLiveEl=e.querySelector(".tp-live-preview");this.thinkingIsDone=false;(s=this.messagesEl)==null?void 0:s.appendChild(e);this.scrollToBottom()}updateLivePreview(e){if(!this.thinkingLiveEl)return;this.livePreviewCache.push(e);if(this.livePreviewCache.length>2)this.livePreviewCache.shift();const t=\`terminal\`;this.thinkingLiveEl.innerHTML=this.livePreviewCache.map(s=>\`
\${t}\${Se(s)}
\`).join("")}addThinkingStep(e,t){if(!this.thinkingStepsEl||!this.thinkingCurrentEl)return;this.thinkingAllSteps.push({tool:e,label:t});if(this.thinkingCurrentEl.childElementCount>0){this.thinkingStepsEl.appendChild(this.thinkingCurrentEl.firstElementChild);while(this.thinkingStepsEl.children.length>2){this.thinkingStepsEl.removeChild(this.thinkingStepsEl.firstChild)}}this.thinkingCurrentEl.replaceChildren();this.thinkingStepCount++;const s=document.createElement("div");s.className="tp-step tp-step-active";const r=e==="execute_command"||e==="terminal"?\`terminal\`:\`smart_toy\`;s.innerHTML=\`\${r}\${Se(t)}\`;this.thinkingCurrentEl.appendChild(s);if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g(this.thinkingIsDone?"agent.completedSteps":"agent.processingSteps",{count:this.thinkingStepCount})}this.scrollToBottom()}collapseThinkingProcess(){var s,r;if(!this.thinkingProcessEl||this.thinkingIsDone)return;this.thinkingIsDone=true;if((s=this.thinkingCurrentEl)==null?void 0:s.firstElementChild){(r=this.thinkingStepsEl)==null?void 0:r.appendChild(this.thinkingCurrentEl.firstElementChild)}this.thinkingCurrentEl.replaceChildren();if(this.thinkingStepsEl){this.thinkingStepsEl.replaceChildren();for(const n of this.thinkingAllSteps){const o=document.createElement("div");o.className="tp-step tp-step-done";const a=n.tool==="execute_command"||n.tool==="terminal"?\`check_circle\`:\`check_circle\`;o.innerHTML=\`\${a}\${Se(n.label)}\`;this.thinkingStepsEl.appendChild(o)}}this.thinkingProcessEl.querySelectorAll(".tp-step-active").forEach(n=>{n.classList.remove("tp-step-active");n.classList.add("tp-step-done");const o=n.querySelector(".tp-step-icon");if(o)o.textContent="check_circle"});if(this.thinkingStatusEl){this.thinkingStatusEl.textContent=g("agent.completedSteps",{count:this.thinkingStepCount})}const e=this.thinkingProcessEl.querySelector(".tp-icon");if(e)e.textContent="check_circle";const t=this.thinkingProcessEl.querySelector(".thinking-dots");if(t)t.style.display="none";this.thinkingProcessEl.classList.add("tp-done");if(this.thinkingLiveEl)this.thinkingLiveEl.replaceChildren()}removeThinkingProcess(){if(this.thinkingProcessEl){this.thinkingProcessEl.remove()}this.thinkingProcessEl=null;this.thinkingStepsEl=null;this.thinkingCurrentEl=null;this.thinkingStatusEl=null;this.thinkingLiveEl=null;this.thinkingIsDone=false;this.thinkingAllSteps=[];this.livePreviewCache=[]}addAgentResponse(e){this.collapseThinkingProcess();this.appendMessage("response",e||"")}handleStreamChunk(e){var s;if(!this.streamingEl){this.collapseThinkingProcess()}if(!this.streamingEl){this.streamingText="";const r=document.createElement("div");r.className="agent-message agent-response";const n="var(--agent-agent-color)";const o=\`smart_toy\`;r.innerHTML=\`
\${o}
@@ -548,20 +548,20 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro \${g("agent.progressTitle")}

- \${Te(g("agent.progressCurrent",{message:e,current:t,max:s}))} + \${Se(g("agent.progressCurrent",{message:e,current:t,max:s}))}
- \${Te(g("agent.progressReason",{reason:r}))} + \${Se(g("agent.progressReason",{reason:r}))}
\`;(o=this.messagesEl)==null?void 0:o.appendChild(n);this.scrollToBottom()}showConfirmDialog(e,t){var a,l,h;if(this.streamingEl){this.convertStreamToThoughtStep()}const s=((a=document.getElementById("terminal-section"))==null?void 0:a.classList.contains("hidden"))??false;if(!this.isVisible||this.parentEl.style.display==="none"||s){(l=this.wsSend)==null?void 0:l.call(this,JSON.stringify({type:"agent_confirm",approved:false,command:e}));return}this.rejectPendingConfirmation(false);this.isWaitingConfirmation=true;this.updateInputState();const r=document.createElement("div");r.className="agent-confirm p-3 rounded border border-[var(--error)] bg-[var(--error-bg)]";r.setAttribute("role","alertdialog");r.setAttribute("aria-modal","true");r.setAttribute("aria-labelledby","agent-confirm-title");r.setAttribute("aria-describedby","agent-confirm-description");r.innerHTML=\`
⚠ \${g("agent.confirmTitle")}
-
$ \${Te(e)}
-
\${Te(t)}
+
$ \${Se(e)}
+
\${Se(t)}
- \`;const n=r.querySelector(".agent-confirm-no");const o=r.querySelector(".agent-confirm-yes");this.pendingConfirmation={command:e,element:r,previousFocus:document.activeElement instanceof HTMLElement?document.activeElement:null};n.addEventListener("click",()=>{this.resolvePendingConfirmation(false)});o.addEventListener("click",()=>{this.resolvePendingConfirmation(true)});r.addEventListener("keydown",c=>{if(c.key==="Escape"){c.preventDefault();c.stopPropagation();this.resolvePendingConfirmation(false);return}if(c.key!=="Tab")return;const d=n;const u=o;if(c.shiftKey&&document.activeElement===d){c.preventDefault();u.focus()}else if(!c.shiftKey&&document.activeElement===u){c.preventDefault();d.focus()}});(h=this.messagesEl)==null?void 0:h.appendChild(r);this.scrollToBottom();requestAnimationFrame(()=>n.focus())}resolvePendingConfirmation(e,t=true){var r;const s=this.pendingConfirmation;if(!s)return;this.pendingConfirmation=null;(r=this.wsSend)==null?void 0:r.call(this,JSON.stringify({type:"agent_confirm",approved:e,command:s.command}));s.element.remove();this.isWaitingConfirmation=false;this.updateInputState();if(t){requestAnimationFrame(()=>{var o;const n=((o=s.previousFocus)==null?void 0:o.isConnected)?s.previousFocus:this.inputEl;n==null?void 0:n.focus()})}}convertStreamToThoughtStep(){if(!this.streamingEl)return;const e=this.streamingText.trim();this.streamingEl.remove();this.streamingEl=null;this.streamingText="";if(e&&this.thinkingProcessEl){this.thinkingIsDone=false;this.thinkingProcessEl.classList.remove("tp-done");const t=this.thinkingProcessEl.querySelector(".tp-icon");if(t)t.textContent="smart_toy";const s=this.thinkingProcessEl.querySelector(".thinking-dots");if(s)s.style.display="";this.addThinkingStep("thought",e)}}appendMessage(e,t,s={}){var f;const r=document.createElement("div");r.className=\`agent-message agent-\${e}\`;const n=e==="user";const o=e==="response";const a=e==="executing";const l=e==="error";const h=n?"var(--agent-user-color)":o?"var(--agent-agent-color)":l?"var(--error)":"var(--on-surface-variant)";const c=n?\`person\`:o?\`smart_toy\`:a?\`terminal\`:\`error\`;let d;if(o){d=this.renderMarkdown(t||"")}else if(n){d=\`
\${Te(t)}
\`}else if(a){d=\`
\${Te(t)}
\`}else{d=\`
\${Te(t)}
\`}const u=n&&s.hasTerminalSelection?\`
+ \`;const n=r.querySelector(".agent-confirm-no");const o=r.querySelector(".agent-confirm-yes");this.pendingConfirmation={command:e,element:r,previousFocus:document.activeElement instanceof HTMLElement?document.activeElement:null};n.addEventListener("click",()=>{this.resolvePendingConfirmation(false)});o.addEventListener("click",()=>{this.resolvePendingConfirmation(true)});r.addEventListener("keydown",c=>{if(c.key==="Escape"){c.preventDefault();c.stopPropagation();this.resolvePendingConfirmation(false);return}if(c.key!=="Tab")return;const d=n;const u=o;if(c.shiftKey&&document.activeElement===d){c.preventDefault();u.focus()}else if(!c.shiftKey&&document.activeElement===u){c.preventDefault();d.focus()}});(h=this.messagesEl)==null?void 0:h.appendChild(r);this.scrollToBottom();requestAnimationFrame(()=>n.focus())}resolvePendingConfirmation(e,t=true){var r;const s=this.pendingConfirmation;if(!s)return;this.pendingConfirmation=null;(r=this.wsSend)==null?void 0:r.call(this,JSON.stringify({type:"agent_confirm",approved:e,command:s.command}));s.element.remove();this.isWaitingConfirmation=false;this.updateInputState();if(t){requestAnimationFrame(()=>{var o;const n=((o=s.previousFocus)==null?void 0:o.isConnected)?s.previousFocus:this.inputEl;n==null?void 0:n.focus()})}}convertStreamToThoughtStep(){if(!this.streamingEl)return;const e=this.streamingText.trim();this.streamingEl.remove();this.streamingEl=null;this.streamingText="";if(e&&this.thinkingProcessEl){this.thinkingIsDone=false;this.thinkingProcessEl.classList.remove("tp-done");const t=this.thinkingProcessEl.querySelector(".tp-icon");if(t)t.textContent="smart_toy";const s=this.thinkingProcessEl.querySelector(".thinking-dots");if(s)s.style.display="";this.addThinkingStep("thought",e)}}appendMessage(e,t,s={}){var f;const r=document.createElement("div");r.className=\`agent-message agent-\${e}\`;const n=e==="user";const o=e==="response";const a=e==="executing";const l=e==="error";const h=n?"var(--agent-user-color)":o?"var(--agent-agent-color)":l?"var(--error)":"var(--on-surface-variant)";const c=n?\`person\`:o?\`smart_toy\`:a?\`terminal\`:\`error\`;let d;if(o){d=this.renderMarkdown(t||"")}else if(n){d=\`
\${Se(t)}
\`}else if(a){d=\`
\${Se(t)}
\`}else{d=\`
\${Se(t)}
\`}const u=n&&s.hasTerminalSelection?\`
\${g("agent.selectionAttachedMessage")}
\`:"";if(n){r.innerHTML=\` @@ -579,7 +579,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

\${c}
\${d}
- \`}(f=this.messagesEl)==null?void 0:f.appendChild(r);if(o){this.enhanceCodeBlocks(r)}this.scrollToBottom()}renderMarkdown(e){let t;try{t=Qe.parse(e,{async:false})}catch{return\`
\${Te(e)}
\`}const s=w$.sanitize(t,{ADD_ATTR:["target","rel","class","loading","data-code-language"],ALLOW_UNKNOWN_PROTOCOLS:false,USE_PROFILES:{html:true}});return\`
\${s}
\`}enhanceCodeBlocks(e){e.querySelectorAll(".agent-md-code-block").forEach(t=>{if(t.dataset.actionsReady==="true")return;const s=t.querySelector("code");const r=t.querySelector(".agent-md-code-actions");const n=t.querySelector(".agent-md-code-meta");if(!s||!r||!n)return;const o=s.textContent||"";const a=this.createCodeActionButton("copy","content_copy",g("agent.codeCopy"));a.addEventListener("click",async()=>{const h=await Hn(o);this.showCodeActionFeedback(a,h?"check":"error",h?g("agent.codeCopied"):g("agent.codeCopyFailed"))});r.appendChild(a);const l=bE(t.dataset.codeLanguage,o);if(l&&this.getTerminalFillTarget&&this.fillTerminalInput){const h=this.getTerminalFillTarget();n.textContent=g("agent.codeTarget",{target:h.label});n.title=h.label;const c=this.createCodeActionButton("fill","input",g("agent.codeFill"));c.disabled=!h.available;c.addEventListener("click",()=>{var f,p;const d=(f=this.getTerminalFillTarget)==null?void 0:f.call(this);const u=!!(d==null?void 0:d.available)&&!!((p=this.fillTerminalInput)==null?void 0:p.call(this,l));this.showCodeActionFeedback(c,u?"check":"error",u?g("agent.codeFilled"):g("agent.codeFillFailed"))});r.appendChild(c)}t.dataset.actionsReady="true"})}refreshCodeBlockActions(){var e;(e=this.panelEl)==null?void 0:e.querySelectorAll(".agent-md-code-block").forEach(t=>{var n;const s=t.querySelector('[data-code-action="copy"]');if(s)this.setCodeActionButton(s,"content_copy",g("agent.codeCopy"));const r=t.querySelector('[data-code-action="fill"]');if(r){this.setCodeActionButton(r,"input",g("agent.codeFill"));const o=(n=this.getTerminalFillTarget)==null?void 0:n.call(this);r.disabled=!(o==null?void 0:o.available);const a=t.querySelector(".agent-md-code-meta");if(a&&o){a.textContent=g("agent.codeTarget",{target:o.label});a.title=o.label}}})}createCodeActionButton(e,t,s){const r=document.createElement("button");r.type="button";r.className="agent-md-code-action";r.dataset.codeAction=e;this.setCodeActionButton(r,t,s);return r}setCodeActionButton(e,t,s){e.replaceChildren();const r=document.createElement("span");r.className="material-symbols-outlined";r.setAttribute("aria-hidden","true");r.textContent=t;const n=document.createElement("span");n.textContent=s;e.append(r,n);e.title=s;e.setAttribute("aria-label",s)}showCodeActionFeedback(e,t,s){this.setCodeActionButton(e,t,s);window.setTimeout(()=>{if(!e.isConnected)return;const r=e.dataset.codeAction==="fill";this.setCodeActionButton(e,r?"input":"content_copy",r?g("agent.codeFill"):g("agent.codeCopy"))},1600)}scrollToBottom(){if(this.messagesEl){requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight})}}dispose(){var e,t;this.rejectPendingConfirmation(false);(e=this.localeCleanup)==null?void 0:e.call(this);this.localeCleanup=null;this.pendingTerminalSelection=null;(t=this.panelEl)==null?void 0:t.remove();this.panelEl=null;this.messagesEl=null;this.contextEl=null;this.inputEl=null;this.sendBtn=null;this.memoryDrawerEl=null;this.memoryTabWorkLogBtn=null;this.memoryTabKnowledgeBtn=null;this.memoryContentEl=null;this.memoryCountEl=null;this.memoryAddBtn=null;this.memoryAddFormContainerEl=null;this.isVisible=false;document.body.classList.remove("agent-panel-open")}toggleMemoryDrawer(){if(this.isMemoryDrawerOpen){this.closeMemoryDrawer()}else{this.openMemoryDrawer()}}openMemoryDrawer(){this.isMemoryDrawerOpen=true;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.remove("hidden")}void this.fetchServerMemory()}closeMemoryDrawer(){this.isMemoryDrawerOpen=false;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.add("hidden")}this.closeAddKnowledgeForm()}switchMemoryTab(e){var t,s;this.activeMemoryTab=e;if(this.memoryTabWorkLogBtn&&this.memoryTabKnowledgeBtn){if(e==="workLog"){this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";(t=this.memoryAddBtn)==null?void 0:t.classList.add("hidden")}else{this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";(s=this.memoryAddBtn)==null?void 0:s.classList.remove("hidden")}}this.closeAddKnowledgeForm();this.renderMemoryContent()}async fetchServerMemory(){if(!this.serverId){this.unifiedMemory={workLogs:[],knowledge:[]};this.renderMemoryContent();return}try{const e=await fetch(\`/api/servers/\${this.serverId}/memory\`);if(e.ok){this.unifiedMemory=await e.json()}else{this.unifiedMemory={workLogs:[],knowledge:[]}}}catch{this.unifiedMemory={workLogs:[],knowledge:[]}}this.renderMemoryContent()}renderMemoryContent(){if(!this.memoryContentEl)return;const e=v1()==="en-US"?"en-US":"zh-CN";if(this.memoryCountEl){if(this.activeMemoryTab==="workLog"){this.memoryCountEl.textContent=this.serverId?\`(\${this.unifiedMemory.workLogs.length}/\${dE})\`:""}else{this.memoryCountEl.textContent=this.serverId?\`(\${this.unifiedMemory.knowledge.length}/\${uE})\`:""}}if(!this.serverId){this.memoryContentEl.innerHTML=\` + \`}(f=this.messagesEl)==null?void 0:f.appendChild(r);if(o){this.enhanceCodeBlocks(r)}this.scrollToBottom()}renderMarkdown(e){let t;try{t=Qe.parse(e,{async:false})}catch{return\`
\${Se(e)}
\`}const s=w$.sanitize(t,{ADD_ATTR:["target","rel","class","loading","data-code-language"],ALLOW_UNKNOWN_PROTOCOLS:false,USE_PROFILES:{html:true}});return\`
\${s}
\`}enhanceCodeBlocks(e){e.querySelectorAll(".agent-md-code-block").forEach(t=>{if(t.dataset.actionsReady==="true")return;const s=t.querySelector("code");const r=t.querySelector(".agent-md-code-actions");const n=t.querySelector(".agent-md-code-meta");if(!s||!r||!n)return;const o=s.textContent||"";const a=this.createCodeActionButton("copy","content_copy",g("agent.codeCopy"));a.addEventListener("click",async()=>{const h=await Hn(o);this.showCodeActionFeedback(a,h?"check":"error",h?g("agent.codeCopied"):g("agent.codeCopyFailed"))});r.appendChild(a);const l=bE(t.dataset.codeLanguage,o);if(l&&this.getTerminalFillTarget&&this.fillTerminalInput){const h=this.getTerminalFillTarget();n.textContent=g("agent.codeTarget",{target:h.label});n.title=h.label;const c=this.createCodeActionButton("fill","input",g("agent.codeFill"));c.disabled=!h.available;c.addEventListener("click",()=>{var f,p;const d=(f=this.getTerminalFillTarget)==null?void 0:f.call(this);const u=!!(d==null?void 0:d.available)&&!!((p=this.fillTerminalInput)==null?void 0:p.call(this,l));this.showCodeActionFeedback(c,u?"check":"error",u?g("agent.codeFilled"):g("agent.codeFillFailed"))});r.appendChild(c)}t.dataset.actionsReady="true"})}refreshCodeBlockActions(){var e;(e=this.panelEl)==null?void 0:e.querySelectorAll(".agent-md-code-block").forEach(t=>{var n;const s=t.querySelector('[data-code-action="copy"]');if(s)this.setCodeActionButton(s,"content_copy",g("agent.codeCopy"));const r=t.querySelector('[data-code-action="fill"]');if(r){this.setCodeActionButton(r,"input",g("agent.codeFill"));const o=(n=this.getTerminalFillTarget)==null?void 0:n.call(this);r.disabled=!(o==null?void 0:o.available);const a=t.querySelector(".agent-md-code-meta");if(a&&o){a.textContent=g("agent.codeTarget",{target:o.label});a.title=o.label}}})}createCodeActionButton(e,t,s){const r=document.createElement("button");r.type="button";r.className="agent-md-code-action";r.dataset.codeAction=e;this.setCodeActionButton(r,t,s);return r}setCodeActionButton(e,t,s){e.replaceChildren();const r=document.createElement("span");r.className="material-symbols-outlined";r.setAttribute("aria-hidden","true");r.textContent=t;const n=document.createElement("span");n.textContent=s;e.append(r,n);e.title=s;e.setAttribute("aria-label",s)}showCodeActionFeedback(e,t,s){this.setCodeActionButton(e,t,s);window.setTimeout(()=>{if(!e.isConnected)return;const r=e.dataset.codeAction==="fill";this.setCodeActionButton(e,r?"input":"content_copy",r?g("agent.codeFill"):g("agent.codeCopy"))},1600)}scrollToBottom(){if(this.messagesEl){requestAnimationFrame(()=>{this.messagesEl.scrollTop=this.messagesEl.scrollHeight})}}dispose(){var e,t;this.rejectPendingConfirmation(false);(e=this.localeCleanup)==null?void 0:e.call(this);this.localeCleanup=null;this.pendingTerminalSelection=null;(t=this.panelEl)==null?void 0:t.remove();this.panelEl=null;this.messagesEl=null;this.contextEl=null;this.inputEl=null;this.sendBtn=null;this.memoryDrawerEl=null;this.memoryTabWorkLogBtn=null;this.memoryTabKnowledgeBtn=null;this.memoryContentEl=null;this.memoryCountEl=null;this.memoryAddBtn=null;this.memoryAddFormContainerEl=null;this.isVisible=false;document.body.classList.remove("agent-panel-open")}toggleMemoryDrawer(){if(this.isMemoryDrawerOpen){this.closeMemoryDrawer()}else{this.openMemoryDrawer()}}openMemoryDrawer(){this.isMemoryDrawerOpen=true;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.remove("hidden")}void this.fetchServerMemory()}closeMemoryDrawer(){this.isMemoryDrawerOpen=false;if(this.memoryDrawerEl){this.memoryDrawerEl.classList.add("hidden")}this.closeAddKnowledgeForm()}switchMemoryTab(e){var t,s;this.activeMemoryTab=e;if(this.memoryTabWorkLogBtn&&this.memoryTabKnowledgeBtn){if(e==="workLog"){this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";(t=this.memoryAddBtn)==null?void 0:t.classList.add("hidden")}else{this.memoryTabWorkLogBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-transparent text-muted hover:text-primary transition-colors cursor-pointer";this.memoryTabKnowledgeBtn.className="flex-1 py-1.5 text-center font-medium border-b-2 border-[var(--accent)] text-[var(--accent)] transition-colors cursor-pointer";(s=this.memoryAddBtn)==null?void 0:s.classList.remove("hidden")}}this.closeAddKnowledgeForm();this.renderMemoryContent()}async fetchServerMemory(){if(!this.serverId){this.unifiedMemory={workLogs:[],knowledge:[]};this.renderMemoryContent();return}try{const e=await fetch(\`/api/servers/\${this.serverId}/memory\`);if(e.ok){this.unifiedMemory=await e.json()}else{this.unifiedMemory={workLogs:[],knowledge:[]}}}catch{this.unifiedMemory={workLogs:[],knowledge:[]}}this.renderMemoryContent()}renderMemoryContent(){if(!this.memoryContentEl)return;const e=v1()==="en-US"?"en-US":"zh-CN";if(this.memoryCountEl){if(this.activeMemoryTab==="workLog"){this.memoryCountEl.textContent=this.serverId?\`(\${this.unifiedMemory.workLogs.length}/\${dE})\`:""}else{this.memoryCountEl.textContent=this.serverId?\`(\${this.unifiedMemory.knowledge.length}/\${uE})\`:""}}if(!this.serverId){this.memoryContentEl.innerHTML=\`
\${g("agent.memoryDirectNotice")}
@@ -591,16 +591,16 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

- \${Te(o.title)} - \${Te(a)} + \${Se(o.title)} + \${Se(a)}
-
\${Te(o.summary)}
+
\${Se(o.summary)}
- \`}).join("");this.memoryContentEl.innerHTML=n;this.memoryContentEl.querySelectorAll(".agent-log-delete-btn").forEach(o=>{o.addEventListener("click",async()=>{const a=Number(o.dataset.id);if(!a||!this.serverId)return;const l=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!l)return;try{const h=await fetch(\`/api/servers/\${this.serverId}/work-logs/\${a}\`,{method:"DELETE"});if(h.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})});return}if(this.unifiedMemory.knowledge.length===0){this.memoryContentEl.innerHTML=\` + \`}).join("");this.memoryContentEl.innerHTML=n;this.memoryContentEl.querySelectorAll(".agent-log-summary").forEach(o=>{o.addEventListener("click",a=>{a.stopPropagation();o.classList.toggle("expanded")})});this.memoryContentEl.querySelectorAll(".agent-log-delete-btn").forEach(o=>{o.addEventListener("click",async()=>{const a=Number(o.dataset.id);if(!a||!this.serverId)return;const l=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!l)return;try{const h=await fetch(\`/api/servers/\${this.serverId}/work-logs/\${a}\`,{method:"DELETE"});if(h.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})});return}if(this.unifiedMemory.knowledge.length===0){this.memoryContentEl.innerHTML=\`
\${g("agent.knowledgeEmpty")}
@@ -608,8 +608,8 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

- \${Te(o.label)} - \${Te(n.key)} + \${Se(o.label)} + \${Se(n.key)}
\${a?\` @@ -617,7 +617,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro \${l?"visibility_off":"visibility"} \`:""} -

-
\${Te(h)}
+
\${Se(h)}
\`}).join("");this.memoryContentEl.innerHTML=r;this.memoryContentEl.querySelectorAll(".agent-secret-toggle-btn").forEach(n=>{n.addEventListener("click",()=>{const o=Number(n.dataset.id);if(this.revealedSecretIds.has(o)){this.revealedSecretIds.delete(o)}else{this.revealedSecretIds.add(o)}this.renderMemoryContent()})});this.memoryContentEl.querySelectorAll(".agent-knowledge-copy-btn").forEach(n=>{n.addEventListener("click",async()=>{const o=n.dataset.value||"";await Hn(o);Y(g("agent.copySuccess"),{variant:"success"})})});this.memoryContentEl.querySelectorAll(".agent-knowledge-delete-btn").forEach(n=>{n.addEventListener("click",async()=>{const o=Number(n.dataset.id);if(!o||!this.serverId)return;const a=await Ui({title:g("common.delete"),message:g("agent.memoryDeleteConfirm"),variant:"danger"});if(!a)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge/\${o}\`,{method:"DELETE"});if(l.ok){Y(g("agent.memoryDeleted"),{variant:"success"});void this.fetchServerMemory()}}catch{}})})}toggleAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;if(this.memoryAddFormContainerEl.classList.contains("hidden")){this.openAddKnowledgeForm()}else{this.closeAddKnowledgeForm()}}openAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.remove("hidden");this.memoryAddFormContainerEl.innerHTML=\`
@@ -646,7 +646,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

- \`;const e=this.memoryAddFormContainerEl.querySelector("#agent-add-knowledge-form");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-cancel-btn");t==null?void 0:t.addEventListener("click",()=>this.closeAddKnowledgeForm());e==null?void 0:e.addEventListener("submit",async r=>{r.preventDefault();await this.handleSaveKnowledge()});const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");s==null?void 0:s.focus()}closeAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.add("hidden");this.memoryAddFormContainerEl.replaceChildren()}async handleSaveKnowledge(){if(!this.serverId||!this.memoryAddFormContainerEl)return;const e=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-category");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-value");const r=(e==null?void 0:e.value)||"note";const n=(t==null?void 0:t.value)||"";const o=(s==null?void 0:s.value)||"";const a=_E({category:r,key:n,value:o});if(!a.ok)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge\`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(l.ok){Y(g("agent.memorySaved"),{variant:"success"});this.closeAddKnowledgeForm();void this.fetchServerMemory()}}catch{}}}const kE={cf:{goodMax:100,fairMax:250},ws:{goodMax:100,fairMax:200}};function t_(i,e){const t=kE[e];if(i<=t.goodMax)return"good";if(i<=t.fairMax)return"fair";return"poor"}let nm=[];let Uw=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=Uw[s])e=s+1;else return true;if(e==t)return false}}function i_(i){return i>=127462&&i<=127487}const s_=8205;function TE(i,e,t=true,s=true){return(t?jw:PE)(i,e,s)}function jw(i,e,t){if(e==i.length)return e;if(e&&Hw(i.charCodeAt(e))&&Vw(i.charCodeAt(e-1)))e--;let s=nf(i,e);e+=r_(s);while(e=0&&i_(nf(i,o))){n++;o-=2}if(n%2==0)break;else e+=2}else{break}}return e}function PE(i,e,t){while(e>1){let s=jw(i,e-2,t);if(s=56320&&i<57344}function Vw(i){return i>=55296&&i<56320}function r_(i){return i<65536?1:2}let Pe=class Yw{lineAt(e){if(e<0||e>this.length)throw new RangeError(\`Invalid position \${e} in document of length \${this.length}\`);return this.lineInner(e,false,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(\`Invalid line number \${e} in \${this.lines}-line document\`);return this.lineInner(e,true,1,0)}replace(e,t,s){[e,t]=ia(this,e,t);let r=[];this.decompose(0,e,r,2);if(s.length)s.decompose(0,s.length,r,1|2);this.decompose(t,this.length,r,1);return $s.from(r,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ia(this,e,t);let s=[];this.decompose(e,t,s,0);return $s.from(s,t-e)}eq(e){if(e==this)return true;if(e.length!=this.length||e.lines!=this.lines)return false;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1);let r=new pl(this),n=new pl(e);for(let o=t,a=t;;){r.next(o);n.next(o);o=0;if(r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return false;a+=r.value.length;if(r.done||a>=s)return true}}iter(e=1){return new pl(this,e)}iterRange(e,t=this.length){return new Gw(this,e,t)}iterLines(e,t){let s;if(e==null){s=this.iter()}else{if(t==null)t=this.lines+1;let r=this.line(e).from;s=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kw(s)}toString(){return this.sliceString(0)}toJSON(){let e=[];this.flatten(e);return e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");if(e.length==1&&!e[0])return Yw.empty;return e.length<=32?new nt(e):$s.from(nt.split(e,[]))}};class nt extends Pe{constructor(e,t=$E(e)){super();this.text=e;this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.text[n],a=r+o.length;if((t?s:a)>=e)return new EE(r,a,s,o);r=a+1;s++}}decompose(e,t,s,r){let n=e<=0&&t>=this.length?this:new nt(n_(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=s.pop();let a=Ec(n.text,o.text.slice(),0,n.length);if(a.length<=32){s.push(new nt(a,o.length+n.length))}else{let l=a.length>>1;s.push(new nt(a.slice(0,l)),new nt(a.slice(l)))}}else{s.push(n)}}replace(e,t,s){if(!(s instanceof nt))return super.replace(e,t,s);[e,t]=ia(this,e,t);let r=Ec(this.text,Ec(s.text,n_(this.text,0,e)),t);let n=this.length+s.length-(t-e);if(r.length<=32)return new nt(r,n);return $s.from(nt.split(r,[]),n)}sliceString(e,t=this.length,s="\\n"){[e,t]=ia(this,e,t);let r="";for(let n=0,o=0;n<=t&&oe&&o)r+=s;if(en)r+=a.slice(Math.max(0,e-n),t-n);n=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let s=[],r=-1;for(let n of e){s.push(n);r+=n.length+1;if(s.length==32){t.push(new nt(s,r));s=[];r=-1}}if(r>-1)t.push(new nt(s,r));return t}}class $s extends Pe{constructor(e,t){super();this.children=e;this.length=t;this.lines=0;for(let s of e)this.lines+=s.lines}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.children[n],a=r+o.length,l=s+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,s,r);r=a+1;s=l+1}}decompose(e,t,s,r){for(let n=0,o=0;o<=t&&n=o){let h=r&((o<=e?1:0)|(l>=t?2:0));if(o>=e&&l<=t&&!h)s.push(a);else a.decompose(e-o,t-o,s,h)}o=l+1}}replace(e,t,s){[e,t]=ia(this,e,t);if(s.lines=n&&t<=a){let l=o.replace(e-n,t-n,s);let h=this.lines-o.lines+l.lines;if(l.lines>5-1&&l.lines>h>>5+1){let c=this.children.slice();c[r]=l;return new $s(c,this.length-(t-e)+s.length)}return super.replace(n,a,l)}n=a+1}return super.replace(e,t,s)}sliceString(e,t=this.length,s="\\n"){[e,t]=ia(this,e,t);let r="";for(let n=0,o=0;ne&&n)r+=s;if(eo)r+=a.sliceString(e-o,t-o,s);o=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof $s))return 0;let s=0;let[r,n,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,n+=t){if(r==o||n==a)return s;let l=this.children[r],h=e.children[n];if(l!=h)return s+l.scanIdentical(h,t);s+=l.length+1}}static from(e,t=e.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let f of e)s+=f.lines;if(s<32){let f=[];for(let p of e)p.flatten(f);return new nt(f,t)}let r=Math.max(32,s>>5),n=r<<1,o=r>>1;let a=[],l=0,h=-1,c=[];function d(f){let p;if(f.lines>n&&f instanceof $s){for(let m of f.children)d(m)}else if(f.lines>o&&(l>o||!l)){u();a.push(f)}else if(f instanceof nt&&l&&(p=c[c.length-1])instanceof nt&&f.lines+p.lines<=32){l+=f.lines;h+=f.length+1;c[c.length-1]=new nt(p.text.concat(f.text),p.length+1+f.length)}else{if(l+f.lines>r)u();l+=f.lines;h+=f.length+1;c.push(f)}}function u(){if(l==0)return;a.push(c.length==1?c[0]:$s.from(c,h));h=-1;l=c.length=0}for(let f of e)d(f);u();return a.length==1?a[0]:new $s(a,t)}}Pe.empty=new nt([""],0);function $E(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Ec(i,e,t=0,s=1e9){for(let r=0,n=0,o=true;n=t){if(l>s)a=a.slice(0,s-r);if(r0?1:(e instanceof nt?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=false;for(;;){let s=this.nodes.length-1;let r=this.nodes[s],n=this.offsets[s],o=n>>1;let a=r instanceof nt?r.text.length:r.children.length;if(o==(t>0?a:0)){if(s==0){this.done=true;this.value="";return this}if(t>0)this.offsets[s-1]++;this.nodes.pop();this.offsets.pop()}else if((n&1)==(t>0?0:1)){this.offsets[s]+=t;if(e==0){this.lineBreak=true;this.value="\\n";return this}e--}else if(r instanceof nt){let l=r.text[o+(t<0?-1:0)];this.offsets[s]+=t;if(l.length>Math.max(0,e)){this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e);return this}e-=l.length}else{let l=r.children[o+(t<0?-1:0)];if(e>l.length){e-=l.length;this.offsets[s]+=t}else{if(t<0)this.offsets[s]--;this.nodes.push(l);this.offsets.push(t>0?1:(l instanceof nt?l.text.length:l.children.length)<<1)}}}}next(e=0){if(e<0){this.nextInner(-e,-this.dir);e=this.value.length}return this.nextInner(e,this.dir)}}class Gw{constructor(e,t,s){this.value="";this.done=false;this.cursor=new pl(e,t>s?-1:1);this.pos=t>s?e.length:0;this.from=Math.min(t,s);this.to=Math.max(t,s)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to){this.value="";this.done=true;return this}e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let s=t<0?this.pos-this.from:this.to-this.pos;if(e>s)e=s;s-=e;let{value:r}=this.cursor.next(e);this.pos+=(r.length+e)*t;this.value=r.length<=s?r:t<0?r.slice(r.length-s):r.slice(0,s);this.done=!this.value;return this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Kw{constructor(e){this.inner=e;this.afterBreak=true;this.value="";this.done=false}next(e=0){let{done:t,lineBreak:s,value:r}=this.inner.next(e);if(t&&this.afterBreak){this.value="";this.afterBreak=false}else if(t){this.done=true;this.value=""}else if(s){if(this.afterBreak){this.value=""}else{this.afterBreak=true;this.next()}}else{this.value=r;this.afterBreak=false}return this}get lineBreak(){return false}}if(typeof Symbol!="undefined"){Pe.prototype[Symbol.iterator]=function(){return this.iter()};pl.prototype[Symbol.iterator]=Gw.prototype[Symbol.iterator]=Kw.prototype[Symbol.iterator]=function(){return this}}let EE=class EU{constructor(e,t,s,r){this.from=e;this.to=t;this.number=s;this.text=r}get length(){return this.to-this.from}};function ia(i,e,t){e=Math.max(0,Math.min(i.length,e));return[e,Math.max(e,Math.min(i.length,t))]}function Rt(i,e,t=true,s=true){return TE(i,e,t,s)}function QE(i){return i>=56320&&i<57344}function RE(i){return i>=55296&&i<56320}function Jw(i,e){let t=i.charCodeAt(e);if(!RE(t)||e+1==i.length)return t;let s=i.charCodeAt(e+1);if(!QE(s))return t;return(t-55296<<10)+(s-56320)+65536}function AE(i){if(i<=65535)return String.fromCharCode(i);i-=65536;return String.fromCharCode((i>>10)+55296,(i&1023)+56320)}function e2(i){return i<65536?1:2}const om=/\\r\\n?|\\n/;var oi=function(i){i[i["Simple"]=0]="Simple";i[i["TrackDel"]=1]="TrackDel";i[i["TrackBefore"]=2]="TrackBefore";i[i["TrackAfter"]=3]="TrackAfter";return i}(oi||(oi={}));class zs{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return n+(e-r);n+=a}else{if(s!=oi.Simple&&h>=e&&(s==oi.TrackDel&&re||s==oi.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!a)return e==r||t<0?n:n+l;n+=l}r=h}if(e>r)throw new RangeError(\`Position \${e} is out of range for changeset of length \${r}\`);return n}touchesRange(e,t=e){for(let s=0,r=0;s=0&&r<=t&&a>=e)return rt?"cover":true;r=a}return false}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new zs(e)}static create(e){return new zs(e)}}class _t extends zs{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");am(this,(t,s,r,n,o)=>e=e.replace(r,r+(s-t),o),false);return e}mapDesc(e,t=false){return lm(this,e,t,true)}invert(e){let t=this.sections.slice(),s=[];for(let r=0,n=0;r=0){t[r]=a;t[r+1]=o;let l=r>>1;while(s.length0)Yr(s,t,n.text);n.forward(c);a+=c}let h=e[o++];while(a>1].toJSON()))}return e}static of(e,t,s){let r=[],n=[],o=0;let a=null;function l(c=false){if(!c&&!r.length)return;if(ou||d<0||u>t)throw new RangeError(\`Invalid change range \${d} to \${u} (in doc of length \${t})\`);let p=!f?Pe.empty:typeof f=="string"?Pe.of(f.split(s||om)):f;let m=p.length;if(d==u&&m==0)return;if(do)Ht(r,d-o,-1);Ht(r,u-d,m);Yr(n,r,p);o=u}}h(e);l(!a);return a}static empty(e){return new _t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],s=[];for(let r=0;ra&&typeof o!="string")){throw new RangeError("Invalid JSON representation of ChangeSet")}else if(n.length==1){t.push(n[0],0)}else{while(s.length=0&&t<=0&&t==i[r+1])i[r]+=e;else if(r>=0&&e==0&&i[r]==0)i[r+1]+=t;else if(s){i[r]+=e;i[r+1]+=t}else i.push(e,t)}function Yr(i,e,t){if(t.length==0)return;let s=e.length-2>>1;if(s>1]);if(t||o==i.sections.length||i.sections[o+1]<0)break;a=i.sections[o++];l=i.sections[o++]}e(r,h,n,c,d);r=h;n=c}}}function lm(i,e,t,s=false){let r=[],n=s?[]:null;let o=new Ml(i),a=new Ml(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len){throw new Error("Mismatched change set lengths")}else if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);Ht(r,h,-1);o.forward(h);a.forward(h)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len=0&&l=0){let h=0,c=o.len;while(c){if(a.ins==-1){let d=Math.min(c,a.len);h+=d;c-=d;a.forward(d)}else if(a.ins==0&&a.lenl||o.ins>=0&&o.len>l)&&(a||s.length>h);n.forward2(l);o.forward(l)}}}class Ml{constructor(e){this.set=e;this.i=0;this.next()}next(){let{sections:e}=this.set;if(this.i>1;return t>=e.length?Pe.empty:e[t]}textBit(e){let{inserted:t}=this.set,s=this.i-2>>1;return s>=t.length&&!e?Pe.empty:t[s].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else{this.len-=e;this.off+=e}}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else{this.ins-=e;this.off+=e}}}class Zr{constructor(e,t,s,r){this.from=e;this.to=t;this.flags=s;this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let s,r;if(this.empty){s=r=e.mapPos(this.from,t)}else{s=e.mapPos(this.from,1);r=e.mapPos(this.to,-1)}return s==this.from&&r==this.to?this:new Zr(s,r,this.flags,this.goalColumn)}extend(e,t=e,s=0){if(e<=this.anchor&&t>=this.anchor)return z.range(e,t,void 0,void 0,s);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return z.range(this.anchor,r,void 0,void 0,s)}eq(e,t=false){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return z.range(e.anchor,e.head)}static create(e,t,s,r){return new Zr(e,t,s,r)}}class z{constructor(e,t){this.ranges=e;this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return z.create(this.ranges.map(s=>s.map(e,t)),this.mainIndex)}eq(e,t=false){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return false;for(let s=0;se.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new z(e.ranges.map(t=>Zr.fromJSON(t)),e.main)}static single(e,t=e){return new z([z.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,r=0;rr.from-n.from);t=e.indexOf(s);for(let r=1;rn.head?z.range(l,a):z.range(a,l))}}return new z(e,t)}}function i2(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let QO=0;class te{constructor(e,t,s,r,n){this.combine=e;this.compareInput=t;this.compare=s;this.isStatic=r;this.id=QO++;this.default=e([]);this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new te(e.combine||(t=>t),e.compareInput||((t,s)=>t===s),e.compare||(!e.combine?RO:(t,s)=>t===s),!!e.static,e.enables)}of(e){return new Qc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,2,t)}from(e,t){if(!t)t=s=>s;return this.compute([e],s=>t(s.field(e)))}}function RO(i,e){return i==e||i.length==e.length&&i.every((t,s)=>t===e[s])}class Qc{constructor(e,t,s,r){this.dependencies=e;this.facet=t;this.type=s;this.value=r;this.id=QO++}dynamicSlot(e){var t;let s=this.value;let r=this.facet.compareInput;let n=this.id,o=e[n]>>1,a=this.type==2;let l=false,h=false,c=[];for(let d of this.dependencies){if(d=="doc")l=true;else if(d=="selection")h=true;else if((((t=e[d.id])!==null&&t!==void 0?t:1)&1)==0)c.push(e[d.id])}return{create(d){d.values[o]=s(d);return 1},update(d,u){if(l&&u.docChanged||h&&(u.docChanged||u.selection)||hm(d,c)){let f=s(d);if(a?!o_(f,d.values[o],r):!r(f,d.values[o])){d.values[o]=f;return 1}}return 0},reconfigure:(d,u)=>{let f,p=u.config.address[n];if(p!=null){let m=dd(u,p);if(this.dependencies.every(O=>{return O instanceof te?u.facet(O)===d.facet(O):O instanceof ji?u.field(O,false)==d.field(O,false):true})||(a?o_(f=s(d),m,r):r(f=s(d),m))){d.values[o]=m;return 0}}else{f=s(d)}d.values[o]=f;return 1}}}get extension(){return this}}function o_(i,e,t){if(i.length!=e.length)return false;for(let s=0;si[l.id]);let r=t.map(l=>l.type);let n=s.filter(l=>!(l&1));let o=i[e.id]>>1;function a(l){let h=[];for(let c=0;cs===r),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(Wh).find(s=>s.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:s=>{s.values[t]=this.create(s);return 1},update:(s,r)=>{let n=s.values[t];let o=this.updateF(n,r);if(this.compareF(n,o))return 0;s.values[t]=o;return 1},reconfigure:(s,r)=>{let n=s.facet(Wh),o=r.facet(Wh),a;if((a=n.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)){s.values[t]=a.create(s);return 1}if(r.config.address[this.id]!=null){s.values[t]=r.field(this);return 0}s.values[t]=this.create(s);return 1}}}init(e){return[this,Wh.of({field:this,create:e})]}get extension(){return this}}const $n={lowest:4,low:3,default:2,high:1,highest:0};function Qa(i){return e=>new s2(e,i)}const ho={highest:Qa($n.highest),high:Qa($n.high),default:Qa($n.default),low:Qa($n.low),lowest:Qa($n.lowest)};class s2{constructor(e,t){this.inner=e;this.prec=t}get extension(){return this}}class ch{of(e){return new cm(this,e)}reconfigure(e){return ch.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class cm{constructor(e,t){this.compartment=e;this.inner=t}get extension(){return this}}class cd{constructor(e,t,s,r,n,o){this.base=e;this.compartments=t;this.dynamicSlots=s;this.address=r;this.staticValues=n;this.facets=o;this.statusTemplate=[];while(this.statusTemplate.length>1]}static resolve(e,t,s){let r=[];let n=Object.create(null);let o=new Map;for(let u of ME(e,t,o)){if(u instanceof ji)r.push(u);else(n[u.facet.id]||(n[u.facet.id]=[])).push(u)}let a=Object.create(null);let l=[];let h=[];for(let u of r){a[u.id]=h.length<<1;h.push(f=>u.slot(f))}let c=s===null||s===void 0?void 0:s.config.facets;for(let u in n){let f=n[u],p=f[0].facet;let m=c&&c[u]||[];if(f.every(O=>O.type==0)){a[p.id]=l.length<<1|1;if(RO(m,f)){l.push(s.facet(p))}else{let O=p.combine(f.map(v=>v.value));l.push(s&&p.compare(O,s.facet(p))?s.facet(p):O)}}else{for(let O of f){if(O.type==0){a[O.id]=l.length<<1|1;l.push(O.value)}else{a[O.id]=h.length<<1;h.push(v=>O.dynamicSlot(v))}}a[p.id]=h.length<<1;h.push(O=>LE(O,p,f))}}let d=h.map(u=>u(a));return new cd(e,o,d,a,l,n)}}function ME(i,e,t){let s=[[],[],[],[],[]];let r=new Map;function n(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let h=s[l].indexOf(o);if(h>-1)s[l].splice(h,1);if(o instanceof cm)t.delete(o.compartment)}r.set(o,a);if(Array.isArray(o)){for(let h of o)n(h,a)}else if(o instanceof cm){if(t.has(o.compartment))throw new RangeError(\`Duplicate use of compartment in extensions\`);let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h);n(h,a)}else if(o instanceof s2){n(o.inner,o.prec)}else if(o instanceof ji){s[a].push(o);if(o.provides)n(o.provides,a)}else if(o instanceof Qc){s[a].push(o);if(o.facet.extensions)n(o.facet.extensions,$n.default)}else{let h=o.extension;if(!h)throw new Error(\`Unrecognized extension value in extension set (\${o}).\`);if(h==o)throw new Error(\`Unrecognized extension value in extension set (\${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.\`);n(h,a)}}n(i,$n.default);return s.reduce((o,a)=>o.concat(a))}function ml(i,e){if(e&1)return 2;let t=e>>1;let s=i.status[t];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function dd(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const r2=te.define();const dm=te.define({combine:i=>i.some(e=>e),static:true});const n2=te.define({combine:i=>i.length?i[0]:void 0,static:true});const o2=te.define();const a2=te.define();const l2=te.define();const h2=te.define({combine:i=>i.length?i[0]:false});class br{constructor(e,t){this.type=e;this.value=t}static define(){return new BE}}class BE{of(e){return new br(this,e)}}class IE{constructor(e){this.map=e}of(e){return new Ce(this,e)}}class Ce{constructor(e,t){this.type=e;this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ce(this.type,t)}is(e){return this.type==e}static define(e={}){return new IE(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let s=[];for(let r of e){let n=r.map(t);if(n)s.push(n)}return s}}Ce.reconfigure=Ce.define();Ce.appendConfig=Ce.define();class ut{constructor(e,t,s,r,n,o){this.startState=e;this.changes=t;this.selection=s;this.effects=r;this.annotations=n;this.scrollIntoView=o;this._doc=null;this._state=null;if(s)i2(s,t.newLength);if(!n.some(a=>a.type==ut.time))this.annotations=n.concat(ut.time.of(Date.now()))}static create(e,t,s,r,n,o){return new ut(e,t,s,r,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return void 0}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ut.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ut.time=br.define();ut.userEvent=br.define();ut.addToHistory=br.define();ut.remote=br.define();function DE(i,e){let t=[];for(let s=0,r=0;;){let n,o;if(s=i[s])){n=i[s++];o=i[s++]}else if(r=0;r--){let n=s[r](i);if(n instanceof ut)i=n;else if(Array.isArray(n)&&n.length==1&&n[0]instanceof ut)i=n[0];else i=d2(e,No(n),false)}return i}function WE(i){let e=i.startState,t=e.facet(l2),s=i;for(let r=t.length-1;r>=0;r--){let n=t[r](i);if(n&&Object.keys(n).length)s=c2(s,um(e,n,i.changes.newLength),true)}return s==i?i:ut.create(e,i.changes,i.selection,s.effects,s.annotations,s.scrollIntoView)}const qE=[];function No(i){return i==null?qE:Array.isArray(i)?i:[i]}var ot=function(i){i[i["Word"]=0]="Word";i[i["Space"]=1]="Space";i[i["Other"]=2]="Other";return i}(ot||(ot={}));const XE=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;let fm;try{fm=new RegExp("[\\\\p{Alphabetic}\\\\p{Number}_]","u")}catch(i){}function NE(i){if(fm)return fm.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||XE.test(t)))return true}return false}function FE(i){return e=>{if(!/\\S/.test(e))return ot.Space;if(NE(e))return ot.Word;for(let t=0;t-1)return ot.Word;return ot.Other}}class we{constructor(e,t,s,r,n,o){this.config=e;this.doc=t;this.selection=s;this.values=r;this.status=e.statusTemplate.slice();this.computeSlot=n;if(o)o._state=this;for(let a=0;ar.set(h,l));t=null}r.set(a.value.compartment,a.value.extension)}else if(a.is(Ce.reconfigure)){t=null;s=a.value}else if(a.is(Ce.appendConfig)){t=null;s=No(s).concat(a.value)}}let n;if(!t){t=cd.resolve(s,r,this);let a=new we(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null);n=a.values}else{n=e.startState.values.slice()}let o=e.startState.facet(dm)?e.newSelection:e.newSelection.asSingle();new we(t,e.newDoc,o,n,(a,l)=>l.update(a,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:z.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection;let s=e(t.ranges[0]);let r=this.changes(s.changes),n=[s.range];let o=No(s.effects);for(let a=1;ao.spec.fromJSON(a,l)))}}return we.create({doc:e.doc,selection:z.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=cd.resolve(e.extensions||[],new Map);let s=e.doc instanceof Pe?e.doc:Pe.of((e.doc||"").split(t.staticFacet(we.lineSeparator)||om));let r=!e.selection?z.single(0):e.selection instanceof z?e.selection:z.single(e.selection.anchor,e.selection.head);i2(r,s.length);if(!t.staticFacet(dm))r=r.asSingle();return new we(t,s,r,t.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(we.tabSize)}get lineBreak(){return this.facet(we.lineSeparator)||"\\n"}get readOnly(){return this.facet(h2)}phrase(e,...t){for(let s of this.facet(we.phrases))if(Object.prototype.hasOwnProperty.call(s,e)){e=s[e];break}if(t.length)e=e.replace(/\\$(\\$|\\d*)/g,(s,r)=>{if(r=="$")return"$";let n=+(r||1);return!n||n>t.length?s:t[n-1]});return e}languageDataAt(e,t,s=-1){let r=[];for(let n of this.facet(r2)){for(let o of n(this,t,s)){if(Object.prototype.hasOwnProperty.call(o,e))r.push(o[e])}}return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return FE(t.length?t[0]:"")}wordAt(e){let{text:t,from:s,length:r}=this.doc.lineAt(e);let n=this.charCategorizer(e);let o=e-s,a=e-s;while(o>0){let l=Rt(t,o,false);if(n(t.slice(l,o))!=ot.Word)break;o=l}while(ai.length?i[0]:4});we.lineSeparator=n2;we.readOnly=h2;we.phrases=te.define({compare(i,e){let t=Object.keys(i),s=Object.keys(e);return t.length==s.length&&t.every(r=>i[r]==e[r])}});we.languageData=r2;we.changeFilter=o2;we.transactionFilter=a2;we.transactionExtender=l2;ch.reconfigure=Ce.define();function co(i,e,t={}){let s={};for(let r of i)for(let n of Object.keys(r)){let o=r[n],a=s[n];if(a===void 0)s[n]=o;else if(a===o||o===void 0);else if(Object.hasOwnProperty.call(t,n))s[n]=t[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let r in e)if(s[r]===void 0)s[r]=e[r];return s}class an{eq(e){return this==e}range(e,t=e){return pm.create(e,t,this)}}an.prototype.startSide=an.prototype.endSide=0;an.prototype.point=false;an.prototype.mapMode=oi.TrackDel;function AO(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}let pm=class u2{constructor(e,t,s){this.from=e;this.to=t;this.value=s}static create(e,t,s){return new u2(e,t,s)}};function mm(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class LO{constructor(e,t,s,r){this.from=e;this.to=t;this.value=s;this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,s,r=0){let n=s?this.to:this.from;for(let o=r,a=n.length;;){if(o==a)return o;let l=o+a>>1;let h=n[l]-e||(s?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return h>=0?o:a;if(h>=0)a=l;else o=l+1}}between(e,t,s,r){for(let n=this.findIndex(t,-1e9,true),o=this.findIndex(s,1e9,false,n);nf||u==f&&h.startSide>0&&h.endSide<=0)continue}if((f-u||h.endSide-h.startSide)<0)continue;if(o<0)o=u;if(h.point)a=Math.max(a,f-u);s.push(h);r.push(u-o);n.push(f-o)}return{mapped:s.length?new LO(r,n,s,a):null,pos:o}}}class ye{constructor(e,t,s,r){this.chunkPos=e;this.chunk=t;this.nextLayer=s;this.maxPoint=r}static create(e,t,s,r){return new ye(e,t,s,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:s=false,filterFrom:r=0,filterTo:n=this.length}=e;let o=e.filter;if(t.length==0&&!o)return this;if(s)t=t.slice().sort(mm);if(this.isEmpty)return t.length?ye.of(t):this;let a=new f2(this,null,-1).goto(0),l=0,h=[];let c=new Yn;while(a.value||l=0){let d=t[l++];if(!c.addInner(d.from,d.to,d.value))h.push(d)}else if(a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||na.to||n=n&&e<=n+o.length&&o.between(n,e-n,t-n,s)===false)return}this.nextLayer.between(e,t,s)}iter(e=0){return Bl.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Bl.from(e).goto(t)}static compare(e,t,s,r,n=-1){let o=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=n);let a=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=n);let l=a_(o,a,s);let h=new Ra(o,l,n);let c=new Ra(a,l,n);s.iterGaps((d,u,f)=>l_(h,d,c,u,f,r));if(s.empty&&s.length==0)l_(h,0,c,0,0,r)}static eq(e,t,s=0,r){if(r==null)r=1e9-1;let n=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);let o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(n.length!=o.length)return false;if(!n.length)return true;let a=a_(n,o);let l=new Ra(n,a,0).goto(s),h=new Ra(o,a,0).goto(s);for(;;){if(l.to!=h.to||!gm(l.active,h.active)||l.point&&(!h.point||!AO(l.point,h.point)))return false;if(l.to>r)return true;l.next();h.next()}}static spans(e,t,s,r,n=-1){let o=new Ra(e,null,n).goto(t),a=t;let l=o.openStart;for(;;){let h=Math.min(o.to,s);if(o.point){let c=o.activeForPoint(o.to);let d=o.pointFroma){r.span(a,h,o.active,l);l=o.openEnd(h)}if(o.to>s)return l+(o.point&&o.to>s?1:0);a=o.to;o.next()}}static of(e,t=false){let s=new Yn;for(let r of e instanceof pm?[e]:t?ZE(e):e)s.add(r.from,r.to,r.value);return s.finish()}static join(e){if(!e.length)return ye.empty;let t=e[e.length-1];for(let s=e.length-2;s>=0;s--){for(let r=e[s];r!=ye.empty;r=r.nextLayer)t=new ye(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint))}return t}}ye.empty=new ye([],[],null,-1);function ZE(i){if(i.length>1)for(let e=i[0],t=1;t0)return i.slice().sort(mm);e=s}return i}ye.empty.nextLayer=ye.empty;class Yn{finishChunk(e){this.chunks.push(new LO(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;if(e){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(e,t,s){if(!this.addInner(e,t,s))(this.nextLayer||(this.nextLayer=new Yn)).add(e,t,s)}addInner(e,t,s){let r=e-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by \`from\` position and \`startSide\`");if(r<0)return false;if(this.from.length==250)this.finishChunk(true);if(this.chunkStart<0)this.chunkStart=e;this.from.push(e-this.chunkStart);this.to.push(t-this.chunkStart);this.last=s;this.lastFrom=e;this.lastTo=t;this.value.push(s);if(s.point)this.maxPoint=Math.max(this.maxPoint,t-e);return true}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return false;if(this.from.length)this.finishChunk(true);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint);this.chunks.push(t);this.chunkPos.push(e);let s=t.value.length-1;this.last=t.value[s];this.lastFrom=t.from[s]+e;this.lastTo=t.to[s]+e;return true}finish(){return this.finishInner(ye.empty)}finishInner(e){if(this.from.length)this.finishChunk(false);if(this.chunks.length==0)return e;let t=ye.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);this.from=null;return t}}function a_(i,e,t){let s=new Map;for(let n of i)for(let o=0;o=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){this.chunkIndex++;if(this.skip){while(this.chunkIndex=s)r.push(new f2(o,t,s,n))}}return r.length==1?r[0]:new Bl(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let s of this.heap)s.goto(e,t);for(let s=this.heap.length>>1;s>=0;s--)of(this.heap,s);this.next();return this}forward(e,t){for(let s of this.heap)s.forward(e,t);for(let s=this.heap.length>>1;s>=0;s--)of(this.heap,s);if((this.to-e||this.value.endSide-t)<0)this.next()}next(){if(this.heap.length==0){this.from=this.to=1e9;this.value=null;this.rank=-1}else{let e=this.heap[0];this.from=e.from;this.to=e.to;this.value=e.value;this.rank=e.rank;if(e.value)e.next();of(this.heap,0)}}}function of(i,e){for(let t=i[e];;){let s=(e<<1)+1;if(s>=i.length)break;let r=i[s];if(s+1=0){r=i[s+1];s++}if(t.compare(r)<0)break;i[s]=t;i[e]=r;e=s}}class Ra{constructor(e,t,s){this.minPoint=s;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=Bl.from(e,t,s)}goto(e,t=-1e9){this.cursor.goto(e,t);this.active.length=this.activeTo.length=this.activeRank.length=0;this.minActive=-1;this.to=e;this.endSide=t;this.openStart=-1;this.next();return this}forward(e,t){while(this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){qh(this.active,e);qh(this.activeTo,e);qh(this.activeRank,e);this.minActive=h_(this.active,this.activeTo)}addActive(e){let t=0,{value:s,to:r,rank:n}=this.cursor;while(t0)t++;Xh(this.active,t,s);Xh(this.activeTo,t,r);Xh(this.activeRank,t,n);if(e)Xh(e,t,this.cursor.from);this.minActive=h_(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r];this.endSide=this.active[r].endSide;break}this.removeActive(r);if(s)qh(s,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from;this.endSide=this.cursor.startSide;break}else{let n=this.cursor.value;if(!n.point){this.addActive(s);this.cursor.next()}else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&s[r]=0;s--){if(this.activeRank[s]e||this.activeTo[s]==e&&this.active[s].endSide>=this.point.endSide)t.push(this.active[s])}return t.reverse()}openEnd(e){let t=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>e;s--)t++;return t}}function l_(i,e,t,s,r,n){i.goto(e);t.goto(s);let o=s+r;let a=s,l=s-e;let h=!!n.boundChange;for(let c=false;;){let d=i.to+l-t.to,u=d||i.endSide-t.endSide;let f=u<0?i.to+l:t.to,p=Math.min(f,o);let m=i.point||t.point;if(m){if(!(i.point&&t.point&&AO(i.point,t.point)&&gm(i.activeForPoint(i.to),t.activeForPoint(t.to))))n.comparePoint(a,p,i.point,t.point);c=false}else{if(c)n.boundChange(a);if(p>a&&!gm(i.active,t.active))n.compareRange(a,p,i.active,t.active);if(h&&po)break;a=f;if(u<=0)i.next();if(u>=0)t.next()}}function gm(i,e){if(i.length!=e.length)return false;for(let t=0;t=e;s--)i[s+1]=i[s];i[e]=t}function h_(i,e){let t=-1,s=1e9;for(let r=0;r=e)return r;if(r==i.length)break;n+=i.charCodeAt(r)==9?t-n%t:1;r=Rt(i,r)}return s===true?-1:i.length}const _m="ͼ";const c_=typeof Symbol=="undefined"?"__"+_m:Symbol.for(_m);const vm=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet");const d_=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class ln{constructor(e,t){this.rules=[];let{finish:s}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function n(o,a,l,h){let c=[],d=/^@(\\w+)\\b/.exec(o[0]),u=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f)){n(f.split(/,\\s*/).map(m=>o.map(O=>m.replace(/&/,O))).reduce((m,O)=>m.concat(O)),p,l)}else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+f+") should be a primitive value.");n(r(f),p,c,u)}else if(p!=null){c.push(f.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}}if(c.length||u){l.push((s&&!d&&!h?o.map(s):o).join(", ")+" {"+c.join(" ")+"}")}}for(let o in e)n(r(o),e[o],this.rules)}getRules(){return this.rules.join("\\n")}static newName(){let e=d_[c_]||1;d_[c_]=e+1;return _m+e.toString(36)}static mount(e,t,s){let r=e[vm],n=s&&s.nonce;if(!r)r=new UE(e,n);else if(n)r.setNonce(n);r.mount(Array.isArray(t)?t:[t],e)}}let u_=new Map;class UE{constructor(e,t){let s=e.ownerDocument||e,r=s.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let n=u_.get(s);if(n)return e[vm]=n;this.sheet=new r.CSSStyleSheet;u_.set(s,this)}else{this.styleTag=s.createElement("style");if(t)this.styleTag.setAttribute("nonce",t)}this.modules=[];e[vm]=this}mount(e,t){let s=this.sheet;let r=0,n=0;for(let o=0;o-1){this.modules.splice(l,1);n--;l=-1}if(l==-1){this.modules.splice(n++,0,a);if(s)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};var jE=typeof navigator!="undefined"&&/Mac/.test(navigator.platform);var HE=typeof navigator!="undefined"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(var qt=0;qt<10;qt++)hn[48+qt]=hn[96+qt]=String(qt);for(var qt=1;qt<=24;qt++)hn[qt+111]="F"+qt;for(var qt=65;qt<=90;qt++){hn[qt]=String.fromCharCode(qt+32);Il[qt]=String.fromCharCode(qt)}for(var af in hn)if(!Il.hasOwnProperty(af))Il[af]=hn[af];function VE(i){var e=jE&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||HE&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified";var t=!e&&i.key||(i.shiftKey?Il:hn)[i.keyCode]||i.key||"Unidentified";if(t=="Esc")t="Escape";if(t=="Del")t="Delete";if(t=="Left")t="ArrowLeft";if(t=="Up")t="ArrowUp";if(t=="Right")t="ArrowRight";if(t=="Down")t="ArrowDown";return t}function wt(){var i=arguments[0];if(typeof i=="string")i=document.createElement(i);var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var r=t[s];if(typeof r=="string")i.setAttribute(s,r);else if(r!=null)i[s]=r}e++}for(;e2);var G={mac:m_||/Mac/.test(ri.platform),windows:/Win/.test(ri.platform),linux:/Linux|X11/.test(ri.platform),ie:ou,ie_version:m2?ym.documentMode||6:Sm?+Sm[1]:bm?+bm[1]:0,gecko:f_,gecko_version:f_?+(/Firefox\\/(\\d+)/.exec(ri.userAgent)||[0,0])[1]:0,chrome:!!lf,chrome_version:lf?+lf[1]:0,ios:m_,android:/Android\\b/.test(ri.userAgent),webkit:p_,webkit_version:p_?+(/\\bAppleWebKit\\/(\\d+)/.exec(ri.userAgent)||[0,0])[1]:0,safari:wm,safari_version:wm?+(/\\bVersion\\/(\\d+(\\.\\d+)?)/.exec(ri.userAgent)||[0,0])[1]:0,tabSize:ym.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function MO(i,e){for(let t in i){if(t=="class"&&e.class)e.class+=" "+i.class;else if(t=="style"&&e.style)e.style+=";"+i.style;else e[t]=i[t]}return e}const ud=Object.create(null);function BO(i,e,t){if(i==e)return true;if(!i)i=ud;if(!e)e=ud;let s=Object.keys(i),r=Object.keys(e);if(s.length-0!=r.length-0)return false;for(let n of s){if(n!=t&&(r.indexOf(n)==-1||i[n]!==e[n]))return false}return true}function YE(i,e){for(let t=i.attributes.length-1;t>=0;t--){let s=i.attributes[t].name;if(e[s]==null)i.removeAttribute(s)}for(let t in e){let s=e[t];if(t=="style")i.style.cssText=s;else if(i.getAttribute(t)!=s)i.setAttribute(t,s)}}function g_(i,e,t){let s=false;if(e){for(let r in e)if(!(t&&r in t)){s=true;if(r=="style")i.style.cssText="";else i.removeAttribute(r)}}if(t){for(let r in t)if(!(e&&e[r]==t[r])){s=true;if(r=="style")i.style.cssText=t[r];else i.setAttribute(r,t[r])}}return s}function GE(i){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8;return new Gn(e,t,t,s,e.widget||null,false)}static replace(e){let t=!!e.block,s,r;if(e.isBlockGap){s=-5e8;r=4e8}else{let{start:n,end:o}=g2(e,t);s=(n?t?-3e8:-1:5e8)-1;r=(o?t?2e8:1:-6e8)+1}return new Gn(e,s,r,t,e.widget||null,true)}static line(e){return new uh(e)}static set(e,t=false){return ye.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:false}}fe.none=ye.empty;class dh extends fe{constructor(e){let{start:t,end:s}=g2(e);super(t?-1:5e8,s?1:-6e8,null,e);this.tagName=e.tagName||"span";this.attrs=e.class&&e.attributes?MO(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ud}eq(e){return this==e||e instanceof dh&&this.tagName==e.tagName&&BO(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}dh.prototype.point=false;class uh extends fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof uh&&this.spec.class==e.spec.class&&BO(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}uh.prototype.mapMode=oi.TrackBefore;uh.prototype.point=true;class Gn extends fe{constructor(e,t,s,r,n,o){super(t,s,n,e);this.block=r;this.isReplace=o;this.mapMode=!r?oi.TrackDel:t<=0?oi.TrackBefore:oi.TrackAfter}get type(){return this.startSide!=this.endSide?Ft.WidgetRange:this.startSide<=0?Ft.WidgetBefore:Ft.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Gn&&KE(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Gn.prototype.point=true;function g2(i,e=false){let{inclusiveStart:t,inclusiveEnd:s}=i;if(t==null)t=i.inclusive;if(s==null)s=i.inclusive;return{start:t!==null&&t!==void 0?t:e,end:s!==null&&s!==void 0?s:e}}function KE(i,e){return i==e||!!(i&&e&&i.compare(e))}function Fo(i,e,t,s=0){let r=t.length-1;if(r>=0&&t[r]+s>=i)t[r]=Math.max(t[r],e);else t.push(i,e)}class Dl extends an{constructor(e,t,s){super();this.tagName=e;this.attributes=t;this.rank=s}eq(e){return e==this||e instanceof Dl&&this.tagName==e.tagName&&BO(this.attributes,e.attributes)}static create(e){return new Dl(e.tagName,e.attributes||ud,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=false){return ye.of(e,t)}}Dl.prototype.startSide=Dl.prototype.endSide=-1;function zl(i){let e;if(i.nodeType==11){e=i.getSelection?i:i.ownerDocument}else{e=i}return e.getSelection()}function xm(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):false}function gl(i,e){if(!e.anchorNode)return false;try{return xm(i,e.anchorNode)}catch(t){return false}}function Rc(i){if(i.nodeType==3)return Wl(i,0,i.nodeValue.length).getClientRects();else if(i.nodeType==1)return i.getClientRects();else return[]}function Ol(i,e,t,s){return t?O_(i,e,t,s,-1)||O_(i,e,t,s,1):false}function cn(i){for(var e=0;;e++){i=i.previousSibling;if(!i)return e}}function fd(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(i.nodeName)}function O_(i,e,t,s,r){for(;;){if(i==t&&e==s)return true;if(e==(r<0?0:Or(i))){if(i.nodeName=="DIV")return false;let n=i.parentNode;if(!n||n.nodeType!=1)return false;e=cn(i)+(r<0?0:1);i=n}else if(i.nodeType==1){i=i.childNodes[e+(r<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")return false;e=r<0?Or(i):0}else{return false}}}function Or(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function pd(i,e){let{left:t,right:s}=i;if(t==s)return i;let r=e?t:s;return{left:r,right:r,top:i.top,bottom:i.bottom}}function JE(i){let e=i.visualViewport;if(e)return{left:0,right:e.width,top:0,bottom:e.height};return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function O2(i,e){let t=e.width/i.offsetWidth;let s=e.height/i.offsetHeight;if(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)t=1;if(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-i.offsetHeight)<1)s=1;return{scaleX:t,scaleY:s}}function e6(i,e,t,s,r,n,o,a){let l=i.ownerDocument,h=l.defaultView||window;for(let c=i,d=false;c&&!d;){if(c.nodeType==1){let u,f=c==l.body;let p=1,m=1;if(f){u=JE(h)}else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))d=true;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let T=c.getBoundingClientRect();({scaleX:p,scaleY:m}=O2(c,T));u={left:T.left,right:T.left+c.clientWidth*p,top:T.top,bottom:T.top+c.clientHeight*m}}let O=0,v=0;if(r=="nearest"){if(e.top0&&e.bottom>u.bottom+v)v=e.bottom-u.bottom+o}else if(e.bottom>u.bottom-o){v=e.bottom-u.bottom+o;if(t<0&&e.top-v0&&e.right>u.right+O)O=e.right-u.right+n}else if(e.right>u.right-n){O=e.right-u.right+n;if(t<0&&e.leftu.bottom||e.leftu.right)e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)};c=c.assignedSlot||c.parentNode}else if(c.nodeType==11){c=c.host}else{break}}}function _2(i,e=true){let t=i.ownerDocument,s=null,r=null;for(let n=i.parentNode;n;){if(n==t.body||(!e||s)&&r){break}else if(n.nodeType==1){if(!r&&n.scrollHeight>n.clientHeight)r=n;if(e&&!s&&n.scrollWidth>n.clientWidth)s=n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11){n=n.host}else{break}}return{x:s,y:r}}class t6{constructor(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:s}=e;this.set(t,Math.min(e.anchorOffset,t?Or(t):0),s,Math.min(e.focusOffset,s?Or(s):0))}set(e,t,s,r){this.anchorNode=e;this.anchorOffset=t;this.focusNode=s;this.focusOffset=r}}function v2(i){let e=[];for(let t=i;t;t=t.nodeType==11?t.host:t.parentNode){if(t.nodeType==1)e.push({node:t,left:t.scrollLeft,top:t.scrollTop})}return e}function y2(i,e=true){for(let{node:t,left:s,top:r}of i){if(e&&t.scrollTop!=r)t.scrollTop=r;if(t.scrollLeft!=s)t.scrollLeft=s}}let kn=null;if(G.safari&&G.safari_version>=26)kn=false;function b2(i){if(i.setActive)return i.setActive();if(kn)return i.focus(kn);let e=v2(i);i.focus(kn==null?{get preventScroll(){kn={preventScroll:true};return true}}:void 0);if(!kn){kn=false;y2(e)}}let __;function Wl(i,e,t=e){let s=__||(__=document.createRange());s.setEnd(i,t);s.setStart(i,e);return s}function Zo(i,e,t,s){let r={key:e,code:e,keyCode:t,which:t,cancelable:true};if(s)({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let n=new KeyboardEvent("keydown",r);n.synthetic=true;i.dispatchEvent(n);let o=new KeyboardEvent("keyup",r);o.synthetic=true;i.dispatchEvent(o);return n.defaultPrevented||o.defaultPrevented}function i6(i){while(i){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function s6(i,e){let t=e.focusNode,s=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=s)return false;s=Math.min(s,Or(t));for(;;){if(s){if(t.nodeType!=1)return false;let r=t.childNodes[s-1];if(r.contentEditable=="false")s--;else{t=r;s=Or(t)}}else if(t==i){return true}else{s=cn(t);t=t.parentNode}}}function S2(i){if(i instanceof Window)return i.pageYOffset>Math.max(0,i.document.documentElement.scrollHeight-i.innerHeight-4);return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function w2(i,e){for(let t=i,s=e;;){if(t.nodeType==3&&s>0){return{node:t,offset:s}}else if(t.nodeType==1&&s>0){if(t.contentEditable=="false")return null;t=t.childNodes[s-1];s=Or(t)}else if(t.parentNode&&!fd(t)){s=cn(t);t=t.parentNode}else{return null}}}function x2(i,e){for(let t=i,s=e;;){if(t.nodeType==3&&s=t){if(a.level==s)return o;if(n<0||(r!=0?r<0?a.fromt:e[n].level>a.level))n=o}}if(n<0)throw new RangeError("Index out of range");return n}}function T2(i,e){if(i.length!=e.length)return false;for(let t=0;t=0;m-=3){if(ms[m+1]==-f){let O=ms[m+2];let v=O&2?r:!(O&4)?0:O&1?n:r;if(v)Be[d]=Be[ms[m]]=v;a=m;break}}}else if(ms.length==189){break}else{ms[a++]=d;ms[a++]=u;ms[a++]=l}}else if((p=Be[d])==2||p==1){let m=p==r;l=m?0:1;for(let O=a-3;O>=0;O-=3){let v=ms[O+2];if(v&2)break;if(m){ms[O+2]|=2}else{if(v&4)break;ms[O+2]|=4}}}}}}function h6(i,e,t,s){for(let r=0,n=s;r<=t.length;r++){let o=r?t[r-1].to:i,a=rl;){if(p==O){p=t[--m].from;O=m?t[m-1].to:i}Be[--p]=f}l=c}else{n=h;l++}}}}function Cm(i,e,t,s,r,n,o){let a=s%2?2:1;if(s%2==r%2){for(let l=e,h=0;ll)o.push(new Rs(l,m.from,f));let O=m.direction==Kn!=!(f%2);Tm(i,O?s+1:s,r,m.inner,m.from,m.to,o);l=m.to}p=m.to}else if(p==t||(c?Be[p]!=a:Be[p]==a)){break}else{p++}}if(u)Cm(i,l,p,s+1,r,u,o);else if(le;){let c=true,d=false;if(!h||l>n[h-1].to){let m=Be[l-1];if(m!=a){c=false;d=m==16}}let u=!c&&a==1?[]:null;let f=c?s:s+1;let p=l;e:for(;;){if(h&&p==n[h-1].to){if(d)break e;let m=n[--h];if(!c)for(let O=m.from,v=h;;){if(O==e)break e;if(v&&n[v-1].to==O)O=n[--v].from;else if(Be[O-1]==a)break e;else break}if(u){u.push(m)}else{if(m.toBe.length)Be[Be.length]=256;let s=[],r=e==Kn?0:1;Tm(i,r,r,t,0,i.length,s);return s}function P2(i){return[new Rs(0,i,0)]}let $2="";function d6(i,e,t,s,r){var n;let o=s.head-i.from;let a=Rs.find(e,o,(n=s.bidiLevel)!==null&&n!==void 0?n:-1,s.assoc);let l=e[a],h=l.side(r,t);if(o==h){let u=a+=r?1:-1;if(u<0||u>=e.length)return null;l=e[a=u];o=l.side(!r,t);h=l.side(r,t)}let c=Rt(i.text,o,l.forward(r,t));if(cl.to)c=h;$2=i.text.slice(Math.min(o,c),Math.max(o,c));let d=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];if(d&&c==h&&d.level+(r?0:1)i.some(e=>e)});const I2=te.define({combine:i=>i.some(e=>e)});const D2=te.define();class Uo{constructor(e,t,s,r,n,o=false){this.range=e;this.y=t;this.x=s;this.yMargin=r;this.xMargin=n;this.isSnapshot=o}map(e){return e.empty?this:new Uo(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Uo(z.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Nh=Ce.define({map:(i,e)=>i.map(e)});const z2=Ce.define();function As(i,e,t){let s=i.facet(A2);if(s.length)s[0](e);else if(window.onerror&&window.onerror(String(e),t,void 0,void 0,e));else if(t)console.error(t+":",e);else console.error(e)}const dr=te.define({combine:i=>i.length?i[0]:true});let f6=0;const Bo=te.define({combine(i){return i.filter((e,t)=>{for(let s=0;s{let l=[];if(o)l.push(au.of(h=>{let c=h.plugin(a);return c?o(c):fe.none}));if(n)l.push(n(a));return l})}static fromClass(e,t){return Kt.define((s,r)=>new e(s,r),t)}}class hf{constructor(e){this.spec=e;this.mustUpdate=null;this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec){try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){As(e.state,t,"CodeMirror plugin crashed");this.deactivate()}}}else if(this.mustUpdate){let t=this.mustUpdate;this.mustUpdate=null;if(this.value.update){try{this.value.update(t)}catch(s){As(t.state,s,"CodeMirror plugin crashed");if(this.value.destroy)try{this.value.destroy()}catch(r){}this.deactivate()}}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy){try{this.value.destroy()}catch(s){As(e.state,s,"CodeMirror plugin crashed")}}}deactivate(){this.spec=this.value=null}}const W2=te.define();const WO=te.define();const au=te.define();const q2=te.define();const qO=te.define();const fh=te.define();const X2=te.define();function v_(i,e){let t=i.state.facet(X2);if(!t.length)return t;let s=t.map(n=>n instanceof Function?n(i):n);let r=[];ye.spans(s,e.from,e.to,{point(){},span(n,o,a,l){let h=n-e.from,c=o-e.from;let d=r;for(let u=a.length-1;u>=0;u--,l--){let f=a[u].spec.bidiIsolate,p;if(f==null)f=u6(e.text,h,c);if(l>0&&d.length&&(p=d[d.length-1]).to==h&&p.direction==f){p.to=c;d=p.inner}else{let m={from:h,to:c,direction:f,inner:[]};d.push(m);d=m.inner}}}});return r}const N2=te.define();function F2(i){let e=0,t=0,s=0,r=0;for(let n of i.state.facet(N2)){let o=n(i);if(o){if(o.left!=null)e=Math.max(e,o.left);if(o.right!=null)t=Math.max(t,o.right);if(o.top!=null)s=Math.max(s,o.top);if(o.bottom!=null)r=Math.max(r,o.bottom)}}return{left:e,right:t,top:s,bottom:r}}const tl=te.define();class Xi{constructor(e,t,s,r){this.fromA=e;this.toA=t;this.fromB=s;this.toB=r}join(e){return new Xi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,s=this;for(;t>0;t--){let r=e[t-1];if(r.fromA>s.toA)continue;if(r.toAr.push(new Xi(n,o,a,l)));this.changedRanges=r}static create(e,t,s){return new md(e,t,s)}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&(16|2))>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const p6=[];class it{constructor(e,t,s=0){this.dom=e;this.length=t;this.flags=s;this.parent=null;e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return p6}isWidget(){return false}get isHidden(){return false}isComposite(){return false}isLine(){return false}isText(){return false}isBlock(){return false}get domAttrs(){return null}sync(e){this.flags|=2;if(this.flags&4){this.flags&=-5;let t=this.domAttrs;if(t)YE(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?\`(\${this.children})\`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e;e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let s=t;for(let r of this.children){if(r==e)return s;s+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return true}coordsIn(e,t,s){return null}domPosFor(e,t){let s=cn(this.dom);let r=this.length?e>0:t>0;return new rs(this.parent.dom,s+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3;if(e)this.flags|=4;if(this.parent&&this.parent.flags&2)this.parent.markDirty(false)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof hu)return e;return null}static get(e){return e.cmTile}}class lu extends it{constructor(e){super(e,0);this._children=[]}isComposite(){return true}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e);e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,s=null,r;let n=(e===null||e===void 0?void 0:e.node)==t?e:null;let o=0;for(let a of this.children){a.sync(e);o+=a.length+a.breakAfter;r=s?s.nextSibling:t.firstChild;if(n&&r!=a.dom)n.written=true;if(a.dom.parentNode==t){while(r&&r!=a.dom)r=y_(r)}else{t.insertBefore(a.dom,r)}s=a.dom}r=s?s.nextSibling:t.firstChild;if(n&&r)n.written=true;while(r)r=y_(r);this.length=o}}function y_(i){let e=i.nextSibling;i.parentNode.removeChild(i);return e}class hu extends lu{constructor(e,t){super(t);this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return true;return false}isBlock(){return true}nearest(e){for(;;){if(!e)return null;let t=it.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],s=this,r=0,n=0;;){if(r==s.children.length){if(!t.length)return;s=s.parent;if(s.breakAfter)n++;r=t.pop()}else{let o=s.children[r++];if(o instanceof mr){t.push(r);s=o;r=0}else{let a=n+o.length;let l=e(o,n);if(l!==void 0)return l;n=a+o.breakAfter}}}}resolveBlock(e,t){let s,r=-1,n,o=-1;this.blockTiles((a,l)=>{let h=l+a.length;if(e>=l&&e<=h){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return true;if(a.flags&16)s=void 0}if((le||e==l&&(t>1?a.length:a.covers(-1)))&&(!n||!a.isWidget()&&n.isWidget())){n=a;o=e-l}}});if(!s&&!n)throw new Error("No tile at position "+e);return s&&t<0||!n?{tile:s,offset:r}:{tile:n,offset:o}}}class mr extends lu{constructor(e,t){super(e);this.wrapper=t}isBlock(){return true}covers(e){if(!this.children.length)return false;return e<0?this.children[0].covers(-1):this.lastChild.covers(1)}get domAttrs(){return this.wrapper.attributes}static of(e,t){let s=new mr(t||document.createElement(e.tagName),e);if(!t)s.flags|=4;return s}}class sa extends lu{constructor(e,t){super(e);this.attrs=t}isLine(){return true}static start(e,t,s){let r=new sa(t||document.createElement("div"),e);if(!t||!s)r.flags|=4;return r}get domAttrs(){return this.attrs}resolveInline(e,t,s){let r=null,n=-1,o=null,a=-1;function l(c,d){for(let u=0,f=0;u=d){if(p.isComposite()){l(p,d-f)}else if((!o||o.isHidden&&(t>0&&!(o.flags&32)||s&&g6(o,p)))&&(m>d||p.flags&32&&t<=1)){o=p;a=d-f}else if(f=-1){r=p;n=d-f}}f=m}}l(this,e);let h=(t<0?r:o)||r||o;return h?{tile:h,offset:h==r?n:a}:null}coordsIn(e,t,s){let r=this.resolveInline(e,t,true);if(!r)return m6(this);return r.tile.coordsIn(Math.max(0,r.offset),t,s)}domIn(e,t){let s=this.resolveInline(e,t);if(s){let{tile:r,offset:n}=s;if(this.dom.contains(r.dom)){if(r.isText())return new rs(r.dom,Math.min(r.dom.nodeValue.length,n));return r.domPosFor(n,r.flags&16?1:r.flags&32?-1:t)}let o=s.tile.parent,a=false;for(let l of o.children){if(a)return new rs(l.dom,0);if(l==s.tile){a=true}}}return new rs(this.dom,0)}}function m6(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Rc(e);return t[t.length-1]||null}function g6(i,e){let t=i.coordsIn(0,1),s=e.coordsIn(0,1);return t&&s&&s.topr)e=r;let n=e,o=e,a=0;if(e==0&&t<0||e==r&&t>=0){if(!(G.chrome||G.gecko)){if(e){n--;a=1}else if(o=0)?0:l.length-1];if(G.safari&&!a&&h.width==0)h=Array.prototype.find.call(l,c=>c.width)||h;return s==null?h:pd(h,(a?a>0:t<0)==s)}static of(e,t){let s=new Bn(t||document.createTextNode(e),e);if(!t)s.flags|=2;return s}}class Jn extends it{constructor(e,t,s,r){super(e,t,r);this.widget=s}isWidget(){return true}get isHidden(){return this.widget.isHidden}covers(e){if(this.flags&48)return false;return(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,false)}coordsInWidget(e,t,s){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(s){return pd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0)}else{let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let a=this.flags&16?true:this.flags&32?false:e>0;for(let l=a?n.length-1:0;;l+=a?-1:1){o=n[l];if(e>0?l==0:l==n.length-1||o.top0==s)}}class O6{constructor(e){this.index=0;this.beforeBreak=false;this.parents=[];this.tile=e}advance(e,t,s){let{tile:r,index:n,beforeBreak:o,parents:a}=this;while(e||t>0){if(!r.isComposite()){let l=r.length;if(n0?l.length<=e:l.length=0;a--){let l=t.marks[a];let h=r.lastChild;if(h instanceof Oi&&h.mark.eq(l.mark)){if(h.dom!=l.dom)h.setDOM(cf(l.dom));r=h}else{if(this.cache.reused.get(l)){let d=it.get(l.dom);if(d)d.setDOM(cf(l.dom))}let c=Oi.of(l.mark,l.dom);r.append(c);r=c}this.cache.reused.set(l,2)}let n=it.get(e.text);if(n)this.cache.reused.set(n,2);let o=new Bn(e.text,e.text.nodeValue);o.flags|=8;this.pos=e.range.toB;r.append(o)}addInlineWidget(e,t,s){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);if(!r)this.flushBuffer();let n=this.ensureMarks(t,s);if(!r&&!(e.flags&16))n.append(this.getBuffer(1));n.append(e);this.pos+=e.length;this.afterWidget=e}addMark(e,t,s){this.flushBuffer();let r=this.ensureMarks(t,s);r.append(e);this.pos+=e.length;this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e);this.pos+=e.length;this.lastBlock=e;this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e;this.pos+=e}addLineStart(e,t){var s;if(!e)e=Z2;let r=sa.start(e,t||((s=this.cache.find(sa))===null||s===void 0?void 0:s.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e);this.pos+=e.length;this.lastBlock=e;this.endLine()}addBreak(){this.lastBlock.flags|=1;this.endLine();this.pos++}addLineStartIfNotCovered(e){if(!this.blockPosCovered())this.addLineStart(e)}ensureLine(e){if(!this.curLine)this.addLineStart(e)}ensureMarks(e,t){var s;let r=this.curLine;for(let n=e.length-1;n>=0;n--){let o=e[n],a;if(t>0&&(a=r.lastChild)&&a instanceof Oi&&a.mark.eq(o)){r=a;t--}else{let l=Oi.of(o,(s=this.cache.find(Oi,h=>h.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(l);r=l;t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;if(!e||!b_(this.curLine,false)||e.dom.nodeName!="BR"&&e.isWidget()&&!(G.ios&&b_(this.curLine,true)))this.curLine.append(this.cache.findWidget(df,0,32)||new Jn(df.toDOM(),0,df,32));this.curLine=this.afterWidget=null}}updateBlockWrappers(){if(this.wrapperPos>this.pos+1e4){this.blockWrappers.goto(this.pos);this.wrappers.length=0}for(let e=this.wrappers.length-1;e>=0;e--)if(this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank;let s=new _6(e.from,e.to,e.value,t),r=this.wrappers.length;while(r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let s of this.wrappers){let r=t.lastChild;if(s.fromo.wrapper.eq(s.wrapper)))===null||e===void 0?void 0:e.dom);t.append(n);t=n}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&(32|128))>0)}getBuffer(e){let t=2|(e<0?16:32);let s=this.cache.find(gd,void 0,1);if(s)s.flags=t;return s||new gd(t)}flushBuffer(){if(this.afterWidget&&!(this.afterWidget.flags&32)){this.afterWidget.parent.append(this.getBuffer(-1));this.afterWidget=null}}}class y6{constructor(e){this.skipCount=0;this.text="";this.textOff=0;this.cursor=e.iter()}skip(e){if(this.textOff+e<=this.text.length){this.textOff+=e}else{this.skipCount+=e-(this.text.length-this.textOff);this.text="";this.textOff=0}}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:n,done:o}=this.cursor.next(this.skipCount);this.skipCount=0;if(o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(e,r.length);return n?null:r.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e);let s=this.text.slice(this.textOff,t);this.textOff=t;return s}}const Od=[Jn,sa,Bn,Oi,gd,mr,hu];for(let i=0;i[]);this.index=Od.map(()=>0);this.reused=new Map}add(e){let t=e.constructor.bucket,s=this.buckets[t];if(s.length<6)s.push(e);else s[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,s=2){let r=e.bucket;let n=this.buckets[r],o=this.index[r];for(let a=0;a{this.cache.add(o);if(o.isComposite())return false},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let s=t&&this.getCompositionContext(t.text);for(let r=0,n=0,o=0;;){let a=or){let h=l-r;this.preserve(h,!o,!a);r=l;n+=h}if(!a)break;if(t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA){this.forward(a.fromA,t.range.fromA,t.range.fromA{if(o.isWidget()){if(this.openWidget){this.builder.continueWidget(l-a)}else{let h=l>0||a{if(o.isLine()){this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o))}else{this.cache.add(o);if(o instanceof Oi)r.unshift(o.mark)}this.openWidget=false},leave:o=>{if(o.isLine()){if(r.length)r.length=n=0}else if(o instanceof Oi){r.shift();n=Math.min(n,r.length)}},break:()=>{this.builder.addBreak();this.openWidget=false}});this.text.skip(e)}emit(e,t){let s=null;let r=this.builder,n=-1;let o=ye.spans(this.decorations,e,t,{point:(a,l,h,c,d,u)=>{if(h instanceof Gn){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}n=c.length;if(d>c.length){r.continueWidget(l-a)}else{let f=h.widget||(h.block?ra.block:ra.inline);let p=w6(h);let m=this.cache.findWidget(f,l-a,p)||Jn.of(f,this.view,l-a,p);if(h.block){if(h.startSide>0)r.addLineStartIfNotCovered(s);r.addBlockWidget(m)}else{r.ensureLine(s);r.addInlineWidget(m,c,d)}}s=null}else{s=x6(s,h)}if(l>a)this.text.skip(l-a)},span:(a,l,h,c)=>{for(let d=a;d-1)this.openWidget=o>n;if(!this.openWidget)r.addLineStartIfNotCovered(s);this.openMarks=o}forward(e,t,s=1){if(t-e<=10){this.old.advance(t-e,s,this.reuseWalker)}else{this.old.advance(5,-1,this.reuseWalker);this.old.advance(t-e-10,-1);this.old.advance(5,s,this.reuseWalker)}}getCompositionContext(e){let t=[],s=null;for(let r=e.parentNode;;r=r.parentNode){let n=it.get(r);if(r==this.view.contentDOM)break;if(n instanceof Oi)t.push(n);else if(n===null||n===void 0?void 0:n.isLine())s=n;else if(n instanceof mr);else if(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM)s=new sa(r,Z2);else if(!s)t.push(Oi.of(new dh({tagName:r.nodeName.toLowerCase(),attributes:GE(r)}),r))}return{line:s,marks:t}}}function b_(i,e){let t=s=>{for(let r of s.children)if((e?r.isText():r.length)||t(r))return true;return false};return t(i)}function w6(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;if(i.block)e|=256;return e}const Z2={class:"cm-line"};function x6(i,e){let t=e.spec.attributes,s=e.spec.class;if(!t&&!s)return i;if(!i)i={class:"cm-line"};if(t)MO(t,i);if(s)i.class+=" "+s;return i}function k6(i){let e=[];for(let t=i.parents.length;t>1;t--){let s=t==i.parents.length?i.tile:i.parents[t].tile;if(s instanceof Oi)e.push(s.mark)}return e}function cf(i){let e=it.get(i);if(e)e.setDOM(i.cloneNode());return i}class ra extends uo{constructor(e){super();this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return true}}ra.inline=new ra("span");ra.block=new ra("div");const df=new class extends uo{toDOM(){return document.createElement("br")}get isHidden(){return true}get editable(){return true}};class S_{constructor(e){this.view=e;this.decorations=[];this.blockWrappers=[];this.dynamicDecorationMap=[false];this.domChanged=null;this.hasComposition=null;this.editContextFormatting=fe.none;this.lastCompositionAfterCursor=false;this.minWidth=0;this.minWidthFrom=0;this.minWidthTo=0;this.impreciseAnchor=null;this.impreciseHead=null;this.forceSelection=false;this.lastUpdate=Date.now();this.updateDeco();this.tile=new hu(e,e.contentDOM);this.updateInner([new Xi(0,0,0,e.state.doc.length)],null)}update(e){var t;let s=e.changedRanges;if(this.minWidth>0&&s.length){if(!s.every(({fromA:c,toA:d})=>dthis.minWidthTo)){this.minWidth=this.minWidthFrom=this.minWidthTo=0}else{this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1);this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)}}this.updateEditContextFormatting(e);let r=-1;if(this.view.inputState.composing>=0&&!this.view.observer.editContext){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)r=this.domChanged.newSel.head;else if(!L6(e.changes,this.hasComposition)&&!e.selectionSet)r=e.state.selection.main.head}let n=r>-1?T6(this.view,e.changes,r):null;this.domChanged=null;if(this.hasComposition){let{from:c,to:d}=this.hasComposition;s=new Xi(c,d,e.changes.mapPos(c,-1),e.changes.mapPos(d,1)).addToSet(s.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null;if((G.ie||G.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=true;let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=E6(o,this.decorations,e.changes);if(l.length)s=Xi.extendWithRanges(s,l);let h=R6(a,this.blockWrappers,e.changes);if(h.length)s=Xi.extendWithRanges(s,h);if(n&&!s.some(c=>c.fromA<=n.range.fromA&&c.toA>=n.range.toA))s=n.range.addToSet(s.slice());if(this.tile.flags&2&&s.length==0){return false}else{this.updateInner(s,n);if(e.transactions.length)this.lastUpdate=Date.now();return true}}updateInner(e,t){this.view.viewState.mustMeasureContent=true;let{observer:s}=this.view;s.ignore(()=>{if(t||e.length){let o=this.tile;let a=new S6(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);if(t&&it.get(t.text))a.cache.reused.set(it.get(t.text),2);this.tile=a.run(e,t);$m(o,a.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 n=G.chrome||G.ios?{node:s.selectionRange.focusNode,written:false}:void 0;this.tile.sync(n);if(n&&(n.written||s.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node)))this.forceSelection=true;this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&gl(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(n||t||o))return;let a=this.forceSelection;this.forceSelection=false;let l=this.view.state.selection.main,h,c;if(l.empty){c=h=this.inlineDOMNearPos(l.anchor,l.assoc||1)}else{c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1);h=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)}if(G.gecko&&l.empty&&!this.hasComposition&&C6(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null));h=c=new rs(u,0);a=true}let d=this.view.observer.selectionRange;if(a||!d.focusNode||(!Ol(h.node,h.offset,d.anchorNode,d.anchorOffset)||!Ol(c.node,c.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l)){this.view.observer.ignore(()=>{if(G.android&&G.chrome&&s.contains(d.focusNode)&&A6(d.focusNode,s)){s.blur();s.focus({preventScroll:true})}let u=zl(this.view.root);if(!u);else if(l.empty){if(G.gecko){let f=P6(h.node,h.offset);if(f&&f!=(1|2)){let p=(f==1?w2:x2)(h.node,h.offset);if(p)h=new rs(p.node,p.offset)}}u.collapse(h.node,h.offset);if(l.bidiLevel!=null&&u.caretBidiLevel!==void 0)u.caretBidiLevel=l.bidiLevel}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch(f){}}else{let f=document.createRange();if(l.anchor>l.head)[h,c]=[c,h];f.setEnd(c.node,c.offset);f.setStart(h.node,h.offset);u.removeAllRanges();u.addRange(f)}if(o&&this.view.root.activeElement==s){s.blur();if(r)r.focus()}});this.view.observer.setSelectionRange(h,c)}this.impreciseAnchor=h.precise?null:new rs(d.anchorNode,d.anchorOffset);this.impreciseHead=c.precise?null:new rs(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ol(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main;let s=zl(e.root);let{anchorNode:r,anchorOffset:n}=e.observer.selectionRange;if(!s||!t.empty||!t.assoc||!s.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!l||!h||l.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);s.collapse(c.node,c.offset);s.modify("move",t.assoc<0?"forward":"backward","lineboundary");e.observer.readSelectionRange();let d=e.observer.selectionRange;if(e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=t.from)s.collapse(r,n)}posFromDOM(e,t){let s=this.tile.nearest(e);if(!s)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let n;if(e==s.dom){n=s.dom.childNodes[t]}else{let o=Or(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==s.dom)break;if(o==0&&a.firstChild!=a.lastChild){if(e==a.firstChild)o=-1;else o=1}e=a}if(o<0)n=e;else n=e.nextSibling}if(n==s.dom.firstChild)return r;while(n&&!it.get(n))n=n.nextSibling;if(!n)return r+s.length;for(let o=0,a=r;;o++){let l=s.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}else if(s.isText()){return e==s.dom?r+t:r+(t?s.length:0)}else{return r}}domAtPos(e,t){let{tile:s,offset:r}=this.tile.resolveBlock(e,t);if(s.isWidget())return s.domPosFor(r,t);return s.domIn(r,t)}inlineDOMNearPos(e,t){let s,r=-1,n=false;let o,a=-1,l=false;this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return true;if(h.flags&16)n=true}else{let d=c+h.length;if(c<=e){s=h;r=e-c;n=d=e&&!o){o=h;a=e-c;l=c>e}if(c>e&&o)return true}});if(!s&&!o)return this.domAtPos(e,t);if(n&&o)s=null;else if(l&&s)o=null;return s&&t<0||!o?s.domIn(r,t):o.domIn(a,t)}coordsAt(e,t,s){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);if(r.isWidget()){if(r.widget instanceof uf)return null;return r.coordsInWidget(n,t,true)}return r.coordsIn(n,t,s)}lineAt(e,t){let{tile:s}=this.tile.resolveBlock(e,t);return s.isLine()?s:null}coordsForChar(e){let{tile:t,offset:s}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(n,o){if(n.isComposite()){for(let a of n.children){if(a.length>=o){let l=r(a,o);if(l)return l}o-=a.length;if(o<0)break}}else if(n.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1;let a=-1,l=this.view.textDirection==Ue.LTR;let h=0;let c=(d,u,f)=>{for(let p=0;pr)break;let m=d.children[p],O=u+m.length;let v=m.dom.getBoundingClientRect(),{height:T}=v;if(f&&!p)h+=v.top-f.top;if(m instanceof mr){if(O>s)c(m,u,v)}else if(u>=s){if(h>0)t.push(-h);t.push(T+h);h=0;if(o){let k=m.dom.lastChild;let _=k?Rc(k):[];if(_.length){let C=_[_.length-1];let w=l?C.right-v.left:v.right-C.left;if(w>a){a=w;this.minWidth=n;this.minWidthFrom=u;this.minWidthTo=O}}}}if(f&&p==d.children.length-1)h+=f.bottom-v.bottom;u=O+m.breakAfter}};c(this.tile,0,null);return t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Ue.RTL:Ue.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return void 0;let c=Rc(h.dom);if(c.length!=1)return void 0;a+=c[0].width;l=c[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),s,r,n;t.className="cm-line";t.style.width="99999px";t.style.position="absolute";t.textContent="abc def ghi jkl mno pqr stu";this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Rc(t.firstChild)[0];s=t.getBoundingClientRect().height;r=o&&o.width?o.width/27:7;n=o&&o.height?o.height:s;t.remove()});return{lineHeight:s,charWidth:r,textHeight:n}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let s=0,r=0;;r++){let n=r==t.viewports.length?null:t.viewports[r];let o=n?n.from-1:this.view.state.doc.length;if(o>s){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(s).top)/this.view.scaleY;e.push(fe.replace({widget:new uf(a),block:true,inclusive:true,isBlockGap:true}).range(s,o))}if(!n)break;s=n.to+1}return fe.set(e)}updateDeco(){let e=1;let t=this.view.state.facet(au).map(n=>{let o=this.dynamicDecorationMap[e++]=typeof n=="function";return o?n(this.view):n});let s=false,r=this.view.state.facet(qO).map((n,o)=>{let a=typeof n=="function";if(a)s=true;return a?n(this.view):n});if(r.length){this.dynamicDecorationMap[e++]=s;t.push(ye.join(r))}this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(etypeof n=="function"?n(this.view):n)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin;this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(D2)){try{if(h(this.view,e.range,e))return true}catch(c){As(this.view.state,c,"scroll handler")}}let{range:t}=e;let s=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!s)return;if(!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))s={left:Math.min(s.left,r.left),top:Math.min(s.top,r.top),right:Math.max(s.right,r.right),bottom:Math.max(s.bottom,r.bottom)};let n=F2(this.view);let o={left:s.left-n.left,top:s.top-n.top,right:s.right+n.right,bottom:s.bottom+n.bottom};let{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;e6(this.view.scrollDOM,o,t.head1&&(s.top>window.visualViewport.offsetTop+window.visualViewport.height||s.bottoms.isWidget()||s.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){$m(this.tile)}}function $m(i,e){let t=e===null||e===void 0?void 0:e.get(i);if(t!=1){if(t==null)i.destroy();for(let s of i.children)$m(s,e)}}function C6(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function U2(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let s=w2(t.focusNode,t.focusOffset);let r=x2(t.focusNode,t.focusOffset);let n=s||r;if(r&&s&&r.node!=s.node){let a=it.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue){n=r}else if(i.docView.lastCompositionAfterCursor){let l=it.get(s.node);if(!(!l||l.isText()&&l.text!=s.node.nodeValue))n=r}}i.docView.lastCompositionAfterCursor=n!=s;if(!n)return null;let o=e-n.offset;return{from:o,to:o+n.node.nodeValue.length,node:n.node}}function T6(i,e,t){let s=U2(i,t);if(!s)return null;let{node:r,from:n,to:o}=s,a=r.nodeValue;if(/[\\n\\r]/.test(a))return null;if(i.state.doc.sliceString(s.from,s.to)!=a)return null;let l=e.invertedDesc;return{range:new Xi(l.mapPos(n),l.mapPos(o),n,o),text:r}}function P6(i,e){if(i.nodeType!=1)return 0;return(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e{if(se.from)t=true});return t}class uf extends uo{constructor(e){super();this.height=e}toDOM(){let e=document.createElement("div");e.className="cm-gap";this.updateDOM(e);return e}eq(e){return e.height==this.height}updateDOM(e){e.style.height=this.height+"px";return true}get editable(){return true}get estimatedHeight(){return this.height}ignoreEvent(){return false}}function M6(i,e,t=1){let s=i.charCategorizer(e);let r=i.doc.lineAt(e),n=e-r.from;if(r.length==0)return z.cursor(e);if(n==0)t=1;else if(n==r.length)t=-1;let o=n,a=n;if(t<0)o=Rt(r.text,n,false);else a=Rt(r.text,n);let l=s(r.text.slice(o,a));while(o>0){let h=Rt(r.text,o,false);if(s(r.text.slice(h,o))!=l)break;o=h}while(ai.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight;let l=Math.floor((r-t.top-(i.defaultLineHeight-a)*.5)/a);n+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Om(o,n,i.state.tabSize)}function Em(i,e,t){let s=i.lineBlockAt(e);if(Array.isArray(s.type)){let r;for(let n of s.type){if(n.from>e)break;if(n.toe)return n;if(!r||n.type==Ft.Text&&(r.type!=n.type||(t<0?n.frome)))r=n}return r||s}return s}function I6(i,e,t,s){let r=Em(i,e.head,e.assoc||-1);let n=!s||r.type!=Ft.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(n){let o=i.dom.getBoundingClientRect();let a=i.textDirectionAt(r.from);let l=i.posAtCoords({x:t==(a==Ue.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return z.cursor(l,t?-1:1)}return z.cursor(t?r.to:r.from,t?-1:1)}function w_(i,e,t,s){let r=i.state.doc.lineAt(e.head),n=i.bidiSpans(r);let o=i.textDirectionAt(r.from);for(let a=e,l=null;;){let h=d6(r,n,o,a,t),c=$2;if(!h){if(r.number==(t?i.state.doc.lines:1))return a;c="\\n";r=i.state.doc.line(r.number+(t?1:-1));n=i.bidiSpans(r);h=i.visualLineSide(r,!t)}if(!l){if(!s)return h;l=s(c)}else if(!l(c)){return a}a=h}}function D6(i,e,t){let s=i.state.charCategorizer(e);let r=s(t);return n=>{let o=s(n);if(r==ot.Space)r=o;return r==o}}function z6(i,e,t,s){let r=e.head,n=t?1:-1;if(r==(t?i.state.doc.length:0))return z.cursor(r,e.assoc);let o=e.goalColumn,a;let l=i.contentDOM.getBoundingClientRect();let h=i.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1));let c=i.documentTop;if(h){if(o==null)o=h.left-l.left;a=n<0?h.top:h.bottom}else{let p=i.viewState.lineBlockAt(r);if(o==null)o=Math.min(l.right-l.left,i.defaultCharacterWidth*(r-p.from));a=(n<0?p.top:p.bottom)+c}let d=l.left+o;let u=i.viewState.heightOracle.textHeight>>1,f=s!==null&&s!==void 0?s:u;for(let p=0;;p+=u){let m=a+(f+p)*n;let O=Qm(i,{x:d,y:m},false,n);if(t?m>l.bottom:ma:T{if(e>n&&er(i)),t.from,e.head>t.from?-1:1);return s==t.from?t:z.cursor(s,si.viewState.docHeight)return new Es(i.state.doc.length,-1);h=i.elementAtHeight(l);if(s==null)break;if(h.type==Ft.Text){if(s<0?h.toi.viewport.to)break;let u=i.docView.coordsAt(s<0?h.from:h.to,s>0?-1:1);if(u&&(s<0?u.top<=l+n:u.bottom>=l+n))break}let d=i.viewState.heightOracle.textHeight/2;l=s>0?h.bottom+d:h.top-d}if(i.viewport.from>=h.to||i.viewport.to<=h.from){if(t)return null;if(h.type==Ft.Text){let d=B6(i,r,h,o,a);return new Es(d,d==h.from?1:-1)}}if(h.type!=Ft.Text)return l<(h.top+h.bottom)/2?new Es(h.from,1):new Es(h.to,-1);let c=i.docView.lineAt(h.from,2);if(!c||c.length!=h.length)c=i.docView.lineAt(h.from,-2);return new W6(i,o,a,i.textDirectionAt(h.from)).scanTile(c,h.from)}class W6{constructor(e,t,s,r){this.view=e;this.x=t;this.y=s;this.baseDir=r;this.line=null;this.spans=null}bidiSpansAt(e){if(!this.line||this.line.from>e||this.line.to1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from>1;t:if(o.has(m)){for(let T=1;T=n)k-=p;if(!o.has(k)){m=k;break t}}break e}o.add(m);let O=t(m),v=0;if(O)for(let T=0;T1)continue;if(k.bottomthis.y){if(!h||h.top>k.top)h=k;v=-1}else{let _=k.left>this.x?this.x-k.left:k.right(p+p+m)/3){this.y=l.bottom-1;return this.scan(e,t,true)}if(h&&h.top<(p+m+m)/3){this.y=h.top+1;return this.scan(e,t,true)}}let f=(a?this.dirAt(e[c],1):this.baseDir)==Ue.LTR;return{i:c,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let s=[];for(let n=0;n{let o=s[n]-t,a=s[n+1]-t;return Wl(e.dom,o,a).getClientRects()});return r.after?new Es(s[r.i+1],-1):new Es(s[r.i],1)}scanTile(e,t){if(!e.length)return new Es(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);else if(a.isComposite())return this.scanTile(a,t)}let s=[t];for(let a=0,l=t;a{let l=e.children[a];if(l.flags&48)return null;return(l.dom.nodeType==1?l.dom:Wl(l.dom,0,l.length)).getClientRects()});let n=e.children[r.i],o=s[r.i];if(n.isText())return this.scanText(n,o);if(n.isComposite())return this.scanTile(n,o);return r.after?new Es(s[r.i+1],-1):new Es(o,1)}}const Eo="￿";class q6{constructor(e,t){this.points=e;this.view=t;this.text="";this.lineSeparator=t.state.facet(we.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Eo}readRange(e,t){if(!e)return this;let s=e.parentNode;for(let r=e;;){this.findPointBefore(s,r);let n=this.text.length;this.readNode(r);let o=it.get(r),a=r.nextSibling;if(a==t){if((o===null||o===void 0?void 0:o.breakAfter)&&!a&&s!=this.view.contentDOM)this.lineBreak();break}let l=it.get(a);if((o&&l?o.breakAfter:(o?o.breakAfter:fd(r))||fd(a)&&(r.nodeName!="BR"||(o===null||o===void 0?void 0:o.isWidget()))&&this.text.length>n)&&!N6(a,t))this.lineBreak();r=a}this.findPointBefore(s,t);return this}readTextNode(e){let t=e.nodeValue;for(let s of this.points)if(s.node==e)s.pos=this.text.length+Math.min(s.offset,t.length);for(let s=0,r=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let n=-1,o=1,a;if(this.lineSeparator){n=t.indexOf(this.lineSeparator,s);o=this.lineSeparator.length}else if(a=r.exec(t)){n=a.index;o=a[0].length}this.append(t.slice(s,n<0?t.length:n));if(n<0)break;this.lineBreak();if(o>1){for(let l of this.points)if(l.node==e&&l.pos>this.text.length)l.pos-=o-1}s=n+o}}readNode(e){let t=it.get(e);let s=t&&t.overrideDOMText;if(s!=null){this.findPointInside(e,s.length);for(let r=s.iter();!r.next().done;){if(r.lineBreak)this.lineBreak();else this.append(r.value)}}else if(e.nodeType==3){this.readTextNode(e)}else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1){this.readRange(e.firstChild,null)}}findPointBefore(e,t){for(let s of this.points)if(s.node==e&&e.childNodes[s.offset]==t)s.pos=this.text.length}findPointInside(e,t){for(let s of this.points)if(e.nodeType==3?s.node==e:e.contains(s.node))s.pos=this.text.length+(X6(e,s.node,s.offset)?t:0)}}function X6(i,e,t){for(;;){if(!e||t-1;let{impreciseHead:n,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1){this.newSel=null}else if(t>-1&&(this.bounds=H2(e.docView.tile,t,s,0))){let l=n||o?[]:U6(e);let h=new q6(l,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM);this.text=h.text;this.newSel=j6(l,this.bounds.from)}else{let l=e.observer.selectionRange;let h=n&&n.node==l.focusNode&&n.offset==l.focusOffset||!xm(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset);let c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!xm(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);let d=e.viewport;if((G.ios||G.chrome)&&h!=c&&Math.min(h,c)<=a.main.from&&Math.max(h,c)>=a.main.to&&(d.from>0||d.to-1&&a.ranges.length>1){this.newSel=a.replaceRange(z.range(c,h))}else if(e.lineWrapping&&c==h&&!(a.main.empty&&a.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let u=e.coordsAtPos(h,-1),f=0;if(u)f=e.inputState.lastTouchY<=u.bottom?-1:1;this.newSel=z.create([z.cursor(h,f)])}else{this.newSel=z.single(c,h)}}}}function H2(i,e,t,s){if(i.isComposite()){let r=-1,n=-1,o=-1,a=-1;for(let l=0,h=s,c=s;lt)return H2(d,e,t,h);if(u>=e&&r==-1){r=l;n=h}if(h>t&&d.dom.parentNode==i.dom){o=l;a=c;break}c=u;h=u+d.breakAfter}return{from:n,to:a<0?s+i.length:a,startDOM:(r?i.children[r-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o=0?i.children[o].dom:null}}else if(i.isText()){return{from:s,to:s+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}}else{return null}}function V2(i,e){let t;let{newSel:s}=e,{state:r}=i,n=r.selection.main;let o=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds;let h=n.from,c=null;if(o===8||G.android&&e.text.length=a&&n.to<=l&&(e.typeOver||d!=e.text)&&d.slice(0,n.from-a)==e.text.slice(0,n.from-a)&&d.slice(n.to-a)==e.text.slice(u=e.text.length-(d.length-(n.to-a)))){t={from:n.from,to:n.to,insert:Pe.of(e.text.slice(n.from-a,u).split(Eo))}}else if(f=Y2(d,e.text,h-a,c)){if(G.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==Eo+Eo)f.toB--;t={from:a+f.from,to:a+f.toA,insert:Pe.of(e.text.slice(f.from,f.toB).split(Eo))}}}else if(s&&(!i.hasFocus&&r.facet(dr)||_d(s,n))){s=null}if(!t&&!s)return false;if((G.mac||G.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"){if(s&&t.insert.length==2)s=z.single(s.main.anchor-1,s.main.head-1);t={from:t.from,to:t.to,insert:Pe.of([t.insert.toString().replace("."," ")])}}else if(r.doc.lineAt(n.from).toDate.now()-50){t={from:n.from,to:n.to,insert:r.toText(i.inputState.insertingText)}}else if(G.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()=="\\n "&&i.lineWrapping){if(s)s=z.single(s.main.anchor-1,s.main.head-1);t={from:n.from,to:n.to,insert:Pe.of([" "])}}if(t){return XO(i,t,s,o)}else if(s&&!_d(s,n)){let a=false,l="select";if(i.inputState.lastSelectionTime>Date.now()-50){if(i.inputState.lastSelectionOrigin=="select")a=true;l=i.inputState.lastSelectionOrigin;if(l=="select.pointer")s=j2(r.facet(fh).map(h=>h(i)),s)}i.dispatch({selection:s,scrollIntoView:a,userEvent:l});return true}else{return false}}function XO(i,e,t,s=-1){if(G.ios&&i.inputState.flushIOSKey(e))return true;let r=i.state.selection.main;if(G.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Zo(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||s==8&&e.insert.lengthr.head)&&Zo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Zo(i.contentDOM,"Delete",46)))return true;let n=e.insert.toString();if(i.inputState.composing>=0)i.inputState.composing++;let o;let a=()=>o||(o=Z6(i,e,t));if(!i.state.facet(L2).some(l=>l(i,e.from,e.to,n,a)))i.dispatch(a());return true}function Z6(i,e,t){let s,r=i.state,n=r.selection.main,o=-1;if(e.from==e.to&&e.fromn.to){let l=e.fromd(i)),h,l);if(e.from==c)o=c}if(o>-1){s={changes:e,selection:z.cursor(e.from+e.insert.length,-1)}}else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=n.frome.to?r.sliceDoc(e.to,n.to):"";s=r.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+h))}else{let l=r.changes(e);let h=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let c=i.state.sliceDoc(e.from,e.to);let d,u=t&&U2(i,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);d={from:u.from,to:u.to-p}}else{d=i.state.doc.lineAt(n.head)}let f=n.to-e.to;s=r.changeByRange(p=>{if(p.from==n.from&&p.to==n.to)return{changes:l,range:h||p.map(l)};let m=p.to-f,O=m-c.length;if(i.state.sliceDoc(O,m)!=c||m>=d.from&&O<=d.to)return{range:p};let v=r.changes({from:O,to:m,insert:e.insert}),T=p.to-n.to;return{changes:v,range:!h?p.map(v):z.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T))}})}else{s={changes:l,selection:h&&r.selection.replaceRange(h)}}}let a="input.type";if(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50){i.inputState.compositionPendingChange=false;a+=".compose";if(i.inputState.compositionFirstChange){a+=".start";i.inputState.compositionFirstChange=false}}return r.update(s,{userEvent:a,scrollIntoView:true})}function Y2(i,e,t,s){let r=Math.min(i.length,e.length);let n=0;while(n0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1)){o--;a--}if(s=="end"){let l=Math.max(0,n-Math.min(o,a));t-=o+l-n}if(o=o?n-t:0;n-=l;a=n+(a-o);o=n}else if(a=a?n-t:0;n-=l;o=n+(o-a);a=n}return{from:n,toA:o,toB:a}}function U6(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:n}=i.observer.selectionRange;if(t){e.push(new x_(t,s));if(r!=t||n!=s)e.push(new x_(r,n))}return e}function j6(i,e){if(i.length==0)return null;let t=i[0].pos,s=i.length==2?i[1].pos:t;return t>-1&&s>-1?z.single(t+e,s+e):null}function _d(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}class H6{setSelectionOrigin(e){this.lastSelectionOrigin=e;this.lastSelectionTime=Date.now()}constructor(e){this.view=e;this.lastKeyCode=0;this.lastKeyTime=0;this.touchActive=false;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=false;this.compositionPendingChange=false;this.insertingText="";this.insertingTextAt=0;this.mouseSelection=null;this.draggedContent=null;this.handleEvent=this.handleEvent.bind(this);this.notifiedFocused=e.hasFocus;if(G.safari)e.contentDOM.addEventListener("input",()=>null);if(G.gecko)cQ(e.contentDOM.ownerDocument)}handleEvent(e){if(!sQ(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;if(this.view.updateState!=0)Promise.resolve().then(()=>this.runHandlers(e.type,e));else this.runHandlers(e.type,e)}runHandlers(e,t){let s=this.handlers[e];if(s){for(let r of s.observers)r(this.view,t);for(let r of s.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Y6(e),s=this.handlers,r=this.view.contentDOM;for(let n in t)if(n!="scroll"){let o=!t[n].handlers.length;let a=s[n];if(a&&o!=!a.handlers.length){r.removeEventListener(n,this.handleEvent);a=null}if(!a)r.addEventListener(n,this.handleEvent,{passive:o})}for(let n in s)if(n!="scroll"&&!t[n])r.removeEventListener(n,this.handleEvent);this.handlers=t}keydown(e){this.lastKeyCode=e.keyCode;this.lastKeyTime=Date.now();if(e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return true;if(this.tabFocusMode>0&&e.keyCode!=27&&K2.indexOf(e.keyCode)<0)this.tabFocusMode=-1;if(G.android&&G.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8)){this.view.observer.delayAndroidKey(e.key,e.keyCode);return true}if(G.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(G2.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||G6.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};if(t.shiftKey&&G.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&V6(this.view.win))t.shiftKey=false;this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};setTimeout(()=>this.flushIOSKey(),250);return true}if(e.keyCode!=229)this.view.observer.forceFlush();return false}flushIOSKey(e){let t=this.pendingIOSKey;if(!t)return false;if(t.key=="Enter"&&e&&e.from0)return true;if(G.safari&&!G.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100){this.compositionPendingKey=false;return true}return false}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){this.view.observer.update(e);if(this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function V6(i){if(!i.visualViewport)return false;return i.visualViewport.height*i.visualViewport.scale/i.document.documentElement.clientHeight<.85}function k_(i,e){return(t,s)=>{try{return e.call(i,s,t)}catch(r){As(t.state,r)}}}function Y6(i){let e=Object.create(null);function t(s){return e[s]||(e[s]={observers:[],handlers:[]})}for(let s of i){let r=s.spec,n=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(n)for(let a in n){let l=n[a];if(l)t(a).handlers.push(k_(s.value,l))}if(o)for(let a in o){let l=o[a];if(l)t(a).observers.push(k_(s.value,l))}}for(let s in ns)t(s).handlers.push(ns[s]);for(let s in li)t(s).observers.push(li[s]);return e}const G2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];const G6="dthko";const K2=[16,17,18,20,91,92,224,225];const Fh=6;function Zh(i){return Math.max(0,i)*.7+8}function K6(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class J6{constructor(e,t,s,r){this.view=e;this.startEvent=t;this.style=s;this.mustSelect=r;this.scrollSpeed={x:0,y:0};this.scrolling=-1;this.lastEvent=t;this.scrollParents=_2(e.contentDOM);this.atoms=e.state.facet(fh).map(o=>o(e));let n=e.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this));n.addEventListener("mouseup",this.up=this.up.bind(this));this.extend=t.shiftKey;this.multiple=e.state.facet(we.allowMultipleSelections)&&eQ(e,t);this.dragging=iQ(e,t)&&tx(t)==1?null:false}start(e){if(this.dragging===false)this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&K6(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,s=0;let r=0,n=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;if(this.scrollParents.x)({left:r,right:o}=this.scrollParents.x.getBoundingClientRect());if(this.scrollParents.y)({top:n,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=F2(this.view);if(e.clientX-l.left<=r+Fh)t=-Zh(r-e.clientX);else if(e.clientX+l.right>=o-Fh)t=Zh(e.clientX-o);if(e.clientY-l.top<=n+Fh)s=-Zh(n-e.clientY);else if(e.clientY+l.bottom>=a-Fh)s=Zh(e.clientY-a);this.setScrollSpeed(t,s)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!this.dragging)e.preventDefault();this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move);e.removeEventListener("mouseup",this.up);this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t};if(e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1){clearInterval(this.scrolling);this.scrolling=-1}}scroll(){let{x:e,y:t}=this.scrollSpeed;if(e&&this.scrollParents.x){this.scrollParents.x.scrollLeft+=e;e=0}if(t&&this.scrollParents.y){this.scrollParents.y.scrollTop+=t;t=0}if(e||t)this.view.win.scrollBy(e,t);if(this.dragging===false)this.select(this.lastEvent)}select(e){let{view:t}=this,s=j2(this.atoms,this.style.get(e,this.extend,this.multiple));if(this.mustSelect||!s.eq(t.state.selection,this.dragging===false))this.view.dispatch({selection:s,userEvent:"select.pointer"});this.mustSelect=false}update(e){if(e.transactions.some(t=>t.isUserEvent("input.type")))this.destroy();else if(this.style.update(e))setTimeout(()=>this.select(this.lastEvent),20)}}function eQ(i,e){let t=i.state.facet(E2);return t.length?t[0](e):G.mac?e.metaKey:e.ctrlKey}function tQ(i,e){let t=i.state.facet(Q2);return t.length?t[0](e):G.mac?!e.altKey:!e.ctrlKey}function iQ(i,e){let{main:t}=i.state.selection;if(t.empty)return false;let s=zl(i.root);if(!s||s.rangeCount==0)return true;let r=s.getRangeAt(0).getClientRects();for(let n=0;n=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return true}return false}function sQ(i,e){if(!e.bubbles)return true;if(e.defaultPrevented)return false;for(let t=e.target,s;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(s=it.get(t))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(e))return false;return true}const ns=Object.create(null);const li=Object.create(null);const J2=G.ie&&G.ie_version<15||G.ios&&G.webkit_version<604;function rQ(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px";t.focus();setTimeout(()=>{i.focus();t.remove();ex(i,t.value)},50)}function cu(i,e,t){for(let s of i.facet(e))t=s(t,i);return t}function ex(i,e){e=cu(i.state,DO,e);let{state:t}=i,s,r=1,n=t.toText(e);let o=n.lines==t.selection.ranges.length;let a=Rm!=null&&t.selection.ranges.every(l=>l.empty)&&Rm==n.toString();if(a){let l=-1;s=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==l)return{range:h};l=c.from;let d=t.toText((o?n.line(r++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:d},range:z.cursor(h.from+d.length)}})}else if(o){s=t.changeByRange(l=>{let h=n.line(r++);return{changes:{from:l.from,to:l.to,insert:h.text},range:z.cursor(l.from+h.length)}})}else{s=t.replaceSelection(n)}i.dispatch(s,{userEvent:"input.paste",scrollIntoView:true})}li.scroll=i=>{let e=i.inputState;e.lastScrollTop=i.scrollDOM.scrollTop;e.lastScrollLeft=i.scrollDOM.scrollLeft;if(G.ios&&!e.touchActive)e.lastIOSMomentumScroll=Date.now()};li.wheel=li.mousewheel=i=>{i.inputState.lastWheelEvent=Date.now()};ns.keydown=(i,e)=>{i.inputState.setSelectionOrigin("select");if(e.keyCode==27&&i.inputState.tabFocusMode!=0)i.inputState.tabFocusMode=Date.now()+2e3;return false};li.touchstart=(i,e)=>{let t=i.inputState,s=e.targetTouches[0];t.touchActive=true;t.lastTouchTime=Date.now();if(s){t.lastTouchX=s.clientX;t.lastTouchY=s.clientY}t.setSelectionOrigin("select.pointer")};li.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};li.touchend=(i,e)=>{i.inputState.touchActive=false};ns.mousedown=(i,e)=>{i.observer.flush();if(i.inputState.lastTouchTime>Date.now()-2e3)return false;let t=null;for(let s of i.state.facet(R2)){t=s(i,e);if(t)break}if(!t&&e.button==0)t=oQ(i,e);if(t){let s=!i.hasFocus;i.inputState.startMouseSelection(new J6(i,e,t,s));if(s)i.observer.ignore(()=>{b2(i.contentDOM);let n=i.root.activeElement;if(n&&!n.contains(i.contentDOM))n.blur()});let r=i.inputState.mouseSelection;if(r){r.start(e);return r.dragging===false}}else{i.inputState.setSelectionOrigin("select.pointer")}return false};function C_(i,e,t,s){if(s==1){return z.cursor(e,t)}else if(s==2){return M6(i.state,e,t)}else{let r=i.docView.lineAt(e,t),n=i.state.doc.lineAt(r?r.posAtEnd:e);let o=r?r.posAtStart:n.from,a=r?r.posAtEnd:n.to;if(aDate.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(P_+1)%3:1}function oQ(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},false),s=tx(e);let r=i.state.selection;return{update(n){if(n.docChanged){t.pos=n.changes.mapPos(t.pos);r=r.map(n.changes)}},get(n,o,a){let l=i.posAndSideAtCoords({x:n.clientX,y:n.clientY},false),h;let c=C_(i,l.pos,l.assoc,s);if(t.pos!=l.pos&&!o){let d=C_(i,t.pos,t.assoc,s);let u=Math.min(d.from,c.from),f=Math.max(d.to,c.to);c=u1&&(h=aQ(r,l.pos)))return h;else if(a)return r.addRange(c);else return z.create([c])}}}function aQ(i,e){for(let t=0;t=e)return z.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}ns.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let r=i.docView.tile.nearest(e.target);if(r&&r.isWidget()){let n=r.posAtStart,o=n+r.length;if(n>=t.to||o<=t.from)t=z.undirectionalRange(n,o)}}let{inputState:s}=i;if(s.mouseSelection)s.mouseSelection.dragging=true;s.draggedContent=t;if(e.dataTransfer){e.dataTransfer.setData("Text",cu(i.state,zO,i.state.sliceDoc(t.from,t.to)));e.dataTransfer.effectAllowed="copyMove"}return false};ns.dragend=i=>{i.inputState.draggedContent=null;return false};function E_(i,e,t,s){t=cu(i.state,DO,t);if(!t)return;let r=i.posAtCoords({x:e.clientX,y:e.clientY},false);let{draggedContent:n}=i.inputState;let o=s&&n&&tQ(i,e)?{from:n.from,to:n.to}:null;let a={from:r,insert:t};let l=i.state.changes(o?[o,a]:a);i.focus();i.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"});i.inputState.draggedContent=null}ns.drop=(i,e)=>{if(!e.dataTransfer)return false;if(i.state.readOnly)return true;let t=e.dataTransfer.files;if(t&&t.length){let s=Array(t.length),r=0;let n=()=>{if(++r==t.length)E_(i,e,s.filter(o=>o!=null).join(i.state.lineBreak),false)};for(let o=0;o{if(!/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(a.result))s[o]=a.result;n()};a.readAsText(t[o])}return true}else{let s=e.dataTransfer.getData("Text");if(s){E_(i,e,s,true);return true}}return false};ns.paste=(i,e)=>{if(i.state.readOnly)return true;i.observer.flush();let t=J2?null:e.clipboardData;if(t){ex(i,t.getData("text/plain")||t.getData("text/uri-list"));return true}else{rQ(i);return false}};function lQ(i,e){let t=i.dom.parentNode;if(!t)return;let s=t.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px";s.value=e;s.focus();s.selectionEnd=e.length;s.selectionStart=0;setTimeout(()=>{s.remove();i.focus()},50)}function hQ(i){let e=[],t=[],s=false;for(let r of i.selection.ranges)if(!r.empty){e.push(i.sliceDoc(r.from,r.to));t.push(r)}if(!e.length){let r=-1;for(let{from:n}of i.selection.ranges){let o=i.doc.lineAt(n);if(o.number>r){e.push(o.text);t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})}r=o.number}s=true}return{text:cu(i,zO,e.join(i.lineBreak)),ranges:t,linewise:s}}let Rm=null;ns.copy=ns.cut=(i,e)=>{if(!gl(i.contentDOM,i.observer.selectionRange))return false;let{text:t,ranges:s,linewise:r}=hQ(i.state);if(!t&&!r)return false;Rm=r?t:null;if(e.type=="cut"&&!i.state.readOnly)i.dispatch({changes:s,scrollIntoView:true,userEvent:"delete.cut"});let n=J2?null:e.clipboardData;if(n){n.clearData();n.setData("text/plain",t);return true}else{lQ(i,t);return false}};const ix=br.define();function sx(i,e){let t=[];for(let s of i.facet(M2)){let r=s(i,e);if(r)t.push(r)}return t.length?i.update({effects:t,annotations:ix.of(true)}):null}function rx(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=sx(i.state,e);if(t)i.dispatch(t);else i.update([])}},10)}li.focus=i=>{i.inputState.lastFocusTime=Date.now();if(!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)){i.scrollDOM.scrollTop=i.inputState.lastScrollTop;i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft}rx(i)};li.blur=i=>{i.observer.clearSelectionRange();rx(i)};li.compositionstart=li.compositionupdate=i=>{if(i.observer.editContext)return;if(i.inputState.compositionFirstChange==null)i.inputState.compositionFirstChange=true;if(i.inputState.composing<0){i.inputState.composing=0}};li.compositionend=i=>{if(i.observer.editContext)return;i.inputState.composing=-1;i.inputState.compositionEndedAt=Date.now();i.inputState.compositionPendingKey=true;i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0;i.inputState.compositionFirstChange=null;if(G.chrome&&G.android){i.observer.flushSoon()}else if(i.inputState.compositionPendingChange){Promise.resolve().then(()=>i.observer.flush())}else{setTimeout(()=>{if(i.inputState.composing<0&&i.docView.hasComposition)i.update([])},50)}};li.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};ns.beforeinput=(i,e)=>{var t,s;if(e.inputType=="insertText"||e.inputType=="insertCompositionText"){i.inputState.insertingText=e.data;i.inputState.insertingTextAt=Date.now()}if(e.inputType=="insertReplacementText"&&i.observer.editContext){let n=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let a=o[0];let l=i.posAtDOM(a.startContainer,a.startOffset),h=i.posAtDOM(a.endContainer,a.endOffset);XO(i,{from:l,to:h,insert:i.state.toText(n)},null);return true}}let r;if(G.chrome&&G.android&&(r=G2.find(n=>n.inputType==e.inputType))){i.observer.delayAndroidKey(r.key,r.keyCode);if(r.key=="Backspace"||r.key=="Delete"){let n=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var o;if((((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&i.hasFocus){i.contentDOM.blur();i.focus()}},100)}}if(G.ios&&e.inputType=="deleteContentForward"){i.observer.flushSoon()}if(G.safari&&e.inputType=="insertText"&&i.inputState.composing>=0){setTimeout(()=>li.compositionend(i,e),20)}return false};const Q_=new Set;function cQ(i){if(!Q_.has(i)){Q_.add(i);i.addEventListener("copy",()=>{});i.addEventListener("cut",()=>{})}}const R_=["pre-wrap","normal","pre-line","break-spaces"];let na=false;function A_(){na=false}class dQ{constructor(e){this.lineWrapping=e;this.doc=Pe.empty;this.heightSamples={};this.lineHeight=14;this.charWidth=7;this.textHeight=14;this.lineLength=30}heightForGap(e,t){let s=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)s+=Math.max(0,Math.ceil((t-e-s*this.lineLength*.5)/this.lineLength));return this.lineHeight*s}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;let t=1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5)));return t*this.lineHeight}setDoc(e){this.doc=e;return this}mustRefreshForWrapping(e){return R_.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=false;for(let s=0;s-1;let l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;this.lineWrapping=a;this.lineHeight=t;this.charWidth=s;this.textHeight=r;this.lineLength=n;if(l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){if(this.height!=e){if(Math.abs(this.height-e)>Ac)na=true;this.height=e}}replace(e,t,s){return ai.of(s)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,s,r){let n=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:h,fromB:c,toB:d}=r[a];let u=n.lineAt(l,ze.ByPosNoHeight,s.setDoc(t),0,0);let f=u.to>=h?u:n.lineAt(h,ze.ByPosNoHeight,s,0,0);d+=f.to-h;h=f.to;while(a>0&&u.from<=r[a-1].toA){l=r[a-1].fromA;c=r[a-1].fromB;a--;if(ln*2){let a=e[t-1];if(a.break)e.splice(--t,1,a.left,null,a.right);else e.splice(--t,1,a.left,a.right);s+=1+a.break;r-=a.size}else if(n>r*2){let a=e[s];if(a.break)e.splice(s,1,a.left,null,a.right);else e.splice(s,1,a.left,a.right);s+=2+a.break;n-=a.size}else{break}}else if(r=n)o(this.lineAt(0,ze.ByPos,s,r,n))}setMeasuredHeight(e){let t=e.heights[e.index++];if(t<0){this.spaceAbove=-t;t=e.heights[e.index++]}else{this.spaceAbove=0}this.setHeight(t)}updateHeight(e,t=0,s=false,r){if(r&&r.from<=t&&r.more)this.setMeasuredHeight(r);this.outdated=false;return this}toString(){return\`block(\${this.length})\`}}class Ti extends nx{constructor(e,t,s){super(e,t,null);this.collapsed=0;this.widgetHeight=0;this.breaks=0;this.spaceAbove=s}mainBlock(e,t){return new ss(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,s){let r=s[0];if(s.length==1&&(r instanceof Ti||r instanceof It&&r.flags&4)&&Math.abs(this.length-r.length)<10){if(r instanceof It)r=new Ti(r.length,this.height,this.spaceAbove);else r.height=this.height;if(!this.outdated)r.outdated=false;return r}else{return ai.of(s)}}updateHeight(e,t=0,s=false,r){if(r&&r.from<=t&&r.more){this.setMeasuredHeight(r)}else if(s||this.outdated){this.spaceAbove=0;this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)}this.outdated=false;return this}toString(){return\`line(\${this.length}\${this.collapsed?-this.collapsed:""}\${this.widgetHeight?":"+this.widgetHeight:""})\`}}class It extends ai{constructor(e){super(e,0)}heightMetrics(e,t){let s=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number;let n=r-s+1;let o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*n);o=l/n;if(this.length>n+1)a=(this.height-l)/(this.length-n-1)}else{o=this.height/n}return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(e,t,s,r){let{firstLine:n,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,r);if(t.lineWrapping){let h=r+(e0){let n=s[s.length-1];if(n instanceof It)s[s.length-1]=new It(n.length+r);else s.push(null,new It(r-1))}if(e>0){let n=s[0];if(n instanceof It)s[0]=new It(e+n.length);else s.unshift(new It(e-1),null)}return ai.of(s)}decomposeLeft(e,t){t.push(new It(e-1),null)}decomposeRight(e,t){t.push(null,new It(this.length-e-1))}updateHeight(e,t=0,s=false,r){let n=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],a=Math.max(t,r.from),l=-1;if(r.from>t)o.push(new It(r.from-t-1).updateHeight(e,t));while(a<=n&&r.more){let c=e.doc.lineAt(a).length;if(o.length)o.push(null);let d=r.heights[r.index++],u=0;if(d<0){u=-d;d=r.heights[r.index++]}if(l==-1)l=d;else if(Math.abs(d-l)>=Ac)l=-2;let f=new Ti(c,d,u);f.outdated=false;o.push(f);a+=c+1}if(a<=n)o.push(null,new It(n-a).updateHeight(e,a));let h=ai.of(o);if(l<0||Math.abs(h.height-this.height)>=Ac||Math.abs(l-this.heightMetrics(e,t).perLine)>=Ac)na=true;return vd(this,h)}else if(s||this.outdated){this.setHeight(e.heightForGap(t,t+this.length));this.outdated=false}return this}toString(){return\`gap(\${this.length})\`}}class pQ extends ai{constructor(e,t,s){super(e.length+t+s.length,e.height+s.height,t|(e.outdated||s.outdated?2:0));this.left=e;this.right=s;this.size=e.size+s.size}get break(){return this.flags&1}blockAt(e,t,s,r){let n=s+this.left.height;return ea))return h;let c=t==ze.ByPosNoHeight?ze.ByPosNoHeight:ze.ByPos;if(l)return h.join(this.right.lineAt(a,c,s,o,a));else return this.left.lineAt(a,c,s,r,n).join(h)}forEachLine(e,t,s,r,n,o){let a=r+this.left.height,l=n+this.left.length+this.break;if(this.break){if(e=l)this.right.forEachLine(e,t,s,a,l,o)}else{let h=this.lineAt(l,ze.ByPos,s,r,n);if(e=e&&h.from<=t)o(h);if(t>h.to)this.right.forEachLine(h.to+1,t,s,a,l,o)}}replace(e,t,s){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,s));let n=[];if(e>0)this.decomposeLeft(e,n);let o=n.length;for(let a of s)n.push(a);if(e>0)L_(n,o-1);if(t=s)t.push(null)}if(e>s)this.right.decomposeLeft(e-s,t)}decomposeRight(e,t){let s=this.left.length,r=s+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);if(e2*t.size||t.size>2*e.size)return ai.of(this.break?[e,null,t]:[e,t]);this.left=vd(this.left,e);this.right=vd(this.right,t);this.setHeight(e.height+t.height);this.outdated=e.outdated||t.outdated;this.size=e.size+t.size;this.length=e.length+this.break+t.length;return this}updateHeight(e,t=0,s=false,r){let{left:n,right:o}=this,a=t+n.length+this.break,l=null;if(r&&r.from<=t+n.length&&r.more)l=n=n.updateHeight(e,t,s,r);else n.updateHeight(e,t,s);if(r&&r.from<=a+o.length&&r.more)l=o=o.updateHeight(e,a,s,r);else o.updateHeight(e,a,s);if(l)return this.balanced(n,o);this.height=this.left.height+this.right.height;this.outdated=false;return this}toString(){return this.left+(this.break?" ":"-")+this.right}}function L_(i,e){let t,s;if(i[e]==null&&(t=i[e-1])instanceof It&&(s=i[e+1])instanceof It)i.splice(e-1,3,new It(t.length+1+s.length))}const mQ=5;class NO{constructor(e,t){this.pos=e;this.oracle=t;this.nodes=[];this.lineStart=-1;this.lineEnd=-1;this.covering=null;this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let s=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];if(r instanceof Ti)r.length+=s-this.pos;else if(s>this.pos||!this.isCovered)this.nodes.push(new Ti(s-this.pos,-1,0));this.writtenTo=s;if(t>s){this.nodes.push(null);this.writtenTo++;this.lineStart=-1}}this.pos=t}point(e,t,s){if(e=mQ){this.addLineDeco(r,n,o)}}else if(t>e){this.span(e,t)}if(this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e;this.lineEnd=t;if(this.writtenToe)this.nodes.push(new Ti(this.pos-e,-1,0));this.writtenTo=this.pos}blankContent(e,t){let s=new It(t-e);if(this.oracle.doc.lineAt(e).to==t)s.flags|=4;return s}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ti)return e;let t=new Ti(0,-1,0);this.nodes.push(t);return t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();this.nodes.push(e);this.writtenTo=this.pos=this.pos+e.length;if(t&&t.endSide>0)this.covering=e}addLineDeco(e,t,s){let r=this.ensureLine();r.length+=s;r.collapsed+=s;r.widgetHeight=Math.max(r.widgetHeight,e);r.breaks+=t;this.writtenTo=this.pos=this.pos+s}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof Ti)&&!this.isCovered)this.nodes.push(new Ti(0,-1,0));else if(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&d.overflow!="visible"){let u=c.getBoundingClientRect();n=Math.max(n,u.left);o=Math.min(o,u.right);a=Math.max(a,u.top);l=Math.min(h==i.parentNode?r.innerHeight:l,u.bottom)}h=d.position=="absolute"||d.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11){h=h.host}else{break}}return{left:n-t.left,right:Math.max(n,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function vQ(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left0&&e.top0}function yQ(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class pf{constructor(e,t,s,r){this.from=e;this.to=t;this.size=s;this.displaySize=r}static same(e,t){if(e.length!=t.length)return false;for(let s=0;stypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new dQ(s);this.stateDeco=I_(t);this.heightMap=ai.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle.setDoc(t.doc),[new Xi(0,0,0,t.doc.length)]);for(let r=0;r<2;r++){this.viewport=this.getViewport(0,null);if(!this.updateForViewport())break}this.updateViewportLines();this.lineGaps=this.ensureLineGaps([]);this.lineGapDeco=fe.set(this.lineGaps.map(r=>r.draw(this,false)));this.scrollParent=e.scrollDOM;this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let s=0;s<=1;s++){let r=s?t.head:t.anchor;if(!e.some(({from:n,to:o})=>r>=n&&r<=o)){let{from:n,to:o}=this.lineBlockAt(r);e.push(new Uh(n,o))}}this.viewports=e.sort((s,r)=>s.from-r.from);return this.updateScaler()}updateScaler(){let e=this.scaler;this.scaler=this.heightMap.height<=7e6?B_:new FO(this.heightOracle,this.heightMap,this.viewports);return e.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,e=>{this.viewportLines.push(il(e,this.scaler))})}update(e,t=null){this.state=e.state;let s=this.stateDeco;this.stateDeco=I_(this.state);let r=e.changedRanges;let n=Xi.extendWithRanges(r,gQ(s,this.stateDeco,e?e.changes:_t.empty(this.state.doc.length)));let o=this.heightMap.height;let a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);A_();this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n);if(this.heightMap.height!=o||na)e.flags|=2;if(a){this.scrollAnchorPos=e.changes.mapPos(a.from,-1);this.scrollAnchorHeight=a.top}else{this.scrollAnchorPos=-1;this.scrollAnchorHeight=o}let l=n.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))l=this.getViewport(0,t);let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l;e.flags|=this.updateForViewport();if(h||!e.changes.empty||e.flags&2)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));e.flags|=this.computeVisibleRanges(e.changes);if(t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(I2))this.mustEnforceCursorAssoc=true}measure(){let{view:e}=this,t=e.contentDOM,s=window.getComputedStyle(t);let r=this.heightOracle;let n=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?Ue.RTL:Ue.LTR;let o=this.heightOracle.mustRefreshForWrapping(n)||this.mustMeasureContent==="refresh";let a=t.getBoundingClientRect();let l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height;this.mustMeasureContent=false;let h=0,c=0;if(a.width&&a.height){let{scaleX:C,scaleY:w}=O2(t,a);if(C>.005&&Math.abs(this.scaleX-C)>.005||w>.005&&Math.abs(this.scaleY-w)>.005){this.scaleX=C;this.scaleY=w;h|=16;o=l=true}}let d=(parseInt(s.paddingTop)||0)*this.scaleY;let u=(parseInt(s.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=d||this.paddingBottom!=u){this.paddingTop=d;this.paddingBottom=u;h|=16|2}if(this.editorWidth!=e.scrollDOM.clientWidth){if(r.lineWrapping)l=true;this.editorWidth=e.scrollDOM.clientWidth;h|=16}let f=_2(this.view.contentDOM,false).y;if(f!=this.scrollParent){this.scrollParent=f;this.scrollAnchorHeight=-1;this.scrollOffset=0}let p=this.getScrollOffset();if(this.scrollOffset!=p){this.scrollAnchorHeight=-1;this.scrollOffset=p}this.scrolledToBottom=S2(this.scrollParent||e.win);let m=(this.printing?yQ:_Q)(t,this.paddingTop);let O=m.top-this.pixelViewport.top,v=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let T=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(T!=this.inView){this.inView=T;if(T)l=true}if(!this.inView&&!this.scrollTarget&&!vQ(e.dom))return 0;let k=a.width;if(this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight){this.contentDOMWidth=a.width;this.editorHeight=e.scrollDOM.clientHeight;h|=16}if(l){let C=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(C))o=true;if(o||r.lineWrapping&&Math.abs(k-this.contentDOMWidth)>r.charWidth){let{lineHeight:w,charWidth:Q,textHeight:D}=e.docView.measureTextSize();o=w>0&&r.refresh(n,w,Q,D,Math.max(5,k/Q),C);if(o){e.docView.minWidth=0;h|=16}}if(O>0&&v>0)c=Math.max(O,v);else if(O<0&&v<0)c=Math.min(O,v);A_();for(let w of this.viewports){let Q=w.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?ai.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle,[new Xi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new uQ(w.from,Q))}if(na)h|=2}let _=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);if(_){if(h&2)h|=this.updateScaler();this.viewport=this.getViewport(c,this.scrollTarget);h|=this.updateForViewport()}if(h&2||_)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));h|=this.computeVisibleRanges();if(this.mustEnforceCursorAssoc){this.mustEnforceCursorAssoc=false;e.docView.enforceCursorAssoc()}return h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let s=.5-Math.max(-.5,Math.min(.5,e/1e3/2));let r=this.heightMap,n=this.heightOracle;let{visibleTop:o,visibleBottom:a}=this;let l=new Uh(r.lineAt(o-s*1e3,ze.ByHeight,n,0,0).from,r.lineAt(a+(1-s)*1e3,ze.ByHeight,n,0,0).to);if(t){let{head:h}=t.range;if(hl.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top);let d=r.lineAt(h,ze.ByPos,n,0,0),u;if(t.y=="center")u=(d.top+d.bottom)/2-c/2;else if(t.y=="start"||t.y=="nearest"&&h=a+Math.max(10,Math.min(s,250)))&&(r>o-2*1e3&&n>1,o=r<<1;if(this.defaultTextDirection!=Ue.LTR&&!s)return[];let a=[];let l=(c,d,u,f)=>{if(d-cc&&vv.from>=u.from&&v.to<=u.to&&Math.abs(v.from-c)v.fromT));if(!O){if(dk.from<=d&&k.to>=d)){let k=t.moveToLineBoundary(z.cursor(d),false,true).head;if(k>c)d=k}let v=this.gapSize(u,c,d,f);let T=s||v<2e6?v:2e6;O=new pf(c,d,v,T)}a.push(O)};let h=c=>{if(c.length2e6)for(let w of e){if(w.from>=c.from&&w.fromc.from)l(c.from,f,c,d);if(pt.draw(this,this.heightOracle.lineWrapping)))}}computeVisibleRanges(e){let t=this.stateDeco;if(this.lineGaps.length)t=t.concat(this.lineGapDeco);let s=[];ye.spans(t,this.viewport.from,this.viewport.to,{span(n,o){s.push({from:n,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length){r=8|4}else{for(let n=0;n=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||il(this.heightMap.lineAt(e,ze.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||il(this.heightMap.lineAt(this.scaler.fromDOM(e),ze.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){let e=this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top;return e*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return il(this.heightMap.blockAt(this.scaler.fromDOM(e),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 Uh{constructor(e,t){this.from=e;this.to=t}}function SQ(i,e,t){let s=[],r=i,n=0;ye.spans(t,i,e,{span(){},point(o,a){if(o>r){s.push({from:r,to:o});n+=o-r}r=a}},20);if(r=1)return e[e.length-1].to;let s=Math.floor(i*t);for(let r=0;;r++){let{from:n,to:o}=e[r],a=o-n;if(s<=a)return n+s;s-=a}}function Hh(i,e){let t=0;for(let{from:s,to:r}of i.ranges){if(e<=r){t+=e-s;break}t+=r-s}return t/i.total}function wQ(i,e){for(let t of i)if(e(t))return t;return void 0}const B_={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function I_(i){let e=i.facet(au).filter(s=>typeof s!="function");let t=i.facet(qO).filter(s=>typeof s!="function");if(t.length)e.push(ye.join(t));return e}class FO{constructor(e,t,s){let r=0,n=0,o=0;this.viewports=s.map(({from:a,to:l})=>{let h=t.lineAt(a,ze.ByPos,e,0,0).top;let c=t.lineAt(l,ze.ByPos,e,0,0).bottom;r+=c-h;return{from:a,to:l,top:h,bottom:c,domTop:0,domBottom:0}});this.scale=(7e6-r)/(t.height-r);for(let a of this.viewports){a.domTop=o+(a.top-n)*this.scale;o=a.domBottom=a.domTop+(a.bottom-a.top);n=a.bottom}}toDOM(e){for(let t=0,s=0,r=0;;t++){let n=tt.from==e.viewports[s].from&&t.to==e.viewports[s].to)}}function il(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),s=e.toDOM(i.bottom);return new ss(i.from,i.length,t,s-t,Array.isArray(i._content)?i._content.map(r=>il(r,e)):i._content)}const Vh=te.define({combine:i=>i.join(" ")});const Am=te.define({combine:i=>i.indexOf(true)>-1});const Lm=ln.newName();const ox=ln.newName();const ax=ln.newName();const lx={"&light":"."+ox,"&dark":"."+ax};function Mm(i,e,t){return new ln(e,{finish(s){return/&/.test(s)?s.replace(/&\\w*/,r=>{if(r=="&")return i;if(!t||!t[r])throw new RangeError(\`Unsupported selector: \${r}\`);return t[r]}):i+" "+s}})}const xQ=Mm("."+Lm,{"&":{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"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&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"}},lx);const kQ={childList:true,characterData:true,subtree:true,attributes:true,characterDataOldValue:true};const mf=G.ie&&G.ie_version<=11;class CQ{constructor(e){this.view=e;this.active=false;this.editContext=null;this.selectionRange=new t6;this.selectionChanged=false;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=false;this.gapIntersection=null;this.gaps=[];this.printQuery=null;this.parentCheck=-1;this.dom=e.contentDOM;this.observer=new MutationObserver(t=>{for(let s of t)this.queue.push(s);if((G.ie&&G.ie_version<=11||G.ios&&e.composing)&&t.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length))this.flushSoon();else this.flush()});if(window.EditContext&&G.android&&e.constructor.EDIT_CONTEXT!==false&&!(G.chrome&&G.chrome_version<126)){this.editContext=new PQ(e);if(e.state.facet(dr))e.contentDOM.editContext=this.editContext.editContext}if(mf)this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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);if(window.matchMedia)this.printQuery=window.matchMedia("print");if(typeof ResizeObserver=="function"){this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){this.intersecting=!this.intersecting;if(this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,.001]});this.intersection.observe(this.dom);this.gapIntersection=new IntersectionObserver(t=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{})}this.listenForScroll();this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e);if(this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(false);if(this.editContext)this.view.requestMeasure(this.editContext.measureReq);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1;this.view.requestMeasure()},50)}onPrint(e){if((e.type=="change"||!e.type)&&!e.matches)return;this.view.viewState.printing=true;this.view.measure();setTimeout(()=>{this.view.viewState.printing=false;this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,s)=>t!=e[s]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,r=this.selectionRange;if(s.state.facet(dr)?s.root.activeElement!=this.dom:!gl(this.dom,r))return;let n=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(n&&n.isWidget()&&n.widget.ignoreEvent(e)){if(!t)this.selectionChanged=false;return}if((G.ie&&G.ie_version<=11||G.android&&G.chrome)&&!s.state.selection.main.empty&&r.focusNode&&Ol(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset))this.flushSoon();else this.flush(false)}readSelectionRange(){let{view:e}=this;let t=zl(e.root);if(!t)return false;let s=G.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&TQ(this.view,t)||t;if(!s||this.selectionRange.eq(s))return false;let r=gl(this.dom,s);if(r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let n=this.delayedAndroidKey;if(n){this.clearDelayedAndroidKey();this.view.inputState.lastKeyCode=n.keyCode;this.view.inputState.lastKeyTime=Date.now();let o=this.flush();if(!o&&n.force)Zo(this.dom,n.key,n.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1;this.flush()})}forceFlush(){if(this.delayedFlush>=0){this.view.win.cancelAnimationFrame(this.delayedFlush);this.delayedFlush=-1}this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();if(e.length)this.queue=[];let t=-1,s=-1,r=false;for(let n of e){let o=this.readMutation(n);if(!o)continue;if(o.typeOver)r=true;if(t==-1){({from:t,to:s}=o)}else{t=Math.min(o.from,t);s=Math.max(o.to,s)}}return{from:t,to:s,typeOver:r}}readChange(){let{from:e,to:t,typeOver:s}=this.processRecords();let r=this.selectionChanged&&gl(this.dom,this.selectionRange);if(e<0&&!r)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0;this.selectionChanged=false;let n=new F6(this.view,e,t,s);this.view.docView.domChanged={newSel:n.newSel?n.newSel.main:null};return n}flush(e=true){if(this.delayedFlush>=0||this.delayedAndroidKey)return false;if(e)this.readSelectionRange();let t=this.readChange();if(!t){this.view.requestMeasure();return false}let s=this.view.state;let r=V2(this.view,t);if(this.view.state==s&&(t.domChanged||t.newSel&&!_d(this.view.state.selection,t.newSel.main)))this.view.update([]);return r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;t.markDirty(e.type=="attributes");if(e.type=="childList"){let s=D_(t,e.previousSibling||e.target.previousSibling,-1);let r=D_(t,e.nextSibling||e.target.nextSibling,1);return{from:s?t.posAfter(s):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:false}}else if(e.type=="characterData"){return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}else{return null}}setWindow(e){if(e!=this.win){this.removeWindowListeners(this.win);this.win=e;this.addWindowListeners(this.win)}}addWindowListeners(e){e.addEventListener("resize",this.onResize);if(this.printQuery){if(this.printQuery.addEventListener)this.printQuery.addEventListener("change",this.onPrint);else this.printQuery.addListener(this.onPrint)}else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll);e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll);e.removeEventListener("resize",this.onResize);if(this.printQuery){if(this.printQuery.removeEventListener)this.printQuery.removeEventListener("change",this.onPrint);else this.printQuery.removeListener(this.onPrint)}else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){if(this.editContext){this.editContext.update(e);if(e.startState.facet(dr)!=e.state.facet(dr))e.view.contentDOM.editContext=e.state.facet(dr)?this.editContext.editContext:null}}destroy(){var e,t,s;this.stop();(e=this.intersection)===null||e===void 0?void 0:e.disconnect();(t=this.gapIntersection)===null||t===void 0?void 0:t.disconnect();(s=this.resizeScroll)===null||s===void 0?void 0:s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win);clearTimeout(this.parentCheck);clearTimeout(this.resizeTimeout);this.win.cancelAnimationFrame(this.delayedFlush);this.win.cancelAnimationFrame(this.flushingAndroidKey);if(this.editContext){this.view.contentDOM.editContext=null;this.editContext.destroy()}}}function D_(i,e,t){while(e){let s=it.get(e);if(s&&s.parent==i)return s;let r=e.parentNode;e=r!=i.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function z_(i,e){let t=e.startContainer,s=e.startOffset;let r=e.endContainer,n=e.endOffset;let o=i.docView.domAtPos(i.state.selection.main.anchor,1);if(Ol(o.node,o.offset,r,n))[t,s,r,n]=[r,n,t,s];return{anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:n}}function TQ(i,e){if(e.getComposedRanges){let r=e.getComposedRanges(i.root)[0];if(r)return z_(i,r)}let t=null;function s(r){r.preventDefault();r.stopImmediatePropagation();t=r.getTargetRanges()[0]}i.contentDOM.addEventListener("beforeinput",s,true);i.dom.ownerDocument.execCommand("indent");i.contentDOM.removeEventListener("beforeinput",s,true);return t?z_(i,t):null}class PQ{constructor(e){this.from=0;this.to=0;this.pendingContextChange=null;this.handlers=Object.create(null);this.composing=null;this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=s=>{let r=e.state.selection.main,{anchor:n,head:o}=r;let a=this.toEditorPos(s.updateRangeStart),l=this.toEditorPos(s.updateRangeEnd);if(e.inputState.composing>=0&&!this.composing)this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:false};let h=l-a>s.text.length;if(a==this.from&&nthis.to)l=n;let c=Y2(e.state.sliceDoc(a,l),s.text,(h?r.from:r.to)-a,h?"end":null);if(!c){let u=z.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));if(!_d(u,r))e.dispatch({selection:u,userEvent:"select"});return}let d={from:c.from+a,to:c.toA+a,insert:Pe.of(s.text.slice(c.from,c.toB).split("\\n"))};if((G.mac||G.android)&&d.from==o-1&&/^\\. ?$/.test(s.text)&&e.contentDOM.getAttribute("autocorrect")=="off")d={from:a,to:l,insert:Pe.of([s.text.replace("."," ")])};this.pendingContextChange=d;if(!e.state.readOnly){let u=this.to-this.from+(d.to-d.from+d.insert.length);XO(e,d,z.single(this.toEditorPos(s.selectionStart,u),this.toEditorPos(s.selectionEnd,u)))}if(this.pendingContextChange){this.revertPending(e.state);this.setSelection(e.state)}if(d.from=0&&!/[\\\\p{Alphabetic}\\\\p{Number}_]/.test(t.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(t.text.length,s.updateRangeStart+1))))this.handlers.compositionend(s)};this.handlers.characterboundsupdate=s=>{let r=[],n=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o{let r=[];for(let n of s.getTextFormats()){let o=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(n.rangeStart),h=this.toEditorPos(n.rangeEnd);if(l{if(e.inputState.composing<0){e.inputState.composing=0;e.inputState.compositionFirstChange=true}};this.handlers.compositionend=()=>{e.inputState.composing=-1;e.inputState.compositionFirstChange=null;if(this.composing){let{drifted:s}=this.composing;this.composing=null;if(s)this.reset(e.state)}};for(let s in this.handlers)t.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{let r=zl(s.root);if(r&&r.rangeCount)this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,s=false,r=this.pendingContextChange;e.changes.iterChanges((n,o,a,l,h)=>{if(s)return;let c=h.length-(o-n);if(r&&o>=r.to){if(r.from==n&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null;t+=c;this.to+=c;return}else{r=null;this.revertPending(e.state)}}n+=t;o+=t;if(o<=this.from){this.from+=c;this.to+=c}else if(nthis.to||this.to-this.from+h.length>3e4){s=true;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(o),h.toString());this.to+=c}t+=c});if(r&&!s)this.revertPending(e.state);return!s}update(e){let t=this.pendingContextChange,s=e.startState.selection.main;if(this.composing&&(this.composing.drifted||!e.changes.touchesRange(s.from,s.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))){this.composing.drifted=true;this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)}else if(!this.applyEdits(e)||!this.rangeIsValid(e.state)){this.pendingContextChange=null;this.reset(e.state)}else if(e.docChanged||e.selectionSet||t){this.setSelection(e.state)}if(e.geometryChanged||e.docChanged||e.selectionSet)e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4);this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e);this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to));this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null;this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection;let s=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor)));let r=this.toContextPos(t.head);if(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)this.editContext.updateSelection(s,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let s=this.composing;return s&&s.drifted?s.editorBase+(e-s.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class J{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(e={}){var t;this.plugins=[];this.pluginMap=new Map;this.editorAttrs={};this.contentAttrs={};this.bidiCache=[];this.destroyed=false;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);if(e.parent)e.parent.appendChild(this.dom);let{dispatch:s}=e;this.dispatchTransactions=e.dispatchTransactions||s&&(r=>r.forEach(n=>s(n,this)))||(r=>this.update(r));this.dispatch=this.dispatch.bind(this);this._root=e.root||i6(e.parent)||document;this.viewState=new M_(this,e.state||we.create(e));if(e.scrollTo&&e.scrollTo.is(Nh))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(Bo).map(r=>new hf(r));for(let r of this.plugins)r.update(this);this.observer=new CQ(this);this.inputState=new H6(this);this.inputState.ensureHandlers(this.plugins);this.docView=new S_(this);this.mountStyles();this.updateAttrs();this.updateState=0;this.requestMeasure();if((t=document.fonts)===null||t===void 0?void 0:t.ready)document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh";this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ut?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=false,s=false,r;let n=this.state;for(let u of e){if(u.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=u.state}if(this.destroyed){this.viewState.state=n;return}let o=this.hasFocus,a=0,l=null;if(e.some(u=>u.annotation(ix))){this.inputState.notifiedFocused=o;a=1}else if(o!=this.inputState.notifiedFocused){this.inputState.notifiedFocused=o;l=sx(n,o);if(!l)a=1}let h=this.observer.delayedAndroidKey,c=null;if(h){this.observer.clearDelayedAndroidKey();c=this.observer.readChange();if(c&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))c=null}else{this.observer.clear()}if(n.facet(we.phrases)!=this.state.facet(we.phrases))return this.setState(n);r=md.create(this,n,e);r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(d)d=d.map(u.changes);if(u.scrollIntoView){let{main:f}=u.state.selection;let{x:p,y:m}=this.state.facet(J.cursorScrollMargin);d=new Uo(f.empty?f:z.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",m,p)}for(let f of u.effects)if(f.is(Nh))d=f.value.clip(this.state)}this.viewState.update(r,d);this.bidiCache=yd.update(this.bidiCache,r.changes);if(!r.empty){this.updatePlugins(r);this.inputState.update(r)}t=this.docView.update(r);if(this.state.facet(tl)!=this.styleModules)this.mountStyles();s=this.updateAttrs();this.showAnnouncements(e);this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Vh)!=r.state.facet(Vh))this.viewState.mustMeasureContent=true;if(t||s||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!r.empty)for(let u of this.state.facet(Pm)){try{u(r)}catch(f){As(this.state,f,"update listener")}}if(l||c)Promise.resolve().then(()=>{if(l&&this.state==l.startState)this.dispatch(l);if(c){if(!V2(this,c)&&h.force)Zo(this.contentDOM,h.key,h.keyCode)}})}setState(e){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=e;return}this.updateState=2;let t=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new M_(this,e);this.plugins=e.facet(Bo).map(s=>new hf(s));this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy();this.docView=new S_(this);this.inputState.ensureHandlers(this.plugins);this.mountStyles();this.updateAttrs();this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Bo),s=e.state.facet(Bo);if(t!=s){let r=[];for(let n of s){let o=t.indexOf(n);if(o<0){r.push(new hf(n))}else{let a=this.plugins[o];a.mustUpdate=e;r.push(a)}}for(let n of this.plugins)if(n.mustUpdate!=e)n.destroy(this);this.plugins=r;this.pluginMap.clear()}else{for(let r of this.plugins)r.mustUpdate=e}for(let r=0;r-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1;this.requestMeasure();return}this.measureScheduled=0;if(e)this.observer.forceFlush();let t=null;let s=this.viewState.scrollParent,r=this.viewState.getScrollOffset();let{scrollAnchorPos:n,scrollAnchorHeight:o}=this.viewState;if(Math.abs(r-this.viewState.scrollOffset)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0){if(S2(s||this.win)){n=-1;o=this.viewState.heightMap.height}else{let f=this.viewState.scrollAnchorAt(r);n=f.from;o=f.top}}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];if(!(l&4))[this.measureRequests,h]=[h,this.measureRequests];let c=h.map(f=>{try{return f.read(this)}catch(p){As(this.state,p);return W_}});let d=md.create(this,this.state,[]),u=false;d.flags|=l;if(!t)t=d;else t.flags|=l;this.updateState=2;if(!d.empty){this.updatePlugins(d);this.inputState.update(d);this.updateAttrs();u=this.docView.update(d);if(u)this.docViewUpdate()}for(let f=0;f1||p<-1)&&!(G.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+p;if(!s)this.win.scrollBy(0,p);else if(n<0)s.scrollTop=s.scrollHeight;else s.scrollTop+=p;o=-1;continue}}}break}}}finally{this.updateState=0;this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Pm))a(t)}get themeClasses(){return Lm+" "+(this.state.facet(Am)?ax:ox)+" "+this.state.facet(Vh)}updateAttrs(){let e=q_(this,W2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses});let t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:!this.state.facet(dr)?"false":"true",class:"cm-content",style:\`\${G.tabSize}: \${this.state.tabSize}\`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";q_(this,WO,t);let s=this.observer.ignore(()=>{let r=g_(this.contentDOM,this.contentAttrs,t);let n=g_(this.dom,this.editorAttrs,e);return r||n});this.editorAttrs=e;this.contentAttrs=t;return s}showAnnouncements(e){let t=true;for(let s of e)for(let r of s.effects)if(r.is(J.announce)){if(t)this.announceDOM.textContent="";t=false;let n=this.announceDOM.appendChild(document.createElement("div"));n.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(tl);let e=this.state.facet(J.cspNonce);ln.mount(this.root,this.styleModules.concat(xQ).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(false)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null)for(let t=0;ts.plugin==e)||null);return t&&t.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(e){this.readMeasured();return this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){this.readMeasured();return this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,s){return ff(this,e,w_(this,e,t,s))}moveByGroup(e,t){return ff(this,e,w_(this,e,t,s=>D6(this,e.head,s)))}visualLineSide(e,t){let s=this.bidiSpans(e),r=this.textDirectionAt(e.from);let n=s[t?s.length-1:0];return z.cursor(n.side(t,r)+e.from,n.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,s=true){return I6(this,e,t,s)}moveVertically(e,t,s){return ff(this,e,z6(this,e,t,s))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=true){this.readMeasured();let s=Qm(this,e,t);return s&&s.pos}posAndSideAtCoords(e,t=true){this.readMeasured();return Qm(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let s=this.state.doc.lineAt(e),r=this.bidiSpans(s);let n=r[Rs.find(r,e-s.from,-1,t)];return this.docView.coordsAt(e,t,n.dir==Ue.RTL)}coordsForChar(e){this.readMeasured();return this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){let t=this.state.facet(B2);if(!t||ethis.viewport.to)return this.textDirection;this.readMeasured();return this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$Q)return P2(e.length);let t=this.textDirectionAt(e.from),s;for(let n of this.bidiCache){if(n.from==e.from&&n.dir==t&&(n.fresh||T2(n.isolates,s=v_(this,e))))return n.order}if(!s)s=v_(this,e);let r=c6(e.text,t,s);this.bidiCache.push(new yd(e.from,e.to,t,s,true,r));return r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||G.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{b2(this.contentDOM);this.docView.updateSelection()})}setRoot(e){if(this._root!=e){this._root=e;this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window);this.mountStyles()}}destroy(){if(this.root.activeElement==this.contentDOM)this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[];this.inputState.destroy();this.docView.destroy();this.dom.remove();this.observer.destroy();if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);this.destroyed=true}static scrollIntoView(e,t={}){var s,r,n,o;return Nh.of(new Uo(typeof e=="number"?z.cursor(e):e,(s=t.y)!==null&&s!==void 0?s:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(n=t.yMargin)!==null&&n!==void 0?n:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM;let s=this.viewState.scrollAnchorAt(e);return Nh.of(new Uo(z.cursor(s.from),"start","start",s.top-e,t,true))}setTabFocusMode(e){if(e==null)this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1;else if(typeof e=="boolean")this.inputState.tabFocusMode=e?0:-1;else if(this.inputState.tabFocusMode!=0)this.inputState.tabFocusMode=Date.now()+e}static domEventHandlers(e){return Kt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Kt.define(()=>({}),{eventObservers:e})}static theme(e,t){let s=ln.newName();let r=[Vh.of(s),tl.of(Mm(\`.\${s}\`,e))];if(t&&t.dark)r.push(Am.of(true));return r}static baseTheme(e){return ho.lowest(tl.of(Mm("."+Lm,e,lx)))}static findFromDOM(e){var t;let s=e.querySelector(".cm-content");let r=s&&it.get(s)||it.get(e);return((t=r===null||r===void 0?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}J.styleModule=tl;J.inputHandler=L2;J.clipboardInputFilter=DO;J.clipboardOutputFilter=zO;J.scrollHandler=D2;J.focusChangeEffect=M2;J.perLineTextDirection=B2;J.exceptionSink=A2;J.updateListener=Pm;J.editable=dr;J.mouseSelectionStyle=R2;J.dragMovesSelection=Q2;J.clickAddsSelectionRange=E2;J.decorations=au;J.blockWrappers=q2;J.outerDecorations=qO;J.atomicRanges=fh;J.bidiIsolatedRanges=X2;J.cursorScrollMargin=te.define({combine:i=>{let e=5,t=5;for(let s of i){if(typeof s=="number")e=t=s;else({x:e,y:t}=s)}return{x:e,y:t}}});J.scrollMargins=N2;J.darkTheme=Am;J.cspNonce=te.define({combine:i=>i.length?i[0]:""});J.contentAttributes=WO;J.editorAttributes=W2;J.lineWrapping=J.contentAttributes.of({"class":"cm-lineWrapping"});J.announce=Ce.define();const $Q=4096;const W_={};class yd{constructor(e,t,s,r,n,o){this.from=e;this.to=t;this.dir=s;this.isolates=r;this.fresh=n;this.order=o}static update(e,t){if(t.empty&&!e.some(n=>n.fresh))return e;let s=[],r=e.length?e[e.length-1].dir:Ue.LTR;for(let n=Math.max(0,e.length-10);n=0;r--){let n=s[r],o=typeof n=="function"?n(i):n;if(o)MO(o,t)}return t}const EQ=G.mac?"mac":G.windows?"win":G.linux?"linux":"key";function QQ(i,e){const t=i.split(/-(?!$)/);let s=t[t.length-1];if(s=="Space")s=" ";let r,n,o,a;for(let l=0;ls.concat(r),[])));return t}function AQ(i,e,t){return cx(hx(i.state),e,i,t)}let Ur=null;const LQ=4e3;function MQ(i,e=EQ){let t=Object.create(null);let s=Object.create(null);let r=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")};let n=(o,a,l,h,c)=>{var d,u;let f=t[o]||(t[o]=Object.create(null));let p=a.split(/ (?!$)/).map(v=>QQ(v,e));for(let v=1;v{let _=Ur={view:k,prefix:T,scope:o};setTimeout(()=>{if(Ur==_)Ur=null},LQ);return true}]}}let m=p.join(" ");r(m,false);let O=f[m]||(f[m]={preventDefault:false,stopPropagation:false,run:((u=(d=f._any)===null||d===void 0?void 0:d.run)===null||u===void 0?void 0:u.slice())||[]});if(l)O.run.push(l);if(h)O.preventDefault=true;if(c)O.stopPropagation=true};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let c=t[h]||(t[h]=Object.create(null));if(!c._any)c._any={preventDefault:false,stopPropagation:false,run:[]};let{any:d}=o;for(let u in c)c[u].run.push(f=>d(f,Bm))}let l=o[e]||o.key;if(!l)continue;for(let h of a){n(h,l,o.run,o.preventDefault,o.stopPropagation);if(o.shift)n(h,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}}return t}let Bm=null;function cx(i,e,t,s){Bm=e;let r=VE(e);let n=Jw(r,0),o=e2(n)==r.length&&r!=" ";let a="",l=false,h=false,c=false;if(Ur&&Ur.view==t&&Ur.scope==s){a=Ur.prefix+" ";if(K2.indexOf(e.keyCode)<0){h=true;Ur=null}}let d=new Set;let u=O=>{if(O){for(let v of O.run)if(!d.has(v)){d.add(v);if(v(t)){if(O.stopPropagation)c=true;return true}}if(O.preventDefault){if(O.stopPropagation)c=true;h=true}}return false};let f=i[s],p,m;if(f){if(u(f[a+Yh(r,e,!o)])){l=true}else if(o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(G.windows&&e.ctrlKey&&e.altKey)&&!(G.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=hn[e.keyCode])&&p!=r){if(u(f[a+Yh(p,e,true)])){l=true}else if(e.shiftKey&&(m=Il[e.keyCode])!=r&&m!=p&&u(f[a+Yh(m,e,false)])){l=true}}else if(o&&e.shiftKey&&u(f[a+Yh(r,e,true)])){l=true}if(!l&&u(f._any))l=true}if(h)l=true;if(l&&c)e.stopPropagation();Bm=null;return l}class Nn{constructor(e,t,s,r,n){this.className=e;this.left=t;this.top=s;this.width=r;this.height=n}draw(){let e=document.createElement("div");e.className=this.className;this.adjust(e);return e}update(e,t){if(t.className!=this.className)return false;this.adjust(e);return true}adjust(e){e.style.left=this.left+"px";e.style.top=this.top+"px";if(this.width!=null)e.style.width=this.width+"px";e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,s){if(s.empty){let r=e.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let n=dx(e);return[new Nn(t,r.left-n.left,r.top-n.top,null,r.bottom-r.top)]}else{return BQ(e,t,s)}}}function dx(i){let e=i.scrollDOM.getBoundingClientRect();let t=i.textDirection==Ue.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX;return{left:t-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function N_(i,e,t,s){let r=i.coordsAtPos(e,t*2);if(!r)return s;let n=i.dom.getBoundingClientRect();let o=(r.top+r.bottom)/2;let a=i.posAtCoords({x:n.left+1,y:o});let l=i.posAtCoords({x:n.right-1,y:o});if(a==null||l==null)return s;return{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function BQ(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let s=Math.max(t.from,i.viewport.from),r=Math.min(t.to,i.viewport.to);let n=i.textDirection==Ue.LTR;let o=i.contentDOM,a=o.getBoundingClientRect(),l=dx(i);let h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h);let d=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0);let u=a.right-(c?parseInt(c.paddingRight):0);let f=Em(i,s,1),p=Em(i,r,-1);let m=f.type==Ft.Text?f:null;let O=p.type==Ft.Text?p:null;if(m&&(i.lineWrapping||f.widgetLineBreaks))m=N_(i,s,1,m);if(O&&(i.lineWrapping||p.widgetLineBreaks))O=N_(i,r,-1,O);if(m&&O&&m.from==O.from&&m.to==O.to){return T(k(t.from,t.to,m))}else{let C=m?k(t.from,null,m):_(f,false);let w=O?k(null,t.to,O):_(p,true);let Q=[];if((m||f).to<(O||p).from-(m&&O?1:0)||f.widgetLineBreaks>1&&C.bottom+i.defaultLineHeight/2x&&$.from=R)break;if(q>E)X(Math.max(M,E),C==null&&M<=x,Math.min(q,R),w==null&&q>=y,B.dir)}E=A.to+1;if(E>=R)break}}if(F.length==0)X(x,C==null,y,w==null,i.textDirection);return{top:D,bottom:I,horizontal:F}}function _(C,w){let Q=a.top+(w?C.top:C.bottom);return{top:Q,bottom:Q,horizontal:[]}}}function IQ(i,e){return i.constructor==e.constructor&&i.eq(e)}class DQ{constructor(e,t){this.view=e;this.layer=t;this.drawn=[];this.scaleX=1;this.scaleY=1;this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)};this.dom=e.scrollDOM.appendChild(document.createElement("div"));this.dom.classList.add("cm-layer");if(t.above)this.dom.classList.add("cm-layer-above");if(t.class)this.dom.classList.add(t.class);this.scale();this.dom.setAttribute("aria-hidden","true");this.setOrder(e.state);e.requestMeasure(this.measureReq);if(t.mount)t.mount(this.dom,e)}update(e){if(e.startState.facet(Lc)!=e.state.facet(Lc))this.setOrder(e.state);if(this.layer.update(e,this.dom)||e.geometryChanged){this.scale();e.view.requestMeasure(this.measureReq)}}docViewUpdate(e){if(this.layer.updateOnDocViewUpdate!==false)e.requestMeasure(this.measureReq)}setOrder(e){let t=0,s=e.facet(Lc);while(t!IQ(t,this.drawn[s]))){let t=this.dom.firstChild,s=0;for(let r of e){if(r.update&&t&&r.constructor&&this.drawn[s].constructor&&r.update(t,this.drawn[s])){t=t.nextSibling;s++}else{this.dom.insertBefore(r.draw(),t)}}while(t){let r=t.nextSibling;t.remove();t=r}this.drawn=e;if(G.webkit)this.dom.style.display=this.dom.firstChild?"":"none"}}destroy(){if(this.layer.destroy)this.layer.destroy(this.dom,this.view);this.dom.remove()}}const Lc=te.define();function ux(i){return[Kt.define(e=>new DQ(e,i)),Lc.of(i)]}const oa=te.define({combine(i){return co(i,{cursorBlinkRate:1200,drawRangeCursor:true,iosSelectionHandles:true},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function zQ(i={}){return[oa.of(i),WQ,qQ,NQ,I2.of(true)]}function fx(i){return i.startState.facet(oa)!=i.state.facet(oa)}const WQ=ux({above:true,markers(i){let{state:e}=i,t=e.facet(oa);let s=[];for(let r of e.selection.ranges){let n=r==e.selection.main;if(r.empty||t.drawRangeCursor&&!(n&&G.ios&&t.iosSelectionHandles)){let o=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary";let a=r.empty?r:z.cursor(r.head,r.assoc);for(let l of Nn.forRange(i,o,a))s.push(l)}}return s},update(i,e){if(i.transactions.some(s=>s.selection))e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink";let t=fx(i);if(t)F_(i.state,e);return i.docChanged||i.selectionSet||t},mount(i,e){F_(e.state,i)},class:"cm-cursorLayer"});function F_(i,e){e.style.animationDuration=i.facet(oa).cursorBlinkRate+"ms"}const qQ=ux({above:false,markers(i){let e=[],{main:t,ranges:s}=i.state.selection;for(let r of s)if(!r.empty){for(let n of Nn.forRange(i,"cm-selectionBackground",r))e.push(n)}if(G.ios&&!t.empty&&i.state.facet(oa).iosSelectionHandles){for(let r of Nn.forRange(i,"cm-selectionHandle cm-selectionHandle-start",z.cursor(t.from,1)))e.push(r);for(let r of Nn.forRange(i,"cm-selectionHandle cm-selectionHandle-end",z.cursor(t.to,1)))e.push(r)}return e},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||fx(i)},class:"cm-selectionLayer"});const XQ=G.gecko&&G.gecko_version==153?"#ffffff01":"transparent";const NQ=ho.highest(J.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:\`\${XQ} !important\`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function FQ(){return UQ}const ZQ=fe.line({class:"cm-activeLine"});const UQ=Kt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){if(i.docChanged||i.selectionSet)this.decorations=this.getDeco(i.view)}getDeco(i){let e=-1,t=[];for(let s of i.state.selection.ranges){let r=i.lineBlockAt(s.head);if(r.from>e){t.push(ZQ.range(r.from));e=r.from}}return fe.set(t)}},{decorations:i=>i.decorations});const Im=2e3;function jQ(i,e,t){let s=Math.min(e.line,t.line),r=Math.max(e.line,t.line);let n=[];if(e.off>Im||t.off>Im||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=s;l<=r;l++){let h=i.doc.line(l);if(h.length<=a)n.push(z.range(h.from+o,h.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=s;l<=r;l++){let h=i.doc.line(l);let c=Om(h.text,o,i.tabSize,true);if(c<0){n.push(z.cursor(h.to))}else{let d=Om(h.text,a,i.tabSize);n.push(z.range(h.from+c,h.from+d))}}}return n}function HQ(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Z_(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},false);let s=i.state.doc.lineAt(t),r=t-s.from;let n=r>Im?-1:r==s.length?HQ(i,e.clientX):Fs(s.text,i.state.tabSize,t-s.from);return{line:s.number,col:n,off:r}}function VQ(i,e){let t=Z_(i,e),s=i.state.selection;if(!t)return null;return{update(r){if(r.docChanged){let n=r.changes.mapPos(r.startState.doc.line(t.line).from);let o=r.state.doc.lineAt(n);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)};s=s.map(r.changes)}},get(r,n,o){let a=Z_(i,r);if(!a)return s;let l=jQ(i.state,t,a);if(!l.length)return s;if(o)return z.create(l.concat(s.ranges));else return z.create(l)}}}function YQ(i){let e=t=>t.altKey&&t.button==0;return J.mouseSelectionStyle.of((t,s)=>e(s)?VQ(t,s):null)}const GQ={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]};const KQ={style:"cursor: crosshair"};function JQ(i={}){let[e,t]=GQ[i.key||"Alt"];let s=Kt.fromClass(class{constructor(r){this.view=r;this.isDown=false}set(r){if(this.isDown!=r){this.isDown=r;this.view.update([])}}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){if(r.keyCode==e||!t(r))this.set(false)},mousemove(r){this.set(t(r))}}});return[s,J.contentAttributes.of(r=>{var n;return((n=r.plugin(s))===null||n===void 0?void 0:n.isDown)?KQ:null})]}const U_=te.define({combine(i){let e,t;for(let s of i){e=e||s.topContainer;t=t||s.bottomContainer}return{topContainer:e,bottomContainer:t}}});function px(i,e){let t=i.plugin(mx);let s=t?t.specs.indexOf(e):-1;return s>-1?t.panels[s]:null}const mx=Kt.fromClass(class{constructor(i){this.input=i.state.facet(bd);this.specs=this.input.filter(t=>t);this.panels=this.specs.map(t=>t(i));let e=i.state.facet(U_);this.top=new Gh(i,true,e.topContainer);this.bottom=new Gh(i,false,e.bottomContainer);this.top.sync(this.panels.filter(t=>t.top));this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels){t.dom.classList.add("cm-panel");if(t.mount)t.mount()}}update(i){let e=i.state.facet(U_);if(this.top.container!=e.topContainer){this.top.sync([]);this.top=new Gh(i.view,true,e.topContainer)}if(this.bottom.container!=e.bottomContainer){this.bottom.sync([]);this.bottom=new Gh(i.view,false,e.bottomContainer)}this.top.syncClasses();this.bottom.syncClasses();let t=i.state.facet(bd);if(t!=this.input){let s=t.filter(l=>l);let r=[],n=[],o=[],a=[];for(let l of s){let h=this.specs.indexOf(l),c;if(h<0){c=l(i.view);a.push(c)}else{c=this.panels[h];if(c.update)c.update(i)}r.push(c);(c.top?n:o).push(c)}this.specs=s;this.panels=r;this.top.sync(n);this.bottom.sync(o);for(let l of a){l.dom.classList.add("cm-panel");if(l.mount)l.mount()}}else{for(let s of this.panels)if(s.update)s.update(i)}}destroy(){this.top.sync([]);this.bottom.sync([])}},{provide:i=>J.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Gh{constructor(e,t,s){this.view=e;this.top=t;this.container=s;this.dom=void 0;this.classes="";this.panels=[];this.syncClasses()}sync(e){for(let t of this.panels)if(t.destroy&&e.indexOf(t)<0)t.destroy();this.panels=e;this.syncDOM()}syncDOM(){if(this.panels.length==0){if(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";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels){if(t.dom.parentNode==this.dom){while(e!=t.dom)e=j_(e);e=e.nextSibling}else{this.dom.insertBefore(t.dom,e)}}while(e)e=j_(e)}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)return;for(let e of this.classes.split(" "))if(e)this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))if(e)this.container.classList.add(e)}}function j_(i){let e=i.nextSibling;i.remove();return e}const bd=te.define({enables:mx});function eR(i,e){let t;let s=new Promise(o=>t=o);let r=o=>tR(o,e,t);if(i.state.field(gf,false)){i.dispatch({effects:gx.of(r)})}else{i.dispatch({effects:Ce.appendConfig.of(gf.init(()=>[r]))})}let n=Ox.of(r);return{close:n,result:s.then(o=>{let a=i.win.queueMicrotask||(l=>i.win.setTimeout(l,10));a(()=>{if(i.state.field(gf).indexOf(r)>-1)i.dispatch({effects:n})});return o})}}const gf=ji.define({create(){return[]},update(i,e){for(let t of e.effects){if(t.is(gx))i=[t.value].concat(i);else if(t.is(Ox))i=i.filter(s=>s!=t.value)}return i},provide:i=>bd.computeN([i],e=>e.field(i))});const gx=Ce.define();const Ox=Ce.define();function tR(i,e,t){let s=e.content?e.content(i,()=>o(null)):null;if(!s){s=wt("form");if(e.input){let a=wt("input",e.input);if(/^(text|password|number|email|tel|url)$/.test(a.type))a.classList.add("cm-textfield");if(!a.name)a.name="input";s.appendChild(wt("label",(e.label||"")+": ",a))}else{s.appendChild(document.createTextNode(e.label||""))}s.appendChild(document.createTextNode(" "));s.appendChild(wt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a{if(h.keyCode==27){h.preventDefault();o(null)}else if(h.keyCode==13){h.preventDefault();o(l)}});l.addEventListener("submit",h=>{h.preventDefault();o(l)})}let n=wt("div",s,wt("button",{onclick:()=>o(null),"aria-label":i.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));if(e.class)n.className=e.class;n.classList.add("cm-dialog");function o(a){if(n.contains(n.ownerDocument.activeElement))i.focus();t(a)}return{dom:n,top:e.top,mount:()=>{if(e.focus){let a;if(typeof e.focus=="string")a=s.querySelector(e.focus);else a=s.querySelector("input")||s.querySelector("button");if(a&&"select"in a)a.select();else if(a&&"focus"in a)a.focus()}}}}class dn extends an{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return false}destroy(e){}}dn.prototype.elementClass="";dn.prototype.toDOM=void 0;dn.prototype.mapMode=oi.TrackBefore;dn.prototype.startSide=dn.prototype.endSide=-1;dn.prototype.point=true;const Of=te.define();const iR=te.define();const sR={class:"",renderEmptyElements:false,elementStyle:"",markers:()=>ye.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"};const vl=te.define();function rR(i){return[_x(),vl.of({...sR,...i})]}const H_=te.define({combine:i=>i.some(e=>e)});function _x(i){let e=[nR];return e}const nR=Kt.fromClass(class{constructor(i){this.view=i;this.domAfter=null;this.prevViewport=i.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=i.state.facet(vl).map(e=>new Y_(i,e));this.fixed=!i.state.facet(H_);for(let e of this.gutters){if(e.config.side=="after")this.getDOMAfter().appendChild(e.dom);else this.dom.appendChild(e.dom)}if(this.fixed){this.dom.style.position="sticky"}this.syncGutters(false);i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){if(!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)}return this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport;let s=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(s<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e;if(this.domAfter)this.domAfter.style.minHeight=e}if(this.view.state.facet(H_)!=!this.fixed){this.fixed=!this.fixed;this.dom.style.position=this.fixed?"sticky":"";if(this.domAfter)this.domAfter.style.position=this.fixed?"sticky":""}this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;if(i){this.dom.remove();if(this.domAfter)this.domAfter.remove()}let t=ye.iter(this.view.state.facet(Of),this.view.viewport.from);let s=[];let r=this.gutters.map(n=>new oR(n,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks){if(s.length)s=[];if(Array.isArray(n.type)){let o=true;for(let a of n.type){if(a.type==Ft.Text&&o){Dm(t,s,a.from);for(let l of r)l.line(this.view,a,s);o=false}else if(a.widget){for(let l of r)l.widget(this.view,a)}}}else if(n.type==Ft.Text){Dm(t,s,n.from);for(let o of r)o.line(this.view,n,s)}else if(n.widget){for(let o of r)o.widget(this.view,n)}}for(let n of r)n.finish();if(i){this.view.scrollDOM.insertBefore(this.dom,e);if(this.domAfter)this.view.scrollDOM.appendChild(this.domAfter)}}updateGutters(i){let e=i.startState.facet(vl),t=i.state.facet(vl);let s=i.docChanged||i.heightChanged||i.viewportChanged||!ye.eq(i.startState.facet(Of),i.state.facet(Of),i.view.viewport.from,i.view.viewport.to);if(e==t){for(let r of this.gutters)if(r.update(i))s=true}else{s=true;let r=[];for(let n of t){let o=e.indexOf(n);if(o<0){r.push(new Y_(this.view,n))}else{this.gutters[o].update(i);r.push(this.gutters[o])}}for(let n of this.gutters){n.dom.remove();if(r.indexOf(n)<0)n.destroy()}for(let n of r){if(n.config.side=="after")this.getDOMAfter().appendChild(n.dom);else this.dom.appendChild(n.dom)}this.gutters=r}return s}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove();if(this.domAfter)this.domAfter.remove()}},{provide:i=>J.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let s=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ue.LTR?{left:s,right:r}:{right:s,left:r}})});function V_(i){return Array.isArray(i)?i:[i]}function Dm(i,e,t){while(i.value&&i.from<=t){if(i.from==t)e.push(i.value);i.next()}}class oR{constructor(e,t,s){this.gutter=e;this.height=s;this.i=0;this.cursor=ye.iter(e.markers,t.from)}addElement(e,t,s){let{gutter:r}=this,n=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let a=new vx(e,o,n,s);r.elements.push(a);r.dom.appendChild(a.dom)}else{r.elements[this.i].update(e,o,n,s)}this.height=t.bottom;this.i++}line(e,t,s){let r=[];Dm(this.cursor,r,t.from);if(s.length)r=r.concat(s);let n=this.gutter.config.lineMarker(e,t,r);if(n)r.unshift(n);let o=this.gutter;if(r.length==0&&!o.config.renderEmptyElements)return;this.addElement(e,t,r)}widget(e,t){let s=this.gutter.config.widgetMarker(e,t.widget,t),r=s?[s]:null;for(let n of e.state.facet(iR)){let o=n(e,t.widget,t);if(o)(r||(r=[])).push(o)}if(r)this.addElement(e,t,r)}finish(){let e=this.gutter;while(e.elements.length>this.i){let t=e.elements.pop();e.dom.removeChild(t.dom);t.destroy()}}}class Y_{constructor(e,t){this.view=e;this.config=t;this.elements=[];this.spacer=null;this.dom=document.createElement("div");this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let s in t.domEventHandlers){this.dom.addEventListener(s,r=>{let n=r.target,o;if(n!=this.dom&&this.dom.contains(n)){while(n.parentNode!=this.dom)n=n.parentNode;let l=n.getBoundingClientRect();o=(l.top+l.bottom)/2}else{o=r.clientY}let a=e.lineBlockAtHeight(o-e.documentTop);if(t.domEventHandlers[s](e,a,r))r.preventDefault()})}this.markers=V_(t.markers(e));if(t.initialSpacer){this.spacer=new vx(e,0,0,[t.initialSpacer(e)]);this.dom.appendChild(this.spacer.dom);this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none"}}update(e){let t=this.markers;this.markers=V_(this.config.markers(e.view));if(this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);if(r!=this.spacer.markers[0])this.spacer.update(e.view,0,0,[r])}let s=e.view.viewport;return!ye.eq(this.markers,t,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):false)}destroy(){for(let e of this.elements)e.destroy()}}class vx{constructor(e,t,s,r){this.height=-1;this.above=0;this.markers=[];this.dom=document.createElement("div");this.dom.className="cm-gutterElement";this.update(e,t,s,r)}update(e,t,s,r){if(this.height!=t){this.height=t;this.dom.style.height=t+"px"}if(this.above!=s)this.dom.style.marginTop=(this.above=s)?s+"px":"";if(!aR(this.markers,r))this.setMarkers(e,r)}setMarkers(e,t){let s="cm-gutterElement",r=this.dom.firstChild;for(let n=0,o=0;;){let a=o,l=nn(a,l,h)||o(a,l,h):o}return s}})}});class _f extends dn{constructor(e){super();this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function vf(i,e){return i.state.facet(Io).formatNumber(e,i.state)}const cR=vl.compute([Io],i=>({class:"cm-lineNumbers",renderEmptyElements:false,markers(e){return e.state.facet(lR)},lineMarker(e,t,s){if(s.some(r=>r.toDOM))return null;return new _f(vf(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,s)=>{for(let r of e.state.facet(hR)){let n=r(e,t,s);if(n)return n}return null},lineMarkerChange:e=>e.startState.facet(Io)!=e.state.facet(Io),initialSpacer(e){return new _f(vf(e,G_(e.state.doc.lines)))},updateSpacer(e,t){let s=vf(t.view,G_(t.view.state.doc.lines));return s==e.number?e:new _f(s)},domEventHandlers:i.facet(Io).domEventHandlers,side:"before"}));function dR(i={}){return[Io.of(i),_x(),cR]}function G_(i){let e=9;while(e{throw new Error("This node type doesn't define a deserialize function")});this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");if(typeof e!="function")e=pt.match(e);return t=>{let s=e(t);return s===void 0?null:[this,s]}}}ue.closedBy=new ue({deserialize:i=>i.split(" ")});ue.openedBy=new ue({deserialize:i=>i.split(" ")});ue.group=new ue({deserialize:i=>i.split(" ")});ue.isolate=new ue({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});ue.contextHash=new ue({perNode:true});ue.lookAhead=new ue({perNode:true});ue.mounted=new ue({perNode:true});class jo{constructor(e,t,s,r=false){this.tree=e;this.overlay=t;this.parser=s;this.bracketed=r}static get(e){return e&&e.props&&e.props[ue.mounted.id]}}const fR=Object.create(null);class pt{constructor(e,t,s,r=0){this.name=e;this.props=t;this.id=s;this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):fR;let s=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0);let r=new pt(e.name||"",t,e.id,s);if(e.props)for(let n of e.props){if(!Array.isArray(n))n=n(r);if(n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return true;let t=this.prop(ue.group);return t?t.indexOf(e)>-1:false}return this.id==e}static match(e){let t=Object.create(null);for(let s in e)for(let r of s.split(" "))t[r]=e[s];return s=>{for(let r=s.prop(ue.group),n=-1;n<(r?r.length:0);n++){let o=t[n<0?s.name:r[n]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class ga{constructor(e){this.types=e;for(let t=0;t0;for(let l=this.cursor(o|Ee.IncludeAnonymous);;){let h=false;if(l.from<=n&&l.to>=r&&(!a&&l.type.isAnonymous||t(l)!==false)){if(l.firstChild())continue;h=true}for(;;){if(h&&s&&(a||!l.type.isAnonymous))s(l);if(l.nextSibling())break;if(!l.parent())return;h=true}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:jO(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,s,r)=>new _e(this.type,t,s,r,this.propValues),e.makeTree||((t,s,r)=>new _e(pt.none,t,s,r)))}static build(e){return OR(e)}}_e.empty=new _e(pt.none,[],[],0);class ZO{constructor(e,t){this.buffer=e;this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ZO(this.buffer,this.index)}}class un{constructor(e,t,s){this.buffer=e;this.length=t;this.set=s}get type(){return pt.none}toString(){let e=[];for(let t=0;t0)break}}return a}slice(e,t,s){let r=this.buffer;let n=new Uint16Array(t-e),o=0;for(let a=e,l=0;a=e&&te;case 1:return t<=e&&s>e;case 2:return s>e;case 4:return true}}function ql(i,e,t,s){var r;while(i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?a.length:-1;e!=h;e+=t){let c=a[e],d=l[e]+o.from,u;if(!(n&Ee.EnterBracketed&&c instanceof _e&&(u=jo.get(c))&&!u.overlay&&u.bracketed&&s>=d&&s<=d+c.length)&&!bx(r,s,d,d+c.length))continue;if(c instanceof un){if(n&Ee.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,t,s-d,r);if(f>-1)return new Ls(new pR(o,c,e,d),null,f)}else if(n&Ee.IncludeAnonymous||(!c.type.isAnonymous||UO(c))){let f;if(!(n&Ee.IgnoreMounts)&&(f=jo.get(c))&&!f.overlay)return new Gt(f.tree,d,e,o);let p=new Gt(c,d,e,o);return n&Ee.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,s,r,n)}}if(n&Ee.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;o=o._parent;if(!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,s=0){let r;if(!(s&Ee.IgnoreOverlays)&&(r=jo.get(this._tree))&&r.overlay){let n=e-this.from,o=s&Ee.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay){if((t>0||o?a<=n:a=n:l>n))return new Gt(r.tree,r.overlay[0].from+this.from,-1,this)}}return this.nextChild(0,1,e,t,s)}nextSignificantParent(){let e=this;while(e.type.isAnonymous&&e._parent)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function J_(i,e,t,s){let r=i.cursor(),n=[];if(!r.firstChild())return n;if(t!=null)for(let o=false;!o;){o=r.type.is(t);if(!r.nextSibling())return n}for(;;){if(s!=null&&r.type.is(s))return n;if(r.type.is(e))n.push(r.node);if(!r.nextSibling())return s==null?n:[]}}function zm(i,e,t=e.length-1){for(let s=i;t>=0;s=s.parent){if(!s)return false;if(!s.type.isAnonymous){if(e[t]&&e[t]!=s.name)return false;t--}}return true}class pR{constructor(e,t,s,r){this.parent=e;this.buffer=t;this.index=s;this.start=r}}class Ls extends Sx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,s){super();this.context=e;this._parent=t;this.index=s;this.type=e.buffer.set.types[e.buffer.buffer[s]]}child(e,t,s){let{buffer:r}=this.context;let n=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,s);return n<0?null:new Ls(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,s=0){if(s&Ee.ExcludeBuffers)return null;let{buffer:r}=this.context;let n=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new Ls(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context;let t=e.buffer[this.index+3];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Ls(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context;let t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Ls(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[];let{buffer:s}=this.context;let r=this.index+4,n=s.buffer[this.index+3];if(n>r){let o=s.buffer[this.index+1];e.push(s.slice(r,n,o));t.push(0)}return new _e(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wx(i){if(!i.length)return null;let e=0,t=i[0];for(let n=1;nt.from||o.to=e){let a=new Gt(o.tree,o.overlay[0].from+n.from,-1,n);(r||(r=[s])).push(ql(a,e,t,false))}}}return r?wx(r):s}class Sd{get name(){return this.type.name}constructor(e,t=0){this.buffer=null;this.stack=[];this.index=0;this.bufferNode=null;this.mode=t&~Ee.EnterBracketed;if(e instanceof Gt){this.yieldNode(e)}else{this._tree=e.context.parent;this.buffer=e.context;for(let s=e._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=e;this.yieldBuf(e.index)}}yieldNode(e){if(!e)return false;this._tree=e;this.type=e.type;this.from=e.from;this.to=e.to;return true}yieldBuf(e,t){this.index=e;let{start:s,buffer:r}=this.buffer;this.type=t||r.set.types[r.buffer[e]];this.from=s+r.buffer[e+1];this.to=s+r.buffer[e+2];return true}yield(e){if(!e)return false;if(e instanceof Gt){this.buffer=null;return this.yieldNode(e)}this.buffer=e.context;return this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,s){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,s,this.mode));let{buffer:r}=this.buffer;let n=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,s);if(n<0)return false;this.stack.push(this.index);return this.yieldBuf(n)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,s=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,s));return s&Ee.ExcludeBuffers?false:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ee.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ee.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();this.buffer=null;return this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?false:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,s=this.stack.length-1;if(e<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(s<0?t.buffer.length:t.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):false}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,s,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let n=t+e,o=e<0?-1:s._tree.children.length;n!=o;n+=e){let a=s._tree.children[n];if(this.mode&Ee.IncludeAnonymous||a instanceof un||!a.type.isAnonymous||UO(a))return false}}return true}move(e,t){if(t&&this.enterChild(e,0,4))return true;for(;;){if(this.sibling(e))return true;if(this.atLastNode(e)||!this.parent())return false}}next(e=true){return this.move(1,e)}prev(e=true){return this.move(-1,e)}moveTo(e,t=0){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o;s=n+1;break e}r=this.stack[--n]}}for(let r=s;r=0;n--){if(n<0)return zm(this._tree,e,r);let o=s[t.buffer[this.stack[n]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return false;r--}}return true}}function UO(i){return i.children.some(e=>e instanceof un||!e.type.isAnonymous||UO(e))}function OR(i){var e;let{buffer:t,nodeSet:s,maxBufferLength:r=yx,reused:n=[],minRepeatType:o=s.types.length}=i;let a=Array.isArray(t)?new ZO(t,t.length):t;let l=s.types;let h=0,c=0;function d(C,w,Q,D,I,F){let{id:X,start:x,end:y,size:$}=a;let E=c,R=h;if($<0){a.next();if($==-1){let re=n[X];Q.push(re);D.push(x-C);return}else if($==-3){h=X;return}else if($==-4){c=X;return}else{throw new RangeError(\`Unrecognized record size: \${$}\`)}}let A=l[X],B,M;let q=x-C;if(y-x<=r&&(M=O(a.pos-w,I))){let re=new Uint16Array(M.size-M.skip);let ee=a.pos-M.size,ne=re.length;while(a.pos>ee)ne=v(M.start,re,ne);B=new un(re,y-M.start,s);q=M.start-C}else{let re=a.pos-$;a.next();let ee=[],ne=[];let Ie=X>=o?X:-1;let pe=0,De=y;while(a.pos>re){if(Ie>=0&&a.id==Ie&&a.size>=0){if(a.end<=De-r){p(ee,ne,x,pe,a.end,De,Ie,E,R);pe=ee.length;De=a.end}a.next()}else if(F>2500){u(x,re,ee,ne)}else{d(x,re,ee,ne,Ie,F+1)}}if(Ie>=0&&pe>0&&pe-1&&pe>0){let ke=f(A,R);B=jO(A,ee,ne,0,ee.length,0,y-x,ke,ke)}else{B=m(A,ee,ne,y-x,E-y,R)}}Q.push(B);D.push(q)}function u(C,w,Q,D){let I=[];let F=0,X=-1;while(a.pos>w){let{id:x,start:y,end:$,size:E}=a;if(E>4){a.next()}else if(X>-1&&y=0;$-=3){x[E++]=I[$];x[E++]=I[$+1]-y;x[E++]=I[$+2]-y;x[E++]=E}Q.push(new un(x,I[2]-y,s));D.push(y-C)}}function f(C,w){return(Q,D,I)=>{let F=0,X=Q.length-1,x,y;if(X>=0&&(x=Q[X])instanceof _e){if(!X&&x.type==C&&x.length==I)return x;if(y=x.prop(ue.lookAhead))F=D[X]+x.length+y}return m(C,Q,D,I,F,w)}}function p(C,w,Q,D,I,F,X,x,y){let $=[],E=[];while(C.length>D){$.push(C.pop());E.push(w.pop()+Q-I)}C.push(m(s.types[X],$,E,F-I,x-F,y));w.push(I-Q)}function m(C,w,Q,D,I,F,X){if(F){let x=[ue.contextHash,F];X=X?[x].concat(X):[x]}if(I>25){let x=[ue.lookAhead,I];X=X?[x].concat(X):[x]}return new _e(C,w,Q,D,X)}function O(C,w){let Q=a.fork();let D=0,I=0,F=0,X=Q.end-r;let x={size:0,start:0,skip:0};e:for(let y=Q.pos-C;Q.pos>y;){let $=Q.size;if(Q.id==w&&$>=0){x.size=D;x.start=I;x.skip=F;F+=4;D+=4;Q.next();continue}let E=Q.pos-$;if($<0||E=o?4:0;let A=Q.start;Q.next();while(Q.pos>E){if(Q.size<0){if(Q.size==-3||Q.size==-4)R+=4;else break e}else if(Q.id>=o){R+=4}Q.next()}I=A;D+=$;F+=R}if(w<0||D==C){x.size=D;x.start=I;x.skip=F}return x.size>4?x:void 0}function v(C,w,Q){let{id:D,start:I,end:F,size:X}=a;a.next();if(X>=0&&D4){let y=a.pos-(X-4);while(a.pos>y)Q=v(C,w,Q)}w[--Q]=x;w[--Q]=F-C;w[--Q]=I-C;w[--Q]=D}else if(X==-3){h=D}else if(X==-4){c=D}return Q}let T=[],k=[];while(a.pos>0)d(i.start||0,i.bufferStart||0,T,k,-1,0);let _=(e=i.length)!==null&&e!==void 0?e:T.length?k[0]+T[0].length:0;return new _e(l[i.topID],T.reverse(),k.reverse(),_)}const ev=new WeakMap;function Mc(i,e){if(!i.isAnonymous||e instanceof un||e.type!=i)return 1;let t=ev.get(e);if(t==null){t=1;for(let s of e.children){if(s.type!=i||!(s instanceof _e)){t=1;break}t+=Mc(i,s)}ev.set(e,t)}return t}function jO(i,e,t,s,r,n,o,a,l){let h=0;for(let p=s;p=c)break;w+=Q}if(k==_+1){if(w>c){let Q=p[_];f(Q.children,Q.positions,0,Q.children.length,m[_]+T);continue}d.push(p[_])}else{let Q=m[k-1]+p[k-1].length-C;d.push(jO(i,p,m,_,k,C,Q,null,l))}u.push(C+T-n)}}f(e,t,s,r,0);return(a||l)(d,u,o)}class HO{constructor(){this.map=new WeakMap}setBuffer(e,t,s){let r=this.map.get(e);if(!r)this.map.set(e,r=new Map);r.set(t,s)}getBuffer(e,t){let s=this.map.get(e);return s&&s.get(t)}set(e,t){if(e instanceof Ls)this.setBuffer(e.context.buffer,e.index,t);else if(e instanceof Gt)this.map.set(e.tree,t)}get(e){return e instanceof Ls?this.getBuffer(e.context.buffer,e.index):e instanceof Gt?this.map.get(e.tree):void 0}cursorSet(e,t){if(e.buffer)this.setBuffer(e.buffer.buffer,e.index,t);else this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class gr{constructor(e,t,s,r,n=false,o=false){this.from=e;this.to=t;this.tree=s;this.offset=r;this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],s=false){let r=[new gr(0,e.length,e,0,false,s)];for(let n of t)if(n.to>e.length)r.push(n);return r}static applyChanges(e,t,s=128){if(!t.length)return e;let r=[];let n=1,o=e.length?e[0]:null;for(let a=0,l=0,h=0;;a++){let c=a=s)while(o&&o.from=u.from||d<=u.to||h){let f=Math.max(u.from,l)-h,p=Math.min(u.to,d)-h;u=f>=p?null:new gr(f,p,u.tree,u.offset+h,a>0,!!c)}if(u)r.push(u);if(o.to>d)break;o=nnew Ni(r.from,r.to)):[new Ni(0,0)];return this.createParse(e,t||[],s)}parse(e,t,s){let r=this.startParse(e,t,s);for(;;){let n=r.advance();if(n)return n}}}class _R{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return false}read(e,t){return this.string.slice(e,t)}}function xx(i){return(e,t,s,r)=>new yR(e,i,t,s,r)}class tv{constructor(e,t,s,r,n,o){this.parser=e;this.parse=t;this.overlay=s;this.bracketed=r;this.target=n;this.from=o}}function iv(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class vR{constructor(e,t,s,r,n,o,a,l){this.parser=e;this.predicate=t;this.mounts=s;this.index=r;this.start=n;this.bracketed=o;this.target=a;this.prev=l;this.depth=0;this.ranges=[]}}const Wm=new ue({perNode:true});class yR{constructor(e,t,s,r,n){this.nest=t;this.input=s;this.fragments=r;this.ranges=n;this.inner=[];this.innerDone=0;this.baseTree=null;this.stoppedAt=null;this.baseParse=e}advance(){if(this.baseParse){let s=this.baseParse.advance();if(!s)return null;this.baseParse=null;this.baseTree=s;this.startInner();if(this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let s=this.baseTree;if(this.stoppedAt!=null)s=new _e(s.type,s.children,s.positions,s.length,s.propValues.concat([[Wm,this.stoppedAt]]));return s}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let s=Object.assign(Object.create(null),e.target.props);s[ue.mounted.id]=new jo(t,e.overlay,e.parser,e.bracketed);e.target.props=s}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt){a=false}else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let d=c.from+h.pos,u=c.to+h.pos;if(d>=r.from&&u<=r.to&&!t.ranges.some(f=>f.fromd))t.ranges.push({from:d,to:u})}}a=false}else if(s&&(o=bR(s.ranges,r.from,r.to))){a=o!=2}else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.fromnew Ni(d.from-r.from,d.to-r.from)):null,!!n.bracketed,r.tree,c.length?c[0].from:r.from));if(!n.overlay)a=false;else if(c.length)s={ranges:c,depth:0,prev:s}}}else if(t&&(l=t.predicate(r))){if(l===true)l=new Ni(r.from,r.to);if(l.from=0&&t.ranges[h].to==l.from)t.ranges[h]={from:t.ranges[h].from,to:l.to};else t.ranges.push(l)}}if(a&&r.firstChild()){if(t)t.depth++;if(s)s.depth++}else{for(;;){if(r.nextSibling())break;if(!r.parent())break e;if(t&&!--t.depth){let h=nv(this.ranges,t.ranges);if(h.length){iv(h);this.inner.splice(t.index,0,new tv(t.parser,t.parser.startParse(this.input,ov(t.mounts,h),h),t.ranges.map(c=>new Ni(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))}t=t.prev}if(s&&!--s.depth)s=s.prev}}}}}function bR(i,e,t){for(let s of i){if(s.from>=t)break;if(s.to>e)return s.from<=e&&s.to>=t?2:1}return 0}function sv(i,e,t,s,r,n){if(e=e&&t.enter(s,1,Ee.IgnoreOverlays|Ee.ExcludeBuffers));else if(t.to<=e){if(!t.next(false))this.done=true}else{break}}}hasNode(e){this.moveTo(e.from);if(!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree){for(let t=this.cursor.tree;;){if(t==e.tree)return true;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof _e)t=t.children[0];else break}}return false}}let wR=class RU{constructor(e){var t;this.fragments=e;this.curTo=0;this.fragI=0;if(e.length){let s=this.curFrag=e[0];this.curTo=(t=s.tree.prop(Wm))!==null&&t!==void 0?t:s.to;this.inner=new rv(s.tree,-s.offset)}else{this.curFrag=this.inner=null}}hasNode(e){while(this.curFrag&&e.from>=this.curTo)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;this.fragI++;if(this.fragI==this.fragments.length){this.curFrag=this.inner=null}else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Wm))!==null&&e!==void 0?e:t.to;this.inner=new rv(t.tree,-t.offset)}}findMounts(e,t){var s;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(s=n.tree)===null||s===void 0?void 0:s.prop(ue.mounted);if(o&&o.parser==t){for(let a=this.fragI;a=n.to)break;if(l.tree==this.curFrag.tree)r.push({frag:l,pos:n.from-l.offset,mount:o})}}}}return r}};function nv(i,e){let t=null,s=e;for(let r=1,n=0;r=a)break;if(l.to<=o)continue;if(!t)s=t=e.slice();if(l.froma)t.splice(n+1,0,new Ni(a,l.to))}else if(l.to>a){t[n--]=new Ni(a,l.to)}else{t.splice(n--,1)}}}return s}function xR(i,e,t,s){let r=0,n=0,o=false,a=false,l=-1e9;let h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from;let d=n==e.length?1e9:a?e[n].to:e[n].from;if(o!=a){let u=Math.max(l,t),f=Math.min(c,d,s);if(unew Ni(u.from+s,u.to+s));let d=xR(e,c,l,h);for(let u=0,f=l;;u++){let p=u==d.length,m=p?h:d[u].from;if(m>f)t.push(new gr(f,m,r.tree,-o,n.from>=f||n.openStart,n.to<=m||n.openEnd));if(p)break;f=d[u].to}}else{t.push(new gr(l,h,r.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}}return t}let kR=0;let Ps=class qm{constructor(e,t,s,r){this.name=e;this.set=t;this.base=s;this.modified=r;this.id=kR++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=\`\${t.name}(\${e})\`;return e}static define(e,t){let s=typeof e=="string"?e:"?";if(e instanceof qm)t=e;if(t===null||t===void 0?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new qm(s,[],null,[]);r.set.push(r);if(t)for(let n of t.set)r.set.push(n);return r}static defineModifier(e){let t=new wd(e);return s=>{if(s.modified.indexOf(t)>-1)return s;return wd.get(s.base||s,s.modified.concat(t).sort((r,n)=>r.id-n.id))}}};let CR=0;class wd{constructor(e){this.name=e;this.instances=[];this.id=CR++}static get(e,t){if(!t.length)return e;let s=t[0].instances.find(a=>a.base==e&&TR(t,a.modified));if(s)return s;let r=[],n=new Ps(e.name,r,e,t);for(let a of t)a.instances.push(n);let o=PR(t);for(let a of e.set)if(!a.modified.length)for(let l of o)r.push(wd.get(a,l));return n}}function TR(i,e){return i.length==e.length&&i.every((t,s)=>t==e[s])}function PR(i){let e=[[]];for(let t=0;ts.length-t.length)}function Sr(i){let e=Object.create(null);for(let t in i){let s=i[t];if(!Array.isArray(s))s=[s];for(let r of t.split(" "))if(r){let n=[],o=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){o=1;break}let u=/^"(?:[^"\\\\]|\\\\.)*?"|[^\\/!]+/.exec(a);if(!u)throw new RangeError("Invalid path: "+r);n.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]);d+=u[0].length;if(d==r.length)break;let f=r[d++];if(d==r.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=n.length-1,h=n[l];if(!h)throw new RangeError("Invalid path: "+r);let c=new Xl(s,o,l>0?n.slice(0,l):null);e[h]=c.sort(e[h])}}return kx.add(e)}const kx=new ue({combine(i,e){let t,s,r;while(i||e){if(!i||e&&i.depth>=e.depth){r=e;e=e.next}else{r=i;i=i.next}if(t&&t.mode==r.mode&&!r.context&&!t.context)continue;let n=new Xl(r.tags,r.mode,r.context);if(t)t.next=n;else s=n;t=n}return s}});let Xl=class AU{constructor(e,t,s,r){this.tags=e;this.mode=t;this.context=s;this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth{let o=r;for(let a of n){for(let l of a.set){let h=t[l.id];if(h){o=o?o+" "+h:h;break}}}return o},scope:s}}function $R(i,e){let t=null;for(let s of i){let r=s.style(e);if(r)t=t?t+" "+r:r}return t}function ER(i,e,t,s=0,r=i.length){let n=new QR(s,Array.isArray(e)?e:[e],t);n.highlightRange(i.cursor(),s,r,"",n.highlighters);n.flush(r)}class QR{constructor(e,t,s){this.at=e;this.highlighters=t;this.span=s;this.class=""}startSpan(e,t){if(t!=this.class){this.flush(e);if(e>this.at)this.at=e;this.class=t}}flush(e){if(e>this.at&&this.class)this.span(this.at,e,this.class)}highlightRange(e,t,s,r,n){let{type:o,from:a,to:l}=e;if(a>=s||l<=t)return;if(o.isTop)n=this.highlighters.filter(f=>!f.scope||f.scope(o));let h=r;let c=RR(e)||Xl.empty;let d=$R(n,c.tags);if(d){if(h)h+=" ";h+=d;if(c.mode==1)r+=(r?" ":"")+d}this.startSpan(Math.max(t,a),h);if(c.opaque)return;let u=e.tree&&e.tree.prop(ue.mounted);if(u&&u.overlay){let f=e.node.enter(u.overlay[0].from+a,1);let p=this.highlighters.filter(O=>!O.scope||O.scope(u.tree.type));let m=e.firstChild();for(let O=0,v=a;;O++){let T=O=k||!e.nextSibling())break}}if(!T||k>s)break;v=T.to+a;if(v>t){this.highlightRange(f.cursor(),Math.max(t,T.from+a),Math.min(s,v),"",p);this.startSpan(Math.min(s,v),h)}}if(m)e.parent()}else if(e.firstChild()){if(u)r="";do{if(e.to<=t)continue;if(e.from>=s)break;this.highlightRange(e,t,s,r,n);this.startSpan(Math.min(s,e.to),h)}while(e.nextSibling());e.parent()}}}function RR(i){let e=i.type.prop(kx);while(e&&e.context&&!i.matchContext(e.context))e=e.next;return e||null}const V=Ps.define;const Jh=V();const Wr=V();const av=V(Wr);const lv=V(Wr);const qr=V();const ec=V(qr);const yf=V(qr);const xs=V();const Sn=V(xs);const gs=V();const Os=V();const Xm=V();const Aa=V(Xm);const tc=V();const P={comment:Jh,lineComment:V(Jh),blockComment:V(Jh),docComment:V(Jh),name:Wr,variableName:V(Wr),typeName:av,tagName:V(av),propertyName:lv,attributeName:V(lv),className:V(Wr),labelName:V(Wr),namespace:V(Wr),macroName:V(Wr),literal:qr,string:ec,docString:V(ec),character:V(ec),attributeValue:V(ec),number:yf,integer:V(yf),float:V(yf),bool:V(qr),regexp:V(qr),escape:V(qr),color:V(qr),url:V(qr),keyword:gs,self:V(gs),null:V(gs),atom:V(gs),unit:V(gs),modifier:V(gs),operatorKeyword:V(gs),controlKeyword:V(gs),definitionKeyword:V(gs),moduleKeyword:V(gs),operator:Os,derefOperator:V(Os),arithmeticOperator:V(Os),logicOperator:V(Os),bitwiseOperator:V(Os),compareOperator:V(Os),updateOperator:V(Os),definitionOperator:V(Os),typeOperator:V(Os),controlOperator:V(Os),punctuation:Xm,separator:V(Xm),bracket:Aa,angleBracket:V(Aa),squareBracket:V(Aa),paren:V(Aa),brace:V(Aa),content:xs,heading:Sn,heading1:V(Sn),heading2:V(Sn),heading3:V(Sn),heading4:V(Sn),heading5:V(Sn),heading6:V(Sn),contentSeparator:V(xs),list:V(xs),quote:V(xs),emphasis:V(xs),strong:V(xs),link:V(xs),monospace:V(xs),strikethrough:V(xs),inserted:V(),deleted:V(),changed:V(),invalid:V(),meta:tc,documentMeta:V(tc),annotation:V(tc),processingInstruction:V(tc),definition:Ps.defineModifier("definition"),constant:Ps.defineModifier("constant"),function:Ps.defineModifier("function"),standard:Ps.defineModifier("standard"),local:Ps.defineModifier("local"),special:Ps.defineModifier("special")};for(let i in P){let e=P[i];if(e instanceof Ps)e.name=i}const AR=Cx([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var bf;const Gr=new ue;function fu(i){return te.define({combine:i?e=>e.concat(i):void 0})}const VO=new ue;class Ei{constructor(e,t,s=[],r=""){this.data=e;this.name=r;if(!we.prototype.hasOwnProperty("tree"))Object.defineProperty(we.prototype,"tree",{get(){return We(this)}});this.parser=t;this.extension=[fn.of(this),we.languageData.of((n,o,a)=>{let l=hv(n,o,a),h=l.type.prop(Gr);if(!h)return[];let c=n.facet(h),d=l.type.prop(VO);if(d){let u=l.resolve(o-l.from,a);for(let f of d)if(f.test(u,n)){let p=n.facet(f.facet);return f.type=="replace"?p:p.concat(c)}}return c})].concat(s)}isActiveAt(e,t,s=-1){return hv(e,t,s).type.prop(Gr)==this.data}findRegions(e){let t=e.facet(fn);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let s=[];let r=(n,o)=>{if(n.prop(Gr)==this.data){s.push({from:o,to:o+n.length});return}let a=n.prop(ue.mounted);if(a){if(a.tree.prop(Gr)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+n.length});return}else if(a.overlay){let l=s.length;r(a.tree,a.overlay[0].from+o);if(s.length>l)return}}for(let l=0;ls.isTop?t:void 0)]}),e.name)}configure(e,t){return new _r(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function We(i){let e=i.field(Ei.state,false);return e?e.tree:_e.empty}class LR{constructor(e){this.doc=e;this.cursorPos=0;this.string="";this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){this.string=this.cursor.next(e-this.cursorPos).value;this.cursorPos=e+this.string.length;return this.cursorPos-this.string.length}chunk(e){this.syncTo(e);return this.string}get lineChunks(){return true}read(e,t){let s=this.cursorPos-this.string.length;if(e=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-s,t-s)}}let La=null;class eo{constructor(e,t,s=[],r,n,o,a,l){this.parser=e;this.state=t;this.fragments=s;this.tree=r;this.treeLen=n;this.viewport=o;this.skipped=a;this.scheduleOn=l;this.parse=null;this.tempSkipped=[]}static create(e,t,s){return new eo(e,t,[],_e.empty,0,s,[],null)}startParse(){return this.parser.startParse(new LR(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=_e.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length)){this.takeTree();return true}return this.withContext(()=>{var s;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance())){}});this.treeLen=e;this.tree=t;this.fragments=this.withoutTempSkipped(gr.addTree(this.tree,this.fragments,true));this.parse=null}}withContext(e){let t=La;La=this;try{return e()}finally{La=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=cv(e,t.from,t.to);return e}changes(e,t){let{fragments:s,tree:r,treeLen:n,viewport:o,skipped:a}=this;this.takeTree();if(!e.empty){let l=[];e.iterChangedRanges((h,c,d,u)=>l.push({fromA:h,toA:c,fromB:d,toB:u}));s=gr.applyChanges(s,l);r=_e.empty;n=0;o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)};if(this.skipped.length){a=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);if(ce.from){this.fragments=cv(this.fragments,r,n);this.skipped.splice(s--,1)}}if(this.skipped.length>=t)return false;this.reset();return true}reset(){if(this.parse){this.takeTree();this.parse=null}}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends uu{createParse(t,s,r){let n=r[0].from,o=r[r.length-1].to;let a={parsedPos:n,advance(){let l=La;if(l){for(let h of r)l.tempSkipped.push(h);if(e)l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e}this.parsedPos=o;return new _e(pt.none,[],[],o-n)},stoppedAt:null,stopAt(){}};return a}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return La}}function cv(i,e,t){return gr.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class aa{constructor(e){this.context=e;this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state);let s=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,s))t.takeTree();return new aa(t)}static init(e){let t=Math.min(3e3,e.doc.length);let s=eo.create(e.facet(fn).parser,e,{from:0,to:t});if(!s.work(20,t))s.takeTree();return new aa(s)}}Ei.state=ji.define({create:aa.init,update(i,e){for(let t of e.effects)if(t.is(Ei.setState))return t.value;if(e.startState.facet(fn)!=e.state.facet(fn))return aa.init(e.state);return i.apply(e)}});let Tx=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};if(typeof requestIdleCallback!="undefined")Tx=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)};const Sf=typeof navigator!="undefined"&&((bf=navigator.scheduling)===null||bf===void 0?void 0:bf.isInputPending)?()=>navigator.scheduling.isInputPending():null;const MR=Kt.fromClass(class LU{constructor(e){this.view=e;this.working=null;this.workScheduled=0;this.chunkEnd=-1;this.chunkBudget=-1;this.work=this.work.bind(this);this.scheduleWork()}update(e){let t=this.view.state.field(Ei.state).context;if(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)this.scheduleWork();if(e.docChanged||e.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ei.state);if(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))this.working=Tx(this.work)}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3;let l=n.context.work(()=>{return Sf&&Sf()||Date.now()>o},r+(a?0:1e5));this.chunkBudget-=Date.now()-t;if(l||this.chunkBudget<=0){n.context.takeTree();this.view.dispatch({effects:Ei.setState.of(new aa(n.context))})}if(this.chunkBudget>0&&!(l&&!a))this.scheduleWork();this.checkAsyncSchedule(n.context)}checkAsyncSchedule(e){if(e.scheduleOn){this.workScheduled++;e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>As(this.view.state,t)).then(()=>this.workScheduled--);e.scheduleOn=null}}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}});const fn=te.define({combine(i){return i.length?i[0]:null},enables:i=>[Ei.state,MR,J.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class pn{constructor(e,t=[]){this.language=e;this.support=t;this.extension=[e,t]}}class xd{constructor(e,t,s,r,n,o=void 0){this.name=e;this.alias=t;this.extensions=s;this.filename=r;this.loadFunc=n;this.support=o;this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{this.loading=null;throw e}))}static of(e){let{load:t,support:s}=e;if(!t){if(!s)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(s)}return new xd(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,s)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let s=/\\.([^.]+)$/.exec(t);if(s){for(let r of e)if(r.extensions.indexOf(s[1])>-1)return r}return null}static matchLanguageName(e,t,s=true){t=t.toLowerCase();for(let r of e)if(r.alias.some(n=>n==t))return r;if(s)for(let r of e)for(let n of r.alias){let o=t.indexOf(n);if(o>-1&&(n.length>2||!/\\w/.test(t[o-1])&&!/\\w/.test(t[o+n.length])))return r}return null}}const BR=te.define();const ph=te.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function to(i){let e=i.facet(ph);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Nl(i,e){let t="",s=i.tabSize,r=i.facet(ph)[0];if(r==" "){while(e>=s){t+=" ";e-=s}r=" "}for(let n=0;n=e?IR(i,t,e):null}class pu{constructor(e,t={}){this.state=e;this.options=t;this.unit=to(e)}lineAt(e,t=1){let s=this.state.doc.lineAt(e);let{simulateBreak:r,simulateDoubleBreak:n}=this.options;if(r!=null&&r>=s.from&&r<=s.to){if(n&&r==e)return{text:"",from:e};else if(t<0?r-1)n+=o-this.countColumn(s,s.search(/\\S|$/));return n}countColumn(e,t=e.length){return Fs(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:s,from:r}=this.lineAt(e,t);let n=this.options.overrideIndentation;if(n){let o=n(r);if(o>-1)return o}return this.countColumn(s,s.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const wr=new ue;function IR(i,e,t){let s=e.resolveStack(t);let r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=s.node){let n=[];for(let o=r;o&&!(o.froms.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)n.push(o);for(let o=n.length-1;o>=0;o--)s={node:n[o],next:s}}return Px(s,i,t)}function Px(i,e,t){for(let s=i;s;s=s.next){let r=zR(s.node);if(r)return r(GO.create(e,t,s))}return 0}function DR(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function zR(i){let e=i.type.prop(wr);if(e)return e;let t=i.firstChild,s;if(t&&(s=t.type.prop(ue.closedBy))){let r=i.lastChild,n=r&&s.indexOf(r.name)>-1;return o=>$x(o,true,1,void 0,n&&!DR(o)?r.from:void 0)}return i.parent==null?WR:null}function WR(){return 0}class GO extends pu{constructor(e,t,s){super(e.state,e.options);this.base=e;this.pos=t;this.context=s}get node(){return this.context.node}static create(e,t,s){return new GO(e,t,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let s=e.resolve(t.from);while(s.parent&&s.parent.from==s.from)s=s.parent;if(qR(s,e))break;t=this.state.doc.lineAt(s.from)}return this.lineIndent(t.from)}continue(){return Px(this.context.next,this.base,this.pos)}}function qR(i,e){for(let t=e;t;t=t.parent)if(i==t)return true;return false}function XR(i){let e=i.node;let t=e.childAfter(e.from),s=e.lastChild;if(!t)return null;let r=i.options.simulateBreak;let n=i.state.doc.lineAt(t.from);let o=r==null||r<=n.from?n.to:Math.min(n.to,r);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let h=/^ */.exec(n.text.slice(t.to-n.from))[0].length;return{from:t.from,to:t.to+h}}a=l.to}}function Ho({closing:i,align:e=true,units:t=1}){return s=>$x(s,e,t,i)}function $x(i,e,t,s,r){let n=i.textAfter,o=n.match(/^\\s*/)[0].length;let a=s&&n.slice(o,o+s.length)==s||r==i.pos+o;let l=e?XR(i):null;if(l)return a?i.column(l.from):i.column(l.to);return i.baseIndent+(a?0:i.unit*t)}const NR=i=>i.baseIndent;function Vo({except:i,units:e=1}={}){return t=>{let s=i&&i.test(t.textAfter);return t.baseIndent+(s?0:e*t.unit)}}const FR=200;function ZR(){return we.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:s}=i.newSelection.main,r=t.lineAt(s);if(s>r.from+FR)return i;let n=t.sliceString(r.from,s);if(!e.some(h=>h.test(n)))return i;let{state:o}=i,a=-1,l=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==a)continue;a=c.from;let d=YO(o,c.from);if(d==null)continue;let u=/^\\s*/.exec(c.text)[0];let f=Nl(o,d);if(u!=f)l.push({from:c.from,to:c.from+u.length,insert:f})}return l.length?[i,{changes:l,sequential:true}]:i})}const Ex=te.define();const xr=new ue;function mh(i){let e=i.firstChild,t=i.lastChild;return e&&e.tot)continue;if(n&&a.from=e&&h.to>t)n=h}}return n}function jR(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function kd(i,e,t){for(let s of i.facet(Ex)){let r=s(i,e,t);if(r)return r}return UR(i,e,t)}function Qx(i,e){let t=e.mapPos(i.from,1),s=e.mapPos(i.to,-1);return t>=s?void 0:{from:t,to:s}}const mu=Ce.define({map:Qx});const gh=Ce.define({map:Qx});function Rx(i){let e=[];for(let{head:t}of i.state.selection.ranges){if(e.some(s=>s.from<=t&&s.to>=t))continue;e.push(i.lineBlockAt(t))}return e}const io=ji.define({create(){return fe.none},update(i,e){if(e.isUserEvent("delete"))e.changes.iterChangedRanges((s,r)=>i=dv(i,s,r));i=i.map(e.changes);let t=[];for(let s of e.effects){if(s.is(mu)&&!HR(i,s.value.from,s.value.to)){t.push(s.value)}else if(s.is(gh)){i=i.update({filter:(r,n)=>s.value.from!=r||s.value.to!=n,filterFrom:s.value.from,filterTo:s.value.to})}}if(t.length){let{preparePlaceholder:s}=e.state.facet(Mx);let r=t.map(n=>{let o=!s?uv:fe.replace({widget:new tA(s(e.state,n))});return o.range(n.from,n.to)});i=i.update({add:r})}if(e.selection)i=dv(i,e.selection.main.head);return i},provide:i=>J.decorations.from(i),toJSON(i,e){let t=[];i.between(0,e.doc.length,(s,r)=>{t.push(s,r)});return t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{if(re)s=true});return!s?i:i.update({filterFrom:e,filterTo:t,filter:(r,n)=>r>=t||n<=e})}function Cd(i,e,t){var s;let r=null;(s=i.field(io,false))===null||s===void 0?void 0:s.between(e,t,(n,o)=>{if(!r||r.from>n)r={from:n,to:o}});return r}function HR(i,e,t){let s=false;i.between(e,e,(r,n)=>{if(r==e&&n==t)s=true});return s}function Ax(i,e){return i.field(io,false)?e:e.concat(Ce.appendConfig.of(Bx()))}const VR=i=>{for(let e of Rx(i)){let t=kd(i.state,e.from,e.to);if(t){i.dispatch({effects:Ax(i.state,[mu.of(t),Lx(i,t)])});return true}}return false};const YR=i=>{if(!i.state.field(io,false))return false;let e=[];for(let t of Rx(i)){let s=Cd(i.state,t.from,t.to);if(s)e.push(gh.of(s),Lx(i,s,false))}if(e.length)i.dispatch({effects:e});return e.length>0};function Lx(i,e,t=true){let s=i.state.doc.lineAt(e.from).number,r=i.state.doc.lineAt(e.to).number;return J.announce.of(\`\${i.state.phrase(t?"Folded lines":"Unfolded lines")} \${s} \${i.state.phrase("to")} \${r}.\`)}const GR=i=>{let{state:e}=i,t=[];for(let s=0;s{let e=i.state.field(io,false);if(!e||!e.size)return false;let t=[];e.between(0,i.state.doc.length,(s,r)=>{t.push(gh.of({from:s,to:r}))});i.dispatch({effects:t});return true};const JR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:VR},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:YR},{key:"Ctrl-Alt-[",run:GR},{key:"Ctrl-Alt-]",run:KR}];const eA={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};const Mx=te.define({combine(i){return co(i,eA)}});function Bx(i){let e=[io,rA];return e}function Ix(i,e){let{state:t}=i,s=t.facet(Mx);let r=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target));let l=Cd(i.state,a.from,a.to);if(l)i.dispatch({effects:gh.of(l)});o.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(i,r,e);let n=document.createElement("span");n.textContent=s.placeholderText;n.setAttribute("aria-label",t.phrase("folded code"));n.title=t.phrase("unfold");n.className="cm-foldPlaceholder";n.onclick=r;return n}const uv=fe.replace({widget:new class extends uo{toDOM(i){return Ix(i,null)}}});class tA extends uo{constructor(e){super();this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ix(e,this.value)}}const iA={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>false};class wf extends dn{constructor(e,t){super();this.config=e;this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");t.textContent=this.open?this.config.openText:this.config.closedText;t.title=e.state.phrase(this.open?"Fold line":"Unfold line");return t}}function sA(i={}){let e={...iA,...i};let t=new wf(e,true),s=new wf(e,false);let r=Kt.fromClass(class{constructor(o){this.from=o.viewport.from;this.markers=this.buildMarkers(o)}update(o){if(o.docChanged||o.viewportChanged||o.startState.facet(fn)!=o.state.facet(fn)||o.startState.field(io,false)!=o.state.field(io,false)||We(o.startState)!=We(o.state)||e.foldingChanged(o))this.markers=this.buildMarkers(o.view)}buildMarkers(o){let a=new Yn;for(let l of o.viewportLineBlocks){let h=Cd(o.state,l.from,l.to)?s:kd(o.state,l.from,l.to)?t:null;if(h)a.add(l.from,l.from,h)}return a.finish()}});let{domEventHandlers:n}=e;return[r,rR({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||ye.empty},initialSpacer(){return new wf(e,false)},domEventHandlers:{...n,click:(o,a,l)=>{if(n.click&&n.click(o,a,l))return true;let h=Cd(o.state,a.from,a.to);if(h){o.dispatch({effects:gh.of(h)});return true}let c=kd(o.state,a.from,a.to);if(c){o.dispatch({effects:mu.of(c)});return true}return false}}}),Bx()]}const rA=J.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 KO{constructor(e,t){this.specs=e;let s;function r(a){let l=ln.newName();(s||(s=Object.create(null)))["."+l]=a;return l}const n=typeof t.all=="string"?t.all:t.all?r(t.all):void 0;const o=t.scope;this.scope=o instanceof Ei?a=>a.prop(Gr)==o.data:o?a=>a==o:void 0;this.style=Cx(e.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:n}).style;this.module=s?new ln(s):null;this.themeType=t.themeType}static define(e,t){return new KO(e,t||{})}}const Nm=te.define();const Dx=te.define({combine(i){return i.length?[i[0]]:null}});function xf(i){let e=i.facet(Nm);return e.length?e:i.facet(Dx)}function nA(i,e){let t=[aA],s;if(i instanceof KO){if(i.module)t.push(J.styleModule.of(i.module));s=i.themeType}if(e===null||e===void 0?void 0:e.fallback)t.push(Dx.of(i));else if(s)t.push(Nm.computeN([J.darkTheme],r=>{return r.facet(J.darkTheme)==(s=="dark")?[i]:[]}));else t.push(Nm.of(i));return t}class oA{constructor(e){this.markCache=Object.create(null);this.tree=We(e.state);this.decorations=this.buildDeco(e,xf(e.state));this.decoratedTo=e.viewport.to}update(e){let t=We(e.state),s=xf(e.state);let r=s!=xf(e.startState);let{viewport:n}=e.view,o=e.changes.mapPos(this.decoratedTo,1);if(t.length=n.to){this.decorations=this.decorations.map(e.changes);this.decoratedTo=o}else if(t!=this.tree||e.viewportChanged||r){this.tree=t;this.decorations=this.buildDeco(e.view,s);this.decoratedTo=n.to}}buildDeco(e,t){if(!t||!this.tree.length)return fe.none;let s=new Yn;for(let{from:r,to:n}of e.visibleRanges){ER(this.tree,t,(o,a,l)=>{s.add(o,a,this.markCache[l]||(this.markCache[l]=fe.mark({class:l})))},r,n)}return s.finish()}}const aA=ho.high(Kt.fromClass(oA,{decorations:i=>i.decorations}));const lA=J.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});const zx=1e4;const Wx="()[]{}";const qx=te.define({combine(i){return co(i,{afterCursor:true,brackets:Wx,maxScanDistance:zx,renderMatch:dA})}});const hA=fe.mark({class:"cm-matchingBracket"});const cA=fe.mark({class:"cm-nonmatchingBracket"});function dA(i){let e=[];let t=i.matched?hA:cA;e.push(t.range(i.start.from,i.start.to));if(i.end)e.push(t.range(i.end.from,i.end.to));return e}function fv(i){let e=[];let t=i.facet(qx);for(let s of i.selection.ranges){if(!s.empty)continue;let r=Ms(i,s.head,-1,t)||s.head>0&&Ms(i,s.head-1,1,t)||t.afterCursor&&(Ms(i,s.head,1,t)||s.headi.decorations});const fA=[uA,lA];function pA(i={}){return[qx.of(i),fA]}const Xx=new ue;function Fm(i,e,t){let s=i.prop(e<0?ue.openedBy:ue.closedBy);if(s)return s;if(i.name.length==1){let r=t.indexOf(i.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function Zm(i){let e=i.type.prop(Xx);return e?e(i.node):i}function Ms(i,e,t,s={}){let r=s.maxScanDistance||zx,n=s.brackets||Wx;let o=We(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let h=Fm(l.type,t,n);if(h&&l.from0?e>=c.from&&ec.from&&e<=c.to))return mA(i,e,t,l,c,h,n)}}return gA(i,e,t,o,a.type,r,n)}function mA(i,e,t,s,r,n,o){let a=s.parent,l={from:r.from,to:r.to};let h=0,c=a===null||a===void 0?void 0:a.cursor();if(c&&(t<0?c.childBefore(s.from):c.childAfter(s.to)))do{if(t<0?c.to<=s.from:c.from>=s.to){if(h==0&&n.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e};let c=i.doc.iterRange(e,t>0?i.doc.length:0),d=0;for(let u=0;!c.next().done&&u<=n;){let f=c.value;if(t<0)u+=f.length;let p=e+u*t;for(let m=t>0?0:f.length-1,O=t>0?f.length:-1;m!=O;m+=t){let v=o.indexOf(f[m]);if(v<0||s.resolveInner(p+m,1).type!=r)continue;if(v%2==0==t>0){d++}else if(d==1){return{start:h,end:{from:p+m,to:p+m+1},matched:v>>1==l>>1}}else{d--}}if(t>0)u+=f.length}return c.done?{start:h,matched:false}:null}function pv(i,e,t,s=0,r=0){if(e==null){e=i.search(/[^\\s\\u00a0]/);if(e==-1)e=i.length}let n=r;for(let o=s;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;while(/[\\s\\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}}backUp(e){this.pos-=e}column(){if(this.lastColumnPoss?o.toLowerCase():o;let n=this.string.substr(this.pos,e.length);if(r(n)==r(e)){if(t!==false)this.pos+=e.length;return true}else return null}else{let r=this.string.slice(this.pos).match(e);if(r&&r.index>0)return null;if(r&&t!==false)this.pos+=r[0].length;return r}}current(){return this.string.slice(this.start,this.pos)}}function OA(i){return{name:i.name||"",token:i.token,blankLine:i.blankLine||(()=>{}),startState:i.startState||(()=>true),copyState:i.copyState||_A,indent:i.indent||(()=>null),languageData:i.languageData||{},tokenTable:i.tokenTable||e0,mergeTokens:i.mergeTokens!==false}}function _A(i){if(typeof i!="object")return i;let e={};for(let t in i){let s=i[t];e[t]=s instanceof Array?s.slice():s}return e}const mv=new WeakMap;class Xr extends Ei{constructor(e){let t=fu(e.languageData);let s=OA(e),r;let n=new class extends uu{createParse(o,a,l){return new yA(r,o,a,l)}};super(t,n,[],e.name);this.topNode=wA(t,this);r=this;this.streamParser=s;this.stateAfter=new ue({perNode:true});this.tokenTable=e.tokenTable?new jx(s.tokenTable):SA}static define(e){return new Xr(e)}getIndent(e){let t=void 0;let{overrideIndentation:s}=e.options;if(s){t=mv.get(e.state);if(t!=null&&t1e4)return null;while(n=s&&t+e.length<=r&&e.prop(i.stateAfter);if(n)return{state:i.streamParser.copyState(n),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o];let h=a instanceof _e&&l=e.length)return e;if(!r&&t==0&&e.type==i.topNode)r=true;for(let n=e.children.length-1;n>=0;n--){let o=e.positions[n],a=e.children[n],l;if(ot&&JO(i,n.tree,0-n.offset,t,a),h;if(l&&l.pos<=s&&(h=Fx(i,n.tree,t+n.offset,l.pos+n.offset,false)))return{state:l.state,tree:h}}return{state:i.streamParser.startState(r?to(r):4),tree:_e.empty}}let yA=class MU{constructor(e,t,s,r){this.lang=e;this.input=t;this.fragments=s;this.ranges=r;this.stoppedAt=null;this.chunks=[];this.chunkPos=[];this.chunk=[];this.chunkReused=void 0;this.rangeIndex=0;this.to=r[r.length-1].to;let n=eo.get(),o=r[0].from;let{state:a,tree:l}=vA(e,s,o,this.to,n===null||n===void 0?void 0:n.state);this.state=a;this.parsedPos=this.chunkStart=o+l.length;for(let h=0;hh.from<=n.viewport.from&&h.to>=n.viewport.from)){this.state=this.lang.streamParser.startState(to(n.state));n.skipUntilInView(this.parsedPos,n.viewport.from);this.parsedPos=n.viewport.from}this.moveRangeIndex()}advance(){let e=eo.get();let t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt);let s=Math.min(t,this.chunkStart+512);if(e)s=Math.min(s,e.viewport.to);while(this.parsedPos=t)return this.finish();if(e&&this.parsedPos>=e.viewport.to){e.skipUntilInView(this.parsedPos,t);return this.finish()}return null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(!this.input.lineChunks){let s=t.indexOf("\\n");if(s>-1)t=t.slice(0,s)}else if(t=="\\n"){t=""}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),s=e+t.length;for(let r=this.rangeIndex;;){let n=this.ranges[r].to;if(n>=s)break;t=t.slice(0,n-(s-t.length));r++;if(r==this.ranges.length)break;let o=this.ranges[r].from;let a=this.lineAfter(o);t+=a;s=o+a.length}return{line:t,end:s}}skipGapsTo(e,t,s){for(;;){let r=this.ranges[this.rangeIndex].to,n=e+t;if(s>0?r>n:r>=n)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){while(this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1);t+=r;let a=this.chunk.length;r=this.skipGapsTo(s,r,-1);s+=r;n+=this.chunk.length-a}let o=this.chunk.length-4;if(this.lang.streamParser.mergeTokens&&n==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t)this.chunk[o+2]=s;else this.chunk.push(e,t,s,n);return r}parseLine(e){let{line:t,end:s}=this.nextLine(),r=0,{streamParser:n}=this.lang;let o=new Nx(t,e?e.state.tabSize:4,e?to(e.state):2);if(o.eol()){n.blankLine(this.state,o.indentUnit)}else{while(!o.eol()){let a=Zx(n.token,o,this.state);if(a)r=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,r);if(o.start>1e4)break}}this.parsedPos=s;this.moveRangeIndex();if(this.parsedPose.start)return r}throw new Error("Stream parser failed to advance stream.")}const e0=Object.create(null);const Fl=[pt.none];const bA=new ga(Fl);const gv=[];const Ov=Object.create(null);const Ux=Object.create(null);for(let[i,e]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"]])Ux[i]=Hx(e0,e);class jx{constructor(e){this.extra=e;this.table=Object.assign(Object.create(null),Ux)}resolve(e){return!e?0:this.table[e]||(this.table[e]=Hx(this.extra,e))}}const SA=new jx(e0);function kf(i,e){if(gv.indexOf(i)>-1)return;gv.push(i);console.warn(e)}function Hx(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let h of a.split(".")){let c=i[h]||P[h];if(!c){kf(h,\`Unknown highlighting tag \${h}\`)}else if(typeof c=="function"){if(!l.length)kf(h,\`Modifier \${h} used at start of tag\`);else l=l.map(c)}else{if(l.length)kf(h,\`Tag \${h} used as modifier\`);else l=Array.isArray(c)?c:[c]}}for(let h of l)t.push(h)}if(!t.length)return 0;let s=e.replace(/ /g,"_"),r=s+" "+t.map(a=>a.id);let n=Ov[r];if(n)return n.id;let o=Ov[r]=pt.define({id:Fl.length,name:s,props:[Sr({[s]:t})]});Fl.push(o);return o.id}function wA(i,e){let t=pt.define({id:Fl.length,name:"Document",props:[Gr.add(()=>i),wr.add(()=>s=>e.getIndent(s))],top:true});Fl.push(t);return t}({rtl:fe.mark({class:"cm-iso",inclusive:true,attributes:{dir:"rtl"},bidiIsolate:Ue.RTL}),ltr:fe.mark({class:"cm-iso",inclusive:true,attributes:{dir:"ltr"},bidiIsolate:Ue.LTR})});const xA=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),s=i0(i.state,t.from);return s.line?kA(i):s.block?TA(i):false};function t0(i,e){return({state:t,dispatch:s})=>{if(t.readOnly)return false;let r=i(e,t);if(!r)return false;s(t.update(r));return true}}const kA=t0(EA,0);const CA=t0(Vx,0);const TA=t0((i,e)=>Vx(i,e,$A(e)),0);function i0(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ma=50;function PA(i,{open:e,close:t},s,r){let n=i.sliceDoc(s-Ma,s);let o=i.sliceDoc(r,r+Ma);let a=/\\s*$/.exec(n)[0].length,l=/^\\s*/.exec(o)[0].length;let h=n.length-a;if(n.slice(h-e.length,h)==e&&o.slice(l,l+t.length)==t){return{open:{pos:s-a,margin:a&&1},close:{pos:r+l,margin:l&&1}}}let c,d;if(r-s<=2*Ma){c=d=i.sliceDoc(s,r)}else{c=i.sliceDoc(s,s+Ma);d=i.sliceDoc(r-Ma,r)}let u=/^\\s*/.exec(c)[0].length,f=/\\s*$/.exec(d)[0].length;let p=d.length-f-t.length;if(c.slice(u,u+e.length)==e&&d.slice(p,p+t.length)==t){return{open:{pos:s+u+e.length,margin:/\\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-f-t.length,margin:/\\s/.test(d.charAt(p-1))?1:0}}}return null}function $A(i){let e=[];for(let t of i.selection.ranges){let s=i.doc.lineAt(t.from);let r=t.to<=s.to?s:i.doc.lineAt(t.to);if(r.from>s.from&&r.from==t.to)r=t.to==s.to+1?s:i.doc.lineAt(t.to-1);let n=e.length-1;if(n>=0&&e[n].to>s.from)e[n].to=r.to;else e.push({from:s.from+/^\\s*/.exec(s.text)[0].length,to:r.to})}return e}function Vx(i,e,t=e.selection.ranges){let s=t.map(n=>i0(e,n.from).block);if(!s.every(n=>n))return null;let r=t.map((n,o)=>PA(e,s[o],n.from,n.to));if(i!=2&&!r.every(n=>n)){return{changes:e.changes(t.map((n,o)=>{if(r[o])return[];return[{from:n.from,insert:s[o].open+" "},{from:n.to,insert:" "+s[o].close}]}))}}else if(i!=1&&r.some(n=>n)){let n=[];for(let o=0,a;or&&(n==o||o>d.from)){r=d.from;let u=/^\\s*/.exec(d.text)[0].length;let f=u==d.length;let p=d.text.slice(u,u+h.length)==h?u:-1;if(un.comment<0&&(!n.empty||n.single))){let n=[];for(let{line:a,token:l,indent:h,empty:c,single:d}of s)if(d||!c)n.push({from:a.from+h,insert:l+" "});let o=e.changes(n);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&s.some(n=>n.comment>=0)){let n=[];for(let{line:o,comment:a,token:l}of s)if(a>=0){let h=o.from+a,c=h+l.length;if(o.text[c-o.from]==" ")c++;n.push({from:h,to:c})}return{changes:n}}return null}const Um=br.define();const QA=br.define();const RA=te.define();const Yx=te.define({combine(i){return co(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(s,r)=>e(s,r)||t(s,r)})}});const Gx=ji.define({create(){return Bs.empty},update(i,e){let t=e.state.facet(Yx);let s=e.annotation(Um);if(s){let l=_i.fromTransaction(e,s.selection),h=s.side;let c=h==0?i.undone:i.done;if(l)c=Td(c,c.length,t.minDepth,l);else c=ek(c,e.startState.selection);return new Bs(h==0?s.rest:c,h==0?c:s.rest)}let r=e.annotation(QA);if(r=="full"||r=="before")i=i.isolate();if(e.annotation(ut.addToHistory)===false)return!e.changes.empty?i.addMapping(e.changes.desc):i;let n=_i.fromTransaction(e);let o=e.annotation(ut.time),a=e.annotation(ut.userEvent);if(n)i=i.addChanges(n,o,a,t,e);else if(e.selection)i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay);if(r=="full"||r=="after")i=i.isolate();return i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Bs(i.done.map(_i.fromJSON),i.undone.map(_i.fromJSON))}});function AA(i={}){return[Gx,Yx.of(i),J.domEventHandlers({beforeinput(e,t){let s=e.inputType=="historyUndo"?Kx:e.inputType=="historyRedo"?jm:null;if(!s)return false;e.preventDefault();return s(t)}})]}function gu(i,e){return function({state:t,dispatch:s}){if(!e&&t.readOnly)return false;let r=t.field(Gx,false);if(!r)return false;let n=r.pop(i,t,e);if(!n)return false;s(n);return true}}const Kx=gu(0,false);const jm=gu(1,false);const LA=gu(0,true);const MA=gu(1,true);class _i{constructor(e,t,s,r,n){this.changes=e;this.effects=t;this.mapped=s;this.startSelection=r;this.selectionsAfter=n}setSelAfter(e){return new _i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,s;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new _i(e.changes&&_t.fromJSON(e.changes),[],e.mapped&&zs.fromJSON(e.mapped),e.startSelection&&z.fromJSON(e.startSelection),e.selectionsAfter.map(z.fromJSON))}static fromTransaction(e,t){let s=Fi;for(let r of e.startState.facet(RA)){let n=r(e);if(n.length)s=s.concat(n)}if(!s.length&&e.changes.empty)return null;return new _i(e.changes.invert(e.startState.doc),s,void 0,t||e.startState.selection,Fi)}static selection(e){return new _i(void 0,Fi,void 0,void 0,e)}}function Td(i,e,t,s){let r=e+1>t+20?e-t-1:0;let n=i.slice(r,e);n.push(s);return n}function BA(i,e){let t=[],s=false;i.iterChangedRanges((r,n)=>t.push(r,n));e.iterChangedRanges((r,n,o,a)=>{for(let l=0;l=h&&o<=c)s=true}});return s}function IA(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,s)=>t.empty!=e.ranges[s].empty).length===0}function Jx(i,e){return!i.length?e:!e.length?i:i.concat(e)}const Fi=[];const DA=200;function ek(i,e){if(!i.length){return[_i.selection([e])]}else{let t=i[i.length-1];let s=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-DA));if(s.length&&s[s.length-1].eq(e))return i;s.push(e);return Td(i,i.length-1,1e9,t.setSelAfter(s))}}function zA(i){let e=i[i.length-1];let t=i.slice();t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1));return t}function Cf(i,e){if(!i.length)return i;let t=i.length,s=Fi;while(t){let r=WA(i[t-1],e,s);if(r.changes&&!r.changes.empty||r.effects.length){let n=i.slice(0,t);n[t-1]=r;return n}else{e=r.mapped;t--;s=r.selectionsAfter}}return s.length?[_i.selection(s)]:Fi}function WA(i,e,t){let s=Jx(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):Fi,t);if(!i.changes)return _i.selection(s);let r=i.changes.map(e),n=e.mapDesc(i.changes,true);let o=i.mapped?i.mapped.composeDesc(n):n;return new _i(r,Ce.mapEffects(i.effects,e),o,i.startSelection.map(n),s)}const qA=/^(input\\.type|delete)($|\\.)/;class Bs{constructor(e,t,s=0,r=void 0){this.done=e;this.undone=t;this.prevTime=s;this.prevUserEvent=r}isolate(){return this.prevTime?new Bs(this.done,this.undone):this}addChanges(e,t,s,r,n){let o=this.done,a=o[o.length-1];if(a&&a.changes&&!a.changes.empty&&e.changes&&(!s||qA.test(s))&&(!a.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?i.moveByChar(t,e):Ou(t,e))}function Jt(i){return i.textDirectionAt(i.state.selection.main.head)==Ue.LTR}const ik=i=>tk(i,!Jt(i));const sk=i=>tk(i,Jt(i));function rk(i,e){return ls(i,t=>t.empty?i.moveByGroup(t,e):Ou(t,e))}const NA=i=>rk(i,!Jt(i));const FA=i=>rk(i,Jt(i));function ZA(i,e,t){if(e.type.prop(t))return true;let s=e.to-e.from;return s&&(s>2||/[^\\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function _u(i,e,t){let s=We(i).resolveInner(e.head);let r=t?ue.closedBy:ue.openedBy;for(let l=e.head;;){let h=t?s.childAfter(l):s.childBefore(l);if(!h)break;if(ZA(i,h,r))s=h;else l=t?h.to:h.from}let n=s.type.prop(r),o,a;if(n&&(o=t?Ms(i,s.from,1):Ms(i,s.to,-1))&&o.matched)a=t?o.end.to:o.end.from;else a=t?s.to:s.from;return z.cursor(a,t?-1:1)}const UA=i=>ls(i,e=>_u(i.state,e,!Jt(i)));const jA=i=>ls(i,e=>_u(i.state,e,Jt(i)));function nk(i,e){return ls(i,t=>{if(!t.empty)return Ou(t,e);let s=i.moveVertically(t,e);return s.head!=t.head?s:i.moveToLineBoundary(t,e)})}const ok=i=>nk(i,false);const ak=i=>nk(i,true);function lk(i){let e=i.scrollDOM.clientHeight{return o.empty?i.moveVertically(o,e,t.height):Ou(o,e)});if(r.eq(s.selection))return false;let n;if(t.selfScroll){let o=i.coordsAtPos(s.selection.main.head);let a=i.scrollDOM.getBoundingClientRect();let l=a.top+t.marginTop,h=a.bottom-t.marginBottom;if(o&&o.top>l&&o.bottomhk(i,false);const Hm=i=>hk(i,true);function _n(i,e,t){let s=i.lineBlockAt(e.head),r=i.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?s.to:s.from))r=i.moveToLineBoundary(e,t,false);if(!t&&r.head==s.from&&s.length){let n=/^\\s*/.exec(i.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;if(n&&e.head!=s.from+n)r=z.cursor(s.from+n)}return r}const HA=i=>ls(i,e=>_n(i,e,true));const VA=i=>ls(i,e=>_n(i,e,false));const YA=i=>ls(i,e=>_n(i,e,!Jt(i)));const GA=i=>ls(i,e=>_n(i,e,Jt(i)));const KA=i=>ls(i,e=>z.cursor(i.lineBlockAt(e.head).from,1));const JA=i=>ls(i,e=>z.cursor(i.lineBlockAt(e.head).to,-1));function e8(i,e,t){let s=false,r=Oa(i.selection,n=>{let o=Ms(i,n.head,-1)||Ms(i,n.head,1)||n.head>0&&Ms(i,n.head-1,1)||n.heade8(i,e);function Hi(i,e,t){let s=Oa(i.state.selection,r=>{if(r.undirectional&&r.head>=r.anchor!=e)r=z.range(r.head,r.anchor);let n=t(r);return z.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});if(s.eq(i.state.selection))return false;i.dispatch(as(i.state,s));return true}function ck(i,e){return Hi(i,e,t=>i.moveByChar(t,e))}const dk=i=>ck(i,!Jt(i));const uk=i=>ck(i,Jt(i));function fk(i,e){return Hi(i,e,t=>i.moveByGroup(t,e))}const i8=i=>fk(i,!Jt(i));const s8=i=>fk(i,Jt(i));const r8=i=>{let e=!Jt(i);return Hi(i,e,t=>_u(i.state,t,e))};const n8=i=>{let e=Jt(i);return Hi(i,e,t=>_u(i.state,t,e))};function pk(i,e){return Hi(i,e,t=>i.moveVertically(t,e))}const mk=i=>pk(i,false);const gk=i=>pk(i,true);function Ok(i,e){return Hi(i,e,t=>i.moveVertically(t,e,lk(i).height))}const vv=i=>Ok(i,false);const yv=i=>Ok(i,true);const o8=i=>Hi(i,true,e=>_n(i,e,true));const a8=i=>Hi(i,false,e=>_n(i,e,false));const l8=i=>{let e=!Jt(i);return Hi(i,e,t=>_n(i,t,e))};const h8=i=>{let e=Jt(i);return Hi(i,e,t=>_n(i,t,e))};const c8=i=>Hi(i,false,e=>z.cursor(i.lineBlockAt(e.head).from));const d8=i=>Hi(i,true,e=>z.cursor(i.lineBlockAt(e.head).to));const bv=({state:i,dispatch:e})=>{e(as(i,{anchor:0}));return true};const Sv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.doc.length}));return true};const wv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.selection.main.anchor,head:0}));return true};const xv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.selection.main.anchor,head:i.doc.length}));return true};const u8=({state:i,dispatch:e})=>{e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"}));return true};const f8=({state:i,dispatch:e})=>{let t=vu(i).map(({from:s,to:r})=>z.undirectionalRange(s,Math.min(r+1,i.doc.length)));e(i.update({selection:z.create(t),userEvent:"select"}));return true};const p8=({state:i,dispatch:e})=>{let t=Oa(i.selection,s=>{let r=We(i),n=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.from,-1);if(o.node.from>=n.node.from&&o.node.to<=n.node.to)n=o}for(let o=n;o;o=o.next){let{node:a}=o;if((a.from=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return z.undirectionalRange(a.from,a.to)}return s});if(t.eq(i.selection))return false;e(as(i,t));return true};function _k(i,e){let{state:t}=i,s=t.selection,r=t.selection.ranges.slice();for(let n of t.selection.ranges){let o=t.doc.lineAt(n.head);if(e?o.to0)for(let a=n;;){let l=i.moveVertically(a,e);if(l.heado.to){if(!r.some(h=>h.head==l.head))r.push(l);break}else if(l.head==a.head){break}else{a=l}}}if(r.length==s.ranges.length)return false;i.dispatch(as(t,z.create(r,r.length-1)));return true}const m8=i=>_k(i,false);const g8=i=>_k(i,true);const O8=({state:i,dispatch:e})=>{let t=i.selection,s=null;if(t.ranges.length>1)s=z.create([t.main]);else if(!t.main.empty)s=z.create([z.cursor(t.main.head)]);if(!s)return false;e(as(i,s));return true};function Oh(i,e){if(i.state.readOnly)return false;let t="delete.selection",{state:s}=i;let r=s.changeByRange(n=>{let{from:o,to:a}=n;if(o==a){let l=e(n);if(lo){t="delete.forward";l=ic(i,l,true)}o=Math.min(o,l);a=Math.max(a,l)}else{o=ic(i,o,false);a=ic(i,a,true)}return o==a?{range:n}:{changes:{from:o,to:a},range:z.cursor(o,or(i)))s.between(e,e,(r,n)=>{if(re)e=t?n:r});return e}const vk=(i,e,t)=>Oh(i,s=>{let r=s.from,{state:n}=i,o=n.doc.lineAt(r),a,l;if(t&&!e&&r>o.from&&rvk(i,false,true);const yk=i=>vk(i,true,false);const bk=(i,e)=>Oh(i,t=>{let s=t.head,{state:r}=i,n=r.doc.lineAt(s);let o=r.charCategorizer(s);for(let a=null;;){if(s==(e?n.to:n.from)){if(s==t.head&&n.number!=(e?r.doc.lines:1))s+=e?1:-1;break}let l=Rt(n.text,s-n.from,e)+n.from;let h=n.text.slice(Math.min(s,l)-n.from,Math.max(s,l)-n.from);let c=o(h);if(a!=null&&c!=a)break;if(h!=" "||s!=t.head)a=c;s=l}return s});const Sk=i=>bk(i,false);const _8=i=>bk(i,true);const v8=i=>Oh(i,e=>{let t=i.lineBlockAt(e.head).to;return e.headOh(i,e=>{let t=i.moveToLineBoundary(e,false).head;return e.head>t?t:Math.max(0,e.head-1)});const b8=i=>Oh(i,e=>{let t=i.moveToLineBoundary(e,true).head;return e.head{if(i.readOnly)return false;let t=i.changeByRange(s=>{return{changes:{from:s.from,to:s.to,insert:Pe.of(["",""])},range:z.cursor(s.from)}});e(i.update(t,{scrollIntoView:true,userEvent:"input"}));return true};const w8=({state:i,dispatch:e})=>{if(i.readOnly)return false;let t=i.changeByRange(s=>{if(!s.empty||s.from==0||s.from==i.doc.length)return{range:s};let r=s.from,n=i.doc.lineAt(r);let o=r==n.from?r-1:Rt(n.text,r-n.from,false)+n.from;let a=r==n.to?r+1:Rt(n.text,r-n.from,true)+n.from;return{changes:{from:o,to:a,insert:i.doc.slice(r,a).append(i.doc.slice(o,r))},range:z.cursor(a)}});if(t.changes.empty)return false;e(i.update(t,{scrollIntoView:true,userEvent:"move.character"}));return true};function vu(i){let e=[],t=-1;for(let s of i.selection.ranges){let r=i.doc.lineAt(s.from),n=i.doc.lineAt(s.to);if(!s.empty&&s.to==n.from)n=i.doc.lineAt(s.to-1);if(t>=r.number){let o=e[e.length-1];o.to=n.to;o.ranges.push(s)}else{e.push({from:r.from,to:n.to,ranges:[s]})}t=n.number+1}return e}function wk(i,e,t){if(i.readOnly)return false;let s=[],r=[];for(let n of vu(i)){if(t?n.to==i.doc.length:n.from==0)continue;let o=i.doc.lineAt(t?n.to+1:n.from-1);let a=o.length+1;if(t){s.push({from:n.to,to:o.to},{from:n.from,insert:o.text+i.lineBreak});for(let l of n.ranges)r.push(z.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{s.push({from:o.from,to:n.from},{from:n.to,insert:i.lineBreak+o.text});for(let l of n.ranges)r.push(z.range(l.anchor-a,l.head-a))}}if(!s.length)return false;e(i.update({changes:s,scrollIntoView:true,selection:z.create(r,i.selection.mainIndex),userEvent:"move.line"}));return true}const x8=({state:i,dispatch:e})=>wk(i,e,false);const k8=({state:i,dispatch:e})=>wk(i,e,true);function xk(i,e,t){if(i.readOnly)return false;let s=[];for(let n of vu(i)){if(t)s.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak});else s.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)})}let r=i.changes(s);e(i.update({changes:r,selection:i.selection.map(r,t?1:-1),scrollIntoView:true,userEvent:"input.copyline"}));return true}const C8=({state:i,dispatch:e})=>xk(i,e,false);const T8=({state:i,dispatch:e})=>xk(i,e,true);const P8=i=>{if(i.state.readOnly)return false;let{state:e}=i,t=e.changes(vu(e).map(({from:r,to:n})=>{if(r>0)r--;else if(n{let n=void 0;if(i.lineWrapping){let o=i.lineBlockAt(r.head),a=i.coordsAtPos(r.head,r.assoc||1);if(a)n=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2}return i.moveVertically(r,true,n)}).map(t);i.dispatch({changes:t,selection:s,scrollIntoView:true,userEvent:"delete.line"});return true};function $8(i,e){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=We(i).resolveInner(e);let s=t.childBefore(e),r=t.childAfter(e),n;if(s&&r&&s.to<=e&&r.from>=e&&(n=s.type.prop(ue.closedBy))&&n.indexOf(r.name)>-1&&i.doc.lineAt(s.to).from==i.doc.lineAt(r.from).from&&!/\\S/.test(i.sliceDoc(s.to,r.from)))return{from:s.to,to:r.from};return null}const kv=kk(false);const E8=kk(true);function kk(i){return({state:e,dispatch:t})=>{if(e.readOnly)return false;let s=e.changeByRange(r=>{let{from:n,to:o}=r,a=e.doc.lineAt(n);let l=!i&&n==o&&$8(e,n);if(i)n=o=(o<=a.to?a:e.doc.lineAt(o)).to;let h=new pu(e,{simulateBreak:n,simulateDoubleBreak:!!l});let c=YO(h,n);if(c==null)c=Fs(/^\\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize);while(oa.from&&n{let r=[];for(let o=s.from;o<=s.to;){let a=i.doc.lineAt(o);if(a.number>t&&(s.empty||s.to>a.from)){e(a,r,s);t=a.number}o=a.to+1}let n=i.changes(r);return{changes:r,range:z.range(n.mapPos(s.anchor,1),n.mapPos(s.head,1))}})}const Q8=({state:i,dispatch:e})=>{if(i.readOnly)return false;let t=Object.create(null);let s=new pu(i,{overrideIndentation:n=>{let o=t[n];return o==null?-1:o}});let r=s0(i,(n,o,a)=>{let l=YO(s,n.from);if(l==null)return;if(!/\\S/.test(n.text))l=0;let h=/^\\s*/.exec(n.text)[0];let c=Nl(i,l);if(h!=c||a.from{if(i.readOnly)return false;e(i.update(s0(i,(t,s)=>{s.push({from:t.from,insert:i.facet(ph)})}),{userEvent:"input.indent"}));return true};const Tk=({state:i,dispatch:e})=>{if(i.readOnly)return false;e(i.update(s0(i,(t,s)=>{let r=/^\\s*/.exec(t.text)[0];if(!r)return;let n=Fs(r,i.tabSize),o=0;let a=Nl(i,Math.max(0,n-to(i)));while(o{i.setTabFocusMode();return true};const A8=[{key:"Ctrl-b",run:ik,shift:dk,preventDefault:true},{key:"Ctrl-f",run:sk,shift:uk},{key:"Ctrl-p",run:ok,shift:mk},{key:"Ctrl-n",run:ak,shift:gk},{key:"Ctrl-a",run:KA,shift:c8},{key:"Ctrl-e",run:JA,shift:d8},{key:"Ctrl-d",run:yk},{key:"Ctrl-h",run:Vm},{key:"Ctrl-k",run:v8},{key:"Ctrl-Alt-h",run:Sk},{key:"Ctrl-o",run:S8},{key:"Ctrl-t",run:w8},{key:"Ctrl-v",run:Hm}];const L8=[{key:"ArrowLeft",run:ik,shift:dk,preventDefault:true},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:NA,shift:i8,preventDefault:true},{mac:"Cmd-ArrowLeft",run:YA,shift:l8,preventDefault:true},{key:"ArrowRight",run:sk,shift:uk,preventDefault:true},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:FA,shift:s8,preventDefault:true},{mac:"Cmd-ArrowRight",run:GA,shift:h8,preventDefault:true},{key:"ArrowUp",run:ok,shift:mk,preventDefault:true},{mac:"Cmd-ArrowUp",run:bv,shift:wv},{mac:"Ctrl-ArrowUp",run:_v,shift:vv},{key:"ArrowDown",run:ak,shift:gk,preventDefault:true},{mac:"Cmd-ArrowDown",run:Sv,shift:xv},{mac:"Ctrl-ArrowDown",run:Hm,shift:yv},{key:"PageUp",run:_v,shift:vv},{key:"PageDown",run:Hm,shift:yv},{key:"Home",run:VA,shift:a8,preventDefault:true},{key:"Mod-Home",run:bv,shift:wv},{key:"End",run:HA,shift:o8,preventDefault:true},{key:"Mod-End",run:Sv,shift:xv},{key:"Enter",run:kv,shift:kv},{key:"Mod-a",run:u8},{key:"Backspace",run:Vm,shift:Vm,preventDefault:true},{key:"Delete",run:yk,preventDefault:true},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sk,preventDefault:true},{key:"Mod-Delete",mac:"Alt-Delete",run:_8,preventDefault:true},{mac:"Mod-Backspace",run:y8,preventDefault:true},{mac:"Mod-Delete",run:b8,preventDefault:true}].concat(A8.map(i=>({mac:i.key,run:i.run,shift:i.shift})));const M8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:UA,shift:r8},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:jA,shift:n8},{key:"Alt-ArrowUp",run:x8},{key:"Shift-Alt-ArrowUp",run:C8},{key:"Alt-ArrowDown",run:k8},{key:"Shift-Alt-ArrowDown",run:T8},{key:"Mod-Alt-ArrowUp",run:m8},{key:"Mod-Alt-ArrowDown",run:g8},{key:"Escape",run:O8},{key:"Mod-Enter",run:E8},{key:"Alt-l",mac:"Ctrl-l",run:f8},{key:"Mod-i",run:p8,preventDefault:true},{key:"Mod-[",run:Tk},{key:"Mod-]",run:Ck},{key:"Mod-Alt-\\\\",run:Q8},{key:"Shift-Mod-k",run:P8},{key:"Shift-Mod-\\\\",run:t8},{key:"Mod-/",run:xA},{key:"Alt-A",mac:"Ctrl-A",run:CA},{key:"Ctrl-m",mac:"Shift-Alt-m",run:R8}].concat(L8);const B8={key:"Tab",run:Ck,shift:Tk};var Cv={};class Pd{constructor(e,t,s,r,n,o,a,l,h,c=0,d){this.p=e;this.stack=t;this.state=s;this.reducePos=r;this.pos=n;this.score=o;this.buffer=a;this.bufferBase=l;this.curContext=h;this.lookAhead=c;this.parent=d}toString(){return\`[\${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@\${this.pos}\${this.score?"!"+this.score:""}\`}static start(e,t,s=0){let r=e.parser.context;return new Pd(e,[],t,s,s,0,[],0,r?new Tv(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length);this.state=e}reduce(e){var t;let s=e>>19,r=e&65535;let{parser:n}=this.p;let o=this.reducePos=2e3&&!((t=this.p.parser.nodeSet.types[r])===null||t===void 0?void 0:t.isAnonymous)){if(h==this.p.lastBigReductionStart){this.p.bigReductionCount++;this.p.lastBigReductionSize=c}else if(this.p.lastBigReductionSizel)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,s,r=4,n=false){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==s)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=s;return}}}if(!n||this.pos==s){this.buffer.push(e,t,s,r)}else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=false;for(let l=o;l>0&&this.buffer[l-2]>s;l-=4){if(this.buffer[l-1]>=0){a=true;break}}if(a)while(o>0&&this.buffer[o-2]>s){this.buffer[o]=this.buffer[o-4];this.buffer[o+1]=this.buffer[o-3];this.buffer[o+2]=this.buffer[o-2];this.buffer[o+3]=this.buffer[o-1];o-=4;if(r>4)r-=4}}this.buffer[o]=e;this.buffer[o+1]=t;this.buffer[o+2]=s;this.buffer[o+3]=r}}shift(e,t,s,r){if(e&131072){this.pushState(e&65535,this.pos)}else if((e&262144)==0){let n=e,{parser:o}=this.p;this.pos=r;let a=o.stateFlag(n,1);if(!a&&(r>s||t<=o.maxNode))this.reducePos=r;this.pushState(n,a?s:Math.min(s,this.reducePos));this.shiftContext(t,s);if(t<=o.maxNode)this.buffer.push(t,s,r,4)}else{this.pos=r;this.shiftContext(t,s);if(t<=this.p.parser.maxNode)this.buffer.push(t,s,r,4)}}apply(e,t,s,r){if(e&65536)this.reduce(e);else this.shift(e,t,s,r)}useNode(e,t){let s=this.p.reused.length-1;if(s<0||this.p.reused[s]!=e){this.p.reused.push(e);s++}let r=this.pos;this.reducePos=this.pos=r+e.length;this.pushState(t,r);this.buffer.push(s,r,this.reducePos,-1);if(this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this;let t=e.buffer.length;if(t&&e.buffer[t-4]==0)t-=4;while(t>0&&e.buffer[t-2]>e.reducePos)t-=4;let s=e.buffer.slice(t),r=e.bufferBase+t;while(e&&r==e.bufferBase)e=e.parent;return new Pd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let s=e<=this.p.parser.maxNode;if(s)this.storeNode(e,this.pos,t,4);this.storeNode(0,this.pos,t,s?8:4);this.pos=this.reducePos=t;this.score-=190}canShift(e){for(let t=new I8(this);;){let s=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(s==0)return false;if((s&65536)==0)return true;t.reduce(s)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let r=[];for(let n=0,o;nl&1&&a==o))r.push(t[n],o)}t=r}let s=[];for(let r=0;r>19,r=t&65535;let n=this.stack.length-s*3;if(n<0||e.getGoto(this.stack[n],r,false)<0){let o=this.findForcedReduction();if(o==null)return false;t=o}this.storeNode(0,this.pos,this.pos,4,true);this.score-=100}this.reducePos=this.pos;this.reduce(t);return true}findForcedReduction(){let{parser:e}=this.p,t=[];let s=(r,n)=>{if(t.includes(r))return;t.push(r);return e.allActions(r,o=>{if(o&(262144|131072));else if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&e.getGoto(this.stack[h],l,false)>=0)return a<<19|65536|l}}else{let a=s(o,n+1);if(a!=null)return a}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2)){if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,true);break}}return this}get deadEnd(){if(this.stack.length!=3)return false;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,true);this.state=this.stack[0];this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return false;for(let t=0;t0)this.emitLookAhead()}}class Tv{constructor(e,t){this.tracker=e;this.context=t;this.hash=e.strict?e.hash(t):0}}class I8{constructor(e){this.start=e;this.state=e.state;this.stack=e.stack;this.base=this.stack.length}reduce(e){let t=e&65535,s=e>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0);this.base+=3}else{this.base-=(s-1)*3}let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,true);this.state=r}}class $d{constructor(e,t,s){this.stack=e;this.pos=t;this.index=s;this.buffer=e.buffer;if(this.index==0)this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new $d(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;if(e!=null){this.index=this.stack.bufferBase-e.bufferBase;this.stack=e;this.buffer=e.buffer}}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4;this.pos-=4;if(this.index==0)this.maybeNext()}fork(){return new $d(this.stack,this.pos,this.index)}}function sl(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let s=0,r=0;s=92)o--;if(o>=34)o--;let l=o-32;if(l>=46){l-=46;a=true}n+=l;if(a)break;n*=46}if(t)t[r++]=n;else t=new e(n)}return t}class Bc{constructor(){this.start=-1;this.value=-1;this.end=-1;this.extended=-1;this.lookAhead=0;this.mask=0;this.context=0}}const Pv=new Bc;class D8{constructor(e,t){this.input=e;this.ranges=t;this.chunk="";this.chunkOff=0;this.chunk2="";this.chunk2Pos=0;this.next=-1;this.token=Pv;this.rangeIndex=0;this.pos=this.chunkPos=t[0].from;this.range=t[0];this.end=t[t.length-1].to;this.readNext()}resolveOffset(e,t){let s=this.range,r=this.rangeIndex;let n=this.pos+e;while(ns.to:n>=s.to){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];n+=o.from-s.to;s=o}return n}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,s,r;if(t>=0&&t=this.chunk2Pos&&sa.to)this.chunk2=this.chunk2.slice(0,a.to-s);r=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return r}acceptToken(e,t=0){let s=t?this.resolveOffset(t,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e;this.chunkPos=this.pos;this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){this.getChunk();if(this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){this.chunkOff+=e;while(this.pos+e>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos;this.range=this.ranges[++this.rangeIndex];this.pos=this.range.from}this.pos+=e;if(this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){this.pos=this.chunkPos=this.end;this.range=this.ranges[this.rangeIndex=this.ranges.length-1];this.chunk="";return this.next=-1}reset(e,t){if(t){this.token=t;t.start=e;t.lookAhead=e+1;t.value=t.extended=-1}else{this.token=Pv}if(this.pos!=e){this.pos=e;if(e==this.end){this.setDone();return this}while(e=this.range.to)this.range=this.ranges[++this.rangeIndex];if(e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let s="";for(let r of this.ranges){if(r.from>=t)break;if(r.to>e)s+=this.input.read(Math.max(r.from,e),Math.min(r.to,t))}return s}}class Yo{constructor(e,t){this.data=e;this.id=t}token(e,t){let{parser:s}=t.p;Pk(this.data,e,t,this.id,s.data,s.tokenPrecTable)}}Yo.prototype.contextual=Yo.prototype.fallback=Yo.prototype.extend=false;class Ed{constructor(e,t,s){this.precTable=t;this.elseToken=s;this.data=typeof e=="string"?sl(e):e}token(e,t){let s=e.pos,r=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);Pk(this.data,e,t,0,this.data,this.precTable);if(e.token.value>-1)break;if(this.elseToken==null)return;if(!n)r++;if(o==null)break;e.reset(o,e.token)}if(r){e.reset(s,e.token);e.acceptToken(this.elseToken,r)}}}Ed.prototype.contextual=Yo.prototype.fallback=Yo.prototype.extend=false;class at{constructor(e,t={}){this.token=e;this.contextual=!!t.contextual;this.fallback=!!t.fallback;this.extend=!!t.extend}}function Pk(i,e,t,s,r,n){let o=0,a=1<0){let p=i[f];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||z8(p,e.token.value,r,n))){e.acceptToken(p);break}}let c=e.next,d=0,u=i[o+2];if(e.next<0&&u>d&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue e}for(;d>1;let p=h+f+(f<<1);let m=i[p],O=i[p+1]||65536;if(c=O)d=f+1;else{o=i[p+2];e.advance();continue e}}break}}function $v(i,e,t){for(let s=e,r;(r=i[s])!=65535;s++)if(r==t)return s-e;return-1}function z8(i,e,t,s){let r=$v(t,s,e);return r<0||$v(t,s,i)e)&&!s.type.isError)return t<0?Math.max(0,Math.min(s.to-1,e-25)):Math.min(i.length,Math.max(s.from+1,e+25));if(t<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return t<0?0:i.length}}}let W8=class BU{constructor(e,t){this.fragments=e;this.nodeSet=t;this.i=0;this.fragment=null;this.safeFrom=-1;this.safeTo=-1;this.trees=[];this.start=[];this.index=[];this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){this.safeFrom=e.openStart?Ev(e.tree,e.from+e.offset,1)-e.offset:e.from;this.safeTo=e.openEnd?Ev(e.tree,e.to+e.offset,-1)-e.offset:e.to;while(this.trees.length){this.trees.pop();this.start.pop();this.index.pop()}this.trees.push(e.tree);this.start.push(-e.offset);this.index.push(0);this.nextStart=this.safeFrom}else{this.nextStart=1e9}}nodeAt(e){if(ee){this.nextStart=o;return null}if(n instanceof _e){if(o==e){if(o=Math.max(this.safeFrom,e)){this.trees.push(n);this.start.push(o);this.index.push(0)}}else{this.index[t]++;this.nextStart=o+n.length}}}};class q8{constructor(e,t){this.stream=t;this.tokens=[];this.mainToken=null;this.actions=[];this.tokens=e.tokenizers.map(s=>new Bc)}getActions(e){let t=0;let s=null;let{parser:r}=e.p,{tokenizers:n}=r;let o=r.stateSlot(e.state,3);let a=e.curContext?e.curContext.hash:0;let l=0;for(let h=0;hd.end+25)l=Math.max(d.lookAhead,l);if(d.value!=0){let u=t;if(d.extended>-1)t=this.addActions(e,d.extended,d.end,t);t=this.addActions(e,d.value,d.end,t);if(!c.extend){s=d;if(t>u)break}}}while(this.actions.length>t)this.actions.pop();if(l)e.setLookAhead(l);if(!s&&e.pos==this.stream.end){s=new Bc;s.value=e.p.parser.eofTerm;s.start=s.end=e.pos;t=this.addActions(e,s.value,s.end,t)}this.mainToken=s;return this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Bc,{pos:s,p:r}=e;t.start=s;t.end=Math.min(s+1,r.stream.end);t.value=s==r.stream.end?r.parser.eofTerm:0;return t}updateCachedToken(e,t,s){let r=this.stream.clipPos(s.pos);t.token(this.stream.reset(r,e),s);if(e.value>-1){let{parser:n}=s.p;for(let o=0;o=0&&s.p.parser.dialect.allows(a>>1)){if((a&1)==0)e.value=a>>1;else e.extended=a>>1;break}}}else{e.value=0;e.end=this.stream.clipPos(r+1)}}putAction(e,t,s,r){for(let n=0;ne.bufferLength*4?new W8(s,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos;let s=this.stacks=[];let r,n;if(this.bigReductionCount>300&&e.length==1){let[o]=e;while(o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart){}this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot){s.push(a)}else if(this.advanceStack(a,s,e)){continue}else{if(!r){r=[];n=[]}r.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}break}}if(!s.length){let o=r&&F8(r);if(o){if(yi)console.log("Finish with "+this.stackID(o));return this.stackToTree(o)}if(this.parser.strict){if(yi&&r)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw new SyntaxError("No parse at "+t)}if(!this.recovering)this.recovering=5}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,s);if(o){if(yi)console.log("Force-finish "+this.stackID(o));return this.stackToTree(o.forceAll())}}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(s.length>o){s.sort((a,l)=>l.score-a.score);while(s.length>o)s.pop()}if(s.some(a=>a.reducePos>t))this.recovering--}else if(s.length>1){e:for(let o=0;o500&&h.buffer.length>500){if((a.score-h.score||a.buffer.length-h.buffer.length)>0){s.splice(l--,1)}else{s.splice(o--,1);continue e}}}}if(s.length>12){s.sort((o,a)=>a.score-o.score);s.splice(12,s.length-12)}}this.minStackPos=s[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let u=this.parser.nodeSet.types[d.type.id]==d.type?n.getGoto(e.state,d.type.id):-1;if(u>-1&&d.length&&(!h||(d.prop(ue.contextHash)||0)==c)){e.useNode(d,u);if(yi)console.log(o+this.stackID(e)+\` (via reuse of \${n.getName(d.type.id)})\`);return true}if(!(d instanceof _e)||d.children.length==0||d.positions[0]>0)break;let f=d.children[0];if(f instanceof _e&&d.positions[0]==0)d=f;else break}}let a=n.stateSlot(e.state,4);if(a>0){e.reduce(a);if(yi)console.log(o+this.stackID(e)+\` (via always-reduce \${n.getName(a&65535)})\`);return true}if(e.stack.length>=8400){while(e.stack.length>6e3&&e.forceReduce()){}}let l=this.tokens.getActions(e);for(let h=0;hr)t.push(p);else s.push(p)}return false}advanceFully(e,t){let s=e.pos;for(;;){if(!this.advanceStack(e,null,null))return false;if(e.pos>s){Qv(e,t);return true}}}runRecovery(e,t,s){let r=null,n=false;for(let o=0;o ":"";if(a.deadEnd){if(n)continue;n=true;a.restart();if(yi)console.log(c+this.stackID(a)+" (restarted)");let f=this.advanceFully(a,s);if(f)continue}let d=a.split(),u=c;for(let f=0;f<10&&d.forceReduce();f++){if(yi)console.log(u+this.stackID(d)+" (via force-reduce)");let p=this.advanceFully(d,s);if(p)break;if(yi)u=this.stackID(d)+" -> "}for(let f of a.recoverByInsert(l)){if(yi)console.log(c+this.stackID(f)+" (via recover-insert)");this.advanceFully(f,s)}if(this.stream.end>a.pos){if(h==a.pos){h++;l=0}a.recoverByDelete(l,h);if(yi)console.log(c+this.stackID(a)+\` (via recover-delete \${this.parser.getName(l)})\`);Qv(a,s)}else if(!r||r.scorei;class yu{constructor(e){this.start=e.start;this.shift=e.shift||Pf;this.reduce=e.reduce||Pf;this.reuse=e.reuse||Pf;this.hash=e.hash||(()=>0);this.strict=e.strict!==false}}class vr extends uu{constructor(e){super();this.wrappers=[];if(e.version!=14)throw new RangeError(\`Parser version (\${e.version}) doesn't match runtime version (\${14})\`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;ae.topRules[a][1]);let r=[];for(let a=0;a=0){n(c,l,a[h++])}else{let d=a[h+-c];for(let u=-c;u>0;u--)n(a[h++],l,d);h++}}}this.nodeSet=new ga(t.map((a,l)=>pt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:s.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1})));if(e.propSources)this.nodeSet=this.nodeSet.extend(...e.propSources);this.strict=false;this.bufferLength=yx;let o=sl(e.tokenData);this.context=e.context;this.specializerSpecs=e.specialized||[];this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new Yo(o,a):a);this.topRules=e.topRules;this.dialects=e.dialects||{};this.dynamicPrecedences=e.dynamicPrecedences||null;this.tokenPrecTable=e.tokenPrec;this.termNames=e.termNames||null;this.maxNode=this.nodeSet.types.length-1;this.dialect=this.parseDialect();this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,s){let r=new X8(this,e,t,s);for(let n of this.wrappers)r=n(r,e,t,s);return r}getGoto(e,t,s=false){let r=this.goto;if(t>=r[0])return-1;for(let n=r[t+1];;){let o=r[n++],a=o&1;let l=r[n++];if(a&&s)return l;for(let h=n+(o>>1);n0}validAction(e,t){return!!this.allActions(e,s=>s==t?true:null)}allActions(e,t){let s=this.stateSlot(e,4);let r=s?t(s):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=hr(this.data,n+2);else break}r=t(hr(this.data,n+1))}return r}nextStates(e){let t=[];for(let s=this.stateSlot(e,1);;s+=3){if(this.data[s]==65535){if(this.data[s+1]==1)s=hr(this.data,s+2);else break}if((this.data[s+2]&65536>>16)==0){let r=this.data[s+1];if(!t.some((n,o)=>o&1&&n==r))t.push(this.data[s],r)}}return t}configure(e){let t=Object.assign(Object.create(vr.prototype),this);if(e.props)t.nodeSet=this.nodeSet.extend(...e.props);if(e.top){let s=this.topRules[e.top];if(!s)throw new RangeError(\`Invalid top rule name \${e.top}\`);t.top=s}if(e.tokenizers)t.tokenizers=this.tokenizers.map(s=>{let r=e.tokenizers.find(n=>n.from==s);return r?r.to:s});if(e.specializers){t.specializers=this.specializers.slice();t.specializerSpecs=this.specializerSpecs.map((s,r)=>{let n=e.specializers.find(a=>a.from==s.external);if(!n)return s;let o=Object.assign(Object.assign({},s),{external:n.to});t.specializers[r]=Rv(o);return o})}if(e.contextTracker)t.context=e.contextTracker;if(e.dialect)t.dialect=this.parseDialect(e.dialect);if(e.strict!=null)t.strict=e.strict;if(e.wrap)t.wrappers=t.wrappers.concat(e.wrap);if(e.bufferLength!=null)t.bufferLength=e.bufferLength;return t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),s=t.map(()=>false);if(e)for(let n of e.split(" ")){let o=t.indexOf(n);if(o>=0)s[o]=true}let r=null;for(let n=0;ns)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,s)<<1|e}return i.get}const Z8=148;const Av=1;const U8=149;const j8=150;const $k=2;const H8=151;const V8=3;const Y8=4;const Ek=[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];const G8=58;const K8=40;const Qk=95;const J8=91;const Ic=45;const e7=46;const t7=35;const i7=37;const s7=38;const r7=92;const n7=10;const o7=42;function Zl(i){return i>=65&&i<=90||i>=97&&i<=122||i>=161}function r0(i){return i>=48&&i<=57}function Lv(i){return r0(i)||i>=97&&i<=102||i>=65&&i<=70}const Rk=(i,e,t)=>(s,r)=>{for(let n=false,o=0,a=0;;a++){let{next:l}=s;if(Zl(l)||l==Ic||l==Qk||n&&r0(l)){if(!n&&(l!=Ic||a>0))n=true;if(o===a&&l==Ic)o++;s.advance()}else if(l==r7&&s.peek(1)!=n7){s.advance();if(Lv(s.next)){do{s.advance()}while(Lv(s.next));if(s.next==32)s.advance()}else if(s.next>-1){s.advance()}n=true}else{if(n)s.acceptToken(o==2&&r.canShift($k)?e:l==K8?t:i);break}}};const a7=new at(Rk(U8,$k,j8),{contextual:true});const l7=new at(Rk(H8,V8,Y8),{contextual:true});const h7=new at(i=>{if(Ek.includes(i.peek(-1))){let{next:e}=i;if(Zl(e)||e==Qk||e==t7||e==e7||e==o7||e==J8||e==G8&&Zl(i.peek(1))||e==Ic||e==s7)i.acceptToken(Z8)}});const c7=new at(i=>{if(!Ek.includes(i.peek(-1))){let{next:e}=i;if(e==i7){i.advance();i.acceptToken(Av)}if(Zl(e)){do{i.advance()}while(Zl(i.next)||r0(i.next));i.acceptToken(Av)}}});const d7=Sr({"AtKeyword import charset namespace keyframes media supports font-feature-values":P.definitionKeyword,"from to selector scope MatchFlag":P.keyword,NamespaceName:P.namespace,KeyframeName:P.labelName,KeyframeRangeName:P.operatorKeyword,TagName:P.tagName,ClassName:P.className,PseudoClassName:P.constant(P.className),IdName:P.labelName,"FeatureName PropertyName":P.propertyName,AttributeName:P.attributeName,NumberLiteral:P.number,KeywordQuery:P.keyword,UnaryQueryOp:P.operatorKeyword,"CallTag ValueName FontName":P.atom,VariableName:P.variableName,Callee:P.operatorKeyword,Unit:P.unit,"UniversalSelector NestingSelector":P.definitionOperator,"MatchOp CompareOp":P.compareOperator,"ChildOp SiblingOp, LogicOp":P.logicOperator,BinOp:P.arithmeticOperator,Important:P.modifier,Comment:P.blockComment,ColorLiteral:P.color,"ParenthesizedContent StringLiteral":P.string,":":P.punctuation,"PseudoOp #":P.derefOperator,"; , |":P.separator,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace});const u7={__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:158,"url-prefix":158,domain:158,regexp:158};const f7={__proto__:null,or:104,and:104,not:112,only:112,layer:212};const p7={__proto__:null,selector:118,style:124,layer:208};const m7={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252};const g7={__proto__:null,to:249};const O7=vr.deserialize({version:14,states:"MrQYQdOOO#}QdOOP$UO\`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q\`O'#CgO%aQaO'#FqO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#ERO'dQdO'#ETO'oQdO'#E[O'oQdO'#E_OOQP'#Fq'#FqO)RQhO'#FQOOQS'#Fp'#FpOOQS'#FT'#FTQYQdOOO)YQdO'#EeO*iQhO'#EkO)YQdO'#EmO*pQdO'#EoO*{QdO'#ErO)}QhO'#ExO+TQdO'#EzO+\`QdO'#E}O+eQaO'#CfO+lQ\`O'#EbO+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:mO'dQdO,5:oO'oQdO,5:vO'oQdO,5:xO'oQdO,5:yO'oQdO'#F[O,nQ\`O,58}O,vQdO'#EaOOQS,58},58}OOQP'#Cq'#CqOOQO'#EP'#EPOOQP,59Y,59YO,}Q\`O,59YO-SQ\`O,59YOOQP'#ES'#ESOOQP,5:m,5:mO-XQpO'#EUO-dQdO'#EVO-iQ\`O'#EVO-nQpO,5:oO.XQaO,5:vO.oQaO,5:yOOQW'#D^'#D^O/nQhO'#DgO0RQhO,5;lO)}QhO'#DeO0\`Q\`O'#DnO0eQhO'#D{OOQW'#Fw'#FwOOQS,5;l,5;lO0jQ\`O'#DhO0oQ\`O'#DkOOQS-E9R-E9ROOQ['#Cv'#CvO0tQdO'#CwO1[QdO'#C}O1rQdO'#DQO2YQ!pO'#DSO4fQ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%l%Z",tokenizers:[h7,c7,a7,l7,1,2,3,4,new Ed("m~RRYZ[z{a~~g~aO$b~~dP!P!Qg~lO$c~~",28,155)],topRules:{"StyleSheet":[0,6],"Styles":[1,129]},dynamicPrecedences:{"97":1},specialized:[{term:150,get:i=>u7[i]||-1},{term:151,get:i=>f7[i]||-1},{term:4,get:i=>p7[i]||-1},{term:28,get:i=>m7[i]||-1},{term:149,get:i=>g7[i]||-1}],tokenPrec:2444});let $f=null;function Ef(){if(!$f&&typeof document=="object"&&document.body){let{style:i}=document.body,e=[],t=new Set;for(let s in i)if(s!="cssText"&&s!="cssFloat"){if(typeof i[s]=="string"){if(/[A-Z]/.test(s))s=s.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());if(!t.has(s)){e.push(s);t.add(s)}}}$f=e.sort().map(s=>({type:"property",label:s,apply:s+": "}))}return $f||[]}const Mv=["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(i=>({type:"class",label:i}));const Bv=["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(i=>({type:"keyword",label:i})).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(i=>({type:"constant",label:i})));const _7=["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(i=>({type:"type",label:i}));const v7=["@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(i=>({type:"keyword",label:i}));const Gs=/^(\\w[\\w-]*|-\\w[\\w-]*|)$/;const y7=/^-(-[\\w-]*)?$/;function b7(i,e){var t;if(i.name=="("||i.type.isError)i=i.parent||i;if(i.name!="ArgList")return false;let s=(t=i.parent)===null||t===void 0?void 0:t.firstChild;if((s===null||s===void 0?void 0:s.name)!="Callee")return false;return e.sliceString(s.from,s.to)=="var"}const Iv=new HO;const S7=["Declaration"];function w7(i){for(let e=i;;){if(e.type.isTop)return e;if(!(e=e.parent))return i}}function Ak(i,e,t){if(e.to-e.from>4096){let s=Iv.get(e);if(s)return s;let r=[],n=new Set,o=e.cursor(Ee.IncludeAnonymous);if(o.firstChild())do{for(let a of Ak(i,o.node,t))if(!n.has(a.label)){n.add(a.label);r.push(a)}}while(o.nextSibling());Iv.set(e,r);return r}else{let s=[],r=new Set;e.cursor().iterate(n=>{var o;if(t(n)&&n.matchContext(S7)&&((o=n.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=i.sliceString(n.from,n.to);if(!r.has(a)){r.add(a);s.push({label:a,type:"variable"})}}});return s}}const x7=i=>e=>{let{state:t,pos:s}=e,r=We(t).resolveInner(s,-1);let n=r.type.isError&&r.from==r.to-1&&t.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(n||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Ef(),validFor:Gs};if(r.name=="ValueName")return{from:r.from,options:Bv,validFor:Gs};if(r.name=="PseudoClassName")return{from:r.from,options:Mv,validFor:Gs};if(i(r)||(e.explicit||n)&&b7(r,t.doc))return{from:i(r)||n?r.from:s,options:Ak(t.doc,w7(r),i),validFor:y7};if(r.name=="TagName"){for(let{parent:l}=r;l;l=l.parent)if(l.name=="Block")return{from:r.from,options:Ef(),validFor:Gs};return{from:r.from,options:_7,validFor:Gs}}if(r.name=="AtKeyword")return{from:r.from,options:v7,validFor:Gs};if(!e.explicit)return null;let o=r.resolve(s),a=o.childBefore(s);if(a&&a.name==":"&&o.name=="PseudoClassSelector")return{from:s,options:Mv,validFor:Gs};if(a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList")return{from:s,options:Bv,validFor:Gs};if(o.name=="Block"||o.name=="Styles")return{from:s,options:Ef(),validFor:Gs};return null};const k7=x7(i=>i.name=="VariableName");const Qd=_r.define({name:"css",parser:O7.configure({props:[wr.add({Declaration:Vo()}),xr.add({"Block KeyframeList":mh})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\\s*\\}$/,wordChars:"-"}});function Lk(){return new pn(Qd,Qd.data.of({autocomplete:k7}))}const C7=55;const T7=1;const P7=56;const $7=2;const E7=57;const Q7=3;const Dv=4;const R7=5;const n0=6;const Mk=7;const Bk=8;const Ik=9;const Dk=10;const A7=11;const L7=12;const M7=13;const Qf=58;const B7=14;const I7=15;const zv=59;const zk=21;const D7=23;const Wk=24;const z7=25;const Ym=27;const qk=28;const W7=29;const q7=32;const X7=35;const N7=37;const F7=38;const Z7=0;const U7=1;const j7={area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,menuitem:true};const H7={dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true};const Wv={dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}};function V7(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}let qv=null;let Xv=null;let Nv=0;function Gm(i,e){let t=i.pos+e;if(Nv==t&&Xv==i)return qv;let s=i.peek(e),r="";for(;;){if(!V7(s))break;r+=String.fromCharCode(s);s=i.peek(++e)}Xv=i;Nv=t;return qv=r?r.toLowerCase():s==Y7||s==G7?void 0:null}const Xk=60;const Rd=62;const o0=47;const Y7=63;const G7=33;const K7=45;function Fv(i,e){this.name=i;this.parent=e}const J7=[n0,Dk,Mk,Bk,Ik];const eL=new yu({start:null,shift(i,e,t,s){return J7.indexOf(e)>-1?new Fv(Gm(s,1)||"",i):i},reduce(i,e){return e==zk&&i?i.parent:i},reuse(i,e,t,s){let r=e.type.id;return r==n0||r==N7?new Fv(Gm(s,1)||"",i):i},strict:false});const tL=new at((i,e)=>{if(i.next!=Xk){if(i.next<0&&e.context)i.acceptToken(Qf);return}i.advance();let t=i.next==o0;if(t)i.advance();let s=Gm(i,0);if(s===void 0)return;if(!s)return i.acceptToken(t?I7:B7);let r=e.context?e.context.name:null;if(t){if(s==r)return i.acceptToken(A7);if(r&&H7[r])return i.acceptToken(Qf,-2);if(e.dialectEnabled(Z7))return i.acceptToken(L7);for(let n=e.context;n;n=n.parent)if(n.name==s)return;i.acceptToken(M7)}else{if(s=="script")return i.acceptToken(Mk);if(s=="style")return i.acceptToken(Bk);if(s=="textarea")return i.acceptToken(Ik);if(j7.hasOwnProperty(s))return i.acceptToken(Dk);if(r&&Wv[r]&&Wv[r][s])i.acceptToken(Qf,-1);else i.acceptToken(n0)}},{contextual:true});const iL=new at(i=>{for(let e=0,t=0;;t++){if(i.next<0){if(t)i.acceptToken(zv);break}if(i.next==K7){e++}else if(i.next==Rd&&e>=2){if(t>=3)i.acceptToken(zv,-2);break}else{e=0}i.advance()}});function sL(i){for(;i;i=i.parent)if(i.name=="svg"||i.name=="math")return true;return false}const rL=new at((i,e)=>{if(i.next==o0&&i.peek(1)==Rd){let t=e.dialectEnabled(U7)||sL(e.context);i.acceptToken(t?R7:Dv,2)}else if(i.next==Rd){i.acceptToken(Dv,1)}});function a0(i,e,t){let s=2+i.length;return new at(r=>{for(let n=0,o=0,a=0;;a++){if(r.next<0){if(a)r.acceptToken(e);break}if(n==0&&r.next==Xk||n==1&&r.next==o0||n>=2&&no)r.acceptToken(e,-o);else r.acceptToken(t,-(o-2));break}else if((r.next==10||r.next==13)&&a){r.acceptToken(e,1);break}else{n=o=0}r.advance()}})}const nL=a0("script",C7,T7);const oL=a0("style",P7,$7);const aL=a0("textarea",E7,Q7);const lL=Sr({"Text RawText IncompleteTag IncompleteCloseTag":P.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":P.angleBracket,TagName:P.tagName,"MismatchedCloseTag/TagName":[P.tagName,P.invalid],AttributeName:P.attributeName,"AttributeValue UnquotedAttributeValue":P.attributeValue,Is:P.definitionOperator,"EntityReference CharacterReference":P.character,Comment:P.blockComment,ProcessingInst:P.processingInstruction,DoctypeDecl:P.documentMeta});const hL=vr.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+$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XYOX\`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:eL,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:[lL],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!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w!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 h=a.type.id;if(h==W7)return Rf(a,l,t);if(h==q7)return Rf(a,l,s);if(h==X7)return Rf(a,l,r);if(h==zk&&n.length){let c=a.node,d=c.firstChild,u=d&&Zv(d,l),f;if(u)for(let p of n){if(p.tag==u&&(!p.attrs||p.attrs(f||(f=Nk(d,l))))){let m=c.lastChild;let O=m.type.id==F7?m.from:c.to;if(O>d.to)return{parser:p.parser,overlay:[{from:d.to,to:O}]}}}}if(o&&h==Wk){let c=a.node,d;if(d=c.firstChild){let u=o[l.read(d.from,d.to)];if(u)for(let f of u){if(f.tagName&&f.tagName!=Zv(c.parent,l))continue;let p=c.lastChild;if(p.type.id==Ym){let m=p.from+1;let O=p.lastChild,v=p.to-(O&&O.isError?0:1);if(v>m)return{parser:f.parser,overlay:[{from:m,to:v}],bracketed:true}}else if(p.type.id==qk){return{parser:f.parser,overlay:[{from:p.from,to:p.to}]}}}}}return null})}const cL=316;const dL=317;const Uv=1;const uL=2;const fL=3;const pL=4;const mL=318;const gL=320;const OL=321;const _L=5;const vL=6;const yL=0;const Km=[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];const Zk=125;const bL=59;const Jm=47;const SL=42;const wL=43;const xL=45;const kL=60;const CL=44;const TL=63;const PL=46;const $L=91;const EL=new yu({start:false,shift(i,e){return e==_L||e==vL||e==gL?i:e==OL},strict:false});const QL=new at((i,e)=>{let{next:t}=i;if(t==Zk||t==-1||e.context)i.acceptToken(mL)},{contextual:true,fallback:true});const RL=new at((i,e)=>{let{next:t}=i,s;if(Km.indexOf(t)>-1)return;if(t==Jm&&((s=i.peek(1))==Jm||s==SL))return;if(t!=Zk&&t!=bL&&t!=-1&&!e.context)i.acceptToken(cL)},{contextual:true});const AL=new at((i,e)=>{if(i.next==$L&&!e.context)i.acceptToken(dL)},{contextual:true});const LL=new at((i,e)=>{let{next:t}=i;if(t==wL||t==xL){i.advance();if(t==i.next){i.advance();let s=!e.context&&e.canShift(Uv);i.acceptToken(s?Uv:uL)}}else if(t==TL&&i.peek(1)==PL){i.advance();i.advance();if(i.next<48||i.next>57)i.acceptToken(fL)}},{contextual:true});function Af(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const ML=new at((i,e)=>{if(i.next!=kL||!e.dialectEnabled(yL))return;i.advance();if(i.next==Jm)return;let t=0;while(Km.indexOf(i.next)>-1){i.advance();t++}if(Af(i.next,true)){i.advance();t++;while(Af(i.next,false)){i.advance();t++}while(Km.indexOf(i.next)>-1){i.advance();t++}if(i.next==CL)return;for(let s=0;;s++){if(s==7){if(!Af(i.next,true))return;break}if(i.next!="extends".charCodeAt(s))break;i.advance();t++}}i.acceptToken(pL,-t)});const BL=Sr({"get set async static":P.modifier,"for while do if else switch try catch finally return throw break continue default case defer":P.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":P.operatorKeyword,"let var const using function class extends":P.definitionKeyword,"import export from":P.moduleKeyword,"with debugger new":P.keyword,TemplateString:P.special(P.string),super:P.atom,BooleanLiteral:P.bool,this:P.self,null:P.null,Star:P.modifier,VariableName:P.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":P.function(P.variableName),VariableDefinition:P.definition(P.variableName),Label:P.labelName,PropertyName:P.propertyName,PrivatePropertyName:P.special(P.propertyName),"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),"FunctionDeclaration/VariableDefinition":P.function(P.definition(P.variableName)),"ClassDeclaration/VariableDefinition":P.definition(P.className),"NewExpression/VariableName":P.className,PropertyDefinition:P.definition(P.propertyName),PrivatePropertyDefinition:P.definition(P.special(P.propertyName)),UpdateOp:P.updateOperator,"LineComment Hashbang":P.lineComment,BlockComment:P.blockComment,Number:P.number,String:P.string,Escape:P.escape,ArithOp:P.arithmeticOperator,LogicOp:P.logicOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,RegExp:P.regexp,Equals:P.definitionOperator,Arrow:P.function(P.punctuation),": Spread":P.punctuation,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,"InterpolationStart InterpolationEnd":P.special(P.brace),".":P.derefOperator,", ;":P.separator,"@":P.meta,TypeName:P.typeName,TypeDefinition:P.definition(P.typeName),"type enum interface implements namespace module declare":P.definitionKeyword,"abstract global Privacy readonly override":P.modifier,"is keyof unique infer asserts":P.operatorKeyword,JSXAttributeValue:P.attributeValue,JSXText:P.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":P.angleBracket,"JSXIdentifier JSXNameSpacedName":P.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":P.attributeName,"JSXBuiltin/JSXIdentifier":P.standard(P.tagName)});const IL={__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};const DL={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199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: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:EL,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:[BL],skippedNodes:[0,5,6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T$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:[RL,AL,LL,ML,2,3,4,5,6,7,8,9,10,11,12,13,14,QL,new Ed("$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 Ed("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{"Script":[0,7],"SingleExpression":[1,276],"SingleClassItem":[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{"80":1,"82":1,"94":1,"169":1,"199":1},specialized:[{term:327,get:i=>IL[i]||-1},{term:343,get:i=>DL[i]||-1},{term:95,get:i=>zL[i]||-1}],tokenPrec:15201});class qL{constructor(e,t,s,r){this.state=e;this.pos=t;this.explicit=s;this.view=r;this.abortListeners=[];this.abortOnDocChange=false}tokenBefore(e){let t=We(this.state).resolveInner(this.pos,-1);while(t&&e.indexOf(t.name)<0)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos);let s=Math.max(t.from,this.pos-250);let r=t.text.slice(s-t.from,this.pos-t.from);let n=r.search(NL(e));return n<0?null:{from:s+n,to:this.pos,text:r.slice(n)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,s){if(e=="abort"&&this.abortListeners){this.abortListeners.push(t);if(s&&s.onDocChange)this.abortOnDocChange=true}}}function jv(i){let e=Object.keys(i).join("");let t=/\\w/.test(e);if(t)e=e.replace(/\\w/g,"");return\`[\${t?"\\\\w":""}\${e.replace(/[^\\w\\s]/g,"\\\\$&")}]\`}function XL(i){let e=Object.create(null),t=Object.create(null);for(let{label:r}of i){e[r[0]]=true;for(let n=1;ntypeof r=="string"?{label:r}:r);let[t,s]=e.every(r=>/^\\w+$/.test(r.label))?[/\\w*$/,/\\w+$/]:XL(e);return r=>{let n=r.matchBefore(s);return n||r.explicit?{from:n?n.from:r.pos,options:e,validFor:t}:null}}function jk(i,e){return t=>{for(let s=We(t.state).resolveInner(t.pos,-1);s;s=s.parent){if(i.indexOf(s.name)>-1)return null;if(s.type.isTop)break}return e(t)}}function NL(i,e){var t;let{source:s}=i;let r=s[s.length-1]!="$";if(!r)return i;return new RegExp(\`\${""}(?:\${s})\${r?"$":""}\`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const FL=br.define();const ZL=J.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:\`\${400}px\`,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:\`\${30}px\`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:\`\${30}px\`},"&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 UL{constructor(e,t,s,r){this.field=e;this.line=t;this.from=s;this.to=r}}class l0{constructor(e,t,s){this.field=e;this.from=t;this.to=s}map(e){let t=e.mapPos(this.from,-1,oi.TrackDel);let s=e.mapPos(this.to,1,oi.TrackDel);return t==null||s==null?null:new l0(this.field,t,s)}}class h0{constructor(e,t){this.lines=e;this.fieldPositions=t}instantiate(e,t){let s=[],r=[t];let n=e.doc.lineAt(t),o=/^\\s*/.exec(n.text)[0];for(let l of this.lines){if(s.length){let h=o,c=/^\\t*/.exec(l)[0].length;for(let d=0;dnew l0(l.field,r[l.line]+l.from,r[l.line]+l.to));return{text:s,ranges:a}}static parse(e){let t=[];let s=[],r=[],n;for(let o of e.split(/\\r\\n?|\\n/)){while(n=/[#$]\\{(?:(\\d+)(?::([^{}]*))?|((?:\\\\[{}]|[^{}])*))\\}/.exec(o)){let a=n[1]?+n[1]:null,l=n[2]||n[3]||"",h=-1;if(a===0)a=1e9;let c=l.replace(/\\\\[{}]/g,d=>d[1]);for(let d=0;d=h)u.field++}for(let d of r)if(d.line==s.length&&d.from>n.index){let u=n[2]?3+(n[1]||"").length:2;d.from-=u;d.to-=u}r.push(new UL(h,s.length,n.index,n.index+c.length));o=o.slice(0,n.index)+l+o.slice(n.index+n[0].length)}o=o.replace(/\\\\([{}])/g,(a,l,h)=>{for(let c of r)if(c.line==s.length&&c.from>h){c.from--;c.to--}return l});s.push(o)}return new h0(s,r)}}let jL=fe.widget({widget:new class extends uo{toDOM(){let i=document.createElement("span");i.className="cm-snippetFieldPosition";return i}ignoreEvent(){return false}}});let HL=fe.mark({class:"cm-snippetField"});class _a{constructor(e,t){this.ranges=e;this.active=t;this.deco=fe.set(e.map(s=>(s.from==s.to?jL:HL).range(s.from,s.to)),true)}map(e){let t=[];for(let s of this.ranges){let r=s.map(e);if(!r)return null;t.push(r)}return new _a(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(s=>s.field==this.active&&s.from<=t.from&&s.to>=t.to))}}const _h=Ce.define({map(i,e){return i&&i.map(e)}});const VL=Ce.define();const Ul=ji.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(_h))return t.value;if(t.is(VL)&&i)return new _a(i.ranges,t.value)}if(i&&e.docChanged)i=i.map(e.changes);if(i&&e.selection&&!i.selectionInsideField(e.selection))i=null;return i},provide:i=>J.decorations.from(i,e=>e?e.deco:fe.none)});function c0(i,e){return z.create(i.filter(t=>t.field==e).map(t=>z.range(t.from,t.to)))}function YL(i){let e=h0.parse(i);return(t,s,r,n)=>{let{text:o,ranges:a}=e.instantiate(t.state,r);let{main:l}=t.state.selection;let h={changes:{from:r,to:n==l.from?l.to:n,insert:Pe.of(o)},scrollIntoView:true,annotations:s?[FL.of(s),ut.userEvent.of("input.complete")]:void 0};if(a.length)h.selection=c0(a,0);if(a.some(c=>c.field>0)){let c=new _a(a,0);let d=h.effects=[_h.of(c)];if(t.state.field(Ul,false)===void 0)d.push(Ce.appendConfig.of([Ul,tM,iM,ZL]))}t.dispatch(t.state.update(h))}}function Hk(i){return({state:e,dispatch:t})=>{let s=e.field(Ul,false);if(!s||i<0&&s.active==0)return false;let r=s.active+i,n=i>0&&!s.ranges.some(o=>o.field==r+i);t(e.update({selection:c0(s.ranges,r),effects:_h.of(n?null:new _a(s.ranges,r)),scrollIntoView:true}));return true}}const GL=({state:i,dispatch:e})=>{let t=i.field(Ul,false);if(!t)return false;e(i.update({effects:_h.of(null)}));return true};const KL=Hk(1);const JL=Hk(-1);const eM=[{key:"Tab",run:KL,shift:JL},{key:"Escape",run:GL}];const Hv=te.define({combine(i){return i.length?i[0]:eM}});const tM=ho.highest(du.compute([Hv],i=>i.facet(Hv)));function Ke(i,e){return{...e,apply:YL(i)}}const iM=J.domEventHandlers({mousedown(i,e){let t=e.state.field(Ul,false),s;if(!t||(s=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return false;let r=t.ranges.find(n=>n.from<=s&&n.to>=s);if(!r||r.field==t.active)return false;e.dispatch({selection:c0(t.ranges,r.field),effects:_h.of(t.ranges.some(n=>n.field>r.field)?new _a(t.ranges,r.field):null),scrollIntoView:true});return true}});const Vk=new class extends an{};Vk.startSide=1;Vk.endSide=-1;const Yk=[Ke("function \${name}(\${params}) {\\n \${}\\n}",{label:"function",detail:"definition",type:"keyword"}),Ke("for (let \${index} = 0; \${index} < \${bound}; \${index}++) {\\n \${}\\n}",{label:"for",detail:"loop",type:"keyword"}),Ke("for (let \${name} of \${collection}) {\\n \${}\\n}",{label:"for",detail:"of loop",type:"keyword"}),Ke("do {\\n \${}\\n} while (\${})",{label:"do",detail:"loop",type:"keyword"}),Ke("while (\${}) {\\n \${}\\n}",{label:"while",detail:"loop",type:"keyword"}),Ke("try {\\n \${}\\n} catch (\${error}) {\\n \${}\\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Ke("if (\${}) {\\n \${}\\n}",{label:"if",detail:"block",type:"keyword"}),Ke("if (\${}) {\\n \${}\\n} else {\\n \${}\\n}",{label:"if",detail:"/ else block",type:"keyword"}),Ke("class \${name} {\\n constructor(\${params}) {\\n \${}\\n }\\n}",{label:"class",detail:"definition",type:"keyword"}),Ke('import {\${names}} from "\${module}"\\n\${}',{label:"import",detail:"named",type:"keyword"}),Ke('import \${name} from "\${module}"\\n\${}',{label:"import",detail:"default",type:"keyword"})];const sM=Yk.concat([Ke("interface \${name} {\\n \${}\\n}",{label:"interface",detail:"definition",type:"keyword"}),Ke("type \${name} = \${type}",{label:"type",detail:"definition",type:"keyword"}),Ke("enum \${name} {\\n \${}\\n}",{label:"enum",detail:"definition",type:"keyword"})]);const Vv=new HO;const Gk=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ba(i){return(e,t)=>{let s=e.node.getChild("VariableDefinition");if(s)t(s,i);return true}}const rM=["FunctionDeclaration"];const nM={FunctionDeclaration:Ba("function"),ClassDeclaration:Ba("class"),ClassExpression:()=>true,EnumDeclaration:Ba("constant"),TypeAliasDeclaration:Ba("type"),NamespaceDeclaration:Ba("namespace"),VariableDefinition(i,e){if(!i.matchContext(rM))e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function Kk(i,e){let t=Vv.get(e);if(t)return t;let s=[],r=true;function n(o,a){let l=i.sliceString(o.from,o.to);s.push({label:l,type:a})}e.cursor(Ee.IncludeAnonymous).iterate(o=>{if(r){r=false}else if(o.name){let a=nM[o.name];if(a&&a(o,n)||Gk.has(o.name))return false}else if(o.to-o.from>8192){for(let a of Kk(i,o.node))s.push(a);return false}});Vv.set(e,s);return s}const Yv=/^[\\w$\\xa1-\\uffff][\\w$\\d\\xa1-\\uffff]*$/;const Jk=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function oM(i){let e=We(i.state).resolveInner(i.pos,-1);if(Jk.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Yv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent){if(Gk.has(r.name))s=s.concat(Kk(i.state.doc,r))}return{options:s,from:t?e.from:i.pos,validFor:Yv}}const Ws=_r.define({name:"javascript",parser:WL.configure({props:[wr.add({IfStatement:Vo({except:/^\\s*({|else\\b)/}),TryStatement:Vo({except:/^\\s*({|catch\\b|finally\\b)/}),LabeledStatement:NR,SwitchBody:i=>{let e=i.textAfter,t=/^\\s*\\}/.test(e),s=/^\\s*(case|default)\\b/.test(e);return i.baseIndent+(t?0:s?1:2)*i.unit},Block:Ho({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Vo({except:/^\\s*{/}),JSXElement(i){let e=/^\\s*<\\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\\s*\\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),xr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":mh,BlockComment(i){return{from:i.from+2,to:i.to-2}},JSXElement(i){let e=i.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=i.lastChild;return{from:e.to,to:t.type.isError?i.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(i){var e;let t=(e=i.firstChild)===null||e===void 0?void 0:e.nextSibling,s=i.lastChild;if(!t||t.type.isError)return null;return{from:t.to,to:s.type.isError?i.to:s.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"\`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\\s*(?:case |default:|\\{|\\}|<\\/)$/,wordChars:"$"}});const e5={test:i=>/^JSX/.test(i.name),facet:fu({commentTokens:{block:{open:"{/*",close:"*/}"}}})};const t5=Ws.configure({dialect:"ts"},"typescript");const i5=Ws.configure({dialect:"jsx",props:[VO.add(i=>i.isTop?[e5]:void 0)]});const s5=Ws.configure({dialect:"jsx ts",props:[VO.add(i=>i.isTop?[e5]:void 0)]},"typescript");let r5=i=>({label:i,type:"keyword"});const n5="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(r5);const aM=n5.concat(["declare","implements","private","protected","public"].map(r5));function Dc(i={}){let e=i.jsx?i.typescript?s5:i5:i.typescript?t5:Ws;let t=i.typescript?sM.concat(aM):Yk.concat(n5);return new pn(e,[Ws.data.of({autocomplete:jk(Jk,Uk(t))}),Ws.data.of({autocomplete:oM}),i.jsx?cM:[]])}function lM(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Gv(i,e,t=i.length){for(let s=e===null||e===void 0?void 0:e.firstChild;s;s=s.nextSibling){if(s.name=="JSXIdentifier"||s.name=="JSXBuiltin"||s.name=="JSXNamespacedName"||s.name=="JSXMemberExpression")return i.sliceString(s.from,Math.min(s.to,t))}return""}const hM=typeof navigator=="object"&&/Android\\b/.test(navigator.userAgent);const cM=J.inputHandler.of((i,e,t,s,r)=>{if((hM?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Ws.isActiveAt(i.state,e,-1))return false;let n=r(),{state:o}=n;let a=o.changeByRange(l=>{var h;let{head:c}=l,d=We(o).resolveInner(c-1,-1),u;if(d.name=="JSXStartTag")d=d.parent;if(o.doc.sliceString(c-1,c)!=s||d.name=="JSXAttributeValue"&&d.to>c);else if(s==">"&&d.name=="JSXFragmentTag"){return{range:l,changes:{from:c,insert:\`\`}}}else if(s=="/"&&d.name=="JSXStartCloseTag"){let f=d.parent,p=f.parent;if(p&&f.from==c-2&&((u=Gv(o.doc,p.firstChild,c))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=\`\${u}>\`;return{range:z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(s==">"){let f=lM(d);if(f&&f.name=="JSXOpenTag"&&!/^\\/?>|^<\\//.test(o.doc.sliceString(c,c+2))&&(u=Gv(o.doc,f,c)))return{range:l,changes:{from:c,insert:\`\`}}}return{range:l}});if(a.changes.empty)return false;i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:true})]);return true});const Ia=["_blank","_self","_top","_parent"];const Lf=["ascii","utf-8","utf-16","latin1","latin1"];const Mf=["get","post","put","delete"];const Bf=["application/x-www-form-urlencoded","multipart/form-data","text/plain"];const bi=["true","false"];const ae={};const dM={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ia,hreflang:null}},abbr:ae,address:ae,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:ae,aside:ae,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:ae,base:{attrs:{href:null,target:Ia}},bdi:ae,bdo:ae,blockquote:{attrs:{cite:null}},body:ae,br:ae,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Bf,formmethod:Mf,formnovalidate:["novalidate"],formtarget:Ia,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:ae,center:ae,cite:ae,code:ae,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:ae,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:ae,div:ae,dl:ae,dt:ae,em:ae,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:ae,figure:ae,footer:ae,form:{attrs:{action:null,name:null,"accept-charset":Lf,autocomplete:["on","off"],enctype:Bf,method:Mf,novalidate:["novalidate"],target:Ia}},h1:ae,h2:ae,h3:ae,h4:ae,h5:ae,h6:ae,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:ae,hgroup:ae,hr:ae,html:{attrs:{manifest:null}},i:ae,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:Bf,formmethod:Mf,formnovalidate:["novalidate"],formtarget:Ia,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:ae,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:ae,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:ae,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Lf,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:ae,noscript:ae,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:ae,param:{attrs:{name:null,value:null}},pre:ae,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:ae,rt:ae,ruby:ae,samp:ae,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Lf}},section:ae,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:ae,source:{attrs:{src:null,type:null,media:null}},span:ae,strong:ae,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:ae,summary:ae,sup:ae,table:ae,tbody:ae,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:ae,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:ae,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:ae,time:{attrs:{datetime:null}},title:ae,tr:ae,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:ae,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:ae};const o5={accesskey:null,class:null,contenteditable:bi,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:bi,autocorrect:bi,autocapitalize:bi,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":bi,"aria-autocomplete":["inline","list","both","none"],"aria-busy":bi,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":bi,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":bi,"aria-hidden":bi,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":bi,"aria-multiselectable":bi,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":bi,"aria-relevant":null,"aria-required":bi,"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};const a5="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(i=>"on"+i);for(let i of a5)o5[i]=null;class jl{constructor(e,t){this.tags={...dM,...e};this.globalAttrs={...o5,...t};this.allTags=Object.keys(this.tags);this.globalAttrNames=Object.keys(this.globalAttrs)}}jl.default=new jl;function so(i,e,t=i.length){if(!e)return"";let s=e.firstChild;let r=s&&s.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function la(i,e=false){for(;i;i=i.parent)if(i.name=="Element"){if(e)e=false;else return i}return null}function l5(i,e,t){let s=t.tags[so(i,la(e))];return(s===null||s===void 0?void 0:s.children)||t.allTags}function d0(i,e){let t=[];for(let s=la(e);s&&!s.type.isTop;s=la(s.parent)){let r=so(i,s);if(r&&s.lastChild.name=="CloseTag")break;if(r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=s.firstChild.to))t.push(r)}return t}const h5=/^[:\\-\\.\\w\\u00b7-\\uffff]*$/;function Kv(i,e,t,s,r){let n=/\\s*>/.test(i.sliceDoc(r,r+5))?"":">";let o=la(t,t.name=="StartTag"||t.name=="TagName");return{from:s,to:r,options:l5(i.doc,o,e).map(a=>({label:a,type:"type"})).concat(d0(i.doc,t).map((a,l)=>({label:"/"+a,apply:"/"+a+n,type:"type",boost:99-l}))),validFor:/^\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/}}function Jv(i,e,t,s){let r=/\\s*>/.test(i.sliceDoc(s,s+5))?"":">";return{from:t,to:s,options:d0(i.doc,e).map((n,o)=>({label:n,apply:n+r,type:"type",boost:99-o})),validFor:h5}}function uM(i,e,t,s){let r=[],n=0;for(let o of l5(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of d0(i.doc,t))r.push({label:"",type:"type",boost:99-n++});return{from:s,to:s,options:r,validFor:/^<\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/}}function fM(i,e,t,s,r){let n=la(t),o=n?e.tags[so(i.doc,n)]:null;let a=o&&o.attrs?Object.keys(o.attrs):[];let l=o&&o.globalAttrs===false?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:s,to:r,options:l.map(h=>({label:h,type:"property"})),validFor:h5}}function pM(i,e,t,s,r){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName");let a=[],l=void 0;if(o){let h=i.sliceDoc(o.from,o.to);let c=e.globalAttrs[h];if(!c){let d=la(t),u=d?e.tags[so(i.doc,d)]:null;c=(u===null||u===void 0?void 0:u.attrs)&&u.attrs[h]}if(c){let d=i.sliceDoc(s,r).toLowerCase(),u='"',f='"';if(/^['"]/.test(d)){l=d[0]=='"'?/^[^"]*$/:/^[^']*$/;u="";f=i.sliceDoc(r,r+1)==d[0]?"":d[0];d=d.slice(1);s++}else{l=/^[^\\s<>='"]*$/}for(let p of c)a.push({label:p,apply:u+p+f,type:"constant"})}}return{from:s,to:r,options:a,validFor:l}}function c5(i,e){let{state:t,pos:s}=e,r=We(t).resolveInner(s,-1),n=r.resolve(s);for(let o=s,a;n==r&&(a=r.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.fromc5(s,r)}const OM=Ws.parser.configure({top:"SingleExpression"});const d5=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:t5.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:i5.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:s5.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\\/(.+\\+)?json)$/i.test(i.type)},parser:OM},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:Ws.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:Qd.parser}];const u5=[{name:"style",parser:Qd.parser.configure({top:"Styles"})}].concat(a5.map(i=>({name:i,parser:Ws.parser})));const f5=_r.define({name:"html",parser:hL.configure({props:[wr.add({Element(i){let e=/^(\\s*)(<\\/)?/.exec(i.textAfter);if(i.node.to<=i.pos+e[0].length)return i.continue();return i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\\s*/.exec(i.textAfter)[0].lengthi.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\\s*<\\/\\w+\\W$/,wordChars:"-_"}});const zc=f5.configure({wrap:Fk(d5,u5)});function p5(i={}){let e="",t;if(i.matchClosingTags===false)e="noMatch";if(i.selfClosingTags===true)e=(e?e+" ":"")+"selfClosing";if(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)t=Fk((i.nestedLanguages||[]).concat(d5),(i.nestedAttributes||[]).concat(u5));let s=t?f5.configure({wrap:t,dialect:e}):e?zc.configure({dialect:e}):zc;return new pn(s,[zc.data.of({autocomplete:gM(i)}),i.autoCloseTags!==false?vM:[],Dc().support,Lk().support])}const ey=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function _M(i,e,t){var s;for(;;){if(((s=e.lastChild)===null||s===void 0?void 0:s.name)!="CloseTag")return false;let r=e.parent;if(!r||so(i,r)!=t)return true;e=r}}const vM=J.inputHandler.of((i,e,t,s,r)=>{if(i.composing||i.state.readOnly||e!=t||s!=">"&&s!="/"||!zc.isActiveAt(i.state,e,-1))return false;let n=r(),{state:o}=n;let a=o.changeByRange(l=>{var h;let c=o.doc.sliceString(l.from-1,l.to)==s;let{head:d}=l,u=We(o).resolveInner(d,-1),f;if(c&&s==">"&&u.name=="EndTag"){let p=u.parent;if((f=so(o.doc,p.parent,d))&&!ey.has(f)&&!_M(o.doc,p.parent,f)){let m=d+(o.doc.sliceString(d,d+1)===">"?1:0);let O=\`\`;return{range:l,changes:{from:d,to:m,insert:O}}}}else if(c&&s=="/"&&u.name=="IncompleteCloseTag"){let p=u.parent;if(u.from==d-2&&((h=p.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(f=so(o.doc,p,d))&&!ey.has(f)){let m=d+(o.doc.sliceString(d,d+1)===">"?1:0);let O=\`\${f}>\`;return{range:z.cursor(d+O.length,-1),changes:{from:d,to:m,insert:O}}}}return{range:l}});if(a.changes.empty)return false;i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:true})]);return true});const yM=Sr({String:P.string,Number:P.number,"True False":P.bool,PropertyName:P.propertyName,Null:P.null,", :":P.separator,"[ ]":P.squareBracket,"{ }":P.brace});const bM=vr.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:[yM],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});const SM=_r.define({name:"json",parser:bM.configure({props:[wr.add({Object:Vo({except:/^\\s*\\}/}),Array:Vo({except:/^\\s*\\]/})}),xr.add({"Object Array":mh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\\s*[\\}\\]]$/}});function wM(){return new pn(SM)}class Ad{static create(e,t,s,r,n){let o=r+(r<<8)+e+(t<<4)|0;return new Ad(e,t,s,o,n,[],[])}constructor(e,t,s,r,n,o,a){this.type=e;this.value=t;this.from=s;this.hash=r;this.end=n;this.children=o;this.positions=a;this.hashProp=[[ue.contextHash,r]]}addChild(e,t){if(e.prop(ue.contextHash)!=this.hash)e=new _e(e.type,e.children,e.positions,e.length,this.hashProp);this.children.push(e);this.positions.push(t)}toTree(e,t=this.end){let s=this.children.length-1;if(s>=0)t=Math.max(t,this.positions[s]+this.children[s].length+this.from);return new _e(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(r,n,o)=>new _e(pt.none,r,n,o,this.hashProp)})}}var Z;(function(i){i[i["Document"]=1]="Document";i[i["CodeBlock"]=2]="CodeBlock";i[i["FencedCode"]=3]="FencedCode";i[i["Blockquote"]=4]="Blockquote";i[i["HorizontalRule"]=5]="HorizontalRule";i[i["BulletList"]=6]="BulletList";i[i["OrderedList"]=7]="OrderedList";i[i["ListItem"]=8]="ListItem";i[i["ATXHeading1"]=9]="ATXHeading1";i[i["ATXHeading2"]=10]="ATXHeading2";i[i["ATXHeading3"]=11]="ATXHeading3";i[i["ATXHeading4"]=12]="ATXHeading4";i[i["ATXHeading5"]=13]="ATXHeading5";i[i["ATXHeading6"]=14]="ATXHeading6";i[i["SetextHeading1"]=15]="SetextHeading1";i[i["SetextHeading2"]=16]="SetextHeading2";i[i["HTMLBlock"]=17]="HTMLBlock";i[i["LinkReference"]=18]="LinkReference";i[i["Paragraph"]=19]="Paragraph";i[i["CommentBlock"]=20]="CommentBlock";i[i["ProcessingInstructionBlock"]=21]="ProcessingInstructionBlock";i[i["Escape"]=22]="Escape";i[i["Entity"]=23]="Entity";i[i["HardBreak"]=24]="HardBreak";i[i["Emphasis"]=25]="Emphasis";i[i["StrongEmphasis"]=26]="StrongEmphasis";i[i["Link"]=27]="Link";i[i["Image"]=28]="Image";i[i["InlineCode"]=29]="InlineCode";i[i["HTMLTag"]=30]="HTMLTag";i[i["Comment"]=31]="Comment";i[i["ProcessingInstruction"]=32]="ProcessingInstruction";i[i["Autolink"]=33]="Autolink";i[i["HeaderMark"]=34]="HeaderMark";i[i["QuoteMark"]=35]="QuoteMark";i[i["ListMark"]=36]="ListMark";i[i["LinkMark"]=37]="LinkMark";i[i["EmphasisMark"]=38]="EmphasisMark";i[i["CodeMark"]=39]="CodeMark";i[i["CodeText"]=40]="CodeText";i[i["CodeInfo"]=41]="CodeInfo";i[i["LinkTitle"]=42]="LinkTitle";i[i["LinkLabel"]=43]="LinkLabel";i[i["URL"]=44]="URL"})(Z||(Z={}));class xM{constructor(e,t){this.start=e;this.content=t;this.marks=[];this.parsers=[]}}class kM{constructor(){this.text="";this.baseIndent=0;this.basePos=0;this.depth=0;this.markers=[];this.pos=0;this.indent=0;this.next=-1}forward(){if(this.basePos>this.pos)this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent);this.pos=e;this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return yl(this.text,e)}reset(e){this.text=e;this.baseIndent=this.basePos=this.pos=this.indent=0;this.forwardInner();this.depth=1;while(this.markers.length)this.markers.pop()}moveBase(e){this.basePos=e;this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e;this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,s=0){for(let r=t;r=e.stack[t.depth+1].value+t.baseIndent)return true;if(t.indent>=t.baseIndent+4)return false;let s=(i.type==Z.OrderedList?p0:f0)(t,e,false);return s>0&&(i.type!=Z.BulletList||u0(t,e,false)<0)&&t.text.charCodeAt(t.pos+s-1)==i.value}const m5={[Z.Blockquote](i,e,t){if(t.next!=62)return false;t.markers.push(Se(Z.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1));t.moveBase(t.pos+(Vi(t.text.charCodeAt(t.pos+1))?2:1));i.end=e.lineStart+t.text.length;return true},[Z.ListItem](i,e,t){if(t.indent-1)return false;t.moveBaseColumn(t.baseIndent+i.value);return true},[Z.OrderedList]:ty,[Z.BulletList]:ty,[Z.Document](){return true}};function Vi(i){return i==32||i==9||i==10||i==13}function yl(i,e=0){while(et&&Vi(i.charCodeAt(e-1)))e--;return e}function g5(i){if(i.next!=96&&i.next!=126)return-1;let e=i.pos+1;while(e-1&&i.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(x5.SetextHeading)>-1)return-1;return s<3?-1:1}function _5(i,e){for(let t=i.stack.length-1;t>=0;t--)if(i.stack[t].type==e)return true;return false}function f0(i,e,t){return(i.next==45||i.next==43||i.next==42)&&(i.pos==i.text.length-1||Vi(i.text.charCodeAt(i.pos+1)))&&(!t||_5(e,Z.BulletList)||i.skipSpace(i.pos+2)=48&&r<=57)s++;else break;if(s==i.text.length)return-1;r=i.text.charCodeAt(s)}if(s==i.pos||s>i.pos+9||r!=46&&r!=41||si.pos+1||i.next!=49))return-1;return s+1-i.pos}function v5(i){if(i.next!=35)return-1;let e=i.pos+1;while(e6?-1:t}function y5(i){if(i.next!=45&&i.next!=61||i.indent>=i.baseIndent+4)return-1;let e=i.pos+1;while(e/;const S5=/\\?>/;const tg=[[/^<(?:script|pre|style)(?:\\s|>|$)/i,/<\\/(?:script|pre|style)>/i],[/^\\s*/i.exec(s);if(n)return i.append(Se(Z.Comment,t,t+1+n[0].length));let o=/^\\?[^]*?\\?>/.exec(s);if(o)return i.append(Se(Z.ProcessingInstruction,t,t+1+o[0].length));let a=/^(?:![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(s);if(!a)return-1;return i.append(Se(Z.HTMLTag,t,t+1+a[0].length))},Emphasis(i,e,t){if(e!=95&&e!=42)return-1;let s=t+1;while(i.char(s)==e)s++;let r=i.slice(t-1,t),n=i.slice(s,s+1);let o=Vl.test(r),a=Vl.test(n);let l=/\\s|^$/.test(r),h=/\\s|^$/.test(n);let c=!h&&(!a||l||o);let d=!l&&(!o||h||a);let u=c&&(e==42||!d||o);let f=d&&(e==42||!c||a);return i.append(new Pi(e==95?$5:E5,t,s,(u?1:0)|(f?2:0)))},HardBreak(i,e,t){if(e==92&&i.char(t+1)==10)return i.append(Se(Z.HardBreak,t,t+2));if(e==32){let s=t+1;while(i.char(s)==32)s++;if(i.char(s)==10&&s>=t+2)return i.append(Se(Z.HardBreak,t,s+1))}return-1},Link(i,e,t){return e==91?i.append(new Pi(En,t,t+1,1)):-1},Image(i,e,t){return e==33&&i.char(t+1)==91?i.append(new Pi(Ld,t,t+2,1)):-1},LinkEnd(i,e,t){if(e!=93)return-1;for(let s=i.parts.length-1;s>=0;s--){let r=i.parts[s];if(r instanceof Pi&&(r.type==En||r.type==Ld)){if(!r.side||i.skipSpace(r.to)==t&&!/[(\\[]/.test(i.slice(t+1,t+2))){i.parts[s]=null;return-1}let n=i.takeContent(s);let o=i.parts[s]=QM(i,n,r.type==En?Z.Link:Z.Image,r.from,t+1);if(r.type==En)for(let a=0;ae?Se(Z.URL,e+t,n+t):n==i.length?null:false}}function R5(i,e,t){let s=i.charCodeAt(e);if(s!=39&&s!=34&&s!=40)return false;let r=s==40?41:s;for(let n=e+1,o=false;n=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){this.parts.push(e);return e.to}addDelimiter(e,t,s,r,n){return this.append(new Pi(e,t,s,(r?1:0)|(n?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof Pi&&(t.type==En||t.type==Ld))return true}return false}addElement(e){return this.append(e)}resolveMarkers(e){for(let s=e;s=e;l--){let m=this.parts[l];if(m instanceof Pi&&m.side&1&&m.type==r.type&&!(n&&(r.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let h=r.type.resolve,c=[];let d=a.from,u=r.to;if(n){let m=Math.min(2,a.to-a.from,o);d=a.to-m;u=r.from+m;h=m==1?"Emphasis":"StrongEmphasis"}if(a.type.mark)c.push(this.elt(a.type.mark,d,a.to));for(let m=l+1;m=0;t--){let s=this.parts[t];if(s instanceof Pi&&s.type==e&&s.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);this.parts.length=e;return t}getDelimiterAt(e){let t=this.parts[e];return t instanceof Pi?t:null}skipSpace(e){return yl(this.text,e-this.offset)+this.offset}elt(e,t,s,r){if(typeof e=="string")return Se(this.parser.getNodeType(e),t,s,r);return new P5(e,t)}}m0.linkStart=En;m0.imageStart=Ld;function sg(i,e){if(!e.length)return i;if(!i.length)return e;let t=i.slice(),s=0;for(let r of e){while(s(e?e-1:0))return false;if(this.fragmentEnd<0){let n=this.fragment.to;while(n>0&&this.input.read(n-1,n)!="\\n")n--;this.fragmentEnd=n?n-1:0}let s=this.cursor;if(!s){s=this.cursor=this.fragment.tree.cursor();s.firstChild()}let r=e+this.fragment.offset;while(s.to<=r)if(!s.parent())return false;for(;;){if(s.from>=r)return this.fragment.from<=t;if(!s.childAfter(r))return false}}matches(e){let t=this.cursor.tree;return t&&t.prop(ue.contextHash)==e}takeNodes(e){let t=this.cursor,s=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0);let n=e.absoluteLineStart,o=n,a=e.block.children.length;let l=o,h=a;for(;;){if(t.to-s>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=L5(t.from-s,e.ranges);if(t.to-s<=e.ranges[e.rangeI].to){e.addNode(t.tree,c)}else{let d=new _e(e.parser.nodeSet.types[Z.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(d,t.tree);e.addNode(d,c)}if(t.type.is("Block")){if(RM.indexOf(t.type.id)<0){o=t.to-s;a=e.block.children.length}else{o=l;a=h}l=t.to-s;h=e.block.children.length}if(!t.nextSibling())break}while(e.block.children.length>a){e.block.children.pop();e.block.positions.pop()}return o-n}}function L5(i,e){let t=i;for(let s=1;ssc[i]),Object.keys(sc).map(i=>x5[i]),Object.keys(sc),PM,m5,Object.keys(Df).map(i=>Df[i]),Object.keys(Df),[]);function BM(i,e,t){let s=[];for(let r=i.firstChild,n=e;;r=r.nextSibling){let o=r?r.from:t;if(o>n)s.push({from:n,to:o});if(!r)break;n=r.to}return s}function IM(i){let{codeParser:e,htmlParser:t}=i;let s=xx((r,n)=>{let o=r.type.id;if(e&&(o==Z.CodeBlock||o==Z.FencedCode)){let a="";if(o==Z.FencedCode){let h=r.node.getChild(Z.CodeInfo);if(h)a=n.read(h.from,h.to)}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==Z.CodeText,bracketed:o==Z.FencedCode}}else if(t&&(o==Z.HTMLBlock||o==Z.HTMLTag||o==Z.CommentBlock)){return{parser:t,overlay:BM(r.node,r.from,r.to)}}return null});return{wrap:s}}const DM={resolve:"Strikethrough",mark:"StrikethroughMark"};const zM={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":P.strikethrough}},{name:"StrikethroughMark",style:P.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let s=i.slice(t-1,t),r=i.slice(t+2,t+3);let n=/\\s|^$/.test(s),o=/\\s|^$/.test(r);let a=Vl.test(s),l=Vl.test(r);return i.addDelimiter(DM,t,t+2,!o&&(!l||n||a),!n&&(!a||o||l))},after:"Emphasis"}]};function bl(i,e,t=0,s,r=0){let n=0,o=true,a=-1,l=-1,h=false;let c=()=>{s.push(i.elt("TableCell",r+a,r+l,i.parser.parseInline(e.slice(a,l),r+a)))};for(let d=t;d-1)n++;o=false;if(s){if(a>-1)c();s.push(i.elt("TableDelimiter",d+r,d+r+1))}a=l=-1}else if(h||u!=32&&u!=9){if(a<0)a=d;l=d+1}h=!h&&u==92}if(a>-1){n++;if(s)c()}return n}function ny(i,e){for(let t=e;t\\s]*\\|?(\\s*:?-+:?\\s*\\|)+(\\s*:?-+:?\\s*)?$/;class oy{constructor(){this.rows=null}nextLine(e,t,s){if(this.rows==null){this.rows=false;let r;if((t.next==45||t.next==58||t.next==124)&&M5.test(r=t.text.slice(t.pos))){let n=[],o=bl(e,s.content,0,n,s.start);if(o==bl(e,r,0))this.rows=[e.elt("TableHeader",s.start,s.start+s.content.length,n),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)]}}else if(this.rows){let r=[];bl(e,t.text,t.pos,r,e.lineStart);this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return false}finish(e,t){if(!this.rows)return false;e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows));return true}}const WM={defineNodes:[{name:"Table",block:true},{name:"TableHeader",style:{"TableHeader/...":P.heading}},"TableRow",{name:"TableCell",style:P.content},{name:"TableDelimiter",style:P.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return ny(e.content,0)?new oy:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof oy)||!ny(e.text,e.basePos))return false;let s=i.peekLine();return M5.test(s)&&bl(i,e.text,e.basePos)==bl(i,s,e.basePos)},before:"SetextHeading"}]};class qM{nextLine(){return false}finish(e,t){e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)]));return true}}const XM={defineNodes:[{name:"Task",block:true,style:P.list},{name:"TaskMarker",style:P.atom}],parseBlock:[{name:"TaskList",leaf(i,e){return/^\\[[ xX]\\][ \\t]/.test(e.content)&&i.parentType().name=="ListItem"?new qM:null},after:"SetextHeading"}]};const ay=/(www\\.)|(https?:\\/\\/)|([\\w.+-]{1,100}@)|(mailto:|xmpp:)/gy;const ly=/[\\w-]+(\\.[\\w-]+)+(:\\d+)?(\\/[^\\s<]*)?/gy;const NM=/[\\w-]+\\.[\\w-]+($|[/:])/;const hy=/[\\w.+-]+@[\\w-]+(\\.[\\w.-]+)+/gy;const cy=/\\/[a-zA-Z\\d@.]+/gy;function dy(i,e,t,s){let r=0;for(let n=e;n-1)return-1;let s=e+t[0].length;for(;;){let r=i[s-1],n;if(/[?!.,:*_~]/.test(r)||r==")"&&dy(i,e,s,")")>dy(i,e,s,"("))s--;else if(r==";"&&(n=/&(?:#\\d+|#x[a-f\\d]+|\\w+);$/.exec(i.slice(e,s))))s=e+n.index;else break}return s}function uy(i,e){hy.lastIndex=e;let t=hy.exec(i);if(!t)return-1;let s=t[0][t[0].length-1];return s=="_"||s=="-"?-1:e+t[0].length-(s=="."?1:0)}const ZM={parseInline:[{name:"Autolink",parse(i,e,t){let s=t-i.offset;if(s&&/\\w/.test(i.text[s-1]))return-1;ay.lastIndex=s;let r=ay.exec(i.text),n=-1;if(!r)return-1;if(r[1]||r[2]){n=FM(i.text,s+r[0].length);if(n>-1&&i.hasOpenLink){let o=/([^\\[\\]]|\\[[^\\]]*\\])*/.exec(i.text.slice(s,n));n=s+o[0].length}}else if(r[3]){n=uy(i.text,s)}else{n=uy(i.text,s+r[0].length);if(n>-1&&r[0]=="xmpp:"){cy.lastIndex=n;r=cy.exec(i.text);if(r)n=r.index+r[0].length}}if(n<0)return-1;i.addElement(i.elt("URL",t,n+i.offset));return n+i.offset}}]};const UM=[WM,XM,zM,ZM];function B5(i,e,t){return(s,r,n)=>{if(r!=i||s.char(n+1)==i)return-1;let o=[s.elt(t,n,n+1)];for(let a=n+1;a"}}});const D5=new ue;const z5=MM.configure({props:[xr.add(i=>{return!i.is("Block")||i.is("Document")||rg(i)!=null||YM(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})}),D5.add(rg),wr.add({Document:()=>null}),Gr.add({Document:I5})]});function rg(i){let e=/^(?:ATX|Setext)Heading(\\d)$/.exec(i.name);return e?+e[1]:void 0}function YM(i){return i.name=="OrderedList"||i.name=="BulletList"}function GM(i,e){let t=i;for(;;){let s=t.nextSibling,r;if(!s||(r=rg(s.type))!=null&&r<=e)break;t=s}return t.to}const KM=Ex.of((i,e,t)=>{for(let s=We(i).resolveInner(t,-1);s;s=s.parent){if(s.fromt)return{from:t,to:n}}return null});function g0(i){return new Ei(I5,i,[],"markdown")}const JM=g0(z5);const e9=z5.configure([UM,HM,jM,VM,{props:[xr.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]);const Md=g0(e9);function t9(i,e){return t=>{if(t&&i){let s=null;t=/\\S*/.exec(t)[0];if(typeof i=="function")s=i(t);else s=xd.matchLanguageName(i,t,true);if(s instanceof xd)return s.support?s.support.language.parser:eo.getSkippingParser(s.load());else if(s)return s.parser}return e?e.parser:null}}let zf=class zU{constructor(e,t,s,r,n,o,a){this.node=e;this.from=t;this.to=s;this.spaceBefore=r;this.spaceAfter=n;this.type=o;this.item=a}blank(e,t=true){let s=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){while(s.length0;r--)s+=" ";return s+(t?this.spaceAfter:"")}}marker(e,t){let s=this.node.name=="OrderedList"?String(+q5(this.item,e)[2]+t):"";return this.spaceBefore+s+this.type+this.spaceAfter}};function W5(i,e){let t=[],s=[];for(let r=i;r;r=r.parent){if(r.name=="FencedCode")return s;if(r.name=="ListItem"||r.name=="Blockquote")t.push(r)}for(let r=t.length-1;r>=0;r--){let n=t[r],o;let a=e.lineAt(n.from),l=n.from-a.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l)))){s.push(new zf(n,l,l+o[0].length,"",o[1],">",null))}else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],c=o[0].length;if(h.length>=4){h=h.slice(0,h.length-4);c-=4}s.push(new zf(n.parent,l,l+c,o[1],h,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\\[[ xX]\\])?( +)/.exec(a.text.slice(l)))){let h=o[4],c=o[0].length;if(h.length>4){h=h.slice(0,h.length-4);c-=4}let d=o[2];if(o[3])d+=o[3].replace(/[xX]/," ");s.push(new zf(n.parent,l,l+c,o[1],h,d,n))}}return s}function q5(i,e){return/^(\\s*)(\\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function Wf(i,e,t,s=0){for(let r=-1,n=i;;){if(n.name=="ListItem"){let a=q5(n,e);let l=+a[2];if(r>=0){if(l!=r+1)return;t.push({from:n.from+a[1].length,to:n.from+a[0].length,insert:String(r+2+s)})}r=l}let o=n.nextSibling;if(!o)break;n=o}}function O0(i,e){let t=/^[ \\t]*/.exec(i)[0].length;if(!t||e.facet(ph)!=" ")return i;let s=Fs(i,4,t);let r="";for(let n=s;n>0;){if(n>=4){r+=" ";n-=4}else{r+=" ";n--}}return r+i.slice(t)}const i9=(i={})=>({state:e,dispatch:t})=>{let s=We(e),{doc:r}=e;let n=null,o=e.changeByRange(a=>{if(!a.empty||!Md.isActiveAt(e,a.from,-1)&&!Md.isActiveAt(e,a.from,1))return n={range:a};let l=a.from,h=r.lineAt(l);let c=W5(s.resolveInner(l,-1),r);while(c.length&&c[c.length-1].from>l-h.from)c.pop();if(!c.length)return n={range:a};let d=c[c.length-1];if(d.to-d.spaceAfter.length>l-h.from)return n={range:a};let u=l>=d.to-d.spaceAfter.length&&!/\\S/.test(h.text.slice(d.to));if(d.item&&u){if(d.item.from]*$/.test(h.text.slice(0,d.to)))return n={range:a};let v=d.node.firstChild,T=d.node.getChild("ListItem","ListItem");if(v.to>=l||T&&T.to0&&!/[^\\s>]/.test(r.lineAt(h.from-1).text)||i.nonTightLists===false){let k=c.length>1?c[c.length-2]:null;let _,C="";if(k&&k.item){_=h.from+k.from;C=k.marker(r,1)}else{_=h.from+(k?k.to:0)}let w=[{from:_,to:l,insert:C}];if(d.node.name=="OrderedList")Wf(d.item,r,w,-2);if(k&&k.node.name=="OrderedList")Wf(k.item,r,w);return{range:z.cursor(_+C.length),changes:w}}else{let k=py(c,e,h);return{range:z.cursor(l+k.length+1),changes:{from:h.from,insert:k+e.lineBreak}}}}if(d.node.name=="Blockquote"&&u&&h.from){let v=r.lineAt(h.from-1),T=/>\\s*$/.exec(v.text);if(T&&T.index==d.from){let k=e.changes([{from:v.from+T.index,to:v.to},{from:h.from+d.from,to:h.to}]);return{range:a.map(k),changes:k}}}let f=[];if(d.node.name=="OrderedList")Wf(d.item,r,f);let p=d.item&&d.item.from]*/.exec(h.text)[0].length>=d.to){for(let v=0,T=c.length-1;v<=T;v++){m+=v==T&&!p?c[v].marker(r,1):c[v].blank(vh.from&&/\\s/.test(h.text.charAt(O-h.from-1)))O--;m=O0(m,e);if(r9(d.node,e.doc))m=py(c,e,h)+e.lineBreak+m;f.push({from:O,to:l,insert:e.lineBreak+m});return{range:z.cursor(O+m.length+1),changes:f}});if(n)return false;t(e.update(o,{scrollIntoView:true,userEvent:"input"}));return true};const s9=i9();function fy(i){return i.name=="QuoteMark"||i.name=="ListMark"}function r9(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return false;let t=i.firstChild,s=i.getChild("ListItem","ListItem");if(!s)return false;let r=e.lineAt(t.to),n=e.lineAt(s.from);let o=/^[\\s>]*$/.test(r.text);return r.number+(o?0:1){let t=We(i);let s=null,r=i.changeByRange(n=>{let o=n.from,{doc:a}=i;if(n.empty&&Md.isActiveAt(i,n.from)){let l=a.lineAt(o);let h=W5(n9(t,o),a);if(h.length){let c=h[h.length-1];let d=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-l.from>d&&!/\\S/.test(l.text.slice(d,o-l.from)))return{range:z.cursor(l.from+d),changes:{from:l.from+d,to:o}};if(o-l.from==d&&(c.item&&l.from<=c.item.from||/^[\\s>]*$/.test(l.text.slice(0,c.to)))){let u=l.from+c.from;if(c.item&&c.node.from{var t;let{main:s}=e.state.selection;if(s.empty)return false;let r=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\\/\\/|mailto:|xmpp:|www\\.)/.test(r))return false;if(/^www\\./.test(r))r="https://"+r;if(!Md.isActiveAt(e.state,s.from,1))return false;let n=We(e.state),o=false;n.iterate({from:s.from,to:s.to,enter:a=>{if(a.from>s.from||d9.test(a.name))o=true},leave:a=>{if(a.to=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102}const uB=new at((i,e)=>{let t;if(i.next<0){i.acceptToken(g9)}else if(e.context.flags&Wc){if(Xf(i.next))i.acceptToken(m9,1)}else if(((t=i.peek(-1))<0||Xf(t))&&e.canShift(my)){let s=0;while(i.next==_0||i.next==Su){i.advance();s++}if(i.next==ro||i.next==Yl||i.next==v0)i.acceptToken(my,-s)}else if(Xf(i.next)){i.acceptToken(p9,1)}},{contextual:true});const fB=new at((i,e)=>{let t=e.context;if(t.flags)return;let s=i.peek(-1);if(s==ro||s==Yl){let r=0,n=0;for(;;){if(i.next==_0)r++;else if(i.next==Su)r+=8-r%8;else break;i.advance();n++}if(r!=t.indent&&i.next!=ro&&i.next!=Yl&&i.next!=v0){if(r[i,e|V5]));const gB=new yu({start:pB,reduce(i,e,t,s){if(i.flags&Wc&&dB.has(e)||(e==A9||e==U5)&&i.flags&V5)return i.parent;return i},shift(i,e,t,s){if(e==N5)return new qc(i,mB(s.read(s.pos,t.pos)),0);if(e==F5)return i.parent;if(e==v9||e==w9||e==C9||e==Z5)return new qc(i,0,Wc);if(vy.has(e))return new qc(i,0,vy.get(e)|i.flags&Wc);return i},hash(i){return i.hash}});const OB=new at(i=>{for(let e=0;e<5;e++){if(i.next!="print".charCodeAt(e))return;i.advance()}if(/\\w/.test(String.fromCharCode(i.next)))return;for(let e=0;;e++){let t=i.peek(e);if(t==_0||t==Su)continue;if(t!=rB&&t!=nB&&t!=ro&&t!=Yl&&t!=v0)i.acceptToken(f9);return}});const _B=new at((i,e)=>{let{flags:t}=e.context;let s=t&sr?H5:j5;let r=(t&rr)>0;let n=!(t&nr);let o=(t&or)>0;let a=i.pos;for(;;){if(i.next<0){break}else if(o&&i.next==ng){if(i.peek(1)==ng){i.advance(2)}else{if(i.pos==a){i.acceptToken(Z5,1);return}break}}else if(n&&i.next==_y){if(i.pos==a){i.advance();let l=i.next;if(l>=0){i.advance();vB(i,l)}i.acceptToken(_9);return}break}else if(i.next==_y&&!n&&i.peek(1)>-1){i.advance(2)}else if(i.next==s&&(!r||i.peek(1)==s&&i.peek(2)==s)){if(i.pos==a){i.acceptToken(gy,r?3:1);return}break}else if(i.next==ro){if(r){i.advance()}else if(i.pos==a){i.acceptToken(gy);return}break}else{i.advance()}}if(i.pos>a)i.acceptToken(O9)});function vB(i,e){if(e==oB){for(let t=0;t<2&&i.next>=48&&i.next<=55;t++)i.advance()}else if(e==aB){for(let t=0;t<2&&Nf(i.next);t++)i.advance()}else if(e==hB){for(let t=0;t<4&&Nf(i.next);t++)i.advance()}else if(e==cB){for(let t=0;t<8&&Nf(i.next);t++)i.advance()}else if(e==lB){if(i.next==ng){i.advance();while(i.next>=0&&i.next!=Oy&&i.next!=j5&&i.next!=H5&&i.next!=ro)i.advance();if(i.next==Oy)i.advance()}}}const yB=Sr({'async "*" "**" FormatConversion FormatSpec':P.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":P.controlKeyword,"in not and or is del":P.operatorKeyword,"from def class global nonlocal lambda":P.definitionKeyword,import:P.moduleKeyword,"with as print":P.keyword,Boolean:P.bool,None:P.null,VariableName:P.variableName,"CallExpression/VariableName":P.function(P.variableName),"FunctionDefinition/VariableName":P.function(P.definition(P.variableName)),"ClassDefinition/VariableName":P.definition(P.className),PropertyName:P.propertyName,"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),Comment:P.lineComment,Number:P.number,String:P.string,FormatString:P.special(P.string),Escape:P.escape,UpdateOp:P.updateOperator,"ArithOp!":P.arithmeticOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,AssignOp:P.definitionOperator,Ellipsis:P.punctuation,At:P.meta,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,".":P.derefOperator,", ;":P.separator});const bB={__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};const SB=vr.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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ZO#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:[OB,fB,uB,_B,0,1,2,3,4],topRules:{"Script":[0,5]},specialized:[{term:221,get:i=>bB[i]||-1}],tokenPrec:7668});const yy=new HO;const Y5=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function nc(i){return(e,t,s)=>{if(s)return false;let r=e.node.getChild("VariableName");if(r)t(r,i);return true}}const wB={FunctionDefinition:nc("function"),ClassDefinition:nc("class"),ForStatement(i,e,t){if(t)for(let s=i.node.firstChild;s;s=s.nextSibling){if(s.name=="VariableName")e(s,"variable");else if(s.name=="in")break}},ImportStatement(i,e){var t,s;let{node:r}=i;let n=((t=r.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=r.getChild("import");o;o=o.nextSibling){if(o.name=="VariableName"&&((s=o.nextSibling)===null||s===void 0?void 0:s.name)!="as")e(o,n?"variable":"namespace")}},AssignStatement(i,e){for(let t=i.node.firstChild;t;t=t.nextSibling){if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break}},ParamList(i,e){for(let t=null,s=i.node.firstChild;s;s=s.nextSibling){if(s.name=="VariableName"&&(!t||!/\\*|AssignOp/.test(t.name)))e(s,"variable");t=s}},CapturePattern:nc("variable"),AsPattern:nc("variable"),__proto__:null};function G5(i,e){let t=yy.get(e);if(t)return t;let s=[],r=true;function n(o,a){let l=i.sliceString(o.from,o.to);s.push({label:l,type:a})}e.cursor(Ee.IncludeAnonymous).iterate(o=>{if(o.name){let a=wB[o.name];if(a&&a(o,n,r)||!r&&Y5.has(o.name))return false;r=false}else if(o.to-o.from>8192){for(let a of G5(i,o.node))s.push(a);return false}});yy.set(e,s);return s}const by=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/;const K5=["String","FormatString","Comment","PropertyName"];function xB(i){let e=We(i.state).resolveInner(i.pos,-1);if(K5.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&by.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent){if(Y5.has(r.name))s=s.concat(G5(i.state.doc,r))}return{options:s,from:t?e.from:i.pos,validFor:by}}const kB=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(i=>({label:i,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(i=>({label:i,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(i=>({label:i,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(i=>({label:i,type:"function"})));const CB=[Ke("def \${name}(\${params}):\\n \${}",{label:"def",detail:"function",type:"keyword"}),Ke("for \${name} in \${collection}:\\n \${}",{label:"for",detail:"loop",type:"keyword"}),Ke("while \${}:\\n \${}",{label:"while",detail:"loop",type:"keyword"}),Ke("try:\\n \${}\\nexcept \${error}:\\n \${}",{label:"try",detail:"/ except block",type:"keyword"}),Ke("if \${}:\\n \\n",{label:"if",detail:"block",type:"keyword"}),Ke("if \${}:\\n \${}\\nelse:\\n \${}",{label:"if",detail:"/ else block",type:"keyword"}),Ke("class \${name}:\\n def __init__(self, \${params}):\\n \${}",{label:"class",detail:"definition",type:"keyword"}),Ke("import \${module}",{label:"import",detail:"statement",type:"keyword"}),Ke("from \${module} import \${names}",{label:"from",detail:"import",type:"keyword"})];const TB=jk(K5,Uk(kB.concat(CB)));function Ff(i){let{node:e,pos:t}=i;let s=i.lineIndent(t,-1);let r=null;for(;;){let n=e.childBefore(t);if(!n){break}else if(n.name=="Comment"){t=n.from}else if(n.name=="Body"||n.name=="MatchBody"){if(i.baseIndentFor(n)+i.unit<=s)r=n;e=n}else if(n.name=="MatchClause"){e=n}else if(n.type.is("Statement")){e=n}else{break}}return r}function Zf(i,e){let t=i.baseIndentFor(e);let s=i.lineAt(i.pos,-1),r=s.from+s.text.length;if(/^\\s*($|#)/.test(s.text)&&i.node.tot)return null;return t+i.unit}const Uf=_r.define({name:"python",parser:SB.configure({props:[wr.add({Body:i=>{var e;let t=/^\\s*(#|$)/.test(i.textAfter)&&Ff(i)||i.node;return(e=Zf(i,t))!==null&&e!==void 0?e:i.continue()},MatchBody:i=>{var e;let t=Ff(i);return(e=Zf(i,t||i.node))!==null&&e!==void 0?e:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),"ForStatement WhileStatement":i=>/^\\s*else:/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except[ :]|finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),MatchStatement:i=>{if(/^\\s*case /.test(i.textAfter))return i.baseIndent+i.unit;return i.continue()},"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Ho({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Ho({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Ho({closing:"]"}),MemberExpression:i=>i.baseIndent+i.unit,"String FormatString":()=>null,Script:i=>{var e;let t=Ff(i);return(e=t&&Zf(i,t))!==null&&e!==void 0?e:i.continue()}}),xr.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":mh,Body:(i,e)=>({from:i.from+1,to:i.to-(i.to==e.doc.length?0:1)}),"String FormatString":(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.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 PB(){return new pn(Uf,[Uf.data.of({autocomplete:xB}),Uf.data.of({autocomplete:TB})])}const Qo=63;const Sy=64;const $B=1;const EB=2;const J5=3;const QB=4;const eC=5;const RB=6;const AB=7;const tC=65;const LB=66;const MB=8;const BB=9;const IB=10;const DB=11;const zB=12;const iC=13;const WB=19;const qB=20;const XB=29;const NB=33;const FB=34;const ZB=47;const UB=0;const y0=1;const og=2;const Gl=3;const ag=4;class Qn{constructor(e,t,s){this.parent=e;this.depth=t;this.type=s;this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+s}}Qn.top=new Qn(null,-1,UB);function Sl(i,e){for(let t=0,s=e-i.pos-1;;s--,t++){let r=i.peek(s);if(yr(r)||r==-1)return t}}function lg(i){return i==32||i==9}function yr(i){return i==10||i==13}function sC(i){return lg(i)||yr(i)}function In(i){return i<0||sC(i)}const jB=new yu({start:Qn.top,reduce(i,e){return i.type==Gl&&(e==qB||e==FB)?i.parent:i},shift(i,e,t,s){if(e==J5)return new Qn(i,Sl(s,s.pos),y0);if(e==tC||e==eC)return new Qn(i,Sl(s,s.pos),og);if(e==Qo)return i.parent;if(e==WB||e==NB)return new Qn(i,0,Gl);if(e==iC&&i.type==ag)return i.parent;if(e==ZB){let r=/[1-9]/.exec(s.read(s.pos,t.pos));if(r)return new Qn(i,i.depth+ +r[0],ag)}return i},hash(i){return i.hash}});function ca(i,e,t=0){return i.peek(t)==e&&i.peek(t+1)==e&&i.peek(t+2)==e&&In(i.peek(t+3))}const HB=new at((i,e)=>{if(i.next==-1&&e.canShift(Sy))return i.acceptToken(Sy);let t=i.peek(-1);if((yr(t)||t<0)&&e.context.type!=Gl){if(ca(i,45)){if(e.canShift(Qo))i.acceptToken(Qo);else return i.acceptToken($B,3)}if(ca(i,46)){if(e.canShift(Qo))i.acceptToken(Qo);else return i.acceptToken(EB,3)}let s=0;while(i.next==32){s++;i.advance()}if((s{if(e.context.type==Gl){if(i.next==63){i.advance();if(In(i.next))i.acceptToken(AB)}return}if(i.next==45){i.advance();if(In(i.next))i.acceptToken(e.context.type==y0&&e.context.depth==Sl(i,i.pos-1)?QB:J5)}else if(i.next==63){i.advance();if(In(i.next))i.acceptToken(e.context.type==og&&e.context.depth==Sl(i,i.pos-1)?RB:eC)}else{let t=i.pos;for(;;){if(lg(i.next)){if(i.pos==t)return;i.advance()}else if(i.next==33){rC(i)}else if(i.next==38){hg(i)}else if(i.next==42){hg(i);break}else if(i.next==39||i.next==34){if(b0(i,true))break;return}else if(i.next==91||i.next==123){if(!GB(i))return;break}else{nC(i,true,false,0);break}}while(lg(i.next))i.advance();if(i.next==58){if(i.pos==t&&e.canShift(XB))return;let s=i.peek(1);if(In(s))i.acceptTokenTo(e.context.type==og&&e.context.depth==Sl(i,t)?LB:tC,t)}}},{contextual:true});function YB(i){return i>32&&i<127&&i!=34&&i!=37&&i!=44&&i!=60&&i!=62&&i!=92&&i!=94&&i!=96&&i!=123&&i!=124&&i!=125}function wy(i){return i>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70}function xy(i,e){if(i.next==37){i.advance();if(wy(i.next))i.advance();if(wy(i.next))i.advance();return true}else if(YB(i.next)||e&&i.next==44){i.advance();return true}return false}function rC(i){i.advance();if(i.next==60){i.advance();for(;;){if(!xy(i,true)){if(i.next==62)i.advance();break}}}else{while(xy(i,false)){}}}function hg(i){i.advance();while(!In(i.next)&&Bd(i.next)!="f")i.advance()}function b0(i,e){let t=i.next,s=false,r=i.pos;i.advance();for(;;){let n=i.next;if(n<0)break;i.advance();if(n==t){if(n==39){if(i.next==39)i.advance();else break}else{break}}else if(n==92&&t==34){if(i.next>=0)i.advance()}else if(yr(n)){if(e)return false;s=true}else if(e&&i.pos>=r+1024){return false}}return!s}function GB(i){for(let e=[],t=i.pos+1024;;){if(i.next==91||i.next==123){e.push(i.next);i.advance()}else if(i.next==39||i.next==34){if(!b0(i,true))return false}else if(i.next==93||i.next==125){if(e[e.length-1]!=i.next-2)return false;e.pop();i.advance();if(!e.length)return true}else if(i.next<0||i.pos>t||yr(i.next)){return false}else{i.advance()}}}const KB="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Bd(i){if(i<33)return"u";if(i>125)return"s";return KB[i-33]}function jf(i,e){let t=Bd(i);return t!="u"&&!(e&&t=="f")}function nC(i,e,t,s){if(Bd(i.next)=="s"||(i.next==63||i.next==58||i.next==45)&&jf(i.peek(1),t)){i.advance()}else{return false}let r=i.pos;for(;;){let n=i.next,o=0,a=s+1;while(sC(n)){if(yr(n)){if(e)return false;a=0}else{a++}n=i.peek(++o)}let l=n>=0&&(n==58?jf(i.peek(o+1),t):n==35?i.peek(o-1)!=32:jf(n,t));if(!l||!t&&a<=s||a==0&&!t&&(ca(i,45,o)||ca(i,46,o)))break;if(e&&Bd(n)=="f")return false;for(let h=o;h>=0;h--)i.advance();if(e&&i.pos>r+1024)return false}return true}const JB=new at((i,e)=>{if(i.next==33){rC(i);i.acceptToken(zB)}else if(i.next==38||i.next==42){let t=i.next==38?IB:DB;hg(i);i.acceptToken(t)}else if(i.next==39||i.next==34){b0(i,false);i.acceptToken(BB)}else if(nC(i,false,e.context.type==Gl,e.context.depth)){i.acceptToken(MB)}});const eI=new at((i,e)=>{let t=e.context.type==ag?e.context.depth:-1,s=i.pos;e:for(;;){let r=0,n=i.next;while(n==32)n=i.peek(++r);if(!r&&(ca(i,45,r)||ca(i,46,r)))break;if(!yr(n)){if(t<0)t=Math.max(e.context.depth+1,r);if(rYAN>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#|OWROXROYeOZf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#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:jB,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[tI],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:[HB,VB,JB,eI,0,1],topRules:{"Stream":[0,15]},tokenPrec:0});const sI=_r.define({name:"yaml",parser:iI.configure({props:[wr.add({Stream:i=>{for(let e=i.node.resolve(i.pos,-1);e&&e.to>=i.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromi.pos)return null}}return null},FlowMapping:Ho({closing:"}"}),FlowSequence:Ho({closing:"]"})}),xr.add({"FlowMapping FlowSequence":mh,"Item Pair BlockLiteral":(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\\s*[\\]\\}]$/}});function rI(){return new pn(sI)}const ky=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class da{constructor(e,t,s=0,r=e.length,n,o){this.test=o;this.value={from:0,to:0,precise:false};this.done=false;this.matches=[];this.buffer="";this.bufferPos=0;this.iter=e.iterRange(s,r);this.bufferStart=s;this.normalize=n?a=>n(ky(a)):ky;this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){this.bufferStart+=this.buffer.length;this.iter.next();if(this.iter.done)return-1;this.bufferPos=0;this.buffer=this.iter.value}return Jw(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0){this.done=true;return this}let t=AE(e),s=this.bufferStart+this.bufferPos;this.bufferPos+=e2(e);let r=this.normalize(t);if(r.length)for(let n=0,o=s,a=true;;n++){let l=r.charCodeAt(n);let h=this.match(l,o,a,this.bufferPos+this.bufferStart,n==r.length-1);if(h){this.value=h;return this}if(n==r.length-1)break;if(a&&nthis.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1;if(this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let s=this.curLineStart+t.index,r=s+t[0].length;this.matchPos=Id(this.text,r+(s==r?1:0));if(s==this.curLineStart+this.curLine.length)this.nextLine();if((sthis.value.to)&&(!this.test||this.test(s,r,t))){this.value={from:s,to:r,precise:true,match:t};return this}e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=s||r.to<=t){let a=new Go(t,e.sliceString(t,s));Hf.set(e,a);return a}if(r.from==t&&r.to==s)return r;let{text:n,from:o}=r;if(o>t){n=e.sliceString(t,o)+n;o=t}if(r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from;let t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e){this.re.lastIndex=e+1;t=this.re.exec(this.flat.text)}if(t){let s=this.flat.from+t.index,r=s+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,r,t))){this.value={from:s,to:r,precise:true,match:t};this.matchPos=Id(this.text,r+(s==r?1:0));return this}}if(this.flat.to==this.to){this.done=true;return this}this.flat=Go.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol!="undefined"){aC.prototype[Symbol.iterator]=lC.prototype[Symbol.iterator]=function(){return this}}function nI(i){try{new RegExp(i,S0);return true}catch(e){return false}}function Id(i,e){if(e>=i.length)return e;let t=i.lineAt(e),s;while(e=56320&&s<57344)e++;return e}const oI=i=>{let{state:e}=i;let t=String(e.doc.lineAt(i.state.selection.main.head).number);let{close:s,result:r}=eR(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:true,submitLabel:e.phrase("go")});r.then(n=>{let o=n&&/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(n.elements["line"].value);if(!o){i.dispatch({effects:s});return}let a=e.doc.lineAt(e.selection.main.head);let[,l,h,c,d]=o;let u=c?+c.slice(1):0;let f=h?+h:a.number;if(h&&d){let O=f/100;if(l)O=O*(l=="-"?-1:1)+a.number/e.doc.lines;f=Math.round(e.doc.lines*O)}else if(h&&l){f=f*(l=="-"?-1:1)+a.number}let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f)));let m=z.cursor(p.from+Math.max(0,Math.min(u,p.length)));i.dispatch({effects:[s,J.scrollIntoView(m.from,{y:"center"})],selection:m})});return true};const aI={highlightWordAroundCursor:false,minSelectionLength:1,maxMatches:100,wholeWords:false};const lI=te.define({combine(i){return co(i,aI,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function hI(i){let e=[pI,fI];return e}const cI=fe.mark({class:"cm-selectionMatch"});const dI=fe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Cy(i,e,t,s){return(t==0||i(e.sliceDoc(t-1,t))!=ot.Word)&&(s==e.doc.length||i(e.sliceDoc(s,s+1))!=ot.Word)}function uI(i,e,t,s){return i(e.sliceDoc(t,t+1))==ot.Word&&i(e.sliceDoc(s-1,s))==ot.Word}const fI=Kt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){if(i.selectionSet||i.docChanged||i.viewportChanged)this.decorations=this.getDeco(i.view)}getDeco(i){let e=i.state.facet(lI);let{state:t}=i,s=t.selection;if(s.ranges.length>1)return fe.none;let r=s.main,n,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return fe.none;let l=t.wordAt(r.head);if(!l)return fe.none;o=t.charCategorizer(r.head);n=t.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return fe.none;if(e.wholeWords){n=t.sliceDoc(r.from,r.to);o=t.charCategorizer(r.head);if(!(Cy(o,t,r.from,r.to)&&uI(o,t,r.from,r.to)))return fe.none}else{n=t.sliceDoc(r.from,r.to);if(!n)return fe.none}}let a=[];for(let l of i.visibleRanges){let h=new da(t.doc,n,l.from,l.to);while(!h.next().done){let{from:c,to:d}=h.value;if(!o||Cy(o,t,c,d)){if(r.empty&&c<=r.from&&d>=r.to)a.push(dI.range(c,d));else if(c>=r.to||d<=r.from)a.push(cI.range(c,d));if(a.length>e.maxMatches)return fe.none}}}return fe.set(a)}},{decorations:i=>i.decorations});const pI=J.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const mI=({state:i,dispatch:e})=>{let{selection:t}=i;let s=z.create(t.ranges.map(r=>i.wordAt(r.head)||z.cursor(r.head)),t.mainIndex);if(s.eq(t))return false;e(i.update({selection:s}));return true};function gI(i,e){let{main:t,ranges:s}=i.selection;let r=i.wordAt(t.head),n=r&&r.from==t.from&&r.to==t.to;for(let o=false,a=new da(i.doc,e,s[s.length-1].to);;){a.next();if(a.done){if(o)return null;a=new da(i.doc,e,0,Math.max(0,s[s.length-1].from-1));o=true}else{if(o&&s.some(l=>l.from==a.value.from))continue;if(n){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}}const OI=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(n=>n.from===n.to))return mI({state:i,dispatch:e});let s=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(n=>i.sliceDoc(n.from,n.to)!=s))return false;let r=gI(i,s);if(!r)return false;e(i.update({selection:i.selection.addRange(z.range(r.from,r.to),false),effects:J.scrollIntoView(r.to)}));return true};const fo=te.define({combine(i){return co(i,{top:false,caseSensitive:false,literal:false,regexp:false,wholeWord:false,createPanel:e=>new RI(e),scrollToMatch:e=>J.scrollIntoView(e)})}});function _I(i){return i?[fo.of(i),dg]:dg}class hC{constructor(e){this.search=e.search;this.caseSensitive=!!e.caseSensitive;this.literal=!!e.literal;this.regexp=!!e.regexp;this.replace=e.replace||"";this.valid=!!this.search&&(!this.regexp||nI(this.search));this.unquoted=this.unquote(this.search);this.wholeWord=!!e.wholeWord;this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\\\([nrt\\\\])/g,(t,s)=>s=="n"?"\\n":s=="r"?"\\r":s=="t"?" ":"\\\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new xI(this):new bI(this)}getCursor(e,t=0,s){let r=e.doc?e:we.create({doc:e});if(s==null)s=r.doc.length;return this.regexp?Ao(this,r,t,s):Ro(this,r,t,s)}}class cC{constructor(e){this.spec=e}}function vI(i,e,t){return(s,r,n,o)=>{if(t&&!t(s,r,n,o))return false;let a=s>=o&&r<=o+n.length?n.slice(s-o,r-o):e.doc.sliceString(s,r);return i(a,e,s,r)}}function Ro(i,e,t,s){let r;if(i.wholeWord)r=yI(e.doc,e.charCategorizer(e.selection.main.head));if(i.test)r=vI(i.test,e,r);return new da(e.doc,i.unquoted,t,s,i.caseSensitive?void 0:n=>n.toLowerCase(),r)}function yI(i,e){return(t,s,r,n)=>{if(n>t||n+r.length=t)return null;r.push(s.value)}return r}highlight(e,t,s,r){let n=Ro(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,e.doc.length));while(!n.next().done)r(n.value.from,n.value.to)}}function SI(i,e,t){return(s,r,n)=>{return(!t||t(s,r,n))&&i(n[0],e,s,r)}}function Ao(i,e,t,s){let r;if(i.wholeWord)r=wI(e.charCategorizer(e.selection.main.head));if(i.test)r=SI(i.test,e,r);return new aC(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:r},t,s)}function Dd(i,e){return i.slice(Rt(i,e,false),e)}function zd(i,e){return i.slice(e,Rt(i,e))}function wI(i){return(e,t,s)=>!s[0].length||(i(Dd(s.input,s.index))!=ot.Word||i(zd(s.input,s.index))!=ot.Word)&&(i(zd(s.input,s.index+s[0].length))!=ot.Word||i(Dd(s.input,s.index+s[0].length))!=ot.Word)}class xI extends cC{nextMatch(e,t,s){let r=Ao(this.spec,e,s,e.doc.length).next();if(r.done)r=Ao(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,s){for(let r=1;;r++){let n=Math.max(t,s-r*1e4);let o=Ao(this.spec,e,n,s),a=null;while(!o.next().done)a=o.value;if(a&&(n==t||a.from>n+10))return a;if(n==t)return null}}prevMatch(e,t,s){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,s,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\\$([$&]|\\d+)/g,(t,s)=>{if(s=="&")return e.match[0];if(s=="$")return"$";for(let r=s.length;r>0;r--){let n=+s.slice(0,r);if(n>0&&n=t)return null;r.push(s.value)}return r}highlight(e,t,s,r){let n=Ao(this.spec,e,Math.max(0,t-250),Math.min(s+250,e.doc.length));while(!n.next().done)r(n.value.from,n.value.to)}}const Kl=Ce.define();const w0=Ce.define();const Jr=ji.define({create(i){return new Vf(cg(i).create(),null)},update(i,e){for(let t of e.effects){if(t.is(Kl))i=new Vf(t.value.create(),i.panel);else if(t.is(w0))i=new Vf(i.query,t.value?x0:null)}return i},provide:i=>bd.from(i,e=>e.panel)});class Vf{constructor(e,t){this.query=e;this.panel=t}}const kI=fe.mark({class:"cm-searchMatch"});const CI=fe.mark({class:"cm-searchMatch cm-searchMatch-selected"});const TI=Kt.fromClass(class{constructor(i){this.view=i;this.decorations=this.highlight(i.state.field(Jr))}update(i){let e=i.state.field(Jr);if(e!=i.startState.field(Jr)||i.docChanged||i.selectionSet||i.viewportChanged)this.decorations=this.highlight(e)}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return fe.none;let{view:t}=this;let s=new Yn;for(let r=0,n=t.visibleRanges,o=n.length;rn[r+1].from-2*250)l=n[++r].to;i.highlight(t.state,a,l,(h,c)=>{let d=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);s.add(h,c,d?CI:kI)})}return s.finish()}},{decorations:i=>i.decorations});function vh(i){return e=>{let t=e.state.field(Jr,false);return t&&t.query.spec.valid?i(e,t):fC(e)}}const Wd=vh((i,{query:e})=>{let{to:t}=i.state.selection.main;let s=e.nextMatch(i.state,t,t);if(!s)return false;let r=z.single(s.from,s.to);let n=i.state.facet(fo);i.dispatch({selection:r,effects:[k0(i,s),n.scrollToMatch(r.main,i)],userEvent:"select.search"});uC(i);return true});const qd=vh((i,{query:e})=>{let{state:t}=i,{from:s}=t.selection.main;let r=e.prevMatch(t,s,s);if(!r)return false;let n=z.single(r.from,r.to);let o=i.state.facet(fo);i.dispatch({selection:n,effects:[k0(i,r),o.scrollToMatch(n.main,i)],userEvent:"select.search"});uC(i);return true});const PI=vh((i,{query:e})=>{let t=e.matchAll(i.state,1e3);if(!t||!t.length)return false;i.dispatch({selection:z.create(t.map(s=>z.range(s.from,s.to))),userEvent:"select.search.matches"});return true});const $I=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return false;let{from:s,to:r}=t.main;let n=[],o=0;for(let a=new da(i.doc,i.sliceDoc(s,r));!a.next().done;){if(n.length>1e3)return false;if(a.value.from==s)o=n.length;n.push(z.range(a.value.from,a.value.to))}e(i.update({selection:z.create(n,o),userEvent:"select.search.matches"}));return true};const Ty=vh((i,{query:e})=>{let{state:t}=i,{from:s,to:r}=t.selection.main;if(t.readOnly)return false;let n=e.nextMatch(t,s,s);if(!n)return false;let o=n;let a=[],l,h;let c=[];if(!o.precise){o=e.nextMatch(t,o.from,o.to)}else if(o.from==s&&o.to==r){h=t.toText(e.getReplacement(o));a.push({from:o.from,to:o.to,insert:h});o=e.nextMatch(t,o.from,o.to);c.push(J.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(s).number)+"."))}let d=i.state.changes(a);if(o){l=z.single(o.from,o.to).map(d);c.push(k0(i,o));c.push(t.facet(fo).scrollToMatch(l.main,i))}i.dispatch({changes:d,selection:l,effects:c,userEvent:"input.replace"});return true});const EI=vh((i,{query:e})=>{if(i.state.readOnly)return false;let t=[];for(let r of e.matchAll(i.state,1e9)){let{from:n,to:o,precise:a}=r;if(a)t.push({from:n,to:o,insert:e.getReplacement(r)})}if(!t.length)return false;let s=i.state.phrase("replaced $ matches",t.length)+".";i.dispatch({changes:t,effects:J.announce.of(s),userEvent:"input.replace.all"});return true});function x0(i){return i.state.facet(fo).createPanel(i)}function cg(i,e){var t,s,r,n,o;let a=i.selection.main;let l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!l)return e;let h=i.facet(fo);return new hC({search:((t=e===null||e===void 0?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?l:l.replace(/\\n/g,"\\\\n"),caseSensitive:(s=e===null||e===void 0?void 0:e.caseSensitive)!==null&&s!==void 0?s:h.caseSensitive,literal:(r=e===null||e===void 0?void 0:e.literal)!==null&&r!==void 0?r:h.literal,regexp:(n=e===null||e===void 0?void 0:e.regexp)!==null&&n!==void 0?n:h.regexp,wholeWord:(o=e===null||e===void 0?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function dC(i){let e=px(i,x0);return e&&e.dom.querySelector("[main-field]")}function uC(i){let e=dC(i);if(e&&e==i.root.activeElement)e.select()}const fC=i=>{let e=i.state.field(Jr,false);if(e&&e.panel){let t=dC(i);if(t&&t!=i.root.activeElement){let s=cg(i.state,e.query.spec);if(s.valid)i.dispatch({effects:Kl.of(s)});t.focus();t.select()}}else{i.dispatch({effects:[w0.of(true),e?Kl.of(cg(i.state,e.query.spec)):Ce.appendConfig.of(dg)]})}return true};const pC=i=>{let e=i.state.field(Jr,false);if(!e||!e.panel)return false;let t=px(i,x0);if(t&&t.dom.contains(i.root.activeElement))i.focus();i.dispatch({effects:w0.of(false)});return true};const QI=[{key:"Mod-f",run:fC,scope:"editor search-panel"},{key:"F3",run:Wd,shift:qd,scope:"editor search-panel",preventDefault:true},{key:"Mod-g",run:Wd,shift:qd,scope:"editor search-panel",preventDefault:true},{key:"Escape",run:pC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:$I},{key:"Mod-Alt-g",run:oI},{key:"Mod-d",run:OI,preventDefault:true}];class RI{constructor(e){this.view=e;let t=this.query=e.state.field(Jr).query.spec;this.commit=this.commit.bind(this);this.searchField=wt("input",{value:t.search,placeholder:Si(e,"Find"),"aria-label":Si(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit});this.replaceField=wt("input",{value:t.replace,placeholder:Si(e,"Replace"),"aria-label":Si(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit});this.caseField=wt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit});this.reField=wt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit});this.wordField=wt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function s(r,n,o){return wt("button",{class:"cm-button",name:r,onclick:n,type:"button"},o)}this.dom=wt("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>Wd(e),[Si(e,"next")]),s("prev",()=>qd(e),[Si(e,"previous")]),s("select",()=>PI(e),[Si(e,"all")]),wt("label",null,[this.caseField,Si(e,"match case")]),wt("label",null,[this.reField,Si(e,"regexp")]),wt("label",null,[this.wordField,Si(e,"by word")]),...e.state.readOnly?[]:[wt("br"),this.replaceField,s("replace",()=>Ty(e),[Si(e,"replace")]),s("replaceAll",()=>EI(e),[Si(e,"replace all")])],wt("button",{name:"close",onclick:()=>pC(e),"aria-label":Si(e,"close"),type:"button"},["×"])])}commit(){let e=new hC({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query)){this.query=e;this.view.dispatch({effects:Kl.of(e)})}}keydown(e){if(AQ(this.view,e,"search-panel")){e.preventDefault()}else if(e.keyCode==13&&e.target==this.searchField){e.preventDefault();(e.shiftKey?qd:Wd)(this.view)}else if(e.keyCode==13&&e.target==this.replaceField){e.preventDefault();Ty(this.view)}}update(e){for(let t of e.transactions)for(let s of t.effects){if(s.is(Kl)&&!s.value.eq(this.query))this.setQuery(s.value)}}setQuery(e){this.query=e;this.searchField.value=e.search;this.replaceField.value=e.replace;this.caseField.checked=e.caseSensitive;this.reField.checked=e.regexp;this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(fo).top}}function Si(i,e){return i.state.phrase(e)}const oc=30;const ac=/[\\s\\.,:;?!]/;function k0(i,{from:e,to:t}){let s=i.state.doc.lineAt(e),r=i.state.doc.lineAt(t).to;let n=Math.max(s.from,e-oc),o=Math.min(r,t+oc);let a=i.state.sliceDoc(n,o);if(n!=s.from){for(let l=0;la.length-oc;l--)if(!ac.test(a[l-1])&&ac.test(a[l])){a=a.slice(0,l);break}}return J.announce.of(\`\${i.state.phrase("current match")}. \${a} \${i.state.phrase("on line")} \${s.number}.\`)}const AI=J.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"}});const dg=[Jr,ho.low(TI),AI];function LI(i){mC(i,"start");var e={},t=i.languageData||{},s=false;for(var r in i)if(r!=t&&i.hasOwnProperty(r)){var n=e[r]=[],o=i[r];for(var a=0;a2&&o.token&&typeof o.token!="string"){t.pending=[];for(var h=2;h-1)return null;var r=t.indent.length-1,n=i[t.state];e:for(;;){for(var o=0;o1)i.eat("$");var t=i.next();if(/['"({]/.test(t)){e.tokens[0]=xu(t,t=="("?"quote":t=="{"?"def":"string");return ua(i,e)}if(!/\\d/.test(t))i.eatWhile(/\\w/);e.tokens.shift();return"def"};function rD(i){return function(e,t){if(e.sol()&&e.string==i)t.tokens.shift();e.skipToEnd();return"string.special"}}function ua(i,e){return(e.tokens[0]||iD)(i,e)}const nD={name:"shell",startState:function(){return{tokens:[]}},token:function(i,e){return ua(i,e)},languageData:{autocomplete:yC.concat(bC,SC),closeBrackets:{brackets:["(","[","{","'",'"',"\`"]},commentTokens:{line:"#"}}};const oD={name:"toml",startState:function(){return{inString:false,stringType:"",lhs:true,inArray:0}},token:function(i,e){let t;if(!e.inString&&(t=i.match(/^('''|"""|'|")/))){e.stringType=t[0];e.inString=true}if(i.sol()&&!e.inString&&e.inArray===0){e.lhs=true}if(e.inString){while(e.inString){if(i.match(e.stringType)){e.inString=false}else if(i.peek()==="\\\\"){i.next();i.next()}else if(i.eol()){break}else{i.match(/^.[^\\\\\\"\\']*/)}}return e.lhs?"property":"string"}else if(e.inArray&&i.peek()==="]"){i.next();e.inArray--;return"bracket"}else if(e.lhs&&i.peek()==="["&&i.skipTo("]")){i.next();if(i.peek()==="]")i.next();return"atom"}else if(i.peek()==="#"){i.skipToEnd();return"comment"}else if(i.eatSpace()){return null}else if(e.lhs&&i.eatWhile(function(s){return s!="="&&s!=" "})){return"property"}else if(e.lhs&&i.peek()==="="){i.next();e.lhs=false;return null}else if(!e.lhs&&i.match(/^\\d\\d\\d\\d[\\d\\-\\:\\.T]*Z/)){return"atom"}else if(!e.lhs&&(i.match("true")||i.match("false"))){return"atom"}else if(!e.lhs&&i.peek()==="["){e.inArray++;i.next();return"bracket"}else if(!e.lhs&&i.match(/^\\-?\\d+(?:\\.\\d+)?/)){return"number"}else if(!i.eatSpace()){i.next()}return null},languageData:{commentTokens:{line:"#"}}};const aD=J.theme({"&":{height:"100%",fontSize:"12.5px",backgroundColor:"var(--bg-terminal)",color:"var(--text)"},".cm-scroller":{fontFamily:"var(--font-code)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)",borderLeftWidth:"2px"},"&.cm-focused > .cm-scroller > .cm-layer.cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--accent-bg)"},"&.cm-focused":{outline:"none"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--text-dim)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLine":{backgroundColor:"var(--bg-elevated)"},".cm-activeLineGutter":{backgroundColor:"var(--bg-elevated)",color:"var(--text-muted)"},".cm-foldGutter span":{color:"var(--text-dim)"},".cm-foldGutter span:hover":{color:"var(--accent)"},".cm-selectionMatch":{backgroundColor:"var(--accent-bg)"},".cm-searchMatch":{backgroundColor:"var(--accent-bg)",outline:"1px solid var(--accent-secondary)"},".cm-searchMatch-selected":{backgroundColor:"var(--accent-secondary-light)"},".cm-panels":{backgroundColor:"var(--bg-elevated)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panel input, .cm-panel button":{background:"var(--bg-surface)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"var(--control-radius, 6px)"},".cm-tooltip":{backgroundColor:"var(--bg-elevated)",color:"var(--text)",border:"1px solid var(--border)"}});const lD=nA(AR,{fallback:true});function hD(i){const e=i.toLowerCase();const t=e.lastIndexOf(".");const s=t>0?e.slice(t+1):"";switch(s){case"js":case"mjs":case"cjs":case"jsx":return Dc();case"ts":case"mts":case"cts":return Dc({typescript:true});case"tsx":return Dc({typescript:true,jsx:true});case"json":return wM();case"yml":case"yaml":return rI();case"py":return PB();case"md":case"markdown":return l9();case"html":case"htm":return p5();case"css":case"less":case"scss":return Lk();case"sh":case"bash":case"zsh":case"ksh":return Xr.define(nD);case"conf":case"ini":case"cfg":case"cnf":case"env":case"properties":return Xr.define(Ey);case"toml":return Xr.define(oD);case"lua":return Xr.define(tD);default:if(e==="dockerfile")return Xr.define(jI);if(e.endsWith(".service")||e.endsWith(".socket")||e.endsWith(".timer")){return Xr.define(Ey)}return[]}}const xC="cloudssh_editor_wrap";function cD(){if(typeof window==="undefined")return false;return window.matchMedia("(pointer: coarse)").matches||window.innerWidth<=520}function dD(){try{const i=window.localStorage.getItem(xC);if(i==="on")return true;if(i==="off")return false}catch{}return null}function uD(i){try{window.localStorage.setItem(xC,i?"on":"off")}catch{}}class fD{constructor(e){b(this,"dialog");b(this,"view");b(this,"options");b(this,"statusEl");b(this,"saveButton");b(this,"wrapCompartment",new ch);b(this,"wrapButton",null);b(this,"wrapEnabled",false);b(this,"baseline");b(this,"saving",false);b(this,"closed",false);this.options=e;this.baseline=e.content.text;this.wrapEnabled=dD()??cD();this.dialog=this.buildDialog();document.body.appendChild(this.dialog);const t=this.dialog.querySelector(".remote-editor__body");const s=this.dialog.querySelector(".remote-editor__title");const r=this.dialog.querySelector(".remote-editor__path");const n=this.dialog.querySelector(".remote-editor__notice");this.statusEl=this.dialog.querySelector(".remote-editor__status");const o=this.dialog.querySelector(".remote-editor__close");const a=this.dialog.querySelector(".remote-editor__button--cancel");this.saveButton=this.dialog.querySelector(".remote-editor__button--save");this.wrapButton=this.dialog.querySelector(".remote-editor__button--wrap");s.textContent=e.filename;r.textContent=e.path;if(e.readOnly){n.textContent=e.notice??"";n.hidden=!n.textContent}a.textContent=g("common.close");this.saveButton.textContent=g("common.save");this.saveButton.disabled=e.readOnly;Ds(this.dialog);o.addEventListener("click",()=>void this.requestClose());a.addEventListener("click",()=>void this.requestClose());this.saveButton.addEventListener("click",()=>void this.requestSave());this.wrapButton.addEventListener("click",()=>this.toggleWrap());this.dialog.addEventListener("cancel",l=>{l.preventDefault();void this.requestClose()});this.dialog.addEventListener("close",()=>this.destroy());this.view=new J({parent:t,state:this.buildState()});this.updateStatus();this.syncWrapButton();this.dialog.showModal();this.view.focus()}buildDialog(){const e=document.createElement("dialog");e.className="remote-editor";e.setAttribute("aria-label",g("sftp.editorTitle",{name:this.options.filename}));e.innerHTML=\` + \`;const e=this.memoryAddFormContainerEl.querySelector("#agent-add-knowledge-form");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-cancel-btn");t==null?void 0:t.addEventListener("click",()=>this.closeAddKnowledgeForm());e==null?void 0:e.addEventListener("submit",async r=>{r.preventDefault();await this.handleSaveKnowledge()});const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");s==null?void 0:s.focus()}closeAddKnowledgeForm(){if(!this.memoryAddFormContainerEl)return;this.memoryAddFormContainerEl.classList.add("hidden");this.memoryAddFormContainerEl.replaceChildren()}async handleSaveKnowledge(){if(!this.serverId||!this.memoryAddFormContainerEl)return;const e=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-category");const t=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-key");const s=this.memoryAddFormContainerEl.querySelector("#agent-knowledge-value");const r=(e==null?void 0:e.value)||"note";const n=(t==null?void 0:t.value)||"";const o=(s==null?void 0:s.value)||"";const a=_E({category:r,key:n,value:o});if(!a.ok)return;try{const l=await fetch(\`/api/servers/\${this.serverId}/knowledge\`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(l.ok){Y(g("agent.memorySaved"),{variant:"success"});this.closeAddKnowledgeForm();void this.fetchServerMemory()}}catch{}}}const kE={cf:{goodMax:100,fairMax:250},ws:{goodMax:100,fairMax:200}};function t_(i,e){const t=kE[e];if(i<=t.goodMax)return"good";if(i<=t.fairMax)return"fair";return"poor"}let nm=[];let Uw=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o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,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=Uw[s])e=s+1;else return true;if(e==t)return false}}function i_(i){return i>=127462&&i<=127487}const s_=8205;function TE(i,e,t=true,s=true){return(t?jw:PE)(i,e,s)}function jw(i,e,t){if(e==i.length)return e;if(e&&Hw(i.charCodeAt(e))&&Vw(i.charCodeAt(e-1)))e--;let s=nf(i,e);e+=r_(s);while(e=0&&i_(nf(i,o))){n++;o-=2}if(n%2==0)break;else e+=2}else{break}}return e}function PE(i,e,t){while(e>1){let s=jw(i,e-2,t);if(s=56320&&i<57344}function Vw(i){return i>=55296&&i<56320}function r_(i){return i<65536?1:2}let Pe=class Yw{lineAt(e){if(e<0||e>this.length)throw new RangeError(\`Invalid position \${e} in document of length \${this.length}\`);return this.lineInner(e,false,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(\`Invalid line number \${e} in \${this.lines}-line document\`);return this.lineInner(e,true,1,0)}replace(e,t,s){[e,t]=ia(this,e,t);let r=[];this.decompose(0,e,r,2);if(s.length)s.decompose(0,s.length,r,1|2);this.decompose(t,this.length,r,1);return $s.from(r,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ia(this,e,t);let s=[];this.decompose(e,t,s,0);return $s.from(s,t-e)}eq(e){if(e==this)return true;if(e.length!=this.length||e.lines!=this.lines)return false;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1);let r=new pl(this),n=new pl(e);for(let o=t,a=t;;){r.next(o);n.next(o);o=0;if(r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return false;a+=r.value.length;if(r.done||a>=s)return true}}iter(e=1){return new pl(this,e)}iterRange(e,t=this.length){return new Gw(this,e,t)}iterLines(e,t){let s;if(e==null){s=this.iter()}else{if(t==null)t=this.lines+1;let r=this.line(e).from;s=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kw(s)}toString(){return this.sliceString(0)}toJSON(){let e=[];this.flatten(e);return e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");if(e.length==1&&!e[0])return Yw.empty;return e.length<=32?new nt(e):$s.from(nt.split(e,[]))}};class nt extends Pe{constructor(e,t=$E(e)){super();this.text=e;this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.text[n],a=r+o.length;if((t?s:a)>=e)return new EE(r,a,s,o);r=a+1;s++}}decompose(e,t,s,r){let n=e<=0&&t>=this.length?this:new nt(n_(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=s.pop();let a=Ec(n.text,o.text.slice(),0,n.length);if(a.length<=32){s.push(new nt(a,o.length+n.length))}else{let l=a.length>>1;s.push(new nt(a.slice(0,l)),new nt(a.slice(l)))}}else{s.push(n)}}replace(e,t,s){if(!(s instanceof nt))return super.replace(e,t,s);[e,t]=ia(this,e,t);let r=Ec(this.text,Ec(s.text,n_(this.text,0,e)),t);let n=this.length+s.length-(t-e);if(r.length<=32)return new nt(r,n);return $s.from(nt.split(r,[]),n)}sliceString(e,t=this.length,s="\\n"){[e,t]=ia(this,e,t);let r="";for(let n=0,o=0;n<=t&&oe&&o)r+=s;if(en)r+=a.slice(Math.max(0,e-n),t-n);n=l+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let s=[],r=-1;for(let n of e){s.push(n);r+=n.length+1;if(s.length==32){t.push(new nt(s,r));s=[];r=-1}}if(r>-1)t.push(new nt(s,r));return t}}class $s extends Pe{constructor(e,t){super();this.children=e;this.length=t;this.lines=0;for(let s of e)this.lines+=s.lines}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.children[n],a=r+o.length,l=s+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,s,r);r=a+1;s=l+1}}decompose(e,t,s,r){for(let n=0,o=0;o<=t&&n=o){let h=r&((o<=e?1:0)|(l>=t?2:0));if(o>=e&&l<=t&&!h)s.push(a);else a.decompose(e-o,t-o,s,h)}o=l+1}}replace(e,t,s){[e,t]=ia(this,e,t);if(s.lines=n&&t<=a){let l=o.replace(e-n,t-n,s);let h=this.lines-o.lines+l.lines;if(l.lines>5-1&&l.lines>h>>5+1){let c=this.children.slice();c[r]=l;return new $s(c,this.length-(t-e)+s.length)}return super.replace(n,a,l)}n=a+1}return super.replace(e,t,s)}sliceString(e,t=this.length,s="\\n"){[e,t]=ia(this,e,t);let r="";for(let n=0,o=0;ne&&n)r+=s;if(eo)r+=a.sliceString(e-o,t-o,s);o=l+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof $s))return 0;let s=0;let[r,n,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,n+=t){if(r==o||n==a)return s;let l=this.children[r],h=e.children[n];if(l!=h)return s+l.scanIdentical(h,t);s+=l.length+1}}static from(e,t=e.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let f of e)s+=f.lines;if(s<32){let f=[];for(let p of e)p.flatten(f);return new nt(f,t)}let r=Math.max(32,s>>5),n=r<<1,o=r>>1;let a=[],l=0,h=-1,c=[];function d(f){let p;if(f.lines>n&&f instanceof $s){for(let m of f.children)d(m)}else if(f.lines>o&&(l>o||!l)){u();a.push(f)}else if(f instanceof nt&&l&&(p=c[c.length-1])instanceof nt&&f.lines+p.lines<=32){l+=f.lines;h+=f.length+1;c[c.length-1]=new nt(p.text.concat(f.text),p.length+1+f.length)}else{if(l+f.lines>r)u();l+=f.lines;h+=f.length+1;c.push(f)}}function u(){if(l==0)return;a.push(c.length==1?c[0]:$s.from(c,h));h=-1;l=c.length=0}for(let f of e)d(f);u();return a.length==1?a[0]:new $s(a,t)}}Pe.empty=new nt([""],0);function $E(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Ec(i,e,t=0,s=1e9){for(let r=0,n=0,o=true;n=t){if(l>s)a=a.slice(0,s-r);if(r0?1:(e instanceof nt?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=false;for(;;){let s=this.nodes.length-1;let r=this.nodes[s],n=this.offsets[s],o=n>>1;let a=r instanceof nt?r.text.length:r.children.length;if(o==(t>0?a:0)){if(s==0){this.done=true;this.value="";return this}if(t>0)this.offsets[s-1]++;this.nodes.pop();this.offsets.pop()}else if((n&1)==(t>0?0:1)){this.offsets[s]+=t;if(e==0){this.lineBreak=true;this.value="\\n";return this}e--}else if(r instanceof nt){let l=r.text[o+(t<0?-1:0)];this.offsets[s]+=t;if(l.length>Math.max(0,e)){this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e);return this}e-=l.length}else{let l=r.children[o+(t<0?-1:0)];if(e>l.length){e-=l.length;this.offsets[s]+=t}else{if(t<0)this.offsets[s]--;this.nodes.push(l);this.offsets.push(t>0?1:(l instanceof nt?l.text.length:l.children.length)<<1)}}}}next(e=0){if(e<0){this.nextInner(-e,-this.dir);e=this.value.length}return this.nextInner(e,this.dir)}}class Gw{constructor(e,t,s){this.value="";this.done=false;this.cursor=new pl(e,t>s?-1:1);this.pos=t>s?e.length:0;this.from=Math.min(t,s);this.to=Math.max(t,s)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to){this.value="";this.done=true;return this}e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let s=t<0?this.pos-this.from:this.to-this.pos;if(e>s)e=s;s-=e;let{value:r}=this.cursor.next(e);this.pos+=(r.length+e)*t;this.value=r.length<=s?r:t<0?r.slice(r.length-s):r.slice(0,s);this.done=!this.value;return this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Kw{constructor(e){this.inner=e;this.afterBreak=true;this.value="";this.done=false}next(e=0){let{done:t,lineBreak:s,value:r}=this.inner.next(e);if(t&&this.afterBreak){this.value="";this.afterBreak=false}else if(t){this.done=true;this.value=""}else if(s){if(this.afterBreak){this.value=""}else{this.afterBreak=true;this.next()}}else{this.value=r;this.afterBreak=false}return this}get lineBreak(){return false}}if(typeof Symbol!="undefined"){Pe.prototype[Symbol.iterator]=function(){return this.iter()};pl.prototype[Symbol.iterator]=Gw.prototype[Symbol.iterator]=Kw.prototype[Symbol.iterator]=function(){return this}}let EE=class EU{constructor(e,t,s,r){this.from=e;this.to=t;this.number=s;this.text=r}get length(){return this.to-this.from}};function ia(i,e,t){e=Math.max(0,Math.min(i.length,e));return[e,Math.max(e,Math.min(i.length,t))]}function Rt(i,e,t=true,s=true){return TE(i,e,t,s)}function QE(i){return i>=56320&&i<57344}function RE(i){return i>=55296&&i<56320}function Jw(i,e){let t=i.charCodeAt(e);if(!RE(t)||e+1==i.length)return t;let s=i.charCodeAt(e+1);if(!QE(s))return t;return(t-55296<<10)+(s-56320)+65536}function AE(i){if(i<=65535)return String.fromCharCode(i);i-=65536;return String.fromCharCode((i>>10)+55296,(i&1023)+56320)}function e2(i){return i<65536?1:2}const om=/\\r\\n?|\\n/;var oi=function(i){i[i["Simple"]=0]="Simple";i[i["TrackDel"]=1]="TrackDel";i[i["TrackBefore"]=2]="TrackBefore";i[i["TrackAfter"]=3]="TrackAfter";return i}(oi||(oi={}));class zs{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return n+(e-r);n+=a}else{if(s!=oi.Simple&&h>=e&&(s==oi.TrackDel&&re||s==oi.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!a)return e==r||t<0?n:n+l;n+=l}r=h}if(e>r)throw new RangeError(\`Position \${e} is out of range for changeset of length \${r}\`);return n}touchesRange(e,t=e){for(let s=0,r=0;s=0&&r<=t&&a>=e)return rt?"cover":true;r=a}return false}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new zs(e)}static create(e){return new zs(e)}}class _t extends zs{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");am(this,(t,s,r,n,o)=>e=e.replace(r,r+(s-t),o),false);return e}mapDesc(e,t=false){return lm(this,e,t,true)}invert(e){let t=this.sections.slice(),s=[];for(let r=0,n=0;r=0){t[r]=a;t[r+1]=o;let l=r>>1;while(s.length0)Yr(s,t,n.text);n.forward(c);a+=c}let h=e[o++];while(a>1].toJSON()))}return e}static of(e,t,s){let r=[],n=[],o=0;let a=null;function l(c=false){if(!c&&!r.length)return;if(ou||d<0||u>t)throw new RangeError(\`Invalid change range \${d} to \${u} (in doc of length \${t})\`);let p=!f?Pe.empty:typeof f=="string"?Pe.of(f.split(s||om)):f;let m=p.length;if(d==u&&m==0)return;if(do)Ht(r,d-o,-1);Ht(r,u-d,m);Yr(n,r,p);o=u}}h(e);l(!a);return a}static empty(e){return new _t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],s=[];for(let r=0;ra&&typeof o!="string")){throw new RangeError("Invalid JSON representation of ChangeSet")}else if(n.length==1){t.push(n[0],0)}else{while(s.length=0&&t<=0&&t==i[r+1])i[r]+=e;else if(r>=0&&e==0&&i[r]==0)i[r+1]+=t;else if(s){i[r]+=e;i[r+1]+=t}else i.push(e,t)}function Yr(i,e,t){if(t.length==0)return;let s=e.length-2>>1;if(s>1]);if(t||o==i.sections.length||i.sections[o+1]<0)break;a=i.sections[o++];l=i.sections[o++]}e(r,h,n,c,d);r=h;n=c}}}function lm(i,e,t,s=false){let r=[],n=s?[]:null;let o=new Ml(i),a=new Ml(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len){throw new Error("Mismatched change set lengths")}else if(o.ins==-1&&a.ins==-1){let h=Math.min(o.len,a.len);Ht(r,h,-1);o.forward(h);a.forward(h)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len=0&&l=0){let h=0,c=o.len;while(c){if(a.ins==-1){let d=Math.min(c,a.len);h+=d;c-=d;a.forward(d)}else if(a.ins==0&&a.lenl||o.ins>=0&&o.len>l)&&(a||s.length>h);n.forward2(l);o.forward(l)}}}class Ml{constructor(e){this.set=e;this.i=0;this.next()}next(){let{sections:e}=this.set;if(this.i>1;return t>=e.length?Pe.empty:e[t]}textBit(e){let{inserted:t}=this.set,s=this.i-2>>1;return s>=t.length&&!e?Pe.empty:t[s].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else{this.len-=e;this.off+=e}}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else{this.ins-=e;this.off+=e}}}class Zr{constructor(e,t,s,r){this.from=e;this.to=t;this.flags=s;this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let s,r;if(this.empty){s=r=e.mapPos(this.from,t)}else{s=e.mapPos(this.from,1);r=e.mapPos(this.to,-1)}return s==this.from&&r==this.to?this:new Zr(s,r,this.flags,this.goalColumn)}extend(e,t=e,s=0){if(e<=this.anchor&&t>=this.anchor)return z.range(e,t,void 0,void 0,s);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return z.range(this.anchor,r,void 0,void 0,s)}eq(e,t=false){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return z.range(e.anchor,e.head)}static create(e,t,s,r){return new Zr(e,t,s,r)}}class z{constructor(e,t){this.ranges=e;this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return z.create(this.ranges.map(s=>s.map(e,t)),this.mainIndex)}eq(e,t=false){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return false;for(let s=0;se.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new z(e.ranges.map(t=>Zr.fromJSON(t)),e.main)}static single(e,t=e){return new z([z.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,r=0;rr.from-n.from);t=e.indexOf(s);for(let r=1;rn.head?z.range(l,a):z.range(a,l))}}return new z(e,t)}}function i2(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let QO=0;class te{constructor(e,t,s,r,n){this.combine=e;this.compareInput=t;this.compare=s;this.isStatic=r;this.id=QO++;this.default=e([]);this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new te(e.combine||(t=>t),e.compareInput||((t,s)=>t===s),e.compare||(!e.combine?RO:(t,s)=>t===s),!!e.static,e.enables)}of(e){return new Qc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Qc(e,this,2,t)}from(e,t){if(!t)t=s=>s;return this.compute([e],s=>t(s.field(e)))}}function RO(i,e){return i==e||i.length==e.length&&i.every((t,s)=>t===e[s])}class Qc{constructor(e,t,s,r){this.dependencies=e;this.facet=t;this.type=s;this.value=r;this.id=QO++}dynamicSlot(e){var t;let s=this.value;let r=this.facet.compareInput;let n=this.id,o=e[n]>>1,a=this.type==2;let l=false,h=false,c=[];for(let d of this.dependencies){if(d=="doc")l=true;else if(d=="selection")h=true;else if((((t=e[d.id])!==null&&t!==void 0?t:1)&1)==0)c.push(e[d.id])}return{create(d){d.values[o]=s(d);return 1},update(d,u){if(l&&u.docChanged||h&&(u.docChanged||u.selection)||hm(d,c)){let f=s(d);if(a?!o_(f,d.values[o],r):!r(f,d.values[o])){d.values[o]=f;return 1}}return 0},reconfigure:(d,u)=>{let f,p=u.config.address[n];if(p!=null){let m=dd(u,p);if(this.dependencies.every(O=>{return O instanceof te?u.facet(O)===d.facet(O):O instanceof ji?u.field(O,false)==d.field(O,false):true})||(a?o_(f=s(d),m,r):r(f=s(d),m))){d.values[o]=m;return 0}}else{f=s(d)}d.values[o]=f;return 1}}}get extension(){return this}}function o_(i,e,t){if(i.length!=e.length)return false;for(let s=0;si[l.id]);let r=t.map(l=>l.type);let n=s.filter(l=>!(l&1));let o=i[e.id]>>1;function a(l){let h=[];for(let c=0;cs===r),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(Wh).find(s=>s.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:s=>{s.values[t]=this.create(s);return 1},update:(s,r)=>{let n=s.values[t];let o=this.updateF(n,r);if(this.compareF(n,o))return 0;s.values[t]=o;return 1},reconfigure:(s,r)=>{let n=s.facet(Wh),o=r.facet(Wh),a;if((a=n.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)){s.values[t]=a.create(s);return 1}if(r.config.address[this.id]!=null){s.values[t]=r.field(this);return 0}s.values[t]=this.create(s);return 1}}}init(e){return[this,Wh.of({field:this,create:e})]}get extension(){return this}}const $n={lowest:4,low:3,default:2,high:1,highest:0};function Qa(i){return e=>new s2(e,i)}const ho={highest:Qa($n.highest),high:Qa($n.high),default:Qa($n.default),low:Qa($n.low),lowest:Qa($n.lowest)};class s2{constructor(e,t){this.inner=e;this.prec=t}get extension(){return this}}class ch{of(e){return new cm(this,e)}reconfigure(e){return ch.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class cm{constructor(e,t){this.compartment=e;this.inner=t}get extension(){return this}}class cd{constructor(e,t,s,r,n,o){this.base=e;this.compartments=t;this.dynamicSlots=s;this.address=r;this.staticValues=n;this.facets=o;this.statusTemplate=[];while(this.statusTemplate.length>1]}static resolve(e,t,s){let r=[];let n=Object.create(null);let o=new Map;for(let u of ME(e,t,o)){if(u instanceof ji)r.push(u);else(n[u.facet.id]||(n[u.facet.id]=[])).push(u)}let a=Object.create(null);let l=[];let h=[];for(let u of r){a[u.id]=h.length<<1;h.push(f=>u.slot(f))}let c=s===null||s===void 0?void 0:s.config.facets;for(let u in n){let f=n[u],p=f[0].facet;let m=c&&c[u]||[];if(f.every(O=>O.type==0)){a[p.id]=l.length<<1|1;if(RO(m,f)){l.push(s.facet(p))}else{let O=p.combine(f.map(v=>v.value));l.push(s&&p.compare(O,s.facet(p))?s.facet(p):O)}}else{for(let O of f){if(O.type==0){a[O.id]=l.length<<1|1;l.push(O.value)}else{a[O.id]=h.length<<1;h.push(v=>O.dynamicSlot(v))}}a[p.id]=h.length<<1;h.push(O=>LE(O,p,f))}}let d=h.map(u=>u(a));return new cd(e,o,d,a,l,n)}}function ME(i,e,t){let s=[[],[],[],[],[]];let r=new Map;function n(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let h=s[l].indexOf(o);if(h>-1)s[l].splice(h,1);if(o instanceof cm)t.delete(o.compartment)}r.set(o,a);if(Array.isArray(o)){for(let h of o)n(h,a)}else if(o instanceof cm){if(t.has(o.compartment))throw new RangeError(\`Duplicate use of compartment in extensions\`);let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h);n(h,a)}else if(o instanceof s2){n(o.inner,o.prec)}else if(o instanceof ji){s[a].push(o);if(o.provides)n(o.provides,a)}else if(o instanceof Qc){s[a].push(o);if(o.facet.extensions)n(o.facet.extensions,$n.default)}else{let h=o.extension;if(!h)throw new Error(\`Unrecognized extension value in extension set (\${o}).\`);if(h==o)throw new Error(\`Unrecognized extension value in extension set (\${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.\`);n(h,a)}}n(i,$n.default);return s.reduce((o,a)=>o.concat(a))}function ml(i,e){if(e&1)return 2;let t=e>>1;let s=i.status[t];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function dd(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const r2=te.define();const dm=te.define({combine:i=>i.some(e=>e),static:true});const n2=te.define({combine:i=>i.length?i[0]:void 0,static:true});const o2=te.define();const a2=te.define();const l2=te.define();const h2=te.define({combine:i=>i.length?i[0]:false});class br{constructor(e,t){this.type=e;this.value=t}static define(){return new BE}}class BE{of(e){return new br(this,e)}}class IE{constructor(e){this.map=e}of(e){return new Te(this,e)}}class Te{constructor(e,t){this.type=e;this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Te(this.type,t)}is(e){return this.type==e}static define(e={}){return new IE(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let s=[];for(let r of e){let n=r.map(t);if(n)s.push(n)}return s}}Te.reconfigure=Te.define();Te.appendConfig=Te.define();class ut{constructor(e,t,s,r,n,o){this.startState=e;this.changes=t;this.selection=s;this.effects=r;this.annotations=n;this.scrollIntoView=o;this._doc=null;this._state=null;if(s)i2(s,t.newLength);if(!n.some(a=>a.type==ut.time))this.annotations=n.concat(ut.time.of(Date.now()))}static create(e,t,s,r,n,o){return new ut(e,t,s,r,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return void 0}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ut.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ut.time=br.define();ut.userEvent=br.define();ut.addToHistory=br.define();ut.remote=br.define();function DE(i,e){let t=[];for(let s=0,r=0;;){let n,o;if(s=i[s])){n=i[s++];o=i[s++]}else if(r=0;r--){let n=s[r](i);if(n instanceof ut)i=n;else if(Array.isArray(n)&&n.length==1&&n[0]instanceof ut)i=n[0];else i=d2(e,No(n),false)}return i}function WE(i){let e=i.startState,t=e.facet(l2),s=i;for(let r=t.length-1;r>=0;r--){let n=t[r](i);if(n&&Object.keys(n).length)s=c2(s,um(e,n,i.changes.newLength),true)}return s==i?i:ut.create(e,i.changes,i.selection,s.effects,s.annotations,s.scrollIntoView)}const qE=[];function No(i){return i==null?qE:Array.isArray(i)?i:[i]}var ot=function(i){i[i["Word"]=0]="Word";i[i["Space"]=1]="Space";i[i["Other"]=2]="Other";return i}(ot||(ot={}));const XE=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;let fm;try{fm=new RegExp("[\\\\p{Alphabetic}\\\\p{Number}_]","u")}catch(i){}function NE(i){if(fm)return fm.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||XE.test(t)))return true}return false}function FE(i){return e=>{if(!/\\S/.test(e))return ot.Space;if(NE(e))return ot.Word;for(let t=0;t-1)return ot.Word;return ot.Other}}class xe{constructor(e,t,s,r,n,o){this.config=e;this.doc=t;this.selection=s;this.values=r;this.status=e.statusTemplate.slice();this.computeSlot=n;if(o)o._state=this;for(let a=0;ar.set(h,l));t=null}r.set(a.value.compartment,a.value.extension)}else if(a.is(Te.reconfigure)){t=null;s=a.value}else if(a.is(Te.appendConfig)){t=null;s=No(s).concat(a.value)}}let n;if(!t){t=cd.resolve(s,r,this);let a=new xe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null);n=a.values}else{n=e.startState.values.slice()}let o=e.startState.facet(dm)?e.newSelection:e.newSelection.asSingle();new xe(t,e.newDoc,o,n,(a,l)=>l.update(a,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:z.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection;let s=e(t.ranges[0]);let r=this.changes(s.changes),n=[s.range];let o=No(s.effects);for(let a=1;ao.spec.fromJSON(a,l)))}}return xe.create({doc:e.doc,selection:z.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=cd.resolve(e.extensions||[],new Map);let s=e.doc instanceof Pe?e.doc:Pe.of((e.doc||"").split(t.staticFacet(xe.lineSeparator)||om));let r=!e.selection?z.single(0):e.selection instanceof z?e.selection:z.single(e.selection.anchor,e.selection.head);i2(r,s.length);if(!t.staticFacet(dm))r=r.asSingle();return new xe(t,s,r,t.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(xe.tabSize)}get lineBreak(){return this.facet(xe.lineSeparator)||"\\n"}get readOnly(){return this.facet(h2)}phrase(e,...t){for(let s of this.facet(xe.phrases))if(Object.prototype.hasOwnProperty.call(s,e)){e=s[e];break}if(t.length)e=e.replace(/\\$(\\$|\\d*)/g,(s,r)=>{if(r=="$")return"$";let n=+(r||1);return!n||n>t.length?s:t[n-1]});return e}languageDataAt(e,t,s=-1){let r=[];for(let n of this.facet(r2)){for(let o of n(this,t,s)){if(Object.prototype.hasOwnProperty.call(o,e))r.push(o[e])}}return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return FE(t.length?t[0]:"")}wordAt(e){let{text:t,from:s,length:r}=this.doc.lineAt(e);let n=this.charCategorizer(e);let o=e-s,a=e-s;while(o>0){let l=Rt(t,o,false);if(n(t.slice(l,o))!=ot.Word)break;o=l}while(ai.length?i[0]:4});xe.lineSeparator=n2;xe.readOnly=h2;xe.phrases=te.define({compare(i,e){let t=Object.keys(i),s=Object.keys(e);return t.length==s.length&&t.every(r=>i[r]==e[r])}});xe.languageData=r2;xe.changeFilter=o2;xe.transactionFilter=a2;xe.transactionExtender=l2;ch.reconfigure=Te.define();function co(i,e,t={}){let s={};for(let r of i)for(let n of Object.keys(r)){let o=r[n],a=s[n];if(a===void 0)s[n]=o;else if(a===o||o===void 0);else if(Object.hasOwnProperty.call(t,n))s[n]=t[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let r in e)if(s[r]===void 0)s[r]=e[r];return s}class an{eq(e){return this==e}range(e,t=e){return pm.create(e,t,this)}}an.prototype.startSide=an.prototype.endSide=0;an.prototype.point=false;an.prototype.mapMode=oi.TrackDel;function AO(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}let pm=class u2{constructor(e,t,s){this.from=e;this.to=t;this.value=s}static create(e,t,s){return new u2(e,t,s)}};function mm(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class LO{constructor(e,t,s,r){this.from=e;this.to=t;this.value=s;this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,s,r=0){let n=s?this.to:this.from;for(let o=r,a=n.length;;){if(o==a)return o;let l=o+a>>1;let h=n[l]-e||(s?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return h>=0?o:a;if(h>=0)a=l;else o=l+1}}between(e,t,s,r){for(let n=this.findIndex(t,-1e9,true),o=this.findIndex(s,1e9,false,n);nf||u==f&&h.startSide>0&&h.endSide<=0)continue}if((f-u||h.endSide-h.startSide)<0)continue;if(o<0)o=u;if(h.point)a=Math.max(a,f-u);s.push(h);r.push(u-o);n.push(f-o)}return{mapped:s.length?new LO(r,n,s,a):null,pos:o}}}class ye{constructor(e,t,s,r){this.chunkPos=e;this.chunk=t;this.nextLayer=s;this.maxPoint=r}static create(e,t,s,r){return new ye(e,t,s,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:s=false,filterFrom:r=0,filterTo:n=this.length}=e;let o=e.filter;if(t.length==0&&!o)return this;if(s)t=t.slice().sort(mm);if(this.isEmpty)return t.length?ye.of(t):this;let a=new f2(this,null,-1).goto(0),l=0,h=[];let c=new Yn;while(a.value||l=0){let d=t[l++];if(!c.addInner(d.from,d.to,d.value))h.push(d)}else if(a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||na.to||n=n&&e<=n+o.length&&o.between(n,e-n,t-n,s)===false)return}this.nextLayer.between(e,t,s)}iter(e=0){return Bl.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Bl.from(e).goto(t)}static compare(e,t,s,r,n=-1){let o=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=n);let a=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=n);let l=a_(o,a,s);let h=new Ra(o,l,n);let c=new Ra(a,l,n);s.iterGaps((d,u,f)=>l_(h,d,c,u,f,r));if(s.empty&&s.length==0)l_(h,0,c,0,0,r)}static eq(e,t,s=0,r){if(r==null)r=1e9-1;let n=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);let o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(n.length!=o.length)return false;if(!n.length)return true;let a=a_(n,o);let l=new Ra(n,a,0).goto(s),h=new Ra(o,a,0).goto(s);for(;;){if(l.to!=h.to||!gm(l.active,h.active)||l.point&&(!h.point||!AO(l.point,h.point)))return false;if(l.to>r)return true;l.next();h.next()}}static spans(e,t,s,r,n=-1){let o=new Ra(e,null,n).goto(t),a=t;let l=o.openStart;for(;;){let h=Math.min(o.to,s);if(o.point){let c=o.activeForPoint(o.to);let d=o.pointFroma){r.span(a,h,o.active,l);l=o.openEnd(h)}if(o.to>s)return l+(o.point&&o.to>s?1:0);a=o.to;o.next()}}static of(e,t=false){let s=new Yn;for(let r of e instanceof pm?[e]:t?ZE(e):e)s.add(r.from,r.to,r.value);return s.finish()}static join(e){if(!e.length)return ye.empty;let t=e[e.length-1];for(let s=e.length-2;s>=0;s--){for(let r=e[s];r!=ye.empty;r=r.nextLayer)t=new ye(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint))}return t}}ye.empty=new ye([],[],null,-1);function ZE(i){if(i.length>1)for(let e=i[0],t=1;t0)return i.slice().sort(mm);e=s}return i}ye.empty.nextLayer=ye.empty;class Yn{finishChunk(e){this.chunks.push(new LO(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;if(e){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(e,t,s){if(!this.addInner(e,t,s))(this.nextLayer||(this.nextLayer=new Yn)).add(e,t,s)}addInner(e,t,s){let r=e-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by \`from\` position and \`startSide\`");if(r<0)return false;if(this.from.length==250)this.finishChunk(true);if(this.chunkStart<0)this.chunkStart=e;this.from.push(e-this.chunkStart);this.to.push(t-this.chunkStart);this.last=s;this.lastFrom=e;this.lastTo=t;this.value.push(s);if(s.point)this.maxPoint=Math.max(this.maxPoint,t-e);return true}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return false;if(this.from.length)this.finishChunk(true);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint);this.chunks.push(t);this.chunkPos.push(e);let s=t.value.length-1;this.last=t.value[s];this.lastFrom=t.from[s]+e;this.lastTo=t.to[s]+e;return true}finish(){return this.finishInner(ye.empty)}finishInner(e){if(this.from.length)this.finishChunk(false);if(this.chunks.length==0)return e;let t=ye.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);this.from=null;return t}}function a_(i,e,t){let s=new Map;for(let n of i)for(let o=0;o=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){this.chunkIndex++;if(this.skip){while(this.chunkIndex=s)r.push(new f2(o,t,s,n))}}return r.length==1?r[0]:new Bl(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let s of this.heap)s.goto(e,t);for(let s=this.heap.length>>1;s>=0;s--)of(this.heap,s);this.next();return this}forward(e,t){for(let s of this.heap)s.forward(e,t);for(let s=this.heap.length>>1;s>=0;s--)of(this.heap,s);if((this.to-e||this.value.endSide-t)<0)this.next()}next(){if(this.heap.length==0){this.from=this.to=1e9;this.value=null;this.rank=-1}else{let e=this.heap[0];this.from=e.from;this.to=e.to;this.value=e.value;this.rank=e.rank;if(e.value)e.next();of(this.heap,0)}}}function of(i,e){for(let t=i[e];;){let s=(e<<1)+1;if(s>=i.length)break;let r=i[s];if(s+1=0){r=i[s+1];s++}if(t.compare(r)<0)break;i[s]=t;i[e]=r;e=s}}class Ra{constructor(e,t,s){this.minPoint=s;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=Bl.from(e,t,s)}goto(e,t=-1e9){this.cursor.goto(e,t);this.active.length=this.activeTo.length=this.activeRank.length=0;this.minActive=-1;this.to=e;this.endSide=t;this.openStart=-1;this.next();return this}forward(e,t){while(this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){qh(this.active,e);qh(this.activeTo,e);qh(this.activeRank,e);this.minActive=h_(this.active,this.activeTo)}addActive(e){let t=0,{value:s,to:r,rank:n}=this.cursor;while(t0)t++;Xh(this.active,t,s);Xh(this.activeTo,t,r);Xh(this.activeRank,t,n);if(e)Xh(e,t,this.cursor.from);this.minActive=h_(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r];this.endSide=this.active[r].endSide;break}this.removeActive(r);if(s)qh(s,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from;this.endSide=this.cursor.startSide;break}else{let n=this.cursor.value;if(!n.point){this.addActive(s);this.cursor.next()}else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&s[r]=0;s--){if(this.activeRank[s]e||this.activeTo[s]==e&&this.active[s].endSide>=this.point.endSide)t.push(this.active[s])}return t.reverse()}openEnd(e){let t=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>e;s--)t++;return t}}function l_(i,e,t,s,r,n){i.goto(e);t.goto(s);let o=s+r;let a=s,l=s-e;let h=!!n.boundChange;for(let c=false;;){let d=i.to+l-t.to,u=d||i.endSide-t.endSide;let f=u<0?i.to+l:t.to,p=Math.min(f,o);let m=i.point||t.point;if(m){if(!(i.point&&t.point&&AO(i.point,t.point)&&gm(i.activeForPoint(i.to),t.activeForPoint(t.to))))n.comparePoint(a,p,i.point,t.point);c=false}else{if(c)n.boundChange(a);if(p>a&&!gm(i.active,t.active))n.compareRange(a,p,i.active,t.active);if(h&&po)break;a=f;if(u<=0)i.next();if(u>=0)t.next()}}function gm(i,e){if(i.length!=e.length)return false;for(let t=0;t=e;s--)i[s+1]=i[s];i[e]=t}function h_(i,e){let t=-1,s=1e9;for(let r=0;r=e)return r;if(r==i.length)break;n+=i.charCodeAt(r)==9?t-n%t:1;r=Rt(i,r)}return s===true?-1:i.length}const _m="ͼ";const c_=typeof Symbol=="undefined"?"__"+_m:Symbol.for(_m);const vm=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet");const d_=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class ln{constructor(e,t){this.rules=[];let{finish:s}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function n(o,a,l,h){let c=[],d=/^@(\\w+)\\b/.exec(o[0]),u=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f)){n(f.split(/,\\s*/).map(m=>o.map(O=>m.replace(/&/,O))).reduce((m,O)=>m.concat(O)),p,l)}else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+f+") should be a primitive value.");n(r(f),p,c,u)}else if(p!=null){c.push(f.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}}if(c.length||u){l.push((s&&!d&&!h?o.map(s):o).join(", ")+" {"+c.join(" ")+"}")}}for(let o in e)n(r(o),e[o],this.rules)}getRules(){return this.rules.join("\\n")}static newName(){let e=d_[c_]||1;d_[c_]=e+1;return _m+e.toString(36)}static mount(e,t,s){let r=e[vm],n=s&&s.nonce;if(!r)r=new UE(e,n);else if(n)r.setNonce(n);r.mount(Array.isArray(t)?t:[t],e)}}let u_=new Map;class UE{constructor(e,t){let s=e.ownerDocument||e,r=s.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let n=u_.get(s);if(n)return e[vm]=n;this.sheet=new r.CSSStyleSheet;u_.set(s,this)}else{this.styleTag=s.createElement("style");if(t)this.styleTag.setAttribute("nonce",t)}this.modules=[];e[vm]=this}mount(e,t){let s=this.sheet;let r=0,n=0;for(let o=0;o-1){this.modules.splice(l,1);n--;l=-1}if(l==-1){this.modules.splice(n++,0,a);if(s)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};var jE=typeof navigator!="undefined"&&/Mac/.test(navigator.platform);var HE=typeof navigator!="undefined"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(var qt=0;qt<10;qt++)hn[48+qt]=hn[96+qt]=String(qt);for(var qt=1;qt<=24;qt++)hn[qt+111]="F"+qt;for(var qt=65;qt<=90;qt++){hn[qt]=String.fromCharCode(qt+32);Il[qt]=String.fromCharCode(qt)}for(var af in hn)if(!Il.hasOwnProperty(af))Il[af]=hn[af];function VE(i){var e=jE&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||HE&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified";var t=!e&&i.key||(i.shiftKey?Il:hn)[i.keyCode]||i.key||"Unidentified";if(t=="Esc")t="Escape";if(t=="Del")t="Delete";if(t=="Left")t="ArrowLeft";if(t=="Up")t="ArrowUp";if(t=="Right")t="ArrowRight";if(t=="Down")t="ArrowDown";return t}function wt(){var i=arguments[0];if(typeof i=="string")i=document.createElement(i);var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var r=t[s];if(typeof r=="string")i.setAttribute(s,r);else if(r!=null)i[s]=r}e++}for(;e2);var G={mac:m_||/Mac/.test(ri.platform),windows:/Win/.test(ri.platform),linux:/Linux|X11/.test(ri.platform),ie:ou,ie_version:m2?ym.documentMode||6:Sm?+Sm[1]:bm?+bm[1]:0,gecko:f_,gecko_version:f_?+(/Firefox\\/(\\d+)/.exec(ri.userAgent)||[0,0])[1]:0,chrome:!!lf,chrome_version:lf?+lf[1]:0,ios:m_,android:/Android\\b/.test(ri.userAgent),webkit:p_,webkit_version:p_?+(/\\bAppleWebKit\\/(\\d+)/.exec(ri.userAgent)||[0,0])[1]:0,safari:wm,safari_version:wm?+(/\\bVersion\\/(\\d+(\\.\\d+)?)/.exec(ri.userAgent)||[0,0])[1]:0,tabSize:ym.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function MO(i,e){for(let t in i){if(t=="class"&&e.class)e.class+=" "+i.class;else if(t=="style"&&e.style)e.style+=";"+i.style;else e[t]=i[t]}return e}const ud=Object.create(null);function BO(i,e,t){if(i==e)return true;if(!i)i=ud;if(!e)e=ud;let s=Object.keys(i),r=Object.keys(e);if(s.length-0!=r.length-0)return false;for(let n of s){if(n!=t&&(r.indexOf(n)==-1||i[n]!==e[n]))return false}return true}function YE(i,e){for(let t=i.attributes.length-1;t>=0;t--){let s=i.attributes[t].name;if(e[s]==null)i.removeAttribute(s)}for(let t in e){let s=e[t];if(t=="style")i.style.cssText=s;else if(i.getAttribute(t)!=s)i.setAttribute(t,s)}}function g_(i,e,t){let s=false;if(e){for(let r in e)if(!(t&&r in t)){s=true;if(r=="style")i.style.cssText="";else i.removeAttribute(r)}}if(t){for(let r in t)if(!(e&&e[r]==t[r])){s=true;if(r=="style")i.style.cssText=t[r];else i.setAttribute(r,t[r])}}return s}function GE(i){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8;return new Gn(e,t,t,s,e.widget||null,false)}static replace(e){let t=!!e.block,s,r;if(e.isBlockGap){s=-5e8;r=4e8}else{let{start:n,end:o}=g2(e,t);s=(n?t?-3e8:-1:5e8)-1;r=(o?t?2e8:1:-6e8)+1}return new Gn(e,s,r,t,e.widget||null,true)}static line(e){return new uh(e)}static set(e,t=false){return ye.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:false}}fe.none=ye.empty;class dh extends fe{constructor(e){let{start:t,end:s}=g2(e);super(t?-1:5e8,s?1:-6e8,null,e);this.tagName=e.tagName||"span";this.attrs=e.class&&e.attributes?MO(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ud}eq(e){return this==e||e instanceof dh&&this.tagName==e.tagName&&BO(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}dh.prototype.point=false;class uh extends fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof uh&&this.spec.class==e.spec.class&&BO(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}uh.prototype.mapMode=oi.TrackBefore;uh.prototype.point=true;class Gn extends fe{constructor(e,t,s,r,n,o){super(t,s,n,e);this.block=r;this.isReplace=o;this.mapMode=!r?oi.TrackDel:t<=0?oi.TrackBefore:oi.TrackAfter}get type(){return this.startSide!=this.endSide?Ft.WidgetRange:this.startSide<=0?Ft.WidgetBefore:Ft.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Gn&&KE(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Gn.prototype.point=true;function g2(i,e=false){let{inclusiveStart:t,inclusiveEnd:s}=i;if(t==null)t=i.inclusive;if(s==null)s=i.inclusive;return{start:t!==null&&t!==void 0?t:e,end:s!==null&&s!==void 0?s:e}}function KE(i,e){return i==e||!!(i&&e&&i.compare(e))}function Fo(i,e,t,s=0){let r=t.length-1;if(r>=0&&t[r]+s>=i)t[r]=Math.max(t[r],e);else t.push(i,e)}class Dl extends an{constructor(e,t,s){super();this.tagName=e;this.attributes=t;this.rank=s}eq(e){return e==this||e instanceof Dl&&this.tagName==e.tagName&&BO(this.attributes,e.attributes)}static create(e){return new Dl(e.tagName,e.attributes||ud,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=false){return ye.of(e,t)}}Dl.prototype.startSide=Dl.prototype.endSide=-1;function zl(i){let e;if(i.nodeType==11){e=i.getSelection?i:i.ownerDocument}else{e=i}return e.getSelection()}function xm(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):false}function gl(i,e){if(!e.anchorNode)return false;try{return xm(i,e.anchorNode)}catch(t){return false}}function Rc(i){if(i.nodeType==3)return Wl(i,0,i.nodeValue.length).getClientRects();else if(i.nodeType==1)return i.getClientRects();else return[]}function Ol(i,e,t,s){return t?O_(i,e,t,s,-1)||O_(i,e,t,s,1):false}function cn(i){for(var e=0;;e++){i=i.previousSibling;if(!i)return e}}function fd(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(i.nodeName)}function O_(i,e,t,s,r){for(;;){if(i==t&&e==s)return true;if(e==(r<0?0:Or(i))){if(i.nodeName=="DIV")return false;let n=i.parentNode;if(!n||n.nodeType!=1)return false;e=cn(i)+(r<0?0:1);i=n}else if(i.nodeType==1){i=i.childNodes[e+(r<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")return false;e=r<0?Or(i):0}else{return false}}}function Or(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function pd(i,e){let{left:t,right:s}=i;if(t==s)return i;let r=e?t:s;return{left:r,right:r,top:i.top,bottom:i.bottom}}function JE(i){let e=i.visualViewport;if(e)return{left:0,right:e.width,top:0,bottom:e.height};return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function O2(i,e){let t=e.width/i.offsetWidth;let s=e.height/i.offsetHeight;if(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)t=1;if(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-i.offsetHeight)<1)s=1;return{scaleX:t,scaleY:s}}function e6(i,e,t,s,r,n,o,a){let l=i.ownerDocument,h=l.defaultView||window;for(let c=i,d=false;c&&!d;){if(c.nodeType==1){let u,f=c==l.body;let p=1,m=1;if(f){u=JE(h)}else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))d=true;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let T=c.getBoundingClientRect();({scaleX:p,scaleY:m}=O2(c,T));u={left:T.left,right:T.left+c.clientWidth*p,top:T.top,bottom:T.top+c.clientHeight*m}}let O=0,v=0;if(r=="nearest"){if(e.top0&&e.bottom>u.bottom+v)v=e.bottom-u.bottom+o}else if(e.bottom>u.bottom-o){v=e.bottom-u.bottom+o;if(t<0&&e.top-v0&&e.right>u.right+O)O=e.right-u.right+n}else if(e.right>u.right-n){O=e.right-u.right+n;if(t<0&&e.leftu.bottom||e.leftu.right)e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)};c=c.assignedSlot||c.parentNode}else if(c.nodeType==11){c=c.host}else{break}}}function _2(i,e=true){let t=i.ownerDocument,s=null,r=null;for(let n=i.parentNode;n;){if(n==t.body||(!e||s)&&r){break}else if(n.nodeType==1){if(!r&&n.scrollHeight>n.clientHeight)r=n;if(e&&!s&&n.scrollWidth>n.clientWidth)s=n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11){n=n.host}else{break}}return{x:s,y:r}}class t6{constructor(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:s}=e;this.set(t,Math.min(e.anchorOffset,t?Or(t):0),s,Math.min(e.focusOffset,s?Or(s):0))}set(e,t,s,r){this.anchorNode=e;this.anchorOffset=t;this.focusNode=s;this.focusOffset=r}}function v2(i){let e=[];for(let t=i;t;t=t.nodeType==11?t.host:t.parentNode){if(t.nodeType==1)e.push({node:t,left:t.scrollLeft,top:t.scrollTop})}return e}function y2(i,e=true){for(let{node:t,left:s,top:r}of i){if(e&&t.scrollTop!=r)t.scrollTop=r;if(t.scrollLeft!=s)t.scrollLeft=s}}let kn=null;if(G.safari&&G.safari_version>=26)kn=false;function b2(i){if(i.setActive)return i.setActive();if(kn)return i.focus(kn);let e=v2(i);i.focus(kn==null?{get preventScroll(){kn={preventScroll:true};return true}}:void 0);if(!kn){kn=false;y2(e)}}let __;function Wl(i,e,t=e){let s=__||(__=document.createRange());s.setEnd(i,t);s.setStart(i,e);return s}function Zo(i,e,t,s){let r={key:e,code:e,keyCode:t,which:t,cancelable:true};if(s)({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let n=new KeyboardEvent("keydown",r);n.synthetic=true;i.dispatchEvent(n);let o=new KeyboardEvent("keyup",r);o.synthetic=true;i.dispatchEvent(o);return n.defaultPrevented||o.defaultPrevented}function i6(i){while(i){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function s6(i,e){let t=e.focusNode,s=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=s)return false;s=Math.min(s,Or(t));for(;;){if(s){if(t.nodeType!=1)return false;let r=t.childNodes[s-1];if(r.contentEditable=="false")s--;else{t=r;s=Or(t)}}else if(t==i){return true}else{s=cn(t);t=t.parentNode}}}function S2(i){if(i instanceof Window)return i.pageYOffset>Math.max(0,i.document.documentElement.scrollHeight-i.innerHeight-4);return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function w2(i,e){for(let t=i,s=e;;){if(t.nodeType==3&&s>0){return{node:t,offset:s}}else if(t.nodeType==1&&s>0){if(t.contentEditable=="false")return null;t=t.childNodes[s-1];s=Or(t)}else if(t.parentNode&&!fd(t)){s=cn(t);t=t.parentNode}else{return null}}}function x2(i,e){for(let t=i,s=e;;){if(t.nodeType==3&&s=t){if(a.level==s)return o;if(n<0||(r!=0?r<0?a.fromt:e[n].level>a.level))n=o}}if(n<0)throw new RangeError("Index out of range");return n}}function T2(i,e){if(i.length!=e.length)return false;for(let t=0;t=0;m-=3){if(ms[m+1]==-f){let O=ms[m+2];let v=O&2?r:!(O&4)?0:O&1?n:r;if(v)Be[d]=Be[ms[m]]=v;a=m;break}}}else if(ms.length==189){break}else{ms[a++]=d;ms[a++]=u;ms[a++]=l}}else if((p=Be[d])==2||p==1){let m=p==r;l=m?0:1;for(let O=a-3;O>=0;O-=3){let v=ms[O+2];if(v&2)break;if(m){ms[O+2]|=2}else{if(v&4)break;ms[O+2]|=4}}}}}}function h6(i,e,t,s){for(let r=0,n=s;r<=t.length;r++){let o=r?t[r-1].to:i,a=rl;){if(p==O){p=t[--m].from;O=m?t[m-1].to:i}Be[--p]=f}l=c}else{n=h;l++}}}}function Cm(i,e,t,s,r,n,o){let a=s%2?2:1;if(s%2==r%2){for(let l=e,h=0;ll)o.push(new Rs(l,m.from,f));let O=m.direction==Kn!=!(f%2);Tm(i,O?s+1:s,r,m.inner,m.from,m.to,o);l=m.to}p=m.to}else if(p==t||(c?Be[p]!=a:Be[p]==a)){break}else{p++}}if(u)Cm(i,l,p,s+1,r,u,o);else if(le;){let c=true,d=false;if(!h||l>n[h-1].to){let m=Be[l-1];if(m!=a){c=false;d=m==16}}let u=!c&&a==1?[]:null;let f=c?s:s+1;let p=l;e:for(;;){if(h&&p==n[h-1].to){if(d)break e;let m=n[--h];if(!c)for(let O=m.from,v=h;;){if(O==e)break e;if(v&&n[v-1].to==O)O=n[--v].from;else if(Be[O-1]==a)break e;else break}if(u){u.push(m)}else{if(m.toBe.length)Be[Be.length]=256;let s=[],r=e==Kn?0:1;Tm(i,r,r,t,0,i.length,s);return s}function P2(i){return[new Rs(0,i,0)]}let $2="";function d6(i,e,t,s,r){var n;let o=s.head-i.from;let a=Rs.find(e,o,(n=s.bidiLevel)!==null&&n!==void 0?n:-1,s.assoc);let l=e[a],h=l.side(r,t);if(o==h){let u=a+=r?1:-1;if(u<0||u>=e.length)return null;l=e[a=u];o=l.side(!r,t);h=l.side(r,t)}let c=Rt(i.text,o,l.forward(r,t));if(cl.to)c=h;$2=i.text.slice(Math.min(o,c),Math.max(o,c));let d=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];if(d&&c==h&&d.level+(r?0:1)i.some(e=>e)});const I2=te.define({combine:i=>i.some(e=>e)});const D2=te.define();class Uo{constructor(e,t,s,r,n,o=false){this.range=e;this.y=t;this.x=s;this.yMargin=r;this.xMargin=n;this.isSnapshot=o}map(e){return e.empty?this:new Uo(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Uo(z.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Nh=Te.define({map:(i,e)=>i.map(e)});const z2=Te.define();function As(i,e,t){let s=i.facet(A2);if(s.length)s[0](e);else if(window.onerror&&window.onerror(String(e),t,void 0,void 0,e));else if(t)console.error(t+":",e);else console.error(e)}const dr=te.define({combine:i=>i.length?i[0]:true});let f6=0;const Bo=te.define({combine(i){return i.filter((e,t)=>{for(let s=0;s{let l=[];if(o)l.push(au.of(h=>{let c=h.plugin(a);return c?o(c):fe.none}));if(n)l.push(n(a));return l})}static fromClass(e,t){return Kt.define((s,r)=>new e(s,r),t)}}class hf{constructor(e){this.spec=e;this.mustUpdate=null;this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec){try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){As(e.state,t,"CodeMirror plugin crashed");this.deactivate()}}}else if(this.mustUpdate){let t=this.mustUpdate;this.mustUpdate=null;if(this.value.update){try{this.value.update(t)}catch(s){As(t.state,s,"CodeMirror plugin crashed");if(this.value.destroy)try{this.value.destroy()}catch(r){}this.deactivate()}}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy){try{this.value.destroy()}catch(s){As(e.state,s,"CodeMirror plugin crashed")}}}deactivate(){this.spec=this.value=null}}const W2=te.define();const WO=te.define();const au=te.define();const q2=te.define();const qO=te.define();const fh=te.define();const X2=te.define();function v_(i,e){let t=i.state.facet(X2);if(!t.length)return t;let s=t.map(n=>n instanceof Function?n(i):n);let r=[];ye.spans(s,e.from,e.to,{point(){},span(n,o,a,l){let h=n-e.from,c=o-e.from;let d=r;for(let u=a.length-1;u>=0;u--,l--){let f=a[u].spec.bidiIsolate,p;if(f==null)f=u6(e.text,h,c);if(l>0&&d.length&&(p=d[d.length-1]).to==h&&p.direction==f){p.to=c;d=p.inner}else{let m={from:h,to:c,direction:f,inner:[]};d.push(m);d=m.inner}}}});return r}const N2=te.define();function F2(i){let e=0,t=0,s=0,r=0;for(let n of i.state.facet(N2)){let o=n(i);if(o){if(o.left!=null)e=Math.max(e,o.left);if(o.right!=null)t=Math.max(t,o.right);if(o.top!=null)s=Math.max(s,o.top);if(o.bottom!=null)r=Math.max(r,o.bottom)}}return{left:e,right:t,top:s,bottom:r}}const tl=te.define();class Xi{constructor(e,t,s,r){this.fromA=e;this.toA=t;this.fromB=s;this.toB=r}join(e){return new Xi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,s=this;for(;t>0;t--){let r=e[t-1];if(r.fromA>s.toA)continue;if(r.toAr.push(new Xi(n,o,a,l)));this.changedRanges=r}static create(e,t,s){return new md(e,t,s)}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&(16|2))>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const p6=[];class it{constructor(e,t,s=0){this.dom=e;this.length=t;this.flags=s;this.parent=null;e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return p6}isWidget(){return false}get isHidden(){return false}isComposite(){return false}isLine(){return false}isText(){return false}isBlock(){return false}get domAttrs(){return null}sync(e){this.flags|=2;if(this.flags&4){this.flags&=-5;let t=this.domAttrs;if(t)YE(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?\`(\${this.children})\`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e;e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let s=t;for(let r of this.children){if(r==e)return s;s+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return true}coordsIn(e,t,s){return null}domPosFor(e,t){let s=cn(this.dom);let r=this.length?e>0:t>0;return new rs(this.parent.dom,s+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3;if(e)this.flags|=4;if(this.parent&&this.parent.flags&2)this.parent.markDirty(false)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof hu)return e;return null}static get(e){return e.cmTile}}class lu extends it{constructor(e){super(e,0);this._children=[]}isComposite(){return true}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e);e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,s=null,r;let n=(e===null||e===void 0?void 0:e.node)==t?e:null;let o=0;for(let a of this.children){a.sync(e);o+=a.length+a.breakAfter;r=s?s.nextSibling:t.firstChild;if(n&&r!=a.dom)n.written=true;if(a.dom.parentNode==t){while(r&&r!=a.dom)r=y_(r)}else{t.insertBefore(a.dom,r)}s=a.dom}r=s?s.nextSibling:t.firstChild;if(n&&r)n.written=true;while(r)r=y_(r);this.length=o}}function y_(i){let e=i.nextSibling;i.parentNode.removeChild(i);return e}class hu extends lu{constructor(e,t){super(t);this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return true;return false}isBlock(){return true}nearest(e){for(;;){if(!e)return null;let t=it.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],s=this,r=0,n=0;;){if(r==s.children.length){if(!t.length)return;s=s.parent;if(s.breakAfter)n++;r=t.pop()}else{let o=s.children[r++];if(o instanceof mr){t.push(r);s=o;r=0}else{let a=n+o.length;let l=e(o,n);if(l!==void 0)return l;n=a+o.breakAfter}}}}resolveBlock(e,t){let s,r=-1,n,o=-1;this.blockTiles((a,l)=>{let h=l+a.length;if(e>=l&&e<=h){if(a.isWidget()&&t>=-1&&t<=1){if(a.flags&32)return true;if(a.flags&16)s=void 0}if((le||e==l&&(t>1?a.length:a.covers(-1)))&&(!n||!a.isWidget()&&n.isWidget())){n=a;o=e-l}}});if(!s&&!n)throw new Error("No tile at position "+e);return s&&t<0||!n?{tile:s,offset:r}:{tile:n,offset:o}}}class mr extends lu{constructor(e,t){super(e);this.wrapper=t}isBlock(){return true}covers(e){if(!this.children.length)return false;return e<0?this.children[0].covers(-1):this.lastChild.covers(1)}get domAttrs(){return this.wrapper.attributes}static of(e,t){let s=new mr(t||document.createElement(e.tagName),e);if(!t)s.flags|=4;return s}}class sa extends lu{constructor(e,t){super(e);this.attrs=t}isLine(){return true}static start(e,t,s){let r=new sa(t||document.createElement("div"),e);if(!t||!s)r.flags|=4;return r}get domAttrs(){return this.attrs}resolveInline(e,t,s){let r=null,n=-1,o=null,a=-1;function l(c,d){for(let u=0,f=0;u=d){if(p.isComposite()){l(p,d-f)}else if((!o||o.isHidden&&(t>0&&!(o.flags&32)||s&&g6(o,p)))&&(m>d||p.flags&32&&t<=1)){o=p;a=d-f}else if(f=-1){r=p;n=d-f}}f=m}}l(this,e);let h=(t<0?r:o)||r||o;return h?{tile:h,offset:h==r?n:a}:null}coordsIn(e,t,s){let r=this.resolveInline(e,t,true);if(!r)return m6(this);return r.tile.coordsIn(Math.max(0,r.offset),t,s)}domIn(e,t){let s=this.resolveInline(e,t);if(s){let{tile:r,offset:n}=s;if(this.dom.contains(r.dom)){if(r.isText())return new rs(r.dom,Math.min(r.dom.nodeValue.length,n));return r.domPosFor(n,r.flags&16?1:r.flags&32?-1:t)}let o=s.tile.parent,a=false;for(let l of o.children){if(a)return new rs(l.dom,0);if(l==s.tile){a=true}}}return new rs(this.dom,0)}}function m6(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Rc(e);return t[t.length-1]||null}function g6(i,e){let t=i.coordsIn(0,1),s=e.coordsIn(0,1);return t&&s&&s.topr)e=r;let n=e,o=e,a=0;if(e==0&&t<0||e==r&&t>=0){if(!(G.chrome||G.gecko)){if(e){n--;a=1}else if(o=0)?0:l.length-1];if(G.safari&&!a&&h.width==0)h=Array.prototype.find.call(l,c=>c.width)||h;return s==null?h:pd(h,(a?a>0:t<0)==s)}static of(e,t){let s=new Bn(t||document.createTextNode(e),e);if(!t)s.flags|=2;return s}}class Jn extends it{constructor(e,t,s,r){super(e,t,r);this.widget=s}isWidget(){return true}get isHidden(){return this.widget.isHidden}covers(e){if(this.flags&48)return false;return(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,false)}coordsInWidget(e,t,s){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(s){return pd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0)}else{let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let a=this.flags&16?true:this.flags&32?false:e>0;for(let l=a?n.length-1:0;;l+=a?-1:1){o=n[l];if(e>0?l==0:l==n.length-1||o.top0==s)}}class O6{constructor(e){this.index=0;this.beforeBreak=false;this.parents=[];this.tile=e}advance(e,t,s){let{tile:r,index:n,beforeBreak:o,parents:a}=this;while(e||t>0){if(!r.isComposite()){let l=r.length;if(n0?l.length<=e:l.length=0;a--){let l=t.marks[a];let h=r.lastChild;if(h instanceof Oi&&h.mark.eq(l.mark)){if(h.dom!=l.dom)h.setDOM(cf(l.dom));r=h}else{if(this.cache.reused.get(l)){let d=it.get(l.dom);if(d)d.setDOM(cf(l.dom))}let c=Oi.of(l.mark,l.dom);r.append(c);r=c}this.cache.reused.set(l,2)}let n=it.get(e.text);if(n)this.cache.reused.set(n,2);let o=new Bn(e.text,e.text.nodeValue);o.flags|=8;this.pos=e.range.toB;r.append(o)}addInlineWidget(e,t,s){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);if(!r)this.flushBuffer();let n=this.ensureMarks(t,s);if(!r&&!(e.flags&16))n.append(this.getBuffer(1));n.append(e);this.pos+=e.length;this.afterWidget=e}addMark(e,t,s){this.flushBuffer();let r=this.ensureMarks(t,s);r.append(e);this.pos+=e.length;this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e);this.pos+=e.length;this.lastBlock=e;this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e;this.pos+=e}addLineStart(e,t){var s;if(!e)e=Z2;let r=sa.start(e,t||((s=this.cache.find(sa))===null||s===void 0?void 0:s.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e);this.pos+=e.length;this.lastBlock=e;this.endLine()}addBreak(){this.lastBlock.flags|=1;this.endLine();this.pos++}addLineStartIfNotCovered(e){if(!this.blockPosCovered())this.addLineStart(e)}ensureLine(e){if(!this.curLine)this.addLineStart(e)}ensureMarks(e,t){var s;let r=this.curLine;for(let n=e.length-1;n>=0;n--){let o=e[n],a;if(t>0&&(a=r.lastChild)&&a instanceof Oi&&a.mark.eq(o)){r=a;t--}else{let l=Oi.of(o,(s=this.cache.find(Oi,h=>h.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(l);r=l;t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;if(!e||!b_(this.curLine,false)||e.dom.nodeName!="BR"&&e.isWidget()&&!(G.ios&&b_(this.curLine,true)))this.curLine.append(this.cache.findWidget(df,0,32)||new Jn(df.toDOM(),0,df,32));this.curLine=this.afterWidget=null}}updateBlockWrappers(){if(this.wrapperPos>this.pos+1e4){this.blockWrappers.goto(this.pos);this.wrappers.length=0}for(let e=this.wrappers.length-1;e>=0;e--)if(this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank;let s=new _6(e.from,e.to,e.value,t),r=this.wrappers.length;while(r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let s of this.wrappers){let r=t.lastChild;if(s.fromo.wrapper.eq(s.wrapper)))===null||e===void 0?void 0:e.dom);t.append(n);t=n}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&(32|128))>0)}getBuffer(e){let t=2|(e<0?16:32);let s=this.cache.find(gd,void 0,1);if(s)s.flags=t;return s||new gd(t)}flushBuffer(){if(this.afterWidget&&!(this.afterWidget.flags&32)){this.afterWidget.parent.append(this.getBuffer(-1));this.afterWidget=null}}}class y6{constructor(e){this.skipCount=0;this.text="";this.textOff=0;this.cursor=e.iter()}skip(e){if(this.textOff+e<=this.text.length){this.textOff+=e}else{this.skipCount+=e-(this.text.length-this.textOff);this.text="";this.textOff=0}}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:n,done:o}=this.cursor.next(this.skipCount);this.skipCount=0;if(o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(e,r.length);return n?null:r.slice(0,a)}let t=Math.min(this.text.length,this.textOff+e);let s=this.text.slice(this.textOff,t);this.textOff=t;return s}}const Od=[Jn,sa,Bn,Oi,gd,mr,hu];for(let i=0;i[]);this.index=Od.map(()=>0);this.reused=new Map}add(e){let t=e.constructor.bucket,s=this.buckets[t];if(s.length<6)s.push(e);else s[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,s=2){let r=e.bucket;let n=this.buckets[r],o=this.index[r];for(let a=0;a{this.cache.add(o);if(o.isComposite())return false},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let s=t&&this.getCompositionContext(t.text);for(let r=0,n=0,o=0;;){let a=or){let h=l-r;this.preserve(h,!o,!a);r=l;n+=h}if(!a)break;if(t&&a.fromA<=t.range.fromA&&a.toA>=t.range.toA){this.forward(a.fromA,t.range.fromA,t.range.fromA{if(o.isWidget()){if(this.openWidget){this.builder.continueWidget(l-a)}else{let h=l>0||a{if(o.isLine()){this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o))}else{this.cache.add(o);if(o instanceof Oi)r.unshift(o.mark)}this.openWidget=false},leave:o=>{if(o.isLine()){if(r.length)r.length=n=0}else if(o instanceof Oi){r.shift();n=Math.min(n,r.length)}},break:()=>{this.builder.addBreak();this.openWidget=false}});this.text.skip(e)}emit(e,t){let s=null;let r=this.builder,n=-1;let o=ye.spans(this.decorations,e,t,{point:(a,l,h,c,d,u)=>{if(h instanceof Gn){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}n=c.length;if(d>c.length){r.continueWidget(l-a)}else{let f=h.widget||(h.block?ra.block:ra.inline);let p=w6(h);let m=this.cache.findWidget(f,l-a,p)||Jn.of(f,this.view,l-a,p);if(h.block){if(h.startSide>0)r.addLineStartIfNotCovered(s);r.addBlockWidget(m)}else{r.ensureLine(s);r.addInlineWidget(m,c,d)}}s=null}else{s=x6(s,h)}if(l>a)this.text.skip(l-a)},span:(a,l,h,c)=>{for(let d=a;d-1)this.openWidget=o>n;if(!this.openWidget)r.addLineStartIfNotCovered(s);this.openMarks=o}forward(e,t,s=1){if(t-e<=10){this.old.advance(t-e,s,this.reuseWalker)}else{this.old.advance(5,-1,this.reuseWalker);this.old.advance(t-e-10,-1);this.old.advance(5,s,this.reuseWalker)}}getCompositionContext(e){let t=[],s=null;for(let r=e.parentNode;;r=r.parentNode){let n=it.get(r);if(r==this.view.contentDOM)break;if(n instanceof Oi)t.push(n);else if(n===null||n===void 0?void 0:n.isLine())s=n;else if(n instanceof mr);else if(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM)s=new sa(r,Z2);else if(!s)t.push(Oi.of(new dh({tagName:r.nodeName.toLowerCase(),attributes:GE(r)}),r))}return{line:s,marks:t}}}function b_(i,e){let t=s=>{for(let r of s.children)if((e?r.isText():r.length)||t(r))return true;return false};return t(i)}function w6(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;if(i.block)e|=256;return e}const Z2={class:"cm-line"};function x6(i,e){let t=e.spec.attributes,s=e.spec.class;if(!t&&!s)return i;if(!i)i={class:"cm-line"};if(t)MO(t,i);if(s)i.class+=" "+s;return i}function k6(i){let e=[];for(let t=i.parents.length;t>1;t--){let s=t==i.parents.length?i.tile:i.parents[t].tile;if(s instanceof Oi)e.push(s.mark)}return e}function cf(i){let e=it.get(i);if(e)e.setDOM(i.cloneNode());return i}class ra extends uo{constructor(e){super();this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return true}}ra.inline=new ra("span");ra.block=new ra("div");const df=new class extends uo{toDOM(){return document.createElement("br")}get isHidden(){return true}get editable(){return true}};class S_{constructor(e){this.view=e;this.decorations=[];this.blockWrappers=[];this.dynamicDecorationMap=[false];this.domChanged=null;this.hasComposition=null;this.editContextFormatting=fe.none;this.lastCompositionAfterCursor=false;this.minWidth=0;this.minWidthFrom=0;this.minWidthTo=0;this.impreciseAnchor=null;this.impreciseHead=null;this.forceSelection=false;this.lastUpdate=Date.now();this.updateDeco();this.tile=new hu(e,e.contentDOM);this.updateInner([new Xi(0,0,0,e.state.doc.length)],null)}update(e){var t;let s=e.changedRanges;if(this.minWidth>0&&s.length){if(!s.every(({fromA:c,toA:d})=>dthis.minWidthTo)){this.minWidth=this.minWidthFrom=this.minWidthTo=0}else{this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1);this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)}}this.updateEditContextFormatting(e);let r=-1;if(this.view.inputState.composing>=0&&!this.view.observer.editContext){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)r=this.domChanged.newSel.head;else if(!L6(e.changes,this.hasComposition)&&!e.selectionSet)r=e.state.selection.main.head}let n=r>-1?T6(this.view,e.changes,r):null;this.domChanged=null;if(this.hasComposition){let{from:c,to:d}=this.hasComposition;s=new Xi(c,d,e.changes.mapPos(c,-1),e.changes.mapPos(d,1)).addToSet(s.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null;if((G.ie||G.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=true;let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=E6(o,this.decorations,e.changes);if(l.length)s=Xi.extendWithRanges(s,l);let h=R6(a,this.blockWrappers,e.changes);if(h.length)s=Xi.extendWithRanges(s,h);if(n&&!s.some(c=>c.fromA<=n.range.fromA&&c.toA>=n.range.toA))s=n.range.addToSet(s.slice());if(this.tile.flags&2&&s.length==0){return false}else{this.updateInner(s,n);if(e.transactions.length)this.lastUpdate=Date.now();return true}}updateInner(e,t){this.view.viewState.mustMeasureContent=true;let{observer:s}=this.view;s.ignore(()=>{if(t||e.length){let o=this.tile;let a=new S6(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);if(t&&it.get(t.text))a.cache.reused.set(it.get(t.text),2);this.tile=a.run(e,t);$m(o,a.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 n=G.chrome||G.ios?{node:s.selectionRange.focusNode,written:false}:void 0;this.tile.sync(n);if(n&&(n.written||s.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node)))this.forceSelection=true;this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&gl(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(n||t||o))return;let a=this.forceSelection;this.forceSelection=false;let l=this.view.state.selection.main,h,c;if(l.empty){c=h=this.inlineDOMNearPos(l.anchor,l.assoc||1)}else{c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1);h=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)}if(G.gecko&&l.empty&&!this.hasComposition&&C6(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null));h=c=new rs(u,0);a=true}let d=this.view.observer.selectionRange;if(a||!d.focusNode||(!Ol(h.node,h.offset,d.anchorNode,d.anchorOffset)||!Ol(c.node,c.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l)){this.view.observer.ignore(()=>{if(G.android&&G.chrome&&s.contains(d.focusNode)&&A6(d.focusNode,s)){s.blur();s.focus({preventScroll:true})}let u=zl(this.view.root);if(!u);else if(l.empty){if(G.gecko){let f=P6(h.node,h.offset);if(f&&f!=(1|2)){let p=(f==1?w2:x2)(h.node,h.offset);if(p)h=new rs(p.node,p.offset)}}u.collapse(h.node,h.offset);if(l.bidiLevel!=null&&u.caretBidiLevel!==void 0)u.caretBidiLevel=l.bidiLevel}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch(f){}}else{let f=document.createRange();if(l.anchor>l.head)[h,c]=[c,h];f.setEnd(c.node,c.offset);f.setStart(h.node,h.offset);u.removeAllRanges();u.addRange(f)}if(o&&this.view.root.activeElement==s){s.blur();if(r)r.focus()}});this.view.observer.setSelectionRange(h,c)}this.impreciseAnchor=h.precise?null:new rs(d.anchorNode,d.anchorOffset);this.impreciseHead=c.precise?null:new rs(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ol(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main;let s=zl(e.root);let{anchorNode:r,anchorOffset:n}=e.observer.selectionRange;if(!s||!t.empty||!t.assoc||!s.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!l||!h||l.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);s.collapse(c.node,c.offset);s.modify("move",t.assoc<0?"forward":"backward","lineboundary");e.observer.readSelectionRange();let d=e.observer.selectionRange;if(e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=t.from)s.collapse(r,n)}posFromDOM(e,t){let s=this.tile.nearest(e);if(!s)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let n;if(e==s.dom){n=s.dom.childNodes[t]}else{let o=Or(e)==0?0:t==0?-1:1;for(;;){let a=e.parentNode;if(a==s.dom)break;if(o==0&&a.firstChild!=a.lastChild){if(e==a.firstChild)o=-1;else o=1}e=a}if(o<0)n=e;else n=e.nextSibling}if(n==s.dom.firstChild)return r;while(n&&!it.get(n))n=n.nextSibling;if(!n)return r+s.length;for(let o=0,a=r;;o++){let l=s.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}else if(s.isText()){return e==s.dom?r+t:r+(t?s.length:0)}else{return r}}domAtPos(e,t){let{tile:s,offset:r}=this.tile.resolveBlock(e,t);if(s.isWidget())return s.domPosFor(r,t);return s.domIn(r,t)}inlineDOMNearPos(e,t){let s,r=-1,n=false;let o,a=-1,l=false;this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return true;if(h.flags&16)n=true}else{let d=c+h.length;if(c<=e){s=h;r=e-c;n=d=e&&!o){o=h;a=e-c;l=c>e}if(c>e&&o)return true}});if(!s&&!o)return this.domAtPos(e,t);if(n&&o)s=null;else if(l&&s)o=null;return s&&t<0||!o?s.domIn(r,t):o.domIn(a,t)}coordsAt(e,t,s){let{tile:r,offset:n}=this.tile.resolveBlock(e,t);if(r.isWidget()){if(r.widget instanceof uf)return null;return r.coordsInWidget(n,t,true)}return r.coordsIn(n,t,s)}lineAt(e,t){let{tile:s}=this.tile.resolveBlock(e,t);return s.isLine()?s:null}coordsForChar(e){let{tile:t,offset:s}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(n,o){if(n.isComposite()){for(let a of n.children){if(a.length>=o){let l=r(a,o);if(l)return l}o-=a.length;if(o<0)break}}else if(n.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1;let a=-1,l=this.view.textDirection==Ue.LTR;let h=0;let c=(d,u,f)=>{for(let p=0;pr)break;let m=d.children[p],O=u+m.length;let v=m.dom.getBoundingClientRect(),{height:T}=v;if(f&&!p)h+=v.top-f.top;if(m instanceof mr){if(O>s)c(m,u,v)}else if(u>=s){if(h>0)t.push(-h);t.push(T+h);h=0;if(o){let k=m.dom.lastChild;let _=k?Rc(k):[];if(_.length){let C=_[_.length-1];let w=l?C.right-v.left:v.right-C.left;if(w>a){a=w;this.minWidth=n;this.minWidthFrom=u;this.minWidthTo=O}}}}if(f&&p==d.children.length-1)h+=f.bottom-v.bottom;u=O+m.breakAfter}};c(this.tile,0,null);return t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Ue.RTL:Ue.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return void 0;let c=Rc(h.dom);if(c.length!=1)return void 0;a+=c[0].width;l=c[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),s,r,n;t.className="cm-line";t.style.width="99999px";t.style.position="absolute";t.textContent="abc def ghi jkl mno pqr stu";this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Rc(t.firstChild)[0];s=t.getBoundingClientRect().height;r=o&&o.width?o.width/27:7;n=o&&o.height?o.height:s;t.remove()});return{lineHeight:s,charWidth:r,textHeight:n}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let s=0,r=0;;r++){let n=r==t.viewports.length?null:t.viewports[r];let o=n?n.from-1:this.view.state.doc.length;if(o>s){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(s).top)/this.view.scaleY;e.push(fe.replace({widget:new uf(a),block:true,inclusive:true,isBlockGap:true}).range(s,o))}if(!n)break;s=n.to+1}return fe.set(e)}updateDeco(){let e=1;let t=this.view.state.facet(au).map(n=>{let o=this.dynamicDecorationMap[e++]=typeof n=="function";return o?n(this.view):n});let s=false,r=this.view.state.facet(qO).map((n,o)=>{let a=typeof n=="function";if(a)s=true;return a?n(this.view):n});if(r.length){this.dynamicDecorationMap[e++]=s;t.push(ye.join(r))}this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(etypeof n=="function"?n(this.view):n)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin;this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(D2)){try{if(h(this.view,e.range,e))return true}catch(c){As(this.view.state,c,"scroll handler")}}let{range:t}=e;let s=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!s)return;if(!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))s={left:Math.min(s.left,r.left),top:Math.min(s.top,r.top),right:Math.max(s.right,r.right),bottom:Math.max(s.bottom,r.bottom)};let n=F2(this.view);let o={left:s.left-n.left,top:s.top-n.top,right:s.right+n.right,bottom:s.bottom+n.bottom};let{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;e6(this.view.scrollDOM,o,t.head1&&(s.top>window.visualViewport.offsetTop+window.visualViewport.height||s.bottoms.isWidget()||s.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){$m(this.tile)}}function $m(i,e){let t=e===null||e===void 0?void 0:e.get(i);if(t!=1){if(t==null)i.destroy();for(let s of i.children)$m(s,e)}}function C6(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function U2(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let s=w2(t.focusNode,t.focusOffset);let r=x2(t.focusNode,t.focusOffset);let n=s||r;if(r&&s&&r.node!=s.node){let a=it.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue){n=r}else if(i.docView.lastCompositionAfterCursor){let l=it.get(s.node);if(!(!l||l.isText()&&l.text!=s.node.nodeValue))n=r}}i.docView.lastCompositionAfterCursor=n!=s;if(!n)return null;let o=e-n.offset;return{from:o,to:o+n.node.nodeValue.length,node:n.node}}function T6(i,e,t){let s=U2(i,t);if(!s)return null;let{node:r,from:n,to:o}=s,a=r.nodeValue;if(/[\\n\\r]/.test(a))return null;if(i.state.doc.sliceString(s.from,s.to)!=a)return null;let l=e.invertedDesc;return{range:new Xi(l.mapPos(n),l.mapPos(o),n,o),text:r}}function P6(i,e){if(i.nodeType!=1)return 0;return(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e{if(se.from)t=true});return t}class uf extends uo{constructor(e){super();this.height=e}toDOM(){let e=document.createElement("div");e.className="cm-gap";this.updateDOM(e);return e}eq(e){return e.height==this.height}updateDOM(e){e.style.height=this.height+"px";return true}get editable(){return true}get estimatedHeight(){return this.height}ignoreEvent(){return false}}function M6(i,e,t=1){let s=i.charCategorizer(e);let r=i.doc.lineAt(e),n=e-r.from;if(r.length==0)return z.cursor(e);if(n==0)t=1;else if(n==r.length)t=-1;let o=n,a=n;if(t<0)o=Rt(r.text,n,false);else a=Rt(r.text,n);let l=s(r.text.slice(o,a));while(o>0){let h=Rt(r.text,o,false);if(s(r.text.slice(h,o))!=l)break;o=h}while(ai.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight;let l=Math.floor((r-t.top-(i.defaultLineHeight-a)*.5)/a);n+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+Om(o,n,i.state.tabSize)}function Em(i,e,t){let s=i.lineBlockAt(e);if(Array.isArray(s.type)){let r;for(let n of s.type){if(n.from>e)break;if(n.toe)return n;if(!r||n.type==Ft.Text&&(r.type!=n.type||(t<0?n.frome)))r=n}return r||s}return s}function I6(i,e,t,s){let r=Em(i,e.head,e.assoc||-1);let n=!s||r.type!=Ft.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(n){let o=i.dom.getBoundingClientRect();let a=i.textDirectionAt(r.from);let l=i.posAtCoords({x:t==(a==Ue.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return z.cursor(l,t?-1:1)}return z.cursor(t?r.to:r.from,t?-1:1)}function w_(i,e,t,s){let r=i.state.doc.lineAt(e.head),n=i.bidiSpans(r);let o=i.textDirectionAt(r.from);for(let a=e,l=null;;){let h=d6(r,n,o,a,t),c=$2;if(!h){if(r.number==(t?i.state.doc.lines:1))return a;c="\\n";r=i.state.doc.line(r.number+(t?1:-1));n=i.bidiSpans(r);h=i.visualLineSide(r,!t)}if(!l){if(!s)return h;l=s(c)}else if(!l(c)){return a}a=h}}function D6(i,e,t){let s=i.state.charCategorizer(e);let r=s(t);return n=>{let o=s(n);if(r==ot.Space)r=o;return r==o}}function z6(i,e,t,s){let r=e.head,n=t?1:-1;if(r==(t?i.state.doc.length:0))return z.cursor(r,e.assoc);let o=e.goalColumn,a;let l=i.contentDOM.getBoundingClientRect();let h=i.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1));let c=i.documentTop;if(h){if(o==null)o=h.left-l.left;a=n<0?h.top:h.bottom}else{let p=i.viewState.lineBlockAt(r);if(o==null)o=Math.min(l.right-l.left,i.defaultCharacterWidth*(r-p.from));a=(n<0?p.top:p.bottom)+c}let d=l.left+o;let u=i.viewState.heightOracle.textHeight>>1,f=s!==null&&s!==void 0?s:u;for(let p=0;;p+=u){let m=a+(f+p)*n;let O=Qm(i,{x:d,y:m},false,n);if(t?m>l.bottom:ma:T{if(e>n&&er(i)),t.from,e.head>t.from?-1:1);return s==t.from?t:z.cursor(s,si.viewState.docHeight)return new Es(i.state.doc.length,-1);h=i.elementAtHeight(l);if(s==null)break;if(h.type==Ft.Text){if(s<0?h.toi.viewport.to)break;let u=i.docView.coordsAt(s<0?h.from:h.to,s>0?-1:1);if(u&&(s<0?u.top<=l+n:u.bottom>=l+n))break}let d=i.viewState.heightOracle.textHeight/2;l=s>0?h.bottom+d:h.top-d}if(i.viewport.from>=h.to||i.viewport.to<=h.from){if(t)return null;if(h.type==Ft.Text){let d=B6(i,r,h,o,a);return new Es(d,d==h.from?1:-1)}}if(h.type!=Ft.Text)return l<(h.top+h.bottom)/2?new Es(h.from,1):new Es(h.to,-1);let c=i.docView.lineAt(h.from,2);if(!c||c.length!=h.length)c=i.docView.lineAt(h.from,-2);return new W6(i,o,a,i.textDirectionAt(h.from)).scanTile(c,h.from)}class W6{constructor(e,t,s,r){this.view=e;this.x=t;this.y=s;this.baseDir=r;this.line=null;this.spans=null}bidiSpansAt(e){if(!this.line||this.line.from>e||this.line.to1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from>1;t:if(o.has(m)){for(let T=1;T=n)k-=p;if(!o.has(k)){m=k;break t}}break e}o.add(m);let O=t(m),v=0;if(O)for(let T=0;T1)continue;if(k.bottomthis.y){if(!h||h.top>k.top)h=k;v=-1}else{let _=k.left>this.x?this.x-k.left:k.right(p+p+m)/3){this.y=l.bottom-1;return this.scan(e,t,true)}if(h&&h.top<(p+m+m)/3){this.y=h.top+1;return this.scan(e,t,true)}}let f=(a?this.dirAt(e[c],1):this.baseDir)==Ue.LTR;return{i:c,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let s=[];for(let n=0;n{let o=s[n]-t,a=s[n+1]-t;return Wl(e.dom,o,a).getClientRects()});return r.after?new Es(s[r.i+1],-1):new Es(s[r.i],1)}scanTile(e,t){if(!e.length)return new Es(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);else if(a.isComposite())return this.scanTile(a,t)}let s=[t];for(let a=0,l=t;a{let l=e.children[a];if(l.flags&48)return null;return(l.dom.nodeType==1?l.dom:Wl(l.dom,0,l.length)).getClientRects()});let n=e.children[r.i],o=s[r.i];if(n.isText())return this.scanText(n,o);if(n.isComposite())return this.scanTile(n,o);return r.after?new Es(s[r.i+1],-1):new Es(o,1)}}const Eo="￿";class q6{constructor(e,t){this.points=e;this.view=t;this.text="";this.lineSeparator=t.state.facet(xe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Eo}readRange(e,t){if(!e)return this;let s=e.parentNode;for(let r=e;;){this.findPointBefore(s,r);let n=this.text.length;this.readNode(r);let o=it.get(r),a=r.nextSibling;if(a==t){if((o===null||o===void 0?void 0:o.breakAfter)&&!a&&s!=this.view.contentDOM)this.lineBreak();break}let l=it.get(a);if((o&&l?o.breakAfter:(o?o.breakAfter:fd(r))||fd(a)&&(r.nodeName!="BR"||(o===null||o===void 0?void 0:o.isWidget()))&&this.text.length>n)&&!N6(a,t))this.lineBreak();r=a}this.findPointBefore(s,t);return this}readTextNode(e){let t=e.nodeValue;for(let s of this.points)if(s.node==e)s.pos=this.text.length+Math.min(s.offset,t.length);for(let s=0,r=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let n=-1,o=1,a;if(this.lineSeparator){n=t.indexOf(this.lineSeparator,s);o=this.lineSeparator.length}else if(a=r.exec(t)){n=a.index;o=a[0].length}this.append(t.slice(s,n<0?t.length:n));if(n<0)break;this.lineBreak();if(o>1){for(let l of this.points)if(l.node==e&&l.pos>this.text.length)l.pos-=o-1}s=n+o}}readNode(e){let t=it.get(e);let s=t&&t.overrideDOMText;if(s!=null){this.findPointInside(e,s.length);for(let r=s.iter();!r.next().done;){if(r.lineBreak)this.lineBreak();else this.append(r.value)}}else if(e.nodeType==3){this.readTextNode(e)}else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1){this.readRange(e.firstChild,null)}}findPointBefore(e,t){for(let s of this.points)if(s.node==e&&e.childNodes[s.offset]==t)s.pos=this.text.length}findPointInside(e,t){for(let s of this.points)if(e.nodeType==3?s.node==e:e.contains(s.node))s.pos=this.text.length+(X6(e,s.node,s.offset)?t:0)}}function X6(i,e,t){for(;;){if(!e||t-1;let{impreciseHead:n,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1){this.newSel=null}else if(t>-1&&(this.bounds=H2(e.docView.tile,t,s,0))){let l=n||o?[]:U6(e);let h=new q6(l,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM);this.text=h.text;this.newSel=j6(l,this.bounds.from)}else{let l=e.observer.selectionRange;let h=n&&n.node==l.focusNode&&n.offset==l.focusOffset||!xm(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset);let c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!xm(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);let d=e.viewport;if((G.ios||G.chrome)&&h!=c&&Math.min(h,c)<=a.main.from&&Math.max(h,c)>=a.main.to&&(d.from>0||d.to-1&&a.ranges.length>1){this.newSel=a.replaceRange(z.range(c,h))}else if(e.lineWrapping&&c==h&&!(a.main.empty&&a.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let u=e.coordsAtPos(h,-1),f=0;if(u)f=e.inputState.lastTouchY<=u.bottom?-1:1;this.newSel=z.create([z.cursor(h,f)])}else{this.newSel=z.single(c,h)}}}}function H2(i,e,t,s){if(i.isComposite()){let r=-1,n=-1,o=-1,a=-1;for(let l=0,h=s,c=s;lt)return H2(d,e,t,h);if(u>=e&&r==-1){r=l;n=h}if(h>t&&d.dom.parentNode==i.dom){o=l;a=c;break}c=u;h=u+d.breakAfter}return{from:n,to:a<0?s+i.length:a,startDOM:(r?i.children[r-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o=0?i.children[o].dom:null}}else if(i.isText()){return{from:s,to:s+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}}else{return null}}function V2(i,e){let t;let{newSel:s}=e,{state:r}=i,n=r.selection.main;let o=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds;let h=n.from,c=null;if(o===8||G.android&&e.text.length=a&&n.to<=l&&(e.typeOver||d!=e.text)&&d.slice(0,n.from-a)==e.text.slice(0,n.from-a)&&d.slice(n.to-a)==e.text.slice(u=e.text.length-(d.length-(n.to-a)))){t={from:n.from,to:n.to,insert:Pe.of(e.text.slice(n.from-a,u).split(Eo))}}else if(f=Y2(d,e.text,h-a,c)){if(G.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==Eo+Eo)f.toB--;t={from:a+f.from,to:a+f.toA,insert:Pe.of(e.text.slice(f.from,f.toB).split(Eo))}}}else if(s&&(!i.hasFocus&&r.facet(dr)||_d(s,n))){s=null}if(!t&&!s)return false;if((G.mac||G.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"){if(s&&t.insert.length==2)s=z.single(s.main.anchor-1,s.main.head-1);t={from:t.from,to:t.to,insert:Pe.of([t.insert.toString().replace("."," ")])}}else if(r.doc.lineAt(n.from).toDate.now()-50){t={from:n.from,to:n.to,insert:r.toText(i.inputState.insertingText)}}else if(G.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()=="\\n "&&i.lineWrapping){if(s)s=z.single(s.main.anchor-1,s.main.head-1);t={from:n.from,to:n.to,insert:Pe.of([" "])}}if(t){return XO(i,t,s,o)}else if(s&&!_d(s,n)){let a=false,l="select";if(i.inputState.lastSelectionTime>Date.now()-50){if(i.inputState.lastSelectionOrigin=="select")a=true;l=i.inputState.lastSelectionOrigin;if(l=="select.pointer")s=j2(r.facet(fh).map(h=>h(i)),s)}i.dispatch({selection:s,scrollIntoView:a,userEvent:l});return true}else{return false}}function XO(i,e,t,s=-1){if(G.ios&&i.inputState.flushIOSKey(e))return true;let r=i.state.selection.main;if(G.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Zo(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||s==8&&e.insert.lengthr.head)&&Zo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Zo(i.contentDOM,"Delete",46)))return true;let n=e.insert.toString();if(i.inputState.composing>=0)i.inputState.composing++;let o;let a=()=>o||(o=Z6(i,e,t));if(!i.state.facet(L2).some(l=>l(i,e.from,e.to,n,a)))i.dispatch(a());return true}function Z6(i,e,t){let s,r=i.state,n=r.selection.main,o=-1;if(e.from==e.to&&e.fromn.to){let l=e.fromd(i)),h,l);if(e.from==c)o=c}if(o>-1){s={changes:e,selection:z.cursor(e.from+e.insert.length,-1)}}else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=n.frome.to?r.sliceDoc(e.to,n.to):"";s=r.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+h))}else{let l=r.changes(e);let h=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let c=i.state.sliceDoc(e.from,e.to);let d,u=t&&U2(i,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);d={from:u.from,to:u.to-p}}else{d=i.state.doc.lineAt(n.head)}let f=n.to-e.to;s=r.changeByRange(p=>{if(p.from==n.from&&p.to==n.to)return{changes:l,range:h||p.map(l)};let m=p.to-f,O=m-c.length;if(i.state.sliceDoc(O,m)!=c||m>=d.from&&O<=d.to)return{range:p};let v=r.changes({from:O,to:m,insert:e.insert}),T=p.to-n.to;return{changes:v,range:!h?p.map(v):z.range(Math.max(0,h.anchor+T),Math.max(0,h.head+T))}})}else{s={changes:l,selection:h&&r.selection.replaceRange(h)}}}let a="input.type";if(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50){i.inputState.compositionPendingChange=false;a+=".compose";if(i.inputState.compositionFirstChange){a+=".start";i.inputState.compositionFirstChange=false}}return r.update(s,{userEvent:a,scrollIntoView:true})}function Y2(i,e,t,s){let r=Math.min(i.length,e.length);let n=0;while(n0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1)){o--;a--}if(s=="end"){let l=Math.max(0,n-Math.min(o,a));t-=o+l-n}if(o=o?n-t:0;n-=l;a=n+(a-o);o=n}else if(a=a?n-t:0;n-=l;o=n+(o-a);a=n}return{from:n,toA:o,toB:a}}function U6(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:n}=i.observer.selectionRange;if(t){e.push(new x_(t,s));if(r!=t||n!=s)e.push(new x_(r,n))}return e}function j6(i,e){if(i.length==0)return null;let t=i[0].pos,s=i.length==2?i[1].pos:t;return t>-1&&s>-1?z.single(t+e,s+e):null}function _d(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}class H6{setSelectionOrigin(e){this.lastSelectionOrigin=e;this.lastSelectionTime=Date.now()}constructor(e){this.view=e;this.lastKeyCode=0;this.lastKeyTime=0;this.touchActive=false;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=false;this.compositionPendingChange=false;this.insertingText="";this.insertingTextAt=0;this.mouseSelection=null;this.draggedContent=null;this.handleEvent=this.handleEvent.bind(this);this.notifiedFocused=e.hasFocus;if(G.safari)e.contentDOM.addEventListener("input",()=>null);if(G.gecko)cQ(e.contentDOM.ownerDocument)}handleEvent(e){if(!sQ(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;if(this.view.updateState!=0)Promise.resolve().then(()=>this.runHandlers(e.type,e));else this.runHandlers(e.type,e)}runHandlers(e,t){let s=this.handlers[e];if(s){for(let r of s.observers)r(this.view,t);for(let r of s.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Y6(e),s=this.handlers,r=this.view.contentDOM;for(let n in t)if(n!="scroll"){let o=!t[n].handlers.length;let a=s[n];if(a&&o!=!a.handlers.length){r.removeEventListener(n,this.handleEvent);a=null}if(!a)r.addEventListener(n,this.handleEvent,{passive:o})}for(let n in s)if(n!="scroll"&&!t[n])r.removeEventListener(n,this.handleEvent);this.handlers=t}keydown(e){this.lastKeyCode=e.keyCode;this.lastKeyTime=Date.now();if(e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return true;if(this.tabFocusMode>0&&e.keyCode!=27&&K2.indexOf(e.keyCode)<0)this.tabFocusMode=-1;if(G.android&&G.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8)){this.view.observer.delayAndroidKey(e.key,e.keyCode);return true}if(G.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(G2.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||G6.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};if(t.shiftKey&&G.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&V6(this.view.win))t.shiftKey=false;this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};setTimeout(()=>this.flushIOSKey(),250);return true}if(e.keyCode!=229)this.view.observer.forceFlush();return false}flushIOSKey(e){let t=this.pendingIOSKey;if(!t)return false;if(t.key=="Enter"&&e&&e.from0)return true;if(G.safari&&!G.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100){this.compositionPendingKey=false;return true}return false}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){this.view.observer.update(e);if(this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function V6(i){if(!i.visualViewport)return false;return i.visualViewport.height*i.visualViewport.scale/i.document.documentElement.clientHeight<.85}function k_(i,e){return(t,s)=>{try{return e.call(i,s,t)}catch(r){As(t.state,r)}}}function Y6(i){let e=Object.create(null);function t(s){return e[s]||(e[s]={observers:[],handlers:[]})}for(let s of i){let r=s.spec,n=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(n)for(let a in n){let l=n[a];if(l)t(a).handlers.push(k_(s.value,l))}if(o)for(let a in o){let l=o[a];if(l)t(a).observers.push(k_(s.value,l))}}for(let s in ns)t(s).handlers.push(ns[s]);for(let s in li)t(s).observers.push(li[s]);return e}const G2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];const G6="dthko";const K2=[16,17,18,20,91,92,224,225];const Fh=6;function Zh(i){return Math.max(0,i)*.7+8}function K6(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class J6{constructor(e,t,s,r){this.view=e;this.startEvent=t;this.style=s;this.mustSelect=r;this.scrollSpeed={x:0,y:0};this.scrolling=-1;this.lastEvent=t;this.scrollParents=_2(e.contentDOM);this.atoms=e.state.facet(fh).map(o=>o(e));let n=e.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this));n.addEventListener("mouseup",this.up=this.up.bind(this));this.extend=t.shiftKey;this.multiple=e.state.facet(xe.allowMultipleSelections)&&eQ(e,t);this.dragging=iQ(e,t)&&tx(t)==1?null:false}start(e){if(this.dragging===false)this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&K6(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,s=0;let r=0,n=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;if(this.scrollParents.x)({left:r,right:o}=this.scrollParents.x.getBoundingClientRect());if(this.scrollParents.y)({top:n,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=F2(this.view);if(e.clientX-l.left<=r+Fh)t=-Zh(r-e.clientX);else if(e.clientX+l.right>=o-Fh)t=Zh(e.clientX-o);if(e.clientY-l.top<=n+Fh)s=-Zh(n-e.clientY);else if(e.clientY+l.bottom>=a-Fh)s=Zh(e.clientY-a);this.setScrollSpeed(t,s)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!this.dragging)e.preventDefault();this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move);e.removeEventListener("mouseup",this.up);this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t};if(e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1){clearInterval(this.scrolling);this.scrolling=-1}}scroll(){let{x:e,y:t}=this.scrollSpeed;if(e&&this.scrollParents.x){this.scrollParents.x.scrollLeft+=e;e=0}if(t&&this.scrollParents.y){this.scrollParents.y.scrollTop+=t;t=0}if(e||t)this.view.win.scrollBy(e,t);if(this.dragging===false)this.select(this.lastEvent)}select(e){let{view:t}=this,s=j2(this.atoms,this.style.get(e,this.extend,this.multiple));if(this.mustSelect||!s.eq(t.state.selection,this.dragging===false))this.view.dispatch({selection:s,userEvent:"select.pointer"});this.mustSelect=false}update(e){if(e.transactions.some(t=>t.isUserEvent("input.type")))this.destroy();else if(this.style.update(e))setTimeout(()=>this.select(this.lastEvent),20)}}function eQ(i,e){let t=i.state.facet(E2);return t.length?t[0](e):G.mac?e.metaKey:e.ctrlKey}function tQ(i,e){let t=i.state.facet(Q2);return t.length?t[0](e):G.mac?!e.altKey:!e.ctrlKey}function iQ(i,e){let{main:t}=i.state.selection;if(t.empty)return false;let s=zl(i.root);if(!s||s.rangeCount==0)return true;let r=s.getRangeAt(0).getClientRects();for(let n=0;n=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return true}return false}function sQ(i,e){if(!e.bubbles)return true;if(e.defaultPrevented)return false;for(let t=e.target,s;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(s=it.get(t))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(e))return false;return true}const ns=Object.create(null);const li=Object.create(null);const J2=G.ie&&G.ie_version<15||G.ios&&G.webkit_version<604;function rQ(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px";t.focus();setTimeout(()=>{i.focus();t.remove();ex(i,t.value)},50)}function cu(i,e,t){for(let s of i.facet(e))t=s(t,i);return t}function ex(i,e){e=cu(i.state,DO,e);let{state:t}=i,s,r=1,n=t.toText(e);let o=n.lines==t.selection.ranges.length;let a=Rm!=null&&t.selection.ranges.every(l=>l.empty)&&Rm==n.toString();if(a){let l=-1;s=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==l)return{range:h};l=c.from;let d=t.toText((o?n.line(r++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:d},range:z.cursor(h.from+d.length)}})}else if(o){s=t.changeByRange(l=>{let h=n.line(r++);return{changes:{from:l.from,to:l.to,insert:h.text},range:z.cursor(l.from+h.length)}})}else{s=t.replaceSelection(n)}i.dispatch(s,{userEvent:"input.paste",scrollIntoView:true})}li.scroll=i=>{let e=i.inputState;e.lastScrollTop=i.scrollDOM.scrollTop;e.lastScrollLeft=i.scrollDOM.scrollLeft;if(G.ios&&!e.touchActive)e.lastIOSMomentumScroll=Date.now()};li.wheel=li.mousewheel=i=>{i.inputState.lastWheelEvent=Date.now()};ns.keydown=(i,e)=>{i.inputState.setSelectionOrigin("select");if(e.keyCode==27&&i.inputState.tabFocusMode!=0)i.inputState.tabFocusMode=Date.now()+2e3;return false};li.touchstart=(i,e)=>{let t=i.inputState,s=e.targetTouches[0];t.touchActive=true;t.lastTouchTime=Date.now();if(s){t.lastTouchX=s.clientX;t.lastTouchY=s.clientY}t.setSelectionOrigin("select.pointer")};li.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};li.touchend=(i,e)=>{i.inputState.touchActive=false};ns.mousedown=(i,e)=>{i.observer.flush();if(i.inputState.lastTouchTime>Date.now()-2e3)return false;let t=null;for(let s of i.state.facet(R2)){t=s(i,e);if(t)break}if(!t&&e.button==0)t=oQ(i,e);if(t){let s=!i.hasFocus;i.inputState.startMouseSelection(new J6(i,e,t,s));if(s)i.observer.ignore(()=>{b2(i.contentDOM);let n=i.root.activeElement;if(n&&!n.contains(i.contentDOM))n.blur()});let r=i.inputState.mouseSelection;if(r){r.start(e);return r.dragging===false}}else{i.inputState.setSelectionOrigin("select.pointer")}return false};function C_(i,e,t,s){if(s==1){return z.cursor(e,t)}else if(s==2){return M6(i.state,e,t)}else{let r=i.docView.lineAt(e,t),n=i.state.doc.lineAt(r?r.posAtEnd:e);let o=r?r.posAtStart:n.from,a=r?r.posAtEnd:n.to;if(aDate.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(P_+1)%3:1}function oQ(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},false),s=tx(e);let r=i.state.selection;return{update(n){if(n.docChanged){t.pos=n.changes.mapPos(t.pos);r=r.map(n.changes)}},get(n,o,a){let l=i.posAndSideAtCoords({x:n.clientX,y:n.clientY},false),h;let c=C_(i,l.pos,l.assoc,s);if(t.pos!=l.pos&&!o){let d=C_(i,t.pos,t.assoc,s);let u=Math.min(d.from,c.from),f=Math.max(d.to,c.to);c=u1&&(h=aQ(r,l.pos)))return h;else if(a)return r.addRange(c);else return z.create([c])}}}function aQ(i,e){for(let t=0;t=e)return z.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}ns.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let r=i.docView.tile.nearest(e.target);if(r&&r.isWidget()){let n=r.posAtStart,o=n+r.length;if(n>=t.to||o<=t.from)t=z.undirectionalRange(n,o)}}let{inputState:s}=i;if(s.mouseSelection)s.mouseSelection.dragging=true;s.draggedContent=t;if(e.dataTransfer){e.dataTransfer.setData("Text",cu(i.state,zO,i.state.sliceDoc(t.from,t.to)));e.dataTransfer.effectAllowed="copyMove"}return false};ns.dragend=i=>{i.inputState.draggedContent=null;return false};function E_(i,e,t,s){t=cu(i.state,DO,t);if(!t)return;let r=i.posAtCoords({x:e.clientX,y:e.clientY},false);let{draggedContent:n}=i.inputState;let o=s&&n&&tQ(i,e)?{from:n.from,to:n.to}:null;let a={from:r,insert:t};let l=i.state.changes(o?[o,a]:a);i.focus();i.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"});i.inputState.draggedContent=null}ns.drop=(i,e)=>{if(!e.dataTransfer)return false;if(i.state.readOnly)return true;let t=e.dataTransfer.files;if(t&&t.length){let s=Array(t.length),r=0;let n=()=>{if(++r==t.length)E_(i,e,s.filter(o=>o!=null).join(i.state.lineBreak),false)};for(let o=0;o{if(!/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(a.result))s[o]=a.result;n()};a.readAsText(t[o])}return true}else{let s=e.dataTransfer.getData("Text");if(s){E_(i,e,s,true);return true}}return false};ns.paste=(i,e)=>{if(i.state.readOnly)return true;i.observer.flush();let t=J2?null:e.clipboardData;if(t){ex(i,t.getData("text/plain")||t.getData("text/uri-list"));return true}else{rQ(i);return false}};function lQ(i,e){let t=i.dom.parentNode;if(!t)return;let s=t.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px";s.value=e;s.focus();s.selectionEnd=e.length;s.selectionStart=0;setTimeout(()=>{s.remove();i.focus()},50)}function hQ(i){let e=[],t=[],s=false;for(let r of i.selection.ranges)if(!r.empty){e.push(i.sliceDoc(r.from,r.to));t.push(r)}if(!e.length){let r=-1;for(let{from:n}of i.selection.ranges){let o=i.doc.lineAt(n);if(o.number>r){e.push(o.text);t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})}r=o.number}s=true}return{text:cu(i,zO,e.join(i.lineBreak)),ranges:t,linewise:s}}let Rm=null;ns.copy=ns.cut=(i,e)=>{if(!gl(i.contentDOM,i.observer.selectionRange))return false;let{text:t,ranges:s,linewise:r}=hQ(i.state);if(!t&&!r)return false;Rm=r?t:null;if(e.type=="cut"&&!i.state.readOnly)i.dispatch({changes:s,scrollIntoView:true,userEvent:"delete.cut"});let n=J2?null:e.clipboardData;if(n){n.clearData();n.setData("text/plain",t);return true}else{lQ(i,t);return false}};const ix=br.define();function sx(i,e){let t=[];for(let s of i.facet(M2)){let r=s(i,e);if(r)t.push(r)}return t.length?i.update({effects:t,annotations:ix.of(true)}):null}function rx(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=sx(i.state,e);if(t)i.dispatch(t);else i.update([])}},10)}li.focus=i=>{i.inputState.lastFocusTime=Date.now();if(!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)){i.scrollDOM.scrollTop=i.inputState.lastScrollTop;i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft}rx(i)};li.blur=i=>{i.observer.clearSelectionRange();rx(i)};li.compositionstart=li.compositionupdate=i=>{if(i.observer.editContext)return;if(i.inputState.compositionFirstChange==null)i.inputState.compositionFirstChange=true;if(i.inputState.composing<0){i.inputState.composing=0}};li.compositionend=i=>{if(i.observer.editContext)return;i.inputState.composing=-1;i.inputState.compositionEndedAt=Date.now();i.inputState.compositionPendingKey=true;i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0;i.inputState.compositionFirstChange=null;if(G.chrome&&G.android){i.observer.flushSoon()}else if(i.inputState.compositionPendingChange){Promise.resolve().then(()=>i.observer.flush())}else{setTimeout(()=>{if(i.inputState.composing<0&&i.docView.hasComposition)i.update([])},50)}};li.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};ns.beforeinput=(i,e)=>{var t,s;if(e.inputType=="insertText"||e.inputType=="insertCompositionText"){i.inputState.insertingText=e.data;i.inputState.insertingTextAt=Date.now()}if(e.inputType=="insertReplacementText"&&i.observer.editContext){let n=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let a=o[0];let l=i.posAtDOM(a.startContainer,a.startOffset),h=i.posAtDOM(a.endContainer,a.endOffset);XO(i,{from:l,to:h,insert:i.state.toText(n)},null);return true}}let r;if(G.chrome&&G.android&&(r=G2.find(n=>n.inputType==e.inputType))){i.observer.delayAndroidKey(r.key,r.keyCode);if(r.key=="Backspace"||r.key=="Delete"){let n=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var o;if((((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&i.hasFocus){i.contentDOM.blur();i.focus()}},100)}}if(G.ios&&e.inputType=="deleteContentForward"){i.observer.flushSoon()}if(G.safari&&e.inputType=="insertText"&&i.inputState.composing>=0){setTimeout(()=>li.compositionend(i,e),20)}return false};const Q_=new Set;function cQ(i){if(!Q_.has(i)){Q_.add(i);i.addEventListener("copy",()=>{});i.addEventListener("cut",()=>{})}}const R_=["pre-wrap","normal","pre-line","break-spaces"];let na=false;function A_(){na=false}class dQ{constructor(e){this.lineWrapping=e;this.doc=Pe.empty;this.heightSamples={};this.lineHeight=14;this.charWidth=7;this.textHeight=14;this.lineLength=30}heightForGap(e,t){let s=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)s+=Math.max(0,Math.ceil((t-e-s*this.lineLength*.5)/this.lineLength));return this.lineHeight*s}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;let t=1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5)));return t*this.lineHeight}setDoc(e){this.doc=e;return this}mustRefreshForWrapping(e){return R_.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=false;for(let s=0;s-1;let l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=a;this.lineWrapping=a;this.lineHeight=t;this.charWidth=s;this.textHeight=r;this.lineLength=n;if(l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){if(this.height!=e){if(Math.abs(this.height-e)>Ac)na=true;this.height=e}}replace(e,t,s){return ai.of(s)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,s,r){let n=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:h,fromB:c,toB:d}=r[a];let u=n.lineAt(l,ze.ByPosNoHeight,s.setDoc(t),0,0);let f=u.to>=h?u:n.lineAt(h,ze.ByPosNoHeight,s,0,0);d+=f.to-h;h=f.to;while(a>0&&u.from<=r[a-1].toA){l=r[a-1].fromA;c=r[a-1].fromB;a--;if(ln*2){let a=e[t-1];if(a.break)e.splice(--t,1,a.left,null,a.right);else e.splice(--t,1,a.left,a.right);s+=1+a.break;r-=a.size}else if(n>r*2){let a=e[s];if(a.break)e.splice(s,1,a.left,null,a.right);else e.splice(s,1,a.left,a.right);s+=2+a.break;n-=a.size}else{break}}else if(r=n)o(this.lineAt(0,ze.ByPos,s,r,n))}setMeasuredHeight(e){let t=e.heights[e.index++];if(t<0){this.spaceAbove=-t;t=e.heights[e.index++]}else{this.spaceAbove=0}this.setHeight(t)}updateHeight(e,t=0,s=false,r){if(r&&r.from<=t&&r.more)this.setMeasuredHeight(r);this.outdated=false;return this}toString(){return\`block(\${this.length})\`}}class Ti extends nx{constructor(e,t,s){super(e,t,null);this.collapsed=0;this.widgetHeight=0;this.breaks=0;this.spaceAbove=s}mainBlock(e,t){return new ss(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,s){let r=s[0];if(s.length==1&&(r instanceof Ti||r instanceof It&&r.flags&4)&&Math.abs(this.length-r.length)<10){if(r instanceof It)r=new Ti(r.length,this.height,this.spaceAbove);else r.height=this.height;if(!this.outdated)r.outdated=false;return r}else{return ai.of(s)}}updateHeight(e,t=0,s=false,r){if(r&&r.from<=t&&r.more){this.setMeasuredHeight(r)}else if(s||this.outdated){this.spaceAbove=0;this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)}this.outdated=false;return this}toString(){return\`line(\${this.length}\${this.collapsed?-this.collapsed:""}\${this.widgetHeight?":"+this.widgetHeight:""})\`}}class It extends ai{constructor(e){super(e,0)}heightMetrics(e,t){let s=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number;let n=r-s+1;let o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*n);o=l/n;if(this.length>n+1)a=(this.height-l)/(this.length-n-1)}else{o=this.height/n}return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(e,t,s,r){let{firstLine:n,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,r);if(t.lineWrapping){let h=r+(e0){let n=s[s.length-1];if(n instanceof It)s[s.length-1]=new It(n.length+r);else s.push(null,new It(r-1))}if(e>0){let n=s[0];if(n instanceof It)s[0]=new It(e+n.length);else s.unshift(new It(e-1),null)}return ai.of(s)}decomposeLeft(e,t){t.push(new It(e-1),null)}decomposeRight(e,t){t.push(null,new It(this.length-e-1))}updateHeight(e,t=0,s=false,r){let n=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],a=Math.max(t,r.from),l=-1;if(r.from>t)o.push(new It(r.from-t-1).updateHeight(e,t));while(a<=n&&r.more){let c=e.doc.lineAt(a).length;if(o.length)o.push(null);let d=r.heights[r.index++],u=0;if(d<0){u=-d;d=r.heights[r.index++]}if(l==-1)l=d;else if(Math.abs(d-l)>=Ac)l=-2;let f=new Ti(c,d,u);f.outdated=false;o.push(f);a+=c+1}if(a<=n)o.push(null,new It(n-a).updateHeight(e,a));let h=ai.of(o);if(l<0||Math.abs(h.height-this.height)>=Ac||Math.abs(l-this.heightMetrics(e,t).perLine)>=Ac)na=true;return vd(this,h)}else if(s||this.outdated){this.setHeight(e.heightForGap(t,t+this.length));this.outdated=false}return this}toString(){return\`gap(\${this.length})\`}}class pQ extends ai{constructor(e,t,s){super(e.length+t+s.length,e.height+s.height,t|(e.outdated||s.outdated?2:0));this.left=e;this.right=s;this.size=e.size+s.size}get break(){return this.flags&1}blockAt(e,t,s,r){let n=s+this.left.height;return ea))return h;let c=t==ze.ByPosNoHeight?ze.ByPosNoHeight:ze.ByPos;if(l)return h.join(this.right.lineAt(a,c,s,o,a));else return this.left.lineAt(a,c,s,r,n).join(h)}forEachLine(e,t,s,r,n,o){let a=r+this.left.height,l=n+this.left.length+this.break;if(this.break){if(e=l)this.right.forEachLine(e,t,s,a,l,o)}else{let h=this.lineAt(l,ze.ByPos,s,r,n);if(e=e&&h.from<=t)o(h);if(t>h.to)this.right.forEachLine(h.to+1,t,s,a,l,o)}}replace(e,t,s){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,s));let n=[];if(e>0)this.decomposeLeft(e,n);let o=n.length;for(let a of s)n.push(a);if(e>0)L_(n,o-1);if(t=s)t.push(null)}if(e>s)this.right.decomposeLeft(e-s,t)}decomposeRight(e,t){let s=this.left.length,r=s+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);if(e2*t.size||t.size>2*e.size)return ai.of(this.break?[e,null,t]:[e,t]);this.left=vd(this.left,e);this.right=vd(this.right,t);this.setHeight(e.height+t.height);this.outdated=e.outdated||t.outdated;this.size=e.size+t.size;this.length=e.length+this.break+t.length;return this}updateHeight(e,t=0,s=false,r){let{left:n,right:o}=this,a=t+n.length+this.break,l=null;if(r&&r.from<=t+n.length&&r.more)l=n=n.updateHeight(e,t,s,r);else n.updateHeight(e,t,s);if(r&&r.from<=a+o.length&&r.more)l=o=o.updateHeight(e,a,s,r);else o.updateHeight(e,a,s);if(l)return this.balanced(n,o);this.height=this.left.height+this.right.height;this.outdated=false;return this}toString(){return this.left+(this.break?" ":"-")+this.right}}function L_(i,e){let t,s;if(i[e]==null&&(t=i[e-1])instanceof It&&(s=i[e+1])instanceof It)i.splice(e-1,3,new It(t.length+1+s.length))}const mQ=5;class NO{constructor(e,t){this.pos=e;this.oracle=t;this.nodes=[];this.lineStart=-1;this.lineEnd=-1;this.covering=null;this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let s=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];if(r instanceof Ti)r.length+=s-this.pos;else if(s>this.pos||!this.isCovered)this.nodes.push(new Ti(s-this.pos,-1,0));this.writtenTo=s;if(t>s){this.nodes.push(null);this.writtenTo++;this.lineStart=-1}}this.pos=t}point(e,t,s){if(e=mQ){this.addLineDeco(r,n,o)}}else if(t>e){this.span(e,t)}if(this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e;this.lineEnd=t;if(this.writtenToe)this.nodes.push(new Ti(this.pos-e,-1,0));this.writtenTo=this.pos}blankContent(e,t){let s=new It(t-e);if(this.oracle.doc.lineAt(e).to==t)s.flags|=4;return s}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ti)return e;let t=new Ti(0,-1,0);this.nodes.push(t);return t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();this.nodes.push(e);this.writtenTo=this.pos=this.pos+e.length;if(t&&t.endSide>0)this.covering=e}addLineDeco(e,t,s){let r=this.ensureLine();r.length+=s;r.collapsed+=s;r.widgetHeight=Math.max(r.widgetHeight,e);r.breaks+=t;this.writtenTo=this.pos=this.pos+s}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof Ti)&&!this.isCovered)this.nodes.push(new Ti(0,-1,0));else if(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&d.overflow!="visible"){let u=c.getBoundingClientRect();n=Math.max(n,u.left);o=Math.min(o,u.right);a=Math.max(a,u.top);l=Math.min(h==i.parentNode?r.innerHeight:l,u.bottom)}h=d.position=="absolute"||d.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11){h=h.host}else{break}}return{left:n-t.left,right:Math.max(n,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function vQ(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left0&&e.top0}function yQ(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class pf{constructor(e,t,s,r){this.from=e;this.to=t;this.size=s;this.displaySize=r}static same(e,t){if(e.length!=t.length)return false;for(let s=0;stypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new dQ(s);this.stateDeco=I_(t);this.heightMap=ai.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle.setDoc(t.doc),[new Xi(0,0,0,t.doc.length)]);for(let r=0;r<2;r++){this.viewport=this.getViewport(0,null);if(!this.updateForViewport())break}this.updateViewportLines();this.lineGaps=this.ensureLineGaps([]);this.lineGapDeco=fe.set(this.lineGaps.map(r=>r.draw(this,false)));this.scrollParent=e.scrollDOM;this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let s=0;s<=1;s++){let r=s?t.head:t.anchor;if(!e.some(({from:n,to:o})=>r>=n&&r<=o)){let{from:n,to:o}=this.lineBlockAt(r);e.push(new Uh(n,o))}}this.viewports=e.sort((s,r)=>s.from-r.from);return this.updateScaler()}updateScaler(){let e=this.scaler;this.scaler=this.heightMap.height<=7e6?B_:new FO(this.heightOracle,this.heightMap,this.viewports);return e.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,e=>{this.viewportLines.push(il(e,this.scaler))})}update(e,t=null){this.state=e.state;let s=this.stateDeco;this.stateDeco=I_(this.state);let r=e.changedRanges;let n=Xi.extendWithRanges(r,gQ(s,this.stateDeco,e?e.changes:_t.empty(this.state.doc.length)));let o=this.heightMap.height;let a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);A_();this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n);if(this.heightMap.height!=o||na)e.flags|=2;if(a){this.scrollAnchorPos=e.changes.mapPos(a.from,-1);this.scrollAnchorHeight=a.top}else{this.scrollAnchorPos=-1;this.scrollAnchorHeight=o}let l=n.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))l=this.getViewport(0,t);let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l;e.flags|=this.updateForViewport();if(h||!e.changes.empty||e.flags&2)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));e.flags|=this.computeVisibleRanges(e.changes);if(t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(I2))this.mustEnforceCursorAssoc=true}measure(){let{view:e}=this,t=e.contentDOM,s=window.getComputedStyle(t);let r=this.heightOracle;let n=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?Ue.RTL:Ue.LTR;let o=this.heightOracle.mustRefreshForWrapping(n)||this.mustMeasureContent==="refresh";let a=t.getBoundingClientRect();let l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height;this.mustMeasureContent=false;let h=0,c=0;if(a.width&&a.height){let{scaleX:C,scaleY:w}=O2(t,a);if(C>.005&&Math.abs(this.scaleX-C)>.005||w>.005&&Math.abs(this.scaleY-w)>.005){this.scaleX=C;this.scaleY=w;h|=16;o=l=true}}let d=(parseInt(s.paddingTop)||0)*this.scaleY;let u=(parseInt(s.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=d||this.paddingBottom!=u){this.paddingTop=d;this.paddingBottom=u;h|=16|2}if(this.editorWidth!=e.scrollDOM.clientWidth){if(r.lineWrapping)l=true;this.editorWidth=e.scrollDOM.clientWidth;h|=16}let f=_2(this.view.contentDOM,false).y;if(f!=this.scrollParent){this.scrollParent=f;this.scrollAnchorHeight=-1;this.scrollOffset=0}let p=this.getScrollOffset();if(this.scrollOffset!=p){this.scrollAnchorHeight=-1;this.scrollOffset=p}this.scrolledToBottom=S2(this.scrollParent||e.win);let m=(this.printing?yQ:_Q)(t,this.paddingTop);let O=m.top-this.pixelViewport.top,v=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let T=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(T!=this.inView){this.inView=T;if(T)l=true}if(!this.inView&&!this.scrollTarget&&!vQ(e.dom))return 0;let k=a.width;if(this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight){this.contentDOMWidth=a.width;this.editorHeight=e.scrollDOM.clientHeight;h|=16}if(l){let C=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(C))o=true;if(o||r.lineWrapping&&Math.abs(k-this.contentDOMWidth)>r.charWidth){let{lineHeight:w,charWidth:Q,textHeight:D}=e.docView.measureTextSize();o=w>0&&r.refresh(n,w,Q,D,Math.max(5,k/Q),C);if(o){e.docView.minWidth=0;h|=16}}if(O>0&&v>0)c=Math.max(O,v);else if(O<0&&v<0)c=Math.min(O,v);A_();for(let w of this.viewports){let Q=w.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?ai.empty().applyChanges(this.stateDeco,Pe.empty,this.heightOracle,[new Xi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new uQ(w.from,Q))}if(na)h|=2}let _=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);if(_){if(h&2)h|=this.updateScaler();this.viewport=this.getViewport(c,this.scrollTarget);h|=this.updateForViewport()}if(h&2||_)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));h|=this.computeVisibleRanges();if(this.mustEnforceCursorAssoc){this.mustEnforceCursorAssoc=false;e.docView.enforceCursorAssoc()}return h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let s=.5-Math.max(-.5,Math.min(.5,e/1e3/2));let r=this.heightMap,n=this.heightOracle;let{visibleTop:o,visibleBottom:a}=this;let l=new Uh(r.lineAt(o-s*1e3,ze.ByHeight,n,0,0).from,r.lineAt(a+(1-s)*1e3,ze.ByHeight,n,0,0).to);if(t){let{head:h}=t.range;if(hl.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top);let d=r.lineAt(h,ze.ByPos,n,0,0),u;if(t.y=="center")u=(d.top+d.bottom)/2-c/2;else if(t.y=="start"||t.y=="nearest"&&h=a+Math.max(10,Math.min(s,250)))&&(r>o-2*1e3&&n>1,o=r<<1;if(this.defaultTextDirection!=Ue.LTR&&!s)return[];let a=[];let l=(c,d,u,f)=>{if(d-cc&&vv.from>=u.from&&v.to<=u.to&&Math.abs(v.from-c)v.fromT));if(!O){if(dk.from<=d&&k.to>=d)){let k=t.moveToLineBoundary(z.cursor(d),false,true).head;if(k>c)d=k}let v=this.gapSize(u,c,d,f);let T=s||v<2e6?v:2e6;O=new pf(c,d,v,T)}a.push(O)};let h=c=>{if(c.length2e6)for(let w of e){if(w.from>=c.from&&w.fromc.from)l(c.from,f,c,d);if(pt.draw(this,this.heightOracle.lineWrapping)))}}computeVisibleRanges(e){let t=this.stateDeco;if(this.lineGaps.length)t=t.concat(this.lineGapDeco);let s=[];ye.spans(t,this.viewport.from,this.viewport.to,{span(n,o){s.push({from:n,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length){r=8|4}else{for(let n=0;n=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||il(this.heightMap.lineAt(e,ze.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||il(this.heightMap.lineAt(this.scaler.fromDOM(e),ze.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){let e=this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top;return e*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return il(this.heightMap.blockAt(this.scaler.fromDOM(e),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 Uh{constructor(e,t){this.from=e;this.to=t}}function SQ(i,e,t){let s=[],r=i,n=0;ye.spans(t,i,e,{span(){},point(o,a){if(o>r){s.push({from:r,to:o});n+=o-r}r=a}},20);if(r=1)return e[e.length-1].to;let s=Math.floor(i*t);for(let r=0;;r++){let{from:n,to:o}=e[r],a=o-n;if(s<=a)return n+s;s-=a}}function Hh(i,e){let t=0;for(let{from:s,to:r}of i.ranges){if(e<=r){t+=e-s;break}t+=r-s}return t/i.total}function wQ(i,e){for(let t of i)if(e(t))return t;return void 0}const B_={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function I_(i){let e=i.facet(au).filter(s=>typeof s!="function");let t=i.facet(qO).filter(s=>typeof s!="function");if(t.length)e.push(ye.join(t));return e}class FO{constructor(e,t,s){let r=0,n=0,o=0;this.viewports=s.map(({from:a,to:l})=>{let h=t.lineAt(a,ze.ByPos,e,0,0).top;let c=t.lineAt(l,ze.ByPos,e,0,0).bottom;r+=c-h;return{from:a,to:l,top:h,bottom:c,domTop:0,domBottom:0}});this.scale=(7e6-r)/(t.height-r);for(let a of this.viewports){a.domTop=o+(a.top-n)*this.scale;o=a.domBottom=a.domTop+(a.bottom-a.top);n=a.bottom}}toDOM(e){for(let t=0,s=0,r=0;;t++){let n=tt.from==e.viewports[s].from&&t.to==e.viewports[s].to)}}function il(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),s=e.toDOM(i.bottom);return new ss(i.from,i.length,t,s-t,Array.isArray(i._content)?i._content.map(r=>il(r,e)):i._content)}const Vh=te.define({combine:i=>i.join(" ")});const Am=te.define({combine:i=>i.indexOf(true)>-1});const Lm=ln.newName();const ox=ln.newName();const ax=ln.newName();const lx={"&light":"."+ox,"&dark":"."+ax};function Mm(i,e,t){return new ln(e,{finish(s){return/&/.test(s)?s.replace(/&\\w*/,r=>{if(r=="&")return i;if(!t||!t[r])throw new RangeError(\`Unsupported selector: \${r}\`);return t[r]}):i+" "+s}})}const xQ=Mm("."+Lm,{"&":{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"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&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"}},lx);const kQ={childList:true,characterData:true,subtree:true,attributes:true,characterDataOldValue:true};const mf=G.ie&&G.ie_version<=11;class CQ{constructor(e){this.view=e;this.active=false;this.editContext=null;this.selectionRange=new t6;this.selectionChanged=false;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=false;this.gapIntersection=null;this.gaps=[];this.printQuery=null;this.parentCheck=-1;this.dom=e.contentDOM;this.observer=new MutationObserver(t=>{for(let s of t)this.queue.push(s);if((G.ie&&G.ie_version<=11||G.ios&&e.composing)&&t.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length))this.flushSoon();else this.flush()});if(window.EditContext&&G.android&&e.constructor.EDIT_CONTEXT!==false&&!(G.chrome&&G.chrome_version<126)){this.editContext=new PQ(e);if(e.state.facet(dr))e.contentDOM.editContext=this.editContext.editContext}if(mf)this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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);if(window.matchMedia)this.printQuery=window.matchMedia("print");if(typeof ResizeObserver=="function"){this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){this.intersecting=!this.intersecting;if(this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,.001]});this.intersection.observe(this.dom);this.gapIntersection=new IntersectionObserver(t=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{})}this.listenForScroll();this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e);if(this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(false);if(this.editContext)this.view.requestMeasure(this.editContext.measureReq);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1;this.view.requestMeasure()},50)}onPrint(e){if((e.type=="change"||!e.type)&&!e.matches)return;this.view.viewState.printing=true;this.view.measure();setTimeout(()=>{this.view.viewState.printing=false;this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,s)=>t!=e[s]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,r=this.selectionRange;if(s.state.facet(dr)?s.root.activeElement!=this.dom:!gl(this.dom,r))return;let n=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(n&&n.isWidget()&&n.widget.ignoreEvent(e)){if(!t)this.selectionChanged=false;return}if((G.ie&&G.ie_version<=11||G.android&&G.chrome)&&!s.state.selection.main.empty&&r.focusNode&&Ol(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset))this.flushSoon();else this.flush(false)}readSelectionRange(){let{view:e}=this;let t=zl(e.root);if(!t)return false;let s=G.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&TQ(this.view,t)||t;if(!s||this.selectionRange.eq(s))return false;let r=gl(this.dom,s);if(r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let n=this.delayedAndroidKey;if(n){this.clearDelayedAndroidKey();this.view.inputState.lastKeyCode=n.keyCode;this.view.inputState.lastKeyTime=Date.now();let o=this.flush();if(!o&&n.force)Zo(this.dom,n.key,n.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1;this.flush()})}forceFlush(){if(this.delayedFlush>=0){this.view.win.cancelAnimationFrame(this.delayedFlush);this.delayedFlush=-1}this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();if(e.length)this.queue=[];let t=-1,s=-1,r=false;for(let n of e){let o=this.readMutation(n);if(!o)continue;if(o.typeOver)r=true;if(t==-1){({from:t,to:s}=o)}else{t=Math.min(o.from,t);s=Math.max(o.to,s)}}return{from:t,to:s,typeOver:r}}readChange(){let{from:e,to:t,typeOver:s}=this.processRecords();let r=this.selectionChanged&&gl(this.dom,this.selectionRange);if(e<0&&!r)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0;this.selectionChanged=false;let n=new F6(this.view,e,t,s);this.view.docView.domChanged={newSel:n.newSel?n.newSel.main:null};return n}flush(e=true){if(this.delayedFlush>=0||this.delayedAndroidKey)return false;if(e)this.readSelectionRange();let t=this.readChange();if(!t){this.view.requestMeasure();return false}let s=this.view.state;let r=V2(this.view,t);if(this.view.state==s&&(t.domChanged||t.newSel&&!_d(this.view.state.selection,t.newSel.main)))this.view.update([]);return r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;t.markDirty(e.type=="attributes");if(e.type=="childList"){let s=D_(t,e.previousSibling||e.target.previousSibling,-1);let r=D_(t,e.nextSibling||e.target.nextSibling,1);return{from:s?t.posAfter(s):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:false}}else if(e.type=="characterData"){return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}else{return null}}setWindow(e){if(e!=this.win){this.removeWindowListeners(this.win);this.win=e;this.addWindowListeners(this.win)}}addWindowListeners(e){e.addEventListener("resize",this.onResize);if(this.printQuery){if(this.printQuery.addEventListener)this.printQuery.addEventListener("change",this.onPrint);else this.printQuery.addListener(this.onPrint)}else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll);e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll);e.removeEventListener("resize",this.onResize);if(this.printQuery){if(this.printQuery.removeEventListener)this.printQuery.removeEventListener("change",this.onPrint);else this.printQuery.removeListener(this.onPrint)}else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){if(this.editContext){this.editContext.update(e);if(e.startState.facet(dr)!=e.state.facet(dr))e.view.contentDOM.editContext=e.state.facet(dr)?this.editContext.editContext:null}}destroy(){var e,t,s;this.stop();(e=this.intersection)===null||e===void 0?void 0:e.disconnect();(t=this.gapIntersection)===null||t===void 0?void 0:t.disconnect();(s=this.resizeScroll)===null||s===void 0?void 0:s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win);clearTimeout(this.parentCheck);clearTimeout(this.resizeTimeout);this.win.cancelAnimationFrame(this.delayedFlush);this.win.cancelAnimationFrame(this.flushingAndroidKey);if(this.editContext){this.view.contentDOM.editContext=null;this.editContext.destroy()}}}function D_(i,e,t){while(e){let s=it.get(e);if(s&&s.parent==i)return s;let r=e.parentNode;e=r!=i.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function z_(i,e){let t=e.startContainer,s=e.startOffset;let r=e.endContainer,n=e.endOffset;let o=i.docView.domAtPos(i.state.selection.main.anchor,1);if(Ol(o.node,o.offset,r,n))[t,s,r,n]=[r,n,t,s];return{anchorNode:t,anchorOffset:s,focusNode:r,focusOffset:n}}function TQ(i,e){if(e.getComposedRanges){let r=e.getComposedRanges(i.root)[0];if(r)return z_(i,r)}let t=null;function s(r){r.preventDefault();r.stopImmediatePropagation();t=r.getTargetRanges()[0]}i.contentDOM.addEventListener("beforeinput",s,true);i.dom.ownerDocument.execCommand("indent");i.contentDOM.removeEventListener("beforeinput",s,true);return t?z_(i,t):null}class PQ{constructor(e){this.from=0;this.to=0;this.pendingContextChange=null;this.handlers=Object.create(null);this.composing=null;this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=s=>{let r=e.state.selection.main,{anchor:n,head:o}=r;let a=this.toEditorPos(s.updateRangeStart),l=this.toEditorPos(s.updateRangeEnd);if(e.inputState.composing>=0&&!this.composing)this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:false};let h=l-a>s.text.length;if(a==this.from&&nthis.to)l=n;let c=Y2(e.state.sliceDoc(a,l),s.text,(h?r.from:r.to)-a,h?"end":null);if(!c){let u=z.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));if(!_d(u,r))e.dispatch({selection:u,userEvent:"select"});return}let d={from:c.from+a,to:c.toA+a,insert:Pe.of(s.text.slice(c.from,c.toB).split("\\n"))};if((G.mac||G.android)&&d.from==o-1&&/^\\. ?$/.test(s.text)&&e.contentDOM.getAttribute("autocorrect")=="off")d={from:a,to:l,insert:Pe.of([s.text.replace("."," ")])};this.pendingContextChange=d;if(!e.state.readOnly){let u=this.to-this.from+(d.to-d.from+d.insert.length);XO(e,d,z.single(this.toEditorPos(s.selectionStart,u),this.toEditorPos(s.selectionEnd,u)))}if(this.pendingContextChange){this.revertPending(e.state);this.setSelection(e.state)}if(d.from=0&&!/[\\\\p{Alphabetic}\\\\p{Number}_]/.test(t.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(t.text.length,s.updateRangeStart+1))))this.handlers.compositionend(s)};this.handlers.characterboundsupdate=s=>{let r=[],n=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o{let r=[];for(let n of s.getTextFormats()){let o=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(n.rangeStart),h=this.toEditorPos(n.rangeEnd);if(l{if(e.inputState.composing<0){e.inputState.composing=0;e.inputState.compositionFirstChange=true}};this.handlers.compositionend=()=>{e.inputState.composing=-1;e.inputState.compositionFirstChange=null;if(this.composing){let{drifted:s}=this.composing;this.composing=null;if(s)this.reset(e.state)}};for(let s in this.handlers)t.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{let r=zl(s.root);if(r&&r.rangeCount)this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,s=false,r=this.pendingContextChange;e.changes.iterChanges((n,o,a,l,h)=>{if(s)return;let c=h.length-(o-n);if(r&&o>=r.to){if(r.from==n&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null;t+=c;this.to+=c;return}else{r=null;this.revertPending(e.state)}}n+=t;o+=t;if(o<=this.from){this.from+=c;this.to+=c}else if(nthis.to||this.to-this.from+h.length>3e4){s=true;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(o),h.toString());this.to+=c}t+=c});if(r&&!s)this.revertPending(e.state);return!s}update(e){let t=this.pendingContextChange,s=e.startState.selection.main;if(this.composing&&(this.composing.drifted||!e.changes.touchesRange(s.from,s.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))){this.composing.drifted=true;this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)}else if(!this.applyEdits(e)||!this.rangeIsValid(e.state)){this.pendingContextChange=null;this.reset(e.state)}else if(e.docChanged||e.selectionSet||t){this.setSelection(e.state)}if(e.geometryChanged||e.docChanged||e.selectionSet)e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4);this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e);this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to));this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null;this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection;let s=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor)));let r=this.toContextPos(t.head);if(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)this.editContext.updateSelection(s,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let s=this.composing;return s&&s.drifted?s.editorBase+(e-s.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class J{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(e={}){var t;this.plugins=[];this.pluginMap=new Map;this.editorAttrs={};this.contentAttrs={};this.bidiCache=[];this.destroyed=false;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);if(e.parent)e.parent.appendChild(this.dom);let{dispatch:s}=e;this.dispatchTransactions=e.dispatchTransactions||s&&(r=>r.forEach(n=>s(n,this)))||(r=>this.update(r));this.dispatch=this.dispatch.bind(this);this._root=e.root||i6(e.parent)||document;this.viewState=new M_(this,e.state||xe.create(e));if(e.scrollTo&&e.scrollTo.is(Nh))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(Bo).map(r=>new hf(r));for(let r of this.plugins)r.update(this);this.observer=new CQ(this);this.inputState=new H6(this);this.inputState.ensureHandlers(this.plugins);this.docView=new S_(this);this.mountStyles();this.updateAttrs();this.updateState=0;this.requestMeasure();if((t=document.fonts)===null||t===void 0?void 0:t.ready)document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh";this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ut?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=false,s=false,r;let n=this.state;for(let u of e){if(u.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=u.state}if(this.destroyed){this.viewState.state=n;return}let o=this.hasFocus,a=0,l=null;if(e.some(u=>u.annotation(ix))){this.inputState.notifiedFocused=o;a=1}else if(o!=this.inputState.notifiedFocused){this.inputState.notifiedFocused=o;l=sx(n,o);if(!l)a=1}let h=this.observer.delayedAndroidKey,c=null;if(h){this.observer.clearDelayedAndroidKey();c=this.observer.readChange();if(c&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))c=null}else{this.observer.clear()}if(n.facet(xe.phrases)!=this.state.facet(xe.phrases))return this.setState(n);r=md.create(this,n,e);r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(d)d=d.map(u.changes);if(u.scrollIntoView){let{main:f}=u.state.selection;let{x:p,y:m}=this.state.facet(J.cursorScrollMargin);d=new Uo(f.empty?f:z.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",m,p)}for(let f of u.effects)if(f.is(Nh))d=f.value.clip(this.state)}this.viewState.update(r,d);this.bidiCache=yd.update(this.bidiCache,r.changes);if(!r.empty){this.updatePlugins(r);this.inputState.update(r)}t=this.docView.update(r);if(this.state.facet(tl)!=this.styleModules)this.mountStyles();s=this.updateAttrs();this.showAnnouncements(e);this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Vh)!=r.state.facet(Vh))this.viewState.mustMeasureContent=true;if(t||s||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!r.empty)for(let u of this.state.facet(Pm)){try{u(r)}catch(f){As(this.state,f,"update listener")}}if(l||c)Promise.resolve().then(()=>{if(l&&this.state==l.startState)this.dispatch(l);if(c){if(!V2(this,c)&&h.force)Zo(this.contentDOM,h.key,h.keyCode)}})}setState(e){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=e;return}this.updateState=2;let t=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new M_(this,e);this.plugins=e.facet(Bo).map(s=>new hf(s));this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy();this.docView=new S_(this);this.inputState.ensureHandlers(this.plugins);this.mountStyles();this.updateAttrs();this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Bo),s=e.state.facet(Bo);if(t!=s){let r=[];for(let n of s){let o=t.indexOf(n);if(o<0){r.push(new hf(n))}else{let a=this.plugins[o];a.mustUpdate=e;r.push(a)}}for(let n of this.plugins)if(n.mustUpdate!=e)n.destroy(this);this.plugins=r;this.pluginMap.clear()}else{for(let r of this.plugins)r.mustUpdate=e}for(let r=0;r-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1;this.requestMeasure();return}this.measureScheduled=0;if(e)this.observer.forceFlush();let t=null;let s=this.viewState.scrollParent,r=this.viewState.getScrollOffset();let{scrollAnchorPos:n,scrollAnchorHeight:o}=this.viewState;if(Math.abs(r-this.viewState.scrollOffset)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0){if(S2(s||this.win)){n=-1;o=this.viewState.heightMap.height}else{let f=this.viewState.scrollAnchorAt(r);n=f.from;o=f.top}}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];if(!(l&4))[this.measureRequests,h]=[h,this.measureRequests];let c=h.map(f=>{try{return f.read(this)}catch(p){As(this.state,p);return W_}});let d=md.create(this,this.state,[]),u=false;d.flags|=l;if(!t)t=d;else t.flags|=l;this.updateState=2;if(!d.empty){this.updatePlugins(d);this.inputState.update(d);this.updateAttrs();u=this.docView.update(d);if(u)this.docViewUpdate()}for(let f=0;f1||p<-1)&&!(G.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+p;if(!s)this.win.scrollBy(0,p);else if(n<0)s.scrollTop=s.scrollHeight;else s.scrollTop+=p;o=-1;continue}}}break}}}finally{this.updateState=0;this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Pm))a(t)}get themeClasses(){return Lm+" "+(this.state.facet(Am)?ax:ox)+" "+this.state.facet(Vh)}updateAttrs(){let e=q_(this,W2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses});let t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:!this.state.facet(dr)?"false":"true",class:"cm-content",style:\`\${G.tabSize}: \${this.state.tabSize}\`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";q_(this,WO,t);let s=this.observer.ignore(()=>{let r=g_(this.contentDOM,this.contentAttrs,t);let n=g_(this.dom,this.editorAttrs,e);return r||n});this.editorAttrs=e;this.contentAttrs=t;return s}showAnnouncements(e){let t=true;for(let s of e)for(let r of s.effects)if(r.is(J.announce)){if(t)this.announceDOM.textContent="";t=false;let n=this.announceDOM.appendChild(document.createElement("div"));n.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(tl);let e=this.state.facet(J.cspNonce);ln.mount(this.root,this.styleModules.concat(xQ).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(false)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null)for(let t=0;ts.plugin==e)||null);return t&&t.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(e){this.readMeasured();return this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){this.readMeasured();return this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,s){return ff(this,e,w_(this,e,t,s))}moveByGroup(e,t){return ff(this,e,w_(this,e,t,s=>D6(this,e.head,s)))}visualLineSide(e,t){let s=this.bidiSpans(e),r=this.textDirectionAt(e.from);let n=s[t?s.length-1:0];return z.cursor(n.side(t,r)+e.from,n.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,s=true){return I6(this,e,t,s)}moveVertically(e,t,s){return ff(this,e,z6(this,e,t,s))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=true){this.readMeasured();let s=Qm(this,e,t);return s&&s.pos}posAndSideAtCoords(e,t=true){this.readMeasured();return Qm(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let s=this.state.doc.lineAt(e),r=this.bidiSpans(s);let n=r[Rs.find(r,e-s.from,-1,t)];return this.docView.coordsAt(e,t,n.dir==Ue.RTL)}coordsForChar(e){this.readMeasured();return this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){let t=this.state.facet(B2);if(!t||ethis.viewport.to)return this.textDirection;this.readMeasured();return this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$Q)return P2(e.length);let t=this.textDirectionAt(e.from),s;for(let n of this.bidiCache){if(n.from==e.from&&n.dir==t&&(n.fresh||T2(n.isolates,s=v_(this,e))))return n.order}if(!s)s=v_(this,e);let r=c6(e.text,t,s);this.bidiCache.push(new yd(e.from,e.to,t,s,true,r));return r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||G.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{b2(this.contentDOM);this.docView.updateSelection()})}setRoot(e){if(this._root!=e){this._root=e;this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window);this.mountStyles()}}destroy(){if(this.root.activeElement==this.contentDOM)this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[];this.inputState.destroy();this.docView.destroy();this.dom.remove();this.observer.destroy();if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);this.destroyed=true}static scrollIntoView(e,t={}){var s,r,n,o;return Nh.of(new Uo(typeof e=="number"?z.cursor(e):e,(s=t.y)!==null&&s!==void 0?s:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(n=t.yMargin)!==null&&n!==void 0?n:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM;let s=this.viewState.scrollAnchorAt(e);return Nh.of(new Uo(z.cursor(s.from),"start","start",s.top-e,t,true))}setTabFocusMode(e){if(e==null)this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1;else if(typeof e=="boolean")this.inputState.tabFocusMode=e?0:-1;else if(this.inputState.tabFocusMode!=0)this.inputState.tabFocusMode=Date.now()+e}static domEventHandlers(e){return Kt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Kt.define(()=>({}),{eventObservers:e})}static theme(e,t){let s=ln.newName();let r=[Vh.of(s),tl.of(Mm(\`.\${s}\`,e))];if(t&&t.dark)r.push(Am.of(true));return r}static baseTheme(e){return ho.lowest(tl.of(Mm("."+Lm,e,lx)))}static findFromDOM(e){var t;let s=e.querySelector(".cm-content");let r=s&&it.get(s)||it.get(e);return((t=r===null||r===void 0?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}J.styleModule=tl;J.inputHandler=L2;J.clipboardInputFilter=DO;J.clipboardOutputFilter=zO;J.scrollHandler=D2;J.focusChangeEffect=M2;J.perLineTextDirection=B2;J.exceptionSink=A2;J.updateListener=Pm;J.editable=dr;J.mouseSelectionStyle=R2;J.dragMovesSelection=Q2;J.clickAddsSelectionRange=E2;J.decorations=au;J.blockWrappers=q2;J.outerDecorations=qO;J.atomicRanges=fh;J.bidiIsolatedRanges=X2;J.cursorScrollMargin=te.define({combine:i=>{let e=5,t=5;for(let s of i){if(typeof s=="number")e=t=s;else({x:e,y:t}=s)}return{x:e,y:t}}});J.scrollMargins=N2;J.darkTheme=Am;J.cspNonce=te.define({combine:i=>i.length?i[0]:""});J.contentAttributes=WO;J.editorAttributes=W2;J.lineWrapping=J.contentAttributes.of({"class":"cm-lineWrapping"});J.announce=Te.define();const $Q=4096;const W_={};class yd{constructor(e,t,s,r,n,o){this.from=e;this.to=t;this.dir=s;this.isolates=r;this.fresh=n;this.order=o}static update(e,t){if(t.empty&&!e.some(n=>n.fresh))return e;let s=[],r=e.length?e[e.length-1].dir:Ue.LTR;for(let n=Math.max(0,e.length-10);n=0;r--){let n=s[r],o=typeof n=="function"?n(i):n;if(o)MO(o,t)}return t}const EQ=G.mac?"mac":G.windows?"win":G.linux?"linux":"key";function QQ(i,e){const t=i.split(/-(?!$)/);let s=t[t.length-1];if(s=="Space")s=" ";let r,n,o,a;for(let l=0;ls.concat(r),[])));return t}function AQ(i,e,t){return cx(hx(i.state),e,i,t)}let Ur=null;const LQ=4e3;function MQ(i,e=EQ){let t=Object.create(null);let s=Object.create(null);let r=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")};let n=(o,a,l,h,c)=>{var d,u;let f=t[o]||(t[o]=Object.create(null));let p=a.split(/ (?!$)/).map(v=>QQ(v,e));for(let v=1;v{let _=Ur={view:k,prefix:T,scope:o};setTimeout(()=>{if(Ur==_)Ur=null},LQ);return true}]}}let m=p.join(" ");r(m,false);let O=f[m]||(f[m]={preventDefault:false,stopPropagation:false,run:((u=(d=f._any)===null||d===void 0?void 0:d.run)===null||u===void 0?void 0:u.slice())||[]});if(l)O.run.push(l);if(h)O.preventDefault=true;if(c)O.stopPropagation=true};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of a){let c=t[h]||(t[h]=Object.create(null));if(!c._any)c._any={preventDefault:false,stopPropagation:false,run:[]};let{any:d}=o;for(let u in c)c[u].run.push(f=>d(f,Bm))}let l=o[e]||o.key;if(!l)continue;for(let h of a){n(h,l,o.run,o.preventDefault,o.stopPropagation);if(o.shift)n(h,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}}return t}let Bm=null;function cx(i,e,t,s){Bm=e;let r=VE(e);let n=Jw(r,0),o=e2(n)==r.length&&r!=" ";let a="",l=false,h=false,c=false;if(Ur&&Ur.view==t&&Ur.scope==s){a=Ur.prefix+" ";if(K2.indexOf(e.keyCode)<0){h=true;Ur=null}}let d=new Set;let u=O=>{if(O){for(let v of O.run)if(!d.has(v)){d.add(v);if(v(t)){if(O.stopPropagation)c=true;return true}}if(O.preventDefault){if(O.stopPropagation)c=true;h=true}}return false};let f=i[s],p,m;if(f){if(u(f[a+Yh(r,e,!o)])){l=true}else if(o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(G.windows&&e.ctrlKey&&e.altKey)&&!(G.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=hn[e.keyCode])&&p!=r){if(u(f[a+Yh(p,e,true)])){l=true}else if(e.shiftKey&&(m=Il[e.keyCode])!=r&&m!=p&&u(f[a+Yh(m,e,false)])){l=true}}else if(o&&e.shiftKey&&u(f[a+Yh(r,e,true)])){l=true}if(!l&&u(f._any))l=true}if(h)l=true;if(l&&c)e.stopPropagation();Bm=null;return l}class Nn{constructor(e,t,s,r,n){this.className=e;this.left=t;this.top=s;this.width=r;this.height=n}draw(){let e=document.createElement("div");e.className=this.className;this.adjust(e);return e}update(e,t){if(t.className!=this.className)return false;this.adjust(e);return true}adjust(e){e.style.left=this.left+"px";e.style.top=this.top+"px";if(this.width!=null)e.style.width=this.width+"px";e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,s){if(s.empty){let r=e.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let n=dx(e);return[new Nn(t,r.left-n.left,r.top-n.top,null,r.bottom-r.top)]}else{return BQ(e,t,s)}}}function dx(i){let e=i.scrollDOM.getBoundingClientRect();let t=i.textDirection==Ue.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX;return{left:t-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function N_(i,e,t,s){let r=i.coordsAtPos(e,t*2);if(!r)return s;let n=i.dom.getBoundingClientRect();let o=(r.top+r.bottom)/2;let a=i.posAtCoords({x:n.left+1,y:o});let l=i.posAtCoords({x:n.right-1,y:o});if(a==null||l==null)return s;return{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function BQ(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let s=Math.max(t.from,i.viewport.from),r=Math.min(t.to,i.viewport.to);let n=i.textDirection==Ue.LTR;let o=i.contentDOM,a=o.getBoundingClientRect(),l=dx(i);let h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h);let d=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0);let u=a.right-(c?parseInt(c.paddingRight):0);let f=Em(i,s,1),p=Em(i,r,-1);let m=f.type==Ft.Text?f:null;let O=p.type==Ft.Text?p:null;if(m&&(i.lineWrapping||f.widgetLineBreaks))m=N_(i,s,1,m);if(O&&(i.lineWrapping||p.widgetLineBreaks))O=N_(i,r,-1,O);if(m&&O&&m.from==O.from&&m.to==O.to){return T(k(t.from,t.to,m))}else{let C=m?k(t.from,null,m):_(f,false);let w=O?k(null,t.to,O):_(p,true);let Q=[];if((m||f).to<(O||p).from-(m&&O?1:0)||f.widgetLineBreaks>1&&C.bottom+i.defaultLineHeight/2x&&$.from=R)break;if(q>E)X(Math.max(M,E),C==null&&M<=x,Math.min(q,R),w==null&&q>=y,B.dir)}E=A.to+1;if(E>=R)break}}if(F.length==0)X(x,C==null,y,w==null,i.textDirection);return{top:D,bottom:I,horizontal:F}}function _(C,w){let Q=a.top+(w?C.top:C.bottom);return{top:Q,bottom:Q,horizontal:[]}}}function IQ(i,e){return i.constructor==e.constructor&&i.eq(e)}class DQ{constructor(e,t){this.view=e;this.layer=t;this.drawn=[];this.scaleX=1;this.scaleY=1;this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)};this.dom=e.scrollDOM.appendChild(document.createElement("div"));this.dom.classList.add("cm-layer");if(t.above)this.dom.classList.add("cm-layer-above");if(t.class)this.dom.classList.add(t.class);this.scale();this.dom.setAttribute("aria-hidden","true");this.setOrder(e.state);e.requestMeasure(this.measureReq);if(t.mount)t.mount(this.dom,e)}update(e){if(e.startState.facet(Lc)!=e.state.facet(Lc))this.setOrder(e.state);if(this.layer.update(e,this.dom)||e.geometryChanged){this.scale();e.view.requestMeasure(this.measureReq)}}docViewUpdate(e){if(this.layer.updateOnDocViewUpdate!==false)e.requestMeasure(this.measureReq)}setOrder(e){let t=0,s=e.facet(Lc);while(t!IQ(t,this.drawn[s]))){let t=this.dom.firstChild,s=0;for(let r of e){if(r.update&&t&&r.constructor&&this.drawn[s].constructor&&r.update(t,this.drawn[s])){t=t.nextSibling;s++}else{this.dom.insertBefore(r.draw(),t)}}while(t){let r=t.nextSibling;t.remove();t=r}this.drawn=e;if(G.webkit)this.dom.style.display=this.dom.firstChild?"":"none"}}destroy(){if(this.layer.destroy)this.layer.destroy(this.dom,this.view);this.dom.remove()}}const Lc=te.define();function ux(i){return[Kt.define(e=>new DQ(e,i)),Lc.of(i)]}const oa=te.define({combine(i){return co(i,{cursorBlinkRate:1200,drawRangeCursor:true,iosSelectionHandles:true},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function zQ(i={}){return[oa.of(i),WQ,qQ,NQ,I2.of(true)]}function fx(i){return i.startState.facet(oa)!=i.state.facet(oa)}const WQ=ux({above:true,markers(i){let{state:e}=i,t=e.facet(oa);let s=[];for(let r of e.selection.ranges){let n=r==e.selection.main;if(r.empty||t.drawRangeCursor&&!(n&&G.ios&&t.iosSelectionHandles)){let o=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary";let a=r.empty?r:z.cursor(r.head,r.assoc);for(let l of Nn.forRange(i,o,a))s.push(l)}}return s},update(i,e){if(i.transactions.some(s=>s.selection))e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink";let t=fx(i);if(t)F_(i.state,e);return i.docChanged||i.selectionSet||t},mount(i,e){F_(e.state,i)},class:"cm-cursorLayer"});function F_(i,e){e.style.animationDuration=i.facet(oa).cursorBlinkRate+"ms"}const qQ=ux({above:false,markers(i){let e=[],{main:t,ranges:s}=i.state.selection;for(let r of s)if(!r.empty){for(let n of Nn.forRange(i,"cm-selectionBackground",r))e.push(n)}if(G.ios&&!t.empty&&i.state.facet(oa).iosSelectionHandles){for(let r of Nn.forRange(i,"cm-selectionHandle cm-selectionHandle-start",z.cursor(t.from,1)))e.push(r);for(let r of Nn.forRange(i,"cm-selectionHandle cm-selectionHandle-end",z.cursor(t.to,1)))e.push(r)}return e},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||fx(i)},class:"cm-selectionLayer"});const XQ=G.gecko&&G.gecko_version==153?"#ffffff01":"transparent";const NQ=ho.highest(J.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:\`\${XQ} !important\`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function FQ(){return UQ}const ZQ=fe.line({class:"cm-activeLine"});const UQ=Kt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){if(i.docChanged||i.selectionSet)this.decorations=this.getDeco(i.view)}getDeco(i){let e=-1,t=[];for(let s of i.state.selection.ranges){let r=i.lineBlockAt(s.head);if(r.from>e){t.push(ZQ.range(r.from));e=r.from}}return fe.set(t)}},{decorations:i=>i.decorations});const Im=2e3;function jQ(i,e,t){let s=Math.min(e.line,t.line),r=Math.max(e.line,t.line);let n=[];if(e.off>Im||t.off>Im||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=s;l<=r;l++){let h=i.doc.line(l);if(h.length<=a)n.push(z.range(h.from+o,h.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=s;l<=r;l++){let h=i.doc.line(l);let c=Om(h.text,o,i.tabSize,true);if(c<0){n.push(z.cursor(h.to))}else{let d=Om(h.text,a,i.tabSize);n.push(z.range(h.from+c,h.from+d))}}}return n}function HQ(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Z_(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},false);let s=i.state.doc.lineAt(t),r=t-s.from;let n=r>Im?-1:r==s.length?HQ(i,e.clientX):Fs(s.text,i.state.tabSize,t-s.from);return{line:s.number,col:n,off:r}}function VQ(i,e){let t=Z_(i,e),s=i.state.selection;if(!t)return null;return{update(r){if(r.docChanged){let n=r.changes.mapPos(r.startState.doc.line(t.line).from);let o=r.state.doc.lineAt(n);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)};s=s.map(r.changes)}},get(r,n,o){let a=Z_(i,r);if(!a)return s;let l=jQ(i.state,t,a);if(!l.length)return s;if(o)return z.create(l.concat(s.ranges));else return z.create(l)}}}function YQ(i){let e=t=>t.altKey&&t.button==0;return J.mouseSelectionStyle.of((t,s)=>e(s)?VQ(t,s):null)}const GQ={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]};const KQ={style:"cursor: crosshair"};function JQ(i={}){let[e,t]=GQ[i.key||"Alt"];let s=Kt.fromClass(class{constructor(r){this.view=r;this.isDown=false}set(r){if(this.isDown!=r){this.isDown=r;this.view.update([])}}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){if(r.keyCode==e||!t(r))this.set(false)},mousemove(r){this.set(t(r))}}});return[s,J.contentAttributes.of(r=>{var n;return((n=r.plugin(s))===null||n===void 0?void 0:n.isDown)?KQ:null})]}const U_=te.define({combine(i){let e,t;for(let s of i){e=e||s.topContainer;t=t||s.bottomContainer}return{topContainer:e,bottomContainer:t}}});function px(i,e){let t=i.plugin(mx);let s=t?t.specs.indexOf(e):-1;return s>-1?t.panels[s]:null}const mx=Kt.fromClass(class{constructor(i){this.input=i.state.facet(bd);this.specs=this.input.filter(t=>t);this.panels=this.specs.map(t=>t(i));let e=i.state.facet(U_);this.top=new Gh(i,true,e.topContainer);this.bottom=new Gh(i,false,e.bottomContainer);this.top.sync(this.panels.filter(t=>t.top));this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels){t.dom.classList.add("cm-panel");if(t.mount)t.mount()}}update(i){let e=i.state.facet(U_);if(this.top.container!=e.topContainer){this.top.sync([]);this.top=new Gh(i.view,true,e.topContainer)}if(this.bottom.container!=e.bottomContainer){this.bottom.sync([]);this.bottom=new Gh(i.view,false,e.bottomContainer)}this.top.syncClasses();this.bottom.syncClasses();let t=i.state.facet(bd);if(t!=this.input){let s=t.filter(l=>l);let r=[],n=[],o=[],a=[];for(let l of s){let h=this.specs.indexOf(l),c;if(h<0){c=l(i.view);a.push(c)}else{c=this.panels[h];if(c.update)c.update(i)}r.push(c);(c.top?n:o).push(c)}this.specs=s;this.panels=r;this.top.sync(n);this.bottom.sync(o);for(let l of a){l.dom.classList.add("cm-panel");if(l.mount)l.mount()}}else{for(let s of this.panels)if(s.update)s.update(i)}}destroy(){this.top.sync([]);this.bottom.sync([])}},{provide:i=>J.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Gh{constructor(e,t,s){this.view=e;this.top=t;this.container=s;this.dom=void 0;this.classes="";this.panels=[];this.syncClasses()}sync(e){for(let t of this.panels)if(t.destroy&&e.indexOf(t)<0)t.destroy();this.panels=e;this.syncDOM()}syncDOM(){if(this.panels.length==0){if(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";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels){if(t.dom.parentNode==this.dom){while(e!=t.dom)e=j_(e);e=e.nextSibling}else{this.dom.insertBefore(t.dom,e)}}while(e)e=j_(e)}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)return;for(let e of this.classes.split(" "))if(e)this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))if(e)this.container.classList.add(e)}}function j_(i){let e=i.nextSibling;i.remove();return e}const bd=te.define({enables:mx});function eR(i,e){let t;let s=new Promise(o=>t=o);let r=o=>tR(o,e,t);if(i.state.field(gf,false)){i.dispatch({effects:gx.of(r)})}else{i.dispatch({effects:Te.appendConfig.of(gf.init(()=>[r]))})}let n=Ox.of(r);return{close:n,result:s.then(o=>{let a=i.win.queueMicrotask||(l=>i.win.setTimeout(l,10));a(()=>{if(i.state.field(gf).indexOf(r)>-1)i.dispatch({effects:n})});return o})}}const gf=ji.define({create(){return[]},update(i,e){for(let t of e.effects){if(t.is(gx))i=[t.value].concat(i);else if(t.is(Ox))i=i.filter(s=>s!=t.value)}return i},provide:i=>bd.computeN([i],e=>e.field(i))});const gx=Te.define();const Ox=Te.define();function tR(i,e,t){let s=e.content?e.content(i,()=>o(null)):null;if(!s){s=wt("form");if(e.input){let a=wt("input",e.input);if(/^(text|password|number|email|tel|url)$/.test(a.type))a.classList.add("cm-textfield");if(!a.name)a.name="input";s.appendChild(wt("label",(e.label||"")+": ",a))}else{s.appendChild(document.createTextNode(e.label||""))}s.appendChild(document.createTextNode(" "));s.appendChild(wt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a{if(h.keyCode==27){h.preventDefault();o(null)}else if(h.keyCode==13){h.preventDefault();o(l)}});l.addEventListener("submit",h=>{h.preventDefault();o(l)})}let n=wt("div",s,wt("button",{onclick:()=>o(null),"aria-label":i.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));if(e.class)n.className=e.class;n.classList.add("cm-dialog");function o(a){if(n.contains(n.ownerDocument.activeElement))i.focus();t(a)}return{dom:n,top:e.top,mount:()=>{if(e.focus){let a;if(typeof e.focus=="string")a=s.querySelector(e.focus);else a=s.querySelector("input")||s.querySelector("button");if(a&&"select"in a)a.select();else if(a&&"focus"in a)a.focus()}}}}class dn extends an{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return false}destroy(e){}}dn.prototype.elementClass="";dn.prototype.toDOM=void 0;dn.prototype.mapMode=oi.TrackBefore;dn.prototype.startSide=dn.prototype.endSide=-1;dn.prototype.point=true;const Of=te.define();const iR=te.define();const sR={class:"",renderEmptyElements:false,elementStyle:"",markers:()=>ye.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"};const vl=te.define();function rR(i){return[_x(),vl.of({...sR,...i})]}const H_=te.define({combine:i=>i.some(e=>e)});function _x(i){let e=[nR];return e}const nR=Kt.fromClass(class{constructor(i){this.view=i;this.domAfter=null;this.prevViewport=i.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=i.state.facet(vl).map(e=>new Y_(i,e));this.fixed=!i.state.facet(H_);for(let e of this.gutters){if(e.config.side=="after")this.getDOMAfter().appendChild(e.dom);else this.dom.appendChild(e.dom)}if(this.fixed){this.dom.style.position="sticky"}this.syncGutters(false);i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){if(!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)}return this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport;let s=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(s<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e;if(this.domAfter)this.domAfter.style.minHeight=e}if(this.view.state.facet(H_)!=!this.fixed){this.fixed=!this.fixed;this.dom.style.position=this.fixed?"sticky":"";if(this.domAfter)this.domAfter.style.position=this.fixed?"sticky":""}this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;if(i){this.dom.remove();if(this.domAfter)this.domAfter.remove()}let t=ye.iter(this.view.state.facet(Of),this.view.viewport.from);let s=[];let r=this.gutters.map(n=>new oR(n,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks){if(s.length)s=[];if(Array.isArray(n.type)){let o=true;for(let a of n.type){if(a.type==Ft.Text&&o){Dm(t,s,a.from);for(let l of r)l.line(this.view,a,s);o=false}else if(a.widget){for(let l of r)l.widget(this.view,a)}}}else if(n.type==Ft.Text){Dm(t,s,n.from);for(let o of r)o.line(this.view,n,s)}else if(n.widget){for(let o of r)o.widget(this.view,n)}}for(let n of r)n.finish();if(i){this.view.scrollDOM.insertBefore(this.dom,e);if(this.domAfter)this.view.scrollDOM.appendChild(this.domAfter)}}updateGutters(i){let e=i.startState.facet(vl),t=i.state.facet(vl);let s=i.docChanged||i.heightChanged||i.viewportChanged||!ye.eq(i.startState.facet(Of),i.state.facet(Of),i.view.viewport.from,i.view.viewport.to);if(e==t){for(let r of this.gutters)if(r.update(i))s=true}else{s=true;let r=[];for(let n of t){let o=e.indexOf(n);if(o<0){r.push(new Y_(this.view,n))}else{this.gutters[o].update(i);r.push(this.gutters[o])}}for(let n of this.gutters){n.dom.remove();if(r.indexOf(n)<0)n.destroy()}for(let n of r){if(n.config.side=="after")this.getDOMAfter().appendChild(n.dom);else this.dom.appendChild(n.dom)}this.gutters=r}return s}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove();if(this.domAfter)this.domAfter.remove()}},{provide:i=>J.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let s=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ue.LTR?{left:s,right:r}:{right:s,left:r}})});function V_(i){return Array.isArray(i)?i:[i]}function Dm(i,e,t){while(i.value&&i.from<=t){if(i.from==t)e.push(i.value);i.next()}}class oR{constructor(e,t,s){this.gutter=e;this.height=s;this.i=0;this.cursor=ye.iter(e.markers,t.from)}addElement(e,t,s){let{gutter:r}=this,n=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let a=new vx(e,o,n,s);r.elements.push(a);r.dom.appendChild(a.dom)}else{r.elements[this.i].update(e,o,n,s)}this.height=t.bottom;this.i++}line(e,t,s){let r=[];Dm(this.cursor,r,t.from);if(s.length)r=r.concat(s);let n=this.gutter.config.lineMarker(e,t,r);if(n)r.unshift(n);let o=this.gutter;if(r.length==0&&!o.config.renderEmptyElements)return;this.addElement(e,t,r)}widget(e,t){let s=this.gutter.config.widgetMarker(e,t.widget,t),r=s?[s]:null;for(let n of e.state.facet(iR)){let o=n(e,t.widget,t);if(o)(r||(r=[])).push(o)}if(r)this.addElement(e,t,r)}finish(){let e=this.gutter;while(e.elements.length>this.i){let t=e.elements.pop();e.dom.removeChild(t.dom);t.destroy()}}}class Y_{constructor(e,t){this.view=e;this.config=t;this.elements=[];this.spacer=null;this.dom=document.createElement("div");this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let s in t.domEventHandlers){this.dom.addEventListener(s,r=>{let n=r.target,o;if(n!=this.dom&&this.dom.contains(n)){while(n.parentNode!=this.dom)n=n.parentNode;let l=n.getBoundingClientRect();o=(l.top+l.bottom)/2}else{o=r.clientY}let a=e.lineBlockAtHeight(o-e.documentTop);if(t.domEventHandlers[s](e,a,r))r.preventDefault()})}this.markers=V_(t.markers(e));if(t.initialSpacer){this.spacer=new vx(e,0,0,[t.initialSpacer(e)]);this.dom.appendChild(this.spacer.dom);this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none"}}update(e){let t=this.markers;this.markers=V_(this.config.markers(e.view));if(this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);if(r!=this.spacer.markers[0])this.spacer.update(e.view,0,0,[r])}let s=e.view.viewport;return!ye.eq(this.markers,t,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):false)}destroy(){for(let e of this.elements)e.destroy()}}class vx{constructor(e,t,s,r){this.height=-1;this.above=0;this.markers=[];this.dom=document.createElement("div");this.dom.className="cm-gutterElement";this.update(e,t,s,r)}update(e,t,s,r){if(this.height!=t){this.height=t;this.dom.style.height=t+"px"}if(this.above!=s)this.dom.style.marginTop=(this.above=s)?s+"px":"";if(!aR(this.markers,r))this.setMarkers(e,r)}setMarkers(e,t){let s="cm-gutterElement",r=this.dom.firstChild;for(let n=0,o=0;;){let a=o,l=nn(a,l,h)||o(a,l,h):o}return s}})}});class _f extends dn{constructor(e){super();this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function vf(i,e){return i.state.facet(Io).formatNumber(e,i.state)}const cR=vl.compute([Io],i=>({class:"cm-lineNumbers",renderEmptyElements:false,markers(e){return e.state.facet(lR)},lineMarker(e,t,s){if(s.some(r=>r.toDOM))return null;return new _f(vf(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,s)=>{for(let r of e.state.facet(hR)){let n=r(e,t,s);if(n)return n}return null},lineMarkerChange:e=>e.startState.facet(Io)!=e.state.facet(Io),initialSpacer(e){return new _f(vf(e,G_(e.state.doc.lines)))},updateSpacer(e,t){let s=vf(t.view,G_(t.view.state.doc.lines));return s==e.number?e:new _f(s)},domEventHandlers:i.facet(Io).domEventHandlers,side:"before"}));function dR(i={}){return[Io.of(i),_x(),cR]}function G_(i){let e=9;while(e{throw new Error("This node type doesn't define a deserialize function")});this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");if(typeof e!="function")e=pt.match(e);return t=>{let s=e(t);return s===void 0?null:[this,s]}}}ue.closedBy=new ue({deserialize:i=>i.split(" ")});ue.openedBy=new ue({deserialize:i=>i.split(" ")});ue.group=new ue({deserialize:i=>i.split(" ")});ue.isolate=new ue({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});ue.contextHash=new ue({perNode:true});ue.lookAhead=new ue({perNode:true});ue.mounted=new ue({perNode:true});class jo{constructor(e,t,s,r=false){this.tree=e;this.overlay=t;this.parser=s;this.bracketed=r}static get(e){return e&&e.props&&e.props[ue.mounted.id]}}const fR=Object.create(null);class pt{constructor(e,t,s,r=0){this.name=e;this.props=t;this.id=s;this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):fR;let s=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0);let r=new pt(e.name||"",t,e.id,s);if(e.props)for(let n of e.props){if(!Array.isArray(n))n=n(r);if(n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return true;let t=this.prop(ue.group);return t?t.indexOf(e)>-1:false}return this.id==e}static match(e){let t=Object.create(null);for(let s in e)for(let r of s.split(" "))t[r]=e[s];return s=>{for(let r=s.prop(ue.group),n=-1;n<(r?r.length:0);n++){let o=t[n<0?s.name:r[n]];if(o)return o}}}}pt.none=new pt("",Object.create(null),0,8);class ga{constructor(e){this.types=e;for(let t=0;t0;for(let l=this.cursor(o|Ee.IncludeAnonymous);;){let h=false;if(l.from<=n&&l.to>=r&&(!a&&l.type.isAnonymous||t(l)!==false)){if(l.firstChild())continue;h=true}for(;;){if(h&&s&&(a||!l.type.isAnonymous))s(l);if(l.nextSibling())break;if(!l.parent())return;h=true}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:jO(pt.none,this.children,this.positions,0,this.children.length,0,this.length,(t,s,r)=>new _e(this.type,t,s,r,this.propValues),e.makeTree||((t,s,r)=>new _e(pt.none,t,s,r)))}static build(e){return OR(e)}}_e.empty=new _e(pt.none,[],[],0);class ZO{constructor(e,t){this.buffer=e;this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ZO(this.buffer,this.index)}}class un{constructor(e,t,s){this.buffer=e;this.length=t;this.set=s}get type(){return pt.none}toString(){let e=[];for(let t=0;t0)break}}return a}slice(e,t,s){let r=this.buffer;let n=new Uint16Array(t-e),o=0;for(let a=e,l=0;a=e&&te;case 1:return t<=e&&s>e;case 2:return s>e;case 4:return true}}function ql(i,e,t,s){var r;while(i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?a.length:-1;e!=h;e+=t){let c=a[e],d=l[e]+o.from,u;if(!(n&Ee.EnterBracketed&&c instanceof _e&&(u=jo.get(c))&&!u.overlay&&u.bracketed&&s>=d&&s<=d+c.length)&&!bx(r,s,d,d+c.length))continue;if(c instanceof un){if(n&Ee.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,t,s-d,r);if(f>-1)return new Ls(new pR(o,c,e,d),null,f)}else if(n&Ee.IncludeAnonymous||(!c.type.isAnonymous||UO(c))){let f;if(!(n&Ee.IgnoreMounts)&&(f=jo.get(c))&&!f.overlay)return new Gt(f.tree,d,e,o);let p=new Gt(c,d,e,o);return n&Ee.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,s,r,n)}}if(n&Ee.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;o=o._parent;if(!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,s=0){let r;if(!(s&Ee.IgnoreOverlays)&&(r=jo.get(this._tree))&&r.overlay){let n=e-this.from,o=s&Ee.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay){if((t>0||o?a<=n:a=n:l>n))return new Gt(r.tree,r.overlay[0].from+this.from,-1,this)}}return this.nextChild(0,1,e,t,s)}nextSignificantParent(){let e=this;while(e.type.isAnonymous&&e._parent)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function J_(i,e,t,s){let r=i.cursor(),n=[];if(!r.firstChild())return n;if(t!=null)for(let o=false;!o;){o=r.type.is(t);if(!r.nextSibling())return n}for(;;){if(s!=null&&r.type.is(s))return n;if(r.type.is(e))n.push(r.node);if(!r.nextSibling())return s==null?n:[]}}function zm(i,e,t=e.length-1){for(let s=i;t>=0;s=s.parent){if(!s)return false;if(!s.type.isAnonymous){if(e[t]&&e[t]!=s.name)return false;t--}}return true}class pR{constructor(e,t,s,r){this.parent=e;this.buffer=t;this.index=s;this.start=r}}class Ls extends Sx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,s){super();this.context=e;this._parent=t;this.index=s;this.type=e.buffer.set.types[e.buffer.buffer[s]]}child(e,t,s){let{buffer:r}=this.context;let n=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,s);return n<0?null:new Ls(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,s=0){if(s&Ee.ExcludeBuffers)return null;let{buffer:r}=this.context;let n=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new Ls(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context;let t=e.buffer[this.index+3];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Ls(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context;let t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Ls(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[];let{buffer:s}=this.context;let r=this.index+4,n=s.buffer[this.index+3];if(n>r){let o=s.buffer[this.index+1];e.push(s.slice(r,n,o));t.push(0)}return new _e(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function wx(i){if(!i.length)return null;let e=0,t=i[0];for(let n=1;nt.from||o.to=e){let a=new Gt(o.tree,o.overlay[0].from+n.from,-1,n);(r||(r=[s])).push(ql(a,e,t,false))}}}return r?wx(r):s}class Sd{get name(){return this.type.name}constructor(e,t=0){this.buffer=null;this.stack=[];this.index=0;this.bufferNode=null;this.mode=t&~Ee.EnterBracketed;if(e instanceof Gt){this.yieldNode(e)}else{this._tree=e.context.parent;this.buffer=e.context;for(let s=e._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=e;this.yieldBuf(e.index)}}yieldNode(e){if(!e)return false;this._tree=e;this.type=e.type;this.from=e.from;this.to=e.to;return true}yieldBuf(e,t){this.index=e;let{start:s,buffer:r}=this.buffer;this.type=t||r.set.types[r.buffer[e]];this.from=s+r.buffer[e+1];this.to=s+r.buffer[e+2];return true}yield(e){if(!e)return false;if(e instanceof Gt){this.buffer=null;return this.yieldNode(e)}this.buffer=e.context;return this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,s){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,s,this.mode));let{buffer:r}=this.buffer;let n=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,s);if(n<0)return false;this.stack.push(this.index);return this.yieldBuf(n)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,s=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,s));return s&Ee.ExcludeBuffers?false:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ee.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ee.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();this.buffer=null;return this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?false:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,s=this.stack.length-1;if(e<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(s<0?t.buffer.length:t.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):false}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,s,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let n=t+e,o=e<0?-1:s._tree.children.length;n!=o;n+=e){let a=s._tree.children[n];if(this.mode&Ee.IncludeAnonymous||a instanceof un||!a.type.isAnonymous||UO(a))return false}}return true}move(e,t){if(t&&this.enterChild(e,0,4))return true;for(;;){if(this.sibling(e))return true;if(this.atLastNode(e)||!this.parent())return false}}next(e=true){return this.move(1,e)}prev(e=true){return this.move(-1,e)}moveTo(e,t=0){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o;s=n+1;break e}r=this.stack[--n]}}for(let r=s;r=0;n--){if(n<0)return zm(this._tree,e,r);let o=s[t.buffer[this.stack[n]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return false;r--}}return true}}function UO(i){return i.children.some(e=>e instanceof un||!e.type.isAnonymous||UO(e))}function OR(i){var e;let{buffer:t,nodeSet:s,maxBufferLength:r=yx,reused:n=[],minRepeatType:o=s.types.length}=i;let a=Array.isArray(t)?new ZO(t,t.length):t;let l=s.types;let h=0,c=0;function d(C,w,Q,D,I,F){let{id:X,start:x,end:y,size:$}=a;let E=c,R=h;if($<0){a.next();if($==-1){let re=n[X];Q.push(re);D.push(x-C);return}else if($==-3){h=X;return}else if($==-4){c=X;return}else{throw new RangeError(\`Unrecognized record size: \${$}\`)}}let A=l[X],B,M;let q=x-C;if(y-x<=r&&(M=O(a.pos-w,I))){let re=new Uint16Array(M.size-M.skip);let ee=a.pos-M.size,ne=re.length;while(a.pos>ee)ne=v(M.start,re,ne);B=new un(re,y-M.start,s);q=M.start-C}else{let re=a.pos-$;a.next();let ee=[],ne=[];let Ie=X>=o?X:-1;let pe=0,De=y;while(a.pos>re){if(Ie>=0&&a.id==Ie&&a.size>=0){if(a.end<=De-r){p(ee,ne,x,pe,a.end,De,Ie,E,R);pe=ee.length;De=a.end}a.next()}else if(F>2500){u(x,re,ee,ne)}else{d(x,re,ee,ne,Ie,F+1)}}if(Ie>=0&&pe>0&&pe-1&&pe>0){let Ce=f(A,R);B=jO(A,ee,ne,0,ee.length,0,y-x,Ce,Ce)}else{B=m(A,ee,ne,y-x,E-y,R)}}Q.push(B);D.push(q)}function u(C,w,Q,D){let I=[];let F=0,X=-1;while(a.pos>w){let{id:x,start:y,end:$,size:E}=a;if(E>4){a.next()}else if(X>-1&&y=0;$-=3){x[E++]=I[$];x[E++]=I[$+1]-y;x[E++]=I[$+2]-y;x[E++]=E}Q.push(new un(x,I[2]-y,s));D.push(y-C)}}function f(C,w){return(Q,D,I)=>{let F=0,X=Q.length-1,x,y;if(X>=0&&(x=Q[X])instanceof _e){if(!X&&x.type==C&&x.length==I)return x;if(y=x.prop(ue.lookAhead))F=D[X]+x.length+y}return m(C,Q,D,I,F,w)}}function p(C,w,Q,D,I,F,X,x,y){let $=[],E=[];while(C.length>D){$.push(C.pop());E.push(w.pop()+Q-I)}C.push(m(s.types[X],$,E,F-I,x-F,y));w.push(I-Q)}function m(C,w,Q,D,I,F,X){if(F){let x=[ue.contextHash,F];X=X?[x].concat(X):[x]}if(I>25){let x=[ue.lookAhead,I];X=X?[x].concat(X):[x]}return new _e(C,w,Q,D,X)}function O(C,w){let Q=a.fork();let D=0,I=0,F=0,X=Q.end-r;let x={size:0,start:0,skip:0};e:for(let y=Q.pos-C;Q.pos>y;){let $=Q.size;if(Q.id==w&&$>=0){x.size=D;x.start=I;x.skip=F;F+=4;D+=4;Q.next();continue}let E=Q.pos-$;if($<0||E=o?4:0;let A=Q.start;Q.next();while(Q.pos>E){if(Q.size<0){if(Q.size==-3||Q.size==-4)R+=4;else break e}else if(Q.id>=o){R+=4}Q.next()}I=A;D+=$;F+=R}if(w<0||D==C){x.size=D;x.start=I;x.skip=F}return x.size>4?x:void 0}function v(C,w,Q){let{id:D,start:I,end:F,size:X}=a;a.next();if(X>=0&&D4){let y=a.pos-(X-4);while(a.pos>y)Q=v(C,w,Q)}w[--Q]=x;w[--Q]=F-C;w[--Q]=I-C;w[--Q]=D}else if(X==-3){h=D}else if(X==-4){c=D}return Q}let T=[],k=[];while(a.pos>0)d(i.start||0,i.bufferStart||0,T,k,-1,0);let _=(e=i.length)!==null&&e!==void 0?e:T.length?k[0]+T[0].length:0;return new _e(l[i.topID],T.reverse(),k.reverse(),_)}const ev=new WeakMap;function Mc(i,e){if(!i.isAnonymous||e instanceof un||e.type!=i)return 1;let t=ev.get(e);if(t==null){t=1;for(let s of e.children){if(s.type!=i||!(s instanceof _e)){t=1;break}t+=Mc(i,s)}ev.set(e,t)}return t}function jO(i,e,t,s,r,n,o,a,l){let h=0;for(let p=s;p=c)break;w+=Q}if(k==_+1){if(w>c){let Q=p[_];f(Q.children,Q.positions,0,Q.children.length,m[_]+T);continue}d.push(p[_])}else{let Q=m[k-1]+p[k-1].length-C;d.push(jO(i,p,m,_,k,C,Q,null,l))}u.push(C+T-n)}}f(e,t,s,r,0);return(a||l)(d,u,o)}class HO{constructor(){this.map=new WeakMap}setBuffer(e,t,s){let r=this.map.get(e);if(!r)this.map.set(e,r=new Map);r.set(t,s)}getBuffer(e,t){let s=this.map.get(e);return s&&s.get(t)}set(e,t){if(e instanceof Ls)this.setBuffer(e.context.buffer,e.index,t);else if(e instanceof Gt)this.map.set(e.tree,t)}get(e){return e instanceof Ls?this.getBuffer(e.context.buffer,e.index):e instanceof Gt?this.map.get(e.tree):void 0}cursorSet(e,t){if(e.buffer)this.setBuffer(e.buffer.buffer,e.index,t);else this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class gr{constructor(e,t,s,r,n=false,o=false){this.from=e;this.to=t;this.tree=s;this.offset=r;this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],s=false){let r=[new gr(0,e.length,e,0,false,s)];for(let n of t)if(n.to>e.length)r.push(n);return r}static applyChanges(e,t,s=128){if(!t.length)return e;let r=[];let n=1,o=e.length?e[0]:null;for(let a=0,l=0,h=0;;a++){let c=a=s)while(o&&o.from=u.from||d<=u.to||h){let f=Math.max(u.from,l)-h,p=Math.min(u.to,d)-h;u=f>=p?null:new gr(f,p,u.tree,u.offset+h,a>0,!!c)}if(u)r.push(u);if(o.to>d)break;o=nnew Ni(r.from,r.to)):[new Ni(0,0)];return this.createParse(e,t||[],s)}parse(e,t,s){let r=this.startParse(e,t,s);for(;;){let n=r.advance();if(n)return n}}}class _R{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return false}read(e,t){return this.string.slice(e,t)}}function xx(i){return(e,t,s,r)=>new yR(e,i,t,s,r)}class tv{constructor(e,t,s,r,n,o){this.parser=e;this.parse=t;this.overlay=s;this.bracketed=r;this.target=n;this.from=o}}function iv(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class vR{constructor(e,t,s,r,n,o,a,l){this.parser=e;this.predicate=t;this.mounts=s;this.index=r;this.start=n;this.bracketed=o;this.target=a;this.prev=l;this.depth=0;this.ranges=[]}}const Wm=new ue({perNode:true});class yR{constructor(e,t,s,r,n){this.nest=t;this.input=s;this.fragments=r;this.ranges=n;this.inner=[];this.innerDone=0;this.baseTree=null;this.stoppedAt=null;this.baseParse=e}advance(){if(this.baseParse){let s=this.baseParse.advance();if(!s)return null;this.baseParse=null;this.baseTree=s;this.startInner();if(this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let s=this.baseTree;if(this.stoppedAt!=null)s=new _e(s.type,s.children,s.positions,s.length,s.propValues.concat([[Wm,this.stoppedAt]]));return s}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let s=Object.assign(Object.create(null),e.target.props);s[ue.mounted.id]=new jo(t,e.overlay,e.parser,e.bracketed);e.target.props=s}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt){a=false}else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let d=c.from+h.pos,u=c.to+h.pos;if(d>=r.from&&u<=r.to&&!t.ranges.some(f=>f.fromd))t.ranges.push({from:d,to:u})}}a=false}else if(s&&(o=bR(s.ranges,r.from,r.to))){a=o!=2}else if(!r.type.isAnonymous&&(n=this.nest(r,this.input))&&(r.fromnew Ni(d.from-r.from,d.to-r.from)):null,!!n.bracketed,r.tree,c.length?c[0].from:r.from));if(!n.overlay)a=false;else if(c.length)s={ranges:c,depth:0,prev:s}}}else if(t&&(l=t.predicate(r))){if(l===true)l=new Ni(r.from,r.to);if(l.from=0&&t.ranges[h].to==l.from)t.ranges[h]={from:t.ranges[h].from,to:l.to};else t.ranges.push(l)}}if(a&&r.firstChild()){if(t)t.depth++;if(s)s.depth++}else{for(;;){if(r.nextSibling())break;if(!r.parent())break e;if(t&&!--t.depth){let h=nv(this.ranges,t.ranges);if(h.length){iv(h);this.inner.splice(t.index,0,new tv(t.parser,t.parser.startParse(this.input,ov(t.mounts,h),h),t.ranges.map(c=>new Ni(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))}t=t.prev}if(s&&!--s.depth)s=s.prev}}}}}function bR(i,e,t){for(let s of i){if(s.from>=t)break;if(s.to>e)return s.from<=e&&s.to>=t?2:1}return 0}function sv(i,e,t,s,r,n){if(e=e&&t.enter(s,1,Ee.IgnoreOverlays|Ee.ExcludeBuffers));else if(t.to<=e){if(!t.next(false))this.done=true}else{break}}}hasNode(e){this.moveTo(e.from);if(!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree){for(let t=this.cursor.tree;;){if(t==e.tree)return true;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof _e)t=t.children[0];else break}}return false}}let wR=class RU{constructor(e){var t;this.fragments=e;this.curTo=0;this.fragI=0;if(e.length){let s=this.curFrag=e[0];this.curTo=(t=s.tree.prop(Wm))!==null&&t!==void 0?t:s.to;this.inner=new rv(s.tree,-s.offset)}else{this.curFrag=this.inner=null}}hasNode(e){while(this.curFrag&&e.from>=this.curTo)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;this.fragI++;if(this.fragI==this.fragments.length){this.curFrag=this.inner=null}else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Wm))!==null&&e!==void 0?e:t.to;this.inner=new rv(t.tree,-t.offset)}}findMounts(e,t){var s;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let n=this.inner.cursor.node;n;n=n.parent){let o=(s=n.tree)===null||s===void 0?void 0:s.prop(ue.mounted);if(o&&o.parser==t){for(let a=this.fragI;a=n.to)break;if(l.tree==this.curFrag.tree)r.push({frag:l,pos:n.from-l.offset,mount:o})}}}}return r}};function nv(i,e){let t=null,s=e;for(let r=1,n=0;r=a)break;if(l.to<=o)continue;if(!t)s=t=e.slice();if(l.froma)t.splice(n+1,0,new Ni(a,l.to))}else if(l.to>a){t[n--]=new Ni(a,l.to)}else{t.splice(n--,1)}}}return s}function xR(i,e,t,s){let r=0,n=0,o=false,a=false,l=-1e9;let h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from;let d=n==e.length?1e9:a?e[n].to:e[n].from;if(o!=a){let u=Math.max(l,t),f=Math.min(c,d,s);if(unew Ni(u.from+s,u.to+s));let d=xR(e,c,l,h);for(let u=0,f=l;;u++){let p=u==d.length,m=p?h:d[u].from;if(m>f)t.push(new gr(f,m,r.tree,-o,n.from>=f||n.openStart,n.to<=m||n.openEnd));if(p)break;f=d[u].to}}else{t.push(new gr(l,h,r.tree,-o,n.from>=o||n.openStart,n.to<=a||n.openEnd))}}return t}let kR=0;let Ps=class qm{constructor(e,t,s,r){this.name=e;this.set=t;this.base=s;this.modified=r;this.id=kR++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=\`\${t.name}(\${e})\`;return e}static define(e,t){let s=typeof e=="string"?e:"?";if(e instanceof qm)t=e;if(t===null||t===void 0?void 0:t.base)throw new Error("Can not derive from a modified tag");let r=new qm(s,[],null,[]);r.set.push(r);if(t)for(let n of t.set)r.set.push(n);return r}static defineModifier(e){let t=new wd(e);return s=>{if(s.modified.indexOf(t)>-1)return s;return wd.get(s.base||s,s.modified.concat(t).sort((r,n)=>r.id-n.id))}}};let CR=0;class wd{constructor(e){this.name=e;this.instances=[];this.id=CR++}static get(e,t){if(!t.length)return e;let s=t[0].instances.find(a=>a.base==e&&TR(t,a.modified));if(s)return s;let r=[],n=new Ps(e.name,r,e,t);for(let a of t)a.instances.push(n);let o=PR(t);for(let a of e.set)if(!a.modified.length)for(let l of o)r.push(wd.get(a,l));return n}}function TR(i,e){return i.length==e.length&&i.every((t,s)=>t==e[s])}function PR(i){let e=[[]];for(let t=0;ts.length-t.length)}function Sr(i){let e=Object.create(null);for(let t in i){let s=i[t];if(!Array.isArray(s))s=[s];for(let r of t.split(" "))if(r){let n=[],o=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){o=1;break}let u=/^"(?:[^"\\\\]|\\\\.)*?"|[^\\/!]+/.exec(a);if(!u)throw new RangeError("Invalid path: "+r);n.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]);d+=u[0].length;if(d==r.length)break;let f=r[d++];if(d==r.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=n.length-1,h=n[l];if(!h)throw new RangeError("Invalid path: "+r);let c=new Xl(s,o,l>0?n.slice(0,l):null);e[h]=c.sort(e[h])}}return kx.add(e)}const kx=new ue({combine(i,e){let t,s,r;while(i||e){if(!i||e&&i.depth>=e.depth){r=e;e=e.next}else{r=i;i=i.next}if(t&&t.mode==r.mode&&!r.context&&!t.context)continue;let n=new Xl(r.tags,r.mode,r.context);if(t)t.next=n;else s=n;t=n}return s}});let Xl=class AU{constructor(e,t,s,r){this.tags=e;this.mode=t;this.context=s;this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth{let o=r;for(let a of n){for(let l of a.set){let h=t[l.id];if(h){o=o?o+" "+h:h;break}}}return o},scope:s}}function $R(i,e){let t=null;for(let s of i){let r=s.style(e);if(r)t=t?t+" "+r:r}return t}function ER(i,e,t,s=0,r=i.length){let n=new QR(s,Array.isArray(e)?e:[e],t);n.highlightRange(i.cursor(),s,r,"",n.highlighters);n.flush(r)}class QR{constructor(e,t,s){this.at=e;this.highlighters=t;this.span=s;this.class=""}startSpan(e,t){if(t!=this.class){this.flush(e);if(e>this.at)this.at=e;this.class=t}}flush(e){if(e>this.at&&this.class)this.span(this.at,e,this.class)}highlightRange(e,t,s,r,n){let{type:o,from:a,to:l}=e;if(a>=s||l<=t)return;if(o.isTop)n=this.highlighters.filter(f=>!f.scope||f.scope(o));let h=r;let c=RR(e)||Xl.empty;let d=$R(n,c.tags);if(d){if(h)h+=" ";h+=d;if(c.mode==1)r+=(r?" ":"")+d}this.startSpan(Math.max(t,a),h);if(c.opaque)return;let u=e.tree&&e.tree.prop(ue.mounted);if(u&&u.overlay){let f=e.node.enter(u.overlay[0].from+a,1);let p=this.highlighters.filter(O=>!O.scope||O.scope(u.tree.type));let m=e.firstChild();for(let O=0,v=a;;O++){let T=O=k||!e.nextSibling())break}}if(!T||k>s)break;v=T.to+a;if(v>t){this.highlightRange(f.cursor(),Math.max(t,T.from+a),Math.min(s,v),"",p);this.startSpan(Math.min(s,v),h)}}if(m)e.parent()}else if(e.firstChild()){if(u)r="";do{if(e.to<=t)continue;if(e.from>=s)break;this.highlightRange(e,t,s,r,n);this.startSpan(Math.min(s,e.to),h)}while(e.nextSibling());e.parent()}}}function RR(i){let e=i.type.prop(kx);while(e&&e.context&&!i.matchContext(e.context))e=e.next;return e||null}const V=Ps.define;const Jh=V();const Wr=V();const av=V(Wr);const lv=V(Wr);const qr=V();const ec=V(qr);const yf=V(qr);const xs=V();const Sn=V(xs);const gs=V();const Os=V();const Xm=V();const Aa=V(Xm);const tc=V();const P={comment:Jh,lineComment:V(Jh),blockComment:V(Jh),docComment:V(Jh),name:Wr,variableName:V(Wr),typeName:av,tagName:V(av),propertyName:lv,attributeName:V(lv),className:V(Wr),labelName:V(Wr),namespace:V(Wr),macroName:V(Wr),literal:qr,string:ec,docString:V(ec),character:V(ec),attributeValue:V(ec),number:yf,integer:V(yf),float:V(yf),bool:V(qr),regexp:V(qr),escape:V(qr),color:V(qr),url:V(qr),keyword:gs,self:V(gs),null:V(gs),atom:V(gs),unit:V(gs),modifier:V(gs),operatorKeyword:V(gs),controlKeyword:V(gs),definitionKeyword:V(gs),moduleKeyword:V(gs),operator:Os,derefOperator:V(Os),arithmeticOperator:V(Os),logicOperator:V(Os),bitwiseOperator:V(Os),compareOperator:V(Os),updateOperator:V(Os),definitionOperator:V(Os),typeOperator:V(Os),controlOperator:V(Os),punctuation:Xm,separator:V(Xm),bracket:Aa,angleBracket:V(Aa),squareBracket:V(Aa),paren:V(Aa),brace:V(Aa),content:xs,heading:Sn,heading1:V(Sn),heading2:V(Sn),heading3:V(Sn),heading4:V(Sn),heading5:V(Sn),heading6:V(Sn),contentSeparator:V(xs),list:V(xs),quote:V(xs),emphasis:V(xs),strong:V(xs),link:V(xs),monospace:V(xs),strikethrough:V(xs),inserted:V(),deleted:V(),changed:V(),invalid:V(),meta:tc,documentMeta:V(tc),annotation:V(tc),processingInstruction:V(tc),definition:Ps.defineModifier("definition"),constant:Ps.defineModifier("constant"),function:Ps.defineModifier("function"),standard:Ps.defineModifier("standard"),local:Ps.defineModifier("local"),special:Ps.defineModifier("special")};for(let i in P){let e=P[i];if(e instanceof Ps)e.name=i}const AR=Cx([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var bf;const Gr=new ue;function fu(i){return te.define({combine:i?e=>e.concat(i):void 0})}const VO=new ue;class Ei{constructor(e,t,s=[],r=""){this.data=e;this.name=r;if(!xe.prototype.hasOwnProperty("tree"))Object.defineProperty(xe.prototype,"tree",{get(){return We(this)}});this.parser=t;this.extension=[fn.of(this),xe.languageData.of((n,o,a)=>{let l=hv(n,o,a),h=l.type.prop(Gr);if(!h)return[];let c=n.facet(h),d=l.type.prop(VO);if(d){let u=l.resolve(o-l.from,a);for(let f of d)if(f.test(u,n)){let p=n.facet(f.facet);return f.type=="replace"?p:p.concat(c)}}return c})].concat(s)}isActiveAt(e,t,s=-1){return hv(e,t,s).type.prop(Gr)==this.data}findRegions(e){let t=e.facet(fn);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let s=[];let r=(n,o)=>{if(n.prop(Gr)==this.data){s.push({from:o,to:o+n.length});return}let a=n.prop(ue.mounted);if(a){if(a.tree.prop(Gr)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+n.length});return}else if(a.overlay){let l=s.length;r(a.tree,a.overlay[0].from+o);if(s.length>l)return}}for(let l=0;ls.isTop?t:void 0)]}),e.name)}configure(e,t){return new _r(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function We(i){let e=i.field(Ei.state,false);return e?e.tree:_e.empty}class LR{constructor(e){this.doc=e;this.cursorPos=0;this.string="";this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){this.string=this.cursor.next(e-this.cursorPos).value;this.cursorPos=e+this.string.length;return this.cursorPos-this.string.length}chunk(e){this.syncTo(e);return this.string}get lineChunks(){return true}read(e,t){let s=this.cursorPos-this.string.length;if(e=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-s,t-s)}}let La=null;class eo{constructor(e,t,s=[],r,n,o,a,l){this.parser=e;this.state=t;this.fragments=s;this.tree=r;this.treeLen=n;this.viewport=o;this.skipped=a;this.scheduleOn=l;this.parse=null;this.tempSkipped=[]}static create(e,t,s){return new eo(e,t,[],_e.empty,0,s,[],null)}startParse(){return this.parser.startParse(new LR(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=_e.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length)){this.takeTree();return true}return this.withContext(()=>{var s;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance())){}});this.treeLen=e;this.tree=t;this.fragments=this.withoutTempSkipped(gr.addTree(this.tree,this.fragments,true));this.parse=null}}withContext(e){let t=La;La=this;try{return e()}finally{La=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=cv(e,t.from,t.to);return e}changes(e,t){let{fragments:s,tree:r,treeLen:n,viewport:o,skipped:a}=this;this.takeTree();if(!e.empty){let l=[];e.iterChangedRanges((h,c,d,u)=>l.push({fromA:h,toA:c,fromB:d,toB:u}));s=gr.applyChanges(s,l);r=_e.empty;n=0;o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)};if(this.skipped.length){a=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);if(ce.from){this.fragments=cv(this.fragments,r,n);this.skipped.splice(s--,1)}}if(this.skipped.length>=t)return false;this.reset();return true}reset(){if(this.parse){this.takeTree();this.parse=null}}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends uu{createParse(t,s,r){let n=r[0].from,o=r[r.length-1].to;let a={parsedPos:n,advance(){let l=La;if(l){for(let h of r)l.tempSkipped.push(h);if(e)l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e}this.parsedPos=o;return new _e(pt.none,[],[],o-n)},stoppedAt:null,stopAt(){}};return a}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return La}}function cv(i,e,t){return gr.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class aa{constructor(e){this.context=e;this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state);let s=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,s))t.takeTree();return new aa(t)}static init(e){let t=Math.min(3e3,e.doc.length);let s=eo.create(e.facet(fn).parser,e,{from:0,to:t});if(!s.work(20,t))s.takeTree();return new aa(s)}}Ei.state=ji.define({create:aa.init,update(i,e){for(let t of e.effects)if(t.is(Ei.setState))return t.value;if(e.startState.facet(fn)!=e.state.facet(fn))return aa.init(e.state);return i.apply(e)}});let Tx=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};if(typeof requestIdleCallback!="undefined")Tx=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)};const Sf=typeof navigator!="undefined"&&((bf=navigator.scheduling)===null||bf===void 0?void 0:bf.isInputPending)?()=>navigator.scheduling.isInputPending():null;const MR=Kt.fromClass(class LU{constructor(e){this.view=e;this.working=null;this.workScheduled=0;this.chunkEnd=-1;this.chunkBudget=-1;this.work=this.work.bind(this);this.scheduleWork()}update(e){let t=this.view.state.field(Ei.state).context;if(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)this.scheduleWork();if(e.docChanged||e.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ei.state);if(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))this.working=Tx(this.work)}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3;let l=n.context.work(()=>{return Sf&&Sf()||Date.now()>o},r+(a?0:1e5));this.chunkBudget-=Date.now()-t;if(l||this.chunkBudget<=0){n.context.takeTree();this.view.dispatch({effects:Ei.setState.of(new aa(n.context))})}if(this.chunkBudget>0&&!(l&&!a))this.scheduleWork();this.checkAsyncSchedule(n.context)}checkAsyncSchedule(e){if(e.scheduleOn){this.workScheduled++;e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>As(this.view.state,t)).then(()=>this.workScheduled--);e.scheduleOn=null}}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}});const fn=te.define({combine(i){return i.length?i[0]:null},enables:i=>[Ei.state,MR,J.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class pn{constructor(e,t=[]){this.language=e;this.support=t;this.extension=[e,t]}}class xd{constructor(e,t,s,r,n,o=void 0){this.name=e;this.alias=t;this.extensions=s;this.filename=r;this.loadFunc=n;this.support=o;this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{this.loading=null;throw e}))}static of(e){let{load:t,support:s}=e;if(!t){if(!s)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(s)}return new xd(e.name,(e.alias||[]).concat(e.name).map(r=>r.toLowerCase()),e.extensions||[],e.filename,t,s)}static matchFilename(e,t){for(let r of e)if(r.filename&&r.filename.test(t))return r;let s=/\\.([^.]+)$/.exec(t);if(s){for(let r of e)if(r.extensions.indexOf(s[1])>-1)return r}return null}static matchLanguageName(e,t,s=true){t=t.toLowerCase();for(let r of e)if(r.alias.some(n=>n==t))return r;if(s)for(let r of e)for(let n of r.alias){let o=t.indexOf(n);if(o>-1&&(n.length>2||!/\\w/.test(t[o-1])&&!/\\w/.test(t[o+n.length])))return r}return null}}const BR=te.define();const ph=te.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function to(i){let e=i.facet(ph);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function Nl(i,e){let t="",s=i.tabSize,r=i.facet(ph)[0];if(r==" "){while(e>=s){t+=" ";e-=s}r=" "}for(let n=0;n=e?IR(i,t,e):null}class pu{constructor(e,t={}){this.state=e;this.options=t;this.unit=to(e)}lineAt(e,t=1){let s=this.state.doc.lineAt(e);let{simulateBreak:r,simulateDoubleBreak:n}=this.options;if(r!=null&&r>=s.from&&r<=s.to){if(n&&r==e)return{text:"",from:e};else if(t<0?r-1)n+=o-this.countColumn(s,s.search(/\\S|$/));return n}countColumn(e,t=e.length){return Fs(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:s,from:r}=this.lineAt(e,t);let n=this.options.overrideIndentation;if(n){let o=n(r);if(o>-1)return o}return this.countColumn(s,s.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const wr=new ue;function IR(i,e,t){let s=e.resolveStack(t);let r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=s.node){let n=[];for(let o=r;o&&!(o.froms.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)n.push(o);for(let o=n.length-1;o>=0;o--)s={node:n[o],next:s}}return Px(s,i,t)}function Px(i,e,t){for(let s=i;s;s=s.next){let r=zR(s.node);if(r)return r(GO.create(e,t,s))}return 0}function DR(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function zR(i){let e=i.type.prop(wr);if(e)return e;let t=i.firstChild,s;if(t&&(s=t.type.prop(ue.closedBy))){let r=i.lastChild,n=r&&s.indexOf(r.name)>-1;return o=>$x(o,true,1,void 0,n&&!DR(o)?r.from:void 0)}return i.parent==null?WR:null}function WR(){return 0}class GO extends pu{constructor(e,t,s){super(e.state,e.options);this.base=e;this.pos=t;this.context=s}get node(){return this.context.node}static create(e,t,s){return new GO(e,t,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let s=e.resolve(t.from);while(s.parent&&s.parent.from==s.from)s=s.parent;if(qR(s,e))break;t=this.state.doc.lineAt(s.from)}return this.lineIndent(t.from)}continue(){return Px(this.context.next,this.base,this.pos)}}function qR(i,e){for(let t=e;t;t=t.parent)if(i==t)return true;return false}function XR(i){let e=i.node;let t=e.childAfter(e.from),s=e.lastChild;if(!t)return null;let r=i.options.simulateBreak;let n=i.state.doc.lineAt(t.from);let o=r==null||r<=n.from?n.to:Math.min(n.to,r);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let h=/^ */.exec(n.text.slice(t.to-n.from))[0].length;return{from:t.from,to:t.to+h}}a=l.to}}function Ho({closing:i,align:e=true,units:t=1}){return s=>$x(s,e,t,i)}function $x(i,e,t,s,r){let n=i.textAfter,o=n.match(/^\\s*/)[0].length;let a=s&&n.slice(o,o+s.length)==s||r==i.pos+o;let l=e?XR(i):null;if(l)return a?i.column(l.from):i.column(l.to);return i.baseIndent+(a?0:i.unit*t)}const NR=i=>i.baseIndent;function Vo({except:i,units:e=1}={}){return t=>{let s=i&&i.test(t.textAfter);return t.baseIndent+(s?0:e*t.unit)}}const FR=200;function ZR(){return xe.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:s}=i.newSelection.main,r=t.lineAt(s);if(s>r.from+FR)return i;let n=t.sliceString(r.from,s);if(!e.some(h=>h.test(n)))return i;let{state:o}=i,a=-1,l=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==a)continue;a=c.from;let d=YO(o,c.from);if(d==null)continue;let u=/^\\s*/.exec(c.text)[0];let f=Nl(o,d);if(u!=f)l.push({from:c.from,to:c.from+u.length,insert:f})}return l.length?[i,{changes:l,sequential:true}]:i})}const Ex=te.define();const xr=new ue;function mh(i){let e=i.firstChild,t=i.lastChild;return e&&e.tot)continue;if(n&&a.from=e&&h.to>t)n=h}}return n}function jR(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function kd(i,e,t){for(let s of i.facet(Ex)){let r=s(i,e,t);if(r)return r}return UR(i,e,t)}function Qx(i,e){let t=e.mapPos(i.from,1),s=e.mapPos(i.to,-1);return t>=s?void 0:{from:t,to:s}}const mu=Te.define({map:Qx});const gh=Te.define({map:Qx});function Rx(i){let e=[];for(let{head:t}of i.state.selection.ranges){if(e.some(s=>s.from<=t&&s.to>=t))continue;e.push(i.lineBlockAt(t))}return e}const io=ji.define({create(){return fe.none},update(i,e){if(e.isUserEvent("delete"))e.changes.iterChangedRanges((s,r)=>i=dv(i,s,r));i=i.map(e.changes);let t=[];for(let s of e.effects){if(s.is(mu)&&!HR(i,s.value.from,s.value.to)){t.push(s.value)}else if(s.is(gh)){i=i.update({filter:(r,n)=>s.value.from!=r||s.value.to!=n,filterFrom:s.value.from,filterTo:s.value.to})}}if(t.length){let{preparePlaceholder:s}=e.state.facet(Mx);let r=t.map(n=>{let o=!s?uv:fe.replace({widget:new tA(s(e.state,n))});return o.range(n.from,n.to)});i=i.update({add:r})}if(e.selection)i=dv(i,e.selection.main.head);return i},provide:i=>J.decorations.from(i),toJSON(i,e){let t=[];i.between(0,e.doc.length,(s,r)=>{t.push(s,r)});return t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{if(re)s=true});return!s?i:i.update({filterFrom:e,filterTo:t,filter:(r,n)=>r>=t||n<=e})}function Cd(i,e,t){var s;let r=null;(s=i.field(io,false))===null||s===void 0?void 0:s.between(e,t,(n,o)=>{if(!r||r.from>n)r={from:n,to:o}});return r}function HR(i,e,t){let s=false;i.between(e,e,(r,n)=>{if(r==e&&n==t)s=true});return s}function Ax(i,e){return i.field(io,false)?e:e.concat(Te.appendConfig.of(Bx()))}const VR=i=>{for(let e of Rx(i)){let t=kd(i.state,e.from,e.to);if(t){i.dispatch({effects:Ax(i.state,[mu.of(t),Lx(i,t)])});return true}}return false};const YR=i=>{if(!i.state.field(io,false))return false;let e=[];for(let t of Rx(i)){let s=Cd(i.state,t.from,t.to);if(s)e.push(gh.of(s),Lx(i,s,false))}if(e.length)i.dispatch({effects:e});return e.length>0};function Lx(i,e,t=true){let s=i.state.doc.lineAt(e.from).number,r=i.state.doc.lineAt(e.to).number;return J.announce.of(\`\${i.state.phrase(t?"Folded lines":"Unfolded lines")} \${s} \${i.state.phrase("to")} \${r}.\`)}const GR=i=>{let{state:e}=i,t=[];for(let s=0;s{let e=i.state.field(io,false);if(!e||!e.size)return false;let t=[];e.between(0,i.state.doc.length,(s,r)=>{t.push(gh.of({from:s,to:r}))});i.dispatch({effects:t});return true};const JR=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:VR},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:YR},{key:"Ctrl-Alt-[",run:GR},{key:"Ctrl-Alt-]",run:KR}];const eA={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};const Mx=te.define({combine(i){return co(i,eA)}});function Bx(i){let e=[io,rA];return e}function Ix(i,e){let{state:t}=i,s=t.facet(Mx);let r=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target));let l=Cd(i.state,a.from,a.to);if(l)i.dispatch({effects:gh.of(l)});o.preventDefault()};if(s.placeholderDOM)return s.placeholderDOM(i,r,e);let n=document.createElement("span");n.textContent=s.placeholderText;n.setAttribute("aria-label",t.phrase("folded code"));n.title=t.phrase("unfold");n.className="cm-foldPlaceholder";n.onclick=r;return n}const uv=fe.replace({widget:new class extends uo{toDOM(i){return Ix(i,null)}}});class tA extends uo{constructor(e){super();this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ix(e,this.value)}}const iA={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>false};class wf extends dn{constructor(e,t){super();this.config=e;this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");t.textContent=this.open?this.config.openText:this.config.closedText;t.title=e.state.phrase(this.open?"Fold line":"Unfold line");return t}}function sA(i={}){let e={...iA,...i};let t=new wf(e,true),s=new wf(e,false);let r=Kt.fromClass(class{constructor(o){this.from=o.viewport.from;this.markers=this.buildMarkers(o)}update(o){if(o.docChanged||o.viewportChanged||o.startState.facet(fn)!=o.state.facet(fn)||o.startState.field(io,false)!=o.state.field(io,false)||We(o.startState)!=We(o.state)||e.foldingChanged(o))this.markers=this.buildMarkers(o.view)}buildMarkers(o){let a=new Yn;for(let l of o.viewportLineBlocks){let h=Cd(o.state,l.from,l.to)?s:kd(o.state,l.from,l.to)?t:null;if(h)a.add(l.from,l.from,h)}return a.finish()}});let{domEventHandlers:n}=e;return[r,rR({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(r))===null||a===void 0?void 0:a.markers)||ye.empty},initialSpacer(){return new wf(e,false)},domEventHandlers:{...n,click:(o,a,l)=>{if(n.click&&n.click(o,a,l))return true;let h=Cd(o.state,a.from,a.to);if(h){o.dispatch({effects:gh.of(h)});return true}let c=kd(o.state,a.from,a.to);if(c){o.dispatch({effects:mu.of(c)});return true}return false}}}),Bx()]}const rA=J.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 KO{constructor(e,t){this.specs=e;let s;function r(a){let l=ln.newName();(s||(s=Object.create(null)))["."+l]=a;return l}const n=typeof t.all=="string"?t.all:t.all?r(t.all):void 0;const o=t.scope;this.scope=o instanceof Ei?a=>a.prop(Gr)==o.data:o?a=>a==o:void 0;this.style=Cx(e.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:n}).style;this.module=s?new ln(s):null;this.themeType=t.themeType}static define(e,t){return new KO(e,t||{})}}const Nm=te.define();const Dx=te.define({combine(i){return i.length?[i[0]]:null}});function xf(i){let e=i.facet(Nm);return e.length?e:i.facet(Dx)}function nA(i,e){let t=[aA],s;if(i instanceof KO){if(i.module)t.push(J.styleModule.of(i.module));s=i.themeType}if(e===null||e===void 0?void 0:e.fallback)t.push(Dx.of(i));else if(s)t.push(Nm.computeN([J.darkTheme],r=>{return r.facet(J.darkTheme)==(s=="dark")?[i]:[]}));else t.push(Nm.of(i));return t}class oA{constructor(e){this.markCache=Object.create(null);this.tree=We(e.state);this.decorations=this.buildDeco(e,xf(e.state));this.decoratedTo=e.viewport.to}update(e){let t=We(e.state),s=xf(e.state);let r=s!=xf(e.startState);let{viewport:n}=e.view,o=e.changes.mapPos(this.decoratedTo,1);if(t.length=n.to){this.decorations=this.decorations.map(e.changes);this.decoratedTo=o}else if(t!=this.tree||e.viewportChanged||r){this.tree=t;this.decorations=this.buildDeco(e.view,s);this.decoratedTo=n.to}}buildDeco(e,t){if(!t||!this.tree.length)return fe.none;let s=new Yn;for(let{from:r,to:n}of e.visibleRanges){ER(this.tree,t,(o,a,l)=>{s.add(o,a,this.markCache[l]||(this.markCache[l]=fe.mark({class:l})))},r,n)}return s.finish()}}const aA=ho.high(Kt.fromClass(oA,{decorations:i=>i.decorations}));const lA=J.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});const zx=1e4;const Wx="()[]{}";const qx=te.define({combine(i){return co(i,{afterCursor:true,brackets:Wx,maxScanDistance:zx,renderMatch:dA})}});const hA=fe.mark({class:"cm-matchingBracket"});const cA=fe.mark({class:"cm-nonmatchingBracket"});function dA(i){let e=[];let t=i.matched?hA:cA;e.push(t.range(i.start.from,i.start.to));if(i.end)e.push(t.range(i.end.from,i.end.to));return e}function fv(i){let e=[];let t=i.facet(qx);for(let s of i.selection.ranges){if(!s.empty)continue;let r=Ms(i,s.head,-1,t)||s.head>0&&Ms(i,s.head-1,1,t)||t.afterCursor&&(Ms(i,s.head,1,t)||s.headi.decorations});const fA=[uA,lA];function pA(i={}){return[qx.of(i),fA]}const Xx=new ue;function Fm(i,e,t){let s=i.prop(e<0?ue.openedBy:ue.closedBy);if(s)return s;if(i.name.length==1){let r=t.indexOf(i.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function Zm(i){let e=i.type.prop(Xx);return e?e(i.node):i}function Ms(i,e,t,s={}){let r=s.maxScanDistance||zx,n=s.brackets||Wx;let o=We(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let h=Fm(l.type,t,n);if(h&&l.from0?e>=c.from&&ec.from&&e<=c.to))return mA(i,e,t,l,c,h,n)}}return gA(i,e,t,o,a.type,r,n)}function mA(i,e,t,s,r,n,o){let a=s.parent,l={from:r.from,to:r.to};let h=0,c=a===null||a===void 0?void 0:a.cursor();if(c&&(t<0?c.childBefore(s.from):c.childAfter(s.to)))do{if(t<0?c.to<=s.from:c.from>=s.to){if(h==0&&n.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e};let c=i.doc.iterRange(e,t>0?i.doc.length:0),d=0;for(let u=0;!c.next().done&&u<=n;){let f=c.value;if(t<0)u+=f.length;let p=e+u*t;for(let m=t>0?0:f.length-1,O=t>0?f.length:-1;m!=O;m+=t){let v=o.indexOf(f[m]);if(v<0||s.resolveInner(p+m,1).type!=r)continue;if(v%2==0==t>0){d++}else if(d==1){return{start:h,end:{from:p+m,to:p+m+1},matched:v>>1==l>>1}}else{d--}}if(t>0)u+=f.length}return c.done?{start:h,matched:false}:null}function pv(i,e,t,s=0,r=0){if(e==null){e=i.search(/[^\\s\\u00a0]/);if(e==-1)e=i.length}let n=r;for(let o=s;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;while(/[\\s\\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1){this.pos=t;return true}}backUp(e){this.pos-=e}column(){if(this.lastColumnPoss?o.toLowerCase():o;let n=this.string.substr(this.pos,e.length);if(r(n)==r(e)){if(t!==false)this.pos+=e.length;return true}else return null}else{let r=this.string.slice(this.pos).match(e);if(r&&r.index>0)return null;if(r&&t!==false)this.pos+=r[0].length;return r}}current(){return this.string.slice(this.start,this.pos)}}function OA(i){return{name:i.name||"",token:i.token,blankLine:i.blankLine||(()=>{}),startState:i.startState||(()=>true),copyState:i.copyState||_A,indent:i.indent||(()=>null),languageData:i.languageData||{},tokenTable:i.tokenTable||e0,mergeTokens:i.mergeTokens!==false}}function _A(i){if(typeof i!="object")return i;let e={};for(let t in i){let s=i[t];e[t]=s instanceof Array?s.slice():s}return e}const mv=new WeakMap;class Xr extends Ei{constructor(e){let t=fu(e.languageData);let s=OA(e),r;let n=new class extends uu{createParse(o,a,l){return new yA(r,o,a,l)}};super(t,n,[],e.name);this.topNode=wA(t,this);r=this;this.streamParser=s;this.stateAfter=new ue({perNode:true});this.tokenTable=e.tokenTable?new jx(s.tokenTable):SA}static define(e){return new Xr(e)}getIndent(e){let t=void 0;let{overrideIndentation:s}=e.options;if(s){t=mv.get(e.state);if(t!=null&&t1e4)return null;while(n=s&&t+e.length<=r&&e.prop(i.stateAfter);if(n)return{state:i.streamParser.copyState(n),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o];let h=a instanceof _e&&l=e.length)return e;if(!r&&t==0&&e.type==i.topNode)r=true;for(let n=e.children.length-1;n>=0;n--){let o=e.positions[n],a=e.children[n],l;if(ot&&JO(i,n.tree,0-n.offset,t,a),h;if(l&&l.pos<=s&&(h=Fx(i,n.tree,t+n.offset,l.pos+n.offset,false)))return{state:l.state,tree:h}}return{state:i.streamParser.startState(r?to(r):4),tree:_e.empty}}let yA=class MU{constructor(e,t,s,r){this.lang=e;this.input=t;this.fragments=s;this.ranges=r;this.stoppedAt=null;this.chunks=[];this.chunkPos=[];this.chunk=[];this.chunkReused=void 0;this.rangeIndex=0;this.to=r[r.length-1].to;let n=eo.get(),o=r[0].from;let{state:a,tree:l}=vA(e,s,o,this.to,n===null||n===void 0?void 0:n.state);this.state=a;this.parsedPos=this.chunkStart=o+l.length;for(let h=0;hh.from<=n.viewport.from&&h.to>=n.viewport.from)){this.state=this.lang.streamParser.startState(to(n.state));n.skipUntilInView(this.parsedPos,n.viewport.from);this.parsedPos=n.viewport.from}this.moveRangeIndex()}advance(){let e=eo.get();let t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt);let s=Math.min(t,this.chunkStart+512);if(e)s=Math.min(s,e.viewport.to);while(this.parsedPos=t)return this.finish();if(e&&this.parsedPos>=e.viewport.to){e.skipUntilInView(this.parsedPos,t);return this.finish()}return null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(!this.input.lineChunks){let s=t.indexOf("\\n");if(s>-1)t=t.slice(0,s)}else if(t=="\\n"){t=""}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),s=e+t.length;for(let r=this.rangeIndex;;){let n=this.ranges[r].to;if(n>=s)break;t=t.slice(0,n-(s-t.length));r++;if(r==this.ranges.length)break;let o=this.ranges[r].from;let a=this.lineAfter(o);t+=a;s=o+a.length}return{line:t,end:s}}skipGapsTo(e,t,s){for(;;){let r=this.ranges[this.rangeIndex].to,n=e+t;if(s>0?r>n:r>=n)break;let o=this.ranges[++this.rangeIndex].from;t+=o-r}return t}moveRangeIndex(){while(this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1);t+=r;let a=this.chunk.length;r=this.skipGapsTo(s,r,-1);s+=r;n+=this.chunk.length-a}let o=this.chunk.length-4;if(this.lang.streamParser.mergeTokens&&n==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t)this.chunk[o+2]=s;else this.chunk.push(e,t,s,n);return r}parseLine(e){let{line:t,end:s}=this.nextLine(),r=0,{streamParser:n}=this.lang;let o=new Nx(t,e?e.state.tabSize:4,e?to(e.state):2);if(o.eol()){n.blankLine(this.state,o.indentUnit)}else{while(!o.eol()){let a=Zx(n.token,o,this.state);if(a)r=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,r);if(o.start>1e4)break}}this.parsedPos=s;this.moveRangeIndex();if(this.parsedPose.start)return r}throw new Error("Stream parser failed to advance stream.")}const e0=Object.create(null);const Fl=[pt.none];const bA=new ga(Fl);const gv=[];const Ov=Object.create(null);const Ux=Object.create(null);for(let[i,e]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"]])Ux[i]=Hx(e0,e);class jx{constructor(e){this.extra=e;this.table=Object.assign(Object.create(null),Ux)}resolve(e){return!e?0:this.table[e]||(this.table[e]=Hx(this.extra,e))}}const SA=new jx(e0);function kf(i,e){if(gv.indexOf(i)>-1)return;gv.push(i);console.warn(e)}function Hx(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let h of a.split(".")){let c=i[h]||P[h];if(!c){kf(h,\`Unknown highlighting tag \${h}\`)}else if(typeof c=="function"){if(!l.length)kf(h,\`Modifier \${h} used at start of tag\`);else l=l.map(c)}else{if(l.length)kf(h,\`Tag \${h} used as modifier\`);else l=Array.isArray(c)?c:[c]}}for(let h of l)t.push(h)}if(!t.length)return 0;let s=e.replace(/ /g,"_"),r=s+" "+t.map(a=>a.id);let n=Ov[r];if(n)return n.id;let o=Ov[r]=pt.define({id:Fl.length,name:s,props:[Sr({[s]:t})]});Fl.push(o);return o.id}function wA(i,e){let t=pt.define({id:Fl.length,name:"Document",props:[Gr.add(()=>i),wr.add(()=>s=>e.getIndent(s))],top:true});Fl.push(t);return t}({rtl:fe.mark({class:"cm-iso",inclusive:true,attributes:{dir:"rtl"},bidiIsolate:Ue.RTL}),ltr:fe.mark({class:"cm-iso",inclusive:true,attributes:{dir:"ltr"},bidiIsolate:Ue.LTR})});const xA=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),s=i0(i.state,t.from);return s.line?kA(i):s.block?TA(i):false};function t0(i,e){return({state:t,dispatch:s})=>{if(t.readOnly)return false;let r=i(e,t);if(!r)return false;s(t.update(r));return true}}const kA=t0(EA,0);const CA=t0(Vx,0);const TA=t0((i,e)=>Vx(i,e,$A(e)),0);function i0(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ma=50;function PA(i,{open:e,close:t},s,r){let n=i.sliceDoc(s-Ma,s);let o=i.sliceDoc(r,r+Ma);let a=/\\s*$/.exec(n)[0].length,l=/^\\s*/.exec(o)[0].length;let h=n.length-a;if(n.slice(h-e.length,h)==e&&o.slice(l,l+t.length)==t){return{open:{pos:s-a,margin:a&&1},close:{pos:r+l,margin:l&&1}}}let c,d;if(r-s<=2*Ma){c=d=i.sliceDoc(s,r)}else{c=i.sliceDoc(s,s+Ma);d=i.sliceDoc(r-Ma,r)}let u=/^\\s*/.exec(c)[0].length,f=/\\s*$/.exec(d)[0].length;let p=d.length-f-t.length;if(c.slice(u,u+e.length)==e&&d.slice(p,p+t.length)==t){return{open:{pos:s+u+e.length,margin:/\\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-f-t.length,margin:/\\s/.test(d.charAt(p-1))?1:0}}}return null}function $A(i){let e=[];for(let t of i.selection.ranges){let s=i.doc.lineAt(t.from);let r=t.to<=s.to?s:i.doc.lineAt(t.to);if(r.from>s.from&&r.from==t.to)r=t.to==s.to+1?s:i.doc.lineAt(t.to-1);let n=e.length-1;if(n>=0&&e[n].to>s.from)e[n].to=r.to;else e.push({from:s.from+/^\\s*/.exec(s.text)[0].length,to:r.to})}return e}function Vx(i,e,t=e.selection.ranges){let s=t.map(n=>i0(e,n.from).block);if(!s.every(n=>n))return null;let r=t.map((n,o)=>PA(e,s[o],n.from,n.to));if(i!=2&&!r.every(n=>n)){return{changes:e.changes(t.map((n,o)=>{if(r[o])return[];return[{from:n.from,insert:s[o].open+" "},{from:n.to,insert:" "+s[o].close}]}))}}else if(i!=1&&r.some(n=>n)){let n=[];for(let o=0,a;or&&(n==o||o>d.from)){r=d.from;let u=/^\\s*/.exec(d.text)[0].length;let f=u==d.length;let p=d.text.slice(u,u+h.length)==h?u:-1;if(un.comment<0&&(!n.empty||n.single))){let n=[];for(let{line:a,token:l,indent:h,empty:c,single:d}of s)if(d||!c)n.push({from:a.from+h,insert:l+" "});let o=e.changes(n);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&s.some(n=>n.comment>=0)){let n=[];for(let{line:o,comment:a,token:l}of s)if(a>=0){let h=o.from+a,c=h+l.length;if(o.text[c-o.from]==" ")c++;n.push({from:h,to:c})}return{changes:n}}return null}const Um=br.define();const QA=br.define();const RA=te.define();const Yx=te.define({combine(i){return co(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(s,r)=>e(s,r)||t(s,r)})}});const Gx=ji.define({create(){return Bs.empty},update(i,e){let t=e.state.facet(Yx);let s=e.annotation(Um);if(s){let l=_i.fromTransaction(e,s.selection),h=s.side;let c=h==0?i.undone:i.done;if(l)c=Td(c,c.length,t.minDepth,l);else c=ek(c,e.startState.selection);return new Bs(h==0?s.rest:c,h==0?c:s.rest)}let r=e.annotation(QA);if(r=="full"||r=="before")i=i.isolate();if(e.annotation(ut.addToHistory)===false)return!e.changes.empty?i.addMapping(e.changes.desc):i;let n=_i.fromTransaction(e);let o=e.annotation(ut.time),a=e.annotation(ut.userEvent);if(n)i=i.addChanges(n,o,a,t,e);else if(e.selection)i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay);if(r=="full"||r=="after")i=i.isolate();return i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Bs(i.done.map(_i.fromJSON),i.undone.map(_i.fromJSON))}});function AA(i={}){return[Gx,Yx.of(i),J.domEventHandlers({beforeinput(e,t){let s=e.inputType=="historyUndo"?Kx:e.inputType=="historyRedo"?jm:null;if(!s)return false;e.preventDefault();return s(t)}})]}function gu(i,e){return function({state:t,dispatch:s}){if(!e&&t.readOnly)return false;let r=t.field(Gx,false);if(!r)return false;let n=r.pop(i,t,e);if(!n)return false;s(n);return true}}const Kx=gu(0,false);const jm=gu(1,false);const LA=gu(0,true);const MA=gu(1,true);class _i{constructor(e,t,s,r,n){this.changes=e;this.effects=t;this.mapped=s;this.startSelection=r;this.selectionsAfter=n}setSelAfter(e){return new _i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,s;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new _i(e.changes&&_t.fromJSON(e.changes),[],e.mapped&&zs.fromJSON(e.mapped),e.startSelection&&z.fromJSON(e.startSelection),e.selectionsAfter.map(z.fromJSON))}static fromTransaction(e,t){let s=Fi;for(let r of e.startState.facet(RA)){let n=r(e);if(n.length)s=s.concat(n)}if(!s.length&&e.changes.empty)return null;return new _i(e.changes.invert(e.startState.doc),s,void 0,t||e.startState.selection,Fi)}static selection(e){return new _i(void 0,Fi,void 0,void 0,e)}}function Td(i,e,t,s){let r=e+1>t+20?e-t-1:0;let n=i.slice(r,e);n.push(s);return n}function BA(i,e){let t=[],s=false;i.iterChangedRanges((r,n)=>t.push(r,n));e.iterChangedRanges((r,n,o,a)=>{for(let l=0;l=h&&o<=c)s=true}});return s}function IA(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,s)=>t.empty!=e.ranges[s].empty).length===0}function Jx(i,e){return!i.length?e:!e.length?i:i.concat(e)}const Fi=[];const DA=200;function ek(i,e){if(!i.length){return[_i.selection([e])]}else{let t=i[i.length-1];let s=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-DA));if(s.length&&s[s.length-1].eq(e))return i;s.push(e);return Td(i,i.length-1,1e9,t.setSelAfter(s))}}function zA(i){let e=i[i.length-1];let t=i.slice();t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1));return t}function Cf(i,e){if(!i.length)return i;let t=i.length,s=Fi;while(t){let r=WA(i[t-1],e,s);if(r.changes&&!r.changes.empty||r.effects.length){let n=i.slice(0,t);n[t-1]=r;return n}else{e=r.mapped;t--;s=r.selectionsAfter}}return s.length?[_i.selection(s)]:Fi}function WA(i,e,t){let s=Jx(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):Fi,t);if(!i.changes)return _i.selection(s);let r=i.changes.map(e),n=e.mapDesc(i.changes,true);let o=i.mapped?i.mapped.composeDesc(n):n;return new _i(r,Te.mapEffects(i.effects,e),o,i.startSelection.map(n),s)}const qA=/^(input\\.type|delete)($|\\.)/;class Bs{constructor(e,t,s=0,r=void 0){this.done=e;this.undone=t;this.prevTime=s;this.prevUserEvent=r}isolate(){return this.prevTime?new Bs(this.done,this.undone):this}addChanges(e,t,s,r,n){let o=this.done,a=o[o.length-1];if(a&&a.changes&&!a.changes.empty&&e.changes&&(!s||qA.test(s))&&(!a.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?i.moveByChar(t,e):Ou(t,e))}function Jt(i){return i.textDirectionAt(i.state.selection.main.head)==Ue.LTR}const ik=i=>tk(i,!Jt(i));const sk=i=>tk(i,Jt(i));function rk(i,e){return ls(i,t=>t.empty?i.moveByGroup(t,e):Ou(t,e))}const NA=i=>rk(i,!Jt(i));const FA=i=>rk(i,Jt(i));function ZA(i,e,t){if(e.type.prop(t))return true;let s=e.to-e.from;return s&&(s>2||/[^\\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function _u(i,e,t){let s=We(i).resolveInner(e.head);let r=t?ue.closedBy:ue.openedBy;for(let l=e.head;;){let h=t?s.childAfter(l):s.childBefore(l);if(!h)break;if(ZA(i,h,r))s=h;else l=t?h.to:h.from}let n=s.type.prop(r),o,a;if(n&&(o=t?Ms(i,s.from,1):Ms(i,s.to,-1))&&o.matched)a=t?o.end.to:o.end.from;else a=t?s.to:s.from;return z.cursor(a,t?-1:1)}const UA=i=>ls(i,e=>_u(i.state,e,!Jt(i)));const jA=i=>ls(i,e=>_u(i.state,e,Jt(i)));function nk(i,e){return ls(i,t=>{if(!t.empty)return Ou(t,e);let s=i.moveVertically(t,e);return s.head!=t.head?s:i.moveToLineBoundary(t,e)})}const ok=i=>nk(i,false);const ak=i=>nk(i,true);function lk(i){let e=i.scrollDOM.clientHeight{return o.empty?i.moveVertically(o,e,t.height):Ou(o,e)});if(r.eq(s.selection))return false;let n;if(t.selfScroll){let o=i.coordsAtPos(s.selection.main.head);let a=i.scrollDOM.getBoundingClientRect();let l=a.top+t.marginTop,h=a.bottom-t.marginBottom;if(o&&o.top>l&&o.bottomhk(i,false);const Hm=i=>hk(i,true);function _n(i,e,t){let s=i.lineBlockAt(e.head),r=i.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?s.to:s.from))r=i.moveToLineBoundary(e,t,false);if(!t&&r.head==s.from&&s.length){let n=/^\\s*/.exec(i.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;if(n&&e.head!=s.from+n)r=z.cursor(s.from+n)}return r}const HA=i=>ls(i,e=>_n(i,e,true));const VA=i=>ls(i,e=>_n(i,e,false));const YA=i=>ls(i,e=>_n(i,e,!Jt(i)));const GA=i=>ls(i,e=>_n(i,e,Jt(i)));const KA=i=>ls(i,e=>z.cursor(i.lineBlockAt(e.head).from,1));const JA=i=>ls(i,e=>z.cursor(i.lineBlockAt(e.head).to,-1));function e8(i,e,t){let s=false,r=Oa(i.selection,n=>{let o=Ms(i,n.head,-1)||Ms(i,n.head,1)||n.head>0&&Ms(i,n.head-1,1)||n.heade8(i,e);function Hi(i,e,t){let s=Oa(i.state.selection,r=>{if(r.undirectional&&r.head>=r.anchor!=e)r=z.range(r.head,r.anchor);let n=t(r);return z.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});if(s.eq(i.state.selection))return false;i.dispatch(as(i.state,s));return true}function ck(i,e){return Hi(i,e,t=>i.moveByChar(t,e))}const dk=i=>ck(i,!Jt(i));const uk=i=>ck(i,Jt(i));function fk(i,e){return Hi(i,e,t=>i.moveByGroup(t,e))}const i8=i=>fk(i,!Jt(i));const s8=i=>fk(i,Jt(i));const r8=i=>{let e=!Jt(i);return Hi(i,e,t=>_u(i.state,t,e))};const n8=i=>{let e=Jt(i);return Hi(i,e,t=>_u(i.state,t,e))};function pk(i,e){return Hi(i,e,t=>i.moveVertically(t,e))}const mk=i=>pk(i,false);const gk=i=>pk(i,true);function Ok(i,e){return Hi(i,e,t=>i.moveVertically(t,e,lk(i).height))}const vv=i=>Ok(i,false);const yv=i=>Ok(i,true);const o8=i=>Hi(i,true,e=>_n(i,e,true));const a8=i=>Hi(i,false,e=>_n(i,e,false));const l8=i=>{let e=!Jt(i);return Hi(i,e,t=>_n(i,t,e))};const h8=i=>{let e=Jt(i);return Hi(i,e,t=>_n(i,t,e))};const c8=i=>Hi(i,false,e=>z.cursor(i.lineBlockAt(e.head).from));const d8=i=>Hi(i,true,e=>z.cursor(i.lineBlockAt(e.head).to));const bv=({state:i,dispatch:e})=>{e(as(i,{anchor:0}));return true};const Sv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.doc.length}));return true};const wv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.selection.main.anchor,head:0}));return true};const xv=({state:i,dispatch:e})=>{e(as(i,{anchor:i.selection.main.anchor,head:i.doc.length}));return true};const u8=({state:i,dispatch:e})=>{e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"}));return true};const f8=({state:i,dispatch:e})=>{let t=vu(i).map(({from:s,to:r})=>z.undirectionalRange(s,Math.min(r+1,i.doc.length)));e(i.update({selection:z.create(t),userEvent:"select"}));return true};const p8=({state:i,dispatch:e})=>{let t=Oa(i.selection,s=>{let r=We(i),n=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.from,-1);if(o.node.from>=n.node.from&&o.node.to<=n.node.to)n=o}for(let o=n;o;o=o.next){let{node:a}=o;if((a.from=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return z.undirectionalRange(a.from,a.to)}return s});if(t.eq(i.selection))return false;e(as(i,t));return true};function _k(i,e){let{state:t}=i,s=t.selection,r=t.selection.ranges.slice();for(let n of t.selection.ranges){let o=t.doc.lineAt(n.head);if(e?o.to0)for(let a=n;;){let l=i.moveVertically(a,e);if(l.heado.to){if(!r.some(h=>h.head==l.head))r.push(l);break}else if(l.head==a.head){break}else{a=l}}}if(r.length==s.ranges.length)return false;i.dispatch(as(t,z.create(r,r.length-1)));return true}const m8=i=>_k(i,false);const g8=i=>_k(i,true);const O8=({state:i,dispatch:e})=>{let t=i.selection,s=null;if(t.ranges.length>1)s=z.create([t.main]);else if(!t.main.empty)s=z.create([z.cursor(t.main.head)]);if(!s)return false;e(as(i,s));return true};function Oh(i,e){if(i.state.readOnly)return false;let t="delete.selection",{state:s}=i;let r=s.changeByRange(n=>{let{from:o,to:a}=n;if(o==a){let l=e(n);if(lo){t="delete.forward";l=ic(i,l,true)}o=Math.min(o,l);a=Math.max(a,l)}else{o=ic(i,o,false);a=ic(i,a,true)}return o==a?{range:n}:{changes:{from:o,to:a},range:z.cursor(o,or(i)))s.between(e,e,(r,n)=>{if(re)e=t?n:r});return e}const vk=(i,e,t)=>Oh(i,s=>{let r=s.from,{state:n}=i,o=n.doc.lineAt(r),a,l;if(t&&!e&&r>o.from&&rvk(i,false,true);const yk=i=>vk(i,true,false);const bk=(i,e)=>Oh(i,t=>{let s=t.head,{state:r}=i,n=r.doc.lineAt(s);let o=r.charCategorizer(s);for(let a=null;;){if(s==(e?n.to:n.from)){if(s==t.head&&n.number!=(e?r.doc.lines:1))s+=e?1:-1;break}let l=Rt(n.text,s-n.from,e)+n.from;let h=n.text.slice(Math.min(s,l)-n.from,Math.max(s,l)-n.from);let c=o(h);if(a!=null&&c!=a)break;if(h!=" "||s!=t.head)a=c;s=l}return s});const Sk=i=>bk(i,false);const _8=i=>bk(i,true);const v8=i=>Oh(i,e=>{let t=i.lineBlockAt(e.head).to;return e.headOh(i,e=>{let t=i.moveToLineBoundary(e,false).head;return e.head>t?t:Math.max(0,e.head-1)});const b8=i=>Oh(i,e=>{let t=i.moveToLineBoundary(e,true).head;return e.head{if(i.readOnly)return false;let t=i.changeByRange(s=>{return{changes:{from:s.from,to:s.to,insert:Pe.of(["",""])},range:z.cursor(s.from)}});e(i.update(t,{scrollIntoView:true,userEvent:"input"}));return true};const w8=({state:i,dispatch:e})=>{if(i.readOnly)return false;let t=i.changeByRange(s=>{if(!s.empty||s.from==0||s.from==i.doc.length)return{range:s};let r=s.from,n=i.doc.lineAt(r);let o=r==n.from?r-1:Rt(n.text,r-n.from,false)+n.from;let a=r==n.to?r+1:Rt(n.text,r-n.from,true)+n.from;return{changes:{from:o,to:a,insert:i.doc.slice(r,a).append(i.doc.slice(o,r))},range:z.cursor(a)}});if(t.changes.empty)return false;e(i.update(t,{scrollIntoView:true,userEvent:"move.character"}));return true};function vu(i){let e=[],t=-1;for(let s of i.selection.ranges){let r=i.doc.lineAt(s.from),n=i.doc.lineAt(s.to);if(!s.empty&&s.to==n.from)n=i.doc.lineAt(s.to-1);if(t>=r.number){let o=e[e.length-1];o.to=n.to;o.ranges.push(s)}else{e.push({from:r.from,to:n.to,ranges:[s]})}t=n.number+1}return e}function wk(i,e,t){if(i.readOnly)return false;let s=[],r=[];for(let n of vu(i)){if(t?n.to==i.doc.length:n.from==0)continue;let o=i.doc.lineAt(t?n.to+1:n.from-1);let a=o.length+1;if(t){s.push({from:n.to,to:o.to},{from:n.from,insert:o.text+i.lineBreak});for(let l of n.ranges)r.push(z.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{s.push({from:o.from,to:n.from},{from:n.to,insert:i.lineBreak+o.text});for(let l of n.ranges)r.push(z.range(l.anchor-a,l.head-a))}}if(!s.length)return false;e(i.update({changes:s,scrollIntoView:true,selection:z.create(r,i.selection.mainIndex),userEvent:"move.line"}));return true}const x8=({state:i,dispatch:e})=>wk(i,e,false);const k8=({state:i,dispatch:e})=>wk(i,e,true);function xk(i,e,t){if(i.readOnly)return false;let s=[];for(let n of vu(i)){if(t)s.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak});else s.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)})}let r=i.changes(s);e(i.update({changes:r,selection:i.selection.map(r,t?1:-1),scrollIntoView:true,userEvent:"input.copyline"}));return true}const C8=({state:i,dispatch:e})=>xk(i,e,false);const T8=({state:i,dispatch:e})=>xk(i,e,true);const P8=i=>{if(i.state.readOnly)return false;let{state:e}=i,t=e.changes(vu(e).map(({from:r,to:n})=>{if(r>0)r--;else if(n{let n=void 0;if(i.lineWrapping){let o=i.lineBlockAt(r.head),a=i.coordsAtPos(r.head,r.assoc||1);if(a)n=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2}return i.moveVertically(r,true,n)}).map(t);i.dispatch({changes:t,selection:s,scrollIntoView:true,userEvent:"delete.line"});return true};function $8(i,e){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=We(i).resolveInner(e);let s=t.childBefore(e),r=t.childAfter(e),n;if(s&&r&&s.to<=e&&r.from>=e&&(n=s.type.prop(ue.closedBy))&&n.indexOf(r.name)>-1&&i.doc.lineAt(s.to).from==i.doc.lineAt(r.from).from&&!/\\S/.test(i.sliceDoc(s.to,r.from)))return{from:s.to,to:r.from};return null}const kv=kk(false);const E8=kk(true);function kk(i){return({state:e,dispatch:t})=>{if(e.readOnly)return false;let s=e.changeByRange(r=>{let{from:n,to:o}=r,a=e.doc.lineAt(n);let l=!i&&n==o&&$8(e,n);if(i)n=o=(o<=a.to?a:e.doc.lineAt(o)).to;let h=new pu(e,{simulateBreak:n,simulateDoubleBreak:!!l});let c=YO(h,n);if(c==null)c=Fs(/^\\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize);while(oa.from&&n{let r=[];for(let o=s.from;o<=s.to;){let a=i.doc.lineAt(o);if(a.number>t&&(s.empty||s.to>a.from)){e(a,r,s);t=a.number}o=a.to+1}let n=i.changes(r);return{changes:r,range:z.range(n.mapPos(s.anchor,1),n.mapPos(s.head,1))}})}const Q8=({state:i,dispatch:e})=>{if(i.readOnly)return false;let t=Object.create(null);let s=new pu(i,{overrideIndentation:n=>{let o=t[n];return o==null?-1:o}});let r=s0(i,(n,o,a)=>{let l=YO(s,n.from);if(l==null)return;if(!/\\S/.test(n.text))l=0;let h=/^\\s*/.exec(n.text)[0];let c=Nl(i,l);if(h!=c||a.from{if(i.readOnly)return false;e(i.update(s0(i,(t,s)=>{s.push({from:t.from,insert:i.facet(ph)})}),{userEvent:"input.indent"}));return true};const Tk=({state:i,dispatch:e})=>{if(i.readOnly)return false;e(i.update(s0(i,(t,s)=>{let r=/^\\s*/.exec(t.text)[0];if(!r)return;let n=Fs(r,i.tabSize),o=0;let a=Nl(i,Math.max(0,n-to(i)));while(o{i.setTabFocusMode();return true};const A8=[{key:"Ctrl-b",run:ik,shift:dk,preventDefault:true},{key:"Ctrl-f",run:sk,shift:uk},{key:"Ctrl-p",run:ok,shift:mk},{key:"Ctrl-n",run:ak,shift:gk},{key:"Ctrl-a",run:KA,shift:c8},{key:"Ctrl-e",run:JA,shift:d8},{key:"Ctrl-d",run:yk},{key:"Ctrl-h",run:Vm},{key:"Ctrl-k",run:v8},{key:"Ctrl-Alt-h",run:Sk},{key:"Ctrl-o",run:S8},{key:"Ctrl-t",run:w8},{key:"Ctrl-v",run:Hm}];const L8=[{key:"ArrowLeft",run:ik,shift:dk,preventDefault:true},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:NA,shift:i8,preventDefault:true},{mac:"Cmd-ArrowLeft",run:YA,shift:l8,preventDefault:true},{key:"ArrowRight",run:sk,shift:uk,preventDefault:true},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:FA,shift:s8,preventDefault:true},{mac:"Cmd-ArrowRight",run:GA,shift:h8,preventDefault:true},{key:"ArrowUp",run:ok,shift:mk,preventDefault:true},{mac:"Cmd-ArrowUp",run:bv,shift:wv},{mac:"Ctrl-ArrowUp",run:_v,shift:vv},{key:"ArrowDown",run:ak,shift:gk,preventDefault:true},{mac:"Cmd-ArrowDown",run:Sv,shift:xv},{mac:"Ctrl-ArrowDown",run:Hm,shift:yv},{key:"PageUp",run:_v,shift:vv},{key:"PageDown",run:Hm,shift:yv},{key:"Home",run:VA,shift:a8,preventDefault:true},{key:"Mod-Home",run:bv,shift:wv},{key:"End",run:HA,shift:o8,preventDefault:true},{key:"Mod-End",run:Sv,shift:xv},{key:"Enter",run:kv,shift:kv},{key:"Mod-a",run:u8},{key:"Backspace",run:Vm,shift:Vm,preventDefault:true},{key:"Delete",run:yk,preventDefault:true},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Sk,preventDefault:true},{key:"Mod-Delete",mac:"Alt-Delete",run:_8,preventDefault:true},{mac:"Mod-Backspace",run:y8,preventDefault:true},{mac:"Mod-Delete",run:b8,preventDefault:true}].concat(A8.map(i=>({mac:i.key,run:i.run,shift:i.shift})));const M8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:UA,shift:r8},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:jA,shift:n8},{key:"Alt-ArrowUp",run:x8},{key:"Shift-Alt-ArrowUp",run:C8},{key:"Alt-ArrowDown",run:k8},{key:"Shift-Alt-ArrowDown",run:T8},{key:"Mod-Alt-ArrowUp",run:m8},{key:"Mod-Alt-ArrowDown",run:g8},{key:"Escape",run:O8},{key:"Mod-Enter",run:E8},{key:"Alt-l",mac:"Ctrl-l",run:f8},{key:"Mod-i",run:p8,preventDefault:true},{key:"Mod-[",run:Tk},{key:"Mod-]",run:Ck},{key:"Mod-Alt-\\\\",run:Q8},{key:"Shift-Mod-k",run:P8},{key:"Shift-Mod-\\\\",run:t8},{key:"Mod-/",run:xA},{key:"Alt-A",mac:"Ctrl-A",run:CA},{key:"Ctrl-m",mac:"Shift-Alt-m",run:R8}].concat(L8);const B8={key:"Tab",run:Ck,shift:Tk};var Cv={};class Pd{constructor(e,t,s,r,n,o,a,l,h,c=0,d){this.p=e;this.stack=t;this.state=s;this.reducePos=r;this.pos=n;this.score=o;this.buffer=a;this.bufferBase=l;this.curContext=h;this.lookAhead=c;this.parent=d}toString(){return\`[\${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@\${this.pos}\${this.score?"!"+this.score:""}\`}static start(e,t,s=0){let r=e.parser.context;return new Pd(e,[],t,s,s,0,[],0,r?new Tv(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length);this.state=e}reduce(e){var t;let s=e>>19,r=e&65535;let{parser:n}=this.p;let o=this.reducePos=2e3&&!((t=this.p.parser.nodeSet.types[r])===null||t===void 0?void 0:t.isAnonymous)){if(h==this.p.lastBigReductionStart){this.p.bigReductionCount++;this.p.lastBigReductionSize=c}else if(this.p.lastBigReductionSizel)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,s,r=4,n=false){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==s)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=s;return}}}if(!n||this.pos==s){this.buffer.push(e,t,s,r)}else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=false;for(let l=o;l>0&&this.buffer[l-2]>s;l-=4){if(this.buffer[l-1]>=0){a=true;break}}if(a)while(o>0&&this.buffer[o-2]>s){this.buffer[o]=this.buffer[o-4];this.buffer[o+1]=this.buffer[o-3];this.buffer[o+2]=this.buffer[o-2];this.buffer[o+3]=this.buffer[o-1];o-=4;if(r>4)r-=4}}this.buffer[o]=e;this.buffer[o+1]=t;this.buffer[o+2]=s;this.buffer[o+3]=r}}shift(e,t,s,r){if(e&131072){this.pushState(e&65535,this.pos)}else if((e&262144)==0){let n=e,{parser:o}=this.p;this.pos=r;let a=o.stateFlag(n,1);if(!a&&(r>s||t<=o.maxNode))this.reducePos=r;this.pushState(n,a?s:Math.min(s,this.reducePos));this.shiftContext(t,s);if(t<=o.maxNode)this.buffer.push(t,s,r,4)}else{this.pos=r;this.shiftContext(t,s);if(t<=this.p.parser.maxNode)this.buffer.push(t,s,r,4)}}apply(e,t,s,r){if(e&65536)this.reduce(e);else this.shift(e,t,s,r)}useNode(e,t){let s=this.p.reused.length-1;if(s<0||this.p.reused[s]!=e){this.p.reused.push(e);s++}let r=this.pos;this.reducePos=this.pos=r+e.length;this.pushState(t,r);this.buffer.push(s,r,this.reducePos,-1);if(this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this;let t=e.buffer.length;if(t&&e.buffer[t-4]==0)t-=4;while(t>0&&e.buffer[t-2]>e.reducePos)t-=4;let s=e.buffer.slice(t),r=e.bufferBase+t;while(e&&r==e.bufferBase)e=e.parent;return new Pd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let s=e<=this.p.parser.maxNode;if(s)this.storeNode(e,this.pos,t,4);this.storeNode(0,this.pos,t,s?8:4);this.pos=this.reducePos=t;this.score-=190}canShift(e){for(let t=new I8(this);;){let s=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(s==0)return false;if((s&65536)==0)return true;t.reduce(s)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let r=[];for(let n=0,o;nl&1&&a==o))r.push(t[n],o)}t=r}let s=[];for(let r=0;r>19,r=t&65535;let n=this.stack.length-s*3;if(n<0||e.getGoto(this.stack[n],r,false)<0){let o=this.findForcedReduction();if(o==null)return false;t=o}this.storeNode(0,this.pos,this.pos,4,true);this.score-=100}this.reducePos=this.pos;this.reduce(t);return true}findForcedReduction(){let{parser:e}=this.p,t=[];let s=(r,n)=>{if(t.includes(r))return;t.push(r);return e.allActions(r,o=>{if(o&(262144|131072));else if(o&65536){let a=(o>>19)-n;if(a>1){let l=o&65535,h=this.stack.length-a*3;if(h>=0&&e.getGoto(this.stack[h],l,false)>=0)return a<<19|65536|l}}else{let a=s(o,n+1);if(a!=null)return a}})};return s(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2)){if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,true);break}}return this}get deadEnd(){if(this.stack.length!=3)return false;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,true);this.state=this.stack[0];this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return false;for(let t=0;t0)this.emitLookAhead()}}class Tv{constructor(e,t){this.tracker=e;this.context=t;this.hash=e.strict?e.hash(t):0}}class I8{constructor(e){this.start=e;this.state=e.state;this.stack=e.stack;this.base=this.stack.length}reduce(e){let t=e&65535,s=e>>19;if(s==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0);this.base+=3}else{this.base-=(s-1)*3}let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,true);this.state=r}}class $d{constructor(e,t,s){this.stack=e;this.pos=t;this.index=s;this.buffer=e.buffer;if(this.index==0)this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new $d(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;if(e!=null){this.index=this.stack.bufferBase-e.bufferBase;this.stack=e;this.buffer=e.buffer}}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4;this.pos-=4;if(this.index==0)this.maybeNext()}fork(){return new $d(this.stack,this.pos,this.index)}}function sl(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let s=0,r=0;s=92)o--;if(o>=34)o--;let l=o-32;if(l>=46){l-=46;a=true}n+=l;if(a)break;n*=46}if(t)t[r++]=n;else t=new e(n)}return t}class Bc{constructor(){this.start=-1;this.value=-1;this.end=-1;this.extended=-1;this.lookAhead=0;this.mask=0;this.context=0}}const Pv=new Bc;class D8{constructor(e,t){this.input=e;this.ranges=t;this.chunk="";this.chunkOff=0;this.chunk2="";this.chunk2Pos=0;this.next=-1;this.token=Pv;this.rangeIndex=0;this.pos=this.chunkPos=t[0].from;this.range=t[0];this.end=t[t.length-1].to;this.readNext()}resolveOffset(e,t){let s=this.range,r=this.rangeIndex;let n=this.pos+e;while(ns.to:n>=s.to){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];n+=o.from-s.to;s=o}return n}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,s,r;if(t>=0&&t=this.chunk2Pos&&sa.to)this.chunk2=this.chunk2.slice(0,a.to-s);r=this.chunk2.charCodeAt(0)}}if(s>=this.token.lookAhead)this.token.lookAhead=s+1;return r}acceptToken(e,t=0){let s=t?this.resolveOffset(t,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e;this.chunkPos=this.pos;this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){this.getChunk();if(this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){this.chunkOff+=e;while(this.pos+e>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos;this.range=this.ranges[++this.rangeIndex];this.pos=this.range.from}this.pos+=e;if(this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){this.pos=this.chunkPos=this.end;this.range=this.ranges[this.rangeIndex=this.ranges.length-1];this.chunk="";return this.next=-1}reset(e,t){if(t){this.token=t;t.start=e;t.lookAhead=e+1;t.value=t.extended=-1}else{this.token=Pv}if(this.pos!=e){this.pos=e;if(e==this.end){this.setDone();return this}while(e=this.range.to)this.range=this.ranges[++this.rangeIndex];if(e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let s="";for(let r of this.ranges){if(r.from>=t)break;if(r.to>e)s+=this.input.read(Math.max(r.from,e),Math.min(r.to,t))}return s}}class Yo{constructor(e,t){this.data=e;this.id=t}token(e,t){let{parser:s}=t.p;Pk(this.data,e,t,this.id,s.data,s.tokenPrecTable)}}Yo.prototype.contextual=Yo.prototype.fallback=Yo.prototype.extend=false;class Ed{constructor(e,t,s){this.precTable=t;this.elseToken=s;this.data=typeof e=="string"?sl(e):e}token(e,t){let s=e.pos,r=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);Pk(this.data,e,t,0,this.data,this.precTable);if(e.token.value>-1)break;if(this.elseToken==null)return;if(!n)r++;if(o==null)break;e.reset(o,e.token)}if(r){e.reset(s,e.token);e.acceptToken(this.elseToken,r)}}}Ed.prototype.contextual=Yo.prototype.fallback=Yo.prototype.extend=false;class at{constructor(e,t={}){this.token=e;this.contextual=!!t.contextual;this.fallback=!!t.fallback;this.extend=!!t.extend}}function Pk(i,e,t,s,r,n){let o=0,a=1<0){let p=i[f];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||z8(p,e.token.value,r,n))){e.acceptToken(p);break}}let c=e.next,d=0,u=i[o+2];if(e.next<0&&u>d&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue e}for(;d>1;let p=h+f+(f<<1);let m=i[p],O=i[p+1]||65536;if(c=O)d=f+1;else{o=i[p+2];e.advance();continue e}}break}}function $v(i,e,t){for(let s=e,r;(r=i[s])!=65535;s++)if(r==t)return s-e;return-1}function z8(i,e,t,s){let r=$v(t,s,e);return r<0||$v(t,s,i)e)&&!s.type.isError)return t<0?Math.max(0,Math.min(s.to-1,e-25)):Math.min(i.length,Math.max(s.from+1,e+25));if(t<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return t<0?0:i.length}}}let W8=class BU{constructor(e,t){this.fragments=e;this.nodeSet=t;this.i=0;this.fragment=null;this.safeFrom=-1;this.safeTo=-1;this.trees=[];this.start=[];this.index=[];this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){this.safeFrom=e.openStart?Ev(e.tree,e.from+e.offset,1)-e.offset:e.from;this.safeTo=e.openEnd?Ev(e.tree,e.to+e.offset,-1)-e.offset:e.to;while(this.trees.length){this.trees.pop();this.start.pop();this.index.pop()}this.trees.push(e.tree);this.start.push(-e.offset);this.index.push(0);this.nextStart=this.safeFrom}else{this.nextStart=1e9}}nodeAt(e){if(ee){this.nextStart=o;return null}if(n instanceof _e){if(o==e){if(o=Math.max(this.safeFrom,e)){this.trees.push(n);this.start.push(o);this.index.push(0)}}else{this.index[t]++;this.nextStart=o+n.length}}}};class q8{constructor(e,t){this.stream=t;this.tokens=[];this.mainToken=null;this.actions=[];this.tokens=e.tokenizers.map(s=>new Bc)}getActions(e){let t=0;let s=null;let{parser:r}=e.p,{tokenizers:n}=r;let o=r.stateSlot(e.state,3);let a=e.curContext?e.curContext.hash:0;let l=0;for(let h=0;hd.end+25)l=Math.max(d.lookAhead,l);if(d.value!=0){let u=t;if(d.extended>-1)t=this.addActions(e,d.extended,d.end,t);t=this.addActions(e,d.value,d.end,t);if(!c.extend){s=d;if(t>u)break}}}while(this.actions.length>t)this.actions.pop();if(l)e.setLookAhead(l);if(!s&&e.pos==this.stream.end){s=new Bc;s.value=e.p.parser.eofTerm;s.start=s.end=e.pos;t=this.addActions(e,s.value,s.end,t)}this.mainToken=s;return this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Bc,{pos:s,p:r}=e;t.start=s;t.end=Math.min(s+1,r.stream.end);t.value=s==r.stream.end?r.parser.eofTerm:0;return t}updateCachedToken(e,t,s){let r=this.stream.clipPos(s.pos);t.token(this.stream.reset(r,e),s);if(e.value>-1){let{parser:n}=s.p;for(let o=0;o=0&&s.p.parser.dialect.allows(a>>1)){if((a&1)==0)e.value=a>>1;else e.extended=a>>1;break}}}else{e.value=0;e.end=this.stream.clipPos(r+1)}}putAction(e,t,s,r){for(let n=0;ne.bufferLength*4?new W8(s,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos;let s=this.stacks=[];let r,n;if(this.bigReductionCount>300&&e.length==1){let[o]=e;while(o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart){}this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot){s.push(a)}else if(this.advanceStack(a,s,e)){continue}else{if(!r){r=[];n=[]}r.push(a);let l=this.tokens.getMainToken(a);n.push(l.value,l.end)}break}}if(!s.length){let o=r&&F8(r);if(o){if(yi)console.log("Finish with "+this.stackID(o));return this.stackToTree(o)}if(this.parser.strict){if(yi&&r)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw new SyntaxError("No parse at "+t)}if(!this.recovering)this.recovering=5}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,n,s);if(o){if(yi)console.log("Force-finish "+this.stackID(o));return this.stackToTree(o.forceAll())}}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(s.length>o){s.sort((a,l)=>l.score-a.score);while(s.length>o)s.pop()}if(s.some(a=>a.reducePos>t))this.recovering--}else if(s.length>1){e:for(let o=0;o500&&h.buffer.length>500){if((a.score-h.score||a.buffer.length-h.buffer.length)>0){s.splice(l--,1)}else{s.splice(o--,1);continue e}}}}if(s.length>12){s.sort((o,a)=>a.score-o.score);s.splice(12,s.length-12)}}this.minStackPos=s[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let u=this.parser.nodeSet.types[d.type.id]==d.type?n.getGoto(e.state,d.type.id):-1;if(u>-1&&d.length&&(!h||(d.prop(ue.contextHash)||0)==c)){e.useNode(d,u);if(yi)console.log(o+this.stackID(e)+\` (via reuse of \${n.getName(d.type.id)})\`);return true}if(!(d instanceof _e)||d.children.length==0||d.positions[0]>0)break;let f=d.children[0];if(f instanceof _e&&d.positions[0]==0)d=f;else break}}let a=n.stateSlot(e.state,4);if(a>0){e.reduce(a);if(yi)console.log(o+this.stackID(e)+\` (via always-reduce \${n.getName(a&65535)})\`);return true}if(e.stack.length>=8400){while(e.stack.length>6e3&&e.forceReduce()){}}let l=this.tokens.getActions(e);for(let h=0;hr)t.push(p);else s.push(p)}return false}advanceFully(e,t){let s=e.pos;for(;;){if(!this.advanceStack(e,null,null))return false;if(e.pos>s){Qv(e,t);return true}}}runRecovery(e,t,s){let r=null,n=false;for(let o=0;o ":"";if(a.deadEnd){if(n)continue;n=true;a.restart();if(yi)console.log(c+this.stackID(a)+" (restarted)");let f=this.advanceFully(a,s);if(f)continue}let d=a.split(),u=c;for(let f=0;f<10&&d.forceReduce();f++){if(yi)console.log(u+this.stackID(d)+" (via force-reduce)");let p=this.advanceFully(d,s);if(p)break;if(yi)u=this.stackID(d)+" -> "}for(let f of a.recoverByInsert(l)){if(yi)console.log(c+this.stackID(f)+" (via recover-insert)");this.advanceFully(f,s)}if(this.stream.end>a.pos){if(h==a.pos){h++;l=0}a.recoverByDelete(l,h);if(yi)console.log(c+this.stackID(a)+\` (via recover-delete \${this.parser.getName(l)})\`);Qv(a,s)}else if(!r||r.scorei;class yu{constructor(e){this.start=e.start;this.shift=e.shift||Pf;this.reduce=e.reduce||Pf;this.reuse=e.reuse||Pf;this.hash=e.hash||(()=>0);this.strict=e.strict!==false}}class vr extends uu{constructor(e){super();this.wrappers=[];if(e.version!=14)throw new RangeError(\`Parser version (\${e.version}) doesn't match runtime version (\${14})\`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;ae.topRules[a][1]);let r=[];for(let a=0;a=0){n(c,l,a[h++])}else{let d=a[h+-c];for(let u=-c;u>0;u--)n(a[h++],l,d);h++}}}this.nodeSet=new ga(t.map((a,l)=>pt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:s.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1})));if(e.propSources)this.nodeSet=this.nodeSet.extend(...e.propSources);this.strict=false;this.bufferLength=yx;let o=sl(e.tokenData);this.context=e.context;this.specializerSpecs=e.specialized||[];this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new Yo(o,a):a);this.topRules=e.topRules;this.dialects=e.dialects||{};this.dynamicPrecedences=e.dynamicPrecedences||null;this.tokenPrecTable=e.tokenPrec;this.termNames=e.termNames||null;this.maxNode=this.nodeSet.types.length-1;this.dialect=this.parseDialect();this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,s){let r=new X8(this,e,t,s);for(let n of this.wrappers)r=n(r,e,t,s);return r}getGoto(e,t,s=false){let r=this.goto;if(t>=r[0])return-1;for(let n=r[t+1];;){let o=r[n++],a=o&1;let l=r[n++];if(a&&s)return l;for(let h=n+(o>>1);n0}validAction(e,t){return!!this.allActions(e,s=>s==t?true:null)}allActions(e,t){let s=this.stateSlot(e,4);let r=s?t(s):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=hr(this.data,n+2);else break}r=t(hr(this.data,n+1))}return r}nextStates(e){let t=[];for(let s=this.stateSlot(e,1);;s+=3){if(this.data[s]==65535){if(this.data[s+1]==1)s=hr(this.data,s+2);else break}if((this.data[s+2]&65536>>16)==0){let r=this.data[s+1];if(!t.some((n,o)=>o&1&&n==r))t.push(this.data[s],r)}}return t}configure(e){let t=Object.assign(Object.create(vr.prototype),this);if(e.props)t.nodeSet=this.nodeSet.extend(...e.props);if(e.top){let s=this.topRules[e.top];if(!s)throw new RangeError(\`Invalid top rule name \${e.top}\`);t.top=s}if(e.tokenizers)t.tokenizers=this.tokenizers.map(s=>{let r=e.tokenizers.find(n=>n.from==s);return r?r.to:s});if(e.specializers){t.specializers=this.specializers.slice();t.specializerSpecs=this.specializerSpecs.map((s,r)=>{let n=e.specializers.find(a=>a.from==s.external);if(!n)return s;let o=Object.assign(Object.assign({},s),{external:n.to});t.specializers[r]=Rv(o);return o})}if(e.contextTracker)t.context=e.contextTracker;if(e.dialect)t.dialect=this.parseDialect(e.dialect);if(e.strict!=null)t.strict=e.strict;if(e.wrap)t.wrappers=t.wrappers.concat(e.wrap);if(e.bufferLength!=null)t.bufferLength=e.bufferLength;return t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),s=t.map(()=>false);if(e)for(let n of e.split(" ")){let o=t.indexOf(n);if(o>=0)s[o]=true}let r=null;for(let n=0;ns)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,s)<<1|e}return i.get}const Z8=148;const Av=1;const U8=149;const j8=150;const $k=2;const H8=151;const V8=3;const Y8=4;const Ek=[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];const G8=58;const K8=40;const Qk=95;const J8=91;const Ic=45;const e7=46;const t7=35;const i7=37;const s7=38;const r7=92;const n7=10;const o7=42;function Zl(i){return i>=65&&i<=90||i>=97&&i<=122||i>=161}function r0(i){return i>=48&&i<=57}function Lv(i){return r0(i)||i>=97&&i<=102||i>=65&&i<=70}const Rk=(i,e,t)=>(s,r)=>{for(let n=false,o=0,a=0;;a++){let{next:l}=s;if(Zl(l)||l==Ic||l==Qk||n&&r0(l)){if(!n&&(l!=Ic||a>0))n=true;if(o===a&&l==Ic)o++;s.advance()}else if(l==r7&&s.peek(1)!=n7){s.advance();if(Lv(s.next)){do{s.advance()}while(Lv(s.next));if(s.next==32)s.advance()}else if(s.next>-1){s.advance()}n=true}else{if(n)s.acceptToken(o==2&&r.canShift($k)?e:l==K8?t:i);break}}};const a7=new at(Rk(U8,$k,j8),{contextual:true});const l7=new at(Rk(H8,V8,Y8),{contextual:true});const h7=new at(i=>{if(Ek.includes(i.peek(-1))){let{next:e}=i;if(Zl(e)||e==Qk||e==t7||e==e7||e==o7||e==J8||e==G8&&Zl(i.peek(1))||e==Ic||e==s7)i.acceptToken(Z8)}});const c7=new at(i=>{if(!Ek.includes(i.peek(-1))){let{next:e}=i;if(e==i7){i.advance();i.acceptToken(Av)}if(Zl(e)){do{i.advance()}while(Zl(i.next)||r0(i.next));i.acceptToken(Av)}}});const d7=Sr({"AtKeyword import charset namespace keyframes media supports font-feature-values":P.definitionKeyword,"from to selector scope MatchFlag":P.keyword,NamespaceName:P.namespace,KeyframeName:P.labelName,KeyframeRangeName:P.operatorKeyword,TagName:P.tagName,ClassName:P.className,PseudoClassName:P.constant(P.className),IdName:P.labelName,"FeatureName PropertyName":P.propertyName,AttributeName:P.attributeName,NumberLiteral:P.number,KeywordQuery:P.keyword,UnaryQueryOp:P.operatorKeyword,"CallTag ValueName FontName":P.atom,VariableName:P.variableName,Callee:P.operatorKeyword,Unit:P.unit,"UniversalSelector NestingSelector":P.definitionOperator,"MatchOp CompareOp":P.compareOperator,"ChildOp SiblingOp, LogicOp":P.logicOperator,BinOp:P.arithmeticOperator,Important:P.modifier,Comment:P.blockComment,ColorLiteral:P.color,"ParenthesizedContent StringLiteral":P.string,":":P.punctuation,"PseudoOp #":P.derefOperator,"; , |":P.separator,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace});const u7={__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:158,"url-prefix":158,domain:158,regexp:158};const f7={__proto__:null,or:104,and:104,not:112,only:112,layer:212};const p7={__proto__:null,selector:118,style:124,layer:208};const m7={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252};const g7={__proto__:null,to:249};const O7=vr.deserialize({version:14,states:"MrQYQdOOO#}QdOOP$UO\`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q\`O'#CgO%aQaO'#FqO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#ERO'dQdO'#ETO'oQdO'#E[O'oQdO'#E_OOQP'#Fq'#FqO)RQhO'#FQOOQS'#Fp'#FpOOQS'#FT'#FTQYQdOOO)YQdO'#EeO*iQhO'#EkO)YQdO'#EmO*pQdO'#EoO*{QdO'#ErO)}QhO'#ExO+TQdO'#EzO+\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`%{<%lO%jjEWU!}WOy%jz#a%j#a#bEj#b;'S%j;'S;=\`%{<%lO%jbEoU!r\`Oy%jz#d%j#d#eFR#e;'S%j;'S;=\`%{<%lO%jbFWU!r\`Oy%jz#c%j#c#dFj#d;'S%j;'S;=\`%{<%lO%jbFoU!r\`Oy%jz#f%j#f#gGR#g;'S%j;'S;=\`%{<%lO%jbGWU!r\`Oy%jz#h%j#h#iGj#i;'S%j;'S;=\`%{<%lO%jbGoU!r\`Oy%jz#T%j#T#UHR#U;'S%j;'S;=\`%{<%lO%jbHWU!r\`Oy%jz#b%j#b#cHj#c;'S%j;'S;=\`%{<%lO%jbHoU!r\`Oy%jz#h%j#h#iIR#i;'S%j;'S;=\`%{<%lO%jbIYS$rQ!r\`Oy%jz;'S%j;'S;=\`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=\`%{<%lO%jfI|U$fUOy%jz!_%j!_!\`2n!\`;'S%j;'S;=\`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=\`%{<%lO%jfJvU#SQOy%jz!_%j!_!\`2n!\`;'S%j;'S;=\`%{<%lO%j\`K]P;=\`<%l%Z",tokenizers:[h7,c7,a7,l7,1,2,3,4,new Ed("m~RRYZ[z{a~~g~aO$b~~dP!P!Qg~lO$c~~",28,155)],topRules:{"StyleSheet":[0,6],"Styles":[1,129]},dynamicPrecedences:{"97":1},specialized:[{term:150,get:i=>u7[i]||-1},{term:151,get:i=>f7[i]||-1},{term:4,get:i=>p7[i]||-1},{term:28,get:i=>m7[i]||-1},{term:149,get:i=>g7[i]||-1}],tokenPrec:2444});let $f=null;function Ef(){if(!$f&&typeof document=="object"&&document.body){let{style:i}=document.body,e=[],t=new Set;for(let s in i)if(s!="cssText"&&s!="cssFloat"){if(typeof i[s]=="string"){if(/[A-Z]/.test(s))s=s.replace(/[A-Z]/g,r=>"-"+r.toLowerCase());if(!t.has(s)){e.push(s);t.add(s)}}}$f=e.sort().map(s=>({type:"property",label:s,apply:s+": "}))}return $f||[]}const Mv=["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(i=>({type:"class",label:i}));const Bv=["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(i=>({type:"keyword",label:i})).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(i=>({type:"constant",label:i})));const _7=["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(i=>({type:"type",label:i}));const v7=["@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(i=>({type:"keyword",label:i}));const Gs=/^(\\w[\\w-]*|-\\w[\\w-]*|)$/;const y7=/^-(-[\\w-]*)?$/;function b7(i,e){var t;if(i.name=="("||i.type.isError)i=i.parent||i;if(i.name!="ArgList")return false;let s=(t=i.parent)===null||t===void 0?void 0:t.firstChild;if((s===null||s===void 0?void 0:s.name)!="Callee")return false;return e.sliceString(s.from,s.to)=="var"}const Iv=new HO;const S7=["Declaration"];function w7(i){for(let e=i;;){if(e.type.isTop)return e;if(!(e=e.parent))return i}}function Ak(i,e,t){if(e.to-e.from>4096){let s=Iv.get(e);if(s)return s;let r=[],n=new Set,o=e.cursor(Ee.IncludeAnonymous);if(o.firstChild())do{for(let a of Ak(i,o.node,t))if(!n.has(a.label)){n.add(a.label);r.push(a)}}while(o.nextSibling());Iv.set(e,r);return r}else{let s=[],r=new Set;e.cursor().iterate(n=>{var o;if(t(n)&&n.matchContext(S7)&&((o=n.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=i.sliceString(n.from,n.to);if(!r.has(a)){r.add(a);s.push({label:a,type:"variable"})}}});return s}}const x7=i=>e=>{let{state:t,pos:s}=e,r=We(t).resolveInner(s,-1);let n=r.type.isError&&r.from==r.to-1&&t.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(n||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Ef(),validFor:Gs};if(r.name=="ValueName")return{from:r.from,options:Bv,validFor:Gs};if(r.name=="PseudoClassName")return{from:r.from,options:Mv,validFor:Gs};if(i(r)||(e.explicit||n)&&b7(r,t.doc))return{from:i(r)||n?r.from:s,options:Ak(t.doc,w7(r),i),validFor:y7};if(r.name=="TagName"){for(let{parent:l}=r;l;l=l.parent)if(l.name=="Block")return{from:r.from,options:Ef(),validFor:Gs};return{from:r.from,options:_7,validFor:Gs}}if(r.name=="AtKeyword")return{from:r.from,options:v7,validFor:Gs};if(!e.explicit)return null;let o=r.resolve(s),a=o.childBefore(s);if(a&&a.name==":"&&o.name=="PseudoClassSelector")return{from:s,options:Mv,validFor:Gs};if(a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList")return{from:s,options:Bv,validFor:Gs};if(o.name=="Block"||o.name=="Styles")return{from:s,options:Ef(),validFor:Gs};return null};const k7=x7(i=>i.name=="VariableName");const Qd=_r.define({name:"css",parser:O7.configure({props:[wr.add({Declaration:Vo()}),xr.add({"Block KeyframeList":mh})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\\s*\\}$/,wordChars:"-"}});function Lk(){return new pn(Qd,Qd.data.of({autocomplete:k7}))}const C7=55;const T7=1;const P7=56;const $7=2;const E7=57;const Q7=3;const Dv=4;const R7=5;const n0=6;const Mk=7;const Bk=8;const Ik=9;const Dk=10;const A7=11;const L7=12;const M7=13;const Qf=58;const B7=14;const I7=15;const zv=59;const zk=21;const D7=23;const Wk=24;const z7=25;const Ym=27;const qk=28;const W7=29;const q7=32;const X7=35;const N7=37;const F7=38;const Z7=0;const U7=1;const j7={area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,menuitem:true};const H7={dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true};const Wv={dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}};function V7(i){return i==45||i==46||i==58||i>=65&&i<=90||i==95||i>=97&&i<=122||i>=161}let qv=null;let Xv=null;let Nv=0;function Gm(i,e){let t=i.pos+e;if(Nv==t&&Xv==i)return qv;let s=i.peek(e),r="";for(;;){if(!V7(s))break;r+=String.fromCharCode(s);s=i.peek(++e)}Xv=i;Nv=t;return qv=r?r.toLowerCase():s==Y7||s==G7?void 0:null}const Xk=60;const Rd=62;const o0=47;const Y7=63;const G7=33;const K7=45;function Fv(i,e){this.name=i;this.parent=e}const J7=[n0,Dk,Mk,Bk,Ik];const eL=new yu({start:null,shift(i,e,t,s){return J7.indexOf(e)>-1?new Fv(Gm(s,1)||"",i):i},reduce(i,e){return e==zk&&i?i.parent:i},reuse(i,e,t,s){let r=e.type.id;return r==n0||r==N7?new Fv(Gm(s,1)||"",i):i},strict:false});const tL=new at((i,e)=>{if(i.next!=Xk){if(i.next<0&&e.context)i.acceptToken(Qf);return}i.advance();let t=i.next==o0;if(t)i.advance();let s=Gm(i,0);if(s===void 0)return;if(!s)return i.acceptToken(t?I7:B7);let r=e.context?e.context.name:null;if(t){if(s==r)return i.acceptToken(A7);if(r&&H7[r])return i.acceptToken(Qf,-2);if(e.dialectEnabled(Z7))return i.acceptToken(L7);for(let n=e.context;n;n=n.parent)if(n.name==s)return;i.acceptToken(M7)}else{if(s=="script")return i.acceptToken(Mk);if(s=="style")return i.acceptToken(Bk);if(s=="textarea")return i.acceptToken(Ik);if(j7.hasOwnProperty(s))return i.acceptToken(Dk);if(r&&Wv[r]&&Wv[r][s])i.acceptToken(Qf,-1);else i.acceptToken(n0)}},{contextual:true});const iL=new at(i=>{for(let e=0,t=0;;t++){if(i.next<0){if(t)i.acceptToken(zv);break}if(i.next==K7){e++}else if(i.next==Rd&&e>=2){if(t>=3)i.acceptToken(zv,-2);break}else{e=0}i.advance()}});function sL(i){for(;i;i=i.parent)if(i.name=="svg"||i.name=="math")return true;return false}const rL=new at((i,e)=>{if(i.next==o0&&i.peek(1)==Rd){let t=e.dialectEnabled(U7)||sL(e.context);i.acceptToken(t?R7:Dv,2)}else if(i.next==Rd){i.acceptToken(Dv,1)}});function a0(i,e,t){let s=2+i.length;return new at(r=>{for(let n=0,o=0,a=0;;a++){if(r.next<0){if(a)r.acceptToken(e);break}if(n==0&&r.next==Xk||n==1&&r.next==o0||n>=2&&no)r.acceptToken(e,-o);else r.acceptToken(t,-(o-2));break}else if((r.next==10||r.next==13)&&a){r.acceptToken(e,1);break}else{n=o=0}r.advance()}})}const nL=a0("script",C7,T7);const oL=a0("style",P7,$7);const aL=a0("textarea",E7,Q7);const lL=Sr({"Text RawText IncompleteTag IncompleteCloseTag":P.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":P.angleBracket,TagName:P.tagName,"MismatchedCloseTag/TagName":[P.tagName,P.invalid],AttributeName:P.attributeName,"AttributeValue UnquotedAttributeValue":P.attributeValue,Is:P.definitionOperator,"EntityReference CharacterReference":P.character,Comment:P.blockComment,ProcessingInst:P.processingInstruction,DoctypeDecl:P.documentMeta});const hL=vr.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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O~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:eL,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:[lL],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@OqrBw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s||p.attrs(f||(f=Nk(d,l))))){let m=c.lastChild;let O=m.type.id==F7?m.from:c.to;if(O>d.to)return{parser:p.parser,overlay:[{from:d.to,to:O}]}}}}if(o&&h==Wk){let c=a.node,d;if(d=c.firstChild){let u=o[l.read(d.from,d.to)];if(u)for(let f of u){if(f.tagName&&f.tagName!=Zv(c.parent,l))continue;let p=c.lastChild;if(p.type.id==Ym){let m=p.from+1;let O=p.lastChild,v=p.to-(O&&O.isError?0:1);if(v>m)return{parser:f.parser,overlay:[{from:m,to:v}],bracketed:true}}else if(p.type.id==qk){return{parser:f.parser,overlay:[{from:p.from,to:p.to}]}}}}}return null})}const cL=316;const dL=317;const Uv=1;const uL=2;const fL=3;const pL=4;const mL=318;const gL=320;const OL=321;const _L=5;const vL=6;const yL=0;const Km=[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];const Zk=125;const bL=59;const Jm=47;const SL=42;const wL=43;const xL=45;const kL=60;const CL=44;const TL=63;const PL=46;const $L=91;const EL=new yu({start:false,shift(i,e){return e==_L||e==vL||e==gL?i:e==OL},strict:false});const QL=new at((i,e)=>{let{next:t}=i;if(t==Zk||t==-1||e.context)i.acceptToken(mL)},{contextual:true,fallback:true});const RL=new at((i,e)=>{let{next:t}=i,s;if(Km.indexOf(t)>-1)return;if(t==Jm&&((s=i.peek(1))==Jm||s==SL))return;if(t!=Zk&&t!=bL&&t!=-1&&!e.context)i.acceptToken(cL)},{contextual:true});const AL=new at((i,e)=>{if(i.next==$L&&!e.context)i.acceptToken(dL)},{contextual:true});const LL=new at((i,e)=>{let{next:t}=i;if(t==wL||t==xL){i.advance();if(t==i.next){i.advance();let s=!e.context&&e.canShift(Uv);i.acceptToken(s?Uv:uL)}}else if(t==TL&&i.peek(1)==PL){i.advance();i.advance();if(i.next<48||i.next>57)i.acceptToken(fL)}},{contextual:true});function Af(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const ML=new at((i,e)=>{if(i.next!=kL||!e.dialectEnabled(yL))return;i.advance();if(i.next==Jm)return;let t=0;while(Km.indexOf(i.next)>-1){i.advance();t++}if(Af(i.next,true)){i.advance();t++;while(Af(i.next,false)){i.advance();t++}while(Km.indexOf(i.next)>-1){i.advance();t++}if(i.next==CL)return;for(let s=0;;s++){if(s==7){if(!Af(i.next,true))return;break}if(i.next!="extends".charCodeAt(s))break;i.advance();t++}}i.acceptToken(pL,-t)});const BL=Sr({"get set async static":P.modifier,"for while do if else switch try catch finally return throw break continue default case defer":P.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":P.operatorKeyword,"let var const using function class extends":P.definitionKeyword,"import export from":P.moduleKeyword,"with debugger new":P.keyword,TemplateString:P.special(P.string),super:P.atom,BooleanLiteral:P.bool,this:P.self,null:P.null,Star:P.modifier,VariableName:P.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":P.function(P.variableName),VariableDefinition:P.definition(P.variableName),Label:P.labelName,PropertyName:P.propertyName,PrivatePropertyName:P.special(P.propertyName),"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),"FunctionDeclaration/VariableDefinition":P.function(P.definition(P.variableName)),"ClassDeclaration/VariableDefinition":P.definition(P.className),"NewExpression/VariableName":P.className,PropertyDefinition:P.definition(P.propertyName),PrivatePropertyDefinition:P.definition(P.special(P.propertyName)),UpdateOp:P.updateOperator,"LineComment Hashbang":P.lineComment,BlockComment:P.blockComment,Number:P.number,String:P.string,Escape:P.escape,ArithOp:P.arithmeticOperator,LogicOp:P.logicOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,RegExp:P.regexp,Equals:P.definitionOperator,Arrow:P.function(P.punctuation),": Spread":P.punctuation,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,"InterpolationStart InterpolationEnd":P.special(P.brace),".":P.derefOperator,", ;":P.separator,"@":P.meta,TypeName:P.typeName,TypeDefinition:P.definition(P.typeName),"type enum interface implements namespace module declare":P.definitionKeyword,"abstract global Privacy readonly override":P.modifier,"is keyof unique infer asserts":P.operatorKeyword,JSXAttributeValue:P.attributeValue,JSXText:P.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":P.angleBracket,"JSXIdentifier JSXNameSpacedName":P.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":P.attributeName,"JSXBuiltin/JSXIdentifier":P.standard(P.tagName)});const IL={__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};const DL={__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};const zL={__proto__:null,"<":193};const WL=vr.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'#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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:EL,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:[BL],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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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 Ed("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{"Script":[0,7],"SingleExpression":[1,276],"SingleClassItem":[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{"80":1,"82":1,"94":1,"169":1,"199":1},specialized:[{term:327,get:i=>IL[i]||-1},{term:343,get:i=>DL[i]||-1},{term:95,get:i=>zL[i]||-1}],tokenPrec:15201});class qL{constructor(e,t,s,r){this.state=e;this.pos=t;this.explicit=s;this.view=r;this.abortListeners=[];this.abortOnDocChange=false}tokenBefore(e){let t=We(this.state).resolveInner(this.pos,-1);while(t&&e.indexOf(t.name)<0)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos);let s=Math.max(t.from,this.pos-250);let r=t.text.slice(s-t.from,this.pos-t.from);let n=r.search(NL(e));return n<0?null:{from:s+n,to:this.pos,text:r.slice(n)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,s){if(e=="abort"&&this.abortListeners){this.abortListeners.push(t);if(s&&s.onDocChange)this.abortOnDocChange=true}}}function jv(i){let e=Object.keys(i).join("");let t=/\\w/.test(e);if(t)e=e.replace(/\\w/g,"");return\`[\${t?"\\\\w":""}\${e.replace(/[^\\w\\s]/g,"\\\\$&")}]\`}function XL(i){let e=Object.create(null),t=Object.create(null);for(let{label:r}of i){e[r[0]]=true;for(let n=1;ntypeof r=="string"?{label:r}:r);let[t,s]=e.every(r=>/^\\w+$/.test(r.label))?[/\\w*$/,/\\w+$/]:XL(e);return r=>{let n=r.matchBefore(s);return n||r.explicit?{from:n?n.from:r.pos,options:e,validFor:t}:null}}function jk(i,e){return t=>{for(let s=We(t.state).resolveInner(t.pos,-1);s;s=s.parent){if(i.indexOf(s.name)>-1)return null;if(s.type.isTop)break}return e(t)}}function NL(i,e){var t;let{source:s}=i;let r=s[s.length-1]!="$";if(!r)return i;return new RegExp(\`\${""}(?:\${s})\${r?"$":""}\`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const FL=br.define();const ZL=J.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:\`\${400}px\`,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:\`\${30}px\`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:\`\${30}px\`},"&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 UL{constructor(e,t,s,r){this.field=e;this.line=t;this.from=s;this.to=r}}class l0{constructor(e,t,s){this.field=e;this.from=t;this.to=s}map(e){let t=e.mapPos(this.from,-1,oi.TrackDel);let s=e.mapPos(this.to,1,oi.TrackDel);return t==null||s==null?null:new l0(this.field,t,s)}}class h0{constructor(e,t){this.lines=e;this.fieldPositions=t}instantiate(e,t){let s=[],r=[t];let n=e.doc.lineAt(t),o=/^\\s*/.exec(n.text)[0];for(let l of this.lines){if(s.length){let h=o,c=/^\\t*/.exec(l)[0].length;for(let d=0;dnew l0(l.field,r[l.line]+l.from,r[l.line]+l.to));return{text:s,ranges:a}}static parse(e){let t=[];let s=[],r=[],n;for(let o of e.split(/\\r\\n?|\\n/)){while(n=/[#$]\\{(?:(\\d+)(?::([^{}]*))?|((?:\\\\[{}]|[^{}])*))\\}/.exec(o)){let a=n[1]?+n[1]:null,l=n[2]||n[3]||"",h=-1;if(a===0)a=1e9;let c=l.replace(/\\\\[{}]/g,d=>d[1]);for(let d=0;d=h)u.field++}for(let d of r)if(d.line==s.length&&d.from>n.index){let u=n[2]?3+(n[1]||"").length:2;d.from-=u;d.to-=u}r.push(new UL(h,s.length,n.index,n.index+c.length));o=o.slice(0,n.index)+l+o.slice(n.index+n[0].length)}o=o.replace(/\\\\([{}])/g,(a,l,h)=>{for(let c of r)if(c.line==s.length&&c.from>h){c.from--;c.to--}return l});s.push(o)}return new h0(s,r)}}let jL=fe.widget({widget:new class extends uo{toDOM(){let i=document.createElement("span");i.className="cm-snippetFieldPosition";return i}ignoreEvent(){return false}}});let HL=fe.mark({class:"cm-snippetField"});class _a{constructor(e,t){this.ranges=e;this.active=t;this.deco=fe.set(e.map(s=>(s.from==s.to?jL:HL).range(s.from,s.to)),true)}map(e){let t=[];for(let s of this.ranges){let r=s.map(e);if(!r)return null;t.push(r)}return new _a(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(s=>s.field==this.active&&s.from<=t.from&&s.to>=t.to))}}const _h=Te.define({map(i,e){return i&&i.map(e)}});const VL=Te.define();const Ul=ji.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(_h))return t.value;if(t.is(VL)&&i)return new _a(i.ranges,t.value)}if(i&&e.docChanged)i=i.map(e.changes);if(i&&e.selection&&!i.selectionInsideField(e.selection))i=null;return i},provide:i=>J.decorations.from(i,e=>e?e.deco:fe.none)});function c0(i,e){return z.create(i.filter(t=>t.field==e).map(t=>z.range(t.from,t.to)))}function YL(i){let e=h0.parse(i);return(t,s,r,n)=>{let{text:o,ranges:a}=e.instantiate(t.state,r);let{main:l}=t.state.selection;let h={changes:{from:r,to:n==l.from?l.to:n,insert:Pe.of(o)},scrollIntoView:true,annotations:s?[FL.of(s),ut.userEvent.of("input.complete")]:void 0};if(a.length)h.selection=c0(a,0);if(a.some(c=>c.field>0)){let c=new _a(a,0);let d=h.effects=[_h.of(c)];if(t.state.field(Ul,false)===void 0)d.push(Te.appendConfig.of([Ul,tM,iM,ZL]))}t.dispatch(t.state.update(h))}}function Hk(i){return({state:e,dispatch:t})=>{let s=e.field(Ul,false);if(!s||i<0&&s.active==0)return false;let r=s.active+i,n=i>0&&!s.ranges.some(o=>o.field==r+i);t(e.update({selection:c0(s.ranges,r),effects:_h.of(n?null:new _a(s.ranges,r)),scrollIntoView:true}));return true}}const GL=({state:i,dispatch:e})=>{let t=i.field(Ul,false);if(!t)return false;e(i.update({effects:_h.of(null)}));return true};const KL=Hk(1);const JL=Hk(-1);const eM=[{key:"Tab",run:KL,shift:JL},{key:"Escape",run:GL}];const Hv=te.define({combine(i){return i.length?i[0]:eM}});const tM=ho.highest(du.compute([Hv],i=>i.facet(Hv)));function Ke(i,e){return{...e,apply:YL(i)}}const iM=J.domEventHandlers({mousedown(i,e){let t=e.state.field(Ul,false),s;if(!t||(s=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return false;let r=t.ranges.find(n=>n.from<=s&&n.to>=s);if(!r||r.field==t.active)return false;e.dispatch({selection:c0(t.ranges,r.field),effects:_h.of(t.ranges.some(n=>n.field>r.field)?new _a(t.ranges,r.field):null),scrollIntoView:true});return true}});const Vk=new class extends an{};Vk.startSide=1;Vk.endSide=-1;const Yk=[Ke("function \${name}(\${params}) {\\n \${}\\n}",{label:"function",detail:"definition",type:"keyword"}),Ke("for (let \${index} = 0; \${index} < \${bound}; \${index}++) {\\n \${}\\n}",{label:"for",detail:"loop",type:"keyword"}),Ke("for (let \${name} of \${collection}) {\\n \${}\\n}",{label:"for",detail:"of loop",type:"keyword"}),Ke("do {\\n \${}\\n} while (\${})",{label:"do",detail:"loop",type:"keyword"}),Ke("while (\${}) {\\n \${}\\n}",{label:"while",detail:"loop",type:"keyword"}),Ke("try {\\n \${}\\n} catch (\${error}) {\\n \${}\\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Ke("if (\${}) {\\n \${}\\n}",{label:"if",detail:"block",type:"keyword"}),Ke("if (\${}) {\\n \${}\\n} else {\\n \${}\\n}",{label:"if",detail:"/ else block",type:"keyword"}),Ke("class \${name} {\\n constructor(\${params}) {\\n \${}\\n }\\n}",{label:"class",detail:"definition",type:"keyword"}),Ke('import {\${names}} from "\${module}"\\n\${}',{label:"import",detail:"named",type:"keyword"}),Ke('import \${name} from "\${module}"\\n\${}',{label:"import",detail:"default",type:"keyword"})];const sM=Yk.concat([Ke("interface \${name} {\\n \${}\\n}",{label:"interface",detail:"definition",type:"keyword"}),Ke("type \${name} = \${type}",{label:"type",detail:"definition",type:"keyword"}),Ke("enum \${name} {\\n \${}\\n}",{label:"enum",detail:"definition",type:"keyword"})]);const Vv=new HO;const Gk=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ba(i){return(e,t)=>{let s=e.node.getChild("VariableDefinition");if(s)t(s,i);return true}}const rM=["FunctionDeclaration"];const nM={FunctionDeclaration:Ba("function"),ClassDeclaration:Ba("class"),ClassExpression:()=>true,EnumDeclaration:Ba("constant"),TypeAliasDeclaration:Ba("type"),NamespaceDeclaration:Ba("namespace"),VariableDefinition(i,e){if(!i.matchContext(rM))e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function Kk(i,e){let t=Vv.get(e);if(t)return t;let s=[],r=true;function n(o,a){let l=i.sliceString(o.from,o.to);s.push({label:l,type:a})}e.cursor(Ee.IncludeAnonymous).iterate(o=>{if(r){r=false}else if(o.name){let a=nM[o.name];if(a&&a(o,n)||Gk.has(o.name))return false}else if(o.to-o.from>8192){for(let a of Kk(i,o.node))s.push(a);return false}});Vv.set(e,s);return s}const Yv=/^[\\w$\\xa1-\\uffff][\\w$\\d\\xa1-\\uffff]*$/;const Jk=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function oM(i){let e=We(i.state).resolveInner(i.pos,-1);if(Jk.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Yv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent){if(Gk.has(r.name))s=s.concat(Kk(i.state.doc,r))}return{options:s,from:t?e.from:i.pos,validFor:Yv}}const Ws=_r.define({name:"javascript",parser:WL.configure({props:[wr.add({IfStatement:Vo({except:/^\\s*({|else\\b)/}),TryStatement:Vo({except:/^\\s*({|catch\\b|finally\\b)/}),LabeledStatement:NR,SwitchBody:i=>{let e=i.textAfter,t=/^\\s*\\}/.test(e),s=/^\\s*(case|default)\\b/.test(e);return i.baseIndent+(t?0:s?1:2)*i.unit},Block:Ho({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Vo({except:/^\\s*{/}),JSXElement(i){let e=/^\\s*<\\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\\s*\\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),xr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":mh,BlockComment(i){return{from:i.from+2,to:i.to-2}},JSXElement(i){let e=i.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=i.lastChild;return{from:e.to,to:t.type.isError?i.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(i){var e;let t=(e=i.firstChild)===null||e===void 0?void 0:e.nextSibling,s=i.lastChild;if(!t||t.type.isError)return null;return{from:t.to,to:s.type.isError?i.to:s.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"\`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\\s*(?:case |default:|\\{|\\}|<\\/)$/,wordChars:"$"}});const e5={test:i=>/^JSX/.test(i.name),facet:fu({commentTokens:{block:{open:"{/*",close:"*/}"}}})};const t5=Ws.configure({dialect:"ts"},"typescript");const i5=Ws.configure({dialect:"jsx",props:[VO.add(i=>i.isTop?[e5]:void 0)]});const s5=Ws.configure({dialect:"jsx ts",props:[VO.add(i=>i.isTop?[e5]:void 0)]},"typescript");let r5=i=>({label:i,type:"keyword"});const n5="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(r5);const aM=n5.concat(["declare","implements","private","protected","public"].map(r5));function Dc(i={}){let e=i.jsx?i.typescript?s5:i5:i.typescript?t5:Ws;let t=i.typescript?sM.concat(aM):Yk.concat(n5);return new pn(e,[Ws.data.of({autocomplete:jk(Jk,Uk(t))}),Ws.data.of({autocomplete:oM}),i.jsx?cM:[]])}function lM(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Gv(i,e,t=i.length){for(let s=e===null||e===void 0?void 0:e.firstChild;s;s=s.nextSibling){if(s.name=="JSXIdentifier"||s.name=="JSXBuiltin"||s.name=="JSXNamespacedName"||s.name=="JSXMemberExpression")return i.sliceString(s.from,Math.min(s.to,t))}return""}const hM=typeof navigator=="object"&&/Android\\b/.test(navigator.userAgent);const cM=J.inputHandler.of((i,e,t,s,r)=>{if((hM?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Ws.isActiveAt(i.state,e,-1))return false;let n=r(),{state:o}=n;let a=o.changeByRange(l=>{var h;let{head:c}=l,d=We(o).resolveInner(c-1,-1),u;if(d.name=="JSXStartTag")d=d.parent;if(o.doc.sliceString(c-1,c)!=s||d.name=="JSXAttributeValue"&&d.to>c);else if(s==">"&&d.name=="JSXFragmentTag"){return{range:l,changes:{from:c,insert:\`\`}}}else if(s=="/"&&d.name=="JSXStartCloseTag"){let f=d.parent,p=f.parent;if(p&&f.from==c-2&&((u=Gv(o.doc,p.firstChild,c))||((h=p.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=\`\${u}>\`;return{range:z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(s==">"){let f=lM(d);if(f&&f.name=="JSXOpenTag"&&!/^\\/?>|^<\\//.test(o.doc.sliceString(c,c+2))&&(u=Gv(o.doc,f,c)))return{range:l,changes:{from:c,insert:\`\`}}}return{range:l}});if(a.changes.empty)return false;i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:true})]);return true});const Ia=["_blank","_self","_top","_parent"];const Lf=["ascii","utf-8","utf-16","latin1","latin1"];const Mf=["get","post","put","delete"];const Bf=["application/x-www-form-urlencoded","multipart/form-data","text/plain"];const bi=["true","false"];const ae={};const dM={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ia,hreflang:null}},abbr:ae,address:ae,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:ae,aside:ae,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:ae,base:{attrs:{href:null,target:Ia}},bdi:ae,bdo:ae,blockquote:{attrs:{cite:null}},body:ae,br:ae,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Bf,formmethod:Mf,formnovalidate:["novalidate"],formtarget:Ia,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:ae,center:ae,cite:ae,code:ae,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:ae,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:ae,div:ae,dl:ae,dt:ae,em:ae,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:ae,figure:ae,footer:ae,form:{attrs:{action:null,name:null,"accept-charset":Lf,autocomplete:["on","off"],enctype:Bf,method:Mf,novalidate:["novalidate"],target:Ia}},h1:ae,h2:ae,h3:ae,h4:ae,h5:ae,h6:ae,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:ae,hgroup:ae,hr:ae,html:{attrs:{manifest:null}},i:ae,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:Bf,formmethod:Mf,formnovalidate:["novalidate"],formtarget:Ia,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:ae,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:ae,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:ae,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Lf,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:ae,noscript:ae,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:ae,param:{attrs:{name:null,value:null}},pre:ae,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:ae,rt:ae,ruby:ae,samp:ae,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Lf}},section:ae,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:ae,source:{attrs:{src:null,type:null,media:null}},span:ae,strong:ae,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:ae,summary:ae,sup:ae,table:ae,tbody:ae,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:ae,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:ae,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:ae,time:{attrs:{datetime:null}},title:ae,tr:ae,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:ae,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:ae};const o5={accesskey:null,class:null,contenteditable:bi,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:bi,autocorrect:bi,autocapitalize:bi,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":bi,"aria-autocomplete":["inline","list","both","none"],"aria-busy":bi,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":bi,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":bi,"aria-hidden":bi,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":bi,"aria-multiselectable":bi,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":bi,"aria-relevant":null,"aria-required":bi,"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};const a5="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(i=>"on"+i);for(let i of a5)o5[i]=null;class jl{constructor(e,t){this.tags={...dM,...e};this.globalAttrs={...o5,...t};this.allTags=Object.keys(this.tags);this.globalAttrNames=Object.keys(this.globalAttrs)}}jl.default=new jl;function so(i,e,t=i.length){if(!e)return"";let s=e.firstChild;let r=s&&s.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function la(i,e=false){for(;i;i=i.parent)if(i.name=="Element"){if(e)e=false;else return i}return null}function l5(i,e,t){let s=t.tags[so(i,la(e))];return(s===null||s===void 0?void 0:s.children)||t.allTags}function d0(i,e){let t=[];for(let s=la(e);s&&!s.type.isTop;s=la(s.parent)){let r=so(i,s);if(r&&s.lastChild.name=="CloseTag")break;if(r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=s.firstChild.to))t.push(r)}return t}const h5=/^[:\\-\\.\\w\\u00b7-\\uffff]*$/;function Kv(i,e,t,s,r){let n=/\\s*>/.test(i.sliceDoc(r,r+5))?"":">";let o=la(t,t.name=="StartTag"||t.name=="TagName");return{from:s,to:r,options:l5(i.doc,o,e).map(a=>({label:a,type:"type"})).concat(d0(i.doc,t).map((a,l)=>({label:"/"+a,apply:"/"+a+n,type:"type",boost:99-l}))),validFor:/^\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/}}function Jv(i,e,t,s){let r=/\\s*>/.test(i.sliceDoc(s,s+5))?"":">";return{from:t,to:s,options:d0(i.doc,e).map((n,o)=>({label:n,apply:n+r,type:"type",boost:99-o})),validFor:h5}}function uM(i,e,t,s){let r=[],n=0;for(let o of l5(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of d0(i.doc,t))r.push({label:"",type:"type",boost:99-n++});return{from:s,to:s,options:r,validFor:/^<\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/}}function fM(i,e,t,s,r){let n=la(t),o=n?e.tags[so(i.doc,n)]:null;let a=o&&o.attrs?Object.keys(o.attrs):[];let l=o&&o.globalAttrs===false?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:s,to:r,options:l.map(h=>({label:h,type:"property"})),validFor:h5}}function pM(i,e,t,s,r){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName");let a=[],l=void 0;if(o){let h=i.sliceDoc(o.from,o.to);let c=e.globalAttrs[h];if(!c){let d=la(t),u=d?e.tags[so(i.doc,d)]:null;c=(u===null||u===void 0?void 0:u.attrs)&&u.attrs[h]}if(c){let d=i.sliceDoc(s,r).toLowerCase(),u='"',f='"';if(/^['"]/.test(d)){l=d[0]=='"'?/^[^"]*$/:/^[^']*$/;u="";f=i.sliceDoc(r,r+1)==d[0]?"":d[0];d=d.slice(1);s++}else{l=/^[^\\s<>='"]*$/}for(let p of c)a.push({label:p,apply:u+p+f,type:"constant"})}}return{from:s,to:r,options:a,validFor:l}}function c5(i,e){let{state:t,pos:s}=e,r=We(t).resolveInner(s,-1),n=r.resolve(s);for(let o=s,a;n==r&&(a=r.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.fromc5(s,r)}const OM=Ws.parser.configure({top:"SingleExpression"});const d5=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:t5.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:i5.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:s5.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\\/(.+\\+)?json)$/i.test(i.type)},parser:OM},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:Ws.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:Qd.parser}];const u5=[{name:"style",parser:Qd.parser.configure({top:"Styles"})}].concat(a5.map(i=>({name:i,parser:Ws.parser})));const f5=_r.define({name:"html",parser:hL.configure({props:[wr.add({Element(i){let e=/^(\\s*)(<\\/)?/.exec(i.textAfter);if(i.node.to<=i.pos+e[0].length)return i.continue();return i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\\s*/.exec(i.textAfter)[0].lengthi.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\\s*<\\/\\w+\\W$/,wordChars:"-_"}});const zc=f5.configure({wrap:Fk(d5,u5)});function p5(i={}){let e="",t;if(i.matchClosingTags===false)e="noMatch";if(i.selfClosingTags===true)e=(e?e+" ":"")+"selfClosing";if(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)t=Fk((i.nestedLanguages||[]).concat(d5),(i.nestedAttributes||[]).concat(u5));let s=t?f5.configure({wrap:t,dialect:e}):e?zc.configure({dialect:e}):zc;return new pn(s,[zc.data.of({autocomplete:gM(i)}),i.autoCloseTags!==false?vM:[],Dc().support,Lk().support])}const ey=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function _M(i,e,t){var s;for(;;){if(((s=e.lastChild)===null||s===void 0?void 0:s.name)!="CloseTag")return false;let r=e.parent;if(!r||so(i,r)!=t)return true;e=r}}const vM=J.inputHandler.of((i,e,t,s,r)=>{if(i.composing||i.state.readOnly||e!=t||s!=">"&&s!="/"||!zc.isActiveAt(i.state,e,-1))return false;let n=r(),{state:o}=n;let a=o.changeByRange(l=>{var h;let c=o.doc.sliceString(l.from-1,l.to)==s;let{head:d}=l,u=We(o).resolveInner(d,-1),f;if(c&&s==">"&&u.name=="EndTag"){let p=u.parent;if((f=so(o.doc,p.parent,d))&&!ey.has(f)&&!_M(o.doc,p.parent,f)){let m=d+(o.doc.sliceString(d,d+1)===">"?1:0);let O=\`\`;return{range:l,changes:{from:d,to:m,insert:O}}}}else if(c&&s=="/"&&u.name=="IncompleteCloseTag"){let p=u.parent;if(u.from==d-2&&((h=p.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(f=so(o.doc,p,d))&&!ey.has(f)){let m=d+(o.doc.sliceString(d,d+1)===">"?1:0);let O=\`\${f}>\`;return{range:z.cursor(d+O.length,-1),changes:{from:d,to:m,insert:O}}}}return{range:l}});if(a.changes.empty)return false;i.dispatch([n,o.update(a,{userEvent:"input.complete",scrollIntoView:true})]);return true});const yM=Sr({String:P.string,Number:P.number,"True False":P.bool,PropertyName:P.propertyName,Null:P.null,", :":P.separator,"[ ]":P.squareBracket,"{ }":P.brace});const bM=vr.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:[yM],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});const SM=_r.define({name:"json",parser:bM.configure({props:[wr.add({Object:Vo({except:/^\\s*\\}/}),Array:Vo({except:/^\\s*\\]/})}),xr.add({"Object Array":mh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\\s*[\\}\\]]$/}});function wM(){return new pn(SM)}class Ad{static create(e,t,s,r,n){let o=r+(r<<8)+e+(t<<4)|0;return new Ad(e,t,s,o,n,[],[])}constructor(e,t,s,r,n,o,a){this.type=e;this.value=t;this.from=s;this.hash=r;this.end=n;this.children=o;this.positions=a;this.hashProp=[[ue.contextHash,r]]}addChild(e,t){if(e.prop(ue.contextHash)!=this.hash)e=new _e(e.type,e.children,e.positions,e.length,this.hashProp);this.children.push(e);this.positions.push(t)}toTree(e,t=this.end){let s=this.children.length-1;if(s>=0)t=Math.max(t,this.positions[s]+this.children[s].length+this.from);return new _e(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(r,n,o)=>new _e(pt.none,r,n,o,this.hashProp)})}}var Z;(function(i){i[i["Document"]=1]="Document";i[i["CodeBlock"]=2]="CodeBlock";i[i["FencedCode"]=3]="FencedCode";i[i["Blockquote"]=4]="Blockquote";i[i["HorizontalRule"]=5]="HorizontalRule";i[i["BulletList"]=6]="BulletList";i[i["OrderedList"]=7]="OrderedList";i[i["ListItem"]=8]="ListItem";i[i["ATXHeading1"]=9]="ATXHeading1";i[i["ATXHeading2"]=10]="ATXHeading2";i[i["ATXHeading3"]=11]="ATXHeading3";i[i["ATXHeading4"]=12]="ATXHeading4";i[i["ATXHeading5"]=13]="ATXHeading5";i[i["ATXHeading6"]=14]="ATXHeading6";i[i["SetextHeading1"]=15]="SetextHeading1";i[i["SetextHeading2"]=16]="SetextHeading2";i[i["HTMLBlock"]=17]="HTMLBlock";i[i["LinkReference"]=18]="LinkReference";i[i["Paragraph"]=19]="Paragraph";i[i["CommentBlock"]=20]="CommentBlock";i[i["ProcessingInstructionBlock"]=21]="ProcessingInstructionBlock";i[i["Escape"]=22]="Escape";i[i["Entity"]=23]="Entity";i[i["HardBreak"]=24]="HardBreak";i[i["Emphasis"]=25]="Emphasis";i[i["StrongEmphasis"]=26]="StrongEmphasis";i[i["Link"]=27]="Link";i[i["Image"]=28]="Image";i[i["InlineCode"]=29]="InlineCode";i[i["HTMLTag"]=30]="HTMLTag";i[i["Comment"]=31]="Comment";i[i["ProcessingInstruction"]=32]="ProcessingInstruction";i[i["Autolink"]=33]="Autolink";i[i["HeaderMark"]=34]="HeaderMark";i[i["QuoteMark"]=35]="QuoteMark";i[i["ListMark"]=36]="ListMark";i[i["LinkMark"]=37]="LinkMark";i[i["EmphasisMark"]=38]="EmphasisMark";i[i["CodeMark"]=39]="CodeMark";i[i["CodeText"]=40]="CodeText";i[i["CodeInfo"]=41]="CodeInfo";i[i["LinkTitle"]=42]="LinkTitle";i[i["LinkLabel"]=43]="LinkLabel";i[i["URL"]=44]="URL"})(Z||(Z={}));class xM{constructor(e,t){this.start=e;this.content=t;this.marks=[];this.parsers=[]}}class kM{constructor(){this.text="";this.baseIndent=0;this.basePos=0;this.depth=0;this.markers=[];this.pos=0;this.indent=0;this.next=-1}forward(){if(this.basePos>this.pos)this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent);this.pos=e;this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return yl(this.text,e)}reset(e){this.text=e;this.baseIndent=this.basePos=this.pos=this.indent=0;this.forwardInner();this.depth=1;while(this.markers.length)this.markers.pop()}moveBase(e){this.basePos=e;this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e;this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,s=0){for(let r=t;r=e.stack[t.depth+1].value+t.baseIndent)return true;if(t.indent>=t.baseIndent+4)return false;let s=(i.type==Z.OrderedList?p0:f0)(t,e,false);return s>0&&(i.type!=Z.BulletList||u0(t,e,false)<0)&&t.text.charCodeAt(t.pos+s-1)==i.value}const m5={[Z.Blockquote](i,e,t){if(t.next!=62)return false;t.markers.push(we(Z.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1));t.moveBase(t.pos+(Vi(t.text.charCodeAt(t.pos+1))?2:1));i.end=e.lineStart+t.text.length;return true},[Z.ListItem](i,e,t){if(t.indent-1)return false;t.moveBaseColumn(t.baseIndent+i.value);return true},[Z.OrderedList]:ty,[Z.BulletList]:ty,[Z.Document](){return true}};function Vi(i){return i==32||i==9||i==10||i==13}function yl(i,e=0){while(et&&Vi(i.charCodeAt(e-1)))e--;return e}function g5(i){if(i.next!=96&&i.next!=126)return-1;let e=i.pos+1;while(e-1&&i.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(x5.SetextHeading)>-1)return-1;return s<3?-1:1}function _5(i,e){for(let t=i.stack.length-1;t>=0;t--)if(i.stack[t].type==e)return true;return false}function f0(i,e,t){return(i.next==45||i.next==43||i.next==42)&&(i.pos==i.text.length-1||Vi(i.text.charCodeAt(i.pos+1)))&&(!t||_5(e,Z.BulletList)||i.skipSpace(i.pos+2)=48&&r<=57)s++;else break;if(s==i.text.length)return-1;r=i.text.charCodeAt(s)}if(s==i.pos||s>i.pos+9||r!=46&&r!=41||si.pos+1||i.next!=49))return-1;return s+1-i.pos}function v5(i){if(i.next!=35)return-1;let e=i.pos+1;while(e6?-1:t}function y5(i){if(i.next!=45&&i.next!=61||i.indent>=i.baseIndent+4)return-1;let e=i.pos+1;while(e/;const S5=/\\?>/;const tg=[[/^<(?:script|pre|style)(?:\\s|>|$)/i,/<\\/(?:script|pre|style)>/i],[/^\\s*/i.exec(s);if(n)return i.append(we(Z.Comment,t,t+1+n[0].length));let o=/^\\?[^]*?\\?>/.exec(s);if(o)return i.append(we(Z.ProcessingInstruction,t,t+1+o[0].length));let a=/^(?:![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(s);if(!a)return-1;return i.append(we(Z.HTMLTag,t,t+1+a[0].length))},Emphasis(i,e,t){if(e!=95&&e!=42)return-1;let s=t+1;while(i.char(s)==e)s++;let r=i.slice(t-1,t),n=i.slice(s,s+1);let o=Vl.test(r),a=Vl.test(n);let l=/\\s|^$/.test(r),h=/\\s|^$/.test(n);let c=!h&&(!a||l||o);let d=!l&&(!o||h||a);let u=c&&(e==42||!d||o);let f=d&&(e==42||!c||a);return i.append(new Pi(e==95?$5:E5,t,s,(u?1:0)|(f?2:0)))},HardBreak(i,e,t){if(e==92&&i.char(t+1)==10)return i.append(we(Z.HardBreak,t,t+2));if(e==32){let s=t+1;while(i.char(s)==32)s++;if(i.char(s)==10&&s>=t+2)return i.append(we(Z.HardBreak,t,s+1))}return-1},Link(i,e,t){return e==91?i.append(new Pi(En,t,t+1,1)):-1},Image(i,e,t){return e==33&&i.char(t+1)==91?i.append(new Pi(Ld,t,t+2,1)):-1},LinkEnd(i,e,t){if(e!=93)return-1;for(let s=i.parts.length-1;s>=0;s--){let r=i.parts[s];if(r instanceof Pi&&(r.type==En||r.type==Ld)){if(!r.side||i.skipSpace(r.to)==t&&!/[(\\[]/.test(i.slice(t+1,t+2))){i.parts[s]=null;return-1}let n=i.takeContent(s);let o=i.parts[s]=QM(i,n,r.type==En?Z.Link:Z.Image,r.from,t+1);if(r.type==En)for(let a=0;ae?we(Z.URL,e+t,n+t):n==i.length?null:false}}function R5(i,e,t){let s=i.charCodeAt(e);if(s!=39&&s!=34&&s!=40)return false;let r=s==40?41:s;for(let n=e+1,o=false;n=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){this.parts.push(e);return e.to}addDelimiter(e,t,s,r,n){return this.append(new Pi(e,t,s,(r?1:0)|(n?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof Pi&&(t.type==En||t.type==Ld))return true}return false}addElement(e){return this.append(e)}resolveMarkers(e){for(let s=e;s=e;l--){let m=this.parts[l];if(m instanceof Pi&&m.side&1&&m.type==r.type&&!(n&&(r.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let h=r.type.resolve,c=[];let d=a.from,u=r.to;if(n){let m=Math.min(2,a.to-a.from,o);d=a.to-m;u=r.from+m;h=m==1?"Emphasis":"StrongEmphasis"}if(a.type.mark)c.push(this.elt(a.type.mark,d,a.to));for(let m=l+1;m=0;t--){let s=this.parts[t];if(s instanceof Pi&&s.type==e&&s.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);this.parts.length=e;return t}getDelimiterAt(e){let t=this.parts[e];return t instanceof Pi?t:null}skipSpace(e){return yl(this.text,e-this.offset)+this.offset}elt(e,t,s,r){if(typeof e=="string")return we(this.parser.getNodeType(e),t,s,r);return new P5(e,t)}}m0.linkStart=En;m0.imageStart=Ld;function sg(i,e){if(!e.length)return i;if(!i.length)return e;let t=i.slice(),s=0;for(let r of e){while(s(e?e-1:0))return false;if(this.fragmentEnd<0){let n=this.fragment.to;while(n>0&&this.input.read(n-1,n)!="\\n")n--;this.fragmentEnd=n?n-1:0}let s=this.cursor;if(!s){s=this.cursor=this.fragment.tree.cursor();s.firstChild()}let r=e+this.fragment.offset;while(s.to<=r)if(!s.parent())return false;for(;;){if(s.from>=r)return this.fragment.from<=t;if(!s.childAfter(r))return false}}matches(e){let t=this.cursor.tree;return t&&t.prop(ue.contextHash)==e}takeNodes(e){let t=this.cursor,s=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0);let n=e.absoluteLineStart,o=n,a=e.block.children.length;let l=o,h=a;for(;;){if(t.to-s>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=L5(t.from-s,e.ranges);if(t.to-s<=e.ranges[e.rangeI].to){e.addNode(t.tree,c)}else{let d=new _e(e.parser.nodeSet.types[Z.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(d,t.tree);e.addNode(d,c)}if(t.type.is("Block")){if(RM.indexOf(t.type.id)<0){o=t.to-s;a=e.block.children.length}else{o=l;a=h}l=t.to-s;h=e.block.children.length}if(!t.nextSibling())break}while(e.block.children.length>a){e.block.children.pop();e.block.positions.pop()}return o-n}}function L5(i,e){let t=i;for(let s=1;ssc[i]),Object.keys(sc).map(i=>x5[i]),Object.keys(sc),PM,m5,Object.keys(Df).map(i=>Df[i]),Object.keys(Df),[]);function BM(i,e,t){let s=[];for(let r=i.firstChild,n=e;;r=r.nextSibling){let o=r?r.from:t;if(o>n)s.push({from:n,to:o});if(!r)break;n=r.to}return s}function IM(i){let{codeParser:e,htmlParser:t}=i;let s=xx((r,n)=>{let o=r.type.id;if(e&&(o==Z.CodeBlock||o==Z.FencedCode)){let a="";if(o==Z.FencedCode){let h=r.node.getChild(Z.CodeInfo);if(h)a=n.read(h.from,h.to)}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==Z.CodeText,bracketed:o==Z.FencedCode}}else if(t&&(o==Z.HTMLBlock||o==Z.HTMLTag||o==Z.CommentBlock)){return{parser:t,overlay:BM(r.node,r.from,r.to)}}return null});return{wrap:s}}const DM={resolve:"Strikethrough",mark:"StrikethroughMark"};const zM={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":P.strikethrough}},{name:"StrikethroughMark",style:P.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let s=i.slice(t-1,t),r=i.slice(t+2,t+3);let n=/\\s|^$/.test(s),o=/\\s|^$/.test(r);let a=Vl.test(s),l=Vl.test(r);return i.addDelimiter(DM,t,t+2,!o&&(!l||n||a),!n&&(!a||o||l))},after:"Emphasis"}]};function bl(i,e,t=0,s,r=0){let n=0,o=true,a=-1,l=-1,h=false;let c=()=>{s.push(i.elt("TableCell",r+a,r+l,i.parser.parseInline(e.slice(a,l),r+a)))};for(let d=t;d-1)n++;o=false;if(s){if(a>-1)c();s.push(i.elt("TableDelimiter",d+r,d+r+1))}a=l=-1}else if(h||u!=32&&u!=9){if(a<0)a=d;l=d+1}h=!h&&u==92}if(a>-1){n++;if(s)c()}return n}function ny(i,e){for(let t=e;t\\s]*\\|?(\\s*:?-+:?\\s*\\|)+(\\s*:?-+:?\\s*)?$/;class oy{constructor(){this.rows=null}nextLine(e,t,s){if(this.rows==null){this.rows=false;let r;if((t.next==45||t.next==58||t.next==124)&&M5.test(r=t.text.slice(t.pos))){let n=[],o=bl(e,s.content,0,n,s.start);if(o==bl(e,r,0))this.rows=[e.elt("TableHeader",s.start,s.start+s.content.length,n),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)]}}else if(this.rows){let r=[];bl(e,t.text,t.pos,r,e.lineStart);this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return false}finish(e,t){if(!this.rows)return false;e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows));return true}}const WM={defineNodes:[{name:"Table",block:true},{name:"TableHeader",style:{"TableHeader/...":P.heading}},"TableRow",{name:"TableCell",style:P.content},{name:"TableDelimiter",style:P.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return ny(e.content,0)?new oy:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof oy)||!ny(e.text,e.basePos))return false;let s=i.peekLine();return M5.test(s)&&bl(i,e.text,e.basePos)==bl(i,s,e.basePos)},before:"SetextHeading"}]};class qM{nextLine(){return false}finish(e,t){e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)]));return true}}const XM={defineNodes:[{name:"Task",block:true,style:P.list},{name:"TaskMarker",style:P.atom}],parseBlock:[{name:"TaskList",leaf(i,e){return/^\\[[ xX]\\][ \\t]/.test(e.content)&&i.parentType().name=="ListItem"?new qM:null},after:"SetextHeading"}]};const ay=/(www\\.)|(https?:\\/\\/)|([\\w.+-]{1,100}@)|(mailto:|xmpp:)/gy;const ly=/[\\w-]+(\\.[\\w-]+)+(:\\d+)?(\\/[^\\s<]*)?/gy;const NM=/[\\w-]+\\.[\\w-]+($|[/:])/;const hy=/[\\w.+-]+@[\\w-]+(\\.[\\w.-]+)+/gy;const cy=/\\/[a-zA-Z\\d@.]+/gy;function dy(i,e,t,s){let r=0;for(let n=e;n-1)return-1;let s=e+t[0].length;for(;;){let r=i[s-1],n;if(/[?!.,:*_~]/.test(r)||r==")"&&dy(i,e,s,")")>dy(i,e,s,"("))s--;else if(r==";"&&(n=/&(?:#\\d+|#x[a-f\\d]+|\\w+);$/.exec(i.slice(e,s))))s=e+n.index;else break}return s}function uy(i,e){hy.lastIndex=e;let t=hy.exec(i);if(!t)return-1;let s=t[0][t[0].length-1];return s=="_"||s=="-"?-1:e+t[0].length-(s=="."?1:0)}const ZM={parseInline:[{name:"Autolink",parse(i,e,t){let s=t-i.offset;if(s&&/\\w/.test(i.text[s-1]))return-1;ay.lastIndex=s;let r=ay.exec(i.text),n=-1;if(!r)return-1;if(r[1]||r[2]){n=FM(i.text,s+r[0].length);if(n>-1&&i.hasOpenLink){let o=/([^\\[\\]]|\\[[^\\]]*\\])*/.exec(i.text.slice(s,n));n=s+o[0].length}}else if(r[3]){n=uy(i.text,s)}else{n=uy(i.text,s+r[0].length);if(n>-1&&r[0]=="xmpp:"){cy.lastIndex=n;r=cy.exec(i.text);if(r)n=r.index+r[0].length}}if(n<0)return-1;i.addElement(i.elt("URL",t,n+i.offset));return n+i.offset}}]};const UM=[WM,XM,zM,ZM];function B5(i,e,t){return(s,r,n)=>{if(r!=i||s.char(n+1)==i)return-1;let o=[s.elt(t,n,n+1)];for(let a=n+1;a"}}});const D5=new ue;const z5=MM.configure({props:[xr.add(i=>{return!i.is("Block")||i.is("Document")||rg(i)!=null||YM(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})}),D5.add(rg),wr.add({Document:()=>null}),Gr.add({Document:I5})]});function rg(i){let e=/^(?:ATX|Setext)Heading(\\d)$/.exec(i.name);return e?+e[1]:void 0}function YM(i){return i.name=="OrderedList"||i.name=="BulletList"}function GM(i,e){let t=i;for(;;){let s=t.nextSibling,r;if(!s||(r=rg(s.type))!=null&&r<=e)break;t=s}return t.to}const KM=Ex.of((i,e,t)=>{for(let s=We(i).resolveInner(t,-1);s;s=s.parent){if(s.fromt)return{from:t,to:n}}return null});function g0(i){return new Ei(I5,i,[],"markdown")}const JM=g0(z5);const e9=z5.configure([UM,HM,jM,VM,{props:[xr.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]);const Md=g0(e9);function t9(i,e){return t=>{if(t&&i){let s=null;t=/\\S*/.exec(t)[0];if(typeof i=="function")s=i(t);else s=xd.matchLanguageName(i,t,true);if(s instanceof xd)return s.support?s.support.language.parser:eo.getSkippingParser(s.load());else if(s)return s.parser}return e?e.parser:null}}let zf=class zU{constructor(e,t,s,r,n,o,a){this.node=e;this.from=t;this.to=s;this.spaceBefore=r;this.spaceAfter=n;this.type=o;this.item=a}blank(e,t=true){let s=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){while(s.length0;r--)s+=" ";return s+(t?this.spaceAfter:"")}}marker(e,t){let s=this.node.name=="OrderedList"?String(+q5(this.item,e)[2]+t):"";return this.spaceBefore+s+this.type+this.spaceAfter}};function W5(i,e){let t=[],s=[];for(let r=i;r;r=r.parent){if(r.name=="FencedCode")return s;if(r.name=="ListItem"||r.name=="Blockquote")t.push(r)}for(let r=t.length-1;r>=0;r--){let n=t[r],o;let a=e.lineAt(n.from),l=n.from-a.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l)))){s.push(new zf(n,l,l+o[0].length,"",o[1],">",null))}else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],c=o[0].length;if(h.length>=4){h=h.slice(0,h.length-4);c-=4}s.push(new zf(n.parent,l,l+c,o[1],h,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\\[[ xX]\\])?( +)/.exec(a.text.slice(l)))){let h=o[4],c=o[0].length;if(h.length>4){h=h.slice(0,h.length-4);c-=4}let d=o[2];if(o[3])d+=o[3].replace(/[xX]/," ");s.push(new zf(n.parent,l,l+c,o[1],h,d,n))}}return s}function q5(i,e){return/^(\\s*)(\\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function Wf(i,e,t,s=0){for(let r=-1,n=i;;){if(n.name=="ListItem"){let a=q5(n,e);let l=+a[2];if(r>=0){if(l!=r+1)return;t.push({from:n.from+a[1].length,to:n.from+a[0].length,insert:String(r+2+s)})}r=l}let o=n.nextSibling;if(!o)break;n=o}}function O0(i,e){let t=/^[ \\t]*/.exec(i)[0].length;if(!t||e.facet(ph)!=" ")return i;let s=Fs(i,4,t);let r="";for(let n=s;n>0;){if(n>=4){r+=" ";n-=4}else{r+=" ";n--}}return r+i.slice(t)}const i9=(i={})=>({state:e,dispatch:t})=>{let s=We(e),{doc:r}=e;let n=null,o=e.changeByRange(a=>{if(!a.empty||!Md.isActiveAt(e,a.from,-1)&&!Md.isActiveAt(e,a.from,1))return n={range:a};let l=a.from,h=r.lineAt(l);let c=W5(s.resolveInner(l,-1),r);while(c.length&&c[c.length-1].from>l-h.from)c.pop();if(!c.length)return n={range:a};let d=c[c.length-1];if(d.to-d.spaceAfter.length>l-h.from)return n={range:a};let u=l>=d.to-d.spaceAfter.length&&!/\\S/.test(h.text.slice(d.to));if(d.item&&u){if(d.item.from]*$/.test(h.text.slice(0,d.to)))return n={range:a};let v=d.node.firstChild,T=d.node.getChild("ListItem","ListItem");if(v.to>=l||T&&T.to0&&!/[^\\s>]/.test(r.lineAt(h.from-1).text)||i.nonTightLists===false){let k=c.length>1?c[c.length-2]:null;let _,C="";if(k&&k.item){_=h.from+k.from;C=k.marker(r,1)}else{_=h.from+(k?k.to:0)}let w=[{from:_,to:l,insert:C}];if(d.node.name=="OrderedList")Wf(d.item,r,w,-2);if(k&&k.node.name=="OrderedList")Wf(k.item,r,w);return{range:z.cursor(_+C.length),changes:w}}else{let k=py(c,e,h);return{range:z.cursor(l+k.length+1),changes:{from:h.from,insert:k+e.lineBreak}}}}if(d.node.name=="Blockquote"&&u&&h.from){let v=r.lineAt(h.from-1),T=/>\\s*$/.exec(v.text);if(T&&T.index==d.from){let k=e.changes([{from:v.from+T.index,to:v.to},{from:h.from+d.from,to:h.to}]);return{range:a.map(k),changes:k}}}let f=[];if(d.node.name=="OrderedList")Wf(d.item,r,f);let p=d.item&&d.item.from]*/.exec(h.text)[0].length>=d.to){for(let v=0,T=c.length-1;v<=T;v++){m+=v==T&&!p?c[v].marker(r,1):c[v].blank(vh.from&&/\\s/.test(h.text.charAt(O-h.from-1)))O--;m=O0(m,e);if(r9(d.node,e.doc))m=py(c,e,h)+e.lineBreak+m;f.push({from:O,to:l,insert:e.lineBreak+m});return{range:z.cursor(O+m.length+1),changes:f}});if(n)return false;t(e.update(o,{scrollIntoView:true,userEvent:"input"}));return true};const s9=i9();function fy(i){return i.name=="QuoteMark"||i.name=="ListMark"}function r9(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return false;let t=i.firstChild,s=i.getChild("ListItem","ListItem");if(!s)return false;let r=e.lineAt(t.to),n=e.lineAt(s.from);let o=/^[\\s>]*$/.test(r.text);return r.number+(o?0:1){let t=We(i);let s=null,r=i.changeByRange(n=>{let o=n.from,{doc:a}=i;if(n.empty&&Md.isActiveAt(i,n.from)){let l=a.lineAt(o);let h=W5(n9(t,o),a);if(h.length){let c=h[h.length-1];let d=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-l.from>d&&!/\\S/.test(l.text.slice(d,o-l.from)))return{range:z.cursor(l.from+d),changes:{from:l.from+d,to:o}};if(o-l.from==d&&(c.item&&l.from<=c.item.from||/^[\\s>]*$/.test(l.text.slice(0,c.to)))){let u=l.from+c.from;if(c.item&&c.node.from{var t;let{main:s}=e.state.selection;if(s.empty)return false;let r=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\\/\\/|mailto:|xmpp:|www\\.)/.test(r))return false;if(/^www\\./.test(r))r="https://"+r;if(!Md.isActiveAt(e.state,s.from,1))return false;let n=We(e.state),o=false;n.iterate({from:s.from,to:s.to,enter:a=>{if(a.from>s.from||d9.test(a.name))o=true},leave:a=>{if(a.to=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102}const uB=new at((i,e)=>{let t;if(i.next<0){i.acceptToken(g9)}else if(e.context.flags&Wc){if(Xf(i.next))i.acceptToken(m9,1)}else if(((t=i.peek(-1))<0||Xf(t))&&e.canShift(my)){let s=0;while(i.next==_0||i.next==Su){i.advance();s++}if(i.next==ro||i.next==Yl||i.next==v0)i.acceptToken(my,-s)}else if(Xf(i.next)){i.acceptToken(p9,1)}},{contextual:true});const fB=new at((i,e)=>{let t=e.context;if(t.flags)return;let s=i.peek(-1);if(s==ro||s==Yl){let r=0,n=0;for(;;){if(i.next==_0)r++;else if(i.next==Su)r+=8-r%8;else break;i.advance();n++}if(r!=t.indent&&i.next!=ro&&i.next!=Yl&&i.next!=v0){if(r[i,e|V5]));const gB=new yu({start:pB,reduce(i,e,t,s){if(i.flags&Wc&&dB.has(e)||(e==A9||e==U5)&&i.flags&V5)return i.parent;return i},shift(i,e,t,s){if(e==N5)return new qc(i,mB(s.read(s.pos,t.pos)),0);if(e==F5)return i.parent;if(e==v9||e==w9||e==C9||e==Z5)return new qc(i,0,Wc);if(vy.has(e))return new qc(i,0,vy.get(e)|i.flags&Wc);return i},hash(i){return i.hash}});const OB=new at(i=>{for(let e=0;e<5;e++){if(i.next!="print".charCodeAt(e))return;i.advance()}if(/\\w/.test(String.fromCharCode(i.next)))return;for(let e=0;;e++){let t=i.peek(e);if(t==_0||t==Su)continue;if(t!=rB&&t!=nB&&t!=ro&&t!=Yl&&t!=v0)i.acceptToken(f9);return}});const _B=new at((i,e)=>{let{flags:t}=e.context;let s=t&sr?H5:j5;let r=(t&rr)>0;let n=!(t&nr);let o=(t&or)>0;let a=i.pos;for(;;){if(i.next<0){break}else if(o&&i.next==ng){if(i.peek(1)==ng){i.advance(2)}else{if(i.pos==a){i.acceptToken(Z5,1);return}break}}else if(n&&i.next==_y){if(i.pos==a){i.advance();let l=i.next;if(l>=0){i.advance();vB(i,l)}i.acceptToken(_9);return}break}else if(i.next==_y&&!n&&i.peek(1)>-1){i.advance(2)}else if(i.next==s&&(!r||i.peek(1)==s&&i.peek(2)==s)){if(i.pos==a){i.acceptToken(gy,r?3:1);return}break}else if(i.next==ro){if(r){i.advance()}else if(i.pos==a){i.acceptToken(gy);return}break}else{i.advance()}}if(i.pos>a)i.acceptToken(O9)});function vB(i,e){if(e==oB){for(let t=0;t<2&&i.next>=48&&i.next<=55;t++)i.advance()}else if(e==aB){for(let t=0;t<2&&Nf(i.next);t++)i.advance()}else if(e==hB){for(let t=0;t<4&&Nf(i.next);t++)i.advance()}else if(e==cB){for(let t=0;t<8&&Nf(i.next);t++)i.advance()}else if(e==lB){if(i.next==ng){i.advance();while(i.next>=0&&i.next!=Oy&&i.next!=j5&&i.next!=H5&&i.next!=ro)i.advance();if(i.next==Oy)i.advance()}}}const yB=Sr({'async "*" "**" FormatConversion FormatSpec':P.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":P.controlKeyword,"in not and or is del":P.operatorKeyword,"from def class global nonlocal lambda":P.definitionKeyword,import:P.moduleKeyword,"with as print":P.keyword,Boolean:P.bool,None:P.null,VariableName:P.variableName,"CallExpression/VariableName":P.function(P.variableName),"FunctionDefinition/VariableName":P.function(P.definition(P.variableName)),"ClassDefinition/VariableName":P.definition(P.className),PropertyName:P.propertyName,"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),Comment:P.lineComment,Number:P.number,String:P.string,FormatString:P.special(P.string),Escape:P.escape,UpdateOp:P.updateOperator,"ArithOp!":P.arithmeticOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,AssignOp:P.definitionOperator,Ellipsis:P.punctuation,At:P.meta,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,".":P.derefOperator,", ;":P.separator});const bB={__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};const SB=vr.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'#G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;=\`%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:[OB,fB,uB,_B,0,1,2,3,4],topRules:{"Script":[0,5]},specialized:[{term:221,get:i=>bB[i]||-1}],tokenPrec:7668});const yy=new HO;const Y5=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function nc(i){return(e,t,s)=>{if(s)return false;let r=e.node.getChild("VariableName");if(r)t(r,i);return true}}const wB={FunctionDefinition:nc("function"),ClassDefinition:nc("class"),ForStatement(i,e,t){if(t)for(let s=i.node.firstChild;s;s=s.nextSibling){if(s.name=="VariableName")e(s,"variable");else if(s.name=="in")break}},ImportStatement(i,e){var t,s;let{node:r}=i;let n=((t=r.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=r.getChild("import");o;o=o.nextSibling){if(o.name=="VariableName"&&((s=o.nextSibling)===null||s===void 0?void 0:s.name)!="as")e(o,n?"variable":"namespace")}},AssignStatement(i,e){for(let t=i.node.firstChild;t;t=t.nextSibling){if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break}},ParamList(i,e){for(let t=null,s=i.node.firstChild;s;s=s.nextSibling){if(s.name=="VariableName"&&(!t||!/\\*|AssignOp/.test(t.name)))e(s,"variable");t=s}},CapturePattern:nc("variable"),AsPattern:nc("variable"),__proto__:null};function G5(i,e){let t=yy.get(e);if(t)return t;let s=[],r=true;function n(o,a){let l=i.sliceString(o.from,o.to);s.push({label:l,type:a})}e.cursor(Ee.IncludeAnonymous).iterate(o=>{if(o.name){let a=wB[o.name];if(a&&a(o,n,r)||!r&&Y5.has(o.name))return false;r=false}else if(o.to-o.from>8192){for(let a of G5(i,o.node))s.push(a);return false}});yy.set(e,s);return s}const by=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/;const K5=["String","FormatString","Comment","PropertyName"];function xB(i){let e=We(i.state).resolveInner(i.pos,-1);if(K5.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&by.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent){if(Y5.has(r.name))s=s.concat(G5(i.state.doc,r))}return{options:s,from:t?e.from:i.pos,validFor:by}}const kB=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(i=>({label:i,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(i=>({label:i,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(i=>({label:i,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(i=>({label:i,type:"function"})));const CB=[Ke("def \${name}(\${params}):\\n \${}",{label:"def",detail:"function",type:"keyword"}),Ke("for \${name} in \${collection}:\\n \${}",{label:"for",detail:"loop",type:"keyword"}),Ke("while \${}:\\n \${}",{label:"while",detail:"loop",type:"keyword"}),Ke("try:\\n \${}\\nexcept \${error}:\\n \${}",{label:"try",detail:"/ except block",type:"keyword"}),Ke("if \${}:\\n \\n",{label:"if",detail:"block",type:"keyword"}),Ke("if \${}:\\n \${}\\nelse:\\n \${}",{label:"if",detail:"/ else block",type:"keyword"}),Ke("class \${name}:\\n def __init__(self, \${params}):\\n \${}",{label:"class",detail:"definition",type:"keyword"}),Ke("import \${module}",{label:"import",detail:"statement",type:"keyword"}),Ke("from \${module} import \${names}",{label:"from",detail:"import",type:"keyword"})];const TB=jk(K5,Uk(kB.concat(CB)));function Ff(i){let{node:e,pos:t}=i;let s=i.lineIndent(t,-1);let r=null;for(;;){let n=e.childBefore(t);if(!n){break}else if(n.name=="Comment"){t=n.from}else if(n.name=="Body"||n.name=="MatchBody"){if(i.baseIndentFor(n)+i.unit<=s)r=n;e=n}else if(n.name=="MatchClause"){e=n}else if(n.type.is("Statement")){e=n}else{break}}return r}function Zf(i,e){let t=i.baseIndentFor(e);let s=i.lineAt(i.pos,-1),r=s.from+s.text.length;if(/^\\s*($|#)/.test(s.text)&&i.node.tot)return null;return t+i.unit}const Uf=_r.define({name:"python",parser:SB.configure({props:[wr.add({Body:i=>{var e;let t=/^\\s*(#|$)/.test(i.textAfter)&&Ff(i)||i.node;return(e=Zf(i,t))!==null&&e!==void 0?e:i.continue()},MatchBody:i=>{var e;let t=Ff(i);return(e=Zf(i,t||i.node))!==null&&e!==void 0?e:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),"ForStatement WhileStatement":i=>/^\\s*else:/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except[ :]|finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),MatchStatement:i=>{if(/^\\s*case /.test(i.textAfter))return i.baseIndent+i.unit;return i.continue()},"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Ho({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Ho({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Ho({closing:"]"}),MemberExpression:i=>i.baseIndent+i.unit,"String FormatString":()=>null,Script:i=>{var e;let t=Ff(i);return(e=t&&Zf(i,t))!==null&&e!==void 0?e:i.continue()}}),xr.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":mh,Body:(i,e)=>({from:i.from+1,to:i.to-(i.to==e.doc.length?0:1)}),"String FormatString":(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.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 PB(){return new pn(Uf,[Uf.data.of({autocomplete:xB}),Uf.data.of({autocomplete:TB})])}const Qo=63;const Sy=64;const $B=1;const EB=2;const J5=3;const QB=4;const eC=5;const RB=6;const AB=7;const tC=65;const LB=66;const MB=8;const BB=9;const IB=10;const DB=11;const zB=12;const iC=13;const WB=19;const qB=20;const XB=29;const NB=33;const FB=34;const ZB=47;const UB=0;const y0=1;const og=2;const Gl=3;const ag=4;class Qn{constructor(e,t,s){this.parent=e;this.depth=t;this.type=s;this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+s}}Qn.top=new Qn(null,-1,UB);function Sl(i,e){for(let t=0,s=e-i.pos-1;;s--,t++){let r=i.peek(s);if(yr(r)||r==-1)return t}}function lg(i){return i==32||i==9}function yr(i){return i==10||i==13}function sC(i){return lg(i)||yr(i)}function In(i){return i<0||sC(i)}const jB=new yu({start:Qn.top,reduce(i,e){return i.type==Gl&&(e==qB||e==FB)?i.parent:i},shift(i,e,t,s){if(e==J5)return new Qn(i,Sl(s,s.pos),y0);if(e==tC||e==eC)return new Qn(i,Sl(s,s.pos),og);if(e==Qo)return i.parent;if(e==WB||e==NB)return new Qn(i,0,Gl);if(e==iC&&i.type==ag)return i.parent;if(e==ZB){let r=/[1-9]/.exec(s.read(s.pos,t.pos));if(r)return new Qn(i,i.depth+ +r[0],ag)}return i},hash(i){return i.hash}});function ca(i,e,t=0){return i.peek(t)==e&&i.peek(t+1)==e&&i.peek(t+2)==e&&In(i.peek(t+3))}const HB=new at((i,e)=>{if(i.next==-1&&e.canShift(Sy))return i.acceptToken(Sy);let t=i.peek(-1);if((yr(t)||t<0)&&e.context.type!=Gl){if(ca(i,45)){if(e.canShift(Qo))i.acceptToken(Qo);else return i.acceptToken($B,3)}if(ca(i,46)){if(e.canShift(Qo))i.acceptToken(Qo);else return i.acceptToken(EB,3)}let s=0;while(i.next==32){s++;i.advance()}if((s{if(e.context.type==Gl){if(i.next==63){i.advance();if(In(i.next))i.acceptToken(AB)}return}if(i.next==45){i.advance();if(In(i.next))i.acceptToken(e.context.type==y0&&e.context.depth==Sl(i,i.pos-1)?QB:J5)}else if(i.next==63){i.advance();if(In(i.next))i.acceptToken(e.context.type==og&&e.context.depth==Sl(i,i.pos-1)?RB:eC)}else{let t=i.pos;for(;;){if(lg(i.next)){if(i.pos==t)return;i.advance()}else if(i.next==33){rC(i)}else if(i.next==38){hg(i)}else if(i.next==42){hg(i);break}else if(i.next==39||i.next==34){if(b0(i,true))break;return}else if(i.next==91||i.next==123){if(!GB(i))return;break}else{nC(i,true,false,0);break}}while(lg(i.next))i.advance();if(i.next==58){if(i.pos==t&&e.canShift(XB))return;let s=i.peek(1);if(In(s))i.acceptTokenTo(e.context.type==og&&e.context.depth==Sl(i,t)?LB:tC,t)}}},{contextual:true});function YB(i){return i>32&&i<127&&i!=34&&i!=37&&i!=44&&i!=60&&i!=62&&i!=92&&i!=94&&i!=96&&i!=123&&i!=124&&i!=125}function wy(i){return i>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70}function xy(i,e){if(i.next==37){i.advance();if(wy(i.next))i.advance();if(wy(i.next))i.advance();return true}else if(YB(i.next)||e&&i.next==44){i.advance();return true}return false}function rC(i){i.advance();if(i.next==60){i.advance();for(;;){if(!xy(i,true)){if(i.next==62)i.advance();break}}}else{while(xy(i,false)){}}}function hg(i){i.advance();while(!In(i.next)&&Bd(i.next)!="f")i.advance()}function b0(i,e){let t=i.next,s=false,r=i.pos;i.advance();for(;;){let n=i.next;if(n<0)break;i.advance();if(n==t){if(n==39){if(i.next==39)i.advance();else break}else{break}}else if(n==92&&t==34){if(i.next>=0)i.advance()}else if(yr(n)){if(e)return false;s=true}else if(e&&i.pos>=r+1024){return false}}return!s}function GB(i){for(let e=[],t=i.pos+1024;;){if(i.next==91||i.next==123){e.push(i.next);i.advance()}else if(i.next==39||i.next==34){if(!b0(i,true))return false}else if(i.next==93||i.next==125){if(e[e.length-1]!=i.next-2)return false;e.pop();i.advance();if(!e.length)return true}else if(i.next<0||i.pos>t||yr(i.next)){return false}else{i.advance()}}}const KB="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Bd(i){if(i<33)return"u";if(i>125)return"s";return KB[i-33]}function jf(i,e){let t=Bd(i);return t!="u"&&!(e&&t=="f")}function nC(i,e,t,s){if(Bd(i.next)=="s"||(i.next==63||i.next==58||i.next==45)&&jf(i.peek(1),t)){i.advance()}else{return false}let r=i.pos;for(;;){let n=i.next,o=0,a=s+1;while(sC(n)){if(yr(n)){if(e)return false;a=0}else{a++}n=i.peek(++o)}let l=n>=0&&(n==58?jf(i.peek(o+1),t):n==35?i.peek(o-1)!=32:jf(n,t));if(!l||!t&&a<=s||a==0&&!t&&(ca(i,45,o)||ca(i,46,o)))break;if(e&&Bd(n)=="f")return false;for(let h=o;h>=0;h--)i.advance();if(e&&i.pos>r+1024)return false}return true}const JB=new at((i,e)=>{if(i.next==33){rC(i);i.acceptToken(zB)}else if(i.next==38||i.next==42){let t=i.next==38?IB:DB;hg(i);i.acceptToken(t)}else if(i.next==39||i.next==34){b0(i,false);i.acceptToken(BB)}else if(nC(i,false,e.context.type==Gl,e.context.depth)){i.acceptToken(MB)}});const eI=new at((i,e)=>{let t=e.context.type==ag?e.context.depth:-1,s=i.pos;e:for(;;){let r=0,n=i.next;while(n==32)n=i.peek(++r);if(!r&&(ca(i,45,r)||ca(i,46,r)))break;if(!yr(n)){if(t<0)t=Math.max(e.context.depth+1,r);if(rYAN>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#WO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R!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:jB,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[tI],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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&&e.fromi.pos)return null}}return null},FlowMapping:Ho({closing:"}"}),FlowSequence:Ho({closing:"]"})}),xr.add({"FlowMapping FlowSequence":mh,"Item Pair BlockLiteral":(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\\s*[\\]\\}]$/}});function rI(){return new pn(sI)}const ky=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i;class da{constructor(e,t,s=0,r=e.length,n,o){this.test=o;this.value={from:0,to:0,precise:false};this.done=false;this.matches=[];this.buffer="";this.bufferPos=0;this.iter=e.iterRange(s,r);this.bufferStart=s;this.normalize=n?a=>n(ky(a)):ky;this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){this.bufferStart+=this.buffer.length;this.iter.next();if(this.iter.done)return-1;this.bufferPos=0;this.buffer=this.iter.value}return Jw(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0){this.done=true;return this}let t=AE(e),s=this.bufferStart+this.bufferPos;this.bufferPos+=e2(e);let r=this.normalize(t);if(r.length)for(let n=0,o=s,a=true;;n++){let l=r.charCodeAt(n);let h=this.match(l,o,a,this.bufferPos+this.bufferStart,n==r.length-1);if(h){this.value=h;return this}if(n==r.length-1)break;if(a&&nthis.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1;if(this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let s=this.curLineStart+t.index,r=s+t[0].length;this.matchPos=Id(this.text,r+(s==r?1:0));if(s==this.curLineStart+this.curLine.length)this.nextLine();if((sthis.value.to)&&(!this.test||this.test(s,r,t))){this.value={from:s,to:r,precise:true,match:t};return this}e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=s||r.to<=t){let a=new Go(t,e.sliceString(t,s));Hf.set(e,a);return a}if(r.from==t&&r.to==s)return r;let{text:n,from:o}=r;if(o>t){n=e.sliceString(t,o)+n;o=t}if(r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from;let t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e){this.re.lastIndex=e+1;t=this.re.exec(this.flat.text)}if(t){let s=this.flat.from+t.index,r=s+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,r,t))){this.value={from:s,to:r,precise:true,match:t};this.matchPos=Id(this.text,r+(s==r?1:0));return this}}if(this.flat.to==this.to){this.done=true;return this}this.flat=Go.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol!="undefined"){aC.prototype[Symbol.iterator]=lC.prototype[Symbol.iterator]=function(){return this}}function nI(i){try{new RegExp(i,S0);return true}catch(e){return false}}function Id(i,e){if(e>=i.length)return e;let t=i.lineAt(e),s;while(e=56320&&s<57344)e++;return e}const oI=i=>{let{state:e}=i;let t=String(e.doc.lineAt(i.state.selection.main.head).number);let{close:s,result:r}=eR(i,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:true,submitLabel:e.phrase("go")});r.then(n=>{let o=n&&/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(n.elements["line"].value);if(!o){i.dispatch({effects:s});return}let a=e.doc.lineAt(e.selection.main.head);let[,l,h,c,d]=o;let u=c?+c.slice(1):0;let f=h?+h:a.number;if(h&&d){let O=f/100;if(l)O=O*(l=="-"?-1:1)+a.number/e.doc.lines;f=Math.round(e.doc.lines*O)}else if(h&&l){f=f*(l=="-"?-1:1)+a.number}let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f)));let m=z.cursor(p.from+Math.max(0,Math.min(u,p.length)));i.dispatch({effects:[s,J.scrollIntoView(m.from,{y:"center"})],selection:m})});return true};const aI={highlightWordAroundCursor:false,minSelectionLength:1,maxMatches:100,wholeWords:false};const lI=te.define({combine(i){return co(i,aI,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function hI(i){let e=[pI,fI];return e}const cI=fe.mark({class:"cm-selectionMatch"});const dI=fe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Cy(i,e,t,s){return(t==0||i(e.sliceDoc(t-1,t))!=ot.Word)&&(s==e.doc.length||i(e.sliceDoc(s,s+1))!=ot.Word)}function uI(i,e,t,s){return i(e.sliceDoc(t,t+1))==ot.Word&&i(e.sliceDoc(s-1,s))==ot.Word}const fI=Kt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){if(i.selectionSet||i.docChanged||i.viewportChanged)this.decorations=this.getDeco(i.view)}getDeco(i){let e=i.state.facet(lI);let{state:t}=i,s=t.selection;if(s.ranges.length>1)return fe.none;let r=s.main,n,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return fe.none;let l=t.wordAt(r.head);if(!l)return fe.none;o=t.charCategorizer(r.head);n=t.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return fe.none;if(e.wholeWords){n=t.sliceDoc(r.from,r.to);o=t.charCategorizer(r.head);if(!(Cy(o,t,r.from,r.to)&&uI(o,t,r.from,r.to)))return fe.none}else{n=t.sliceDoc(r.from,r.to);if(!n)return fe.none}}let a=[];for(let l of i.visibleRanges){let h=new da(t.doc,n,l.from,l.to);while(!h.next().done){let{from:c,to:d}=h.value;if(!o||Cy(o,t,c,d)){if(r.empty&&c<=r.from&&d>=r.to)a.push(dI.range(c,d));else if(c>=r.to||d<=r.from)a.push(cI.range(c,d));if(a.length>e.maxMatches)return fe.none}}}return fe.set(a)}},{decorations:i=>i.decorations});const pI=J.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const mI=({state:i,dispatch:e})=>{let{selection:t}=i;let s=z.create(t.ranges.map(r=>i.wordAt(r.head)||z.cursor(r.head)),t.mainIndex);if(s.eq(t))return false;e(i.update({selection:s}));return true};function gI(i,e){let{main:t,ranges:s}=i.selection;let r=i.wordAt(t.head),n=r&&r.from==t.from&&r.to==t.to;for(let o=false,a=new da(i.doc,e,s[s.length-1].to);;){a.next();if(a.done){if(o)return null;a=new da(i.doc,e,0,Math.max(0,s[s.length-1].from-1));o=true}else{if(o&&s.some(l=>l.from==a.value.from))continue;if(n){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}}const OI=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(n=>n.from===n.to))return mI({state:i,dispatch:e});let s=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(n=>i.sliceDoc(n.from,n.to)!=s))return false;let r=gI(i,s);if(!r)return false;e(i.update({selection:i.selection.addRange(z.range(r.from,r.to),false),effects:J.scrollIntoView(r.to)}));return true};const fo=te.define({combine(i){return co(i,{top:false,caseSensitive:false,literal:false,regexp:false,wholeWord:false,createPanel:e=>new RI(e),scrollToMatch:e=>J.scrollIntoView(e)})}});function _I(i){return i?[fo.of(i),dg]:dg}class hC{constructor(e){this.search=e.search;this.caseSensitive=!!e.caseSensitive;this.literal=!!e.literal;this.regexp=!!e.regexp;this.replace=e.replace||"";this.valid=!!this.search&&(!this.regexp||nI(this.search));this.unquoted=this.unquote(this.search);this.wholeWord=!!e.wholeWord;this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\\\([nrt\\\\])/g,(t,s)=>s=="n"?"\\n":s=="r"?"\\r":s=="t"?" ":"\\\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new xI(this):new bI(this)}getCursor(e,t=0,s){let r=e.doc?e:xe.create({doc:e});if(s==null)s=r.doc.length;return this.regexp?Ao(this,r,t,s):Ro(this,r,t,s)}}class cC{constructor(e){this.spec=e}}function vI(i,e,t){return(s,r,n,o)=>{if(t&&!t(s,r,n,o))return false;let a=s>=o&&r<=o+n.length?n.slice(s-o,r-o):e.doc.sliceString(s,r);return i(a,e,s,r)}}function Ro(i,e,t,s){let r;if(i.wholeWord)r=yI(e.doc,e.charCategorizer(e.selection.main.head));if(i.test)r=vI(i.test,e,r);return new da(e.doc,i.unquoted,t,s,i.caseSensitive?void 0:n=>n.toLowerCase(),r)}function yI(i,e){return(t,s,r,n)=>{if(n>t||n+r.length=t)return null;r.push(s.value)}return r}highlight(e,t,s,r){let n=Ro(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,e.doc.length));while(!n.next().done)r(n.value.from,n.value.to)}}function SI(i,e,t){return(s,r,n)=>{return(!t||t(s,r,n))&&i(n[0],e,s,r)}}function Ao(i,e,t,s){let r;if(i.wholeWord)r=wI(e.charCategorizer(e.selection.main.head));if(i.test)r=SI(i.test,e,r);return new aC(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:r},t,s)}function Dd(i,e){return i.slice(Rt(i,e,false),e)}function zd(i,e){return i.slice(e,Rt(i,e))}function wI(i){return(e,t,s)=>!s[0].length||(i(Dd(s.input,s.index))!=ot.Word||i(zd(s.input,s.index))!=ot.Word)&&(i(zd(s.input,s.index+s[0].length))!=ot.Word||i(Dd(s.input,s.index+s[0].length))!=ot.Word)}class xI extends cC{nextMatch(e,t,s){let r=Ao(this.spec,e,s,e.doc.length).next();if(r.done)r=Ao(this.spec,e,0,t).next();return r.done?null:r.value}prevMatchInRange(e,t,s){for(let r=1;;r++){let n=Math.max(t,s-r*1e4);let o=Ao(this.spec,e,n,s),a=null;while(!o.next().done)a=o.value;if(a&&(n==t||a.from>n+10))return a;if(n==t)return null}}prevMatch(e,t,s){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,s,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\\$([$&]|\\d+)/g,(t,s)=>{if(s=="&")return e.match[0];if(s=="$")return"$";for(let r=s.length;r>0;r--){let n=+s.slice(0,r);if(n>0&&n=t)return null;r.push(s.value)}return r}highlight(e,t,s,r){let n=Ao(this.spec,e,Math.max(0,t-250),Math.min(s+250,e.doc.length));while(!n.next().done)r(n.value.from,n.value.to)}}const Kl=Te.define();const w0=Te.define();const Jr=ji.define({create(i){return new Vf(cg(i).create(),null)},update(i,e){for(let t of e.effects){if(t.is(Kl))i=new Vf(t.value.create(),i.panel);else if(t.is(w0))i=new Vf(i.query,t.value?x0:null)}return i},provide:i=>bd.from(i,e=>e.panel)});class Vf{constructor(e,t){this.query=e;this.panel=t}}const kI=fe.mark({class:"cm-searchMatch"});const CI=fe.mark({class:"cm-searchMatch cm-searchMatch-selected"});const TI=Kt.fromClass(class{constructor(i){this.view=i;this.decorations=this.highlight(i.state.field(Jr))}update(i){let e=i.state.field(Jr);if(e!=i.startState.field(Jr)||i.docChanged||i.selectionSet||i.viewportChanged)this.decorations=this.highlight(e)}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return fe.none;let{view:t}=this;let s=new Yn;for(let r=0,n=t.visibleRanges,o=n.length;rn[r+1].from-2*250)l=n[++r].to;i.highlight(t.state,a,l,(h,c)=>{let d=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);s.add(h,c,d?CI:kI)})}return s.finish()}},{decorations:i=>i.decorations});function vh(i){return e=>{let t=e.state.field(Jr,false);return t&&t.query.spec.valid?i(e,t):fC(e)}}const Wd=vh((i,{query:e})=>{let{to:t}=i.state.selection.main;let s=e.nextMatch(i.state,t,t);if(!s)return false;let r=z.single(s.from,s.to);let n=i.state.facet(fo);i.dispatch({selection:r,effects:[k0(i,s),n.scrollToMatch(r.main,i)],userEvent:"select.search"});uC(i);return true});const qd=vh((i,{query:e})=>{let{state:t}=i,{from:s}=t.selection.main;let r=e.prevMatch(t,s,s);if(!r)return false;let n=z.single(r.from,r.to);let o=i.state.facet(fo);i.dispatch({selection:n,effects:[k0(i,r),o.scrollToMatch(n.main,i)],userEvent:"select.search"});uC(i);return true});const PI=vh((i,{query:e})=>{let t=e.matchAll(i.state,1e3);if(!t||!t.length)return false;i.dispatch({selection:z.create(t.map(s=>z.range(s.from,s.to))),userEvent:"select.search.matches"});return true});const $I=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return false;let{from:s,to:r}=t.main;let n=[],o=0;for(let a=new da(i.doc,i.sliceDoc(s,r));!a.next().done;){if(n.length>1e3)return false;if(a.value.from==s)o=n.length;n.push(z.range(a.value.from,a.value.to))}e(i.update({selection:z.create(n,o),userEvent:"select.search.matches"}));return true};const Ty=vh((i,{query:e})=>{let{state:t}=i,{from:s,to:r}=t.selection.main;if(t.readOnly)return false;let n=e.nextMatch(t,s,s);if(!n)return false;let o=n;let a=[],l,h;let c=[];if(!o.precise){o=e.nextMatch(t,o.from,o.to)}else if(o.from==s&&o.to==r){h=t.toText(e.getReplacement(o));a.push({from:o.from,to:o.to,insert:h});o=e.nextMatch(t,o.from,o.to);c.push(J.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(s).number)+"."))}let d=i.state.changes(a);if(o){l=z.single(o.from,o.to).map(d);c.push(k0(i,o));c.push(t.facet(fo).scrollToMatch(l.main,i))}i.dispatch({changes:d,selection:l,effects:c,userEvent:"input.replace"});return true});const EI=vh((i,{query:e})=>{if(i.state.readOnly)return false;let t=[];for(let r of e.matchAll(i.state,1e9)){let{from:n,to:o,precise:a}=r;if(a)t.push({from:n,to:o,insert:e.getReplacement(r)})}if(!t.length)return false;let s=i.state.phrase("replaced $ matches",t.length)+".";i.dispatch({changes:t,effects:J.announce.of(s),userEvent:"input.replace.all"});return true});function x0(i){return i.state.facet(fo).createPanel(i)}function cg(i,e){var t,s,r,n,o;let a=i.selection.main;let l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!l)return e;let h=i.facet(fo);return new hC({search:((t=e===null||e===void 0?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?l:l.replace(/\\n/g,"\\\\n"),caseSensitive:(s=e===null||e===void 0?void 0:e.caseSensitive)!==null&&s!==void 0?s:h.caseSensitive,literal:(r=e===null||e===void 0?void 0:e.literal)!==null&&r!==void 0?r:h.literal,regexp:(n=e===null||e===void 0?void 0:e.regexp)!==null&&n!==void 0?n:h.regexp,wholeWord:(o=e===null||e===void 0?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function dC(i){let e=px(i,x0);return e&&e.dom.querySelector("[main-field]")}function uC(i){let e=dC(i);if(e&&e==i.root.activeElement)e.select()}const fC=i=>{let e=i.state.field(Jr,false);if(e&&e.panel){let t=dC(i);if(t&&t!=i.root.activeElement){let s=cg(i.state,e.query.spec);if(s.valid)i.dispatch({effects:Kl.of(s)});t.focus();t.select()}}else{i.dispatch({effects:[w0.of(true),e?Kl.of(cg(i.state,e.query.spec)):Te.appendConfig.of(dg)]})}return true};const pC=i=>{let e=i.state.field(Jr,false);if(!e||!e.panel)return false;let t=px(i,x0);if(t&&t.dom.contains(i.root.activeElement))i.focus();i.dispatch({effects:w0.of(false)});return true};const QI=[{key:"Mod-f",run:fC,scope:"editor search-panel"},{key:"F3",run:Wd,shift:qd,scope:"editor search-panel",preventDefault:true},{key:"Mod-g",run:Wd,shift:qd,scope:"editor search-panel",preventDefault:true},{key:"Escape",run:pC,scope:"editor search-panel"},{key:"Mod-Shift-l",run:$I},{key:"Mod-Alt-g",run:oI},{key:"Mod-d",run:OI,preventDefault:true}];class RI{constructor(e){this.view=e;let t=this.query=e.state.field(Jr).query.spec;this.commit=this.commit.bind(this);this.searchField=wt("input",{value:t.search,placeholder:Si(e,"Find"),"aria-label":Si(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit});this.replaceField=wt("input",{value:t.replace,placeholder:Si(e,"Replace"),"aria-label":Si(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit});this.caseField=wt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit});this.reField=wt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit});this.wordField=wt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function s(r,n,o){return wt("button",{class:"cm-button",name:r,onclick:n,type:"button"},o)}this.dom=wt("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,s("next",()=>Wd(e),[Si(e,"next")]),s("prev",()=>qd(e),[Si(e,"previous")]),s("select",()=>PI(e),[Si(e,"all")]),wt("label",null,[this.caseField,Si(e,"match case")]),wt("label",null,[this.reField,Si(e,"regexp")]),wt("label",null,[this.wordField,Si(e,"by word")]),...e.state.readOnly?[]:[wt("br"),this.replaceField,s("replace",()=>Ty(e),[Si(e,"replace")]),s("replaceAll",()=>EI(e),[Si(e,"replace all")])],wt("button",{name:"close",onclick:()=>pC(e),"aria-label":Si(e,"close"),type:"button"},["×"])])}commit(){let e=new hC({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query)){this.query=e;this.view.dispatch({effects:Kl.of(e)})}}keydown(e){if(AQ(this.view,e,"search-panel")){e.preventDefault()}else if(e.keyCode==13&&e.target==this.searchField){e.preventDefault();(e.shiftKey?qd:Wd)(this.view)}else if(e.keyCode==13&&e.target==this.replaceField){e.preventDefault();Ty(this.view)}}update(e){for(let t of e.transactions)for(let s of t.effects){if(s.is(Kl)&&!s.value.eq(this.query))this.setQuery(s.value)}}setQuery(e){this.query=e;this.searchField.value=e.search;this.replaceField.value=e.replace;this.caseField.checked=e.caseSensitive;this.reField.checked=e.regexp;this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(fo).top}}function Si(i,e){return i.state.phrase(e)}const oc=30;const ac=/[\\s\\.,:;?!]/;function k0(i,{from:e,to:t}){let s=i.state.doc.lineAt(e),r=i.state.doc.lineAt(t).to;let n=Math.max(s.from,e-oc),o=Math.min(r,t+oc);let a=i.state.sliceDoc(n,o);if(n!=s.from){for(let l=0;la.length-oc;l--)if(!ac.test(a[l-1])&&ac.test(a[l])){a=a.slice(0,l);break}}return J.announce.of(\`\${i.state.phrase("current match")}. \${a} \${i.state.phrase("on line")} \${s.number}.\`)}const AI=J.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"}});const dg=[Jr,ho.low(TI),AI];function LI(i){mC(i,"start");var e={},t=i.languageData||{},s=false;for(var r in i)if(r!=t&&i.hasOwnProperty(r)){var n=e[r]=[],o=i[r];for(var a=0;a2&&o.token&&typeof o.token!="string"){t.pending=[];for(var h=2;h-1)return null;var r=t.indent.length-1,n=i[t.state];e:for(;;){for(var o=0;o1)i.eat("$");var t=i.next();if(/['"({]/.test(t)){e.tokens[0]=xu(t,t=="("?"quote":t=="{"?"def":"string");return ua(i,e)}if(!/\\d/.test(t))i.eatWhile(/\\w/);e.tokens.shift();return"def"};function rD(i){return function(e,t){if(e.sol()&&e.string==i)t.tokens.shift();e.skipToEnd();return"string.special"}}function ua(i,e){return(e.tokens[0]||iD)(i,e)}const nD={name:"shell",startState:function(){return{tokens:[]}},token:function(i,e){return ua(i,e)},languageData:{autocomplete:yC.concat(bC,SC),closeBrackets:{brackets:["(","[","{","'",'"',"\`"]},commentTokens:{line:"#"}}};const oD={name:"toml",startState:function(){return{inString:false,stringType:"",lhs:true,inArray:0}},token:function(i,e){let t;if(!e.inString&&(t=i.match(/^('''|"""|'|")/))){e.stringType=t[0];e.inString=true}if(i.sol()&&!e.inString&&e.inArray===0){e.lhs=true}if(e.inString){while(e.inString){if(i.match(e.stringType)){e.inString=false}else if(i.peek()==="\\\\"){i.next();i.next()}else if(i.eol()){break}else{i.match(/^.[^\\\\\\"\\']*/)}}return e.lhs?"property":"string"}else if(e.inArray&&i.peek()==="]"){i.next();e.inArray--;return"bracket"}else if(e.lhs&&i.peek()==="["&&i.skipTo("]")){i.next();if(i.peek()==="]")i.next();return"atom"}else if(i.peek()==="#"){i.skipToEnd();return"comment"}else if(i.eatSpace()){return null}else if(e.lhs&&i.eatWhile(function(s){return s!="="&&s!=" "})){return"property"}else if(e.lhs&&i.peek()==="="){i.next();e.lhs=false;return null}else if(!e.lhs&&i.match(/^\\d\\d\\d\\d[\\d\\-\\:\\.T]*Z/)){return"atom"}else if(!e.lhs&&(i.match("true")||i.match("false"))){return"atom"}else if(!e.lhs&&i.peek()==="["){e.inArray++;i.next();return"bracket"}else if(!e.lhs&&i.match(/^\\-?\\d+(?:\\.\\d+)?/)){return"number"}else if(!i.eatSpace()){i.next()}return null},languageData:{commentTokens:{line:"#"}}};const aD=J.theme({"&":{height:"100%",fontSize:"12.5px",backgroundColor:"var(--bg-terminal)",color:"var(--text)"},".cm-scroller":{fontFamily:"var(--font-code)",lineHeight:"1.55",overflow:"auto"},".cm-content":{caretColor:"var(--accent)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--accent)",borderLeftWidth:"2px"},"&.cm-focused > .cm-scroller > .cm-layer.cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--accent-bg)"},"&.cm-focused":{outline:"none"},".cm-gutters":{backgroundColor:"var(--bg)",color:"var(--text-dim)",border:"none",borderRight:"1px solid var(--border)"},".cm-activeLine":{backgroundColor:"var(--bg-elevated)"},".cm-activeLineGutter":{backgroundColor:"var(--bg-elevated)",color:"var(--text-muted)"},".cm-foldGutter span":{color:"var(--text-dim)"},".cm-foldGutter span:hover":{color:"var(--accent)"},".cm-selectionMatch":{backgroundColor:"var(--accent-bg)"},".cm-searchMatch":{backgroundColor:"var(--accent-bg)",outline:"1px solid var(--accent-secondary)"},".cm-searchMatch-selected":{backgroundColor:"var(--accent-secondary-light)"},".cm-panels":{backgroundColor:"var(--bg-elevated)",color:"var(--text)",border:"1px solid var(--border)"},".cm-panel input, .cm-panel button":{background:"var(--bg-surface)",color:"var(--text)",border:"1px solid var(--border)",borderRadius:"var(--control-radius, 6px)"},".cm-tooltip":{backgroundColor:"var(--bg-elevated)",color:"var(--text)",border:"1px solid var(--border)"}});const lD=nA(AR,{fallback:true});function hD(i){const e=i.toLowerCase();const t=e.lastIndexOf(".");const s=t>0?e.slice(t+1):"";switch(s){case"js":case"mjs":case"cjs":case"jsx":return Dc();case"ts":case"mts":case"cts":return Dc({typescript:true});case"tsx":return Dc({typescript:true,jsx:true});case"json":return wM();case"yml":case"yaml":return rI();case"py":return PB();case"md":case"markdown":return l9();case"html":case"htm":return p5();case"css":case"less":case"scss":return Lk();case"sh":case"bash":case"zsh":case"ksh":return Xr.define(nD);case"conf":case"ini":case"cfg":case"cnf":case"env":case"properties":return Xr.define(Ey);case"toml":return Xr.define(oD);case"lua":return Xr.define(tD);default:if(e==="dockerfile")return Xr.define(jI);if(e.endsWith(".service")||e.endsWith(".socket")||e.endsWith(".timer")){return Xr.define(Ey)}return[]}}const xC="cloudssh_editor_wrap";function cD(){if(typeof window==="undefined")return false;return window.matchMedia("(pointer: coarse)").matches||window.innerWidth<=520}function dD(){try{const i=window.localStorage.getItem(xC);if(i==="on")return true;if(i==="off")return false}catch{}return null}function uD(i){try{window.localStorage.setItem(xC,i?"on":"off")}catch{}}class fD{constructor(e){b(this,"dialog");b(this,"view");b(this,"options");b(this,"statusEl");b(this,"saveButton");b(this,"wrapCompartment",new ch);b(this,"wrapButton",null);b(this,"wrapEnabled",false);b(this,"baseline");b(this,"saving",false);b(this,"closed",false);this.options=e;this.baseline=e.content.text;this.wrapEnabled=dD()??cD();this.dialog=this.buildDialog();document.body.appendChild(this.dialog);const t=this.dialog.querySelector(".remote-editor__body");const s=this.dialog.querySelector(".remote-editor__title");const r=this.dialog.querySelector(".remote-editor__path");const n=this.dialog.querySelector(".remote-editor__notice");this.statusEl=this.dialog.querySelector(".remote-editor__status");const o=this.dialog.querySelector(".remote-editor__close");const a=this.dialog.querySelector(".remote-editor__button--cancel");this.saveButton=this.dialog.querySelector(".remote-editor__button--save");this.wrapButton=this.dialog.querySelector(".remote-editor__button--wrap");s.textContent=e.filename;r.textContent=e.path;if(e.readOnly){n.textContent=e.notice??"";n.hidden=!n.textContent}a.textContent=g("common.close");this.saveButton.textContent=g("common.save");this.saveButton.disabled=e.readOnly;Ds(this.dialog);o.addEventListener("click",()=>void this.requestClose());a.addEventListener("click",()=>void this.requestClose());this.saveButton.addEventListener("click",()=>void this.requestSave());this.wrapButton.addEventListener("click",()=>this.toggleWrap());this.dialog.addEventListener("cancel",l=>{l.preventDefault();void this.requestClose()});this.dialog.addEventListener("close",()=>this.destroy());this.view=new J({parent:t,state:this.buildState()});this.updateStatus();this.syncWrapButton();this.dialog.showModal();this.view.focus()}buildDialog(){const e=document.createElement("dialog");e.className="remote-editor";e.setAttribute("aria-label",g("sftp.editorTitle",{name:this.options.filename}));e.innerHTML=\`
@@ -669,7 +669,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro

- \`;return e}buildState(){const e=[dR(),sA(),AA(),zQ(),FQ(),pA(),ZR(),_I({top:true}),hI(),YQ(),JQ(),lD,aD,du.of([{key:"Mod-s",preventDefault:true,run:()=>{void this.requestSave();return true}},...M8,...QI,...XA,...JR,B8]),hD(this.options.filename),this.wrapCompartment.of(this.wrapEnabled?J.lineWrapping:[]),J.updateListener.of(t=>{if(t.docChanged)this.updateStatus()})];if(this.options.readOnly){e.push(we.readOnly.of(true),J.editable.of(false))}return we.create({doc:this.options.content.text,extensions:e})}isDirty(){return this.view.state.doc.toString()!==this.baseline}getContent(){return this.view.state.doc.toString()}markSaved(){this.baseline=this.view.state.doc.toString();this.updateStatus()}focus(){if(!this.closed)this.view.focus()}toggleWrap(){this.wrapEnabled=!this.wrapEnabled;this.view.dispatch({effects:this.wrapCompartment.reconfigure(this.wrapEnabled?J.lineWrapping:[])});uD(this.wrapEnabled);this.syncWrapButton();this.view.focus()}syncWrapButton(){var e;(e=this.wrapButton)==null?void 0:e.setAttribute("aria-pressed",String(this.wrapEnabled))}close(){this.destroy()}updateStatus(){if(this.closed)return;const e=this.options.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const t=this.options.content.eol==="\\r\\n"?"CRLF":"LF";const s=this.isDirty()?g("sftp.editorStatusDirty"):g("sftp.editorStatusSaved");this.statusEl.textContent=\`\${e} · \${t} · \${s}\`;if(!this.options.readOnly&&!this.saving){this.saveButton.disabled=!this.isDirty()}}async requestSave(){if(this.closed||this.saving||this.options.readOnly)return;if(!this.isDirty()){Y(g("sftp.editorNoChanges"));return}this.saving=true;this.saveButton.disabled=true;const e=this.saveButton.textContent;this.saveButton.textContent=g("sftp.editorSaving");try{const t=await this.options.onSave();if(t)this.baseline=this.view.state.doc.toString()}finally{this.saving=false;this.saveButton.disabled=this.options.readOnly||!this.isDirty();this.saveButton.textContent=e??g("common.save");this.updateStatus()}}async requestClose(){if(this.closed)return;if(this.saving){Y(g("sftp.editorSavingWait"));return}if(this.isDirty()&&!this.options.readOnly){const e=await Ui({title:g("sftp.editorDirtyTitle"),message:g("sftp.editorDirtyMessage",{name:this.options.filename}),confirmText:g("sftp.editorDiscard"),cancelText:g("common.cancel"),variant:"danger"});if(!e){this.focus();return}}this.destroy()}destroy(){if(this.closed)return;this.closed=true;this.view.destroy();this.dialog.close();this.dialog.remove();this.options.onClose()}}function pD(i){return new fD(i)}const kC=2*1024*1024;const mD=8192;function gD(i,e=mD){const t=Math.min(i.length,e);for(let s=0;s=0&&i<=kC}function Yf(i,e){return(i.match(e)||[]).length}function Qy(i){const e=Yf(i,/\\r\\n/g);const t=Yf(i,/\\n/g)-e;const s=Yf(i,/\\r/g)-e;return e>t+s?"\\r\\n":"\\n"}function _D(i){if(gD(i)){return{ok:false,reason:"binary"}}const e=i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191;const t=e?i.subarray(3):i;try{const s=new TextDecoder("utf-8",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"utf-8",bom:e,eol:r}}}catch{}try{const s=new TextDecoder("gb18030",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"gb18030",bom:e,eol:r}}}catch{return{ok:false,reason:"encoding"}}}function vD(i,e){const t=e.eol==="\\r\\n"?i.split("\\n").join("\\r\\n"):i;const s=new TextEncoder().encode(t);if(!e.bom)return s;const r=new Uint8Array(s.length+3);r[0]=239;r[1]=187;r[2]=191;r.set(s,3);return r}function yD(i){const e=i.startsWith("/")?i:\`/\${i}\`;const t=e.split("/").filter(Boolean);const s=[{name:"/",path:"/"}];let r="";for(const n of t){r+=\`/\${n}\`;s.push({name:n,path:r})}return s}function bD(i,e){return[...i].sort((t,s)=>{if(t.isDir&&!s.isDir)return-1;if(!t.isDir&&s.isDir)return 1;let r=0;if(e.field==="name"){r=t.name.localeCompare(s.name)}else if(e.field==="size"){const n=t.isDir?0:t.size??0;const o=s.isDir?0:s.size??0;r=n-o}else if(e.field==="mtime"){const n=t.modifiedTime??0;const o=s.modifiedTime??0;r=n-o}if(r===0){return t.name.localeCompare(s.name)}return e.direction==="asc"?r:-r})}function SD(i){var t;const e=((t=i.split(".").pop())==null?void 0:t.toLowerCase())||"";switch(e){case"js":case"ts":case"jsx":case"tsx":return"javascript";case"py":return"code";case"sh":case"bash":case"zsh":return"terminal";case"json":case"yaml":case"yml":case"toml":return"data_object";case"md":case"txt":case"log":return"description";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"image";case"mp4":case"mkv":case"avi":case"mov":return"movie";case"mp3":case"wav":case"ogg":return"audio_file";case"zip":case"tar":case"gz":case"bz2":case"xz":case"7z":return"folder_zip";case"pdf":return"picture_as_pdf";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"go":case"rs":case"c":case"h":case"cpp":case"hpp":case"java":case"kt":case"rb":case"php":case"xml":return"code";case"sql":return"database";case"conf":case"cfg":case"ini":case"env":return"settings";default:return"draft"}}function fg(i){if(i<1024)return\`\${i} B\`;if(i<1024*1024)return\`\${(i/1024).toFixed(1)} KB\`;if(i<1024*1024*1024)return\`\${(i/(1024*1024)).toFixed(1)} MB\`;return\`\${(i/(1024*1024*1024)).toFixed(1)} GB\`}function wD(i){if(!i)return"";const e=new Date(i*1e3);const t=new Date;const s=new Date(t);s.setMonth(s.getMonth()-6);const r=n=>n.toString().padStart(2,"0");if(e>s){return\`\${r(e.getMonth()+1)}-\${r(e.getDate())} \${r(e.getHours())}:\${r(e.getMinutes())}\`}return\`\${r(e.getMonth()+1)}-\${r(e.getDate())} \${e.getFullYear()}\`}function xD(i){return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}class en{constructor(){b(this,"promise");b(this,"resolve");b(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e;this.reject=t})}}class kD{constructor(){b(this,"ready",null);b(this,"progress",null);b(this,"complete",null);b(this,"progressQueue",[]);b(this,"progressQueueHead",0)}waitReady(){this.ready=new en;return this.ready.promise}resolveReady(){var e;(e=this.ready)==null?void 0:e.resolve({status:"ready"});this.ready=null}resolveConflict(e){var t;(t=this.ready)==null?void 0:t.resolve({status:"conflict",conflict:e});this.ready=null}waitProgress(){const e=this.progressQueue[this.progressQueueHead];if(e!==void 0){this.progressQueueHead++;this.compactProgressQueue();return Promise.resolve(e)}this.progress=new en;return this.progress.promise}resolveProgress(e){if(this.progress){this.progress.resolve(e);this.progress=null;return}this.progressQueue.push(e)}waitComplete(){this.complete=new en;return this.complete.promise}resolveComplete(){var e;(e=this.complete)==null?void 0:e.resolve();this.reset()}reject(e){var s,r,n;const t=new Error(e);(s=this.ready)==null?void 0:s.reject(t);(r=this.progress)==null?void 0:r.reject(t);(n=this.complete)==null?void 0:n.reject(t);this.reset()}reset(){this.ready=null;this.progress=null;this.complete=null;this.progressQueue=[];this.progressQueueHead=0}compactProgressQueue(){if(this.progressQueueHead>32&&this.progressQueueHead*2>this.progressQueue.length){this.progressQueue=this.progressQueue.slice(this.progressQueueHead);this.progressQueueHead=0}}}const CD=3e4;const TD=15e3;function Ry(i,e){return e!==null||i!==void 0}class PD{constructor(e){b(this,"activeEditor",null);b(this,"editReadActive",false);b(this,"editReadChunks",[]);b(this,"editReadMeta",null);b(this,"editReadWaiter",null);b(this,"editReadTimeout",null);b(this,"statWaiter",null);b(this,"statTimeout",null);this.ctx=e}hasActiveEditor(){return this.activeEditor!==null}getActiveEditor(){return this.activeEditor}isEditReadActive(){return this.editReadActive}hasPendingEditRead(){return this.editReadWaiter!==null}handleBinaryData(e){if(this.editReadActive){this.editReadChunks.push(e);return true}return false}onEditStart(e,t,s){this.editReadMeta={path:e,size:t,mtime:s};this.editReadChunks=[]}onEditDone(e,t,s){this.resolveEditRead({ok:true,path:e,bytes:this.concatEditChunks(),mtime:s,size:t})}onEditError(e,t,s){this.rejectEditRead(e,t);if(!s){this.ctx.showError(e)}}onStatAttrs(e){this.resolveStatWaiter(e)}onStatError(){if(this.statWaiter){this.resolveStatWaiter(null)}}async openEditorForFile(e,t,s,r={}){const n=r.fallbackToDownload===true;if(this.activeEditor){this.activeEditor.handle.focus();Y(g("sftp.editorAlreadyOpen"),{variant:"warning"});return}if(this.editReadActive){Y(g("sftp.editorLoadingOther"),{variant:"info"});return}if(!OD(s)){if(n){this.ctx.queueDownloadFile(e,t);return}Y(g("sftp.editorTooLarge",{name:t,size:fg(s),max:fg(kC)}),{variant:"danger"});return}this.editReadActive=true;this.editReadChunks=[];this.editReadMeta=null;const o=new en;this.editReadWaiter=o;this.editReadTimeout=setTimeout(()=>{if(this.editReadWaiter===o){this.editReadWaiter=null;o.resolve({ok:false,path:e,bytes:new Uint8Array(0),mtime:0,size:0,errorMessage:g("sftp.editorLoadTimeout")})}},CD);this.ctx.setStatus(g("sftp.editorLoading",{name:t}));try{this.ctx.sendJSON({type:"sftp_edit_read",path:e});const a=await o.promise;if(!a.ok){if(a.errorMessage){if(n&&Ry(a.errorCode,null)){this.ctx.queueDownloadFile(e,t);return}Y(a.errorMessage,{variant:"danger"})}return}const l=_D(a.bytes);if(!l.ok){if(n&&Ry(void 0,l.reason)){this.ctx.queueDownloadFile(e,t);return}Y(l.reason==="binary"?g("sftp.editorBinary"):g("sftp.editorEncodingUnsupported"),{variant:"warning"});return}const h=l.content.encoding!=="utf-8";const c=l.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const d=pD({filename:t,path:e,content:l.content,readOnly:h,notice:h?g("sftp.editorReadOnlyNotice",{encoding:c}):void 0,onSave:()=>this.saveActiveEditor(),onClose:()=>{this.activeEditor=null;if(this.ctx.isVisible()&&this.ctx.isSftpReady()){this.ctx.refresh()}}});this.activeEditor={path:e,filename:t,encoding:l.content.encoding,bom:l.content.bom,eol:l.content.eol,mtime:a.mtime,size:a.size,handle:d}}catch(a){Y(g("sftp.editorLoadFailed",{message:a instanceof Error?a.message:String(a)}),{variant:"danger"})}finally{this.editReadActive=false;this.editReadChunks=[];this.editReadMeta=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}this.ctx.setIdleStatus(this.ctx.getItemsStatus())}}async saveActiveEditor(){const e=this.activeEditor;if(!e)return false;if(!this.ctx.isSftpReady()){Y(g("sftp.editorSaveFailed",{message:g("sftp.disconnected")}),{variant:"danger"});return false}const t=e.handle.getContent();const s=await this.statRemote(e.path);if(s.ok){if(s.mtime!==e.mtime||s.size!==e.size){const h=await Ui({title:g("sftp.editorRemoteChangedTitle"),message:g("sftp.editorRemoteChangedMessage",{name:e.filename}),confirmText:g("sftp.editorOverwrite"),cancelText:g("common.cancel"),variant:"danger"});if(!h)return false}}else{const h=await Ui({title:g("sftp.editorUnverifiableTitle"),message:g("sftp.editorUnverifiableMessage",{name:e.filename}),confirmText:g("sftp.editorOverwrite"),cancelText:g("common.cancel"),variant:"danger"});if(!h)return false}const r=vD(t,{bom:e.bom,eol:e.eol});const n=new File([r],e.filename);const o=e.path.slice(0,e.path.lastIndexOf("/"))||"/";let a;try{a=await this.ctx.enqueueUploadTask(n,o,{overwriteFirst:true,reportError:false})}catch(h){Y(g("sftp.editorSaveFailed",{message:h instanceof Error?h.message:String(h)}),{variant:"danger"});return false}if(!a){Y(g("sftp.editorSaveFailed",{message:g("sftp.uploadCancelled")}),{variant:"danger"});return false}const l=await this.statRemote(e.path);if(l.ok){e.mtime=l.mtime;e.size=l.size}else{e.mtime=-1;e.size=-1}e.handle.markSaved();Y(g("sftp.editorSaved",{name:e.filename}),{variant:"success"});return true}statRemote(e){if(this.statWaiter){return Promise.resolve({ok:false,mtime:0,size:0})}const t=new en;this.statWaiter=t;this.statTimeout=setTimeout(()=>{if(this.statWaiter===t){this.statWaiter=null;t.resolve({ok:false,mtime:0,size:0})}},TD);void t.promise.then(()=>this.clearStatTimeout()).catch(()=>this.clearStatTimeout());this.ctx.sendJSON({type:"sftp_stat",path:e});return t.promise}clearStatTimeout(){if(this.statTimeout){clearTimeout(this.statTimeout);this.statTimeout=null}}resolveStatWaiter(e){const t=this.statWaiter;this.statWaiter=null;this.clearStatTimeout();if(!t)return;if(e&&typeof e==="object"){t.resolve({ok:true,mtime:Number(e.modifiedTime)||0,size:Number(e.size)||0})}else{t.resolve({ok:false,mtime:0,size:0})}}resolveEditRead(e){const t=this.editReadWaiter;this.editReadWaiter=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}t==null?void 0:t.resolve(e)}rejectEditRead(e,t){var r;const s=this.editReadWaiter;this.editReadWaiter=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}s==null?void 0:s.resolve({ok:false,path:((r=this.editReadMeta)==null?void 0:r.path)||"",bytes:new Uint8Array(0),mtime:0,size:0,errorMessage:e,errorCode:t})}concatEditChunks(){const e=this.editReadChunks.reduce((r,n)=>r+n.length,0);const t=new Uint8Array(e);let s=0;for(const r of this.editReadChunks){t.set(r,s);s+=r.length}return t}closeActiveEditor(){if(this.activeEditor){this.activeEditor.handle.close();this.activeEditor=null}}resetEditState(){this.closeActiveEditor();if(this.editReadWaiter){this.rejectEditRead(g("sftp.disconnected"))}if(this.statWaiter){this.resolveStatWaiter(null)}this.editReadActive=false;this.editReadChunks=[];this.editReadMeta=null}dispose(){this.resetEditState()}}function $D(i,e,t,s,r){const n=Math.min(Math.max(0,e),Math.max(0,s-1));const o=r.additive?new Set(i):new Set;if(r.range&&t!==null){const a=Math.min(t,n);const l=Math.max(t,n);for(let h=a;h<=l;h++)o.add(h)}else if(r.additive&&o.has(n)){o.delete(n)}else{o.add(n)}return{selected:o,anchor:n}}function P0(i){if(i==="."||i==="..")return g("sftp.invalidName");if(i.includes("/")||i.includes("\\0"))return g("sftp.invalidName");return null}async function ED(){return su({title:g("sftp.newFileTitle"),message:g("sftp.newFileMessage"),label:g("sftp.name"),placeholder:g("sftp.newFilePlaceholder"),confirmText:g("common.confirm"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function QD(){return su({title:g("sftp.mkdirTitle"),message:g("sftp.mkdirMessage"),label:g("sftp.name"),placeholder:g("sftp.mkdirMessage"),confirmText:g("common.confirm"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function RD(i){return su({title:g("sftp.renameTitle"),message:g("sftp.renameMessage",{name:i}),label:g("sftp.name"),defaultValue:i,confirmText:g("sftp.rename"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function AD(i){if(i.length===0)return false;return Ui({title:g("sftp.deleteTitle"),message:i.length===1?g("sftp.deleteMessage",{name:i[0]}):g("sftp.deleteManyMessage",{count:i.length}),confirmText:g("common.delete"),cancelText:g("common.cancel"),variant:"danger"})}const Ay=128*1024;const LD=8;const MD=1e3;const BD=3e4;class ID{constructor(e){b(this,"container");b(this,"currentPath","/");b(this,"entries",[]);b(this,"renderedEntries",[]);b(this,"sortOptions",{field:"name",direction:"asc"});b(this,"selectedEntries",new Map);b(this,"selectionAnchorIndex",null);b(this,"pendingDeleteCount",0);b(this,"getWebSocketUrl");b(this,"ws",null);b(this,"connectingPromise",null);b(this,"sftpWsRetryTimer",null);b(this,"pendingSends",[]);b(this,"closedByPanel",new WeakSet);b(this,"heartbeatInterval",null);b(this,"visible",false);b(this,"initializing",false);b(this,"sftpReady",false);b(this,"downloadChunks",[]);b(this,"downloadFilename","");b(this,"uploadCancelRequested",false);b(this,"uploadCancelConfirmed",false);b(this,"uploadCancelWaiter",null);b(this,"uploadWaiter",new kD);b(this,"uploadQueueTail",Promise.resolve());b(this,"uploadQueuePending",0);b(this,"uploadQueuedFiles",0);b(this,"uploadActive",false);b(this,"uploadQueueGeneration",0);b(this,"downloadWaiter",null);b(this,"downloadQueueTail",Promise.resolve());b(this,"downloadQueuePending",0);b(this,"downloadQueuedFiles",0);b(this,"downloadActive",false);b(this,"downloadCancelRequested",false);b(this,"downloadQueueGeneration",0);b(this,"editorCoordinator");b(this,"localeCleanup",null);b(this,"keydownHandler",e=>{if(!this.visible||document.querySelector("dialog[open]"))return;const t=e.target;const s=t==null?void 0:t.matches('input, textarea, select, [contenteditable="true"]');if((e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase()==="a"&&!s){e.preventDefault();this.selectAllEntries()}else if(e.key==="Escape"&&this.selectedEntries.size>0){e.preventDefault();this.clearSelection()}else if(e.key==="Escape"){this.hide()}});this.getWebSocketUrl=e;this.container=this.createPanel();document.body.appendChild(this.container);this.editorCoordinator=new PD({isSftpReady:()=>this.sftpReady,isVisible:()=>this.visible,sendJSON:t=>this.sendJSON(t),enqueueUploadTask:(t,s,r)=>this.enqueueUploadTask(t,s,r),queueDownloadFile:(t,s)=>this.queueDownloadFile(t,s),refresh:()=>this.refresh(),setStatus:t=>this.setStatus(t),setIdleStatus:t=>this.setIdleStatus(t),getItemsStatus:()=>this.getItemsStatus(),showError:t=>this.showError(t)});this.localeCleanup=On(()=>{Ds(this.container);this.hideContextMenu()});this.bindKeyboard()}get activeEditor(){return this.editorCoordinator.getActiveEditor()}createPanel(){const e=document.createElement("div");e.id="sftp-panel";e.className="fixed top-0 right-0 h-full z-[90] flex transition-transform duration-300 ease-in-out";e.style.width="min(clamp(420px, 40vw, 600px), 100vw)";e.style.transform="translateX(100%)";e.innerHTML=\` + \`;return e}buildState(){const e=[dR(),sA(),AA(),zQ(),FQ(),pA(),ZR(),_I({top:true}),hI(),YQ(),JQ(),lD,aD,du.of([{key:"Mod-s",preventDefault:true,run:()=>{void this.requestSave();return true}},...M8,...QI,...XA,...JR,B8]),hD(this.options.filename),this.wrapCompartment.of(this.wrapEnabled?J.lineWrapping:[]),J.updateListener.of(t=>{if(t.docChanged)this.updateStatus()})];if(this.options.readOnly){e.push(xe.readOnly.of(true),J.editable.of(false))}return xe.create({doc:this.options.content.text,extensions:e})}isDirty(){return this.view.state.doc.toString()!==this.baseline}getContent(){return this.view.state.doc.toString()}markSaved(){this.baseline=this.view.state.doc.toString();this.updateStatus()}focus(){if(!this.closed)this.view.focus()}toggleWrap(){this.wrapEnabled=!this.wrapEnabled;this.view.dispatch({effects:this.wrapCompartment.reconfigure(this.wrapEnabled?J.lineWrapping:[])});uD(this.wrapEnabled);this.syncWrapButton();this.view.focus()}syncWrapButton(){var e;(e=this.wrapButton)==null?void 0:e.setAttribute("aria-pressed",String(this.wrapEnabled))}close(){this.destroy()}updateStatus(){if(this.closed)return;const e=this.options.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const t=this.options.content.eol==="\\r\\n"?"CRLF":"LF";const s=this.isDirty()?g("sftp.editorStatusDirty"):g("sftp.editorStatusSaved");this.statusEl.textContent=\`\${e} · \${t} · \${s}\`;if(!this.options.readOnly&&!this.saving){this.saveButton.disabled=!this.isDirty()}}async requestSave(){if(this.closed||this.saving||this.options.readOnly)return;if(!this.isDirty()){Y(g("sftp.editorNoChanges"));return}this.saving=true;this.saveButton.disabled=true;const e=this.saveButton.textContent;this.saveButton.textContent=g("sftp.editorSaving");try{const t=await this.options.onSave();if(t)this.baseline=this.view.state.doc.toString()}finally{this.saving=false;this.saveButton.disabled=this.options.readOnly||!this.isDirty();this.saveButton.textContent=e??g("common.save");this.updateStatus()}}async requestClose(){if(this.closed)return;if(this.saving){Y(g("sftp.editorSavingWait"));return}if(this.isDirty()&&!this.options.readOnly){const e=await Ui({title:g("sftp.editorDirtyTitle"),message:g("sftp.editorDirtyMessage",{name:this.options.filename}),confirmText:g("sftp.editorDiscard"),cancelText:g("common.cancel"),variant:"danger"});if(!e){this.focus();return}}this.destroy()}destroy(){if(this.closed)return;this.closed=true;this.view.destroy();this.dialog.close();this.dialog.remove();this.options.onClose()}}function pD(i){return new fD(i)}const kC=2*1024*1024;const mD=8192;function gD(i,e=mD){const t=Math.min(i.length,e);for(let s=0;s=0&&i<=kC}function Yf(i,e){return(i.match(e)||[]).length}function Qy(i){const e=Yf(i,/\\r\\n/g);const t=Yf(i,/\\n/g)-e;const s=Yf(i,/\\r/g)-e;return e>t+s?"\\r\\n":"\\n"}function _D(i){if(gD(i)){return{ok:false,reason:"binary"}}const e=i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191;const t=e?i.subarray(3):i;try{const s=new TextDecoder("utf-8",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"utf-8",bom:e,eol:r}}}catch{}try{const s=new TextDecoder("gb18030",{fatal:true}).decode(t);const r=Qy(s);const n=s.replace(/\\r\\n?/g,"\\n");return{ok:true,content:{text:n,encoding:"gb18030",bom:e,eol:r}}}catch{return{ok:false,reason:"encoding"}}}function vD(i,e){const t=e.eol==="\\r\\n"?i.split("\\n").join("\\r\\n"):i;const s=new TextEncoder().encode(t);if(!e.bom)return s;const r=new Uint8Array(s.length+3);r[0]=239;r[1]=187;r[2]=191;r.set(s,3);return r}function yD(i){const e=i.startsWith("/")?i:\`/\${i}\`;const t=e.split("/").filter(Boolean);const s=[{name:"/",path:"/"}];let r="";for(const n of t){r+=\`/\${n}\`;s.push({name:n,path:r})}return s}function bD(i,e){return[...i].sort((t,s)=>{if(t.isDir&&!s.isDir)return-1;if(!t.isDir&&s.isDir)return 1;let r=0;if(e.field==="name"){r=t.name.localeCompare(s.name)}else if(e.field==="size"){const n=t.isDir?0:t.size??0;const o=s.isDir?0:s.size??0;r=n-o}else if(e.field==="mtime"){const n=t.modifiedTime??0;const o=s.modifiedTime??0;r=n-o}if(r===0){return t.name.localeCompare(s.name)}return e.direction==="asc"?r:-r})}function SD(i){var t;const e=((t=i.split(".").pop())==null?void 0:t.toLowerCase())||"";switch(e){case"js":case"ts":case"jsx":case"tsx":return"javascript";case"py":return"code";case"sh":case"bash":case"zsh":return"terminal";case"json":case"yaml":case"yml":case"toml":return"data_object";case"md":case"txt":case"log":return"description";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"image";case"mp4":case"mkv":case"avi":case"mov":return"movie";case"mp3":case"wav":case"ogg":return"audio_file";case"zip":case"tar":case"gz":case"bz2":case"xz":case"7z":return"folder_zip";case"pdf":return"picture_as_pdf";case"html":case"htm":return"html";case"css":case"scss":case"less":return"css";case"go":case"rs":case"c":case"h":case"cpp":case"hpp":case"java":case"kt":case"rb":case"php":case"xml":return"code";case"sql":return"database";case"conf":case"cfg":case"ini":case"env":return"settings";default:return"draft"}}function fg(i){if(i<1024)return\`\${i} B\`;if(i<1024*1024)return\`\${(i/1024).toFixed(1)} KB\`;if(i<1024*1024*1024)return\`\${(i/(1024*1024)).toFixed(1)} MB\`;return\`\${(i/(1024*1024*1024)).toFixed(1)} GB\`}function wD(i){if(!i)return"";const e=new Date(i*1e3);const t=new Date;const s=new Date(t);s.setMonth(s.getMonth()-6);const r=n=>n.toString().padStart(2,"0");if(e>s){return\`\${r(e.getMonth()+1)}-\${r(e.getDate())} \${r(e.getHours())}:\${r(e.getMinutes())}\`}return\`\${r(e.getMonth()+1)}-\${r(e.getDate())} \${e.getFullYear()}\`}function xD(i){return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}class en{constructor(){b(this,"promise");b(this,"resolve");b(this,"reject");this.promise=new Promise((e,t)=>{this.resolve=e;this.reject=t})}}class kD{constructor(){b(this,"ready",null);b(this,"progress",null);b(this,"complete",null);b(this,"progressQueue",[]);b(this,"progressQueueHead",0)}waitReady(){this.ready=new en;return this.ready.promise}resolveReady(){var e;(e=this.ready)==null?void 0:e.resolve({status:"ready"});this.ready=null}resolveConflict(e){var t;(t=this.ready)==null?void 0:t.resolve({status:"conflict",conflict:e});this.ready=null}waitProgress(){const e=this.progressQueue[this.progressQueueHead];if(e!==void 0){this.progressQueueHead++;this.compactProgressQueue();return Promise.resolve(e)}this.progress=new en;return this.progress.promise}resolveProgress(e){if(this.progress){this.progress.resolve(e);this.progress=null;return}this.progressQueue.push(e)}waitComplete(){this.complete=new en;return this.complete.promise}resolveComplete(){var e;(e=this.complete)==null?void 0:e.resolve();this.reset()}reject(e){var s,r,n;const t=new Error(e);(s=this.ready)==null?void 0:s.reject(t);(r=this.progress)==null?void 0:r.reject(t);(n=this.complete)==null?void 0:n.reject(t);this.reset()}reset(){this.ready=null;this.progress=null;this.complete=null;this.progressQueue=[];this.progressQueueHead=0}compactProgressQueue(){if(this.progressQueueHead>32&&this.progressQueueHead*2>this.progressQueue.length){this.progressQueue=this.progressQueue.slice(this.progressQueueHead);this.progressQueueHead=0}}}const CD=3e4;const TD=15e3;function Ry(i,e){return e!==null||i!==void 0}class PD{constructor(e){b(this,"activeEditor",null);b(this,"editReadActive",false);b(this,"editReadChunks",[]);b(this,"editReadMeta",null);b(this,"editReadWaiter",null);b(this,"editReadTimeout",null);b(this,"statWaiter",null);b(this,"statTimeout",null);this.ctx=e}hasActiveEditor(){return this.activeEditor!==null}getActiveEditor(){return this.activeEditor}isEditReadActive(){return this.editReadActive}hasPendingEditRead(){return this.editReadWaiter!==null}handleBinaryData(e){if(this.editReadActive){this.editReadChunks.push(e);return true}return false}onEditStart(e,t,s){this.editReadMeta={path:e,size:t,mtime:s};this.editReadChunks=[]}onEditDone(e,t,s){this.resolveEditRead({ok:true,path:e,bytes:this.concatEditChunks(),mtime:s,size:t})}onEditError(e,t,s){this.rejectEditRead(e,t);if(!s){this.ctx.showError(e)}}onStatAttrs(e){this.resolveStatWaiter(e)}onStatError(){if(this.statWaiter){this.resolveStatWaiter(null)}}async openEditorForFile(e,t,s,r={}){const n=r.fallbackToDownload===true;if(this.activeEditor){this.activeEditor.handle.focus();Y(g("sftp.editorAlreadyOpen"),{variant:"warning"});return}if(this.editReadActive){Y(g("sftp.editorLoadingOther"),{variant:"info"});return}if(!OD(s)){if(n){this.ctx.queueDownloadFile(e,t);return}Y(g("sftp.editorTooLarge",{name:t,size:fg(s),max:fg(kC)}),{variant:"danger"});return}this.editReadActive=true;this.editReadChunks=[];this.editReadMeta=null;const o=new en;this.editReadWaiter=o;this.editReadTimeout=setTimeout(()=>{if(this.editReadWaiter===o){this.editReadWaiter=null;o.resolve({ok:false,path:e,bytes:new Uint8Array(0),mtime:0,size:0,errorMessage:g("sftp.editorLoadTimeout")})}},CD);this.ctx.setStatus(g("sftp.editorLoading",{name:t}));try{this.ctx.sendJSON({type:"sftp_edit_read",path:e});const a=await o.promise;if(!a.ok){if(a.errorMessage){if(n&&Ry(a.errorCode,null)){this.ctx.queueDownloadFile(e,t);return}Y(a.errorMessage,{variant:"danger"})}return}const l=_D(a.bytes);if(!l.ok){if(n&&Ry(void 0,l.reason)){this.ctx.queueDownloadFile(e,t);return}Y(l.reason==="binary"?g("sftp.editorBinary"):g("sftp.editorEncodingUnsupported"),{variant:"warning"});return}const h=l.content.encoding!=="utf-8";const c=l.content.encoding==="gb18030"?g("sftp.editorEncodingGb18030"):g("sftp.editorEncodingUtf8");const d=pD({filename:t,path:e,content:l.content,readOnly:h,notice:h?g("sftp.editorReadOnlyNotice",{encoding:c}):void 0,onSave:()=>this.saveActiveEditor(),onClose:()=>{this.activeEditor=null;if(this.ctx.isVisible()&&this.ctx.isSftpReady()){this.ctx.refresh()}}});this.activeEditor={path:e,filename:t,encoding:l.content.encoding,bom:l.content.bom,eol:l.content.eol,mtime:a.mtime,size:a.size,handle:d}}catch(a){Y(g("sftp.editorLoadFailed",{message:a instanceof Error?a.message:String(a)}),{variant:"danger"})}finally{this.editReadActive=false;this.editReadChunks=[];this.editReadMeta=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}this.ctx.setIdleStatus(this.ctx.getItemsStatus())}}async saveActiveEditor(){const e=this.activeEditor;if(!e)return false;if(!this.ctx.isSftpReady()){Y(g("sftp.editorSaveFailed",{message:g("sftp.disconnected")}),{variant:"danger"});return false}const t=e.handle.getContent();const s=await this.statRemote(e.path);if(s.ok){if(s.mtime!==e.mtime||s.size!==e.size){const h=await Ui({title:g("sftp.editorRemoteChangedTitle"),message:g("sftp.editorRemoteChangedMessage",{name:e.filename}),confirmText:g("sftp.editorOverwrite"),cancelText:g("common.cancel"),variant:"danger"});if(!h)return false}}else{const h=await Ui({title:g("sftp.editorUnverifiableTitle"),message:g("sftp.editorUnverifiableMessage",{name:e.filename}),confirmText:g("sftp.editorOverwrite"),cancelText:g("common.cancel"),variant:"danger"});if(!h)return false}const r=vD(t,{bom:e.bom,eol:e.eol});const n=new File([r],e.filename);const o=e.path.slice(0,e.path.lastIndexOf("/"))||"/";let a;try{a=await this.ctx.enqueueUploadTask(n,o,{overwriteFirst:true,reportError:false})}catch(h){Y(g("sftp.editorSaveFailed",{message:h instanceof Error?h.message:String(h)}),{variant:"danger"});return false}if(!a){Y(g("sftp.editorSaveFailed",{message:g("sftp.uploadCancelled")}),{variant:"danger"});return false}const l=await this.statRemote(e.path);if(l.ok){e.mtime=l.mtime;e.size=l.size}else{e.mtime=-1;e.size=-1}e.handle.markSaved();Y(g("sftp.editorSaved",{name:e.filename}),{variant:"success"});return true}statRemote(e){if(this.statWaiter){return Promise.resolve({ok:false,mtime:0,size:0})}const t=new en;this.statWaiter=t;this.statTimeout=setTimeout(()=>{if(this.statWaiter===t){this.statWaiter=null;t.resolve({ok:false,mtime:0,size:0})}},TD);void t.promise.then(()=>this.clearStatTimeout()).catch(()=>this.clearStatTimeout());this.ctx.sendJSON({type:"sftp_stat",path:e});return t.promise}clearStatTimeout(){if(this.statTimeout){clearTimeout(this.statTimeout);this.statTimeout=null}}resolveStatWaiter(e){const t=this.statWaiter;this.statWaiter=null;this.clearStatTimeout();if(!t)return;if(e&&typeof e==="object"){t.resolve({ok:true,mtime:Number(e.modifiedTime)||0,size:Number(e.size)||0})}else{t.resolve({ok:false,mtime:0,size:0})}}resolveEditRead(e){const t=this.editReadWaiter;this.editReadWaiter=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}t==null?void 0:t.resolve(e)}rejectEditRead(e,t){var r;const s=this.editReadWaiter;this.editReadWaiter=null;if(this.editReadTimeout){clearTimeout(this.editReadTimeout);this.editReadTimeout=null}s==null?void 0:s.resolve({ok:false,path:((r=this.editReadMeta)==null?void 0:r.path)||"",bytes:new Uint8Array(0),mtime:0,size:0,errorMessage:e,errorCode:t})}concatEditChunks(){const e=this.editReadChunks.reduce((r,n)=>r+n.length,0);const t=new Uint8Array(e);let s=0;for(const r of this.editReadChunks){t.set(r,s);s+=r.length}return t}closeActiveEditor(){if(this.activeEditor){this.activeEditor.handle.close();this.activeEditor=null}}resetEditState(){this.closeActiveEditor();if(this.editReadWaiter){this.rejectEditRead(g("sftp.disconnected"))}if(this.statWaiter){this.resolveStatWaiter(null)}this.editReadActive=false;this.editReadChunks=[];this.editReadMeta=null}dispose(){this.resetEditState()}}function $D(i,e,t,s,r){const n=Math.min(Math.max(0,e),Math.max(0,s-1));const o=r.additive?new Set(i):new Set;if(r.range&&t!==null){const a=Math.min(t,n);const l=Math.max(t,n);for(let h=a;h<=l;h++)o.add(h)}else if(r.additive&&o.has(n)){o.delete(n)}else{o.add(n)}return{selected:o,anchor:n}}function P0(i){if(i==="."||i==="..")return g("sftp.invalidName");if(i.includes("/")||i.includes("\\0"))return g("sftp.invalidName");return null}async function ED(){return su({title:g("sftp.newFileTitle"),message:g("sftp.newFileMessage"),label:g("sftp.name"),placeholder:g("sftp.newFilePlaceholder"),confirmText:g("common.confirm"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function QD(){return su({title:g("sftp.mkdirTitle"),message:g("sftp.mkdirMessage"),label:g("sftp.name"),placeholder:g("sftp.mkdirMessage"),confirmText:g("common.confirm"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function RD(i){return su({title:g("sftp.renameTitle"),message:g("sftp.renameMessage",{name:i}),label:g("sftp.name"),defaultValue:i,confirmText:g("sftp.rename"),cancelText:g("common.cancel"),maxLength:255,validate:P0})}async function AD(i){if(i.length===0)return false;return Ui({title:g("sftp.deleteTitle"),message:i.length===1?g("sftp.deleteMessage",{name:i[0]}):g("sftp.deleteManyMessage",{count:i.length}),confirmText:g("common.delete"),cancelText:g("common.cancel"),variant:"danger"})}const Ay=128*1024;const LD=8;const MD=1e3;const BD=3e4;class ID{constructor(e){b(this,"container");b(this,"currentPath","/");b(this,"entries",[]);b(this,"renderedEntries",[]);b(this,"sortOptions",{field:"name",direction:"asc"});b(this,"selectedEntries",new Map);b(this,"selectionAnchorIndex",null);b(this,"pendingDeleteCount",0);b(this,"getWebSocketUrl");b(this,"ws",null);b(this,"connectingPromise",null);b(this,"sftpWsRetryTimer",null);b(this,"pendingSends",[]);b(this,"closedByPanel",new WeakSet);b(this,"heartbeatInterval",null);b(this,"visible",false);b(this,"initializing",false);b(this,"sftpReady",false);b(this,"downloadChunks",[]);b(this,"downloadFilename","");b(this,"uploadCancelRequested",false);b(this,"uploadCancelConfirmed",false);b(this,"uploadCancelWaiter",null);b(this,"uploadWaiter",new kD);b(this,"uploadQueueTail",Promise.resolve());b(this,"uploadQueuePending",0);b(this,"uploadQueuedFiles",0);b(this,"uploadActive",false);b(this,"uploadQueueGeneration",0);b(this,"downloadWaiter",null);b(this,"downloadQueueTail",Promise.resolve());b(this,"downloadQueuePending",0);b(this,"downloadQueuedFiles",0);b(this,"downloadActive",false);b(this,"downloadCancelRequested",false);b(this,"downloadQueueGeneration",0);b(this,"editorCoordinator");b(this,"localeCleanup",null);b(this,"keydownHandler",e=>{if(!this.visible||document.querySelector("dialog[open]"))return;const t=e.target;const s=t==null?void 0:t.matches('input, textarea, select, [contenteditable="true"]');if((e.ctrlKey||e.metaKey)&&e.key.toLocaleLowerCase()==="a"&&!s){e.preventDefault();this.selectAllEntries()}else if(e.key==="Escape"&&this.selectedEntries.size>0){e.preventDefault();this.clearSelection()}else if(e.key==="Escape"){this.hide()}});this.getWebSocketUrl=e;this.container=this.createPanel();document.body.appendChild(this.container);this.editorCoordinator=new PD({isSftpReady:()=>this.sftpReady,isVisible:()=>this.visible,sendJSON:t=>this.sendJSON(t),enqueueUploadTask:(t,s,r)=>this.enqueueUploadTask(t,s,r),queueDownloadFile:(t,s)=>this.queueDownloadFile(t,s),refresh:()=>this.refresh(),setStatus:t=>this.setStatus(t),setIdleStatus:t=>this.setIdleStatus(t),getItemsStatus:()=>this.getItemsStatus(),showError:t=>this.showError(t)});this.localeCleanup=On(()=>{Ds(this.container);this.hideContextMenu()});this.bindKeyboard()}get activeEditor(){return this.editorCoordinator.getActiveEditor()}createPanel(){const e=document.createElement("div");e.id="sftp-panel";e.className="fixed top-0 right-0 h-full z-[90] flex transition-transform duration-300 ease-in-out";e.style.width="min(clamp(420px, 40vw, 600px), 100vw)";e.style.transform="translateX(100%)";e.innerHTML=\`
@@ -850,7 +850,7 @@ Please report this to https://github.com/markedjs/marked.\`,e){let r="

An erro \`+e.stack):new Error(e.message+\` -\`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var XD=new qD;function Gf(i){ND(i)||XD.onUnexpectedError(i)}var pg="Canceled";function ND(i){return i instanceof FD?true:i instanceof Error&&i.name===pg&&i.message===pg}var FD=class XU extends Error{constructor(){super(pg),this.name=this.message}};var Ly=class mg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof mg)return e;let t=new mg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var ZD;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(ZD||(ZD={}));function UD(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var CC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function PC(...i){let e=va(()=>wl(i));return e}function va(i){let e=jD({dispose:UD(()=>{i()})});return e}var $C=class EC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?EC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),TC())}};$C.DISABLE_DISPOSED_WARNING=false;var $0=$C;var mn=class NU{constructor(){this._store=new $0;TC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};mn.None=Object.freeze({dispose(){}});var Xd=class FU{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var HD=globalThis.performance&&typeof globalThis.performance.now=="function";var VD=class QC{static create(e){return new QC(e)}constructor(e){this._now=HD&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var E0;(i=>{i.None=()=>mn.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=PC(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new Cs(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let ke=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(ke),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new Cs(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new Cs({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new Cs({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new Cs({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new Cs;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new Cs(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof $0?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(E0||(E0={}));var gg=class Og{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${Og._idPool++}\`,Og.all.add(this)}start(e){this._stopWatch=new VD,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gg.all=new Set,gg._idPool=0;var YD=gg;var GD=-1;var RC=class AC{constructor(e,t,s=(AC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var XD=new qD;function Gf(i){ND(i)||XD.onUnexpectedError(i)}var pg="Canceled";function ND(i){return i instanceof FD?true:i instanceof Error&&i.name===pg&&i.message===pg}var FD=class XU extends Error{constructor(){super(pg),this.name=this.message}};var Ly=class mg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof mg)return e;let t=new mg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var ZD;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(ZD||(ZD={}));function UD(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var CC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function PC(...i){let e=va(()=>wl(i));return e}function va(i){let e=jD({dispose:UD(()=>{i()})});return e}var $C=class EC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{wl(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?EC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),TC())}};$C.DISABLE_DISPOSED_WARNING=false;var $0=$C;var mn=class NU{constructor(){this._store=new $0;TC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};mn.None=Object.freeze({dispose(){}});var Xd=class FU{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var HD=globalThis.performance&&typeof globalThis.performance.now=="function";var VD=class QC{static create(e){return new QC(e)}constructor(e){this._now=HD&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var E0;(i=>{i.None=()=>mn.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=PC(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new Cs(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let Ce=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(Ce),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new Cs(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new Cs({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new Cs({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new Cs({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new Cs;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new Cs(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof $0?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(E0||(E0={}));var gg=class Og{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${Og._idPool++}\`,Og.all.add(this)}start(e){this._stopWatch=new VD,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gg.all=new Set,gg._idPool=0;var YD=gg;var GD=-1;var RC=class AC{constructor(e,t,s=(AC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new tz(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Gf)(p),mn.None}if(this._disposed)return mn.None;t&&(e=e.bind(t));let r=new Kf(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=JD.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Kf?(this._deliveryQueue??(this._deliveryQueue=new nz),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=va(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof $0?s.add(o):Array.isArray(s)&&s.push(o),rz);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*sz<=t.length){let h=0;for(let c=0;c0}};var nz=class VU{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var MC=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}});var oz;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof az?true:!t||typeof t!="object"?false:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:false,onCancellationRequested:E0.None}),i.Cancelled=Object.freeze({isCancellationRequested:true,onCancellationRequested:MC})})(oz||(oz={}));var az=class YU{constructor(){this._isCancelled=false;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=true,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?MC:(this._emitter||(this._emitter=new Cs),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Do="en";var Jf=false;var lc;var Xc=Do;var My=Do;var lz;var Ki;var Fn=globalThis;var Dt;var NS;typeof Fn.vscode<"u"&&typeof Fn.vscode.process<"u"?Dt=Fn.vscode.process:typeof process<"u"&&typeof((NS=process==null?void 0:process.versions)==null?void 0:NS.node)=="string"&&(Dt=process);var FS;var hz=typeof((FS=Dt==null?void 0:Dt.versions)==null?void 0:FS.electron)=="string";var cz=hz&&(Dt==null?void 0:Dt.type)==="renderer";var ZS;if(typeof Dt=="object"){Dt.platform==="win32",Dt.platform==="darwin",Jf=Dt.platform==="linux",Jf&&!!Dt.env.SNAP&&!!Dt.env.SNAP_REVISION,!!Dt.env.CI||!!Dt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lc=Do,Xc=Do;let i=Dt.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);lc=e.userLocale,My=e.osLocale,Xc=e.resolvedLanguage||Do,lz=(ZS=e.languagePack)==null?void 0:ZS.translationsConfigFile}catch{}}else typeof navigator=="object"&&!cz?(Ki=navigator.userAgent,Ki.indexOf("Windows")>=0,Ki.indexOf("Macintosh")>=0,(Ki.indexOf("Macintosh")>=0||Ki.indexOf("iPad")>=0||Ki.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Jf=Ki.indexOf("Linux")>=0,(Ki==null?void 0:Ki.indexOf("Mobi"))>=0,Xc=globalThis._VSCODE_NLS_LANGUAGE||Do,lc=navigator.language.toLowerCase(),My=lc):console.error("Unable to resolve platform.");var Zs=Ki;var Ar=Xc;var dz;(i=>{function e(){return Ar}i.value=e;function t(){return Ar.length===2?Ar==="en":Ar.length>=3?Ar[0]==="e"&&Ar[1]==="n"&&Ar[2]==="-":false}i.isDefaultVariant=t;function s(){return Ar==="en"}i.isDefault=s})(dz||(dz={}));var uz=typeof Fn.postMessage=="function"&&!Fn.importScripts;(()=>{if(uz){let i=[];Fn.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s{let s=++e;i.push({id:s,callback:t}),Fn.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var fz=!!(Zs&&Zs.indexOf("Chrome")>=0);!!(Zs&&Zs.indexOf("Firefox")>=0);!!(!fz&&Zs&&Zs.indexOf("Safari")>=0);!!(Zs&&Zs.indexOf("Edg/")>=0);!!(Zs&&Zs.indexOf("Android")>=0);function BC(i,e=0,t){let s=setTimeout(()=>{i()},e),r=va(()=>{clearTimeout(s)});return r}var pz;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(pz||(pz={}));var By=class Li{static fromArray(e){return new Li(t=>{t.emitMany(e)})}static fromPromise(e){return new Li(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Li(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Li(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Cs,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e{var t;return(t=this._onReturn)==null?void 0:t.call(this),{done:true,value:void 0}}}}static map(e,t){return new Li(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Li.map(this,e)}static filter(e,t){return new Li(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Li.filter(this,e)}static coalesce(e){return Li.filter(e,t=>!!t)}coalesce(){return Li.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Li.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};By.EMPTY=By.fromArray([]);var mz=class GU extends mn{constructor(e){super();this._terminal=e;this._linesCacheTimeout=this._register(new Xd);this._linesCacheDisposables=this._register(new Xd);this._register(va(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=PC(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=BC(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var t;return(t=this._linesCache)==null?void 0:t[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){var o;let s=[],r=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let a=this._terminal.buffer.active.getLine(e+1),l=a?a.isWrapped:false,h=n.translateToString(!l&&t);if(l&&a){let c=n.getCell(n.length-1);c&&c.getCode()===0&&c.getWidth()===1&&((o=a.getCell(0))==null?void 0:o.getWidth())===2&&(h=h.slice(0,-1))}if(s.push(h),l)r.push(r[r.length-1]+h.length);else break;e++,n=a}return[s.join(""),r]}};var gz=class KU{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:false:true}shouldUpdateHighlighting(e,t){return(t==null?void 0:t.decorations)?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):false}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}};var Oz=class JU{constructor(e,t){this._terminal=e;this._lineCache=t}find(e,t,s,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(\`Invalid col: \${s} to search in terminal of \${this._terminal.cols} cols\`);this._lineCache.initLinesCache();let n={startRow:t,startCol:s},o=this._findInLine(e,n,r);if(!o)for(let a=t+1;a=0&&(l.startRow=c,h=this._findInLine(e,l,t,a),!h);c--);}if(!h&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=n&&(l.startRow=c,h=this._findInLine(e,l,t,a),!h);c--);return h}_isWholeWord(e,t,s){return(e===0||" ~!@#$%^&*()+\`-=[]{}|\\\\;:\\"',./<>?".includes(t[e-1]))&&(e+s.length===t.length||" ~!@#$%^&*()+\`-=[]{}|\\\\;:\\"',./<>?".includes(t[e+s.length]))}_findInLine(e,t,s={},r=false){var p;let n=t.startRow,o=t.startCol;if((p=this._terminal.buffer.active.getLine(n))==null?void 0:p.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,s)}let a=this._lineCache.getLineFromCache(n);a||(a=this._lineCache.translateBufferLineToStringWithWrap(n,true),this._lineCache.setLineInCache(n,a));let[l,h]=a,c=this._bufferColsToStringOffset(n,o),d=e,u=l;s.regex||(d=s.caseSensitive?e:e.toLowerCase(),u=s.caseSensitive?l:l.toLowerCase());let f=-1;if(s.regex){let m=RegExp(d,s.caseSensitive?"g":"gi"),O;if(r)for(;O=m.exec(u.slice(0,c));)f=m.lastIndex-O[0].length,e=O[0],m.lastIndex-=e.length-1;else O=m.exec(u.slice(c)),O&&O[0].length>0&&(f=c+(m.lastIndex-O[0].length),e=O[0])}else r?c-d.length>=0&&(f=u.lastIndexOf(d,c-d.length)):f=u.indexOf(d,c);if(f>=0){if(s.wholeWord&&!this._isWholeWord(f,u,e))return;let m=0;for(;m=h[m+1];)m++;let O=m;for(;O=h[O+1];)O++;let v=f-h[m],T=f+e.length-h[O],k=this._stringLengthToBufferSize(n+m,v),_=this._stringLengthToBufferSize(n+O,T)-k+this._terminal.cols*(O-m);return{term:e,col:k,row:n+m,size:_}}}_stringLengthToBufferSize(e,t){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let r=0;r1&&(t-=o.length-1);let a=s.getCell(r+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let s=e,r=0,n=this._terminal.buffer.active.getLine(s);for(;t>0&&n;){for(let o=0;othis.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let s of e){let r=this._createResultDecorations(s,t,false);if(r)for(let n of r)this._storeDecoration(n,s)}}createActiveDecoration(e,t){let s=this._createResultDecorations(e,t,true);if(s)return{decorations:s,match:e,dispose(){wl(s)}}}clearHighlightDecorations(){wl(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,s){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=\`1px solid \${t}\`)),s&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,s){let r=[],n=e.col,o=e.size,a=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;o>0;){let h=Math.min(this._terminal.cols-n,o);r.push([a,n,h]),n=0,o-=h,a++}let l=[];for(let h of r){let c=this._terminal.registerMarker(h[0]),d=this._terminal.registerDecoration({marker:c,x:h[1],width:h[2],backgroundColor:s?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(c.line)?void 0:{color:s?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let u=[];u.push(c),u.push(d.onRender(f=>this._applyStyles(f,s?t.activeMatchBorder:t.matchBorder,false))),u.push(d.onDispose(()=>wl(u))),l.push(d)}}return l.length===0?void 0:l}};var vz=class tj extends mn{constructor(){super(...arguments);this._searchResults=[];this._onDidChangeResults=this._register(new Cs)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;tthis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(va(()=>this.clearDecorations()))}_updateMatches(){var e;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&((e=this._state.lastSearchOptions)==null?void 0:e.decorations)&&(this._highlightTimeout.value=BC(()=>{let t=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(t,{...this._state.lastSearchOptions,incremental:true},{noScroll:true})},200))}clearDecorations(e){var t;this._resultTracker.clearSelectedDecoration(),(t=this._decorationManager)==null?void 0:t.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(true);let s=[],r,n=this._engine.find(e,0,0,t);for(;n&&((r==null?void 0:r.row)!==n.row||(r==null?void 0:r.col)!==n.col)&&!(s.length>=this._highlightLimit);)r=n,s.push(r),n=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(s,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(s,t.decorations)}_findNextAndSelect(e,t,s){if(!this._terminal||!this._engine)return false;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),false;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t==null?void 0:t.decorations,s==null?void 0:s.noScroll)}findPrevious(e,t,s){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!(e==null?void 0:e.decorations))}_findPreviousAndSelect(e,t,s){if(!this._terminal||!this._engine)return false;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),false;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t==null?void 0:t.decorations,s==null?void 0:s.noScroll)}_selectResult(e,t,s){if(!this._terminal||!this._decorationManager)return false;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),false;if(this._terminal.select(e.col,e.row,e.size),t){let r=this._decorationManager.createActiveDecoration(e,t);r&&(this._resultTracker.selectedDecoration=r)}if(!s&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Az||(Az={}));function Lz(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var IC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function WC(...i){let e=Vt(()=>zC(i));return e}function Vt(i){let e=Mz({dispose:Lz(()=>{i()})});return e}var qC=class XC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zC(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?XC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),DC())}};qC.DISABLE_DISPOSED_WARNING=false;var Ko=qC;var os=class aj{constructor(){this._store=new Ko;DC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});var za=class lj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var Q0=typeof process<"u"&&"title"in process;var ku=Q0?"node":navigator.userAgent;var Bz=Q0?"node":navigator.platform;var Iz=ku.includes("Firefox");var Dz=ku.includes("Edge");var NC=/^((?!chrome|android).)*safari/i.test(ku);function zz(){if(!NC)return 0;let i=ku.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}Bz.indexOf("Linux")>=0;var Wz="";var Ct=0;var Tt=0;var Pt=0;var et=0;var Mi={css:"#00000000",rgba:0};var ni;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${wn(r)}\${wn(n)}\${wn(o)}\${wn(a)}\`:\`#\${wn(r)}\${wn(n)}\${wn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(ni||(ni={}));var rl;(i=>{function e(l,h){if(et=(h.rgba&255)/255,et===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;Ct=f+Math.round((c-f)*et),Tt=p+Math.round((d-p)*et),Pt=m+Math.round((u-m)*et);let O=ni.toCss(Ct,Tt,Pt),v=ni.toRgba(Ct,Tt,Pt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Zn.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return ni.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[Ct,Tt,Pt]=Zn.toChannels(h),{css:ni.toCss(Ct,Tt,Pt),rgba:h}}i.opaque=r;function n(l,h){return et=Math.round(h*255),[Ct,Tt,Pt]=Zn.toChannels(l.rgba),{css:ni.toCss(Ct,Tt,Pt,et),rgba:ni.toRgba(Ct,Tt,Pt,et)}}i.opacity=n;function o(l,h){return et=l.rgba&255,n(l,et*h/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(rl||(rl={}));var qz;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:true});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\\da-f]{3,8}/i))switch(r.length){case 4:return Ct=parseInt(r.slice(1,2).repeat(2),16),Tt=parseInt(r.slice(2,3).repeat(2),16),Pt=parseInt(r.slice(3,4).repeat(2),16),ni.toColor(Ct,Tt,Pt);case 5:return Ct=parseInt(r.slice(1,2).repeat(2),16),Tt=parseInt(r.slice(2,3).repeat(2),16),Pt=parseInt(r.slice(3,4).repeat(2),16),et=parseInt(r.slice(4,5).repeat(2),16),ni.toColor(Ct,Tt,Pt,et);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(n)return Ct=parseInt(n[1]),Tt=parseInt(n[2]),Pt=parseInt(n[3]),et=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),ni.toColor(Ct,Tt,Pt,et);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ct,Tt,Pt,et]=e.getImageData(0,0,1,1).data,et!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ni.toRgba(Ct,Tt,Pt,et),css:r}}i.toColor=s})(qz||(qz={}));var ii;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}i.relativeLuminance2=t})(ii||(ii={}));var Zn;(i=>{function e(o,a){if(et=(a&255)/255,et===1)return a;let l=a>>24&255,h=a>>16&255,c=a>>8&255,d=o>>24&255,u=o>>16&255,f=o>>8&255;return Ct=d+Math.round((l-d)*et),Tt=u+Math.round((h-u)*et),Pt=f+Math.round((c-f)*et),ni.toRgba(Ct,Tt,Pt)}i.blend=e;function t(o,a,l){let h=ii.relativeLuminance(o>>8),c=ii.relativeLuminance(a>>8);if(Ks(h,c)>8));if(p>8));return p>O?f:m}return f}let d=r(o,a,l),u=Ks(h,ii.relativeLuminance(d>>8));if(u>8));return u>p?d:f}return d}}i.ensureContrastRatio=t;function s(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));for(;m0||f>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));return(u<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));for(;m>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Zn||(Zn={}));function wn(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Ks(i,e){return i=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function Uz(i,e,t,s){return e===1&&t>Math.ceil(s*1.5)&&i!==void 0&&i>255&&!Zz(i)&&!R0(i)&&!Nz(i)}function FC(i){return R0(i)||Fz(i)}function jz(){return{css:{canvas:hc(),cell:hc()},device:{canvas:hc(),cell:hc(),char:{width:0,height:0,left:0,top:0}}}}function hc(){return{width:0,height:0}}function Hz(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var Lt=0;var yt=0;var _s=false;var Js=false;var cc=false;var pi;var tp=0;var Vz=class hj{constructor(e,t,s,r,n,o){this._terminal=e;this._optionService=t;this._selectionRenderModel=s;this._decorationService=r;this._coreBrowserService=n;this._themeService=o;this.result={fg:0,bg:0,ext:0}}resolve(e,t,s,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,yt=0,Lt=0,Js=false,_s=false,cc=false,pi=this._themeService.colors,tp=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));tp=t*r%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,s,"bottom",n=>{n.backgroundColorRGB&&(yt=n.backgroundColorRGB.rgba>>8&16777215,Js=true),n.foregroundColorRGB&&(Lt=n.foregroundColorRGB.rgba>>8&16777215,_s=true)}),cc=this._selectionRenderModel.isCellSelected(this._terminal,t,s),cc){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yt=(this.result.fg&16777215)<<8|255;break;case 0:default:yt=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yt=(this.result.bg&16777215)<<8|255;break}yt=Zn.blend(yt,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else yt=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Js=true,pi.selectionForeground&&(Lt=pi.selectionForeground.rgba>>8&16777215,_s=true),FC(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Lt=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Lt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Lt=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Lt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Lt=(this.result.fg&16777215)<<8|255;break;case 0:default:Lt=this._themeService.colors.foreground.rgba}Lt=Zn.blend(Lt,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}_s=true}}this._decorationService.forEachDecorationAtCell(t,s,"top",n=>{n.backgroundColorRGB&&(yt=n.backgroundColorRGB.rgba>>8&16777215,Js=true),n.foregroundColorRGB&&(Lt=n.foregroundColorRGB.rgba>>8&16777215,_s=true)}),Js&&(cc?yt=e.bg&-16777216&-134217729|yt|50331648:yt=e.bg&-16777216|yt|50331648),_s&&(Lt=e.fg&-16777216&-67108865|Lt|50331648),this.result.fg&67108864&&(Js&&!_s&&((this.result.bg&50331648)===0?Lt=this.result.fg&-134217728|pi.background.rgba>>8&16777215&16777215|50331648:Lt=this.result.fg&-134217728|this.result.bg&67108863,_s=true),!Js&&_s&&((this.result.fg&50331648)===0?yt=this.result.bg&-67108864|pi.foreground.rgba>>8&16777215&16777215|50331648:yt=this.result.bg&-67108864|this.result.fg&67108863,Js=true)),pi=void 0,this.result.bg=Js?yt:this.result.bg,this.result.fg=_s?Lt:this.result.fg,this.result.ext&=536870911,this.result.ext|=tp<<29&3758096384}};var Yz=.5;var ZC=Iz||Dz?"bottom":"ideographic";var Gz={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};var Kz={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};var Jz={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"║":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╒":{1:(i,e)=>\`M.5,1 L.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╓":{1:(i,e)=>\`M\${.5-i},1 L\${.5-i},.5 L1,.5 M\${.5+i},.5 L\${.5+i},1\`},"╔":{1:(i,e)=>\`M1,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1\`},"╕":{1:(i,e)=>\`M0,\${.5-e} L.5,\${.5-e} L.5,1 M0,\${.5+e} L.5,\${.5+e}\`},"╖":{1:(i,e)=>\`M\${.5+i},1 L\${.5+i},.5 L0,.5 M\${.5-i},.5 L\${.5-i},1\`},"╗":{1:(i,e)=>\`M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M0,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},1\`},"╘":{1:(i,e)=>\`M.5,0 L.5,\${.5+e} L1,\${.5+e} M.5,\${.5-e} L1,\${.5-e}\`},"╙":{1:(i,e)=>\`M1,.5 L\${.5-i},.5 L\${.5-i},0 M\${.5+i},.5 L\${.5+i},0\`},"╚":{1:(i,e)=>\`M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0 M1,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},0\`},"╛":{1:(i,e)=>\`M0,\${.5+e} L.5,\${.5+e} L.5,0 M0,\${.5-e} L.5,\${.5-e}\`},"╜":{1:(i,e)=>\`M0,.5 L\${.5+i},.5 L\${.5+i},0 M\${.5-i},.5 L\${.5-i},0\`},"╝":{1:(i,e)=>\`M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M0,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},0\`},"╞":{1:(i,e)=>\`M.5,0 L.5,1 M.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╟":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1 M\${.5+i},.5 L1,.5\`},"╠":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╡":{1:(i,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L.5,\${.5-e} M0,\${.5+e} L.5,\${.5+e}\`},"╢":{1:(i,e)=>\`M0,.5 L\${.5-i},.5 M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╣":{1:(i,e)=>\`M\${.5+i},0 L\${.5+i},1 M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0\`},"╤":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e} M.5,\${.5+e} L.5,1\`},"╥":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},.5 L\${.5-i},1 M\${.5+i},.5 L\${.5+i},1\`},"╦":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1\`},"╧":{1:(i,e)=>\`M.5,0 L.5,\${.5-e} M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╨":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},.5 L\${.5-i},0 M\${.5+i},.5 L\${.5+i},0\`},"╩":{1:(i,e)=>\`M0,\${.5+e} L1,\${.5+e} M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╪":{1:(i,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╫":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╬":{1:(i,e)=>\`M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1 M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":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1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(i,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,1,.5\`},"╮":{1:(i,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,0,.5\`},"╯":{1:(i,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,0,.5\`},"╰":{1:(i,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,1,.5\`}};var Jl={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Jl[""]=Jl[""];Jl[""]=Jl[""];function eW(i,e,t,s,r,n,o,a){let l=Gz[e];if(l)return tW(i,l,t,s,r,n),true;let h=Kz[e];if(h)return iW(i,h,t,s,r,n),true;let c=Jz[e];if(c)return sW(i,c,t,s,r,n,a),true;let d=Jl[e];return d?(rW(i,d,t,s,r,n,o,a),true):false}function tW(i,e,t,s,r,n){for(let o=0;o7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[p,m,O,v]=a.substring(5,a.length-1).split(",").map(T=>parseFloat(T));else throw new Error(\`Unexpected fillStyle color format "\${a}" when drawing pattern glyph\`);for(let T=0;Ti.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function jC(i,e,t,s,r,n,o,a=0,l=0){let h=i.map(c=>parseFloat(c)||parseInt(c));if(h.length<2)throw new Error("Too few arguments for instruction");for(let c=0;cn){r-t<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(r-t))}ms\`),this._start();return}r=n}this.clear()}};var nW=class fj extends HC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}};var oW=class pj extends HC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}};var aW=!Q0&&"requestIdleCallback"in window?oW:nW;var zo=class VC{constructor(){this.fg=0;this.bg=0;this.extended=new YC}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new VC;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}};var YC=class GC{constructor(e=0,t=0){this._ext=0;this._urlId=0;this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new GC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var lW=globalThis.performance&&typeof globalThis.performance.now=="function";var hW=class KC{static create(e){return new KC(e)}constructor(e){this._now=lW&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var ur;(i=>{i.None=()=>os.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=WC(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new Ne(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let ke=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(ke),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new Ne(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new Ne({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new Ne({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new Ne({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new Ne;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new Ne(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof Ko?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(ur||(ur={}));var yg=class bg{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${bg._idPool++}\`,bg.all.add(this)}start(e){this._stopWatch=new hW,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yg.all=new Set,yg._idPool=0;var cW=yg;var dW=-1;var JC=class e3{constructor(e,t,s=(e3._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};var Ez=new $z;function ep(i){Qz(i)||Ez.onUnexpectedError(i)}var _g="Canceled";function Qz(i){return i instanceof Rz?true:i instanceof Error&&i.name===_g&&i.message===_g}var Rz=class oj extends Error{constructor(){super(_g),this.name=this.message}};var Iy=class vg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof vg)return e;let t=new vg;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Az;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Az||(Az={}));function Lz(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var IC;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function WC(...i){let e=Vt(()=>zC(i));return e}function Vt(i){let e=Mz({dispose:Lz(()=>{i()})});return e}var qC=class XC{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zC(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?XC.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),DC())}};qC.DISABLE_DISPOSED_WARNING=false;var Ko=qC;var os=class aj{constructor(){this._store=new Ko;DC(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});var za=class lj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var Q0=typeof process<"u"&&"title"in process;var ku=Q0?"node":navigator.userAgent;var Bz=Q0?"node":navigator.platform;var Iz=ku.includes("Firefox");var Dz=ku.includes("Edge");var NC=/^((?!chrome|android).)*safari/i.test(ku);function zz(){if(!NC)return 0;let i=ku.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}Bz.indexOf("Linux")>=0;var Wz="";var Ct=0;var Tt=0;var Pt=0;var et=0;var Mi={css:"#00000000",rgba:0};var ni;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${wn(r)}\${wn(n)}\${wn(o)}\${wn(a)}\`:\`#\${wn(r)}\${wn(n)}\${wn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(ni||(ni={}));var rl;(i=>{function e(l,h){if(et=(h.rgba&255)/255,et===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;Ct=f+Math.round((c-f)*et),Tt=p+Math.round((d-p)*et),Pt=m+Math.round((u-m)*et);let O=ni.toCss(Ct,Tt,Pt),v=ni.toRgba(Ct,Tt,Pt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Zn.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return ni.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[Ct,Tt,Pt]=Zn.toChannels(h),{css:ni.toCss(Ct,Tt,Pt),rgba:h}}i.opaque=r;function n(l,h){return et=Math.round(h*255),[Ct,Tt,Pt]=Zn.toChannels(l.rgba),{css:ni.toCss(Ct,Tt,Pt,et),rgba:ni.toRgba(Ct,Tt,Pt,et)}}i.opacity=n;function o(l,h){return et=l.rgba&255,n(l,et*h/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(rl||(rl={}));var qz;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:true});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\\da-f]{3,8}/i))switch(r.length){case 4:return Ct=parseInt(r.slice(1,2).repeat(2),16),Tt=parseInt(r.slice(2,3).repeat(2),16),Pt=parseInt(r.slice(3,4).repeat(2),16),ni.toColor(Ct,Tt,Pt);case 5:return Ct=parseInt(r.slice(1,2).repeat(2),16),Tt=parseInt(r.slice(2,3).repeat(2),16),Pt=parseInt(r.slice(3,4).repeat(2),16),et=parseInt(r.slice(4,5).repeat(2),16),ni.toColor(Ct,Tt,Pt,et);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(n)return Ct=parseInt(n[1]),Tt=parseInt(n[2]),Pt=parseInt(n[3]),et=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),ni.toColor(Ct,Tt,Pt,et);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ct,Tt,Pt,et]=e.getImageData(0,0,1,1).data,et!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ni.toRgba(Ct,Tt,Pt,et),css:r}}i.toColor=s})(qz||(qz={}));var ii;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}i.relativeLuminance2=t})(ii||(ii={}));var Zn;(i=>{function e(o,a){if(et=(a&255)/255,et===1)return a;let l=a>>24&255,h=a>>16&255,c=a>>8&255,d=o>>24&255,u=o>>16&255,f=o>>8&255;return Ct=d+Math.round((l-d)*et),Tt=u+Math.round((h-u)*et),Pt=f+Math.round((c-f)*et),ni.toRgba(Ct,Tt,Pt)}i.blend=e;function t(o,a,l){let h=ii.relativeLuminance(o>>8),c=ii.relativeLuminance(a>>8);if(Ks(h,c)>8));if(p>8));return p>O?f:m}return f}let d=r(o,a,l),u=Ks(h,ii.relativeLuminance(d>>8));if(u>8));return u>p?d:f}return d}}i.ensureContrastRatio=t;function s(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));for(;m0||f>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));return(u<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ks(ii.relativeLuminance2(u,f,p),ii.relativeLuminance2(h,c,d));for(;m>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Zn||(Zn={}));function wn(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Ks(i,e){return i=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function Uz(i,e,t,s){return e===1&&t>Math.ceil(s*1.5)&&i!==void 0&&i>255&&!Zz(i)&&!R0(i)&&!Nz(i)}function FC(i){return R0(i)||Fz(i)}function jz(){return{css:{canvas:hc(),cell:hc()},device:{canvas:hc(),cell:hc(),char:{width:0,height:0,left:0,top:0}}}}function hc(){return{width:0,height:0}}function Hz(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var Lt=0;var yt=0;var _s=false;var Js=false;var cc=false;var pi;var tp=0;var Vz=class hj{constructor(e,t,s,r,n,o){this._terminal=e;this._optionService=t;this._selectionRenderModel=s;this._decorationService=r;this._coreBrowserService=n;this._themeService=o;this.result={fg:0,bg:0,ext:0}}resolve(e,t,s,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,yt=0,Lt=0,Js=false,_s=false,cc=false,pi=this._themeService.colors,tp=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));tp=t*r%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,s,"bottom",n=>{n.backgroundColorRGB&&(yt=n.backgroundColorRGB.rgba>>8&16777215,Js=true),n.foregroundColorRGB&&(Lt=n.foregroundColorRGB.rgba>>8&16777215,_s=true)}),cc=this._selectionRenderModel.isCellSelected(this._terminal,t,s),cc){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yt=(this.result.fg&16777215)<<8|255;break;case 0:default:yt=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:yt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yt=(this.result.bg&16777215)<<8|255;break}yt=Zn.blend(yt,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else yt=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Js=true,pi.selectionForeground&&(Lt=pi.selectionForeground.rgba>>8&16777215,_s=true),FC(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Lt=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Lt=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Lt=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Lt=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Lt=(this.result.fg&16777215)<<8|255;break;case 0:default:Lt=this._themeService.colors.foreground.rgba}Lt=Zn.blend(Lt,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}_s=true}}this._decorationService.forEachDecorationAtCell(t,s,"top",n=>{n.backgroundColorRGB&&(yt=n.backgroundColorRGB.rgba>>8&16777215,Js=true),n.foregroundColorRGB&&(Lt=n.foregroundColorRGB.rgba>>8&16777215,_s=true)}),Js&&(cc?yt=e.bg&-16777216&-134217729|yt|50331648:yt=e.bg&-16777216|yt|50331648),_s&&(Lt=e.fg&-16777216&-67108865|Lt|50331648),this.result.fg&67108864&&(Js&&!_s&&((this.result.bg&50331648)===0?Lt=this.result.fg&-134217728|pi.background.rgba>>8&16777215&16777215|50331648:Lt=this.result.fg&-134217728|this.result.bg&67108863,_s=true),!Js&&_s&&((this.result.fg&50331648)===0?yt=this.result.bg&-67108864|pi.foreground.rgba>>8&16777215&16777215|50331648:yt=this.result.bg&-67108864|this.result.fg&67108863,Js=true)),pi=void 0,this.result.bg=Js?yt:this.result.bg,this.result.fg=_s?Lt:this.result.fg,this.result.ext&=536870911,this.result.ext|=tp<<29&3758096384}};var Yz=.5;var ZC=Iz||Dz?"bottom":"ideographic";var Gz={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};var Kz={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};var Jz={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"║":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╒":{1:(i,e)=>\`M.5,1 L.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╓":{1:(i,e)=>\`M\${.5-i},1 L\${.5-i},.5 L1,.5 M\${.5+i},.5 L\${.5+i},1\`},"╔":{1:(i,e)=>\`M1,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1\`},"╕":{1:(i,e)=>\`M0,\${.5-e} L.5,\${.5-e} L.5,1 M0,\${.5+e} L.5,\${.5+e}\`},"╖":{1:(i,e)=>\`M\${.5+i},1 L\${.5+i},.5 L0,.5 M\${.5-i},.5 L\${.5-i},1\`},"╗":{1:(i,e)=>\`M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M0,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},1\`},"╘":{1:(i,e)=>\`M.5,0 L.5,\${.5+e} L1,\${.5+e} M.5,\${.5-e} L1,\${.5-e}\`},"╙":{1:(i,e)=>\`M1,.5 L\${.5-i},.5 L\${.5-i},0 M\${.5+i},.5 L\${.5+i},0\`},"╚":{1:(i,e)=>\`M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0 M1,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},0\`},"╛":{1:(i,e)=>\`M0,\${.5+e} L.5,\${.5+e} L.5,0 M0,\${.5-e} L.5,\${.5-e}\`},"╜":{1:(i,e)=>\`M0,.5 L\${.5+i},.5 L\${.5+i},0 M\${.5-i},.5 L\${.5-i},0\`},"╝":{1:(i,e)=>\`M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M0,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},0\`},"╞":{1:(i,e)=>\`M.5,0 L.5,1 M.5,\${.5-e} L1,\${.5-e} M.5,\${.5+e} L1,\${.5+e}\`},"╟":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1 M\${.5+i},.5 L1,.5\`},"╠":{1:(i,e)=>\`M\${.5-i},0 L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╡":{1:(i,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L.5,\${.5-e} M0,\${.5+e} L.5,\${.5+e}\`},"╢":{1:(i,e)=>\`M0,.5 L\${.5-i},.5 M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╣":{1:(i,e)=>\`M\${.5+i},0 L\${.5+i},1 M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0\`},"╤":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e} M.5,\${.5+e} L.5,1\`},"╥":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},.5 L\${.5-i},1 M\${.5+i},.5 L\${.5+i},1\`},"╦":{1:(i,e)=>\`M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1\`},"╧":{1:(i,e)=>\`M.5,0 L.5,\${.5-e} M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╨":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},.5 L\${.5-i},0 M\${.5+i},.5 L\${.5+i},0\`},"╩":{1:(i,e)=>\`M0,\${.5+e} L1,\${.5+e} M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╪":{1:(i,e)=>\`M.5,0 L.5,1 M0,\${.5-e} L1,\${.5-e} M0,\${.5+e} L1,\${.5+e}\`},"╫":{1:(i,e)=>\`M0,.5 L1,.5 M\${.5-i},0 L\${.5-i},1 M\${.5+i},0 L\${.5+i},1\`},"╬":{1:(i,e)=>\`M0,\${.5+e} L\${.5-i},\${.5+e} L\${.5-i},1 M1,\${.5+e} L\${.5+i},\${.5+e} L\${.5+i},1 M0,\${.5-e} L\${.5-i},\${.5-e} L\${.5-i},0 M1,\${.5-e} L\${.5+i},\${.5-e} L\${.5+i},0\`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5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.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(i,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,1,.5\`},"╮":{1:(i,e)=>\`M.5,1 L.5,\${.5+e/.15*.5} C.5,\${.5+e/.15*.5},.5,.5,0,.5\`},"╯":{1:(i,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,0,.5\`},"╰":{1:(i,e)=>\`M.5,0 L.5,\${.5-e/.15*.5} C.5,\${.5-e/.15*.5},.5,.5,1,.5\`}};var Jl={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Jl[""]=Jl[""];Jl[""]=Jl[""];function eW(i,e,t,s,r,n,o,a){let l=Gz[e];if(l)return tW(i,l,t,s,r,n),true;let h=Kz[e];if(h)return iW(i,h,t,s,r,n),true;let c=Jz[e];if(c)return sW(i,c,t,s,r,n,a),true;let d=Jl[e];return d?(rW(i,d,t,s,r,n,o,a),true):false}function tW(i,e,t,s,r,n){for(let o=0;o7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[p,m,O,v]=a.substring(5,a.length-1).split(",").map(T=>parseFloat(T));else throw new Error(\`Unexpected fillStyle color format "\${a}" when drawing pattern glyph\`);for(let T=0;Ti.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function jC(i,e,t,s,r,n,o,a=0,l=0){let h=i.map(c=>parseFloat(c)||parseInt(c));if(h.length<2)throw new Error("Too few arguments for instruction");for(let c=0;cn){r-t<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(r-t))}ms\`),this._start();return}r=n}this.clear()}};var nW=class fj extends HC{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}};var oW=class pj extends HC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}};var aW=!Q0&&"requestIdleCallback"in window?oW:nW;var zo=class VC{constructor(){this.fg=0;this.bg=0;this.extended=new YC}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new VC;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}};var YC=class GC{constructor(e=0,t=0){this._ext=0;this._urlId=0;this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new GC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var lW=globalThis.performance&&typeof globalThis.performance.now=="function";var hW=class KC{static create(e){return new KC(e)}constructor(e){this._now=lW&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var ur;(i=>{i.None=()=>os.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=WC(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new Ne(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let Ce=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(Ce),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new Ne(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new Ne({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new Ne({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new Ne({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new Ne;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new Ne(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof Ko?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(ur||(ur={}));var yg=class bg{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${bg._idPool++}\`,bg.all.add(this)}start(e){this._stopWatch=new hW,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};yg.all=new Set,yg._idPool=0;var cW=yg;var dW=-1;var JC=class e3{constructor(e,t,s=(e3._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new mW(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ep)(p),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let r=new ip(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=fW.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ip?(this._deliveryQueue??(this._deliveryQueue=new vW),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=Vt(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof Ko?s.add(o):Array.isArray(s)&&s.push(o),_W);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*OW<=t.length){let h=0;for(let c=0;c0}};var vW=class vj{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Xy={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};var Wa=2;var qa;var Dr=class Lo{constructor(e,t,s){this._document=e;this._config=t;this._unicodeService=s;this._didWarmUp=false;this._cacheMap=new qy;this._cacheMapCombined=new qy;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new zo;this._textureSize=512;this._onAddTextureAtlasCanvas=new Ne;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new Ne;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=false;this._createNewPage(),this._tmpCanvas=i3(e,this._config.deviceCellWidth*4+Wa*2,this._config.deviceCellHeight+Wa*2),this._tmpCtx=ct(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:true}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=true)}_doWarmUp(){let e=new aW;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let s=this._drawToCache(t,0,0,0,false,void 0);this._cacheMap.set(t,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=false}}_createNewPage(){if(Lo.maxAtlasPages&&this._pages.length>=Math.max(4,Lo.maxAtlasPages)){let t=this._pages.filter(h=>h.canvas.width*2<=(Lo.maxTextureSize||4096)).sort((h,c)=>c.canvas.width!==h.canvas.width?c.canvas.width-h.canvas.width:c.percentageUsed-h.percentageUsed),s=-1,r=0;for(let h=0;hh.glyphs[0].texturePage).sort((h,c)=>h>c?1:-1),a=this.pages.length-n.length,l=this._mergePages(n,a);l.version++;for(let h=o.length-1;h>=0;h--)this._deletePage(o[h]);this.pages.push(l),this._requestClearModel=true,this._onAddTextureAtlasCanvas.fire(l.canvas)}let e=new sp(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let s=e[0].canvas.width*2,r=new sp(this._document,s,e);for(let[n,o]of e.entries()){let a=n*o.canvas.width%s,l=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,a,l);for(let c of o.glyphs)c.texturePage=t,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=a,c.texturePosition.y+=l,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let h=this._activePages.indexOf(o);h!==-1&&this._activePages.splice(h,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,s,r){if(this._config.allowTransparency)return Mi;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(t);break;case 50331648:let o=zo.toColorRGB(t);n=ni.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=rl.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=rl.opaque(n)),n}_getForegroundColor(e,t,s,r,n,o,a,l,h,c){let d=this._getMinimumContrastColor(e,t,s,r,n,o,a,h,l,c);if(d)return d;let u;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&o<8&&(o+=8),u=this._getColorFromAnsiIndex(o);break;case 50331648:let f=zo.toColorRGB(o);u=ni.toColor(f[0],f[1],f[2]);break;case 0:default:a?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=rl.opaque(u)),l&&(u=rl.multiplyOpacity(u,Yz)),u}_resolveBackgroundRgba(e,t,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,s,r,n,o,a,l,h,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(h),u=d.getColor(e,r);if(u!==void 0)return u||void 0;let f=this._resolveBackgroundRgba(t,s,a),p=this._resolveForegroundRgba(n,o,a,l),m=Zn.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(h?2:1));if(!m){d.setColor(e,r,null);return}let O=ni.toColor(m>>24&255,m>>16&255,m>>8&255);return d.setColor(e,r,O),O}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,s,r,n,o){let a=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+Wa*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=q?q*2-De:q-De;!(De>=q)===false||oe===0?(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae+oe,ne),this._tmpCtx.lineTo(lt,ne)):(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(Ae+oe,ne),this._tmpCtx.moveTo(Ae+oe+q,ne),this._tmpCtx.lineTo(lt,ne)),De=Hz(lt-Ae,q,De);break;case 5:let Vs=.6,Fe=.3,Ys=lt-Ae,xa=Math.floor(Vs*Ys),Yi=Math.floor(Fe*Ys),kh=Ys-xa-Yi;this._tmpCtx.setLineDash([xa,Yi,kh]),this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(lt,ne);break;case 1:default:this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(lt,ne);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!x&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ke=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ke&&ke.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ae=new Path2D;Ae.rect(ee,ne-Math.ceil(q/2),this._config.deviceCellWidth*$,pe-ne+Math.ceil(q/2)),this._tmpCtx.clip(Ae),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=C.css,this._tmpCtx.strokeText(a,X,X+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(O){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),re=q%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(X,X+re),this._tmpCtx.lineTo(X+this._config.deviceCharWidth*$,X+re),this._tmpCtx.stroke()}if(x||this._tmpCtx.fillText(a,X,X+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let q=rp(this._tmpCtx.getImageData(X,X,this._config.deviceCellWidth,this._config.deviceCellHeight),C,F,y);if(q)for(let re=1;re<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,X,X+this._config.deviceCharHeight-re),q=rp(this._tmpCtx.getImageData(X,X,this._config.deviceCellWidth,this._config.deviceCellHeight),C,F,y),!!q);re++);}if(m){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),re=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(X,X+Math.floor(this._config.deviceCharHeight/2)-re),this._tmpCtx.lineTo(X+this._config.deviceCharWidth*$,X+Math.floor(this._config.deviceCharHeight/2)-re),this._tmpCtx.stroke()}this._tmpCtx.restore();let E=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),R;if(this._config.allowTransparency?R=yW(E):R=rp(E,C,F,y),R)return Xy;let A=this._findGlyphBoundingBox(E,this._workBoundingBox,l,I,x,X),B,M;for(;;){if(this._activePages.length===0){let q=this._createNewPage();B=q,M=q.currentRow,M.height=A.size.y;break}B=this._activePages[this._activePages.length-1],M=B.currentRow;for(let q of this._activePages)A.size.y<=q.currentRow.height&&(B=q,M=q.currentRow);for(let q=this._activePages.length-1;q>=0;q--)for(let re of this._activePages[q].fixedRows)re.height<=M.height&&A.size.y<=re.height&&(B=this._activePages[q],M=re);if(A.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new sp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=true,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),B=this._overflowSizePage,M=this._overflowSizePage.currentRow,M.x+A.size.x>=B.canvas.width&&(M.x=0,M.y+=M.height,M.height=0);break}if(M.y+A.size.y>=B.canvas.height||M.height>A.size.y+2){let q=false;if(B.currentRow.y+B.currentRow.height+A.size.y>=B.canvas.height){let re;for(let ee of this._activePages)if(ee.currentRow.y+ee.currentRow.height+A.size.y=Lo.maxAtlasPages&&M.y+A.size.y<=B.canvas.height&&M.height>=A.size.y&&M.x+A.size.x<=B.canvas.width)q=true;else{let ee=this._createNewPage();B=ee,M=ee.currentRow,M.height=A.size.y,q=true}}q||(B.currentRow.height>0&&B.fixedRows.push(B.currentRow),M={x:0,y:B.currentRow.y+B.currentRow.height,height:A.size.y},B.fixedRows.push(M),B.currentRow={x:0,y:M.y+M.height,height:0})}if(M.x+A.size.x<=B.canvas.width)break;M===B.currentRow?(M.x=0,M.y+=M.height,M.height=0):B.fixedRows.splice(B.fixedRows.indexOf(M),1)}return A.texturePage=this._pages.indexOf(B),A.texturePosition.x=M.x,A.texturePosition.y=M.y,A.texturePositionClipSpace.x=M.x/B.canvas.width,A.texturePositionClipSpace.y=M.y/B.canvas.height,A.sizeClipSpace.x/=B.canvas.width,A.sizeClipSpace.y/=B.canvas.height,M.height=Math.max(M.height,A.size.y),M.x+=A.size.x,B.ctx.putImageData(E,A.texturePosition.x-this._workBoundingBox.left,A.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,A.size.x,A.size.y),B.addGlyph(A),B.version++,A}_findGlyphBoundingBox(e,t,s,r,n,o){t.top=0;let a=r?this._config.deviceCellHeight:this._tmpCanvas.height,l=r?this._config.deviceCellWidth:s,h=false;for(let c=0;c=o;c--){for(let d=0;d=0;c--){for(let d=0;d>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,a=t.rgba>>>24,l=t.rgba>>>16&255,h=t.rgba>>>8&255,c=Math.floor((Math.abs(r-a)+Math.abs(n-l)+Math.abs(o-h))/12),d=true;for(let u=0;u0)return false;return true}function i3(i,e,t){let s=i.createElement("canvas");return s.width=e,s.height=t,s}function bW(i,e,t,s,r,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:Mi,cursorAccent:Mi,selectionForeground:Mi,selectionBackgroundTransparent:Mi,selectionBackgroundOpaque:Mi,selectionInactiveBackgroundTransparent:Mi,selectionInactiveBackgroundOpaque:Mi,overviewRulerBorder:Mi,scrollbarSliderBackground:Mi,scrollbarSliderHoverBackground:Mi,scrollbarSliderActiveBackground:Mi,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:l}}function Ny(i,e){for(let t=0;t=0){if(Ny(f.config,h))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),Wi.splice(u,1)):f.ownedBy.splice(p,1);break}}for(let u=0;u{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=dc){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=dc-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=false,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=dc-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},dc)},e)}pause(){this.isCursorVisible=true,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Zy(i,e,t){let s=new e.ResizeObserver(r=>{let n=r.find(l=>l.target===i);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null?void 0:s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&t(o,a)});try{s.observe(i,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Vt(()=>s==null?void 0:s.disconnect())}function xW(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var Uy=class r3 extends zo{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new YC;this.combinedData=""}static fromCharData(e){let t=new r3;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?xW(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=false;if(e[1].length>2)t=true;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:t=true}else t=true}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var n3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function o3(i,e,t){let s=ct(i.createProgram());if(i.attachShader(s,ct(jy(i,i.VERTEX_SHADER,e))),i.attachShader(s,ct(jy(i,i.FRAGMENT_SHADER,t))),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS))return s;console.error(i.getProgramInfoLog(s)),i.deleteProgram(s)}function jy(i,e,t){let s=ct(i.createShader(e));if(i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS))return s;console.error(i.getShaderInfoLog(s)),i.deleteShader(s)}function kW(i,e){let t=Math.min(i.length*2,e),s=new Float32Array(t);for(let r=0;r{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new mW(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ep)(p),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let r=new ip(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=fW.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof ip?(this._deliveryQueue??(this._deliveryQueue=new vW),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=Vt(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof Ko?s.add(o):Array.isArray(s)&&s.push(o),_W);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*OW<=t.length){let h=0;for(let c=0;c0}};var vW=class vj{constructor(){this.i=-1;this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Xy={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};var Wa=2;var qa;var Dr=class Lo{constructor(e,t,s){this._document=e;this._config=t;this._unicodeService=s;this._didWarmUp=false;this._cacheMap=new qy;this._cacheMapCombined=new qy;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new zo;this._textureSize=512;this._onAddTextureAtlasCanvas=new Ne;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new Ne;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=false;this._createNewPage(),this._tmpCanvas=i3(e,this._config.deviceCellWidth*4+Wa*2,this._config.deviceCellHeight+Wa*2),this._tmpCtx=ct(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:true}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=true)}_doWarmUp(){let e=new aW;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let s=this._drawToCache(t,0,0,0,false,void 0);this._cacheMap.set(t,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=false}}_createNewPage(){if(Lo.maxAtlasPages&&this._pages.length>=Math.max(4,Lo.maxAtlasPages)){let t=this._pages.filter(h=>h.canvas.width*2<=(Lo.maxTextureSize||4096)).sort((h,c)=>c.canvas.width!==h.canvas.width?c.canvas.width-h.canvas.width:c.percentageUsed-h.percentageUsed),s=-1,r=0;for(let h=0;hh.glyphs[0].texturePage).sort((h,c)=>h>c?1:-1),a=this.pages.length-n.length,l=this._mergePages(n,a);l.version++;for(let h=o.length-1;h>=0;h--)this._deletePage(o[h]);this.pages.push(l),this._requestClearModel=true,this._onAddTextureAtlasCanvas.fire(l.canvas)}let e=new sp(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let s=e[0].canvas.width*2,r=new sp(this._document,s,e);for(let[n,o]of e.entries()){let a=n*o.canvas.width%s,l=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,a,l);for(let c of o.glyphs)c.texturePage=t,c.sizeClipSpace.x=c.size.x/s,c.sizeClipSpace.y=c.size.y/s,c.texturePosition.x+=a,c.texturePosition.y+=l,c.texturePositionClipSpace.x=c.texturePosition.x/s,c.texturePositionClipSpace.y=c.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let h=this._activePages.indexOf(o);h!==-1&&this._activePages.splice(h,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,s,r){if(this._config.allowTransparency)return Mi;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(t);break;case 50331648:let o=zo.toColorRGB(t);n=ni.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=rl.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=rl.opaque(n)),n}_getForegroundColor(e,t,s,r,n,o,a,l,h,c){let d=this._getMinimumContrastColor(e,t,s,r,n,o,a,h,l,c);if(d)return d;let u;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&o<8&&(o+=8),u=this._getColorFromAnsiIndex(o);break;case 50331648:let f=zo.toColorRGB(o);u=ni.toColor(f[0],f[1],f[2]);break;case 0:default:a?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=rl.opaque(u)),l&&(u=rl.multiplyOpacity(u,Yz)),u}_resolveBackgroundRgba(e,t,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,s,r,n,o,a,l,h,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(h),u=d.getColor(e,r);if(u!==void 0)return u||void 0;let f=this._resolveBackgroundRgba(t,s,a),p=this._resolveForegroundRgba(n,o,a,l),m=Zn.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(h?2:1));if(!m){d.setColor(e,r,null);return}let O=ni.toColor(m>>24&255,m>>16&255,m>>8&255);return d.setColor(e,r,O),O}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,s,r,n,o){let a=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+Wa*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width=q?q*2-De:q-De;!(De>=q)===false||oe===0?(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae+oe,ne),this._tmpCtx.lineTo(lt,ne)):(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(Ae+oe,ne),this._tmpCtx.moveTo(Ae+oe+q,ne),this._tmpCtx.lineTo(lt,ne)),De=Hz(lt-Ae,q,De);break;case 5:let Vs=.6,Fe=.3,Ys=lt-Ae,xa=Math.floor(Vs*Ys),Yi=Math.floor(Fe*Ys),kh=Ys-xa-Yi;this._tmpCtx.setLineDash([xa,Yi,kh]),this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(lt,ne);break;case 1:default:this._tmpCtx.moveTo(Ae,ne),this._tmpCtx.lineTo(lt,ne);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!x&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Ce=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ce&&Ce.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ae=new Path2D;Ae.rect(ee,ne-Math.ceil(q/2),this._config.deviceCellWidth*$,pe-ne+Math.ceil(q/2)),this._tmpCtx.clip(Ae),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=C.css,this._tmpCtx.strokeText(a,X,X+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(O){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),re=q%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(X,X+re),this._tmpCtx.lineTo(X+this._config.deviceCharWidth*$,X+re),this._tmpCtx.stroke()}if(x||this._tmpCtx.fillText(a,X,X+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let q=rp(this._tmpCtx.getImageData(X,X,this._config.deviceCellWidth,this._config.deviceCellHeight),C,F,y);if(q)for(let re=1;re<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=C.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,X,X+this._config.deviceCharHeight-re),q=rp(this._tmpCtx.getImageData(X,X,this._config.deviceCellWidth,this._config.deviceCellHeight),C,F,y),!!q);re++);}if(m){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),re=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(X,X+Math.floor(this._config.deviceCharHeight/2)-re),this._tmpCtx.lineTo(X+this._config.deviceCharWidth*$,X+Math.floor(this._config.deviceCharHeight/2)-re),this._tmpCtx.stroke()}this._tmpCtx.restore();let E=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),R;if(this._config.allowTransparency?R=yW(E):R=rp(E,C,F,y),R)return Xy;let A=this._findGlyphBoundingBox(E,this._workBoundingBox,l,I,x,X),B,M;for(;;){if(this._activePages.length===0){let q=this._createNewPage();B=q,M=q.currentRow,M.height=A.size.y;break}B=this._activePages[this._activePages.length-1],M=B.currentRow;for(let q of this._activePages)A.size.y<=q.currentRow.height&&(B=q,M=q.currentRow);for(let q=this._activePages.length-1;q>=0;q--)for(let re of this._activePages[q].fixedRows)re.height<=M.height&&A.size.y<=re.height&&(B=this._activePages[q],M=re);if(A.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new sp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=true,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),B=this._overflowSizePage,M=this._overflowSizePage.currentRow,M.x+A.size.x>=B.canvas.width&&(M.x=0,M.y+=M.height,M.height=0);break}if(M.y+A.size.y>=B.canvas.height||M.height>A.size.y+2){let q=false;if(B.currentRow.y+B.currentRow.height+A.size.y>=B.canvas.height){let re;for(let ee of this._activePages)if(ee.currentRow.y+ee.currentRow.height+A.size.y=Lo.maxAtlasPages&&M.y+A.size.y<=B.canvas.height&&M.height>=A.size.y&&M.x+A.size.x<=B.canvas.width)q=true;else{let ee=this._createNewPage();B=ee,M=ee.currentRow,M.height=A.size.y,q=true}}q||(B.currentRow.height>0&&B.fixedRows.push(B.currentRow),M={x:0,y:B.currentRow.y+B.currentRow.height,height:A.size.y},B.fixedRows.push(M),B.currentRow={x:0,y:M.y+M.height,height:0})}if(M.x+A.size.x<=B.canvas.width)break;M===B.currentRow?(M.x=0,M.y+=M.height,M.height=0):B.fixedRows.splice(B.fixedRows.indexOf(M),1)}return A.texturePage=this._pages.indexOf(B),A.texturePosition.x=M.x,A.texturePosition.y=M.y,A.texturePositionClipSpace.x=M.x/B.canvas.width,A.texturePositionClipSpace.y=M.y/B.canvas.height,A.sizeClipSpace.x/=B.canvas.width,A.sizeClipSpace.y/=B.canvas.height,M.height=Math.max(M.height,A.size.y),M.x+=A.size.x,B.ctx.putImageData(E,A.texturePosition.x-this._workBoundingBox.left,A.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,A.size.x,A.size.y),B.addGlyph(A),B.version++,A}_findGlyphBoundingBox(e,t,s,r,n,o){t.top=0;let a=r?this._config.deviceCellHeight:this._tmpCanvas.height,l=r?this._config.deviceCellWidth:s,h=false;for(let c=0;c=o;c--){for(let d=0;d=0;c--){for(let d=0;d>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,a=t.rgba>>>24,l=t.rgba>>>16&255,h=t.rgba>>>8&255,c=Math.floor((Math.abs(r-a)+Math.abs(n-l)+Math.abs(o-h))/12),d=true;for(let u=0;u0)return false;return true}function i3(i,e,t){let s=i.createElement("canvas");return s.width=e,s.height=t,s}function bW(i,e,t,s,r,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:Mi,cursorAccent:Mi,selectionForeground:Mi,selectionBackgroundTransparent:Mi,selectionBackgroundOpaque:Mi,selectionInactiveBackgroundTransparent:Mi,selectionInactiveBackgroundOpaque:Mi,overviewRulerBorder:Mi,scrollbarSliderBackground:Mi,scrollbarSliderHoverBackground:Mi,scrollbarSliderActiveBackground:Mi,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:l}}function Ny(i,e){for(let t=0;t=0){if(Ny(f.config,h))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),Wi.splice(u,1)):f.ownedBy.splice(p,1);break}}for(let u=0;u{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=dc){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=dc-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=false,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=dc-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},dc)},e)}pause(){this.isCursorVisible=true,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Zy(i,e,t){let s=new e.ResizeObserver(r=>{let n=r.find(l=>l.target===i);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null?void 0:s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&t(o,a)});try{s.observe(i,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Vt(()=>s==null?void 0:s.disconnect())}function xW(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var Uy=class r3 extends zo{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new YC;this.combinedData=""}static fromCharData(e){let t=new r3;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?xW(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=false;if(e[1].length>2)t=true;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:t=true}else t=true}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var n3=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function o3(i,e,t){let s=ct(i.createProgram());if(i.attachShader(s,ct(jy(i,i.VERTEX_SHADER,e))),i.attachShader(s,ct(jy(i,i.FRAGMENT_SHADER,t))),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS))return s;console.error(i.getProgramInfoLog(s)),i.deleteProgram(s)}function jy(i,e,t){let s=ct(i.createShader(e));if(i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS))return s;console.error(i.getShaderInfoLog(s)),i.deleteShader(s)}function kW(i,e){let t=Math.min(i.length*2,e),s=new Float32Array(t);for(let r=0;r{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}};var xq=new wq;function jc(i){kq(i)||xq.onUnexpectedError(i)}var Pg="Canceled";function kq(i){return i instanceof Cq?true:i instanceof Error&&i.name===Pg&&i.message===Pg}var Cq=class qj extends Error{constructor(){super(Pg),this.name=this.message}};function Tq(i){return new Error(\`Illegal argument: \${i}\`)}var pb=class $g extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof $g)return e;let t=new $g;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Eg=class S3 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,S3.prototype)}};function wi(i,e=0){return i[i.length-(1+e)]}var Pq;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Pq||(Pq={}));function $q(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var w3;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Qq(...i){let e=je(()=>no(i));return e}function je(i){let e=Eq({dispose:$q(()=>{i()})});return e}var k3=class C3{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{no(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?C3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),x3())}};k3.DISABLE_DISPOSED_WARNING=false;var tn=k3;var Oe=class Xj{constructor(){this._store=new tn;x3(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var fa=class Nj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var fr=typeof window=="object"?window:globalThis;var Qg=class Rg{constructor(e){this.element=e,this.next=Rg.Undefined,this.prev=Rg.Undefined}};Qg.Undefined=new Qg(void 0);var Ye=Qg;var gb=class Fj{constructor(){this._first=Ye.Undefined;this._last=Ye.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Ye.Undefined}clear(){let e=this._first;for(;e!==Ye.Undefined;){let t=e.next;e.prev=Ye.Undefined,e.next=Ye.Undefined,e=t}this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}unshift(e){return this._insert(e,false)}push(e){return this._insert(e,true)}_insert(e,t){let s=new Ye(e);if(this._first===Ye.Undefined)this._first=s,this._last=s;else if(t){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=false;return()=>{r||(r=true,this._remove(s))}}shift(){if(this._first!==Ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ye.Undefined&&e.next!==Ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ye.Undefined&&e.next===Ye.Undefined?(this._first=Ye.Undefined,this._last=Ye.Undefined):e.next===Ye.Undefined?(this._last=this._last.prev,this._last.next=Ye.Undefined):e.prev===Ye.Undefined&&(this._first=this._first.next,this._first.prev=Ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ye.Undefined;)yield e.element,e=e.next}};var Rq=globalThis.performance&&typeof globalThis.performance.now=="function";var Aq=class T3{static create(e){return new T3(e)}constructor(e){this._now=Rq&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var Xt;(i=>{i.None=()=>Oe.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=Qq(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new j(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let ke=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(ke),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new j(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new j({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new j({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new j({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new j;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new j(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof tn?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(Xt||(Xt={}));var Ag=class Lg{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${Lg._idPool++}\`,Lg.all.add(this)}start(e){this._stopWatch=new Aq,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ag.all=new Set,Ag._idPool=0;var Lq=Ag;var Mq=-1;var P3=class $3{constructor(e,t,s=($3._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}};var xq=new wq;function jc(i){kq(i)||xq.onUnexpectedError(i)}var Pg="Canceled";function kq(i){return i instanceof Cq?true:i instanceof Error&&i.name===Pg&&i.message===Pg}var Cq=class qj extends Error{constructor(){super(Pg),this.name=this.message}};function Tq(i){return new Error(\`Illegal argument: \${i}\`)}var pb=class $g extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof $g)return e;let t=new $g;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}};var Eg=class S3 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,S3.prototype)}};function wi(i,e=0){return i[i.length-(1+e)]}var Pq;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Pq||(Pq={}));function $q(i,e){let t=this,s=false,r;return function(){if(s)return r;if(s=true,e);else r=i.apply(t,arguments);return r}}var w3;(i=>{function e(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(_){yield _}i.single=r;function n(_){return e(_)?_:r(_)}i.wrap=n;function o(_){return _||t}i.from=o;function*a(_){for(let C=_.length-1;C>=0;C--)yield _[C]}i.reverse=a;function l(_){return!_||_[Symbol.iterator]().next().done===true}i.isEmpty=l;function h(_){return _[Symbol.iterator]().next().value}i.first=h;function c(_,C){let w=0;for(let Q of _)if(C(Q,w++))return true;return false}i.some=c;function d(_,C){for(let w of _)if(C(w))return w}i.find=d;function*u(_,C){for(let w of _)C(w)&&(yield w)}i.filter=u;function*f(_,C){let w=0;for(let Q of _)yield C(Q,w++)}i.map=f;function*p(_,C){let w=0;for(let Q of _)yield*C(Q,w++)}i.flatMap=p;function*m(..._){for(let C of _)yield*C}i.concat=m;function O(_,C,w){let Q=w;for(let D of _)Q=C(Q,D);return Q}i.reduce=O;function*v(_,C,w=_.length){for(C<0&&(C+=_.length),w<0?w+=_.length:w>_.length&&(w=_.length);C1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function Qq(...i){let e=je(()=>no(i));return e}function je(i){let e=Eq({dispose:$q(()=>{i()})});return e}var k3=class C3{constructor(){this._toDispose=new Set;this._isDisposed=false}dispose(){this._isDisposed||(this._isDisposed=true,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{no(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?C3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),x3())}};k3.DISABLE_DISPOSED_WARNING=false;var tn=k3;var Oe=class Xj{constructor(){this._store=new tn;x3(this._store)}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Oe.None=Object.freeze({dispose(){}});var fa=class Nj{constructor(){this._isDisposed=false}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null?void 0:t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=true,(e=this._value)==null?void 0:e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}};var fr=typeof window=="object"?window:globalThis;var Qg=class Rg{constructor(e){this.element=e,this.next=Rg.Undefined,this.prev=Rg.Undefined}};Qg.Undefined=new Qg(void 0);var Ye=Qg;var gb=class Fj{constructor(){this._first=Ye.Undefined;this._last=Ye.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Ye.Undefined}clear(){let e=this._first;for(;e!==Ye.Undefined;){let t=e.next;e.prev=Ye.Undefined,e.next=Ye.Undefined,e=t}this._first=Ye.Undefined,this._last=Ye.Undefined,this._size=0}unshift(e){return this._insert(e,false)}push(e){return this._insert(e,true)}_insert(e,t){let s=new Ye(e);if(this._first===Ye.Undefined)this._first=s,this._last=s;else if(t){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=false;return()=>{r||(r=true,this._remove(s))}}shift(){if(this._first!==Ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ye.Undefined&&e.next!==Ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ye.Undefined&&e.next===Ye.Undefined?(this._first=Ye.Undefined,this._last=Ye.Undefined):e.next===Ye.Undefined?(this._last=this._last.prev,this._last.next=Ye.Undefined):e.prev===Ye.Undefined&&(this._first=this._first.next,this._first.prev=Ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ye.Undefined;)yield e.element,e=e.next}};var Rq=globalThis.performance&&typeof globalThis.performance.now=="function";var Aq=class T3{static create(e){return new T3(e)}constructor(e){this._now=Rq&&e===false?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}};var Xt;(i=>{i.None=()=>Oe.None;function e(x,y){return d(x,()=>{},0,void 0,true,void 0,y)}i.defer=e;function t(x){return(y,$=null,E)=>{let R=false,A;return A=x(B=>{if(!R)return A?A.dispose():R=true,y.call($,B)},null,E),R&&A.dispose(),A}}i.once=t;function s(x,y,$){return h((E,R=null,A)=>x(B=>E.call(R,y(B)),null,A),$)}i.map=s;function r(x,y,$){return h((E,R=null,A)=>x(B=>{y(B),E.call(R,B)},null,A),$)}i.forEach=r;function n(x,y,$){return h((E,R=null,A)=>x(B=>y(B)&&E.call(R,B),null,A),$)}i.filter=n;function o(x){return x}i.signal=o;function a(...x){return(y,$=null,E)=>{let R=Qq(...x.map(A=>A(B=>y.call($,B))));return c(R,E)}}i.any=a;function l(x,y,$,E){let R=$;return s(x,A=>(R=y(R,A),R),E)}i.reduce=l;function h(x,y){let $,E={onWillAddFirstListener(){$=x(R.fire,R)},onDidRemoveLastListener(){$==null?void 0:$.dispose()}};let R=new j(E);return y==null?void 0:y.add(R),R.event}function c(x,y){return y instanceof Array?y.push(x):y&&y.add(x),x}function d(x,y,$=100,E=false,R=false,A,B){let M,q,re,ee=0,ne,Ie={leakWarningThreshold:A,onWillAddFirstListener(){M=x(De=>{ee++,q=y(q,De),E&&!re&&(pe.fire(q),q=void 0),ne=()=>{let Ce=q;q=void 0,re=void 0,(!E||ee>1)&&pe.fire(Ce),ee=0},typeof $=="number"?(clearTimeout(re),re=setTimeout(ne,$)):re===void 0&&(re=0,queueMicrotask(ne))})},onWillRemoveListener(){R&&ee>0&&(ne==null?void 0:ne())},onDidRemoveLastListener(){ne=void 0,M.dispose()}};let pe=new j(Ie);return B==null?void 0:B.add(pe),pe.event}i.debounce=d;function u(x,y=0,$){return i.debounce(x,(E,R)=>E?(E.push(R),E):[R],y,void 0,true,void 0,$)}i.accumulate=u;function f(x,y=(E,R)=>E===R,$){let E=true,R;return n(x,A=>{let B=E||!y(A,R);return E=false,R=A,B},$)}i.latch=f;function p(x,y,$){return[i.filter(x,y,$),i.filter(x,E=>!y(E),$)]}i.split=p;function m(x,y=false,$=[],E){let R=$.slice(),A=x(q=>{R?R.push(q):M.fire(q)});E&&E.add(A);let B=()=>{R==null?void 0:R.forEach(q=>M.fire(q)),R=null},M=new j({onWillAddFirstListener(){A||(A=x(q=>M.fire(q)),E&&E.add(A))},onDidAddFirstListener(){R&&(y?setTimeout(B):B())},onDidRemoveLastListener(){A&&A.dispose(),A=null}});return E&&E.add(M),M.event}i.buffer=m;function O(x,y){return($,E,R)=>{let A=y(new T);return x(function(B){let M=A.evaluate(B);M!==v&&$.call(E,M)},void 0,R)}}i.chain=O;let v=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(y){return this.steps.push(y),this}forEach(y){return this.steps.push($=>(y($),$)),this}filter(y){return this.steps.push($=>y($)?$:v),this}reduce(y,$){let E=$;return this.steps.push(R=>(E=y(E,R),E)),this}latch(y=($,E)=>$===E){let $=true,E;return this.steps.push(R=>{let A=$||!y(R,E);return $=false,E=R,A?R:v}),this}evaluate(y){for(let $ of this.steps)if(y=$(y),y===v)break;return y}}function k(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.on(y,E),A=()=>x.removeListener(y,E),B=new j({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromNodeEventEmitter=k;function _(x,y,$=E=>E){let E=(...M)=>B.fire($(...M)),R=()=>x.addEventListener(y,E),A=()=>x.removeEventListener(y,E),B=new j({onWillAddFirstListener:R,onDidRemoveLastListener:A});return B.event}i.fromDOMEventEmitter=_;function C(x){return new Promise(y=>t(x)(y))}i.toPromise=C;function w(x){let y=new j;return x.then($=>{y.fire($)},()=>{y.fire(void 0)}).finally(()=>{y.dispose()}),y.event}i.fromPromise=w;function Q(x,y){return x($=>y.fire($))}i.forward=Q;function D(x,y,$){return y($),x(E=>y(E))}i.runAndSubscribe=D;class I{constructor(y,$){this._observable=y;this._counter=0;this._hasChanged=false;let E={onWillAddFirstListener:()=>{y.addObserver(this)},onDidRemoveLastListener:()=>{y.removeObserver(this)}};this.emitter=new j(E),$&&$.add(this.emitter)}beginUpdate(y){this._counter++}handlePossibleChange(y){}handleChange(y,$){this._hasChanged=true}endUpdate(y){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=false,this.emitter.fire(this._observable.get())))}}function F(x,y){return new I(x,y).emitter.event}i.fromObservable=F;function X(x){return(y,$,E)=>{let R=0,A=false,B={beginUpdate(){R++},endUpdate(){R--,R===0&&(x.reportChanges(),A&&(A=false,y.call($)))},handlePossibleChange(){},handleChange(){A=true}};x.addObserver(B),x.reportChanges();let M={dispose(){x.removeObserver(B)}};return E instanceof tn?E.add(M):Array.isArray(E)&&E.push(M),M}}i.fromObservableLight=X})(Xt||(Xt={}));var Ag=class Lg{constructor(e){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=\`\${e}_\${Lg._idPool++}\`,Lg.all.add(this)}start(e){this._stopWatch=new Aq,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ag.all=new Set,Ag._idPool=0;var Lq=Ag;var Mq=-1;var P3=class $3{constructor(e,t,s=($3._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e;this.threshold=t;this.name=s;this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null?void 0:e.clear()}check(e,t){let s=this.threshold;if(s<=0||t{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t{var a,l,h,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=\`[\${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (\${this._size} vs \${this._leakageMon.threshold})\`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new zq(\`\${u}. HINT: Stack shows most frequent listener (\${f[1]}-times)\`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||jc)(p),Oe.None}if(this._disposed)return Oe.None;t&&(e=e.bind(t));let r=new fp(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Iq.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof fp?(this._deliveryQueue??(this._deliveryQueue=new Nq),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null?void 0:h.call(l,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null?void 0:d.call(c,this)),this._size++;let o=je(()=>{n==null?void 0:n(),this._removeListener(r)});if(s instanceof tn?s.add(o):Array.isArray(s)&&s.push(o),Xq);return o}),this._event}_removeListener(e){var n,o,a,l;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null?void 0:o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null?void 0:l.call(a,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*qq<=t.length){let h=0;for(let c=0;c0}};var Nq=class{constructor(){this.i=-1;this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var Mg=class jj{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new j;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new j;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Mg.INSTANCE=new Mg;var B0=Mg;function Fq(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}B0.INSTANCE.onDidChangeZoomLevel;function Zq(i){return B0.INSTANCE.getZoomFactor(i)}B0.INSTANCE.onDidChangeFullscreen;var Sa=typeof navigator=="object"?navigator.userAgent:"";var Bg=Sa.indexOf("Firefox")>=0;var Uq=Sa.indexOf("AppleWebKit")>=0;var I0=Sa.indexOf("Chrome")>=0;var jq=!I0&&Sa.indexOf("Safari")>=0;Sa.indexOf("Electron/")>=0;Sa.indexOf("Android")>=0;var pp=false;if(typeof fr.matchMedia=="function"){let i=fr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=fr.matchMedia("(display-mode: fullscreen)");pp=i.matches,Fq(fr,i,({matches:t})=>{pp&&e.matches||(pp=t)})}var qo="en";var Ig=false;var Dg=false;var Hc=false;var Q3=false;var fc;var Vc=qo;var Ob=qo;var Hq;var es;var jn=globalThis;var Wt;var VS;typeof jn.vscode<"u"&&typeof jn.vscode.process<"u"?Wt=jn.vscode.process:typeof process<"u"&&typeof((VS=process==null?void 0:process.versions)==null?void 0:VS.node)=="string"&&(Wt=process);var YS;var Vq=typeof((YS=Wt==null?void 0:Wt.versions)==null?void 0:YS.electron)=="string";var Yq=Vq&&(Wt==null?void 0:Wt.type)==="renderer";var GS;if(typeof Wt=="object"){Ig=Wt.platform==="win32",Dg=Wt.platform==="darwin",Hc=Wt.platform==="linux",Hc&&!!Wt.env.SNAP&&!!Wt.env.SNAP_REVISION,!!Wt.env.CI||!!Wt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fc=qo,Vc=qo;let i=Wt.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);fc=e.userLocale,Ob=e.osLocale,Vc=e.resolvedLanguage||qo,Hq=(GS=e.languagePack)==null?void 0:GS.translationsConfigFile}catch{}Q3=true}else typeof navigator=="object"&&!Yq?(es=navigator.userAgent,Ig=es.indexOf("Windows")>=0,Dg=es.indexOf("Macintosh")>=0,(es.indexOf("Macintosh")>=0||es.indexOf("iPad")>=0||es.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Hc=es.indexOf("Linux")>=0,(es==null?void 0:es.indexOf("Mobi"))>=0,Vc=globalThis._VSCODE_NLS_LANGUAGE||qo,fc=navigator.language.toLowerCase(),Ob=fc):console.error("Unable to resolve platform.");var R3=Ig;var qs=Dg;var Gq=Hc;var _b=Q3;var js=es;var Mr=Vc;var Kq;(i=>{function e(){return Mr}i.value=e;function t(){return Mr.length===2?Mr==="en":Mr.length>=3?Mr[0]==="e"&&Mr[1]==="n"&&Mr[2]==="-":false}i.isDefaultVariant=t;function s(){return Mr==="en"}i.isDefault=s})(Kq||(Kq={}));var Jq=typeof jn.postMessage=="function"&&!jn.importScripts;(()=>{if(Jq){let i=[];jn.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s{let s=++e;i.push({id:s,callback:t}),jn.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var eX=!!(js&&js.indexOf("Chrome")>=0);!!(js&&js.indexOf("Firefox")>=0);!!(!eX&&js&&js.indexOf("Safari")>=0);!!(js&&js.indexOf("Edg/")>=0);!!(js&&js.indexOf("Android")>=0);var Co=typeof navigator=="object"?navigator:{};({clipboard:{writeText:_b||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Co&&Co.clipboard&&Co.clipboard.writeText),readText:_b||!!(Co&&Co.clipboard&&Co.clipboard.readText)}});var D0=class Hj{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}};var mp=new D0;var vb=new D0;var yb=new D0;var tX=new Array(230);var A3;(i=>{function e(a){return mp.keyCodeToStr(a)}i.toString=e;function t(a){return mp.strToKeyCode(a)}i.fromString=t;function s(a){return vb.keyCodeToStr(a)}i.toUserSettingsUS=s;function r(a){return yb.keyCodeToStr(a)}i.toUserSettingsGeneral=r;function n(a){return vb.strToKeyCode(a)||yb.strToKeyCode(a)}i.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return mp.keyCodeToStr(a)}i.toElectronAccelerator=o})(A3||(A3={}));var iX=class L3{constructor(e,t,s,r,n){this.ctrlKey=e;this.shiftKey=t;this.altKey=s;this.metaKey=r;this.keyCode=n}equals(e){return e instanceof L3&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",t=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return\`K\${e}\${t}\${s}\${r}\${this.keyCode}\`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new sX([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var sX=class{constructor(i){if(i.length===0)throw Tq("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e{function e(t){return t===i.None||t===i.Cancelled||t instanceof uX?true:!t||typeof t!="object"?false:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:false,onCancellationRequested:Xt.None}),i.Cancelled=Object.freeze({isCancellationRequested:true,onCancellationRequested:M3})})(dX||(dX={}));var uX=class{constructor(){this._isCancelled=false;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=true,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?M3:(this._emitter||(this._emitter=new j),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var z0=class Kj{constructor(e,t){this._isDisposed=false;this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=true}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Eg("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Eg("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}};var fX=class{constructor(){this.disposable=void 0;this.isDisposed=false}cancel(){var i;(i=this.disposable)==null?void 0:i.dispose(),this.disposable=void 0}cancelAndSet(i,e,t=globalThis){if(this.isDisposed)throw new Eg("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=t.setInterval(()=>{i()},e);this.disposable=je(()=>{t.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=true}};var pX;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(pX||(pX={}));var xb=class Ii{static fromArray(e){return new Ii(t=>{t.emitMany(e)})}static fromPromise(e){return new Ii(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Ii(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Ii(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new j,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e{var t;return(t=this._onReturn)==null?void 0:t.call(this),{done:true,value:void 0}}}}static map(e,t){return new Ii(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Ii.map(this,e)}static filter(e,t){return new Ii(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Ii.filter(this,e)}static coalesce(e){return Ii.filter(e,t=>!!t)}coalesce(){return Ii.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Ii.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};xb.EMPTY=xb.fromArray([]);var{getWindow:Is,getWindowId:mX,onDidRegisterWindow:gX}=function(){let i=new Map;let e={window:fr,disposables:new tn};i.set(fr.vscodeWindowId,e);let t=new j,s=new j,r=new j;function n(o,a){return(typeof o=="number"?i.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Oe.None;let a=new tn,l={window:o,disposables:a.add(new tn)};return i.set(o.vscodeWindowId,l),a.add(je(()=>{i.delete(o.vscodeWindowId),s.fire(o)})),a.add(de(o,xt.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(l),a},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){var h;let a=o;if((h=a==null?void 0:a.ownerDocument)==null?void 0:h.defaultView)return a.ownerDocument.defaultView.window;let l=o;return(l==null?void 0:l.view)?l.view.window:fr},getDocument(o){return Is(o).document}}}();var OX=class{constructor(i,e,t,s){this._node=i,this._type=e,this._handler=t,this._options=s||false,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function de(i,e,t,s){return new OX(i,e,t,s)}var kb=function(i,e,t,s){let r=t;return de(i,e,r,s)};var W0;var _X=class extends fX{constructor(i){super(),this.defaultTarget=i&&Is(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}};var Cb=class Jj{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=false}dispose(){this._canceled=true}execute(){if(!this._canceled)try{this._runner()}catch(e){jc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,s=new Map,r=n=>{t.set(n,false);let o=i.get(n)??[];for(e.set(n,o),i.set(n,[]),s.set(n,true);o.length>0;)o.sort(Cb.sort),o.shift().execute();s.set(n,false)};W0=(n,o,a=0)=>{let l=mX(n),h=new Cb(o,a),c=i.get(l);return c||(c=[],i.set(l,c)),c.push(h),t.get(l)||(t.set(l,true),n.requestAnimationFrame(()=>r(l))),h}})();function vX(i){let e=i.getBoundingClientRect(),t=Is(i);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}var xt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"};var yX=class{constructor(i){this.domNode=i;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=false;this._contain="none";this._boxShadow=""}setMaxWidth(i){let e=mi(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=mi(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=mi(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=mi(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=mi(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=mi(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=mi(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=mi(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=mi(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=mi(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=mi(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=mi(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=mi(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=mi(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function mi(i){return typeof i=="number"?\`\${i}px\`:i}function xl(i){return new yX(i)}var B3=class eH{constructor(){this._hooks=new tn;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(false),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,n){this.isMonitoring()&&this.stopMonitoring(false),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(t),this._hooks.add(je(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Is(e)}this._hooks.add(de(o,xt.POINTER_MOVE,a=>{if(a.buttons!==s){this.stopMonitoring(true);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(de(o,xt.POINTER_UP,a=>this.stopMonitoring(true)))}};function bX(i,e,t){let s=null,r=null;if(typeof t.value=="function"?(s="value",r=t.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(s="get",r=t.get),!r)throw new Error("not supported");let n=\`$memoize$\${e}\`;t[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:false,enumerable:false,writable:false,value:r.apply(this,o)}),this[n]}}var ks;(i=>(i.Tap="-xterm-gesturetap",i.Change="-xterm-gesturechange",i.Start="-xterm-gesturestart",i.End="-xterm-gesturesend",i.Contextmenu="-xterm-gesturecontextmenu"))(ks||(ks={}));var nl=class Ut extends Oe{constructor(){super();this.dispatched=false;this.targets=new gb;this.ignoreTargets=new gb;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xt.runAndSubscribe(gX,({window:e,disposables:t})=>{t.add(de(e.document,"touchstart",s=>this.onTouchStart(s),{passive:false})),t.add(de(e.document,"touchend",s=>this.onTouchEnd(e,s))),t.add(de(e.document,"touchmove",s=>this.onTouchMove(s),{passive:false}))},{window:fr,disposables:this._store}))}static addTarget(e){if(!Ut.isTouchDevice())return Oe.None;Ut.INSTANCE||(Ut.INSTANCE=mb(new Ut));let t=Ut.INSTANCE.targets.push(e);return je(t)}static ignoreTarget(e){if(!Ut.isTouchDevice())return Oe.None;Ut.INSTANCE||(Ut.INSTANCE=mb(new Ut));let t=Ut.INSTANCE.ignoreTargets.push(e);return je(t)}static isTouchDevice(){return"ontouchstart"in fr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s=Ut.HOLD_DELAY&&Math.abs(l.initialPageX-wi(l.rollingPageX))<30&&Math.abs(l.initialPageY-wi(l.rollingPageY))<30){let c=this.newGestureEvent(ks.Contextmenu,l.initialTarget);c.pageX=wi(l.rollingPageX),c.pageY=wi(l.rollingPageY),this.dispatchEvent(c)}else if(r===1){let c=wi(l.rollingPageX),d=wi(l.rollingPageY),u=wi(l.rollingTimestamps)-l.rollingTimestamps[0],f=c-l.rollingPageX[0],p=d-l.rollingPageY[0],m=[...this.targets].filter(O=>l.initialTarget instanceof Node&&O.contains(l.initialTarget));this.inertia(e,m,s,Math.abs(f)/u,f>0?1:-1,c,Math.abs(p)/u,p>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ks.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=false)}newGestureEvent(e,t){let s=document.createEvent("CustomEvent");return s.initEvent(e,false,true),s.initialTarget=t,s.tapCount=0,s}dispatchEvent(e){if(e.type===ks.Tap){let t=new Date().getTime(),s=0;t-this._lastSetTapCountTime>Ut.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=t,e.tapCount=s}else(e.type===ks.Change||e.type===ks.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let t=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;t.push([r,s])}t.sort((s,r)=>s[0]-r[0]);for(let[s,r]of t)r.dispatchEvent(e),this.dispatched=true}}inertia(e,t,s,r,n,o,a,l,h){this.handle=W0(e,()=>{let c=Date.now(),d=c-s,u=0,f=0,p=true;r+=Ut.SCROLL_FRICTION*d,a+=Ut.SCROLL_FRICTION*d,r>0&&(p=false,u=n*r*d),a>0&&(p=false,f=l*a*d);let m=this.newGestureEvent(ks.Change);m.translationX=u,m.translationY=f,t.forEach(O=>O.dispatchEvent(m)),p||this.inertia(e,t,c,r,n,o+u,a,l,h+f)})}onTouchMove(e){let t=Date.now();for(let s=0,r=e.changedTouches.length;s3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=false)}};nl.SCROLL_FRICTION=-.005,nl.HOLD_DELAY=700,nl.CLEAR_TAP_COUNT_TIME=400,st([bX],nl,"isTouchDevice",1);var SX=nl;var q0=class tH extends Oe{onclick(e,t){this._register(de(e,xt.CLICK,s=>t(new pc(Is(e),s))))}onmousedown(e,t){this._register(de(e,xt.MOUSE_DOWN,s=>t(new pc(Is(e),s))))}onmouseover(e,t){this._register(de(e,xt.MOUSE_OVER,s=>t(new pc(Is(e),s))))}onmouseleave(e,t){this._register(de(e,xt.MOUSE_LEAVE,s=>t(new pc(Is(e),s))))}onkeydown(e,t){this._register(de(e,xt.KEY_DOWN,s=>t(new bb(s))))}onkeyup(e,t){this._register(de(e,xt.KEY_UP,s=>t(new bb(s))))}oninput(e,t){this._register(de(e,xt.INPUT,t))}onblur(e,t){this._register(de(e,xt.BLUR,t))}onfocus(e,t){this._register(de(e,xt.FOCUS,t))}onchange(e,t){this._register(de(e,xt.CHANGE,t))}ignoreGesture(e){return SX.ignoreTarget(e)}};var Tb=11;var wX=class extends q0{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.style.position="absolute",this.domNode.style.width=Tb+"px",this.domNode.style.height=Tb+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new B3),this._register(kb(this.bgDomNode,xt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(kb(this.domNode,xt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new _X),this._pointerdownScheduleRepeatTimer=this._register(new z0)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Is(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}};var xX=class zg{constructor(e,t,s,r,n,o,a){this._forceIntegerValues=e;this._scrollStateBrand=void 0;this._forceIntegerValues&&(t=t|0,s=s|0,r=r|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,t<0&&(t=0),r+t>s&&(r=s-t),r<0&&(r=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=t,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new zg(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new zg(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}};var kX=class iH extends Oe{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new j);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new xX(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),(r=this._smoothScrolling)==null?void 0:r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,false)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let r;t?r=new $b(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=$b.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,true),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}};var Pb=class{constructor(i,e,t){this.scrollLeft=i,this.scrollTop=e,this.isDone=t}};function gp(i,e){let t=e-i;return function(s){return i+t*PX(s)}}function CX(i,e,t){return function(s){return s2.5*s){let r,n;return e{var i;(i=this._domNode)==null?void 0:i.setClassName(this._visibleClassName)},0))}_hide(i){var e;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=false,(e=this._domNode)==null?void 0:e.setClassName(this._invisibleClassName+(i?" fade":"")))}};var EX=140;var I3=class sH extends q0{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new $X(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new B3),this._shouldRender=true,this.domNode=xl(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(de(this.domNode.domNode,xt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new wX(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=xl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(true),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(de(this.slider.domNode,xt.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=true,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=true,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=true,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(true)}beginHide(){this._visibilityController.setShouldBeVisible(false)}render(){this._shouldRender&&(this._shouldRender=false,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let n=vX(this.domNode.domNode);t=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",true),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),a=Math.abs(o-s);if(R3&&a>EX){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",false),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=true,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var D3=class qg{constructor(e,t,s,r,n,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=false,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new qg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),true):false}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),true):false}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),true):false}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,s,r,n){let o=Math.max(0,s-e),a=Math.max(0,o-2*t),l=r>0&&r>s;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*a/r))),c=(a-h)/(r-s),d=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(h),computedSliderRatio:c,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let e=qg._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,s=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),t){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(r,o),1),h=Math.max(Math.min(n,a),1),c=Math.max(r,o),d=Math.max(n,a);c%l===0&&d%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Xg.INSTANCE=new Xg;var MX=Xg;var BX=class extends q0{constructor(i,e,t){super();this._onScroll=this._register(new j);this.onScroll=this._onScroll.event;this._onWillScroll=this._register(new j);this.onWillScroll=this._onWillScroll.event;this._options=DX(e),this._scrollable=t,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new RX(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new QX(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(i),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=xl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=xl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=xl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new z0),this._isDragging=false,this._mouseIsOver=false,this._shouldRender=true,this._revealOnScroll=true}get options(){return this._options}dispose(){this._mouseWheelToDispose=no(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(i){this._verticalScrollbar.delegatePointerDown(i)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(i){this._scrollable.setScrollDimensions(i,false)}updateClassName(i){this._options.className=i,qs&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(i){typeof i.handleMouseWheel<"u"&&(this._options.handleMouseWheel=i.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof i.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=i.mouseWheelScrollSensitivity),typeof i.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=i.fastScrollSensitivity),typeof i.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=i.scrollPredominantAxis),typeof i.horizontal<"u"&&(this._options.horizontal=i.horizontal),typeof i.vertical<"u"&&(this._options.vertical=i.vertical),typeof i.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=i.horizontalScrollbarSize),typeof i.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=i.verticalScrollbarSize),typeof i.scrollByPage<"u"&&(this._options.scrollByPage=i.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(i){this._revealOnScroll=i}delegateScrollFromMouseWheelEvent(i){this._onMouseWheel(new wb(i))}_setListeningToMouseWheel(i){if(this._mouseWheelToDispose.length>0!==i&&(this._mouseWheelToDispose=no(this._mouseWheelToDispose),i)){let e=t=>{this._onMouseWheel(new wb(t))};this._mouseWheelToDispose.push(de(this._listenOnDomNode,xt.MOUSE_WHEEL,e,{passive:false}))}}_onMouseWheel(i){var r;if((r=i.browserEvent)==null?void 0:r.defaultPrevented)return;let e=MX.INSTANCE;e.acceptStandardWheelEvent(i);let t=false;if(i.deltaY||i.deltaX){let n=i.deltaY*this._options.mouseWheelScrollSensitivity,o=i.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let a=!qs&&i.browserEvent&&i.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=n,n=0),i.browserEvent&&i.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),h={};if(n){let c=Eb*n,d=l.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(h,d)}if(o){let c=Eb*o,d=l.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(h,d)}h=this._scrollable.validateScrollPosition(h),(l.scrollLeft!==h.scrollLeft||l.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),t=true)}let s=t;!s&&this._options.alwaysConsumeMouseWheel&&(s=true),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=true),s&&(i.preventDefault(),i.stopPropagation())}_onDidScroll(i){this._shouldRender=this._horizontalScrollbar.onDidScroll(i)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(i)||this._shouldRender,this._options.useShadows&&(this._shouldRender=true),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use \`lazyRender\` together with \`renderNow\`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=false,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let i=this._scrollable.getCurrentScrollPosition(),e=i.scrollTop>0,t=i.scrollLeft>0,s=t?" left":"",r=e?" top":"",n=t||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(\`shadow\${s}\`),this._topShadowDomNode.setClassName(\`shadow\${r}\`),this._topLeftShadowDomNode.setClassName(\`shadow\${n}\${r}\${s}\`)}}_onDragStart(){this._isDragging=true,this._reveal()}_onDragEnd(){this._isDragging=false,this._hide()}_onMouseLeave(i){this._mouseIsOver=false,this._hide()}_onMouseOver(i){this._mouseIsOver=true,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),AX)}};var IX=class extends BX{constructor(i,e,t){super(i,e,t)}setScrollPosition(i){i.reuseAnimation?this._scrollable.setScrollPositionSmooth(i,i.reuseAnimation):this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function DX(i){let e={lazyRender:typeof i.lazyRender<"u"?i.lazyRender:false,className:typeof i.className<"u"?i.className:"",useShadows:typeof i.useShadows<"u"?i.useShadows:true,handleMouseWheel:typeof i.handleMouseWheel<"u"?i.handleMouseWheel:true,flipAxes:typeof i.flipAxes<"u"?i.flipAxes:false,consumeMouseWheelIfScrollbarIsNeeded:typeof i.consumeMouseWheelIfScrollbarIsNeeded<"u"?i.consumeMouseWheelIfScrollbarIsNeeded:false,alwaysConsumeMouseWheel:typeof i.alwaysConsumeMouseWheel<"u"?i.alwaysConsumeMouseWheel:false,scrollYToX:typeof i.scrollYToX<"u"?i.scrollYToX:false,mouseWheelScrollSensitivity:typeof i.mouseWheelScrollSensitivity<"u"?i.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof i.fastScrollSensitivity<"u"?i.fastScrollSensitivity:5,scrollPredominantAxis:typeof i.scrollPredominantAxis<"u"?i.scrollPredominantAxis:true,mouseWheelSmoothScroll:typeof i.mouseWheelSmoothScroll<"u"?i.mouseWheelSmoothScroll:true,arrowSize:typeof i.arrowSize<"u"?i.arrowSize:11,listenOnDomNode:typeof i.listenOnDomNode<"u"?i.listenOnDomNode:null,horizontal:typeof i.horizontal<"u"?i.horizontal:1,horizontalScrollbarSize:typeof i.horizontalScrollbarSize<"u"?i.horizontalScrollbarSize:10,horizontalSliderSize:typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:0,horizontalHasArrows:typeof i.horizontalHasArrows<"u"?i.horizontalHasArrows:false,vertical:typeof i.vertical<"u"?i.vertical:1,verticalScrollbarSize:typeof i.verticalScrollbarSize<"u"?i.verticalScrollbarSize:10,verticalHasArrows:typeof i.verticalHasArrows<"u"?i.verticalHasArrows:false,verticalSliderSize:typeof i.verticalSliderSize<"u"?i.verticalSliderSize:0,scrollByPage:typeof i.scrollByPage<"u"?i.scrollByPage:false};return e.horizontalSliderSize=typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof i.verticalSliderSize<"u"?i.verticalSliderSize:e.verticalScrollbarSize,qs&&(e.className+=" mac"),e}var Ng=class nH extends Oe{constructor(e,t,s,r,n,o,a,l){super();this._bufferService=s;this._optionsService=a;this._renderService=l;this._onRequestScrollLines=this._register(new j);this.onRequestScrollLines=this._onRequestScrollLines.event;this._isSyncing=false;this._isHandlingScroll=false;this._suppressOnScrollHandler=false;let h=this._register(new kX({forceIntegerValues:false,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>W0(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new IX(t,{vertical:1,horizontal:2,useShadows:false,mouseWheelSmoothScroll:true,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Xt.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(je(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(je(()=>this._styleElement.remove())),this._register(Xt.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",\` background: \${o.colors.scrollbarSliderBackground.css};\`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",\` background: \${o.colors.scrollbarSliderHoverBackground.css};\`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",\` background: \${o.colors.scrollbarSliderActiveBackground.css};\`,"}"].join(\` \`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:true,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=true,this._suppressOnScrollHandler=true,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=false,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=false)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=true;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=false}};Ng=st([K(2,hi),K(3,kr),K(4,O3),K(5,ba),K(6,ci),K(7,Cr)],Ng);var Fg=class oH extends Oe{constructor(e,t,s,r,n){super();this._screenElement=e;this._bufferService=t;this._coreBrowserService=s;this._decorationService=r;this._renderService=n;this._decorationElements=new Map;this._altBufferIsActive=false;this._dimensionsChanged=false;this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=true,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(je(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=false}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=\`\${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px\`,t.style.height=\`\${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px\`,t.style.top=\`\${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px\`,t.style.lineHeight=\`\${this._renderService.dimensions.css.cell.height}px\`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=\`\${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px\`,s.style.height=\`\${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px\`,s.style.top=\`\${t*this._renderService.dimensions.css.cell.height}px\`,s.style.lineHeight=\`\${this._renderService.dimensions.css.cell.height}px\`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?\`\${s*this._renderService.dimensions.css.cell.width}px\`:"":t.style.left=s?\`\${s*this._renderService.dimensions.css.cell.width}px\`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null?void 0:t.remove(),this._decorationElements.delete(e),e.dispose()}};Fg=st([K(1,hi),K(2,kr),K(3,bh),K(4,Cr)],Fg);var zX=class{constructor(){this._zones=[];this._zonePool=[];this._zonePoolIndex=0;this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(i){if(i.options.overviewRulerOptions){for(let e of this._zones)if(e.color===i.options.overviewRulerOptions.color&&e.position===i.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,i.marker.line))return;if(this._lineAdjacentToZone(e,i.marker.line,i.options.overviewRulerOptions.position)){this._addLineToZone(e,i.marker.line);return}}if(this._zonePoolIndex=i.startBufferLine&&e<=i.endBufferLine}_lineAdjacentToZone(i,e,t){return e>=i.startBufferLine-this._linePadding[t||"full"]&&e<=i.endBufferLine+this._linePadding[t||"full"]}_addLineToZone(i,e){i.startBufferLine=Math.min(i.startBufferLine,e),i.endBufferLine=Math.max(i.endBufferLine,e)}};var vs={full:0,left:0,center:0,right:0};var Br={full:0,left:0,center:0,right:0};var Na={full:0,left:0,center:0,right:0};var Zd=class aH extends Oe{constructor(e,t,s,r,n,o,a,l){var c;super();this._viewportElement=e;this._screenElement=t;this._bufferService=s;this._decorationService=r;this._renderService=n;this._optionsService=o;this._themeService=a;this._coreBrowserService=l;this._colorZoneStore=new zX;this._shouldUpdateDimensions=true;this._shouldUpdateAnchor=true;this._lastKnownBufferLength=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null?void 0:c.insertBefore(this._canvas,this._viewportElement),this._register(je(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,true))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,true))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(true),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(true))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(true))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(true)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Br.full=this._canvas.width,Br.left=e,Br.center=t,Br.right=e,this._refreshDrawHeightConstants(),Na.full=1,Na.left=1,Na.center=1+Br.left,Na.right=1+Br.left+Br.center}_refreshDrawHeightConstants(){vs.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);vs.left=t,vs.center=t,vs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vs.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=\`\${this._width}px\`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=\`\${this._screenElement.clientHeight}px\`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=false,this._shouldUpdateAnchor=false}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Na[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-vs[e.position||"full"]/2),Br[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+vs[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Zd=st([K(2,hi),K(3,bh),K(4,Cr),K(5,ci),K(6,ba),K(7,kr)],Zd);var W;(i=>(i.NUL="\\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="\\x07",i.BS="\\b",i.HT=" ",i.LF=\` -\`,i.VT="\\v",i.FF="\\f",i.CR="\\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(W||(W={}));var Yc;(i=>(i.PAD="€",i.HOP="",i.BPH="‚",i.NBH="ƒ",i.IND="„",i.NEL="…",i.SSA="†",i.ESA="‡",i.HTS="ˆ",i.HTJ="‰",i.VTS="Š",i.PLD="‹",i.PLU="Œ",i.RI="",i.SS2="Ž",i.SS3="",i.DCS="",i.PU1="‘",i.PU2="’",i.STS="“",i.CCH="”",i.MW="•",i.SPA="–",i.EPA="—",i.SOS="˜",i.SGCI="™",i.SCI="š",i.CSI="›",i.ST="œ",i.OSC="",i.PM="ž",i.APC="Ÿ"))(Yc||(Yc={}));var z3;(i=>i.ST=\`\${W.ESC}\\\\\`)(z3||(z3={}));var Zg=class lH{constructor(e,t,s,r,n,o){this._textarea=e;this._compositionView=t;this._bufferService=s;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=false,this._isSendingComposition=false,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=true,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(true)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return false;this._finalizeComposition(false)}return e.keyCode===229?(this._handleAnyTextareaChanges(),false):true}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=false,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=true,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=false;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,true)}},0)}else{this._isSendingComposition=false;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,true)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,true):t.lengththis.updateCompositionElements(true),0)}}};Zg=st([K(2,hi),K(3,ci),K(4,po),K(5,Cr)],Zg);var $t=0;var Et=0;var Qt=0;var tt=0;var Qb={css:"#00000000",rgba:0};var dt;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${xn(r)}\${xn(n)}\${xn(o)}\${xn(a)}\`:\`#\${xn(r)}\${xn(n)}\${xn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(dt||(dt={}));var Xe;(i=>{function e(l,h){if(tt=(h.rgba&255)/255,tt===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;$t=f+Math.round((c-f)*tt),Et=p+Math.round((d-p)*tt),Qt=m+Math.round((u-m)*tt);let O=dt.toCss($t,Et,Qt),v=dt.toRgba($t,Et,Qt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Gc.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return dt.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[$t,Et,Qt]=Gc.toChannels(h),{css:dt.toCss($t,Et,Qt),rgba:h}}i.opaque=r;function n(l,h){return tt=Math.round(h*255),[$t,Et,Qt]=Gc.toChannels(l.rgba),{css:dt.toCss($t,Et,Qt,tt),rgba:dt.toRgba($t,Et,Qt,tt)}}i.opacity=n;function o(l,h){return tt=l.rgba&255,n(l,tt*h/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(Xe||(Xe={}));var Ge;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:true});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\\da-f]{3,8}/i))switch(r.length){case 4:return $t=parseInt(r.slice(1,2).repeat(2),16),Et=parseInt(r.slice(2,3).repeat(2),16),Qt=parseInt(r.slice(3,4).repeat(2),16),dt.toColor($t,Et,Qt);case 5:return $t=parseInt(r.slice(1,2).repeat(2),16),Et=parseInt(r.slice(2,3).repeat(2),16),Qt=parseInt(r.slice(3,4).repeat(2),16),tt=parseInt(r.slice(4,5).repeat(2),16),dt.toColor($t,Et,Qt,tt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(n)return $t=parseInt(n[1]),Et=parseInt(n[2]),Qt=parseInt(n[3]),tt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),dt.toColor($t,Et,Qt,tt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[$t,Et,Qt,tt]=e.getImageData(0,0,1,1).data,tt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:dt.toRgba($t,Et,Qt,tt),css:r}}i.toColor=s})(Ge||(Ge={}));var si;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}i.relativeLuminance2=t})(si||(si={}));var Gc;(i=>{function e(o,a){if(tt=(a&255)/255,tt===1)return a;let l=a>>24&255,h=a>>16&255,c=a>>8&255,d=o>>24&255,u=o>>16&255,f=o>>8&255;return $t=d+Math.round((l-d)*tt),Et=u+Math.round((h-u)*tt),Qt=f+Math.round((c-f)*tt),dt.toRgba($t,Et,Qt)}i.blend=e;function t(o,a,l){let h=si.relativeLuminance(o>>8),c=si.relativeLuminance(a>>8);if(tr(h,c)>8));if(p>8));return p>O?f:m}return f}let d=r(o,a,l),u=tr(h,si.relativeLuminance(d>>8));if(u>8));return u>p?d:f}return d}}i.ensureContrastRatio=t;function s(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));for(;m0||f>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));return(u<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));for(;m>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Gc||(Gc={}));function xn(i){let e=i.toString(16);return e.length<2?"0"+e:e}function tr(i,e){return i1){let d=this._getJoinedRanges(r,a,o,t,n);for(let u=0;u1){let c=this._getJoinedRanges(r,a,o,t,n);for(let d=0;d=X,B=$,M=this._workCell;if(f.length>0&&$===f[0][0]&&A){let oe=f.shift(),Vs=this._isCellInSelection(oe[0],t);for(k=oe[0]+1;k=oe[1]),A?(R=true,M=new WX(this._workCell,e.translateToString(true,oe[0],oe[1]),oe[1]-oe[0]),B=oe[1]-1,E=M.getWidth()):X=oe[1]}let q=this._isCellInSelection($,t),re=s&&$===o,ee=y&&$>=c&&$<=d,ne=false;this._decorationService.forEachDecorationAtCell($,t,void 0,oe=>{ne=true});let Ie=M.getChars()||Kr;if(Ie===" "&&(M.isUnderline()||M.isOverline())&&(Ie=" "),F=E*l-h.get(Ie,M.isBold(),M.isItalic()),!O)O=this._document.createElement("span");else if(v&&(q&&I||!q&&!I&&M.bg===_)&&(q&&I&&p.selectionForeground||M.fg===C)&&M.extended.ext===w&&ee===Q&&F===D&&!re&&!R&&!ne&&A){M.isInvisible()?T+=Kr:T+=Ie,v++;continue}else v&&(O.textContent=T),O=this._document.createElement("span"),v=0,T="";if(_=M.bg,C=M.fg,w=M.extended.ext,Q=ee,D=F,I=q,R&&o>=$&&o<=B&&(o=$),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if(x.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&x.push("xterm-cursor-blink"),x.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":x.push("xterm-cursor-outline");break;case"block":x.push("xterm-cursor-block");break;case"bar":x.push("xterm-cursor-bar");break;case"underline":x.push("xterm-cursor-underline");break}}if(M.isBold()&&x.push("xterm-bold"),M.isItalic()&&x.push("xterm-italic"),M.isDim()&&x.push("xterm-dim"),M.isInvisible()?T=Kr:T=M.getChars()||Kr,M.isUnderline()&&(x.push(\`xterm-underline-\${M.extended.underlineStyle}\`),T===" "&&(T=" "),!M.isUnderlineColorDefault()))if(M.isUnderlineColorRGB())O.style.textDecorationColor=\`rgb(\${yh.toColorRGB(M.getUnderlineColor()).join(",")})\`;else{let oe=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&oe<8&&(oe+=8),O.style.textDecorationColor=p.ansi[oe].css}M.isOverline()&&(x.push("xterm-overline"),T===" "&&(T=" ")),M.isStrikethrough()&&x.push("xterm-strikethrough"),ee&&(O.style.textDecoration="underline");let pe=M.getFgColor(),De=M.getFgColorMode(),ke=M.getBgColor(),Ae=M.getBgColorMode(),lt=!!M.isInverse();if(lt){let oe=pe;pe=ke,ke=oe;let Vs=De;De=Ae,Ae=Vs}let di,Qi,ve=false;this._decorationService.forEachDecorationAtCell($,t,void 0,oe=>{oe.options.layer!=="top"&&ve||(oe.backgroundColorRGB&&(Ae=50331648,ke=oe.backgroundColorRGB.rgba>>8&16777215,di=oe.backgroundColorRGB),oe.foregroundColorRGB&&(De=50331648,pe=oe.foregroundColorRGB.rgba>>8&16777215,Qi=oe.foregroundColorRGB),ve=oe.options.layer==="top")}),!ve&&q&&(di=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ke=di.rgba>>8&16777215,Ae=50331648,ve=true,p.selectionForeground&&(De=50331648,pe=p.selectionForeground.rgba>>8&16777215,Qi=p.selectionForeground)),ve&&x.push("xterm-decoration-top");let ei;switch(Ae){case 16777216:case 33554432:ei=p.ansi[ke],x.push(\`xterm-bg-\${ke}\`);break;case 50331648:ei=dt.toColor(ke>>16,ke>>8&255,ke&255),this._addStyle(O,\`background-color:#\${Rb((ke>>>0).toString(16),"0",6)}\`);break;case 0:default:lt?(ei=p.foreground,x.push(\`xterm-bg-\${257}\`)):ei=p.background}switch(di||M.isDim()&&(di=Xe.multiplyOpacity(ei,.5)),De){case 16777216:case 33554432:M.isBold()&&pe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(pe+=8),this._applyMinimumContrast(O,ei,p.ansi[pe],M,di,void 0)||x.push(\`xterm-fg-\${pe}\`);break;case 50331648:let oe=dt.toColor(pe>>16&255,pe>>8&255,pe&255);this._applyMinimumContrast(O,ei,oe,M,di,Qi)||this._addStyle(O,\`color:#\${Rb(pe.toString(16),"0",6)}\`);break;case 0:default:this._applyMinimumContrast(O,ei,p.foreground,M,di,Qi)||lt&&x.push(\`xterm-fg-\${257}\`)}x.length&&(O.className=x.join(" "),x.length=0),!re&&!R&&!ne&&A?v++:O.textContent=T,F!==this.defaultSpacing&&(O.style.letterSpacing=\`\${F}px\`),u.push(O),$=B}return O&&v&&(O.textContent=T),u}_applyMinimumContrast(e,t,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||NX(r.getCode()))return false;let a=this._getContrastCache(r),l;if(!n&&!o&&(l=a.getColor(t.rgba,s.rgba)),l===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=Xe.ensureContrastRatio(n||t,o||s,h),a.setColor((n||t).rgba,(o||s).rgba,l??null)}return l?(this._addStyle(e,\`color:\${l.css}\`),true):false}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",\`\${e.getAttribute("style")||""}\${t};\`)}_isCellInSelection(e,t){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?false:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t=s[0]&&e=s[0]}};Ug=st([K(1,y3),K(2,ci),K(3,kr),K(4,po),K(5,bh),K(6,ba)],Ug);function Rb(i,e,t){for(;i.length0&&(this._flat[s]=o),o}let r=i;e&&(r+="B"),t&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;e&&(o|=1),t&&(o|=2),n=this._measure(i,o),n>0&&this._holey.set(r,n)}return n}_measure(i,e){let t=this._measureElements[e];return t.textContent=i.repeat(32),t.offsetWidth/32}};var UX=class{constructor(){this.clear()}clear(){this.hasSelection=false,this.columnSelectMode=false,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(i,e,t,s=false){if(this.selectionStart=e,this.selectionEnd=t,!e||!t||e[0]===t[0]&&e[1]===t[1]){this.clear();return}let r=i.buffers.active.ydisp,n=e[1]-r,o=t[1]-r,a=Math.max(n,0),l=Math.min(o,i.rows-1);if(a>=i.rows||l<0){this.clear();return}this.hasSelection=true,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=e[0],this.endCol=t[0]}isCellSelected(i,e,t){return this.hasSelection?(t-=i.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&t>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&t<=this.viewportCappedEndRow:t>this.viewportStartRow&&t=this.startCol&&e=this.startCol):false}};function jX(){return new UX}var Op="xterm-dom-renderer-owner-";var Ai="xterm-rows";var gc="xterm-fg-";var Ab="xterm-bg-";var Fa="xterm-focus";var Oc="xterm-selection";var HX=1;var jg=class dH extends Oe{constructor(e,t,s,r,n,o,a,l,h,c,d,u,f,p){super();this._terminal=e;this._document=t;this._element=s;this._screenElement=r;this._viewportElement=n;this._helperContainer=o;this._linkifier2=a;this._charSizeService=h;this._optionsService=c;this._bufferService=d;this._coreService=u;this._coreBrowserService=f;this._themeService=p;this._terminalClass=HX++;this._rowElements=[];this._selectionRenderModel=jX();this.onRequestRedraw=this._register(new j).event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ai),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Oc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=FX(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Ug,document),this._element.classList.add(Op+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(je(()=>{this._element.classList.remove(Op+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ZX(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=\`\${this.dimensions.css.canvas.width}px\`,s.style.height=\`\${this.dimensions.css.cell.height}px\`,s.style.lineHeight=\`\${this.dimensions.css.cell.height}px\`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=\`\${this._terminalSelector} .\${Ai} span { display: inline-block; height: 100%; vertical-align: top;}\`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=\`\${this.dimensions.css.canvas.width}px\`,this._screenElement.style.height=\`\${this.dimensions.css.canvas.height}px\`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=\`\${this._terminalSelector} .\${Ai} { pointer-events: none; color: \${e.foreground.css}; font-family: \${this._optionsService.rawOptions.fontFamily}; font-size: \${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}\`;t+=\`\${this._terminalSelector} .\${Ai} .xterm-dim { color: \${Xe.multiplyOpacity(e.foreground,.5).css};}\`,t+=\`\${this._terminalSelector} span:not(.xterm-bold) { font-weight: \${this._optionsService.rawOptions.fontWeight};}\${this._terminalSelector} span.xterm-bold { font-weight: \${this._optionsService.rawOptions.fontWeightBold};}\${this._terminalSelector} span.xterm-italic { font-style: italic;}\`;let s=\`blink_underline_\${this._terminalClass}\`,r=\`blink_bar_\${this._terminalClass}\`,n=\`blink_block_\${this._terminalClass}\`;t+=\`@keyframes \${s} { 50% { border-bottom-style: hidden; }}\`,t+=\`@keyframes \${r} { 50% { box-shadow: none; }}\`,t+=\`@keyframes \${n} { 0% { background-color: \${e.cursor.css}; color: \${e.cursorAccent.css}; } 50% { background-color: inherit; color: \${e.cursor.css}; }}\`,t+=\`\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: \${s} 1s step-end infinite;}\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: \${r} 1s step-end infinite;}\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: \${n} 1s step-end infinite;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-block { background-color: \${e.cursor.css}; color: \${e.cursorAccent.css};}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: \${e.cursor.css} !important; color: \${e.cursorAccent.css} !important;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-outline { outline: 1px solid \${e.cursor.css}; outline-offset: -1px;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-bar { box-shadow: \${this._optionsService.rawOptions.cursorWidth}px 0 0 \${e.cursor.css} inset;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px \${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}\`,t+=\`\${this._terminalSelector} .\${Oc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}\${this._terminalSelector}.focus .\${Oc} div { position: absolute; background-color: \${e.selectionBackgroundOpaque.css};}\${this._terminalSelector} .\${Oc} div { position: absolute; background-color: \${e.selectionInactiveBackgroundOpaque.css};}\`;for(let[o,a]of e.ansi.entries())t+=\`\${this._terminalSelector} .\${gc}\${o} { color: \${a.css}; }\${this._terminalSelector} .\${gc}\${o}.xterm-dim { color: \${Xe.multiplyOpacity(a,.5).css}; }\${this._terminalSelector} .\${Ab}\${o} { background-color: \${a.css}; }\`;t+=\`\${this._terminalSelector} .\${gc}\${257} { color: \${Xe.opaque(e.background).css}; }\${this._terminalSelector} .\${gc}\${257}.xterm-dim { color: \${Xe.multiplyOpacity(Xe.opaque(e.background),.5).css}; }\${this._terminalSelector} .\${Ab}\${257} { background-color: \${e.foreground.css}; }\`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",false,false);this._rowContainer.style.letterSpacing=\`\${e}px\`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Fa),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Fa),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(s){let h=e[0]>t[0];l.appendChild(this._createSelectionElement(o,h?t[0]:e[0],h?e[0]:t[0],a-o+1))}else{let h=r===o?e[0]:0,c=o===n?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,h,c));let d=a-o-1;if(l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,d)),o!==a){let u=n===a?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,s,r=1){let n=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(s-t);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),n.style.height=\`\${r*this.dimensions.css.cell.height}px\`,n.style.top=\`\${e*this.dimensions.css.cell.height}px\`,n.style.left=\`\${o}px\`,n.style.width=\`\${a}px\`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let c=h+s.ydisp,d=this._rowElements[h],u=s.lines.get(c);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,c,c===r,a,l,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return\`.\${Op}\${this._terminalClass}\`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,true)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,false)}_setCellUnderline(e,t,s,r,n,o){s<0&&(e=0),r<0&&(t=0);let a=this._bufferService.rows-1;s=Math.max(Math.min(s,a),0),r=Math.max(Math.min(r,a),0),n=Math.min(n,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,c=Math.min(l.x,n-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=s;p<=r;++p){let m=p+l.ydisp,O=this._rowElements[p],v=l.lines.get(m);if(!O||!v)break;O.replaceChildren(...this._rowFactory.createRow(v,m,m===h,u,f,c,d,this.dimensions.css.cell.width,this._widthCache,o?p===s?e:0:-1,o?(p===r?t:n)-1:-1))}}};jg=st([K(7,L0),K(8,Tu),K(9,ci),K(10,hi),K(11,po),K(12,kr),K(13,ba)],jg);var Hg=class uH extends Oe{constructor(e,t,s){super();this._optionsService=s;this.width=0;this.height=0;this._onCharSizeChange=this._register(new j);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new YX(this._optionsService))}catch{this._measureStrategy=this._register(new VX(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Hg=st([K(2,ci)],Hg);var W3=class extends Oe{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(i,e){i!==void 0&&i>0&&e!==void 0&&e>0&&(this._result.width=i,this._result.height=e)}};var VX=class extends W3{constructor(i,e,t){super();this._document=i;this._parentElement=e;this._optionsService=t;this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=\`\${this._optionsService.rawOptions.fontSize}px\`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}};var YX=class extends W3{constructor(i){super();this._optionsService=i;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=\`\${this._optionsService.rawOptions.fontSize}px \${this._optionsService.rawOptions.fontFamily}\`;let i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}};var GX=class extends Oe{constructor(i,e,t){super();this._textarea=i;this._window=e;this.mainDocument=t;this._isFocused=false;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new KX(this._window));this._onDprChange=this._register(new j);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new j);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Xt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(de(this._textarea,"focus",()=>this._isFocused=true)),this._register(de(this._textarea,"blur",()=>this._isFocused=false))}get window(){return this._window}set window(i){this._window!==i&&(this._window=i,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}};var KX=class extends Oe{constructor(i){super();this._parentWindow=i;this._windowResizeListener=this._register(new fa);this._onDprChange=this._register(new j);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(je(()=>this.clearListener()))}setWindow(i){this._parentWindow=i,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=de(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var i;this._outerListener&&((i=this._resolutionMediaMatchList)==null?void 0:i.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(\`screen and (resolution: \${this._parentWindow.devicePixelRatio}dppx)\`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}};var JX=class extends Oe{constructor(){super();this.linkProviders=[];this._register(je(()=>this.linkProviders.length=0))}registerLinkProvider(i){return this.linkProviders.push(i),{dispose:()=>{let e=this.linkProviders.indexOf(i);e!==-1&&this.linkProviders.splice(e,1)}}}};function X0(i,e,t){let s=t.getBoundingClientRect(),r=i.getComputedStyle(t),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function eN(i,e,t,s,r,n,o,a,l){if(!n)return;let h=X0(i,e,t);if(h)return h[0]=Math.ceil((h[0]+(l?o/2:0))/o),h[1]=Math.ceil(h[1]/a),h[0]=Math.min(Math.max(h[0],1),s+(l?1:0)),h[1]=Math.min(Math.max(h[1],1),r),h}var Vg=class fH{constructor(e,t){this._renderService=e;this._charSizeService=t}getCoords(e,t,s,r,n){return eN(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let s=X0(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Vg=st([K(0,Cr),K(1,Tu)],Vg);var tN=class{constructor(i,e){this._renderCallback=i;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(i){return this._refreshCallbacks.push(i),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(i,e,t){this._rowCount=t,i=i!==void 0?i:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let i=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}};var q3={};cq(q3,{getSafariVersion:()=>sN,isChromeOS:()=>Z3,isFirefox:()=>X3,isIpad:()=>rN,isIphone:()=>nN,isLegacyEdge:()=>iN,isLinux:()=>N0,isMac:()=>jd,isNode:()=>Pu,isSafari:()=>N3,isWindows:()=>F3});var Pu=typeof process<"u"&&"title"in process;var Sh=Pu?"node":navigator.userAgent;var wh=Pu?"node":navigator.platform;var X3=Sh.includes("Firefox");var iN=Sh.includes("Edge");var N3=/^((?!chrome|android).)*safari/i.test(Sh);function sN(){if(!N3)return 0;let i=Sh.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var jd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(wh);var rN=wh==="iPad";var nN=wh==="iPhone";var F3=["Windows","Win16","Win32","WinCE"].includes(wh);var N0=wh.indexOf("Linux")>=0;var Z3=/\\bCrOS\\b/.test(Sh);var U3=class{constructor(){this._tasks=[];this._i=0}enqueue(i){this._tasks.push(i),this._start()}flush(){for(;this._ir){s-e<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(s-e))}ms\`),this._start();return}s=r}this.clear()}};var oN=class extends U3{_requestCallback(i){return setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){clearTimeout(i)}_createDeadline(i){let e=performance.now()+i;return{timeRemaining:()=>Math.max(0,e-performance.now())}}};var aN=class extends U3{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}};var Hd=!Pu&&"requestIdleCallback"in window?aN:oN;var lN=class{constructor(){this._queue=new Hd}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};var Yg=class pH extends Oe{constructor(e,t,s,r,n,o,a,l,h){super();this._rowCount=e;this._optionsService=s;this._charSizeService=r;this._coreService=n;this._coreBrowserService=l;this._renderer=this._register(new fa);this._pausedResizeTask=new lN;this._observerDisposable=this._register(new fa);this._isPaused=false;this._needsFullRefresh=false;this._isNextRenderRedrawOnly=true;this._needsSelectionRefresh=false;this._canvasWidth=0;this._canvasHeight=0;this._selectionState={start:void 0,end:void 0,columnSelectMode:false};this._onDimensionsChange=this._register(new j);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new j);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new j);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new j);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new tN((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new hN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(je(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,true))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=je(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=false)}refreshRows(e,t,s=false){if(this._isPaused){this._needsFullRefresh=true;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=false),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=false),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=true}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,true)),this._needsSelectionRefresh=true,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=true:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null?void 0:t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null?void 0:e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null?void 0:e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null?void 0:e.handleFocus()}handleSelectionChanged(e,t,s){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null?void 0:r.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null?void 0:e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null?void 0:e.clear()}};Yg=st([K(2,ci),K(3,Tu),K(4,po),K(5,bh),K(6,hi),K(7,kr),K(8,ba)],Yg);var hN=class{constructor(i,e,t){this._coreBrowserService=i;this._coreService=e;this._onTimeout=t;this._start=0;this._end=0;this._isBuffering=false}bufferRows(i,e){this._isBuffering?(this._start=Math.min(this._start,i),this._end=Math.max(this._end,e)):(this._start=i,this._end=e,this._isBuffering=true),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=false,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let i={start:this._start,end:this._end};return this._isBuffering=false,i}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function cN(i,e,t,s){let r=t.buffer.x,n=t.buffer.y;if(!t.buffer.hasScrollback)return fN(r,n,i,e,t,s)+$u(n,e,t,s)+pN(r,n,i,e,t,s);let o;if(n===e)return o=r>i?"D":"C",th(Math.abs(r-i),eh(o,s));o=n>e?"D":"C";let a=Math.abs(n-e),l=uN(n>e?i:r,t)+(a-1)*t.cols+1+dN(n>e?r:i);return th(l,eh(o,s))}function dN(i,e){return i-1}function uN(i,e){return e.cols-i}function fN(i,e,t,s,r,n){return $u(e,s,r,n).length===0?"":th(H3(i,e,i,e-oo(e,r),false,r).length,eh("D",n))}function $u(i,e,t,s){let r=i-oo(i,t),n=e-oo(e,t),o=Math.abs(r-n)-mN(i,e,t);return th(o,eh(j3(i,e),s))}function pN(i,e,t,s,r,n){let o;$u(e,s,r,n).length>0?o=s-oo(s,r):o=e;let a=s,l=gN(i,e,t,s,r,n);return th(H3(i,o,t,a,l==="C",r).length,eh(l,n))}function mN(i,e,t){var o;let s=0,r=i-oo(i,t),n=e-oo(e,t);for(let a=0;a=0&&i0?o=s-oo(s,r):o=e,i=t&&oe?"A":"B"}function H3(i,e,t,s,r,n){let o=i,a=e,l="";for(;(o!==t||a!==s)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,false,i,o),o=0,i=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,false,0,i+1),o=n.cols-1,i=o,a--);return l+n.buffer.translateBufferLineToString(a,false,i,o)}function eh(i,e){let t=e?"O":"[";return W.ESC+t+i}function th(i,e){i=Math.floor(i);let t="";for(let s=0;sthis._bufferService.cols?i%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let i=this.selectionStart,e=this.selectionEnd;return!i||!e?false:i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),true):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),false)}};function Lb(i,e){if(i.start.y>i.end.y)throw new Error(\`Buffer range end (\${i.end.x}, \${i.end.y}) cannot be before start (\${i.start.x}, \${i.start.y})\`);return e*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}var _p=50;var _N=15;var vN=50;var yN=500;var bN=" ";var SN=new RegExp(bN,"g");var Gg=class mH extends Oe{constructor(e,t,s,r,n,o,a,l,h){super();this._element=e;this._screenElement=t;this._linkifier=s;this._bufferService=r;this._coreService=n;this._mouseService=o;this._optionsService=a;this._renderService=l;this._coreBrowserService=h;this._dragScrollAmount=0;this._enabled=true;this._workCell=new Zi;this._mouseDownTimeStamp=0;this._oldHasSelection=false;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new j);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new j);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new j);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new j);this.onRequestScrollLines=this._onRequestScrollLines.event;this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new ON(this._bufferService),this._activeSelectionMode=0,this._register(je(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=false}enable(){this._enabled=true}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?false:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]n.replace(SN," ")).join(F3?\`\\r +\`,i.VT="\\v",i.FF="\\f",i.CR="\\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(W||(W={}));var Yc;(i=>(i.PAD="€",i.HOP="",i.BPH="‚",i.NBH="ƒ",i.IND="„",i.NEL="…",i.SSA="†",i.ESA="‡",i.HTS="ˆ",i.HTJ="‰",i.VTS="Š",i.PLD="‹",i.PLU="Œ",i.RI="",i.SS2="Ž",i.SS3="",i.DCS="",i.PU1="‘",i.PU2="’",i.STS="“",i.CCH="”",i.MW="•",i.SPA="–",i.EPA="—",i.SOS="˜",i.SGCI="™",i.SCI="š",i.CSI="›",i.ST="œ",i.OSC="",i.PM="ž",i.APC="Ÿ"))(Yc||(Yc={}));var z3;(i=>i.ST=\`\${W.ESC}\\\\\`)(z3||(z3={}));var Zg=class lH{constructor(e,t,s,r,n,o){this._textarea=e;this._compositionView=t;this._bufferService=s;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=false,this._isSendingComposition=false,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=true,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(true)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return false;this._finalizeComposition(false)}return e.keyCode===229?(this._handleAnyTextareaChanges(),false):true}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=false,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=true,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=false;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,true)}},0)}else{this._isSendingComposition=false;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,true)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,true):t.lengththis.updateCompositionElements(true),0)}}};Zg=st([K(2,hi),K(3,ci),K(4,po),K(5,Cr)],Zg);var $t=0;var Et=0;var Qt=0;var tt=0;var Qb={css:"#00000000",rgba:0};var dt;(i=>{function e(r,n,o,a){return a!==void 0?\`#\${xn(r)}\${xn(n)}\${xn(o)}\${xn(a)}\`:\`#\${xn(r)}\${xn(n)}\${xn(o)}\`}i.toCss=e;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function s(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=s})(dt||(dt={}));var Xe;(i=>{function e(l,h){if(tt=(h.rgba&255)/255,tt===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,m=l.rgba>>8&255;$t=f+Math.round((c-f)*tt),Et=p+Math.round((d-p)*tt),Qt=m+Math.round((u-m)*tt);let O=dt.toCss($t,Et,Qt),v=dt.toRgba($t,Et,Qt);return{css:O,rgba:v}}i.blend=e;function t(l){return(l.rgba&255)===255}i.isOpaque=t;function s(l,h,c){let d=Gc.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return dt.toColor(d>>24&255,d>>16&255,d>>8&255)}i.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[$t,Et,Qt]=Gc.toChannels(h),{css:dt.toCss($t,Et,Qt),rgba:h}}i.opaque=r;function n(l,h){return tt=Math.round(h*255),[$t,Et,Qt]=Gc.toChannels(l.rgba),{css:dt.toCss($t,Et,Qt,tt),rgba:dt.toRgba($t,Et,Qt,tt)}}i.opacity=n;function o(l,h){return tt=l.rgba&255,n(l,tt*h/255)}i.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}i.toColorRGB=a})(Xe||(Xe={}));var Ge;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:true});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\\da-f]{3,8}/i))switch(r.length){case 4:return $t=parseInt(r.slice(1,2).repeat(2),16),Et=parseInt(r.slice(2,3).repeat(2),16),Qt=parseInt(r.slice(3,4).repeat(2),16),dt.toColor($t,Et,Qt);case 5:return $t=parseInt(r.slice(1,2).repeat(2),16),Et=parseInt(r.slice(2,3).repeat(2),16),Qt=parseInt(r.slice(3,4).repeat(2),16),tt=parseInt(r.slice(4,5).repeat(2),16),dt.toColor($t,Et,Qt,tt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(n)return $t=parseInt(n[1]),Et=parseInt(n[2]),Qt=parseInt(n[3]),tt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),dt.toColor($t,Et,Qt,tt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[$t,Et,Qt,tt]=e.getImageData(0,0,1,1).data,tt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:dt.toRgba($t,Et,Qt,tt),css:r}}i.toColor=s})(Ge||(Ge={}));var si;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}i.relativeLuminance2=t})(si||(si={}));var Gc;(i=>{function e(o,a){if(tt=(a&255)/255,tt===1)return a;let l=a>>24&255,h=a>>16&255,c=a>>8&255,d=o>>24&255,u=o>>16&255,f=o>>8&255;return $t=d+Math.round((l-d)*tt),Et=u+Math.round((h-u)*tt),Qt=f+Math.round((c-f)*tt),dt.toRgba($t,Et,Qt)}i.blend=e;function t(o,a,l){let h=si.relativeLuminance(o>>8),c=si.relativeLuminance(a>>8);if(tr(h,c)>8));if(p>8));return p>O?f:m}return f}let d=r(o,a,l),u=tr(h,si.relativeLuminance(d>>8));if(u>8));return u>p?d:f}return d}}i.ensureContrastRatio=t;function s(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));for(;m0||f>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));return(u<<24|f<<16|p<<8|255)>>>0}i.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,c=o>>16&255,d=o>>8&255,u=a>>24&255,f=a>>16&255,p=a>>8&255,m=tr(si.relativeLuminance2(u,f,p),si.relativeLuminance2(h,c,d));for(;m>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Gc||(Gc={}));function xn(i){let e=i.toString(16);return e.length<2?"0"+e:e}function tr(i,e){return i1){let d=this._getJoinedRanges(r,a,o,t,n);for(let u=0;u1){let c=this._getJoinedRanges(r,a,o,t,n);for(let d=0;d=X,B=$,M=this._workCell;if(f.length>0&&$===f[0][0]&&A){let oe=f.shift(),Vs=this._isCellInSelection(oe[0],t);for(k=oe[0]+1;k=oe[1]),A?(R=true,M=new WX(this._workCell,e.translateToString(true,oe[0],oe[1]),oe[1]-oe[0]),B=oe[1]-1,E=M.getWidth()):X=oe[1]}let q=this._isCellInSelection($,t),re=s&&$===o,ee=y&&$>=c&&$<=d,ne=false;this._decorationService.forEachDecorationAtCell($,t,void 0,oe=>{ne=true});let Ie=M.getChars()||Kr;if(Ie===" "&&(M.isUnderline()||M.isOverline())&&(Ie=" "),F=E*l-h.get(Ie,M.isBold(),M.isItalic()),!O)O=this._document.createElement("span");else if(v&&(q&&I||!q&&!I&&M.bg===_)&&(q&&I&&p.selectionForeground||M.fg===C)&&M.extended.ext===w&&ee===Q&&F===D&&!re&&!R&&!ne&&A){M.isInvisible()?T+=Kr:T+=Ie,v++;continue}else v&&(O.textContent=T),O=this._document.createElement("span"),v=0,T="";if(_=M.bg,C=M.fg,w=M.extended.ext,Q=ee,D=F,I=q,R&&o>=$&&o<=B&&(o=$),!this._coreService.isCursorHidden&&re&&this._coreService.isCursorInitialized){if(x.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&x.push("xterm-cursor-blink"),x.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":x.push("xterm-cursor-outline");break;case"block":x.push("xterm-cursor-block");break;case"bar":x.push("xterm-cursor-bar");break;case"underline":x.push("xterm-cursor-underline");break}}if(M.isBold()&&x.push("xterm-bold"),M.isItalic()&&x.push("xterm-italic"),M.isDim()&&x.push("xterm-dim"),M.isInvisible()?T=Kr:T=M.getChars()||Kr,M.isUnderline()&&(x.push(\`xterm-underline-\${M.extended.underlineStyle}\`),T===" "&&(T=" "),!M.isUnderlineColorDefault()))if(M.isUnderlineColorRGB())O.style.textDecorationColor=\`rgb(\${yh.toColorRGB(M.getUnderlineColor()).join(",")})\`;else{let oe=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&oe<8&&(oe+=8),O.style.textDecorationColor=p.ansi[oe].css}M.isOverline()&&(x.push("xterm-overline"),T===" "&&(T=" ")),M.isStrikethrough()&&x.push("xterm-strikethrough"),ee&&(O.style.textDecoration="underline");let pe=M.getFgColor(),De=M.getFgColorMode(),Ce=M.getBgColor(),Ae=M.getBgColorMode(),lt=!!M.isInverse();if(lt){let oe=pe;pe=Ce,Ce=oe;let Vs=De;De=Ae,Ae=Vs}let di,Qi,ve=false;this._decorationService.forEachDecorationAtCell($,t,void 0,oe=>{oe.options.layer!=="top"&&ve||(oe.backgroundColorRGB&&(Ae=50331648,Ce=oe.backgroundColorRGB.rgba>>8&16777215,di=oe.backgroundColorRGB),oe.foregroundColorRGB&&(De=50331648,pe=oe.foregroundColorRGB.rgba>>8&16777215,Qi=oe.foregroundColorRGB),ve=oe.options.layer==="top")}),!ve&&q&&(di=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Ce=di.rgba>>8&16777215,Ae=50331648,ve=true,p.selectionForeground&&(De=50331648,pe=p.selectionForeground.rgba>>8&16777215,Qi=p.selectionForeground)),ve&&x.push("xterm-decoration-top");let ei;switch(Ae){case 16777216:case 33554432:ei=p.ansi[Ce],x.push(\`xterm-bg-\${Ce}\`);break;case 50331648:ei=dt.toColor(Ce>>16,Ce>>8&255,Ce&255),this._addStyle(O,\`background-color:#\${Rb((Ce>>>0).toString(16),"0",6)}\`);break;case 0:default:lt?(ei=p.foreground,x.push(\`xterm-bg-\${257}\`)):ei=p.background}switch(di||M.isDim()&&(di=Xe.multiplyOpacity(ei,.5)),De){case 16777216:case 33554432:M.isBold()&&pe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(pe+=8),this._applyMinimumContrast(O,ei,p.ansi[pe],M,di,void 0)||x.push(\`xterm-fg-\${pe}\`);break;case 50331648:let oe=dt.toColor(pe>>16&255,pe>>8&255,pe&255);this._applyMinimumContrast(O,ei,oe,M,di,Qi)||this._addStyle(O,\`color:#\${Rb(pe.toString(16),"0",6)}\`);break;case 0:default:this._applyMinimumContrast(O,ei,p.foreground,M,di,Qi)||lt&&x.push(\`xterm-fg-\${257}\`)}x.length&&(O.className=x.join(" "),x.length=0),!re&&!R&&!ne&&A?v++:O.textContent=T,F!==this.defaultSpacing&&(O.style.letterSpacing=\`\${F}px\`),u.push(O),$=B}return O&&v&&(O.textContent=T),u}_applyMinimumContrast(e,t,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||NX(r.getCode()))return false;let a=this._getContrastCache(r),l;if(!n&&!o&&(l=a.getColor(t.rgba,s.rgba)),l===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=Xe.ensureContrastRatio(n||t,o||s,h),a.setColor((n||t).rgba,(o||s).rgba,l??null)}return l?(this._addStyle(e,\`color:\${l.css}\`),true):false}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",\`\${e.getAttribute("style")||""}\${t};\`)}_isCellInSelection(e,t){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?false:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t=s[0]&&e=s[0]}};Ug=st([K(1,y3),K(2,ci),K(3,kr),K(4,po),K(5,bh),K(6,ba)],Ug);function Rb(i,e,t){for(;i.length0&&(this._flat[s]=o),o}let r=i;e&&(r+="B"),t&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;e&&(o|=1),t&&(o|=2),n=this._measure(i,o),n>0&&this._holey.set(r,n)}return n}_measure(i,e){let t=this._measureElements[e];return t.textContent=i.repeat(32),t.offsetWidth/32}};var UX=class{constructor(){this.clear()}clear(){this.hasSelection=false,this.columnSelectMode=false,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(i,e,t,s=false){if(this.selectionStart=e,this.selectionEnd=t,!e||!t||e[0]===t[0]&&e[1]===t[1]){this.clear();return}let r=i.buffers.active.ydisp,n=e[1]-r,o=t[1]-r,a=Math.max(n,0),l=Math.min(o,i.rows-1);if(a>=i.rows||l<0){this.clear();return}this.hasSelection=true,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=e[0],this.endCol=t[0]}isCellSelected(i,e,t){return this.hasSelection?(t-=i.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&t>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&t<=this.viewportCappedEndRow:t>this.viewportStartRow&&t=this.startCol&&e=this.startCol):false}};function jX(){return new UX}var Op="xterm-dom-renderer-owner-";var Ai="xterm-rows";var gc="xterm-fg-";var Ab="xterm-bg-";var Fa="xterm-focus";var Oc="xterm-selection";var HX=1;var jg=class dH extends Oe{constructor(e,t,s,r,n,o,a,l,h,c,d,u,f,p){super();this._terminal=e;this._document=t;this._element=s;this._screenElement=r;this._viewportElement=n;this._helperContainer=o;this._linkifier2=a;this._charSizeService=h;this._optionsService=c;this._bufferService=d;this._coreService=u;this._coreBrowserService=f;this._themeService=p;this._terminalClass=HX++;this._rowElements=[];this._selectionRenderModel=jX();this.onRequestRedraw=this._register(new j).event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ai),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Oc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=FX(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(Ug,document),this._element.classList.add(Op+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(je(()=>{this._element.classList.remove(Op+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ZX(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=\`\${this.dimensions.css.canvas.width}px\`,s.style.height=\`\${this.dimensions.css.cell.height}px\`,s.style.lineHeight=\`\${this.dimensions.css.cell.height}px\`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=\`\${this._terminalSelector} .\${Ai} span { display: inline-block; height: 100%; vertical-align: top;}\`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=\`\${this.dimensions.css.canvas.width}px\`,this._screenElement.style.height=\`\${this.dimensions.css.canvas.height}px\`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=\`\${this._terminalSelector} .\${Ai} { pointer-events: none; color: \${e.foreground.css}; font-family: \${this._optionsService.rawOptions.fontFamily}; font-size: \${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}\`;t+=\`\${this._terminalSelector} .\${Ai} .xterm-dim { color: \${Xe.multiplyOpacity(e.foreground,.5).css};}\`,t+=\`\${this._terminalSelector} span:not(.xterm-bold) { font-weight: \${this._optionsService.rawOptions.fontWeight};}\${this._terminalSelector} span.xterm-bold { font-weight: \${this._optionsService.rawOptions.fontWeightBold};}\${this._terminalSelector} span.xterm-italic { font-style: italic;}\`;let s=\`blink_underline_\${this._terminalClass}\`,r=\`blink_bar_\${this._terminalClass}\`,n=\`blink_block_\${this._terminalClass}\`;t+=\`@keyframes \${s} { 50% { border-bottom-style: hidden; }}\`,t+=\`@keyframes \${r} { 50% { box-shadow: none; }}\`,t+=\`@keyframes \${n} { 0% { background-color: \${e.cursor.css}; color: \${e.cursorAccent.css}; } 50% { background-color: inherit; color: \${e.cursor.css}; }}\`,t+=\`\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: \${s} 1s step-end infinite;}\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: \${r} 1s step-end infinite;}\${this._terminalSelector} .\${Ai}.\${Fa} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: \${n} 1s step-end infinite;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-block { background-color: \${e.cursor.css}; color: \${e.cursorAccent.css};}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: \${e.cursor.css} !important; color: \${e.cursorAccent.css} !important;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-outline { outline: 1px solid \${e.cursor.css}; outline-offset: -1px;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-bar { box-shadow: \${this._optionsService.rawOptions.cursorWidth}px 0 0 \${e.cursor.css} inset;}\${this._terminalSelector} .\${Ai} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px \${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}\`,t+=\`\${this._terminalSelector} .\${Oc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}\${this._terminalSelector}.focus .\${Oc} div { position: absolute; background-color: \${e.selectionBackgroundOpaque.css};}\${this._terminalSelector} .\${Oc} div { position: absolute; background-color: \${e.selectionInactiveBackgroundOpaque.css};}\`;for(let[o,a]of e.ansi.entries())t+=\`\${this._terminalSelector} .\${gc}\${o} { color: \${a.css}; }\${this._terminalSelector} .\${gc}\${o}.xterm-dim { color: \${Xe.multiplyOpacity(a,.5).css}; }\${this._terminalSelector} .\${Ab}\${o} { background-color: \${a.css}; }\`;t+=\`\${this._terminalSelector} .\${gc}\${257} { color: \${Xe.opaque(e.background).css}; }\${this._terminalSelector} .\${gc}\${257}.xterm-dim { color: \${Xe.multiplyOpacity(Xe.opaque(e.background),.5).css}; }\${this._terminalSelector} .\${Ab}\${257} { background-color: \${e.foreground.css}; }\`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",false,false);this._rowContainer.style.letterSpacing=\`\${e}px\`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Fa),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Fa),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(s){let h=e[0]>t[0];l.appendChild(this._createSelectionElement(o,h?t[0]:e[0],h?e[0]:t[0],a-o+1))}else{let h=r===o?e[0]:0,c=o===n?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,h,c));let d=a-o-1;if(l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,d)),o!==a){let u=n===a?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,u))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,s,r=1){let n=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(s-t);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),n.style.height=\`\${r*this.dimensions.css.cell.height}px\`,n.style.top=\`\${e*this.dimensions.css.cell.height}px\`,n.style.left=\`\${o}px\`,n.style.width=\`\${a}px\`,n}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let c=h+s.ydisp,d=this._rowElements[h],u=s.lines.get(c);if(!d||!u)break;d.replaceChildren(...this._rowFactory.createRow(u,c,c===r,a,l,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return\`.\${Op}\${this._terminalClass}\`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,true)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,false)}_setCellUnderline(e,t,s,r,n,o){s<0&&(e=0),r<0&&(t=0);let a=this._bufferService.rows-1;s=Math.max(Math.min(s,a),0),r=Math.max(Math.min(r,a),0),n=Math.min(n,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,c=Math.min(l.x,n-1),d=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=s;p<=r;++p){let m=p+l.ydisp,O=this._rowElements[p],v=l.lines.get(m);if(!O||!v)break;O.replaceChildren(...this._rowFactory.createRow(v,m,m===h,u,f,c,d,this.dimensions.css.cell.width,this._widthCache,o?p===s?e:0:-1,o?(p===r?t:n)-1:-1))}}};jg=st([K(7,L0),K(8,Tu),K(9,ci),K(10,hi),K(11,po),K(12,kr),K(13,ba)],jg);var Hg=class uH extends Oe{constructor(e,t,s){super();this._optionsService=s;this.width=0;this.height=0;this._onCharSizeChange=this._register(new j);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new YX(this._optionsService))}catch{this._measureStrategy=this._register(new VX(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Hg=st([K(2,ci)],Hg);var W3=class extends Oe{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(i,e){i!==void 0&&i>0&&e!==void 0&&e>0&&(this._result.width=i,this._result.height=e)}};var VX=class extends W3{constructor(i,e,t){super();this._document=i;this._parentElement=e;this._optionsService=t;this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=\`\${this._optionsService.rawOptions.fontSize}px\`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}};var YX=class extends W3{constructor(i){super();this._optionsService=i;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=\`\${this._optionsService.rawOptions.fontSize}px \${this._optionsService.rawOptions.fontFamily}\`;let i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}};var GX=class extends Oe{constructor(i,e,t){super();this._textarea=i;this._window=e;this.mainDocument=t;this._isFocused=false;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new KX(this._window));this._onDprChange=this._register(new j);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new j);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Xt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(de(this._textarea,"focus",()=>this._isFocused=true)),this._register(de(this._textarea,"blur",()=>this._isFocused=false))}get window(){return this._window}set window(i){this._window!==i&&(this._window=i,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}};var KX=class extends Oe{constructor(i){super();this._parentWindow=i;this._windowResizeListener=this._register(new fa);this._onDprChange=this._register(new j);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(je(()=>this.clearListener()))}setWindow(i){this._parentWindow=i,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=de(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var i;this._outerListener&&((i=this._resolutionMediaMatchList)==null?void 0:i.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(\`screen and (resolution: \${this._parentWindow.devicePixelRatio}dppx)\`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}};var JX=class extends Oe{constructor(){super();this.linkProviders=[];this._register(je(()=>this.linkProviders.length=0))}registerLinkProvider(i){return this.linkProviders.push(i),{dispose:()=>{let e=this.linkProviders.indexOf(i);e!==-1&&this.linkProviders.splice(e,1)}}}};function X0(i,e,t){let s=t.getBoundingClientRect(),r=i.getComputedStyle(t),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function eN(i,e,t,s,r,n,o,a,l){if(!n)return;let h=X0(i,e,t);if(h)return h[0]=Math.ceil((h[0]+(l?o/2:0))/o),h[1]=Math.ceil(h[1]/a),h[0]=Math.min(Math.max(h[0],1),s+(l?1:0)),h[1]=Math.min(Math.max(h[1],1),r),h}var Vg=class fH{constructor(e,t){this._renderService=e;this._charSizeService=t}getCoords(e,t,s,r,n){return eN(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let s=X0(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Vg=st([K(0,Cr),K(1,Tu)],Vg);var tN=class{constructor(i,e){this._renderCallback=i;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(i){return this._refreshCallbacks.push(i),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(i,e,t){this._rowCount=t,i=i!==void 0?i:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let i=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}};var q3={};cq(q3,{getSafariVersion:()=>sN,isChromeOS:()=>Z3,isFirefox:()=>X3,isIpad:()=>rN,isIphone:()=>nN,isLegacyEdge:()=>iN,isLinux:()=>N0,isMac:()=>jd,isNode:()=>Pu,isSafari:()=>N3,isWindows:()=>F3});var Pu=typeof process<"u"&&"title"in process;var Sh=Pu?"node":navigator.userAgent;var wh=Pu?"node":navigator.platform;var X3=Sh.includes("Firefox");var iN=Sh.includes("Edge");var N3=/^((?!chrome|android).)*safari/i.test(Sh);function sN(){if(!N3)return 0;let i=Sh.match(/Version\\/(\\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var jd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(wh);var rN=wh==="iPad";var nN=wh==="iPhone";var F3=["Windows","Win16","Win32","WinCE"].includes(wh);var N0=wh.indexOf("Linux")>=0;var Z3=/\\bCrOS\\b/.test(Sh);var U3=class{constructor(){this._tasks=[];this._i=0}enqueue(i){this._tasks.push(i),this._start()}flush(){for(;this._ir){s-e<-20&&console.warn(\`task queue exceeded allotted deadline by \${Math.abs(Math.round(s-e))}ms\`),this._start();return}s=r}this.clear()}};var oN=class extends U3{_requestCallback(i){return setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){clearTimeout(i)}_createDeadline(i){let e=performance.now()+i;return{timeRemaining:()=>Math.max(0,e-performance.now())}}};var aN=class extends U3{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}};var Hd=!Pu&&"requestIdleCallback"in window?aN:oN;var lN=class{constructor(){this._queue=new Hd}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};var Yg=class pH extends Oe{constructor(e,t,s,r,n,o,a,l,h){super();this._rowCount=e;this._optionsService=s;this._charSizeService=r;this._coreService=n;this._coreBrowserService=l;this._renderer=this._register(new fa);this._pausedResizeTask=new lN;this._observerDisposable=this._register(new fa);this._isPaused=false;this._needsFullRefresh=false;this._isNextRenderRedrawOnly=true;this._needsSelectionRefresh=false;this._canvasWidth=0;this._canvasHeight=0;this._selectionState={start:void 0,end:void 0,columnSelectMode:false};this._onDimensionsChange=this._register(new j);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new j);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new j);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new j);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new tN((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new hN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(je(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,true))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=je(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=false)}refreshRows(e,t,s=false){if(this._isPaused){this._needsFullRefresh=true;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=false),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=false),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=true}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,true)),this._needsSelectionRefresh=true,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=true:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null?void 0:t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var s;return(s=this._renderer.value)==null?void 0:s.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null?void 0:e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null?void 0:e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null?void 0:e.handleFocus()}handleSelectionChanged(e,t,s){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null?void 0:r.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null?void 0:e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null?void 0:e.clear()}};Yg=st([K(2,ci),K(3,Tu),K(4,po),K(5,bh),K(6,hi),K(7,kr),K(8,ba)],Yg);var hN=class{constructor(i,e,t){this._coreBrowserService=i;this._coreService=e;this._onTimeout=t;this._start=0;this._end=0;this._isBuffering=false}bufferRows(i,e){this._isBuffering?(this._start=Math.min(this._start,i),this._end=Math.max(this._end,e)):(this._start=i,this._end=e,this._isBuffering=true),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=false,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let i={start:this._start,end:this._end};return this._isBuffering=false,i}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function cN(i,e,t,s){let r=t.buffer.x,n=t.buffer.y;if(!t.buffer.hasScrollback)return fN(r,n,i,e,t,s)+$u(n,e,t,s)+pN(r,n,i,e,t,s);let o;if(n===e)return o=r>i?"D":"C",th(Math.abs(r-i),eh(o,s));o=n>e?"D":"C";let a=Math.abs(n-e),l=uN(n>e?i:r,t)+(a-1)*t.cols+1+dN(n>e?r:i);return th(l,eh(o,s))}function dN(i,e){return i-1}function uN(i,e){return e.cols-i}function fN(i,e,t,s,r,n){return $u(e,s,r,n).length===0?"":th(H3(i,e,i,e-oo(e,r),false,r).length,eh("D",n))}function $u(i,e,t,s){let r=i-oo(i,t),n=e-oo(e,t),o=Math.abs(r-n)-mN(i,e,t);return th(o,eh(j3(i,e),s))}function pN(i,e,t,s,r,n){let o;$u(e,s,r,n).length>0?o=s-oo(s,r):o=e;let a=s,l=gN(i,e,t,s,r,n);return th(H3(i,o,t,a,l==="C",r).length,eh(l,n))}function mN(i,e,t){var o;let s=0,r=i-oo(i,t),n=e-oo(e,t);for(let a=0;a=0&&i0?o=s-oo(s,r):o=e,i=t&&oe?"A":"B"}function H3(i,e,t,s,r,n){let o=i,a=e,l="";for(;(o!==t||a!==s)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,false,i,o),o=0,i=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,false,0,i+1),o=n.cols-1,i=o,a--);return l+n.buffer.translateBufferLineToString(a,false,i,o)}function eh(i,e){let t=e?"O":"[";return W.ESC+t+i}function th(i,e){i=Math.floor(i);let t="";for(let s=0;sthis._bufferService.cols?i%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let i=this.selectionStart,e=this.selectionEnd;return!i||!e?false:i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),true):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),false)}};function Lb(i,e){if(i.start.y>i.end.y)throw new Error(\`Buffer range end (\${i.end.x}, \${i.end.y}) cannot be before start (\${i.start.x}, \${i.start.y})\`);return e*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}var _p=50;var _N=15;var vN=50;var yN=500;var bN=" ";var SN=new RegExp(bN,"g");var Gg=class mH extends Oe{constructor(e,t,s,r,n,o,a,l,h){super();this._element=e;this._screenElement=t;this._linkifier=s;this._bufferService=r;this._coreService=n;this._mouseService=o;this._optionsService=a;this._renderService=l;this._coreBrowserService=h;this._dragScrollAmount=0;this._enabled=true;this._workCell=new Zi;this._mouseDownTimeStamp=0;this._oldHasSelection=false;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new j);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new j);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new j);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new j);this.onRequestScrollLines=this._onRequestScrollLines.event;this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new ON(this._bufferService),this._activeSelectionMode=0,this._register(je(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=false}enable(){this._enabled=true}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?false:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]n.replace(SN," ")).join(F3?\`\\r \`:\` \`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),N0&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?false:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?false:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Lb(s,this._bufferService.cols),this._model.selectionEnd=void 0,true;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,true):false}selectAll(){this._model.isSelectAllActive=true,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,true);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=X0(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-_p),_p),t/=_p,t/Math.abs(t)+Math.round(t*(_N-1)))}shouldForceSelection(e){return jd?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(true)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),vN)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=false,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,true)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(jd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(true);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&t!==r&&(s+=n-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,false)&&this.refresh(true),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=true,r=true){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let a=n.translateBufferLineToString(e[1],false),l=this._convertViewportColToCharacterIndex(o,e[0]),h=l,c=e[0]-l,d=0,u=0,f=0,p=0;if(a.charAt(l)===" "){for(;l>0&&a.charAt(l-1)===" ";)l--;for(;h1&&(p+=k-1,h+=k-1);v>0&&l>0&&!this._isCharWordSeparator(o.loadCell(v-1,this._workCell));){o.loadCell(v-1,this._workCell);let _=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,v--):_>1&&(f+=_-1,l-=_-1),l--,v--}for(;T1&&(p+=_-1,h+=_-1),h++,T++}}h++;let m=l+c-d+f,O=Math.min(this._bufferService.cols,h-l+d+u-f-p);if(!(!t&&a.slice(l,h).trim()==="")){if(s&&m===0&&o.getCodePoint(0)!==32){let v=n.lines.get(e[1]-1);if(v&&o.isWrapped&&v.getCodePoint(this._bufferService.cols-1)!==32){let T=this._getWordAt([this._bufferService.cols-1,e[1]-1],false,true,false);if(T){let k=this._bufferService.cols-T.start;m-=k,O+=k}}}if(r&&m+O===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let v=n.lines.get(e[1]+1);if((v==null?void 0:v.isWrapped)&&v.getCodePoint(0)!==32){let T=this._getWordAt([0,e[1]+1],false,false,true);T&&(O+=T.length)}}return{start:m,length:O}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,true);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?false:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Lb(s,this._bufferService.cols)}};Gg=st([K(3,hi),K(4,po),K(5,M0),K(6,ci),K(7,Cr),K(8,kr)],Gg);var Mb=class gH{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}};var Bb=class OH{constructor(){this._color=new Mb;this._css=new Mb}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}};var mt=Object.freeze((()=>{let i=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let t=0;t<216;t++){let s=e[t/36%6|0],r=e[t/6%6|0],n=e[t%6];i.push({css:dt.toCss(s,r,n),rgba:dt.toRgba(s,r,n)})}for(let t=0;t<24;t++){let s=8+t*10;i.push({css:dt.toCss(s,s,s),rgba:dt.toRgba(s,s,s)})}return i})());var Cn=Ge.toColor("#ffffff");var ol=Ge.toColor("#000000");var Ib=Ge.toColor("#ffffff");var Db=ol;var Za={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};var wN=Cn;var Kg=class _H extends Oe{constructor(e){super();this._optionsService=e;this._contrastCache=new Bb;this._halfContrastCache=new Bb;this._onChangeColors=this._register(new j);this.onChangeColors=this._onChangeColors.event;this._colors={foreground:Cn,background:ol,cursor:Ib,cursorAccent:Db,selectionForeground:void 0,selectionBackgroundTransparent:Za,selectionBackgroundOpaque:Xe.blend(ol,Za),selectionInactiveBackgroundTransparent:Za,selectionInactiveBackgroundOpaque:Xe.blend(ol,Za),scrollbarSliderBackground:Xe.opacity(Cn,.2),scrollbarSliderHoverBackground:Xe.opacity(Cn,.4),scrollbarSliderActiveBackground:Xe.opacity(Cn,.5),overviewRulerBorder:Cn,ansi:mt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Me(e.foreground,Cn),t.background=Me(e.background,ol),t.cursor=Xe.blend(t.background,Me(e.cursor,Ib)),t.cursorAccent=Xe.blend(t.background,Me(e.cursorAccent,Db)),t.selectionBackgroundTransparent=Me(e.selectionBackground,Za),t.selectionBackgroundOpaque=Xe.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Me(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Xe.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Me(e.selectionForeground,Qb):void 0,t.selectionForeground===Qb&&(t.selectionForeground=void 0),Xe.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Xe.opacity(t.selectionBackgroundTransparent,.3)),Xe.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Xe.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Me(e.scrollbarSliderBackground,Xe.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Me(e.scrollbarSliderHoverBackground,Xe.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Me(e.scrollbarSliderActiveBackground,Xe.opacity(t.foreground,.5)),t.overviewRulerBorder=Me(e.overviewRulerBorder,wN),t.ansi=mt.slice(),t.ansi[0]=Me(e.black,mt[0]),t.ansi[1]=Me(e.red,mt[1]),t.ansi[2]=Me(e.green,mt[2]),t.ansi[3]=Me(e.yellow,mt[3]),t.ansi[4]=Me(e.blue,mt[4]),t.ansi[5]=Me(e.magenta,mt[5]),t.ansi[6]=Me(e.cyan,mt[6]),t.ansi[7]=Me(e.white,mt[7]),t.ansi[8]=Me(e.brightBlack,mt[8]),t.ansi[9]=Me(e.brightRed,mt[9]),t.ansi[10]=Me(e.brightGreen,mt[10]),t.ansi[11]=Me(e.brightYellow,mt[11]),t.ansi[12]=Me(e.brightBlue,mt[12]),t.ansi[13]=Me(e.brightMagenta,mt[13]),t.ansi[14]=Me(e.brightCyan,mt[14]),t.ansi[15]=Me(e.brightWhite,mt[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;rn.index-o.index),s=[];for(let n of t){let o=this._services.get(n.id);if(!o)throw new Error(\`[createInstance] \${i.name} depends on UNKNOWN service \${n.id._id}.\`);s.push(o)}let r=t.length>0?t[0].index:e.length;if(e.length!==r)throw new Error(\`[createInstance] First service dependency of \${i.name} at position \${r+1} conflicts with \${e.length} static arguments\`);return new i(...e,...s)}};var CN={trace:0,debug:1,info:2,warn:3,error:4,off:5};var TN="xterm.js: ";var Jg=class vH extends Oe{constructor(e){super();this._optionsService=e;this._logLevel=5;this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=CN[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;rthis._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=t-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+t+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,t){this._data[e*ge+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*ge+0]=e|2097152|t[2]<<22):this._data[e*ge+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*ge+0]>>22}hasWidth(e){return this._data[e*ge+0]&12582912}getFg(e){return this._data[e*ge+1]}getBg(e){return this._data[e*ge+2]}hasContent(e){return this._data[e*ge+0]&4194303}getCodePoint(e){let t=this._data[e*ge+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*ge+0]&2097152}getString(e){let t=this._data[e*ge+0];return t&2097152?this._combined[e]:t&2097151?Nr(t&2097151):""}isProtected(e){return this._data[e*ge+2]&536870912}loadCell(e,t){return _c=e*ge,t.content=this._data[_c+0],t.fg=this._data[_c+1],t.bg=this._data[_c+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*ge+0]=t.content,this._data[e*ge+1]=t.fg,this._data[e*ge+2]=t.bg}setCellFromCodepoint(e,t,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*ge+0]=t|s<<22,this._data[e*ge+1]=r.fg,this._data[e*ge+2]=r.bg}addCodepointToCell(e,t,s){let r=this._data[e*ge+0];r&2097152?this._combined[e]+=Nr(t):r&2097151?(this._combined[e]=Nr(r&2097151)+Nr(t),r&=-2097152,r|=2097152):r=t|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*ge+0]=r}insertCells(e,t,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let n=0;nthis.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=e&&delete this._extendedAttrs[a]}}return this.length=e,s*4*vp=0;--e)if(this._data[e*ge+0]&4194303)return e+(this._data[e*ge+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*ge+0]&4194303||this._data[e*ge+2]&50331648)return e+(this._data[e*ge+0]>>22);return 0}copyCellsFrom(e,t,s,r,n){let o=e._data;if(n)for(let l=r-1;l>=0;l--){for(let h=0;h=t&&(this._combined[h-t+s]=e._combined[h])}}translateToString(e,t,s,r){t=t??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;t>22||1}return r&&r.push(t),n}};function PN(i,e,t,s,r,n){let o=[];for(let a=0;a=a&&s0&&(O>d||c[O].getTrimmedLength()===0);O--)m++;m>0&&(o.push(a+c.length-m),o.push(m)),a+=c.length-1}return o}function $N(i,e){let t=[],s=0,r=e[s],n=0;for(let o=0;oih(i,h,e)).reduce((l,h)=>l+h),n=0,o=0,a=0;for(;al&&(n-=l,o++);let h=i[o].getWidth(n-1)===2;h&&n--;let c=h?t-1:t;s.push(c),a+=c}return s}function ih(i,e,t){if(e===i.length-1)return i[e].getTrimmedLength();let s=!i[e].hasContent(t-1)&&i[e].getWidth(t-1)===1,r=i[e+1].getWidth(0)===2;return s&&r?t-1:t}var Y3=class G3{constructor(e){this.line=e;this.isDisposed=false;this._disposables=[];this._id=G3._nextId++;this._onDispose=this.register(new j);this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=true,this.line=-1,this._onDispose.fire(),no(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Y3._nextId=1;var RN=Y3;var vt={};var Tn=vt.B;vt[0]={"\`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};vt.A={"#":"£"};vt.B=void 0;vt[4]={"#":"£","@":"¾","[":"ij","\\\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};vt.C=vt[5]={"[":"Ä","\\\\":"Ö","]":"Å","^":"Ü","\`":"é","{":"ä","|":"ö","}":"å","~":"ü"};vt.R={"#":"£","@":"à","[":"°","\\\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};vt.Q={"@":"à","[":"â","\\\\":"ç","]":"ê","^":"î","\`":"ô","{":"é","|":"ù","}":"è","~":"û"};vt.K={"@":"§","[":"Ä","\\\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};vt.Y={"#":"£","@":"§","[":"°","\\\\":"ç","]":"é","\`":"ù","{":"à","|":"ò","}":"è","~":"ì"};vt.E=vt[6]={"@":"Ä","[":"Æ","\\\\":"Ø","]":"Å","^":"Ü","\`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};vt.Z={"#":"£","@":"§","[":"¡","\\\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};vt.H=vt[7]={"@":"É","[":"Ä","\\\\":"Ö","]":"Å","^":"Ü","\`":"é","{":"ä","|":"ö","}":"å","~":"ü"};vt["="]={"#":"ù","@":"à","[":"é","\\\\":"ç","]":"ê","^":"î",_:"è","\`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Wb=4294967295;var qb=class bH{constructor(e,t,s){this._hasScrollback=e;this._optionsService=t;this._bufferService=s;this.ydisp=0;this.ybase=0;this.y=0;this.x=0;this.tabs={};this.savedY=0;this.savedX=0;this.savedCurAttrData=ht.clone();this.savedCharset=Tn;this.markers=[];this._nullCell=Zi.fromCharData([0,f3,1,0]);this._whitespaceCell=Zi.fromCharData([0,Kr,1,32]);this._isClearing=false;this._memoryCleanupQueue=new Hd;this._memoryCleanupPosition=0;this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new zb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Fd),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Fd),this._whitespaceCell}getBlankLine(e,t){return new al(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eWb?Wb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ht);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new zb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(ht),r=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new al(e,s)));else for(let a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=true;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=false);let t=0;for(;this._memoryCleanupPosition100)return true;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,r=PN(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ht),s);if(r.length>0){let n=$N(this.lines,r);EN(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let r=this.getNullCell(ht),n=s;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let h=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),h.unshift(l);if(!s){let _=this.ybase+this.y;if(_>=a&&_0&&(n.push({start:a+h.length+o,newLines:p}),o+=p.length),h.push(...p);let m=d.length-1,O=d[m];O===0&&(m--,O=d[m]);let v=h.length-u-1,T=c;for(;v>=0;){let _=Math.min(T,O);if(h[m]===void 0)break;if(h[m].copyCellsFrom(h[v],T-_,O-_,_,true),O-=_,O===0&&(m--,O=d[m]),T-=_,T===0){v--;let C=Math.max(v,0);T=ih(h,C,this._cols)}}for(let _=0;_0;)this.ybase===0?this.y0){let a=[],l=[];for(let O=0;O=0;O--)if(u&&u.start>c+f){for(let v=u.newLines.length-1;v>=0;v--)this.lines.set(O--,u.newLines[v]);O++,a.push({index:c+1,amount:u.newLines.length}),f+=u.newLines.length,u=n[++d]}else this.lines.set(O,l[c--]);let p=0;for(let O=a.length-1;O>=0;O--)a[O].index+=p,this.lines.onInsertEmitter.fire(a[O]),p+=a[O].amount;let m=Math.max(0,h+o-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,s=0,r){let n=this.lines.get(e);return n?n.translateToString(t,s,r):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=true;for(let t=0;t{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.lines.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}};var AN=class extends Oe{constructor(i,e){super();this._optionsService=i;this._bufferService=e;this._onBufferActivate=this._register(new j);this.onBufferActivate=this._onBufferActivate.event;this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new qb(true,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new qb(false,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(i){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(i),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(i,e){this._normal.resize(i,e),this._alt.resize(i,e),this.setupTabStops(i)}setupTabStops(i){this._normal.setupTabStops(i),this._alt.setupTabStops(i)}};var K3=2;var J3=1;var eO=class SH extends Oe{constructor(e){super();this.isUserScrolling=false;this._onResize=this._register(new j);this.onResize=this._onResize.event;this._onScroll=this._register(new j);this.onScroll=this._onScroll.event;this.cols=Math.max(e.rawOptions.cols||0,K3),this.rows=Math.max(e.rawOptions.rows||0,J3),this.buffers=this._register(new AN(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=false}scroll(e,t=false){let s=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=s.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let n=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(s.scrollTop===0){let a=s.lines.isFull;o===s.lines.length-1?a?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(o+1,0,r.clone()),a?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let a=o-n+1;s.lines.shiftElements(n+1,a-1,-1),s.lines.set(o,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=true}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=false);let r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};eO=st([K(0,ci)],eO);var To={cols:80,rows:24,cursorBlink:false,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:true,drawBoldTextInBrightColors:true,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:false,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:false,scrollOnUserInput:true,scrollSensitivity:1,screenReaderMode:false,smoothScrollDuration:0,macOptionIsMeta:false,macOptionClickForcesSelection:false,minimumContrastRatio:1,disableStdin:false,allowProposedApi:false,allowTransparency:false,tabStopWidth:8,theme:{},reflowCursorLine:false,rescaleOverlappingGlyphs:false,rightClickSelectsWord:jd,windowOptions:{},windowsMode:false,windowsPty:{},wordSeparator:" ()[]{}',\\"\`",altClickMovesCursor:true,convertEol:false,termName:"xterm",cancelEvents:false,overviewRuler:{}};var LN=["normal","bold","100","200","300","400","500","600","700","800","900"];var MN=class extends Oe{constructor(i){super();this._onOptionChange=this._register(new j);this.onOptionChange=this._onOptionChange.event;let e={...To};for(let t in i)if(t in e)try{let s=i[t];e[t]=this._sanitizeAndValidateOption(t,s)}catch(s){console.error(s)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(je(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(i,e){return this.onOptionChange(t=>{t===i&&e(this.rawOptions[i])})}onMultipleOptionChange(i,e){return this.onOptionChange(t=>{i.indexOf(t)!==-1&&e()})}_setupOptions(){let i=t=>{if(!(t in To))throw new Error(\`No option with key "\${t}"\`);return this.rawOptions[t]},e=(t,s)=>{if(!(t in To))throw new Error(\`No option with key "\${t}"\`);s=this._sanitizeAndValidateOption(t,s),this.rawOptions[t]!==s&&(this.rawOptions[t]=s,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let s={get:i.bind(this,t),set:e.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(i,e){switch(i){case"cursorStyle":if(e||(e=To[i]),!BN(e))throw new Error(\`"\${e}" is not a valid value for \${i}\`);break;case"wordSeparator":e||(e=To[i]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=LN.includes(e)?e:To[i];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(\`\${i} cannot be less than 1, value: \${e}\`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(\`\${i} cannot be less than 0, value: \${e}\`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(\`\${i} cannot be less than or equal to 0, value: \${e}\`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(\`\${i} must be numeric, value: \${e}\`);break;case"windowsPty":e=e??{};break}return e}};function BN(i){return i==="block"||i==="underline"||i==="bar"}function ll(i,e=5){if(typeof i!="object")return i;let t=Array.isArray(i)?[]:{};for(let s in i)t[s]=e<=1?i[s]:i[s]&&ll(i[s],e-1);return t}var Xb=Object.freeze({insertMode:false});var Nb=Object.freeze({applicationCursorKeys:false,applicationKeypad:false,bracketedPasteMode:false,cursorBlink:void 0,cursorStyle:void 0,origin:false,reverseWraparound:false,sendFocus:false,synchronizedOutput:false,wraparound:true});var tO=class wH extends Oe{constructor(e,t,s){super();this._bufferService=e;this._logService=t;this._optionsService=s;this.isCursorInitialized=false;this.isCursorHidden=false;this._onData=this._register(new j);this.onData=this._onData.event;this._onUserInput=this._register(new j);this.onUserInput=this._onUserInput.event;this._onBinary=this._register(new j);this.onBinary=this._onBinary.event;this._onRequestScrollToBottom=this._register(new j);this.onRequestScrollToBottom=this._onRequestScrollToBottom.event;this.modes=ll(Xb),this.decPrivateModes=ll(Nb)}reset(){this.modes=ll(Xb),this.decPrivateModes=ll(Nb)}triggerDataEvent(e,t=false){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(\`sending data "\${e}"\`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(\`sending binary "\${e}"\`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};tO=st([K(0,hi),K(1,_3),K(2,ci)],tO);var Fb={NONE:{events:0,restrict:()=>false},X10:{events:1,restrict:i=>i.button===4||i.action!==1?false:(i.ctrl=false,i.alt=false,i.shift=false,true)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>!(i.action===32&&i.button===3)},ANY:{events:31,restrict:i=>true}};function yp(i,e){let t=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(t|=64,t|=i.action):(t|=i.button&3,i.button&4&&(t|=64),i.button&8&&(t|=128),i.action===32?t|=32:i.action===0&&!e&&(t|=3)),t}var bp=String.fromCharCode;var Zb={DEFAULT:i=>{let e=[yp(i,false)+32,i.col+32,i.row+32];return e[0]>255||e[1]>255||e[2]>255?"":\`\\x1B[M\${bp(e[0])}\${bp(e[1])}\${bp(e[2])}\`},SGR:i=>{let e=i.action===0&&i.button!==4?"m":"M";return\`\\x1B[<\${yp(i,true)};\${i.col};\${i.row}\${e}\`},SGR_PIXELS:i=>{let e=i.action===0&&i.button!==4?"m":"M";return\`\\x1B[<\${yp(i,true)};\${i.x};\${i.y}\${e}\`}};var iO=class xH extends Oe{constructor(e,t,s){super();this._bufferService=e;this._coreService=t;this._optionsService=s;this._protocols={};this._encodings={};this._activeProtocol="";this._activeEncoding="";this._lastEvent=null;this._wheelPartialScroll=0;this._onProtocolChange=this._register(new j);this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Fb))this.addProtocol(r,Fb[r]);for(let r of Object.keys(Zb))this.addEncoding(r,Zb[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(\`unknown protocol "\${e}"\`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(\`unknown encoding "\${e}"\`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let r=t/s,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=r+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return false;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,true)),this._lastEvent=e,true}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return false}else if(e.col!==t.col||e.row!==t.row)return false;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};iO=st([K(0,hi),K(1,po),K(2,ci)],iO);var Sp=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]];var IN=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];var gt;function DN(i,e){let t=0,s=e.length-1,r;if(ie[s][1])return false;for(;s>=t;)if(r=t+s>>1,i>e[r][1])t=r+1;else if(i=131072&&i<=196605||i>=196608&&i<=262141?2:1}charProperties(i,e){let t=this.wcwidth(i),s=t===0&&e!==0;if(s){let r=zn.extractWidth(e);r===0?s=false:r>t&&(t=r)}return zn.createPropertyValue(0,t,s)}};var zn=class Kc{constructor(){this._providers=Object.create(null);this._active="";this._onChange=new j;this.onChange=this._onChange.event;let e=new zN;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,s=false){return(e&16777215)<<3|(t&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(\`unknown Unicode version "\${e}"\`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,s=0,r=e.length;for(let n=0;n=r)return t+this.wcwidth(o);let h=e.charCodeAt(n);56320<=h&&h<=57343?o=(o-55296)*1024+h-56320+65536:t+=this.wcwidth(h)}let a=this.charProperties(o,s),l=Kc.extractWidth(a);Kc.extractShouldJoin(a)&&(l-=Kc.extractWidth(s)),t+=l,s=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}};var WN=class{constructor(){this.glevel=0;this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(i){this.glevel=i,this.charset=this._charsets[i]}setgCharset(i,e){this._charsets[i]=e,this.glevel===i&&(this.charset=e)}};function Ub(i){var s;let e=(s=i.buffer.lines.get(i.buffer.ybase+i.buffer.y-1))==null?void 0:s.get(i.cols-1),t=i.buffer.lines.get(i.buffer.ybase+i.buffer.y);t&&e&&(t.isWrapped=e[3]!==0&&e[3]!==32)}var Ua=2147483647;var qN=256;var eT=class sO{constructor(e=32,t=32){this.maxLength=e;this.maxSubParamsLength=t;if(t>qN)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=false,this._rejectSubDigits=false,this._digitIsSub=false}static fromArray(e){let t=new sO;if(!e.length)return t;for(let s=Array.isArray(e[0])?1:0;s>8,r=this._subParamsIdx[t]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=false,this._rejectSubDigits=false,this._digitIsSub=false}addParam(e){if(this._digitIsSub=false,this.length>=this.maxLength){this._rejectDigits=true;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Ua?Ua:e}addSubParam(e){if(this._digitIsSub=true,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=true;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Ua?Ua:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-t>0?this._subParams.subarray(t,s):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-s>0&&(e[t]=this._subParams.slice(s,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(r*10+e,Ua):e}};var ja=[];var XN=class{constructor(){this._state=0;this._active=ja;this._id=-1;this._handlers=Object.create(null);this._handlerFb=()=>{};this._stack={paused:false,loopPosition:0,fallThrough:false}}registerHandler(i,e){this._handlers[i]===void 0&&(this._handlers[i]=[]);let t=this._handlers[i];return t.push(e),{dispose:()=>{let s=t.indexOf(e);s!==-1&&t.splice(s,1)}}}clearHandler(i){this._handlers[i]&&delete this._handlers[i]}setHandlerFallback(i){this._handlerFb=i}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ja}reset(){if(this._state===2)for(let i=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;i>=0;--i)this._active[i].end(false);this._stack.paused=false,this._active=ja,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ja,!this._active.length)this._handlerFb(this._id,"START");else for(let i=this._active.length-1;i>=0;i--)this._active[i].start()}_put(i,e,t){if(!this._active.length)this._handlerFb(this._id,"PUT",Cu(i,e,t));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(i,e,t)}start(){this.reset(),this._state=1}put(i,e,t){if(this._state!==3){if(this._state===1)for(;e0&&this._put(i,e,t)}}end(i,e=true){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",i);else{let t=false,s=this._active.length-1,r=false;if(this._stack.paused&&(s=this._stack.loopPosition-1,t=e,r=this._stack.fallThrough,this._stack.paused=false),!r&&t===false){for(;s>=0&&(t=this._active[s].end(i),t!==true);s--)if(t instanceof Promise)return this._stack.paused=true,this._stack.loopPosition=s,this._stack.fallThrough=false,t;s--}for(;s>=0;s--)if(t=this._active[s].end(false),t instanceof Promise)return this._stack.paused=true,this._stack.loopPosition=s,this._stack.fallThrough=true,t}this._active=ja,this._id=-1,this._state=0}}};var xi=class kH{constructor(e){this._handler=e;this._data="";this._hitLimit=false}start(){this._data="",this._hitLimit=false}put(e,t,s){this._hitLimit||(this._data+=Cu(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=true))}end(e){let t=false;if(this._hitLimit)t=false;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=false,s));return this._data="",this._hitLimit=false,t}};var Ha=[];var NN=class{constructor(){this._handlers=Object.create(null);this._active=Ha;this._ident=0;this._handlerFb=()=>{};this._stack={paused:false,loopPosition:0,fallThrough:false}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ha}registerHandler(i,e){this._handlers[i]===void 0&&(this._handlers[i]=[]);let t=this._handlers[i];return t.push(e),{dispose:()=>{let s=t.indexOf(e);s!==-1&&t.splice(s,1)}}}clearHandler(i){this._handlers[i]&&delete this._handlers[i]}setHandlerFallback(i){this._handlerFb=i}reset(){if(this._active.length)for(let i=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;i>=0;--i)this._active[i].unhook(false);this._stack.paused=false,this._active=Ha,this._ident=0}hook(i,e){if(this.reset(),this._ident=i,this._active=this._handlers[i]||Ha,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(e)}put(i,e,t){if(!this._active.length)this._handlerFb(this._ident,"PUT",Cu(i,e,t));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(i,e,t)}unhook(i,e=true){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",i);else{let t=false,s=this._active.length-1,r=false;if(this._stack.paused&&(s=this._stack.loopPosition-1,t=e,r=this._stack.fallThrough,this._stack.paused=false),!r&&t===false){for(;s>=0&&(t=this._active[s].unhook(i),t!==true);s--)if(t instanceof Promise)return this._stack.paused=true,this._stack.loopPosition=s,this._stack.fallThrough=false,t;s--}for(;s>=0;s--)if(t=this._active[s].unhook(false),t instanceof Promise)return this._stack.paused=true,this._stack.loopPosition=s,this._stack.fallThrough=true,t}this._active=Ha,this._ident=0}};var hl=new eT;hl.addParam(0);var jb=class CH{constructor(e){this._handler=e;this._data="";this._params=hl;this._hitLimit=false}hook(e){this._params=e.length>1||e.params[0]?e.clone():hl,this._data="",this._hitLimit=false}put(e,t,s){this._hitLimit||(this._data+=Cu(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=true))}unhook(e){let t=false;if(this._hitLimit)t=false;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=hl,this._data="",this._hitLimit=false,s));return this._params=hl,this._data="",this._hitLimit=false,t}};var FN=class{constructor(i){this.table=new Uint8Array(i)}setDefault(i,e){this.table.fill(i<<4|e)}add(i,e,t,s){this.table[e<<8|i]=t<<4|s}addMany(i,e,t,s){for(let r=0;rl),t=(a,l)=>e.slice(a,l),s=t(32,127),r=t(0,24);r.push(25),r.push.apply(r,t(28,32));let n=t(0,14),o;i.setDefault(1,0),i.addMany(s,0,2,0);for(o in n)i.addMany([24,26,153,154],o,3,0),i.addMany(t(128,144),o,3,0),i.addMany(t(144,152),o,3,0),i.add(156,o,0,0),i.add(27,o,11,1),i.add(157,o,4,8),i.addMany([152,158,159],o,0,7),i.add(155,o,11,3),i.add(144,o,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(t(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(t(64,127),3,7,0),i.addMany(t(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(t(48,60),4,8,4),i.addMany(t(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(t(32,64),6,0,6),i.add(127,6,0,6),i.addMany(t(64,127),6,0,0),i.addMany(t(32,48),3,9,5),i.addMany(t(32,48),5,9,5),i.addMany(t(48,64),5,0,6),i.addMany(t(64,127),5,7,0),i.addMany(t(32,48),4,9,5),i.addMany(t(32,48),1,9,2),i.addMany(t(32,48),2,9,2),i.addMany(t(48,127),2,10,0),i.addMany(t(48,80),1,10,0),i.addMany(t(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(t(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(t(28,32),9,0,9),i.addMany(t(32,48),9,9,12),i.addMany(t(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(t(32,128),11,0,11),i.addMany(t(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(t(28,32),10,0,10),i.addMany(t(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(t(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(t(28,32),12,0,12),i.addMany(t(32,48),12,9,12),i.addMany(t(48,64),12,0,11),i.addMany(t(64,127),12,12,13),i.addMany(t(64,127),10,12,13),i.addMany(t(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(Di,0,2,0),i.add(Di,8,5,8),i.add(Di,6,0,6),i.add(Di,11,0,11),i.add(Di,13,13,13),i}();var UN=class extends Oe{constructor(i=ZN){super();this._transitions=i;this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0};this.initialState=0,this.currentState=this.initialState,this._params=new eT,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,s)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(je(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new XN),this._dcsParser=this._register(new NN),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\\\"},()=>true)}_identifier(i,e=[64,126]){let t=0;if(i.prefix){if(i.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=i.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;rn||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=n}}if(i.final.length!==1)throw new Error("final must be a single byte");let s=i.final.charCodeAt(0);if(e[0]>s||s>e[1])throw new Error(\`final must be in range \${e[0]} .. \${e[1]}\`);return t<<=8,t|=s,t}identToString(i){let e=[];for(;i;)e.push(String.fromCharCode(i&255)),i>>=8;return e.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,e){let t=this._identifier(i,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let s=this._escHandlers[t];return s.push(e),{dispose:()=>{let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,e){this._executeHandlers[i.charCodeAt(0)]=e}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,e){let t=this._identifier(i);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let s=this._csiHandlers[t];return s.push(e),{dispose:()=>{let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,e){return this._dcsParser.registerHandler(this._identifier(i),e)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,e){return this._oscParser.registerHandler(i,e)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(i,e,t,s,r){this._parseStack.state=i,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(i,e,t){let s=0,r=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===false&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==true);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(t===false&&l>-1){for(;l>=0&&(o=a[l](),o!==true);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(s=i[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,t),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=i[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,t),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a>4){case 2:for(let u=a+1;;++u){if(u>=e||(s=i[u])<32||s>126&&s=e||(s=i[u])<32||s>126&&s=e||(s=i[u])<32||s>126&&s=e||(s=i[u])<32||s>126&&s=0&&(o=l[h](this._params),o!==true);h--)if(o instanceof Promise)return this._preserveStack(3,l,h,r,a),o;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let c=this._escHandlers[this._collect<<8|s],d=c?c.length-1:-1;for(;d>=0&&(o=c[d](),o!==true);d--)if(o instanceof Promise)return this._preserveStack(4,c,d,r,a),o;d<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let u=a+1;;++u)if(u>=e||(s=i[u])===24||s===26||s===27||s>127&&s=e||(s=i[u])<32||s>127&&s>4:n>>8}return s}}function wp(i,e){let t=i.toString(16),s=t.length<2?"0"+t:t;switch(e){case 4:return t[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function VN(i,e=16){let[t,s,r]=i;return\`rgb:\${wp(t,e)}/\${wp(s,e)}/\${wp(r,e)}\`}var YN={"(":0,")":1,"*":2,"+":3,"-":1,".":2};var Ir=131072;var Vb=10;function Yb(i,e){if(i>24)return e.setWinLines||false;switch(i){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return false}var Gb=5e3;var Kb=0;var GN=class extends Oe{constructor(i,e,t,s,r,n,o,a,l=new UN){super();this._bufferService=i;this._charsetService=e;this._coreService=t;this._logService=s;this._optionsService=r;this._oscLinkService=n;this._coreMouseService=o;this._unicodeService=a;this._parser=l;this._parseBuffer=new Uint32Array(4096);this._stringDecoder=new mq;this._utf8Decoder=new gq;this._windowTitle="";this._iconName="";this._windowTitleStack=[];this._iconNameStack=[];this._curAttrData=ht.clone();this._eraseAttrDataInternal=ht.clone();this._onRequestBell=this._register(new j);this.onRequestBell=this._onRequestBell.event;this._onRequestRefreshRows=this._register(new j);this.onRequestRefreshRows=this._onRequestRefreshRows.event;this._onRequestReset=this._register(new j);this.onRequestReset=this._onRequestReset.event;this._onRequestSendFocus=this._register(new j);this.onRequestSendFocus=this._onRequestSendFocus.event;this._onRequestSyncScrollBar=this._register(new j);this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event;this._onRequestWindowsOptionsReport=this._register(new j);this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event;this._onA11yChar=this._register(new j);this.onA11yChar=this._onA11yChar.event;this._onA11yTab=this._register(new j);this.onA11yTab=this._onA11yTab.event;this._onCursorMove=this._register(new j);this.onCursorMove=this._onCursorMove.event;this._onLineFeed=this._register(new j);this.onLineFeed=this._onLineFeed.event;this._onScroll=this._register(new j);this.onScroll=this._onScroll.event;this._onTitleChange=this._register(new j);this.onTitleChange=this._onTitleChange.event;this._onColor=this._register(new j);this.onColor=this._onColor.event;this._parseStack={paused:false,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0};this._specialColors=[256,257,258];this._register(this._parser),this._dirtyRowTracker=new rO(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:c.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,c,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:c,data:d})}),this._parser.setDcsHandlerFallback((h,c,d)=>{c==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:c,payload:d})}),this._parser.setPrintHandler((h,c,d)=>this.print(h,c,d)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,false)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,true)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,false)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,true)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"\`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,true)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,false)),this._parser.setExecuteHandler(W.BEL,()=>this.bell()),this._parser.setExecuteHandler(W.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(W.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(W.BS,()=>this.backspace()),this._parser.setExecuteHandler(W.HT,()=>this.tab()),this._parser.setExecuteHandler(W.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(W.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Yc.IND,()=>this.index()),this._parser.setExecuteHandler(Yc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Yc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new xi(h=>(this.setTitle(h),this.setIconName(h),true))),this._parser.registerOscHandler(1,new xi(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new xi(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new xi(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new xi(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new xi(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new xi(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new xi(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new xi(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new xi(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new xi(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new xi(h=>this.restoreCursorColor(h))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let h in vt)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new jb((h,c)=>this.requestStatusString(h,c)))}getAttrData(){return this._curAttrData}_preserveStack(i,e,t,s){this._parseStack.paused=true,this._parseStack.cursorStartX=i,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=t,this._parseStack.position=s}_logSlowResolvingAsync(i){this._logService.logLevel<=3&&Promise.race([i,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),Gb))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(\`async parser handler taking longer than \${Gb} ms\`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(i,e){let t,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(t=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(t),t;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=false,i.length>Ir&&(n=this._parseStack.position+Ir)}if(this._logService.logLevel<=1&&this._logService.debug(\`parsing data \${typeof i=="string"?\` "\${i}"\`:\` "\${Array.prototype.map.call(i,h=>String.fromCharCode(h)).join("")}"\`}\`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof i=="string"?i.split("").map(h=>h.charCodeAt(0)):i),this._parseBuffer.lengthIr)for(let h=n;h0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let u=this._parser.precedingJoinState;for(let f=e;fa){if(l){let v=d,T=this._activeBuffer.x-O;for(this._activeBuffer.x=O,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),true)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=true),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),O>0&&d instanceof al&&d.copyCellsFrom(v,T,0,O,false);T=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(h&&(d.insertCells(this._activeBuffer.x,r-O,this._activeBuffer.getNullCell(c)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,c)),d.setCellFromCodepoint(this._activeBuffer.x++,s,r,c),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=u,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(i,e){return i.final==="t"&&!i.prefix&&!i.intermediates?this._parser.registerCsiHandler(i,t=>Yb(t.params[0],this._optionsService.rawOptions.windowOptions)?e(t):true):this._parser.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._parser.registerDcsHandler(i,new jb(e))}registerEscHandler(i,e){return this._parser.registerEscHandler(i,e)}registerOscHandler(i,e){return this._parser.registerOscHandler(i,new xi(e))}bell(){return this._onRequestBell.fire(),true}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=false,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),true}carriageReturn(){return this._activeBuffer.x=0,true}backspace(){var i;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,true;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))==null?void 0:i.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=false,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),true}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return true;let i=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-i),true}shiftOut(){return this._charsetService.setgLevel(1),true}shiftIn(){return this._charsetService.setgLevel(0),true}_restrictCursor(i=this._bufferService.cols-1){this._activeBuffer.x=Math.min(i,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(i,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=i,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=i,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(i,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+i,this._activeBuffer.y+e)}cursorUp(i){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,i.params[0]||1)):this._moveCursor(0,-(i.params[0]||1)),true}cursorDown(i){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,i.params[0]||1)):this._moveCursor(0,i.params[0]||1),true}cursorForward(i){return this._moveCursor(i.params[0]||1,0),true}cursorBackward(i){return this._moveCursor(-(i.params[0]||1),0),true}cursorNextLine(i){return this.cursorDown(i),this._activeBuffer.x=0,true}cursorPrecedingLine(i){return this.cursorUp(i),this._activeBuffer.x=0,true}cursorCharAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),true}cursorPosition(i){return this._setCursor(i.length>=2?(i.params[1]||1)-1:0,(i.params[0]||1)-1),true}charPosAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),true}hPositionRelative(i){return this._moveCursor(i.params[0]||1,0),true}linePosAbsolute(i){return this._setCursor(this._activeBuffer.x,(i.params[0]||1)-1),true}vPositionRelative(i){return this._moveCursor(0,i.params[0]||1),true}hVPosition(i){return this.cursorPosition(i),true}tabClear(i){let e=i.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),true}cursorForwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return true;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return true}cursorBackwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return true;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return true}selectProtected(i){let e=i.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),true}_eraseInBufferLine(i,e,t,s=false,r=false){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.replaceCells(e,t,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=false)}_resetBufferLine(i,e=false){let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);t&&(t.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+i),t.isWrapped=false)}eraseInDisplay(i,e=false){var s;this._restrictCursor(this._bufferService.cols);let t;switch(i.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);t=this._bufferService.cols&&(this._activeBuffer.lines.get(t+1).isWrapped=false);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(t=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,t-1);t--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t))==null?void 0:s.getTrimmedLength()););for(;t>=0;t--)this._bufferService.scroll(this._eraseAttrData())}else{for(t=this._bufferService.rows,this._dirtyRowTracker.markDirty(t-1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return true}eraseInLine(i,e=false){switch(this._restrictCursor(this._bufferService.cols),i.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,false,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,true,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),true}insertLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let l=a;for(let h=1;h0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(W.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(W.ESC+"[?6c")),true}sendDeviceAttributesSecondary(i){return i.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(W.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(W.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(i.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(W.ESC+"[>83;40003;0c")),true}_is(i){return(this._optionsService.rawOptions.termName+"").indexOf(i)===0}setMode(i){for(let e=0;e(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(t||(t={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:h,alt:c}=a,d=this._optionsService.rawOptions,u=(m,O)=>(o.triggerDataEvent(\`\${W.ESC}[\${e?"":"?"}\${m};\${O}$y\`),true),f=m=>m?1:2,p=i.params[0];return e?p===2?u(p,4):p===4?u(p,f(o.modes.insertMode)):p===12?u(p,3):p===20?u(p,f(d.convertEol)):u(p,0):p===1?u(p,f(s.applicationCursorKeys)):p===3?u(p,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?u(p,f(s.origin)):p===7?u(p,f(s.wraparound)):p===8?u(p,3):p===9?u(p,f(r==="X10")):p===12?u(p,f(d.cursorBlink)):p===25?u(p,f(!o.isCursorHidden)):p===45?u(p,f(s.reverseWraparound)):p===66?u(p,f(s.applicationKeypad)):p===67?u(p,4):p===1e3?u(p,f(r==="VT200")):p===1002?u(p,f(r==="DRAG")):p===1003?u(p,f(r==="ANY")):p===1004?u(p,f(s.sendFocus)):p===1005?u(p,4):p===1006?u(p,f(n==="SGR")):p===1015?u(p,4):p===1016?u(p,f(n==="SGR_PIXELS")):p===1048?u(p,1):p===47||p===1047||p===1049?u(p,f(h===c)):p===2004?u(p,f(s.bracketedPasteMode)):p===2026?u(p,f(s.synchronizedOutput)):u(p,0)}_updateAttrColor(i,e,t,s,r){return e===2?(i|=50331648,i&=-16777216,i|=yh.fromColorRGB([t,s,r])):e===5&&(i&=-50331904,i|=33554432|t&255),i}_extractColor(i,e,t){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=i.params[e+n],i.hasSubParams(e+n)){let o=i.getSubParams(e+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=o[a];while(++a=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e5)&&(i=1),e.extended.underlineStyle=i,e.fg|=268435456,i===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(i){i.fg=ht.fg,i.bg=ht.bg,i.extended=i.extended.clone(),i.extended.underlineStyle=0,i.extended.underlineColor&=-67108864,i.updateExtended()}charAttributes(i){if(i.length===1&&i.params[0]===0)return this._processSGR0(this._curAttrData),true;let e=i.length,t,s=this._curAttrData;for(let r=0;r=30&&t<=37?(s.fg&=-50331904,s.fg|=16777216|t-30):t>=40&&t<=47?(s.bg&=-50331904,s.bg|=16777216|t-40):t>=90&&t<=97?(s.fg&=-50331904,s.fg|=16777216|t-90|8):t>=100&&t<=107?(s.bg&=-50331904,s.bg|=16777216|t-100|8):t===0?this._processSGR0(s):t===1?s.fg|=134217728:t===3?s.bg|=67108864:t===4?(s.fg|=268435456,this._processUnderline(i.hasSubParams(r)?i.getSubParams(r)[0]:1,s)):t===5?s.fg|=536870912:t===7?s.fg|=67108864:t===8?s.fg|=1073741824:t===9?s.fg|=2147483648:t===2?s.bg|=134217728:t===21?this._processUnderline(2,s):t===22?(s.fg&=-134217729,s.bg&=-134217729):t===23?s.bg&=-67108865:t===24?(s.fg&=-268435457,this._processUnderline(0,s)):t===25?s.fg&=-536870913:t===27?s.fg&=-67108865:t===28?s.fg&=-1073741825:t===29?s.fg&=2147483647:t===39?(s.fg&=-67108864,s.fg|=ht.fg&16777215):t===49?(s.bg&=-67108864,s.bg|=ht.bg&16777215):t===38||t===48||t===58?r+=this._extractColor(i,r,s):t===53?s.bg|=1073741824:t===55?s.bg&=-1073741825:t===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):t===100?(s.fg&=-67108864,s.fg|=ht.fg&16777215,s.bg&=-67108864,s.bg|=ht.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",t);return true}deviceStatus(i){switch(i.params[0]){case 5:this._coreService.triggerDataEvent(\`\${W.ESC}[0n\`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(\`\${W.ESC}[\${e};\${t}R\`);break}return true}deviceStatusPrivate(i){switch(i.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(\`\${W.ESC}[?\${e};\${t}R\`);break}return true}softReset(i){return this._coreService.isCursorHidden=false,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ht.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=false,true}setCursorStyle(i){let e=i.length===0?1:i.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let t=e%2===1;this._coreService.decPrivateModes.cursorBlink=t}return true}setScrollRegion(i){let e=i.params[0]||1,t;return(i.length<2||(t=i.params[1])>this._bufferService.rows||t===0)&&(t=this._bufferService.rows),t>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),true}windowOptions(i){if(!Yb(i.params[0],this._optionsService.rawOptions.windowOptions))return true;let e=i.length>1?i.params[1]:0;switch(i.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(\`\${W.ESC}[8;\${this._bufferService.rows};\${this._bufferService.cols}t\`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Vb&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Vb&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return true}saveCursor(i){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,true}restoreCursor(i){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),true}setTitle(i){return this._windowTitle=i,this._onTitleChange.fire(i),true}setIconName(i){return this._iconName=i,true}setOrReportIndexedColor(i){let e=[],t=i.split(";");for(;t.length>1;){let s=t.shift(),r=t.shift();if(/^\\d+$/.exec(s)){let n=parseInt(s);if(Jb(n))if(r==="?")e.push({type:0,index:n});else{let o=Hb(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),true}setHyperlink(i){let e=i.indexOf(";");if(e===-1)return true;let t=i.slice(0,e).trim(),s=i.slice(e+1);return s?this._createHyperlink(t,s):t.trim()?false:this._finishHyperlink()}_createHyperlink(i,e){this._getCurrentLinkId()&&this._finishHyperlink();let t=i.split(":"),s,r=t.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=t[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),true}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),true}_setOrReportSpecialColor(i,e){let t=i.split(";");for(let s=0;s=this._specialColors.length);++s,++e)if(t[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=Hb(t[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return true}setOrReportFgColor(i){return this._setOrReportSpecialColor(i,0)}setOrReportBgColor(i){return this._setOrReportSpecialColor(i,1)}setOrReportCursorColor(i){return this._setOrReportSpecialColor(i,2)}restoreIndexedColor(i){if(!i)return this._onColor.fire([{type:2}]),true;let e=[],t=i.split(";");for(let s=0;s=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),true}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=true,true}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let i=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,i,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return true}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),true}reset(){this._curAttrData=ht.clone(),this._eraseAttrDataInternal=ht.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(i){return this._charsetService.setgLevel(i),true}screenAlignmentPattern(){let i=new Zi;i.content=1<<22|69,i.fg=this._curAttrData.fg,i.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e(this._coreService.triggerDataEvent(\`\${W.ESC}\${o}\${W.ESC}\\\\\`),true),s=this._bufferService.buffer,r=this._optionsService.rawOptions,n={block:2,underline:4,bar:6};return t(i==='"q'?\`P1$r\${this._curAttrData.isProtected()?1:0}"q\`:i==='"p'?'P1$r61;1"p':i==="r"?\`P1$r\${s.scrollTop+1};\${s.scrollBottom+1}r\`:i==="m"?"P1$r0m":i===" q"?\`P1$r\${n[r.cursorStyle]-(r.cursorBlink?1:0)} q\`:"P0$r")}markRangeDirty(i,e){this._dirtyRowTracker.markRangeDirty(i,e)}};var rO=class TH{constructor(e){this._bufferService=e;this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Kb=e,e=t,t=Kb),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};rO=st([K(0,hi)],rO);function Jb(i){return 0<=i&&i<256}var KN=5e7;var eS=12;var JN=50;var eF=class extends Oe{constructor(i){super();this._action=i;this._writeBuffer=[];this._callbacks=[];this._pendingData=0;this._bufferOffset=0;this._isSyncWriting=false;this._syncCalls=0;this._didUserInput=false;this._onWriteParsed=this._register(new j);this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=true}writeSync(i,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=i.length,this._writeBuffer.push(i),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=true;let t;for(;t=this._writeBuffer.shift();){this._action(t);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=false,this._syncCalls=0}write(i,e){if(this._pendingData>KN)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=false,this._pendingData+=i.length,this._writeBuffer.push(i),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=i.length,this._writeBuffer.push(i),this._callbacks.push(e)}_innerWrite(i=0,e=true){let t=i||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,e);if(r){let o=a=>performance.now()-t>=eS?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(t,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(false))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-t>=eS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>JN&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}};var nO=class PH{constructor(e){this._bufferService=e;this._nextId=1;this._entriesWithId=new Map;this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let l=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._dataByLinkId.set(h.id,h),h.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let o=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return\`\${e.id};;\${e.uri}\`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};nO=st([K(0,hi)],nO);var tS=false;var tF=class extends Oe{constructor(i){super();this._windowsWrappingHeuristics=this._register(new fa);this._onBinary=this._register(new j);this.onBinary=this._onBinary.event;this._onData=this._register(new j);this.onData=this._onData.event;this._onLineFeed=this._register(new j);this.onLineFeed=this._onLineFeed.event;this._onResize=this._register(new j);this.onResize=this._onResize.event;this._onWriteParsed=this._register(new j);this.onWriteParsed=this._onWriteParsed.event;this._onScroll=this._register(new j);this._instantiationService=new kN,this.optionsService=this._register(new MN(i)),this._instantiationService.setService(ci,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(eO)),this._instantiationService.setService(hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Jg)),this._instantiationService.setService(_3,this._logService),this.coreService=this._register(this._instantiationService.createInstance(tO)),this._instantiationService.setService(po,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(iO)),this._instantiationService.setService(O3,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(zn)),this._instantiationService.setService(yq,this.unicodeService),this._charsetService=this._instantiationService.createInstance(WN),this._instantiationService.setService(vq,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(nO),this._instantiationService.setService(v3,this._oscLinkService),this._inputHandler=this._register(new GN(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Xt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Xt.forward(this._bufferService.onResize,this._onResize)),this._register(Xt.forward(this.coreService.onData,this._onData)),this._register(Xt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(true))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new eF((e,t)=>this._inputHandler.parse(e,t))),this._register(Xt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new j),this._onScroll.event(i=>{var e;(e=this._onScrollApi)==null?void 0:e.fire(i.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(i){for(let e in i)this.optionsService.options[e]=i[e]}write(i,e){this._writeBuffer.write(i,e)}writeSync(i,e){this._logService.logLevel<=3&&!tS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),tS=true),this._writeBuffer.writeSync(i,e)}input(i,e=true){this.coreService.triggerDataEvent(i,e)}resize(i,e){isNaN(i)||isNaN(e)||(i=Math.max(i,K3),e=Math.max(e,J3),this._bufferService.resize(i,e))}scroll(i,e=false){this._bufferService.scroll(i,e)}scrollLines(i,e){this._bufferService.scrollLines(i,e)}scrollPages(i){this.scrollLines(i*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(i){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(i){let e=i-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(i,e){return this._inputHandler.registerEscHandler(i,e)}registerDcsHandler(i,e){return this._inputHandler.registerDcsHandler(i,e)}registerCsiHandler(i,e){return this._inputHandler.registerCsiHandler(i,e)}registerOscHandler(i,e){return this._inputHandler.registerOscHandler(i,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let i=false,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?i=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(i=true),i?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let i=[];i.push(this.onLineFeed(Ub.bind(null,this._bufferService))),i.push(this.registerCsiHandler({final:"H"},()=>(Ub(this._bufferService),false))),this._windowsWrappingHeuristics.value=je(()=>{for(let e of i)e.dispose()})}}};var iF={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["\`","~"],219:["[","{"],220:["\\\\","|"],221:["]","}"],222:["'",'"']};function sF(i,e,t,s){var o;let r={type:0,cancel:false,key:void 0},n=(i.shiftKey?1:0)|(i.altKey?2:0)|(i.ctrlKey?4:0)|(i.metaKey?8:0);switch(i.keyCode){case 0:i.key==="UIKeyInputUpArrow"?e?r.key=W.ESC+"OA":r.key=W.ESC+"[A":i.key==="UIKeyInputLeftArrow"?e?r.key=W.ESC+"OD":r.key=W.ESC+"[D":i.key==="UIKeyInputRightArrow"?e?r.key=W.ESC+"OC":r.key=W.ESC+"[C":i.key==="UIKeyInputDownArrow"&&(e?r.key=W.ESC+"OB":r.key=W.ESC+"[B");break;case 8:r.key=i.ctrlKey?"\\b":W.DEL,i.altKey&&(r.key=W.ESC+r.key);break;case 9:if(i.shiftKey){r.key=W.ESC+"[Z";break}r.key=W.HT,r.cancel=true;break;case 13:r.key=i.altKey?W.ESC+W.CR:W.CR,r.cancel=true;break;case 27:r.key=W.ESC,i.altKey&&(r.key=W.ESC+W.ESC),r.cancel=true;break;case 37:if(i.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"D":e?r.key=W.ESC+"OD":r.key=W.ESC+"[D";break;case 39:if(i.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"C":e?r.key=W.ESC+"OC":r.key=W.ESC+"[C";break;case 38:if(i.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"A":e?r.key=W.ESC+"OA":r.key=W.ESC+"[A";break;case 40:if(i.metaKey)break;n?r.key=W.ESC+"[1;"+(n+1)+"B":e?r.key=W.ESC+"OB":r.key=W.ESC+"[B";break;case 45:!i.shiftKey&&!i.ctrlKey&&(r.key=W.ESC+"[2~");break;case 46:n?r.key=W.ESC+"[3;"+(n+1)+"~":r.key=W.ESC+"[3~";break;case 36:n?r.key=W.ESC+"[1;"+(n+1)+"H":e?r.key=W.ESC+"OH":r.key=W.ESC+"[H";break;case 35:n?r.key=W.ESC+"[1;"+(n+1)+"F":e?r.key=W.ESC+"OF":r.key=W.ESC+"[F";break;case 33:i.shiftKey?r.type=2:i.ctrlKey?r.key=W.ESC+"[5;"+(n+1)+"~":r.key=W.ESC+"[5~";break;case 34:i.shiftKey?r.type=3:i.ctrlKey?r.key=W.ESC+"[6;"+(n+1)+"~":r.key=W.ESC+"[6~";break;case 112:n?r.key=W.ESC+"[1;"+(n+1)+"P":r.key=W.ESC+"OP";break;case 113:n?r.key=W.ESC+"[1;"+(n+1)+"Q":r.key=W.ESC+"OQ";break;case 114:n?r.key=W.ESC+"[1;"+(n+1)+"R":r.key=W.ESC+"OR";break;case 115:n?r.key=W.ESC+"[1;"+(n+1)+"S":r.key=W.ESC+"OS";break;case 116:n?r.key=W.ESC+"[15;"+(n+1)+"~":r.key=W.ESC+"[15~";break;case 117:n?r.key=W.ESC+"[17;"+(n+1)+"~":r.key=W.ESC+"[17~";break;case 118:n?r.key=W.ESC+"[18;"+(n+1)+"~":r.key=W.ESC+"[18~";break;case 119:n?r.key=W.ESC+"[19;"+(n+1)+"~":r.key=W.ESC+"[19~";break;case 120:n?r.key=W.ESC+"[20;"+(n+1)+"~":r.key=W.ESC+"[20~";break;case 121:n?r.key=W.ESC+"[21;"+(n+1)+"~":r.key=W.ESC+"[21~";break;case 122:n?r.key=W.ESC+"[23;"+(n+1)+"~":r.key=W.ESC+"[23~";break;case 123:n?r.key=W.ESC+"[24;"+(n+1)+"~":r.key=W.ESC+"[24~";break;default:if(i.ctrlKey&&!i.shiftKey&&!i.altKey&&!i.metaKey)i.keyCode>=65&&i.keyCode<=90?r.key=String.fromCharCode(i.keyCode-64):i.keyCode===32?r.key=W.NUL:i.keyCode>=51&&i.keyCode<=55?r.key=String.fromCharCode(i.keyCode-51+27):i.keyCode===56?r.key=W.DEL:i.keyCode===219?r.key=W.ESC:i.keyCode===220?r.key=W.FS:i.keyCode===221&&(r.key=W.GS);else if((!t||s)&&i.altKey&&!i.metaKey){let a=(o=iF[i.keyCode])==null?void 0:o[i.shiftKey?1:0];if(a)r.key=W.ESC+a;else if(i.keyCode>=65&&i.keyCode<=90){let l=i.ctrlKey?i.keyCode-64:i.keyCode+32,h=String.fromCharCode(l);i.shiftKey&&(h=h.toUpperCase()),r.key=W.ESC+h}else if(i.keyCode===32)r.key=W.ESC+(i.ctrlKey?W.NUL:" ");else if(i.key==="Dead"&&i.code.startsWith("Key")){let l=i.code.slice(3,4);i.shiftKey||(l=l.toLowerCase()),r.key=W.ESC+l,r.cancel=true}}else t&&!i.altKey&&!i.ctrlKey&&!i.shiftKey&&i.metaKey?i.keyCode===65&&(r.type=1):i.key&&!i.ctrlKey&&!i.altKey&&!i.metaKey&&i.keyCode>=48&&i.key.length===1?r.key=i.key:i.key&&i.ctrlKey&&(i.key==="_"&&(r.key=W.US),i.key==="@"&&(r.key=W.NUL));break}return r}var rt=0;var rF=class{constructor(i){this._getKey=i;this._array=[];this._insertedValues=[];this._flushInsertedTask=new Hd;this._isFlushingInserted=false;this._deletedIndices=[];this._flushDeletedTask=new Hd;this._isFlushingDeleted=false}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=false,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=false}insert(i){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(i)}_flushInserted(){let i=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),e=0,t=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r=this._array.length||this._getKey(i[e])<=this._getKey(this._array[t])?(s[r]=i[e],e++):s[r]=this._array[t++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(i){if(this._flushCleanupInserted(),this._array.length===0)return false;let e=this._getKey(i);if(e===void 0||(rt=this._search(e),rt===-1)||this._getKey(this._array[rt])!==e)return false;do if(this._array[rt]===i)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(rt),true;while(++rtr-n),e=0,t=new Array(this._array.length-i.length),s=0;for(let r=0;r0&&this._flushDeletedTask.flush()}*getKeyIterator(i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(rt=this._search(i),!(rt<0||rt>=this._array.length)&&this._getKey(this._array[rt])===i))do yield this._array[rt];while(++rt=this._array.length)&&this._getKey(this._array[rt])===i))do e(this._array[rt]);while(++rt=e;){let s=e+t>>1,r=this._getKey(this._array[s]);if(r>i)t=s-1;else if(r0&&this._getKey(this._array[s-1])===i;)s--;return s}}return e}};var xp=0;var iS=0;var nF=class extends Oe{constructor(){super();this._decorations=new rF(i=>i==null?void 0:i.marker.line);this._onDecorationRegistered=this._register(new j);this.onDecorationRegistered=this._onDecorationRegistered.event;this._onDecorationRemoved=this._register(new j);this.onDecorationRemoved=this._onDecorationRemoved.event;this._register(je(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(i){if(i.marker.isDisposed)return;let e=new oF(i);if(e){let t=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),t.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,e,t){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),i>=s&&i{xp=r.options.x??0,iS=xp+(r.options.width??1),i>=xp&&i=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=true,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=false,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let i=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,e)}};var sS=20;var Vd=class $H extends Oe{constructor(e,t,s,r){super();this._terminal=e;this._coreBrowserService=s;this._renderService=r;this._rowColumns=new WeakMap;this._liveRegionLineCount=0;this._charsToConsume=[];this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;othis._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new lF(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(\` \`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(de(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(je(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===\` @@ -970,7 +970,7 @@ WARNING: This link could potentially be dangerous\`)){let t=window.open();if(t){ \\r \`)}stopHeartbeat(){if(this.heartbeatInterval){clearInterval(this.heartbeatInterval);this.heartbeatInterval=null}if(this.heartbeatResponseTimeout){clearTimeout(this.heartbeatResponseTimeout);this.heartbeatResponseTimeout=null}this.pendingHeartbeatId=null;this.lastPingTime=null}disposeConnectionDisposables(){for(const e of this.disposables)e.dispose();this.disposables=[]}clearReconnectTimeout(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null}}resetActiveConnection(){var t;(t=this.authChallengeDialog)==null?void 0:t.dismiss();this.stopHeartbeat();this.clearReconnectTimeout();this.disposeConnectionDisposables();const e=this.ws;this.ws=null;this.sftpAttachUrl=null;this.trzszFilter=null;this.sessionReady=false;this.cfLatency=null;this.cfColo=null;this.wsLatency=null;if(e&&e.readyState!==WebSocket.CLOSED&&e.readyState!==WebSocket.CLOSING){e.close(1e3)}}hasReconnectStrategy(){if(this.resumeOnlyMode){return this.shareResumeSupported&&Boolean(this.activeSessionId&&this.activeResumeToken)&&(this.shareResumeDeadline===null||Date.now(){if(!e)this.scheduleFallbackReconnect()});return}this.scheduleFallbackReconnect()}scheduleShareResume(){if(this.shareSessionEndedByServer){this.finishShareResume();return}if(!this.hasReconnectStrategy()){this.finishShareResume();return}if(this.shareResumeDeadline===null){this.shareResumeDeadline=Date.now()+k4}const e=this.shareResumeDeadline-Date.now();if(e<=sU){this.finishShareResume();return}if(this.reconnectAttempts===1&&this.sessionRequiresDeviceSig&&this.shareResumeChallengeMissing){this.terminal.writeln(\`\\x1B[33m[!] \${g("terminal.shareResumeNoDeviceIdentity")}\\x1B[0m\`)}if(this.reconnectAttempts===2&&this.sessionRequiresDeviceSig&&!this.shareResumeChallengeMissing){this.terminal.writeln(\`\\x1B[33m[!] \${g("terminal.shareResumeEnvironmentHint")}\\x1B[0m\`)}const t=Math.min(1e3*2**Math.max(0,this.reconnectAttempts-1),3e4);const s=t>e;const r=Math.min(t,e);const n=Math.max(1,Math.round(r/1e3));if(s){this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.shareResumeFinalAttempt")}\\x1B[0m\`)}this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.resumingSession",{seconds:n,attempt:this.reconnectAttempts})}\\x1B[0m\`);this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null;void this.tryResumeSession().then(o=>{if(!o)this.finishShareResume()})},r)}finishShareResume(){this.resumeOnlyMode=false;this.shareResumeDeadline=null;this.shareResumeChallengeMissing=false;this.sessionRequiresDeviceSig=false;this.activeSessionId=null;this.activeResumeToken=null;this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.shareResumeEnded")}\\x1B[0m\`)}scheduleFallbackReconnect(){this.clearReconnectTimeout();const e=Math.min(1e3*2**this.reconnectAttempts,3e4);this.terminal.writeln(\`\\x1B[33m[*] \${g("terminal.reconnectWait",{seconds:e/1e3,attempt:this.reconnectAttempts,max:this.maxReconnectAttempts})}\\x1B[0m\`);this.reconnectTimeout=setTimeout(async()=>{this.reconnectTimeout=null;if(this.lastConfig){this.terminal.writeln(\`\\x1B[32m[+] \${g("terminal.reconnecting")}\\x1B[0m\`);try{await this.connect(this.lastConfig,{resetDisplay:false})}catch{this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.reconnectFailed")}\\x1B[0m\`)}}else if(this.reconnectWebSocketFactory){this.terminal.writeln(\`\\x1B[32m[+] \${g("terminal.reconnecting")}\\x1B[0m\`);const t=this.reconnectWebSocketFactory;try{const s=await t();if(this.reconnectWebSocketFactory!==t||!this.canReconnect||this.reconnectAttempts>=this.maxReconnectAttempts){s.close(1e3);return}this.connectWithWebSocket(s,this.lastHostInfo??void 0,{resetDisplay:false,reconnectFactory:t})}catch{this.terminal.writeln(\`\\x1B[31m[!] \${g("terminal.reconnectFailed")}\\x1B[0m\`);if(this.hasReconnectStrategy())this.scheduleReconnect()}}},e)}disconnect(){this.reconnectAttempts=this.maxReconnectAttempts;this.setMobileSelectionMode(false);this.resetActiveConnection();this.lastConfig=null;this.lastHostInfo=null;this.reconnectWebSocketFactory=null;this.resumeOnlyMode=false;this.shareResumeDeadline=null;this.shareResumeChallengeMissing=false;this.sessionRequiresDeviceSig=false;this.activeSessionId=null;this.activeResumeToken=null;this.resetTerminalDisplay()}dispose(){var e,t,s,r;this.disconnect();(e=this.authChallengeDialog)==null?void 0:e.destroy();this.authChallengeDialog=null;window.removeEventListener("resize",this.resizeListener);if(this.mobileConnectionRecoveryEnabled){document.removeEventListener("visibilitychange",this.visibilityChangeListener);window.removeEventListener("pageshow",this.pageShowListener)}window.removeEventListener("online",this.onlineListener);this.container.removeEventListener("pointerdown",this.selectionPointerDownListener,true);this.container.removeEventListener("pointermove",this.selectionPointerMoveListener,true);window.removeEventListener("pointerup",this.selectionPointerUpListener,true);window.removeEventListener("pointercancel",this.selectionPointerCancelListener,true);this.container.removeEventListener("contextmenu",this.contextMenuPasteListener);(t=this.imeTextarea)==null?void 0:t.removeEventListener("keydown",this.imeKeydownListener,true);(s=this.imeTextarea)==null?void 0:s.removeEventListener("keyup",this.imeKeyupListener,true);(r=this.imeTextarea)==null?void 0:r.removeEventListener("compositionstart",this.imeCompositionStartListener,true);this.clearIMEPendingInput();if(this.viewportRestoreFrame!==null)cancelAnimationFrame(this.viewportRestoreFrame);this.viewportRestoreFrame=null;this.imeTextarea=null;this.themeCleanup();for(const n of this.terminalDisposables)n.dispose();this.terminalDisposables=[];this.terminal.dispose()}exportToFile(e){var h,c;const t=this.terminal.buffer.active;const s=[];for(let d=0;d{const c=this.tabs.get(s);if(c){c.state=h?"connecting":"disconnected";this.renderTabBar();if(this.activeTabId===s){this.updateStatusBar(c)}if(c.sftpPanel){c.sftpPanel.dispose();c.sftpPanel=null}if(c.agentPanel){c.agentPanel.dispose();c.agentPanel=null}c.selectedText="";c.selectionAnchor=null;this.updateSelectionAction(c)}});o.setSessionReadyHandler(()=>{var h;const l=this.tabs.get(s);if(l){l.state="connected";this.renderTabBar();if(this.activeTabId===s){this.updateStatusBar(l)}if(!l.sftpPanel){l.sftpPanel=new ID(()=>l.terminal.getSFTPWebSocketUrl());l.sftpPanel.bindEvents()}l.sftpPanel.handleSSHReady();if(this._isLoggedIn&&!l.agentPanel){l.agentPanel=new xE(l.containerEl,true,(h=l.hostInfo)==null?void 0:h.serverId);l.agentPanel.render();l.agentPanel.setWebSocketSend(c=>l.terminal.sendWebSocketMessage(c));l.agentPanel.setTerminalFillHandler(()=>({label:this.getTerminalTargetLabel(l),available:this.activeTabId===l.id&&l.state==="connected"}),c=>{const d=this.getActiveTab();if((d==null?void 0:d.id)!==l.id||l.state!=="connected")return false;return l.terminal.fillInput(c)});l.terminal.setAgentFrameHandler(c=>{var d;(d=l.agentPanel)==null?void 0:d.handleAgentFrame(c)});l.agentPanel.setLayoutChangeHandler(()=>l.terminal.fit());this.updateSelectionAction(l)}}});o.setOSDetectedHandler((l,h)=>{var c;(c=this.onOSDetected)==null?void 0:c.call(this,l,h)});o.setLatencyUpdatedHandler((l,h,c)=>{const d=this.tabs.get(s);if(d){d.cfLatency=l??void 0;d.cfColo=h??void 0;d.wsLatency=c??void 0;if(this.activeTabId===s){this.updateStatusBar(d)}}});const a={id:s,label:e,terminal:o,sftpPanel:null,agentPanel:null,containerEl:r,hostInfo:t,state:"connecting",selectedText:"",selectionAnchor:null};this.tabs.set(s,a);o.setSelectionChangeHandler((l,h)=>{const c=this.tabs.get(s);if(!c)return;c.selectedText=l;c.selectionAnchor=h;if(this.activeTabId===s){this.updateSelectionAction(c)}});this.switchTab(s);this.renderTabBar();this.tabsChanged();return a}switchTab(e){var s,r,n;const t=this.tabs.get(e);if(!t)return;if(this.activeTabId===e)return;if(this.activeTabId&&this.activeTabId!==e){const o=this.tabs.get(this.activeTabId);if(o){(s=o.agentPanel)==null?void 0:s.rejectPendingConfirmation(false);o.containerEl.style.display="none";(r=o.sftpPanel)==null?void 0:r.hide()}}t.containerEl.style.display="flex";this.activeTabId=e;document.body.classList.toggle("agent-panel-open",((n=t.agentPanel)==null?void 0:n.isOpen)??false);document.dispatchEvent(new Event("cloudssh:active-terminal-change"));t.terminal.mount();this.updateStatusBar(t);this.updateSelectionAction(t);this.renderTabBar()}closeTab(e){var s;const t=this.tabs.get(e);if(!t)return;if(t.sftpPanel){t.sftpPanel.dispose();t.sftpPanel=null}if(t.agentPanel){t.agentPanel.dispose();t.agentPanel=null}t.terminal.dispose();t.containerEl.remove();this.tabs.delete(e);if(this.activeTabId===e){this.activeTabId=null;const r=Array.from(this.tabs.keys());if(r.length>0){this.switchTab(r[r.length-1])}else{document.body.classList.remove("agent-panel-open");(s=this.onAllTabsClosed)==null?void 0:s.call(this)}}this.renderTabBar();this.updateSelectionAction();this.tabsChanged()}closeAllTabs(){var t;const e=Array.from(this.tabs.keys());for(const s of e){const r=this.tabs.get(s);if(!r)continue;if(r.sftpPanel){r.sftpPanel.dispose();r.sftpPanel=null}if(r.agentPanel){r.agentPanel.dispose();r.agentPanel=null}r.terminal.dispose();r.containerEl.remove()}this.tabs.clear();this.activeTabId=null;document.body.classList.remove("agent-panel-open");this.renderTabBar();this.updateSelectionAction();(t=this.onAllTabsClosed)==null?void 0:t.call(this);this.tabsChanged()}getActiveTab(){if(!this.activeTabId)return null;return this.tabs.get(this.activeTabId)||null}getTabCount(){return this.tabs.size}hasAnyTab(){return this.tabs.size>0}getTerminalTargetLabel(e){if(!e.hostInfo)return e.label;const t=e.hostInfo.username?\`\${e.hostInfo.username}@\`:"";return\`\${e.label} · \${t}\${e.hostInfo.host}:\${e.hostInfo.port}\`}refreshTranslations(){this.renderTabBar();const e=this.getActiveTab();if(e)this.updateStatusBar(e)}closeActiveTab(){if(this.activeTabId){this.closeTab(this.activeTabId)}}disconnectActiveTab(){var t,s;const e=this.getActiveTab();if(!e)return;if(e.sftpPanel){e.sftpPanel.hide()}(t=e.agentPanel)==null?void 0:t.rejectPendingConfirmation(false);(s=e.agentPanel)==null?void 0:s.clearTerminalSelectionContext();e.terminal.disconnect();e.state="disconnected";e.selectedText="";e.selectionAnchor=null;this.updateSelectionAction(e);this.renderTabBar()}askAIAboutActiveSelection(){const e=this.getActiveTab();const t=(e==null?void 0:e.selectedText)||"";if(!(e==null?void 0:e.agentPanel)||!t.trim())return false;const s=e.agentPanel.attachTerminalSelection(t,this.getTerminalTargetLabel(e));if(s){e.terminal.clearSelection()}return s}renderTabBar(){const e=this.tabBarEl.querySelector("#new-tab-btn");this.tabBarEl.replaceChildren();for(const t of this.tabs.values()){const s=document.createElement("div");s.className=\`tab-item\${t.id===this.activeTabId?" active":""}\${t.state==="disconnected"?" disconnected":""}\`;s.dataset.tabId=t.id;const r=document.createElement("span");r.className=\`tab-dot \${this.tabDotClass(t.state)}\`;const n=document.createElement("span");n.className="tab-label";n.textContent=t.label;n.title=\`\${g("terminal.doubleClickToRename")}: \${t.label}\`;n.addEventListener("dblclick",a=>{a.stopPropagation();this.startRenameTab(t,n)});const o=document.createElement("button");o.className="tab-close";o.title=g("terminal.closeTab");o.appendChild(this.createIcon("close","14px"));s.append(r,n,o);s.addEventListener("contextmenu",a=>{a.preventDefault();this.showTabContextMenu(t,a.clientX,a.clientY)});s.addEventListener("click",a=>{if(a.target.closest(".tab-close"))return;this.switchTab(t.id)});o.addEventListener("click",a=>{a.stopPropagation();this.closeTab(t.id)});this.tabBarEl.appendChild(s)}if(e){this.tabBarEl.appendChild(e)}else{const t=document.createElement("button");t.id="new-tab-btn";t.className="tab-new-btn";t.title=g("terminal.newConnection");t.appendChild(this.createIcon("add","16px"));this.tabBarEl.appendChild(t)}}tabDotClass(e){if(e==="connected")return"tab-dot-connected";if(e==="connecting")return"tab-dot-connecting";return"tab-dot-disconnected"}renameTab(e,t){const s=this.tabs.get(e);if(!s)return;const r=t.trim();if(r)s.label=r;this.renderTabBar();if(this.activeTabId===e){this.updateStatusBar(s)}}startRenameTab(e,t){const s=e.label;const r=document.createElement("input");r.type="text";r.className="tab-rename-input terminal-input px-1 py-0 text-xs w-28 bg-surface border border-outline-variant";r.value=s;r.maxLength=40;let n=false;const o=()=>{if(n)return;n=true;this.renameTab(e.id,r.value)};r.addEventListener("keydown",a=>{if(a.key==="Enter"){a.preventDefault();o()}else if(a.key==="Escape"){a.preventDefault();n=true;this.renderTabBar()}});r.addEventListener("blur",()=>o());r.addEventListener("click",a=>a.stopPropagation());t.replaceWith(r);r.focus();r.select()}closeOtherTabs(e){for(const t of Array.from(this.tabs.values())){if(t.id!==e){this.closeTab(t.id)}}}showTabContextMenu(e,t,s){this.hideTabContextMenu();const r=document.createElement("div");r.id="tab-context-menu";r.className="fixed z-[100] cyber-box py-1 shadow-2xl text-xs bg-surface border border-outline-variant text-on-surface";r.style.left=\`\${t}px\`;r.style.top=\`\${s}px\`;const n=[{label:g("terminal.renameTab"),icon:"edit",action:()=>{const a=this.tabBarEl.querySelector(\`[data-tab-id="\${e.id}"]\`);const l=a==null?void 0:a.querySelector(".tab-label");if(l)this.startRenameTab(e,l)}},{label:g("terminal.duplicateTab"),icon:"content_copy",action:()=>{var a;(a=this.onDuplicateTab)==null?void 0:a.call(this,e)}},{label:g("terminal.closeOtherTabs"),icon:"close_fullscreen",action:()=>{this.closeOtherTabs(e.id)}},{label:g("terminal.closeTab"),icon:"close",action:()=>{this.closeTab(e.id)},className:"text-error"}];for(const a of n){const l=document.createElement("div");l.className=\`flex items-center gap-2 px-3 py-1.5 hover:bg-surface-variant cursor-pointer \${a.className||""}\`;l.appendChild(this.createIcon(a.icon,"14px"));l.appendChild(document.createTextNode(a.label));l.addEventListener("click",h=>{h.stopPropagation();this.hideTabContextMenu();a.action()});r.appendChild(l)}document.body.appendChild(r);const o=a=>{if(!r.contains(a.target)){this.hideTabContextMenu()}};this.tabCtxCloseHandler=o;setTimeout(()=>document.addEventListener("click",o,true),0)}hideTabContextMenu(){if(this.tabCtxCloseHandler){document.removeEventListener("click",this.tabCtxCloseHandler,true);this.tabCtxCloseHandler=null}const e=document.getElementById("tab-context-menu");e==null?void 0:e.remove()}createIcon(e,t){const s=document.createElement("span");s.className="material-symbols-outlined";s.style.fontSize=t;s.textContent=e;return s}setStatusIndicator(e,t,s){if(!e)return;const r=document.createElement("span");r.className=\`\${t} inline-block\`;e.replaceChildren(r,document.createTextNode(s))}updateStatusBar(e){const t=document.getElementById("term-host");const s=document.getElementById("term-user");const r=document.getElementById("term-port");const n=document.getElementById("term-status");const o=document.getElementById("status-text");if(e.hostInfo){if(t){const l=Cw(e.hostInfo.host);if(l){const h=g("terminal.clickToCopyIP");const c=document.createElement("button");c.type="button";c.className="host-ip-badge";c.title=h;c.setAttribute("aria-label",h);c.textContent=l;t.replaceChildren(document.createTextNode(g("terminal.hostLabel")),c);c.addEventListener("click",async()=>{const d=await Hn(e.hostInfo.host);if(d){c.classList.add("host-ip-copied");setTimeout(()=>c.classList.remove("host-ip-copied"),800);Y(g("terminal.ipCopied"),{variant:"success",duration:1500})}else{Y(g("terminal.ipCopyFailed"),{variant:"danger"})}})}else{t.textContent=g("terminal.host",{value:e.hostInfo.host})}}if(s)s.textContent=e.hostInfo.username?g("terminal.user",{value:e.hostInfo.username}):"";if(r)r.textContent=g("terminal.port",{value:e.hostInfo.port})}else{if(t)t.textContent=g("terminal.server",{value:e.label});if(s)s.textContent="";if(r)r.textContent=""}if(e.state==="connected"){this.setStatusIndicator(n,"w-2 h-2 bg-primary-container",g("terminal.connected"));this.setStatusIndicator(o,"w-2 h-2 bg-[var(--accent)] animate-pulse",g("auth.statusOnline"))}else if(e.state==="connecting"){this.setStatusIndicator(n,"w-2 h-2 bg-primary-container animate-pulse",g("terminal.connecting"))}else{this.setStatusIndicator(n,"w-2 h-2 bg-[var(--error)]",g("terminal.disconnected"));this.setStatusIndicator(o,"w-2 h-2 bg-surface-dot",g("auth.statusOffline"))}const a=document.getElementById("term-info");if(a){if(e.state==="connected"){const l=[];if(e.cfLatency!==void 0){l.push({label:\`CF-\${e.cfColo||"UNK"}: \${e.cfLatency}ms\`,quality:t_(e.cfLatency,"cf")})}if(e.wsLatency!==void 0){l.push({label:\`RTT: \${e.wsLatency}ms\`,quality:t_(e.wsLatency,"ws")})}if(l.length>0){const h=document.createDocumentFragment();h.appendChild(document.createTextNode("⚡ "));for(const[c,d]of l.entries()){if(c>0){const p=document.createElement("span");p.className="network-latency-separator";p.setAttribute("aria-hidden","true");p.textContent="|";h.appendChild(p)}const u=document.createElement("span");u.className="network-latency-item";const f=document.createElement("span");f.className=\`network-quality-dot network-quality-\${d.quality}\`;f.setAttribute("aria-hidden","true");u.append(f,document.createTextNode(d.label));h.appendChild(u)}a.replaceChildren(h)}else{a.textContent=""}}else{a.textContent=""}}}updateSelectionAction(e=this.getActiveTab()){const t=document.getElementById("ask-ai-selection-btn");if(!t)return;const s=!!(this._isLoggedIn&&e&&e.id===this.activeTabId&&e.state==="connected"&&e.agentPanel&&e.selectedText.trim()&&e.selectionAnchor);t.classList.toggle("hidden",!s);if(!s||!(e==null?void 0:e.selectionAnchor))return;const r=12;const n=8;const{clientX:o,clientY:a}=e.selectionAnchor;const l=e.containerEl.getBoundingClientRect();let h=o+r;let c=a+r;if(h+t.offsetWidth>l.right-n){h=o-t.offsetWidth-r}if(c+t.offsetHeight>l.bottom-n){c=a-t.offsetHeight-r}t.style.left=\`\${Math.max(l.left+n,h)}px\`;t.style.top=\`\${Math.max(l.top+n,c)}px\`}tabsChanged(){var e;(e=this.onTabsChanged)==null?void 0:e.call(this)}}let ce=null;let XS=null;let on=null;let gn=false;let j0=false;const H0=new r4(()=>{var i;return((i=ce==null?void 0:ce.getActiveTab())==null?void 0:i.terminal)??null});const hU=new F4({getTerminal:()=>{var i;return((i=ce==null?void 0:ce.getActiveTab())==null?void 0:i.terminal)??null},isAuthenticated:()=>gn&&!j0});function Tc(i){var e,t;(e=document.getElementById("user-space-header-actions"))==null?void 0:e.classList.toggle("is-open",i);(t=document.getElementById("user-space-more-btn"))==null?void 0:t.setAttribute("aria-expanded",String(i))}function cU(){const i=document.getElementById("user-space-more-btn");const e=document.getElementById("user-space-header-actions");if(!i||!e)return;i.addEventListener("click",()=>{Tc(!e.classList.contains("is-open"))});e.addEventListener("click",t=>{if(t.target.closest("button"))Tc(false)});e.addEventListener("change",()=>Tc(false));document.addEventListener("pointerdown",t=>{const s=t.target;if(s&&(i.contains(s)||e.contains(s)))return;Tc(false)},true)}function dU(){const i=[window.matchMedia("(max-width: 767px)"),window.matchMedia("(max-width: 1180px) and (pointer: coarse)")];for(const e of i){e.addEventListener("change",()=>on==null?void 0:on.refreshPageSize())}}function V0(){if(!ce){ce=new lU("tab-bar","terminal-area");ce.setAllTabsClosedHandler(()=>{OU()});ce.setLoggedIn(gn);ce.setOSDetectedHandler((i,e)=>{on==null?void 0:on.updateServerOS(i,e)});ce.setTabsChangedHandler(()=>{Y0()});ce.setDuplicateTabHandler(async i=>{var t;const e=(t=i.hostInfo)==null?void 0:t.serverId;if(!e){Y(g("terminal.duplicateAnonymousUnsupported"),{variant:"warning"});return}try{const s=await fO(e);const{terminal:r}=G0(i.label,i.hostInfo);r.mount();const n=()=>fO(e);r.connectWithWebSocket(s,i.hostInfo,{reconnectFactory:n})}catch(s){Y(s instanceof Error?s.message:String(s),{variant:"danger"})}});uU()}return ce}function uU(){var i;(i=document.getElementById("tab-bar"))==null?void 0:i.addEventListener("click",e=>{const t=e.target.closest("#new-tab-btn");if(!t)return;gU()})}function Y0(){var e,t;const i=(ce==null?void 0:ce.hasAnyTab())??false;(e=document.getElementById("back-to-terminal-btn"))==null?void 0:e.classList.toggle("hidden",!i);(t=document.getElementById("back-to-terminal-from-auth-btn"))==null?void 0:t.classList.toggle("hidden",!i)}function ET(){var i,e;document.getElementById("auth-section").classList.add("hidden");document.getElementById("user-space-section").classList.add("hidden");document.getElementById("user-space-section").classList.remove("flex");(i=document.getElementById("server-modal"))==null?void 0:i.classList.add("hidden");(e=document.getElementById("server-modal"))==null?void 0:e.classList.remove("flex");document.getElementById("terminal-section").classList.remove("hidden");document.getElementById("terminal-section").classList.add("flex");document.body.classList.add("terminal-active")}function Fp(){var i,e,t;if(!ce||!ce.hasAnyTab())return;(e=(i=ce.getActiveTab())==null?void 0:i.agentPanel)==null?void 0:e.rejectPendingConfirmation(false);ET();(t=ce.getActiveTab())==null?void 0:t.terminal.fit()}function fU(){var i,e;(i=document.getElementById("back-to-terminal-btn"))==null?void 0:i.addEventListener("click",()=>{Fp()});(e=document.getElementById("back-to-terminal-from-auth-btn"))==null?void 0:e.addEventListener("click",()=>{Fp()});document.addEventListener("keydown",t=>{var n;if(t.key!=="Escape")return;const s=((n=document.getElementById("terminal-section"))==null?void 0:n.classList.contains("hidden"))??true;if(!s)return;if(!(ce==null?void 0:ce.hasAnyTab()))return;const r=document.getElementById("server-modal");if(r&&!r.classList.contains("hidden"))return;t.preventDefault();Fp()})}function QT(){const i=new URLSearchParams(window.location.search);return i.has("wsUrl")}function Ru(i){try{const e=new URL(i);if(e.protocol!=="wss:"&&e.protocol!=="ws:")return false;return e.origin===window.location.origin||e.origin===window.location.origin.replace(/^http/,"ws")}catch{return false}}function pU(){const i=new URLSearchParams(window.location.search);const e=i.get("wsUrl");const t=i.get("name")||"Server";const s=i.get("host")||"";const r=parseInt(i.get("port")||"0",10)||0;if(!Ru(e)){const c=document.createElement("div");c.style.color="var(--error)";c.style.padding="2em";c.style.fontFamily="monospace";c.textContent=g("terminal.invalidUrl");document.body.replaceChildren(c);return}document.getElementById("auth-section").classList.add("hidden");document.getElementById("user-space-section").classList.add("hidden");document.getElementById("user-space-section").classList.remove("flex");document.getElementById("terminal-section").classList.remove("hidden");document.getElementById("terminal-section").classList.add("flex");document.body.classList.add("terminal-active");const n=document.getElementById("tab-bar");if(n)n.style.display="none";const o=V0();const a=o.createTab(t,s&&r?{host:s,port:r}:void 0);const l=new WebSocket(e);l.binaryType="arraybuffer";const h=s&&r?{host:s,port:r}:void 0;a.terminal.connectWithWebSocket(l,h)}function lh(){H0.leaveTerminal();document.getElementById("terminal-section").classList.add("hidden");document.getElementById("terminal-section").classList.remove("flex");document.body.classList.remove("terminal-active")}function Au(){lh();document.getElementById("auth-section").classList.remove("hidden");document.getElementById("user-space-section").classList.add("hidden");document.getElementById("user-space-section").classList.remove("flex");document.getElementById("server-modal").classList.add("hidden");document.getElementById("server-modal").classList.remove("flex");if(!XS){XS=new JP({getTabManager:V0})}Y0()}function mU(i){var e;lh();gn=true;document.getElementById("auth-section").classList.add("hidden");document.getElementById("user-space-section").classList.remove("hidden");document.getElementById("user-space-section").classList.add("flex");(e=document.getElementById("agent-toggle-btn"))==null?void 0:e.classList.remove("hidden");on=new w4(i,()=>{gn=false;on=null;if(ce){ce.closeAllTabs()}Au()},(t,s,r)=>{_U(t,s,r)})}function gU(){var i,e;(e=(i=ce==null?void 0:ce.getActiveTab())==null?void 0:i.agentPanel)==null?void 0:e.rejectPendingConfirmation(false);if(gn){lh();document.getElementById("user-space-section").classList.remove("hidden");document.getElementById("user-space-section").classList.add("flex")}else{Au()}Y0()}function OU(){var e,t;if(j0){lh();Ew();return}if(QT()){H0.leaveTerminal();window.close();return}if(ce&&ce.hasAnyTab()){return}lh();if(gn){(e=document.getElementById("user-space-section"))==null?void 0:e.classList.remove("hidden");(t=document.getElementById("user-space-section"))==null?void 0:t.classList.add("flex")}else{Au()}const i=document.getElementById("status-text");if(i){const s=document.createElement("span");s.className="w-2 h-2 bg-surface-dot inline-block";i.replaceChildren(s,document.createTextNode(g("auth.statusOffline")))}}function G0(i,e){ET();const t=V0();const s=t.createTab(i,e);return{tab:s,terminal:s.terminal}}function _U(i,e,t){if(!Ru(i)){Y(g("server.invalidWs"),{title:g("server.connectFailed"),variant:"danger"});return}const{terminal:s}=G0(e,t);s.mount();const r=new WebSocket(i);r.binaryType="arraybuffer";const n=t==null?void 0:t.serverId;const o=n?()=>fO(n):void 0;s.connectWithWebSocket(r,t,{reconnectFactory:o})}function vU(i){var r,n,o;if(!Ru(i.wsUrl)){Ew();return}j0=true;gn=false;(r=document.getElementById("agent-toggle-btn"))==null?void 0:r.classList.add("hidden");(n=document.getElementById("snippet-toggle-btn"))==null?void 0:n.classList.add("hidden");(o=document.getElementById("mobile-snippets-btn"))==null?void 0:o.classList.add("hidden");const e=document.getElementById("tab-bar");if(e)e.style.display="none";const{terminal:t}=G0(i.serverName);t.mount();const s=new WebSocket(i.wsUrl);s.binaryType="arraybuffer";t.connectWithWebSocket(s,void 0,{resumeOnly:true})}async function fO(i){const e=await fetch(\`/api/servers/\${i}/connect\`,{method:"POST"});if(!e.ok){const r=e.headers.get("content-type")||"";const n=r.includes("application/json")?(await e.json()).error:null;throw new Error(n||\`Connection failed (\${e.status})\`)}const{wsUrl:t}=await e.json();if(typeof t!=="string"||!Ru(t)){throw new Error(g("server.invalidWs"))}const s=new WebSocket(t);s.binaryType="arraybuffer";return s}var KS;(KS=document.getElementById("disconnect-btn"))==null?void 0:KS.addEventListener("click",()=>{var t;const i=ce;if(!i)return;const e=i.getActiveTab();if(!e)return;(t=e.sftpPanel)==null?void 0:t.hide();e.terminal.disconnect();i.closeActiveTab()});function RT(){hU.toggle()}var JS;(JS=document.getElementById("snippet-toggle-btn"))==null?void 0:JS.addEventListener("click",RT);var ew;(ew=document.getElementById("mobile-snippets-btn"))==null?void 0:ew.addEventListener("click",RT);var tw;(tw=document.getElementById("sftp-toggle-btn"))==null?void 0:tw.addEventListener("click",()=>{const i=ce==null?void 0:ce.getActiveTab();if(!i)return;if(!i.sftpPanel){return}i.sftpPanel.toggle()});const yU=new sP;var iw;(iw=document.getElementById("ai-config-btn"))==null?void 0:iw.addEventListener("click",()=>{yU.show()});var sw;(sw=document.getElementById("agent-toggle-btn"))==null?void 0:sw.addEventListener("click",()=>{const i=ce==null?void 0:ce.getActiveTab();if(!(i==null?void 0:i.agentPanel))return;i.agentPanel.toggle()});const ea=document.getElementById("ask-ai-selection-btn");ea==null?void 0:ea.addEventListener("pointerdown",i=>{i.stopPropagation()});ea==null?void 0:ea.addEventListener("click",()=>{ce==null?void 0:ce.askAIAboutActiveSelection()});var rw;(rw=document.getElementById("search-btn"))==null?void 0:rw.addEventListener("click",()=>{var i;(i=ce==null?void 0:ce.getActiveTab())==null?void 0:i.terminal.toggleSearch()});var nw;(nw=document.getElementById("export-btn"))==null?void 0:nw.addEventListener("click",()=>{var i;(i=ce==null?void 0:ce.getActiveTab())==null?void 0:i.terminal.exportToFile()});const Ns="__custom__";let Lu=0;const K0=Array.from(document.querySelectorAll("[data-theme-selector]"));for(const i of K0){i.addEventListener("change",e=>{Lu++;const t=e.target.value;if(t===Ns){const s=localStorage.getItem("cloudssh_imported_theme");if(s){try{const r=ta(JSON.parse(s));if(r)iu(r)}catch{}}}else if(yw(t)){$c(t)}Xn(t);localStorage.setItem("cloudssh_theme_selection",t)})}function Mu(){for(const i of K0){let e=i.querySelector(\`option[value="\${Ns}"]\`);if(!e){e=document.createElement("option");e.value=Ns;i.insertBefore(e,i.firstChild)}e.textContent=g("theme.custom")}}function Xn(i){for(const e of K0){e.value=i}}const bU=document.querySelectorAll("[data-theme-import]");const Hr=document.getElementById("import-theme-input");for(const i of bU){i.addEventListener("click",()=>Hr==null?void 0:Hr.click())}Hr==null?void 0:Hr.addEventListener("change",i=>{var s;const e=(s=i.target.files)==null?void 0:s[0];if(!e)return;if(e.size>dP){Y(g("theme.importFailed"),{title:g("theme.importTitle"),variant:"danger"});Hr.value="";return}const t=new FileReader;t.onload=async r=>{try{const n=ta(JSON.parse(r.target.result));if(!n){Y(g("theme.importFailed"),{title:g("theme.importTitle"),variant:"danger"});return}localStorage.setItem("cloudssh_imported_theme",JSON.stringify(n));Lu++;Mu();Xn(Ns);localStorage.setItem("cloudssh_theme_selection",Ns);iu(n);Y(g("theme.importSuccess"),{variant:"success"});if(gn&&!await AT(n)){Y(g("theme.syncFailed"),{title:g("feedback.warning"),variant:"warning"})}}catch{Y(g("theme.invalidJson"),{title:g("theme.importTitle"),variant:"danger"})}};t.readAsText(e);Hr.value=""});function SU(){const i=localStorage.getItem("cloudssh_theme_selection");localStorage.removeItem("cloudssh_theme");if(i==="glacier"){localStorage.setItem("cloudssh_theme_selection","standard-dark");$c("standard-dark");Xn("standard-dark");return}if(yw(i)){$c(i);Xn(i);return}const e=localStorage.getItem("cloudssh_imported_theme");if(e){try{const t=ta(JSON.parse(e));if(!t)throw new Error("Invalid theme");localStorage.setItem("cloudssh_imported_theme",JSON.stringify(t));Mu();if(i===Ns){iu(t);Xn(Ns);return}}catch{localStorage.removeItem("cloudssh_imported_theme")}}localStorage.setItem("cloudssh_theme_selection","cyberpunk");$c("cyberpunk");Xn("cyberpunk")}async function AT(i){if(!i)return false;try{const e=await fetch("/api/user/theme",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme_data:i})});return e.ok}catch{return false}}async function wU(i,e){try{const t=await fetch("/api/user/theme");if(!t.ok)return;const s=await t.json();const r=ta(s.theme);if(r){if(Lu!==e)return;localStorage.setItem("cloudssh_imported_theme",JSON.stringify(r));Mu();if(i===null||i===Ns){localStorage.setItem("cloudssh_theme_selection",Ns);iu(r);Xn(Ns)}return}const n=localStorage.getItem("cloudssh_imported_theme");if(!n)return;const o=ta(JSON.parse(n));if(o)await AT(o)}catch{}}async function xU(){iP();cU();dU();fU();H0.start();On(()=>{if(localStorage.getItem("cloudssh_imported_theme"))Mu();ce==null?void 0:ce.refreshTranslations()});const i=localStorage.getItem("cloudssh_theme_selection");SU();const e=document.getElementById("copyright-year");if(e){e.textContent=new Date().getFullYear().toString()}const t=L4();if(t){B4(t,vU);return}if(QT()){pU();return}try{const s=await fetch("/api/auth/me");if(s.ok){const r=await s.json();mU(r);void wU(i,Lu);return}}catch{}Au()}xU(); -