diff --git a/design-system/AGENTS.md b/design-system/AGENTS.md index 5d6c846f1e..ab5c335a71 100644 --- a/design-system/AGENTS.md +++ b/design-system/AGENTS.md @@ -70,8 +70,13 @@ For Spinner presentations, FlowChat integration and decorative playback: ```bash pnpm --dir design-system run build:ui && node --test design-system/packages/ui/tests/spinner.test.mjs design-system/packages/ui/tests/brand.test.mjs design-system/packages/ui/tests/registry.test.mjs +pnpm --dir src/web-ui exec vitest run src/shared/ui/FlowChatRuntimeStatus.test.tsx src/flow_chat/components/modern/RuntimeStatusSlot.test.tsx ``` +The runtime status fixture checks resident geometry ownership and playback through +exit, reversal, cancellation and unmount. DOM tests do not prove native transition +rendering; the workload E2E records actual status fade-out outside resource windows. + For ColorPicker HEX drafts, flower selection, curved lightness dragging and keyboard input: ```bash @@ -80,3 +85,16 @@ pnpm --dir src/web-ui run test:run src/shared/ui/ColorPicker.test.tsx src/app/co ``` These package and DOM checks do not establish visual fidelity or live remote behavior. + +For Subagent motion rendering and playback, build UI and run the focused brand +contract above. After building the production Web UI, the opt-in native geometry +contract compares all 20 artworks, three sizes and authored actions to a named +Git revision, including opacity, pause/resume, reduced motion and cleanup: + +```bash +OPENBITFUN_WORKBENCH_MOTION_CONTRACT=1 OPENBITFUN_MOTION_REFERENCE_COMMIT=HEAD OPENBITFUN_WORKBENCH_PANELS_ONLY=1 node tests/e2e/scripts/run-workbench-performance.mjs +``` + +Use a pre-change reference commit when testing an already committed change. +The native fixture runs outside performance windows. Geometry equivalence does +not establish pixel-identical rasterization or coverage on other WebView engines. diff --git a/design-system/packages/ui/README.md b/design-system/packages/ui/README.md index ac82ee490a..f6ae6abb44 100644 --- a/design-system/packages/ui/README.md +++ b/design-system/packages/ui/README.md @@ -18,6 +18,26 @@ export function Example() { The package owns component anatomy, behavior, accessibility, and stable variants. It does not own theme selection persistence, product state, routes, locale resources, or platform APIs. +## Subagent artwork motion + +The opt-in `@openbitfun/ui/brand` entry exports `useSubagentAvatarMotion` and +`createSubagentMotionPlayer`. Their default `svg` rendering preserves existing +avatar behavior. A standalone artwork surface may explicitly select `layers` +(the hook's fifth argument, or the player's fourth argument) after native +performance and rendering verification. The SVG must fill its sole parent +surface, with the authored `xMidYMid meet` viewBox and no additional SVG offset. + +`layers` keeps the outer SVG as the layout and accessibility placeholder, moves +its authored shapes into SVG leaves in HTML transform layers, and maps SVG units +into the surface with a ResizeObserver. The HTML layers remain outside SVG: +`foreignObject` geometry can appear correct while WebKit draws its accelerated +contents at the wrong position or scale. Keyframes and playback controls are +shared with the default renderer. Unmeasurable artwork keeps the SVG renderer; +disposal cancels animation, disconnects sizing observation and restores markup. +Keep this choice local to measured large artwork; do not promote every small +avatar without measuring its memory and rendering cost. Verify actual native +screenshots as well as transform matrices when changing either renderer. + ## Loading indicators Use `Spinner` for the shared loading indicator. Its default `logo` presentation @@ -39,6 +59,9 @@ The host supplies localized accessible text. Omit `aria-label` when adjacent copy already describes the activity. `active={false}` shows a still mark. Playback pauses offscreen or when the document is hidden and respects reduced motion. `LoadingState` composes the same indicator with optional support copy. +`FlowChatRuntimeStatus` keeps its fixed slot mounted when hidden, but stops its +indicator after the content's actual exit transitions finish or are cancelled. +A reversed exit keeps the existing playback; a fully hidden slot owns no loop. The legacy `variant="matrix"` value resolves to `logo` for existing callers; `variant="bars"` selects the bar presentation. The legacy matrix layout tokens continue to define the established size allocations. diff --git a/design-system/packages/ui/src/brand/subagent/subagentMotionPlayer.ts b/design-system/packages/ui/src/brand/subagent/subagentMotionPlayer.ts index 34d773c934..be433ede77 100644 --- a/design-system/packages/ui/src/brand/subagent/subagentMotionPlayer.ts +++ b/design-system/packages/ui/src/brand/subagent/subagentMotionPlayer.ts @@ -1,9 +1,10 @@ import { neutralMotionFrames, type MotionClip, type MotionPart } from "./subagentMotion"; const parts: readonly MotionPart[] = ["body", "lever", "face", "eyes"]; -type Rig = Record; +export type SubagentMotionRenderMode = "svg" | "layers"; +type Rig = Record; -function createRig(svg: SVGSVGElement) { +function createRig(svg: SVGSVGElement, renderMode: SubagentMotionRenderMode) { const original = Array.from(svg.childNodes, (node) => node.cloneNode(true)); const stem = svg.querySelector(":scope > rect"); const body = svg.querySelector(":scope > path"); @@ -25,15 +26,77 @@ function createRig(svg: SVGSVGElement) { const face = group("face", [eyeRig]); const bodyRig = group("body", [lever, body, face]); svg.append(bodyRig); - return { - rig: { body: bodyRig, lever, face, eyes: eyeRig } satisfies Rig, - restore: () => svg.replaceChildren(...original), + const svgRig = { body: bodyRig, lever, face, eyes: eyeRig }; + const restore = () => svg.replaceChildren(...original); + if (renderMode === "layers") { + const layered = createLayerRig(svg, svgRig, { stem, body, knob, eyes }); + if (layered) return { rig: layered.rig, restore: () => { layered.dispose(); restore(); } }; + } + return { rig: svgRig satisfies Rig, restore }; +} + +/** Opt-in for a standalone artwork surface, retaining its SVG layout box. */ +function createLayerRig(svg: SVGSVGElement, rig: Record, artwork: Record<"stem" | "body" | "knob" | "eyes", Element>) { + const parent = svg.parentElement; + const view = svg.ownerDocument.defaultView; + const box = svg.viewBox.baseVal; + const aspect = svg.preserveAspectRatio.baseVal; + if (!parent || !view?.ResizeObserver || parent.childElementCount !== 1 || box.width <= 0 || box.height <= 0 + || aspect.align !== 6 || aspect.meetOrSlice !== 1 || !svg.clientWidth || !svg.clientHeight) return; + let bounds: DOMRect[]; + try { bounds = parts.map(part => rig[part].getBBox()); } catch { return; } + if (bounds.some(rect => ![rect.x, rect.y, rect.width, rect.height].every(Number.isFinite) || rect.width <= 0 || rect.height <= 0)) return; + const document = svg.ownerDocument; + const overlay = document.createElement("span"); + overlay.dataset.subagentMotionLayer = "true"; + overlay.setAttribute("aria-hidden", "true"); + Object.assign(overlay.style, { position: "absolute", inset: "0", pointerEvents: "none", overflow: "visible" }); + const canvas = document.createElement("span"); + Object.assign(canvas.style, { position: "absolute", left: "0", top: "0", width: `${box.width}px`, height: `${box.height}px`, transformOrigin: "0 0" }); + overlay.append(canvas); + const layer = (...children: Element[]) => { + const element = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + element.setAttribute("width", String(box.width)); element.setAttribute("height", String(box.height)); + Object.assign(element.style, { position: "absolute", left: "0", top: "0", overflow: "visible" }); + element.append(...children); return element; + }; + const group = (part: MotionPart, children: Element[]) => { + const boundsForPart = bounds[parts.indexOf(part)]!; + const element = document.createElement("span"); + element.dataset.motionPart = part; + Object.assign(element.style, { position: "absolute", left: "0", top: "0", width: `${box.width}px`, height: `${box.height}px`, + transformOrigin: `${boundsForPart.x + boundsForPart.width / 2}px ${boundsForPart.y + boundsForPart.height * (part === "body" || part === "lever" ? 1 : 0.5)}px` }); + element.append(...children); return element; + }; + const lever = group("lever", [layer(artwork.stem, artwork.knob)]); + const eyes = group("eyes", [layer(artwork.eyes)]); + const face = group("face", [eyes]); + const body = group("body", [lever, layer(artwork.body), face]); + canvas.append(body); + rig.body.remove(); + const oldPosition = parent.style.position; + const positioned = view.getComputedStyle(parent).position === "static"; + if (positioned) parent.style.position = "relative"; + parent.append(overlay); + // The untouched outer SVG remains the layout placeholder. HTML transforms + // live outside SVG; foreignObject transform layers misplace pixels in WebKit. + const fit = () => { + const width = svg.clientWidth, height = svg.clientHeight; + const scale = Math.min(width / box.width, height / box.height); + canvas.style.transform = `matrix(${scale}, 0, 0, ${scale}, ${(width - box.width * scale) / 2 - box.x * scale}, ${(height - box.height * scale) / 2 - box.y * scale})`; }; + fit(); + const observer = new view.ResizeObserver(fit); + observer.observe(svg); + return { rig: { body, lever, face, eyes } satisfies Rig, dispose: () => { + observer.disconnect(); overlay.remove(); + if (positioned && parent.style.position === "relative") parent.style.position = oldPosition; + } }; } /** One player owns every size sample, all animation handles, and completion. */ -export function createSubagentMotionPlayer(host: HTMLElement, onFinish: () => void, selector = '.subagent-motion-art svg') { - const rigs = Array.from(host.querySelectorAll(selector), createRig); +export function createSubagentMotionPlayer(host: HTMLElement, onFinish: () => void, selector = '.subagent-motion-art svg', renderMode: SubagentMotionRenderMode = "svg") { + const rigs = Array.from(host.querySelectorAll(selector), svg => createRig(svg, renderMode)); let animations: Animation[] = []; let revision = 0; let paused = false; diff --git a/design-system/packages/ui/src/brand/subagent/useSubagentAvatarMotion.ts b/design-system/packages/ui/src/brand/subagent/useSubagentAvatarMotion.ts index cedfaa007b..0ec3b28b63 100644 --- a/design-system/packages/ui/src/brand/subagent/useSubagentAvatarMotion.ts +++ b/design-system/packages/ui/src/brand/subagent/useSubagentAvatarMotion.ts @@ -1,20 +1,26 @@ import { useEffect, useRef, type RefObject } from 'react'; -import { createSubagentMotionPlayer, type SubagentMotionPlayer } from './subagentMotionPlayer'; +import { createSubagentMotionPlayer, type SubagentMotionPlayer, type SubagentMotionRenderMode } from './subagentMotionPlayer'; import { pressHoldClip, pressReleaseClip, subagentMotionClips } from './subagentMotion'; const isWorking = (status: string) => status === 'running' || status === 'finishing'; /** Animate authored avatar parts, never the measured card or its text. */ -export function useSubagentAvatarMotion(ref: RefObject, status: string, enabled: boolean, identity?: string) { +export function useSubagentAvatarMotion(ref: RefObject, status: string, enabled: boolean, identity?: string, renderMode: SubagentMotionRenderMode = "svg") { const playerRef = useRef(); const statusRef = useRef(status); const previousStatus = useRef(status); + const enabledRef = useRef(enabled); + const synchronizeEnabled = useRef<() => void>(); statusRef.current = status; + enabledRef.current = enabled; + // Standalone layered artwork stays mounted while its scene is retained. + // Ordinary SVG callers may replace their artwork when motion is disabled. + const attach = enabled || renderMode === 'layers'; useEffect(() => { const host = ref.current; const view = host?.ownerDocument.defaultView; - if (!enabled || !host || !view || typeof host.animate !== 'function') return; + if (!attach || !host || !view || typeof host.animate !== 'function') return; previousStatus.current = statusRef.current; const document = host.ownerDocument; const reduced = view.matchMedia?.('(prefers-reduced-motion: reduce)'); @@ -22,25 +28,38 @@ export function useSubagentAvatarMotion(ref: RefObject, status: str let visible = typeof IntersectionObserver === 'undefined'; let pressing = false; let hovering = false; + let player: SubagentMotionPlayer | undefined; + let lastEnabled = enabledRef.current; const rest = () => { if (pressing) return; if (isWorking(statusRef.current)) { - player.play(subagentMotionClips.working, { notify: false }); + player?.play(subagentMotionClips.working, { notify: false }); return; } if (hovering) { - player.play(subagentMotionClips.hoverBlink, { notify: false }); + player?.play(subagentMotionClips.hoverBlink, { notify: false }); return; } - player.play(subagentMotionClips.settle, { notify: false }); + player?.play(subagentMotionClips.settle, { notify: false }); }; - const player = createSubagentMotionPlayer(host, rest, '[data-subagent-motion-art] svg'); - playerRef.current = player; - const active = () => visible && !document.hidden && !reduced?.matches && !forced?.matches; + const active = () => enabledRef.current && visible && !document.hidden && !reduced?.matches && !forced?.matches; const sync = () => { // Offscreen avatars release their animation handles instead of accumulating paused loops. - player.setReduced(!active()); - if (active()) rest(); + if (!active()) { player?.setReduced(true); return; } + // Delay the first rig until its artwork is visible and measurable. + if (!player) { + player = createSubagentMotionPlayer(host, rest, '[data-subagent-motion-art] svg', renderMode); + playerRef.current = player; + } + player.setReduced(false); + rest(); + }; + synchronizeEnabled.current = () => { + if (lastEnabled === enabledRef.current) return; + lastEnabled = enabledRef.current; + previousStatus.current = statusRef.current; + if (!lastEnabled) { pressing = false; hovering = false; } + sync(); }; const observer = typeof IntersectionObserver === 'undefined' ? undefined : new IntersectionObserver(entries => { visible = entries.some(entry => entry.isIntersecting); @@ -56,8 +75,8 @@ export function useSubagentAvatarMotion(ref: RefObject, status: str // Pointer and focus changes must not replace or restart a working loop. if (active() && !pressing && !isWorking(statusRef.current)) rest(); }; - const press = () => { if (active()) { pressing = true; player.play(pressHoldClip, { notify: false }); } }; - const release = () => { if (pressing) { pressing = false; if (active()) player.play({ ...pressReleaseClip, duration: 300 }); } }; + const press = () => { if (active()) { pressing = true; player?.play(pressHoldClip, { notify: false }); } }; + const release = () => { if (pressing) { pressing = false; if (active()) player?.play({ ...pressReleaseClip, duration: 300 }); } }; const leave = () => { hovering = false; if (pressing) release(); @@ -65,7 +84,7 @@ export function useSubagentAvatarMotion(ref: RefObject, status: str }; const click = () => { pressing = false; - if (active()) player.play({ ...subagentMotionClips.nod, duration: 260 }); + if (active()) player?.play({ ...subagentMotionClips.nod, duration: 260 }); }; const keyDown = (event: KeyboardEvent) => { if (!event.repeat && (event.key === ' ' || event.key === 'Enter')) press(); }; trigger?.addEventListener('pointerenter', hover); @@ -94,10 +113,13 @@ export function useSubagentAvatarMotion(ref: RefObject, status: str trigger?.removeEventListener('keyup', release); trigger?.removeEventListener('blur', leave); view.removeEventListener('pointerup', release); - player.dispose(); + player?.dispose(); playerRef.current = undefined; + synchronizeEnabled.current = undefined; }; - }, [enabled, identity, ref]); + }, [attach, identity, ref, renderMode]); + + useEffect(() => { synchronizeEnabled.current?.(); }, [enabled]); useEffect(() => { const before = previousStatus.current; diff --git a/design-system/packages/ui/src/components/Dialog/Dialog.tsx b/design-system/packages/ui/src/components/Dialog/Dialog.tsx index 79531c56ed..605c07579d 100644 --- a/design-system/packages/ui/src/components/Dialog/Dialog.tsx +++ b/design-system/packages/ui/src/components/Dialog/Dialog.tsx @@ -186,6 +186,7 @@ const OverlaySurface = forwardRef(function >
*, + .headerColumns > * { + --_split-view-right-size: initial; + } .surface[data-split-active="false"] { visibility: hidden; opacity: 0; pointer-events: none; } .root[data-layout="overlay"][data-mode="split"] .secondary { z-index: 2; } .primary { grid-area: primary; } diff --git a/design-system/packages/ui/src/components/SplitView/SplitView.tsx b/design-system/packages/ui/src/components/SplitView/SplitView.tsx index 630f46c8b3..0c2c8f16b2 100644 --- a/design-system/packages/ui/src/components/SplitView/SplitView.tsx +++ b/design-system/packages/ui/src/components/SplitView/SplitView.tsx @@ -8,17 +8,19 @@ import styles from './SplitView.module.css'; export type SplitViewMode = 'split' | 'primary' | 'secondary'; const SplitViewModeContext = createContext('split'); +const SplitViewLayoutContext = createContext<'split' | 'overlay'>('split'); /** Stable sibling hosts can change panes without reparenting their React tree. */ export function SplitViewSurface({ pane, active = true, className, children, ...props }: HTMLAttributes & { pane: 'primary' | 'secondary'; active?: boolean }) { const mode = useContext(SplitViewModeContext); + const layout = useContext(SplitViewLayoutContext); const hidden = mode !== 'split' && mode !== pane; return ; } @@ -178,7 +180,7 @@ export function SplitView({ }; return ( -
} {surfaces} -
+
); } diff --git a/design-system/packages/ui/src/flow-chat/conversation/FlowChatRuntimeStatus.tsx b/design-system/packages/ui/src/flow-chat/conversation/FlowChatRuntimeStatus.tsx index 0c6323bdbe..52f67f03a5 100644 --- a/design-system/packages/ui/src/flow-chat/conversation/FlowChatRuntimeStatus.tsx +++ b/design-system/packages/ui/src/flow-chat/conversation/FlowChatRuntimeStatus.tsx @@ -1,4 +1,4 @@ -import type { HTMLAttributes } from 'react'; +import { useEffect, useRef, useState, type HTMLAttributes } from 'react'; import { OverflowText } from '../../primitives/OverflowText'; import { Spinner } from '../../components/Spinner/Spinner'; import './ConversationBlocks.css'; @@ -12,14 +12,37 @@ export interface FlowChatRuntimeStatusProps extends HTMLAttributes(null); + const [retainPlayback, setRetainPlayback] = useState(visible); + useEffect(() => { + if (visible) { + setRetainPlayback(true); + return; + } + if (!retainPlayback) return; + // The slot stays mounted. Let its authored exit finish before stopping the + // glyph; opacity alone does not stop a descendant's decorative animation. + // Only inspect this element's transitions, never the looping descendants. + const exitAnimations = contentRef.current?.getAnimations?.() ?? []; + if (exitAnimations.length === 0) { + setRetainPlayback(false); + return; + } + let current = true; + void Promise.allSettled(exitAnimations.map(animation => animation.finished)).then(() => { + if (current) setRetainPlayback(false); + }); + return () => { current = false; }; + }, [retainPlayback, visible]); + return
-
0 ? { transitionDelay: `${revealDelayMs}ms` } : undefined}> {label}
diff --git a/docs/performance/05-workbench-page-baseline-2026-11-05.md b/docs/performance/05-workbench-page-baseline-2026-11-05.md new file mode 100644 index 0000000000..2f06dc7d43 --- /dev/null +++ b/docs/performance/05-workbench-page-baseline-2026-11-05.md @@ -0,0 +1,437 @@ +# 工作台页面性能基线、优化与 E2E 验证 + +日期:2026-11-05。代码基点:`18eeb95db`。本报告记录本机实测,区分已达标、仍需优化和未覆盖项。 + +本轮工作于11月6日收尾,综合结论与最终状态见[性能优化收尾报告](08-performance-wrap-up-2026-11-06.md)。本文保留各阶段的原始口径及限制。 + +**11月6日口径校正:** 已复核保留的P0前后快照,HTML均声明`harmony-bundled`,这是通用Web字体配置;macOS Desktop正式构建选择`apple-system`。本报告的同配置前后对照及几何检查仍保留,但资源和延迟数值不能直接作为macOS默认字体的基线。尤其后续GPU进程增长已指向大字体数据的重复分配,不能归因于logo图层。匹配实际Desktop字体的新基线见下方持续工作负载报告;切换构建配置的差值不计为产品代码优化收益。 + +后续长驻留、进程归因及重负载工作见[持续工作负载基线](06-workload-residency-baseline-2026-11-05.md)。其操作序列和采样协议独立,不与本报告直接混算收益。 + +**最新P0结果:** 已统一三组交叉E2E;修正logo坐标后保留合成优化。首页主WebContent CPU中位数 **19.27% → 0.90%(−95.3%)**,RSS **881.0 → 852.2 MiB**;功能、速度预算与48张截图检查通过。详见第11–13节。第1–10节保留首轮历史基线,不和新协议直接混算。 + +## 1. 第一轮结论 + +- 已完成主场景 **109 次打开/切换采样**:7 个导航入口各首开 1 次、重入 8 次,20 个设置页各首开/重入 1 次,以及设置容器、项目资源、文件树、编辑器、长会话、终端。前后均使用真实 Desktop/WKWebView、生产前端、相同 native binary 和独立用户目录。 +- MiniApp 本地库热切换 P95 **2593 → 65 ms**;无需增加懒加载,根因是本地列表 loading 等待市场请求。 +- 打开上述页面后,导航拖拽各次 P95 **64–66 → 23–25 ms**;中间分栏 **70–73 → 19–21 ms**。两类手势优化后最大帧间隔分别为 **67 / 59 ms**,实际位移及松手归位通过。 +- 最终主场景 `functionalPassed=true`、`performanceBudgetsPassed=true`、`passed=true`;自动门槛覆盖普通导航热切换和各次拖拽 P95/max,不代表所有资源目标都已闭环。 +- 主 WebContent 的拖拽 CPU 时间明显减少,首页空闲段 RSS 结束值 **913.1 → 790.2 MiB**。GPU 候选进程的 RSS/CPU、Host 空闲 CPU 并未全面降低,**不能宣称整个应用内存或 GPU 占用下降相同比例**。 +- 保留现有懒加载、空闲预热、页面状态和可见动画;本轮优化集中于不必要的数据等待、隐藏页面布局和尺寸变量的样式传播。 + +## 2. 测试环境、覆盖与口径 + +| 项目 | 本轮条件 | +| --- | --- | +| 硬件 / 系统 | Apple M5,10 逻辑核,16 GiB,macOS 27.2 / Darwin 27.2.0,build 26B123 | +| Native | Rust debug + devtools;前后同一可执行文件,非 release host 性能 | +| Binary SHA-256 | `d550b87edb3c1a11712cd663bb8265e6171a2b95a29ab08679b571d1c3da306c` | +| 基线前端 | `bundled-3d5d54242d8903ad`,2737 文件,93,309,771 bytes | +| 最终前端 | `bundled-b503eab92c59427b`,2737 文件,93,310,296 bytes | +| 数据 | 临时 Git 工作区;2 条会话,其中测试会话 80 回合,每回合约 4K 助手文本及 3×6K 工具结果;1,200 行 TypeScript 文件;本地 MiniApp 库为空 | +| 首开含义 | 新页面首次 UI 进入;启动后已等待 7 秒,代码可能预热,**不是冷模块加载** | +| 导航样本 | 每页热切换 n=8,nearest-rank P95 此时等于最大值;不是线上总体 SLA | +| 拖拽 | 每手势 60 次、16 ms 间隔正弦移动;导航 ±70 px、内容分栏 ±100 px;记录开始/拖动/松手附近 RAF;每类重复 4 次 | +| 资源采样 | 每秒 `ps` 累计 CPU 时间 / RSS;`ioreg AGXAccelerator` 系统计数;基准期间不运行构建和测试 | +| 空闲段 | 回到个人主页后等待 32 秒,**主页仍有 4 个产品 SVG 动画**,并非静止空白页 | + +`visibleMs` 是点击捕获到目标根节点可见,`presentedMs` 是两次 RAF 展示机会,`contentMs` 是已知 loading/busy 消失后的连续帧。它们不等于 GPU 完成全部像素合成;编辑器另有实际代码 `value0` 出现断言,终端就绪指 xterm 界面出现,不承诺 shell 提示符已完成初始化。目标节点尚未出现的 `missingFrames` 不是整屏白屏,因为产品保留离场页面。 + +原生嵌入式 WebDriver 的 W3C pointer action 当前只产生 MouseEvent。导航及分栏因此通过 native eval 向真实控件发送 PointerEvent,未替换 pointer capture,断言分隔条真实位移;底部分栏使用其真实 MouseEvent 路径。**这不构成操作系统可信鼠标/触控板、每帧合成像素或辅助功能测试。** + +前后检查了最新 `origin/main`(`6d3176797`)及 open/draft PR。相关 UI 实现在检查时与本地基点一致;[PR #3694](https://github.com/GCWing/OpenBitFun/pull/3694) 涉及启动/IPC/浏览器清理,[PR #3217](https://github.com/GCWing/OpenBitFun/pull/3217) 涉及 Windows 原生窗口拖动,均不覆盖这里验证的本地列表等待与 pane 样式传播根因。#3004、#3580 的流式重绘/远程 Skills 也不作为本轮替代修复。 + +## 3. 人体感受底线与目标 + +约 0.1 秒接近即时响应,约 1 秒仍能维持操作连贯性;普通切页应显著快于 1 秒。[响应时间阈值](https://www.nngroup.com/articles/response-times-3-important-limits/)。60 Hz 对应约 16.7 ms 帧预算;超过 50 ms 的主线程长任务需要单独定位。[渲染性能](https://web.dev/articles/rendering-performance/)、[长任务](https://web.dev/articles/optimize-long-tasks)。本报告的 RAF 间隔不能直接当作 Long Task API 测量。 + +| 维度 | 验收底线 | 继续优化目标 | 本轮状态 | +| --- | --- | --- | --- | +| 普通导航反馈 | 热切换根节点可见 P95 ≤100 ms | ≤50 ms | 实测 31–60 ms,底线通过 | +| 普通本地页 | 热切换内容 P95 ≤150 ms;首次 ≤500 ms | 热切换 ≤100 ms | 底线通过;Skills P95 105 ms,仍有余量 | +| 编辑器/历史会话/终端 | 首次 ≤1000 ms,持续可见反馈 | ≤500 ms | 本轮均通过;首开各 n=1 | +| 拖拽 | 各手势 P95 <34 ms、max <100 ms | 接近16.7 ms,>33.33 ms 占比<1% | 主场景底线通过;慢帧约1.6%,进阶目标未全达成 | +| CPU | 相同工作量累计 CPU 不增加;后台无无效持续工作 | 分别降低脚本、样式、布局、原生后台任务 | 主 WebContent 改善;Host/GPU 候选进程需独立归因,不能整体判绿 | +| 内存 | 稳定循环无持续 DOM 增长;空闲资源无无界增长证据 | 降低真实常驻与峰值,同时保留草稿/终端/阅读状态 | 短时稳定;主 WebContent RSS 较低,未证明长期无泄漏 | +| GPU | 不新增持续渲染、合成负担 | 取得可归属 GPU busy / GPU memory 后定量下降 | 当前只有系统计数及进程 CPU/RSS,应用 GPU 利用率目标待补测 | +| 交互体验 | 实际跟手、归位、草稿、阅读位置与编辑器恢复正确 | 保持动画、快捷键、取消和真实刷新语义 | E2E 与聚焦单测通过;不外推未覆盖平台/场景 | + +不能通过降低输入采样、隐藏失败、关闭可见动画、取消数据刷新、切页清空状态来满足目标。启动总时长另列观察值,debug host 单次结果不足以给出 release 冷启动 SLA。 + +## 4. 页面打开与切换结果 + +以下单位均为 ms;箭头为优化前 → 优化后。 + +| 页面 | 首次 前→后 | 热切换 P50 前→后 | 热切换 P95 前→后 | 优化后反馈 P95 | +| --- | --- | --- | --- | --- | +| 个人主页 | 117 → 146 | 58 → 55 | 69 → 66 | 36 | +| 待办 | 107 → 136 | 45 → 47 | 47 → 52 | 34 | +| Agents | 136 → 139 | 71 → 71 | 96 → 78 | 44 | +| 助手 | 101 → 109 | 40 → 41 | 45 → 54 | 43 | +| MiniApp 本地库 | 91 → 94 | 2330 → 51 | 2593 → 65 | 46 | +| Skills 已安装 | 94 → 78 | 65 → 67 | 71 → 105 | 60 | +| Insights | 110 → 104 | 43 → 40 | 46 → 49 | 31 | + +MiniApp 的市场目录仍每次刷新,市场 loading/error 独立保留;只解除本地库展示对市场网络响应的等待。真实 E2E 覆盖空本地库,已安装项目和市场失败保留本地数据由聚焦测试补充。外网请求未经固定延迟模拟,不能把网络波动当作代码加载时间。 + +| 入口 | 首次内容就绪 前→后 | +| --- | --- | +| 设置容器 | 67 → 69 | +| 项目资源 | 105 → 120 | +| 工作区文件树 | 148 → 150 | +| 代码编辑器 | 486 → 453 | +| 80 回合历史会话 | 313 → 276 | +| 终端画布 | 137 → 272 | + +终端单次结果由 137 增至 272 ms,仍低于500 ms进阶目标;没有将它标为加速。最终运行在终端打开前增加了两次阅读锚点守卫手势,因此终端及后续空闲段的前置操作不完全相同,不能用该单点判断因果回归。样本不足以区分后台异步工作、布局与首次 PTY/字体初始化,后续应补充独立多次冷启动/终端样本。主要导航和8次计时拖拽发生在这些额外守卫之前。 + +### 设置页逐项结果 + +每格各 n=1,仅是覆盖性观察值,不称作 P95。 + +| 设置页 id | 首次 前→后 | 再次进入 前→后 | +| --- | --- | --- | +| application.general | 29 → 23 | 36 → 30 | +| application.appearance | 98 → 80 | 31 → 34 | +| application.pet | 213 → 110 | 128 → 135 | +| application.input | 81 → 80 | 34 → 34 | +| ai.models | 123 → 115 | 55 → 55 | +| ai.session-memory | 74 → 83 | 24 → 27 | +| ai.execution | 103 → 74 | 42 → 45 | +| ai.permissions | 40 → 52 | 24 → 19 | +| development.editor | 79 → 75 | 32 → 33 | +| development.terminal | 124 → 133 | 18 → 19 | +| development.workspace | 145 → 137 | 64 → 66 | +| tools.external-import | 117 → 124 | 53 → 56 | +| tools.web-search | 72 → 76 | 26 → 15 | +| tools.desktop-control | 4023 → 4089 | 4049 → 4061 | +| tools.mcp | 97 → 93 | 20 → 24 | +| tools.external-agents | 79 → 85 | 39 → 38 | +| tools.automation | 105 → 127 | 31 → 51 | +| data.usage | 73 → 66 | 34 → 42 | +| data.archived | 62 → 90 | 37 → 34 | +| data.diagnostics | 62 → 55 | 21 → 22 | + +桌面控制约4秒对应 `browser_control_get_status` 等局部状态探测;优化后该页首次根节点可见39 ms、重入11 ms,配置控件与状态探测独立加载。该耗时未解决,也未通过缩短超时或隐藏状态伪装为达标。后续目标是探测异步分区、明确状态和原生探测耗时归因,保持实际能力判断。 + +## 5. 拖拽、开合及操作状态 + +主场景先遍历全部页面、打开编辑器和长会话,再测分栏,避免仅在干净首页得到偏乐观结果。 + +| 手势 | 版本 | 4 次各自 P95 | 最大帧间隔 | 帧间隔数 | >33.33 ms | >100 ms | +| --- | --- | --- | --- | --- | --- | --- | +| 导航宽度 | 优化前 | 66 / 64 / 65 / 66 | 137 | 296 | 221/296(74.66%) | 3 | +| 导航宽度 | 优化后 | 25 / 25 / 23 / 25 | 67 | 313 | 5/313(1.60%) | 0 | +| 中间分栏 | 优化前 | 73 / 70 / 73 / 70 | 152 | 251 | 236/251(94.02%) | 5 | +| 中间分栏 | 优化后 | 20 / 20 / 21 / 19 | 59 | 310 | 5/310(1.61%) | 0 | + +两种手势实际往返范围分别140/200 px,所有结束位置误差0 px。优化后导航P50约19–20 ms,中间分栏约17 ms。P95为每次手势分别计算,未将“P95的P95”当作原始分布。慢帧分母包含测量的开始和收尾帧,不是纯pointermove区间。 + +最终主场景另验证:4轮最大化/还原与收起/展开;远离最新消息后,两类拖拽均保持同一阅读行,偏移差0 px;切页后草稿完整;空闲回收后重新打开代码编辑器显示实际文件内容,返回会话草稿仍完整。取消、失焦、失去捕获、卸载、键盘和 reduced-motion 路径由原有及新增聚焦测试覆盖。 + +### 左侧叠加面板与底部终端变体 + +此变体仅打开长会话/终端,未先挂载全部导航页面,因此不能与上述重负载拖拽数字直接横比。真实 root 的 `layout=overlay`、`secondarySide=left` 已断言;输入区暴露宽度符合 `1170−540−1=629 px`,避免 CSS 变量截断破坏叠加模式输入布局。 + +| 版本 | 手势 | 4 次各自 P95 | 最大帧间隔 | >33.33 ms | 功能通过 | 帧预算通过 | +| --- | --- | --- | --- | --- | --- | --- | +| baseline-overlay-bottom | navigation | 28 / 20 / 21 / 20 | 43 | 0.95% | True | True | +| baseline-overlay-bottom | bottom-terminal | 19 / 18 / 18 / 17 | 79 | 0.34% | True | True | +| baseline-overlay-bottom | content-split | 19 / 18 / 19 / 18 | 40 | 1.30% | True | True | +| optimized-overlay-bottom | navigation | 32 / 19 / 19 / 19 | 49 | 1.01% | True | True | +| optimized-overlay-bottom | bottom-terminal | 18 / 19 / 19 / 19 | 87 | 0.34% | True | True | +| optimized-overlay-bottom | content-split | 18 / 19 / 18 / 19 | 38 | 1.00% | True | True | + +当前工作区菜单明确把新终端放入内容画布。底部测试先通过原生配置 API 设置偏好,再通过现有 `bottom-terminal-create-tab` 事件把菜单创建的真实 PTY 附着到底部 host;**这是底部面板的布局/拖拽 E2E,不是底部终端用户打开流程的证明**。底部实际往返100 px,未修改产品以制造测试入口。 + +## 6. CPU、GPU 与内存 + +CPU采用累计进程 CPU 时间差 / 实际采样墙钟,100%表示一个逻辑核。Host为测试启动的确定进程;WebKit由launchd托管,报告仅捕获启动后新出现的WebContent/GPU/Networking候选,不能把候选集合说成已证实的应用进程树。下表“主WebContent”指该候选中RSS最大的渲染进程。 + +### 同工作量 CPU + +| 阶段 | 版本 | 采样墙钟 s | 主 WebContent CPU s | 主 WebContent 平均 CPU | Host CPU s | GPU 候选进程 CPU s | +| --- | --- | --- | --- | --- | --- | --- | +| 7 页首开+8轮切换 | 前 | 109.20 | 23.23 | 21.27% | 10.70 | 4.46 | +| 7 页首开+8轮切换 | 后 | 96.17 | 21.06 | 21.90% | 9.52 | 4.60 | +| 4 次导航拖拽 | 前 | 13.02 | 13.30 | 102.13% | 0.94 | 2.24 | +| 4 次导航拖拽 | 后 | 5.01 | 5.05 | 100.78% | 0.67 | 1.59 | +| 4 次分栏拖拽及开合 | 前 | 17.03 | 17.82 | 104.63% | 0.71 | 1.85 | +| 4 次分栏拖拽及开合 | 后 | 7.01 | 6.56 | 93.53% | 0.67 | 2.27 | + +导航窗口包含63次测量点击及回主页/待办的准备动作。拖拽每次均60个同幅度输入,优化后事件循环等待减少,墙钟明显缩短。每秒采样存在约1秒边界误差,分栏阶段还包含随后4轮面板开合,不是精确函数级CPU计时。 + +主WebContent累计CPU:导航23.23→21.06 s(约−9%),导航拖拽13.30→5.05 s(约−62%),内容分栏17.82→6.56 s(约−63%)。拖拽中的平均CPU仍约一个核,说明相同工作更快完成,不是主线程全程低占用。GPU候选进程在分栏阶段CPU **1.85→2.27 s**,不能遗漏这个反向指标;更顺畅的呈现也可能增加提交频率,本轮未取得足够归因证据。 + +独立诊断运行的原生 `sample` 显示,拖拽 WebContent 主线程881个样本中约392落在样式解析、174在布局,约787属于渲染更新调用链(这些调用链有包含关系,不能相加)。据此优先处理CSS传播/隐藏布局,而非只加React memo。采样运行有额外开销,未混入正式基线。 + +### 首页空闲段资源 + +等待均设为32秒,落入每秒采样的实际区间前32.24秒、后31.05秒。 + +| 进程 | 优化前 RSS 开始→结束 MiB | 优化前平均 CPU | 优化后 RSS 开始→结束 MiB | 优化后平均 CPU | +| --- | --- | --- | --- | --- | +| Host(确定归属) | 258.8 → 258.8 | 6.11% | 258.1 → 257.8 | 9.40% | +| 主 WebContent 候选 | 911.1 → 913.1 | 24.54% | 790.5 → 790.2 | 16.30% | +| GPU 进程候选 | 176.3 → 173.8 | 2.57% | 219.0 → 218.0 | 4.28% | +| 另一个 WebContent 候选 | 92.0 → 94.2 | 1.12% | 48.1 → 51.2 | 1.45% | + +主WebContent空闲平均CPU24.54%→16.30%,但Host6.11%→9.40%、GPU候选2.57%→4.28%。同一native binary仍有异步网络刷新、状态轮询和伴随窗口活动,不足以将其变化归因于某条前端修改;资源目标不能整体标为完成。首页4个产品SVG动画保持运行;独立空闲剖析可见SVG transform/渲染路径,不通过禁用这些动画换取低CPU。 + +GPU候选RSS在导航窗口的峰值前1258.8、后1308.3 MiB;空闲结束值173.8→218.0 MiB。主WebContent较低的RSS不能抵消或掩盖这一观察,也不能直接推导出GPU显存。RSS包含共享/可回收页,不等于JS堆,逐进程简单相加会失真。 + +系统AGX Device Utilization在首页空闲段前81–88%、后83–88%。它包含整台机器其他窗口的GPU活动;**不能据此说OpenBitFun GPU占用80%以上,也不能得出本次优化降低了应用GPU利用率**。GPU进程的CPU%同样不等于GPU busy%。本机没有可用的xctrace应用归因数据。 + +DOM和存活对象:热切换稳定后主导航DOM基线约2665个、主页约2669个,没有随8轮重入继续增长。空闲前后基线3700→3700节点、优化后3793→3709节点;scene hosts均11。优化后Monaco实例1→0,与现有约30秒非活动视图回收一致;再次进入可恢复。逻辑resource-budget账本均169,948 bytes且空闲前后不变,它只计入被该管理器追踪的数据,绝不是应用总内存。 + +WKWebView不提供本次脚本可读的`performance.memory`,JSON为null;原生资源协议的Resource Timing为空。两项均记为“不可测”,不填0,不用包大小估算JS堆。 + +## 7. 懒加载是否必要 + +**建议保留现有按功能的懒加载;当前不建议扩大成所有页面首次点击才加载,也不建议切走即卸载。** 这是结合现有主路径与重功能边界的工程判断,本轮没有用全量eager的A/B证明某一具体内存节省值。 + +当前链路:Session等主交互路径直接进入主场景bundle;Terminal、Git、Agents、Skills、MiniApps等使用`lazyWithRecovery`;Settings按页面加载。启动后2.5秒串行调度8个场景预热,另有编辑器空闲预热。打开过的scene host保留状态,内容资源有自己的回收策略。这是“模块加载、组件挂载、数据请求、非活动渲染”四个不同问题。 + +| 观察 | 优化前 | 优化后 | 能得出的结论 | +| --- | --- | --- | --- | +| JS trace interactive shell ready | 613 ms | 616 ms | 本轮未加速主shell启动 | +| JS trace启动遮罩消失 | 1084 ms | 1104 ms | 既有最短展示及过渡保持 | +| 进程启动到驱动观察shell就绪 | 5141 ms | 6098 ms | 包含debug host/驱动观察等,不能与JS trace同起点比较 | +| 7秒预热段scene hosts | 1→1 | 1→1 | 预热代码没有把所有页面都挂载 | +| 7秒预热段Monaco实例 | 0→0 | 0→0 | 预热不等于创建编辑器视图 | +| 预热段主WebContent RSS | 325.7→511.2 MiB | 325.1→423.4 MiB | 非零资源成本,但含并发启动工作/GC,不能全归因于8个预热模块 | +| 预热段主WebContent累计CPU | 0.77 s | 0.77 s | 不是“首开快就没有CPU成本” | + +磁盘前端约93.3 MB不代表启动传输了93.3 MB,也不代表常驻93.3 MB。当前未做关闭预热/全量eager的受控A/B,不能宣称懒加载节省具体MB。已测的首次UI进入大多低于150 ms;贸然取消预热会把解析/初始化成本移到用户点击时。 + +本轮选择:保留现有加载策略;解除无关网络等待;对已经不可见的场景使用`content-visibility:hidden`跳过后代渲染,保留DOM/React状态;阻断不需要继承的私有尺寸变量。该CSS特性用于控制布局/绘制工作,并不卸载模块、释放所有JS状态或停止所有effect。[CSS Containment规范](https://www.w3.org/TR/css-contain-2/)、[content-visibility](https://web.dev/articles/content-visibility?authuser=0)。 + +后续若优化预热,需要同数据、同机器交替运行“现状/减少预热”各至少5次,分别记录启动到可交互、首点延迟、0–10秒CPU、常驻/峰值内存和后台工作。只有实际首点仍满足人体感受底线且资源稳定下降,才调整预热清单;不把内存下降建立在丢草稿、滚动位置或重建终端上。 + +## 8. 已实施的修改 + +1. `MiniAppLibraryView.tsx`:本地安装列表/worker/来源读取完成即结束本地loading,再继续市场刷新;本地失败行为、surface scope检查及市场错误状态保留。 +2. `useNavResize.ts`、`WorkspaceBody.tsx`、`WorkbenchLayout.tsx`:导航改宽接入工作台既有measurement suspension,松手后两帧恢复;不改变可见拖拽flag、移动采样、弹性反馈、快捷键或取消逻辑。 +3. `SplitView.module.css`、`SplitView.tsx`:split模式在内容边界截断私有`--_split-view-right-size`继承,布局context正确区分嵌套split/overlay;overlay保留输入dock所需尺寸继承。 +4. `SceneViewport.scss`:仅完全不可见scene跳过内容渲染;当前页和参与过渡的可见scene不命中该规则,DOM和组件状态不清除。 +5. `WorkspaceBody.scss`:nav尺寸变量止于nav内容边界;导航拖动的全树cursor通配改为透明cursor表面,pointer capture仍负责手势,避免按下/松手对每个元素修改cursor样式。 + +## 9. 验证、证据与复现 + +已通过的聚焦检查:MiniApp/导航resize/WorkbenchLayout/虚拟列表测量/WorkspaceBody共56测试;SplitView/WorkbenchLayout/SceneViewport另37测试(与前项WorkbenchLayout有重叠,不相加为唯一总数);导航最终复核22测试;design-system SplitView node测试2个。`check:web`、`build:ui`、生产前端build、Monaco资源校验、28个surface的theme color audit通过。未改Rust源文件,未运行无关workspace全量测试。 + +原始JSON和原生采样副本位于`tests/e2e/reports/workbench-performance-2026-11-05/`(按仓库规则忽略,本机可查看);本报告保留全部关键表格,不依赖临时目录存续。正式源目录: + +| 用途 | 临时证据目录后缀 | 前端 | +| --- | --- | --- | +| 优化前完整基线 | `ImdUSX` | `3d5d54242d8903ad` | +| 最终完整验证 | `FJKEsH` | `b503eab92c59427b` | +| 左overlay/底部基线 | `50xCuH` | `3d5d54242d8903ad` | +| 左overlay/底部优化后 | `WRn4py` | `b503eab92c59427b` | + +运行器在系统临时目录下以 `openbitfun-workbench-perf-` 为前缀创建证据目录。基线旧runner尚未输出独立functional/performance字段,但`passed=true`且真实移动/归位和草稿断言通过;可从其原始帧数据明确判断原始拖拽未达预算。最终runner分开报告功能与性能。 + +失败与诊断保留,不择优删除:`mWNrCM`/`SMNOOO`的旧MouseEvent拖拽未产生真实位移,拖拽数字作废;`HkbK5D`临时CSS因果实验、`ojkYbK`原生采样均不混入正式结果;`ZfohoE`只在拖动时隐藏后台内容,松手max达123 ms;`aRmFAe`中间修订仍有105 ms导航尖峰而预算失败,随后才实施cursor与nav变量边界优化;`nUExqq`底部fixture配置缺少product_id,启动失败;`o1TfyW`误以为工作区菜单直接打开底部终端,断言失败,修正测试前置条件并明示范围。没有放宽100 ms门槛来覆盖失败。 + +构建与复现(先完成构建,再单独运行基准,避免CPU/GPU争用): + +```bash +cargo build -p openbitfun-desktop --features devtools +pnpm run build:web +node scripts/generate-frontend-revision.mjs +pnpm run verify:monaco-assets + +# 全场景,自动检查热切换和拖拽预算,保留全部采样 +OPENBITFUN_WORKBENCH_LABEL=optimized \ +OPENBITFUN_WORKBENCH_STATE_GUARDS=1 \ +OPENBITFUN_WORKBENCH_ENFORCE_BUDGETS=1 \ +node tests/e2e/scripts/run-workbench-performance.mjs + +# 独立左侧overlay + 底部终端布局变体 +OPENBITFUN_WORKBENCH_LABEL=optimized-overlay-bottom \ +OPENBITFUN_WORKBENCH_PANELS_ONLY=1 \ +OPENBITFUN_WORKBENCH_LAYOUT=overlay \ +OPENBITFUN_WORKBENCH_SIDE=left \ +OPENBITFUN_WORKBENCH_TERMINAL_POSITION=bottom \ +OPENBITFUN_WORKBENCH_STATE_GUARDS=1 \ +OPENBITFUN_WORKBENCH_ENFORCE_BUDGETS=1 \ +OPENBITFUN_WORKBENCH_IDLE_MS=1000 \ +node tests/e2e/scripts/run-workbench-performance.mjs +``` + +优化前需将`OPENBITFUN_E2E_FRONTEND_DIR`指向优化前已完成且含revision的资源快照;相同binary可通过`OPENBITFUN_E2E_DESKTOP_BINARY`指定。脚本自动生成独立用户数据、复制前端及binary、记录SHA,并仅关闭自己启动的进程。测试实现为`tests/e2e/page-objects/WorkbenchPerformancePage.mjs`和`tests/e2e/scripts/run-workbench-performance.mjs`;入口说明已写入E2E AGENTS。 + +## 10. 尚未完成的目标与覆盖边界 + +- 继续降低主场景约1.6%的>33.33 ms帧;Skills热切换进一步压至100 ms内。不能为平均帧率牺牲松手恢复或阅读位置。 +- 补齐Host后台工作与GPU进程成本归因;当前GPU进程CPU/RSS存在反向指标,需独立对照,不能宣布资源目标全面完成。应用级GPU busy、显存及真实JS堆仍缺测。 +- 补充release冷启动、终端首次就绪多次采样、长时间循环与内存压力测试;32秒空闲和8轮切页不能证明长期无泄漏。 +- 本轮直接覆盖7个主导航入口及20设置页。Pages入口当前被主导航隐藏;Browser/Git具体业务、MiniApp实际运行、多编辑器大文件、模型流式生成、海量列表/远端市场不在这109次样本内。 +- 仅在本机macOS/WKWebView验证。Windows/WebView2、Linux/WebKitGTK,以及真实SSH远程工作区、relay远程控制、Peer Device、Detached Dispatch均未执行;没有修改这些协议或平台能力,但本地测试不是远程证据。 +- 未验证系统可信输入、触控板惯性、辅助功能与每帧合成像素。现有可见过渡/动画代码未被降级,功能状态有断言;这不是对所有交互体验的无限范围证明。 + + +## 11. P0:统一测量流程与首页资源优化 + +本节接续前一轮,不把新协议结果直接和第4–6节的单次数据计算百分比。前一轮复制的原始JSON仍位于 `tests/e2e/reports/workbench-performance-2026-11-05/`;本轮资源、图片和对比结果保存在仓库忽略目录 `tests/e2e/reports/p0-paired-final/`,不依赖系统临时目录存续。 + +### 本轮目标与实现边界 + +- **首页可见时**:在四条1600 ms动画、交互及数据请求不变的前提下,主WebContent CPU目标至少降低30%;分别检查Host、GPU候选进程,不能只优化单一进程后宣布整体达标。 +- **隐藏页面**:停止无意义的展示时钟和动画工作;保留页面、草稿、编辑器、阅读位置及数据订阅。待办的30秒时钟仅在页面和文档可见时更新,返回前立即校时,跨午夜单测覆盖;任务调度和订阅没有改变。 +- **内存**:同一操作序列结束时的RSS不出现稳定恶化,预设观察线为中位数增幅5%;这不等于JS堆、GPU显存或长期泄漏证明。 +- **速度**:沿用第3节的100 ms反馈、150 ms热切换、34/100 ms拖拽P95/max门槛;资源优化不能换取交互变慢。 +- **视觉**:必须同时验证真实截图。仅有DOM矩形和SVG变换矩阵一致不足以证明实际绘制一致。 + +首页现在显式选择 `layers` 渲染:保留原SVG布局占位和原始矢量图形,把四个运动部件放在SVG外的HTML图层中,以原 `viewBox` 和容器尺寸映射坐标;尺寸变化由ResizeObserver同步。关键帧、缓动、时长和播放器控制不变。销毁时取消动画、断开观察并恢复原始SVG。其他头像仍默认使用原SVG路径;没有全局扩展图层数量,也没有降低帧率、移除动作或改变数据刷新。 + +早期 `foreignObject` 实验造成logo放大及错位,已撤回。该实验的CPU下降不能作为有效优化结果;用户截图表明几何API不能替代绘制验证。修正后的外部图层方案先在独立原生窗口验证:中性帧截图的logo区域逐像素一致;20款头像、28/112/136 px三种尺寸、15类动作共19,920个采样状态的几何/透明度最大差异约0.0000015,播放控制与销毁还原通过。上述是诊断和源实现契约;正式性能验收仍使用未经注入修改的生产前端。 + +### 统一协议(schema 2) + +| 项目 | 固定条件 | +| --- | --- | +| 前端基线 | `bundled-959adff9cd7a1988`,保留上一轮优化,不含本轮首页图层/待办时钟优化 | +| 优化后 | `bundled-4d132dfb7e350fad` | +| Native SHA-256 | `04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`,同一debug + devtools二进制 | +| 顺序 | 三组交叉顺序 AB / BA / AB;每次独立工作区、用户目录和WebView存储 | +| 页面样本 | 每次7个导航页各首次1次、热切换3次;20设置页各首次/重入1次;其余入口与上一轮相同,共74次打开/切换 | +| 资源窗口 | 全部页面、拖拽和终端操作后:活动首页 → 待办静态页(首页隐藏保留)→ 返回首页;每段先稳定5秒,再采样30秒 | +| 资源算法 | 每秒进程累计CPU/RSS;每段独立起止采样,CPU百分比 = CPU毫秒增量 / 实际墙钟毫秒 ×100,100%代表一个逻辑核 | +| 进程归属 | 初始化结束后冻结新出现的WebKit PID候选集合;后续其他应用启动的进程不会被计入。候选归属仍不是操作系统证明 | +| 额外检查 | 资源窗口结束后才做动画几何、8种截图条件、阅读锚点和编辑器恢复检查;计时段没有截图、暂停动画或DOM轮询 | +| 可比性 | 必须相同协议hash、runner及page-object/验证器hash、native binary、环境、操作顺序及样本数量;实验注入和功能未完成的运行不可作为正式对比 | +| GPU口径 | 分开报告GPU候选进程CPU/RSS与系统级AGX busy/内存;不把GPU进程CPU称作GPU利用率 | + +内存记录是操作系统的进程RSS,包含引擎、缓存及共享映射;候选进程RSS之和不等于应用独占物理内存。WKWebView没有提供本次可用的真实JS堆或应用级GPU显存计数。待办使用空任务列表,隐藏时钟的停止由行为测试直接证明,不把这一小项的资源波动当作独立量化收益。 + +正式截图条件为宽/窄两种窗口(实际头像136/112 px),各验证动画0、480、1360 ms及滚动32 px后的480 ms。每张图检查布局居中和实际矢量主体位于头像区域;前后比较允许边缘抗锯齿差异,阈值是RGB最大通道差>24的像素比例<3%、平均通道差<2/255。保留完整定位图及头像裁剪图。该检查针对这次回归和代表性帧,不声称覆盖所有合成帧。 + +## 12. P0 正式对比结果 + +三组交叉A/B共 **6次完整运行、444次打开/切换、48次计时拖拽、18个30秒资源窗口、48张头像截图**。六次 `functionalPassed` / `performanceBudgetsPassed` 均为true,整体 `comparison.passed=true`。 + +- 协议hash:`2e99bc9f66f87b3397e4ecb0c209c1f041dd794f44f7333b98caa5a43c59edfa` +- 测量脚本hash:`e06e003d9632194a983b5b4d27c4418979cf15fbf83bbd9ff7b92e4eee54b814` + +### CPU:可见首页的持续开销明显下降 + +单位为单核CPU百分比;每格是3次独立运行的中位数(最小–最大),不是整机CPU百分比。 + +| 窗口 | 进程 | 基线 | 优化后 | +| --- | --- | --- | --- | +| 活动首页 | 主WebContent候选 | 19.27(12.18–19.47) | 0.90(0.87–1.33) | +| 活动首页 | Host | 9.88(7.09–10.05) | 3.56(3.03–3.63) | +| 活动首页 | GPU候选进程 | 4.53(3.73–4.76) | 0.30(0.27–0.33) | +| 活动首页 | 固定候选进程合计 | 35.42(23.97–35.67) | 6.56(5.66–6.99) | +| 待办静态页 | 主WebContent候选 | 1.03(0.67–1.33) | 0.77(0.73–1.16) | +| 待办静态页 | Host | 2.93(2.46–3.16) | 3.16(2.73–3.53) | +| 待办静态页 | GPU候选进程 | 0.30(0.17–0.40) | 0.30(0.27–0.37) | +| 待办静态页 | 固定候选进程合计 | 5.99(4.36–6.19) | 5.96(5.16–6.72) | +| 返回首页 | 主WebContent候选 | 19.40(18.84–19.57) | 1.13(0.93–1.23) | +| 返回首页 | Host | 9.88(9.88–9.92) | 3.63(2.53–3.63) | +| 返回首页 | GPU候选进程 | 4.49(4.43–4.79) | 0.30(0.20–0.30) | +| 返回首页 | 固定候选进程合计 | 35.61(34.71–35.87) | 6.86(4.86–6.99) | + +主WebContent可见首页CPU中位数下降 **95.3%**,返回首页后下降 **94.2%**,超过至少30%的目标。Host和GPU候选进程在可见首页也下降。待办静态页的候选总CPU基本持平;不把隐藏时钟优化包装成已测得的大幅收益。 + +### 内存:小幅改善,波动明显 + +单位MiB,统计各30秒窗口结束时RSS的中位数(最小–最大)。 + +| 窗口 | 进程 | 基线 | 优化后 | +| --- | --- | --- | --- | +| 活动首页 | 主WebContent候选 | 881.0(877.5–1256.8) | 852.2(823.0–944.8) | +| 活动首页 | Host | 377.7(352.4–385.9) | 377.0(331.2–377.9) | +| 活动首页 | GPU候选进程 | 175.6(151.1–194.1) | 167.4(146.3–172.9) | +| 活动首页 | 固定候选RSS之和 | 1649.1(1648.6–1931.0) | 1598.7(1424.5–1666.4) | +| 待办静态页 | 主WebContent候选 | 879.5(878.6–1268.9) | 853.5(824.6–945.9) | +| 待办静态页 | Host | 376.7(352.4–385.9) | 377.0(331.2–377.9) | +| 待办静态页 | GPU候选进程 | 192.8(189.2–207.7) | 186.3(163.7–192.5) | +| 待办静态页 | 固定候选RSS之和 | 1669.0(1648.4–1983.0) | 1620.6(1447.7–1686.2) | +| 返回首页 | 主WebContent候选 | 880.3(841.0–1270.3) | 855.0(826.0–947.5) | +| 返回首页 | Host | 373.3(352.5–385.9) | 377.0(331.2–377.9) | +| 返回首页 | GPU候选进程 | 183.4(151.0–192.9) | 186.6(164.1–210.8) | +| 返回首页 | 固定候选RSS之和 | 1670.7(1584.6–1947.4) | 1641.6(1451.7–1689.4) | + +活动首页主WebContent RSS中位数约 **−3.3%**,返回首页约 **−2.9%**。候选RSS合计中位数分别约−3.1%、−1.7%。返回首页GPU候选RSS约 **+1.7%**;范围重叠且波动较大,不能宣布所有进程内存都下降。三次中位数未触发5%恶化观察线,仍需长时压力/泄漏验证。 + +DOM在基线首页/待办/返回为 **3700 / 3696 / 3700**;优化后为 **3705 / 3696 / 3705**,三次一致。新增的5个可见图层结构在隐藏时释放,没有出现这一往返内的持续DOM增长;不等于无限循环无泄漏。 + +### GPU系统计数:保留观测,不作应用归因 + +每格为三次窗口内中位数的中位数(运行间范围)。系统计数包括桌面及其他应用,GPU进程CPU不是GPU硬件利用率。 + +| 窗口 | 系统GPU busy % 前→后 | 系统GPU in-use MiB 前→后 | +| --- | --- | --- | +| 活动首页 | 64.5(64–79.5)→60(58–83) | 874.3(835.6–902.6)→822.1(768.6–913.0) | +| 待办静态页 | 31(12–52.5)→35(31–58.5) | 680.9(670.6–740.3)→676.5(676.2–755.1) | +| 返回首页 | 65(64–81)→59(59–82.5) | 879.8(872.9–966.1)→827.4(793.6–878.8) | + +这些范围明显重叠,待办窗口busy还出现反向变化。**应用级GPU busy/显存下降仍未得到证明**,不把系统busy变化当作本优化的百分比收益。 + +### 打开、切换与拖拽速度 + +单位ms;首次为3次运行中位数,热切换为合并9个样本的nearest-rank P95(此样本量下等于最大值)。 + +| 页面 | 首次 前→后 | 热内容P95 前→后 | 反馈P95 前→后 | +| --- | --- | --- | --- | +| 首页 | 138 → 137 | 66 → 69 | 39 → 40 | +| 待办 | 102 → 95 | 52 → 54 | 40 → 40 | +| Agents | 123 → 133 | 72 → 109 | 44 → 47 | +| 助手 | 82 → 91 | 44 → 55 | 33 → 50 | +| MiniApp | 80 → 89 | 66 → 62 | 50 → 51 | +| Skills | 91 → 81 | 120 → 77 | 49 → 51 | +| Insights | 99 → 83 | 46 → 44 | 33 → 31 | + +所有普通导航的反馈/热内容仍在100/150 ms门槛内。此次重点是资源开销,**没有让所有切换都提速**:Agents热内容P95从72变为109 ms,尚未达到100 ms进阶目标;样本不足以认定原因,保留该反向结果。 + +| 其他入口 | 首次内容中位数 前→后(ms) | +| --- | --- | +| 设置容器 | 61 → 63 | +| 项目资源 | 109 → 102 | +| 文件树 | 136 → 165 | +| 编辑器 | 461 → 462 | +| 80回合会话 | 280 → 292 | +| 终端 | 281 → 272 | + +20个设置页每个各3次首次/3次重入,原始样本全部保留。桌面控制的约4秒状态探测仍是既有待优化项,本轮没有缩短超时或跳过探测。 + +| 拖拽 | 单次P95范围 前→后(ms) | 全部最大帧间隔 前→后(ms) | >33.33 ms比例 前→后 | +| --- | --- | --- | --- | +| 导航分隔条 | 24–27 → 24–28 | 58 → 60 | 1.63% → 1.86% | +| 内容分栏 | 18–22 → 18–22 | 63 → 63 | 1.40% → 1.50% | + +每种手势每侧n=12;全部通过P95<34 ms、max<100 ms门槛,但<1%的慢帧进阶目标仍未完成。真实位移、松手归位、草稿、阅读锚点和编辑器恢复均通过。 + +### 动画、像素与数据刷新 + +- 资源窗口内首页四条动画均为running、可见、周期1600 ms,时间持续推进;待办窗口没有运行的首页动画。没有在计时段暂停动画。 +- 生产页面40个动画采样点的最大几何差异约 **0.000000419 CSS px**。48张正式截图覆盖宽/窄尺寸、三个动画相位和滚动;所有与基线的裁剪像素比较均为 **0差异**,无需使用抗锯齿容差来通过。 +- 每侧9次首页热重入,`get_token_usage_statistics`、`get_available_modes`、`list_subagents`、`list_miniapps`、`miniapp_worker_list_running`、`get_skill_configs`各记录 **9次请求**,前后一致;没有通过取消刷新换取速度或CPU。 +- 不新增强制懒加载、不卸载保留的业务页面。现有按需加载/预热策略不变;首开速度保持在门槛内,主要瓶颈是已打开首页的持续渲染,继续推迟模块下载不能消除这部分成本。 + +## 13. P0 验证与复现 + +- UI包构建、Web UI生产构建、`tsc --noEmit`、Appearance/颜色/视觉契约、Monaco资源和WebKit兼容性检查通过;motion audit已完成。顶层构建一度等待已有开发构建的Cargo锁,最终单独完成类型生成(39个导出测试)、前端构建与类型检查;未把等待/失败尝试记作通过。 +- 44个聚焦DOM/行为测试通过:SceneViewport、待办时钟、首页数据hook、首页操作。8个品牌与测量契约测试通过。 +- 20款头像×3尺寸的原生源实现契约、生产前端的6次完整E2E均通过。此次P0没有重跑上一轮左overlay/底部终端变体;不要把第5节的旧变体结果标为新版实测。 +- 本轮仍仅是本机macOS/WKWebView、debug native + 生产前端;Windows、Linux和四种真实远程场景未执行。源码未改这些传输/数据协议,本地结果不能替代其验证。 +- 原始运行、日志、完整定位图与裁剪图:`tests/e2e/reports/p0-paired-final/`;总体结果:`comparison.json`;统计汇总:`statistics.json`。隔离试验与所有头像契约:`p0-outer-pilot/`、`p0-final-pilot/`;生产快照在 `p0-preserved/`。大体积证据目录按仓库规则忽略,本报告保留关键数字。 + +两个构建均已完成、且没有构建/测试并行时复现: + +```bash +OPENBITFUN_E2E_DESKTOP_BINARY=/absolute/path/to/same/native-binary \ +OPENBITFUN_E2E_EXPECTED_FONT_PROFILE=harmony-bundled \ +OPENBITFUN_WORKBENCH_BASELINE_FRONTEND=/absolute/path/to/baseline/frontend \ +OPENBITFUN_E2E_FRONTEND_DIR=/absolute/path/to/optimized/frontend \ +OPENBITFUN_WORKBENCH_PAIR_EVIDENCE=/absolute/path/to/new/evidence-directory \ +OPENBITFUN_WORKBENCH_PAIRS=3 \ +OPENBITFUN_WORKBENCH_REPEATS=3 \ +OPENBITFUN_WORKBENCH_IDLE_MS=30000 \ +OPENBITFUN_WORKBENCH_SETTLE_MS=5000 \ +node tests/e2e/scripts/run-workbench-performance-pair.mjs +``` + +后续优先补齐应用级GPU/内存归因和长时间驻留,再定位Agents尾延迟与拖拽慢帧。继续保留原有动画和刷新,不以释放业务状态或降低显示质量满足资源目标。 diff --git a/docs/performance/06-pet-performance-baseline-2026-11-05.md b/docs/performance/06-pet-performance-baseline-2026-11-05.md new file mode 100644 index 0000000000..4f6c33d04b --- /dev/null +++ b/docs/performance/06-pet-performance-baseline-2026-11-05.md @@ -0,0 +1,85 @@ +# 桌面宠物性能基线报告 + +日期:2026-11-05。对象:当前默认 **BitBlob v2**。本报告不读取或修改真实用户的宠物选择;自定义宠物和其他预设的原生性能不由该样本代表。 + +## 结论 + +宠物独立 WebContent 的待机 CPU 中位数为 **1.94%**,工作态 **2.89%**;常驻 RSS 约 **196–202 MiB**。CPU 的 100% 表示一颗核心,不能将 2.89% 解读为整台 10 核机器的 2.89%。该窗口的运行时成本明显大于默认图片单份 RGBA 的理论大小 13.41 MiB。隐藏窗口保留这些内存;关闭/销毁窗口后,六次正式运行的宠物 WebContent 候选进程均退出。 + +不能由这些数据得出“宠物占用某个百分比 GPU”或“没有长期泄漏”。系统 GPU 指标包含其他应用,RSS 包含运行时和可共享页,WKWebView 没有向本次工具提供 JS heap。 + +[优化报告](07-pet-performance-optimization-2026-11-05.md) · [完整采样证据](pet-performance-evidence-2026-11-05.json) + +## 方法与可复现身份 + +- Apple M5,10 逻辑核,16 GiB,Darwin 27.2.0;macOS 原生 WKWebView。Native 是 debug,前端是生产构建,不外推 release host 或 Windows/Linux。 +- 本地基点 `18eeb95db0e7d49b068081b2120b1879f90e44ed`;工作区既有工作台/设计系统改动在前后构建中保留。本次基线以完成的 bundle 内容哈希为准。 +- 优化前 `bundled-430fd6c0fc1530b6`;优化后 `bundled-ce86dd79f9268b72`。 +- 六次使用同一个 native binary:SHA-256 `04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`。测量 harness SHA、完整协议和每次环境保存在证据 JSON。 +- 三组顺序 **AB / BA / AB**。每次独立进程、应用数据和 WebView 存储;不使用真实账号、模型、会话或工作区。 +- Shell ready 后等待 15 秒。每个阶段先隐藏主窗口,再稳定 5 秒,测量 20 秒;两端断言主窗口仍隐藏。共 30 个资源窗口,约 600 秒正式资源采样。本任务没有在采样期间并发启动构建或测试;其他桌面活动无法完全隔离。 +- 顺序:宠物销毁后的控制段 → 新建宠物待机 → 工作+固定任务气泡 → 隐藏但不销毁 → 关闭并销毁。工作气泡由真实 companion event contract 注入 fixture,不代表真实 Agent 流式执行。 +- 每秒读取 `ps` 累计 CPU 时间 / RSS 和 `ioreg AGXAccelerator`。CPU = 进程累计 CPU 毫秒差 / 实际墙钟毫秒差 × 100;20 秒窗口的 10ms CPU 时间粒度约对应 0.05 个百分点。 +- 原生宿主 PID 已知;WebKit 是启动期间新增的候选 PID。重新创建宠物窗口时新增的 WebContent 标为宠物候选,随后冻结 PID 集。该识别比全系统进程求和更窄,但不是操作系统提供的所有权证明。 +- RAF/精灵帧探针在资源窗口外单独执行,每次 2.6 秒。它观察调度和 computed style,不证明每帧合成像素或 GPU 完成时间。没有使用 computer use 或浏览器控制工具。 + +原生鼠标没有被测试控制。第二组基线待机段开始时仍在注视,之后恢复走帧;该次数据保留并在优化报告单列,不能将三组当作严格相同的静止输入。正式结果之外的早期主窗口显示污染、守卫失败和调度实验均保留在证据 JSON 的 `excludedDiagnostics`,不混入下表。 + +## CPU 与内存基线 + +以下每格为三次运行的中位数。各进程中位数之和不一定等于合计中位数。 + +| 状态 | 宿主 CPU % | 主窗口 CPU % | 宠物 CPU % | GPU 进程 CPU % | 合计 CPU % | +| --- | --- | --- | --- | --- | --- | +| 关闭前控制段 | 0.30 | 0.20 | 0.00 | 0.00 | 0.50 | +| 待机 | 2.99 | 0.20 | 1.94 | 0.25 | 5.64 | +| 工作+固定气泡 | 3.49 | 0.50 | 2.89 | 0.50 | 7.03 | +| 隐藏(未销毁) | 0.30 | 0.15 | 0.20 | 0.00 | 0.65 | +| 关闭并销毁后 | 0.30 | 0.25 | 0.00 | 0.00 | 0.55 | + +RSS 使用窗口结束值;“采样峰值”是每秒离散采样的峰值,不是连续追踪峰值。合计可能重复计入共享页,不能等同于进程组的独占物理内存。 + +| 状态 | 宠物 RSS MiB | GPU 进程 RSS MiB | 进程 RSS 和 MiB | 采样峰值 RSS 和 MiB | +| --- | --- | --- | --- | --- | +| 关闭前控制段 | 0.00 | 129.48 | 825.75 | 826.17 | +| 待机 | 196.30 | 156.44 | 1066.12 | 1069.81 | +| 工作+固定气泡 | 201.22 | 176.53 | 1069.69 | 1069.70 | +| 隐藏(未销毁) | 201.61 | 176.39 | 1069.91 | 1070.08 | +| 关闭并销毁后 | 0.00 | 149.14 | 840.98 | 841.03 | + +## GPU 与帧调度 + +这里的 GPU 进程 CPU/RSS 已在上表列出;它们不是 GPU 利用率或专属显存。下面仅是**整机** GPU 观测,不能把前后差值归因给宠物。内存列是 `In use system memory` 的中位数;原始证据同时保留 allocated、renderer、tiler 计数。 + +| 状态 | 前 GPU busy P50/P95 % | 前系统 GPU 内存 MiB | 后 GPU busy P50/P95 % | 后系统 GPU 内存 MiB | +| --- | --- | --- | --- | --- | +| 关闭前控制段 | 9 / 42 | 442.5 | 5 / 11 | 390.9 | +| 待机 | 7 / 19 | 416.8 | 3 / 10 | 450.2 | +| 工作+固定气泡 | 10 / 23 | 439.4 | 6 / 12 | 436.2 | +| 隐藏(未销毁) | 6.5 / 29 | 419.3 | 2 / 11 | 397.0 | +| 关闭并销毁后 | 2 / 27 | 430.4 | 4.5 / 10 | 398.4 | + +| 版本 | 状态 | 间隔样本数 | P50 ms | P95 ms | 最大 ms | >33.33 ms 次数 | +| --- | --- | --- | --- | --- | --- | --- | +| 优化前 | 待机 | 471 | 17.00 | 18.00 | 18.00 | 0 | +| 优化前 | 工作 | 471 | 17.00 | 18.00 | 18.00 | 0 | +| 优化后 | 待机 | 471 | 17.00 | 18.00 | 19.00 | 0 | +| 优化后 | 工作 | 471 | 17.00 | 19.00 | 19.00 | 0 | + +P95 使用 nearest-rank。优化版每次待机/工作探针均观察到六个精灵帧位置。基线第二组待机观察到五个,其余为六个。用户可以正常移动鼠标,注视行为会暂停走帧,因此这不是完全固定输入的 GPU 压力测试。 + +## 图片与缓存分析 + +默认 BitBlob:1536×2288,8×11 单元,单帧 192×208;WebP **1,523,708 bytes(1.45 MiB)**,若完整解码成单份 RGBA8 则为 **13.41 MiB**。这个乘法估算不是实测 GPU 分配。全部内置预设的尺寸与编码体积见证据 `atlasInventory`(共 14 个,包含 BitBlob)。v1 通常为 1536×1872,单份 RGBA8 为 10.97 MiB。 + +桌面显示为 96×104 CSS 像素,在 2× 像素密度下与原单帧像素数一致。直接减半图片会牺牲这类显示器的清晰度,改换编码也不会自动减少相同解码尺寸的内存。本轮保留原始图片。 + +用户宠物由 host 读取为 Buffer,再生成缓存 Blob URL;这是独立于内置路径的内存风险。原实现只有完成缓存,没有并发中的去重:同时请求可生成多个 URL,Map 只保留最后一个,早先 URL 无法通过删除入口回收。删除期间仍在加载的请求还能重新填入缓存。这两个竞态已在优化版修复并通过聚焦测试。默认 BitBlob 不走这条 Blob 路径,因此不能用默认宠物 RSS 来证明该修复节省了多少内存。 + +## 上游、复现与边界 + +开始修复前刷新了 `origin/main` 至 `b76d6606b`,检查相关实现及历史,宠物代码与本地基点一致。通过 `gh pr list --state open` 检查了全部 18 个 open/draft PR,并读取 [#3694](https://github.com/GCWing/OpenBitFun/pull/3694) 的 diff:它修改启动、IPC 广播、锁和浏览器清理,不覆盖本轮动画样式、计时器或 Blob 竞态。GitHub connector 调用不可用后使用 `gh` 完成检查,未仅凭标题断定已有修复。 + +复现命令和环境变量见 [E2E 指南](../../tests/e2e/AGENTS.md)。可复用本机完成快照 `/tmp/openbitfun-pet-baseline-20261105` 与 `/tmp/openbitfun-pet-optimized-20261105`;长期事实与完整数字保存在仓库中的证据 JSON,临时快照不作为跨机器依赖。 + +未覆盖:真实流式多任务、大量用户宠物切换、长时间同进程泄漏 soak、Windows/Linux、release native、精确 GPU 时间/显存归属。四种远程场景(SSH/Docker 工作区、远程控制、Peer Device、Detached Dispatch)均未实测;本地数据不得当作远程性能证据。 diff --git a/docs/performance/06-workload-residency-baseline-2026-11-05.md b/docs/performance/06-workload-residency-baseline-2026-11-05.md new file mode 100644 index 0000000000..defa523ad3 --- /dev/null +++ b/docs/performance/06-workload-residency-baseline-2026-11-05.md @@ -0,0 +1,1462 @@ +# 持续工作负载:驻留、资源归因与并发操作 + +日期:2026-11-05;后续验证持续到11月6日。本文承接[工作台基线](05-workbench-page-baseline-2026-11-05.md),记录后续实测及未完成项。已完成正确Apple Desktop配置下的28.74分钟长驻留基线:功能检查通过,速度预算未全部通过。当前P0仍是首页/会话切换的尾延迟与恢复后的资源占用;未建立整体收益的候选已撤回,各项增量工作和未完成验收分别记录。 + +**11月6日收尾:** 按用户要求结束本轮性能优化,不再扩展试验。整体成果、保留修改与未验收项见[收尾报告](08-performance-wrap-up-2026-11-06.md)。下文按时间保留的“下一步”均为历史计划,不代表仍有后台任务在执行。 + +**构建配置校正:** 前述基线为`harmony-bundled`通用Web字体,不能直接代表macOS Desktop默认的`apple-system`配置。原数据不删除;第05号P0快照也已复核并补充此限制。下文记录字体分配证据及已完成的实际Desktop配置完整驻留测试。配置修正不是产品优化收益。 + +**输入口径补充:** 后续场景动画检查发现嵌入驱动的element click仅发MouseEvent,未触发产品pointerdown模态追踪和会话打开路径。此前click起算的切页结果仍保留,但不能视为完整鼠标手势/动画路径的验收。新的场景v2发送PointerEvent+MouseEvent序列,并从pointerdown起算;两种协议不得混合比较。新协议仍为原生WebView中的合成事件,不能代表系统可信鼠标输入延迟。 + +## 范围与验收 + +**11月6日用户范围调整:** 暂停编辑器专项,后续资源管理交由Monaco现有机制处理,不再继续编辑器性能分析或增加回收策略。正在执行的`editor-theme-pairs-1`已停止:仅完成第一组基线/候选,未完成三组验收;原始结果及停止说明保留在该目录的`interruption.json`。已有功能修复和未验收候选不因停止而变成性能收益。其余首页/隐藏页面驻留、生成中并发、终端、Browser与MiniApp工作继续。 + +| 阶段 | 覆盖范围 | 当前状态 | +| --- | --- | --- | +| 长时间驻留与资源归因 | 重复切页、已打开页面与 PTY 驻留、隐藏/恢复、关闭后回收;历史基线含编辑器,后续排除 | Apple正式基线完成;GPU进程循环驻留趋稳,首页/会话尾延迟未达标,桌宠增长仍待归因 | +| 生成中并发操作 | 实际 Agent/工具流式输出,同时输入、滚动、切页、拖分栏;后续不打开编辑器 | 无编辑器v7三对完整比较、六次功能与42个窗口条件检查通过;回读候选生成期主CPU−7.2%,但关闭后主内存+15.4%,已撤回。工具启动长帧与内存仍待优化;旧协议Spinner和滚动量化修复保留 | +| 编辑器重负载 | 大文件、多文档、持续编辑和文件变更 | 按用户要求暂停专项;语言Worker修复及五语言回归通过,已有重负载基线;主题候选仅完成一组对照,未验收,不再继续优化Monaco生命周期 | +| 终端重负载 | shell 就绪、多 PTY、大量输出、滚动和调整大小 | 三PTY×12万行基线及隐藏重绘三对A/B完成,六次功能通过;隐藏主CPU中位数25.27%→9.61%;一次热反馈106 ms超标、宿主CPU上升与内存波动尚未闭环 | +| Browser 重负载 | 多子 WebView、动态内容、隐藏、关闭与资源归还 | 布局与原生编码候选各三对A/B完成,各六次功能通过、速度未通过;原生候选切页主CPU时间中位数−5.4%,GPU进程CPU时间+2.3%,关闭后宿主内存下降;仍未验收 | +| MiniApp 重负载 | 多应用、真实运行和 Worker 生命周期 | 修正驱动跨iframe引用后的v3完整基线功能通过;首开307–351 ms、热内容P95 53 ms;拖拽P95 36 ms未达标,隐藏绘制与关闭后约43–45 MiB增量待归因;无优化对照 | + +交互底线沿用上一报告:普通操作反馈 P95 ≤100 ms,热内容 P95 ≤150 ms;连续交互帧间隔 P95 <34 ms、最大 <100 ms,继续追求 >33.33 ms 慢帧低于1%。重负载必须保留输入、取消、阅读位置和增量展示,不以阻断操作换取后台吞吐。 + +资源目标:相同有界工作量下 CPU/唤醒和稳定内存不恶化;诊断重复操作的增长是否来自真实业务数据、可重建缓存、渲染资源或测试自身。需要优化的热点必须有前后对照。RSS、物理 footprint、JS 堆和 GPU 内存不可互相替代;测不到的指标保留“未取得”,不能写成零。 + +不减少动画质量、动画节奏、数据刷新,不通过卸载业务状态、丢弃草稿或重建终端满足预算。实际远程和其他平台未在本机本轮中执行,本地结果不能替代它们。 + +## 关键覆盖缺口(11月6日核对) + +“已有测试脚本”“功能通过”“取得性能基线”“优化前后验证通过”是不同状态。 +以下依据本轮第05号报告、本文的实际结果及桌宠专项报告;没有把仓库内历史专项或未执行脚本记作当前版本的性能验收。 +普通导航、20个设置入口和分栏已测,不代表页面内部所有操作均已测。 + +| 优先级 | 场景/页面/操作 | 已有证据 | 尚缺的性能评估与优化 | +| --- | --- | --- | --- | +| P0 | 长时间驻留、反复切页、隐藏/恢复、关闭回收 | Apple配置28.74分钟、480次导航;草稿和阅读状态通过 | 首页/会话尾延迟未达标;桌宠WebContent增长待归因;旧通用Web字体的重复分配不能当作默认桌面结果;更长时稳定性未证明 | +| P0 | 生成中并发操作 | 旧协议600段并发及滚动量化三对A/B完成;新增无编辑器v7三对完整比较,六次功能及42个焦点/可见性窗口通过;独立插桩定位重复滚动状态通知 | 最新三组基线工具启动最大帧165/98/87 ms;回读候选虽减少约73%渲染调用、生成期主CPU−7.2%,关闭后主内存+15.4%,撤回;内存与工具启动仍待优化。持续前台、多会话同时输出、取消后重试、审批等待/恢复及断线追赶仍缺同口径性能结果 | +| 暂停 | 编辑器、Markdown、Diff/预览 | 语言服务正常工作的v3六文件基线完成,输入、撤销/重做、查找、切换、回收恢复、保存、外部更新及关闭通过;五语言小文件回归通过 | 切换内容P95 195 ms、查找68 ms长帧及关闭后的约730 MiB主WebContent增量待归因;尚无产品优化A/B;v3包含一次当前标签重选,后续v4要求12次均实际切换;上述缺口保留为历史记录,按用户要求不再继续编辑器专项 | +| P1 | 终端 | 三PTY各12万行基线及隐藏重绘三对A/B完成;隐藏主CPU中位数25.27%→9.61%,选区/复制恢复通过;尺寸同步和自然退出修复已验证 | 候选一次热反馈P95 106 ms未达100 ms门槛;隐藏宿主CPU中位数14.21%→17.83%待归因;内存范围重叠,不能宣称稳定改善。拖动慢帧约4.55–4.58%,未达<1%进阶目标;活PTY detach/reattach及全屏终端程序尚缺性能验证 | +| P1 | Browser及HTML预览 | 三个真实原生网页、长表格/Canvas/Worker的正式基线完成;调用栈已确认预览转码CPU工作;布局候选三对A/B功能通过、速度未通过,CPU改善与反向指标均保留 | 原生网页热展示P95、预览和主界面布局的临界路径占比、关闭后内存待优化/归因;原生编码候选未验收;视频、HTML网关重负载、无主独立页面仍缺测量,需协调已有浏览器清理PR | +| P1 | MiniApp | 30个本地安装条目、3个真实应用/Worker的v3完整基线功能通过;首开、热切换、输入/滚动/计算、隐藏恢复、逐个关闭/重开已覆盖 | 拖拽P95 36 ms未达标;隐藏主CPU18.56%、GPU进程CPU12.70%待优化;已修正驱动引用后,关闭内存仍未回原基线,尚不能认定产品泄漏;无优化A/B。市场/严格隔离、独立Shell、展示迁移、详情/AI调用仍缺性能结果 | +| P1 | 冷启动、恢复启动、懒加载/预热 | JS启动观察值及预热后的首开;尚无加载策略A/B | release冷启动到可操作、预热未结束时首点、已打开工作区恢复;同条件比较加载策略的首点延迟、0–10秒CPU、常驻/峰值内存 | +| P1 | 大工作区的文件树、搜索、Git | 小临时仓库的入口打开 | 大目录展开、连续搜索与取消、文件watch风暴、Git状态/大量变更/长历史/Diff、工作区切换及索引;缺有规模数据的量化对照 | +| P1 | 拖拽与面板复杂组合 | 导航/内容分栏已改善;已补单会话生成中的双分栏、三PTY持续输出时的拖动;早期左overlay/底部终端变体通过 | Browser/MiniApp与生成/终端输出同时活跃时的组合拖动(编辑器组合按用户要求暂停);重复切换各种面板布局;慢帧<1%的进阶目标未全达成;最新P0未重跑全部变体 | +| P1 | 输入与内容导入 | 草稿分段输入、代码编辑和终端输入已测;原生驱动/DOM事件有明确口径限制 | 中文IME组合输入、大段粘贴、附件/图片导入及同时生成时的响应、CPU与峰值内存未取得本轮基线;系统可信按键/剪贴板到最终像素延迟不能由input-to-RAF替代 | +| P1 | 真实远程链路 | 本轮没有真实远程性能样本 | SSH/Docker工作区、Remote Control、Peer Device、Detached Dispatch的延迟、断线恢复/事件追赶、CPU/内存;本地结果不能替代 | +| P2 | 待办/Agents/助手/Skills/Insights等页内操作 | 普通打开/重入已测,待办为空列表 | 大量条目的筛选/搜索/编辑、待办状态更新、助手详情与历史、Skills市场/安装、Insights统计切换和刷新;按实际规模建立工作量 | +| P2 | 设置与全局浮层 | 20个设置入口计时;桌面控制探测约4秒未解决 | 模型/MCP等真实探测与保存、主题切换、诊断/归档大列表、全局搜索和复杂弹窗;区分可操作反馈与外部请求完成时间 | +| P2 | Pages、Profile、Shell等其余场景 | 已核对当前场景分发入口,未见本轮性能结果 | 对实际可用入口分别建立首开/重入、真实内容操作和后台驻留样本;不能由其他导航页推定达标 | +| P2 | 桌宠与伴随窗口 | 独立六次短窗口对比;默认宠物内存基本持平 | 长时间高频气泡、多自定义素材切换、Blob缓存上限、主窗与桌宠分别隐藏;不能用主窗口隐藏代替全部窗口静止 | + +跨场景还缺三个测量维度:应用级GPU busy/独占显存、真实JS堆及对象保留链、release与Windows/Linux的同口径结果。 +GPU进程CPU/footprint和系统AGX计数已有数据,但不能填补前两类缺口。 + +覆盖核对复查了正式驻留、编辑器、终端及三对并发结果,并对照当前场景分发和runner操作序列;此后新增的Browser正式基线与独立诊断也已同步到上表。上述“未覆盖”指没有本轮当前版本、同口径的性能证据,不代表仓库没有历史功能测试或静态审阅。终端旧预演失败已被后续完整基线取代,不能继续据其判断终端未测;上游回补候选通过服务层测试也不等于已通过原生性能验收。 + +每项补测应分别输出首开/重入、持续操作、隐藏、恢复、关闭六阶段的速度与帧分布、进程CPU时间/唤醒、footprint/峰值及资源存活数量。懒加载尤其需要比较相同release构建下的现有策略、按需加载和预热策略,记录启动后立即点击与预热后的点击;现有“预热15秒后首开”不能回答首次打开是否值得延迟加载。 + +首开、热切换、持续操作、后台驻留、恢复、关闭回收需分别记录;其中某个阶段通过,不能替代其他阶段。性能回归还应在正常动画、真实数据刷新、草稿/阅读位置/终端会话保留通过的前提下判断。当前“待测”项目均没有已验证的优化收益,不预设它们一定需要改代码。 + +执行顺序按最新要求调整:先完成长驻留与归因,再做生成中并发操作,随后终端/Browser/MiniApp重负载;编辑器专项暂停,保留历史证据。 +其余行是明确记录的覆盖缺口,不代表已开始或已完成优化。 + +## 当前上游检查 + +- 已刷新 `origin/main` 至 `b76d6606b`,检查相关实现历史。此前长会话优化已合入,不重复当作新问题。 +- 已查看开放/草稿 PR 列表及相关差异:[PR #3694](https://github.com/GCWing/OpenBitFun/pull/3694) 涉及启动、IPC 定向广播及浏览器关闭清理;Browser 阶段需基于该工作识别缺口,避免重复修复。 +- [PR #3004](https://github.com/GCWing/OpenBitFun/pull/3004) 清理已结束文本段的累积缓冲,处理重复展示;不等同于并发操作的完整资源优化。 +- GitHub 插件搜索接口当时不可用,以上通过仓库 `git` 和 `gh` 检查,不据标题推断修复覆盖。 +- 11月6日再次刷新main至`d6a640fcc`,相关动画hook/播放器实现未包含本轮候选;重新检查#3694差异及搜索返回PR的文件范围,没有覆盖这些生命周期候选。 +- 滚动量化收敛修复前再次刷新至同一`d6a640fcc`:`useFlowChatFollowOutput`仍每帧从原生回读位置重新缓动,相关最近实现提交为`18eeb95db`。开放/草稿PR按scroll、follow、FlowChat、CPU、取消及函数名检索;返回PR的文件范围未修改该跟随循环。已读取本模块滚动/viewport契约及Known Gaps;历史上原生平滑滚动起步的量化停顿与这次自有RAF缓动末段空转需分别处理。 + +## 资源测量协议 + +旧协议仅按启动前后 PID 差集捕获 WebKit 候选。新协议在 macOS 测试适配器中单独启动目标,验证其 Darwin responsibility 身份,再动态枚举归属该目标的进程。预演确认主程序和 WebKit/GPU/Networking 的 responsible PID 均为目标程序 PID;原生测试同时运行一个无关进程,确认其被排除。 + +这解决进程归属,不推导某个 WebContent 对应哪一个页面,也不将多个进程的 RSS 相加称作独占物理内存。启动使用运行时解析的 Darwin SPI,其用法参考 [LLVM LLDB 的启动实现](https://lldb.llvm.org/cpp_reference/PosixSpawnResponsible_8h_source.html)。该适配器仅用于 E2E;接口不可用或归属验证失败时明确报错。 + +| 指标 | 来源与口径 | +| --- | --- | +| CPU | `proc_pid_rusage` 累计 user/system time,经本机 Mach timebase 转成毫秒,除以单调时钟窗口;100%为一个逻辑核 | +| CPU 校准 | 每次运行前以 `CLOCK_PROCESS_CPUTIME_ID` 对照约100 ms CPU 工作量;首轮100.0010 ms参考值对应100.0103 ms采样值 | +| 内存 | 分别记录 resident size、physical footprint、lifetime peak;`vmmap -summary`在计时窗口外提供分配分类 | +| 后台开销 | package idle wakeups、interrupt wakeups、pageins、磁盘读写累积值 | +| GPU | 归属明确的 GPU 进程 CPU/footprint,以及系统 AGX 观察;应用 GPU busy/独占显存仍未取得 | +| 生命周期 | PID与启动时间共同标识进程;启动/退出进程标记覆盖不完整,不混作完整窗口样本 | +| UI/逻辑资源 | DOM、保留场景、动画、canvas、编辑器、PTY、只读逻辑缓存账本;清理断开的 WebDriver 句柄,不清产品缓存、不强制 GC | + +11月6日再次核对GPU工具:本机选中`/Library/Developer/CommandLineTools`,`xcrun --find xctrace`返回不可用;`powermetrics`帮助中提供`--show-process-gpu`,但普通权限的一次调用返回`must be invoked as the superuser`,没有取得采样。以上是工具可用性证据,不是应用GPU时间/显存结果;未以进程CPU或系统AGX替代缺失指标。 + +正式默认协议:60轮×8个入口,保留1个1,200行编辑器、真实 PTY 和80回合会话;四个180秒资源窗口(首页、待办、恢复首页、关闭后首页),另有600秒窗口隐藏。每5轮记录检查点。窗口前稳定5秒,资源每2秒采样;截图和内存分类检查不进入计时窗口。 + +该协议与第05号报告的操作序列、进程归属方式及前端快照不同,不能直接混算收益。v1正式发现基线的原始测量脚本已保存在证据目录`harness/`。后续v2在预热前增加两次400 ms CPU脉冲,用于将主窗口/桌宠WebView与WebContent进程对应;这是窗口外的因果诊断,不是原生PID接口,也不进入资源或帧率样本。前后对照必须使用同版协议和测量脚本。 + +### 构建配置与原生分配归因 + +`residency-allocation-diagnostic-1`用v4在20轮首页/待办往返结束后运行`heap`,在速度和资源窗口外取得GPU进程的原生分配分类。23份`CFData (Bytes Storage)`各20,627,456 bytes,合计474,431,488 bytes;同时存在23份字体variation相关对象。内置`HarmonyOS_Sans_SC.ttf`为20,617,156 bytes,向16 KiB页对齐后恰为20,627,456 bytes。这强烈指向字体数据的重复副本,尚不等同于取得每个副本的完整分配栈或应用显存数据。 + +生产构建的字体规则由`scripts/web-font-profile.mjs`与Desktop构建器共同拥有:裸Vite production build使用`harmony-bundled`,Apple Desktop目标使用`apple-system`。旧E2E只校验前端revision、native和环境,漏掉了目标字体配置。 + +现在工作台、驻留和桌宠runner均校验HTML声明的配置,默认必须匹配Desktop目标。只有显式`OPENBITFUN_E2E_EXPECTED_FONT_PROFILE`才允许替代配置诊断,报告记录`matchesDesktopTarget=false`;成对对照同时比较字体配置。驻留v5还检查真实WebView的HTML标记,记录已加载字体,并保存字体规则源码及其hash输入。两个聚焦测试覆盖Apple错误配置拒绝、Windows/Linux正确配置、显式诊断与缺失标记。 + +新的Apple前端为`bundled-5b1689dc385c491b`(2,728文件、71,889,382 bytes),来自恢复既有P0代码后的同一工作树,仅按正式桌面构建规则选择字体。`residency-apple-baseline-1`已使用完整60轮及180/600秒资源窗口重新建立基线,结果如下。这是测量配置修正,不是改变用户字体后的性能优化。 + +## Apple Desktop正式驻留基线:功能通过,速度仍未达标 + +证据:`tests/e2e/reports/residency-apple-baseline-1/result.json`及同目录原生分配分类。协议v5,前端`bundled-5b1689dc385c491b`,native SHA-256仍为`04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`。实际WebView确认`apple-system`;本地macOS、debug native、production frontend。首次到最终检查点共28.74分钟,`functionalPassed=true`、`performanceBudgetsPassed=false`。 + +| 入口 | 热反馈P95 ms | 热内容P95 ms | 每项热样本数 | +| --- | ---: | ---: | ---: | +| 首页 | 190 | 216 | 59 | +| 待办 | 114 | 123 | 59 | +| Agents | 115 | 153 | 59 | +| Assistant | 98 | 104 | 59 | +| MiniApps | 110 | 121 | 59 | +| Skills | 104 | 125 | 59 | +| Insights | 99 | 105 | 59 | +| 长会话 | 171 | 192 | 59 | + +下表CPU为一核百分比,内存为窗口结束physical footprint(MiB)。主窗口与桌宠已通过窗口外的两次独立CPU脉冲对应到原生WebContent PID,而非按内存大小猜测。GPU列为GPU进程CPU/footprint,不是应用GPU busy/显存。 + +| 窗口 | 主窗口CPU / footprint | 桌宠CPU / footprint | GPU进程CPU / footprint | Host CPU / footprint | +| --- | ---: | ---: | ---: | ---: | +| 首页180秒 | 0.93% / 445.6 | 1.86% / 78.8 | 0.31% / 83.9 | 3.98% / 86.8 | +| 待办180秒 | 0.85% / 430.0 | 1.38% / 79.4 | 0.32% / 83.5 | 2.96% / 86.7 | +| 主窗口隐藏600秒 | 0.72% / 355.6 | 1.26% / 107.6 | 0.33% / 81.8 | 2.78% / 86.6 | +| 恢复首页180秒 | 1.09% / 342.3 | 1.83% / 117.0 | 0.31% / 83.4 | 4.23% / 87.9 | +| 关闭页面后180秒 | 0.42% / 345.6 | 1.90% / 126.6 | 0.32% / 83.3 | 4.04% / 87.8 | + +- 第1至60轮GPU进程footprint为133.8→135.2 MiB,中间检查点范围130.5–137.6 MiB。未复现旧通用Web字体快照每轮约20 MiB的增长。这支持字体配置与旧增长有关,不证明所有页面/配置都没有渲染资源问题。 +- 第6至60轮DOM稳定为3341、场景9个;关闭后为1490、场景1个。主窗口结束footprint低于首页初始驻留窗口,但关闭前后短期内存没有继续下降,不能据此声称全部对象已立即释放。 +- 草稿与编辑器内容保留,阅读行和偏移完全一致(−795.28125 px)。首页动画和业务刷新沿用原产品实现,没有因本次测量而修改。 +- 主窗口隐藏时桌宠保持可见。桌宠在后续阶段从约79 MiB增长到126.6 MiB,需要单独排查对象/缓存与回收节奏;一次增长不等于已证实泄漏,也不能用主窗口下降抵消该增长。 +- 下一项为独立原生调用栈诊断:首页/长会话尾延迟尚不能靠配置修正消除。带栈采样的运行只用于定位,不作为速度或资源优化验收。 + +### 桌宠长驻留增长:分配分类与独立观察 + +复核Apple正式基线的同一桌宠PID 22477:`after-cycles`至`final`的WebKit malloc已分配字节为63.8→117.3 MiB、分配节点315,158→632,079;`owned unmapped (graphics)`均为688 KiB。这把调查重点放到WebKit分配与对象回收,不能据此将增长称作GPU显存或已证实的JS泄漏。原始分类仍在`residency-apple-baseline-1/*22477-vmmap.txt`。 + +新增`run-pet-residency.mjs`使用现有责任进程采样和WebView身份归因,桌宠依次可见、隐藏但不销毁、恢复。每阶段默认五个60秒窗口,边界采集native heap/vmmap;只观察Tauri调试callback Map的注册、删除、分发和存活数,不保留回调函数,不强制GC或清产品缓存。它是带探针的独立归因,不是优化A/B或速度验收。 + +预演1因试图包装不可写的Tauri invoke入口而失败,改为观察其现有调试Map;预演2把真实鼠标移动产生的合法v2注视帧误当动画失效,已修正为分别验证行9/10的注视帧和原有walking动画,保留所有失败证据。没有修改产品交互或动画。`pet-residency-pilot-3`完成三个5秒窗口,功能通过;DOM均44、回调表均4项,可见/隐藏/恢复窗口的注册与删除增量分别82/82、0/0、82/82。恢复后采到全部六个walking帧;初始cadence受99个注视帧影响,未记为完整walking验证。这只证明短流程及回调正常配对,不能证明长期内存稳定。 + +`pet-residency-diagnostic-1`使用v4,在第一个60秒窗口后因主窗口意外变为可见而失败;这组不完整、控制条件失效的证据保留,不算长期基线。v4起另统计调试Map的get分发次数,用于区分一次性调用与持续事件投递。v5将主窗口固定为可见的静态Todos,并在每个窗口两端断言,避免原生应用激活破坏隐藏主窗口条件。新增脚本语法与`git diff --check`通过,repository hygiene此前通过142项变更内容/10,298个文件名检查。编辑器专项按用户要求保持暂停。 + +`pet-residency-diagnostic-2`已完成15个一分钟窗口,功能通过,仍标记为instrumented诊断,未进行优化A/B或性能门槛验收。前端`bundled-3c87f6e27790f7fd`、原生`ec3205e9…`;protocol hash `13c6e08f…`、harness hash `162b9102…`。以下CPU为每阶段五个窗口的单核百分比中位数;footprint是桌宠各窗口末值的范围和阶段末值,不是JS堆或显存。 + +| 阶段(每阶段5分钟) | 桌宠CPU | 桌宠footprint范围/末值 MiB | 主WebContent CPU | GPU进程CPU | Rust宿主CPU | +| --- | ---: | --- | ---: | ---: | ---: | +| 可见 | 1.44% | 78.0–81.2/81.2 | 0.38% | 0.25% | 2.76% | +| 隐藏但保留 | 0.10% | 65.4–79.9/65.4 | 0.32% | 0.06% | 0.41% | +| 恢复可见 | 1.40% | 73.8–77.5/76.6 | 0.38% | 0.24% | 2.67% | + +所有窗口边界桌宠DOM为44、callback Map为4;全程累计注册/删除10,886/10,886,没有持续积累回调。计数包含诊断自身原生查询,不能将隐藏阶段的小量调用全部归为产品轮询。WebKit malloc分配量初始44.4 MiB、可见后48.8、隐藏后33.5、恢复后42.5,分配节点184,775→213,264→143,157→195,890;没有强制GC或清缓存。可见期footprint未复现旧记录的持续上升,隐藏期有自然回落。 + +两段cadence均受到实际鼠标注视状态影响:首次只采到两个walking位置,不能作为完整动画周期验证;恢复后采到五个walking位置。隐藏暂停/恢复播放、尺寸和贴图检查通过。这次没有改桌宠产品代码。旧基线与本次桌宠入口chunk在归一化导入文件名后相同,但整个前端、主窗口负载和驻留时长不同;本次15分钟观察不排除旧28.7分钟复杂负载中的增长,也没有取得JS对象保留链。原始结果、分配分类和`metrics.json`保存在`pet-residency-diagnostic-2/`,不将“未复现”写成“已修复泄漏”。 + +### 首页/长会话布局归因与候选验证 + +`navigation-stacks-apple-1`与`navigation-layout-apple-1`分别记录原生调用栈、保留1200行编辑器/PTY/80回合历史时的32次首页与会话切换。后者临时包裹几何读取API并恢复原方法,仅用于诊断;其耗时不作为性能验收数据。 + +主要同步布局调用点包括:虚拟会话滚动范围的`scrollHeight`、SceneBar自动显露活动标签的`scrollLeft`/尺寸读取、虚拟列表`rangeExtractor`中的`clientHeight`,以及首页重建动画图层时读取SVG尺寸。头像图层初始化的16次慢读取最大52 ms;不能直接将这些数字相加作为可优化收益,也不能在没有对照的情况下删除滚动定位或活动标签自动显露。 + +新候选保留首页已有图层,仅在隐藏时取消动画句柄,恢复时沿用原动画。`retained-layout-apple-visual-pilot`的同协议原生A/B均通过功能与速度检查;8个宽窄窗口/动画时间点/滚动偏移截图裁剪逐像素一致,动画几何最大差异0。它仅有两次常规重入及5秒资源窗口,不证明重负载切页或长期资源收益。 + +随后`retained-layout-apple-residency-pilot`完成同协议12轮A/B,双方功能通过、速度预算均未通过。每入口11个热样本:首页反馈/内容P95由191/215 ms变为150/174 ms;长会话由167/189 ms变为179/201 ms。首页改善方向与消除图层初始化同步布局相符,但单对短测不足以证明稳定收益,会话也没有改善。3秒资源窗口不作为常驻CPU/内存验收,不能据首页单窗口4.34%→0.77%的波动宣称资源收益。候选仍待重复及长窗口验证,未计为已完成优化。 + +### 隐藏场景样式候选:短对照无收益,已撤回 + +11月6日刷新`origin/main@54e0f0df5`,SceneViewport和SplitView相关实现与当前基点无差异;检索开放/草稿PR并读取#3698的`62be21f0…`差异,没有覆盖这些文件。检查记录在`scene-visibility-build/upstream-check.json`。 + +现有独立诊断显示切页时有较多样式匹配与同步布局,但尚未隔离各项样式的独占代价。本次尝试让场景根的继承`visibility`保持visible;隐藏子树仍由既有`content-visibility:hidden`、opacity、pointer-events、inert和aria-hidden隔离。消息发送反馈原来依赖继承visibility抑制隐藏播放,因此同时补充浏览器`checkVisibility`判断,保留隐藏时消费反馈凭据且恢复不重播的规则;上游同文件无差异,开放PR专项检索无匹配,已检查的#3694/#3698也未覆盖。未改DOM保留、焦点规则、过渡时长、首页位置及业务刷新。该尝试已在下述对照后撤回,不能据源码推断为已完成优化。 + +新增独立`run-scene-visibility.mjs`复用统一原生责任进程采样,限定首页/80回合会话切换、静态Todos驻留,**不打开文件编辑器**。固定动画截图、隐藏场景焦点/命中检查和交叉淡入淡出采样放在性能窗口外。默认每入口30个热样本、三个30秒资源窗口;缩短运行明确为pilot,不与旧的含编辑器/终端驻留协议直接比较。首开、真实远程、应用GPU busy/显存及JS对象保留链不在本协议覆盖范围。 + +SceneViewport/WorkbenchLayout共15项和发送动画生命周期10项聚焦检查通过,`check:web`、motion audit和repository hygiene(148内容文件/10,301文件名)通过。消息反馈新增用例覆盖隐藏消费不重播及可见播放;首次用例错误复用了已经消费的同一提交凭据,修正为独立用例后通过,未放宽产品行为。基线为`bundled-3e15189fc192841e`,候选`bundled-24d33f9b362188da`,原生均`ec3205e9…`。预检查发现Vite直调的字体/mode与旧快照不同,启动E2E前已重建为相同Apple字体、production模式;归一化资源文件名后仅AppLayout CSS和ChatPane JS有预期差异,无新增或删除资源。 + +`scene-visibility-pilot-1`在基线完成24次切换和三个5秒窗口后,因未触发预期入场动画而失败;候选未启动。检查实际44帧与驱动源码确认element click仅发MouseEvent,没有pointerdown,产品因此按instant切页。v2通过Page Object向真实控件发送PointerEvent+MouseEvent标准顺序,并将计时起点前移到pointerdown,覆盖会话在按下时即开始的工作;没有导入产品store或强制开启动画。失败证据保留,不能与v2计时混用。 + +`scene-visibility-pilot-2`完成一对v2对照:每入口12次、三个5秒资源窗口,双方功能通过、反馈速度未全部通过;`comparable=true`、`pilot=true`、`passed=false`。protocol hash `885b0702…`、harness hash `620e92cd…`。 + +| 指标 | 原实现 | 候选 | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 99/109 | 102/116 | +| 会话反馈/内容P95 ms | 128/145 | 131/148 | +| 24次切页主WebContent CPU时间 ms | 6,097.2 | 6,574.5 | +| 同段GPU进程CPU时间 ms | 759.2 | 849.5 | +| 同段Rust宿主CPU时间 ms | 1,272.8 | 1,363.1 | +| 切页结束主WebContent footprint MiB | 519.8 | 541.9 | +| 最后首页5秒窗口末主WebContent footprint MiB | 327.9 | 380.5 | + +8组头像裁剪逐像素一致,4条动画轨迹的几何差异为0,完整首页截图也已核对;位置、尺寸、滚动偏移均一致。两次过渡各采到31个中间透明度帧,480 ms入场时长保留;隐藏场景无法命中、聚焦或绘制,inert与aria-hidden仍在。草稿保留,阅读行与偏移前后均为同一行/−51.546875 px;两侧均没有打开文件编辑器。 + +这组短样本没有建立速度或资源收益,切页主CPU时间反向约7.8%、GPU进程CPU反向约11.9%;单对不能证明稳定退化,5秒内存与CPU窗口也不作长驻留结论。**已撤回本次visibility及配套消息动画判断改动和专项测试,恢复试验前的产品源码;没有撤回先前的content-visibility或其他工作。** 新的指针计时流程、功能保护和全部证据保留。不通过继续重复无明确收益的候选、降低动画或放宽预算完成验收。 + +### 修正指针口径后的场景正式基线 + +撤回后23项聚焦检查通过。`scene-pointer-baseline-1`使用原前端`bundled-3e15189fc192841e`、同一`ec3205e9…`原生宿主完成v2默认负载:每入口30次,共60次切换,以及三个30秒驻留窗口。没有打开文件编辑器,未并行运行构建或测试;`functionalPassed=true`、`performanceBudgetsPassed=false`、`passed=false`、`pilot=false`。Protocol hash `8ab365b2…`、harness hash `620e92cd…`。原始数据及`metrics.json`位于同名报告目录。 + +| 入口 | 反馈P95 ms(目标≤100) | 内容P95 ms(目标≤150) | +| --- | ---: | ---: | +| 首页 | 113,未通过 | 123,通过 | +| 会话 | 136,未通过 | 152,未通过 | + +这不是相对旧click协议的产品加速;输入事件、计时起点及工作量已不同。60次切页的归因窗口为45.80秒,主WebContent累计CPU时间15,763.3 ms、GPU进程2,143.4 ms、宿主3,423.6 ms;主WebContent采样峰值570.4 MiB。CPU时间包含原有切页动画和相同测量开销,不能把它全部当作事件阻塞或独占脚本时间。 + +以下CPU是窗口内累计时间/单调墙钟的单核百分比,footprint是窗口末值MiB;每个进程身份覆盖完整窗口。GPU列仅为GPU**进程CPU和footprint**,不是GPU busy或独占显存。 + +| 30秒窗口 | 主WebContent CPU/footprint | 桌宠CPU/footprint | GPU进程CPU/footprint | 宿主CPU/footprint | +| --- | --- | --- | --- | --- | +| 首页可见 | 1.48%/309.2 | 1.12%/72.9 | 0.40%/79.2 | 2.95%/99.2 | +| Todos可见、首页隐藏保留 | 0.70%/285.2 | 1.59%/73.8 | 0.28%/75.8 | 3.15%/99.2 | +| 恢复首页 | 0.76%/381.7 | 1.27%/83.3 | 0.22%/78.8 | 2.93%/103.7 | + +三个窗口DOM均为2014;主WebContent窗口采样峰值分别350.6、285.6、382.3 MiB。恢复后的内存较前两个窗口高,不能据短窗口结束值断言泄漏,也不能称内存已稳定。原头像四条动画在可见窗口持续推进、隐藏时停止;宽窄布局的8张原生截图、两次过渡、隐藏焦点/命中隔离、草稿和阅读行/−51.546875 px偏移检查通过。该基线仍未覆盖release、实际远程、其他OS、系统可信输入、实际GPU busy/显存或JS保留链。 + +下一项P0应在该指针协议下定位首页113 ms与会话136 ms反馈的临界路径及恢复后内存来源;不能继续用旧的无pointerdown切页结果判断动画路径已经达标。编辑器专项保持暂停。 + +### 指针路径布局归因与选区候选:未建立整体收益,已撤回 + +`navigation-pointer-stacks-1`完成v3独立诊断:16轮首页/80回合会话往返,共32次切换,20秒原生WebContent栈采样及可恢复的布局读取包装器。前端`bundled-3e15189fc192841e`、原生`ec3205e9…`;protocol hash `a49ba71b…`、harness hash `7955f477…`。未打开文件编辑器或PTY;草稿及阅读位置通过。诊断采样和调用栈收集会增加开销,以下同步读取耗时不能作为普通E2E收益或各函数独占CPU时间。 + +| 同步读取路径 | ≥1 ms次数 | 这些慢读取累计 ms | 最大 ms | +| --- | ---: | ---: | ---: | +| Timeline `selectionchange → update → clientHeight` | 16 | 490 | 38 | +| 虚拟列表范围提取 `clientHeight` | 48 | 476 | 33 | +| 跟随可用性检查 `clientHeight` | 32 | 390 | 28 | +| 历史边界/滚动读取 `scrollHeight` | 32 | 814 | 31 | +| 场景标签可见性调整 `scrollLeft` | 32 | 444 | 21 | + +原生非等待栈也多次落在样式选择器匹配中。采样次数不是CPU百分比;触发布局的读取方不一定是使布局失效的来源。尤其删除一处读取后,待处理布局可能移到下一处,不能将上述490 ms直接算作可节省时间。 + +准备候选前刷新`origin/main`至`932630187…`,选区hook与基点完全一致;开放/草稿PR的选区专项检索没有匹配,已核对#3694和#3754范围,没有覆盖该owner。记录保存在`timeline-selection-build/upstream-check.json`。候选只对与聊天列表无交集、且此前也没有聊天选区的文档`selectionchange`跳过几何更新;实际选择、跨区域范围、选区移出/清除仍更新租约,焦点与滚动处理不变。判断使用DOM Range交集,不读取布局、不持有Range、不改变动画或业务刷新。 + +三项hook聚焦测试及`check:web`通过。Apple字体、production模式的候选为`bundled-310861b5d7902305`;归一化Vite资源名后只有`TimelineMutationBoundary`实现块变化。`timeline-selection-native-2`功能通过:4,011字符跨行选区在滚动回收后内容、端点和行驻留不变;移到55字符输入草稿后旧行租约释放;两端均在scroller外的11,938字符范围及清除检查通过,草稿未丢失。使用DOM Range及WebKit原生selectionchange,没有额外派发事件;不代表系统拖选、剪贴板或选择高亮像素验收。首轮`native-1`因选用了只有图标、无可选文字的导航按钮而中断,改为真实输入框后补跑;失败证据保留。 + +`timeline-selection-pilot-1`完成无诊断包装器的一对短对照:每入口12次、三个5秒资源窗口;双方功能通过,速度预算未全部通过,`comparable=true`、`pilot=true`、`passed=false`。Protocol `885b0702…`、harness `620e92cd…`;不同字体、原生版本或旧MouseEvent协议没有混入。8组头像裁剪像素差异为0,四条轨迹几何差异为0,位置/尺寸/滚动偏移一致;原有480 ms过渡、隐藏焦点/命中隔离、草稿和阅读位置均通过。 + +| 指标 | 原实现 | 候选 | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 100/112 | 106/127 | +| 会话反馈/内容P95 ms | 135/152 | 130/145 | +| 首页内容中位数 ms | 96.5 | 113.5 | +| 会话内容中位数 ms | 134.0 | 129.5 | +| 24次切页主WebContent CPU时间 ms | 6,903.0 | 6,767.3 | +| 同段GPU进程CPU时间 ms | 886.3 | 864.9 | +| 同段Rust宿主CPU时间 ms | 1,439.9 | 1,425.0 | +| 切页结束/采样峰值主footprint MiB | 529.8/537.4 | 528.0/548.3 | +| 最后首页5秒窗口末主footprint MiB | 316.6 | 302.7 | + +切页主CPU时间约−2.0%、GPU进程CPU约−2.4%,未建立稳定改善;首页内容P95和中位数反向。5秒窗口主CPU本身有较大波动:首页可见2.18%→0.35%,恢复首页0.47%→2.16%。因此不以某个短窗口或末尾内存下降认定空转/驻留问题已修复,单对也不足以证明稳定退化。详细窗口、归属及峰值保存在同目录`metrics.json`。 + +随后的`timeline-selection-pointer-stacks-1`保持同一v3诊断protocol/harness,与初始诊断一致:选区回调不再出现在≥1 ms慢读取中;所有clientHeight读取累计由1,379降到802 ms,但首页`OverviewMiniAppLogos`的clientWidth新出现15次慢读取,累计130 ms(原诊断该字段所有调用合计1 ms)。其余主要路径仍在:历史scrollHeight 814→794 ms、标签scrollLeft 444→452 ms、范围提取476→442 ms、跟随可用性390→360 ms。该结果支持“布局读取时点发生转移”,不能量化为直接可见收益,更不能把原490 ms全部算作节省。 + +**已撤回选区hook候选,产品文件与试验前快照完全一致。** 保留跨区域选择/清除/移出语义的单元回归、新原生选择脚本及全部成功/失败证据;未撤回其他已有优化。下一步P0聚焦首页刷新、场景切换和列表范围更新之间的样式失效与读写顺序,继续用同一指针协议验证最终响应。编辑器专项保持暂停。实际GPU busy/显存、JS对象保留链及真实远程仍未取得。 + +恢复后3项hook测试通过;`timeline-selection-native-restored-1`在原前端`bundled-3e15189fc192841e`上完成相同六阶段选择检查,全部通过。Repository hygiene通过(149内容文件/10,304文件名)。候选与恢复后的选择运行均未打开文件编辑器,未与构建或性能测试并行。产品源文件恢复哈希、构建差异及日志保存在`timeline-selection-build/manifest.json`和同目录日志中。 + +### 标签栏测量与多标签露出:时序候选撤回,保留功能修复 + +沿用32次指针切换诊断中标签栏`scrollLeft`累计444 ms的线索,检查`useSceneTabNavigation`在每次激活时同步测量标签。准备变更前再次刷新`origin/main@932630187…`,hook及SceneBar实现与当前基点一致;专项开放/草稿PR检索没有匹配,读取#3764/#3694/#3698的实际文件范围,没有覆盖该owner。GitHub连接器返回Unknown tool,本次检查通过git/gh完成,记录在`scene-tab-measure-build/upstream-check.json`。 + +试验中的时序候选将激活请求交给已有ResizeObserver,在布局完成后测量;通过重新观察当前标签请求通知,尺寸没有变化也会处理。没有添加定时等待或改变业务刷新。重复激活取最新请求,滚轮/翻页取消尚未完成的自动露出;缺少ResizeObserver的环境保留同步路径。通知依据见[Resize Observer观察算法](https://drafts.csswg.org/resize-observer/#dom-resizeobserver-observe)。下方对照未证明收益,最终源代码已恢复首次激活时同步测量;ResizeObserver仅用于控件宽度变化后完成尚未结束的露出。 + +新增`run-scene-tabs.mjs`覆盖7个非编辑器场景、窄窗口溢出、指针露出、Home/End、垂直滚轮和翻页控件。首轮`scene-tab-native-1`遗漏侧栏固定项准备,停在不可交互的Agents入口;原有驻留脚本已包含这项fixture配置,不能据本次遗漏否定旧导航数据。第二轮已得到真实溢出,但因应用从无标签欢迎页启动,只显式打开6页而未达到7页的工作量断言;v3明确打开首页并列出7个场景,未降低工作量。 + +`scene-tab-native-3`(仅时序候选`bundled-eed92fde3cbc1a7d`)与`scene-tab-native-baseline-1`(原实现`bundled-3e15189fc192841e`)都在同一露出断言失败:900 CSS px窗口,选中Insights标签的相对区间为606.61–671.61 px,标签可视宽512 px,scrollLeft仍为0。页面已切到Insights,选中标签却在视区外;这是原有坐标问题,不是候选独有回归。内部TabGroup item位于有定位的SceneBar拖拽包装内,其offsetLeft属于包装坐标,原hook却将其视为标签栏滚动坐标。 + +功能修复改用元素与滚动容器的矩形差计算位置,并跟踪一次露出直到可见;左右翻页控件的出现/隐藏可改变可用宽度,只在目标变化时调整平滑滚动,不因每个中间位置重启动画。过宽标签保持单次对齐,不在两端往返。时序+功能候选的30项聚焦测试、`check:web`和motion audit通过。 + +`scene-tab-native-4`在候选`bundled-3de97ea4a4863cca`上完成v3全部10项检查,功能通过。指针切换后scrollLeft为193 px,选中标签位于413.61–478.61 px,容器clientWidth为478 px(整数边界与亚像素测量相差不足1 px);采到45帧、10个不同滚动位置,保留平滑过程。Home/End的选择及焦点、32 px垂直滚轮、前后翻页、恢复窗口和草稿均通过;轮滚后选中标签可以留在视区外,没有被自动露出逻辑抢回。原生检查是合成事件/实际WebView布局,不代表系统可信输入或真实远程。Protocol `20d0768b…`、harness `bc03f87b…`。 + +候选构建的归一化资源差异仅AppLayout JS;前端为Apple字体、production模式,原生仍为`ec3205e9…`。无探针对照`scene-tab-measure-pilot-1`已完成,12轮/24次切页、3个5秒驻留窗口、单对AB;协议`885b0702…`、harness `620e92cd…`与其他同配置短对照一致。两侧功能通过、可比性通过,速度预算未通过。8个首页头像裁剪像素差均为0,动画几何差为0,480 ms入场、隐藏焦点/命中、阅读位置和草稿均保留;未打开文件编辑器。 + +| 单对短样本指标 | 原实现 `3e15189f…` | 时序+功能候选 `3de97ea4…` | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 99/111 | 99/122 | +| 会话反馈/内容P95 ms | 128/148 | 139/154 | +| 24次切页主WebContent CPU时间 ms | 6,795.5 | 6,923.1 | +| 同段GPU进程CPU时间 ms | 856.2 | 875.5 | +| 同段Rust宿主CPU时间 ms | 1,387.4 | 1,471.6 | +| 切页结束/采样峰值主footprint MiB | 515.1/520.2 | 527.4/543.0 | +| 最后首页5秒窗口末主footprint MiB | 297.3 | 319.2 | + +主CPU约+1.9%,没有整体收益;单对短窗口不足以证明稳定退化或长期泄漏。`scene-tab-measure-stacks-1`采用相同v3诊断协议/harness,32次切页功能通过。标签scrollLeft慢读取444→0 ms,但会话跟随逻辑clientHeight慢读取390→617 ms,并新增会话clientWidth慢读取214 ms;全体clientHeight累计1,379→1,511 ms,历史scrollHeight仍为814→806 ms。该诊断仅支持耗时在布局读取点之间转移,不能把消失的444 ms认作用户收益。逐类和调用栈汇总位于同目录`layout-summary.json`。 + +**已撤回延后首次测量,只保留原生基线确认的坐标/完整露出修复。** 恢复同步测量后的30项聚焦测试、`check:web`、motion audit及production构建通过,最终前端为`bundled-fbedcd1bb54c92f1`,归一化资源仍仅AppLayout JS变化。`scene-tab-native-5`沿用v3相同protocol/harness,全部10项原生检查通过;指针44帧含12个不同滚动位置,键盘选择/焦点、滚轮接管、翻页、窗口恢复及草稿保留通过,文件编辑器数量为0。 + +最终功能修复的独立短对照`scene-tab-reveal-pilot-1`已完成,仍为相同12轮/3×5秒/单对AB协议。两侧功能通过、可比性通过;8个头像裁剪像素差为0、动画几何差为0,隐藏焦点/命中、480 ms入场、阅读位置及草稿通过。以下数据仅在本对中比较,不将上一对时序候选直接与本对混算。 + +| 最终修复单对短样本 | 原实现 `3e15189f…` | 功能修复 `fbedcd1b…` | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 101/112 | 97/108 | +| 会话反馈/内容P95 ms | 137/151 | 125/140 | +| 24次切页主WebContent CPU时间 ms | 6,887.2 | 6,894.8 | +| 同段GPU进程CPU时间 ms | 869.2 | 868.4 | +| 同段Rust宿主CPU时间 ms | 1,414.3 | 1,374.8 | +| 切页结束/采样峰值主footprint MiB | 519.0/519.0 | 519.5/551.3 | +| 最后首页5秒窗口末主footprint MiB | 299.7 | 310.9 | + +主CPU约+0.1%、GPU进程CPU约−0.1%,基本持平;会话反馈仍超过100 ms底线。短窗主CPU波动互换:首页0.35%→2.12%,待办2.18%→0.34%,返回首页0.50%→0.60%,不能只选有利窗口。当前保留为已通过回归的功能修复,不宣称稳定速度/内存改善;没有将较高内存峰值删除或解释为已解决。实际GPU busy/显存、JS保留链与真实远程行为仍未测得。 + +### 样式匹配归因:共享滚动条绘制规则 + +针对原生栈中的选择器匹配,新增独立`run-scene-style-diagnostic.mjs`:在同一隔离进程内依次执行原始、临时删除指定规则、完整恢复三个阶段,每阶段8轮/16次首页与会话切换。每阶段记录归属CPU、footprint及几何getter;删除与恢复、尺寸检查均在计时外。CSS规则删除会改变测试页面的滚动条表现,**只能用于定位,不能作为产品优化或交互等价证明**;产品CSS没有修改。 + +`scene-style-focus-diagnostic-1`只临时移除2条共享hover/focus显隐绘制规则,实际列表和标签栏视口尺寸完全一致;CSSOM逐字恢复、草稿和阅读位置、未打开编辑器检查全部通过。使用最终功能修复前端`fbedcd1b…`和同一native;原始记录及`metrics.json`保留。 + +| 插桩诊断阶段 | 首页反馈P95 ms | 会话反馈P95 ms | 主WebContent CPU时间 ms | GPU进程CPU时间 ms | +| --- | ---: | ---: | ---: | ---: | +| 原始规则 | 95 | 137 | 4,698.1 | 596.2 | +| 暂时移除2条规则 | 108 | 127 | 4,337.2 | 558.7 | +| 完整恢复 | 100 | 132 | 4,324.2 | 563.7 | + +移除时主CPU低于首次阶段,但恢复后仍处于同一水平,不能将差值归因于规则删除;首页尾延迟没有改善。主要布局读取仍在:clientHeight累计518→449→515 ms、scrollHeight 364→318→356 ms、标签scrollLeft 211→190→205 ms。顺序阶段共享缓存和进程年龄,尚不足以认定focus规则是主要瓶颈;不以永久显示滚动条或移除键盘焦点提示换取性能。 + +扩展范围的首轮`scene-style-all-diagnostic-1`发现runner参数错误:native execute接受可变参数,传入`[false]`使页面收到真值数组,实际仍只移除上述2条focus规则。该运行三个阶段和CSS恢复成功,但**不能记作全组规则诊断**。v2改传原始boolean、在页面内校验类型并回传实际scope;外层再断言与请求一致。原始失败范围证据保留,未回写成符合预期的结果。首次focus-only运行实际移除范围与预期一致,仍只保留其受限诊断结论。 + +v2的`scene-style-all-diagnostic-2`完整通过,实际移除并精确恢复9条规则。三个阶段列表/标签栏几何恰好相同,草稿、阅读位置和零编辑器断言通过;这只覆盖该fixture,删除规则仍改变滚动条外观,不是可交付方案。 + +| 全组规则插桩诊断 | 首页反馈P95 ms | 会话反馈P95 ms | 主WebContent CPU时间 ms | GPU进程CPU时间 ms | +| --- | ---: | ---: | ---: | ---: | +| 原始规则 | 100 | 138 | 4,685.4 | 590.7 | +| 暂时移除9条规则 | 96 | 117 | 4,398.8 | 632.2 | +| 完整恢复 | 110 | 138 | 4,315.9 | 576.0 | + +clientHeight累计511→356→515 ms、scrollHeight 365→237→359 ms、标签scrollLeft 213→152→213 ms,说明这些规则参与了同步样式/布局成本;但总主CPU在恢复后仍更低,GPU进程CPU在删除时反而更高。不能从单次顺序诊断推导整体节省或保证交互等价。目前不保留任何产品CSS改动,也不把删除规则计作优化。 + +后续诊断改为记录每个慢读取发生时的所属场景、活动场景及holding/preparing/running状态,定位多次提交期间的读写关系。`run-navigation-profile.mjs`协议升至v4,新增字段通过DOM属性读取取得,不访问computed style;旧v3样本保留,不混算速度或CPU收益。 + +### 已就绪页面的重复等待阶段:性能候选撤回 + +`navigation-phase-stacks-1`的v4诊断完成,32次切换的草稿、阅读位置及零编辑器检查通过。前端`fbedcd1b…`,protocol `236dafb9…`、harness `dd486a30…`。主要慢读取的阶段分布如下;表内是插桩读取耗时,不是可直接节省的端到端时长。 + +| 读取路径 | 所属/活动场景状态 | 次数 | 累计 ms | +| --- | --- | ---: | ---: | +| 历史边界scrollHeight | 回到会话,active但holding不可见 | 16 | 415 | +| 历史边界scrollHeight | 离开会话,会话仍可见,首页holding不可见 | 16 | 384 | +| 范围提取clientHeight | 回到会话,active但holding不可见 | 16 | 366 | +| 标签栏scrollLeft | 回到会话holding | 16 | 240 | +| 标签栏scrollLeft | 回到首页holding | 16 | 219 | +| 跟随逻辑clientHeight | 会话preparing且可见 | 16 | 321 | +| 选区回调clientHeight | 首页preparing可见,会话已隐藏 | 16 | 426 | + +代码检查确认,即使目标树已经就绪并仍挂载,指针切换首个提交也一律派生holding,然后layout effect同步改为preparing。这使子组件激活测量先发生在不可见树上。准备候选前刷新`origin/main`到`c2ae5b88d…`,实际SceneViewport实现/测试/样式与HEAD一致;专项开放/草稿PR检索为空,相关#3694及其他返回PR的文件范围没有覆盖该owner。检查和源代码快照保存在`scene-ready-build/`。 + +试验候选让已就绪且仍挂载的树直接进入原有preparing阶段;未就绪页面继续holding,保留两次RAF准备和480 ms入场时长。同时在SceneReadyBoundary卸载/Suspense隐藏时撤销就绪标记,避免关闭后重新打开时把旧id误当作新树已就绪。两个新增回归在原实现上失败:激活测量看到holding/inert,以及关闭后重开未就绪目标却被显示;修改后9项场景测试全部通过。`check:web`、动效审计及构建完成,候选`bundled-09b38059603f1c88`的归一化资源差异只有AppLayout JS。 + +`scene-ready-pilot-1`完成相同12轮/3×5秒单对AB协议,基线为包含标签栏功能修复的`fbedcd1b…`。两侧功能与可比性通过,8个头像裁剪像素差及动效几何差均为0,草稿、阅读、隐藏隔离、480 ms动画保留;速度预算未通过。 + +| 单对短样本 | 原切换阶段 `fbedcd1b…` | 直接准备候选 `09b38059…` | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 109/121 | 110/122 | +| 会话反馈/内容P95 ms | 129/144 | 137/151 | +| 24次切页主WebContent CPU时间 ms | 7,039.6 | 7,053.9 | +| 同段GPU进程CPU时间 ms | 908.1 | 869.4 | +| 同段Rust宿主CPU时间 ms | 1,455.1 | 1,449.0 | +| 切页结束/采样峰值主footprint MiB | 523.5/530.1 | 516.1/529.4 | +| 最后首页5秒窗口末主footprint MiB | 296.6 | 305.0 | + +主CPU基本持平(约+0.2%),首页中位反馈也由93变为100.5 ms,未建立整体改善;单对不足以证明稳定退化。`navigation-phase-ready-stacks-1`使用相同v4诊断protocol/harness,证实主要读取已从holding转到preparing,但没有消除工作:标签scrollLeft累计459→822 ms,历史scrollHeight 799→767 ms;跟随clientHeight下降时,其他读取承担了更多成本。选区回调仍存在,并出现134 ms单次慢读,原始尖峰未删除。不能把阶段标签消失或某一调用栈下降当作用户收益。 + +**撤回直接进入preparing的性能改动,恢复原切换阶段。** 仅保留关闭/卸载后撤销旧就绪标记的功能修复及对应回归;最终8项场景测试、`check:web`和production构建通过。最终前端`bundled-e8c537a1f8dc3557`,源代码/测试快照、检查日志及归一化差异保存在`scene-ready-build/manifest-final.json`和同目录文件,资源差异仍仅AppLayout JS。 + +`scene-tab-native-6`使用最终前端及相同native,完成v4的7个非编辑器页面、全部12项检查。除原10项标签栏/窗口检查外,通过真实Delete处理器关闭Insights,确认场景host卸载,再从侧栏重开成功;会话草稿保留,Monaco实例为0。原生覆盖正常关闭重开;人为悬挂新树的等待语义由DOM回归覆盖,不能混称为原生慢网络验证。最终功能修复没有独立性能验收,不使用被撤回候选的A/B数值替代其结果。 + +未将此功能修复计为性能收益,未修改产品CSS、数据刷新、logo几何或动画节奏。后续归因应检查使样式/布局失效的写入与隐藏树测量,而不是继续从单个慢getter推导收益。所有这些运行均为本机macOS原生E2E;没有执行SSH/Docker、远程控制、Peer Device或Detached Dispatch,也未取得实际GPU busy/显存或JS堆保留链。文件编辑器专项继续暂停。 + +最终`git diff --check`与repository hygiene通过(156内容文件/10,309文件名);产品源文件与最终构建记录的源码快照逐字一致。所有原生采样/验证结束后才执行这些检查,没有并行构建或测试干扰计时。 + +### DOM 写入归因:独立诊断,不作为优化验收 + +`navigation-write-stacks-1`使用v5诊断、当前`bundled-e8c537a1f8dc3557`前端和相同native,完成32次首页/会话切换;草稿、阅读位置及零编辑器检查通过。Protocol `1936aade…`、harness `d1d10989…`。在慢布局读取之间收集DOM MutationObserver记录,仅保存基本字段、不持有节点;每批128条上限,本次没有丢弃。原始数据及分组结果在同目录`result.json`/`mutation-summary.json`。 + +共收集3,800条记录,其中覆盖层ID有1,312次、列表测量索引有408次旧值与采集时现值相同。源码也确认这些路径会无条件写入当前值。批次采集时间不是精确写入时间,采集时属性值也不能恢复全部中间状态,不能把这些计数直接换算成CPU收益。 + +| 慢读取 | 次数 | 累计 ms | 前置DOM更新情况 | +| --- | ---: | ---: | --- | +| 离开会话后的选区clientHeight | 16 | 546 | 场景进入preparing、会话隐藏;包含138 ms单次尖峰 | +| 回到会话holding时历史scrollHeight | 16 | 420 | 每次仅有excerpt-ready标记更新 | +| 回到会话holding时clientHeight | 32 | 397 | 其中16次慢读取之间没有DOM更新 | +| 离开会话时历史scrollHeight | 16 | 388 | 同值测量索引及excerpt-ready更新 | +| 会话preparing时跟随clientHeight | 16 | 320 | 场景/opening边界更新 | +| 场景标签scrollLeft | 32 | 461 | 导航、标签、场景及覆盖层属性更新 | + +没有DOM更新不等于样式未失效;CSS动画、隐藏子树强制测量以及引擎内部工作不在MutationObserver覆盖内。该结果缩小了归因范围,没有证明某一条写入造成后续全部耗时。下一候选仅跳过同值ID/测量索引写入,保留真实索引变化、测量顺序、动画和业务刷新;以独立无探针A/B判断收益。 + +### 跳过同值属性写入候选:未建立整体收益,已撤回 + +修改前通过HTTPS刷新`origin/main@c2ae5b88d…`(SSH首次连接失败);两个owner与HEAD无差异。核对21个开放/草稿PR、专项检索及#3694/#3364/#3004实际文件范围,未发现覆盖本次同值属性路径的实现。检查记录在`dom-write-build/upstream-check.json`。候选只在值变化时同步覆盖层ID和测量索引,36项已有功能测试、`check:web`及production构建通过;前端`bundled-39b028c3fa7c8be5`,归一化资产差异仅对应两个实现块。 + +`dom-write-pilot-1`使用同一无探针v2协议:每入口12次切换,三个5秒驻留窗口,一对AB;protocol `885b0702…`、harness `620e92cd…`。可比性及两侧功能通过,速度预算未通过。8个宽窄布局头像裁剪的像素差、动画几何差均为0;logo位置/尺寸/滚动、480 ms入场、隐藏隔离、草稿和阅读位置均保留。 + +| 单对短样本 | 当前基线 `e8c537a1…` | 同值写入候选 `39b028c3…` | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 111/124 | 108/120 | +| 会话反馈/内容P95 ms | 128/142 | 132/147 | +| 24次切页主WebContent CPU时间 ms | 6,907.2 | 6,878.4 | +| 同段GPU进程CPU时间 ms | 851.2 | 868.5 | +| 同段Rust宿主CPU时间 ms | 1,407.6 | 1,428.8 | +| 切页结束/采样峰值主footprint MiB | 545.6/545.6 | 516.3/561.4 | +| 最后首页5秒窗口末主footprint MiB | 310.7 | 306.8 | + +主CPU约−0.4%,GPU进程CPU约+2.0%,首页和会话速度方向不一致,不能认定整体改善。结束内存较低但采样峰值较高;5秒窗口不支持长期稳定性结论。详细资源数据保存在该目录各arm的`*-metrics.json`。 + +随后`navigation-write-candidate-stacks-1`沿用完全相同的v5诊断protocol/harness,功能通过。记录从3,800减到2,080,同值ID/索引写入从1,720变为0,确认候选确实消除了目标工作;但历史scrollHeight仍累计809 ms(原808),标签scrollLeft 471 ms(原461),holding阶段clientHeight仍397→407 ms,其中32次慢读取之前均无DOM写入。选区累计下降包含基线138 ms单次尖峰差异,不能据此归因收益。 + +**撤回这两处性能候选,恢复试验前源码;保留诊断工具、测试日志及全部原始证据。** 没有以“少写属性”替代用户速度/资源验收。P0仍需检查隐藏树测量和样式工作;文件编辑器继续排除。本轮仅本机macOS,没有真实远程、其他OS、实际GPU busy/显存或JS对象保留链证据。 + +### 复用已观察的视口高度:读取成本转移,已撤回 + +沿用上面的同owner上游检查,下一候选在既有尺寸观察器接受可用视口时记录clientHeight,供范围overscan及历史坐标换算复用。没有推迟观察器通知、改变滚动写入、刷新、DOM结构或CSS。51项测量/初始窗口/历史定位测试通过;另外补充的视口增高→零尺寸→恢复回归通过。`check:web`及production构建通过,`bundled-2b59756d99d2eff9`的归一化差异只有TimelineMutationBoundary实现块。 + +`viewport-height-pilot-1`使用同一12轮/三个5秒窗口的无探针AB协议。可比性和两侧功能通过,速度预算未通过;8组头像裁剪像素差及几何差均为0,480 ms入场、隐藏隔离、草稿和阅读位置通过。 + +| 单对短样本 | 当前基线 `e8c537a1…` | 高度复用候选 `2b59756d…` | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 88/100 | 99/112 | +| 会话反馈/内容P95 ms | 133/147 | 144/159 | +| 24次切页主WebContent CPU时间 ms | 7,025.1 | 7,069.9 | +| 同段GPU进程CPU时间 ms | 877.3 | 870.7 | +| 同段Rust宿主CPU时间 ms | 1,457.0 | 1,451.1 | +| 切页结束/采样峰值主footprint MiB | 507.3/529.1 | 514.2/529.1 | +| 最后首页5秒窗口末主footprint MiB | 300.0 | 304.2 | + +没有建立速度/资源改善;不把一次短样本的反向变化当作已证明的稳定退化,也不保留没有收益依据的候选。`navigation-height-stacks-1`沿用相同v5诊断protocol/harness,32次切页功能通过:范围提取的clientHeight慢读取消失,但紧随其后的offsetHeight新增44次、累计437 ms。历史scrollHeight仍805 ms、标签scrollLeft仍462 ms。这直接支持待处理布局转移到了下一处读取;不能将getter调用数量下降记作速度优化。 + +**已恢复试验前的虚拟列表源码和测试。** 候选源码/测试快照、日志、资源指标及诊断保存在`viewport-height-build/`、`viewport-height-pilot-1/metrics.json`及`navigation-height-stacks-1/layout-summary.json`。下一步隔离隐藏树的布局状态,不再逐个替换几何getter。文件编辑器未打开;本轮仍只有本机macOS证据。 + +### E2E 快照存储修复与后续测量边界 + +`scene-hidden-layout-diagnostic-1`在复制原生程序时遇到ENOSPC,尚未启动宿主,没有性能数据;失败日志保存为该目录`setup-failure.json`。检查发现E2E报告目录的重复程序快照占用大量空间,当时卷可用空间约508 MiB。前述两组短对照未记录逐阶段磁盘水位,故也不能排除低磁盘空间对波动的影响;这些候选均未被验收,不据其小幅变化宣称稳定收益或退化。 + +仅对本任务报告目录中的184份原生程序快照逐份校验SHA-256,确认4种不同二进制版本,将180份重复内容改为独立的APFS copy-on-write副本。每次替换前校验副本哈希及不同inode,再原子替换;没有删除报告、日志、测量数据或不同版本,也没有使用会互相传播写入的硬链接。完成后卷可用空间约115 GiB,记录在`tests/e2e/reports/storage-clone-audit.json`。处理期间没有运行性能负载。 + +共享macOS原生runner现在通过`/bin/cp -c`复制前端和程序快照;本机`cp`文档明确支持clonefile及不支持克隆时的普通复制回退。Node 22的FICLONE_FORCE实测返回ENOSYS,因此没有使用会悄悄退化为普通复制的Node配置。独立临时文件验证了修改副本不改变源内容;后续原生运行验证实际启动。快照准备在采样窗口外;runner内容变化会产生新harness hash,后续比较须两侧使用同一新runner,不与旧hash混算。 + +### 隐藏会话布局状态隔离:部分成本下降,恢复开销增加 + +磁盘快照处理结束后,`scene-hidden-layout-diagnostic-2`在原产品前端`bundled-e8c537a1f8dc3557`上完成v3的original/suspended/restored三个阶段,每阶段8轮、16次导航。Protocol `f76429e0…`、新harness `8fd123ee…`;native仍为`ec3205e9…`。仅在隔离测试中临时为隐藏session场景加入display:none,然后删除该规则;产品CSS没有修改。它改变了隐藏布局语义,只用于归因,不能视作优化验收。 + +隐藏会话的scroller高度依次为781→0→781 px;重新可见后的scroller/标签栏几何三阶段相同。草稿、阅读行及−51.546875 px偏移保留,零编辑器、临时规则准确移除均通过。新快照复制方式实际启动成功。 + +| 带布局探针的诊断窗口 | 原状态 | 隐藏时不布局 | 恢复原状态 | +| --- | ---: | ---: | ---: | +| 首页反馈/内容P95 ms(每项8样本) | 99/110 | 98/133 | 100/111 | +| 会话反馈/内容P95 ms(每项8样本) | 128/153 | 111/135 | 138/151 | +| 主WebContent CPU时间 ms | 4,636.8 | 4,341.9 | 4,440.1 | +| GPU进程CPU时间 ms | 587.5 | 604.5 | 585.1 | +| Rust宿主CPU时间 ms | 969.6 | 960.0 | 978.7 | +| 主footprint结束/采样峰值 MiB | 579.3/583.9 | 556.1/562.9 | 522.6/530.0 | +| clientHeight读取累计 ms | 526 | 239 | 516 | +| scrollHeight读取累计 ms | 364 | 491 | 362 | +| 标签scrollLeft读取累计 ms | 214 | 209 | 214 | + +隐藏布局状态确实影响了部分读取:clientHeight成本在恢复规则后回到原水平。但回到可见会话preparing阶段新增23次慢scrollHeight,累计190 ms;GPU进程CPU和首页内容P95也反向。恢复阶段主CPU和内存没有回到初始水平,说明顺序、缓存及回收节奏仍影响整体数值,不能用第一列与第二列直接计算产品收益。 + +**没有把display:none写入产品代码。** 后续需联合检查场景可见性、整棵树的样式更新及恢复流程,并校准测量自身开销;逐个跳过getter或直接更换隐藏CSS都不足以证明体验和资源同时改善。当前P0反馈预算仍未达标。本次不覆盖生成中切换、嵌入视图、系统可信输入、真实远程、其他OS、实际GPU busy/显存或JS保留链。证据和分组见该目录`metrics.json`、`layout-summary.json`。 + +本轮收尾:撤回后的36项聚焦测试、脚本语法检查、`git diff --check`及repository hygiene通过(156内容文件/10,309文件名)。被试验的产品源码和测试均与试验前快照逐字一致;未保留新的产品性能候选。最终记录为`tests/e2e/reports/navigation-write-validation.json`,没有在原生性能运行期间执行构建、测试或快照压缩。 + +### 测量自身开销校准:保留完整可见性测量 + +`scene-probe-calibration-1`在相同e8前端/ec32原生程序上完成三阶段:完整观测、只记录RAF、恢复完整观测;每阶段8轮、16次首页/会话切换。Protocol `28daa4ef…`、harness `ee6f761f…`。只记录RAF的阶段仍使用相同指针操作和700 ms观察期,最后一次检查DOM就绪,不逐帧查询可见性/几何,因而**不能报告反馈或内容延迟,也不能用于通过速度门槛**。 + +| 带探针的诊断窗口 | 完整观测 | 只记录RAF | 恢复完整观测 | +| --- | ---: | ---: | ---: | +| 资源窗口时长 ms | 12,162 | 12,235 | 12,349 | +| 主WebContent CPU时间 ms | 4,707.5 | 4,481.2 | 4,396.8 | +| GPU进程CPU时间 ms | 599.4 | 609.8 | 556.3 | +| Rust宿主CPU时间 ms | 968.8 | 999.5 | 990.1 | +| 主footprint结束 MiB | 512.0 | 507.7 | 511.9 | +| checkVisibility次数/累计耗时 ms | 622/388 | 18/0 | 629/383 | +| clientHeight累计耗时 ms | 519 | 506 | 518 | +| scrollHeight累计耗时 ms | 369 | 369 | 369 | + +可见性查询存在可测的调用耗时,但包含产品先前挂起的样式/布局刷新,不能将388 ms直接扣为“测试开销”。取消查询后整体CPU没有在恢复阶段回升,不能认定测量查询解释了主要成本。保留原速度协议,不将frame-only的缺失数据当作达标。草稿、阅读位置、零编辑器检查通过。原始及汇总数据见该目录`result.json`、`metrics.json`。导航归因脚本升至v6,增加可恢复的checkVisibility探针;旧版探针数据不混算。 + +### 会话根inert隔离:不移除产品交互保护 + +`scene-inert-diagnostic-1`以同样构建完成v4三阶段,每阶段16次导航。Protocol `b4b36c12…`、harness `b6916a60…`。仅在隔离进程中拦截会话根的inert属性写入,其他属性/CSS不变;中间阶段实际抑制9次添加、9次删除,之后恢复原方法和当前属性。隐藏状态inert为true→false→true;aria-hidden始终为true,隐藏scroller仍781×1170 px,三阶段活动几何一致。 + +| 带探针的诊断窗口 | 原状态 | 暂停根inert | 恢复原状态 | +| --- | ---: | ---: | ---: | +| 首页反馈/内容P95 ms(各8样本) | 105/117 | 98/114 | 98/110 | +| 会话反馈/内容P95 ms(各8样本) | 135/151 | 127/149 | 139/153 | +| 主WebContent CPU时间 ms | 4,776.0 | 4,510.9 | 4,410.3 | +| GPU进程CPU时间 ms | 562.3 | 583.4 | 567.7 | +| Rust宿主CPU时间 ms | 940.4 | 972.9 | 960.4 | +| 主footprint结束/采样峰值 MiB | 591.7/591.7 | 533.2/552.8 | 522.5/540.8 | +| clientHeight累计耗时 ms | 492 | 525 | 513 | +| scrollHeight累计耗时 ms | 364 | 374 | 367 | + +主要几何读取成本仍在,整体CPU/内存继续受顺序、缓存和回收影响,未建立可逆收益。**产品inert规则没有修改。** 诊断故意削弱了交互隔离,草稿/阅读位置和恢复检查通过不等于可访问性、焦点、生成中操作或远程等价。证据见该目录`metrics.json`。以上两组均为本机macOS诊断;GPU一列仍是GPU进程的CPU时间,不是GPU busy或显存。 + +### 首页热力图重复渲染候选:未建立收益,已撤回 + +检查最新main `6dfdbb78…`、该组件历史,以及开放/草稿PR列表和#3694/#3698文件差异后,确认`UsageActivityGrid`与上游相同,相关PR未覆盖该组件。仅试验React.memo跳过参数未变时的渲染;数据请求、loading状态、DOM/CSS、动画及刷新频率均未修改。38项首页/日历测试、完整check:web和Apple生产构建通过;候选`bundled-7e76770f047a90ed`,基线仍为e8。 + +`overview-grid-pilot-1`在基线首页资源窗口中出现计划外导航:起点为首页,终点变成会话,新增`workload-history-001`标签,头像动画断言因此失败。导航来源未确定,不能归为产品动画故障;候选没有启动。保留`invalid-window.json`与原始记录,不纳入收益分析。随后新增窗口起止页面检查,在新目录重跑两侧。 + +`overview-grid-pilot-2`完成一对短对照(每入口12次,三个5秒资源窗口),功能通过、速度预算未全部通过。Protocol `885b0702…`、harness `ec79c943…`。8组头像裁剪和动画几何一致,480 ms入场、隐藏焦点/命中保护、草稿和阅读位置通过,零编辑器。 + +| 短对照指标 | 基线 | 热力图候选 | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 101/111 | 101/112 | +| 会话反馈/内容P95 ms | 136/152 | 123/141 | +| 切页主WebContent CPU时间 ms | 5,796.9 | 5,846.2 | +| 切页GPU进程CPU时间 ms | 760.8 | 780.0 | +| 切页Rust宿主CPU时间 ms | 1,207.0 | 1,274.0 | +| 切页主footprint结束/峰值 MiB | 576.7/642.6 | 514.6/537.5 | +| 返回首页主footprint结束 MiB | 364.0 | 384.4 | + +没有建立整体速度/资源收益,不据一个短样本宣称稳定退化或内存改善。进一步检查发现两侧自动更新检查触发不同:候选宿主日志记录14:27:44的更新请求,基线没有对应请求。旧runner没有固定更新偏好,也没有记录窗口焦点;自动更新调度会检查document.hasFocus,额外网络和状态更新可能落入不同窗口。不能由这项差异推算它贡献了多少CPU/内存,也不将它直接定为上述数字的根因。`comparison.json`的comparable=true只代表旧版检查通过,未覆盖这些条件。 + +**已逐字恢复试验前组件,没有保留新的产品性能改动。** 源码前后快照、上游检查、构建及测试日志见`overview-grid-build/`;原始对照和汇总见`overview-grid-pilot-2/metrics.json`。 + +### 测量条件补强:自动更新与焦点 + +共享native runner在隔离测试配置中,通过生产Product Control关闭自动更新检查并读取确认,然后才等待shell/预热;记录`environment.automaticUpdateChecks=false`。没有修改用户真实配置、产品默认值、页面数据刷新或动画。这组工作负载明确不覆盖更新器性能。 + +资源快照增加document.hasFocus。场景专用runner要求导航/驻留窗口起止页面、文档可见性与焦点状态符合预期;配对runner还要求两侧对应窗口焦点一致。起止检查不能证明中途没有离开又返回,系统可信输入/合成完成时间仍未覆盖。5项测量单测通过,包括错误页面、焦点变化/缺失和隐藏文档拒绝。新harness与旧报告分开,不将更严格测量条件本身记作产品收益;用相同e8前端的A/A运行验证流程。 + +`scene-controls-aa-1`已完成两次相同e8构建的短A/A(24次切页、各3×5秒资源窗口)。Protocol仍为`885b0702…`,新harness `ad153f9a…`。双方功能、头像裁剪/几何、完整480 ms入场、隐藏交互隔离、草稿/阅读位置、零编辑器均通过。四个窗口的起止documentHidden=false、documentHasFocus=false且两侧一致;这是**文档可见但未获窗口焦点**的合成输入证据,不代表前台系统鼠标操作。双方隔离配置读回auto_update=false,原生日志均无更新检查请求。 + +| 同构建A/A校准,非优化对照 | 第一次 | 第二次 | +| --- | ---: | ---: | +| 首页反馈/内容P95 ms | 105/118 | 104/113 | +| 会话反馈/内容P95 ms | 128/143 | 121/141 | +| 切页主WebContent CPU时间 ms | 6,047.0 | 6,617.5 | +| 切页GPU进程CPU时间 ms | 862.1 | 901.4 | +| 切页Rust宿主CPU时间 ms | 1,330.8 | 1,362.2 | +| 切页主footprint结束/采样峰值 MiB | 596.4/716.3 | 559.6/578.2 | +| 静态Todos主CPU | 0.356% | 0.323% | +| 返回首页主footprint结束 MiB | 356.5 | 349.5 | + +同代码主CPU仍波动约9.4%,峰值内存波动也明显;这是两次短运行观察,不是置信区间或稳定噪声上限。不能凭小幅单对差值保留产品候选。后续验收需同一新harness、完整资源窗口和交替顺序,另补有焦点/可信输入场景;不能通过减少动画、刷新或放宽100 ms反馈目标完成验收。原始数据与`metrics.json`保存于该目录;本轮没有新增已验收的产品性能收益。 + +收尾检查:候选组件与试验前快照逐字一致;5项测量测试、相关脚本语法、git diff检查和repository hygiene通过(158内容文件/10,311文件名)。38项产品聚焦测试及check:web是在候选构建前完成,全部性能窗口中没有并行构建或测试。验证记录为`tests/e2e/reports/scene-controls-validation.json`,整体优化目标仍未完成。 + +## 首次正式驻留基线(通用Web字体):历史诊断 + +证据:`tests/e2e/reports/residency-baseline-1/result.json`。前端`bundled-526eef79e758acc5`;native SHA-256为`04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`。从首次首页检查点到最终检查点共28.73分钟。`functionalPassed=true`,`performanceBudgetsPassed=false`;`passed=true`只表示运行完成。 + +60轮共480次导航,热样本每入口59次。连续从长会话切到首页的负载与前一报告的穿插准备动作不同。 + +| 入口 | 热反馈P95 ms | 热内容P95 ms | +| --- | ---: | ---: | +| 首页 | 192 | 227 | +| 待办 | 114 | 135 | +| Agents | 119 | 153 | +| Assistant | 103 | 122 | +| MiniApps | 114 | 131 | +| Skills | 109 | 138 | +| Insights | 105 | 119 | +| 长会话 | 176 | 206 | + +CPU为窗口内累计时间/单调墙钟,100%为一核;内存为physical footprint结束值,单位MiB。v1没有原生WebView→PID映射,下表仅按大小区分两个WebContent,**不把较小进程未经验证地命名为桌宠**。 + +| 资源窗口 | 较大WebContent CPU / footprint | 较小WebContent CPU / footprint | GPU进程CPU / footprint | Host CPU / footprint | +| --- | ---: | ---: | ---: | ---: | +| 首页驻留180秒 | 1.04% / 470.3 | 1.51% / 117.3 | 0.29% / 652.3 | 3.34% / 102.3 | +| 待办驻留180秒 | 0.88% / 456.6 | 1.40% / 117.8 | 0.32% / 652.2 | 2.95% / 102.3 | +| 主窗口隐藏600秒 | 0.77% / 506.2 | 1.26% / 172.8 | 0.34% / 103.6 | 2.73% / 109.0 | +| 恢复首页180秒 | 1.13% / 529.3 | 1.87% / 182.5 | 0.31% / 125.5 | 4.29% / 110.4 | +| 关闭页面后180秒 | 0.44% / 503.0 | 1.94% / 191.9 | 0.31% / 105.9 | 4.08% / 110.3 | + +观察与下一步归因: + +- 第6至60轮,DOM稳定在3341,保留场景9个,WebDriver句柄11个,只读逻辑缓存账本约0.162 MiB。关闭后DOM1490、场景1个。没有在这个有界循环中观察到DOM线性增长;账本不是全部JS内存。 +- GPU进程footprint检查点从第1轮352.4 MiB逐步增至第36轮1084.2 MiB,第41轮降至289.1 MiB,之后再次增长。静置仍保留约652 MiB,隐藏后降至103.6 MiB。可确认周期性积累与回收,不能写成持续泄漏或应用GPU利用率下降。需要逐场景隔离生成这些资源的来源。 +- 较小WebContent从首页驻留后的117.3 MiB增至最终191.9 MiB,尚未确认归属及是否达到稳定上限。不能用主窗口资源下降掩盖这个增长。 +- 隐藏阶段仅隐藏主窗口,不声称所有伴随窗口都已隐藏。关闭场景也不等于用户要求终止所有后台任务或PTY。 +- 草稿内容、编辑器内容和阅读锚点均保留;阅读偏移前后均为−795.28125 px。 + +## 生成中并发操作:首个正式基线 + +证据:`tests/e2e/reports/concurrent-apple-baseline-1/result.json`。协议v2,Apple前端及native与上面的驻留基线一致;相同资源适配器和窗口外WebView归因。模型响应来自loopback SSE fixture;实际Agent dispatcher执行4个ExecCommand和4个Edit,输出600段Markdown(初始250段,随后每90 ms一段)。只关闭测试中无关的标题/欢迎分析/提示建议AI请求,没有关闭产品动画、正常数据刷新或工具执行。 + +`functionalPassed=true`、`performanceBudgetsPassed=false`。24次分块输入的文字完全保留;滚动接管后,新增输出、切页和两种分栏拖动均保持原阅读行,偏移误差不超过1 px。600段输出及完成标记真实落盘,4个文件修改成功,8个工具结果无错误。第二会话在第120段取消,43 ms后取消控件消失,SSE连接中断且段数不再增加,草稿保留。 + +| 阶段 | 帧间隔P95 ms | 最大帧间隔 ms | +| --- | ---: | ---: | +| 工具启动 | 139 | 139 | +| 首批输出 | 21 | 62 | +| 输出中输入 | 27 | 47 | +| 输出中滚动 | 20 | 30 | +| 阅读保持 | 19 | 27 | +| 输出中切页 | 35 | 81 | +| 导航分栏拖动 | 29 | 50 | +| 内容分栏拖动 | 24 | 55 | +| 回到最新并完成 | 20 | 97 | +| 取消 | 29 | 29 | + +输入事件到下一RAF的P95为16 ms、最大23 ms;这不是键盘到最终像素的端到端延迟。三次导航分别是首页58/142 ms、待办59/94 ms、会话66/85 ms(反馈/内容),每入口仅一次,不能称为目的页P95。会话重入的就绪点是活动场景中的输入框与已有会话可用,生成期间允许busy状态继续;不等待模型结束来判页面就绪。 + +四个静置窗口均稳定5秒后采样30秒;CPU为一核百分比,footprint为窗口结束MiB。 + +| 窗口 | 主窗口CPU / footprint | 桌宠CPU / footprint | GPU进程CPU / footprint | Host CPU / footprint | +| --- | ---: | ---: | ---: | ---: | +| before-generation | 0.55% / 413.6 | 1.59% / 85.5 | 0.33% / 68.8 | 2.78% / 105.9 | +| after-completion | 1.26% / 529.1 | 2.11% / 122.2 | 0.44% / 87.0 | 4.07% / 125.3 | +| after-cancellation | 11.09% / 481.2 | 1.83% / 122.9 | 0.73% / 80.6 | 7.05% / 127.3 | +| after-close | 0.86% / 460.9 | 1.88% / 122.5 | 0.32% / 80.4 | 3.79% / 120.1 | + +固定输出与并发操作共32.90秒,主窗口平均CPU 66.74%,采样峰值footprint 902.3 MiB。GPU进程CPU、系统AGX与应用GPU busy仍分列,不能替代真实JS堆或显存。 + +取消后的主窗口CPU约11%持续整个30秒窗口,2秒分段CPU增量均明显非零;同时存在一个1800 ms周期、位于会话中的运行中Spinner动画。原探针的`checkVisibility({checkVisibilityCSS:true})`未检查祖先透明度,不能据其`visible=true`断言动画实际可见。该关联尚不能证明动画是唯一原因,下一次诊断记录其DOM归属与祖先透明度,区分未结束状态和绘制成本。关闭会话后主窗口CPU回落到0.86%。不能以取消控件消失就宣称所有后台工作归零。 + +`cancellation-apple-diagnostic-1`已完成独立诊断:8个实际工具执行通过,输出至121段时取消,UI取消反馈61 ms,连接断开且活动流式文本块为0。5秒稳定后采样30秒,主WebContent CPU为11.36%、结束footprint405.3 MiB;Host为7.19%、122.8 MiB,GPU进程为0.72%、72.6 MiB。窗口外DOM归因确认:唯一仍运行的1800 ms动画属于`runtime-status-slot--footer`中的Spinner;根节点`data-runtime-status-visible=false`、`aria-hidden=true`,内容祖先`opacity=0`。因此已证实完全透明状态槽中仍有无效动画,但尚未通过去除该工作后的A/B证明它解释了全部额外CPU。 + +对应当前main实现仍给常驻槽传入默认激活的`Spinner`;按组件名与症状搜索开放PR未返回匹配项。下一修复需保留现有140 ms透明度退出/160 ms位移过渡和快速重新显示,等可见退出结束再停止内部动画;不能立即取消可见退出,也不能以移除状态槽改变布局。诊断脚本和透明度探针语法检查通过。此诊断的操作序列不同于600段并发基线,不混算优化收益。 + +### 常驻状态槽的隐藏动画修复 + +刷新main仍为`d6a640fcc`;其组件仍默认激活常驻Spinner,开放PR的`spinner`检索未返回匹配项。修复只在`FlowChatRuntimeStatus`控制内部装饰性播放:首次隐藏不启动;可见时保留原1800 ms循环;退出时等待内容元素自己的CSS过渡完成或取消,再关闭循环;重新显示会撤销旧退出清理。状态槽、文字、140/160 ms过渡、业务状态、刷新和模型事件均不改动。 + +组件生命周期与既有RuntimeStatusSlot共7项测试通过;品牌/Spinner/registry共13项测试通过,`check:web`通过,motion inventory未发现重复全局关键帧。生产快照为`bundled-e0abee1cd74b5ef3`;其对照`bundled-dbc4d804ffc0d911`具有相同首页候选,避免将图层保留的差异算作Spinner收益。 + +`runtime-status-cancel-baseline-3`与`runtime-status-cancel-optimized-1`使用完全相同协议、harness、native和环境:固定120段后取消,状态退出诊断在资源窗口外,稳定5秒后采样30秒。原生过渡前后均保留可见退出中的播放,采到12/13个退出帧;24 px槽高最大浮点偏差约0.000008 px。取消反馈62→40 ms,取消后运行中动画1→0。 + +| 进程 | CPU一核% 前→后 | 结束footprint MiB 前→后 | +| --- | ---: | ---: | +| 主WebContent | 9.43→4.83 | 406.6→445.4 | +| 桌宠WebContent | 1.90→1.47 | 75.8→76.6 | +| GPU进程 | 0.73→0.59 | 77.3→74.3 | +| Host | 7.19→4.65 | 115.9→118.6 | + +这是单对诊断,支持隐藏动画确有持续CPU成本,但主窗口仍约4.8%,且结束footprint较高,不能宣称资源目标全部达成。协议v3将取消场景也固定为120段,仍保持流连接未结束,消除轮询时机造成的输出量差异;新增成对runner交替AB/BA并校验协议、harness、native和环境。 + +### 完整并发A/B:资源改善与未通过的速度门槛 + +`runtime-status-concurrent-pair-4`完成一对完整运行,使用相同前端对照/候选、native、环境、协议及harness。协议v4在刷新后等待实际新文档,使用工作区卡片的真实右键菜单,并将进程归因安排在预热及稳定期后;没有放宽归因阈值。协议hash为`bb96f904b454f0d35bccbf3fea9c949c9e0426e2d4d5cdb2772cb5961960b91c`,harness hash为`9a2ba670d4e88ee4daa6445097be061ab04d1ee9a047163aeb27a29aa4405355`。原始报告及`comparison.json`保留在该目录。 + +双方`functionalPassed=true`,完成600段输出、8个真实工具、输入/阅读/切页/双分栏、固定120段取消及关闭检查。`comparable=true`,但双方`performanceBudgetsPassed=false`,因此成对runner以失败状态结束;这是速度门槛失败,不是将失败运行隐藏为通过。 + +| 操作 | 对照 | 候选 | +| --- | ---: | ---: | +| 工具启动帧P95/最大 ms | 98/98 | 151/151 | +| 生成中输入→RAF P95/最大 ms(各24样本) | 16/22 | 15/21 | +| 生成中导航帧P95/最大 ms | 31/93 | 28/72 | +| 导航分栏帧P95/最大 ms | 29/49 | 28/47 | +| 内容分栏帧P95/最大 ms | 24/41 | 23/35 | +| 取消反馈 ms | 41 | 39 | +| 取消阶段帧P95/最大 ms | 29/29 | 35/35 | + +三次导航的反馈/内容均在100/150 ms内,但单目的地一次点击不是P95。候选工具启动超过100 ms上限,取消阶段超过34 ms帧P95门槛;保留原门槛,不将输入与取消反馈通过等同于全部流畅。单对结果也不足以归因工具启动差异或证明长期速度不回退。 + +下表为5秒稳定后的30秒窗口,CPU为单核百分比,内存为结束physical footprint;GPU进程指标仍不等于应用GPU busy/显存。 + +| 窗口/进程 | CPU % 前→后 | footprint MiB 前→后 | +| --- | ---: | ---: | +| 生成前/主WebContent | 0.83→0.82 | 311.8→314.0 | +| 正常完成/主WebContent | 1.16→0.65 | 443.8→446.8 | +| 取消后/主WebContent | 11.28→4.69 | 352.0→347.2 | +| 取消后/桌宠WebContent | 1.88→1.41 | 83.5→111.9 | +| 取消后/GPU进程 | 0.73→0.63 | 79.4→81.5 | +| 取消后/Host | 7.12→4.65 | 127.4→120.1 | +| 关闭后/主WebContent | 0.85→0.90 | 346.2→327.3 | + +取消后运行中动画1→0,主CPU下降约58%,与独立淡出诊断方向一致;但仍约4.7%,关闭会话才回落到约0.9%。桌宠footprint反向增加约28 MiB,GPU进程footprint也略高,不宣称整体内存改善。下一步对剩余CPU做窗口外原生栈诊断,并补重复对照;首页图层保留在双方快照中相同,本结果不构成其验收。 + +后续`runtime-status-cancel-stacks-1`复现取消后30秒主CPU 4.57%、结束footprint374.4 MiB,状态退出11帧保留原播放,功能检查通过。窗口之后另取20秒原生栈:主线程多数样本处于RunLoop等待,同时可见定时器/IPC和回收工作,没有取得足以归因剩余CPU的单一热点。该栈与前述CPU不在同一时间窗,不能把等待样本比例直接换算为CPU或据此判定前一窗口已空闲;诊断尚未形成新的产品修改。 + +随后两次独立回调诊断`runtime-status-cancel-callbacks-1/2`都完成120段输出取消及退出动画检查。5秒稳定+30秒采样期间,`useFlowChatFollowOutput`的RAF分别执行2,105/2,106次,约60次/秒。第二次进一步只读记录原生scrollTop写入/回读:2,107次写入中2,094次没有改变位置;稳定末段`scrollHeight=31389`、`clientHeight=781`,目标为30608,实际位置为30606。反复写入30606.41–30606.48仍回读30606,留下2px差距,继续唤醒RAF。该证据指向缓动末段被原生滚动坐标量化后无法收敛,优先修复方向应是实际写入/回读的收敛,而不是停掉正常跟随、放宽阅读锚点或降低刷新频率。 + +两次带探针主CPU为4.80/4.83%;回调本体累计97/101 ms不足以解释全部CPU,不能直接宣称该循环贡献全部开销。包装函数、MutationObserver及几何回读会增加开销,以上仅用于定位;尚未修改follow产品逻辑,也没有其优化A/B。探针会恢复原函数,不更改滚动目标;观测开始前已经注册的重复定时器不在回调统计内。 + +### 滚动缓动量化收敛候选 + +上述诊断之后,`useFlowChatFollowOutput`保留自己的已接受写入中尚未被原生坐标表达的小数位移,下一帧继续原有时间缓动。它只在实际回读仍匹配自己的前次写入时沿用;其他滚动/原生clamp、写入被更高优先级拒绝、新显式进入和暂停都会重新使用实际位置。目标、缓动常数、snap阈值、可见动画与刷新频率不变;虚拟列表继续接收实际回读。 + +新增9项行为检查先在旧实现失败,修复后连同跟随/viewport owner/leading extent/resize共69项通过,覆盖16/5 ms帧间隔、1/0.8 px量化、正反向坐标、单调缓动、结束后休眠及拒绝期间不累积虚假移动。`check:web`、motion inventory、Apple生产构建通过。候选前端为`bundled-86fd30e6a6cea9be`,2,728文件、71,890,240 bytes;未更改native。 + +`follow-quantization-callbacks-1`真实取消诊断功能通过,退出动画11帧持续播放、槽位仍24px。与同版探针`runtime-status-cancel-callbacks-2`相比,约35.1秒观测中的follow RAF 2,106→25次,scrollTop写入2,107→16次,已结束无进展循环。30秒窗口主CPU 4.83%→1.17%,GPU进程CPU 0.60%→0.34%,Host CPU 4.66%→2.81%;主footprint 378.4→448.1 MiB,不能声称内存改善。这是单次带探针对照,只证明根因路径已改变;其后完成的无探针三对并发比较见下节。 + +完整成对测量前的三次失败全部保留:`pair-1`在第二会话刷新时误用旧文档就绪状态;`pair-2`等待产品刻意隐藏的overflow按钮,改用真实工作区右键菜单;`pair-3`在后台初始化尚未稳定时CPU脉冲归因差距不足阈值,明确失败。v4调整归因时机,未降低识别标准。这些运行未完成全部场景,不作为完整性能对照。 + +失败记录保留:`runtime-status-cancel-baseline-1`的回环响应快于产品1000 ms状态提示延迟,没有覆盖实际淡出,不计通过;随后退出诊断明确加入1800 ms模型响应等待,正式并发协议不加此等待。`baseline-2`因将24 px与23.999992 px的原生浮点结果做严格相等比较而中止;改为0.001 px数值精度容差后重新完整运行,没有放宽交互速度或动画体验门槛。 + +预演`concurrent-apple-pilot-1`因通用页面就绪判定把生成中的busy状态当作加载未结束而失败,保留证据且不计入覆盖;修正后的`pilot-2`功能通过,但2秒静置只验证流程。固定输出fixture及字体配置guard的3个聚焦测试通过。本节仅证明本地单会话输出中的组合操作;并发多会话、外部模型网络、真实远程及其他平台仍未覆盖,也未完成全部优化验收。 + +## 滚动量化修复:三对正式并发比较 + +证据:`tests/e2e/reports/follow-quantization-concurrent-pairs/comparison.json`及六个运行目录。顺序AB/BA/AB;baseline为`bundled-bbfcb3aba1defd11`,candidate为`bundled-86fd30e6a6cea9be`。同一native SHA `04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`,同一Apple字体、viewport、硬件、协议与harness;协议hash `bb96f904b454f0d35bccbf3fea9c949c9e0426e2d4d5cdb2772cb5961960b91c`,harness hash `9a2ba670d4e88ee4daa6445097be061ab04d1ee9a047163aeb27a29aa4405355`。使用完成的独立构建,测量期间没有并行构建或测试,也没有callback诊断包装器。 + +六次均完成600段输出、4次真实命令、4次真实文件编辑、24次输入、阅读接管、切页、两处分栏拖动、返回最新、完成、固定120段取消与关闭检查。六次`functionalPassed=true`,六次`performanceBudgetsPassed=false`;比较器`comparable=true`、`passed=false`,退出码1表示速度预算未全部通过,没有把它改成成功。 + +取消后资源窗口每次30秒、先稳定5秒。下面是每侧3次的中位数(最小–最大),CPU 100%为一个逻辑核;footprint为各窗口末MiB。 + +| 取消后的角色/指标 | baseline | candidate | +| --- | ---: | ---: | +| 主WebContent CPU % | 4.39(4.18–4.63) | 0.93(0.93–1.12) | +| 主WebContent package idle wakeups/秒 | 44.59(43.49–44.62) | 7.03(5.86–7.03) | +| GPU进程 CPU % | 0.64(0.62–0.64) | 0.37(0.36–0.38) | +| Host CPU % | 4.62(4.59–4.65) | 2.76(2.75–2.78) | +| 主WebContent footprint MiB | 442.16(320.31–487.03) | 393.13(315.58–410.02) | +| GPU进程 footprint MiB | 80.49(77.67–80.69) | 80.67(79.08–81.21) | +| Host footprint MiB | 126.41(126.19–129.27) | 126.11(124.70–128.64) | + +取消后主CPU中位数降低约78.8%,GPU进程CPU约41.3%,Host CPU约40.1%;三对方向一致,与独立诊断中的末段RAF空转消失相符。GPU进程CPU不是GPU硬件利用率。主内存逐对为442.2→315.6、320.3→410.0、487.0→393.1 MiB,第二对反向且启动前内存本身有差异,不能据中位数下降就宣称内存优化。 + +其他30秒窗口的主CPU中位数(范围):生成前0.86(0.50–0.95)→0.80(0.79–0.85)%,关闭后0.84(0.80–0.85)→0.82(0.78–0.82)%;**正常完成后0.64(0.60–0.94)→1.07(0.67–1.12)%**。后者有上升,需继续归因,不能把取消后的收益推广为所有静置场景均改善。 + +下表为每次运行帧P95的最小–最大,以及三次中最大的单帧;不混合不同操作来稀释慢帧。 + +| 操作 | baseline 帧P95/最大 ms | candidate 帧P95/最大 ms | +| --- | ---: | ---: | +| 工具启动 | 34–143/143 | 82–157/157 | +| 首批文本 | 19–21/47 | 21–23/47 | +| 生成中输入 | 22–25/43 | 22–24/46 | +| 生成中阅读滚动 | 20–23/33 | 19–21/32 | +| 生成中切页 | 25–30/86 | 26–27/93 | +| 导航分栏拖动 | 26–28/48 | 26–28/61 | +| 内容分栏拖动 | 22–23/48 | 23/50 | +| 返回最新并完成 | 19/69 | 19/75 | +| 取消 | 33–41/41 | 24–34/34 | + +工具启动每次仅18–20个帧间隔;取消仅5–8个,不能将它们的P95视为大量重复动作的稳定估计。保留所有慢帧:候选第三次启动157 ms超出最大100 ms底线,第二次取消34 ms未达到严格小于34 ms门槛。生成中输入到RAF P95逐次为17/18/13→15/18/19 ms,每次24个输入;取消反馈38/38/39→43/38/45 ms,均在100 ms以内。候选的三次首页内容就绪为150/139/130 ms,待办104/90/96 ms,会话87/73/90 ms,每入口每次只点击一次,不替代长驻留热切换分布。 + +阅读滚动的慢帧比例候选三次均为0;但输入最高2.31%、生成中导航3.82%、返回最新1.96%,尚未全部达到慢帧低于1%的进阶目标。现阶段接受“消除取消后的确定性空转”这一局部修复;整体优化目标仍未完成。终端只读诊断是在两份构建完成后新增的,不在本组A/B快照内。 + +### 无编辑器并发协议与独立归因 + +按用户要求,后续并发v5不再打开文件编辑器:通过真实工作台按钮打开空的右侧画布,保留四次ExecCommand和四次Agent Edit对隔离文件的真实执行;资源窗口起止检查Monaco编辑器DOM节点数为0。切页与取消改为PointerEvent+MouseEvent完整序列、pointerdown起算,切页观察700 ms,与场景测量一致。v4含编辑器且click起算,不能与v5直接计算产品收益。配对比较进一步核对窗口起止的可见页面、焦点及同侧构建digest;起止快照不能证明全窗口焦点不变。 + +`concurrent-no-editor-baseline-1`完成生成、输入、阅读位置保持、切页、双分栏、完成和取消,但最终关闭标签时失败:旧测试辅助方法点击了hover前隐藏的关闭图标,严格指针路径拒绝该目标。它仍是`functionalPassed=false`的未完成记录,不能当作正式通过。辅助方法现改为选择可见标签后发送产品已有的Delete快捷键,不绕过SceneBar关闭处理。该次工具启动帧P95/最大41/107 ms,输入帧P95/最大38/72 ms;完成后资源窗口还出现焦点起止不一致,不能用于同条件资源对照。 + +独立诊断`tool-startup-no-editor-diagnostic-1`已完成三个新文档/真实会话,每次8个工具、120段输出、持久化及草稿保留检查,编辑器DOM节点均为0。构建`bundled-e8c537a1f8dc3557`,协议hash `60d812a7b44891898c3617d872eb9d5427b7345afbd2498d274cc48d1e3a20f3`、harness hash `a196515cea9c4267538e7d0d4d8c8de5b78d9161eb597ac015a9bfd4488e4b1a`。原始调用栈、几何读取、回调与进程样本在该目录,汇总为`metrics.json`。 + +完成后先稳定5秒、再采样30秒,三个窗口均为文档可见、起止未获焦点。下列值含回调观测开销,三个文档共享原生进程年龄和缓存,**只能归因,不作为未插桩A/B收益**。 + +| 完成后指标 | 文档1 | 文档2 | 文档3 | +| --- | ---: | ---: | ---: | +| 主WebContent CPU % | 0.89 | 0.38 | 0.69 | +| GPU进程 CPU % | 0.54 | 0.25 | 0.23 | +| Host CPU % | 2.93 | 2.33 | 2.31 | +| 主WebContent末footprint MiB | 406.1 | 443.8 | 561.6 | +| 跟随RAF调用数(含5秒稳定段) | 28 | 35 | 33 | + +未重现每帧持续执行的跟随空转;仍有正常Git/宿主轮询,不能据此称完成后的全部后台工作都已消除。内存随文档/进程年龄变化,缺少对象保留链,不能判定泄漏或宣称回收改善。 + +工具启动诊断定位到`TimelineMutationBoundary.getSnapshotBeforeUpdate`在条目结构未变化或不应修复阅读位置时,仍先读取`clientHeight`。三个周期记录到该调用栈的慢读取8/4/4次,耗时合计16/7/4 ms。原生栈也包含样式与布局工作,但getter会承担此前DOM写入的待处理成本,不能把其耗时等同于该函数自身成本;开启原生采样和包装器后的178–428 ms最大帧也不能与普通E2E长帧直接比较。 + +`timeline-snapshot-pilot-1/baseline-1`随后完整通过v5功能检查,包括修正后的标签关闭;速度预算未通过,工具启动出现171 ms长帧。其完成后窗口再次为焦点true→false,比较器因此退出1、`comparable=false`,没有运行候选侧。不能把这次失败解释为候选回归,也不能忽略焦点差异来计算资源收益。 + +针对上述测量条件,v6在各空闲窗口的5秒稳定段之前,以及取消动作开始前,通过原生window和webview API聚焦主窗口并读回验证;记录调整前状态,比较窗口起止还要求原生窗口与文档均获焦点。该操作只在测试环境中设定前台测量条件,不修改产品代码或刷新机制。v6与v5/历史后台窗口分开记录;仍不将起止检查说成连续焦点证明。 + +`timeline-snapshot-pilot-2/baseline-1`的v6功能仍完整通过、速度未通过,但前台条件未保持:生成前窗口从原生/文档均获焦点变为均失焦,工具启动在失焦状态发生。比较器据此拒绝、未运行候选。独立读取系统前台状态时为Codex;这只证实当时的环境状态,不确定每次焦点转换由哪个事件触发。 + +当前v7撤去强制聚焦,明确测量“主窗口可见但原生窗口/文档均未获焦点”:在动作及空闲稳定段之前等待真实状态符合条件,记录等待时长;增加不含轮询的focus/blur/visibility事件观察,除了原生与文档起止状态,还拒绝观察到的中途焦点/可见性变化。它不能证明持续前台工作负载的性能,前台环境仍需独立受控验证。未更改任何产品的焦点、动画、刷新或运行机制。 + +### 时间线提交前几何读取候选:未建立整体收益,撤回 + +修改前刷新main至`6dfdbb784a1a68f7b86a97f57619ed003fb653e7`:`TimelineMutationBoundary.tsx`与main逐字节相同,最近相关提交为`71bc498a2`;重新检查全部开放/草稿PR清单,并查看#3694与#3004的文件差异,没有覆盖此处提交前快照的资格判断。核对保存在`timeline-snapshot-build/upstream-check.json`。 + +候选把条目键相等、历史前插和阅读位置修复资格判断放到`clientHeight`读取之前。新增用例在原实现上4项失败、2项通过;候选连同现有阅读交互及跟随测试共62项通过,类型检查与Apple字体生产构建通过。归一化Vite文件名hash后,构建仅`TimelineMutationBoundary`代码块内容变化,体积保持71,892,547 bytes;未改动画、几何或数据刷新策略。 + +`timeline-snapshot-pilot-3`执行完整v7基线/候选各一次,600段输出及120段取消,四个30秒空闲窗口,未开启布局读取包装器或原生栈采样。基线`bundled-e8c537a1f8dc3557`,候选`bundled-57ab6a0df1e65475`;同一native SHA `ec3205e982d4e086824ba67e608312bf1a8532818242e95e5082094fdb46c4a3`,协议hash `037f04c1151d54eb22175b03e7cd2c5d542deea73f180cb557d15c4f06d02135`、harness hash `36cab6ac7318d449e2692a91b3bf3aa4c6c70c05a5dc69dc254b71a74ba2822c`。 + +两次`functionalPassed=true`、`performanceBudgetsPassed=false`。v7基线全部窗口满足焦点条件;候选正常完成后的观察在第18.123秒进入焦点、第19.815秒离开,起止快照却都为false。事件观察发现了仅看起止会漏掉的1.692秒变化,比较器正确返回`comparable=false`/退出1;**整组不作为正式A/B验收**,尤其不比较该完成后窗口的CPU变化。 + +以下是焦点条件一致的操作阶段的单对诊断值,不代表重复测量中的稳定收益或回归: + +| 指标 | 基线 | 候选 | +| --- | ---: | ---: | +| 工具启动总耗时 ms | 432.5 | 556.4 | +| 工具启动帧P95/最大 ms | 154/154 | 84/102 | +| 工具启动主WebContent CPU时间 ms | 570.7 | 662.8 | +| 工具启动GPU进程CPU时间 ms | 37.7 | 47.5 | +| 生成并发阶段主WebContent CPU时间 ms | 19,297.7 | 19,915.1 | +| 生成并发阶段GPU进程CPU时间 ms | 6,741.4 | 6,918.7 | +| 输入帧P95/最大 ms | 22/34 | 24/40 | +| 返回最新并完成帧P95/最大 ms | 20/75 | 22/110 | +| 首页内容就绪 ms(各一次) | 137 | 169 | +| 取消反馈 ms | 56 | 42 | + +稳定焦点窗口中的内存也未支持优化:主WebContent生成前末footprint为277.4→290.8 MiB,取消后464.2→667.1 MiB,关闭后469.5→756.7 MiB;Host生成前已为107.3→167.3 MiB,说明初始状态本身存在资源差异,不能把这些差异全部归因于候选。取消后主/GPU进程/Host CPU为0.40/0.11/1.24→0.41/0.24/2.47%,各窗口逐进程的CPU、唤醒、起止/峰值footprint见`metrics.json`。原始无效窗口仍保留且单独标记。 + +结论:减少该处读取并未建立整体收益,工具启动及返回最新仍超过100 ms最大帧底线,首页就绪在候选中超过150 ms。候选产品源码已逐字节恢复,候选和测试快照留在`timeline-snapshot-build`,不保留未验收产品改动。保留无编辑器协议、真实Delete关闭路径、原生焦点快照和焦点事件校验;7项测量判定测试覆盖起止及中途条件变化。后续仍需定位工具启动的实际CPU工作,并补齐受控前台结果,不能通过放宽门槛或忽略失焦完成验收。 + +### 工具启动独立原生采样:不再混入几何getter包装器 + +诊断协议v2默认关闭布局读取包装器;需要定位几何读取调用点时才显式设置`OPENBITFUN_TOOL_DIAGNOSTIC_LAYOUT_READS=1`,两种模式不能混合比较。`tool-startup-native-only-diagnostic-1`已在恢复后的`bundled-e8c537a1f8dc3557`上完成三个周期,每周期8次真实工具、120段输出、持久化和草稿检查通过、无编辑器DOM节点。协议hash `cf735a4f4bb400e7ec51238952b1531a0a927ee87cff73fba3a0aa21552ff8f1`,harness hash `6d5adfc1d385b27d24883ce23dbf85cd86c8ae8af79873d774a9df02b53de021`。 + +三个原生栈样本均出现Flex布局、样式匹配、JSC JIT编译、GC/对象遍历和未符号化调用帧。这证明启动期间存在这些类别的工作,**不证明其CPU占比或对应某个React组件**;文本采样的递归栈计数不能相加当成耗时百分比。带原生采样的工具阶段耗时656.1/555.5/559.4 ms,最大帧390/405/311 ms,仍受采样扰动,不能替代普通E2E的速度结果。 + +完成后回调观察中的跟随RAF为28/31/34次(含5秒稳定段),主WebContent CPU为0.64/0.40/0.49%,未见持续60fps空转。该结果不包含前台控制或正式资源A/B验收,且原生进程/缓存跨三个文档延续。详细类别、原始栈文件引用、帧及进程数据保存在该目录`metrics.json`。下一步应细分工具状态集中到达时的组件提交、布局与初始化工作;不继续仅凭单个getter耗时选择优化。 + +### 同步工作归因与滚动状态回读候选:CPU下降、内存反增,撤回 + +单独的构建期插桩覆盖 store/工具事件/时间线投影/容器/虚拟列表与部分工具卡共11个文件、270个同步函数和回调。正常产品构建不包含插桩。每轮使用新文档,执行4个真实ExecCommand和4个真实Edit,输出80→120段、间隔90 ms,核验持久化首尾及完成标记、草稿保留和零Monaco实例。三轮共享原生进程与缓存;不启用原生采样或几何getter包装器。 + +原始诊断`tests/e2e/reports/sync-work-diagnostic-1/result.json`三轮功能通过。约3.9秒输出窗口内,`VirtualMessageListSession`渲染473/471/461次,虚拟器`requestRender`调用472/472/461次,位置回读217/217/211次;store通知仅22/21/21次。按行号核查,标为`useFlowChatVirtualizer:cleanup`的217/217/212次实际是传给offset observer的回调,**不是217次卸载清理**。插桩时钟会增加开销;调用次数用于定位,不能替代无插桩性能验收,inclusive与self耗时也不能直接求和。 + +发现回读路径以`callback(actualOffset, false)`避免React提交内嵌套`flushSync`,却同时将TanStack的`isScrolling`改为false。随后的native scroll又将其改为true;该库以滚动状态和可见范围共同决定通知,造成同一范围反复渲染。候选保留真实滚动状态,单独用当前回读调用栈控制React同步刷新。实际位置和范围仍立即发布,原生滚动、缓动、用户接管、测量与数据节奏保持原有路径。 + +- 上游检查:刷新至main `4876f186460009be49ffab94b19ba134b7f569b5`,该实现与本地修改前相同;扫描23个开放PR(含草稿),无虚拟器变更。审查#3004(已结束文本缓存)、#3694(原生启动/IPC投递)和#3771(GenUI修复)相关diff,没有覆盖此回读状态问题;记录于`virtualizer-readback-build/upstream-check.json`。 +- 两项新增回归在旧实现失败,分别出现2次/1次多余提交;修正后虚拟器与follow共109项测试、类型检查通过。源码聚焦lint零错误;测试文件按现有eslint配置被忽略,不计为已lint。 +- 无插桩候选为`bundled-8f7e58056e215533`,基线仍为`bundled-e8c537a1f8dc3557`。去除资源文件名哈希并保留重名chunk分组后,仅`TimelineMutationBoundary`代码包内容变化;没有改变其他页面资源。 +- 候选插桩构建`bundled-fcd4413551aa0b99`三轮功能通过,时间线渲染降至128/124/121次(约−73%),虚拟器通知降至53/51/51次。工具启动阶段仍有71–76次时间线渲染,不能宣称已解决工具启动长帧。原始证据`sync-work-readback-candidate-2/`,提取对照`virtualizer-readback-build/sync-work-comparison.json`。首次候选诊断因未生成frontend revision在启动前失败,日志保留,不计通过。 + +上述渲染计数是render函数执行次数,不是React提交数或原生绘制数。正式对照使用无插桩v7、250→600段、30秒稳态窗口、相同原生二进制、三组交替AB/BA;覆盖输入、阅读接管、导航、面板拖拽、跳至最新、完成、取消和关闭。六次功能检查和42个窗口条件检查全部通过,无编辑器实例,输出/草稿/阅读位置与拖拽恢复检查通过。协议哈希`037f04c1151d54eb22175b03e7cd2c5d542deea73f180cb557d15c4f06d02135`,脚本哈希`4c59eeaf2d076e091e96cad6a4fa124c784d3f4aaa4ee8def4b2027ea855376a`。`comparison.json`为`comparable=true, pilot=false, passed=false`:比较有效,速度目标未全部通过,不是采样失败。 + +以下是每侧三次运行的中位数;帧指标是每次P95的中位数,不是混合原始样本重新计算的P95。GPU进程CPU不代表GPU busy或显存。 + +| 指标 | 基线 | 候选 | 判断 | +| --- | ---: | ---: | --- | +| 完整生成窗口主WebContent CPU时间 | 19.197 s | 17.823 s | −7.2%;三对分别−7.2%/−6.7%/−10.7% | +| 同窗口宿主CPU时间 | 3.447 s | 3.326 s | −3.5% | +| 同窗口GPU进程CPU时间 | 6.223 s | 6.165 s | −0.9%,接近持平 | +| 同窗口结束主WebContent footprint | 885.2 MiB | 850.5 MiB | −3.9%,不代表后续回收改善 | +| 同窗口结束GPU进程footprint | 105.5 MiB | 107.4 MiB | +1.8% | +| 输入到RAF P95 | 20 ms | 14 ms | 通过输入反馈门槛;不是按键到像素 | +| 导航/内容分栏帧P95 | 25/26 ms | 28/27 ms | 仍通过34 ms门槛,未改善 | +| 工具启动帧P95 | 98 ms | 92 ms | 仍未通过;候选最大帧92/88/115 ms | +| 取消反馈 | 39 ms | 39 ms | 持平;取消阶段帧P95 32→34 ms,未全过门槛 | +| 正常完成后主WebContent footprint | 486.9 MiB | 483.2 MiB | 接近持平 | +| 取消后主WebContent footprint | 440.5 MiB | 472.1 MiB | +7.2% | +| 关闭后主WebContent footprint | 477.5 MiB | 551.0 MiB | +15.4%,不满足资源不恶化目标 | +| 关闭后相对各自初始主内存增量 | 172.0 MiB | 240.9 MiB | +68.9 MiB;未建立回收改善 | + +首页三次内容时间186/133/176→131/137/134 ms,待办105/108/119→104/85/102 ms,会话80/74/62→74/62/66 ms;每入口每次只有一个样本,这不是目的页面的可靠P95。可见的速度收益不能抵消资源反向指标。 + +关闭后的主内存原始值为573.8/471.5/477.5→679.9/448.5/551.0 MiB。扣除各自初始窗口后,三对增量差约+83.1/+0.05/+68.9 MiB,不能仅用初始状态不同解释。六次关闭窗口的驱动元素句柄均已清零;基础快照已经释放脱离DOM的驱动引用,不把此结果归咎于未清理句柄。取消/关闭后空闲CPU仍在低位,主CPU中位数分别0.55%→0.60%、0.59%→0.49%;这也不能证明多出的内存已回收。当前数据不足以断言产品泄漏或GC保留链,**但足以拒绝将此候选验收为综合资源优化**。 + +已撤回本候选的产品代码、两项新增测试及对应owner文档段落,恢复源码与修改前逐字节一致;恢复后107项虚拟器/follow测试通过。保留独立插桩工具、源码/测试快照和所有证据,避免下次重复同一试验。原始对照、可重算的`summarize.mjs`与`metrics.json`位于`tests/e2e/reports/virtualizer-readback-pairs-1/`;候选源码、构建、回归及上游检查位于`virtualizer-readback-build/`。后续先解释关闭后内存反向指标,再评估保持现有滚动状态语义的通知去重方案;不降低输出频率、动画或操作体验。持续前台和四类真实远程路径仍未覆盖。 + +## 编辑器重负载:完整代码文件基线及预演记录 + +新增原生runner使用6个真实TypeScript文件:2个30,003行(各1,946,716 bytes)、4个8,003行(各500,716 bytes),共5,896,296 bytes。通过实际文件树打开,内容就绪要求Monaco模型有内容、行实际渲染及两次RAF机会;只出现编辑容器不算完成。编辑器实例只用于只读检查,未直接修改model或调用编辑器命令来代替操作。 + +`editor-heavy-apple-pilot-2`和`pilot-3`均通过6个文件打开、24次增量输入、撤销/重做、24步大幅滚动、12次热切换、离开45秒后恢复、真实保存及外部磁盘更新。`pilot-2`的非活动窗口Monaco视图3→0;恢复后的光标仍为30003行255列、阅读offset均为615322 px,文本长度与草稿末行均保持。这说明该流程中的视图回收没有丢文档状态,不证明模型或全部内存已释放。 + +两次均在主SceneBar资源页的查找步骤失败,未执行最终恢复/关闭资源窗口。`pilot-3`明确检查编辑器已获得焦点,失败时`document.activeElement`仍为目标Monaco的`textarea.inputarea`,但`.find-widget`不存在。源码中的查找注册位于ContentCanvas快捷键hook,而主资源页独立渲染;这是后续需核对上游并复现的功能路径疑点,不把未打开的查找计为快速完成,也没有绕过真实入口调用Monaco命令。完整`functionalPassed=false`,不计正式基线或已完成优化。 + +后续核对`origin/main@d6a640fcc`的资源页、Canvas快捷键及历史,主资源页仍未注册查找;按症状/模块搜索开放及草稿PR并检查返回的#3698、#3364文件范围,未覆盖此路径。GitHub插件搜索不可用,检查使用`git`/`gh`。现已在独立`ContentResourceView`激活且聚焦时注册既有`editor.findInFile`命令,仍委托`ActiveEditTargetService`,沿用平台和用户键位设置。聚焦的58项快捷键/浏览器策略测试、`check:web`及Apple生产构建通过;这些检查不是原生性能验收。 + +`editor-heavy-apple-baseline-1`使用30秒资源窗口及修复前端`bundled-bbfcb3aba1defd11`,仍因查找步骤超时而中断。失败快照显示查找面板已可见、其`textarea.input.empty`已获得焦点:与前述无面板的产品缺陷不同,这次是E2E只匹配`input`的选择器错误。已修正为查找控件内的`input`或`textarea`,保持查找命中断言及全部资源窗口;原失败证据保留,不能当作完整基线。 + +`pilot-1`停在文末快捷键:嵌入驱动的键盘事件缺少Monaco依赖的legacy `keyCode`。后续仅在E2E通过native eval派发包含该字段的DOM键盘事件,文本及wheel继续走驱动;它们均不是系统可信输入、IME或原生快捷键覆盖。第二次失败后补充焦点确认,第三次仍复现查找问题,失败证据全部保留。 + +这些预演的常规资源窗口仅3秒,不用于CPU/内存验收。后续完整结果如下,预演失败与未执行部分仍保留。 + +### 六个大文件正式基线:功能通过,待优化验收 + +证据:`tests/e2e/reports/editor-heavy-apple-baseline-2/result.json`。前端`bundled-bbfcb3aba1defd11`,同一native SHA `04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2`;协议v1 hash `eb9f9a6898c801e260febdc9c41b941caa5eecc4a3b788b05a73e9d2ea77fed4`,harness hash `025388646f2786faaeba8102fec590cc78460cfca11e41315e9c8caeb79a40dc`。Apple系统字体、production前端、debug native、本地隔离数据;无并行构建/测试。 + +六文件打开、24次输入、撤销/重做、24步wheel、12次保留文档切换、隐藏45秒后草稿/光标/阅读位置恢复、真实保存、外部更新、查找命中与关闭全部通过。`functionalPassed=true`、`performanceBudgetsPassed=false`。查找快捷键修复获得真实流程验证,但它是功能修复,不能作为CPU/内存优化收益。 + +| 项目 | 结果 | 样本与限制 | +| --- | ---: | --- | +| 首个文件可见/内容就绪 | 311/445 ms | 首次UI进入各1次,非release冷启动 | +| 其余5个文件内容就绪 | 146/159/212/178/176 ms | 各1次 | +| 保留文档切换反馈/内容P95 | 114/204 ms | 各12次;保留文档不等于Monaco视图仍常驻,不剔除首次视图重建的慢样本 | +| 隐藏45秒后恢复可见/内容 | 62/125 ms | 1次,草稿及位置完全保留 | +| 输入到RAF P95/最大 | 16/16 ms | 24次输入;不是系统按键到像素延迟 | +| 输入期间帧P95/最大 | 21/24 ms | 132帧间隔,>33.33 ms为0 | +| 滚动期间帧P95/最大 | 18/18 ms | 28帧间隔,>33.33 ms为0 | +| 查找期间帧P95/最大 | 76/76 ms | 仅10帧间隔,1帧>33.33 ms;不能当作大量重复查找的稳定分布 | + +四个常规资源窗口各30秒,非活动编辑器窗口45秒,均先稳定5秒。CPU以100%=一个逻辑核计;内存为窗口末physical footprint,单位MiB。 + +| 窗口 | 主WebContent CPU % | 主WebContent footprint | GPU进程CPU % | GPU进程footprint | Host CPU %/footprint | +| --- | ---: | ---: | ---: | ---: | ---: | +| 打开编辑器前 | 0.71 | 256.4 | 0.29 | 73.3 | 3.69/104.3 | +| 编辑器活动,编辑后静置 | 0.60 | 561.4 | 0.33 | 77.8 | 2.92/96.8 | +| 切至首页,编辑器非活动 | 0.44 | 536.5 | 0.31 | 77.8 | 3.73/97.0 | +| 恢复、保存/外部更新/查找后 | 1.72 | 610.8 | 0.56 | 77.6 | 3.33/105.7 | +| 六个文件全部关闭后 | 0.37 | 548.0 | 0.30 | 77.5 | 3.77/105.8 | + +活动静置窗口的Monaco视图4→1,非活动窗口1→0,恢复为1,关闭后为0;对应最终DOM为1,423个,打开前1,246个。关闭后主WebContent footprint仍高约291.7 MiB;RSS为1,303.0 MiB,而打开前为323.6 MiB。这些口径不能混算,且未取得JS堆/对象保留链,不能仅凭关闭后30秒未回到初值判定泄漏。后续需区分语言Worker、文档模型、引擎缓存与驻留页;测试没有强制GC或清产品缓存。 + +同一运行中桌宠CPU为1.42–2.00%,footprint由71.7增至75.3 MiB,单次短运行不证明长期稳定。GPU表格是归属进程的CPU/footprint,并非GPU busy或独占显存。Markdown/Diff、IME、实际远程、其他平台与优化A/B仍未覆盖。 + +### 编辑器关闭后的对象与Worker诊断 + +`EditorRetentionPage`在同一大文件流程中记录公开Monaco模型清单、模型/视图销毁事件、弱引用存活,以及实际Worker创建/终止;不把观测对象保存在强引用列表中。单纯弱引用仍可访问不能证明泄漏,也不能换算成保留字节。普通运行不启用探针,诊断运行明确排除于性能验收。 + +`editor-retention-diagnostic-1`在用户暂停目标时中断;恢复后确认exec句柄已不存在、原生宿主PID已退出。原始结果保留至`after-editors-close`资源窗口,但关闭后的弱引用快照及最终检查没有完整保存,不能计作通过,旁注在`interruption.json`。隐藏45秒时,六个文档模型仍在、视图均已销毁,这符合保留文档和撤下视图的契约;关闭后回收结论需完整运行。 + +继续归因前已重新刷新`origin/main@d6a640fcc`,Monaco初始化/模型管理/文档所有权实现与当前基点无差异。检索开放及草稿PR,并核对#3694、#3698、#3351、#3364文件范围,没有覆盖语言Worker关闭生命周期。当前安装Monaco 0.52.2:通用编辑器Worker在模型清空后停止,而TypeScript Worker管理器仅在配置变化/自身销毁时停止;模型镜像删除和语言服务派生缓存释放不是同一事实。后续仅将这点作为待验证假设,不据源码推算内存收益。 + +`editor-retention-diagnostic-2`完成两段关闭后的30秒观察。六个模型均收到销毁事件、公开清单为0,编辑器视图也均销毁;通用编辑器Worker停止,TypeScript Worker仍存在。主WebContent footprint为863.5/864.0 MiB(打开前286.4 MiB)。随后仅在诊断中通过完全相同的compiler-options通知重置TypeScript Worker,确实记录到terminate,但下一窗口末为967.5 MiB,没有得到回收收益。重新打开内容180 ms后,直接语义调用40秒超时,整体`functionalPassed=false`。这不是产品优化对照,不能推出重置导致了超时;未采用重置方案。 + +进一步的`editor-language-diagnostic-1`使用只有一行的实际TypeScript文件、不包装Worker、不保持长时间native eval,也不先重置。仍在取得语言Worker阶段超过10秒,模型诊断标记为空。原生控制台记录`ReferenceError: Can't find variable: define`以及Worker失败后尝试回退主线程的警告。当前`MonacoInitManager`以AMD loader初始化编辑器,却将`language/typescript/tsWorker.js`这个以`define(...)`开头的AMD模块直接交给`new Worker`;缺少AMD worker bootstrap。该证据改变下一步:先修复实际语言Worker启动,再重新建立功能与资源基线,不能把先前失效的语言服务当成正常性能基线。 + +修改前再次刷新同一main并核对实现历史;按Monaco/worker/editor搜索的开放PR #3364、#3694、#3484、#3698均没有相关初始化修复。修复仅让经典AMD Worker统一从`base/worker/workerMain.js`引导,由Monaco原协议加载实际语言模块;不降低诊断、补全、模型同步或文件刷新频率。功能与资源验证另行记录。 + +修复后的`editor-language-fixed-2/result.json`记录TypeScript原始Worker与诊断重置后重开均返回预期2322错误及可见诊断标记,控制台未记录Worker启动错误,`functionalPassed=true`。这是小文件功能诊断,`performanceBudgetsPassed=false`,不构成性能验收,也未将诊断中的Worker重置加入产品。随后`editor-languages-fixed-2/result.json`取得JavaScript、JSON、CSS的预期标记和可见波浪线;HTML在“以源码打开”菜单入口等待超时,整轮`functionalPassed=false`,不能宣称全部语言已通过。 + +大文件runner已增加真实语言服务就绪检查,但修复后的完整重负载运行及同口径优化对照尚未完成。此前六文件流程的基础交互测量保留;由于当时语言Worker启动失败,其CPU/内存不能作为语言服务正常运行时的基线。补全响应、HTML、Markdown/Diff以及关闭后的对象保留仍需独立验证。 + +`editor-languages-fixed-3`进一步记录到HTML右键实际命中主导航按钮:保留的文件树仍有矩形,但其父导航层已`inert`、`aria-hidden`且不可命中。旧驱动的元素click能直接派发到该隐藏节点,因此仅凭`checkVisibility`和宽度不足以证明真实文件打开路径。v6语言诊断与v3大文件协议改为先通过工作区菜单显示文件树,断言实际命中目标;保留文档通过真实SceneBar标签切换。`fixed-4`暴露重复打开导航菜单的测试时序,删除重复准备步骤后,`editor-languages-fixed-5`完整通过TypeScript诊断/重开、JavaScript/JSON/CSS波浪线及HTML可见标签补全(包含`div`)。原产品HTML默认预览行为未变。 + +该完整语言回归的前端为`bundled-3c87f6e27790f7fd`,native为`ec3205e982d4e086824ba67e608312bf1a8532818242e95e5082094fdb46c4a3`;协议哈希`59a7b91d3cd8edbcafe83ff2acba3214748dafcbd4a24e2c5c0c715612dce16d`,脚本哈希`f4a85dde34c0a320612e21bb6cfb5c2029c0950189e520339b2a17eb94a00663`。它仍是小文件功能诊断,不是资源优化验收。旧编辑器切换数据同时受隐藏文件树点击口径影响,不与v3真实标签切换直接计算收益。 + +### 语言服务正常运行后的六文件基线(v3) + +`editor-heavy-language-baseline-2`完整结束,`functionalPassed=true`、`performanceBudgetsPassed=false`。前端和native与上述五语言回归相同,协议哈希`c2b4a0668fc156bb13479ac75a5fd8e0169467cc7b07bf8b9c377d8439374ff3`,脚本哈希`15a657435c003102d3168428c7e320eb206effdb0e41e1d292e60c10ef0d829d`。此前`baseline-1`因测试点击SceneBar外层容器、没有点击内部真实tab按钮而失败;保留失败记录,不计正式结果。 + +工作量仍为6个文件、5,896,296 bytes。首次打开均走可命中的文件树;后续均走真实标签按钮。大文件语义服务返回成功且无诊断错误/Worker启动警告;24次增量输入、撤销重做、24步滚动、45秒非活动后草稿/光标/阅读位置恢复、真实保存、外部磁盘更新和查找通过。 + +| 指标 | 结果 | +| --- | ---: | +| 六文件首开内容 | 466/279/162/178/219/208 ms | +| 保留文档反馈/内容P95 | 113/195 ms | +| 非活动视图回收后恢复内容 | 149 ms | +| 输入到RAF P95/最大 | 17/26 ms,24个输入事件 | +| 输入帧P95/最大 | 18/63 ms,124帧间隔 | +| 滚动帧P95/最大 | 17/18 ms,28帧间隔 | +| 查找帧P95/最大 | 68/68 ms,9帧间隔,1次>50 ms | + +v3的12次标签点击含一次已经激活标签的重选,实际切换11次;剔除重选后反馈/内容P95仍为113/195 ms。195 ms样本包含一个被回收视图的重建,不因其慢而删除。v4将循环从另一个文档开始,使12次均发生实际切换;后续配对必须使用同一v4脚本,不能与v3直接计算收益。查找9个帧间隔是单次操作观察,不代表大量用户查找的总体P95。 + +以下CPU为单核百分比,内存为窗口结束physical footprint MiB;不是JS堆或显存。各资源窗口与构建/其他测试隔离。 + +| 阶段 | 主WebContent CPU/footprint | Host CPU/footprint | GPU进程CPU/footprint | +| --- | ---: | ---: | ---: | +| 打开前30秒 | 0.46/254.2 | 2.09/103.1 | 0.14/33.4 | +| 编辑器活动30秒 | 0.86/1223.6 | 3.33/128.1 | 0.34/74.6 | +| 首页、编辑器非活动45秒 | 0.80/1178.3 | 2.05/128.5 | 0.26/87.5 | +| 恢复后30秒 | 1.90/1047.3 | 3.05/125.5 | 0.55/79.5 | +| 全部关闭后30秒 | 0.72/983.9 | 3.12/125.7 | 0.24/78.6 | + +关闭后主WebContent较打开前高约729.7 MiB,需要区分语言服务派生缓存、模型/视图、引擎分配器及驱动引用。这里没有强制GC、关闭Worker或清产品缓存,尚不能据此判定泄漏。语言Worker修复恢复了实际功能;与此前失效语言服务的资源差异不作为性能收益或回归结论。 + +### 正常语言服务下的关闭诊断:模型已释放,空程序同步未见收益 + +`editor-empty-program-diagnostic-1`使用v4与弱引用探针完成全部流程,功能通过;其运行在暂停/恢复后通过同一exec句柄及实际PID确认仍存活,没有重复启动。协议哈希`749b4a528edc03f863e0dba8c5b6e6663b2c2bd545b65032239f400e39f73725`,脚本哈希`4be9dd39751a85c1f9b741f1d64d1f553f20b7be276d7102f3a7ffb3913c92de`。带探针结果只用于归因,不能和前述无探针v3计算优化收益。 + +两段关闭后30秒窗口结束时,主WebContent footprint分别为1525.0、986.3 MiB;后一个窗口出现约539 MiB自然回落,期间未强制GC或清缓存。六个模型均收到销毁事件,公开模型清单为0;延长窗口结束时六个模型和全部观察到的视图的弱引用均不再存活。通用编辑器Worker已停止,TypeScript Worker仍存在。由此不能再将这些已释放的模型/视图作为当前驻留的保留链,也不能用最初30秒的结束值判定长期泄漏。 + +随后诊断先确认TypeScript Worker的实际镜像文件清单为空,再请求一次compiler-options diagnostics,使其派生程序同步到空清单。调用耗时12 ms、返回无错误,Worker身份与终止状态前后完全相同;没有修改编译配置或终止Worker。另一个30秒窗口末主WebContent为1102.5 MiB(CPU 0.77%),未取得内存下降。重新从真实文件树打开保存文件内容为276 ms,实际语义请求29 ms返回成功。**不将空程序同步加入产品,也不宣称其资源收益。** 正常Worker整体驻留与引擎分配器仍需进一步分离。 + +`editor-working-worker-reset-diagnostic-1`随后在正常工作的语言服务上单独验证整个Worker释放,功能通过。两段关闭窗口结束主WebContent为2386.0、1661.7 MiB,说明自然回落仍很大;公开模型清单为0,观察到的模型/视图均已销毁,但有6个模型/6个视图弱引用仍可访问。重新通知完全相同的compiler options后,实际记录到TypeScript Worker终止;下一个窗口开始896.4、结束895.6 MiB,CPU 0.36%。这个阶段下降支持Worker整体驻留是贡献者,但不能把约766 MiB等同独占Worker内存或配对产品收益。重新打开内容246 ms,随后语义请求295 ms成功;该请求在内容观察之后才发出,不是从首次点击到诊断标记的总延迟。**尚未实施自动Worker回收策略;需要同时验证资源与重开语言服务代价。** 协议哈希`0013fdf0679c0050ae87d8ed3b51d07c1a115ba217829cdda86f28c649495fd7`,脚本哈希与空程序诊断相同。 + +### 视图创建归因与重复主题附着候选 + +独立`editor-creation-diagnostic-2`完成24次真实标签切换及视图重建。创建调用累计192 ms、最大20 ms,96次模型`getValue`未取得>=1 ms的单次耗时;同一个主题却被`defineTheme`和`setTheme`各调用24次,合计73 ms、最大10 ms。标签栏的`scrollLeft`读取累计363 ms、最大17 ms;调用点对应`useSceneTabNavigation`的激活标签布局effect。还观察到Monaco渲染准备的几何读取最高20 ms。包装器与原生采样均有开销,这些数字用于定位,不能作为速度收益或相加成独立总成本。首次诊断在逐个创建fixture文件后打开第二文件时卡在导航菜单,已保留;第二次先生成全部fixture,并在文件树已激活时等待真实条目刷新。 + +修改候选前刷新`origin/main@509bdd2c03f8c8508b56cca365bf1c5fa314dae4`;Monaco初始化与主题适配器仍与本地基点相同。检查全部开放/草稿PR,并按Monaco/language worker/editor memory/appearance检索,核对#3364、#3698、#3217及#3694实际文件范围,均未覆盖这些初始化/重复主题附着路径。GitHub插件仍返回Unknown tool,本次使用git/gh;检查记录保存在`editor-theme-build/upstream-check.json`。 + +候选只让相同Monaco实例、相同设置对象和revision的重复附着复用已成功应用的主题;真正的`apply`仍投影颜色、定义主题并刷新所有编辑器,同id的新设置和替换runtime也正常应用,失败附着可重试。没有改颜色、字体、布局、动画、语言设置或数据刷新。10项聚焦外观测试、`check:web`及28个surface的主题审计通过。`editor-theme-pairs-1`完成第一组后按用户要求停止,未完成三组性能验收;不据此宣布收益,后续不再继续编辑器专项。 + +后续只读源码核对补充了内存归因线索:当前依赖为Monaco 0.52.2,其TypeScript `WorkerManager`使用`keepIdleModels: true`,源码中没有空闲计时停止逻辑;停止入口为配置变化和manager dispose。OpenBitFun的document model释放、普通model的10秒延迟释放,与该Worker生命周期是不同机制。这不证明本次关闭后的291.7 MiB全部由Worker持有,也不证明已关闭模型仍留在mirror列表;下一诊断需分别记录实际模型数、Worker存活与语言服务缓存,不能将DOM数或等待30秒当作完整释放证据。当前未据此修改Worker生命周期。 + +## 终端重负载:预演与尺寸同步诊断 + +新runner通过真实工作区菜单创建3个PTY,再从终端输入启动Python有限输出fixture。每个fixture计划2,400批×50行、每批间隔50 ms,实际完成时间会独立记录;每个终端必须收到`WORKLOAD_READY`回应才算shell可用。只读诊断仅在性能开关启用时暴露复制的viewport/tail数据及几何,不提供engine句柄或写入方法,不增加轮询、parser或render回调,并以弱引用避免延长生命周期。旧宿主没有WeakRef时不启用诊断,不改变ES2020产品目标或引入强引用fallback。 + +前端`bundled-89a3ad23a53f756c`,2,728文件、71,891,190 bytes,同一保存的native。6项终端诊断/链接聚焦测试、`check:web`、Apple生产构建通过;另外用真实PTY验证fixture的启动、有限输出、PING、尺寸读取、完成与退出。首次类型检查发现ES2020类型库没有WeakRef声明,改为运行时能力检测后通过;没有扩大整个前端的编译目标。这些检查不是原生性能验收。 + +三次预演证据保留在`tests/e2e/reports/terminal-heavy-apple-pilot-{1,2,3}/`,常规资源窗口仅3秒,均未完成全部流程: + +- `pilot-1`三个真实shell均回应,但切换点击落在SceneBar外层容器,未触发内部tab按钮;第三次首开测量还匹配到无session-id的外层终端容器。已纠正实际按钮和带session-id的终端选择器,并增加内容就绪失败断言。该次计时不能作为完整基线。 +- `pilot-2`通过12次输出中输入回应及wheel离开末尾/保持阅读,停在拖拽后的PTY尺寸断言。第一次尺寸读取可能落在中间态,因此下一轮改为持续比较当前xterm与当前PTY尺寸,保留相同一致性要求。 +- `pilot-3`仍在30秒后失败:同一活动终端xterm稳定为154×42,`terminal_get`及`terminal_list`仍为162×42,其他两个PTY仍正常输出。这已排除仅保存一个过渡列数导致超时的解释;尚需独立读取输出进程实际TTY尺寸,并跟踪前端resize调用,不能先归咎于后端或跳过该功能检查。隐藏、恢复及关闭窗口尚未执行,`functionalPassed=false`。 + +诊断前再次刷新`origin/main@d6a640fcc`;`TerminalResizeDebouncer`与本地原实现一致。按terminal、resize及终端搜索开放/草稿PR并检查返回PR文件范围,未发现覆盖该终端尺寸同步路径的变更。`terminal-resize-diagnostic-{1,2}`增加只观察的callback/IPC/error及timer取消栈记录,明确标记为instrumented,不用于CPU或速度收益比较。两次均未捕获JavaScript错误;独立从终端输入`STATE`后,Python进程通过TTY ioctl读到的也为162×42。后续验证发现Tauri的invoke属性不能被该诊断包装替换,故空调用列表不作为“没有IPC”的证据;尺寸读回、定时器取消栈及修复前后结果是此处有效证据。第二次进一步记录到50 ms后端同步定时器在`clearPendingJobs → flush → Terminal`恢复RAF路径被取消,没有执行。 + +根因是新的拖拽已经暂停测量,而前一次恢复RAF仍执行flush,丢掉前端已接受尺寸对应的后端同步。恢复时fit发现本地尺寸相等,会直接返回,不能补发PTY更新。候选在恢复RAF执行前重新检查暂停状态并取消过期RAF;pending标记保留到实际恢复,完成fit后通过原有去重入口同步当前实际xterm尺寸。未改拖拽动画、PTY输出、后台保留、终端scrollback或原有resize合并延迟。 + +新增两项组件行为检查覆盖“后端定时器在暂停期间到期”和“恢复RAF被第二次拖拽打断”,均先在旧实现上复现PTY未同步;修复后连同诊断/链接共8项通过,`check:web`及Apple生产构建通过。候选`bundled-87f2bc38e7bc93d5`(2,728文件、71,891,302 bytes)完成`terminal-heavy-apple-pilot-4`后,真实resize已得到验证:xterm、后端元数据及Python TTY读取均为154×42,随后恢复为162×42。三路输出中输入、滚动、12次切换、隐藏45秒及同PID恢复均通过;每路完成120,000行,实际耗时135.86/136.23/135.97秒。 + +该轮仍未完成整体流程:第一个fixture已退出且画面显示输入了shell `exit`,但30秒后PTY元数据仍为Active。未执行最后关闭资源窗口,不能记为功能全部通过。独立`terminal-exit-diagnostic-{1,2,3}`均保留:用只读历史游标观察到shell integration的命令输入就绪标记;普通`exit`、`builtin exit`均未退出。第三次另外比较驱动Enter及终端Ctrl-J,仍是PID存在、元数据Active;此时的`kill(pid, 0)`不能区分活进程与僵尸进程,不能据此断言shell仍在执行。 + +第三次也明确测得`invokeWrapperInstalled=false`,所以诊断中的空调用列表不能说明输入没有进入IPC。后续第4/5次诊断已定位为PTY自然退出回收缺失,见下节;没有通过后台关闭命令绕过退出检查。终端完整基线、最终关闭资源窗口及性能优化A/B仍未完成。 + +关闭终端标签的现有语义是detach,保留PTY;本runner计划通过输入`EXIT`结束fixture、再输入shell `exit`,之后关闭视图,分别核对退出与回收。不会以修改detach行为、停掉隐藏终端输出或缩短scrollback来降低资源数字。 + +### PTY自然退出:僵尸进程及状态不更新 + +`terminal-exit-diagnostic-4`读取既有startup trace:输入shell退出命令前4次`terminal_write`,输入后6次,额外Enter/Ctrl-J后8次;全部成功,最长2 ms,没有缓存命中。它证明请求经过前端队列和API返回,但PTY writer本身是异步命令队列,仍不能单独证明shell执行。 + +`terminal-exit-diagnostic-5`进一步通过OS `ps`读到目标shell为`Z / `,父PID仍是本轮应用。此前“shell仍存活”的判断应修正为“shell已经退出但未被回收”。对僵尸进程的`sample`尝试失败,未取得调用栈,也未申请更高权限。 + +源码中`spawn_pty`只在收到主动Shutdown命令时调用`try_wait`并发送Exit;自然退出没有waiter,读线程遇到EOF也不更新状态。因此shell退出后留下僵尸、PTY元数据仍Active,不能获得正确的最终资源基线。修复前再次刷新main(`d6a640fcc`),此文件与本地原实现一致;按terminal/PTY/exit检索开放及草稿PR,并检查返回的#3588、#3751、#3532、#3004文件,均未覆盖该路径。 + +候选在terminal服务中增加阻塞式子进程waiter,睡在OS等待上,不添加每终端轮询计时器。自然退出与主动关闭共用确认后的退出发布,短暂等待输出EOF;保持已有250 ms输出排空上限、Unix忽略SIGHUP时的强制结束及5秒确认上限,已退出PTY重复关闭幂等。没有修改输入、shell命令、隐藏PTY输出或标签detach语义。 + +新增自然退出检查先在旧实现复现3秒超时;修复后6项PTY聚焦测试通过,包括最后输出/实际exit code、主动关闭、重复关闭、不因输出提前关闭误报退出、Unix忽略SIGHUP后仍完成关闭;`cargo check -p terminal-core`通过。原生候选构建成功(debug+devtools),保存在`terminal-exit-native/openbitfun-desktop`,SHA256 `6ae6fa7ab24038cc38b004f0dc02f20d7ea13b4adb3c5fe3200ba374deadcecb`。这些本地进程测试不代表真实远程或其他平台通过。 + +`terminal-exit-before-v2`/`terminal-exit-after-v2`使用相同前端`bundled-87f2bc38e7bc93d5`、协议hash `ea5870acc045a66632b1e59fde84f1144ed6fea2849b91200c8c49c4073cf774`、harness hash `ad634c251e5798325a72e0e80bd64e8e2e8c400d5a50639eaa43c18895785b55`,仅替换native候选。旧版再次得到`Z / `、Active和退出超时;新版退出码0、PID已回收,最后的`SHELL_EXIT_TAIL`仍可从xterm读到。功能前后对照通过,记录在`terminal-exit-native/comparison.json`;该诊断不测稳态CPU或速度,不能作为资源收益百分比。 + +完整终端runner升级为v3:等待shell输入就绪后通过界面退出;同时要求元数据Exited、shell与fixture PID回收、最后输出保留,再关闭视图。`terminal-heavy-apple-baseline-1`已完成,使用上述原生候选和相同前端。所有先前失败保留,不与新协议或修复后窗口混算。 + +### 三PTY正式基线:功能和当前速度门槛通过,资源优化尚待对照 + +证据`tests/e2e/reports/terminal-heavy-apple-baseline-1/result.json`;协议v3 hash `f5ac81bd3e1eddb1dc8cb52a42965548218ccfcca75d2b7a08868eda51b3b817`,harness hash `f5f38519a2a58b330ca7cdf5c58cc4b0ce58d3b2fe20fb2b1bf719d993732574`。未启用callback/resize诊断,无并行构建或其他基准。每路完成120,000行,实际136.49/136.41/136.48秒;12次输入、阅读保持、尺寸同步、12次热切换、隐藏45秒、同PID恢复、完整输出、shell/fixture回收、末尾输出保留及视图关闭均通过。最终诊断注册数为0。 + +| 速度指标 | 本轮结果 | +| --- | --- | +| 三个首次UI入口反馈/内容 | 97/120、77/124、78/125 ms;是视图就绪,真实shell就绪另要求fixture响应 | +| 热切换反馈/内容 P95(各12样本) | 91/104 ms | +| 隐藏后恢复反馈/内容(各一次) | 105/111、62/69、42/48 ms;第一项反馈仍高于100 ms追求值,未混入热切换分布 | +| 输入到RAF机会 P95(12样本) | 17 ms | +| 输入到PTY响应及两帧机会 P95(12样本) | 60 ms;含驱动提交成本,不是key-to-pixel | +| 输入时帧间隔 P95/最大 | 18/28 ms,84样本 | +| 滚动时帧间隔 P95/最大 | 19/32 ms,56样本 | +| 拖动时帧间隔 P95/最大 | 27/68 ms,129样本;>33.33 ms为6帧、4.65%,仍未达到<1%进阶目标 | + +资源窗口前稳定5秒;常规30秒,隐藏45秒。CPU以100%为一个逻辑核,内存为窗口末尾physical footprint MiB。 + +| 窗口 | 主WebContent CPU/内存 | GPU进程 CPU/内存 | Host CPU/内存 | +| --- | --- | --- | --- | +| 打开前首页 | 0.64%/254.4 | 0.32%/74.0 | 3.72%/114.9 | +| 三路输出、一页可见 | 18.76%/534.4 | 2.67%/127.8 | 15.18%/112.3 | +| 三路输出、全部隐藏 | 25.58%/480.4 | 1.71%/95.7 | 14.66%/120.3 | +| 输出完成、PTY仍开 | 1.61%/516.2 | 0.66%/123.5 | 3.47%/112.4 | +| shell退出、视图关闭后 | 0.67%/330.7 | 0.36%/86.6 | 3.84%/115.4 | + +隐藏窗口结束三个终端的canvas计数均为0,缓冲仍为10,042行且输出继续推进;仅凭canvas数量不能断言GPU所有分配已释放。主WebContent关闭后CPU/唤醒接近打开前(0.64→0.67%、3.80→4.13次/秒),footprint仍高76.3 MiB,RSS则317.1→646.6 MiB;这些指标不能互换,也尚不能据单次关闭窗口认定泄漏。GPU进程footprint仍高12.6 MiB。应用GPU busy/独占显存和JS堆仍未取得。 + +隐藏输出主WebContent CPU比此前可见窗口高,但两窗顺序、累计输出量、GC及renderer释放阶段不同,不能直接归因为隐藏渲染,也不能将这两个数当作优化前后对照。先做同负载下交替可见/隐藏的工作归因,再决定具体优化;不会停止隐藏输出、删减历史或以关闭活PTY换取低占用。当前`functionalPassed=true`、`performanceBudgetsPassed=true`只代表上述协议门槛通过,不代表资源优化或全部进阶目标验收。 + +### 隐藏终端工作归因:选区刷新绕过绘制暂停 + +`terminal-render-attribution-1`已完成。相同三PTY持续输出,在buffer均达到10,042行后执行“可见→隐藏并等待renderer释放→再次可见”,每段约12秒。callback wrapper/MutationObserver带额外开销,因此不能与正式基线CPU百分比混算;fixture在诊断结束时通过正常输入EXIT停止,剩余工作量也记录在trace,不作为12万行完成测试。 + +| 阶段 | SelectionService刷新 | 普通RenderDebouncer刷新 | 终端screen childList变更 | +| --- | --- | --- | --- | +| 可见 | 639次/592 ms | 656次/259 ms | 17,934 | +| 全部隐藏、canvas均0 | 632次/606 ms | 632次/2 ms | 26,586 | +| 再次可见 | 638次/487 ms | 655次/192 ms | 17,934 | + +回调组只保存首次注册栈,不能把这一栈当作每次调用来源。但本轮`_refresh`源码和构建位置已对应到`@xterm/xterm@6.1.0-beta.141`的SelectionService:输出scroll触发选择刷新,随后`RenderService.handleSelectionChanged`保存状态并直接调用renderer;它没有普通`refreshRows`路径中的`_isPaused`检查。WebGL释放后的DomRenderer在`handleSelectionChanged`中先清选区容器、更新rowFactory并重画全部可视行,之后才判断是否存在选区。于是普通绘制虽已暂停,隐藏DOM仍因选区刷新被反复重建。 + +这确定了一个可优化的隐藏工作来源,不等于全部25.58% CPU都由它造成。诊断三段主WebContent CPU为32.84/26.57/26.92%,包含观察开销;不用于性能验收。窗口外的1秒原生`sample`成功,保存在`main-sample.txt`,可见Rendering→Layout/Style栈;它仅是短样本,不能替代完整CPU归因。 + +本次归因后的候选方向是在引擎正常暂停期间保留最新选区状态、推迟其重绘,并在重新可见时正确恢复。不能关闭输出解析、清空历史、禁用选区或改页面/logo布局。后续上游核对和回补进度见下一节;原生选择/复制/恢复及正式性能A/B仍待执行。 + +### 上游回补核对 + +修复前再次刷新OpenBitFun main至`d6a640fcc`,其pnpm patch注册与本地原状态一致;开放/草稿PR按xterm及terminal selection检索未返回覆盖项。xterm当前master的RenderService仍直调selection handler,但已有开放[PR #6283](https://github.com/xtermjs/xterm.js/pull/6283),head `c279844f2a8cfcff9dd3466805d354b634c56223`,实际diff覆盖选择/blur/focus直接绘制和隐藏前已排队帧。本轮将基于该PR回补,未另起上游PR、未对外发送消息。 + +较新的master还包含[5c2b19f](https://github.com/xtermjs/xterm.js/commit/5c2b19f2c89eef1fb9743746f093bf93264762a2)的选择范围优化。此次以已固定beta.141为基础,保留原有选择范围算法,仅把相关行重画交还RenderService,并补暂停及恢复检查,避免顺带升级整个终端依赖。 + +`xterm-render-pause.test.mjs`对实际固定版本RenderService使用可控帧/IntersectionObserver,检查隐藏后排队帧、选区/焦点/尺寸保持、选区回放和同步输出。旧实现4项中3通过,排队帧检查按预期失败;候选源码和实际安装包均4项通过。这些服务层fixture不代替真实DOM renderer和原生选择/复制体验。 + +回补包从发布元数据中的源码commit `8f9045ed882aa663a63935e216501f43d757188d`及原lock构建,恢复发布版Version.ts后与npm包所有已发布src文件逐一相同。未改源代码的控制构建已逐字节复现原UMD、ESM及两份source map;随后生成候选并通过pnpm patch安装,安装后的四份产物与候选一致。`check:web`和repository hygiene检查通过。原生三对对照结果见后文;CPU改善不等于全部资源与速度目标达标。构建与上游来源记录在[patches/README.md](../../patches/README.md)。 + +### 终端选区/复制恢复:原生前后验证 + +候选Apple前端`bundled-bb74c94cbd986035`,2,728文件、71,891,474 bytes。与旧快照`bundled-87f2bc38e7bc93d5`比较时,只将已知生成文件的内容hash名称归一化并排除revision清单;除xterm chunk增加172 bytes外,其余文件的归一化内容多重集一致。完整产物和原始revision仍保留,不把归一化结果作为真正的文件hash。 + +`terminal-selection-before-2`/`terminal-selection-after-2`使用相同native `6ae6fa7…`、protocol hash `def15c2bc5d508311b5a67d15905e2ea95c97acf01382777e79c805b583c6ebb`、harness hash `c5b2ebe4c333c7eaab422a150573b6113130bc6fa490e03bdf7608d4e99f7442`及环境。真实PTY保持输出,使用产品select-all快捷键选中,隐藏35秒等待WebGL释放,观察3秒,再恢复并复制、单击清除、通过UI正常退出。 + +| 检查 | 旧版 | 回补候选 | +| --- | --- | --- | +| 隐藏期间`.xterm-rows`变更数 | 1,176 | 0 | +| 隐藏期间输出解析推进 | 通过 | 通过 | +| 恢复后复制保留原选区全部前缀,并包含新增输出 | 通过 | 通过 | +| 单击清除选区、正常退出 | 通过 | 通过 | +| 功能/停止隐藏行重画 | 通过/失败 | 通过/通过 | + +候选可见和恢复后的截图均保存,检查时选区和文字正常显示。复制使用真实xterm copy handler及私有DataTransfer,不覆盖系统剪贴板;快捷键和单击经DOM事件触发,不能代表系统可信按键/剪贴板集成。`before-1`最初在清除选区处失败:嵌入驱动的MouseEvent缺少`detail`,xterm只有`detail=1`才执行单击选择逻辑。v2补齐该事件字段,未修改产品行为;首轮失败保留,不混入匹配对照。 + +补充的v4故障注入对照`terminal-selection-before-4`/`terminal-selection-after-4`在隐藏前通过真实canvas的`WEBGL_lose_context`触发产品DOM回退,再检查可见文字、选区、失焦/恢复焦点及复制。双方protocol hash均为`9812d2cfa0a673c8fcb7dba62d58a7d4931b443706dfceb3c7c514a4f6858cfa`,harness hash均为`63be07a9c506cacf69f3cc4d8ea6f0f2ff6f945558f64f7716c217a10752aead`,native、环境及前后前端与上述对照一致。双方功能通过;失焦选区背景由`rgb(218, 237, 255)`变为`rgb(234, 245, 255)`,重新聚焦后恢复,实际textarea焦点和重新聚焦后的`xterm-focus`类正确,复制保留已有前缀并包含新增输出。候选DOM回退截图已核对,文字和选区正常显示。隐藏3秒的行变更仍为1,176→0;旧版仅在最后的停止隐藏重绘断言失败,候选通过。此诊断没有运行速度预算,`performanceBudgetsPassed=false`不是新增速度失败,也不能改成已通过性能验收。 + +v3预演曾错误读取渲染器`focus`类,实际类名为`xterm-focus`;v4只修正测试读回并增加实际焦点、颜色恢复检查,未改产品。失败证据仍保留,不能与v4混为同协议样本。WebGL故障注入也不代表观察到了自然GPU故障;本次验证不补足系统键盘/剪贴板或真实GPU占用的覆盖缺口。 + +这些是带MutationObserver的行为和工作归因证据,不是CPU收益。正式三PTY重负载另用`run-terminal-workload-pair.mjs`执行AB/BA/AB,目录`terminal-pause-pairs-1`;固定同一native和当前测量脚本,禁止并行构建/测试,结果如下。 + +### 终端隐藏重绘:三对正式资源与速度比较 + +证据为`tests/e2e/reports/terminal-pause-pairs-1/comparison.json`、`metrics.json`及各轮`result.json`。同目录保存汇总源码`summarize.mjs`、构建差异核对和pair runner。前后前端分别为`bundled-87f2bc38e7bc93d5`/`bundled-bb74c94cbd986035`,native均为`6ae6fa7ab24038cc38b004f0dc02f20d7ea13b4adb3c5fe3200ba374deadcecb`;protocol hash `f5ac81bd3e1eddb1dc8cb52a42965548218ccfcca75d2b7a08868eda51b3b817`,harness hash `f70744cbbd4deb16a0d09c7f44b5d259ad99ab9ae7281d58ab8c0730c47eb87f`。环境、viewport和Apple字体配置一致,未并行运行构建/测试;不混用前述单次基线的旧harness。 + +六次功能全部通过,每次三个PTY各完成120,000行,18路实际输出耗时135.91–136.90秒。输入、阅读位置、真实TTY尺寸、隐藏输出、同PID恢复、退出后末尾输出和shell/fixture回收均保留。三次旧版速度预算均通过,候选为通过/未通过/通过;`comparable=true`、整组`passed=false`,退出码1来自已保留的速度超标,不是测量未完成。 + +下表为每次独立运行的P95,单位ms;每次热切换、输入和回应各12样本,不将三个P95再当成原始样本的P95。 + +| 指标 | 旧版三次 | 候选三次 | 判断 | +| --- | --- | --- | --- | +| 热切换反馈P95 | 91/98/93 | 96/106/98 | 候选第二次106超过100门槛,未关闭此项 | +| 热切换内容P95 | 102/111/98 | 103/112/104 | 均低于150门槛,没有证实加速 | +| 输入到RAF P95 | 13/13/14 | 14/18/17 | 均通过;不是系统按键到像素延迟 | +| PTY回应及两帧机会P95 | 58/59/59 | 59/59/66 | 不宣称改善 | +| 拖动帧P95/最大 | 31/72、31/69、28/68 | 30/63、27/72、28/78 | 当前门槛通过,慢帧约4.55–4.58%仍未达到<1% | + +六次输入及滚动均无>33.33 ms帧。候选九次隐藏恢复内容就绪48–94 ms,旧版49–108 ms;样本较少且三终端恢复顺序不同,不把此范围当作独立P95或稳定速度收益。 + +CPU为三个独立窗口的中位数,100%表示一个逻辑核。最后一列对所有归属明确、完整覆盖窗口的进程CPU求和,包含三个真实PTY输出fixture;CPU时间可相加,RSS/footprint不可据此简单相加为独占内存。 + +| 窗口 | 主WebContent CPU 前→后 | GPU进程CPU 前→后 | Rust宿主CPU 前→后 | 可归属进程CPU合计 前→后 | +| --- | --- | --- | --- | --- | +| 打开前 | 1.09%→0.97% | 0.34%→0.31% | 3.83%→3.91% | 7.42%→7.63% | +| 三路输出、一页可见 | 19.80%→17.51% | 2.79%→2.69% | 16.26%→17.24% | 41.56%→40.50% | +| 三路输出、全部隐藏 | 25.27%→9.61% | 2.13%→0.67% | 14.21%→17.83% | 44.38%→31.21% | +| 输出完成、PTY仍开 | 2.08%→1.96% | 0.66%→0.67% | 4.37%→4.42% | 9.03%→9.08% | +| shell退出、视图关闭 | 1.01%→1.01% | 0.33%→0.39% | 3.94%→3.86% | 7.07%→7.12% | + +隐藏窗口主CPU中位数降低约62%,GPU进程CPU约69%,可归属CPU合计约30%;三对合计分别44.38→34.03、54.83→31.20、43.93→31.21%,方向一致。主进程唤醒中位数36.40→24.16次/秒。宿主CPU及唤醒反向变化(14.21→17.83%、167.07→177.06次/秒)仍需归因,不能称每个组件都改善。GPU进程CPU不是GPU busy,未取得应用独占显存。 + +下表为主WebContent窗口末尾physical footprint,单位MiB,括号为三次范围;中位数下降不掩盖首对反向结果。 + +| 窗口 | 旧版中位数(范围) | 候选中位数(范围) | +| --- | --- | --- | +| 打开前 | 256.4(256.3–258.3) | 253.0(253.0–257.8) | +| 一页可见输出 | 537.2(518.0–622.2) | 483.5(476.1–555.6) | +| 全部隐藏输出 | 475.1(465.8–746.0) | 418.0(413.2–622.2) | +| 输出完成 | 527.3(517.8–957.8) | 486.3(479.8–863.8) | +| 退出并关闭 | 335.9(333.3–607.4) | 302.7(297.7–342.5) | + +输出完成窗口的采样峰值范围旧版520.7–1009.6、候选531.7–915.7 MiB;它是采样窗口峰值,不是未采样阶段的全程峰值。关闭后相对各自打开前的增加量,中位数79.5→49.8 MiB,但首对79.5→84.7 MiB,第二对351.1→44.7 MiB,第三对75.0→49.8 MiB;存在明显运行波动,尚不证明稳定内存收益或所有资源释放。GPU进程隐藏末尾footprint中位数96.2→91.1 MiB,关闭后85.8→85.5 MiB;桌宠关闭后约76.6 MiB持平。以上均不是JS堆或显存。 + +结论仅到“确定的隐藏行重绘已消除,三对CPU下降且功能保留”。依赖回补继续作为候选保留,终端整体速度、宿主开销、内存归因与拖动进阶目标尚未完成;不以清空scrollback、暂停PTY、削减可见动画或放宽门槛完成验收。 + +## Browser重负载:原生页面预演与测量边界 + +11月6日再次刷新`origin/main`,仍为`d6a640fcc`,相关Browser实现与当前基点无差异。开放/草稿PR检索返回#3694和文档PR #3098;已读取#3694当前`9dab0e3…`差异,其内容包括定向IPC广播和`browser_webview_close`清理。此轮先建立当前代码的基线,没有重复实现该PR。GitHub插件接口返回Unknown tool,检查使用`git`/`gh`完成。 + +新增`run-browser-workload.mjs`复用既有原生资源协议:Apple系统字体、production前端`bundled-bb74c94cbd986035`、debug native `6ae6fa7…`及独立用户数据。固定loopback服务仅提供模型响应和网页内容,真实输入发送、Agent ControlHub、原生页面、Worker、定时器和Canvas仍按产品运行。三个会话各有一个3,000行表格、400个动画点的页面,每页21,014个DOM节点;服务端自身不属于应用进程。此负载不代表视频、第三方复杂站点或HTML预览网关。 + +原生资源归因增加显式子WebView标签,并用原生`get_all_webviews`核对:嵌入驱动的`window/handles`基于`webview_windows()`,不仅遗漏子WebView,主窗口拥有多个WebView后也可能被排除。两次窗口外CPU脉冲再将每个视图对应到PID/启动时间,不能按标签数量推断独占进程或相加内存。新增五项聚焦检查覆盖默认行为、子视图、主窗口遗漏、目标不存在及脉冲歧义拒绝,均通过。 + +`browser-heavy-pilot-1/2`分别在上述两类清单假设处失败;`pilot-3/4`揭示了测试场景假设错误:回首页只切换左侧场景,独立右侧Browser仍正常可见,截图和`WorkbenchLayout`的`canvasVisible`规则一致。v5通过真实面板开关收起/恢复,并分别使用Browser标签关闭控件和ControlHub显式关闭页面;没有修改产品的双面板行为或将可见页面当作隐藏采样。失败证据均保留。 + +`browser-heavy-pilot-5`已完整结束:功能通过,速度预算未全部通过,资源窗口仅3秒/隐藏10秒,不作为正式资源验收。覆盖24段输入、24次滚动、12次会话切换、两种分栏拖动、隐藏期间定时器/Worker推进、草稿和阅读位置恢复、显式重载、三个展示标签关闭以及三个原生页面显式关闭。恢复必须仍是原文档;重载必须换成新文档。展示关闭后页面仍可执行,显式关闭后原生视图和目标登记均消失。 + +热切换分别记录主界面面板就绪和子页面visibility+两次RAF:前者不能代替原生网页的展示机会,后者使用跨上下文`Date.now`,也不等于合成像素完成。此预演子页面展示P95为155 ms,超过150 ms门槛。12次切换期间另记录12次`browser_webview_capture_preview`、累计调用耗时2,733 ms;调用可能异步重叠,不能相加作为阻塞或把它直接认定为速度根因。当前代码每次面板重挂载都会重建预览缓存,是后续调用栈/时间线诊断的线索。 + +### 三页面正式基线:功能通过,原生展示尾延迟未达标 + +`browser-heavy-apple-baseline-1`使用v5的默认30秒资源窗口、45秒全部隐藏及相同交互工作量,已完整结束:`functionalPassed=true`、`performanceBudgetsPassed=false`、`passed=false`。Protocol hash为`aa15c8e7e20b1d81b44cef044024136518fcce408c05204776ca1dc6b0bca0b4`,harness hash为`137502920356678481597796b27a948d206bcd975a2904db1aa22274d83297ff`。进程返回0代表流程正常结束,不能代替报告中的未通过预算。 + +| 操作 | 实测 | 判断 | +| --- | --- | --- | +| 三次Agent打开真实网页 | 432/345/338 ms | 含固定模型响应、真实工具执行及网页就绪;不是纯模块首开或外网延迟 | +| 十二次热切换反馈/面板内容P95 | 99/117 ms | 分别通过100/150 ms门槛 | +| 十二次原生网页展示机会P95 | 171 ms | 未通过150 ms门槛,不能由面板内容117 ms替代 | +| 网页24段输入到RAF P95 | 15 ms | 保留完整草稿;不是系统可信按键到像素 | +| 输入/滚动帧P95,最大 | 17/17 ms,18/17 ms | 无>33.33 ms帧 | +| 导航/内容分栏帧P95,最大 | 18/18 ms,30/35 ms | 当前门槛通过;内容分栏慢帧1/72=1.39%,仍未达到<1%进阶目标 | +| 45秒隐藏后打开右面板 | 面板反馈57 ms、内容81 ms;原生网页展示244 ms | 单个带面板开合动画的恢复样本,需单独诊断,不混作热切换P95 | + +三网页均保留原文档、草稿和阅读位置。隐藏前后含5秒稳定期的区间内,三个页面timer分别推进50/50/51次,Worker消息330/321/332次,RAF计数0/0/5;最后一页5帧包含收起动作尚未完成的边界,不将该总差值当成稳定隐藏窗口的帧率。网页服务只收到a、b、c各一次初始请求和一次显式c重载,切换没有重复加载网页。 + +CPU是单核百分比,footprint为各窗口末尾MiB;A/B/C分别对应三个独立WebContent PID,C为可见页面。所有角色按PID及启动时间归因。合计列只相加完整窗口的CPU时间,包含表外小型辅助进程,不相加footprint为独占物理内存。 + +| 窗口 | 主WebContent CPU/footprint | 网页A、B、C CPU | 网页A、B、C footprint | GPU进程CPU/footprint | Rust宿主CPU/footprint | 可归属CPU合计 | +| --- | --- | --- | --- | --- | --- | ---: | +| 打开前30秒 | 0.80%/278.3 | — | — | 0.32%/70.0 | 3.81%/94.9 | 7.03% | +| 三页运行、一页可见30秒 | 0.65%/365.0 | 1.71/2.07/7.18% | 94.5/94.3/111.7 | 11.54%/83.8 | 14.90%/219.6 | 39.69% | +| 全部隐藏45秒 | 0.70%/401.0 | 2.37/1.72/2.16% | 95.2/95.3/104.1 | 2.19%/90.9 | 6.26%/129.4 | 17.30% | +| 恢复一页30秒 | 0.62%/410.9 | 2.66/1.54/7.22% | 96.3/98.4/122.9 | 11.17%/95.8 | 13.93%/144.3 | 38.68% | +| 展示标签关闭、网页仍保留30秒 | 0.77%/391.1 | 1.67/1.96/1.94% | 97.5/97.5/103.2 | 2.07%/93.1 | 6.44%/120.3 | 16.68% | +| 显式关闭网页后30秒 | 0.85%/391.1 | 进程退出 | 进程退出 | 0.30%/81.4 | 3.80%/119.8 | 6.74% | + +显式关闭后,三个网页PID在最终资源窗口中已不再出现;原生视图清单和Browser目标登记也均移除。宿主CPU回到3.80%,接近打开前3.81%,不能把“保留网页窗口”的后台工作误判为关闭泄漏。主窗口footprint仍高112.8 MiB、宿主高24.9 MiB、GPU进程高11.4 MiB,且保留了本次新生成的会话/工具结果;没有JS对象保留链,尚不能区分业务数据、缓存和未回收分配。主窗口全部隐藏窗口的采样峰值421.6 MiB、宿主279.6 MiB,也不代表未采样阶段的全程峰值。桌宠末尾72.5→77.1 MiB,不能据单轮短样本证明长期稳定。 + +正式12次切换同样触发12次预览截图(累计调用耗时2,730 ms)、36次browser eval(793 ms)、24次target-state更新(75 ms)、12次bounds更新(34 ms)及12次URL读取(5 ms)。截图路径存在原生PNG生成、base64传递、Rust PNG解码和JPEG重编码;尚未取得各段CPU/临界路径占比,下一步做独立调用栈诊断,不以删除预览、降低动画或停止后台任务换取达标。实际GPU busy/显存、JS堆、release、其他平台、远程路径、独立无主Browser生命周期尚未取得;本阶段不能标记Browser优化完成。 + +### 独立调用栈诊断:已确认CPU工作,尚未证明切换主因 + +`browser-stacks-apple-1`已正常完成18次三页面切换,使用同一生产前端/debug宿主,在三个进程分别进行15秒、1 ms间隔的原生调用栈采样,同时包装主文档布局读取。Protocol hash为`a7e1e0e807ae16ab6be9205b373673c6c7188bcf5a9cd624e410b2a51f961473`,harness hash为`69e9812a4f9ce0c570a3ce3d9550bf0ba89be0c48344d05d36ab4fa14e4df38b`。`coverage.instrumented=true`、`pilot=true`;诊断流程通过只说明采样和切换/关闭流程完成,不能作为速度、资源预算或完整功能验收。 + +- 宿主栈出现`encode_browser_preview`及原生`take_screenshot`路径。叶节点采样中,JPEG DCT变换536次、RGB转YCbCr 194次、PNG Paeth解码84次,确认预览转码确实消耗宿主CPU。这些是采样命中数,不是独占CPU百分比,也不能用全部线程的等待样本作分母推算CPU占比。 +- 18次切换新增18次预览调用,其中1次失败;累计调用耗时9,114 ms,失败调用2,143 ms。当前证据没有具体失败原因;不能将其认定为正常负载的超时或忽略。并发采样显著干扰调度,这组耗时不与正式基线的2,730 ms比较,多个异步调用的累计时长也不等于UI阻塞时间。 +- 主文档记录268次非零耗时布局读取。会话滚动容器`clientHeight`累计338 ms、单次最大13 ms;输入框外层`getBoundingClientRect`累计174 ms、最大11 ms;场景标签栏`scrollLeft`累计77 ms、最大6 ms。主WebContent栈也包含样式选择器匹配和GC工作。包装器及驱动自身均有开销,读回耗时不是独占CPU;这些结果仅帮助缩小后续时间线定位范围。 +- GPU进程调用栈包含合成/绘制工作,但未获得应用GPU busy或独占显存。采样没有补足该测量维度。 + +下一步需分清预览的PNG生成/JPEG转码、主界面布局和原生页面显示各自是否处于切换临界路径,再对有证据的热点做同协议A/B。不能因发现CPU热点就宣称解释了171 ms尾延迟,也不能直接降低截图质量、预览刷新或后台页面执行频率。本轮未实施Browser产品优化。 + +### 原生截图编码线程候选:三对完成,尚未验收 + +11月6日再次刷新`origin/main@d6a640fcc`,`platform/capture.rs`与当前基点一致。开放/草稿PR按screenshot、capture、preview、browser检索,并核对相关文件与差异:#3694仍为`9dab0e3…`,Browser API改动是关闭清理,不包含截图编码;#3698没有相关文件。没有重复实施已有修复。 + +独立原生调用栈及源码确认macOS的`WKWebView`截图回调在主线程完成TIFF到PNG编码。候选在主线程提取拥有独立所有权的TIFF字节,再由现有Tokio阻塞线程池创建/使用/释放位图对象和编码PNG;不跨线程传递NSImage/NSBitmapImageRep,不改PNG格式、尺寸、像素、预览JPEG质量或刷新频率。原有超时包含编码排队和执行;已超时请求在回调或排队结束时跳过尚未开始的工作。后台原生临时对象有独立autorelease pool。 + +等待Browser三对对照进程终止后才开始编译与测试,没有并行干扰计时。三项macOS聚焦测试通过:PNG尺寸/像素/透明度、损坏数据错误、阻塞池排队仍计入原超时;独立`cargo check -p openbitfun-webdriver`和`cargo build -p openbitfun-desktop --features devtools`通过。新runner语法、`git diff --check`及repository hygiene检查通过(117内容文件/10,279文件名)。原生候选SHA256为`0e960536f968dc101a5e82a64d47c29b2f9cf21012330fe7209fde347e7531a5`,旧版仍为`6ae6fa7a…`;源码快照、diff和构建清单保存在`browser-capture-native/`。这些本地检查不证明其他平台或真实远程行为。 + +新增`run-browser-capture.mjs`在相同前端、不同原生宿主下检查首页固定动画帧和真实Browser的静态文字/渐变/透明混合,要求PNG与JPEG预览解码像素一致;它与计时运行分离。Browser pair runner增加native轴,只允许宿主变化,强制两侧前端和每侧跨轮构建一致。TIFF跨线程传递增加临时字节副本,不能预设总CPU/内存降低;原生功能对照已通过,性能验收尚未完成。 + +`browser-capture-before-1`在旧宿主上已取得8张首页头像截图,但创建子WebView后读取WebDriver window rect失败:该驱动接口使用`get_webview_window`,不适用于包含多个WebView的原生Window。v2改为既有Tauri Window尺寸接口,并断言实际逻辑窗口宽度;保留失败证据,没有修改产品窗口行为或放宽像素断言。 + +`browser-capture-before-2`/`browser-capture-after-2`已完整通过。两侧前端均为`bundled-0d980ee8c4b20b6e`,protocol hash `b102cc904dadaa15fa030ccc7952da87da34b0fd866d3dedca56f6ffb2a31769`,harness hash `38ac81c8aa50035f6db1ab4834f154ec8d88ba85a9cc6f952cc6fdf2412f99a5`。16组解码图像的差异通道数、最大差值均为0:8组首页固定动画/滚动帧,4组原生Browser PNG及4组JPEG预览。首页位置/尺寸、浏览器viewport、实际滚动偏移、截图尺寸和格式一致;已查看完整首页定位图与候选Browser截图。该运行没有性能窗口,`performanceBudgetsPassed=false`表示未执行性能验收,不能将其当作速度失败或通过。汇总保存在`browser-capture-native/fidelity-comparison.json`。 + +`browser-capture-pairs-1`已按AB/BA/AB完成三对正式性能比较,两侧固定上述相同前端,只替换已保存的原生宿主;完整v5工作量、30秒资源窗口和45秒隐藏,没有并行构建/测试。六次功能通过,六次速度预算未全部通过;`comparable=true`、`passed=false`,进程最终返回1来自速度门槛,未丢弃失败样本。协议/harness仍为`aa15c8e7…`/`137502920…`,原始结果、汇总脚本和`metrics.json`保存在同目录。 + +| 配对 | 热反馈P95 ms,前→后 | 面板内容P95 ms,前→后 | 原生网页展示P95 ms,前→后 | 切页主WebContent CPU ms,前→后 | +| --- | ---: | ---: | ---: | ---: | +| 1 | 96→101 | 115→109 | 317→333 | 2639.5→2454.6 | +| 2 | 108→109 | 114→117 | 158→307 | 2511.6→2471.3 | +| 3 | 96→101 | 113→106 | 297→245 | 2612.5→2558.2 | + +每次12个热样本,此样本量的nearest-rank P95等于最大值。以下是每次结果的三次中位数,不是合并36次点击后的总体P95;范围与逐次值保存在`metrics.json`。 + +| 指标 | 旧宿主 | 原生候选 | 判断 | +| --- | ---: | ---: | --- | +| 切页主WebContent CPU时间 | 2612.5 ms | 2471.3 ms | −5.4%,三对均下降 | +| 切页宿主CPU时间 | 3697.9 ms | 3721.6 ms | +0.6%,不能宣称宿主计算量下降 | +| 切页GPU进程CPU时间 | 744.4 ms | 761.6 ms | +2.3%,不是GPU busy | +| 切页主WebContent峰值footprint | 426.2 MiB | 427.4 MiB | 基本持平,运行范围重叠 | +| 切页宿主峰值footprint | 317.2 MiB | 319.2 MiB | 未见峰值改善 | +| 关闭后宿主footprint | 142.3 MiB | 120.4 MiB | 三次分别142.6/142.3/141.3→120.4/128.5/117.8 MiB | +| 关闭后宿主相对自身初始窗口增长 | 38.2 MiB | 18.6 MiB | 三对均降低,但仍有保留量 | +| 关闭后主WebContent相对自身初始窗口增长 | 104.6 MiB | 100.9 MiB | 范围96.4–139.7/85.8–117.0 MiB重叠,不证明稳定内存收益 | +| 全部隐藏主WebContent/宿主/GPU进程CPU | 0.70%/6.30%/2.00% | 0.74%/6.51%/2.04% | 未取得后台资源下降证据 | + +六次输入、滚动与两类分栏的当前帧门槛均通过;三网页文档、草稿、阅读位置、后台计时器/Worker及显式关闭语义保留。原生展示P95的三次中位数为297→307 ms,面板内容为114→109 ms,不能用后者替代前者。候选三次热反馈101/109/101 ms均超过100 ms门槛;整组未验收。 + +目前证据支持小幅主WebContent CPU与关闭后宿主保留内存改善,不支持“原生展示尾延迟已解决”或“整体GPU/内存全面下降”。候选保留为未验收工作,后续需单独核对主线程编码迁移的调用栈,并定位原生显示前的等待;不能仅凭代码移到后台就宣称性能目标完成。 + +### 原生候选的线程与IPC诊断 + +`tests/e2e/reports/browser-capture-profile-2/`已完成,功能通过。使用原生编码候选`0e960536…`和同一`bundled-0d980ee8c4b20b6e`前端;诊断v2记录18次真实切换、689条自定义协议IPC请求/响应头边界及三个原生进程调用栈,没有丢弃追踪记录。Tauri 2.11.5的`invoke`/`ipc`属性不可写,诊断读取其本地实现后改为观察`fetch`传输,不覆盖内部方法、不消费响应体、不保留请求payload或凭证。此边界不包含响应解码/回调,也不覆盖postMessage后备传输;调用栈与JS包装有干扰,全部耗时仅作定位。 + +宿主调用树中`tiff_to_png_base64`出现在Tokio工作线程(含其系统并发队列栈),未出现在主线程;主线程仍可见`NSImage::TIFFRepresentation`。这验证迁移执行路径,不代表编码总CPU下降。18次切换都触发预览抓取,响应头耗时238–518 ms,不能据此认定它阻塞了切换,因为请求发生在show返回之后。 + +独立`ipc-phases.json`保留逐次时间线。例如第2轮C页:show请求在点击后117 ms发出、119 ms收到响应头,页面visibilitychange在215 ms;第4轮C页对应120/120/223 ms;第5轮A页131/133/217 ms。show返回不是实际绘制完成,约84–103 ms间隔还需区分原生消息应用、WebKit可见性投递和同时启动的预览工作。首个A页另出现1751 ms可见延迟,前段多个元数据/监听请求约1.4–1.6秒;保留这一受诊断条件影响的异常,不计入正式A/B,也不删除后再计算所谓收益。以下轻量诊断继续核对该间隔;当前仍未验收。 + +### 轻量IPC与预览延后实验:排除一项尾延迟假设 + +`browser-capture-ipc-light-1`关闭调用栈采样和布局包装器,仍使用上述相同前端和原生宿主。18次真实切换功能通过,记录688条IPC和18次预览请求。第1轮B页原生可见204 ms、show响应79 ms;第2轮A页对应217/87 ms,间隔125/130 ms仍存在。18次bounds请求均为逻辑像素`x=930, y=90, width=540, height=736`。这只说明请求值相同,不证明原生布局没有执行,也不证明取消这些请求安全。 + +`browser-preview-delay-diagnostic-1`用诊断v4将实际预览请求延后200 ms;全部18次真实抓取仍执行,功能检查通过。第1轮B页:show响应在点击后79 ms、网页可见221 ms,而真实抓取直到279 ms才发出,响应头在532 ms。**这一可见性尖峰先于截图请求,不能归因于预览抓取。** 不采用延后预览刷新的产品方案;两个独立诊断的尖峰次数不是同协议三对A/B,不能据此宣称性能收益。 + +本地锁定的Tauri runtime中,`show`将`WebviewMessage::Show`入队,GUI线程随后调用Wry的`set_visible`;macOS实现执行`NSView.setHidden`。因此IPC响应、原生视图应用、网页visibilitychange、RAF以及最终合成像素是不同边界。当前未取得原生应用时刻/逐帧合成证据,约100 ms间隔的根因仍待确认。这两轮是插桩诊断,不含正式CPU/内存资源窗口,不能替代已有三对验收结果,也不改变其未通过结论。 + +### 主界面输入框重复测量候选 + +独立诊断中输入框外层和输入区的布局读取,定位到`ChatInput.measureCapsuleInputWidth`:即使当前已是compact布局,每次挂载/宽度同步仍克隆整个输入框、插入隐藏DOM,再读取compact输入区宽度。候选仅在根节点和ChatComposer均确认compact、且实时输入区宽度有效时直接读取现有区域;expanded/不可用几何仍走原克隆测量,不缓存尺寸,也不改变折叠阈值、动画或刷新频率。Browser截图和页面生命周期完全沿用基线。 + +编辑前核对`origin/main@d6a640fcc`及开放/草稿PR:当前main的输入框差异涉及历史/大段粘贴,不包含本次测量修复;已检查#3751、#3588、#3752的ChatInput差异及#3698文件范围,未覆盖该路径。Browser的#3694仍是`9dab0e3…`,没有重复其关闭清理实现。GitHub插件接口此前不可用,本次通过`git`/`gh`核对。 + +聚焦的compact测量和ChatPane布局暂停共7项测试、`check:web`及两份Apple生产前端构建通过。基线通过构建期单文件转换移除本候选,工作区不回退其他修改;产物精确复现`bundled-bb74c94cbd986035`,候选为`bundled-0d980ee8c4b20b6e`,原生宿主不变。构建脚本及源码快照保留在`tests/e2e/reports/composer-width-builds/`。 + +原生几何对照`composer-layout-baseline-2`/`composer-layout-candidate-1`各24例通过:1000/1280逻辑像素窗口、空白/短文本/多级长文本/显式换行/中文文本/清空恢复。逐例草稿和compact/expanded状态相同,容器、输入区和surface各矩形差异最大0 px;compact实时宽度与旧克隆探针结果一致。Protocol hash为`38c79dcd03931543c5559f96a6d96fe8e7de549e20716c25fc44f5fda9c00a00`,harness hash为`f75a352d6878c3a02249f8d17e4e2f6bb463fcc29fe3d5da181c3124dca0827e`。此验证有额外布局探针,不计入性能窗口,也不是系统IME验证。 + +首轮`composer-layout-baseline-1`误将原生rect接口的物理像素当作逻辑像素,在500逻辑像素窗口使输入区无可用宽度而失败;v2按DPR转换,并断言实际`innerWidth`等于请求值。保留失败记录,没有放宽几何门槛。速度和资源收益需以同协议Browser三对A/B结果判断,几何通过不能替代性能验收。 + +`composer-width-browser-pairs-1`按AB/BA/AB完成三个正式配对。六次功能通过、速度预算均未通过;`comparison.json`为`comparable=true`、`passed=false`,pair进程最终返回1,不能当作流程中断或成功验收。协议、harness、宿主与环境均一致,使用v5默认30秒资源窗口/45秒隐藏。原始样本、构建及汇总脚本保留在同目录,`metrics.json`记录中位数和完整运行范围。 + +每次12个热样本,下表P95使用nearest-rank,当前样本量下等于该轮最大值;没有将各轮P95的中位数称作合并样本P95。 + +| 配对 | 反馈P95 前→后 ms | 面板内容P95 前→后 ms | 原生展示P95 前→后 ms | 主WebContent切页CPU时间 前→后 ms | +| --- | ---: | ---: | ---: | ---: | +| 1(AB) | 94→98 | 109→106 | 162→296 | 2763.2→2690.0 | +| 2(BA) | 104→107 | 112→128 | 205→153 | 2601.6→2234.5 | +| 3(AB) | 100→88 | 120→99 | 343→242 | 2735.8→2483.8 | + +三轮主WebContent切页CPU时间均下降,中位数2735.8→2483.8 ms(−9.2%);宿主3688.6→3723.3 ms(+0.9%),GPU进程738.0→791.3 ms(+7.2%)。GPU进程CPU不是GPU busy,主进程下降不能替代整体资源验收。各轮P95中位数:反馈100→98 ms、面板112→106 ms、原生展示205→242 ms;存在反向结果和明显波动,不能宣布切页体验已改善。六次输入/滚动和分栏均通过当前帧门槛。 + +下表为三个独立运行的中位数;CPU为单核百分比,内存为该窗口末尾physical footprint,完整范围在`metrics.json`。网页自己的计时器、Worker、动画及原文档恢复继续通过,没有缩减真实工作量。 + +| 窗口/进程 | CPU 前→后 | footprint 前→后 MiB | +| --- | ---: | ---: | +| 三页运行/主WebContent | 0.97→0.72% | 337.1→360.6 | +| 三页运行/宿主 | 14.08→14.26% | 223.5→221.3 | +| 三页运行/GPU进程 | 10.70→11.07% | 86.9→87.5 | +| 全部隐藏/主WebContent | 0.72→0.74% | 395.5→391.4 | +| 全部隐藏/宿主 | 6.21→6.07% | 120.7→120.8 | +| 全部隐藏/GPU进程 | 2.03→1.99% | 95.2→93.3 | +| 显式关闭后/主WebContent | 0.73→0.71% | 389.2→386.7 | +| 显式关闭后/宿主 | 3.79→3.77% | 126.4→120.6 | +| 显式关闭后/GPU进程 | 0.32→0.31% | 81.3→81.5 | + +切换阶段主WebContent采样峰值中位数423.9→439.4 MiB;关闭后相对各自打开前的主进程增长中位数106.7→112.2 MiB,运行范围99.4–118.0/95.6–112.5 MiB重叠,不能宣称稳定内存改善。GPU进程对应增长11.4→7.7 MiB也不是显存释放证明。 + +首轮候选296 ms来自第0轮B页(原生visibility 295 ms),同轮A页为215 ms;基线第三轮也出现343 ms。全部尖峰均保留,既不删除候选坏样本,也不据一次尖峰断言代码因果。当前仅保留输入框改动为待验收候选;下一步在相同前端上单独验证原生截图编码,不把几何一致或局部CPU下降替代“不降低操作体验”的要求。 + +## MiniApp运行态:正式基线完成,隐藏绘制与拖拽待优化 + +新增`run-miniapp-workload.mjs`及独立fixture/Page Object,不修改正在运行的Browser测量脚本或公共采样器。默认工作量为30个本地安装条目、3个真实运行应用;每个运行应用包含3,000行表格、400个Canvas点、50 ms周期的有界Worker计算/推送及每秒SDK RPC。应用通过生产创建API编译并持久化,通过实际本地库按钮启动,不用空列表或模拟Worker代替运行态。 + +计划检查首开、12次热切换、输入、滚动、计算按钮、导航分栏、45秒隐藏、恢复、逐个关闭及重开。目录计时要求全部fixture条目实际出现;应用内容计时要求真实Worker响应与推送抵达,并取得iframe自身的展示机会。PID来自Worker RPC,需与宿主责任归属及进程启动时间核对;关闭后需确认进程已消失,同时其他应用继续运行。隐藏阶段保留Worker、RPC、计时器和状态,不以停止业务工作获得低占用。 + +另有聚焦的`miniapp-workload-fixture.test.mjs`,通过真实Node Worker宿主检查推送、RPC、有界工作量及关闭输入后的退出,不将模拟函数调用当作真实Worker证据。SDK源码核对确认推送订阅应使用`worker:workload`,fixture已使用该公开事件,不能直接订阅桥接内部的`worker:event`包络。 + +Browser对照结束后,三个新增JS文件的语法检查、`git diff --check`及repository hygiene通过(121内容文件/10,283文件名)。fixture首轮直接从仓库ESM包内执行CommonJS的`worker_host.js`失败,保留此条件;测试改为与现有原生Worker集成fixture一致,将原文件逐字复制到隔离目录的`worker_host.cjs`。修正后真实Node宿主测试通过,包括UI模块语法、推送、RPC、工作量上限及关闭输入后退出。它不证明开发目录直接运行`.js`的Node兼容性,也不替代Bun或GUI验证。 + +`miniapp-heavy-apple-pilot-1`已结束,未通过:Bun 1.4.2运行时可用,成功创建30个fixture应用,本地总安装数35(含5个内置应用),完成未运行资源窗口;随后旧`nav-miniapps-entry`不在当前侧栏布局中,未进入应用启动。失败不是产品首开延迟,也未执行后续生命周期。v2沿用已有工作台E2E的持久化偏好格式,在测量前固定`builtin.miniapps`入口并刷新,等待新文档与真实导航按钮;计时仍使用用户点击。没有修改产品导航。 + +`miniapp-heavy-apple-pilot-2`及`miniapp-heavy-apple-pilot-3`均已结束,未通过。两轮成功打开三个真实应用并核对Worker PID归属;第二轮首开内容分别为404/354/297 ms,仅属短窗预演。输入阶段失败,第二轮的清理断言掩盖了原始错误,第三轮保留原始错误后定位为:选中iframe后,内部元素查找脚本访问了不存在的`window.__openbitfunWd.findElements`。不能将它归为MiniApp输入延迟或产品Worker故障。 + +独立原生回归`webdriver-frames-before-1`在同一二进制`0e960536…`复现该错误。桥接对象仅安装在原生顶层窗口,命令函数则在选中的iframe执行;修复让内部命令从`window.top`访问共享桥接,保留用户脚本和DOM读取的当前iframe语义。改动前已刷新main到`d6a640fcc…`,相关实现与本地一致;开放/草稿PR按webdriver、iframe、MiniApp、frame、findElements检索,检查相关差异,未发现覆盖此根因的修改(#3694涉及启动/IPC/Browser关闭,#3351涉及内存/测试辅助,均不修改该驱动路径)。 + +修复后二进制`ec3205e982d4e086824ba67e608312bf1a8532818242e95e5082094fdb46c4a3`及补丁/构建记录保存在`tests/e2e/reports/webdriver-frame-native/`。`cargo check -p openbitfun-webdriver`、Desktop devtools构建、格式化、JS语法和repository hygiene(125内容文件/10,285文件名)通过。`webdriver-frames-after-1`原生功能回归通过;与修复前使用相同前端、协议哈希`032186146a…`及测量脚本哈希`cd6617a723…`。实际输入和点击各收到1次事件,iframe滚动800 px,嵌套输入/标签、清空、父层/顶层恢复及按索引选择均通过;iframe自身仍没有桥接对象。此结果只证明本机macOS同源frame命令修复,不证明性能收益、跨域或远程行为。 + +`miniapp-heavy-apple-pilot-4`已完整结束:功能通过,速度预算未全部通过。真实输入、滚动、6次Worker计算、12次热切换、隐藏更新、草稿/阅读位置恢复、逐个关闭且不影响其他Worker、退出后重开均通过。目录填充94 ms,首次内容494/387/346 ms,热切换反馈/内容P95为43/49 ms,输入到RAF P95为14 ms;这些仅作流程观察,不替代正式基线。导航拖拽P95为36 ms(门槛<34),最大65 ms,14/88帧超过33.33 ms。隐藏前后每个iframe仍增加612次绘制回调,同时业务推送/RPC/计时器继续;不能直接将全部后台CPU归类为无效工作。 + +### 首次完整基线(v2,关闭内存受驱动引用影响) + +`tests/e2e/reports/miniapp-heavy-apple-baseline-1/`已完整结束:**功能通过,帧预算未通过;无优化A/B。** Apple Desktop前端`bundled-0d980ee8c4b20b6e`,上述已修复驱动的原生debug二进制`ec3205e982…`,Bun 1.4.2。协议哈希`2c107a624f8f9c64474acd04927f12ffe0ef2cb3ed283dc2cd1fd64ada7bc515`,测量脚本哈希`0520722e86c90933c242ddad8da0350ca99899bdd738cd8afe285d4430faa9a6`;6个完整资源窗口,普通30秒、全部隐藏45秒,各先稳定5秒。无并行构建或其他测试。原始`result.json`和提取的`metrics.json`均保留。 + +| 速度/连续操作 | 结果 | 判断 | +| --- | ---: | --- | +| 35个实际安装条目全部填充(30个fixture+5个内置) | 91 ms | 通过500 ms门槛;单次首开,不是P95 | +| 三应用首次真实内容 | 367/302/429 ms | 通过1000 ms门槛;预热后的首次启动,不是冷安装 | +| 12次热切换反馈/iframe内容P95 | 43/48 ms | 通过100/150 ms门槛 | +| 隐藏恢复/关闭后重开内容 | 31/278 ms | 状态保持及新Worker生命周期通过 | +| 24段输入到RAF P95 | 14 ms | 通过;不是OS按键到像素 | +| 输入/滚动/计算帧间隔P95 | 18/22/18 ms | 通过基本帧门槛;滚动1/26帧为34 ms | +| 导航拖拽帧间隔P95/最大 | 36/42 ms | P95未达<34 ms;21/86帧(24.42%)>33.33 ms | + +下表每格是“CPU% / 窗口结束footprint MiB”;CPU 100%是一核。三个Worker合计不是单个Worker占用。GPU行是GPU进程CPU及物理footprint,**不是实际GPU busy或显存**。 + +| 阶段 | 主WebContent | 桌面宿主 | GPU进程 | 3个Worker合计 | +| --- | ---: | ---: | ---: | ---: | +| 已安装、未运行 | 0.80 / 368.0 | 3.84 / 92.8 | 0.32 / 69.3 | 未启动 | +| 三应用、一页可见 | 19.95 / 595.3 | 15.05 / 93.5 | 13.94 / 89.6 | 3.14 / 30.2 | +| 全部隐藏 | 19.64 / 580.3 | 14.88 / 94.8 | 12.75 / 91.0 | 3.23 / 29.8 | +| 恢复可见 | 20.34 / 627.0 | 16.00 / 94.8 | 14.93 / 93.2 | 3.23 / 29.5 | +| 全部关闭 | 1.40 / 436.4 | 3.93 / 94.8 | 0.31 / 80.3 | 已退出 | +| 重开再关闭 | 1.58 / 437.2 | 3.79 / 94.8 | 0.29 / 80.1 | 已退出 | + +桌宠独立WebContent同时记录,CPU为1.54–2.18%,结束footprint为72.0–74.8 MiB,没有并入主界面。关闭后主界面仍较打开前高约68–69 MiB;这不是JS堆或泄漏证明,仍需区分缓存、分配器驻留及驱动元素句柄的保留。各应用iframe共享主WebContent,不能把该进程内存各算一份。正常业务工作保持:隐藏阶段的Worker实例/PID不变,计算、推送、RPC和计时器推进,恢复后草稿/阅读位置相同;显式关闭后Worker真实退出,其他应用保持运行。 + +当前目标是降低隐藏绘制和拖拽慢帧,保持可见动画、业务更新、布局/阅读位置及Worker生命周期。独立`miniapp-hidden-rendering-diagnostic-1`已完成,功能通过。每个临时CSS条件先稳定5秒再观测15秒;只有诊断页面被临时修改,产品源码未采用这些策略。 + +| 隐藏条件 | 主WebContent CPU | GPU进程CPU | 宿主CPU | 每个iframe绘制回调增量(含稳定期) | +| --- | ---: | ---: | ---: | ---: | +| 原样隐藏 | 17.32% | 12.34% | 14.64% | 1207 | +| iframe额外`display:none` | 18.49% | 13.45% | 15.60% | 1207 | +| 恢复原样隐藏 | 17.41% | 12.69% | 14.85% | 1207 | +| iframe额外`content-visibility:hidden` | 17.21% | 12.96% | 14.93% | 1207 | + +各条件中业务推送、RPC、计时器均继续,iframe内部视口维持1170×781;`display:none`使外部rect变为0,恢复后每个iframe增加一次resize事件。最终草稿、阅读位置、文档/Worker身份保持。上述单次诊断没有证明CPU收益,且无法覆盖任意第三方应用的resize或RAF业务语义,因此**不保留这两种CSS产品改动**,不把降低后台业务频率作为替代方案。 + +随后在恢复原样隐藏后单独采集12秒宿主、主WebContent、GPU进程调用栈。主WebContent中可见`serviceRequestAnimationFrameCallbacks → fillRect → RemoteGraphicsContextProxy`,GPU进程中可见`RemoteImageBuffer::flushContext`及`GraphicsContextCG::fillRect`,支持隐藏Canvas仍产生绘制工作的判断。宿主中同时存在Worker事件经Core/TransportEmitter转发的路径;尚未分离各路径成本,调用栈命中数也不是正式窗口CPU百分比。原始三个`*-sample.txt`保留。关闭后内存另以驱动句柄专项诊断核对,避免把自动化持有的iframe当作产品泄漏。 + +### 关闭内存口径修正:驱动持有旧iframe文档 + +`miniapp-driver-handles-diagnostic-1`通过一个真实应用复现测量侧保留:应用和Worker关闭、普通快照完成后,驱动元素表仍保留一个`INPUT`,`isConnected=true`,但所属文档已不在任何存活iframe内。诊断只删除这一失效的自动化句柄,不触碰产品缓存或强制GC;删除前后各15秒主WebContent footprint分别369.0→358.1、358.1→348.4 MiB。两个窗口均在自然回落,不能把后者差值直接归为清理收益;但强引用本身已被证实。 + +原公共快照只检查`node.isConnected`,无法识别整个iframe已移除而文档内部仍连接的节点。已补充沿`ownerDocument.defaultView.frameElement`逐层检查是否仍连接到当前主文档,仅删除失效驱动句柄;保留仍挂载的隐藏/嵌套iframe句柄。该本轮新增的公共Page Object不在最新main中;另核对#3351差异,未发现此跨文档句柄清理。`webdriver-frames-after-2`原生回归通过:挂载时未释放句柄且输入仍可读,移除后释放5个句柄,旧子文档句柄剩余0;此前输入、点击、滚动、嵌套/父层/顶层选择仍通过。JS语法、`git diff --check`及hygiene通过(129内容文件/10,289文件名)。MiniApp协议升至v3,重新基线已完成,见下表。**上面v2关闭后的68–69 MiB增长含测量侧保留风险,不能作为产品泄漏或优化验收证据。** 原数据不删除,v3不与v2直接计算产品收益。 + +### 当前正式基线(v3) + +`tests/e2e/reports/miniapp-heavy-apple-baseline-2/`完整通过功能检查,帧预算仍未通过;构建与v2相同,只有测量清理口径修正。协议哈希`9885ce62f67cda37ba070526ce49cfedeee19bf48232fe26a69edb5d87c95def`,脚本哈希`bd838c5886b8b2c638bd092c4f6a8b03e539c6c2210b939238c2f3997228362d`。完整6个资源窗口期间无其他构建/测试;原始及提取指标均保留。 + +- 目录填充88 ms;三应用首开351/307/347 ms;12次热切换反馈/内容P95为44/53 ms;隐藏恢复35 ms,重开356 ms。 +- 24段输入到RAF P95为16 ms;输入/滚动/计算帧间隔P95均18 ms,最大28/23/26 ms,均通过基本门槛。 +- 导航拖拽P95仍36 ms,最大65 ms,12/84帧(14.29%)>33.33 ms,1帧>50 ms;功能位移/回位通过,性能未达目标。 +- 关闭后的资源窗口开始前释放9个失效驱动句柄,重开再关闭时释放1个;均在计时外。显式关闭后Worker进程消失,隐藏业务更新与草稿/阅读位置检查仍通过。 + +每格仍为“CPU% / 窗口结束footprint MiB”;GPU行含义与上表相同,不是GPU利用率或显存。 + +| 阶段 | 主WebContent | 桌面宿主 | GPU进程 | 3个Worker合计 | +| --- | ---: | ---: | ---: | ---: | +| 已安装、未运行 | 0.41 / 350.4 | 3.75 / 95.1 | 0.32 / 73.0 | 未启动 | +| 三应用、一页可见 | 18.41 / 593.4 | 15.27 / 96.3 | 14.95 / 88.6 | 3.62 / 29.4 | +| 全部隐藏 | 18.56 / 607.0 | 14.74 / 97.3 | 12.70 / 94.8 | 3.64 / 28.8 | +| 恢复可见 | 20.12 / 614.5 | 15.64 / 97.3 | 14.79 / 96.9 | 3.52 / 28.7 | +| 全部关闭 | 1.44 / 395.5 | 3.66 / 97.4 | 0.30 / 80.0 | 已退出 | +| 重开再关闭 | 1.12 / 393.8 | 3.85 / 97.5 | 0.29 / 79.8 | 已退出 | + +主WebContent在关闭后相对自身初始窗口仍增加45.1/43.4 MiB;这仍需要实际保留链或更长驻留诊断,不能称为已解决的泄漏。桌宠单独记录,CPU1.47–2.35%、footprint71.9–75.9 MiB。当前正式优化目标以v3为基线:拖拽P95<34 ms、慢帧率继续向<1%优化;针对宿主事件投递与隐藏Canvas工作定位可避免成本,保留可见动画、Worker/推送/RPC频率与状态。**尚无MiniApp产品优化收益或配对验收。** + +此协议不覆盖市场安装、严格隔离iframe、独立Shell、展示位置迁移、AI调用或真实远程路径,也不取得独占应用内存/JS堆/GPU busy。暂无优化收益。 + +## 渲染隔离试验:未保留 + +`SceneViewport`的准备、运行、结束阶段会反复创建所有场景的React子树。候选修改仅在场景内容边界按原始输入隔离重渲染;窗口/工作区/激活输入变化继续传播,页面自身数据订阅、状态及上下文仍更新,DOM和动画宿主未改变。 + +- 最新main相同位置仍直接调用`renderScene`;开放PR按`SceneViewport`检索无匹配,先前已审查的相关PR不覆盖这一边界。 +- 24项聚焦测试通过,包含隐藏页不受其他切换阶段驱动、隐藏页订阅仍更新、工作区输入变化仍传播、原DOM继续复用。 +- `pnpm run check:web`通过;候选生产前端为`bundled-f3c7909edc837685`。 +- `tests/e2e/reports/residency-memo-pilot-pair/`的12轮/短资源窗口A/B诊断已完成,双方功能通过、速度预算未通过。原始快照和对照证据保留。 +- 每入口11个热样本:首页内容P95 **219→226 ms**,Agents **142→146 ms**,会话 **200→205 ms**。第1至12轮检查点之间主WebContent累计CPU **24.479→24.750秒**,GPU进程CPU **2.570→2.512秒**,墙钟 **68.03→67.76秒**。单组小幅差异不足以认定改善,不能将聚焦测试的少渲染次数直接当作性能收益。 +- 六类首页相关数据请求计数前后一致,首页四条动画在两个资源窗口边界均保持running/1600 ms。修改没有靠减少这些工作降低指标。 +- 已撤回仅属于本试验的`SceneContent` memo边界及相应计数测试,保留之前的P0修改。下一步用逐场景和布局/图层诊断确定成本来源。 + +## 已取得的证据 + +### 首页往返的资源隔离诊断 + +v3增加视口尺寸/DPR记录和原始导航RAF样本。三次均为同一native、1470×826 CSS px、DPR 2;30轮双入口切换,后续1秒资源窗口仅验证流程,不作为稳态CPU验收。均通过草稿、阅读锚点、编辑器恢复及速度门槛。 + +| 诊断 | GPU进程footprint:第1→30轮 MiB | 导航内容P95 ms | +| --- | ---: | --- | +| 首页/待办,原前端 | 210.1→771.1 | 首页124、待办106 | +| Insights/待办,原前端 | 229.4→229.0 | Insights92、待办100 | +| 首页/待办,取消动画时额外解除effect引用的候选 | 211.7→732.9 | 首页118、待办101 | + +前两次操作序列不同,仅用于定位:增长集中在本实验的首页往返路径,尚未证明具体图层或引擎对象是唯一原因。不能把两个不同页面序列的差值当作优化收益。 + +第三次候选依然明显增长;第1→30轮主WebContent累计CPU从12.812秒变为13.735秒,结束footprint从544.3变为609.8 MiB。单次微小速度差异不足以证明收益,已撤回该候选及其新增单测,保留既有P0代码。候选的5项品牌测试和构建曾通过,但不构成资源优化证据。下一步检查合成图层反复创建/销毁及实际保留关系,不调整logo位置、尺寸或动画节奏。 + +原始证据分别在`tests/e2e/reports/residency-home-isolation-1/`、`residency-static-isolation-1/`和`residency-effect-release-pilot-1/`;候选前端`bundled-edec3e92c1608491`仅供复核。v3与早期v1/v2不直接混算收益。 + +随后`residency-retain-pilot-1`验证保留同一组头像图层DOM、切走只取消动画的候选(`bundled-c461a6210d9a0940`)。30轮后仍出现类似增长,原生分配分类主要增长在`Malloc Large`,并非IOSurface常驻;候选及两项新增生命周期测试已撤回。8项头像测试曾通过,但没有得到资源收益,不保留无效产品修改。原始hook源码与运行结果均保存在证据目录。 + +- `native-process-probe.test.mjs` 和 `residency-metrics.test.mjs`:3项测试通过,覆盖原生 CPU 单位、无关进程排除、PID复用/进程到达退出与 RSS/footprint 区分。 +- `tests/e2e/reports/residency-pilot-2/`:旧P0前端下2轮预演通过;5个短窗口完成,草稿/编辑器恢复和关闭操作通过。它验证采样与流程,不用于当前版本收益结论。 +- 已构建当前工作树的生产前端并保存为 `tests/e2e/reports/residency-baseline-frontend/`,revision为 `bundled-526eef79e758acc5`。后续短程预演补充阅读锚点后,才执行正式长驻留。 +- 首次快照路径已由另一个专项自动清理,以及首次构建的 `--outDir` 转发未生效,均保留失败日志;没有计入通过次数。随后从已完成的生产构建保存独立快照。 + +## 关闭后内存归因与测量桥接开销(11月6日) + +### 延长驻留与弱引用观察 + +新增独立内存诊断协议,完整执行600段生成、实际工具调用、并发操作及120段取消,然后在普通关闭窗口后增加三个60秒窗口,各自稳定5秒。没有打开编辑器、强制GC或驱逐产品缓存。`vmmap`/`heap`仅在窗口外运行,但它们仍可能影响后续驻留,因此本节不能替代普通协议的优化验收。 + +`concurrent-memory-baseline-1`与`concurrent-memory-readback-1`均通过功能检查及各10个可见、无焦点窗口条件。原前端`e8c537a1…`与已撤回候选`8f7e5805…`使用同一原生程序`ec3205e9…`、协议`cd642c5f…`及脚本`3e33978a…`。完整汇总与原生原文见`tests/e2e/reports/concurrent-memory-validation/comparison.json`及两个运行目录。 + +| 主WebContent footprint MiB | 原前端 | 已撤回候选,仅作诊断 | +| --- | ---: | ---: | +| 生成前 | 347.2 | 345.2 | +| 生成完成 | 567.1 | 513.7 | +| 取消后 | 461.4 | 471.6 | +| 关闭约35秒 | 488.0 | 471.0 | +| 关闭约100秒 | 480.8 | 470.3 | +| 关闭约165秒 | 481.4 | 471.1 | +| 关闭约230秒 | 481.2 | 471.2 | + +两次运行在关闭后均观察到当前文档的会话根节点弱引用已回收,断开但仍存活的根节点为0,残留驱动句柄为0,Highlight范围为0。逻辑缓存账本保持3,227,136 bytes。这排除了所观察根节点及账本继续增长的直接证据,但不证明所有子对象或此前文档已释放:完成与取消阶段之间发生了刷新,弱引用观察随文档重置;尚未取得JS对象保留链。 + +原前端的WebKit Malloc区从已分配263.2 MiB、脏页与换出碎片47.0 MiB,变为305.0 MiB、111.3 MiB;最终原生footprint约481.1 MiB。JIT脏页/换出也有增加。原生分配类别表明分配器空闲页、碎片及代码资源都参与驻留,不能把全部增量当作业务对象泄漏。候选最终同一区已分配319.1 MiB、碎片95.2 MiB,说明仅比较最终footprint不足以判断对象占用。 + +本次每个前端只有一轮插桩诊断,且包含原生堆读取,**不推翻此前三对普通协议中候选关闭内存回归的结论;回读候选仍撤回**。 + +### 静态页面的驱动开销对照 + +在相同实际待办页,分别执行400次变化参数调用、400次固定参数调用,以及一次页面内400次计算。三次均功能通过,各4个窗口条件通过,DOM节点数在计算前后保持969。 + +| 控制模式 | 调用耗时 ms | 主WebContent CPU时间 ms | 调用窗口主footprint增量 MiB | +| --- | ---: | ---: | ---: | +| 400次变化参数 | 286.5 | 163.3 | 24.72 | +| 400次固定参数 | 149.2 | 50.0 | 1.91 | +| 一次页面内400次计算 | 1.5 | 约1 | 0.06 | + +原始结果为`evaluation-control-requests-1`、`evaluation-control-fixed-requests-1`及`evaluation-control-in-page-1`。模式故意改变桥接次数或输入,不是产品A/B;首个运行的调用前30秒内存也有约26 MiB漂移,不能把后续全部驻留归因于400次调用。 + +源码核对发现macOS驱动把脚本、参数及frame上下文拼进整份桥接源码,每次变化都会向WebKit提交不同源码,而原生`callAsyncJavaScript`参数字典为空。已刷新main至`f7f5b416…`并检查22个开放PR(含draft);相关#3694的diff不涉及此求值路径,最新main的这两处实现与本地原版一致。 + +候选改为固定桥接源码,通过WebKit原生字典传入脚本及数据;仅缓存桥接包装文本,每次仍重新求值用户表达式。独立crate检查与Desktop构建通过,原生候选SHA256为`0a18ed74ec028e2b9d6bd5f51a05bd128f1aa9c2ea02a8faf02b53daef076d18`。 + +新旧程序均通过结构化Unicode参数、同步函数/函数体、异步回调/Promise、表达式副作用、错误/超时恢复、选中frame参数、页面刷新及原有嵌套frame回归。候选另通过真实Browser多会话的9项检查,包括后台读取、并发、可见性、状态保持、错误恢复和逐会话关闭。证据分别为`native-arguments-functional-baseline-4`、`native-arguments-functional-candidate-2`及`native-arguments-build/browser-session-result.json`。先前测试预期校准失败和一次启动归因不明确的运行均保留,不计入通过。 + +用户暂停/清除原目标并要求收尾后,停止后续队列,已在运行的第二组自然结束,第三组未启动。最终为BA/AB两组、4次完整运行及16个窗口条件通过;少于原计划三组,明确标为pilot。原始证据为`native-arguments-performance-{baseline,candidate}-{1,2}`;校验/汇总脚本、`comparison.json`及停止记录见`native-arguments-build/`。未重写失败记录或把批次退出143记作完整三组成功。 + +| 同负载400次变化参数调用 | 第1组 前→后 | 第2组 前→后 | +| --- | ---: | ---: | +| 调用耗时 ms | 250.8→138.9 | 364.4→150.7 | +| 主WebContent CPU时间 ms | 168.3→27.3 | 216.6→52.5 | +| 宿主CPU时间 ms | 72.5→60.1 | 110.8→63.1 | +| 调用窗口主footprint增量 MiB | 23.48→19.12 | 19.89→20.16 | +| 延长观察结束主footprint MiB | 260.4→235.6 | 265.4→245.3 | +| 延长观察结束宿主footprint MiB | 111.1→134.9 | 96.9→95.7 | +| 延长观察结束GPU进程footprint MiB | 36.8→71.5 | 70.9→67.5 | + +两组均显示驱动调用耗时和主/宿主CPU下降;两次结果中位数的耗时约−52.9%、主CPU约−79.3%,只是小样本驱动开销观察。GPU进程在极短调用窗口的CPU时间旧版0.36/0.48 ms、新版0/0 ms,不据此宣称GPU硬件收益。内存仍有反向指标及明显波动,不接受“总体内存下降”结论,也不能证明整个页面的业务资源已优化。 + +原生参数修改保留为通过功能回归的测量工具改进;性能证据止于两组预演。**此项不记作产品页面优化收益;后续前端比较必须固定原生程序,不能跨版本混算。** 本轮结束时已确认批次、runner和对应测试宿主退出。 + +## 复现 + +先完成构建和前端 revision 生成,再单独运行;采样期间不要并行构建或运行其他基准。 + +```bash +node --test tests/e2e/scripts/native-process-probe.test.mjs tests/e2e/scripts/residency-metrics.test.mjs +OPENBITFUN_E2E_FRONTEND_DIR=/absolute/path/to/completed/frontend \ +OPENBITFUN_E2E_DESKTOP_BINARY=/absolute/path/to/desktop \ +OPENBITFUN_RESIDENCY_EVIDENCE=/absolute/path/to/new/evidence \ +node tests/e2e/scripts/run-workbench-residency.mjs +``` + +本轮已收尾,不再启动新的性能试验。生成中并发、终端、Browser和MiniApp的未达标项保留为后续工作;文件编辑器按用户要求停止专项,交由Monaco现有机制处理。各项未验收状态见收尾报告,不视为已完成整体优化。 diff --git a/docs/performance/07-pet-performance-optimization-2026-11-05.md b/docs/performance/07-pet-performance-optimization-2026-11-05.md new file mode 100644 index 0000000000..c7f5d5e0ee --- /dev/null +++ b/docs/performance/07-pet-performance-optimization-2026-11-05.md @@ -0,0 +1,70 @@ +# 桌面宠物优化报告 + +日期:2026-11-05。配套:[基线报告](06-pet-performance-baseline-2026-11-05.md) · [原始采样与检查结果](pet-performance-evidence-2026-11-05.json)。所有改动仍在工作区,未提交或发布。 + +整体性能工作的最终状态见[11月6日收尾报告](08-performance-wrap-up-2026-11-06.md);本页的小幅观察收益不代表整体应用CPU、GPU或内存目标已完成。 + +## 结果与判断 + +完成三个产品修复点及清理,并用六次隔离原生运行对比。宠物 WebContent 待机 CPU 中位数 **1.94% → 1.79%**(观察值约 −7.7%),工作态 **2.89% → 2.74%**(约 −5.2%)。这是小幅观测改善,样本量和输入干扰不足以证明统计显著或承诺线上收益。 + +**默认宠物内存没有下降,GPU 进程 CPU 没有明确下降。** 待机 RSS **196.30 → 196.48 MiB**,工作 RSS **201.22 → 201.38 MiB**,视作基本持平。全进程工作态 RSS 和 **1069.69 → 1069.42 MiB** 同样基本不变,不能宣称整体应用节省了大块内存。 + +## 已实施的优化 + +1. **修正注视结束后的动画恢复。** `AgentCompanionPet` 原先用 `animation: none` 停止注视时的走帧;清除简写会在 WebKit 中清掉原本不变的 `animationName`,让 BitBlob 重新套上额外呼吸缩放。现在只切换 `animationName`。原生优化样本始终保留 `openbitfun-petdex-walk`,尺寸为 96×104;保留精灵图已有呼吸、拖动、任务反应和动作优先级。JSDOM 不能充分复现 CSS 简写的原生行为,因此补充了真实 computed style 的前后证据。 +2. **让计时器与可见内容对应。** SVG 熊猫的待机动作/过渡计时器不再为精灵图运行;隐藏页面和 reduced motion 下不调度这些 SVG 动作。隐藏精灵图暂停 CSS 动画;桌面鼠标轮询在隐藏时撤销 interval,显示时立即读取一次并恢复原来的 120ms 间隔。没有降低可见鼠标响应或动画帧数。 +3. **合并用户精灵图并发读取并防止释放竞态。** 同一路径的进行中读取共用一个 Promise 和一个 Blob URL。删除/释放使旧读取失效,旧请求完成不会重新填充缓存,也不会清除新的替代请求;失败后可重试。图片探测卸载时同时移除 onload/onerror 回调。单测证明并发请求只读一次、只创建一个 URL;默认内置路径的 RSS 并不能代表这项修复的收益。 + +主要代码在 [AgentCompanionPet.tsx](../../src/web-ui/src/flow_chat/components/AgentCompanionPet.tsx)、[AgentCompanionDesktopPet.tsx](../../src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx)、[AgentCompanionPetService.ts](../../src/web-ui/src/infrastructure/config/services/AgentCompanionPetService.ts)。没有更改持久化、wire payload、命令注册或跨平台所有权边界。 + +## 前后量化结果 + +以下为每个状态三次运行的中位数,CPU 100% = 一颗核心。GPU 行是 **GPU 进程使用的 CPU / RSS**。 + +| 状态 | 进程 | 前 CPU % | 后 CPU % | 前 RSS MiB | 后 RSS MiB | +| --- | --- | --- | --- | --- | --- | +| 待机 | 宠物 WebContent | 1.94 | 1.79 | 196.30 | 196.48 | +| 待机 | Rust 宿主 | 2.99 | 2.64 | 374.88 | 355.22 | +| 待机 | GPU 进程 | 0.25 | 0.30 | 156.44 | 157.02 | +| 工作+固定气泡 | 宠物 WebContent | 2.89 | 2.74 | 201.22 | 201.38 | +| 工作+固定气泡 | Rust 宿主 | 3.49 | 3.54 | 354.22 | 354.06 | +| 工作+固定气泡 | GPU 进程 | 0.50 | 0.50 | 176.53 | 177.22 | +| 隐藏(未销毁) | 宠物 WebContent | 0.20 | 0.15 | 201.61 | 201.70 | +| 隐藏(未销毁) | Rust 宿主 | 0.30 | 0.35 | 354.25 | 354.06 | +| 隐藏(未销毁) | GPU 进程 | 0.00 | 0.05 | 176.39 | 177.17 | + +逐组宠物 WebContent CPU: + +| 组 | 待机前 % | 待机后 % | 工作前 % | 工作后 % | +| --- | --- | --- | --- | --- | +| 1 | 1.94 | 1.74 | 2.89 | 2.74 | +| 2 | 1.35 | 1.79 | 2.59 | 2.29 | +| 3 | 2.15 | 1.99 | 2.89 | 2.74 | + +第二组基线开始时仍在鼠标注视(`animation-name: none`),随后恢复走帧;其低待机 CPU 不能用来宣称优化回退,也不能静默删除。仅看第一/第三组,两组待机分别下降约 10.3% / 7.1%,仍不替代固定输入的大样本实验。工作态三组均略低,但只报告观察值。约 0.05 个百分点的差值已接近该窗口的进程 CPU 计时粒度。 + +隐藏状态的源代码和计时器测试证明无无效轮询 interval,并不意味着整个 WebView 的 CPU 变成零。宿主、事件、WebKit 自身仍有工作。系统 GPU busy 的前后波动详见基线报告,不能归属于此改动。 + +## 行为与生命周期验证 + +- 五个聚焦测试文件,共 **53 项通过**。覆盖 v1/v2、旧选择兼容、动作优先级、注视恢复、reduced motion、隐藏/恢复、窗口 hover、并发去重、释放中的加载与新旧加载交错、失败重试。 +- `pnpm run check:web` 通过:包括 TypeScript、Typography、Appearance contract、theme color 与 visual contract。`pnpm run motion:audit` 完成;它是意图盘点,不是 pass/fail gate。 +- 原生六次 `passed=true`,相同 binary / environment / measurement harness / protocol;每次独立存储。优化版三个待机、三个工作探针都观察到六个帧位置。所有优化版状态快照的尺寸/动画名/隐藏暂停已从原始结果复核,pair runner 也增加了对应守卫。 +- 每版每个状态的 RAF 间隔合计 n=471;优化前待机/工作 P95 18/18ms,优化后 18/19ms;最大 18 → 19ms,均无 >33.33ms 间隔。探针在资源窗口之外,不能当作 GPU 逐帧截图或真实输入延迟。 +- 每次窗口销毁后,宠物 WebContent 候选 PID 均退出;短窗口里没看到持续 DOM 增长。没有强制 GC、清产品缓存或通过移除可见功能改善数字。这不证明长时间、任意用户素材情况下无泄漏。 +- E2E runner JavaScript 语法检查、`git diff --check`、`pnpm run check:repo-hygiene` 均通过。 + +可复现入口:[run-pet-performance.mjs](../../tests/e2e/scripts/run-pet-performance.mjs)、[成对运行器](../../tests/e2e/scripts/run-pet-performance-pair.mjs)。场景操作封装在独立 Page Object,采样不会调用外部模型。详细命令位于各自 AGENTS.md。 + +## 为什么保留现有播放器与图片 + +额外做了一次隔离诊断:暂停 WAAPI 自动时间线,按原始 400ms 帧边界手动推进。它仍显示六帧,但待机宠物 CPU **1.64%**、宿主 **2.59%**、GPU 进程 **0.30%**、宠物 RSS **196.50 MiB**。这只是单次实验,差值落在正式样本的波动范围内,未形成足够证据支持增加新的调度器和主题/动作中断恢复机制;实验没有进入生产代码,也不混入成对结果。 + +原图单帧恰好支持 2× 显示密度,本轮没有降分辨率。独立 WebView 的约 200 MiB 常驻成本没有被这几个局部修复消除。若后续要显著降低它,应单独剖析 pet bootstrap、CSS/JS 常驻与 WebKit 内存,并针对大量用户宠物建立有生命周期引用的缓存管理;简单淘汰仍被预览使用的 Blob URL 会引入失效图片,不适合作为本轮快捷优化。 + +## 适用范围与剩余风险 + +只有本机 macOS debug host 的原生性能证据,不能外推 Windows/Linux、release host、真实高频流式气泡或大量自定义宠物。用户 Blob 缓存仍按已访问 package 保留,长时间跨多个 package 的有界驻留需要单独设计;本次解决的是并发孤儿 URL 和失效请求回填。 + +远程工作区、远程控制、Peer Device、Detached Dispatch 均未实际运行。本次没有新增协议或配置形状,兼容性由已有 v1/v2/旧选择 fixtures 覆盖,但这些 fixture 不构成真实远程运行证明。 diff --git a/docs/performance/08-performance-wrap-up-2026-11-06.md b/docs/performance/08-performance-wrap-up-2026-11-06.md new file mode 100644 index 0000000000..a094e8860b --- /dev/null +++ b/docs/performance/08-performance-wrap-up-2026-11-06.md @@ -0,0 +1,91 @@ +# 性能优化收尾报告 + +日期:2026-11-06。范围:工作台页面、首页与隐藏页面、长驻留、生成中并发、终端、Browser、MiniApp、桌宠及E2E测量。按用户要求结束本轮工作,文件编辑器专项已停止;没有继续分析或调整Monaco生命周期。 + +## 整体结论 + +已解决几项可复现的主要开销:分栏拖动中的广泛样式/布局工作、本地MiniApp列表等待市场网络、首页动画的持续渲染成本、取消输出后的滚动空转,以及隐藏终端的无效重绘。同时修复了logo错位、终端尺寸不同步和PTY自然退出未回收等功能问题。 + +**成果是多个具体场景的改善,不是“全应用性能目标全部完成”。** 普通导航和基础拖拽在对应短流程中通过门槛;更长驻留、生成工具启动、终端个别切换和Browser展示仍有超标。未证明整体常驻内存、应用级GPU利用率或显存全面下降,也没有完成release、其他OS和真实远程验收。 + +不同阶段的字体、输入协议、工作量和原生程序有调整,下列结果分别在各自匹配对照内成立,不能相加或折算成一个“整体提升百分比”。本报告记录性能优化收尾时的工作区状态。 + +## 已取得的主要结果 + +| 场景 | 实测前→后 | 结论与边界 | +| --- | --- | --- | +| MiniApp本地库热切换 | 内容P95 2593→65 ms | 解除本地展示对市场请求的等待;市场刷新、loading/error保留。第一轮实测为空本地库,不代表应用运行态或市场服务加速 | +| 左侧导航分栏拖动 | 每次帧间隔P95 64–66→23–25 ms;最大137→67 ms | 从明显卡顿降到本轮<34/<100 ms门槛内;实际位移与归位通过 | +| 中间内容分栏拖动 | P95 70–73→19–21 ms;最大152→59 ms | 同上;没有通过降低输入采样或丢弃阅读位置获得收益。<1%慢帧进阶目标未全部达到 | +| 首页可见时持续CPU | 主WebContent 19.27%→0.90%;宿主9.88%→3.56%;GPU进程CPU 4.53%→0.30% | 三对旧`harmony-bundled`配置下的结果,主CPU约−95.3%;不能直接宣称macOS默认字体也降低相同比例。实际Apple配置后来另测首页主CPU约0.93%,这是基线观察,不是前后收益 | +| 取消生成后的空转 | 主CPU 4.39%→0.93%;唤醒44.59→7.03次/秒;宿主4.62%→2.76%;GPU进程CPU 0.64%→0.37% | 三对同协议结果,主CPU约−78.8%;滚动量化导致的持续RAF循环已消除。工具启动等其他阶段仍有长帧,不能将此收益推广到所有生成场景 | +| 三终端全部隐藏且持续输出 | 主CPU 25.27%→9.61%;GPU进程CPU 2.13%→0.67%;可归属进程CPU合计44.38%→31.21% | 三对均支持隐藏重绘下降,合计约−30%;但宿主14.21%→17.83%,一次热反馈106 ms超门槛,整体仍未验收 | +| 桌宠 | 待机CPU 1.94%→1.79%;工作态2.89%→2.74% | 六次隔离运行的小幅观察,输入有干扰,不能承诺稳定百分比;默认宠物内存基本持平 | +| E2E原生求值桥接 | 两组400次调用:250.8/364.4→138.9/150.7 ms;主CPU 168.3/216.6→27.3/52.5 ms | 固定包装源码、数据走原生参数接口;只算测量工具开销改善。按收尾要求第三组未启动,保留为两组pilot,不算产品页面收益或完整三组验收 | + +CPU百分比的100%表示一个逻辑核。GPU进程CPU表示该进程消耗的CPU时间,**不是GPU硬件利用率**。帧间隔来自RAF,输入到RAF不等于系统可信输入到最终像素的延迟。 + +前四项详见[工作台报告](05-workbench-page-baseline-2026-11-05.md),并发/终端/工具结果详见[持续工作负载报告](06-workload-residency-baseline-2026-11-05.md),桌宠详见[专项报告](07-pet-performance-optimization-2026-11-05.md)。这些报告保留逐轮数据、反向指标、构建标识及复现命令。 + +## 实际完成的修改 + +- **页面与布局:** 本地MiniApp数据独立展示;缩小拖拽尺寸变量的样式传播范围;隐藏页面跳过无意义的布局/绘制,保留状态和订阅;待办展示时钟随可见性休眠,返回时立即校时。 +- **首页与logo:** 将运动部件放到SVG外的HTML合成图层,原SVG承担布局占位,按原viewBox映射坐标并响应尺寸变化。早期造成错位的方案撤回;保留方案验证位置、尺寸、滚动与原动画节奏。 +- **流式会话:** 状态槽退出动画结束后停止隐藏旋转;修复滚动缓动遇到原生坐标量化无法收敛的问题,保留原目标、缓动、用户阅读接管和增量展示。 +- **终端:** 修复连续拖拽/恢复竞态造成PTY尺寸漏同步;增加真实子进程等待与退出发布,回收自然退出的shell并保留末尾输出;回补隐藏xterm选区刷新绕过绘制暂停的路径。后台PTY继续运行,未缩短scrollback或改变标签detach语义。 +- **页面生命周期:** 修复标签栏嵌套坐标、快速切换露出目标和手动滚动取消;补齐场景准备阶段在卸载/Suspense路径的清理。这些是功能与生命周期修复,不分别编造性能收益。 +- **桌宠:** 修复注视后的动画恢复、无效计时器及隐藏鼠标轮询;合并用户精灵图并发加载,防止释放过程中的旧请求回填和孤儿Blob URL;保留图像分辨率与可见动画。 +- **自动化驱动:** 修复iframe选择后的内部桥接引用;仅释放已失效的跨文档元素句柄;macOS脚本通过原生字典传参,保持每次重新求值用户表达式及原有错误/超时/frame语义。 + +没有扩大“首次点击才加载”的范围,也没有通过切页卸载业务状态、停止正常数据刷新或取消可见动画降低数字。当前证据支持保留既有懒加载与空闲预热;尚无同条件release冷启动/关闭预热A/B,不能声称懒加载已节省某个具体MB数。 + +## 测量与验证成果 + +建立了可复用的原生E2E流程:隔离工作区/用户数据,冻结前端与native快照,校验协议、脚本、字体与构建hash,分开报告功能通过和性能预算通过,交替运行A/B并保留全部原始样本。构建、截图和原生分配检查与计时窗口分离。 + +后续测量使用Darwin进程归属及PID启动时间,分别观察主WebContent、桌宠、宿主、GPU进程;以窗口外CPU脉冲识别WebView归属。校正了字体配置、pointerdown计时、焦点/可见性、旧iframe句柄保留及脚本桥接自身开销。诊断插桩不当作正常产品验收;原生分配读取、RSS、physical footprint、JS堆和显存明确区分。 + +代表性已完成证据: + +- P0三对:6次完整运行、444次打开/切换、48次计时拖拽、18个资源窗口、48张头像截图;对应功能与速度预算通过。截图裁剪前后0差异,四条1600 ms动画及六类首页刷新请求保持。 +- Apple默认配置长驻留:28.74分钟、480次导航,功能通过,尾延迟预算未全部通过;随后补充真实pointerdown路径及无编辑器协议。 +- 生成中并发:600段有界输出、4次真实命令、4次真实文件编辑,同时输入/阅读/切页/拖分栏;另有120段取消。多轮三对比较已完成,功能与速度/资源结果分别记录。 +- 终端:三PTY各12万行,三对比较均完成;真实TTY尺寸、输入回应、隐藏输出、同PID恢复、自然退出、末尾内容与进程回收有断言。 +- Browser:三个原生子WebView,页面切换、输入、滚动、Canvas/Worker、隐藏恢复、关闭;两项候选分别完成三对,另有16组截图/预览解码像素一致性检查。 +- MiniApp:30条本地安装记录、3个真实应用与Worker,首开、热切换、输入/计算、隐藏业务推进、恢复和逐个关闭;完成基线,尚无产品优化A/B。 +- 最新驱动修改:新旧原生脚本语义/嵌套iframe回归通过,候选真实Browser多会话9项检查通过;资源对照最终完成2组、4次运行、16个窗口条件检查。 + +各模块的聚焦测试、类型检查及构建按阶段执行,详细日志见原报告;不把跨快照的检查相加成“最终整包全量通过”。本次收尾不再开启新的原生页面验证。 + +## 保留、撤回与未验收状态 + +| 分类 | 收尾处理 | +| --- | --- | +| 已验证功能修复及局部优化 | 保留页面加载/布局、首页图层、时钟/动画生命周期、滚动收敛、终端尺寸/退出、桌宠加载竞态、场景与驱动修复;收益仅在对应证据范围内成立 | +| 隐藏xterm回补 | 工作区保留;功能及隐藏CPU收益明确,整体仍未验收,106 ms反馈、宿主CPU上升及内存波动如实保留 | +| Browser输入框布局、原生截图编码移出主线程 | 工作区仍保留为未验收候选;主WebContent切页CPU分别约−9.2%/−5.4%,GPU进程CPU分别约+7.2%/+2.3%,展示尾延迟未通过。不得当作已完成的Browser优化发布结论 | +| 原生脚本参数传递 | 保留为通过功能回归的测量工具改进;仅两组资源预演,宿主/GPU进程内存有反向结果,完整性能验收未完成 | +| 滚动状态回读候选 | 已撤回:生成期主CPU约−7.2%,但关闭后主footprint中位数约+15.4%;后续单轮插桩诊断不推翻撤回结论 | +| 其他未建立收益的尝试 | 渲染memo、隐藏样式变体、重复写入/布局读取旁路、标签栏时序等性能候选已撤回;不保留以减少通知或读次数替代实际性能验证的结论 | +| 造成logo错位的早期方案 | 已撤回,由经过像素与几何检查的外部图层方案替代 | +| 文件编辑器 | 按用户要求停止专项,历史记录与既有改动保留;此前未完成的主题候选等不计为验收成果,不再扩展Monaco分析或回收策略 | + +“保留”表示修改仍在工作区,不等于所有场景或发布验收通过。本次收尾没有提交、发布,也没有继续试验上述未验收候选。 + +## 尚未完成的目标 + +- **速度:** 新pointerdown基线的首页/会话反馈P95仍为113/136 ms;会话内容152 ms略超150 ms。生成工具启动仍有>100 ms长帧;Browser原生展示、终端个别热反馈及MiniApp拖拽P95 36 ms未达目标。连续交互慢帧<1%的进阶目标未全面完成。 +- **资源:** MiniApp全部隐藏时主CPU约18.56%、GPU进程CPU约12.70%;关闭后主footprint仍约增加43–45 MiB。会话关闭约230秒后主footprint仍约481 MiB,已观察根节点回收且逻辑缓存约3.08 MiB,但分配器碎片、代码资源及实际对象保留链尚未完全分离。不能把残留footprint直接称为泄漏或已解决。 +- **GPU与内存证据:** 未取得应用级GPU busy/独占显存和完整JS对象保留链。系统AGX计数、GPU进程CPU及RSS/footprint不替代这些指标;没有可信的全应用“节省内存总量”。 +- **首开与规模:** release冷启动、加载/预热策略A/B、大工作区搜索/Git/watch、大量列表、中文IME/大段粘贴、多个会话同时生成及更长时间压力仍缺同口径结果。 +- **平台与远程:** 本轮为本机macOS/WKWebView、debug host+生产前端;Windows、Linux、真实SSH/Docker工作区、Remote Control、Peer Device、Detached Dispatch均未实际验证。 + +后续若恢复性能工作,应从这些明确缺口选择范围,并固定经过校正的测量协议重新建立对应基线;本轮不再自动继续。 + +## 收尾状态与交付 + +- 已停止后续E2E批次;最后一轮正常完成,未启动第三组。已核对对应批次、runner及测试宿主均退出。 +- 基线、原始失败、撤回候选、未验收证据均保留。大体积原生快照和日志在仓库忽略目录`tests/e2e/reports/`;本报告及专项报告保留关键结果与证据索引。 +- 最新驱动资源对照及停止记录:`tests/e2e/reports/native-arguments-build/{comparison.json,build-manifest.json,interruption.json,process-cleanup.txt}`。 +- 本次收尾只更新证据与文档状态,不继续修改产品交互或开展编辑器分析。 +- 收尾检查通过:`git diff --check`、5个新增测量/功能脚本的语法检查、报告内3个文档链接检查,以及repository hygiene(172个内容文件、10,323个文件名)。最新原生修改的独立crate检查、Desktop构建及功能E2E在上述对应快照下已通过;本次没有重跑整仓或全平台套件。 diff --git a/docs/performance/pet-performance-evidence-2026-11-05.json b/docs/performance/pet-performance-evidence-2026-11-05.json new file mode 100644 index 0000000000..a688d5c859 --- /dev/null +++ b/docs/performance/pet-performance-evidence-2026-11-05.json @@ -0,0 +1 @@ +{"protocol":"AB / BA / AB alternating; fresh process and storage for every run","runs":[{"pair":1,"label":"baseline","directory":"/openbitfun-pet-perf-1Eo6MF","report":{"schemaVersion":1,"label":"baseline-1","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-430fd6c0fc1530b6","algorithm":"sha256-path-content-v1","digest":"430fd6c0fc1530b6044d5fdcf2ba13f547b36b5114cdbba9c70f274f619ec1a5","fileCount":2737,"totalBytes":93312928},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890381840,"load":[1.55078125,1.6787109375,2.0185546875],"processes":[{"pid":70339,"rssMiB":358.71875,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.96875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.5,"cpuMs":1560,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":15,"In use system memory":284721152,"Alloc system memory":1701085184}},{"at":1793890382901,"load":[1.55078125,1.6787109375,2.0185546875],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1560,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":429047808,"Alloc system memory":1711603712}},{"at":1793890383964,"load":[1.55078125,1.6787109375,2.0185546875],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1560,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":352534528,"Alloc system memory":1705312256}},{"at":1793890385028,"load":[1.50634765625,1.6669921875,2.01220703125],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1560,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1696923648}},{"at":1793890386090,"load":[1.50634765625,1.6669921875,2.01220703125],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":454967296,"Alloc system memory":1702543360}},{"at":1793890387155,"load":[1.50634765625,1.6669921875,2.01220703125],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":401981440,"Alloc system memory":1687486464}},{"at":1793890388211,"load":[1.50634765625,1.6669921875,2.01220703125],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.3125,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.9375,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":290553856,"Alloc system memory":1678540800}},{"at":1793890389271,"load":[1.50634765625,1.6669921875,2.01220703125],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.796875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.3125,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":289619968,"Alloc system memory":1674346496}},{"at":1793890390336,"load":[1.54541015625,1.67236328125,2.01171875],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.3125,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":455049216,"Alloc system memory":1687306240}},{"at":1793890391388,"load":[1.54541015625,1.67236328125,2.01171875],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.3125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":401817600,"Alloc system memory":1682735104}},{"at":1793890392448,"load":[1.54541015625,1.67236328125,2.01171875],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345309184,"Alloc system memory":1678540800}},{"at":1793890393515,"load":[1.54541015625,1.67236328125,2.01171875],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":344375296,"Alloc system memory":1674346496}},{"at":1793890394578,"load":[1.54541015625,1.67236328125,2.01171875],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":453115904,"Alloc system memory":1686913024}},{"at":1793890395643,"load":[1.50146484375,1.6611328125,2.00537109375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352796672,"Alloc system memory":1682718720}},{"at":1793890396707,"load":[1.50146484375,1.6611328125,2.00537109375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1678524416}},{"at":1793890397772,"load":[1.50146484375,1.6611328125,2.00537109375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2360,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":284721152,"Alloc system memory":1674330112}},{"at":1793890398840,"load":[1.50146484375,1.6611328125,2.00537109375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":457834496,"Alloc system memory":1686945792}},{"at":1793890399906,"load":[1.4609375,1.64990234375,1.9990234375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":403996672,"Alloc system memory":1710080000}},{"at":1793890400938,"load":[1.4609375,1.64990234375,1.9990234375],"processes":[{"pid":70339,"rssMiB":358.671875,"cpuMs":2370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":377176064,"Alloc system memory":1705885696}},{"at":1793890401901,"load":[1.4609375,1.64990234375,1.9990234375],"processes":[{"pid":70339,"rssMiB":358.65625,"cpuMs":2370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.921875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":290258944,"Alloc system memory":1697497088}}],"cpu":[{"pid":70339,"role":"openbitfun-desktop","cpuPercent":0.29908778226409455,"startRssMiB":358.71875,"endRssMiB":358.65625},{"pid":70351,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.96875,"endRssMiB":129.78125},{"pid":70352,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19939185484272964,"startRssMiB":328.5,"endRssMiB":328.390625},{"pid":70353,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.921875}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4188},{"name":"openbitfun-petdex-breathe","state":"running","time":4188}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":101.49974060058594,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":98.30793762207033,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24312},{"name":"openbitfun-petdex-breathe","state":"running","time":24312}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":102.95204162597656,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":96.96734619140624,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793890407259,"load":[1.34375,1.6220703125,1.9873046875],"processes":[{"pid":70339,"rssMiB":379,"cpuMs":2590,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.390625,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.171875,"cpuMs":340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":434913280,"Alloc system memory":1729970176}},{"at":1793890408317,"load":[1.34375,1.6220703125,1.9873046875],"processes":[{"pid":70339,"rssMiB":379,"cpuMs":2610,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.359375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.171875,"cpuMs":360,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":400588800,"Alloc system memory":1727873024}},{"at":1793890409383,"load":[1.34375,1.6220703125,1.9873046875],"processes":[{"pid":70339,"rssMiB":379,"cpuMs":2640,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.359375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.1875,"cpuMs":380,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":399654912,"Alloc system memory":1723678720}},{"at":1793890410448,"load":[1.31591796875,1.611328125,1.9814453125],"processes":[{"pid":70339,"rssMiB":379.078125,"cpuMs":2680,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.25,"cpuMs":400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":442105856,"Alloc system memory":1717764096}},{"at":1793890411514,"load":[1.31591796875,1.611328125,1.9814453125],"processes":[{"pid":70339,"rssMiB":379.078125,"cpuMs":2710,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.25,"cpuMs":420,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":434110464,"Alloc system memory":1717387264}},{"at":1793890412579,"load":[1.31591796875,1.611328125,1.9814453125],"processes":[{"pid":70339,"rssMiB":379.078125,"cpuMs":2730,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.1875,"cpuMs":440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":460390400,"Alloc system memory":1715290112}},{"at":1793890413646,"load":[1.31591796875,1.611328125,1.9814453125],"processes":[{"pid":70339,"rssMiB":379.09375,"cpuMs":2760,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.203125,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":392413184,"Alloc system memory":1711095808}},{"at":1793890414712,"load":[1.31591796875,1.611328125,1.9814453125],"processes":[{"pid":70339,"rssMiB":379.09375,"cpuMs":2790,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.234375,"cpuMs":480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":441729024,"Alloc system memory":1711095808}},{"at":1793890415777,"load":[1.21044921875,1.58447265625,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.109375,"cpuMs":2820,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.328125,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":433258496,"Alloc system memory":1711095808}},{"at":1793890416842,"load":[1.21044921875,1.58447265625,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.109375,"cpuMs":2860,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.34375,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":433750016,"Alloc system memory":1711095808}},{"at":1793890417907,"load":[1.21044921875,1.58447265625,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.109375,"cpuMs":2880,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.34375,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":392413184,"Alloc system memory":1711095808}},{"at":1793890418972,"load":[1.21044921875,1.58447265625,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.125,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.375,"cpuMs":590,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":447692800,"Alloc system memory":1711128576}},{"at":1793890420037,"load":[1.2734375,1.59130859375,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.125,"cpuMs":2940,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.375,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":433258496,"Alloc system memory":1711128576}},{"at":1793890421103,"load":[1.2734375,1.59130859375,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.125,"cpuMs":2970,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.765625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.390625,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":433750016,"Alloc system memory":1711013888}},{"at":1793890422168,"load":[1.2734375,1.59130859375,1.9697265625],"processes":[{"pid":70339,"rssMiB":379.171875,"cpuMs":3000,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.765625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.390625,"cpuMs":640,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":442138624,"Alloc system memory":1711390720}},{"at":1793890423235,"load":[1.2734375,1.59130859375,1.9697265625],"processes":[{"pid":70339,"rssMiB":353.796875,"cpuMs":3030,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.53125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.390625,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":434683904,"Alloc system memory":1710997504}},{"at":1793890424300,"load":[1.2734375,1.59130859375,1.9697265625],"processes":[{"pid":70339,"rssMiB":353.796875,"cpuMs":3060,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.40625,"cpuMs":680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":400588800,"Alloc system memory":1710997504}},{"at":1793890425367,"load":[1.25146484375,1.5810546875,1.9638671875],"processes":[{"pid":70339,"rssMiB":353.796875,"cpuMs":3090,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.40625,"cpuMs":700,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":399654912,"Alloc system memory":1710997504}},{"at":1793890426433,"load":[1.25146484375,1.5810546875,1.9638671875],"processes":[{"pid":70339,"rssMiB":353.796875,"cpuMs":3120,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.296875,"cpuMs":720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":442105856,"Alloc system memory":1711374336}},{"at":1793890427318,"load":[1.25146484375,1.5810546875,1.9638671875],"processes":[{"pid":70339,"rssMiB":353.796875,"cpuMs":3150,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":156.75,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":196.296875,"cpuMs":730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":434683904,"Alloc system memory":1710997504}}],"cpu":[{"pid":70339,"role":"openbitfun-desktop","cpuPercent":2.7917642953287802,"startRssMiB":379,"endRssMiB":353.796875},{"pid":70351,"role":"com.apple.WebKit.GPU","cpuPercent":0.24926466922578394,"startRssMiB":156.75,"endRssMiB":156.75},{"pid":70352,"role":"com.apple.WebKit.WebContent","cpuPercent":0.7976469415225085,"startRssMiB":328.390625,"endRssMiB":328.40625},{"pid":70353,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.046875,"endRssMiB":8.953125},{"pid":71062,"role":"com.apple.WebKit.WebContent","cpuPercent":1.9442644199611145,"startRssMiB":196.171875,"endRssMiB":196.296875}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5014},{"name":"openbitfun-petdex-walk","state":"running","time":3806}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25139},{"name":"openbitfun-petdex-walk","state":"running","time":23931}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793890435030,"load":[1.31103515625,1.587890625,1.9638671875],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":3480,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.8125,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.125,"cpuMs":1070,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":5,"In use system memory":449773568,"Alloc system memory":1712504832}},{"at":1793890436089,"load":[1.52587890625,1.6279296875,1.9755859375],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":3520,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.796875,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.140625,"cpuMs":1100,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":415678464,"Alloc system memory":1712504832}},{"at":1793890437154,"load":[1.52587890625,1.6279296875,1.9755859375],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":3550,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.8125,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.15625,"cpuMs":1130,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":434601984,"Alloc system memory":1712504832}},{"at":1793890438220,"load":[1.52587890625,1.6279296875,1.9755859375],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":3580,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.15625,"cpuMs":1150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":457195520,"Alloc system memory":1712881664}},{"at":1793890439285,"load":[1.52587890625,1.6279296875,1.9755859375],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":3620,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.84375,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.40625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.21875,"cpuMs":1180,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":7,"In use system memory":449396736,"Alloc system memory":1712504832}},{"at":1793890440349,"load":[1.7236328125,1.6669921875,1.9873046875],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3660,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.84375,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.09375,"cpuMs":1210,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":415694848,"Alloc system memory":1712521216}},{"at":1793890441415,"load":[1.7236328125,1.6669921875,1.9873046875],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3700,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.84375,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.09375,"cpuMs":1240,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":440451072,"Alloc system memory":1712521216}},{"at":1793890442481,"load":[1.7236328125,1.6669921875,1.9873046875],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3740,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.859375,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.265625,"cpuMs":1280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":456818688,"Alloc system memory":1712521216}},{"at":1793890443546,"load":[1.7236328125,1.6669921875,1.9873046875],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.859375,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.28125,"cpuMs":1300,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":5,"In use system memory":448348160,"Alloc system memory":1712521216}},{"at":1793890444613,"load":[1.7236328125,1.6669921875,1.9873046875],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3810,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.859375,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.28125,"cpuMs":1330,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":434601984,"Alloc system memory":1712521216}},{"at":1793890445678,"load":[1.66552734375,1.65576171875,1.9814453125],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.3125,"cpuMs":1350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":473251840,"Alloc system memory":1739849728}},{"at":1793890446743,"load":[1.66552734375,1.65576171875,1.9814453125],"processes":[{"pid":70339,"rssMiB":353.859375,"cpuMs":3880,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.875,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.34375,"cpuMs":1390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":456818688,"Alloc system memory":1739833344}},{"at":1793890447806,"load":[1.66552734375,1.65576171875,1.9814453125],"processes":[{"pid":70339,"rssMiB":353.859375,"cpuMs":3920,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.875,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.484375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":448348160,"Alloc system memory":1735639040}},{"at":1793890448872,"load":[1.66552734375,1.65576171875,1.9814453125],"processes":[{"pid":70339,"rssMiB":353.859375,"cpuMs":3960,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.890625,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.5,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":414105600,"Alloc system memory":1731444736}},{"at":1793890449937,"load":[1.66552734375,1.65576171875,1.9814453125],"processes":[{"pid":70339,"rssMiB":353.859375,"cpuMs":3990,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.890625,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.5,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":478953472,"Alloc system memory":1727660032}},{"at":1793890451002,"load":[1.93212890625,1.7109375,1.9990234375],"processes":[{"pid":70339,"rssMiB":353.859375,"cpuMs":4040,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.890625,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.5,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":462782464,"Alloc system memory":1725120512}},{"at":1793890452065,"load":[1.93212890625,1.7109375,1.9990234375],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":4080,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.90625,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.421875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.515625,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":416317440,"Alloc system memory":1723023360}},{"at":1793890453132,"load":[1.93212890625,1.7109375,1.9990234375],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.90625,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.4375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.515625,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":432898048,"Alloc system memory":1718829056}},{"at":1793890454196,"load":[1.93212890625,1.7109375,1.9990234375],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":4150,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.90625,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.4375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.53125,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":457228288,"Alloc system memory":1719205888}},{"at":1793890455089,"load":[1.93212890625,1.7109375,1.9990234375],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":4180,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.8125,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.4375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.546875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":450002944,"Alloc system memory":1718386688}}],"cpu":[{"pid":70339,"role":"openbitfun-desktop","cpuPercent":3.4897053691609754,"startRssMiB":353.875,"endRssMiB":353.875},{"pid":70351,"role":"com.apple.WebKit.GPU","cpuPercent":0.4985293384515679,"startRssMiB":176.8125,"endRssMiB":176.8125},{"pid":70352,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14955880153547035,"startRssMiB":328.40625,"endRssMiB":328.4375},{"pid":70353,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.953125,"endRssMiB":9.015625},{"pid":71062,"role":"com.apple.WebKit.WebContent","cpuPercent":2.8914701630190933,"startRssMiB":201.125,"endRssMiB":201.546875}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%;","name":"none","state":"running","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%;","name":"none","state":"running","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793890462834,"load":[1.93603515625,1.7197265625,1.99853515625],"processes":[{"pid":70339,"rssMiB":353.890625,"cpuMs":4360,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.453125,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.796875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":455704576,"Alloc system memory":1722433536}},{"at":1793890463896,"load":[1.93603515625,1.7197265625,1.99853515625],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4360,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.453125,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.75,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352796672,"Alloc system memory":1716142080}},{"at":1793890464962,"load":[1.93603515625,1.7197265625,1.99853515625],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.75,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1709850624}},{"at":1793890466017,"load":[1.86083984375,1.70751953125,1.99267578125],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.75,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":456081408,"Alloc system memory":1716518912}},{"at":1793890467078,"load":[1.86083984375,1.70751953125,1.99267578125],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.75,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":459292672,"Alloc system memory":1714044928}},{"at":1793890468143,"load":[1.86083984375,1.70751953125,1.99267578125],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.6875,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":290553856,"Alloc system memory":1705132032}},{"at":1793890469210,"load":[1.86083984375,1.70751953125,1.99267578125],"processes":[{"pid":70339,"rssMiB":353.84375,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1690451968}},{"at":1793890470274,"load":[1.86083984375,1.70751953125,1.99267578125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":452952064,"Alloc system memory":1703411712}},{"at":1793890471336,"load":[1.79150390625,1.6953125,1.98681640625],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":402210816,"Alloc system memory":1698840576}},{"at":1793890472375,"load":[1.79150390625,1.6953125,1.98681640625],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":290553856,"Alloc system memory":1694646272}},{"at":1793890473442,"load":[1.79150390625,1.6953125,1.98681640625],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":344375296,"Alloc system memory":1690451968}},{"at":1793890474506,"load":[1.79150390625,1.6953125,1.98681640625],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":455704576,"Alloc system memory":1703034880}},{"at":1793890475542,"load":[1.72802734375,1.68359375,1.98095703125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":401866752,"Alloc system memory":1698840576}},{"at":1793890476609,"load":[1.72802734375,1.68359375,1.98095703125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4400,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345309184,"Alloc system memory":1694646272}},{"at":1793890477675,"load":[1.72802734375,1.68359375,1.98095703125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4400,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":284721152,"Alloc system memory":1690451968}},{"at":1793890478739,"load":[1.72802734375,1.68359375,1.98095703125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.640625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":457261056,"Alloc system memory":1703034880}},{"at":1793890479800,"load":[1.72802734375,1.68359375,1.98095703125],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.609375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352534528,"Alloc system memory":1698840576}},{"at":1793890480863,"load":[1.66943359375,1.671875,1.97509765625],"processes":[{"pid":70339,"rssMiB":353.921875,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.46875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.609375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1694646272}},{"at":1793890481928,"load":[1.66943359375,1.671875,1.97509765625],"processes":[{"pid":70339,"rssMiB":353.9375,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.484375,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.609375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":284721152,"Alloc system memory":1690451968}},{"at":1793890482897,"load":[1.66943359375,1.671875,1.97509765625],"processes":[{"pid":70339,"rssMiB":353.9375,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":176.828125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.484375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":71062,"rssMiB":201.609375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":458080256,"Alloc system memory":1703067648}}],"cpu":[{"pid":70339,"role":"openbitfun-desktop","cpuPercent":0.29905796740268153,"startRssMiB":353.890625,"endRssMiB":353.9375},{"pid":70351,"role":"com.apple.WebKit.GPU","cpuPercent":0.049842994567113594,"startRssMiB":176.875,"endRssMiB":176.828125},{"pid":70352,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19937197826845438,"startRssMiB":328.453125,"endRssMiB":328.484375},{"pid":70353,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.0625,"endRssMiB":9.046875},{"pid":71062,"role":"com.apple.WebKit.WebContent","cpuPercent":0.09968598913422719,"startRssMiB":201.796875,"endRssMiB":201.609375}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793890487979,"load":[1.61572265625,1.66064453125,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.875,"cpuMs":4450,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.59375,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":339329024,"Alloc system memory":1683390464}},{"at":1793890489042,"load":[1.61572265625,1.66064453125,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":4450,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.59375,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1679196160}},{"at":1793890490108,"load":[1.61572265625,1.66064453125,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":4460,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.46875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":455294976,"Alloc system memory":1687961600}},{"at":1793890491174,"load":[1.646484375,1.666015625,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.828125,"cpuMs":4460,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.46875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":448888832,"Alloc system memory":1687584768}},{"at":1793890492240,"load":[1.646484375,1.666015625,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4460,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.46875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":319602688,"Alloc system memory":1679196160}},{"at":1793890493304,"load":[1.646484375,1.666015625,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4460,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.46875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1675001856}},{"at":1793890494370,"load":[1.646484375,1.666015625,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4470,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.46875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":456081408,"Alloc system memory":1687961600}},{"at":1793890495436,"load":[1.646484375,1.666015625,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4470,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":401637376,"Alloc system memory":1683390464}},{"at":1793890496487,"load":[1.67431640625,1.67138671875,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345309184,"Alloc system memory":1679196160}},{"at":1793890497541,"load":[1.67431640625,1.67138671875,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":284721152,"Alloc system memory":1675001856}},{"at":1793890498606,"load":[1.67431640625,1.67138671875,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":455704576,"Alloc system memory":1687584768}},{"at":1793890499671,"load":[1.67431640625,1.67138671875,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.546875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352796672,"Alloc system memory":1683390464}},{"at":1793890500733,"load":[1.67431640625,1.67138671875,1.96923828125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4490,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1980,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":318947328,"Alloc system memory":1679212544}},{"at":1793890501788,"load":[1.6201171875,1.66015625,1.96337890625],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4490,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":284721152,"Alloc system memory":1675018240}},{"at":1793890502853,"load":[1.6201171875,1.66015625,1.96337890625],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":424574976,"Alloc system memory":1687601152}},{"at":1793890503909,"load":[1.6201171875,1.66015625,1.96337890625],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352534528,"Alloc system memory":1683406848}},{"at":1793890504974,"load":[1.6201171875,1.66015625,1.96337890625],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":289619968,"Alloc system memory":1679212544}},{"at":1793890506040,"load":[1.5703125,1.64892578125,1.95751953125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":453738496,"Alloc system memory":1687977984}},{"at":1793890507107,"load":[1.5703125,1.64892578125,1.95751953125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":402210816,"Alloc system memory":1687584768}},{"at":1793890508042,"load":[1.5703125,1.64892578125,1.95751953125],"processes":[{"pid":70339,"rssMiB":353.8125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":70351,"rssMiB":149.453125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":70352,"rssMiB":328.734375,"cpuMs":1990,"role":"com.apple.WebKit.WebContent"},{"pid":70353,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":352534528,"Alloc system memory":1683390464}}],"cpu":[{"pid":70339,"role":"openbitfun-desktop","cpuPercent":0.24921497283556795,"startRssMiB":353.875,"endRssMiB":353.8125},{"pid":70351,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":149.59375,"endRssMiB":149.453125},{"pid":70352,"role":"com.apple.WebKit.WebContent","cpuPercent":0.5981159348053631,"startRssMiB":328.546875,"endRssMiB":328.734375},{"pid":70353,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.015625,"endRssMiB":8.984375}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[70351,70352,70353,71062],"hostPid":70339,"petCandidatePids":[71062],"mainCandidatePids":[70351,70352,70353]},"restCadence":{"frames":[25372,25374,25391,25407,25424,25441,25457,25474,25491,25507,25524,25541,25557,25574,25591,25607,25624,25640,25657,25674,25691,25707,25724,25741,25757,25773,25791,25806,25823,25841,25856,25874,25891,25907,25924,25941,25957,25974,25991,26007,26023,26041,26056,26074,26091,26107,26124,26141,26157,26174,26191,26207,26223,26241,26257,26274,26291,26307,26324,26341,26357,26374,26391,26407,26424,26441,26457,26473,26491,26507,26523,26541,26556,26574,26591,26607,26623,26641,26657,26674,26691,26707,26724,26740,26757,26774,26791,26807,26824,26841,26856,26874,26891,26907,26924,26941,26956,26974,26991,27007,27024,27041,27057,27074,27091,27106,27124,27141,27157,27174,27191,27207,27224,27241,27257,27273,27291,27307,27324,27341,27357,27374,27391,27407,27424,27441,27457,27474,27490,27506,27524,27541,27557,27574,27591,27607,27623,27640,27657,27674,27691,27707,27724,27741,27757,27773,27791,27807,27823,27841,27856,27874,27891,27907,27924,27941,27957,27974],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53143,53157,53174,53190,53207,53224,53240,53256,53273,53290,53307,53324,53340,53357,53374,53390,53407,53424,53440,53457,53474,53490,53507,53523,53539,53557,53574,53590,53606,53623,53640,53656,53673,53689,53706,53724,53740,53757,53773,53790,53807,53824,53840,53857,53874,53890,53906,53923,53940,53957,53974,53990,54007,54024,54040,54057,54074,54090,54107,54124,54140,54156,54174,54190,54207,54224,54240,54257,54274,54290,54307,54324,54339,54356,54374,54390,54407,54424,54440,54457,54474,54490,54507,54524,54540,54557,54573,54590,54607,54624,54640,54657,54674,54690,54707,54724,54740,54757,54774,54790,54806,54824,54840,54856,54874,54890,54906,54924,54939,54957,54974,54989,55007,55024,55040,55057,55073,55090,55107,55124,55140,55157,55174,55189,55207,55224,55240,55257,55274,55290,55307,55324,55340,55357,55374,55390,55406,55424,55440,55457,55474,55491,55507,55524,55540,55556,55574,55590,55607,55623,55640,55657,55673,55689,55707,55724,55740,55757],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"pair":1,"label":"optimized","directory":"/openbitfun-pet-perf-7x5vwU","report":{"schemaVersion":1,"label":"optimized-1","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-ce86dd79f9268b72","algorithm":"sha256-path-content-v1","digest":"ce86dd79f9268b72fdf032f4a092fb681f0e675f8f7b7cda8dbd67d6f13de049","fileCount":2737,"totalBytes":93313799},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890540234,"load":[1.69091796875,1.6787109375,1.95751953125],"processes":[{"pid":73839,"rssMiB":306.3125,"cpuMs":1700,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.21875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":44,"Renderer Utilization %":44,"Tiler Utilization %":12,"In use system memory":357957632,"Alloc system memory":1768865792}},{"at":1793890541291,"load":[1.63525390625,1.6669921875,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.21875,"cpuMs":1710,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.21875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1733214208}},{"at":1793890542358,"load":[1.63525390625,1.6669921875,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1710,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":458653696,"Alloc system memory":1730134016}},{"at":1793890543426,"load":[1.63525390625,1.6669921875,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1710,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":467189760,"Alloc system memory":1720631296}},{"at":1793890544492,"load":[1.63525390625,1.6669921875,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1720,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1709096960}},{"at":1793890545559,"load":[1.63525390625,1.6669921875,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1730,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1690746880}},{"at":1793890546601,"load":[1.6640625,1.67236328125,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":456343552,"Alloc system memory":1690320896}},{"at":1793890547668,"load":[1.6640625,1.67236328125,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.09375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":409845760,"Alloc system memory":1688125440}},{"at":1793890548733,"load":[1.6640625,1.67236328125,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.1875,"cpuMs":1740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1676787712}},{"at":1793890549798,"load":[1.6640625,1.67236328125,1.95166015625],"processes":[{"pid":73839,"rssMiB":306.203125,"cpuMs":1750,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1663746048}},{"at":1793890550852,"load":[1.6640625,1.67236328125,1.95166015625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":5,"In use system memory":454000640,"Alloc system memory":1672232960}},{"at":1793890551917,"load":[1.85107421875,1.7109375,1.96337890625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":409878528,"Alloc system memory":1672134656}},{"at":1793890552971,"load":[1.85107421875,1.7109375,1.96337890625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":330727424,"Alloc system memory":1667940352}},{"at":1793890554036,"load":[1.85107421875,1.7109375,1.96337890625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":330727424,"Alloc system memory":1663746048}},{"at":1793890555101,"load":[1.85107421875,1.7109375,1.96337890625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.296875,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":456196096,"Alloc system memory":1672495104}},{"at":1793890556169,"load":[1.85107421875,1.7109375,1.96337890625],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":409944064,"Alloc system memory":1672364032}},{"at":1793890557212,"load":[1.78271484375,1.69873046875,1.95751953125],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":280018944,"Alloc system memory":1668005888}},{"at":1793890558276,"load":[1.78271484375,1.69873046875,1.95751953125],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1780,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":266813440,"Alloc system memory":1663811584}},{"at":1793890559341,"load":[1.78271484375,1.69873046875,1.95751953125],"processes":[{"pid":73839,"rssMiB":286.53125,"cpuMs":1780,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":467255296,"Alloc system memory":1669644288}},{"at":1793890560291,"load":[1.78271484375,1.69873046875,1.95751953125],"processes":[{"pid":73839,"rssMiB":286.515625,"cpuMs":1780,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":130.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":409960448,"Alloc system memory":1669660672}}],"cpu":[{"pid":73839,"role":"openbitfun-desktop","cpuPercent":0.39886323976666505,"startRssMiB":306.3125,"endRssMiB":286.515625},{"pid":73844,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":130.21875,"endRssMiB":130.078125},{"pid":73845,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19943161988333252,"startRssMiB":319.46875,"endRssMiB":319.328125},{"pid":73846,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.921875}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4183}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24307}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793890565652,"load":[1.6396484375,1.67041015625,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.9375,"cpuMs":1990,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.359375,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.25,"cpuMs":300,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":389906432,"Alloc system memory":1713602560}},{"at":1793890566708,"load":[1.66845703125,1.67578125,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.9375,"cpuMs":2020,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.359375,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.25,"cpuMs":320,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":516128768,"Alloc system memory":1717927936}},{"at":1793890567775,"load":[1.66845703125,1.67578125,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.890625,"cpuMs":2040,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.28125,"cpuMs":340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":471285760,"Alloc system memory":1717796864}},{"at":1793890568841,"load":[1.66845703125,1.67578125,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.90625,"cpuMs":2070,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.34375,"cpuMs":350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":458391552,"Alloc system memory":1717796864}},{"at":1793890569905,"load":[1.66845703125,1.67578125,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.90625,"cpuMs":2100,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.359375,"cpuMs":370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":467976192,"Alloc system memory":1717796864}},{"at":1793890570966,"load":[1.66845703125,1.67578125,1.94580078125],"processes":[{"pid":73839,"rssMiB":300.90625,"cpuMs":2130,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.328125,"cpuMs":390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":517177344,"Alloc system memory":1717927936}},{"at":1793890572033,"load":[1.61474609375,1.66455078125,1.93994140625],"processes":[{"pid":73839,"rssMiB":300.921875,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.375,"cpuMs":410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":471318528,"Alloc system memory":1717796864}},{"at":1793890573087,"load":[1.61474609375,1.66455078125,1.93994140625],"processes":[{"pid":73839,"rssMiB":300.921875,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.265625,"cpuMs":430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":389906432,"Alloc system memory":1713602560}},{"at":1793890574153,"load":[1.61474609375,1.66455078125,1.93994140625],"processes":[{"pid":73839,"rssMiB":300.9375,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.28125,"cpuMs":440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":451674112,"Alloc system memory":1717796864}},{"at":1793890575217,"load":[1.61474609375,1.66455078125,1.93994140625],"processes":[{"pid":73839,"rssMiB":300.9375,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.28125,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":514408448,"Alloc system memory":1717796864}},{"at":1793890576284,"load":[1.61474609375,1.66455078125,1.93994140625],"processes":[{"pid":73839,"rssMiB":300.9375,"cpuMs":2270,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.390625,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":419971072,"Alloc system memory":1717796864}},{"at":1793890577342,"load":[1.5654296875,1.6533203125,1.93408203125],"processes":[{"pid":73839,"rssMiB":300.953125,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.421875,"cpuMs":520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":560185344,"Alloc system memory":1748680704}},{"at":1793890578394,"load":[1.5654296875,1.6533203125,1.93408203125],"processes":[{"pid":73839,"rssMiB":300.953125,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.46875,"cpuMs":540,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":472875008,"Alloc system memory":1739915264}},{"at":1793890579460,"load":[1.5654296875,1.6533203125,1.93408203125],"processes":[{"pid":73839,"rssMiB":300.96875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.3125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.46875,"cpuMs":560,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":389267456,"Alloc system memory":1731526656}},{"at":1793890580526,"load":[1.5654296875,1.6533203125,1.93408203125],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2380,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.03125,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":570,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":389267456,"Alloc system memory":1723138048}},{"at":1793890581592,"load":[1.52001953125,1.64208984375,1.92822265625],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2410,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":590,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":519536640,"Alloc system memory":1733083136}},{"at":1793890582659,"load":[1.52001953125,1.64208984375,1.92822265625],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2440,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":3,"In use system memory":522813440,"Alloc system memory":1730887680}},{"at":1793890583725,"load":[1.52001953125,1.64208984375,1.92822265625],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2460,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":620,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":389267456,"Alloc system memory":1724596224}},{"at":1793890584790,"load":[1.52001953125,1.64208984375,1.92822265625],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2490,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":412499968,"Alloc system memory":1718599680}},{"at":1793890585710,"load":[1.52001953125,1.64208984375,1.92822265625],"processes":[{"pid":73839,"rssMiB":301.015625,"cpuMs":2520,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":157.015625,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.328125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":196.484375,"cpuMs":650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":515604480,"Alloc system memory":1727348736}}],"cpu":[{"pid":73839,"role":"openbitfun-desktop","cpuPercent":2.6423372220560375,"startRssMiB":300.9375,"endRssMiB":301.015625},{"pid":73844,"role":"com.apple.WebKit.GPU","cpuPercent":0.2991325157044571,"startRssMiB":157,"endRssMiB":157.015625},{"pid":73845,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14956625785222855,"startRssMiB":319.359375,"endRssMiB":319.328125},{"pid":73846,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.078125,"endRssMiB":8.984375},{"pid":74561,"role":"com.apple.WebKit.WebContent","cpuPercent":1.7449396749426662,"startRssMiB":196.25,"endRssMiB":196.484375}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5014},{"name":"openbitfun-petdex-walk","state":"running","time":3801}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25121},{"name":"openbitfun-petdex-walk","state":"running","time":23908}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793890593422,"load":[1.6796875,1.67041015625,1.93408203125],"processes":[{"pid":73839,"rssMiB":277.390625,"cpuMs":2830,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.359375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.34375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":200.984375,"cpuMs":980,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":538984448,"Alloc system memory":1742700544}},{"at":1793890594465,"load":[1.6796875,1.67041015625,1.93408203125],"processes":[{"pid":73839,"rssMiB":277.34375,"cpuMs":2870,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.21875,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.34375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.015625,"cpuMs":1010,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":12,"In use system memory":508755968,"Alloc system memory":1739964416}},{"at":1793890595531,"load":[1.6796875,1.67041015625,1.93408203125],"processes":[{"pid":73839,"rssMiB":277.34375,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.21875,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.34375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.015625,"cpuMs":1040,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":455589888,"Alloc system memory":1739964416}},{"at":1793890596597,"load":[1.625,1.6591796875,1.92822265625],"processes":[{"pid":73839,"rssMiB":277.34375,"cpuMs":2940,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.234375,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.34375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.03125,"cpuMs":1070,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":477544448,"Alloc system memory":1739964416}},{"at":1793890597663,"load":[1.625,1.6591796875,1.92822265625],"processes":[{"pid":73839,"rssMiB":277.34375,"cpuMs":2980,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.234375,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.515625,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.03125,"cpuMs":1100,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":13,"Renderer Utilization %":13,"Tiler Utilization %":10,"In use system memory":508952576,"Alloc system memory":1741471744}},{"at":1793890598728,"load":[1.625,1.6591796875,1.92822265625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3020,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.234375,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.046875,"cpuMs":1130,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":9,"In use system memory":509296640,"Alloc system memory":1740242944}},{"at":1793890599794,"load":[1.625,1.6591796875,1.92822265625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3060,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.25,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.0625,"cpuMs":1160,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421281792,"Alloc system memory":1738850304}},{"at":1793890600861,"load":[1.625,1.6591796875,1.92822265625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3100,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.25,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.109375,"cpuMs":1190,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":443580416,"Alloc system memory":1734656000}},{"at":1793890601925,"load":[1.57470703125,1.64794921875,1.92236328125],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3140,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.25,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":200.984375,"cpuMs":1220,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":473415680,"Alloc system memory":1730461696}},{"at":1793890602981,"load":[1.57470703125,1.64794921875,1.92236328125],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3170,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.265625,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.015625,"cpuMs":1250,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":470548480,"Alloc system memory":1726267392}},{"at":1793890604048,"load":[1.57470703125,1.64794921875,1.92236328125],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3210,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.265625,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.015625,"cpuMs":1280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421281792,"Alloc system memory":1724170240}},{"at":1793890605114,"load":[1.57470703125,1.64794921875,1.92236328125],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3240,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.265625,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.015625,"cpuMs":1300,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":4,"In use system memory":473513984,"Alloc system memory":1722171392}},{"at":1793890606179,"load":[1.57470703125,1.64794921875,1.92236328125],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3280,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.28125,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.03125,"cpuMs":1340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":482017280,"Alloc system memory":1719975936}},{"at":1793890607247,"load":[1.5283203125,1.63671875,1.91650390625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3320,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.28125,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.046875,"cpuMs":1370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421281792,"Alloc system memory":1717878784}},{"at":1793890608313,"load":[1.5283203125,1.63671875,1.91650390625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3350,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.28125,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.40625,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.0625,"cpuMs":1390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421281792,"Alloc system memory":1717878784}},{"at":1793890609382,"load":[1.5283203125,1.63671875,1.91650390625],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3400,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.296875,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.40625,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.078125,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":474513408,"Alloc system memory":1711702016}},{"at":1793890610449,"load":[1.5283203125,1.63671875,1.91650390625],"processes":[{"pid":73839,"rssMiB":277.5625,"cpuMs":3440,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.296875,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.40625,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.078125,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":7,"In use system memory":474251264,"Alloc system memory":1711587328}},{"at":1793890611516,"load":[1.5283203125,1.63671875,1.91650390625],"processes":[{"pid":73839,"rssMiB":277.578125,"cpuMs":3470,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.3125,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.40625,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.109375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":421281792,"Alloc system memory":1711587328}},{"at":1793890612583,"load":[1.48583984375,1.6259765625,1.9111328125],"processes":[{"pid":73839,"rssMiB":277.578125,"cpuMs":3510,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.3125,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.125,"cpuMs":1500,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421281792,"Alloc system memory":1711587328}},{"at":1793890613464,"load":[1.48583984375,1.6259765625,1.9111328125],"processes":[{"pid":73839,"rssMiB":277.578125,"cpuMs":3540,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.21875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.421875,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.140625,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":474316800,"Alloc system memory":1711259648}}],"cpu":[{"pid":73839,"role":"openbitfun-desktop","cpuPercent":3.5425606226923456,"startRssMiB":277.390625,"endRssMiB":277.578125},{"pid":73844,"role":"com.apple.WebKit.GPU","cpuPercent":0.4989522003792037,"startRssMiB":177.359375,"endRssMiB":177.21875},{"pid":73845,"role":"com.apple.WebKit.WebContent","cpuPercent":0.6486378604929648,"startRssMiB":319.34375,"endRssMiB":319.421875},{"pid":73846,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.984375},{"pid":74561,"role":"com.apple.WebKit.WebContent","cpuPercent":2.7442371020856204,"startRssMiB":200.984375,"endRssMiB":201.140625}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793890621354,"load":[1.44677734375,1.615234375,1.90576171875],"processes":[{"pid":73839,"rssMiB":277.609375,"cpuMs":3720,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.28125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.453125,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.546875,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":470351872,"Alloc system memory":1721647104}},{"at":1793890622416,"load":[1.57080078125,1.63818359375,1.912109375],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3730,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.28125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.5,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":426688512,"Alloc system memory":1719435264}},{"at":1793890623469,"load":[1.57080078125,1.63818359375,1.912109375],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3730,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.5,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":506085376,"Alloc system memory":1745158144}},{"at":1793890624535,"load":[1.57080078125,1.63818359375,1.912109375],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3730,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.5,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":428163072,"Alloc system memory":1733771264}},{"at":1793890625601,"load":[1.57080078125,1.63818359375,1.912109375],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.5,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":296157184,"Alloc system memory":1724858368}},{"at":1793890626668,"load":[1.57080078125,1.63818359375,1.912109375],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.359375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":296157184,"Alloc system memory":1707032576}},{"at":1793890627725,"load":[1.44482421875,1.61083984375,1.90087890625],"processes":[{"pid":73839,"rssMiB":277.515625,"cpuMs":3740,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.359375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":474873856,"Alloc system memory":1717288960}},{"at":1793890628790,"load":[1.44482421875,1.61083984375,1.90087890625],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3750,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":398147584,"Alloc system memory":1710637056}},{"at":1793890629855,"load":[1.44482421875,1.61083984375,1.90087890625],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3750,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":347504640,"Alloc system memory":1704345600}},{"at":1793890630920,"load":[1.44482421875,1.61083984375,1.90087890625],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3750,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":283590656,"Alloc system memory":1698054144}},{"at":1793890631988,"load":[1.4091796875,1.6005859375,1.8955078125],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":479674368,"Alloc system memory":1710702592}},{"at":1793890633056,"load":[1.4091796875,1.6005859375,1.8955078125],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":394772480,"Alloc system memory":1704411136}},{"at":1793890634120,"load":[1.4091796875,1.6005859375,1.8955078125],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3760,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":296157184,"Alloc system memory":1696022528}},{"at":1793890635188,"load":[1.4091796875,1.6005859375,1.8955078125],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":513490944,"Alloc system memory":1733738496}},{"at":1793890636243,"load":[1.4091796875,1.6005859375,1.8955078125],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.46875,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":522305536,"Alloc system memory":1733935104}},{"at":1793890637308,"load":[1.3759765625,1.59033203125,1.89013671875],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":520650752,"Alloc system memory":1733853184}},{"at":1793890638376,"load":[1.3759765625,1.59033203125,1.89013671875],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.46875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":2,"In use system memory":408797184,"Alloc system memory":1729658880}},{"at":1793890639442,"load":[1.3759765625,1.59033203125,1.89013671875],"processes":[{"pid":73839,"rssMiB":277.53125,"cpuMs":3780,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.359375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":330219520,"Alloc system memory":1725464576}},{"at":1793890640507,"load":[1.3759765625,1.59033203125,1.89013671875],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3790,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.359375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":507363328,"Alloc system memory":1733574656}},{"at":1793890641416,"load":[1.3759765625,1.59033203125,1.89013671875],"processes":[{"pid":73839,"rssMiB":277.546875,"cpuMs":3790,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":177.171875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.53125,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":74561,"rssMiB":201.359375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":515850240,"Alloc system memory":1731575808}}],"cpu":[{"pid":73839,"role":"openbitfun-desktop","cpuPercent":0.34891835310537334,"startRssMiB":277.609375,"endRssMiB":277.546875},{"pid":73844,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":177.28125,"endRssMiB":177.171875},{"pid":73845,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19938191606021335,"startRssMiB":319.453125,"endRssMiB":319.53125},{"pid":73846,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.03125,"endRssMiB":9.015625},{"pid":74561,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14953643704516,"startRssMiB":201.546875,"endRssMiB":201.359375}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793890646492,"load":[1.42578125,1.5966796875,1.890625],"processes":[{"pid":73839,"rssMiB":277.4375,"cpuMs":3820,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.9375,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.515625,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":296157184,"Alloc system memory":1697579008}},{"at":1793890647551,"load":[1.3916015625,1.58642578125,1.88525390625],"processes":[{"pid":73839,"rssMiB":277.390625,"cpuMs":3820,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.9375,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.484375,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":296157184,"Alloc system memory":1689190400}},{"at":1793890648617,"load":[1.3916015625,1.58642578125,1.88525390625],"processes":[{"pid":73839,"rssMiB":277.390625,"cpuMs":3820,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.8125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.484375,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":475643904,"Alloc system memory":1699790848}},{"at":1793890649683,"load":[1.3916015625,1.58642578125,1.88525390625],"processes":[{"pid":73839,"rssMiB":277.390625,"cpuMs":3830,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.8125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":426655744,"Alloc system memory":1693253632}},{"at":1793890650734,"load":[1.3916015625,1.58642578125,1.88525390625],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3830,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.8125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":328122368,"Alloc system memory":1705902080}},{"at":1793890651789,"load":[1.3916015625,1.58642578125,1.88525390625],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.8125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":296157184,"Alloc system memory":1697513472}},{"at":1793890652837,"load":[1.60009765625,1.62646484375,1.8974609375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.8125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":508411904,"Alloc system memory":1714700288}},{"at":1793890653903,"load":[1.60009765625,1.62646484375,1.8974609375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":426721280,"Alloc system memory":1706196992}},{"at":1793890654954,"load":[1.60009765625,1.62646484375,1.8974609375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":348143616,"Alloc system memory":1697808384}},{"at":1793890656019,"load":[1.60009765625,1.62646484375,1.8974609375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":348143616,"Alloc system memory":1689419776}},{"at":1793890657085,"load":[1.60009765625,1.62646484375,1.8974609375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":472580096,"Alloc system memory":1699905536}},{"at":1793890658153,"load":[1.6318359375,1.63232421875,1.89794921875],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":426688512,"Alloc system memory":1693417472}},{"at":1793890659220,"load":[1.6318359375,1.63232421875,1.89794921875],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":296796160,"Alloc system memory":1686994944}},{"at":1793890660285,"load":[1.6318359375,1.63232421875,1.89794921875],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":504627200,"Alloc system memory":1714405376}},{"at":1793890661351,"load":[1.6318359375,1.63232421875,1.89794921875],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":456556544,"Alloc system memory":1712226304}},{"at":1793890662416,"load":[1.6318359375,1.63232421875,1.89794921875],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":324567040,"Alloc system memory":1705934848}},{"at":1793890663476,"load":[1.6611328125,1.63818359375,1.8984375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":290504704,"Alloc system memory":1699643392}},{"at":1793890664541,"load":[1.6611328125,1.63818359375,1.8984375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":462209024,"Alloc system memory":1695563776}},{"at":1793890665604,"load":[1.6611328125,1.63818359375,1.8984375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":409812992,"Alloc system memory":1684963328}},{"at":1793890666551,"load":[1.6611328125,1.63818359375,1.8984375],"processes":[{"pid":73839,"rssMiB":277.375,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":73844,"rssMiB":149.796875,"cpuMs":730,"role":"com.apple.WebKit.GPU"},{"pid":73845,"rssMiB":319.546875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":73846,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":316178432,"Alloc system memory":1693351936}}],"cpu":[{"pid":73839,"role":"openbitfun-desktop","cpuPercent":0.24926466922578394,"startRssMiB":277.4375,"endRssMiB":277.375},{"pid":73844,"role":"com.apple.WebKit.GPU","cpuPercent":0.04985293384515678,"startRssMiB":149.9375,"endRssMiB":149.796875},{"pid":73845,"role":"com.apple.WebKit.WebContent","cpuPercent":0.09970586769031356,"startRssMiB":319.515625,"endRssMiB":319.546875},{"pid":73846,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.953125}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[73844,73845,73846,74561],"hostPid":73839,"petCandidatePids":[74561],"mainCandidatePids":[73844,73845,73846]},"restCadence":{"frames":[25373,25381,25398,25415,25431,25448,25463,25481,25498,25515,25532,25548,25565,25581,25598,25615,25632,25649,25665,25682,25698,25713,25731,25748,25763,25781,25798,25815,25832,25848,25865,25881,25898,25915,25931,25948,25965,25982,25998,26015,26032,26049,26065,26082,26099,26115,26132,26149,26163,26181,26198,26215,26231,26248,26265,26281,26298,26315,26332,26349,26366,26382,26398,26415,26431,26448,26463,26481,26497,26515,26531,26548,26566,26583,26598,26615,26632,26648,26665,26681,26699,26715,26731,26748,26763,26780,26797,26815,26832,26846,26864,26881,26898,26915,26932,26949,26965,26981,26998,27015,27030,27048,27065,27082,27099,27116,27129,27148,27165,27182,27198,27215,27231,27248,27263,27281,27298,27315,27330,27348,27365,27382,27398,27415,27431,27448,27466,27483,27499,27513,27530,27548,27565,27582,27598,27615,27632,27648,27665,27682,27699,27716,27731,27748,27765,27780,27798,27815,27832,27848,27865,27881,27898,27915,27932,27948,27966,27981],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53126,53131,53148,53164,53181,53198,53215,53232,53249,53265,53282,53299,53316,53333,53350,53365,53382,53396,53413,53431,53448,53465,53481,53496,53513,53531,53548,53564,53581,53598,53615,53629,53648,53663,53679,53698,53713,53730,53748,53765,53783,53796,53815,53832,53849,53866,53883,53900,53913,53931,53948,53965,53982,53999,54017,54031,54046,54063,54081,54098,54115,54132,54149,54165,54182,54199,54216,54229,54248,54265,54280,54298,54313,54331,54348,54365,54380,54396,54415,54429,54446,54463,54481,54496,54515,54529,54548,54563,54581,54596,54614,54629,54646,54665,54682,54696,54715,54732,54749,54766,54782,54799,54813,54830,54847,54865,54882,54899,54915,54931,54948,54965,54982,54999,55016,55031,55048,55065,55082,55099,55115,55130,55148,55165,55182,55199,55216,55233,55250,55265,55282,55298,55315,55329,55348,55365,55379,55398,55415,55431,55446,55463,55479,55498,55515,55529,55546,55565,55582,55599,55616,55631,55647,55663,55681,55698,55715,55732],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"pair":2,"label":"optimized","directory":"/openbitfun-pet-perf-qyJCKm","report":{"schemaVersion":1,"label":"optimized-2","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-ce86dd79f9268b72","algorithm":"sha256-path-content-v1","digest":"ce86dd79f9268b72fdf032f4a092fb681f0e675f8f7b7cda8dbd67d6f13de049","fileCount":2737,"totalBytes":93313799},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890699105,"load":[1.79541015625,1.6630859375,1.89599609375],"processes":[{"pid":77288,"rssMiB":359.296875,"cpuMs":2240,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.921875,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.0625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":43,"Renderer Utilization %":43,"Tiler Utilization %":12,"In use system memory":330727424,"Alloc system memory":1717174272}},{"at":1793890700159,"load":[1.79541015625,1.6630859375,1.89599609375],"processes":[{"pid":77288,"rssMiB":359.25,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":266813440,"Alloc system memory":1708785664}},{"at":1793890701226,"load":[1.79541015625,1.6630859375,1.89599609375],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.78125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":467386368,"Alloc system memory":1717174272}},{"at":1793890702291,"load":[1.79541015625,1.6630859375,1.89599609375],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":358219776,"Alloc system memory":1709834240}},{"at":1793890703358,"load":[1.7314453125,1.65185546875,1.890625],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1700397056}},{"at":1793890704425,"load":[1.7314453125,1.65185546875,1.890625],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2260,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":454311936,"Alloc system memory":1703657472}},{"at":1793890705492,"load":[1.7314453125,1.65185546875,1.890625],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2260,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":409911296,"Alloc system memory":1688338432}},{"at":1793890706559,"load":[1.7314453125,1.65185546875,1.890625],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2260,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":279379968,"Alloc system memory":1684144128}},{"at":1793890707626,"load":[1.7314453125,1.65185546875,1.890625],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2260,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":279379968,"Alloc system memory":1675755520}},{"at":1793890708693,"load":[1.7529296875,1.6572265625,1.89111328125],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2270,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":456572928,"Alloc system memory":1688469504}},{"at":1793890709760,"load":[1.7529296875,1.6572265625,1.89111328125],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":409911296,"Alloc system memory":1684144128}},{"at":1793890710826,"load":[1.7529296875,1.6572265625,1.89111328125],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":522698752,"Alloc system memory":1719746560}},{"at":1793890711860,"load":[1.7529296875,1.6572265625,1.89111328125],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":531365888,"Alloc system memory":1722646528}},{"at":1793890712927,"load":[1.7529296875,1.6572265625,1.89111328125],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":536657920,"Alloc system memory":1723547648}},{"at":1793890713984,"load":[2.0126953125,1.71240234375,1.9091796875],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.09375,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":490405888,"Alloc system memory":1723547648}},{"at":1793890715036,"load":[2.0126953125,1.71240234375,1.9091796875],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2290,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.09375,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":529170432,"Alloc system memory":1723547648}},{"at":1793890716103,"load":[2.0126953125,1.71240234375,1.9091796875],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2290,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":438075392,"Alloc system memory":1719386112}},{"at":1793890717170,"load":[2.0126953125,1.71240234375,1.9091796875],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2290,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":425574400,"Alloc system memory":1710604288}},{"at":1793890718237,"load":[1.93115234375,1.7001953125,1.90380859375],"processes":[{"pid":77288,"rssMiB":359.234375,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":298156032,"Alloc system memory":1701101568}},{"at":1793890719158,"load":[1.93115234375,1.7001953125,1.90380859375],"processes":[{"pid":77288,"rssMiB":359.21875,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":129.65625,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.125,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.953125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":271712256,"Alloc system memory":1694547968}}],"cpu":[{"pid":77288,"role":"openbitfun-desktop","cpuPercent":0.29920710118186805,"startRssMiB":359.296875,"endRssMiB":359.21875},{"pid":77290,"role":"com.apple.WebKit.GPU","cpuPercent":0.04986785019697801,"startRssMiB":129.921875,"endRssMiB":129.65625},{"pid":77291,"role":"com.apple.WebKit.WebContent","cpuPercent":0.24933925098489007,"startRssMiB":328.3125,"endRssMiB":328.125},{"pid":77292,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.0625,"endRssMiB":8.953125}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4183}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24306}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793890724521,"load":[1.8564453125,1.6884765625,1.8984375],"processes":[{"pid":77288,"rssMiB":379.171875,"cpuMs":2510,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.171875,"cpuMs":330,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":547995648,"Alloc system memory":1756938240}},{"at":1793890725580,"load":[1.8564453125,1.6884765625,1.8984375],"processes":[{"pid":77288,"rssMiB":379.171875,"cpuMs":2530,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.203125,"cpuMs":360,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":388382720,"Alloc system memory":1754841088}},{"at":1793890726647,"load":[1.8564453125,1.6884765625,1.8984375],"processes":[{"pid":77288,"rssMiB":379.171875,"cpuMs":2550,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.25,"cpuMs":400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":388120576,"Alloc system memory":1742192640}},{"at":1793890727714,"load":[1.8564453125,1.6884765625,1.8984375],"processes":[{"pid":77288,"rssMiB":379.1875,"cpuMs":2590,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.296875,"cpuMs":430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":533053440,"Alloc system memory":1748647936}},{"at":1793890728779,"load":[1.86767578125,1.693359375,1.89892578125],"processes":[{"pid":77288,"rssMiB":379.1875,"cpuMs":2620,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.296875,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":488734720,"Alloc system memory":1744322560}},{"at":1793890729847,"load":[1.86767578125,1.693359375,1.89892578125],"processes":[{"pid":77288,"rssMiB":379.1875,"cpuMs":2640,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.59375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.265625,"cpuMs":490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":410419200,"Alloc system memory":1738031104}},{"at":1793890730914,"load":[1.86767578125,1.693359375,1.89892578125],"processes":[{"pid":77288,"rssMiB":379.203125,"cpuMs":2670,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.296875,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":456572928,"Alloc system memory":1754988544}},{"at":1793890731980,"load":[1.86767578125,1.693359375,1.89892578125],"processes":[{"pid":77288,"rssMiB":379.203125,"cpuMs":2690,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.296875,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":530661376,"Alloc system memory":1765474304}},{"at":1793890733043,"load":[1.86767578125,1.693359375,1.89892578125],"processes":[{"pid":77288,"rssMiB":379.21875,"cpuMs":2710,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.3125,"cpuMs":540,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":537608192,"Alloc system memory":1761132544}},{"at":1793890734106,"load":[2.1982421875,1.7646484375,1.9228515625],"processes":[{"pid":77288,"rssMiB":378.96875,"cpuMs":2730,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.453125,"cpuMs":560,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":2,"In use system memory":407584768,"Alloc system memory":1752743936}},{"at":1793890735169,"load":[2.1982421875,1.7646484375,1.9228515625],"processes":[{"pid":77288,"rssMiB":378.96875,"cpuMs":2750,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.453125,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":456507392,"Alloc system memory":1754841088}},{"at":1793890736233,"load":[2.1982421875,1.7646484375,1.9228515625],"processes":[{"pid":77288,"rssMiB":378.984375,"cpuMs":2770,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.484375,"cpuMs":590,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":504135680,"Alloc system memory":1752711168}},{"at":1793890737278,"load":[2.1982421875,1.7646484375,1.9228515625],"processes":[{"pid":77288,"rssMiB":378.984375,"cpuMs":2780,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.53125,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":537608192,"Alloc system memory":1750614016}},{"at":1793890738341,"load":[2.10205078125,1.751953125,1.9169921875],"processes":[{"pid":77288,"rssMiB":378.984375,"cpuMs":2810,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.140625,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":620,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":407584768,"Alloc system memory":1744207872}},{"at":1793890739403,"load":[2.10205078125,1.751953125,1.9169921875],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2830,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":530890752,"Alloc system memory":1748484096}},{"at":1793890740459,"load":[2.10205078125,1.751953125,1.9169921875],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2850,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":488751104,"Alloc system memory":1746305024}},{"at":1793890741523,"load":[2.10205078125,1.751953125,1.9169921875],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":388120576,"Alloc system memory":1737883648}},{"at":1793890742586,"load":[2.10205078125,1.751953125,1.9169921875],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2890,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":670,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":407584768,"Alloc system memory":1733689344}},{"at":1793890743650,"load":[2.25390625,1.7890625,1.9287109375],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":532217856,"Alloc system memory":1742192640}},{"at":1793890744581,"load":[2.25390625,1.7890625,1.9287109375],"processes":[{"pid":77288,"rssMiB":379.28125,"cpuMs":2920,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":156.609375,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.171875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":196.546875,"cpuMs":690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":540114944,"Alloc system memory":1742077952}}],"cpu":[{"pid":77288,"role":"openbitfun-desktop","cpuPercent":2.0438683948155534,"startRssMiB":379.171875,"endRssMiB":379.28125},{"pid":77290,"role":"com.apple.WebKit.GPU","cpuPercent":0.24925224327018944,"startRssMiB":156.59375,"endRssMiB":156.609375},{"pid":77291,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14955134596211367,"startRssMiB":328.140625,"endRssMiB":328.171875},{"pid":77292,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.984375},{"pid":77983,"role":"com.apple.WebKit.WebContent","cpuPercent":1.794616151545364,"startRssMiB":196.171875,"endRssMiB":196.546875}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5015},{"name":"openbitfun-petdex-walk","state":"running","time":3801}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25140},{"name":"openbitfun-petdex-walk","state":"running","time":23926}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793890752291,"load":[2.1533203125,1.77587890625,1.9228515625],"processes":[{"pid":77288,"rssMiB":353.96875,"cpuMs":3160,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.875,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.3125,"cpuMs":940,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":5,"In use system memory":521076736,"Alloc system memory":1757413376}},{"at":1793890753350,"load":[2.140625,1.779296875,1.9228515625],"processes":[{"pid":77288,"rssMiB":353.9375,"cpuMs":3180,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.625,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.34375,"cpuMs":960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":467222528,"Alloc system memory":1750745088}},{"at":1793890754412,"load":[2.140625,1.779296875,1.9228515625],"processes":[{"pid":77288,"rssMiB":353.9375,"cpuMs":3200,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.625,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.375,"cpuMs":980,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1744142336}},{"at":1793890755474,"load":[2.140625,1.779296875,1.9228515625],"processes":[{"pid":77288,"rssMiB":353.9375,"cpuMs":3220,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.640625,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.515625,"cpuMs":1010,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":435683328,"Alloc system memory":1737850880}},{"at":1793890756537,"load":[2.140625,1.779296875,1.9228515625],"processes":[{"pid":77288,"rssMiB":353.9375,"cpuMs":3250,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.640625,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.53125,"cpuMs":1040,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":463011840,"Alloc system memory":1735835648}},{"at":1793890757600,"load":[2.140625,1.779296875,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.03125,"cpuMs":3270,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.640625,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.53125,"cpuMs":1070,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":5,"In use system memory":466845696,"Alloc system memory":1731264512}},{"at":1793890758662,"load":[2.048828125,1.76611328125,1.9169921875],"processes":[{"pid":77288,"rssMiB":354.03125,"cpuMs":3300,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.65625,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.546875,"cpuMs":1100,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1724973056}},{"at":1793890759725,"load":[2.048828125,1.76611328125,1.9169921875],"processes":[{"pid":77288,"rssMiB":354.03125,"cpuMs":3320,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.65625,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.59375,"cpuMs":1130,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":386940928,"Alloc system memory":1722875904}},{"at":1793890760786,"load":[2.048828125,1.76611328125,1.9169921875],"processes":[{"pid":77288,"rssMiB":354.03125,"cpuMs":3340,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.65625,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.609375,"cpuMs":1150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":462667776,"Alloc system memory":1720811520}},{"at":1793890761849,"load":[2.048828125,1.76611328125,1.9169921875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3360,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.625,"cpuMs":1170,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":460455936,"Alloc system memory":1716617216}},{"at":1793890762912,"load":[2.048828125,1.76611328125,1.9169921875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3390,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.1875,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.625,"cpuMs":1180,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":466239488,"Alloc system memory":1717239808}},{"at":1793890763974,"load":[2.12451171875,1.7861328125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3410,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.1875,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.625,"cpuMs":1200,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":7,"In use system memory":471285760,"Alloc system memory":1717141504}},{"at":1793890765037,"load":[2.12451171875,1.7861328125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3440,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.6875,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.1875,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.65625,"cpuMs":1220,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1717141504}},{"at":1793890766101,"load":[2.12451171875,1.7861328125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3460,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.6875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.1875,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.640625,"cpuMs":1240,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1717108736}},{"at":1793890767164,"load":[2.12451171875,1.7861328125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3480,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.703125,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.1875,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.65625,"cpuMs":1260,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":460324864,"Alloc system memory":1714487296}},{"at":1793890768225,"load":[2.12451171875,1.7861328125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3520,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.703125,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.15625,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.65625,"cpuMs":1290,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":7,"In use system memory":463405056,"Alloc system memory":1714356224}},{"at":1793890769291,"load":[2.1142578125,1.78955078125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3560,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.703125,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.203125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.671875,"cpuMs":1320,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1714356224}},{"at":1793890770358,"load":[2.1142578125,1.78955078125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3600,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.71875,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.203125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.53125,"cpuMs":1350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":413384704,"Alloc system memory":1714356224}},{"at":1793890771425,"load":[2.1142578125,1.78955078125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3640,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.71875,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.203125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.546875,"cpuMs":1380,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":6,"In use system memory":457949184,"Alloc system memory":1714487296}},{"at":1793890772350,"load":[2.1142578125,1.78955078125,1.9228515625],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3670,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.625,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.203125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.546875,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":465747968,"Alloc system memory":1713913856}}],"cpu":[{"pid":77288,"role":"openbitfun-desktop","cpuPercent":2.5424996261029964,"startRssMiB":353.96875,"endRssMiB":354.0625},{"pid":77290,"role":"com.apple.WebKit.GPU","cpuPercent":0.39882347076125424,"startRssMiB":176.875,"endRssMiB":176.625},{"pid":77291,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14955880153547035,"startRssMiB":328.3125,"endRssMiB":328.203125},{"pid":77292,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.984375},{"pid":77983,"role":"com.apple.WebKit.WebContent","cpuPercent":2.293234956877212,"startRssMiB":201.3125,"endRssMiB":201.546875}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793890780213,"load":[1.94921875,1.763671875,1.91162109375],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.71875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.921875,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":460046336,"Alloc system memory":1756332032}},{"at":1793890781279,"load":[1.94921875,1.763671875,1.91162109375],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.71875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.875,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1750040576}},{"at":1793890782346,"load":[1.94921875,1.763671875,1.91162109375],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.875,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":292585472,"Alloc system memory":1739554816}},{"at":1793890783411,"load":[1.94921875,1.763671875,1.91162109375],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3850,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.875,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":470024192,"Alloc system memory":1741783040}},{"at":1793890784479,"load":[1.873046875,1.7509765625,1.90625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":428081152,"Alloc system memory":1735360512}},{"at":1793890785541,"load":[1.873046875,1.7509765625,1.90625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":349503488,"Alloc system memory":1729069056}},{"at":1793890786603,"load":[1.873046875,1.7509765625,1.90625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":349503488,"Alloc system memory":1711702016}},{"at":1793890787667,"load":[1.873046875,1.7509765625,1.90625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":471580672,"Alloc system memory":1718124544}},{"at":1793890788729,"load":[1.802734375,1.73828125,1.90087890625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":373964800,"Alloc system memory":1715896320}},{"at":1793890789789,"load":[1.802734375,1.73828125,1.90087890625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.890625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":330121216,"Alloc system memory":1728544768}},{"at":1793890790850,"load":[1.802734375,1.73828125,1.90087890625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.859375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":472334336,"Alloc system memory":1732870144}},{"at":1793890791909,"load":[1.802734375,1.73828125,1.90087890625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.859375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":484917248,"Alloc system memory":1728577536}},{"at":1793890792972,"load":[1.802734375,1.73828125,1.90087890625],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.859375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":327204864,"Alloc system memory":1720188928}},{"at":1793890794035,"load":[1.818359375,1.7421875,1.9013671875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.859375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1713897472}},{"at":1793890795099,"load":[1.818359375,1.7421875,1.9013671875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":472399872,"Alloc system memory":1720320000}},{"at":1793890796161,"load":[1.818359375,1.7421875,1.9013671875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":511426560,"Alloc system memory":1736966144}},{"at":1793890797228,"load":[1.818359375,1.7421875,1.9013671875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3880,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":327204864,"Alloc system memory":1736966144}},{"at":1793890798294,"load":[1.818359375,1.7421875,1.9013671875],"processes":[{"pid":77288,"rssMiB":354.046875,"cpuMs":3880,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.234375,"cpuMs":1830,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1728577536}},{"at":1793890799360,"load":[1.67236328125,1.712890625,1.89013671875],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3890,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":470007808,"Alloc system memory":1728692224}},{"at":1793890800279,"load":[1.67236328125,1.712890625,1.89013671875],"processes":[{"pid":77288,"rssMiB":354.0625,"cpuMs":3890,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":176.671875,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":77983,"rssMiB":201.734375,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":428359680,"Alloc system memory":1724399616}}],"cpu":[{"pid":77288,"role":"openbitfun-desktop","cpuPercent":0.24917771354530052,"startRssMiB":354.0625,"endRssMiB":354.0625},{"pid":77290,"role":"com.apple.WebKit.GPU","cpuPercent":0.0498355427090601,"startRssMiB":176.71875,"endRssMiB":176.671875},{"pid":77291,"role":"com.apple.WebKit.WebContent","cpuPercent":0.1993421708362404,"startRssMiB":328.234375,"endRssMiB":328.296875},{"pid":77292,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.046875,"endRssMiB":9.03125},{"pid":77983,"role":"com.apple.WebKit.WebContent","cpuPercent":0.0996710854181202,"startRssMiB":201.921875,"endRssMiB":201.734375}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793890805597,"load":[1.7783203125,1.73388671875,1.896484375],"processes":[{"pid":77288,"rssMiB":353.859375,"cpuMs":3930,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.4375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":298156032,"Alloc system memory":1724006400}},{"at":1793890806663,"load":[1.7783203125,1.73388671875,1.896484375],"processes":[{"pid":77288,"rssMiB":353.859375,"cpuMs":3930,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.4375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":271712256,"Alloc system memory":1713520640}},{"at":1793890807716,"load":[1.7783203125,1.73388671875,1.896484375],"processes":[{"pid":77288,"rssMiB":353.859375,"cpuMs":3930,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":472268800,"Alloc system memory":1713553408}},{"at":1793890808783,"load":[1.6357421875,1.705078125,1.88525390625],"processes":[{"pid":77288,"rssMiB":353.875,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.296875,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":425312256,"Alloc system memory":1703067648}},{"at":1793890809849,"load":[1.6357421875,1.705078125,1.88525390625],"processes":[{"pid":77288,"rssMiB":353.859375,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1696776192}},{"at":1793890810904,"load":[1.6357421875,1.705078125,1.88525390625],"processes":[{"pid":77288,"rssMiB":353.859375,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":469975040,"Alloc system memory":1705246720}},{"at":1793890811970,"load":[1.6357421875,1.705078125,1.88525390625],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3950,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.265625,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":477429760,"Alloc system memory":1695006720}},{"at":1793890813023,"load":[1.6357421875,1.705078125,1.88525390625],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3950,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.265625,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1690173440}},{"at":1793890814090,"load":[1.66455078125,1.7099609375,1.8857421875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3950,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.265625,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":298156032,"Alloc system memory":1685340160}},{"at":1793890815155,"load":[1.66455078125,1.7099609375,1.8857421875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3950,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":508395520,"Alloc system memory":1724776448}},{"at":1793890816222,"load":[1.66455078125,1.7099609375,1.8857421875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3950,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":428490752,"Alloc system memory":1720582144}},{"at":1793890817289,"load":[1.66455078125,1.7099609375,1.8857421875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3960,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1712193536}},{"at":1793890818353,"load":[1.66455078125,1.7099609375,1.8857421875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3960,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":298156032,"Alloc system memory":1703280640}},{"at":1793890819412,"load":[1.69140625,1.71435546875,1.88623046875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3960,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":472465408,"Alloc system memory":1709604864}},{"at":1793890820478,"load":[1.69140625,1.71435546875,1.88623046875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3970,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":399704064,"Alloc system memory":1707425792}},{"at":1793890821544,"load":[1.69140625,1.71435546875,1.88623046875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3970,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":349503488,"Alloc system memory":1701134336}},{"at":1793890822606,"load":[1.69140625,1.71435546875,1.88623046875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3970,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":349503488,"Alloc system memory":1694842880}},{"at":1793890823673,"load":[1.69140625,1.71435546875,1.88623046875],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3980,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":474808320,"Alloc system memory":1703231488}},{"at":1793890824735,"load":[1.6357421875,1.7021484375,1.880859375],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3980,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":410255360,"Alloc system memory":1701691392}},{"at":1793890825663,"load":[1.6357421875,1.7021484375,1.880859375],"processes":[{"pid":77288,"rssMiB":354.078125,"cpuMs":3980,"role":"openbitfun-desktop"},{"pid":77290,"rssMiB":149.390625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":77291,"rssMiB":328.3125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":77292,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":481820672,"Alloc system memory":1697431552}}],"cpu":[{"pid":77288,"role":"openbitfun-desktop","cpuPercent":0.24917771354530052,"startRssMiB":353.859375,"endRssMiB":354.078125},{"pid":77290,"role":"com.apple.WebKit.GPU","cpuPercent":0.0498355427090601,"startRssMiB":149.4375,"endRssMiB":149.390625},{"pid":77291,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14950662812718032,"startRssMiB":328.296875,"endRssMiB":328.3125},{"pid":77292,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.96875}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[77290,77291,77292,77983],"hostPid":77288,"petCandidatePids":[77983],"mainCandidatePids":[77290,77291,77292]},"restCadence":{"frames":[25371,25381,25398,25415,25432,25449,25464,25481,25499,25516,25530,25547,25564,25581,25597,25613,25631,25647,25664,25681,25696,25714,25731,25747,25764,25781,25797,25814,25831,25848,25865,25882,25895,25914,25931,25948,25965,25982,25999,26016,26031,26048,26064,26081,26097,26114,26131,26147,26164,26181,26198,26212,26231,26247,26264,26281,26298,26315,26332,26349,26364,26381,26398,26414,26431,26447,26463,26481,26497,26514,26531,26548,26564,26581,26598,26614,26631,26648,26662,26681,26698,26715,26731,26748,26764,26781,26797,26814,26831,26849,26864,26881,26898,26915,26932,26949,26966,26979,26996,27014,27031,27047,27064,27081,27098,27114,27131,27148,27165,27181,27198,27215,27230,27247,27264,27281,27297,27314,27330,27347,27364,27381,27397,27414,27431,27447,27464,27481,27498,27515,27531,27547,27564,27581,27597,27614,27631,27647,27664,27681,27698,27714,27731,27748,27765,27781,27798,27814,27831,27847,27864,27881,27898,27914,27931,27948,27964,27981],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53142,53147,53164,53181,53198,53215,53232,53249,53265,53281,53295,53314,53331,53348,53365,53382,53399,53412,53429,53447,53464,53481,53498,53514,53531,53547,53563,53581,53598,53614,53631,53648,53664,53679,53697,53714,53731,53748,53765,53781,53798,53812,53831,53845,53864,53881,53898,53912,53931,53948,53965,53982,53995,54012,54031,54047,54064,54081,54099,54116,54131,54147,54164,54181,54198,54215,54232,54245,54262,54281,54297,54314,54329,54347,54362,54381,54398,54415,54432,54448,54465,54479,54497,54514,54530,54547,54562,54581,54598,54615,54632,54648,54665,54682,54699,54714,54731,54746,54762,54781,54798,54815,54831,54847,54864,54881,54897,54914,54931,54948,54965,54982,54997,55014,55031,55047,55064,55081,55098,55115,55132,55147,55164,55179,55197,55214,55231,55248,55264,55281,55295,55314,55329,55347,55364,55381,55395,55412,55429,55447,55464,55481,55498,55515,55531,55545,55564,55581,55598,55615,55631,55646,55664,55681,55698,55715,55731,55748],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"pair":2,"label":"baseline","directory":"/openbitfun-pet-perf-JRAX9d","report":{"schemaVersion":1,"label":"baseline-2","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-430fd6c0fc1530b6","algorithm":"sha256-path-content-v1","digest":"430fd6c0fc1530b6044d5fdcf2ba13f547b36b5114cdbba9c70f274f619ec1a5","fileCount":2737,"totalBytes":93312928},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890857818,"load":[1.51123046875,1.66552734375,1.8603515625],"processes":[{"pid":80696,"rssMiB":360.40625,"cpuMs":1970,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.484375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1410,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.96875,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":12,"In use system memory":464027648,"Alloc system memory":1773305856}},{"at":1793890858866,"load":[1.51123046875,1.66552734375,1.8603515625],"processes":[{"pid":80696,"rssMiB":360.28125,"cpuMs":1970,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.359375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":4,"In use system memory":498499584,"Alloc system memory":1764982784}},{"at":1793890859931,"load":[1.55029296875,1.6708984375,1.86083984375],"processes":[{"pid":80696,"rssMiB":360.25,"cpuMs":1970,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.359375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":4,"In use system memory":513196032,"Alloc system memory":1761869824}},{"at":1793890860992,"load":[1.55029296875,1.6708984375,1.86083984375],"processes":[{"pid":80696,"rssMiB":360.25,"cpuMs":1970,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.34375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":3,"In use system memory":464306176,"Alloc system memory":1757118464}},{"at":1793890862051,"load":[1.55029296875,1.6708984375,1.86083984375],"processes":[{"pid":80696,"rssMiB":360.25,"cpuMs":1980,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.34375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":5,"In use system memory":513490944,"Alloc system memory":1752498176}},{"at":1793890863115,"load":[1.55029296875,1.6708984375,1.86083984375],"processes":[{"pid":80696,"rssMiB":360.3125,"cpuMs":1980,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.34375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":4,"In use system memory":464027648,"Alloc system memory":1744109568}},{"at":1793890864184,"load":[1.666015625,1.69287109375,1.8671875],"processes":[{"pid":80696,"rssMiB":360.3125,"cpuMs":1990,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.34375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":3,"In use system memory":464027648,"Alloc system memory":1739390976}},{"at":1793890865247,"load":[1.666015625,1.69287109375,1.8671875],"processes":[{"pid":80696,"rssMiB":360.3125,"cpuMs":1990,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.34375,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.890625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":36,"Renderer Utilization %":36,"Tiler Utilization %":7,"In use system memory":573915136,"Alloc system memory":1780662272}},{"at":1793890866301,"load":[1.666015625,1.69287109375,1.8671875],"processes":[{"pid":80696,"rssMiB":360.3125,"cpuMs":1990,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.890625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":4,"In use system memory":464027648,"Alloc system memory":1767571456}},{"at":1793890867369,"load":[1.666015625,1.69287109375,1.8671875],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2000,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.890625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":23,"Renderer Utilization %":23,"Tiler Utilization %":5,"In use system memory":570785792,"Alloc system memory":1780449280}},{"at":1793890868435,"load":[1.666015625,1.69287109375,1.8671875],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2000,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.890625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":4,"In use system memory":570458112,"Alloc system memory":1781612544}},{"at":1793890869502,"load":[1.8525390625,1.73095703125,1.87939453125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":26,"Renderer Utilization %":26,"Tiler Utilization %":5,"In use system memory":570556416,"Alloc system memory":1782054912}},{"at":1793890870564,"load":[1.8525390625,1.73095703125,1.87939453125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":27,"Renderer Utilization %":27,"Tiler Utilization %":5,"In use system memory":513277952,"Alloc system memory":1772814336}},{"at":1793890871627,"load":[1.8525390625,1.73095703125,1.87939453125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":42,"Renderer Utilization %":41,"Tiler Utilization %":9,"In use system memory":576520192,"Alloc system memory":1786920960}},{"at":1793890872688,"load":[1.8525390625,1.73095703125,1.87939453125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":30,"Renderer Utilization %":29,"Tiler Utilization %":6,"In use system memory":568918016,"Alloc system memory":1789345792}},{"at":1793890873751,"load":[1.8525390625,1.73095703125,1.87939453125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":37,"Renderer Utilization %":37,"Tiler Utilization %":7,"In use system memory":534822912,"Alloc system memory":1795473408}},{"at":1793890874817,"load":[1.8642578125,1.7353515625,1.8798828125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2020,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":4,"In use system memory":492879872,"Alloc system memory":1779122176}},{"at":1793890875877,"load":[1.8642578125,1.7353515625,1.8798828125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2020,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":4,"In use system memory":464027648,"Alloc system memory":1770733568}},{"at":1793890876938,"load":[1.8642578125,1.7353515625,1.8798828125],"processes":[{"pid":80696,"rssMiB":360.328125,"cpuMs":2020,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":4,"In use system memory":464027648,"Alloc system memory":1768636416}},{"at":1793890877867,"load":[1.8642578125,1.7353515625,1.8798828125],"processes":[{"pid":80696,"rssMiB":360.3125,"cpuMs":2029.9999999999998,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":129.328125,"cpuMs":340,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.90625,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":4,"In use system memory":569114624,"Alloc system memory":1795522560}}],"cpu":[{"pid":80696,"role":"openbitfun-desktop","cpuPercent":0.29926679634894393,"startRssMiB":360.40625,"endRssMiB":360.3125},{"pid":80698,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.484375,"endRssMiB":129.328125},{"pid":80699,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19951119756596336,"startRssMiB":326.921875,"endRssMiB":326.84375},{"pid":80700,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.96875,"endRssMiB":8.90625}]},{"name":"rest","before":{"animations":[],"domNodes":44,"heap":null,"mutations":1,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 71.428571% 100%;","name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":252},{"name":"openbitfun-petdex-breathe","state":"running","time":252}],"domNodes":44,"heap":null,"mutations":17,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":103.96216583251952,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":96.03492736816406,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793890883217,"load":[1.955078125,1.755859375,1.88623046875],"processes":[{"pid":80696,"rssMiB":380.40625,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.3125,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.421875,"cpuMs":280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":3,"In use system memory":118718464,"Alloc system memory":1654079488}},{"at":1793890884277,"load":[1.87841796875,1.7431640625,1.880859375],"processes":[{"pid":80696,"rssMiB":380.40625,"cpuMs":2380,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.3125,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.328125,"cpuMs":290,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":114524160,"Alloc system memory":1643593728}},{"at":1793890885343,"load":[1.87841796875,1.7431640625,1.880859375],"processes":[{"pid":80696,"rssMiB":380.40625,"cpuMs":2430,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.34375,"cpuMs":330,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":110329856,"Alloc system memory":1633107968}},{"at":1793890886397,"load":[1.87841796875,1.7431640625,1.880859375],"processes":[{"pid":80696,"rssMiB":380.421875,"cpuMs":2480,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.359375,"cpuMs":340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":88309760,"Alloc system memory":1621573632}},{"at":1793890887463,"load":[1.87841796875,1.7431640625,1.880859375],"processes":[{"pid":80696,"rssMiB":380.421875,"cpuMs":2530,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.359375,"cpuMs":350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":84115456,"Alloc system memory":1614233600}},{"at":1793890888528,"load":[1.87841796875,1.7431640625,1.880859375],"processes":[{"pid":80696,"rssMiB":380.421875,"cpuMs":2560,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.90625,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.28125,"cpuMs":360,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":84115456,"Alloc system memory":1609515008}},{"at":1793890889593,"load":[1.8076171875,1.73046875,1.87548828125],"processes":[{"pid":80696,"rssMiB":380.4375,"cpuMs":2610,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.8125,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.296875,"cpuMs":370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":71532544,"Alloc system memory":1567571968}},{"at":1793890890659,"load":[1.8076171875,1.73046875,1.87548828125],"processes":[{"pid":80696,"rssMiB":380.4375,"cpuMs":2660,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.8125,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.3125,"cpuMs":380,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":278134784,"Alloc system memory":1642020864}},{"at":1793890891725,"load":[1.8076171875,1.73046875,1.87548828125],"processes":[{"pid":80696,"rssMiB":380.46875,"cpuMs":2710,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.8125,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.34375,"cpuMs":400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":277872640,"Alloc system memory":1642020864}},{"at":1793890892790,"load":[1.8076171875,1.73046875,1.87548828125],"processes":[{"pid":80696,"rssMiB":374.828125,"cpuMs":2740,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.84375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.359375,"cpuMs":410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":5,"In use system memory":543277056,"Alloc system memory":1748697088}},{"at":1793890893837,"load":[1.8076171875,1.73046875,1.87548828125],"processes":[{"pid":80696,"rssMiB":374.828125,"cpuMs":2760,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.859375,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.359375,"cpuMs":420,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":15,"Renderer Utilization %":15,"Tiler Utilization %":4,"In use system memory":405733376,"Alloc system memory":1740308480}},{"at":1793890894903,"load":[1.74267578125,1.71826171875,1.8701171875],"processes":[{"pid":80696,"rssMiB":374.84375,"cpuMs":2780,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.859375,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.234375,"cpuMs":430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":15,"Renderer Utilization %":15,"Tiler Utilization %":4,"In use system memory":443842560,"Alloc system memory":1736409088}},{"at":1793890895969,"load":[1.74267578125,1.71826171875,1.8701171875],"processes":[{"pid":80696,"rssMiB":374.84375,"cpuMs":2800,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.1875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.859375,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":195.203125,"cpuMs":440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":14,"Renderer Utilization %":14,"Tiler Utilization %":4,"In use system memory":405864448,"Alloc system memory":1728544768}},{"at":1793890897035,"load":[1.74267578125,1.71826171875,1.8701171875],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2830,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.21875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.859375,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.796875,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":11,"In use system memory":533282816,"Alloc system memory":1752711168}},{"at":1793890898076,"load":[1.74267578125,1.71826171875,1.8701171875],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2860,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":370,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.90625,"cpuMs":1500,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.796875,"cpuMs":480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":508198912,"Alloc system memory":1751810048}},{"at":1793890899140,"load":[1.74267578125,1.71826171875,1.8701171875],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2900,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":370,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.8125,"cpuMs":500,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":20,"Renderer Utilization %":20,"Tiler Utilization %":6,"In use system memory":502710272,"Alloc system memory":1745272832}},{"at":1793890900183,"load":[1.68310546875,1.7060546875,1.86474609375],"processes":[{"pid":80696,"rssMiB":374.859375,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":370,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.8125,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":4,"In use system memory":533692416,"Alloc system memory":1823178752}},{"at":1793890901243,"load":[1.68310546875,1.7060546875,1.86474609375],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2930,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":380,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.828125,"cpuMs":520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":6,"In use system memory":729595904,"Alloc system memory":1881636864}},{"at":1793890902299,"load":[1.68310546875,1.7060546875,1.86474609375],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2960,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":380,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":198.953125,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":4,"In use system memory":506658816,"Alloc system memory":1866874880}},{"at":1793890903277,"load":[1.68310546875,1.7060546875,1.86474609375],"processes":[{"pid":80696,"rssMiB":374.875,"cpuMs":2980,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":156.28125,"cpuMs":380,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":199.015625,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":4,"In use system memory":469385216,"Alloc system memory":1783988224}}],"cpu":[{"pid":80696,"role":"openbitfun-desktop","cpuPercent":3.2402791625124627,"startRssMiB":380.40625,"endRssMiB":374.875},{"pid":80698,"role":"com.apple.WebKit.GPU","cpuPercent":0.09970089730807577,"startRssMiB":156.3125,"endRssMiB":156.28125},{"pid":80699,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19940179461615154,"startRssMiB":326.9375,"endRssMiB":326.921875},{"pid":80700,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.078125,"endRssMiB":9.03125},{"pid":81453,"role":"com.apple.WebKit.WebContent","cpuPercent":1.3459621136590227,"startRssMiB":195.421875,"endRssMiB":199.015625}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5014},{"name":"openbitfun-petdex-walk","state":"running","time":3798}],"domNodes":54,"heap":null,"mutations":29,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25138},{"name":"openbitfun-petdex-walk","state":"running","time":23922}],"domNodes":54,"heap":null,"mutations":29,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793890910986,"load":[1.8046875,1.7314453125,1.87158203125],"processes":[{"pid":80696,"rssMiB":355.25,"cpuMs":3290,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.4375,"cpuMs":430,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":200.859375,"cpuMs":850,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":512753664,"Alloc system memory":1755709440}},{"at":1793890912043,"load":[1.8046875,1.7314453125,1.87158203125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3330,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.421875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.03125,"cpuMs":900,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":430702592,"Alloc system memory":1739718656}},{"at":1793890913105,"load":[1.8046875,1.7314453125,1.87158203125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3350,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.421875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.078125,"cpuMs":920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":7,"In use system memory":511410176,"Alloc system memory":1751007232}},{"at":1793890914157,"load":[1.8046875,1.7314453125,1.87158203125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3390,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.421875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.109375,"cpuMs":950,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":468680704,"Alloc system memory":1738080256}},{"at":1793890915219,"load":[1.66015625,1.70263671875,1.8603515625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3430,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.4375,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.125,"cpuMs":990,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":430702592,"Alloc system memory":1731788800}},{"at":1793890916286,"load":[1.66015625,1.70263671875,1.8603515625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3470,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.4375,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.140625,"cpuMs":1020,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":20,"Renderer Utilization %":20,"Tiler Utilization %":6,"In use system memory":512376832,"Alloc system memory":1748041728}},{"at":1793890917352,"load":[1.66015625,1.70263671875,1.8603515625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3490,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.4375,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.921875,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.15625,"cpuMs":1030,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":23,"Renderer Utilization %":23,"Tiler Utilization %":7,"In use system memory":476217344,"Alloc system memory":1748041728}},{"at":1793890918394,"load":[1.66015625,1.70263671875,1.8603515625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3520,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.453125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.203125,"cpuMs":1060,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":24,"Renderer Utilization %":24,"Tiler Utilization %":7,"In use system memory":508182528,"Alloc system memory":1748041728}},{"at":1793890919440,"load":[1.60693359375,1.69091796875,1.85498046875],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3550,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.453125,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.203125,"cpuMs":1080,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":6,"In use system memory":526188544,"Alloc system memory":1749254144}},{"at":1793890920477,"load":[1.60693359375,1.69091796875,1.85498046875],"processes":[{"pid":80696,"rssMiB":355.328125,"cpuMs":3590,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.46875,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.21875,"cpuMs":1110,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":6,"In use system memory":535937024,"Alloc system memory":1757200384}},{"at":1793890921544,"load":[1.60693359375,1.69091796875,1.85498046875],"processes":[{"pid":80696,"rssMiB":355.328125,"cpuMs":3610,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.46875,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.234375,"cpuMs":1140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":20,"Renderer Utilization %":20,"Tiler Utilization %":6,"In use system memory":514080768,"Alloc system memory":1756643328}},{"at":1793890922588,"load":[1.60693359375,1.69091796875,1.85498046875],"processes":[{"pid":80696,"rssMiB":355.328125,"cpuMs":3640,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.46875,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.140625,"cpuMs":1150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":23,"Renderer Utilization %":23,"Tiler Utilization %":7,"In use system memory":513753088,"Alloc system memory":1756790784}},{"at":1793890923650,"load":[1.60693359375,1.69091796875,1.85498046875],"processes":[{"pid":80696,"rssMiB":355.328125,"cpuMs":3680,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.15625,"cpuMs":1180,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":6,"In use system memory":480772096,"Alloc system memory":1756790784}},{"at":1793890924717,"load":[1.71826171875,1.71240234375,1.861328125],"processes":[{"pid":80696,"rssMiB":355.328125,"cpuMs":3710,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.484375,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.15625,"cpuMs":1210,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":23,"Renderer Utilization %":23,"Tiler Utilization %":18,"In use system memory":503414784,"Alloc system memory":1757855744}},{"at":1793890925785,"load":[1.71826171875,1.71240234375,1.861328125],"processes":[{"pid":80696,"rssMiB":355.234375,"cpuMs":3740,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.484375,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.171875,"cpuMs":1230,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":14,"In use system memory":498106368,"Alloc system memory":1752727552}},{"at":1793890926849,"load":[1.71826171875,1.71240234375,1.861328125],"processes":[{"pid":80696,"rssMiB":355.234375,"cpuMs":3780,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.5,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.1875,"cpuMs":1260,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":22,"Renderer Utilization %":22,"Tiler Utilization %":12,"In use system memory":502906880,"Alloc system memory":1751760896}},{"at":1793890927912,"load":[1.71826171875,1.71240234375,1.861328125],"processes":[{"pid":80696,"rssMiB":355.25,"cpuMs":3820,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.5,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.015625,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.1875,"cpuMs":1290,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":22,"Renderer Utilization %":22,"Tiler Utilization %":13,"In use system memory":502693888,"Alloc system memory":1751547904}},{"at":1793890928968,"load":[1.71826171875,1.71240234375,1.861328125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.5,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.1875,"cpuMs":1310,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":23,"Renderer Utilization %":23,"Tiler Utilization %":16,"In use system memory":471973888,"Alloc system memory":1748336640}},{"at":1793890930020,"load":[1.98095703125,1.7666015625,1.87939453125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3900,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.515625,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.21875,"cpuMs":1340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":21,"Renderer Utilization %":21,"Tiler Utilization %":10,"In use system memory":497582080,"Alloc system memory":1750761472}},{"at":1793890931043,"load":[1.98095703125,1.7666015625,1.87939453125],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.40625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.9375,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.21875,"cpuMs":1370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":20,"Renderer Utilization %":20,"Tiler Utilization %":6,"In use system memory":456359936,"Alloc system memory":1746124800}}],"cpu":[{"pid":80696,"role":"openbitfun-desktop","cpuPercent":3.2407638231041527,"startRssMiB":355.25,"endRssMiB":355.265625},{"pid":80698,"role":"com.apple.WebKit.GPU","cpuPercent":0.44872114473749813,"startRssMiB":176.4375,"endRssMiB":176.40625},{"pid":80699,"role":"com.apple.WebKit.WebContent","cpuPercent":0.4985790497083312,"startRssMiB":326.921875,"endRssMiB":326.9375},{"pid":80700,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.015625,"endRssMiB":9.03125},{"pid":81453,"role":"com.apple.WebKit.WebContent","cpuPercent":2.5926110584833224,"startRssMiB":200.859375,"endRssMiB":201.21875}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":32,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 71.428571% 100%;","name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":32,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 71.428571% 100%;","name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793890938828,"load":[1.822265625,1.73681640625,1.8681640625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4070.0000000000005,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.453125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.953125,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.125,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":7,"In use system memory":472809472,"Alloc system memory":1739161600}},{"at":1793890939890,"load":[1.67626953125,1.70751953125,1.85693359375],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4070.0000000000005,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.453125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.953125,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.09375,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":7,"In use system memory":478887936,"Alloc system memory":1726955520}},{"at":1793890940953,"load":[1.67626953125,1.70751953125,1.85693359375],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4080,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.09375,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":7,"In use system memory":439435264,"Alloc system memory":1721925632}},{"at":1793890942018,"load":[1.67626953125,1.70751953125,1.85693359375],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4090,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.09375,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":7,"In use system memory":439861248,"Alloc system memory":1719664640}},{"at":1793890943083,"load":[1.67626953125,1.70751953125,1.85693359375],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4090,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.09375,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":30,"Renderer Utilization %":30,"Tiler Utilization %":8,"In use system memory":490881024,"Alloc system memory":1719664640}},{"at":1793890944146,"load":[1.67626953125,1.70751953125,1.85693359375],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4090,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.09375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":7,"In use system memory":442646528,"Alloc system memory":1707081728}},{"at":1793890945212,"load":[1.6220703125,1.6953125,1.8515625],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4090,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.109375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":7,"In use system memory":405372928,"Alloc system memory":1702723584}},{"at":1793890946276,"load":[1.6220703125,1.6953125,1.8515625],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4090,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.109375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":7,"In use system memory":447037440,"Alloc system memory":1698627584}},{"at":1793890947342,"load":[1.6220703125,1.6953125,1.8515625],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4100,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.109375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":7,"In use system memory":480133120,"Alloc system memory":1711996928}},{"at":1793890948406,"load":[1.6220703125,1.6953125,1.8515625],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4100,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202.109375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":33,"Renderer Utilization %":33,"Tiler Utilization %":20,"In use system memory":463519744,"Alloc system memory":1718763520}},{"at":1793890949470,"load":[1.57177734375,1.68359375,1.84619140625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.984375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":30,"Renderer Utilization %":30,"Tiler Utilization %":24,"In use system memory":731643904,"Alloc system memory":1757822976}},{"at":1793890950535,"load":[1.57177734375,1.68359375,1.84619140625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.984375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":602488832,"Alloc system memory":1813282816}},{"at":1793890951600,"load":[1.57177734375,1.68359375,1.84619140625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.953125,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":3,"In use system memory":561872896,"Alloc system memory":1811873792}},{"at":1793890952667,"load":[1.57177734375,1.68359375,1.84619140625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":201.984375,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":14,"In use system memory":667680768,"Alloc system memory":1850245120}},{"at":1793890953728,"load":[1.57177734375,1.68359375,1.84619140625],"processes":[{"pid":80696,"rssMiB":355.265625,"cpuMs":4120,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":14,"In use system memory":561725440,"Alloc system memory":1847902208}},{"at":1793890954785,"load":[1.60595703125,1.6884765625,1.8466796875],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4120,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":570179584,"Alloc system memory":1841332224}},{"at":1793890955849,"load":[1.60595703125,1.6884765625,1.8466796875],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4120,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":590168064,"Alloc system memory":1835286528}},{"at":1793890956915,"load":[1.60595703125,1.6884765625,1.8466796875],"processes":[{"pid":80696,"rssMiB":355.21875,"cpuMs":4120,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":5,"In use system memory":668909568,"Alloc system memory":1802387456}},{"at":1793890957965,"load":[1.60595703125,1.6884765625,1.8466796875],"processes":[{"pid":80696,"rssMiB":355.234375,"cpuMs":4130,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":8,"In use system memory":597966848,"Alloc system memory":1836974080}},{"at":1793890958888,"load":[1.60595703125,1.6884765625,1.8466796875],"processes":[{"pid":80696,"rssMiB":355.234375,"cpuMs":4140,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":176.328125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":81453,"rssMiB":202,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":609828864,"Alloc system memory":1832583168}}],"cpu":[{"pid":80696,"role":"openbitfun-desktop","cpuPercent":0.34895314057826293,"startRssMiB":355.265625,"endRssMiB":355.234375},{"pid":80698,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":176.453125,"endRssMiB":176.328125},{"pid":80699,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14955134596211367,"startRssMiB":326.953125,"endRssMiB":326.96875},{"pid":80700,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.03125,"endRssMiB":9.03125},{"pid":81453,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19940179461615154,"startRssMiB":202.125,"endRssMiB":202}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793890963968,"load":[1.63720703125,1.693359375,1.84716796875],"processes":[{"pid":80696,"rssMiB":355.0625,"cpuMs":4160,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.109375,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":9,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":479887360,"Alloc system memory":1812496384}},{"at":1793890965026,"load":[1.505859375,1.6650390625,1.8359375],"processes":[{"pid":80696,"rssMiB":355.0625,"cpuMs":4170,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.109375,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":598392832,"Alloc system memory":1823113216}},{"at":1793890966091,"load":[1.505859375,1.6650390625,1.8359375],"processes":[{"pid":80696,"rssMiB":355.0625,"cpuMs":4170,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":658735104,"Alloc system memory":1823113216}},{"at":1793890967153,"load":[1.505859375,1.6650390625,1.8359375],"processes":[{"pid":80696,"rssMiB":355.0625,"cpuMs":4180,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":549191680,"Alloc system memory":1813151744}},{"at":1793890968219,"load":[1.505859375,1.6650390625,1.8359375],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4180,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":494272512,"Alloc system memory":1813364736}},{"at":1793890969284,"load":[1.505859375,1.6650390625,1.8359375],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4180,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":568115200,"Alloc system memory":1813856256}},{"at":1793890970348,"load":[1.38525390625,1.63720703125,1.82470703125],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":326.96875,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":480346112,"Alloc system memory":1809563648}},{"at":1793890971413,"load":[1.38525390625,1.63720703125,1.82470703125],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":361349120,"Alloc system memory":1799077888}},{"at":1793890972479,"load":[1.38525390625,1.63720703125,1.82470703125],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":547569664,"Alloc system memory":1816018944}},{"at":1793890973543,"load":[1.38525390625,1.63720703125,1.82470703125],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":633552896,"Alloc system memory":1830338560}},{"at":1793890974610,"load":[1.35400390625,1.62646484375,1.81982421875],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":465502208,"Alloc system memory":1828061184}},{"at":1793890975676,"load":[1.35400390625,1.62646484375,1.81982421875],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4200,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":3,"In use system memory":498024448,"Alloc system memory":1825964032}},{"at":1793890976743,"load":[1.35400390625,1.62646484375,1.81982421875],"processes":[{"pid":80696,"rssMiB":355.046875,"cpuMs":4200,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.046875,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":537001984,"Alloc system memory":1827667968}},{"at":1793890977808,"load":[1.35400390625,1.62646484375,1.81982421875],"processes":[{"pid":80696,"rssMiB":355.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":32,"Renderer Utilization %":32,"Tiler Utilization %":21,"In use system memory":636190720,"Alloc system memory":1832632320}},{"at":1793890978845,"load":[1.35400390625,1.62646484375,1.81982421875],"processes":[{"pid":80696,"rssMiB":355.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":32,"Renderer Utilization %":32,"Tiler Utilization %":8,"In use system memory":576159744,"Alloc system memory":1831223296}},{"at":1793890979903,"load":[1.5654296875,1.66552734375,1.83251953125],"processes":[{"pid":80696,"rssMiB":355.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":33,"Renderer Utilization %":33,"Tiler Utilization %":7,"In use system memory":494125056,"Alloc system memory":1859436544}},{"at":1793890980940,"load":[1.5654296875,1.66552734375,1.83251953125],"processes":[{"pid":80696,"rssMiB":355.15625,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.078125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":27,"Renderer Utilization %":27,"Tiler Utilization %":6,"In use system memory":556007424,"Alloc system memory":1893138432}},{"at":1793890981985,"load":[1.5654296875,1.66552734375,1.83251953125],"processes":[{"pid":80696,"rssMiB":355.15625,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.015625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":6,"In use system memory":497369088,"Alloc system memory":1888944128}},{"at":1793890983048,"load":[1.5654296875,1.66552734375,1.83251953125],"processes":[{"pid":80696,"rssMiB":355.15625,"cpuMs":4220,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.0625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":10,"In use system memory":491569152,"Alloc system memory":1884045312}},{"at":1793890984026,"load":[1.5654296875,1.66552734375,1.83251953125],"processes":[{"pid":80696,"rssMiB":355.15625,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":80698,"rssMiB":149.0625,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":80699,"rssMiB":327.0625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":80700,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":14,"In use system memory":463159296,"Alloc system memory":1881391104}}],"cpu":[{"pid":80696,"role":"openbitfun-desktop","cpuPercent":0.34898793498853325,"startRssMiB":355.0625,"endRssMiB":355.15625},{"pid":80698,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":149.109375,"endRssMiB":149.0625},{"pid":80699,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14956625785222855,"startRssMiB":326.96875,"endRssMiB":327.0625},{"pid":80700,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.953125}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[80698,80699,80700,81453],"hostPid":80696,"petCandidatePids":[81453],"mainCandidatePids":[80698,80699,80700]},"restCadence":{"frames":[25374,25381,25398,25414,25431,25448,25464,25480,25498,25514,25531,25548,25564,25581,25598,25614,25630,25648,25664,25680,25698,25714,25731,25747,25764,25780,25798,25814,25831,25847,25864,25881,25898,25914,25931,25948,25964,25981,25997,26014,26031,26048,26064,26080,26098,26113,26130,26148,26164,26180,26197,26214,26231,26248,26264,26281,26297,26314,26330,26348,26364,26381,26398,26414,26431,26448,26464,26481,26498,26514,26531,26547,26564,26581,26598,26614,26631,26648,26664,26681,26698,26714,26731,26747,26764,26781,26798,26814,26830,26847,26864,26881,26897,26914,26931,26947,26963,26981,26997,27014,27031,27048,27064,27081,27098,27114,27131,27148,27164,27181,27198,27214,27231,27248,27264,27281,27298,27313,27331,27348,27364,27381,27398,27414,27431,27448,27464,27481,27497,27514,27531,27547,27564,27581,27597,27614,27631,27647,27664,27681,27698,27714,27731,27748,27764,27781,27798,27814,27831,27848,27864,27881,27898,27914,27931,27948,27964,27981],"positions":["0%","14.285714%","28.571428%","71.428574%","57.142857%"]},"workCadence":{"frames":[53139,53147,53164,53181,53197,53214,53231,53247,53264,53281,53296,53313,53330,53347,53364,53381,53397,53413,53431,53447,53464,53481,53497,53514,53531,53547,53564,53581,53597,53614,53631,53648,53665,53681,53696,53714,53731,53747,53763,53781,53796,53814,53831,53847,53864,53881,53897,53913,53931,53947,53964,53980,53997,54014,54031,54046,54063,54081,54097,54114,54131,54147,54164,54181,54197,54214,54231,54247,54264,54281,54297,54314,54331,54347,54364,54381,54396,54413,54431,54447,54464,54481,54497,54514,54530,54546,54563,54580,54596,54613,54630,54647,54663,54681,54697,54714,54731,54747,54763,54780,54796,54813,54830,54847,54864,54881,54897,54914,54931,54947,54964,54981,54997,55014,55031,55047,55064,55081,55097,55114,55131,55147,55164,55181,55197,55214,55231,55246,55263,55280,55297,55314,55331,55347,55364,55381,55396,55414,55431,55447,55464,55481,55496,55513,55531,55547,55564,55581,55597,55614,55631,55646,55664,55681,55697,55714,55731,55747],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"pair":3,"label":"baseline","directory":"/openbitfun-pet-perf-5Wg6FL","report":{"schemaVersion":1,"label":"baseline-3","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-430fd6c0fc1530b6","algorithm":"sha256-path-content-v1","digest":"430fd6c0fc1530b6044d5fdcf2ba13f547b36b5114cdbba9c70f274f619ec1a5","fileCount":2737,"totalBytes":93312928},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793891015617,"load":[1.7265625,1.7119140625,1.84228515625],"processes":[{"pid":84417,"rssMiB":359.453125,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":14,"In use system memory":386859008,"Alloc system memory":1887748096}},{"at":1793891016672,"load":[1.7265625,1.7119140625,1.84228515625],"processes":[{"pid":84417,"rssMiB":359.328125,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.21875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":414842880,"Alloc system memory":1883553792}},{"at":1793891017738,"load":[1.7265625,1.7119140625,1.84228515625],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.21875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":556400640,"Alloc system memory":1915895808}},{"at":1793891018801,"load":[1.7265625,1.7119140625,1.84228515625],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2300,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.21875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":542310400,"Alloc system memory":1930444800}},{"at":1793891019837,"load":[1.587890625,1.68310546875,1.8310546875],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.21875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":501334016,"Alloc system memory":1918468096}},{"at":1793891020876,"load":[1.587890625,1.68310546875,1.8310546875],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":482279424,"Alloc system memory":1904492544}},{"at":1793891021949,"load":[1.587890625,1.68310546875,1.8310546875],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":469778432,"Alloc system memory":1900298240}},{"at":1793891023014,"load":[1.587890625,1.68310546875,1.8310546875],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.5,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":344244224,"Alloc system memory":1889812480}},{"at":1793891024063,"load":[1.587890625,1.68310546875,1.8310546875],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":469352448,"Alloc system memory":1884995584}},{"at":1793891025129,"load":[1.62060546875,1.68798828125,1.83203125],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":487292928,"Alloc system memory":1877671936}},{"at":1793891026195,"load":[1.62060546875,1.68798828125,1.83203125],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":476102656,"Alloc system memory":1873821696}},{"at":1793891027261,"load":[1.62060546875,1.68798828125,1.83203125],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":426033152,"Alloc system memory":1867350016}},{"at":1793891028327,"load":[1.62060546875,1.68798828125,1.83203125],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":515342336,"Alloc system memory":1882554368}},{"at":1793891029367,"load":[1.62060546875,1.68798828125,1.83203125],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":522551296,"Alloc system memory":1884766208}},{"at":1793891030406,"load":[1.73095703125,1.70947265625,1.8388671875],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":500498432,"Alloc system memory":1881964544}},{"at":1793891031472,"load":[1.73095703125,1.70947265625,1.8388671875],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":505724928,"Alloc system memory":1882406912}},{"at":1793891032538,"load":[1.73095703125,1.70947265625,1.8388671875],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":363757568,"Alloc system memory":1879851008}},{"at":1793891033604,"load":[1.73095703125,1.70947265625,1.8388671875],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":478478336,"Alloc system memory":1870757888}},{"at":1793891034669,"load":[1.73095703125,1.70947265625,1.8388671875],"processes":[{"pid":84417,"rssMiB":359.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":418463744,"Alloc system memory":1860304896}},{"at":1793891035673,"load":[1.67236328125,1.697265625,1.83349609375],"processes":[{"pid":84417,"rssMiB":359.296875,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":129.484375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":346537984,"Alloc system memory":1851916288}}],"cpu":[{"pid":84417,"role":"openbitfun-desktop","cpuPercent":0.24930195452732348,"startRssMiB":359.453125,"endRssMiB":359.296875},{"pid":84419,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.5,"endRssMiB":129.484375},{"pid":84420,"role":"com.apple.WebKit.WebContent","cpuPercent":0.1495811727163941,"startRssMiB":335.265625,"endRssMiB":335.125},{"pid":84421,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.9375,"endRssMiB":8.875}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4180},{"name":"openbitfun-petdex-breathe","state":"running","time":4180}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":101.4896240234375,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":98.3172607421875,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24287},{"name":"openbitfun-petdex-breathe","state":"running","time":24287}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":102.9127426147461,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":97.00363159179688,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793891041016,"load":[1.5380859375,1.6689453125,1.822265625],"processes":[{"pid":84417,"rssMiB":379.46875,"cpuMs":2560,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.765625,"cpuMs":350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":500531200,"Alloc system memory":1904541696}},{"at":1793891042057,"load":[1.5380859375,1.6689453125,1.822265625],"processes":[{"pid":84417,"rssMiB":379.46875,"cpuMs":2590,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.8125,"cpuMs":400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":461750272,"Alloc system memory":1895841792}},{"at":1793891043110,"load":[1.5380859375,1.6689453125,1.822265625],"processes":[{"pid":84417,"rssMiB":379.421875,"cpuMs":2620,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.8125,"cpuMs":420,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":453361664,"Alloc system memory":1889665024}},{"at":1793891044174,"load":[1.5380859375,1.6689453125,1.822265625],"processes":[{"pid":84417,"rssMiB":379.4375,"cpuMs":2660,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.828125,"cpuMs":450,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":450772992,"Alloc system memory":1883258880}},{"at":1793891045240,"load":[1.57470703125,1.67431640625,1.8232421875],"processes":[{"pid":84417,"rssMiB":379.4375,"cpuMs":2690,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.828125,"cpuMs":470,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":437092352,"Alloc system memory":1881161728}},{"at":1793891046303,"load":[1.57470703125,1.67431640625,1.8232421875],"processes":[{"pid":84417,"rssMiB":379.4375,"cpuMs":2720,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.15625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.796875,"cpuMs":490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":427098112,"Alloc system memory":1876082688}},{"at":1793891047368,"load":[1.57470703125,1.67431640625,1.8232421875],"processes":[{"pid":84417,"rssMiB":379.453125,"cpuMs":2750,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.0625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.78125,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":454328320,"Alloc system memory":1867415552}},{"at":1793891048435,"load":[1.57470703125,1.67431640625,1.8232421875],"processes":[{"pid":84417,"rssMiB":379.453125,"cpuMs":2780,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.0625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.828125,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":453148672,"Alloc system memory":1865351168}},{"at":1793891049500,"load":[1.57470703125,1.67431640625,1.8232421875],"processes":[{"pid":84417,"rssMiB":379.46875,"cpuMs":2810,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.0625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":195.90625,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":427065344,"Alloc system memory":1865351168}},{"at":1793891050565,"load":[1.7685546875,1.712890625,1.8359375],"processes":[{"pid":84417,"rssMiB":379.46875,"cpuMs":2840,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.0625,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":3,"In use system memory":448217088,"Alloc system memory":1863335936}},{"at":1793891051628,"load":[1.7685546875,1.712890625,1.8359375],"processes":[{"pid":84417,"rssMiB":379.46875,"cpuMs":2880,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.0625,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":451805184,"Alloc system memory":1859059712}},{"at":1793891052693,"load":[1.7685546875,1.712890625,1.8359375],"processes":[{"pid":84417,"rssMiB":379.484375,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.140625,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":437092352,"Alloc system memory":1859059712}},{"at":1793891053759,"load":[1.7685546875,1.712890625,1.8359375],"processes":[{"pid":84417,"rssMiB":379.484375,"cpuMs":2940,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.453125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.046875,"cpuMs":650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":427065344,"Alloc system memory":1859026944}},{"at":1793891054819,"load":[1.7685546875,1.712890625,1.8359375],"processes":[{"pid":84417,"rssMiB":379.484375,"cpuMs":2970,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.453125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.046875,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":449806336,"Alloc system memory":1859141632}},{"at":1793891055885,"load":[1.70654296875,1.70068359375,1.83056640625],"processes":[{"pid":84417,"rssMiB":379.53125,"cpuMs":3010,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.453125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.0625,"cpuMs":690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":450772992,"Alloc system memory":1859026944}},{"at":1793891056944,"load":[1.70654296875,1.70068359375,1.83056640625],"processes":[{"pid":84417,"rssMiB":379.53125,"cpuMs":3040,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.0625,"cpuMs":710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":437125120,"Alloc system memory":1859010560}},{"at":1793891058008,"load":[1.70654296875,1.70068359375,1.83056640625],"processes":[{"pid":84417,"rssMiB":379.515625,"cpuMs":3060,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.0625,"cpuMs":720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":3,"In use system memory":427098112,"Alloc system memory":1859010560}},{"at":1793891059075,"load":[1.70654296875,1.70068359375,1.83056640625],"processes":[{"pid":84417,"rssMiB":379.53125,"cpuMs":3100,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.078125,"cpuMs":740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":448249856,"Alloc system memory":1859125248}},{"at":1793891060141,"load":[1.64990234375,1.68896484375,1.82568359375],"processes":[{"pid":84417,"rssMiB":379.53125,"cpuMs":3130,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.09375,"cpuMs":770,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":450772992,"Alloc system memory":1859010560}},{"at":1793891061057,"load":[1.64990234375,1.68896484375,1.82568359375],"processes":[{"pid":84417,"rssMiB":379.53125,"cpuMs":3160,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":156.4375,"cpuMs":560,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":196.109375,"cpuMs":780,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":4,"In use system memory":437092352,"Alloc system memory":1859010560}}],"cpu":[{"pid":84417,"role":"openbitfun-desktop","cpuPercent":2.9938625817075,"startRssMiB":379.46875,"endRssMiB":379.53125},{"pid":84419,"role":"com.apple.WebKit.GPU","cpuPercent":0.29938625817075,"startRssMiB":156.4375,"endRssMiB":156.4375},{"pid":84420,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19959083878049996,"startRssMiB":335.234375,"endRssMiB":335.140625},{"pid":84421,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.9375},{"pid":85134,"role":"com.apple.WebKit.WebContent","cpuPercent":2.1456015168903746,"startRssMiB":195.765625,"endRssMiB":196.109375}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5021},{"name":"openbitfun-petdex-walk","state":"running","time":3807}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25146},{"name":"openbitfun-petdex-walk","state":"running","time":23932}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793891068777,"load":[1.677734375,1.69384765625,1.82666015625],"processes":[{"pid":84417,"rssMiB":354.25,"cpuMs":3480,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.515625,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.03125,"cpuMs":1140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":474316800,"Alloc system memory":1883144192}},{"at":1793891069835,"load":[1.677734375,1.69384765625,1.82666015625],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3520,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.046875,"cpuMs":1190,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":449675264,"Alloc system memory":1880588288}},{"at":1793891070900,"load":[1.54296875,1.66552734375,1.81591796875],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3560,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.0625,"cpuMs":1220,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":440713216,"Alloc system memory":1876393984}},{"at":1793891071966,"load":[1.54296875,1.66552734375,1.81591796875],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3590,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.0625,"cpuMs":1250,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":443383808,"Alloc system memory":1874591744}},{"at":1793891073030,"load":[1.54296875,1.66552734375,1.81591796875],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3630,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.546875,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.078125,"cpuMs":1280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":460685312,"Alloc system memory":1874788352}},{"at":1793891074095,"load":[1.54296875,1.66552734375,1.81591796875],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3670,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.546875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.078125,"cpuMs":1310,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":460718080,"Alloc system memory":1869971456}},{"at":1793891075163,"load":[1.5791015625,1.6708984375,1.81689453125],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3710,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.546875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.09375,"cpuMs":1340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":439222272,"Alloc system memory":1865777152}},{"at":1793891076230,"load":[1.5791015625,1.6708984375,1.81689453125],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3750,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.5625,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1850,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.140625,"cpuMs":1370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":459276288,"Alloc system memory":1865859072}},{"at":1793891077292,"load":[1.5791015625,1.6708984375,1.81689453125],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3780,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.5625,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.140625,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":598491136,"Alloc system memory":1928052736}},{"at":1793891078357,"load":[1.5791015625,1.6708984375,1.81689453125],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3820,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.5625,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.140625,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":513916928,"Alloc system memory":1926594560}},{"at":1793891079422,"load":[1.5791015625,1.6708984375,1.81689453125],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.578125,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.15625,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":439222272,"Alloc system memory":1920303104}},{"at":1793891080487,"load":[1.45263671875,1.64306640625,1.80615234375],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3900,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.578125,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.0625,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":464207872,"Alloc system memory":1912029184}},{"at":1793891081551,"load":[1.45263671875,1.64306640625,1.80615234375],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3930,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.578125,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.0625,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":7,"In use system memory":465911808,"Alloc system memory":1903525888}},{"at":1793891082616,"load":[1.45263671875,1.64306640625,1.80615234375],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":3970,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.59375,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.09375,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":450527232,"Alloc system memory":1895137280}},{"at":1793891083682,"load":[1.45263671875,1.64306640625,1.80615234375],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":4010,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.59375,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.265625,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.09375,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":439222272,"Alloc system memory":1890942976}},{"at":1793891084748,"load":[1.45263671875,1.64306640625,1.80615234375],"processes":[{"pid":84417,"rssMiB":354.203125,"cpuMs":4050,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.59375,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.109375,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.109375,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":464207872,"Alloc system memory":1886863360}},{"at":1793891085811,"load":[1.416015625,1.63232421875,1.80126953125],"processes":[{"pid":84417,"rssMiB":354.21875,"cpuMs":4100,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.609375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.140625,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.125,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":12,"Renderer Utilization %":12,"Tiler Utilization %":6,"In use system memory":465911808,"Alloc system memory":1882554368}},{"at":1793891086877,"load":[1.416015625,1.63232421875,1.80126953125],"processes":[{"pid":84417,"rssMiB":354.21875,"cpuMs":4130,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.609375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.15625,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.140625,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":458571776,"Alloc system memory":1878917120}},{"at":1793891087935,"load":[1.416015625,1.63232421875,1.80126953125],"processes":[{"pid":84417,"rssMiB":354.21875,"cpuMs":4160,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.625,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.15625,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.171875,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":502169600,"Alloc system memory":1899397120}},{"at":1793891088836,"load":[1.416015625,1.63232421875,1.80126953125],"processes":[{"pid":84417,"rssMiB":354.21875,"cpuMs":4190,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.15625,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.171875,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":5,"In use system memory":463814656,"Alloc system memory":1899773952}}],"cpu":[{"pid":84417,"role":"openbitfun-desktop","cpuPercent":3.5395583030061317,"startRssMiB":354.25,"endRssMiB":354.21875},{"pid":84419,"role":"com.apple.WebKit.GPU","cpuPercent":0.4985293384515679,"startRssMiB":176.515625,"endRssMiB":176.53125},{"pid":84420,"role":"com.apple.WebKit.WebContent","cpuPercent":0.6480881399870383,"startRssMiB":335.140625,"endRssMiB":335.15625},{"pid":84421,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.9375,"endRssMiB":8.9375},{"pid":85134,"role":"com.apple.WebKit.WebContent","cpuPercent":2.8914701630190933,"startRssMiB":201.03125,"endRssMiB":201.171875}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%;","name":"none","state":"running","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%;","name":"none","state":"running","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793891096626,"load":[1.271484375,1.59423828125,1.78564453125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.625,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":344883200,"Alloc system memory":1875525632}},{"at":1793891097688,"load":[1.271484375,1.59423828125,1.78564453125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.53125,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.53125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":433618944,"Alloc system memory":1877835776}},{"at":1793891098750,"load":[1.271484375,1.59423828125,1.78564453125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.53125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":387170304,"Alloc system memory":1867350016}},{"at":1793891099801,"load":[1.271484375,1.59423828125,1.78564453125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.53125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":343605248,"Alloc system memory":1861058560}},{"at":1793891100866,"load":[1.24951171875,1.583984375,1.78076171875],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.53125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":470056960,"Alloc system memory":1866924032}},{"at":1793891101922,"load":[1.24951171875,1.583984375,1.78076171875],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.359375,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":488816640,"Alloc system memory":1860550656}},{"at":1793891102988,"load":[1.24951171875,1.583984375,1.78076171875],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4400,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":353894400,"Alloc system memory":1856356352}},{"at":1793891104056,"load":[1.24951171875,1.583984375,1.78076171875],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4400,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":342540288,"Alloc system memory":1852162048}},{"at":1793891105122,"load":[1.24951171875,1.583984375,1.78076171875],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":462094336,"Alloc system memory":1860665344}},{"at":1793891106188,"load":[1.3095703125,1.5908203125,1.78173828125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":418807808,"Alloc system memory":1856323584}},{"at":1793891107253,"load":[1.3095703125,1.5908203125,1.78173828125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":353632256,"Alloc system memory":1852129280}},{"at":1793891108320,"load":[1.3095703125,1.5908203125,1.78173828125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":479592448,"Alloc system memory":1887846400}},{"at":1793891109385,"load":[1.3095703125,1.5908203125,1.78173828125],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4410,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":467484672,"Alloc system memory":1883242496}},{"at":1793891110451,"load":[1.20458984375,1.56396484375,1.77099609375],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":418807808,"Alloc system memory":1874214912}},{"at":1793891111502,"load":[1.20458984375,1.56396484375,1.77099609375],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.5625,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345096192,"Alloc system memory":1865302016}},{"at":1793891112570,"load":[1.20458984375,1.56396484375,1.77099609375],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.4375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":346898432,"Alloc system memory":1857355776}},{"at":1793891113637,"load":[1.20458984375,1.56396484375,1.77099609375],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4430,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.4375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":432766976,"Alloc system memory":1867890688}},{"at":1793891114700,"load":[1.20458984375,1.56396484375,1.77099609375],"processes":[{"pid":84417,"rssMiB":354.234375,"cpuMs":4430,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.4375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":421707776,"Alloc system memory":1861517312}},{"at":1793891115761,"load":[1.18798828125,1.55419921875,1.76611328125],"processes":[{"pid":84417,"rssMiB":354.25,"cpuMs":4440,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.4375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345096192,"Alloc system memory":1855225856}},{"at":1793891116687,"load":[1.18798828125,1.55419921875,1.76611328125],"processes":[{"pid":84417,"rssMiB":354.25,"cpuMs":4440,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":176.390625,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.1875,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":85134,"rssMiB":201.4375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":346374144,"Alloc system memory":1851031552}}],"cpu":[{"pid":84417,"role":"openbitfun-desktop","cpuPercent":0.29908778226409455,"startRssMiB":354.234375,"endRssMiB":354.25},{"pid":84419,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":176.53125,"endRssMiB":176.390625},{"pid":84420,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14954389113204727,"startRssMiB":335.171875,"endRssMiB":335.1875},{"pid":84421,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.96875},{"pid":85134,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19939185484272964,"startRssMiB":201.625,"endRssMiB":201.4375}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793891121768,"load":[1.1728515625,1.544921875,1.76123046875],"processes":[{"pid":84417,"rssMiB":354.140625,"cpuMs":4470,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.9375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":507314176,"Alloc system memory":1870053376}},{"at":1793891122830,"load":[1.1728515625,1.544921875,1.76123046875],"processes":[{"pid":84417,"rssMiB":354.09375,"cpuMs":4470,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":421855232,"Alloc system memory":1865367552}},{"at":1793891123896,"load":[1.1728515625,1.544921875,1.76123046875],"processes":[{"pid":84417,"rssMiB":354.09375,"cpuMs":4470,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":378454016,"Alloc system memory":1856978944}},{"at":1793891124946,"load":[1.1728515625,1.544921875,1.76123046875],"processes":[{"pid":84417,"rssMiB":354.09375,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":368427008,"Alloc system memory":1842298880}},{"at":1793891126000,"load":[1.15869140625,1.53564453125,1.75634765625],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":505397248,"Alloc system memory":1869643776}},{"at":1793891127065,"load":[1.15869140625,1.53564453125,1.75634765625],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4480,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":419233792,"Alloc system memory":1861042176}},{"at":1793891128130,"load":[1.15869140625,1.53564453125,1.75634765625],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4490,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.15625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.171875,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.90625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":355123200,"Alloc system memory":1851965440}},{"at":1793891129195,"load":[1.15869140625,1.53564453125,1.75634765625],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4490,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":344031232,"Alloc system memory":1843576832}},{"at":1793891130260,"load":[1.15869140625,1.53564453125,1.75634765625],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":501563392,"Alloc system memory":1868955648}},{"at":1793891131326,"load":[1.1455078125,1.5263671875,1.75146484375],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":419233792,"Alloc system memory":1860354048}},{"at":1793891132391,"load":[1.1455078125,1.5263671875,1.75146484375],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":346374144,"Alloc system memory":1851965440}},{"at":1793891133456,"load":[1.1455078125,1.5263671875,1.75146484375],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":345096192,"Alloc system memory":1843576832}},{"at":1793891134523,"load":[1.1455078125,1.5263671875,1.75146484375],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4500,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":511066112,"Alloc system memory":1868742656}},{"at":1793891135588,"load":[1.1337890625,1.517578125,1.74658203125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4510,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":421576704,"Alloc system memory":1860354048}},{"at":1793891136654,"load":[1.1337890625,1.517578125,1.74658203125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4510,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":346374144,"Alloc system memory":1851965440}},{"at":1793891137720,"load":[1.1337890625,1.517578125,1.74658203125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4510,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.234375,"cpuMs":1960,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":613711872,"Alloc system memory":1908654080}},{"at":1793891138785,"load":[1.1337890625,1.517578125,1.74658203125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4510,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.359375,"cpuMs":1970,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":499744768,"Alloc system memory":1903640576}},{"at":1793891139845,"load":[1.1337890625,1.517578125,1.74658203125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4520,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.359375,"cpuMs":1970,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":378454016,"Alloc system memory":1895251968}},{"at":1793891140911,"load":[1.04296875,1.4921875,1.736328125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4520,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.359375,"cpuMs":1980,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":344031232,"Alloc system memory":1882669056}},{"at":1793891141829,"load":[1.04296875,1.4921875,1.736328125],"processes":[{"pid":84417,"rssMiB":354.078125,"cpuMs":4530,"role":"openbitfun-desktop"},{"pid":84419,"rssMiB":149.140625,"cpuMs":750,"role":"com.apple.WebKit.GPU"},{"pid":84420,"rssMiB":335.359375,"cpuMs":1980,"role":"com.apple.WebKit.WebContent"},{"pid":84421,"rssMiB":8.890625,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":505397248,"Alloc system memory":1889812480}}],"cpu":[{"pid":84417,"role":"openbitfun-desktop","cpuPercent":0.29908778226409455,"startRssMiB":354.140625,"endRssMiB":354.078125},{"pid":84419,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":149.15625,"endRssMiB":149.140625},{"pid":84420,"role":"com.apple.WebKit.WebContent","cpuPercent":0.2492398185534121,"startRssMiB":335.171875,"endRssMiB":335.359375},{"pid":84421,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.9375,"endRssMiB":8.890625}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[84419,84420,84421,85134],"hostPid":84417,"petCandidatePids":[85134],"mainCandidatePids":[84419,84420,84421]},"restCadence":{"frames":[25349,25358,25374,25391,25408,25424,25441,25458,25474,25491,25508,25524,25541,25557,25574,25591,25608,25624,25641,25658,25674,25691,25708,25723,25741,25758,25774,25791,25808,25824,25841,25858,25874,25891,25908,25923,25941,25958,25974,25991,26008,26024,26041,26058,26074,26091,26108,26124,26141,26158,26174,26190,26208,26224,26241,26258,26274,26291,26308,26323,26341,26358,26374,26391,26408,26424,26441,26458,26475,26491,26508,26524,26541,26557,26574,26591,26608,26624,26640,26658,26674,26691,26707,26724,26741,26758,26774,26791,26808,26823,26841,26858,26874,26890,26908,26923,26941,26957,26974,26991,27008,27025,27041,27058,27074,27091,27108,27124,27140,27158,27174,27191,27207,27224,27241,27257,27273,27290,27307,27324,27340,27358,27374,27391,27408,27424,27441,27458,27474,27491,27508,27524,27541,27558,27574,27590,27607,27623,27641,27658,27673,27691,27708,27724,27741,27758,27774,27791,27808,27824,27841,27858,27874,27891,27908,27924,27941,27957],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53126,53141,53157,53174,53191,53207,53223,53241,53257,53274,53291,53307,53324,53341,53357,53374,53391,53408,53424,53441,53457,53474,53491,53507,53524,53541,53557,53574,53591,53607,53623,53640,53656,53674,53691,53707,53724,53741,53757,53773,53790,53807,53823,53840,53856,53873,53891,53907,53924,53941,53957,53974,53991,54007,54024,54041,54057,54074,54091,54106,54124,54140,54157,54174,54190,54207,54224,54241,54256,54274,54291,54307,54323,54341,54357,54373,54390,54407,54424,54440,54457,54474,54491,54508,54523,54540,54557,54574,54591,54607,54624,54641,54657,54674,54691,54707,54724,54741,54758,54774,54791,54807,54824,54841,54857,54874,54890,54907,54923,54941,54957,54974,54990,55007,55023,55040,55057,55073,55091,55107,55124,55141,55157,55173,55191,55207,55224,55241,55256,55273,55290,55307,55324,55341,55357,55374,55391,55407,55424,55441,55457,55474,55491,55507,55524,55541,55557,55574,55591,55608,55623,55640,55658,55674,55691,55708,55724,55741],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"pair":3,"label":"optimized","directory":"/openbitfun-pet-perf-qLdNcs","report":{"schemaVersion":1,"label":"optimized-3","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"7b6b65185568708e3aef22b2dd48854629903d5733cba4960c0e8e80b7f3c3d5","frontend":{"schemaVersion":1,"revision":"bundled-ce86dd79f9268b72","algorithm":"sha256-path-content-v1","digest":"ce86dd79f9268b72fdf032f4a092fb681f0e675f8f7b7cda8dbd67d6f13de049","fileCount":2737,"totalBytes":93313799},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793891173563,"load":[1.10205078125,1.4609375,1.7158203125],"processes":[{"pid":87881,"rssMiB":360.421875,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.984375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.734375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":30,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":42,"Renderer Utilization %":41,"Tiler Utilization %":12,"In use system memory":354156544,"Alloc system memory":1804369920}},{"at":1793891174624,"load":[1.10205078125,1.4609375,1.7158203125],"processes":[{"pid":87881,"rssMiB":360.359375,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.859375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.609375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":344883200,"Alloc system memory":1798078464}},{"at":1793891175690,"load":[1.10205078125,1.4609375,1.7158203125],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.859375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.609375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":466092032,"Alloc system memory":1804484608}},{"at":1793891176755,"load":[1.25390625,1.486328125,1.72314453125],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.734375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.609375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":418971648,"Alloc system memory":1801224192}},{"at":1793891177820,"load":[1.25390625,1.486328125,1.72314453125],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.734375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.609375,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":376963072,"Alloc system memory":1793884160}},{"at":1793891178884,"load":[1.25390625,1.486328125,1.72314453125],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.734375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.609375,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":366936064,"Alloc system memory":1788641280}},{"at":1793891179940,"load":[1.25390625,1.486328125,1.72314453125],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.734375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.515625,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":465305600,"Alloc system memory":1780973568}},{"at":1793891181006,"load":[1.1533203125,1.46142578125,1.712890625],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.734375,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.515625,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":421347328,"Alloc system memory":1776697344}},{"at":1793891182072,"load":[1.1533203125,1.46142578125,1.712890625],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.515625,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":354156544,"Alloc system memory":1773469696}},{"at":1793891183140,"load":[1.1533203125,1.46142578125,1.712890625],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.515625,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343064576,"Alloc system memory":1769275392}},{"at":1793891184205,"load":[1.1533203125,1.46142578125,1.712890625],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":462258176,"Alloc system memory":1781972992}},{"at":1793891185270,"load":[1.1533203125,1.46142578125,1.712890625],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":421347328,"Alloc system memory":1777664000}},{"at":1793891186338,"load":[1.30078125,1.48681640625,1.72021484375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":344883200,"Alloc system memory":1773469696}},{"at":1793891187400,"load":[1.30078125,1.48681640625,1.72021484375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343605248,"Alloc system memory":1769275392}},{"at":1793891188456,"load":[1.30078125,1.48681640625,1.72021484375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.5625,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":478658560,"Alloc system memory":1780891648}},{"at":1793891189522,"load":[1.30078125,1.48681640625,1.72021484375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2220,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":384794624,"Alloc system memory":1776697344}},{"at":1793891190588,"load":[1.30078125,1.48681640625,1.72021484375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2220,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":344883200,"Alloc system memory":1772503040}},{"at":1793891191652,"load":[1.1962890625,1.4619140625,1.7099609375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2220,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":466092032,"Alloc system memory":1781006336}},{"at":1793891192716,"load":[1.1962890625,1.4619140625,1.7099609375],"processes":[{"pid":87881,"rssMiB":360.34375,"cpuMs":2230,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":418971648,"Alloc system memory":1780858880}},{"at":1793891193624,"load":[1.1962890625,1.4619140625,1.7099609375],"processes":[{"pid":87881,"rssMiB":360.328125,"cpuMs":2230,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":148.71875,"cpuMs":440,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.59375,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":353632256,"Alloc system memory":1776664576}}],"cpu":[{"pid":87881,"role":"openbitfun-desktop","cpuPercent":0.29908778226409455,"startRssMiB":360.421875,"endRssMiB":360.328125},{"pid":87884,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":148.984375,"endRssMiB":148.71875},{"pid":87885,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14954389113204727,"startRssMiB":324.734375,"endRssMiB":324.59375},{"pid":87886,"role":"com.apple.WebKit.Networking","cpuPercent":0.04984796371068241,"startRssMiB":9.125,"endRssMiB":9.03125}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4187}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24305}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793891198988,"load":[1.18017578125,1.4541015625,1.70556640625],"processes":[{"pid":87881,"rssMiB":380.359375,"cpuMs":2440,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.921875,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.15625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.078125,"cpuMs":340,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":500744192,"Alloc system memory":1860616192}},{"at":1793891200046,"load":[1.18017578125,1.4541015625,1.70556640625],"processes":[{"pid":87881,"rssMiB":380.359375,"cpuMs":2470,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.921875,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.109375,"cpuMs":370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":523370496,"Alloc system memory":1854324736}},{"at":1793891201112,"load":[1.18017578125,1.4541015625,1.70556640625],"processes":[{"pid":87881,"rssMiB":380.359375,"cpuMs":2500,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.90625,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.109375,"cpuMs":390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":480346112,"Alloc system memory":1844363264}},{"at":1793891202177,"load":[1.08544921875,1.4296875,1.6953125],"processes":[{"pid":87881,"rssMiB":380.453125,"cpuMs":2530,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.90625,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.140625,"cpuMs":440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":434470912,"Alloc system memory":1838071808}},{"at":1793891203243,"load":[1.08544921875,1.4296875,1.6953125],"processes":[{"pid":87881,"rssMiB":380.453125,"cpuMs":2560,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.90625,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.140625,"cpuMs":470,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":403914752,"Alloc system memory":1829797888}},{"at":1793891204309,"load":[1.08544921875,1.4296875,1.6953125],"processes":[{"pid":87881,"rssMiB":380.453125,"cpuMs":2590,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.71875,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.78125,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.078125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.078125,"cpuMs":490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":526303232,"Alloc system memory":1842266112}},{"at":1793891205376,"load":[1.08544921875,1.4296875,1.6953125],"processes":[{"pid":87881,"rssMiB":380.46875,"cpuMs":2620,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.78125,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.078125,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":543145984,"Alloc system memory":1840201728}},{"at":1793891206443,"load":[1.158203125,1.43896484375,1.69677734375],"processes":[{"pid":87881,"rssMiB":380.46875,"cpuMs":2640,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.09375,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":425721856,"Alloc system memory":1836007424}},{"at":1793891207508,"load":[1.158203125,1.43896484375,1.69677734375],"processes":[{"pid":87881,"rssMiB":380.484375,"cpuMs":2670,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.921875,"cpuMs":1640,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.109375,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":527171584,"Alloc system memory":1833992192}},{"at":1793891208574,"load":[1.158203125,1.43896484375,1.69677734375],"processes":[{"pid":87881,"rssMiB":380.484375,"cpuMs":2710,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.9375,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.21875,"cpuMs":570,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":529940480,"Alloc system memory":1833910272}},{"at":1793891209640,"load":[1.158203125,1.43896484375,1.69677734375],"processes":[{"pid":87881,"rssMiB":380.484375,"cpuMs":2730,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.9375,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.25,"cpuMs":590,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":4,"Renderer Utilization %":4,"Tiler Utilization %":2,"In use system memory":434470912,"Alloc system memory":1829715968}},{"at":1793891210706,"load":[1.158203125,1.43896484375,1.69677734375],"processes":[{"pid":87881,"rssMiB":380.5,"cpuMs":2760,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.9375,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.28125,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":406257664,"Alloc system memory":1825488896}},{"at":1793891211773,"load":[1.3056640625,1.46484375,1.7041015625],"processes":[{"pid":87881,"rssMiB":380.515625,"cpuMs":2790,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.9375,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.359375,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":527204352,"Alloc system memory":1833992192}},{"at":1793891212838,"load":[1.3056640625,1.46484375,1.7041015625],"processes":[{"pid":87881,"rssMiB":380.53125,"cpuMs":2820,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.734375,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.9375,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.375,"cpuMs":650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":480346112,"Alloc system memory":1833877504}},{"at":1793891213895,"load":[1.3056640625,1.46484375,1.7041015625],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":2860,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.28125,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":438337536,"Alloc system memory":1829683200}},{"at":1793891214958,"load":[1.3056640625,1.46484375,1.7041015625],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":2880,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.296875,"cpuMs":680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":423378944,"Alloc system memory":1823490048}},{"at":1793891216024,"load":[1.3056640625,1.46484375,1.7041015625],"processes":[{"pid":87881,"rssMiB":355.21875,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.3125,"cpuMs":700,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":523370496,"Alloc system memory":1829257216}},{"at":1793891217090,"load":[1.28076171875,1.45703125,1.69970703125],"processes":[{"pid":87881,"rssMiB":355.21875,"cpuMs":2940,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.3125,"cpuMs":710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":532889600,"Alloc system memory":1829142528}},{"at":1793891218155,"load":[1.28076171875,1.45703125,1.69970703125],"processes":[{"pid":87881,"rssMiB":355.21875,"cpuMs":2960,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.328125,"cpuMs":730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":434470912,"Alloc system memory":1824948224}},{"at":1793891219046,"load":[1.28076171875,1.45703125,1.69970703125],"processes":[{"pid":87881,"rssMiB":355.21875,"cpuMs":2990,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":175.75,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":196.328125,"cpuMs":740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":403914752,"Alloc system memory":1820753920}}],"cpu":[{"pid":87881,"role":"openbitfun-desktop","cpuPercent":2.7420480606241897,"startRssMiB":380.359375,"endRssMiB":355.21875},{"pid":87884,"role":"com.apple.WebKit.GPU","cpuPercent":0.2991325157044571,"startRssMiB":175.71875,"endRssMiB":175.75},{"pid":87885,"role":"com.apple.WebKit.WebContent","cpuPercent":0.6979758699770665,"startRssMiB":324.921875,"endRssMiB":324.828125},{"pid":87886,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.15625,"endRssMiB":9.0625},{"pid":88578,"role":"com.apple.WebKit.WebContent","cpuPercent":1.994216771363047,"startRssMiB":196.078125,"endRssMiB":196.328125}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5013},{"name":"openbitfun-petdex-walk","state":"running","time":3800}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25137},{"name":"openbitfun-petdex-walk","state":"running","time":23924}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793891226751,"load":[1.39697265625,1.474609375,1.70263671875],"processes":[{"pid":87881,"rssMiB":355.234375,"cpuMs":3330,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.859375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.09375,"cpuMs":1130,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":431521792,"Alloc system memory":1814020096}},{"at":1793891227808,"load":[1.39697265625,1.474609375,1.70263671875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3370,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.859375,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.09375,"cpuMs":1160,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":457768960,"Alloc system memory":1812037632}},{"at":1793891228873,"load":[1.39697265625,1.474609375,1.70263671875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3410,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.859375,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.09375,"cpuMs":1190,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":457097216,"Alloc system memory":1809825792}},{"at":1793891229933,"load":[1.39697265625,1.474609375,1.70263671875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3450,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.875,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.109375,"cpuMs":1220,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":444137472,"Alloc system memory":1807728640}},{"at":1793891231000,"load":[1.39697265625,1.474609375,1.70263671875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3480,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.875,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.125,"cpuMs":1250,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":434110464,"Alloc system memory":1807728640}},{"at":1793891232066,"load":[1.36474609375,1.46630859375,1.6982421875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3530,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.890625,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.125,"cpuMs":1280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":454426624,"Alloc system memory":1802518528}},{"at":1793891233132,"load":[1.36474609375,1.46630859375,1.6982421875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3570,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.90625,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.15625,"cpuMs":1310,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":6,"In use system memory":457621504,"Alloc system memory":1802403840}},{"at":1793891234196,"load":[1.36474609375,1.46630859375,1.6982421875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3600,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.90625,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.25,"cpuMs":1350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":440795136,"Alloc system memory":1802403840}},{"at":1793891235261,"load":[1.36474609375,1.46630859375,1.6982421875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3640,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.90625,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.25,"cpuMs":1370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":429178880,"Alloc system memory":1802403840}},{"at":1793891236327,"load":[1.36474609375,1.46630859375,1.6982421875],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3680,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.921875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.140625,"cpuMs":1410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":451903488,"Alloc system memory":1802403840}},{"at":1793891237394,"load":[1.33544921875,1.45849609375,1.69384765625],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3720,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.921875,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.15625,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":451706880,"Alloc system memory":1802403840}},{"at":1793891238459,"load":[1.33544921875,1.45849609375,1.69384765625],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3760,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.9375,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.171875,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":431521792,"Alloc system memory":1802403840}},{"at":1793891239525,"load":[1.33544921875,1.45849609375,1.69384765625],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3790,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.953125,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.1875,"cpuMs":1490,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":526598144,"Alloc system memory":1841938432}},{"at":1793891240590,"load":[1.33544921875,1.45849609375,1.69384765625],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3830,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.953125,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.828125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.1875,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":491831296,"Alloc system memory":1844510720}},{"at":1793891241656,"load":[1.38818359375,1.46728515625,1.6953125],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3860,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.953125,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.796875,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.203125,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":5,"In use system memory":444710912,"Alloc system memory":1840316416}},{"at":1793891242722,"load":[1.38818359375,1.46728515625,1.6953125],"processes":[{"pid":87881,"rssMiB":355.1875,"cpuMs":3900,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.96875,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.796875,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.234375,"cpuMs":1570,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":430817280,"Alloc system memory":1835794432}},{"at":1793891243789,"load":[1.38818359375,1.46728515625,1.6953125],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.96875,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.84375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.25,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":4,"In use system memory":460996608,"Alloc system memory":1831895040}},{"at":1793891244856,"load":[1.38818359375,1.46728515625,1.6953125],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":3980,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.984375,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.859375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.28125,"cpuMs":1630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":490569728,"Alloc system memory":1830371328}},{"at":1793891245922,"load":[1.38818359375,1.46728515625,1.6953125],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":4010,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.984375,"cpuMs":680,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.859375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.296875,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":456196096,"Alloc system memory":1827389440}},{"at":1793891246809,"load":[1.43701171875,1.47607421875,1.69677734375],"processes":[{"pid":87881,"rssMiB":355.203125,"cpuMs":4040,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.859375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.375,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":444186624,"Alloc system memory":1823195136}}],"cpu":[{"pid":87881,"role":"openbitfun-desktop","cpuPercent":3.5397347691694088,"startRssMiB":355.234375,"endRssMiB":355.203125},{"pid":87884,"role":"com.apple.WebKit.GPU","cpuPercent":0.49855419284076175,"startRssMiB":195.859375,"endRssMiB":195.875},{"pid":87885,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14956625785222855,"startRssMiB":324.828125,"endRssMiB":324.859375},{"pid":87886,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.0625,"endRssMiB":9.0625},{"pid":88578,"role":"com.apple.WebKit.WebContent","cpuPercent":2.7420480606241897,"startRssMiB":201.09375,"endRssMiB":201.375}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":19,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: none; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 57.142857% 100%; animation-play-state: paused;","name":"none","state":"paused","width":96,"x":"57.142857%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793891254571,"load":[1.40185546875,1.4677734375,1.6923828125],"processes":[{"pid":87881,"rssMiB":355.21875,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.9375,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.921875,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":353681408,"Alloc system memory":1828913152}},{"at":1793891255635,"load":[1.40185546875,1.4677734375,1.6923828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4240,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":344932352,"Alloc system memory":1818427392}},{"at":1793891256702,"load":[1.36962890625,1.4599609375,1.68798828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4240,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":498499584,"Alloc system memory":1833222144}},{"at":1793891257767,"load":[1.36962890625,1.4599609375,1.68798828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":561053696,"Alloc system memory":1870741504}},{"at":1793891258833,"load":[1.36962890625,1.4599609375,1.68798828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":454606848,"Alloc system memory":1858158592}},{"at":1793891259884,"load":[1.36962890625,1.4599609375,1.68798828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":710,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.703125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":366985216,"Alloc system memory":1849769984}},{"at":1793891260946,"load":[1.36962890625,1.4599609375,1.68798828125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":467337216,"Alloc system memory":1847787520}},{"at":1793891261985,"load":[1.419921875,1.46875,1.689453125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4260,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.875,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":461996032,"Alloc system memory":1841987584}},{"at":1793891263052,"load":[1.419921875,1.46875,1.689453125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4260,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":342163456,"Alloc system memory":1835696128}},{"at":1793891264119,"load":[1.419921875,1.46875,1.689453125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4270,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":389414912,"Alloc system memory":1815068672}},{"at":1793891265183,"load":[1.419921875,1.46875,1.689453125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4270,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":509427712,"Alloc system memory":1837694976}},{"at":1793891266233,"load":[1.419921875,1.46875,1.689453125],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4270,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":3,"In use system memory":352190464,"Alloc system memory":1829306368}},{"at":1793891267283,"load":[1.46630859375,1.4775390625,1.69091796875],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4270,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":365494272,"Alloc system memory":1814429696}},{"at":1793891268349,"load":[1.46630859375,1.4775390625,1.69091796875],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4280,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":464912384,"Alloc system memory":1818738688}},{"at":1793891269412,"load":[1.46630859375,1.4775390625,1.69091796875],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4280,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":416301056,"Alloc system memory":1811808256}},{"at":1793891270477,"load":[1.46630859375,1.4775390625,1.69091796875],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4280,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.828125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":352190464,"Alloc system memory":1802321920}},{"at":1793891271531,"load":[1.46630859375,1.4775390625,1.69091796875],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4280,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.703125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343441408,"Alloc system memory":1796030464}},{"at":1793891272582,"load":[1.4287109375,1.46923828125,1.6865234375],"processes":[{"pid":87881,"rssMiB":355.140625,"cpuMs":4290,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.890625,"cpuMs":1760,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.703125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":464928768,"Alloc system memory":1802452992}},{"at":1793891273647,"load":[1.4287109375,1.46923828125,1.6865234375],"processes":[{"pid":87881,"rssMiB":355.15625,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.96875,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.703125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":6,"In use system memory":416301056,"Alloc system memory":1802321920}},{"at":1793891274634,"load":[1.4287109375,1.46923828125,1.6865234375],"processes":[{"pid":87881,"rssMiB":355.15625,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":195.796875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.96875,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":88578,"rssMiB":201.703125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":352190464,"Alloc system memory":1796030464}}],"cpu":[{"pid":87881,"role":"openbitfun-desktop","cpuPercent":0.34890096196979514,"startRssMiB":355.21875,"endRssMiB":355.15625},{"pid":87884,"role":"com.apple.WebKit.GPU","cpuPercent":0.049842994567113594,"startRssMiB":195.9375,"endRssMiB":195.796875},{"pid":87885,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19937197826845438,"startRssMiB":324.875,"endRssMiB":324.96875},{"pid":87886,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.125,"endRssMiB":9.109375},{"pid":88578,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19937197826845438,"startRssMiB":201.921875,"endRssMiB":201.703125}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793891279717,"load":[1.31396484375,1.44482421875,1.67626953125],"processes":[{"pid":87881,"rssMiB":355.015625,"cpuMs":4330,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.984375,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.09375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":352190464,"Alloc system memory":1793785856}},{"at":1793891280779,"load":[1.31396484375,1.44482421875,1.67626953125],"processes":[{"pid":87881,"rssMiB":355.015625,"cpuMs":4330,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.984375,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":367607808,"Alloc system memory":1785708544}},{"at":1793891281827,"load":[1.31396484375,1.44482421875,1.67626953125],"processes":[{"pid":87881,"rssMiB":355.015625,"cpuMs":4330,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.984375,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":467566592,"Alloc system memory":1796227072}},{"at":1793891282893,"load":[1.36865234375,1.45361328125,1.677734375],"processes":[{"pid":87881,"rssMiB":355.015625,"cpuMs":4340,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.984375,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":528580608,"Alloc system memory":1814921216}},{"at":1793891283959,"load":[1.36865234375,1.45361328125,1.677734375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4340,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":464322560,"Alloc system memory":1814282240}},{"at":1793891285026,"load":[1.36865234375,1.45361328125,1.677734375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4340,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":514490368,"Alloc system memory":1815298048}},{"at":1793891286064,"load":[1.36865234375,1.45361328125,1.677734375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.546875,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":324.953125,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":436273152,"Alloc system memory":1815298048}},{"at":1793891287116,"load":[2.1396484375,1.61181640625,1.73193359375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1790,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":534020096,"Alloc system memory":1817640960}},{"at":1793891288164,"load":[2.1396484375,1.61181640625,1.73193359375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":452526080,"Alloc system memory":1813315584}},{"at":1793891289231,"load":[2.1396484375,1.61181640625,1.73193359375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":1,"In use system memory":377012224,"Alloc system memory":1802371072}},{"at":1793891290292,"load":[2.1396484375,1.61181640625,1.73193359375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":367198208,"Alloc system memory":1793916928}},{"at":1793891291358,"load":[2.1396484375,1.61181640625,1.73193359375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4350,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":466894848,"Alloc system memory":1814020096}},{"at":1793891292422,"load":[2.12841796875,1.6181640625,1.7333984375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4360,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":452509696,"Alloc system memory":1808564224}},{"at":1793891293489,"load":[2.12841796875,1.6181640625,1.7333984375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4360,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343326720,"Alloc system memory":1797636096}},{"at":1793891294556,"load":[2.12841796875,1.6181640625,1.7333984375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":345456640,"Alloc system memory":1788723200}},{"at":1793891295622,"load":[2.12841796875,1.6181640625,1.7333984375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":432439296,"Alloc system memory":1796587520}},{"at":1793891296688,"load":[2.12841796875,1.6181640625,1.7333984375],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1800,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":390676480,"Alloc system memory":1790214144}},{"at":1793891297754,"load":[2.03759765625,1.607421875,1.72900390625],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":342802432,"Alloc system memory":1783922688}},{"at":1793891298821,"load":[2.03759765625,1.607421875,1.72900390625],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":467501056,"Alloc system memory":1790246912}},{"at":1793891299779,"load":[2.03759765625,1.607421875,1.72900390625],"processes":[{"pid":87881,"rssMiB":355,"cpuMs":4380,"role":"openbitfun-desktop"},{"pid":87884,"rssMiB":168.53125,"cpuMs":720,"role":"com.apple.WebKit.GPU"},{"pid":87885,"rssMiB":325.046875,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"},{"pid":87886,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":472809472,"Alloc system memory":1787084800}}],"cpu":[{"pid":87881,"role":"openbitfun-desktop","cpuPercent":0.24922739507526667,"startRssMiB":355.015625,"endRssMiB":355},{"pid":87884,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":168.546875,"endRssMiB":168.53125},{"pid":87885,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14953643704516,"startRssMiB":324.984375,"endRssMiB":325.046875},{"pid":87886,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.09375,"endRssMiB":9.03125}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[87884,87885,87886,88578],"hostPid":87881,"petCandidatePids":[88578],"mainCandidatePids":[87884,87885,87886]},"restCadence":{"frames":[25366,25375,25391,25408,25425,25441,25458,25475,25491,25508,25525,25541,25558,25575,25591,25608,25625,25641,25658,25675,25691,25708,25724,25741,25758,25775,25792,25808,25825,25841,25858,25874,25892,25907,25925,25941,25958,25975,25991,26008,26025,26042,26058,26075,26092,26108,26124,26142,26158,26175,26191,26208,26225,26241,26258,26275,26292,26308,26325,26342,26358,26375,26392,26408,26425,26442,26458,26476,26491,26508,26525,26542,26558,26575,26592,26607,26625,26641,26658,26675,26692,26707,26725,26741,26757,26775,26791,26808,26825,26841,26858,26875,26891,26908,26925,26941,26958,26975,26991,27008,27025,27041,27058,27075,27091,27107,27125,27142,27158,27175,27191,27208,27224,27241,27258,27274,27291,27308,27325,27342,27358,27375,27391,27407,27425,27441,27458,27475,27491,27508,27525,27541,27558,27575,27592,27608,27625,27642,27658,27675,27691,27708,27725,27741,27758,27775,27791,27808,27825,27841,27858,27875,27891,27908,27925,27941,27958,27974],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53135,53140,53157,53175,53191,53208,53225,53241,53257,53275,53291,53307,53324,53340,53358,53374,53391,53408,53425,53441,53458,53475,53491,53508,53525,53541,53557,53574,53590,53607,53625,53641,53657,53674,53691,53708,53725,53741,53757,53774,53791,53808,53825,53841,53858,53874,53891,53907,53925,53941,53958,53975,53991,54008,54025,54041,54058,54075,54091,54108,54125,54142,54158,54175,54191,54208,54225,54241,54258,54275,54291,54308,54325,54341,54358,54375,54392,54408,54424,54441,54458,54474,54491,54508,54525,54541,54558,54575,54590,54608,54624,54641,54658,54675,54691,54708,54725,54741,54757,54775,54791,54808,54825,54841,54858,54875,54891,54907,54925,54941,54958,54975,54991,55008,55025,55040,55057,55074,55091,55108,55124,55141,55157,55175,55191,55208,55225,55241,55258,55275,55291,55308,55324,55340,55358,55374,55391,55408,55425,55441,55457,55475,55490,55508,55524,55541,55557,55574,55590,55607,55625,55641,55657,55675,55691,55708,55725,55741],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}}],"summary":[{"name":"off","role":"host","baseline":{"samples":[{"cpuPercent":0.29908778226409455,"endRssMiB":358.65625,"peakRssMiB":358.71875},{"cpuPercent":0.29926679634894393,"endRssMiB":360.3125,"peakRssMiB":360.40625},{"cpuPercent":0.24930195452732348,"endRssMiB":359.296875,"peakRssMiB":359.453125}],"medianCpuPercent":0.29908778226409455,"medianEndRssMiB":359.296875,"medianPeakRssMiB":359.453125},"optimized":{"samples":[{"cpuPercent":0.39886323976666505,"endRssMiB":286.515625,"peakRssMiB":306.3125},{"cpuPercent":0.29920710118186805,"endRssMiB":359.21875,"peakRssMiB":359.296875},{"cpuPercent":0.29908778226409455,"endRssMiB":360.328125,"peakRssMiB":360.421875}],"medianCpuPercent":0.29920710118186805,"medianEndRssMiB":359.21875,"medianPeakRssMiB":359.296875}},{"name":"off","role":"pet-WebContent","baseline":{"samples":[{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0}],"medianCpuPercent":0,"medianEndRssMiB":0,"medianPeakRssMiB":0},"optimized":{"samples":[{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0}],"medianCpuPercent":0,"medianEndRssMiB":0,"medianPeakRssMiB":0}},{"name":"off","role":"main-WebContent","baseline":{"samples":[{"cpuPercent":0.19939185484272964,"endRssMiB":328.390625,"peakRssMiB":328.5},{"cpuPercent":0.19951119756596336,"endRssMiB":326.84375,"peakRssMiB":326.921875},{"cpuPercent":0.1495811727163941,"endRssMiB":335.125,"peakRssMiB":335.265625}],"medianCpuPercent":0.19939185484272964,"medianEndRssMiB":328.390625,"medianPeakRssMiB":328.5},"optimized":{"samples":[{"cpuPercent":0.19943161988333252,"endRssMiB":319.328125,"peakRssMiB":319.46875},{"cpuPercent":0.24933925098489007,"endRssMiB":328.125,"peakRssMiB":328.3125},{"cpuPercent":0.14954389113204727,"endRssMiB":324.59375,"peakRssMiB":324.734375}],"medianCpuPercent":0.19943161988333252,"medianEndRssMiB":324.59375,"medianPeakRssMiB":324.734375}},{"name":"off","role":"com.apple.WebKit.GPU","baseline":{"samples":[{"cpuPercent":0,"endRssMiB":129.78125,"peakRssMiB":129.96875},{"cpuPercent":0,"endRssMiB":129.328125,"peakRssMiB":129.484375},{"cpuPercent":0,"endRssMiB":129.484375,"peakRssMiB":129.5}],"medianCpuPercent":0,"medianEndRssMiB":129.484375,"medianPeakRssMiB":129.5},"optimized":{"samples":[{"cpuPercent":0,"endRssMiB":130.078125,"peakRssMiB":130.21875},{"cpuPercent":0.04986785019697801,"endRssMiB":129.65625,"peakRssMiB":129.921875},{"cpuPercent":0,"endRssMiB":148.71875,"peakRssMiB":148.984375}],"medianCpuPercent":0,"medianEndRssMiB":130.078125,"medianPeakRssMiB":130.21875}},{"name":"off","role":"total","baseline":{"samples":[{"cpuPercent":0.4984796371068242,"endRssMiB":825.75,"peakRssMiB":826.171875},{"cpuPercent":0.4987779939149073,"endRssMiB":825.390625,"peakRssMiB":825.78125},{"cpuPercent":0.39888312724371755,"endRssMiB":832.78125,"peakRssMiB":833.15625}],"medianCpuPercent":0.4984796371068242,"medianEndRssMiB":825.75,"medianPeakRssMiB":826.171875},"optimized":{"samples":[{"cpuPercent":0.5982948596499975,"endRssMiB":744.84375,"peakRssMiB":765},{"cpuPercent":0.5984142023637361,"endRssMiB":825.953125,"peakRssMiB":826.59375},{"cpuPercent":0.49847963710682425,"endRssMiB":842.671875,"peakRssMiB":843.265625}],"medianCpuPercent":0.5982948596499975,"medianEndRssMiB":825.953125,"medianPeakRssMiB":826.59375}},{"name":"rest","role":"host","baseline":{"samples":[{"cpuPercent":2.7917642953287802,"endRssMiB":353.796875,"peakRssMiB":379.171875},{"cpuPercent":3.2402791625124627,"endRssMiB":374.875,"peakRssMiB":380.46875},{"cpuPercent":2.9938625817075,"endRssMiB":379.53125,"peakRssMiB":379.53125}],"medianCpuPercent":2.9938625817075,"medianEndRssMiB":374.875,"medianPeakRssMiB":379.53125},"optimized":{"samples":[{"cpuPercent":2.6423372220560375,"endRssMiB":301.015625,"peakRssMiB":301.015625},{"cpuPercent":2.0438683948155534,"endRssMiB":379.28125,"peakRssMiB":379.28125},{"cpuPercent":2.7420480606241897,"endRssMiB":355.21875,"peakRssMiB":380.53125}],"medianCpuPercent":2.6423372220560375,"medianEndRssMiB":355.21875,"medianPeakRssMiB":379.28125}},{"name":"rest","role":"pet-WebContent","baseline":{"samples":[{"cpuPercent":1.9442644199611145,"endRssMiB":196.296875,"peakRssMiB":196.40625},{"cpuPercent":1.3459621136590227,"endRssMiB":199.015625,"peakRssMiB":199.015625},{"cpuPercent":2.1456015168903746,"endRssMiB":196.109375,"peakRssMiB":196.140625}],"medianCpuPercent":1.9442644199611145,"medianEndRssMiB":196.296875,"medianPeakRssMiB":196.40625},"optimized":{"samples":[{"cpuPercent":1.7449396749426662,"endRssMiB":196.484375,"peakRssMiB":196.484375},{"cpuPercent":1.794616151545364,"endRssMiB":196.546875,"peakRssMiB":196.546875},{"cpuPercent":1.994216771363047,"endRssMiB":196.328125,"peakRssMiB":196.375}],"medianCpuPercent":1.794616151545364,"medianEndRssMiB":196.484375,"medianPeakRssMiB":196.484375}},{"name":"rest","role":"main-WebContent","baseline":{"samples":[{"cpuPercent":0.7976469415225085,"endRssMiB":328.40625,"peakRssMiB":328.53125},{"cpuPercent":0.19940179461615154,"endRssMiB":326.921875,"peakRssMiB":326.9375},{"cpuPercent":0.19959083878049996,"endRssMiB":335.140625,"peakRssMiB":335.234375}],"medianCpuPercent":0.19959083878049996,"medianEndRssMiB":328.40625,"medianPeakRssMiB":328.53125},"optimized":{"samples":[{"cpuPercent":0.14956625785222855,"endRssMiB":319.328125,"peakRssMiB":319.359375},{"cpuPercent":0.14955134596211367,"endRssMiB":328.171875,"peakRssMiB":328.171875},{"cpuPercent":0.6979758699770665,"endRssMiB":324.828125,"peakRssMiB":324.953125}],"medianCpuPercent":0.14956625785222855,"medianEndRssMiB":324.828125,"medianPeakRssMiB":324.953125}},{"name":"rest","role":"com.apple.WebKit.GPU","baseline":{"samples":[{"cpuPercent":0.24926466922578394,"endRssMiB":156.75,"peakRssMiB":156.765625},{"cpuPercent":0.09970089730807577,"endRssMiB":156.28125,"peakRssMiB":156.3125},{"cpuPercent":0.29938625817075,"endRssMiB":156.4375,"peakRssMiB":156.453125}],"medianCpuPercent":0.24926466922578394,"medianEndRssMiB":156.4375,"medianPeakRssMiB":156.453125},"optimized":{"samples":[{"cpuPercent":0.2991325157044571,"endRssMiB":157.015625,"peakRssMiB":157.03125},{"cpuPercent":0.24925224327018944,"endRssMiB":156.609375,"peakRssMiB":156.625},{"cpuPercent":0.2991325157044571,"endRssMiB":175.75,"peakRssMiB":175.75}],"medianCpuPercent":0.2991325157044571,"medianEndRssMiB":157.015625,"medianPeakRssMiB":157.03125}},{"name":"rest","role":"total","baseline":{"samples":[{"cpuPercent":5.782940326038187,"endRssMiB":1044.203125,"peakRssMiB":1069.8125},{"cpuPercent":4.885343968095713,"endRssMiB":1066.125,"peakRssMiB":1068.15625},{"cpuPercent":5.638441195549124,"endRssMiB":1076.15625,"peakRssMiB":1076.15625}],"medianCpuPercent":5.638441195549124,"medianEndRssMiB":1066.125,"medianPeakRssMiB":1069.8125},"optimized":{"samples":[{"cpuPercent":4.835975670555389,"endRssMiB":982.828125,"peakRssMiB":982.84375},{"cpuPercent":4.237288135593221,"endRssMiB":1069.59375,"peakRssMiB":1069.609375},{"cpuPercent":5.73337321766876,"endRssMiB":1061.1875,"peakRssMiB":1086.640625}],"medianCpuPercent":4.835975670555389,"medianEndRssMiB":1061.1875,"medianPeakRssMiB":1069.609375}},{"name":"working-bubble","role":"host","baseline":{"samples":[{"cpuPercent":3.4897053691609754,"endRssMiB":353.875,"peakRssMiB":353.875},{"cpuPercent":3.2407638231041527,"endRssMiB":355.265625,"peakRssMiB":355.328125},{"cpuPercent":3.5395583030061317,"endRssMiB":354.21875,"peakRssMiB":354.25}],"medianCpuPercent":3.4897053691609754,"medianEndRssMiB":354.21875,"medianPeakRssMiB":354.25},"optimized":{"samples":[{"cpuPercent":3.5425606226923456,"endRssMiB":277.578125,"peakRssMiB":277.578125},{"cpuPercent":2.5424996261029964,"endRssMiB":354.0625,"peakRssMiB":354.0625},{"cpuPercent":3.5397347691694088,"endRssMiB":355.203125,"peakRssMiB":355.234375}],"medianCpuPercent":3.5397347691694088,"medianEndRssMiB":354.0625,"medianPeakRssMiB":354.0625}},{"name":"working-bubble","role":"pet-WebContent","baseline":{"samples":[{"cpuPercent":2.8914701630190933,"endRssMiB":201.546875,"peakRssMiB":201.546875},{"cpuPercent":2.5926110584833224,"endRssMiB":201.21875,"peakRssMiB":201.234375},{"cpuPercent":2.8914701630190933,"endRssMiB":201.171875,"peakRssMiB":201.171875}],"medianCpuPercent":2.8914701630190933,"medianEndRssMiB":201.21875,"medianPeakRssMiB":201.234375},"optimized":{"samples":[{"cpuPercent":2.7442371020856204,"endRssMiB":201.140625,"peakRssMiB":201.140625},{"cpuPercent":2.293234956877212,"endRssMiB":201.546875,"peakRssMiB":201.671875},{"cpuPercent":2.7420480606241897,"endRssMiB":201.375,"peakRssMiB":201.375}],"medianCpuPercent":2.7420480606241897,"medianEndRssMiB":201.375,"medianPeakRssMiB":201.375}},{"name":"working-bubble","role":"main-WebContent","baseline":{"samples":[{"cpuPercent":0.14955880153547035,"endRssMiB":328.4375,"peakRssMiB":328.4375},{"cpuPercent":0.4985790497083312,"endRssMiB":326.9375,"peakRssMiB":327.046875},{"cpuPercent":0.6480881399870383,"endRssMiB":335.15625,"peakRssMiB":335.265625}],"medianCpuPercent":0.4985790497083312,"medianEndRssMiB":328.4375,"medianPeakRssMiB":328.4375},"optimized":{"samples":[{"cpuPercent":0.6486378604929648,"endRssMiB":319.421875,"peakRssMiB":319.53125},{"cpuPercent":0.14955880153547035,"endRssMiB":328.203125,"peakRssMiB":328.3125},{"cpuPercent":0.14956625785222855,"endRssMiB":324.859375,"peakRssMiB":324.859375}],"medianCpuPercent":0.14956625785222855,"medianEndRssMiB":324.859375,"medianPeakRssMiB":324.859375}},{"name":"working-bubble","role":"com.apple.WebKit.GPU","baseline":{"samples":[{"cpuPercent":0.4985293384515679,"endRssMiB":176.8125,"peakRssMiB":176.90625},{"cpuPercent":0.44872114473749813,"endRssMiB":176.40625,"peakRssMiB":176.515625},{"cpuPercent":0.4985293384515679,"endRssMiB":176.53125,"peakRssMiB":176.625}],"medianCpuPercent":0.4985293384515679,"medianEndRssMiB":176.53125,"medianPeakRssMiB":176.625},"optimized":{"samples":[{"cpuPercent":0.4989522003792037,"endRssMiB":177.21875,"peakRssMiB":177.359375},{"cpuPercent":0.39882347076125424,"endRssMiB":176.625,"peakRssMiB":176.875},{"cpuPercent":0.49855419284076175,"endRssMiB":195.875,"peakRssMiB":195.984375}],"medianCpuPercent":0.49855419284076175,"medianEndRssMiB":177.21875,"medianPeakRssMiB":177.359375}},{"name":"working-bubble","role":"total","baseline":{"samples":[{"cpuPercent":7.029263672167107,"endRssMiB":1069.6875,"peakRssMiB":1069.703125},{"cpuPercent":6.7806750760333045,"endRssMiB":1068.859375,"peakRssMiB":1069.109375},{"cpuPercent":7.577645944463831,"endRssMiB":1076.015625,"peakRssMiB":1076.140625}],"medianCpuPercent":7.029263672167107,"medianEndRssMiB":1069.6875,"medianPeakRssMiB":1069.703125},"optimized":{"samples":[{"cpuPercent":7.434387785650134,"endRssMiB":984.34375,"peakRssMiB":984.421875},{"cpuPercent":5.3841168552769325,"endRssMiB":1069.421875,"peakRssMiB":1069.640625},{"cpuPercent":6.929903280486589,"endRssMiB":1086.375,"peakRssMiB":1086.40625}],"medianCpuPercent":6.929903280486589,"medianEndRssMiB":1069.421875,"medianPeakRssMiB":1069.640625}},{"name":"hidden","role":"host","baseline":{"samples":[{"cpuPercent":0.29905796740268153,"endRssMiB":353.9375,"peakRssMiB":353.9375},{"cpuPercent":0.34895314057826293,"endRssMiB":355.234375,"peakRssMiB":355.265625},{"cpuPercent":0.29908778226409455,"endRssMiB":354.25,"peakRssMiB":354.25}],"medianCpuPercent":0.29908778226409455,"medianEndRssMiB":354.25,"medianPeakRssMiB":354.25},"optimized":{"samples":[{"cpuPercent":0.34891835310537334,"endRssMiB":277.546875,"peakRssMiB":277.609375},{"cpuPercent":0.24917771354530052,"endRssMiB":354.0625,"peakRssMiB":354.0625},{"cpuPercent":0.34890096196979514,"endRssMiB":355.15625,"peakRssMiB":355.21875}],"medianCpuPercent":0.34890096196979514,"medianEndRssMiB":354.0625,"medianPeakRssMiB":354.0625}},{"name":"hidden","role":"pet-WebContent","baseline":{"samples":[{"cpuPercent":0.09968598913422719,"endRssMiB":201.609375,"peakRssMiB":201.796875},{"cpuPercent":0.19940179461615154,"endRssMiB":202,"peakRssMiB":202.125},{"cpuPercent":0.19939185484272964,"endRssMiB":201.4375,"peakRssMiB":201.625}],"medianCpuPercent":0.19939185484272964,"medianEndRssMiB":201.609375,"medianPeakRssMiB":201.796875},"optimized":{"samples":[{"cpuPercent":0.14953643704516,"endRssMiB":201.359375,"peakRssMiB":201.546875},{"cpuPercent":0.0996710854181202,"endRssMiB":201.734375,"peakRssMiB":201.921875},{"cpuPercent":0.19937197826845438,"endRssMiB":201.703125,"peakRssMiB":201.921875}],"medianCpuPercent":0.14953643704516,"medianEndRssMiB":201.703125,"medianPeakRssMiB":201.921875}},{"name":"hidden","role":"main-WebContent","baseline":{"samples":[{"cpuPercent":0.19937197826845438,"endRssMiB":328.484375,"peakRssMiB":328.484375},{"cpuPercent":0.14955134596211367,"endRssMiB":326.96875,"peakRssMiB":326.96875},{"cpuPercent":0.14954389113204727,"endRssMiB":335.1875,"peakRssMiB":335.1875}],"medianCpuPercent":0.14955134596211367,"medianEndRssMiB":328.484375,"medianPeakRssMiB":328.484375},"optimized":{"samples":[{"cpuPercent":0.19938191606021335,"endRssMiB":319.53125,"peakRssMiB":319.53125},{"cpuPercent":0.1993421708362404,"endRssMiB":328.296875,"peakRssMiB":328.296875},{"cpuPercent":0.19937197826845438,"endRssMiB":324.96875,"peakRssMiB":324.96875}],"medianCpuPercent":0.19937197826845438,"medianEndRssMiB":324.96875,"medianPeakRssMiB":324.96875}},{"name":"hidden","role":"com.apple.WebKit.GPU","baseline":{"samples":[{"cpuPercent":0.049842994567113594,"endRssMiB":176.828125,"peakRssMiB":176.875},{"cpuPercent":0,"endRssMiB":176.328125,"peakRssMiB":176.453125},{"cpuPercent":0,"endRssMiB":176.390625,"peakRssMiB":176.53125}],"medianCpuPercent":0,"medianEndRssMiB":176.390625,"medianPeakRssMiB":176.53125},"optimized":{"samples":[{"cpuPercent":0,"endRssMiB":177.171875,"peakRssMiB":177.28125},{"cpuPercent":0.0498355427090601,"endRssMiB":176.671875,"peakRssMiB":176.71875},{"cpuPercent":0.049842994567113594,"endRssMiB":195.796875,"peakRssMiB":195.9375}],"medianCpuPercent":0.0498355427090601,"medianEndRssMiB":177.171875,"medianPeakRssMiB":177.28125}},{"name":"hidden","role":"total","baseline":{"samples":[{"cpuPercent":0.6479589293724768,"endRssMiB":1069.90625,"peakRssMiB":1070.078125},{"cpuPercent":0.6979062811565282,"endRssMiB":1069.5625,"peakRssMiB":1069.828125},{"cpuPercent":0.6480235282388715,"endRssMiB":1076.234375,"peakRssMiB":1076.546875}],"medianCpuPercent":0.6480235282388715,"medianEndRssMiB":1069.90625,"medianPeakRssMiB":1070.078125},"optimized":{"samples":[{"cpuPercent":0.6978367062107467,"endRssMiB":984.625,"peakRssMiB":984.921875},{"cpuPercent":0.5980265125087212,"endRssMiB":1069.796875,"peakRssMiB":1069.984375},{"cpuPercent":0.7974879130738175,"endRssMiB":1086.734375,"peakRssMiB":1087.078125}],"medianCpuPercent":0.6978367062107467,"medianEndRssMiB":1069.796875,"medianPeakRssMiB":1069.984375}},{"name":"closed","role":"host","baseline":{"samples":[{"cpuPercent":0.24921497283556795,"endRssMiB":353.8125,"peakRssMiB":353.875},{"cpuPercent":0.34898793498853325,"endRssMiB":355.15625,"peakRssMiB":355.15625},{"cpuPercent":0.29908778226409455,"endRssMiB":354.078125,"peakRssMiB":354.140625}],"medianCpuPercent":0.29908778226409455,"medianEndRssMiB":354.078125,"medianPeakRssMiB":354.140625},"optimized":{"samples":[{"cpuPercent":0.24926466922578394,"endRssMiB":277.375,"peakRssMiB":277.4375},{"cpuPercent":0.24917771354530052,"endRssMiB":354.078125,"peakRssMiB":354.078125},{"cpuPercent":0.24922739507526667,"endRssMiB":355,"peakRssMiB":355.015625}],"medianCpuPercent":0.24922739507526667,"medianEndRssMiB":354.078125,"medianPeakRssMiB":354.078125}},{"name":"closed","role":"pet-WebContent","baseline":{"samples":[{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0}],"medianCpuPercent":0,"medianEndRssMiB":0,"medianPeakRssMiB":0},"optimized":{"samples":[{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0},{"cpuPercent":0,"endRssMiB":0,"peakRssMiB":0}],"medianCpuPercent":0,"medianEndRssMiB":0,"medianPeakRssMiB":0}},{"name":"closed","role":"main-WebContent","baseline":{"samples":[{"cpuPercent":0.5981159348053631,"endRssMiB":328.734375,"peakRssMiB":328.734375},{"cpuPercent":0.14956625785222855,"endRssMiB":327.0625,"peakRssMiB":327.078125},{"cpuPercent":0.2492398185534121,"endRssMiB":335.359375,"peakRssMiB":335.359375}],"medianCpuPercent":0.2492398185534121,"medianEndRssMiB":328.734375,"medianPeakRssMiB":328.734375},"optimized":{"samples":[{"cpuPercent":0.09970586769031356,"endRssMiB":319.546875,"peakRssMiB":319.546875},{"cpuPercent":0.14950662812718032,"endRssMiB":328.3125,"peakRssMiB":328.3125},{"cpuPercent":0.14953643704516,"endRssMiB":325.046875,"peakRssMiB":325.046875}],"medianCpuPercent":0.14950662812718032,"medianEndRssMiB":325.046875,"medianPeakRssMiB":325.046875}},{"name":"closed","role":"com.apple.WebKit.GPU","baseline":{"samples":[{"cpuPercent":0,"endRssMiB":149.453125,"peakRssMiB":149.59375},{"cpuPercent":0,"endRssMiB":149.0625,"peakRssMiB":149.109375},{"cpuPercent":0,"endRssMiB":149.140625,"peakRssMiB":149.15625}],"medianCpuPercent":0,"medianEndRssMiB":149.140625,"medianPeakRssMiB":149.15625},"optimized":{"samples":[{"cpuPercent":0.04985293384515678,"endRssMiB":149.796875,"peakRssMiB":149.9375},{"cpuPercent":0.0498355427090601,"endRssMiB":149.390625,"peakRssMiB":149.4375},{"cpuPercent":0,"endRssMiB":168.53125,"peakRssMiB":168.546875}],"medianCpuPercent":0.0498355427090601,"medianEndRssMiB":149.796875,"medianPeakRssMiB":149.9375}},{"name":"closed","role":"total","baseline":{"samples":[{"cpuPercent":0.847330907640931,"endRssMiB":840.984375,"peakRssMiB":841.03125},{"cpuPercent":0.4985541928407618,"endRssMiB":840.234375,"peakRssMiB":840.25},{"cpuPercent":0.5483276008175066,"endRssMiB":847.46875,"peakRssMiB":847.46875}],"medianCpuPercent":0.5483276008175066,"medianEndRssMiB":840.984375,"medianPeakRssMiB":841.03125},"optimized":{"samples":[{"cpuPercent":0.39882347076125424,"endRssMiB":755.671875,"peakRssMiB":755.875},{"cpuPercent":0.4485198843815409,"endRssMiB":840.75,"peakRssMiB":840.75},{"cpuPercent":0.39876383212042665,"endRssMiB":857.609375,"peakRssMiB":857.640625}],"medianCpuPercent":0.39882347076125424,"medianEndRssMiB":840.75,"medianPeakRssMiB":840.75}}],"passed":true,"postRunValidation":{"optimizedAtlasOnly":true,"optimizedSize96x104":true,"optimizedHiddenPaused":true,"closedPetCandidatesExited":true,"cadenceAtLeastFiveFrames":true},"notes":["All CPU percentages use one logical core as 100%. Summed RSS can double-count shared pages.","Baseline pair 2 began idle sampling during pointer look; keep this confounder and show individual runs. No OS cursor control was used.","The extra validation above was also applied to retained results after collection; the pair runner now enforces these checks."],"atlasInventory":[{"pet":"hachiware","bytes":1585846,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"gugugaga","bytes":1900892,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"panda-pix","bytes":699980,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"deepseek-goldwhale","bytes":2708266,"width":1536,"height":2288,"rgbaMiB":13.40625},{"pet":"boxcat","bytes":1743076,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"openbitfun","bytes":2362668,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"jiyi","bytes":1871226,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"openbitfun-girl","bytes":2920246,"width":1536,"height":2288,"rgbaMiB":13.40625},{"pet":"ikun","bytes":1644844,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"blue-golden","bytes":1907636,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"elaina-2","bytes":2368004,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"capy","bytes":1486062,"width":1536,"height":1872,"rgbaMiB":10.96875},{"pet":"bitblob","bytes":1523708,"width":1536,"height":2288,"rgbaMiB":13.40625},{"pet":"usagi","bytes":1529510,"width":1536,"height":1872,"rgbaMiB":10.96875}],"excludedDiagnostics":[{"reason":"Protocol 1 exploratory run: main-window delayed activation contaminated resource attribution.","directory":"/openbitfun-pet-perf-HgHVLw","report":{"schemaVersion":1,"label":"baseline-1","protocol":{"version":1,"settleMs":5000,"windowMs":20000,"phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"4fddcbdc94767ae73e1191b35167156496e9857b555081eab43dc59a50d151a5","frontend":{"schemaVersion":1,"revision":"bundled-430fd6c0fc1530b6","algorithm":"sha256-path-content-v1","digest":"430fd6c0fc1530b6044d5fdcf2ba13f547b36b5114cdbba9c70f274f619ec1a5","fileCount":2737,"totalBytes":93312928},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793889464827,"load":[1.46923828125,2.1884765625,2.5927734375],"processes":[{"pid":60849,"rssMiB":358.859375,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.171875,"cpuMs":360,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.40625,"cpuMs":1460,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":14,"In use system memory":792150016,"Alloc system memory":1922383872}},{"at":1793889465892,"load":[1.46923828125,2.1884765625,2.5927734375],"processes":[{"pid":60849,"rssMiB":358.859375,"cpuMs":2009.9999999999998,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.21875,"cpuMs":370,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.453125,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":27,"Renderer Utilization %":27,"Tiler Utilization %":12,"In use system memory":750010368,"Alloc system memory":1918189568}},{"at":1793889466958,"load":[1.46923828125,2.1884765625,2.5927734375],"processes":[{"pid":60849,"rssMiB":358.859375,"cpuMs":2029.9999999999998,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":50.859375,"cpuMs":370,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.484375,"cpuMs":1500,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":32,"Renderer Utilization %":32,"Tiler Utilization %":11,"In use system memory":710950912,"Alloc system memory":1913995264}},{"at":1793889468022,"load":[1.46923828125,2.1884765625,2.5927734375],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2050,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51,"cpuMs":390,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.578125,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":26,"Renderer Utilization %":26,"Tiler Utilization %":12,"In use system memory":692600832,"Alloc system memory":1909800960}},{"at":1793889469086,"load":[1.46923828125,2.1884765625,2.5927734375],"processes":[{"pid":60849,"rssMiB":358.71875,"cpuMs":2060,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.046875,"cpuMs":400,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.578125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":22,"In use system memory":759021568,"Alloc system memory":1907703808}},{"at":1793889470149,"load":[1.431640625,2.16845703125,2.5830078125],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2070,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.046875,"cpuMs":410,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.609375,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":38,"Renderer Utilization %":38,"Tiler Utilization %":15,"In use system memory":720371712,"Alloc system memory":1905508352}},{"at":1793889471218,"load":[1.431640625,2.16845703125,2.5830078125],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2100,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.046875,"cpuMs":430,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.578125,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":35,"Renderer Utilization %":35,"Tiler Utilization %":8,"In use system memory":691814400,"Alloc system memory":1903411200}},{"at":1793889472282,"load":[1.431640625,2.16845703125,2.5830078125],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2120,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.078125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.578125,"cpuMs":1770,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":37,"Renderer Utilization %":37,"Tiler Utilization %":12,"In use system memory":724189184,"Alloc system memory":1901690880}},{"at":1793889473336,"load":[1.431640625,2.16845703125,2.5830078125],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2120,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.078125,"cpuMs":460,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.578125,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":23,"In use system memory":758726656,"Alloc system memory":1901314048}},{"at":1793889474401,"load":[1.431640625,2.16845703125,2.5830078125],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2140,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.078125,"cpuMs":470,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.59375,"cpuMs":1820,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":27,"Renderer Utilization %":27,"Tiler Utilization %":10,"In use system memory":730284032,"Alloc system memory":1899216896}},{"at":1793889475467,"load":[1.39697265625,2.14892578125,2.57373046875],"processes":[{"pid":60849,"rssMiB":358.734375,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.125,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.609375,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":33,"Renderer Utilization %":33,"Tiler Utilization %":18,"In use system memory":711180288,"Alloc system memory":1895022592}},{"at":1793889476532,"load":[1.39697265625,2.14892578125,2.57373046875],"processes":[{"pid":60849,"rssMiB":358.796875,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.125,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.59375,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":22,"In use system memory":760528896,"Alloc system memory":1895399424}},{"at":1793889477597,"load":[1.39697265625,2.14892578125,2.57373046875],"processes":[{"pid":60849,"rssMiB":358.75,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.125,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.609375,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":18,"In use system memory":750764032,"Alloc system memory":1895022592}},{"at":1793889478663,"load":[1.39697265625,2.14892578125,2.57373046875],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.1875,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.625,"cpuMs":1950,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":35,"Renderer Utilization %":35,"Tiler Utilization %":8,"In use system memory":714653696,"Alloc system memory":1895022592}},{"at":1793889479730,"load":[1.44482421875,2.14599609375,2.5703125],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2220,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.203125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.625,"cpuMs":1980,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":39,"Renderer Utilization %":39,"Tiler Utilization %":7,"In use system memory":765722624,"Alloc system memory":1922351104}},{"at":1793889480796,"load":[1.44482421875,2.14599609375,2.5703125],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2220,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.203125,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.4375,"cpuMs":2000,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":58,"Renderer Utilization %":58,"Tiler Utilization %":19,"In use system memory":753172480,"Alloc system memory":1918533632}},{"at":1793889481862,"load":[1.44482421875,2.14599609375,2.5703125],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2250,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.3125,"cpuMs":570,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.5,"cpuMs":2050,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":43,"Renderer Utilization %":43,"Tiler Utilization %":16,"In use system memory":751239168,"Alloc system memory":1913929728}},{"at":1793889482929,"load":[1.44482421875,2.14599609375,2.5703125],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2270,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.34375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.546875,"cpuMs":2100,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":37,"Renderer Utilization %":37,"Tiler Utilization %":14,"In use system memory":731136000,"Alloc system memory":1908178944}},{"at":1793889483995,"load":[1.44482421875,2.14599609375,2.5703125],"processes":[{"pid":60849,"rssMiB":358.765625,"cpuMs":2280,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.34375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.5625,"cpuMs":2120,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":31,"Renderer Utilization %":31,"Tiler Utilization %":11,"In use system memory":724566016,"Alloc system memory":1920761856}},{"at":1793889484893,"load":[1.4091796875,2.126953125,2.56103515625],"processes":[{"pid":60849,"rssMiB":358.78125,"cpuMs":2290,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":51.34375,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.5625,"cpuMs":2130,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.890625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":18,"In use system memory":753172480,"Alloc system memory":1921138688}}],"cpu":[{"pid":60849,"role":"openbitfun-desktop","cpuPercent":1.3953951958536839,"startRssMiB":358.859375,"endRssMiB":358.78125},{"pid":60851,"role":"com.apple.WebKit.GPU","cpuPercent":1.1960530250174426,"startRssMiB":51.171875,"endRssMiB":51.34375},{"pid":60852,"role":"com.apple.WebKit.WebContent","cpuPercent":3.338981361507027,"startRssMiB":327.40625,"endRssMiB":327.5625},{"pid":60853,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.890625}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4179},{"name":"openbitfun-petdex-breathe","state":"running","time":4179}],"counts":{},"domNodes":44,"heap":null,"mutations":4,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":101.48836517333984,"name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":98.31843566894533,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24290},{"name":"openbitfun-petdex-breathe","state":"running","time":24290}],"counts":{},"domNodes":44,"heap":null,"mutations":4,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":102.91747283935548,"name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":96.99925231933594,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793889490248,"load":[1.4560546875,2.12451171875,2.5576171875],"processes":[{"pid":60849,"rssMiB":379.109375,"cpuMs":2600,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":97.921875,"cpuMs":740,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.796875,"cpuMs":2350,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.796875,"cpuMs":360,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":46,"In use system memory":749699072,"Alloc system memory":1904066560}},{"at":1793889491305,"load":[1.4560546875,2.12451171875,2.5576171875],"processes":[{"pid":60849,"rssMiB":379.125,"cpuMs":2650,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":97.734375,"cpuMs":760,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.796875,"cpuMs":2370,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.828125,"cpuMs":390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":49,"In use system memory":731971584,"Alloc system memory":1901936640}},{"at":1793889492370,"load":[1.4560546875,2.12451171875,2.5576171875],"processes":[{"pid":60849,"rssMiB":379.125,"cpuMs":2700,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":97.78125,"cpuMs":790,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.8125,"cpuMs":2420,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.828125,"cpuMs":410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":49,"In use system memory":751058944,"Alloc system memory":1900249088}},{"at":1793889493433,"load":[1.4560546875,2.12451171875,2.5576171875],"processes":[{"pid":60849,"rssMiB":379.140625,"cpuMs":2750,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":117.46875,"cpuMs":820,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.84375,"cpuMs":2460,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.84375,"cpuMs":430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":49,"In use system memory":754761728,"Alloc system memory":1899888640}},{"at":1793889494497,"load":[1.4560546875,2.12451171875,2.5576171875],"processes":[{"pid":60849,"rssMiB":379.125,"cpuMs":2800,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":117.46875,"cpuMs":830,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.84375,"cpuMs":2470,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.859375,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":46,"In use system memory":712179712,"Alloc system memory":1893597184}},{"at":1793889495561,"load":[1.57958984375,2.138671875,2.56005859375],"processes":[{"pid":60849,"rssMiB":379.140625,"cpuMs":2850,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":117.53125,"cpuMs":860,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.859375,"cpuMs":2520,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.796875,"cpuMs":480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":755204096,"Alloc system memory":1893629952}},{"at":1793889496626,"load":[1.57958984375,2.138671875,2.56005859375],"processes":[{"pid":60849,"rssMiB":373.453125,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":137.25,"cpuMs":910,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.890625,"cpuMs":2590,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.78125,"cpuMs":500,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":48,"In use system memory":727826432,"Alloc system memory":1849917440}},{"at":1793889497691,"load":[1.57958984375,2.138671875,2.56005859375],"processes":[{"pid":60849,"rssMiB":373.453125,"cpuMs":2950,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":137.203125,"cpuMs":920,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.890625,"cpuMs":2600,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.78125,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":46,"In use system memory":691863552,"Alloc system memory":1849507840}},{"at":1793889498723,"load":[1.57958984375,2.138671875,2.56005859375],"processes":[{"pid":60849,"rssMiB":373.453125,"cpuMs":2990,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":137.25,"cpuMs":930,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":327.890625,"cpuMs":2620,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.828125,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":49,"In use system memory":722927616,"Alloc system memory":1876869120}},{"at":1793889499790,"load":[1.53271484375,2.11962890625,2.55078125],"processes":[{"pid":60849,"rssMiB":373.46875,"cpuMs":3040,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":157.015625,"cpuMs":980,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328,"cpuMs":2690,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.984375,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":49,"In use system memory":665976832,"Alloc system memory":1872674816}},{"at":1793889500856,"load":[1.53271484375,2.11962890625,2.55078125],"processes":[{"pid":60849,"rssMiB":373.484375,"cpuMs":3090,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":157.0625,"cpuMs":1010,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.015625,"cpuMs":2720,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.921875,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":46,"In use system memory":712245248,"Alloc system memory":1868480512}},{"at":1793889501920,"load":[1.53271484375,2.11962890625,2.55078125],"processes":[{"pid":60849,"rssMiB":373.5,"cpuMs":3130,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":157.015625,"cpuMs":1020,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.03125,"cpuMs":2740,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.9375,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":49,"In use system memory":705167360,"Alloc system memory":1864286208}},{"at":1793889502986,"load":[1.53271484375,2.11962890625,2.55078125],"processes":[{"pid":60849,"rssMiB":373.515625,"cpuMs":3190,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":157.046875,"cpuMs":1050,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.046875,"cpuMs":2790,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.96875,"cpuMs":650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":47,"In use system memory":687013888,"Alloc system memory":1862189056}},{"at":1793889504050,"load":[1.53271484375,2.11962890625,2.55078125],"processes":[{"pid":60849,"rssMiB":373.515625,"cpuMs":3240,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":176.859375,"cpuMs":1090,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.0625,"cpuMs":2840,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.984375,"cpuMs":670,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":648642560,"Alloc system memory":1860091904}},{"at":1793889505116,"load":[1.48974609375,2.1005859375,2.54150390625],"processes":[{"pid":60849,"rssMiB":373.515625,"cpuMs":3280,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":176.8125,"cpuMs":1100,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.0625,"cpuMs":2860,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":194.984375,"cpuMs":690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":47,"In use system memory":757235712,"Alloc system memory":1903181824}},{"at":1793889506180,"load":[1.48974609375,2.1005859375,2.54150390625],"processes":[{"pid":60849,"rssMiB":373.515625,"cpuMs":3330,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":176.875,"cpuMs":1130,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.625,"cpuMs":2920,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":195.015625,"cpuMs":710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":50,"In use system memory":750682112,"Alloc system memory":1901084672}},{"at":1793889507245,"load":[1.48974609375,2.1005859375,2.54150390625],"processes":[{"pid":60849,"rssMiB":353.828125,"cpuMs":3380,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":196.875,"cpuMs":1170,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.15625,"cpuMs":2970,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":195.140625,"cpuMs":750,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":46,"In use system memory":732889088,"Alloc system memory":1901346816}},{"at":1793889508308,"load":[1.48974609375,2.1005859375,2.54150390625],"processes":[{"pid":60849,"rssMiB":353.84375,"cpuMs":3430,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":196.890625,"cpuMs":1190,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.1875,"cpuMs":3000,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":195.15625,"cpuMs":780,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":49,"In use system memory":754466816,"Alloc system memory":1899626496}},{"at":1793889509367,"load":[1.48974609375,2.1005859375,2.54150390625],"processes":[{"pid":60849,"rssMiB":353.859375,"cpuMs":3470,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":196.84375,"cpuMs":1200,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.15625,"cpuMs":3010,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":195.15625,"cpuMs":800,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":46,"In use system memory":759300096,"Alloc system memory":1895071744}},{"at":1793889510306,"load":[1.6904296875,2.1318359375,2.5498046875],"processes":[{"pid":60849,"rssMiB":353.859375,"cpuMs":3520,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":216.59375,"cpuMs":1240,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.203125,"cpuMs":3060,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":195.15625,"cpuMs":820,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":49,"In use system memory":750731264,"Alloc system memory":1895104512}}],"cpu":[{"pid":60849,"role":"openbitfun-desktop","cpuPercent":4.586698574135008,"startRssMiB":379.109375,"endRssMiB":353.859375},{"pid":60851,"role":"com.apple.WebKit.GPU","cpuPercent":2.492770964203809,"startRssMiB":97.921875,"endRssMiB":216.59375},{"pid":60852,"role":"com.apple.WebKit.WebContent","cpuPercent":3.5397347691694088,"startRssMiB":327.796875,"endRssMiB":328.203125},{"pid":60853,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.9375},{"pid":61555,"role":"com.apple.WebKit.WebContent","cpuPercent":2.293349287067504,"startRssMiB":194.796875,"endRssMiB":195.15625}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":5006},{"name":"openbitfun-petdex-walk","state":"running","time":3792}],"counts":{},"domNodes":54,"heap":null,"mutations":11,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25135},{"name":"openbitfun-petdex-walk","state":"running","time":23921}],"counts":{},"domNodes":54,"heap":null,"mutations":11,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793889517994,"load":[1.5546875,2.09619140625,2.53466796875],"processes":[{"pid":60849,"rssMiB":353.953125,"cpuMs":4000,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":276.28125,"cpuMs":1460,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.421875,"cpuMs":3320,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.5625,"cpuMs":1240,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":47,"In use system memory":706052096,"Alloc system memory":1865629696}},{"at":1793889519055,"load":[1.5546875,2.09619140625,2.53466796875],"processes":[{"pid":60849,"rssMiB":353.90625,"cpuMs":4059.9999999999995,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":276.375,"cpuMs":1470,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.421875,"cpuMs":3330,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.578125,"cpuMs":1300,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":48,"In use system memory":687439872,"Alloc system memory":1863532544}},{"at":1793889520120,"load":[1.67041015625,2.11083984375,2.537109375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4110,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":276.421875,"cpuMs":1500,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.484375,"cpuMs":3380,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.59375,"cpuMs":1330,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":692076544,"Alloc system memory":1906622464}},{"at":1793889521187,"load":[1.67041015625,2.11083984375,2.537109375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4180,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":296.140625,"cpuMs":1550,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.640625,"cpuMs":3450,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.59375,"cpuMs":1370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":45,"In use system memory":762806272,"Alloc system memory":1904525312}},{"at":1793889522252,"load":[1.67041015625,2.11083984375,2.537109375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":296.15625,"cpuMs":1570,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.671875,"cpuMs":3470,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.609375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":753319936,"Alloc system memory":1902428160}},{"at":1793889523318,"load":[1.67041015625,2.11083984375,2.537109375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4280,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":296.109375,"cpuMs":1580,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.671875,"cpuMs":3480,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.609375,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":49,"In use system memory":732692480,"Alloc system memory":1902428160}},{"at":1793889524382,"load":[1.67041015625,2.11083984375,2.537109375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4340,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":315.890625,"cpuMs":1630,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.6875,"cpuMs":3540,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.609375,"cpuMs":1470,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":47,"In use system memory":757792768,"Alloc system memory":1900707840}},{"at":1793889525444,"load":[1.69677734375,2.10888671875,2.53369140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4400,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":315.890625,"cpuMs":1660,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.6875,"cpuMs":3570,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.65625,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":45,"In use system memory":760135680,"Alloc system memory":1896103936}},{"at":1793889526511,"load":[1.69677734375,2.10888671875,2.53369140625],"processes":[{"pid":60849,"rssMiB":353.90625,"cpuMs":4450,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":315.890625,"cpuMs":1670,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":328.71875,"cpuMs":3590,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.65625,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":49,"In use system memory":735641600,"Alloc system memory":1896103936}},{"at":1793889527576,"load":[1.69677734375,2.10888671875,2.53369140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4520,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":315.890625,"cpuMs":1700,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.171875,"cpuMs":3710,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.65625,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":755793920,"Alloc system memory":1896136704}},{"at":1793889528641,"load":[1.69677734375,2.10888671875,2.53369140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4570,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":335.71875,"cpuMs":1740,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.171875,"cpuMs":3750,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.671875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":54,"Renderer Utilization %":54,"Tiler Utilization %":46,"In use system memory":733069312,"Alloc system memory":1851293696}},{"at":1793889529705,"load":[1.640625,2.09033203125,2.5244140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4630,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":335.671875,"cpuMs":1750,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.171875,"cpuMs":3770,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.5625,"cpuMs":1650,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":47,"In use system memory":712835072,"Alloc system memory":1851637760}},{"at":1793889530770,"load":[1.640625,2.09033203125,2.5244140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4680,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":335.71875,"cpuMs":1780,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.171875,"cpuMs":3810,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.5625,"cpuMs":1680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":47,"In use system memory":699760640,"Alloc system memory":1851670528}},{"at":1793889531834,"load":[1.640625,2.09033203125,2.5244140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4750,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":355.484375,"cpuMs":1830,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.1875,"cpuMs":3880,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.578125,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":50,"In use system memory":651640832,"Alloc system memory":1851670528}},{"at":1793889532897,"load":[1.640625,2.09033203125,2.5244140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4800,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":355.4375,"cpuMs":1850,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.1875,"cpuMs":3900,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.59375,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":46,"In use system memory":717242368,"Alloc system memory":1851670528}},{"at":1793889533962,"load":[1.640625,2.09033203125,2.5244140625],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4840,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":355.4375,"cpuMs":1860,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.1875,"cpuMs":3920,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.59375,"cpuMs":1780,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":703447040,"Alloc system memory":1851670528}},{"at":1793889534997,"load":[1.5087890625,2.05517578125,2.50927734375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":4900,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":375.1875,"cpuMs":1900,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.21875,"cpuMs":3970,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.609375,"cpuMs":1810,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":48,"In use system memory":723550208,"Alloc system memory":1877934080}},{"at":1793889536062,"load":[1.5087890625,2.05517578125,2.50927734375],"processes":[{"pid":60849,"rssMiB":353.90625,"cpuMs":4960,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":375.1875,"cpuMs":1930,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.21875,"cpuMs":4010,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.625,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":46,"In use system memory":686424064,"Alloc system memory":1873707008}},{"at":1793889537127,"load":[1.5087890625,2.05517578125,2.50927734375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":5010,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":375.234375,"cpuMs":1940,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.0625,"cpuMs":4030.0000000000005,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.625,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":46,"In use system memory":757907456,"Alloc system memory":1915142144}},{"at":1793889538055,"load":[1.5087890625,2.05517578125,2.50927734375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":5050,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":375.203125,"cpuMs":1970,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.0625,"cpuMs":4070.0000000000005,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.671875,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":46,"In use system memory":725942272,"Alloc system memory":1865629696}}],"cpu":[{"pid":60849,"role":"openbitfun-desktop","cpuPercent":5.234036189621654,"startRssMiB":353.953125,"endRssMiB":353.921875},{"pid":60851,"role":"com.apple.WebKit.GPU","cpuPercent":2.5422461492448036,"startRssMiB":276.28125,"endRssMiB":375.203125},{"pid":60852,"role":"com.apple.WebKit.WebContent","cpuPercent":3.738597278301184,"startRssMiB":328.421875,"endRssMiB":329.0625},{"pid":60853,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.9375,"endRssMiB":8.9375},{"pid":61555,"role":"com.apple.WebKit.WebContent","cpuPercent":3.2899656049050394,"startRssMiB":199.5625,"endRssMiB":199.671875}]},{"name":"hidden","before":{"animations":[],"counts":{},"domNodes":44,"heap":null,"mutations":18,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"counts":{},"domNodes":44,"heap":null,"mutations":18,"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793889545842,"load":[1.3564453125,2.00390625,2.4853515625],"processes":[{"pid":60849,"rssMiB":354.0625,"cpuMs":5410,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":67.21875,"cpuMs":2150,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.28125,"cpuMs":4310,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":200.0625,"cpuMs":2130,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":44,"In use system memory":844759040,"Alloc system memory":1927790592}},{"at":1793889546888,"load":[1.3564453125,2.00390625,2.4853515625],"processes":[{"pid":60849,"rssMiB":354.0625,"cpuMs":5420,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":67.21875,"cpuMs":2160,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.28125,"cpuMs":4320,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":200.015625,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":57,"Renderer Utilization %":57,"Tiler Utilization %":46,"In use system memory":743817216,"Alloc system memory":1923760128}},{"at":1793889547955,"load":[1.3564453125,2.00390625,2.4853515625],"processes":[{"pid":60849,"rssMiB":354.0625,"cpuMs":5430,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":67.109375,"cpuMs":2160,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4340,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":200.015625,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":42,"In use system memory":751943680,"Alloc system memory":1918304256}},{"at":1793889549016,"load":[1.3564453125,2.00390625,2.4853515625],"processes":[{"pid":60849,"rssMiB":354.015625,"cpuMs":5460,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":86.609375,"cpuMs":2200,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4390,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":200.015625,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":37,"In use system memory":700760064,"Alloc system memory":1896742912}},{"at":1793889550078,"load":[1.24755859375,1.97021484375,2.470703125],"processes":[{"pid":60849,"rssMiB":354,"cpuMs":5470,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":86.609375,"cpuMs":2220,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4410,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":200.015625,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":40,"In use system memory":766607360,"Alloc system memory":1921122304}},{"at":1793889551133,"load":[1.24755859375,1.97021484375,2.470703125],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5480,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":86.609375,"cpuMs":2230,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4420,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":58,"Renderer Utilization %":58,"Tiler Utilization %":47,"In use system memory":794820608,"Alloc system memory":1932984320}},{"at":1793889552176,"load":[1.24755859375,1.97021484375,2.470703125],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5510,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":86.609375,"cpuMs":2260,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4470,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2140,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":42,"Renderer Utilization %":42,"Tiler Utilization %":34,"In use system memory":745455616,"Alloc system memory":1915944960}},{"at":1793889553240,"load":[1.24755859375,1.97021484375,2.470703125],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5530,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":106.28125,"cpuMs":2290,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4520,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":40,"Renderer Utilization %":40,"Tiler Utilization %":32,"In use system memory":716668928,"Alloc system memory":1909653504}},{"at":1793889554303,"load":[1.24755859375,1.97021484375,2.470703125],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5540,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":106.28125,"cpuMs":2300,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4530,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":40,"In use system memory":835780608,"Alloc system memory":1929773056}},{"at":1793889555344,"load":[1.3076171875,1.970703125,2.4677734375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5560,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":106.28125,"cpuMs":2320,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4570,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":60,"Renderer Utilization %":60,"Tiler Utilization %":48,"In use system memory":790298624,"Alloc system memory":1929969664}},{"at":1793889556406,"load":[1.3076171875,1.970703125,2.4677734375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5590,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":125.96875,"cpuMs":2360,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.3125,"cpuMs":4620,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":47,"Renderer Utilization %":47,"Tiler Utilization %":38,"In use system memory":716668928,"Alloc system memory":1915944960}},{"at":1793889557471,"load":[1.3076171875,1.970703125,2.4677734375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5600,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":125.953125,"cpuMs":2370,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4640,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":46,"Renderer Utilization %":46,"Tiler Utilization %":37,"In use system memory":745455616,"Alloc system memory":1909653504}},{"at":1793889558534,"load":[1.3076171875,1.970703125,2.4677734375],"processes":[{"pid":60849,"rssMiB":353.921875,"cpuMs":5610,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":125.953125,"cpuMs":2380,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4650,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":39,"In use system memory":838205440,"Alloc system memory":1929773056}},{"at":1793889559597,"load":[1.3076171875,1.970703125,2.4677734375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5630,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":145.625,"cpuMs":2420,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":329.296875,"cpuMs":4690,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":56,"Renderer Utilization %":56,"Tiler Utilization %":44,"In use system memory":787726336,"Alloc system memory":1925775360}},{"at":1793889560644,"load":[1.36279296875,1.970703125,2.46484375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5650,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":145.640625,"cpuMs":2430,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.625,"cpuMs":4750,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":44,"Renderer Utilization %":44,"Tiler Utilization %":36,"In use system memory":700235776,"Alloc system memory":1864433664}},{"at":1793889561708,"load":[1.36279296875,1.970703125,2.46484375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5660,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":145.640625,"cpuMs":2440,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.125,"cpuMs":4770,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":46,"Renderer Utilization %":46,"Tiler Utilization %":38,"In use system memory":671449088,"Alloc system memory":1862336512}},{"at":1793889562774,"load":[1.36279296875,1.970703125,2.46484375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5690,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":145.640625,"cpuMs":2470,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.125,"cpuMs":4800,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":62,"Renderer Utilization %":62,"Tiler Utilization %":47,"In use system memory":797032448,"Alloc system memory":1884553216}},{"at":1793889563841,"load":[1.36279296875,1.970703125,2.46484375],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5710,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":165.3125,"cpuMs":2500,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.125,"cpuMs":4850,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":41,"In use system memory":747339776,"Alloc system memory":1880555520}},{"at":1793889564905,"load":[1.41357421875,1.970703125,2.4619140625],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5720,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":165.3125,"cpuMs":2510,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.125,"cpuMs":4860,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":44,"Renderer Utilization %":44,"Tiler Utilization %":36,"In use system memory":671449088,"Alloc system memory":1864433664}},{"at":1793889565888,"load":[1.41357421875,1.970703125,2.4619140625],"processes":[{"pid":60849,"rssMiB":353.9375,"cpuMs":5740,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":165.3125,"cpuMs":2530,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.125,"cpuMs":4900,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":61555,"rssMiB":199.84375,"cpuMs":2150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":41,"In use system memory":700235776,"Alloc system memory":1862336512}}],"cpu":[{"pid":60849,"role":"openbitfun-desktop","cpuPercent":1.646213708470518,"startRssMiB":354.0625,"endRssMiB":353.9375},{"pid":60851,"role":"com.apple.WebKit.GPU","cpuPercent":1.8956400279357477,"startRssMiB":67.21875,"endRssMiB":165.3125},{"pid":60852,"role":"com.apple.WebKit.WebContent","cpuPercent":2.9432305696897134,"startRssMiB":329.28125,"endRssMiB":330.125},{"pid":60853,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.96875},{"pid":61555,"role":"com.apple.WebKit.WebContent","cpuPercent":0.09977052778609198,"startRssMiB":200.0625,"endRssMiB":199.84375}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793889570959,"load":[1.38037109375,1.9541015625,2.453125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5840,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":190.8125,"cpuMs":2650,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.703125,"cpuMs":5100,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.953125,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":42,"In use system memory":795230208,"Alloc system memory":1882898432}},{"at":1793889572022,"load":[1.38037109375,1.9541015625,2.453125],"processes":[{"pid":60849,"rssMiB":353.78125,"cpuMs":5860,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":190.8125,"cpuMs":2660,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.71875,"cpuMs":5120,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":42,"Renderer Utilization %":42,"Tiler Utilization %":35,"In use system memory":746995712,"Alloc system memory":1869168640}},{"at":1793889573086,"load":[1.38037109375,1.9541015625,2.453125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5880,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":190.8125,"cpuMs":2690,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.71875,"cpuMs":5160,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":42,"Renderer Utilization %":42,"Tiler Utilization %":35,"In use system memory":716668928,"Alloc system memory":1908097024}},{"at":1793889574148,"load":[1.38037109375,1.9541015625,2.453125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5910,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":210.484375,"cpuMs":2730,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.71875,"cpuMs":5210,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":48,"Renderer Utilization %":48,"Tiler Utilization %":38,"In use system memory":806977536,"Alloc system memory":1928200192}},{"at":1793889575211,"load":[1.4296875,1.95458984375,2.4501953125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5920,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":210.484375,"cpuMs":2740,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.71875,"cpuMs":5230,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":57,"Renderer Utilization %":57,"Tiler Utilization %":46,"In use system memory":790216704,"Alloc system memory":1928413184}},{"at":1793889576276,"load":[1.4296875,1.95458984375,2.4501953125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5940,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":210.484375,"cpuMs":2750,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.859375,"cpuMs":5320,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":38,"In use system memory":745455616,"Alloc system memory":1914388480}},{"at":1793889577341,"load":[1.4296875,1.95458984375,2.4501953125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5960,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":230.15625,"cpuMs":2790,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.859375,"cpuMs":5370,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.859375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":47,"Renderer Utilization %":47,"Tiler Utilization %":38,"In use system memory":745455616,"Alloc system memory":1908097024}},{"at":1793889578400,"load":[1.4296875,1.95458984375,2.4501953125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5980,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":230.15625,"cpuMs":2810,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.921875,"cpuMs":5400,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":44,"In use system memory":840384512,"Alloc system memory":1928314880}},{"at":1793889579463,"load":[1.4296875,1.95458984375,2.4501953125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":5990,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":230.15625,"cpuMs":2810,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":330.921875,"cpuMs":5410,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":50,"Renderer Utilization %":50,"Tiler Utilization %":40,"In use system memory":787693568,"Alloc system memory":1928511488}},{"at":1793889580528,"load":[1.39501953125,1.9384765625,2.44140625],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6010,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":249.8125,"cpuMs":2850,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":334.921875,"cpuMs":5510,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":40,"In use system memory":716668928,"Alloc system memory":1914388480}},{"at":1793889581587,"load":[1.39501953125,1.9384765625,2.44140625],"processes":[{"pid":60849,"rssMiB":353.78125,"cpuMs":6030,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":249.828125,"cpuMs":2870,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.921875,"cpuMs":5540,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":49,"Renderer Utilization %":49,"Tiler Utilization %":39,"In use system memory":716668928,"Alloc system memory":1905999872}},{"at":1793889582652,"load":[1.39501953125,1.9384765625,2.44140625],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6040,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":249.828125,"cpuMs":2880,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.921875,"cpuMs":5560,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":56,"Renderer Utilization %":56,"Tiler Utilization %":45,"In use system memory":795426816,"Alloc system memory":1883095040}},{"at":1793889583716,"load":[1.39501953125,1.9384765625,2.44140625],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6070,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":249.828125,"cpuMs":2910,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.921875,"cpuMs":5610,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":51,"Renderer Utilization %":51,"Tiler Utilization %":40,"In use system memory":744816640,"Alloc system memory":1879097344}},{"at":1793889584777,"load":[1.39501953125,1.9384765625,2.44140625],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6080,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":269.515625,"cpuMs":2940,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.921875,"cpuMs":5640,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":45,"In use system memory":778305536,"Alloc system memory":1892761600}},{"at":1793889585844,"load":[1.283203125,1.90625,2.4267578125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6090,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":269.515625,"cpuMs":2940,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.796875,"cpuMs":5650,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":44,"Renderer Utilization %":44,"Tiler Utilization %":36,"In use system memory":672743424,"Alloc system memory":1888862208}},{"at":1793889586907,"load":[1.283203125,1.90625,2.4267578125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6110,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":269.515625,"cpuMs":2960,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":333.875,"cpuMs":5690,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":55,"Renderer Utilization %":55,"Tiler Utilization %":43,"In use system memory":747339776,"Alloc system memory":1884667904}},{"at":1793889587969,"load":[1.283203125,1.90625,2.4267578125],"processes":[{"pid":60849,"rssMiB":353.796875,"cpuMs":6140,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":289.1875,"cpuMs":3000,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":345.71875,"cpuMs":5810,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.84375,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":47,"Renderer Utilization %":47,"Tiler Utilization %":38,"In use system memory":753172480,"Alloc system memory":1880440832}},{"at":1793889589009,"load":[1.283203125,1.90625,2.4267578125],"processes":[{"pid":60849,"rssMiB":353.90625,"cpuMs":6160,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":53.265625,"cpuMs":3020,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":344.734375,"cpuMs":5820,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.875,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":48,"Renderer Utilization %":48,"Tiler Utilization %":25,"In use system memory":848412672,"Alloc system memory":1947926528}},{"at":1793889590072,"load":[1.34033203125,1.90771484375,2.423828125],"processes":[{"pid":60849,"rssMiB":353.890625,"cpuMs":6170,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":53.46875,"cpuMs":3020,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":344.734375,"cpuMs":5830,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.875,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":33,"Renderer Utilization %":33,"Tiler Utilization %":9,"In use system memory":818216960,"Alloc system memory":1942454272}},{"at":1793889591022,"load":[1.34033203125,1.90771484375,2.423828125],"processes":[{"pid":60849,"rssMiB":353.90625,"cpuMs":6200,"role":"openbitfun-desktop"},{"pid":60851,"rssMiB":53.578125,"cpuMs":3040,"role":"com.apple.WebKit.GPU"},{"pid":60852,"rssMiB":344.734375,"cpuMs":5870,"role":"com.apple.WebKit.WebContent"},{"pid":60853,"rssMiB":8.875,"cpuMs":50,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":60,"Renderer Utilization %":60,"Tiler Utilization %":21,"In use system memory":845791232,"Alloc system memory":1943322624}}],"cpu":[{"pid":60849,"role":"openbitfun-desktop","cpuPercent":1.7943478044160892,"startRssMiB":353.796875,"endRssMiB":353.90625},{"pid":60851,"role":"com.apple.WebKit.GPU","cpuPercent":1.94387678811743,"startRssMiB":190.8125,"endRssMiB":53.578125},{"pid":60852,"role":"com.apple.WebKit.WebContent","cpuPercent":3.8379105816677463,"startRssMiB":330.703125,"endRssMiB":344.734375},{"pid":60853,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.953125,"endRssMiB":8.875}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[60851,60852,60853,61555],"hostPid":60849},"restCadence":{"frames":[25352,25360,25377,25394,25411,25428,25445,25460,25477,25493,25511,25525,25544,25560,25577,25592,25610,25627,25644,25660,25676,25693,25710,25727,25744,25761,25775,25793,25810,25827,25844,25860,25877,25894,25910,25927,25944,25961,25977,25994,26011,26028,26042,26059,26075,26094,26110,26127,26142,26159,26177,26194,26211,26228,26245,26260,26278,26294,26311,26326,26344,26360,26377,26392,26409,26427,26442,26461,26478,26494,26508,26525,26544,26560,26577,26592,26610,26625,26644,26659,26677,26694,26711,26725,26744,26758,26777,26794,26810,26827,26845,26861,26878,26895,26912,26925,26943,26960,26978,26994,27010,27025,27044,27061,27078,27092,27110,27127,27144,27160,27177,27194,27209,27227,27242,27260,27277,27294,27310,27325,27342,27360,27375,27394,27411,27425,27443,27460,27476,27493,27510,27527,27544,27561,27577,27594,27612,27626,27644,27660,27677,27695,27710,27726,27743,27761,27778,27795,27812,27828,27846,27859,27877,27892,27910,27925,27944,27959],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53116,53125,53143,53160,53177,53194,53211,53228,53243,53260,53277,53294,53311,53326,53342,53358,53377,53391,53410,53427,53444,53459,53476,53493,53510,53527,53543,53560,53577,53593,53610,53627,53644,53659,53676,53691,53708,53727,53743,53760,53777,53794,53811,53827,53841,53859,53877,53894,53911,53927,53944,53961,53978,53995,54010,54027,54043,54061,54078,54095,54110,54126,54143,54160,54177,54191,54210,54227,54243,54258,54276,54291,54310,54327,54342,54359,54378,54391,54408,54427,54443,54460,54476,54493,54509,54526,54543,54560,54577,54594,54611,54627,54641,54658,54677,54694,54710,54727,54744,54760,54775,54793,54810,54827,54843,54858,54877,54893,54910,54927,54944,54960,54977,54993,55010,55027,55044,55060,55077,55093,55111,55126,55143,55161,55178,55192,55210,55227,55245,55260,55275,55291,55308,55327,55344,55358,55376,55393,55410,55427,55444,55461,55479,55494,55510,55527,55543,55560,55577,55592,55610,55627,55644,55661,55678,55695,55712,55727],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"reason":"Protocol 2 pilot baseline; not part of the final six protocol-3 runs.","directory":"/openbitfun-pet-perf-qgmQj4","report":{"schemaVersion":1,"label":"baseline-1","protocol":{"version":2,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"d52b4e5fb2789eea510b9431ad92326161206dad85c2a8597812dd244542fd91","frontend":{"schemaVersion":1,"revision":"bundled-430fd6c0fc1530b6","algorithm":"sha256-path-content-v1","digest":"430fd6c0fc1530b6044d5fdcf2ba13f547b36b5114cdbba9c70f274f619ec1a5","fileCount":2737,"totalBytes":93312928},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890048935,"load":[1.77099609375,2.0361328125,2.2783203125],"processes":[{"pid":65847,"rssMiB":358.171875,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.8125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.109375,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":52,"Renderer Utilization %":52,"Tiler Utilization %":14,"In use system memory":155631616,"Alloc system memory":1744011264}},{"at":1793890049996,"load":[1.77099609375,2.0361328125,2.2783203125],"processes":[{"pid":65847,"rssMiB":358.09375,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.015625,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":147144704,"Alloc system memory":1708883968}},{"at":1793890051057,"load":[1.708984375,2.0185546875,2.2705078125],"processes":[{"pid":65847,"rssMiB":358.0625,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.015625,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":482295808,"Alloc system memory":1746042880}},{"at":1793890052121,"load":[1.708984375,2.0185546875,2.2705078125],"processes":[{"pid":65847,"rssMiB":358.0625,"cpuMs":2310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.015625,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":422051840,"Alloc system memory":1734705152}},{"at":1793890053186,"load":[1.708984375,2.0185546875,2.2705078125],"processes":[{"pid":65847,"rssMiB":358.0625,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.015625,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":147144704,"Alloc system memory":1700495360}},{"at":1793890054232,"load":[1.708984375,2.0185546875,2.2705078125],"processes":[{"pid":65847,"rssMiB":358.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":142950400,"Alloc system memory":1676378112}},{"at":1793890055284,"load":[1.708984375,2.0185546875,2.2705078125],"processes":[{"pid":65847,"rssMiB":358.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":482295808,"Alloc system memory":1730314240}},{"at":1793890056349,"load":[1.73193359375,2.01806640625,2.2685546875],"processes":[{"pid":65847,"rssMiB":358.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.546875,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":422051840,"Alloc system memory":1722122240}},{"at":1793890057416,"load":[1.73193359375,2.01806640625,2.2685546875],"processes":[{"pid":65847,"rssMiB":358.296875,"cpuMs":2320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.890625,"cpuMs":1530,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":167116800,"Alloc system memory":1694334976}},{"at":1793890058476,"load":[1.73193359375,2.01806640625,2.2685546875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2330,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.890625,"cpuMs":1540,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":438026240,"Alloc system memory":1723432960}},{"at":1793890059543,"load":[1.73193359375,2.01806640625,2.2685546875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.96875,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.90625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":527892480,"Alloc system memory":1725792256}},{"at":1793890060609,"load":[1.73193359375,2.01806640625,2.2685546875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.96875,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343769088,"Alloc system memory":1717403648}},{"at":1793890061662,"load":[1.6728515625,2.0009765625,2.2607421875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.96875,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":162791424,"Alloc system memory":1684275200}},{"at":1793890062722,"load":[1.6728515625,2.0009765625,2.2607421875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2340,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.96875,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":6,"Renderer Utilization %":6,"Tiler Utilization %":3,"In use system memory":482557952,"Alloc system memory":1725595648}},{"at":1793890063788,"load":[1.6728515625,2.0009765625,2.2607421875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":332.96875,"cpuMs":1550,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":423526400,"Alloc system memory":1725792256}},{"at":1793890064850,"load":[1.6728515625,2.0009765625,2.2607421875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.265625,"cpuMs":1660,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":4,"In use system memory":489095168,"Alloc system memory":1724432384}},{"at":1793890065897,"load":[1.6728515625,2.0009765625,2.2607421875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.265625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":5,"In use system memory":471695360,"Alloc system memory":1723793408}},{"at":1793890066946,"load":[1.61865234375,1.98388671875,2.2529296875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.265625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":457048064,"Alloc system memory":1720729600}},{"at":1793890067980,"load":[1.61865234375,1.98388671875,2.2529296875],"processes":[{"pid":65847,"rssMiB":358.3125,"cpuMs":2350,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.265625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":475643904,"Alloc system memory":1715863552}},{"at":1793890068996,"load":[1.61865234375,1.98388671875,2.2529296875],"processes":[{"pid":65847,"rssMiB":358.296875,"cpuMs":2360,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":129.53125,"cpuMs":450,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.265625,"cpuMs":1670,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":13,"Renderer Utilization %":13,"Tiler Utilization %":7,"In use system memory":530235392,"Alloc system memory":1732722688}}],"cpu":[{"pid":65847,"role":"openbitfun-desktop","cpuPercent":0.2492398185534121,"startRssMiB":358.171875,"endRssMiB":358.296875},{"pid":65849,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.8125,"endRssMiB":129.53125},{"pid":65850,"role":"com.apple.WebKit.WebContent","cpuPercent":0.7477194556602362,"startRssMiB":333.109375,"endRssMiB":333.265625},{"pid":65851,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.015625,"endRssMiB":8.921875}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":4192},{"name":"openbitfun-petdex-breathe","state":"running","time":4192}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":101.50482940673828,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":98.30323791503906,"x":"57.142857%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"running","time":24315},{"name":"openbitfun-petdex-breathe","state":"running","time":24315}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":102.95829010009766,"inlineStyle":"image-rendering: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk, openbitfun-petdex-breathe","state":"running, running","width":96.96157836914062,"x":"0%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793890074334,"load":[1.56884765625,1.96728515625,2.2451171875],"processes":[{"pid":65847,"rssMiB":378.359375,"cpuMs":2550,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.09375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.71875,"cpuMs":350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":236404736,"Alloc system memory":1750319104}},{"at":1793890075393,"load":[1.56884765625,1.96728515625,2.2451171875],"processes":[{"pid":65847,"rssMiB":378.3125,"cpuMs":2580,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.734375,"cpuMs":370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":339181568,"Alloc system memory":1724940288}},{"at":1793890076457,"load":[1.76318359375,2.0009765625,2.25537109375],"processes":[{"pid":65847,"rssMiB":378.3125,"cpuMs":2610,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.75,"cpuMs":390,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":338509824,"Alloc system memory":1720008704}},{"at":1793890077523,"load":[1.76318359375,2.0009765625,2.25537109375],"processes":[{"pid":65847,"rssMiB":378.328125,"cpuMs":2640,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1690,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.78125,"cpuMs":410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1711620096}},{"at":1793890078588,"load":[1.76318359375,2.0009765625,2.25537109375],"processes":[{"pid":65847,"rssMiB":378.328125,"cpuMs":2670,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.8125,"cpuMs":420,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1704280064}},{"at":1793890079652,"load":[1.76318359375,2.0009765625,2.25537109375],"processes":[{"pid":65847,"rssMiB":378.328125,"cpuMs":2700,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.71875,"cpuMs":440,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1697464320}},{"at":1793890080718,"load":[1.76318359375,2.0009765625,2.25537109375],"processes":[{"pid":65847,"rssMiB":378.34375,"cpuMs":2720,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":490,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.75,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":255459328,"Alloc system memory":1679130624}},{"at":1793890081784,"load":[1.78173828125,2.00048828125,2.25341796875],"processes":[{"pid":65847,"rssMiB":378.34375,"cpuMs":2750,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.75,"cpuMs":480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1672314880}},{"at":1793890082850,"load":[1.78173828125,2.00048828125,2.25341796875],"processes":[{"pid":65847,"rssMiB":378.359375,"cpuMs":2780,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.875,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1670217728}},{"at":1793890083913,"load":[1.78173828125,2.00048828125,2.25341796875],"processes":[{"pid":65847,"rssMiB":378.359375,"cpuMs":2810,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.90625,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1668120576}},{"at":1793890084977,"load":[1.78173828125,2.00048828125,2.25341796875],"processes":[{"pid":65847,"rssMiB":378.359375,"cpuMs":2840,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":500,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.90625,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1668120576}},{"at":1793890086042,"load":[1.78173828125,2.00048828125,2.25341796875],"processes":[{"pid":65847,"rssMiB":378.375,"cpuMs":2860,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.921875,"cpuMs":590,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1666023424}},{"at":1793890087105,"load":[1.798828125,2,2.25146484375],"processes":[{"pid":65847,"rssMiB":378.375,"cpuMs":2890,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.578125,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.9375,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661829120}},{"at":1793890088170,"load":[1.798828125,2,2.25146484375],"processes":[{"pid":65847,"rssMiB":378.390625,"cpuMs":2920,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.578125,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.9375,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661714432}},{"at":1793890089235,"load":[1.798828125,2,2.25146484375],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":2950,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.578125,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.9375,"cpuMs":640,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661714432}},{"at":1793890090301,"load":[1.798828125,2,2.25146484375],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":2980,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.9375,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661698048}},{"at":1793890091367,"load":[1.814453125,2,2.24951171875],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":3010,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.9375,"cpuMs":680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1661698048}},{"at":1793890092432,"load":[1.814453125,2,2.24951171875],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":3040,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.953125,"cpuMs":690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236666880,"Alloc system memory":1661698048}},{"at":1793890093499,"load":[1.814453125,2,2.24951171875],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":3070,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.828125,"cpuMs":710,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661698048}},{"at":1793890094392,"load":[1.814453125,2,2.24951171875],"processes":[{"pid":65847,"rssMiB":353.0625,"cpuMs":3090,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":156.5625,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":196.828125,"cpuMs":730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":236404736,"Alloc system memory":1661698048}}],"cpu":[{"pid":65847,"role":"openbitfun-desktop","cpuPercent":2.6921926413401134,"startRssMiB":378.359375,"endRssMiB":353.0625},{"pid":65849,"role":"com.apple.WebKit.GPU","cpuPercent":0.24927709642038087,"startRssMiB":156.5625,"endRssMiB":156.5625},{"pid":65850,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14956625785222855,"startRssMiB":333.140625,"endRssMiB":333.15625},{"pid":65851,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.09375,"endRssMiB":8.984375},{"pid":66561,"role":"com.apple.WebKit.WebContent","cpuPercent":1.894505932794895,"startRssMiB":196.71875,"endRssMiB":196.828125}]},{"name":"working-bubble","before":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":4997},{"name":"openbitfun-petdex-walk","state":"running","time":3785}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"14.285714%","y":"70%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-agent-companion-state-spin","state":"running","time":25121},{"name":"openbitfun-petdex-walk","state":"running","time":23909}],"domNodes":54,"heap":null,"mutations":11,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"1.16s, 0.56s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 7; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 70%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"42.857143%","y":"70%"},"visibility":"visible"},"samples":[{"at":1793890102093,"load":[1.615234375,1.95068359375,2.22900390625],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3390,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.71875,"cpuMs":580,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.75,"cpuMs":1040,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890103151,"load":[1.615234375,1.95068359375,2.22900390625],"processes":[{"pid":65847,"rssMiB":353.015625,"cpuMs":3430,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.59375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1070,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890104216,"load":[1.615234375,1.95068359375,2.22900390625],"processes":[{"pid":65847,"rssMiB":353.015625,"cpuMs":3460,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.59375,"cpuMs":590,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1100,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890105281,"load":[1.615234375,1.95068359375,2.22900390625],"processes":[{"pid":65847,"rssMiB":353.015625,"cpuMs":3500,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.59375,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.78125,"cpuMs":1120,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890106347,"load":[1.72607421875,1.9677734375,2.2333984375],"processes":[{"pid":65847,"rssMiB":353.015625,"cpuMs":3530,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.609375,"cpuMs":600,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.796875,"cpuMs":1150,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890107413,"load":[1.72607421875,1.9677734375,2.2333984375],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3570,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.609375,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1170,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890108480,"load":[1.72607421875,1.9677734375,2.2333984375],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3600,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.609375,"cpuMs":610,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1200,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890109547,"load":[1.72607421875,1.9677734375,2.2333984375],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3640,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.625,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.796875,"cpuMs":1230,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890110612,"load":[1.72607421875,1.9677734375,2.2333984375],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3670,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.625,"cpuMs":620,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.796875,"cpuMs":1250,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890111678,"load":[1.66748046875,1.95166015625,2.22607421875],"processes":[{"pid":65847,"rssMiB":353.09375,"cpuMs":3700,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.625,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.796875,"cpuMs":1280,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890112744,"load":[1.66748046875,1.95166015625,2.22607421875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3730,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.6875,"cpuMs":1300,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890113809,"load":[1.66748046875,1.95166015625,2.22607421875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3770,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":630,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.703125,"cpuMs":1330,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890114874,"load":[1.66748046875,1.95166015625,2.22607421875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3800,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.703125,"cpuMs":1350,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890115940,"load":[1.66748046875,1.95166015625,2.22607421875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3840,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.65625,"cpuMs":640,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.15625,"cpuMs":1750,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.71875,"cpuMs":1380,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890117005,"load":[1.69384765625,1.9521484375,2.224609375],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3870,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.65625,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.734375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890118071,"load":[1.69384765625,1.9521484375,2.224609375],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":3910,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.65625,"cpuMs":650,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1840,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.734375,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890119136,"load":[1.69384765625,1.9521484375,2.224609375],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":3940,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.671875,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.296875,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.75,"cpuMs":1450,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890120201,"load":[1.69384765625,1.9521484375,2.224609375],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":3980,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.671875,"cpuMs":660,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.3125,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.75,"cpuMs":1480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890121267,"load":[1.69384765625,1.9521484375,2.224609375],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":4010,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.6875,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.3125,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1500,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667956736}},{"at":1793890122151,"load":[1.63818359375,1.93603515625,2.21728515625],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":4040,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.59375,"cpuMs":670,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.3125,"cpuMs":1860,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.765625,"cpuMs":1520,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":281116672,"Alloc system memory":1667514368}}],"cpu":[{"pid":65847,"role":"openbitfun-desktop","cpuPercent":3.2406022534649517,"startRssMiB":353.09375,"endRssMiB":353.125},{"pid":65849,"role":"com.apple.WebKit.GPU","cpuPercent":0.44869877355668564,"startRssMiB":176.71875,"endRssMiB":176.59375},{"pid":65850,"role":"com.apple.WebKit.WebContent","cpuPercent":0.5982650314089142,"startRssMiB":333.15625,"endRssMiB":333.3125},{"pid":65851,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.984375},{"pid":66561,"role":"com.apple.WebKit.WebContent","cpuPercent":2.3930601256356567,"startRssMiB":201.75,"endRssMiB":201.765625}]},{"name":"hidden","before":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 71.428571% 100%;","name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"after":{"animations":[],"domNodes":44,"heap":null,"mutations":18,"scripts":["openbitfun-ui://localhost/assets/index-BhRpB9Js.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"0s","height":104,"inlineStyle":"image-rendering: auto; animation: auto; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 10; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position: 71.428571% 100%;","name":"none","state":"running","width":96,"x":"71.428574%","y":"100%"},"visibility":"hidden"},"samples":[{"at":1793890129858,"load":[1.5869140625,1.92041015625,2.2099609375],"processes":[{"pid":65847,"rssMiB":353.203125,"cpuMs":4200,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.6875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.234375,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":136413184,"Alloc system memory":1619279872}},{"at":1793890130919,"load":[1.5869140625,1.92041015625,2.2099609375],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.6875,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1870,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.140625,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":130121728,"Alloc system memory":1612988416}},{"at":1793890131974,"load":[1.53955078125,1.90478515625,2.20263671875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.15625,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":125927424,"Alloc system memory":1608794112}},{"at":1793890133038,"load":[1.53955078125,1.90478515625,2.20263671875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.15625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":95518720,"Alloc system memory":1601454080}},{"at":1793890134103,"load":[1.53955078125,1.90478515625,2.20263671875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4210,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":690,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.15625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":91324416,"Alloc system memory":1596211200}},{"at":1793890135156,"load":[1.53955078125,1.90478515625,2.20263671875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4220,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.15625,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":76644352,"Alloc system memory":1580482560}},{"at":1793890136207,"load":[1.53955078125,1.90478515625,2.20263671875],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4220,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.03125,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":76644352,"Alloc system memory":1568423936}},{"at":1793890137260,"load":[1.49609375,1.8896484375,2.1953125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4220,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":76644352,"Alloc system memory":1568423936}},{"at":1793890138326,"load":[1.49609375,1.8896484375,2.1953125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1880,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":76644352,"Alloc system memory":1568423936}},{"at":1793890139387,"load":[1.49609375,1.8896484375,2.1953125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":76644352,"Alloc system memory":1568423936}},{"at":1793890140448,"load":[1.49609375,1.8896484375,2.1953125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":173047808,"Alloc system memory":1604567040}},{"at":1793890141514,"load":[1.49609375,1.8896484375,2.1953125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":202.109375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":173047808,"Alloc system memory":1604567040}},{"at":1793890142579,"load":[1.5361328125,1.89111328125,2.19384765625],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4230,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":162463744,"Alloc system memory":1598275584}},{"at":1793890143631,"load":[1.5361328125,1.89111328125,2.19384765625],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4240,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":158269440,"Alloc system memory":1594081280}},{"at":1793890144681,"load":[1.5361328125,1.89111328125,2.19384765625],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4240,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":154075136,"Alloc system memory":1589886976}},{"at":1793890145745,"load":[1.5361328125,1.89111328125,2.19384765625],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":151977984,"Alloc system memory":1587789824}},{"at":1793890146810,"load":[1.5361328125,1.89111328125,2.19384765625],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":147783680,"Alloc system memory":1583595520}},{"at":1793890147868,"load":[1.5732421875,1.892578125,2.1923828125],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4250,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1890,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":145686528,"Alloc system memory":1581498368}},{"at":1793890148933,"load":[1.5732421875,1.892578125,2.1923828125],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":4260,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.984375,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":133103616,"Alloc system memory":1581498368}},{"at":1793890149919,"load":[1.5732421875,1.892578125,2.1923828125],"processes":[{"pid":65847,"rssMiB":353.125,"cpuMs":4260,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":176.640625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1900,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":9.015625,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":66561,"rssMiB":201.953125,"cpuMs":1740,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":131006464,"Alloc system memory":1579401216}}],"cpu":[{"pid":65847,"role":"openbitfun-desktop","cpuPercent":0.29908778226409455,"startRssMiB":353.203125,"endRssMiB":353.125},{"pid":65849,"role":"com.apple.WebKit.GPU","cpuPercent":0.04984796371068241,"startRssMiB":176.6875,"endRssMiB":176.640625},{"pid":65850,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14954389113204727,"startRssMiB":333.203125,"endRssMiB":333.203125},{"pid":65851,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.03125,"endRssMiB":9.015625},{"pid":66561,"role":"com.apple.WebKit.WebContent","cpuPercent":0.19939185484272964,"startRssMiB":202.234375,"endRssMiB":201.953125}]},{"name":"closed","before":null,"after":null,"samples":[{"at":1793890154996,"load":[1.52685546875,1.87744140625,2.18505859375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4290,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890156059,"load":[1.52685546875,1.87744140625,2.18505859375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4290,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.203125,"cpuMs":1910,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890157124,"load":[1.564453125,1.87939453125,2.18359375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4290,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890158181,"load":[1.564453125,1.87939453125,2.18359375],"processes":[{"pid":65847,"rssMiB":353.015625,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890159227,"load":[1.564453125,1.87939453125,2.18359375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890160287,"load":[1.564453125,1.87939453125,2.18359375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890161351,"load":[1.564453125,1.87939453125,2.18359375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4300,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890162416,"load":[1.51904296875,1.86474609375,2.17626953125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1920,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890163480,"load":[1.51904296875,1.86474609375,2.17626953125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890164546,"load":[1.51904296875,1.86474609375,2.17626953125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890165609,"load":[1.51904296875,1.86474609375,2.17626953125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.28125,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890166673,"load":[1.51904296875,1.86474609375,2.17626953125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4310,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890167738,"load":[1.47705078125,1.85009765625,2.1689453125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890168800,"load":[1.47705078125,1.85009765625,2.1689453125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4320,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890169865,"load":[1.47705078125,1.85009765625,2.1689453125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4330,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":124715008,"Alloc system memory":1552777216}},{"at":1793890170931,"load":[1.47705078125,1.85009765625,2.1689453125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4330,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":351305728,"Alloc system memory":1626406912}},{"at":1793890171996,"load":[1.47705078125,1.85009765625,2.1689453125],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4370,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1930,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":322109440,"Alloc system memory":1626046464}},{"at":1793890173061,"load":[1.4384765625,1.8359375,2.16162109375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4390,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":161546240,"Alloc system memory":1613463552}},{"at":1793890174115,"load":[1.4384765625,1.8359375,2.16162109375],"processes":[{"pid":65847,"rssMiB":353,"cpuMs":4420,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.375,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.953125,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":157351936,"Alloc system memory":1605074944}},{"at":1793890175058,"load":[1.4384765625,1.8359375,2.16162109375],"processes":[{"pid":65847,"rssMiB":353.109375,"cpuMs":4430,"role":"openbitfun-desktop"},{"pid":65849,"rssMiB":149.390625,"cpuMs":700,"role":"com.apple.WebKit.GPU"},{"pid":65850,"rssMiB":333.25,"cpuMs":1940,"role":"com.apple.WebKit.WebContent"},{"pid":65851,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":16,"Renderer Utilization %":16,"Tiler Utilization %":6,"In use system memory":547651584,"Alloc system memory":1713143808}}],"cpu":[{"pid":65847,"role":"openbitfun-desktop","cpuPercent":0.6978367062107467,"startRssMiB":353,"endRssMiB":353.109375},{"pid":65849,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":149.390625,"endRssMiB":149.390625},{"pid":65850,"role":"com.apple.WebKit.WebContent","cpuPercent":0.14953643704516,"startRssMiB":333.203125,"endRssMiB":333.25},{"pid":65851,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.96875}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[65849,65850,65851,66561],"hostPid":65847,"petCandidatePids":[66561],"mainCandidatePids":[65849,65850,65851]},"restCadence":{"frames":[25381,25397,25412,25430,25446,25462,25479,25496,25513,25530,25546,25563,25580,25596,25613,25630,25646,25663,25680,25696,25713,25730,25746,25763,25780,25796,25813,25829,25846,25863,25879,25896,25913,25930,25946,25963,25980,25995,26013,26030,26046,26063,26080,26096,26113,26130,26146,26163,26179,26196,26213,26230,26246,26263,26280,26296,26313,26330,26346,26363,26380,26396,26413,26430,26446,26463,26480,26496,26513,26530,26546,26563,26579,26596,26613,26630,26646,26663,26680,26696,26713,26730,26746,26763,26780,26796,26813,26830,26846,26863,26880,26896,26913,26930,26946,26963,26980,26995,27013,27030,27046,27063,27080,27096,27112,27130,27146,27163,27180,27196,27213,27230,27246,27263,27280,27296,27313,27330,27346,27362,27379,27396,27413,27430,27446,27463,27480,27495,27512,27530,27545,27562,27579,27596,27613,27630,27646,27663,27680,27696,27713,27730,27746,27763,27780,27796,27813,27829,27847,27863,27879,27896,27913,27930,27946,27963,27979,27996],"positions":["0%","14.285714%","28.571428%","42.857143%","57.142857%","71.428574%"]},"workCadence":{"frames":[53141,53146,53163,53179,53196,53213,53229,53245,53263,53280,53296,53313,53330,53346,53363,53379,53395,53413,53430,53446,53463,53480,53496,53513,53530,53545,53562,53579,53595,53613,53629,53645,53663,53680,53696,53713,53730,53746,53763,53779,53796,53812,53830,53846,53863,53879,53896,53913,53930,53946,53962,53979,53996,54013,54030,54046,54063,54080,54096,54112,54129,54145,54163,54180,54196,54213,54230,54246,54263,54280,54296,54313,54330,54346,54363,54380,54396,54412,54430,54446,54463,54480,54496,54513,54530,54545,54563,54580,54596,54613,54630,54646,54663,54680,54696,54713,54730,54746,54763,54780,54796,54812,54830,54846,54863,54879,54896,54912,54930,54945,54963,54980,54996,55013,55029,55045,55062,55079,55096,55113,55130,55146,55163,55180,55196,55213,55230,55245,55262,55280,55296,55313,55330,55346,55363,55380,55396,55413,55430,55446,55463,55480,55496,55513,55529,55546,55563,55580,55596,55613,55630,55646,55662,55679,55696,55713,55730,55746],"positions":["42.857143%","57.142857%","71.428574%","0%","14.285714%","28.571428%"]}}},{"reason":"Protocol 2 optimized run aborted: main-window visibility guard failed after companion activation.","directory":"/openbitfun-pet-perf-Ha2Rop","report":{"schemaVersion":1,"label":"optimized-1","protocol":{"version":2,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"d52b4e5fb2789eea510b9431ad92326161206dad85c2a8597812dd244542fd91","frontend":{"schemaVersion":1,"revision":"bundled-ce86dd79f9268b72","algorithm":"sha256-path-content-v1","digest":"ce86dd79f9268b72fdf032f4a092fb681f0e675f8f7b7cda8dbd67d6f13de049","fileCount":2737,"totalBytes":93313799},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793890207760,"load":[1.67431640625,1.82666015625,2.14306640625],"processes":[{"pid":69447,"rssMiB":358.421875,"cpuMs":2140,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.109375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":53,"Renderer Utilization %":53,"Tiler Utilization %":27,"In use system memory":557563904,"Alloc system memory":1807859712}},{"at":1793890208817,"load":[1.67431640625,1.82666015625,2.14306640625],"processes":[{"pid":69447,"rssMiB":358.34375,"cpuMs":2150,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.25,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":9,"In use system memory":600850432,"Alloc system memory":1819639808}},{"at":1793890209863,"load":[1.67431640625,1.82666015625,2.14306640625],"processes":[{"pid":69447,"rssMiB":358.3125,"cpuMs":2150,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.25,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":30,"Renderer Utilization %":30,"Tiler Utilization %":6,"In use system memory":525287424,"Alloc system memory":1808678912}},{"at":1793890210927,"load":[1.67431640625,1.82666015625,2.14306640625],"processes":[{"pid":69447,"rssMiB":358.3125,"cpuMs":2150,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1400,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":26,"Renderer Utilization %":26,"Tiler Utilization %":5,"In use system memory":516931584,"Alloc system memory":1802862592}},{"at":1793890211992,"load":[1.67431640625,1.82666015625,2.14306640625],"processes":[{"pid":69447,"rssMiB":358.3125,"cpuMs":2150,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1410,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":4,"In use system memory":475365376,"Alloc system memory":1786216448}},{"at":1793890213057,"load":[1.5400390625,1.7958984375,2.13037109375],"processes":[{"pid":69447,"rssMiB":358.3125,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":4,"In use system memory":475365376,"Alloc system memory":1771110400}},{"at":1793890214124,"load":[1.5400390625,1.7958984375,2.13037109375],"processes":[{"pid":69447,"rssMiB":358.3125,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":6,"In use system memory":560545792,"Alloc system memory":1778941952}},{"at":1793890215188,"load":[1.5400390625,1.7958984375,2.13037109375],"processes":[{"pid":69447,"rssMiB":358.265625,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":22,"Renderer Utilization %":22,"Tiler Utilization %":5,"In use system memory":516931584,"Alloc system memory":1772240896}},{"at":1793890216253,"load":[1.5400390625,1.7958984375,2.13037109375],"processes":[{"pid":69447,"rssMiB":358.265625,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1420,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":5,"In use system memory":564740096,"Alloc system memory":1779384320}},{"at":1793890217302,"load":[1.89697265625,1.865234375,2.15283203125],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.09375,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":29,"Renderer Utilization %":29,"Tiler Utilization %":6,"In use system memory":567427072,"Alloc system memory":1780908032}},{"at":1793890218368,"load":[1.89697265625,1.865234375,2.15283203125],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.171875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":17,"Renderer Utilization %":17,"Tiler Utilization %":3,"In use system memory":533921792,"Alloc system memory":1780383744}},{"at":1793890219434,"load":[1.89697265625,1.865234375,2.15283203125],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.171875,"cpuMs":1430,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":18,"Renderer Utilization %":18,"Tiler Utilization %":4,"In use system memory":533921792,"Alloc system memory":1777238016}},{"at":1793890220500,"load":[1.89697265625,1.865234375,2.15283203125],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.171875,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":28,"Renderer Utilization %":28,"Tiler Utilization %":6,"In use system memory":561086464,"Alloc system memory":1777172480}},{"at":1793890221568,"load":[1.89697265625,1.865234375,2.15283203125],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.171875,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":5,"In use system memory":556417024,"Alloc system memory":1775681536}},{"at":1793890222629,"load":[1.82470703125,1.8505859375,2.14599609375],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":19,"Renderer Utilization %":19,"Tiler Utilization %":3,"In use system memory":569442304,"Alloc system memory":1777467392}},{"at":1793890223694,"load":[1.82470703125,1.8505859375,2.14599609375],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":32,"Renderer Utilization %":32,"Tiler Utilization %":7,"In use system memory":567050240,"Alloc system memory":1781760000}},{"at":1793890224755,"load":[1.82470703125,1.8505859375,2.14599609375],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327,"cpuMs":1440,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":20,"Renderer Utilization %":20,"Tiler Utilization %":5,"In use system memory":579420160,"Alloc system memory":1787953152}},{"at":1793890225797,"load":[1.82470703125,1.8505859375,2.14599609375],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.109375,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.140625,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.046875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":25,"Renderer Utilization %":25,"Tiler Utilization %":5,"In use system memory":568246272,"Alloc system memory":1790443520}},{"at":1793890226834,"load":[1.82470703125,1.8505859375,2.14599609375],"processes":[{"pid":69447,"rssMiB":358.28125,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.140625,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":32,"Renderer Utilization %":32,"Tiler Utilization %":6,"In use system memory":616710144,"Alloc system memory":1837187072}},{"at":1793890227818,"load":[1.75830078125,1.83642578125,2.13916015625],"processes":[{"pid":69447,"rssMiB":358.265625,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":69460,"rssMiB":129.125,"cpuMs":420,"role":"com.apple.WebKit.GPU"},{"pid":69461,"rssMiB":327.140625,"cpuMs":1510,"role":"com.apple.WebKit.WebContent"},{"pid":69462,"rssMiB":9.0625,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":34,"Renderer Utilization %":34,"Tiler Utilization %":22,"In use system memory":594837504,"Alloc system memory":1838841856}}],"cpu":[{"pid":69447,"role":"openbitfun-desktop","cpuPercent":0.34898793498853325,"startRssMiB":358.421875,"endRssMiB":358.265625},{"pid":69460,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.375,"endRssMiB":129.125},{"pid":69461,"role":"com.apple.WebKit.WebContent","cpuPercent":0.548409612124838,"startRssMiB":327.09375,"endRssMiB":327.140625},{"pid":69462,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9.109375,"endRssMiB":9.0625}]}],"passed":false,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[69460,69461,69462,70260],"hostPid":69447,"petCandidatePids":[70260],"mainCandidatePids":[69460,69461,69462]},"error":"AssertionError [ERR_ASSERTION]: Main must stay hidden during pet measurements\n\ntrue !== false\n\n at measure (file:///tests/e2e/scripts/run-pet-performance.mjs:77:10)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)\n at async file:///tests/e2e/scripts/run-pet-performance.mjs:113:3"}},{"reason":"Diagnostic-only paused-WAAPI stepping experiment; not production behavior or paired acceptance.","directory":"/openbitfun-pet-perf-oF12p4","report":{"schemaVersion":1,"diagnosticOnly":true,"label":"discrete-diagnostic","protocol":{"version":3,"prewarmMs":15000,"settleMs":5000,"windowMs":20000,"mainVisibility":"hide-before-each-settle-and-assert-both-boundaries","phases":["off","rest","working-bubble","hidden","closed"],"cadenceOutsideResourceWindows":true},"harnessHash":"555c76f85d5b67a7dd675841920354b45c517c65152eb1f69ada201beb9ea067","frontend":{"schemaVersion":1,"revision":"bundled-ce86dd79f9268b72","algorithm":"sha256-path-content-v1","digest":"ce86dd79f9268b72fdf032f4a092fb681f0e675f8f7b7cda8dbd67d6f13de049","fileCount":2737,"totalBytes":93313799},"binarySha256":"04bc43523a1ddee4e10861262bfeadaa4435d4e5b63f60e1735d9b3be50cbce2","environment":{"model":"Apple M5","cpus":10,"memory":17179869184,"release":"27.2.0"},"coverage":{"nativeDesktop":true,"isolatedProfile":true,"productionFrontend":true,"nativeProfile":"debug","activityFixture":true,"realAgent":false,"remoteWorkspace":false,"remoteControl":false,"peerDevice":false,"detachedDispatch":false},"limitations":["WebKit PIDs are fixed launch candidates, not proven ownership.","GPU counters are system-wide, not pet utilization.","RSS is resident process memory, not JS heap or private GPU memory.","Cadence uses RAF opportunities, not GPU completion."],"windows":[{"name":"off","before":null,"after":null,"samples":[{"at":1793891359580,"load":[1.73779296875,1.576171875,1.70556640625],"processes":[{"pid":91298,"rssMiB":360.078125,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.609375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.140625,"cpuMs":1500,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":9,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":40,"Renderer Utilization %":40,"Tiler Utilization %":11,"In use system memory":464551936,"Alloc system memory":1851293696}},{"at":1793891360640,"load":[1.73779296875,1.576171875,1.70556640625],"processes":[{"pid":91298,"rssMiB":360.03125,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":418938880,"Alloc system memory":1839710208}},{"at":1793891361703,"load":[1.73779296875,1.576171875,1.70556640625],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":342802432,"Alloc system memory":1829224448}},{"at":1793891362769,"load":[1.73779296875,1.576171875,1.70556640625],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2160,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":422084608,"Alloc system memory":1830797312}},{"at":1793891363833,"load":[1.6787109375,1.56640625,1.701171875],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1580,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":505315328,"Alloc system memory":1840152576}},{"at":1793891364891,"load":[1.6787109375,1.56640625,1.701171875],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2170,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":416071680,"Alloc system memory":1871282176}},{"at":1793891365960,"load":[1.6787109375,1.56640625,1.701171875],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.9375,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":396361728,"Alloc system memory":1851359232}},{"at":1793891367024,"load":[1.6787109375,1.56640625,1.701171875],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":499810304,"Alloc system memory":1868300288}},{"at":1793891368091,"load":[1.7041015625,1.5732421875,1.70263671875],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2180,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.359375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1590,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":11,"Renderer Utilization %":11,"Tiler Utilization %":6,"In use system memory":419790848,"Alloc system memory":1861877760}},{"at":1793891369159,"load":[1.7041015625,1.5732421875,1.70263671875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.125,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":3,"Renderer Utilization %":3,"Tiler Utilization %":2,"In use system memory":353681408,"Alloc system memory":1846231040}},{"at":1793891370225,"load":[1.7041015625,1.5732421875,1.70263671875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2190,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.1875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":343867392,"Alloc system memory":1833648128}},{"at":1793891371279,"load":[1.7041015625,1.5732421875,1.70263671875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":497172480,"Alloc system memory":1846362112}},{"at":1793891372346,"load":[1.7041015625,1.5732421875,1.70263671875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":417415168,"Alloc system memory":1831550976}},{"at":1793891373398,"load":[1.6474609375,1.5634765625,1.6982421875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":377012224,"Alloc system memory":1821032448}},{"at":1793891374466,"load":[1.6474609375,1.5634765625,1.6982421875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.015625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":344932352,"Alloc system memory":1810546688}},{"at":1793891375525,"load":[1.6474609375,1.5634765625,1.6982421875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2200,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.015625,"cpuMs":1600,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":464551936,"Alloc system memory":1834942464}},{"at":1793891376591,"load":[1.6474609375,1.5634765625,1.6982421875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":4,"In use system memory":417415168,"Alloc system memory":1820131328}},{"at":1793891377659,"load":[1.6474609375,1.5634765625,1.6982421875],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":467615744,"Alloc system memory":1853685760}},{"at":1793891378727,"load":[1.75537109375,1.5869140625,1.70556640625],"processes":[{"pid":91298,"rssMiB":360.015625,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":1,"Renderer Utilization %":1,"Tiler Utilization %":1,"In use system memory":501268480,"Alloc system memory":1860616192}},{"at":1793891379641,"load":[1.75537109375,1.5869140625,1.70556640625],"processes":[{"pid":91298,"rssMiB":360,"cpuMs":2210,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":129.34375,"cpuMs":480,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.046875,"cpuMs":1610,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.921875,"cpuMs":40,"role":"com.apple.WebKit.Networking"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":509820928,"Alloc system memory":1856339968}}],"cpu":[{"pid":91298,"role":"openbitfun-desktop","cpuPercent":0.2492398185534121,"startRssMiB":360.078125,"endRssMiB":360},{"pid":91303,"role":"com.apple.WebKit.GPU","cpuPercent":0,"startRssMiB":129.609375,"endRssMiB":129.34375},{"pid":91304,"role":"com.apple.WebKit.WebContent","cpuPercent":0.5483276008175066,"startRssMiB":329.140625,"endRssMiB":329.046875},{"pid":91305,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":9,"endRssMiB":8.921875}]},{"name":"rest","before":{"animations":[{"name":"openbitfun-petdex-walk","state":"paused","time":5605}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"28.571428%","y":"0%"},"visibility":"visible"},"after":{"animations":[{"name":"openbitfun-petdex-walk","state":"paused","time":25605}],"domNodes":44,"heap":null,"mutations":4,"scripts":["openbitfun-ui://localhost/assets/index-D_waDZcG.js"],"sprite":{"backgroundImage":"url(\"openbitfun-ui://localhost/agent-companion-pets/bitblob/spritesheet.webp\")","duration":"2.4s, 6.4s","height":104,"inlineStyle":"image-rendering: auto; animation-name: openbitfun-petdex-walk; --openbitfun-petdex-src: url(\"/agent-companion-pets/bitblob/spritesheet.webp\"); --openbitfun-petdex-row: 0; --openbitfun-petdex-frames: 6; --openbitfun-petdex-end: 85.71428571428571%; background-size: 800% 1100%; background-position-y: 0%;","name":"openbitfun-petdex-walk","state":"running, running","width":96,"x":"57.142857%","y":"0%"},"visibility":"visible"},"samples":[{"at":1793891386513,"load":[1.69482421875,1.5771484375,1.701171875],"processes":[{"pid":91298,"rssMiB":380.28125,"cpuMs":2460,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.296875,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.0625,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.28125,"cpuMs":370,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":511803392,"Alloc system memory":1886945280}},{"at":1793891387574,"load":[1.69482421875,1.5771484375,1.701171875],"processes":[{"pid":91298,"rssMiB":380.296875,"cpuMs":2490,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.296875,"cpuMs":510,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.0625,"cpuMs":1620,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.296875,"cpuMs":410,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":455671808,"Alloc system memory":1873625088}},{"at":1793891388641,"load":[1.71923828125,1.583984375,1.70263671875],"processes":[{"pid":91298,"rssMiB":380.296875,"cpuMs":2520,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.296875,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.296875,"cpuMs":430,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":554713088,"Alloc system memory":1880440832}},{"at":1793891389707,"load":[1.71923828125,1.583984375,1.70263671875],"processes":[{"pid":91298,"rssMiB":380.296875,"cpuMs":2550,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.296875,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.3125,"cpuMs":450,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":10,"Renderer Utilization %":10,"Tiler Utilization %":5,"In use system memory":513654784,"Alloc system memory":1880309760}},{"at":1793891390772,"load":[1.71923828125,1.583984375,1.70263671875],"processes":[{"pid":91298,"rssMiB":380.3125,"cpuMs":2580,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.296875,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.984375,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.265625,"cpuMs":460,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":544391168,"Alloc system memory":1880309760}},{"at":1793891391809,"load":[1.71923828125,1.583984375,1.70263671875],"processes":[{"pid":91298,"rssMiB":380.3125,"cpuMs":2600,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":520,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.28125,"cpuMs":480,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":7,"Renderer Utilization %":7,"Tiler Utilization %":3,"In use system memory":560185344,"Alloc system memory":1883865088}},{"at":1793891392873,"load":[1.71923828125,1.583984375,1.70263671875],"processes":[{"pid":91298,"rssMiB":380.3125,"cpuMs":2630,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.296875,"cpuMs":500,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":5,"Renderer Utilization %":5,"Tiler Utilization %":3,"In use system memory":573816832,"Alloc system memory":1883537408}},{"at":1793891393939,"load":[1.90185546875,1.6240234375,1.7158203125],"processes":[{"pid":91298,"rssMiB":380.328125,"cpuMs":2650,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.3125,"cpuMs":510,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":414842880,"Alloc system memory":1875148800}},{"at":1793891395005,"load":[1.90185546875,1.6240234375,1.7158203125],"processes":[{"pid":91298,"rssMiB":380.328125,"cpuMs":2680,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":530,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1700,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.359375,"cpuMs":530,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":525238272,"Alloc system memory":1875230720}},{"at":1793891396071,"load":[1.90185546875,1.6240234375,1.7158203125],"processes":[{"pid":91298,"rssMiB":380.328125,"cpuMs":2710,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.40625,"cpuMs":550,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":545816576,"Alloc system memory":1870790656}},{"at":1793891397131,"load":[1.90185546875,1.6240234375,1.7158203125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2730,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.203125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.421875,"cpuMs":560,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":416595968,"Alloc system memory":1868316672}},{"at":1793891398188,"load":[1.90185546875,1.6240234375,1.7158203125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2760,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":540,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.078125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.390625,"cpuMs":580,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":499941376,"Alloc system memory":1863401472}},{"at":1793891399255,"load":[1.82958984375,1.61328125,1.71142578125],"processes":[{"pid":91298,"rssMiB":380.3125,"cpuMs":2790,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.078125,"cpuMs":1710,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.390625,"cpuMs":600,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":521453568,"Alloc system memory":1861435392}},{"at":1793891400322,"load":[1.82958984375,1.61328125,1.71142578125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2820,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1720,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.421875,"cpuMs":610,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":9,"Renderer Utilization %":9,"Tiler Utilization %":5,"In use system memory":543096832,"Alloc system memory":1859207168}},{"at":1793891401387,"load":[1.82958984375,1.61328125,1.71142578125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2850,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.4375,"cpuMs":630,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":455606272,"Alloc system memory":1876049920}},{"at":1793891402453,"load":[1.82958984375,1.61328125,1.71142578125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2880,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":550,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.453125,"cpuMs":640,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":2,"Renderer Utilization %":2,"Tiler Utilization %":1,"In use system memory":533233664,"Alloc system memory":1880309760}},{"at":1793891403520,"load":[1.7626953125,1.60302734375,1.70703125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2910,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":560,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.453125,"cpuMs":660,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":521191424,"Alloc system memory":1876246528}},{"at":1793891404586,"load":[1.7626953125,1.60302734375,1.70703125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2930,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":560,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.453125,"cpuMs":680,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":8,"Renderer Utilization %":8,"Tiler Utilization %":4,"In use system memory":543096832,"Alloc system memory":1871921152}},{"at":1793891405653,"load":[1.7626953125,1.60302734375,1.70703125],"processes":[{"pid":91298,"rssMiB":380.34375,"cpuMs":2960,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":560,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.484375,"cpuMs":690,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":423641088,"Alloc system memory":1863532544}},{"at":1793891406574,"load":[1.7626953125,1.60302734375,1.70703125],"processes":[{"pid":91298,"rssMiB":354.984375,"cpuMs":2980,"role":"openbitfun-desktop"},{"pid":91303,"rssMiB":156.3125,"cpuMs":570,"role":"com.apple.WebKit.GPU"},{"pid":91304,"rssMiB":329.09375,"cpuMs":1730,"role":"com.apple.WebKit.WebContent"},{"pid":91305,"rssMiB":8.96875,"cpuMs":40,"role":"com.apple.WebKit.Networking"},{"pid":91991,"rssMiB":196.5,"cpuMs":700,"role":"com.apple.WebKit.WebContent"}],"gpu":{"Device Utilization %":0,"Renderer Utilization %":0,"Tiler Utilization %":0,"In use system memory":501268480,"Alloc system memory":1865613312}}],"cpu":[{"pid":91298,"role":"openbitfun-desktop","cpuPercent":2.5920941129554858,"startRssMiB":380.28125,"endRssMiB":354.984375},{"pid":91303,"role":"com.apple.WebKit.GPU","cpuPercent":0.29908778226409455,"startRssMiB":156.296875,"endRssMiB":156.3125},{"pid":91304,"role":"com.apple.WebKit.WebContent","cpuPercent":0.5483276008175066,"startRssMiB":329.0625,"endRssMiB":329.09375},{"pid":91305,"role":"com.apple.WebKit.Networking","cpuPercent":0,"startRssMiB":8.984375,"endRssMiB":8.96875},{"pid":91991,"role":"com.apple.WebKit.WebContent","cpuPercent":1.6449828024525197,"startRssMiB":196.28125,"endRssMiB":196.5}]}],"passed":true,"processAttribution":{"policy":"fixed-new-WebKit-candidates-after-pet-ready","pids":[91303,91304,91305,91991],"hostPid":91298,"petCandidatePids":[91991],"mainCandidatePids":[91303,91304,91305]},"experiment":{"frameMs":400,"type":"paused-WAAPI-at-authored-frame-boundaries"},"restCadence":{"frames":[26855,26860,26877,26894,26911,26928,26945,26962,26977,26994,27011,27028,27042,27059,27075,27092,27108,27125,27144,27161,27177,27194,27210,27227,27244,27259,27277,27294,27310,27327,27342,27360,27377,27394,27410,27428,27442,27461,27477,27494,27510,27527,27544,27561,27577,27594,27611,27628,27644,27661,27678,27695,27712,27727,27744,27761,27775,27792,27810,27827,27842,27861,27878,27894,27911,27928,27945,27961,27977,27994,28011,28028,28045,28062,28077,28095,28112,28128,28142,28159,28177,28192,28211,28225,28242,28259,28275,28294,28310,28327,28344,28361,28377,28394,28409,28427,28444,28458,28475,28493,28510,28527,28544,28560,28577,28593,28610,28625,28644,28660,28677,28693,28710,28727,28742,28760,28777,28794,28810,28827,28843,28861,28877,28894,28910,28927,28944,28959,28976,28994,29008,29027,29044,29061,29078,29094,29111,29128,29144,29160,29177,29194,29210,29228,29245,29260,29277,29294,29310,29327,29344,29361,29378,29394,29410,29427,29444,29460],"positions":["57.142857%","71.428574%","0%","14.285714%","28.571428%","42.857143%"]}}}],"verification":{"focusedTests":53,"focusedFiles":5,"checkWeb":"passed","motionAudit":"completed inventory; not a pass/fail gate","runnerSyntax":"passed","liveRemoteScenarios":[],"repoHygiene":"passed","diffCheck":"passed"},"pathRedaction":"Workstation paths replaced with logical repository/evidence roots; numerical samples unchanged."} diff --git a/patches/@xterm__xterm@6.1.0-beta.141.patch b/patches/@xterm__xterm@6.1.0-beta.141.patch new file mode 100644 index 0000000000..a6b98ae99e --- /dev/null +++ b/patches/@xterm__xterm@6.1.0-beta.141.patch @@ -0,0 +1,107 @@ +diff --git a/lib/xterm.js b/lib/xterm.js +index fbf2be13e6724d27771d1db27b77439bf4a86c3e..cbd28f162bbeaa7080c98ddea2fde25407583823 100644 +--- a/lib/xterm.js ++++ b/lib/xterm.js +@@ -1,2 +1 @@ +-!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(globalThis,()=>(()=>{"use strict";var e={56(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(4812),r=i(701),n=i(8636);t.DEFAULT_OPTIONS={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:r.isMac,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",overviewRuler:{},quirks:{},vtExtensions:{}};const o=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends s.Disposable{constructor(e){super(),this._onOptionChange=this._register(new n.Emitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register((0,s.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=a},79(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollbarVisibilityController=void 0;const s=i(1758),r=i(7150),n=i(9881);class o extends r.Disposable{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new s.TimeoutTimer)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility!==n.ScrollbarVisibility.Hidden&&(this._visibility===n.ScrollbarVisibility.Visible||this._rawShouldBeVisible)}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}t.ScrollbarVisibilityController=o},151(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.HorizontalScrollbar=void 0;const s=i(8801),r=i(8245),n=i(9881);class o extends s.AbstractScrollbar{constructor(e,t,i){const s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new r.ScrollbarState(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===n.ScrollbarVisibility.Hidden?0:t.horizontalScrollbarSize,t.vertical===n.ScrollbarVisibility.Hidden?0:t.verticalScrollbarSize,s.width,s.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===n.ScrollbarVisibility.Hidden?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===n.ScrollbarVisibility.Hidden?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}t.HorizontalScrollbar=o},626(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0,t.Lazy=class{constructor(e){this.executor=e,this._didRun=!1}get hasValue(){return this._didRun}get value(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}},701(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isMac=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isNode=!("undefined"==typeof process||!("title"in process)||"undefined"!=typeof navigator&&!navigator.userAgent.startsWith("Node.js/"));const i=t.isNode?"node":navigator.userAgent,s=t.isNode?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isLegacyEdge=i.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(s),t.isWindows=["Windows","Win16","Win32","WinCE"].includes(s),t.isLinux=s.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(i)},706(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=function(e,t,s,r){const n={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?n.key=t?"OA":"":"UIKeyInputLeftArrow"===e.key?n.key=t?"OD":"":"UIKeyInputRightArrow"===e.key?n.key=t?"OC":"":"UIKeyInputDownArrow"===e.key&&(n.key=t?"OB":"");break;case 8:n.key=e.ctrlKey?"\b":"",e.altKey&&(n.key=""+n.key);break;case 9:if(e.shiftKey){n.key="";break}n.key="\t",n.cancel=!0;break;case 13:n.key=e.altKey?"\r":"\r",n.cancel=!0;break;case 27:n.key="",e.altKey&&(n.key=""),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"D":t?"OD":"";break;case 39:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"C":t?"OC":"";break;case 38:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"A":t?"OA":"";break;case 40:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"B":t?"OB":"";break;case 45:e.shiftKey||e.ctrlKey||(n.key="[2~");break;case 46:n.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:n.key=o?"[1;"+(o+1)+"H":t?"OH":"";break;case 35:n.key=o?"[1;"+(o+1)+"F":t?"OF":"";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key="[5;"+(o+1)+"~":n.key="[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key="[6;"+(o+1)+"~":n.key="[6~";break;case 112:n.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:n.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:n.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:n.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:n.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:n.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:n.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:n.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:n.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:n.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:n.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:n.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(s&&!r||!e.altKey||e.metaKey)if(!s||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)n.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":n.key="";break;case"Digit2":n.key="\0";break;case"Digit6":n.key=""}}else 65===e.keyCode&&(n.type=1);else{const t=i[e.keyCode],s=t?.[e.shiftKey?1:0];if(s)n.key=""+s;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=""+i}else if(32===e.keyCode)n.key=""+(e.ctrlKey?"\0":" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=""+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key="\0":e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key="":"/"===e.key?n.key="":219===e.keyCode?n.key="":220===e.keyCode?n.key="":221===e.keyCode&&(n.key="")}return n};const i={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:["'",'"']}},726(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s="";for(let r=t;r65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o);continue}65279!==r&&(t[s++]=r)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const i=e.length;if(!i)return 0;let s,r,n,o,a=0,l=0,h=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,c=l-o;for(;h=i)return 0;if(n=e[h++],128!=(192&n)){h--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===l?r<128?h--:t[a++]=r:3===l?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0)}const c=i-4;let d=h;for(;d=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(l=(31&s)<<6|63&r,l<128){d--;continue}t[a++]=l}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(l=(15&s)<<12|(63&r)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}}},732(e,t){function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.reflowLargerGetLinesToRemove=function(e,t,s,r,n,o){const a=[];for(let l=0;l=l&&r0&&(e>u||0===d[e].getTrimmedLength());e--)g++;g>0&&(a.push(l+d.length-g),a.push(g)),l+=d.length-1}return a},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;oi(e,r,t)).reduce((e,t)=>e+t);let o=0,a=0,l=0;for(;lh&&(o-=h,a++);const c=2===e[a].getWidth(o-1);c&&o--;const d=c?s-1:s;r.push(d),l+=d}return r},t.getWrappedLineTrimmedLength=i},793(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const s=i(3055);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},802(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueWithChangeEvent=t.Relay=t.EventBufferer=t.DynamicListEventMultiplexer=t.EventMultiplexer=t.MicrotaskEmitter=t.DebounceEmitter=t.PauseableEmitter=t.AsyncEmitter=t.createEventDeliveryQueue=t.Emitter=t.ListenerRefusalError=t.ListenerLeakError=t.EventProfiling=t.Event=void 0,t.setGlobalLeakWarningThreshold=function(e){const t=c;return c=e,{dispose(){c=t}}};const s=i(9807),r=i(8841),n=i(7150),o=i(6317),a=i(9725);var l;!function(e){function t(e){return(t,i=null,s)=>{let r,n=!1;return r=e(e=>{if(!n)return r?r.dispose():n=!0,t.call(i,e)},null,s),n&&r.dispose(),r}}function i(e,t,i){return r((i,s=null,r)=>e(e=>i.call(s,t(e)),null,r),i)}function s(e,t,i){return r((i,s=null,r)=>e(e=>t(e)&&i.call(s,e),null,r),i)}function r(e,t){let i;const s=new m({onWillAddFirstListener(){i=e(s.fire,s)},onDidRemoveLastListener(){i?.dispose()}});return t?.add(s),s.event}function o(e,t,i=100,s=!1,r=!1,n,o){let a,l,h,c,d=0;const u=new m({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{d++,l=t(l,e),s&&!h&&(u.fire(l),l=void 0),c=()=>{const e=l;l=void 0,h=void 0,(!s||d>1)&&u.fire(e),d=0},"number"==typeof i?(clearTimeout(h),h=setTimeout(c,i)):void 0===h&&(h=0,queueMicrotask(c))})},onWillRemoveListener(){r&&d>0&&c?.()},onDidRemoveLastListener(){c=void 0,a.dispose()}});return o?.add(u),u.event}e.None=()=>n.Disposable.None,e.defer=function(e,t){return o(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return r((i,s=null,r)=>e(e=>{t(e),i.call(s,e)},null,r),i)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,s)=>{return r=(0,n.combinedDisposable)(...e.map(e=>e(e=>t.call(i,e)))),(o=s)instanceof Array?o.push(r):o&&o.add(r),r;var r,o}},e.reduce=function(e,t,s,r){let n=s;return i(e,e=>(n=t(n,e),n),r)},e.debounce=o,e.accumulate=function(t,i=0,s){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,s)},e.latch=function(e,t=(e,t)=>e===t,i){let r,n=!0;return s(e,e=>{const i=n||!t(e,r);return n=!1,r=e,i},i)},e.split=function(t,i,s){return[e.filter(t,i,s),e.filter(t,e=>!i(e),s)]},e.buffer=function(e,t=!1,i=[],s){let r=i.slice(),n=e(e=>{r?r.push(e):a.fire(e)});s&&s.add(n);const o=()=>{r?.forEach(e=>a.fire(e)),r=null},a=new m({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),s&&s.add(n))},onDidAddFirstListener(){r&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return s&&s.add(a),a.event},e.chain=function(e,t){return(i,s,r)=>{const n=t(new l);return e(function(e){const t=n.evaluate(e);t!==a&&i.call(s,t)},void 0,r)}};const a=Symbol("HaltChainable");class l{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:a),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(s=>{const r=i||!e(s,t);return i=!1,t=s,r?s:a}),this}evaluate(e){for(const t of this.steps)if((e=t(e))===a)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){const s=(...e)=>r.fire(i(...e)),r=new m({onWillAddFirstListener:()=>e.on(t,s),onDidRemoveLastListener:()=>e.removeListener(t,s)});return r.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){const s=(...e)=>r.fire(i(...e)),r=new m({onWillAddFirstListener:()=>e.addEventListener(t,s),onDidRemoveLastListener:()=>e.removeEventListener(t,s)});return r.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){const t=new m;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class h{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;const i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new m(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new h(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,s)=>{let r=0,o=!1;const a={beginUpdate(){r++},endUpdate(){r--,0===r&&(e.reportChanges(),o&&(o=!1,t.call(i)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();const l={dispose(){e.removeObserver(a)}};return s instanceof n.DisposableStore?s.add(l):Array.isArray(s)&&s.push(l),l}}}(l||(t.Event=l={}));class h{static{this.all=new Set}static{this._idPool=0}constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${h._idPool++}`,h.all.add(this)}start(e){this._stopWatch=new a.StopWatch,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}}t.EventProfiling=h;let c=-1;class d{static{this._idPool=1}constructor(e,t,i=(d._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){const i=this.threshold;if(i<=0||t{const t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,s]of this._stacks)(!e||t0||this._options?.leakWarningThreshold?new d(e?.onListenerError??s.onUnexpectedError,this._options?.leakWarningThreshold??c):void 0,this._perfMon=this._options?._profName?new h(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);const t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new f(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||s.onUnexpectedError)(i),n.Disposable.None}if(this._disposed)return n.Disposable.None;t&&(e=e.bind(t));const r=new g(e);let o;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(r.stack=u.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof g?(this._deliveryQueue??=new v,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;const a=(0,n.toDisposable)(()=>{o?.(),this._removeListener(r)});return i instanceof n.DisposableStore?i.add(a):Array.isArray(i)&&i.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);const t=this._listeners,i=t.indexOf(e);if(-1===i)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[i]=void 0;const s=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i0}}t.Emitter=m,t.createEventDeliveryQueue=()=>new v;class v{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}t.AsyncEmitter=class extends m{async fireAsync(e,t,i){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new o.LinkedList),((e,t)=>{if(e instanceof g)t(e);else for(let i=0;ithis._asyncDeliveryQueue.push([t.value,e]));this._asyncDeliveryQueue.size>0&&!t.isCancellationRequested;){const[e,r]=this._asyncDeliveryQueue.shift(),n=[],o={...r,token:t,waitUntil:t=>{if(Object.isFrozen(n))throw new Error("waitUntil can NOT be called asynchronous");i&&(t=i(t,e)),n.push(t)}};try{e(o)}catch(e){(0,s.onUnexpectedError)(e);continue}Object.freeze(n),await Promise.allSettled(n).then(e=>{for(const t of e)"rejected"===t.status&&(0,s.onUnexpectedError)(t.reason)})}}};class S extends m{get isPaused(){return 0!==this._isPaused}constructor(e){super(e),this._isPaused=0,this._eventQueue=new o.LinkedList,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0===--this._isPaused)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(0!==this._isPaused?this._eventQueue.push(e):super.fire(e))}}t.PauseableEmitter=S,t.DebounceEmitter=class extends S{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}},t.MicrotaskEmitter=class extends m{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),1===this._queuedEvents.length&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(e=>super.fire(e)),this._queuedEvents=[]}))}};class b{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new m({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),(0,n.toDisposable)((0,r.createSingleCallFunction)(()=>{this.hasListeners&&this.unhook(t);const e=this.events.indexOf(t);this.events.splice(e,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(e=>this.emitter.fire(e))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(const e of this.events)e.listener?.dispose();this.events=[]}}t.EventMultiplexer=b,t.DynamicListEventMultiplexer=class{constructor(e,t,i,s){this._store=new n.DisposableStore;const r=this._store.add(new b),o=this._store.add(new n.DisposableMap);function a(e){o.set(e,r.add(s(e)))}for(const t of e)a(t);this._store.add(t(e=>{a(e)})),this._store.add(i(e=>{o.deleteAndDispose(e)})),this.event=r.event}dispose(){this._store.dispose()}},t.EventBufferer=class{constructor(){this.data=[]}wrapEvent(e,t,i){return(s,r,n)=>e(e=>{const n=this.data[this.data.length-1];if(!t)return void(n?n.buffers.push(()=>s.call(r,e)):s.call(r,e));const o=n;o?(o.items??=[],o.items.push(e),0===o.buffers.length&&n.buffers.push(()=>{o.reducedResult??=i?o.items.reduce(t,i):o.items.reduce(t),s.call(r,o.reducedResult)})):s.call(r,t(i,e))},void 0,n)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(e=>e()),i}},t.Relay=class{constructor(){this.listening=!1,this.inputEvent=l.None,this.inputEventListener=n.Disposable.None,this.emitter=new m({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},t.ValueWithChangeEvent=class{static const(e){return new y(e)}constructor(e){this._value=e,this._onDidChange=new m,this.onDidChange=this._onDidChange.event}get value(){return this._value}set value(e){e!==this._value&&(this._value=e,this._onDidChange.fire(void 0))}};class y{constructor(e){this.value=e,this.onDidChange=l.None}}},945(e,t,i){var s,r=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const o=i(5451),a=i(8938),l=i(3055),h=i(6501);class c extends o.AttributeData{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let d=s=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new l.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){const e=this._getJoinedRanges(s,o,n,t,r);for(let t=0;t1){const e=this._getJoinedRanges(s,o,n,t,r);for(let t=0;t=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},1073(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(5639),r=i(6168),n=i(5451),o=i(6107),a=i(732),l=i(3055),h=i(8938),c=i(8158),d=i(6760);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=l.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(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 n.ExtendedAttrs),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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){e??=o.DEFAULT_ATTR_DATA;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 s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 t=0;t0){const e=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,e)}this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=this._optionsService.rawOptions.reflowCursorLine,s=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA),i);if(s.length>0){const i=(0,a.reflowLargerCreateNewLayout)(this.lines,s);(0,a.reflowLargerApplyNewLayout)(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;l--){let h=this.lines.get(l);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const c=[h];for(;h.isWrapped&&l>0;)h=this.lines.get(--l),c.unshift(h);if(!i){const e=this.ybase+this.y;if(e>=l&&e0&&(r.push({start:l+c.length+n,newLines:p}),n+=p.length),c.push(...p);let g=u.length-1,m=u[g];0===m&&(g--,m=u[g]);let v=c.length-_-1,S=d;for(;v>=0;){const e=Math.min(S,m);if(void 0===c[g])break;if(c[g].copyCellsFrom(c[v],S-e,m-e,e,!0),m-=e,0===m&&(g--,m=u[g]),S-=e,0===S){v--;const e=Math.max(v,0);S=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t0;)0===this.ybase?this.y0){const e=[],t=[];for(let e=0;e=0;h--)if(a&&a.start>s+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(h--,a.newLines[e]);h++,e.push({index:s+1,amount:a.newLines.length}),l+=a.newLines.length,a=r[++o]}else this.lines.set(h,t[s--]);let h=0;for(let t=e.length-1;t>=0;t--)e[t].index+=h,this.lines.onInsertEmitter.fire(e[t]),h+=e[t].amount;const c=Math.max(0,i+n-this.lines.maxLength);c>0&&this.lines.onTrimEmitter.fire(c)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},1316(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.noBreakWhitespace=t.CodePointIterator=void 0,t.isFalsyOrWhitespace=function(e){return!e||"string"!=typeof e||0===e.trim().length},t.format=function(e,...t){return 0===t.length?e:e.replace(n,function(e,i){const s=parseInt(i,10);return isNaN(s)||s<0||s>=t.length?e:t[s]})},t.format2=function(e,t){return 0===Object.keys(t).length?e:e.replace(o,(e,i)=>t[i]??e)},t.htmlAttributeEncodeValue=function(e){return e.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return e})},t.escape=function(e){return e.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})},t.escapeRegExpCharacters=a,t.count=function(e,t){let i=0,s=e.indexOf(t);for(;-1!==s;)i++,s=e.indexOf(t,s+t.length);return i},t.truncate=function(e,t,i="…"){return e.length<=t?e:`${e.substr(0,t)}${i}`},t.truncateMiddle=function(e,t,i="…"){if(e.length<=t)return e;const s=Math.ceil(t/2)-i.length/2,r=Math.floor(t/2)-i.length/2;return`${e.substr(0,s)}${i}${e.substr(e.length-r)}`},t.trim=function(e,t=" "){return h(l(e,t),t)},t.ltrim=l,t.rtrim=h,t.convertSimple2RegExpPattern=function(e){return e.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")},t.stripWildcards=function(e){return e.replace(/\*/g,"")},t.createRegExp=function(e,t,i={}){if(!e)throw new Error("Cannot create regex from empty string");t||(e=a(e)),i.wholeWord&&(/\B/.test(e.charAt(0))||(e="\\b"+e),/\B/.test(e.charAt(e.length-1))||(e+="\\b"));let s="";return i.global&&(s+="g"),i.matchCase||(s+="i"),i.multiline&&(s+="m"),i.unicode&&(s+="u"),new RegExp(e,s)},t.regExpLeadsToEndlessLoop=function(e){return"^"!==e.source&&"^$"!==e.source&&"$"!==e.source&&"^\\s*$"!==e.source&&!(!e.exec("")||0!==e.lastIndex)},t.splitLines=function(e){return e.split(/\r\n|\r|\n/)},t.splitLinesIncludeSeparators=function(e){const t=[],i=e.split(/(\r\n|\r|\n)/);for(let e=0;e=0;i--){const t=e.charCodeAt(i);if(t!==s.CharCode.Space&&t!==s.CharCode.Tab)return i}return-1},t.replaceAsync=function(e,t,i){const s=[];let r=0;for(const n of e.matchAll(t)){if(s.push(e.slice(r,n.index)),void 0===n.index)throw new Error("match.index should be defined");r=n.index+n[0].length,s.push(i(n[0],...n.slice(1),n.index,e,n.groups))}return s.push(e.slice(r)),Promise.all(s).then(e=>e.join(""))},t.compare=function(e,t){return et?1:0},t.compareSubstring=c,t.compareIgnoreCase=function(e,t){return d(e,t,0,e.length,0,t.length)},t.compareSubstringIgnoreCase=d,t.isAsciiDigit=function(e){return e>=s.CharCode.Digit0&&e<=s.CharCode.Digit9},t.isLowerAsciiLetter=u,t.isUpperAsciiLetter=function(e){return e>=s.CharCode.A&&e<=s.CharCode.Z},t.equalsIgnoreCase=function(e,t){return e.length===t.length&&0===d(e,t)},t.startsWithIgnoreCase=function(e,t){const i=t.length;return!(t.length>e.length)&&0===d(e,t,0,i)},t.commonPrefixLength=function(e,t){const i=Math.min(e.length,t.length);let s;for(s=0;sn)return 1}const o=s-i,a=n-r;return oa?1:0}function d(e,t,i=0,s=e.length,r=0,n=t.length){for(;i=128||a>=128)return c(e.toLowerCase(),t.toLowerCase(),i,s,r,n);u(o)&&(o-=32),u(a)&&(a-=32);const l=o-a;if(0!==l)return l}const o=s-i,a=n-r;return oa?1:0}function u(e){return e>=s.CharCode.a&&e<=s.CharCode.z}function _(e){return 55296<=e&&e<=56319}function f(e){return 56320<=e&&e<=57343}function p(e,t){return t-56320+(e-55296<<10)+65536}function g(e,t,i){const s=e.charCodeAt(i);if(_(s)&&i+11){const s=e.charCodeAt(t-2);if(_(s))return p(s,i)}return i}(this._str,this._offset);return this._offset-=e>=r.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,e}nextCodePoint(){const e=g(this._str,this._len,this._offset);return this._offset+=e>=r.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,e}eol(){return this._offset>=this._len}},t.noBreakWhitespace=" "},1346(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(726),r=[];t.OscParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,s.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=r,this._id=-1,this._state=0}}};class n{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n._payloadLimit&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}t.OscHandler=n,n._payloadLimit=1e7},1433(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=i(9176),o=i(8938),a=i(3055),l=i(6501),h=i(4103),c=i(7098),d=i(945),u=i(6181),_=i(5451);let f=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,l,c,u,f,p){const g=[],m=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors;let S,b=e.getNoBgTrimmedLength();i&&b=M,N=P,U=this._workCell;if(m.length>0&&P===m[0][0]&&B){const s=m.shift(),r=this._isCellInSelection(s[0],t);for(C=s[0]+1;C=s[1],B?(x=!0,U=new d.JoinedCellData(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),N=s[1]-1,b=U.getWidth()):M=s[1]}const F=this._isCellInSelection(P,t),W=i&&P===a,K=I&&P>=f&&P<=p;let H=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,e=>{H=!0});let z=U.getChars()||o.WHITESPACE_CELL_CHAR;if(" "===z&&(U.isUnderline()||U.isOverline())&&(z=" "),T=b*c-u.get(z,U.isBold(),U.isItalic()),S){if(y&&(F&&A||!F&&!A&&U.bg===E)&&(F&&A&&v.selectionForeground||U.fg===D)&&U.extended.ext===L&&K===k&&T===R&&!W&&!x&&!H&&B){U.isInvisible()?w+=o.WHITESPACE_CELL_CHAR:w+=z,y++;continue}y&&(S.textContent=w),S=this._document.createElement("span"),y=0,w=""}else S=this._document.createElement("span");if(E=U.bg,D=U.fg,L=U.extended.ext,k=K,R=T,A=F,x&&a>=P&&a<=N&&(a=P),!this._coreService.isCursorHidden&&W&&this._coreService.isCursorInitialized)if(O.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&O.push("xterm-cursor-blink"),O.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":O.push("xterm-cursor-outline");break;case"block":O.push("xterm-cursor-block");break;case"bar":O.push("xterm-cursor-bar");break;case"underline":O.push("xterm-cursor-underline")}if(U.isBold()&&O.push("xterm-bold"),U.isItalic()&&O.push("xterm-italic"),U.isDim()&&O.push("xterm-dim"),w=U.isInvisible()?o.WHITESPACE_CELL_CHAR:U.getChars()||o.WHITESPACE_CELL_CHAR,U.isUnderline()&&(O.push(`xterm-underline-${U.extended.underlineStyle}`)," "===w&&(w=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let e=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&e<8&&(e+=8),S.style.textDecorationColor=v.ansi[e].css}U.isOverline()&&(O.push("xterm-overline")," "===w&&(w=" ")),U.isStrikethrough()&&O.push("xterm-strikethrough"),K&&(S.style.textDecoration="underline");let j=U.getFgColor(),$=U.getFgColorMode(),V=U.getBgColor(),q=U.getBgColorMode();const G=!!U.isInverse();if(G){const e=j;j=V,V=e;const t=$;$=q,q=t}let X,Y,Z,Q=!1;switch(this._decorationService.forEachDecorationAtCell(P,t,void 0,e=>{"top"!==e.options.layer&&Q||(e.backgroundColorRGB&&(q=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,X=e.backgroundColorRGB),e.foregroundColorRGB&&($=50331648,j=e.foregroundColorRGB.rgba>>8&16777215,Y=e.foregroundColorRGB),Q="top"===e.options.layer)}),!Q&&F&&(X=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,V=X.rgba>>8&16777215,q=50331648,Q=!0,v.selectionForeground&&($=50331648,j=v.selectionForeground.rgba>>8&16777215,Y=v.selectionForeground)),Q&&O.push("xterm-decoration-top"),q){case 16777216:case 33554432:Z=v.ansi[V],O.push(`xterm-bg-${V}`);break;case 50331648:Z=h.channels.toColor(V>>16,V>>8&255,255&V),this._addStyle(S,`background-color:#${(V>>>0).toString(16).padStart(6,"0")}`);break;default:G?(Z=v.foreground,O.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Z=v.background}switch(X||U.isDim()&&(X=h.color.multiplyOpacity(Z,.5)),$){case 16777216:case 33554432:U.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(S,Z,v.ansi[j],U,X,void 0)||O.push(`xterm-fg-${j}`);break;case 50331648:const e=h.channels.toColor(j>>16&255,j>>8&255,255&j);this._applyMinimumContrast(S,Z,e,U,X,Y)||this._addStyle(S,`color:#${j.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(S,Z,v.foreground,U,X,Y)||G&&O.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}O.length&&(S.className=O.join(" "),O.length=0),W||x||H||!B?S.textContent=w:y++,T!==this.defaultSpacing&&(S.style.letterSpacing=`${T}px`),g.push(S),P=N}return S&&y&&(S.textContent=w),g}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,u.treatGlyphAsBackgroundColor)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=h.color.ensureContrastRatio(r??t,n??i,e),o.setColor((r??t).rgba,(n??i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_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){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t=i[0]&&e=i[0])}};t.DomRendererRowFactory=f,t.DomRendererRowFactory=f=s([r(1,c.ICharacterJoinerService),r(2,l.IOptionsService),r(3,c.ICoreBrowserService),r(4,l.ICoreService),r(5,l.IDecorationService),r(6,c.IThemeService)],f)},1718(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserTerminal=void 0;const s=i(7861),r=i(7721),n=i(3285),o=i(4017),a=i(4196),l=i(9925),h=i(3618),c=i(3955),d=i(4792),u=i(945),_=i(9574),f=i(9820),p=i(9784),g=i(5783),m=i(2079),v=i(7098),S=i(9078),b=i(2136),y=i(4103),w=i(5777),C=i(701),E=i(6107),D=i(8693),L=i(4720),k=i(6501),R=i(2486),A=i(2840),T=i(8906),M=i(8636),O=i(7093),I=i(4812);class P extends w.CoreTerminal{get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}get dimensions(){if(!this._renderService)return;const e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}constructor(e={}){super(e),this._linkifier=this._register(new I.MutableDisposable),this.browser=C,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new I.MutableDisposable),this._onCursorMove=this._register(new M.Emitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new M.Emitter),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new M.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new M.Emitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new M.Emitter),this.onBell=this._onBell.event,this._onFocus=this._register(new M.Emitter),this._onBlur=this._register(new M.Emitter),this._onA11yCharEmitter=this._register(new M.Emitter),this._onA11yTabEmitter=this._register(new M.Emitter),this._onWillOpen=this._register(new M.Emitter),this._onDimensionsChange=this._register(new M.Emitter),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(k.IDecorationService,this._decorationService),this._keyboardService=this._instantiationService.createInstance(b.KeyboardService),this._instantiationService.setService(v.IKeyboardService,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(f.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(n.OscLinkProvider)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(M.EventUtils.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(M.EventUtils.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(M.EventUtils.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(M.EventUtils.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register((0,I.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:const s=y.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${i};${(0,D.toRgbString)(s)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=y.channels.toColor(...t.color));else{const i=e;this._themeService.modifyColors(e=>e[i]=y.channels.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;const e=y.rgb.relativeLuminance(this._themeService.colors.background.rgba>>8)>8)?1:2;this.coreService.triggerDataEvent(`[?997;${e}n`)}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(A.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register((0,O.addDisposableListener)(this.element,"copy",e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)}));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this._register((0,O.addDisposableListener)(this.textarea,"paste",e)),this._register((0,O.addDisposableListener)(this.element,"paste",e)),C.isFirefox?this._register((0,O.addDisposableListener)(this.element,"mousedown",e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register((0,O.addDisposableListener)(this.element,"contextmenu",e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),C.isLinux&&this._register((0,O.addDisposableListener)(this.element,"auxclick",e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register((0,O.addDisposableListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register((0,O.addDisposableListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register((0,O.addDisposableListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register((0,O.addDisposableListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.toggle("allow-transparency",this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange("allowTransparency",e=>this.element.classList.toggle("allow-transparency",e))),e.appendChild(this.element);const t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register((0,O.addDisposableListener)(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);const i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",r.promptLabel.get()),C.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??"undefined"!=typeof window?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this._register((0,O.addDisposableListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register((0,O.addDisposableListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(d.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(h.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService);const s=this._linkifier.value=this._register(this._instantiationService.createInstance(T.Linkifier,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(o.Viewport,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,s)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(M.EventUtils.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(a.BufferDecorationRenderer,this.screenElement)),this._register((0,O.addDisposableListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(A.AccessibilityManager,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService?.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case"mousemove":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":r=0,s=t.button<3?t.button:3;break;case"mousedown":r=1,s=t.button<3?t.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;const i=t.deltaY;if(0===i)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;r=i<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:e=>{i(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag))},wheel:e=>(i(e),e.preventDefault(),e.stopPropagation(),!1),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup??=r.mouseup:(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag??=r.mousedrag:(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register((0,I.toDisposable)(()=>{s.mouseup&&this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)})),this._register((0,O.addDisposableListener)(t,"mousedown",e=>{e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e)&&(i(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag))})),this._register((0,O.addDisposableListener)(t,"wheel",t=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(t))return!1;if(!this.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return t.preventDefault(),t.stopPropagation(),!1;const i=""+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(i,!0),t.preventDefault(),t.stopPropagation(),!1}}},{passive:!1}))}refresh(e,t,i=!1){this._renderService?.refreshRows(e,t,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===i.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e))return!0;if(i.cancel&&(e.preventDefault(),e.stopPropagation()),!i.key)return!0;if(!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;""!==i.key&&"\r"!==i.key||(this.textarea.value="");const s=this._keyboardService.useWin32InputMode&&x(e);if(this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!s),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;x(e)||this.focus();const t=this._keyboardService.evaluateKeyUp(e);if(t?.key){const i=this._keyboardService.useWin32InputMode&&x(e);this.coreService.triggerDataEvent(t.key,!i)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{const n=t.onCancellationRequested(()=>{n.dispose(),s(i)});e.then(s,r).finally(()=>n.dispose())})},t.raceCancellationError=function(e,t){return new Promise((i,s)=>{const n=t.onCancellationRequested(()=>{n.dispose(),s(new r.CancellationError)});e.then(i,s).finally(()=>n.dispose())})},t.raceCancellablePromises=async function(e){let t=-1;const i=e.map((e,i)=>e.then(e=>(t=i,e)));try{return await Promise.race(i)}finally{e.forEach((e,i)=>{i!==t&&e.cancel()})}},t.raceTimeout=function(e,t,i){let s;const r=setTimeout(()=>{s?.(void 0),i?.()},t);return Promise.race([e.finally(()=>clearTimeout(r)),new Promise(e=>s=e)])},t.asPromise=function(e){return new Promise((t,i)=>{const s=e();c(s)?s.then(t,i):t(s)})},t.promiseWithResolvers=u,t.timeout=g,t.disposableTimeout=function(e,t=0,i){const s=setTimeout(()=>{e(),i&&r.dispose()},t),r=(0,o.toDisposable)(()=>{clearTimeout(s),i?.deleteAndLeak(r)});return i?.add(r),r},t.sequence=function(e){const t=[];let i=0;const s=e.length;return Promise.resolve(null).then(function r(n){null!=n&&t.push(n);const o=i!!e,i=null){let s=0;const r=e.length,n=()=>{if(s>=r)return Promise.resolve(i);const o=e[s++];return Promise.resolve(o()).then(e=>t(e)?Promise.resolve(e):n())};return n()},t.firstParallel=function(e,t=e=>!!e,i=null){if(0===e.length)return Promise.resolve(i);let s=e.length;const r=()=>{s=-1;for(const t of e)t.cancel?.()};return new Promise((n,o)=>{for(const a of e)a.then(e=>{--s>=0&&t(e)?(r(),n(e)):0===s&&n(i)}).catch(e=>{--s>=0&&(r(),o(e))})})},t.retry=async function(e,t,i){let s;for(let r=0;r{const s=t.token.onCancellationRequested(()=>{s.dispose(),t.dispose(),e.reject(new r.CancellationError)});try{for await(const s of i){if(t.token.isCancellationRequested)return;e.emitOne(s)}s.dispose(),t.dispose()}catch(i){s.dispose(),t.dispose(),e.reject(i)}})};const s=i(8447),r=i(9807),n=i(802),o=i(7150),a=i(8163),l=i(5015),h=i(626);function c(e){return!!e&&"function"==typeof e.then}function d(e){const t=new s.CancellationTokenSource,i=e(t.token),n=new Promise((e,s)=>{const n=t.token.onCancellationRequested(()=>{n.dispose(),s(new r.CancellationError)});Promise.resolve(i).then(i=>{n.dispose(),t.dispose(),e(i)},e=>{n.dispose(),t.dispose(),s(e)})});return new class{cancel(){t.cancel(),t.dispose()}then(e,t){return n.then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return n.finally(e)}}}function u(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),resolve:e,reject:t}}class _{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const e=()=>{if(this.queuedPromise=null,this.isDisposed)return;const e=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,e};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=e(),new Promise((e,t)=>{this.activePromise.then(t=>{this.activePromise=null,e(t)},e=>{this.activePromise=null,t(e)})})}dispose(){this.isDisposed=!0}}t.Throttler=_,t.Sequencer=class{constructor(){this.current=Promise.resolve(null)}queue(e){return this.current=this.current.then(()=>e(),()=>e())}},t.SequencerByKey=class{constructor(){this.promiseMap=new Map}queue(e,t){const i=(this.promiseMap.get(e)??Promise.resolve()).catch(()=>{}).then(t).finally(()=>{this.promiseMap.get(e)===i&&this.promiseMap.delete(e)});return this.promiseMap.set(e,i),i}};class f{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((e,t)=>{this.doResolve=e,this.doReject=t}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const e=this.task;return this.task=null,e()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===l.MicrotaskDelay?(e=>{let t=!0;return queueMicrotask(()=>{t&&(t=!1,e())}),{isTriggered:()=>t,dispose:()=>{t=!1}}})(i):((e,t)=>{let i=!0;const s=setTimeout(()=>{i=!1,t()},e);return{isTriggered:()=>i,dispose:()=>{clearTimeout(s),i=!1}}})(t,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new r.CancellationError),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}t.Delayer=f,t.ThrottledDelayer=class{constructor(e){this.delayer=new f(e),this.throttler=new _}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}};class p{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}}function g(e,t){return t?new Promise((i,s)=>{const n=setTimeout(()=>{o.dispose(),i()},e),o=t.onCancellationRequested(()=>{clearTimeout(n),o.dispose(),s(new r.CancellationError)})}):d(t=>g(e,t))}t.Barrier=p,t.AutoOpenBarrier=class extends p{constructor(e){super(),this._timeout=setTimeout(()=>this.open(),e)}open(){clearTimeout(this._timeout),super.open()}};class m{constructor(e){this._size=0,this._isDisposed=!1,this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new n.Emitter}whenIdle(){return this.size>0?n.Event.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(e){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((t,i)=>{this.outstandingPromises.push({factory:e,c:t,e:i}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,0===--this._size&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}}t.Limiter=m,t.Queue=class extends m{constructor(){super(1)}},t.LimitedQueue=class{constructor(){this.sequentializer=new y,this.tasks=0}queue(e){return this.sequentializer.isRunning()?this.sequentializer.queue(()=>this.sequentializer.run(this.tasks++,e())):this.sequentializer.run(this.tasks++,e())}},t.TimeoutTimer=class{constructor(e,t){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new r.BugIndicatingError("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new r.BugIndicatingError("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},t.IntervalTimer=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new r.BugIndicatingError("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const s=i.setInterval(()=>{e()},t);this.disposable=(0,o.toDisposable)(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};class v{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return-1!==this.timeoutToken}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}}t.RunOnceScheduler=v,t.ProcessTimeRunOnceScheduler=class{constructor(e,t){t%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.runner=e,this.timeout=t,this.counter=0,this.intervalToken=-1,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=-1)}schedule(e=this.timeout){e%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(e/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return-1!==this.intervalToken}onInterval(){this.counter--,this.counter>0||(clearInterval(this.intervalToken),this.intervalToken=-1,this.runner?.())}},t.RunOnceWorker=class extends v{constructor(e,t){super(e,t),this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){const e=this.units;this.units=[],this.runner?.(e)}dispose(){this.units=[],super.dispose()}};class S extends o.Disposable{constructor(e,t){super(),this.options=e,this.handler=t,this.pendingWork=[],this.throttler=this._register(new o.MutableDisposable),this.disposed=!1}get pending(){return this.pendingWork.length}work(e){if(this.disposed)return!1;if("number"==typeof this.options.maxBufferedWork)if(this.throttler.value){if(this.pending+e.length>this.options.maxBufferedWork)return!1}else if(this.pending+e.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1;for(const t of e)this.pendingWork.push(t);return this.throttler.value||this.doWork(),!0}doWork(){this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&(this.throttler.value=new v(()=>{this.throttler.clear(),this.doWork()},this.options.throttleDelay),this.throttler.value.schedule())}dispose(){super.dispose(),this.disposed=!0}}t.ThrottledWorker=S,"function"!=typeof globalThis.requestIdleCallback||"function"!=typeof globalThis.cancelIdleCallback?t._runWhenIdle=(e,t)=>{(0,a.setTimeout0)(()=>{if(i)return;const e=Date.now()+15,s={didTimeout:!0,timeRemaining:()=>Math.max(0,e-Date.now())};t(Object.freeze(s))});let i=!1;return{dispose(){i||(i=!0)}}}:t._runWhenIdle=(e,t,i)=>{const s=e.requestIdleCallback(t,"number"==typeof i?{timeout:i}:void 0);let r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},t.runWhenGlobalIdle=e=>(0,t._runWhenIdle)(globalThis,e);class b{constructor(e,i){this._didRun=!1,this._executor=()=>{try{this._value=i()}catch(e){this._error=e}finally{this._didRun=!0}},this._handle=(0,t._runWhenIdle)(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}t.AbstractIdleValue=b,t.GlobalIdleValue=class extends b{constructor(e){super(globalThis,e)}};class y{isRunning(e){return"number"==typeof e?this._running?.taskId===e:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(e,t,i){return this._running={taskId:e,cancel:()=>i?.(),promise:t},t.then(()=>this.doneRunning(e),()=>this.doneRunning(e)),t}doneRunning(e){this._running&&e===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){const e=this._queued;this._queued=void 0,e.run().then(e.promiseResolve,e.promiseReject)}}queue(e){if(this._queued)this._queued.run=e;else{const{promise:t,resolve:i,reject:s}=u();this._queued={run:e,promise:t,promiseResolve:i,promiseReject:s}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}}var w,C,E;t.TaskSequentializer=y,t.IntervalCounter=class{constructor(e,t=()=>Date.now()){this.interval=e,this.nowFn=t,this.lastIncrementTime=0,this.value=0}increment(){const e=this.nowFn();return e-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=e,this.value=0),this.value++,this.value}},function(e){e[e.Resolved=0]="Resolved",e[e.Rejected=1]="Rejected"}(w||(w={}));class D{get isRejected(){return this.outcome?.outcome===w.Rejected}get isResolved(){return this.outcome?.outcome===w.Resolved}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===w.Resolved?this.outcome?.value:void 0}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return new Promise(t=>{this.completeCallback(e),this.outcome={outcome:w.Resolved,value:e},t()})}error(e){return new Promise(t=>{this.errorCallback(e),this.outcome={outcome:w.Rejected,value:e},t()})}cancel(){return this.error(new r.CancellationError)}}t.DeferredPromise=D,function(e){e.settled=async function(e){let t;const i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(void 0!==t)throw t;return i},e.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(e){i(e)}})}}(C||(t.Promises=C={}));class L{get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}constructor(e){this._value=void 0,this._error=void 0,this._isResolved=!1,this.promise=e.then(e=>(this._value=e,this._isResolved=!0,e),e=>{throw this._error=e,this._isResolved=!0,e})}requireValue(){if(!this._isResolved)throw new r.BugIndicatingError("Promise is not resolved yet");if(this._error)throw this._error;return this._value}}t.StatefulPromise=L,t.LazyStatefulPromise=class{constructor(e){this._compute=e,this._promise=new h.Lazy(()=>new L(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}},function(e){e[e.Initial=0]="Initial",e[e.DoneOK=1]="DoneOK",e[e.DoneError=2]="DoneError"}(E||(E={}));class k{static fromArray(e){return new k(t=>{t.emitMany(e)})}static fromPromise(e){return new k(async t=>{t.emitMany(await e)})}static fromPromises(e){return new k(async t=>{await Promise.all(e.map(async e=>t.emitOne(await e)))})}static merge(e){return new k(async t=>{await Promise.all(e.map(async e=>{for await(const i of e)t.emitOne(i)}))})}static{this.EMPTY=k.fromArray([])}constructor(e,t){this._state=E.Initial,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new n.Emitter,queueMicrotask(async()=>{const t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(this._state===E.DoneError)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new k(async i=>{for await(const s of e)i.emitOne(t(s))})}map(e){return k.map(this,e)}static filter(e,t){return new k(async i=>{for await(const s of e)t(s)&&i.emitOne(s)})}filter(e){return k.filter(this,e)}static coalesce(e){return k.filter(e,e=>!!e)}coalesce(){return k.coalesce(this)}static async toPromise(e){const t=[];for await(const i of e)t.push(i);return t}toPromise(){return k.toPromise(this)}emitOne(e){this._state===E.Initial&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===E.Initial&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===E.Initial&&(this._state=E.DoneOK,this._onStateChanged.fire())}reject(e){this._state===E.Initial&&(this._state=E.DoneError,this._error=e,this._onStateChanged.fire())}}t.AsyncIterableObject=k;class R extends k{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}t.CancelableAsyncIterableObject=R,t.AsyncIterableSource=class{constructor(e){let t,i;this._deferred=new D,this._asyncIterable=new k(e=>{if(!t)return i&&e.emitMany(i),this._errorFn=t=>e.reject(t),this._emitFn=t=>e.emitOne(t),this._deferred.p;e.reject(t)},e),this._emitFn=e=>{i||(i=[]),i.push(e)},this._errorFn=e=>{t||(t=e)}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(e){this._errorFn(e),this._deferred.complete()}emitOne(e){this._emitFn(e)}}},2079(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=i(5251),o=i(9686),a=i(5959),l=i(7098),h=i(4812),c=i(701),d=i(9384),u=i(3055),_=i(6501),f=i(8636),p=String.fromCharCode(160),g=new RegExp(p,"g");let m=class extends h.Disposable{constructor(e,t,i,s,r,n,o,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new f.Emitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new f.Emitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new f.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new f.Emitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this._register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const r=e[0]e.replace(g," ")).join(c.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),c.isLinux&&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:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){const i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return c.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_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){const t=this.hasSelection;if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0,t&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);const i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(c.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),l=a;const h=e[0]-a;let c=0,d=0,u=0,_=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l1&&(_+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(c++,t--):e>1&&(u+=e-1,a-=e-1),a--,t--}for(;i1&&(_+=e-1,l+=e-1),l++,i++}}l++;let f=a+h-c+u,p=Math.min(this._bufferService.cols,l-a+c+d-u-_);if(t||""!==o.slice(a,l).trim()){if(i&&0===f&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,p+=e}}}if(s&&f+p===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if(t?.isWrapped&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(p+=t.length)}}return{start:f,length:p}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=(0,d.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=m,t.SelectionService=m=s([r(3,_.IBufferService),r(4,_.ICoreService),r(5,l.IMouseService),r(6,_.IOptionsService),r(7,l.IRenderService),r(8,l.ICoreBrowserService)],m)},2136(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardService=void 0;const n=i(706),o=i(7241),a=i(9249),l=i(701),h=i(6501);let c=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??=new a.Win32InputMode,this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??=new o.KittyKeyboard,this._kittyKeyboard}evaluateKeyDown(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!0);const t=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(e,t,e.repeat?2:1):(0,n.evaluateKeyboardEvent)(e,this._coreService.decPrivateModes.applicationCursorKeys,l.isMac,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!1);const t=this._coreService.kittyKeyboard.flags;return this.useKitty&&2&t?this._getKittyKeyboard().evaluate(e,t,3):void 0}get useKitty(){const e=this._coreService.kittyKeyboard.flags;return!(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard||!o.KittyKeyboard.shouldUseProtocol(e))}get useWin32InputMode(){return!(!this._optionsService.rawOptions.vtExtensions?.win32InputMode||!this._coreService.decPrivateModes.win32InputMode)}};t.KeyboardService=c,t.KeyboardService=c=s([r(0,h.ICoreService),r(1,h.IOptionsService)],c)},2274(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=function(){return new i};class i{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&t=this.startCol)}}},2486(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0,t.isValidColorIndex=R;const n=i(6760),o=i(6717),a=i(4812),l=i(726),h=i(6107),c=i(8938),d=i(3055),u=i(5451),_=i(6501),f=i(6415),p=i(1346),g=i(9823),m=i(2607),v=i(8693),S=i(8636),b=i(7804),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},w=131072;function C(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var E;!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(E||(t.WindowsOptionsReportType=E={}));let D=0;class L extends a.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,i,s,r,a,c,d,u=new o.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=a,this._coreMouseService=c,this._unicodeService=d,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this._register(new S.Emitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new S.Emitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new S.Emitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new S.Emitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new S.Emitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new S.Emitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new S.Emitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new S.Emitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new S.Emitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new S.Emitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new S.Emitter),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new S.Emitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new S.Emitter),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new S.Emitter),this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new k(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"^"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({prefix:">",final:"q"},e=>this.sendXtVersion(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},e=>this.kittyKeyboardSet(e)),this._parser.registerCsiHandler({prefix:"?",final:"u"},e=>this.kittyKeyboardQuery(e)),this._parser.registerCsiHandler({prefix:">",final:"u"},e=>this.kittyKeyboardPush(e)),this._parser.registerCsiHandler({prefix:"<",final:"u"},e=>this.kittyKeyboardPop(e)),this._parser.setExecuteHandler("",()=>this.bell()),this._parser.setExecuteHandler("\n",()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler("\t",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("„",()=>this.index()),this._parser.setExecuteHandler("…",()=>this.nextLine()),this._parser.setExecuteHandler("ˆ",()=>this.tabSet()),this._parser.registerOscHandler(0,new p.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new p.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new p.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new p.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new p.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new p.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new p.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new p.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new p.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new p.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new p.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new p.OscHandler(e=>this.restoreCursorColor(e))),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(const e in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:e},()=>this.selectCharset("("+e)),this._parser.registerEscHandler({intermediates:")",final:e},()=>this.selectCharset(")"+e)),this._parser.registerEscHandler({intermediates:"*",final:e},()=>this.selectCharset("*"+e)),this._parser.registerEscHandler({intermediates:"+",final:e},()=>this.selectCharset("+"+e)),this._parser.registerEscHandler({intermediates:"-",final:e},()=>this.selectCharset("-"+e)),this._parser.registerEscHandler({intermediates:".",final:e},()=>this.selectCharset("."+e)),this._parser.registerEscHandler({intermediates:"/",final:e},()=>this.selectCharset("/"+e));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){if(this._logService.logLevel<=_.LogLevelEnum.WARN){let t;const i=new Promise((e,i)=>{t=setTimeout(()=>i("#SLOW_TIMEOUT"),5e3)});Promise.race([e,i]).then(()=>{void 0!==t&&clearTimeout(t)},e=>{if(void 0!==t&&clearTimeout(t),"#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>w&&(n=this._parseStack.position+w)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),this._logService.logLevel===_.LogLevelEnum.TRACE&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthw)for(let t=n;t0&&2===p.getWidth(this._activeBuffer.x-1)&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let g=this._parser.precedingJoinState;for(let m=t;ma)if(d){const e=p;let t=this._activeBuffer.x-v;if(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!p)return;for(v>0&&p instanceof h.BufferLine&&p.copyCellsFrom(e,t,0,v,!1);t=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(u&&(p.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(_)),2===p.getWidth(a-1)&&p.setCellFromCodepoint(a-1,c.NULL_CELL_CODE,c.NULL_CELL_WIDTH,_)),p.setCellFromCodepoint(this._activeBuffer.x++,s,r,_),r>0)for(;--r;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=g,this._activeBuffer.x0&&0===p.getWidth(this._activeBuffer.x)&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!C(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new g.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new p.OscHandler(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new m.ApcHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const 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(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1))}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i=this._bufferService.cols){const e=this._activeBuffer.lines.get(i+1);e&&(e.isWrapped=!1)}for(;i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--;){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);if(e?.getTrimmedLength())break}for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.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 e=1;e0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent(`P>|xterm.js(${b.XTERM_VERSION})\\`),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}setMode(e){for(let t=0;t(n.triggerDataEvent(`[${t?"":"?"}${e};${i}$y`),!0),u=e=>e?1:2,_=e.params[0];return t?d(_,2===_?4:4===_?u(n.modes.insertMode):12===_?3:20===_?u(c.convertEol):0):1===_?d(_,u(i.applicationCursorKeys)):3===_?d(_,c.windowOptions.setWinLines?80===a?2:132===a?1:0:0):6===_?d(_,u(i.origin)):7===_?d(_,u(i.wraparound)):8===_?d(_,3):9===_?d(_,u("X10"===s)):12===_?d(_,u(c.cursorBlink)):25===_?d(_,u(!n.isCursorHidden)):45===_?d(_,u(i.reverseWraparound)):66===_?d(_,u(i.applicationKeypad)):67===_?d(_,4):1e3===_?d(_,u("VT200"===s)):1002===_?d(_,u("DRAG"===s)):1003===_?d(_,u("ANY"===s)):1004===_?d(_,u(i.sendFocus)):1005===_?d(_,4):1006===_?d(_,u("SGR"===r)):1015===_?d(_,4):1016===_?d(_,u("SGR_PIXELS"===r)):1048===_?d(_,1):47===_||1047===_||1049===_?d(_,u(l===h)):2004===_?d(_,u(i.bracketedPasteMode)):2026===_?d(_,u(i.synchronizedOutput)):9001===_&&this._optionsService.rawOptions.vtExtensions?.win32InputMode?d(_,u(i.win32InputMode)):d(_,0)}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=u.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=h.DEFAULT_ATTR_DATA.fg,e.bg=h.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825:221===i&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??1)?s.fg&=-134217729:222===i&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??1)?s.bg&=-134217729:59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("");break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[${e};${t}R`)}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${t}R`);break;case 15:case 25:case 26:case 53:break;case 996:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??1)&&this._onRequestColorSchemeQuery.fire()}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=0===e.length?1:e.params[0];if(0===t)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}const e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!C(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(E.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(E.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let e=0;e1;){const e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){const i=parseInt(e);if(R(i))if("?"===s)t.push({type:0,index:i});else{const e=(0,v.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.indexOf(";");if(-1===t)return!0;const i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(":");let s;const r=i.findIndex(e=>e.startsWith("id="));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(";");for(let e=0;e=this._specialColors.length);++e,++t)if("?"===i[e])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const s=(0,v.parseColor)(i[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(";");for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new d.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${e}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=e.params[0]||0,i=e.params[1]||1,s=this._coreService.kittyKeyboard;switch(i){case 1:s.flags=t;break;case 2:s.flags|=t;break;case 3:s.flags&=~t}return!0}kittyKeyboardQuery(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${t}u`),!0}kittyKeyboardPush(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=e.params[0]||0,i=this._coreService.kittyKeyboard,s=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;return s.length>=16&&s.shift(),s.push(i.flags),i.flags=t,!0}kittyKeyboardPop(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=Math.max(1,e.params[0]||1),i=this._coreService.kittyKeyboard,s=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;for(let e=0;e0;e++)i.flags=s.pop();return 0===s.length&&t>0&&(i.flags=0),!0}}t.InputHandler=L;let k=class{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&&(D=e,e=t,t=D),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function R(e){return 0<=e&&e<256}k=s([r(0,_.IBufferService)],k)},2607(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ApcHandler=t.ApcParser=void 0;const s=i(726),r=[];t.ApcParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,s.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){3!==this._state&&(1===this._state&&t0&&this._put(e,t,i))}end(e,t=!0){if(0!==this._state){if(3!==this._state){if(1===this._state)return this._active=r,this._id=-1,void(this._state=0);if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e)}this._active=r,this._id=-1,this._state=0}}};class n{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n._payloadLimit&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}t.ApcHandler=n,n._payloadLimit=1e7},2608(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.SetMap=t.BidirectionalMap=t.CounterSet=t.Touch=void 0,t.getOrSet=function(e,t,i){let s=e.get(t);return void 0===s&&(s=i,e.set(t,s)),s},t.mapToString=function(e){const t=[];return e.forEach((e,i)=>{t.push(`${i} => ${e}`)}),`Map(${e.size}) {${t.join(", ")}}`},t.setToString=function(e){const t=[];return e.forEach(e=>{t.push(e)}),`Set(${e.size}) {${t.join(", ")}}`},t.mapsStrictEqualIgnoreOrder=function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;for(const[i]of t)if(!e.has(i))return!1;return!0},function(e){e[e.None=0]="None",e[e.AsOld=1]="AsOld",e[e.AsNew=2]="AsNew"}(i||(t.Touch=i={})),t.CounterSet=class{constructor(){this.map=new Map}add(e){return this.map.set(e,(this.map.get(e)||0)+1),this}delete(e){let t=this.map.get(e)||0;return 0!==t&&(t--,0===t?this.map.delete(e):this.map.set(e,t),!0)}has(e){return this.map.has(e)}},t.BidirectionalMap=class{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(const[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){const t=this._m1.get(e);return void 0!==t&&(this._m1.delete(e),this._m2.delete(t),!0)}forEach(e,t){this._m1.forEach((i,s)=>{e.call(t,i,s,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},t.SetMap=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),0===i.size&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}}},2744(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0;const s=i(6181);t.WidthCache=class{constructor(e=()=>new r){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._canvasElements=[],this._canvasElements=[e(),e(),e(),e()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._canvasElements[0].setFont(e,t,i,!1),this._canvasElements[1].setFont(e,t,s,!1),this._canvasElements[2].setFont(e,t,i,!0),this._canvasElements[3].setFont(e,t,s,!0),this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];const t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){return this._canvasElements[t].measure(e)}};class r{constructor(){"undefined"!=typeof OffscreenCanvas?(this._canvas=new OffscreenCanvas(1,1),this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d")))}setFont(e,t,i,s){const r=s?"italic":"";this._ctx.font=`${r} ${i} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}}},2811(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvedKeybinding=t.ResolvedChord=t.Keybinding=t.ScanCodeChord=t.KeyCodeChord=void 0,t.decodeKeybinding=function(e,t){if("number"==typeof e){if(0===e)return null;const i=(65535&e)>>>0,s=(4294901760&e)>>>16;return new c(0!==s?[a(i,t),a(s,t)]:[a(i,t)])}{const i=[];for(let s=0;s=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=i(7721),o=i(4292),a=i(4812),l=i(7098),h=i(6501),c=i(7093);let d=class extends a.Disposable{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";const r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new o.TimeBasedDebouncer(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register((0,c.addDisposableListener)(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register((0,a.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent=n.tooMuchOutput.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.lines.get(i.ydisp+r),t=[],n=e?.translateToString(!0,void 0,void 0,t)||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===n.tooMuchOutput.get()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;const r=({node:e,offset:t})=>{const i=e instanceof Text?e.parentNode:e;let s=parseInt(i?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;const r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t=this._terminal.cols&&(++s,n=0),{row:s,column:n}},n=r(t),o=r(i);if(n&&o){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,s.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},3058(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Permutation=t.CallbackIterable=t.ArrayQueue=t.booleanComparator=t.numberComparator=t.CompareResult=void 0,t.tail=function(e,t=0){return e[e.length-(1+t)]},t.tail2=function(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]},t.equals=function(e,t,i=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(let s=0,r=e.length;si(e[s],t))},t.binarySearch2=n,t.quickSelect=function e(t,i,s){if((t|=0)>=i.length)throw new TypeError("invalid index");const r=i[Math.floor(i.length*Math.random())],n=[],o=[],a=[];for(const e of i){const t=s(e,r);t<0?n.push(e):t>0?o.push(e):a.push(e)}return t{(async()=>{const o=e.length,l=e.slice(0,i).sort(t);for(let h=i,c=Math.min(i+r,o);hi&&await new Promise(e=>setTimeout(e)),n&&n.isCancellationRequested)throw new s.CancellationError;a(e,t,l,h,c)}return l})().then(o,l)})},t.coalesce=function(e){return e.filter(e=>!!e)},t.coalesceInPlace=function(e){let t=0;for(let i=0;i0},t.distinct=function(e,t=e=>e){const i=new Set;return e.filter(e=>{const s=t(e);return!i.has(s)&&(i.add(s),!0)})},t.uniqueFilter=function(e){const t=new Set;return i=>{const s=e(i);return!t.has(s)&&(t.add(s),!0)}},t.firstOrDefault=function(e,t){return e.length>0?e[0]:t},t.lastOrDefault=function(e,t){return e.length>0?e[e.length-1]:t},t.commonPrefixLength=function(e,t,i=(e,t)=>e===t){let s=0;for(let r=0,n=Math.min(e.length,t.length);rt;e--)s.push(e);return s},t.index=function(e,t,i){return e.reduce((e,s)=>(e[t(s)]=i?i(s):s,e),Object.create(null))},t.insert=function(e,t){return e.push(t),()=>l(e,t)},t.remove=l,t.arrayInsert=function(e,t,i){const s=e.slice(0,t),r=e.slice(t);return s.concat(i,r)},t.shuffle=function(e,t){let i;if("number"==typeof t){let e=t;i=()=>{const t=179426549*Math.sin(e++);return t-Math.floor(t)}}else i=Math.random;for(let t=e.length-1;t>0;t-=1){const s=Math.floor(i()*(t+1)),r=e[t];e[t]=e[s],e[s]=r}},t.pushToStart=function(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))},t.pushToEnd=function(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))},t.pushMany=function(e,t){for(const i of t)e.push(i)},t.mapArrayOrNot=function(e,t){return Array.isArray(e)?e.map(t):t(e)},t.asArray=function(e){return Array.isArray(e)?e:[e]},t.getRandomElement=function(e){return e[Math.floor(Math.random()*e.length)]},t.insertInto=h,t.splice=function(e,t,i,s){const r=c(e,t);let n=e.splice(r,i);return void 0===n&&(n=[]),h(e,r,s),n},t.compareBy=function(e,t){return(i,s)=>t(e(i),e(s))},t.tieBreakComparators=function(...e){return(t,i)=>{for(const s of e){const e=s(t,i);if(!d.isNeitherLessOrGreaterThan(e))return e}return d.neitherLessOrGreaterThan}},t.reverseOrder=function(e){return(t,i)=>-e(t,i)};const s=i(9807),r=i(8297);function n(e,t){let i=0,s=e-1;for(;i<=s;){const e=(i+s)/2|0,r=t(e);if(r<0)i=e+1;else{if(!(r>0))return e;s=e-1}}return-(i+1)}function o(e,t,i){const s=[];function r(e,t,i){if(0===t&&0===i.length)return;const r=s[s.length-1];r&&r.start+r.deleteCount===e?(r.deleteCount+=t,r.toInsert.push(...i)):s.push({start:e,deleteCount:t,toInsert:i})}let n=0,o=0;for(;;){if(n===e.length){r(n,0,t.slice(o));break}if(o===t.length){r(n,e.length-n,[]);break}const s=e[n],a=t[o],l=i(s,a);0===l?(n+=1,o+=1):l<0?(r(n,1,[]),n+=1):l>0&&(r(n,0,[a]),o+=1)}return s}function a(e,t,i,s,n){for(const o=i.length;st(n,e)<0);i.splice(e,0,n)}}}function l(e,t){const i=e.indexOf(t);if(i>-1)return e.splice(i,1),t}function h(e,t,i){const s=c(e,t),r=e.length,n=i.length;e.length=r+n;for(let t=r-1;t>=s;t--)e[t+n]=e[t];for(let t=0;t0},e.isNeitherLessOrGreaterThan=function(e){return 0===e},e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0}(d||(t.CompareResult=d={})),t.numberComparator=(e,t)=>e-t,t.booleanComparator=(e,i)=>(0,t.numberComparator)(e?1:0,i?1:0),t.ArrayQueue=class{constructor(e){this.items=e,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(0!==this.length)return this.items[this.firstIdx]}peekLast(){if(0!==this.length)return this.items[this.lastIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}removeLast(){const e=this.items[this.lastIdx];return this.lastIdx--,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}};class u{static{this.empty=new u(e=>{})}constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new u(t=>this.iterate(i=>!e(i)||t(i)))}map(e){return new u(t=>this.iterate(i=>t(e(i))))}some(e){let t=!1;return this.iterate(i=>(t=e(i),!t)),t}findFirst(e){let t;return this.iterate(i=>!e(i)||(t=i,!1)),t}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(s=>((i||d.isGreaterThan(e(s,t)))&&(i=!1,t=s),!0)),t}}t.CallbackIterable=u;class _{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((i,s)=>t(e[i],e[s]));return new _(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;tthis._flushInserted()),this._insertedValues.push(e)}_flushInserted(){const e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t));let t=0,i=0;const s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(r=this._search(t),-1===r)return!1;if(this._getKey(this._array[r])!==t)return!1;do{if(this._array[r]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(r),!0}while(++re-t);let t=0;const i=new Array(this._array.length-e.length);let s=0;for(let r=0;r0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{yield this._array[r]}while(++r=this._array.length)&&this._getKey(this._array[r])===e))do{t(this._array[r])}while(++r=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},3235(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const s=i(793),r=i(3055);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3285(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=i(3055),o=i(6501);let a=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i,this._workCell=new n.CellData}provideLinks(e,t){const i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,n=this._workCell,o=i.getTrimmedLength();let a=-1,h=-1,c=!1;for(let t=0;tr?r.activate(e,t,n):l(0,t),hover:(e,t)=>r?.hover?.(e,t,n),leave:(e,t)=>r?.leave?.(e,t,n)})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=t,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=a,t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a)},3562(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const s=i(4812),r=i(8636);class n extends s.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new r.Emitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._isSyncWriting)return;let e;for(this._isSyncWriting=!0;e=this._writeBuffer.shift();){this._action(e);const t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>performance.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}t.WriteBuffer=n},3618(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=i(7098),o=i(6501);let a=class{get isComposing(){return this._isComposing}constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;const e=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){const t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0),0)}}};t.CompositionHelper=a,t.CompositionHelper=a=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],a)},3955(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=i(1433),o=i(2744),a=i(9176),l=i(6181),h=i(2274),c=i(7098),d=i(4103),u=i(4812),_=i(6501),f=i(8636),p=i(7093),g="xterm-dom-renderer-owner-",m="xterm-rows",v="xterm-fg-",S="xterm-bg-",b="xterm-focus",y="xterm-selection",w="xterm-cursor-blink-idle";let C=1,E=class extends u.Disposable{constructor(e,t,i,s,r,a,c,d,_,v,S,b,w,E){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=a,this._linkifier2=c,this._charSizeService=_,this._optionsService=v,this._bufferService=S,this._coreService=b,this._coreBrowserService=w,this._themeService=E,this._terminalClass=C++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this._register(new f.Emitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(m),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._cursorBlinkStateManager=new D(this._rowContainer,this._coreBrowserService),this._register((0,p.addDisposableListener)(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register((0,u.toDisposable)(()=>this._cursorBlinkStateManager.dispose())),this._register((0,u.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new o.WidthCache,this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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(const e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${m} 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} .${m} { 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} .${m} .xterm-dim { color: ${d.color.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;}`;const i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${m}.${w} .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[i,s]of e.ansi.entries())t+=`${this._terminalSelector} .${v}${i} { color: ${s.css}; }${this._terminalSelector} .${v}${i}.xterm-dim { color: ${d.color.multiplyOpacity(s,.5).css}; }${this._terminalSelector} .${S}${i} { background-color: ${s.css}; }`;t+=`${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${S}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){const e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}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(b),this._cursorBlinkStateManager.pause(),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this._cursorBlinkStateManager.resume(),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection)return;const s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,l=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));const h=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,h)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width;let o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+i.ydisp,t=this._rowElements[l],h=i.lines.get(e);if(!t||!h)break;t.replaceChildren(...this._rowFactory.createRow(h,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,l=a.ybase+a.y,h=Math.min(a.x,r-1),c=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=i;o<=s;++o){const _=o+a.ydisp,f=this._rowElements[o],p=a.lines.get(_);if(!f||!p)break;f.replaceChildren(...this._rowFactory.createRow(p,_,_===l,d,u,h,c,this.dimensions.css.cell.width,this._widthCache,n?o===i?e:0:-1,n?(o===s?t:r)-1:-1))}}};t.DomRenderer=E,t.DomRenderer=E=s([r(7,_.IInstantiationService),r(8,c.ICharSizeService),r(9,_.IOptionsService),r(10,_.IBufferService),r(11,_.ICoreService),r(12,c.ICoreBrowserService),r(13,c.IThemeService)],E);class D{constructor(e,t){this._rowContainer=e,this._coreBrowserService=t,this._isIdlePaused=!1,this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove(w),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove(w),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add(w),this._isIdlePaused=!0,this._idleTimeout=void 0}}},4017(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=i(7098),o=i(4812),a=i(6501),l=i(7093),h=i(8234),c=i(8636),d=i(9881),u=i(8594);let _=class extends o.Disposable{constructor(e,t,i,s,r,n,a,_){super(),this._bufferService=i,this._optionsService=a,this._renderService=_,this._onRequestScrollLines=this._register(new c.Emitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;const f=this._register(new d.Scrollable({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>(0,l.scheduleAtNextAnimationFrame)(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new h.SmoothScrollableElement(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(c.EventUtils.runAndSubscribe(n.onChangeColors,()=>{e.style.backgroundColor=n.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register((0,o.toDisposable)(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register((0,o.toDisposable)(()=>this._styleElement.remove())),this._register(c.EventUtils.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")})),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(e=>this._handleScroll(e))),this._register(u.Gesture.addTarget(t)),this._register((0,l.addDisposableListener)(t,u.EventType.Change,e=>this._handleGestureChange(e)))}scrollLines(e){const t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){this._renderService&&!this._isSyncing&&(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService)return;if(this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;const t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}_handleGestureChange(e){e.preventDefault(),e.stopPropagation();const t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e.translationY})}};t.Viewport=_,t.Viewport=_=s([r(2,a.IBufferService),r(3,n.ICoreBrowserService),r(4,a.ICoreMouseService),r(5,n.IThemeService),r(6,a.IOptionsService),r(7,n.IRenderService)],_)},4071(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=i(7453),o=i(4812),a=i(6501),l=i(8636),h=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0});let d=class extends o.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorHidden=!1,this._onData=this._register(new l.Emitter),this.onData=this._onData.event,this._onUserInput=this._register(new l.Emitter),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new l.Emitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new l.Emitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=i.rawOptions.showCursorImmediately??!1,this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(c),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(c),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d,t.CoreService=d=s([r(0,a.IBufferService),r(1,a.ILogService),r(2,a.IOptionsService)],d)},4097(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const s=i(4812),r=i(1073),n=i(8636);class o extends s.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new n.Emitter),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 r.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},4103(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0,t.toPaddedHex=d,t.contrastRatio=u;let i=0,s=0,r=0,n=0;var o,a,l,h,c;function d(e){const t=e.toString(16);return t.length<2?"0"+t:t}function u(e,t){return e>>0},e.toColor=function(t,i,s,r){return{css:e.toCss(t,i,s,r),rgba:e.toRgba(t,i,s,r)}}}(o||(t.channels=o={})),function(e){function t(e,t){return n=Math.round(255*t),[i,s,r]=c.toChannels(e.rgba),{css:o.toCss(i,s,r,n),rgba:o.toRgba(i,s,r,n)}}e.blend=function(e,t){if(n=(255&t.rgba)/255,1===n)return{css:t.css,rgba:t.rgba};const a=t.rgba>>24&255,l=t.rgba>>16&255,h=t.rgba>>8&255,c=e.rgba>>24&255,d=e.rgba>>16&255,u=e.rgba>>8&255;return i=c+Math.round((a-c)*n),s=d+Math.round((l-d)*n),r=u+Math.round((h-u)*n),{css:o.toCss(i,s,r),rgba:o.toRgba(i,s,r)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=c.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return o.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,s,r]=c.toChannels(t),{css:o.toCss(i,s,r),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return n=255&e.rgba,t(e,n*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(a||(t.color=a={})),function(e){let t,a;try{const e=document.createElement("canvas");e.width=1,e.height=1;const i=e.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",a=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),o.toColor(i,s,r);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),n=parseInt(e.slice(4,5).repeat(2),16),o.toColor(i,s,r,n);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const l=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return i=parseInt(l[1]),s=parseInt(l[2]),r=parseInt(l[3]),n=Math.round(255*(void 0===l[5]?1:parseFloat(l[5]))),o.toColor(i,s,r,n);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!a)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=a,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,s,r,n]=t.getImageData(0,0,1,1).data,255!==n)throw new Error("css.toColor: Unsupported css format");return{rgba:o.toRgba(i,s,r,n),css:e}}}(l||(t.css=l={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(h||(t.rgb=h={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));for(;c0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function a(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));for(;c>>0}e.blend=function(e,t){if(n=(255&t)/255,1===n)return t;const a=t>>24&255,l=t>>16&255,h=t>>8&255,c=e>>24&255,d=e>>16&255,u=e>>8&255;return i=c+Math.round((a-c)*n),s=d+Math.round((l-d)*n),r=u+Math.round((h-u)*n),o.toRgba(i,s,r)},e.ensureContrastRatio=function(e,i,s){const r=h.relativeLuminance(e>>8),n=h.relativeLuminance(i>>8);if(u(r,n)>8));if(ou(r,h.relativeLuminance(t>>8))?n:t}return n}const o=a(e,i,s),l=u(r,h.relativeLuminance(o>>8));if(lu(r,h.relativeLuminance(n>>8))?o:n}return o}},e.reduceLuminance=t,e.increaseLuminance=a,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(c||(t.rgba=c={}))},4196(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(7098),o=i(4812),a=i(6501);let l=class extends o.Disposable{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register((0,o.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer","top"===e?.options?.layer),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`;const i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const 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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;const i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=l,t.BufferDecorationRenderer=l=s([r(1,a.IBufferService),r(2,n.ICoreBrowserService),r(3,a.IDecorationService),r(4,n.IRenderService)],l)},4218(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Iterable=void 0,function(e){function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;const i=Object.freeze([]);function*s(e){yield e}e.empty=function(){return i},e.single=s,e.wrap=function(e){return t(e)?e:s(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(const s of e)if(t(s,i++))return!0;return!1},e.find=function(e,t){for(const i of e)if(t(i))return i},e.filter=function*(e,t){for(const i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(const s of e)yield t(s,i++)},e.flatMap=function*(e,t){let i=0;for(const s of e)yield*t(s,i++)},e.concat=function*(...e){for(const t of e)yield*t},e.reduce=function(e,t,i){let s=i;for(const i of e)s=t(s,i);return s},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);tr}]},e.asyncToArray=async function(e){const t=[];for await(const i of e)t.push(i);return Promise.resolve(t)}}(i||(t.Iterable=i={}))},4292(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},4333(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.isAndroid=t.isElectron=t.isWebkitWebView=t.isSafari=t.isChrome=t.isWebKit=t.isFirefox=t.onDidChangeFullscreen=t.onDidChangeZoomLevel=void 0,t.addMatchMediaChangeListener=o,t.setZoomLevel=function(e,t){n.INSTANCE.setZoomLevel(e,t)},t.getZoomLevel=function(e){return n.INSTANCE.getZoomLevel(e)},t.getZoomFactor=function(e){return n.INSTANCE.getZoomFactor(e)},t.setZoomFactor=function(e,t){n.INSTANCE.setZoomFactor(e,t)},t.setFullscreen=function(e,t){n.INSTANCE.setFullscreen(e,t)},t.isFullscreen=function(e){return n.INSTANCE.isFullscreen(e)},t.isStandalone=function(){return l},t.isWCOEnabled=function(){return navigator?.windowControlsOverlay?.visible},t.getWCOBoundingRect=function(){return navigator?.windowControlsOverlay?.getTitlebarAreaRect()};const s=i(4693),r=i(802);class n{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new r.Emitter,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new r.Emitter,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new n}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;const i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}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;const i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}}function o(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}t.onDidChangeZoomLevel=n.INSTANCE.onDidChangeZoomLevel,t.onDidChangeFullscreen=n.INSTANCE.onDidChangeFullscreen;const a="object"==typeof navigator?navigator.userAgent:"";t.isFirefox=a.indexOf("Firefox")>=0,t.isWebKit=a.indexOf("AppleWebKit")>=0,t.isChrome=a.indexOf("Chrome")>=0,t.isSafari=!t.isChrome&&a.indexOf("Safari")>=0,t.isWebkitWebView=!t.isChrome&&!t.isSafari&&t.isWebKit,t.isElectron=a.indexOf("Electron/")>=0,t.isAndroid=a.indexOf("Android")>=0;let l=!1;if("function"==typeof s.mainWindow.matchMedia){const e=s.mainWindow.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=s.mainWindow.matchMedia("(display-mode: fullscreen)");l=e.matches,o(s.mainWindow,e,({matches:e})=>{l&&t.matches||(l=e)})}},4335(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},4693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.mainWindow=void 0,t.ensureCodeWindow=function(e,t){},t.mainWindow="object"==typeof window?window:globalThis},4720(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const s=i(4103),r=i(4812),n=i(3087),o=i(8636);let a=0,l=0,h=0,c=0;class d extends r.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new n.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this._register(new o.Emitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new o.Emitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register((0,r.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new u(e);if(t){const e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0,n=0,o=0;for(const a of this._decorations.values())n=a.marker.line,o=n+(a.options.height??1),t=o||(s=a.options.x??0,r=s+(a.options.width??1),e>=s&&e=c||(a=r.options.x??0,l=a+(r.options.width??1),e>=a&&e=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=i(6501),o=i(4812),a=i(8636);let l=class extends o.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new a.Emitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new d(this._optionsService))}catch{this._measureStrategy=this._register(new c(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l,t.CharSizeService=l=s([r(2,n.IOptionsService)],l);class h extends o.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}}class c extends h{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}}class d extends h{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4812(e,t){function i(e){return{dispose:e}}function s(e){if(e)if(Array.isArray(e))for(const t of e)t.dispose();else e.dispose()}Object.defineProperty(t,"__esModule",{value:!0}),t.MutableDisposable=t.Disposable=t.DisposableStore=void 0,t.toDisposable=i,t.dispose=s,t.combinedDisposable=function(...e){return i(()=>s(e))};class r{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.clear()}}}t.DisposableStore=r,t.Disposable=class{constructor(){this._store=new r}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}}},4838(e,t){function i(e){return(t,i,s)=>{let r=null,n=null;if("function"==typeof s.value?(r="value",n=s.value):"function"==typeof s.get&&(r="get",n=s.get),!n)throw new Error("not supported");s[r]=e(n,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.memoize=function(e,t,i){let s=null,r=null;if("function"==typeof i.value?(s="value",r=i.value,0!==r.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(s="get",r=i.get),!r)throw new Error("not supported");const n=`$memoize$${t}`;i[s]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,e)}),this[n]}},t.debounce=function(e,t,s){return i((i,r)=>{const n=`$debounce$${r}`,o=`$debounce$result$${r}`;return function(...r){this[o]||(this[o]=s?s():void 0),clearTimeout(this[n]),t&&(this[o]=t(this[o],...r),r=[this[o]]),this[n]=setTimeout(()=>{i.apply(this,r),this[o]=s?s():void 0},e)}})},t.throttle=function(e,t,s){return i((i,r)=>{const n=`$throttle$timer$${r}`,o=`$throttle$result$${r}`,a=`$throttle$lastRun$${r}`,l=`$throttle$pending$${r}`;return function(...r){if(this[o]||(this[o]=s?s():void 0),null!==this[a]&&void 0!==this[a]||(this[a]=-Number.MAX_VALUE),t&&(this[o]=t(this[o],...r)),this[l])return;const h=this[a]+e;h<=Date.now()?(this[a]=Date.now(),i.apply(this,[this[o]]),this[o]=s?s():void 0):(this[l]=!0,this[n]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),i.apply(this,[this[o]]),this[o]=s?s():void 0},h-Date.now()))}})}},4852(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},4869(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CharCode=void 0,function(e){e[e.Null=0]="Null",e[e.Backspace=8]="Backspace",e[e.Tab=9]="Tab",e[e.LineFeed=10]="LineFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.DoubleQuote=34]="DoubleQuote",e[e.Hash=35]="Hash",e[e.DollarSign=36]="DollarSign",e[e.PercentSign=37]="PercentSign",e[e.Ampersand=38]="Ampersand",e[e.SingleQuote=39]="SingleQuote",e[e.OpenParen=40]="OpenParen",e[e.CloseParen=41]="CloseParen",e[e.Asterisk=42]="Asterisk",e[e.Plus=43]="Plus",e[e.Comma=44]="Comma",e[e.Dash=45]="Dash",e[e.Period=46]="Period",e[e.Slash=47]="Slash",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.Colon=58]="Colon",e[e.Semicolon=59]="Semicolon",e[e.LessThan=60]="LessThan",e[e.Equals=61]="Equals",e[e.GreaterThan=62]="GreaterThan",e[e.QuestionMark=63]="QuestionMark",e[e.AtSign=64]="AtSign",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.OpenSquareBracket=91]="OpenSquareBracket",e[e.Backslash=92]="Backslash",e[e.CloseSquareBracket=93]="CloseSquareBracket",e[e.Caret=94]="Caret",e[e.Underline=95]="Underline",e[e.BackTick=96]="BackTick",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.OpenCurlyBrace=123]="OpenCurlyBrace",e[e.Pipe=124]="Pipe",e[e.CloseCurlyBrace=125]="CloseCurlyBrace",e[e.Tilde=126]="Tilde",e[e.NoBreakSpace=160]="NoBreakSpace",e[e.U_Combining_Grave_Accent=768]="U_Combining_Grave_Accent",e[e.U_Combining_Acute_Accent=769]="U_Combining_Acute_Accent",e[e.U_Combining_Circumflex_Accent=770]="U_Combining_Circumflex_Accent",e[e.U_Combining_Tilde=771]="U_Combining_Tilde",e[e.U_Combining_Macron=772]="U_Combining_Macron",e[e.U_Combining_Overline=773]="U_Combining_Overline",e[e.U_Combining_Breve=774]="U_Combining_Breve",e[e.U_Combining_Dot_Above=775]="U_Combining_Dot_Above",e[e.U_Combining_Diaeresis=776]="U_Combining_Diaeresis",e[e.U_Combining_Hook_Above=777]="U_Combining_Hook_Above",e[e.U_Combining_Ring_Above=778]="U_Combining_Ring_Above",e[e.U_Combining_Double_Acute_Accent=779]="U_Combining_Double_Acute_Accent",e[e.U_Combining_Caron=780]="U_Combining_Caron",e[e.U_Combining_Vertical_Line_Above=781]="U_Combining_Vertical_Line_Above",e[e.U_Combining_Double_Vertical_Line_Above=782]="U_Combining_Double_Vertical_Line_Above",e[e.U_Combining_Double_Grave_Accent=783]="U_Combining_Double_Grave_Accent",e[e.U_Combining_Candrabindu=784]="U_Combining_Candrabindu",e[e.U_Combining_Inverted_Breve=785]="U_Combining_Inverted_Breve",e[e.U_Combining_Turned_Comma_Above=786]="U_Combining_Turned_Comma_Above",e[e.U_Combining_Comma_Above=787]="U_Combining_Comma_Above",e[e.U_Combining_Reversed_Comma_Above=788]="U_Combining_Reversed_Comma_Above",e[e.U_Combining_Comma_Above_Right=789]="U_Combining_Comma_Above_Right",e[e.U_Combining_Grave_Accent_Below=790]="U_Combining_Grave_Accent_Below",e[e.U_Combining_Acute_Accent_Below=791]="U_Combining_Acute_Accent_Below",e[e.U_Combining_Left_Tack_Below=792]="U_Combining_Left_Tack_Below",e[e.U_Combining_Right_Tack_Below=793]="U_Combining_Right_Tack_Below",e[e.U_Combining_Left_Angle_Above=794]="U_Combining_Left_Angle_Above",e[e.U_Combining_Horn=795]="U_Combining_Horn",e[e.U_Combining_Left_Half_Ring_Below=796]="U_Combining_Left_Half_Ring_Below",e[e.U_Combining_Up_Tack_Below=797]="U_Combining_Up_Tack_Below",e[e.U_Combining_Down_Tack_Below=798]="U_Combining_Down_Tack_Below",e[e.U_Combining_Plus_Sign_Below=799]="U_Combining_Plus_Sign_Below",e[e.U_Combining_Minus_Sign_Below=800]="U_Combining_Minus_Sign_Below",e[e.U_Combining_Palatalized_Hook_Below=801]="U_Combining_Palatalized_Hook_Below",e[e.U_Combining_Retroflex_Hook_Below=802]="U_Combining_Retroflex_Hook_Below",e[e.U_Combining_Dot_Below=803]="U_Combining_Dot_Below",e[e.U_Combining_Diaeresis_Below=804]="U_Combining_Diaeresis_Below",e[e.U_Combining_Ring_Below=805]="U_Combining_Ring_Below",e[e.U_Combining_Comma_Below=806]="U_Combining_Comma_Below",e[e.U_Combining_Cedilla=807]="U_Combining_Cedilla",e[e.U_Combining_Ogonek=808]="U_Combining_Ogonek",e[e.U_Combining_Vertical_Line_Below=809]="U_Combining_Vertical_Line_Below",e[e.U_Combining_Bridge_Below=810]="U_Combining_Bridge_Below",e[e.U_Combining_Inverted_Double_Arch_Below=811]="U_Combining_Inverted_Double_Arch_Below",e[e.U_Combining_Caron_Below=812]="U_Combining_Caron_Below",e[e.U_Combining_Circumflex_Accent_Below=813]="U_Combining_Circumflex_Accent_Below",e[e.U_Combining_Breve_Below=814]="U_Combining_Breve_Below",e[e.U_Combining_Inverted_Breve_Below=815]="U_Combining_Inverted_Breve_Below",e[e.U_Combining_Tilde_Below=816]="U_Combining_Tilde_Below",e[e.U_Combining_Macron_Below=817]="U_Combining_Macron_Below",e[e.U_Combining_Low_Line=818]="U_Combining_Low_Line",e[e.U_Combining_Double_Low_Line=819]="U_Combining_Double_Low_Line",e[e.U_Combining_Tilde_Overlay=820]="U_Combining_Tilde_Overlay",e[e.U_Combining_Short_Stroke_Overlay=821]="U_Combining_Short_Stroke_Overlay",e[e.U_Combining_Long_Stroke_Overlay=822]="U_Combining_Long_Stroke_Overlay",e[e.U_Combining_Short_Solidus_Overlay=823]="U_Combining_Short_Solidus_Overlay",e[e.U_Combining_Long_Solidus_Overlay=824]="U_Combining_Long_Solidus_Overlay",e[e.U_Combining_Right_Half_Ring_Below=825]="U_Combining_Right_Half_Ring_Below",e[e.U_Combining_Inverted_Bridge_Below=826]="U_Combining_Inverted_Bridge_Below",e[e.U_Combining_Square_Below=827]="U_Combining_Square_Below",e[e.U_Combining_Seagull_Below=828]="U_Combining_Seagull_Below",e[e.U_Combining_X_Above=829]="U_Combining_X_Above",e[e.U_Combining_Vertical_Tilde=830]="U_Combining_Vertical_Tilde",e[e.U_Combining_Double_Overline=831]="U_Combining_Double_Overline",e[e.U_Combining_Grave_Tone_Mark=832]="U_Combining_Grave_Tone_Mark",e[e.U_Combining_Acute_Tone_Mark=833]="U_Combining_Acute_Tone_Mark",e[e.U_Combining_Greek_Perispomeni=834]="U_Combining_Greek_Perispomeni",e[e.U_Combining_Greek_Koronis=835]="U_Combining_Greek_Koronis",e[e.U_Combining_Greek_Dialytika_Tonos=836]="U_Combining_Greek_Dialytika_Tonos",e[e.U_Combining_Greek_Ypogegrammeni=837]="U_Combining_Greek_Ypogegrammeni",e[e.U_Combining_Bridge_Above=838]="U_Combining_Bridge_Above",e[e.U_Combining_Equals_Sign_Below=839]="U_Combining_Equals_Sign_Below",e[e.U_Combining_Double_Vertical_Line_Below=840]="U_Combining_Double_Vertical_Line_Below",e[e.U_Combining_Left_Angle_Below=841]="U_Combining_Left_Angle_Below",e[e.U_Combining_Not_Tilde_Above=842]="U_Combining_Not_Tilde_Above",e[e.U_Combining_Homothetic_Above=843]="U_Combining_Homothetic_Above",e[e.U_Combining_Almost_Equal_To_Above=844]="U_Combining_Almost_Equal_To_Above",e[e.U_Combining_Left_Right_Arrow_Below=845]="U_Combining_Left_Right_Arrow_Below",e[e.U_Combining_Upwards_Arrow_Below=846]="U_Combining_Upwards_Arrow_Below",e[e.U_Combining_Grapheme_Joiner=847]="U_Combining_Grapheme_Joiner",e[e.U_Combining_Right_Arrowhead_Above=848]="U_Combining_Right_Arrowhead_Above",e[e.U_Combining_Left_Half_Ring_Above=849]="U_Combining_Left_Half_Ring_Above",e[e.U_Combining_Fermata=850]="U_Combining_Fermata",e[e.U_Combining_X_Below=851]="U_Combining_X_Below",e[e.U_Combining_Left_Arrowhead_Below=852]="U_Combining_Left_Arrowhead_Below",e[e.U_Combining_Right_Arrowhead_Below=853]="U_Combining_Right_Arrowhead_Below",e[e.U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below=854]="U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below",e[e.U_Combining_Right_Half_Ring_Above=855]="U_Combining_Right_Half_Ring_Above",e[e.U_Combining_Dot_Above_Right=856]="U_Combining_Dot_Above_Right",e[e.U_Combining_Asterisk_Below=857]="U_Combining_Asterisk_Below",e[e.U_Combining_Double_Ring_Below=858]="U_Combining_Double_Ring_Below",e[e.U_Combining_Zigzag_Above=859]="U_Combining_Zigzag_Above",e[e.U_Combining_Double_Breve_Below=860]="U_Combining_Double_Breve_Below",e[e.U_Combining_Double_Breve=861]="U_Combining_Double_Breve",e[e.U_Combining_Double_Macron=862]="U_Combining_Double_Macron",e[e.U_Combining_Double_Macron_Below=863]="U_Combining_Double_Macron_Below",e[e.U_Combining_Double_Tilde=864]="U_Combining_Double_Tilde",e[e.U_Combining_Double_Inverted_Breve=865]="U_Combining_Double_Inverted_Breve",e[e.U_Combining_Double_Rightwards_Arrow_Below=866]="U_Combining_Double_Rightwards_Arrow_Below",e[e.U_Combining_Latin_Small_Letter_A=867]="U_Combining_Latin_Small_Letter_A",e[e.U_Combining_Latin_Small_Letter_E=868]="U_Combining_Latin_Small_Letter_E",e[e.U_Combining_Latin_Small_Letter_I=869]="U_Combining_Latin_Small_Letter_I",e[e.U_Combining_Latin_Small_Letter_O=870]="U_Combining_Latin_Small_Letter_O",e[e.U_Combining_Latin_Small_Letter_U=871]="U_Combining_Latin_Small_Letter_U",e[e.U_Combining_Latin_Small_Letter_C=872]="U_Combining_Latin_Small_Letter_C",e[e.U_Combining_Latin_Small_Letter_D=873]="U_Combining_Latin_Small_Letter_D",e[e.U_Combining_Latin_Small_Letter_H=874]="U_Combining_Latin_Small_Letter_H",e[e.U_Combining_Latin_Small_Letter_M=875]="U_Combining_Latin_Small_Letter_M",e[e.U_Combining_Latin_Small_Letter_R=876]="U_Combining_Latin_Small_Letter_R",e[e.U_Combining_Latin_Small_Letter_T=877]="U_Combining_Latin_Small_Letter_T",e[e.U_Combining_Latin_Small_Letter_V=878]="U_Combining_Latin_Small_Letter_V",e[e.U_Combining_Latin_Small_Letter_X=879]="U_Combining_Latin_Small_Letter_X",e[e.LINE_SEPARATOR=8232]="LINE_SEPARATOR",e[e.PARAGRAPH_SEPARATOR=8233]="PARAGRAPH_SEPARATOR",e[e.NEXT_LINE=133]="NEXT_LINE",e[e.U_CIRCUMFLEX=94]="U_CIRCUMFLEX",e[e.U_GRAVE_ACCENT=96]="U_GRAVE_ACCENT",e[e.U_DIAERESIS=168]="U_DIAERESIS",e[e.U_MACRON=175]="U_MACRON",e[e.U_ACUTE_ACCENT=180]="U_ACUTE_ACCENT",e[e.U_CEDILLA=184]="U_CEDILLA",e[e.U_MODIFIER_LETTER_LEFT_ARROWHEAD=706]="U_MODIFIER_LETTER_LEFT_ARROWHEAD",e[e.U_MODIFIER_LETTER_RIGHT_ARROWHEAD=707]="U_MODIFIER_LETTER_RIGHT_ARROWHEAD",e[e.U_MODIFIER_LETTER_UP_ARROWHEAD=708]="U_MODIFIER_LETTER_UP_ARROWHEAD",e[e.U_MODIFIER_LETTER_DOWN_ARROWHEAD=709]="U_MODIFIER_LETTER_DOWN_ARROWHEAD",e[e.U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING=722]="U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING",e[e.U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING=723]="U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING",e[e.U_MODIFIER_LETTER_UP_TACK=724]="U_MODIFIER_LETTER_UP_TACK",e[e.U_MODIFIER_LETTER_DOWN_TACK=725]="U_MODIFIER_LETTER_DOWN_TACK",e[e.U_MODIFIER_LETTER_PLUS_SIGN=726]="U_MODIFIER_LETTER_PLUS_SIGN",e[e.U_MODIFIER_LETTER_MINUS_SIGN=727]="U_MODIFIER_LETTER_MINUS_SIGN",e[e.U_BREVE=728]="U_BREVE",e[e.U_DOT_ABOVE=729]="U_DOT_ABOVE",e[e.U_RING_ABOVE=730]="U_RING_ABOVE",e[e.U_OGONEK=731]="U_OGONEK",e[e.U_SMALL_TILDE=732]="U_SMALL_TILDE",e[e.U_DOUBLE_ACUTE_ACCENT=733]="U_DOUBLE_ACUTE_ACCENT",e[e.U_MODIFIER_LETTER_RHOTIC_HOOK=734]="U_MODIFIER_LETTER_RHOTIC_HOOK",e[e.U_MODIFIER_LETTER_CROSS_ACCENT=735]="U_MODIFIER_LETTER_CROSS_ACCENT",e[e.U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR=741]="U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR",e[e.U_MODIFIER_LETTER_HIGH_TONE_BAR=742]="U_MODIFIER_LETTER_HIGH_TONE_BAR",e[e.U_MODIFIER_LETTER_MID_TONE_BAR=743]="U_MODIFIER_LETTER_MID_TONE_BAR",e[e.U_MODIFIER_LETTER_LOW_TONE_BAR=744]="U_MODIFIER_LETTER_LOW_TONE_BAR",e[e.U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR=745]="U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR",e[e.U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK=746]="U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK",e[e.U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK=747]="U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK",e[e.U_MODIFIER_LETTER_UNASPIRATED=749]="U_MODIFIER_LETTER_UNASPIRATED",e[e.U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD=751]="U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_UP_ARROWHEAD=752]="U_MODIFIER_LETTER_LOW_UP_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD=753]="U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD=754]="U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_RING=755]="U_MODIFIER_LETTER_LOW_RING",e[e.U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT=756]="U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT",e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT=757]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT",e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT=758]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT",e[e.U_MODIFIER_LETTER_LOW_TILDE=759]="U_MODIFIER_LETTER_LOW_TILDE",e[e.U_MODIFIER_LETTER_RAISED_COLON=760]="U_MODIFIER_LETTER_RAISED_COLON",e[e.U_MODIFIER_LETTER_BEGIN_HIGH_TONE=761]="U_MODIFIER_LETTER_BEGIN_HIGH_TONE",e[e.U_MODIFIER_LETTER_END_HIGH_TONE=762]="U_MODIFIER_LETTER_END_HIGH_TONE",e[e.U_MODIFIER_LETTER_BEGIN_LOW_TONE=763]="U_MODIFIER_LETTER_BEGIN_LOW_TONE",e[e.U_MODIFIER_LETTER_END_LOW_TONE=764]="U_MODIFIER_LETTER_END_LOW_TONE",e[e.U_MODIFIER_LETTER_SHELF=765]="U_MODIFIER_LETTER_SHELF",e[e.U_MODIFIER_LETTER_OPEN_SHELF=766]="U_MODIFIER_LETTER_OPEN_SHELF",e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROW=767]="U_MODIFIER_LETTER_LOW_LEFT_ARROW",e[e.U_GREEK_LOWER_NUMERAL_SIGN=885]="U_GREEK_LOWER_NUMERAL_SIGN",e[e.U_GREEK_TONOS=900]="U_GREEK_TONOS",e[e.U_GREEK_DIALYTIKA_TONOS=901]="U_GREEK_DIALYTIKA_TONOS",e[e.U_GREEK_KORONIS=8125]="U_GREEK_KORONIS",e[e.U_GREEK_PSILI=8127]="U_GREEK_PSILI",e[e.U_GREEK_PERISPOMENI=8128]="U_GREEK_PERISPOMENI",e[e.U_GREEK_DIALYTIKA_AND_PERISPOMENI=8129]="U_GREEK_DIALYTIKA_AND_PERISPOMENI",e[e.U_GREEK_PSILI_AND_VARIA=8141]="U_GREEK_PSILI_AND_VARIA",e[e.U_GREEK_PSILI_AND_OXIA=8142]="U_GREEK_PSILI_AND_OXIA",e[e.U_GREEK_PSILI_AND_PERISPOMENI=8143]="U_GREEK_PSILI_AND_PERISPOMENI",e[e.U_GREEK_DASIA_AND_VARIA=8157]="U_GREEK_DASIA_AND_VARIA",e[e.U_GREEK_DASIA_AND_OXIA=8158]="U_GREEK_DASIA_AND_OXIA",e[e.U_GREEK_DASIA_AND_PERISPOMENI=8159]="U_GREEK_DASIA_AND_PERISPOMENI",e[e.U_GREEK_DIALYTIKA_AND_VARIA=8173]="U_GREEK_DIALYTIKA_AND_VARIA",e[e.U_GREEK_DIALYTIKA_AND_OXIA=8174]="U_GREEK_DIALYTIKA_AND_OXIA",e[e.U_GREEK_VARIA=8175]="U_GREEK_VARIA",e[e.U_GREEK_OXIA=8189]="U_GREEK_OXIA",e[e.U_GREEK_DASIA=8190]="U_GREEK_DASIA",e[e.U_IDEOGRAPHIC_FULL_STOP=12290]="U_IDEOGRAPHIC_FULL_STOP",e[e.U_LEFT_CORNER_BRACKET=12300]="U_LEFT_CORNER_BRACKET",e[e.U_RIGHT_CORNER_BRACKET=12301]="U_RIGHT_CORNER_BRACKET",e[e.U_LEFT_BLACK_LENTICULAR_BRACKET=12304]="U_LEFT_BLACK_LENTICULAR_BRACKET",e[e.U_RIGHT_BLACK_LENTICULAR_BRACKET=12305]="U_RIGHT_BLACK_LENTICULAR_BRACKET",e[e.U_OVERLINE=8254]="U_OVERLINE",e[e.UTF8_BOM=65279]="UTF8_BOM",e[e.U_FULLWIDTH_SEMICOLON=65307]="U_FULLWIDTH_SEMICOLON",e[e.U_FULLWIDTH_COMMA=65292]="U_FULLWIDTH_COMMA"}(i||(t.CharCode=i={}))},5015(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MicrotaskDelay=void 0,t.MicrotaskDelay=Symbol("MicrotaskDelay")},5101(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(3235),r=i(4812),n=i(8636);class o extends r.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new n.Emitter),this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new s.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},5251(e,t){function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,l,h){if(!o)return;const c=i(e,t,s);return c?(c[0]=Math.ceil((c[0]+(h?a/2:0))/a),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),r+(h?1:0)),c[1]=Math.min(Math.max(c[1],1),n),c):void 0}},5394(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){const e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},5473(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.VerticalScrollbar=void 0;const s=i(8801),r=i(8245),n=i(9881);class o extends s.AbstractScrollbar{constructor(e,t,i){const s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new r.ScrollbarState(t.verticalHasArrows?t.arrowSize:0,t.vertical===n.ScrollbarVisibility.Hidden?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===n.ScrollbarVisibility.Hidden?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}t.VerticalScrollbar=o},5639(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const s=i(4812),r=i(8636);class n extends s.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new r.Emitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new r.Emitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new r.Emitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;ithis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+i.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this._register(new m.MutableDisposable),this._onBinary=this._register(new g.Emitter),this.onBinary=this._onBinary.event,this._onData=this._register(new g.Emitter),this.onData=this._onData.event,this._onLineFeed=this._register(new g.Emitter),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new g.Emitter),this.onRender=this._onRender.event,this._onResize=this._register(new g.Emitter),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new g.Emitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new g.Emitter),this._instantiationService=new r.InstantiationService,this.optionsService=this._register(new a.OptionsService(e)),this._instantiationService.setService(s.IOptionsService,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(o.BufferService)),this._instantiationService.setService(s.IBufferService,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(n.LogService)),this._instantiationService.setService(s.ILogService,this._logService),this.coreService=this._register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(s.ICoreService,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(h.CoreMouseService)),this._instantiationService.setService(s.ICoreMouseService,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(c.UnicodeService)),this._instantiationService.setService(s.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d.CharsetService),this._instantiationService.setService(s.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p.OscLinkService),this._instantiationService.setService(s.IOscLinkService,this._oscLinkService),this._inputHandler=this._register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(g.EventUtils.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(g.EventUtils.forward(this._bufferService.onResize,this._onResize)),this._register(g.EventUtils.forward(this.coreService.onData,this._onData)),this._register(g.EventUtils.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["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 f.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this._register(g.EventUtils.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=s.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,o.MINIMUM_COLS),t=Math.max(t,o.MINIMUM_ROWS),this._writeBuffer.flushSync(),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber&&(e=!!("conpty"===t.backend&&t.buildNumber<21376)),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=S},5783(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=i(4852),o=i(7098),a=i(4812),l=i(6168),h=i(6501),c=i(8636);let d=class extends a.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,o,h,d,_){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new a.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this._register(new a.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new c.Emitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new c.Emitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new c.Emitter),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new c.Emitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new u(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register((0,a.toDisposable)(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>this._renderer.value?.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(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,void 0,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=(0,a.toDisposable)(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1,s=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);const r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=!1),i?this._renderRows(e,t):this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){this._renderer.value&&(this._coreService.decPrivateModes.synchronizedOutput?this._syncOutputHandler.bufferRows(e,t):(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0))}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,e.sync,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d,t.RenderService=d=s([r(2,h.IOptionsService),r(3,o.ICharSizeService),r(4,h.ICoreService),r(5,h.IDecorationService),r(6,h.IBufferService),r(7,o.ICoreBrowserService),r(8,o.IThemeService)],d);class u{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout??=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3)}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;const e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}}},5882(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=t?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)};const s=i(8938)},5959(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},5964(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;oe.index-t.index),s=[];for(const t of i){const i=this._services.get(t.id);if(!i)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);s.push(i)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},6097(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}}},6107(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(5451),r=i(3055),n=i(8938),o=i(726);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);let a=0;const l=new r.CellData;class h{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t??r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&s?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&s)+(0,o.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t=0;--i)this.setCell(e+t+i,this.loadCell(e+i,l));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[i]}}return this.length=e,4*i*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let r=s-1;r>=0;r--){for(let e=0;e<3;e++)this._data[3*(i+r)+e]=n[3*(t+r)+e];268435456&n[3*(t+r)+2]&&(this._extendedAttrs[i+r]=e._extendedAttrs[t+r])}else for(let r=0;r=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e,t,i,s){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let r="";for(;t>22||1}return s&&s.push(t),r}}t.BufferLine=h},6168(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(701);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class n extends r{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},6181(e,t){function i(e){return 57508<=e&&e<=57558}function s(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=s,t.allowRescaling=function(e,t,r,n){return 1===t&&r>Math.ceil(1.5*n)&&void 0!==e&&e>255&&!s(e)&&!i(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return i(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}},6201(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.serviceRegistry=void 0,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,r){t[i]===t?t[s].push({id:e,index:r}):(t[s]=[{id:e,index:r}],t[i]=t)}(r,e,n)};return r._id=e,t.serviceRegistry.set(e,r),r};const i="di$target",s="di$dependencies";t.serviceRegistry=new Map},6304(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;ol(t,e),s)):function(e,t){return t=h(181387,t),Object.keys(e).sort().reduce((t,i)=>(t=c(i,t),l(e[i],t)),t)}(e,t);case"string":return c(e,t);case"boolean":return function(e,t){return h(e?433:863,t)}(e,t);case"number":return h(e,t);case"undefined":return h(937,t);default:return h(617,t)}var i,s}function h(e,t){return(t<<5)-t+e|0}function c(e,t){t=h(149417,t);for(let i=0,s=e.length;i>>s)>>>0}function _(e,t=0,i=e.byteLength,s=0){for(let r=0;re.toString(16).padStart(2,"0")).join(""):function(e,t,i="0"){for(;e.length>>0).toString(16),t/4)}t.Hasher=class{constructor(){this._value=0}get value(){return this._value}hash(e){return this._value=l(e,this._value),this._value}},function(e){e[e.BLOCK_SIZE=64]="BLOCK_SIZE",e[e.UNICODE_REPLACEMENT=65533]="UNICODE_REPLACEMENT"}(d||(d={}));class p{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(d.BLOCK_SIZE+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const t=e.length;if(0===t)return;const i=this._buff;let s,r,n=this._buffLen,o=this._leftoverHighSurrogate;for(0!==o?(s=o,r=-1,o=0):(s=e.charCodeAt(0),r=0);;){let l=s;if(a.isHighSurrogate(s)){if(!(r+1>>6,e[t++]=128|(63&i)>>>0):i<65536?(e[t++]=224|(61440&i)>>>12,e[t++]=128|(4032&i)>>>6,e[t++]=128|(63&i)>>>0):(e[t++]=240|(1835008&i)>>>18,e[t++]=128|(258048&i)>>>12,e[t++]=128|(4032&i)>>>6,e[t++]=128|(63&i)>>>0),t>=d.BLOCK_SIZE&&(this._step(),t-=d.BLOCK_SIZE,this._totalLen+=d.BLOCK_SIZE,e[0]=e[d.BLOCK_SIZE+0],e[1]=e[d.BLOCK_SIZE+1],e[2]=e[d.BLOCK_SIZE+2]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,d.UNICODE_REPLACEMENT)),this._totalLen+=this._buffLen,this._wrapUp()),f(this._h0)+f(this._h1)+f(this._h2)+f(this._h3)+f(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,_(this._buff,this._buffLen),this._buffLen>56&&(this._step(),_(this._buff));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=p._bigBlock32,t=this._buffDV;for(let i=0;i<64;i+=4)e.setUint32(i,t.getUint32(i,!1),!1);for(let t=64;t<320;t+=4)e.setUint32(t,u(e.getUint32(t-12,!1)^e.getUint32(t-32,!1)^e.getUint32(t-56,!1)^e.getUint32(t-64,!1),1),!1);let i,s,r,n=this._h0,o=this._h1,a=this._h2,l=this._h3,h=this._h4;for(let t=0;t<80;t++)t<20?(i=o&a|~o&l,s=1518500249):t<40?(i=o^a^l,s=1859775393):t<60?(i=o&a|o&l|a&l,s=2400959708):(i=o^a^l,s=3395469782),r=u(n,5)+i+h+s+e.getUint32(4*t,!1)&4294967295,h=l,l=a,a=u(o,30),o=n,n=r;this._h0=this._h0+n&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+l&4294967295,this._h4=this._h4+h&4294967295}}t.StringSHA1=p},6317(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=void 0;class i{static{this.Undefined=new i(void 0)}constructor(e){this.element=e,this.next=i.Undefined,this.prev=i.Undefined}}class s{constructor(){this._first=i.Undefined,this._last=i.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===i.Undefined}clear(){let e=this._first;for(;e!==i.Undefined;){const t=e.next;e.prev=i.Undefined,e.next=i.Undefined,e=t}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const s=new i(e);if(this._first===i.Undefined)this._first=s,this._last=s;else if(t){const e=this._last;this._last=s,s.prev=e,e.next=s}else{const e=this._first;this._first=s,s.next=e,e.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==i.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==i.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==i.Undefined&&e.next!==i.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===i.Undefined&&e.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):e.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):e.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==i.Undefined;)yield e.element,e=e.next}}t.LinkedList=s},6415(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const s=i(7428),r=i(8636);class n{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new r.Emitter,this.onChange=this._onChange.event;const e=new s.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}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,i=0;const s=e.length;for(let r=0;r=s)return t+this.wcwidth(o);const i=e.charCodeAt(r);56320<=i&&i<=57343?o=1024*(o-55296)+i-56320+65536:t+=this.wcwidth(i)}const a=this.charProperties(o,i);let l=n.extractWidth(a);n.extractShouldJoin(a)&&(l-=n.extractWidth(i)),t+=l,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=n},6501(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(6201);var r;t.IBufferService=(0,s.createDecorator)("BufferService"),t.ICoreMouseService=(0,s.createDecorator)("CoreMouseService"),t.ICoreService=(0,s.createDecorator)("CoreService"),t.ICharsetService=(0,s.createDecorator)("CharsetService"),t.IInstantiationService=(0,s.createDecorator)("InstantiationService"),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.OFF=5]="OFF"}(r||(t.LogLevelEnum=r={})),t.ILogService=(0,s.createDecorator)("LogService"),t.IOptionsService=(0,s.createDecorator)("OptionsService"),t.IOscLinkService=(0,s.createDecorator)("OscLinkService"),t.IUnicodeService=(0,s.createDecorator)("UnicodeService"),t.IDecorationService=(0,s.createDecorator)("DecorationService")},6609(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.IframeUtils=void 0,t.parentOriginHash=async function(e,t){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");const i=JSON.stringify({parentOrigin:e,salt:t}),s=(new TextEncoder).encode(i);return function(e){const t=Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("");return BigInt(`0x${t}`).toString(32).padStart(52,"0")}(await crypto.subtle.digest("sha-256",s))};const i=new WeakMap;function s(e){if(!e.parent||e.parent===e)return null;try{const t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch(e){return null}return e.parent}t.IframeUtils=class{static getSameOriginWindowChain(e){let t=i.get(e);if(!t){t=[],i.set(e,t);let r,n=e;do{r=s(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r}while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0;const r=this.getSameOriginWindowChain(e);for(const e of r){const r=e.window.deref();if(i+=r?.scrollY??0,s+=r?.scrollX??0,r===t)break;if(!e.iframeElement)break;const n=e.iframeElement.getBoundingClientRect();i+=n.top,s+=n.left}return{top:i,left:s}}}},6717(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(4812),r=i(7262),n=i(1346),o=i(9823),a=i(2607);class l{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,i,s){this.table[t<<8|e]=i<<8|s}addMany(e,t,i,s){for(let r=0;rt),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,15);e.setDefault(1,0),e.addMany(s,0,2,0);for(const t of n)e.addMany([24,26,153,154],t,3,0),e.addMany(i(128,144),t,3,0),e.addMany(i(144,152),t,3,0),e.add(156,t,0,0),e.add(27,t,11,1),e.add(157,t,4,8),e.addMany([152,158],t,0,7),e.add(159,t,15,14),e.add(155,t,11,3),e.add(144,t,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,15,14),e.addMany(s,14,16,14),e.addMany(r,14,0,14),e.add(127,14,0,14),e.addMany([27,156,24,26],14,17,0),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(h,0,2,0),e.add(h,8,5,8),e.add(h,6,0,6),e.add(h,11,0,11),e.add(h,13,13,13),e.add(h,14,16,14),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},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((0,s.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new n.OscParser),this._dcsParser=this._register(new o.DcsParser),this._apcParser=this._register(new a.ApcParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;ts||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);this._escHandlers[i]??=[];const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);this._csiHandlers[i]??=[];const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}registerApcHandler(e,t){return this._apcParser.registerHandler(e,t)}clearApcHandler(e){this._apcParser.clearHandler(e)}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 7:if(r=e[this._parseStack.chunkPos],s=this._apcParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=255&this._parseStack.transition}for(let i=o;i>8){case 2:for(let s=i+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=0&&(s=o[a](this._params),!0!==s);a--)if(s instanceof Promise)return this._preserveStack(3,o,a,n,i),s;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++i47&&r<60);i--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const l=this._escHandlers[this._collect<<8|r];let c=l?l.length-1:-1;for(;c>=0&&(s=l[c](),!0!==s);c--)if(s instanceof Promise)return this._preserveStack(4,l,c,n,i),s;c<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=i+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r=t||(r=e[s])<32||r>127&&r=t||24===(r=e[s])||26===r||27===r||156===r||r>127&&r{r++,("number"==typeof s&&r>=s||!0===t())&&o.dispose()},i),o=(0,g.toDisposable)(()=>{e.clearInterval(n)});return o},t.measure=function(e,i){return(0,t.scheduleAtNextAnimationFrame)(e,i,1e4)},t.modify=function(e,i){return(0,t.scheduleAtNextAnimationFrame)(e,i,-1e4)},t.addDisposableThrottledListener=function(e,t,i,s,r){return new T(e,t,i,s,r)},t.getComputedStyle=M,t.getClientArea=function e(i,s){const r=(0,t.getWindow)(i),n=r.document;if(i!==n.body)return new I(i.clientWidth,i.clientHeight);if(m.isIOS&&r?.visualViewport)return new I(r.visualViewport.width,r.visualViewport.height);if(r?.innerWidth&&r.innerHeight)return new I(r.innerWidth,r.innerHeight);if(n.body&&n.body.clientWidth&&n.body.clientHeight)return new I(n.body.clientWidth,n.body.clientHeight);if(n.documentElement&&n.documentElement.clientWidth&&n.documentElement.clientHeight)return new I(n.documentElement.clientWidth,n.documentElement.clientHeight);if(s)return e(s);throw new Error("Unable to figure out browser width and height")},t.getTopLeftOffset=P,t.size=function(e,t,i){"number"==typeof t&&(e.style.width=`${t}px`),"number"==typeof i&&(e.style.height=`${i}px`)},t.position=function(e,t,i,s,r,n="absolute"){"number"==typeof t&&(e.style.top=`${t}px`),"number"==typeof i&&(e.style.right=`${i}px`),"number"==typeof s&&(e.style.bottom=`${s}px`),"number"==typeof r&&(e.style.left=`${r}px`),e.style.position=n},t.getDomNodePagePosition=function(e){const i=e.getBoundingClientRect(),s=(0,t.getWindow)(e);return{left:i.left+s.scrollX,top:i.top+s.scrollY,width:i.width,height:i.height}},t.getDomNodeZoomLevel=function(e){let t=e,i=1;do{const e=M(t).zoom;null!=e&&"1"!==e&&(i*=e),t=t.parentElement}while(null!==t&&t!==t.ownerDocument.documentElement);return i},t.getTotalWidth=x,t.getContentWidth=function(e){const t=O.getBorderLeftWidth(e)+O.getBorderRightWidth(e),i=O.getPaddingLeft(e)+O.getPaddingRight(e);return e.offsetWidth-t-i},t.getTotalScrollWidth=B,t.getContentHeight=function(e){const t=O.getBorderTopWidth(e)+O.getBorderBottomWidth(e),i=O.getPaddingTop(e)+O.getPaddingBottom(e);return e.offsetHeight-t-i},t.getTotalHeight=function(e){const t=O.getMarginTop(e)+O.getMarginBottom(e);return e.offsetHeight+t},t.getLargestChildWidth=function(e,t){const i=t.map(t=>Math.max(B(t),x(t))+function(e,t){if(null===e)return 0;const i=P(e),s=P(t);return i.left-s.left}(t,e)||0);return Math.max(...i)},t.isAncestor=N,t.setParentFlowTo=function(e,t){e.dataset[U]=t.id},t.isAncestorUsingFlowTo=function(e,t){let i=e;for(;i;){if(i===t)return!0;if(ee(i)){const e=F(i);if(e){i=e;continue}}i=i.parentNode}return!1},t.findParentWithClass=W,t.hasParentWithClass=function(e,t,i){return!!W(e,t,i)},t.isShadowRoot=K,t.isInShadowDOM=function(e){return!!H(e)},t.getShadowRoot=H,t.getActiveElement=z,t.isActiveElement=function(e){return z()===e},t.isAncestorOfActiveElement=function(e){return N(z(),e)},t.isActiveDocument=function(e){return e.ownerDocument===j()},t.getActiveDocument=j,t.getActiveWindow=function(){const e=j();return e.defaultView?.window??S.mainWindow},t.isGlobalStylesheet=function(e){return $.has(e)},t.createStyleSheet2=function(){return new V},t.createStyleSheet=q,t.cloneGlobalStylesheets=function(e){const t=new g.DisposableStore;for(const[i,s]of $)t.add(G(i,s,e));return t},t.createMetaElement=function(e=S.mainWindow.document.head){return X("meta",e)},t.createLinkElement=function(e=S.mainWindow.document.head){return X("link",e)},t.createCSSRule=function e(t,i,s=Z()){if(s&&i){s.sheet?.insertRule(`${t} {${i}}`,0);for(const r of $.get(s)??[])e(t,i,r)}},t.removeCSSRulesContainingSelector=function e(t,i=Z()){if(!i)return;const s=Q(i),r=[];for(let e=0;e=0;e--)i.sheet?.deleteRule(r[e]);for(const s of $.get(i)??[])e(t,s)},t.isHTMLElement=ee,t.isHTMLAnchorElement=function(e){return e instanceof HTMLAnchorElement||e instanceof(0,t.getWindow)(e).HTMLAnchorElement},t.isHTMLSpanElement=function(e){return e instanceof HTMLSpanElement||e instanceof(0,t.getWindow)(e).HTMLSpanElement},t.isHTMLTextAreaElement=function(e){return e instanceof HTMLTextAreaElement||e instanceof(0,t.getWindow)(e).HTMLTextAreaElement},t.isHTMLInputElement=function(e){return e instanceof HTMLInputElement||e instanceof(0,t.getWindow)(e).HTMLInputElement},t.isHTMLButtonElement=function(e){return e instanceof HTMLButtonElement||e instanceof(0,t.getWindow)(e).HTMLButtonElement},t.isHTMLDivElement=function(e){return e instanceof HTMLDivElement||e instanceof(0,t.getWindow)(e).HTMLDivElement},t.isSVGElement=function(e){return e instanceof SVGElement||e instanceof(0,t.getWindow)(e).SVGElement},t.isMouseEvent=function(e){return e instanceof MouseEvent||e instanceof(0,t.getWindow)(e).MouseEvent},t.isKeyboardEvent=function(e){return e instanceof KeyboardEvent||e instanceof(0,t.getWindow)(e).KeyboardEvent},t.isPointerEvent=function(e){return e instanceof PointerEvent||e instanceof(0,t.getWindow)(e).PointerEvent},t.isDragEvent=function(e){return e instanceof DragEvent||e instanceof(0,t.getWindow)(e).DragEvent},t.isEventLike=function(e){const t=e;return!(!t||"function"!=typeof t.preventDefault||"function"!=typeof t.stopPropagation)},t.saveParentsScrollTop=function(e){const t=[];for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)t[i]=e.scrollTop,e=e.parentNode;return t},t.restoreParentsScrollTop=function(e,t){for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)e.scrollTop!==t[i]&&(e.scrollTop=t[i]),e=e.parentNode},t.trackFocus=function(e){return new te(e)},t.after=function(e,t){return e.after(t),t},t.append=ie,t.prepend=function(e,t){return e.insertBefore(t,e.firstChild),t},t.reset=function(e,...t){e.innerText="",ie(e,...t)},t.$=ae,t.join=function(e,t){const i=[];return e.forEach((e,s)=>{s>0&&(t instanceof Node?i.push(t.cloneNode()):i.push(document.createTextNode(t))),i.push(e)}),i},t.setVisibility=function(e,...t){e?le(...t):he(...t)},t.show=le,t.hide=he,t.removeTabIndexAndUpdateFocus=function(e){if(e&&e.hasAttribute("tabIndex")){if(e.ownerDocument.activeElement===e){const t=function(e){for(;e&&e.nodeType===e.ELEMENT_NODE;){if(ee(e)&&e.hasAttribute("tabIndex"))return e;e=e.parentNode}return null}(e.parentElement);t?.focus()}e.removeAttribute("tabindex")}},t.finalHandler=function(e){return t=>{t.preventDefault(),t.stopPropagation(),e(t)}},t.domContentLoaded=function(e){return new Promise(t=>{if("complete"===e.document.readyState||e.document&&null!==e.document.body)t(void 0);else{const i=()=>{e.window.removeEventListener("DOMContentLoaded",i,!1),t()};e.window.addEventListener("DOMContentLoaded",i,!1)}})},t.computeScreenAwareSize=function(e,t){const i=e.devicePixelRatio*t;return Math.max(1,Math.floor(i))/e.devicePixelRatio},t.windowOpenNoOpener=function(e){S.mainWindow.open(e,"_blank","noopener")},t.windowOpenPopup=function(e){const t=Math.floor(S.mainWindow.screenLeft+S.mainWindow.innerWidth/2-390),i=Math.floor(S.mainWindow.screenTop+S.mainWindow.innerHeight/2-320);S.mainWindow.open(e,"_blank",`width=780,height=640,top=${i},left=${t}`)},t.windowOpenWithSuccess=function(e,t=!0){const i=S.mainWindow.open();return!!i&&(t&&(i.opener=null),i.location.href=e,!0)},t.animate=function(e,i){const s=()=>{i(),r=(0,t.scheduleAtNextAnimationFrame)(e,s)};let r=(0,t.scheduleAtNextAnimationFrame)(e,s);return(0,g.toDisposable)(()=>r.dispose())},t.asCSSPropertyValue=function(e){return`'${e.replace(/'/g,"%27")}'`},t.asCssValueWithDefault=function e(t,i){if(void 0!==t){const s=t.match(/^\s*var\((.+)\)$/);if(s){const t=s[1].split(",",2);return 2===t.length&&(i=e(t[1].trim(),i)),`var(${t[0]}, ${i})`}return t}return i},t.detectFullscreen=function(e){return e.document.fullscreenElement||e.document.webkitFullscreenElement||e.document.webkitIsFullScreen?{mode:ne.DOCUMENT,guess:!1}:e.innerHeight===e.screen.height?{mode:ne.BROWSER,guess:!1}:(m.isMacintosh||m.isLinux)&&e.outerHeight===e.screen.height&&e.outerWidth===e.screen.width?{mode:ne.BROWSER,guess:!0}:null},t.multibyteAwareBtoa=function(e){return btoa(function(e){const t=new Uint16Array(e.length);for(let i=0;i0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),s)for(const e of s)ee(e)?o.appendChild(e):"string"==typeof e?o.append(e):"root"in e&&(Object.assign(l,e),o.appendChild(e.root));for(const[e,t]of Object.entries(i))if("className"!==e)if("style"===e)for(const[e,i]of Object.entries(t))o.style.setProperty(_e(e),"number"==typeof i?i+"px":""+i);else"tabIndex"===e?o.tabIndex=t:o.setAttribute(_e(e),t.toString());return l.root=o,l},t.svgElem=function(e,...t){let i,s;Array.isArray(t[0])?(i={},s=t[0]):(i=t[0]||{},s=t[1]);const r=ue.exec(e);if(!r||!r.groups)throw new Error("Bad use of h");const n=r.groups.tag||"div",o=document.createElementNS("http://www.w3.org/2000/svg",n);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const e of r.groups.class.split("."))""!==e&&a.push(e);if(void 0!==i.className)for(const e of i.className.split("."))""!==e&&a.push(e);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),s)for(const e of s)ee(e)?o.appendChild(e):"string"==typeof e?o.append(e):"root"in e&&(Object.assign(l,e),o.appendChild(e.root));for(const[e,t]of Object.entries(i))if("className"!==e)if("style"===e)for(const[e,i]of Object.entries(t))o.style.setProperty(_e(e),"number"==typeof i?i+"px":""+i);else"tabIndex"===e?o.tabIndex=t:o.setAttribute(_e(e),t.toString());return l.root=o,l},t.copyAttributes=fe,t.trackAttributes=function(e,i,s){fe(e,i,s);const r=new g.DisposableStore;return r.add(t.sharedMutationObserver.observe(e,r,{attributes:!0,attributeFilter:s})(t=>{for(const s of t)"attributes"===s.type&&s.attributeName&&pe(e,i,s.attributeName)})),r};const l=a(i(4333)),h=i(7745),c=i(5394),d=i(5964),u=i(1758),_=i(9807),f=a(i(802)),p=i(7883),g=i(7150),m=a(i(8163)),v=i(6304),S=i(4693),b=i(7704);r=function(){const e=new Map;(0,S.ensureCodeWindow)(S.mainWindow,1);const i={window:S.mainWindow,disposables:new g.DisposableStore};e.set(S.mainWindow.vscodeWindowId,i);const s=new f.Emitter,r=new f.Emitter,n=new f.Emitter;return{onDidRegisterWindow:s.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:r.event,registerWindow(i){if(e.has(i.vscodeWindowId))return g.Disposable.None;const o=new g.DisposableStore,a={window:i,disposables:o.add(new g.DisposableStore)};return e.set(i.vscodeWindowId,a),o.add((0,g.toDisposable)(()=>{e.delete(i.vscodeWindowId),r.fire(i)})),o.add(w(i,t.EventType.BEFORE_UNLOAD,()=>{n.fire(i)})),s.fire(a),o},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(t,s){return("number"==typeof t?e.get(t):void 0)??(s?i:void 0)},getWindow(e){const t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;const i=e;return i?.view?i.view.window:S.mainWindow},getDocument(e){const i=e;return(0,t.getWindow)(i).document}}}(),t.registerWindow=r.registerWindow,t.getWindow=r.getWindow,t.getDocument=r.getDocument,t.getWindows=r.getWindows,t.getWindowsCount=r.getWindowsCount,t.getWindowId=r.getWindowId,t.getWindowById=r.getWindowById,t.hasWindow=r.hasWindow,t.onDidRegisterWindow=r.onDidRegisterWindow,t.onWillUnregisterWindow=r.onWillUnregisterWindow,t.onDidUnregisterWindow=r.onDidUnregisterWindow;class y{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function w(e,t,i,s){return new y(e,t,i,s)}function C(e,t){return function(i){return t(new d.StandardMouseEvent(e,i))}}function E(e,i,s){return w(e,m.isIOS&&h.BrowserFeatures.pointerEvents?t.EventType.POINTER_DOWN:t.EventType.MOUSE_DOWN,i,s)}function D(e,i,s){return w(e,m.isIOS&&h.BrowserFeatures.pointerEvents?t.EventType.POINTER_UP:t.EventType.MOUSE_UP,i,s)}t.addStandardDisposableListener=function(e,i,s,r){let n=s;return"click"===i||"mousedown"===i||"contextmenu"===i?n=C((0,t.getWindow)(e),s):"keydown"!==i&&"keypress"!==i&&"keyup"!==i||(n=function(e){return function(t){return e(new c.StandardKeyboardEvent(t))}}(s)),w(e,i,n,r)},t.addStandardDisposableGenericMouseDownListener=function(e,i,s){return E(e,C((0,t.getWindow)(e),i),s)},t.addStandardDisposableGenericMouseUpListener=function(e,i,s){return D(e,C((0,t.getWindow)(e),i),s)};class L extends u.AbstractIdleValue{constructor(e,t){super(e,t)}}t.WindowIdleValue=L;class k extends u.IntervalTimer{constructor(e){super(),this.defaultTarget=e&&(0,t.getWindow)(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}t.WindowIntervalTimer=k;class R{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){(0,_.onUnexpectedError)(e)}}static sort(e,t){return t.priority-e.priority}}!function(){const e=new Map,i=new Map,s=new Map,r=new Map;t.scheduleAtNextAnimationFrame=(n,o,a=0)=>{const l=(0,t.getWindowId)(n),h=new R(o,a);let c=e.get(l);return c||(c=[],e.set(l,c)),c.push(h),s.get(l)||(s.set(l,!0),n.requestAnimationFrame(()=>(t=>{s.set(t,!1);const n=e.get(t)??[];for(i.set(t,n),e.set(t,[]),r.set(t,!0);n.length>0;)n.sort(R.sort),n.shift().execute();r.set(t,!1)})(l))),h},t.runAtThisOrScheduleAtNextAnimationFrame=(e,s,n)=>{const o=(0,t.getWindowId)(e);if(r.get(o)){const e=new R(s,n);let t=i.get(o);return t||(t=[],i.set(o,t)),t.push(e),e}return(0,t.scheduleAtNextAnimationFrame)(e,s,n)}}();const A=function(e,t){return t};class T extends g.Disposable{constructor(e,t,i,s=A,r=8){super();let n=null,o=0;const a=this._register(new u.TimeoutTimer),l=()=>{o=(new Date).getTime(),i(n),n=null};this._register(w(e,t,e=>{n=s(n,e);const t=(new Date).getTime()-o;t>=r?(a.cancel(),l()):a.setIfNotSet(l,r-t)}))}}function M(e){return(0,t.getWindow)(e).getComputedStyle(e,null)}class O{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){const s=M(e),r=s?s.getPropertyValue(t):"0";return O.convertToPixels(e,r)}static getBorderLeftWidth(e){return O.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return O.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return O.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return O.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return O.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return O.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return O.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return O.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return O.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return O.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return O.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return O.getDimension(e,"margin-bottom","marginBottom")}}class I{static{this.None=new I(0,0)}constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new I(e,t):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(e){return e instanceof I?e:new I(e.width,e.height)}static equals(e,t){return e===t||!(!e||!t)&&e.width===t.width&&e.height===t.height}}function P(e){let t=e.offsetParent,i=e.offsetTop,s=e.offsetLeft;for(;null!==(e=e.parentNode)&&e!==e.ownerDocument.body&&e!==e.ownerDocument.documentElement;){i-=e.scrollTop;const r=K(e)?null:M(e);r&&(s-="rtl"!==r.direction?e.scrollLeft:-e.scrollLeft),e===t&&(s+=O.getBorderLeftWidth(e),i+=O.getBorderTopWidth(e),i+=e.offsetTop,s+=e.offsetLeft,t=e.offsetParent)}return{left:s,top:i}}function x(e){const t=O.getMarginLeft(e)+O.getMarginRight(e);return e.offsetWidth+t}function B(e){const t=O.getMarginLeft(e)+O.getMarginRight(e);return e.scrollWidth+t}function N(e,t){return Boolean(t?.contains(e))}t.Dimension=I;const U="parentFlowToElementId";function F(e){const t=e.dataset[U];return"string"==typeof t?e.ownerDocument.getElementById(t):null}function W(e,t,i){for(;e&&e.nodeType===e.ELEMENT_NODE;){if(e.classList.contains(t))return e;if(i)if("string"==typeof i){if(e.classList.contains(i))return null}else if(e===i)return null;e=e.parentNode}return null}function K(e){return e&&!!e.host&&!!e.mode}function H(e){for(;e.parentNode;){if(e===e.ownerDocument?.body)return null;e=e.parentNode}return K(e)?e:null}function z(){let e=j().activeElement;for(;e?.shadowRoot;)e=e.shadowRoot.activeElement;return e}function j(){return(0,t.getWindowsCount)()<=1?S.mainWindow.document:Array.from((0,t.getWindows)()).map(({window:e})=>e.document).find(e=>e.hasFocus())??S.mainWindow.document}const $=new Map;class V{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.innerText=e:this._styleSheet=q(S.mainWindow.document.head,t=>t.innerText=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function q(e=S.mainWindow.document.head,i,s){const r=document.createElement("style");if(r.type="text/css",r.media="screen",i?.(r),e.appendChild(r),s&&s.add((0,g.toDisposable)(()=>r.remove())),e===S.mainWindow.document.head){const e=new Set;$.set(r,e);for(const{window:i,disposables:n}of(0,t.getWindows)()){if(i===S.mainWindow)continue;const t=n.add(G(r,e,i));s?.add(t)}}return r}function G(e,i,s){const r=new g.DisposableStore,n=e.cloneNode(!0);s.document.head.appendChild(n),r.add((0,g.toDisposable)(()=>n.remove()));for(const t of Q(e))n.sheet?.insertRule(t.cssText,n.sheet?.cssRules.length);return r.add(t.sharedMutationObserver.observe(e,r,{childList:!0})(()=>{n.textContent=e.textContent})),i.add(n),r.add((0,g.toDisposable)(()=>i.delete(n))),r}function X(e,t=S.mainWindow.document.head){const i=document.createElement(e);return t.appendChild(i),i}t.sharedMutationObserver=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));const r=(0,v.hash)(i);let n=s.get(r);if(n)n.users+=1;else{const o=new f.Emitter,a=new MutationObserver(e=>o.fire(e));a.observe(e,i);const l=n={users:1,observer:a,onDidMutate:o.event};t.add((0,g.toDisposable)(()=>{l.users-=1,0===l.users&&(o.dispose(),a.disconnect(),s?.delete(r),0===s?.size&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}};let Y=null;function Z(){return Y||(Y=q()),Y}function Q(e){return e?.sheet?.rules?e.sheet.rules:e?.sheet?.cssRules?e.sheet.cssRules:[]}function J(e){return"string"==typeof e.selectorText}function ee(e){return e instanceof HTMLElement||e instanceof(0,t.getWindow)(e).HTMLElement}t.EventType={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:l.isWebKit?"webkitAnimationStart":"animationstart",ANIMATION_END:l.isWebKit?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:l.isWebKit?"webkitAnimationIteration":"animationiteration"},t.EventHelper={stop:(e,t)=>(e.preventDefault(),t&&e.stopPropagation(),e)};class te extends g.Disposable{static hasFocusWithin(e){if(ee(e)){const t=H(e);return N(t?t.activeElement:e.ownerDocument.activeElement,e)}{const t=e;return N(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new f.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new f.Emitter),this.onDidBlur=this._onDidBlur.event;let i=te.hasFocusWithin(e),s=!1;const r=()=>{s=!1,i||(i=!0,this._onDidFocus.fire())},n=()=>{i&&(s=!0,(ee(e)?(0,t.getWindow)(e):e).setTimeout(()=>{s&&(s=!1,i=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{te.hasFocusWithin(e)!==i&&(i?n():r())},this._register(w(e,t.EventType.FOCUS,r,!0)),this._register(w(e,t.EventType.BLUR,n,!0)),ee(e)&&(this._register(w(e,t.EventType.FOCUS_IN,()=>this._refreshStateHandler())),this._register(w(e,t.EventType.FOCUS_OUT,()=>this._refreshStateHandler())))}refreshState(){this._refreshStateHandler()}}function ie(e,...t){if(e.append(...t),1===t.length&&"string"!=typeof t[0])return t[0]}const se=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var re,ne;function oe(e,t,i,...s){const r=se.exec(t);if(!r)throw new Error("Bad use of emmet");const n=r[1]||"div";let o;return o=e!==re.HTML?document.createElementNS(e,n):document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([e,t])=>{void 0!==t&&(/^on\w+$/.test(e)?o[e]=t:"selected"===e?t&&o.setAttribute(e,"true"):o.setAttribute(e,t))}),o.append(...s),o}function ae(e,t,...i){return oe(re.HTML,e,t,...i)}function le(...e){for(const t of e)t.style.display="",t.removeAttribute("aria-hidden")}function he(...e){for(const t of e)t.style.display="none",t.setAttribute("aria-hidden","true")}!function(e){e.HTML="http://www.w3.org/1999/xhtml",e.SVG="http://www.w3.org/2000/svg"}(re||(t.Namespace=re={})),ae.SVG=function(e,t,...i){return oe(re.SVG,e,t,...i)},function(e){e[e.DOCUMENT=1]="DOCUMENT",e[e.BROWSER=2]="BROWSER"}(ne||(t.DetectedFullscreenMode=ne={}));class ce extends f.Emitter{constructor(){super(),this._subscriptions=new g.DisposableStore,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(f.Event.runAndSubscribe(t.onDidRegisterWindow,({window:e,disposables:t})=>this.registerListeners(e,t),{window:S.mainWindow,disposables:this._subscriptions}))}registerListeners(e,t){t.add(w(e,"keydown",e=>{if(e.defaultPrevented)return;const t=new c.StandardKeyboardEvent(e);if(t.keyCode!==p.KeyCode.Alt||!e.repeat){if(e.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(e.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(e.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(e.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else{if(t.keyCode===p.KeyCode.Alt)return;this._keyStatus.lastKeyPressed=void 0}this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=e,this.fire(this._keyStatus))}},!0)),t.add(w(e,"keyup",e=>{e.defaultPrevented||(!e.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!e.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!e.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!e.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=e,this.fire(this._keyStatus)))},!0)),t.add(w(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(w(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(w(e.document.body,"mousemove",e=>{e.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(w(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return this._keyStatus.altKey||this._keyStatus.ctrlKey||this._keyStatus.metaKey||this._keyStatus.shiftKey}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return ce.instance||(ce.instance=new ce),ce.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}t.ModifierKeyEmitter=ce;class de extends g.Disposable{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(w(this.element,t.EventType.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(w(this.element,t.EventType.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(w(this.element,t.EventType.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(w(this.element,t.EventType.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(w(this.element,t.EventType.DRAG_LEAVE,e=>{this.counter--,0===this.counter&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(w(this.element,t.EventType.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(w(this.element,t.EventType.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}t.DragAndDropObserver=de;const ue=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/;function _e(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function fe(e,t,i){for(const{name:s,value:r}of e.attributes)i&&!i.includes(s)||t.setAttribute(s,r)}function pe(e,t,i){const s=e.getAttribute(i);s?t.setAttribute(i,s):t.removeAttribute(i)}t.SafeTriangle=class{constructor(e,t,i){this.originX=e,this.originY=t,this.triangles=[];const{top:s,left:r,right:n,bottom:o}=i.getBoundingClientRect(),a=this.triangles;let l=0;a[l++]=r,a[l++]=s,a[l++]=n,a[l++]=s,a[l++]=r,a[l++]=s,a[l++]=r,a[l++]=o,a[l++]=n,a[l++]=s,a[l++]=n,a[l++]=o,a[l++]=r,a[l++]=o,a[l++]=n,a[l++]=o}contains(e,t){const{triangles:i,originX:s,originY:r}=this;for(let n=0;n<4;n++)if((0,b.isPointWithinTriangle)(e,t,s,r,i[2*n],i[2*n+1],i[2*n+2],i[2*n+3]))return!0;return!1}}},7098(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.IKeyboardService=t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(6201);t.ICharSizeService=(0,s.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,s.createDecorator)("CoreBrowserService"),t.IMouseService=(0,s.createDecorator)("MouseService"),t.IRenderService=(0,s.createDecorator)("RenderService"),t.ISelectionService=(0,s.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,s.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,s.createDecorator)("ThemeService"),t.ILinkProviderService=(0,s.createDecorator)("LinkProviderService"),t.IKeyboardService=(0,s.createDecorator)("KeyboardService")},7150(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DisposableMap=t.ImmortalReference=t.AsyncReferenceCollection=t.ReferenceCollection=t.SafeDisposable=t.RefCountedDisposable=t.MandatoryMutableDisposable=t.MutableDisposable=t.Disposable=t.DisposableStore=t.DisposableTracker=void 0,t.setDisposableTracker=function(e){l=e},t.trackDisposable=c,t.markAsDisposed=d,t.markAsSingleton=function(e){return l?.markAsSingleton(e),e},t.isDisposable=_,t.dispose=f,t.disposeIfDisposable=function(e){for(const t of e)_(t)&&t.dispose();return[]},t.combinedDisposable=function(...e){const t=p(()=>f(e));return function(e,t){if(l)for(const i of e)l.setParent(i,t)}(e,t),t},t.toDisposable=p,t.disposeOnReturn=function(e){const t=new g;try{e(t)}finally{t.dispose()}};const s=i(3058),r=i(9087),n=i(2608),o=i(8841),a=i(4218);let l=null;class h{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:h.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){const t=this.getDisposableData(e);t.source||(t.source=(new Error).stack)}setParent(e,t){this.getDisposableData(e).parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){const i=t.get(e);if(i)return i;const s=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,s),s}getTrackedDisposables(){const e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>null!==t.source&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let i;if(t)i=t;else{const e=new Map,t=[...this.livingDisposables.values()].filter(t=>null!==t.source&&!this.getRootParent(t,e).isSingleton);if(0===t.length)return;const s=new Set(t.map(e=>e.value));if(i=t.filter(e=>!(e.parent&&s.has(e.parent))),0===i.length)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(e){const t=e.source.split("\n").map(e=>e.trim().replace("at ","")).filter(e=>""!==e);return function(e,t){for(;e.length>0&&t.some(t=>"string"==typeof t?t===e[0]:e[0].match(t));)e.shift()}(t,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),t.reverse()}const a=new n.SetMap;for(const e of i){const t=o(e);for(let i=0;i<=t.length;i++)a.add(t.slice(0,i).join("\n"),e)}i.sort((0,s.compareBy)(e=>e.idx,s.numberComparator));let l="",h=0;for(const t of i.slice(0,e)){h++;const e=o(t),s=[];for(let t=0;to(e)[t]),e=>e);delete h[e[t]];for(const[e,t]of Object.entries(h))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(n)}l+=`\n\n\n==================== Leaking disposable ${h}/${i.length}: ${t.value.constructor.name} ====================\n${s.join("\n")}\n============================================================\n\n`}return i.length>e&&(l+=`\n\n\n... and ${i.length-e} more leaking disposables\n\n`),{leaks:i,details:l}}}function c(e){return l?.trackDisposable(e),e}function d(e){l?.markAsDisposed(e)}function u(e,t){l?.setParent(e,t)}function _(e){return"object"==typeof e&&null!==e&&"function"==typeof e.dispose&&0===e.dispose.length}function f(e){if(a.Iterable.is(e)){const t=[];for(const i of e)if(i)try{i.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function p(e){const t=c({dispose:(0,o.createSingleCallFunction)(()=>{d(t),e()})});return t}t.DisposableTracker=h;class g{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,c(this)}dispose(){this._isDisposed||(d(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{f(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 u(e,this),this._isDisposed?g.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),u(e,null))}}t.DisposableStore=g;class m{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new g,c(this),u(this._store,this)}dispose(){d(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}t.Disposable=m;class v{constructor(){this._isDisposed=!1,c(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&u(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,d(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){const e=this._value;return this._value=void 0,e&&u(e,null),e}}t.MutableDisposable=v,t.MandatoryMutableDisposable=class{constructor(e){this._disposable=new v,this._isDisposed=!1,this._disposable.value=e}get value(){return this._disposable.value}set value(e){this._isDisposed||e===this._disposable.value||(this._disposable.value=e)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},t.RefCountedDisposable=class{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return 0===--this._counter&&this._disposable.dispose(),this}},t.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,c(this)}set(e){let t=e;return this.unset=()=>t=void 0,this.isset=()=>void 0!==t,this.dispose=()=>{t&&(t(),t=void 0,d(this))},this}},t.ReferenceCollection=class{constructor(){this.references=new Map}acquire(e,...t){let i=this.references.get(e);i||(i={counter:0,object:this.createReferencedObject(e,...t)},this.references.set(e,i));const{object:s}=i,r=(0,o.createSingleCallFunction)(()=>{0===--i.counter&&(this.destroyReferencedObject(e,i.object),this.references.delete(e))});return i.counter++,{object:s,dispose:r}}},t.AsyncReferenceCollection=class{constructor(e){this.referenceCollection=e}async acquire(e,...t){const i=this.referenceCollection.acquire(e,...t);try{return{object:await i.object,dispose:()=>i.dispose()}}catch(e){throw i.dispose(),e}}},t.ImmortalReference=class{constructor(e){this.object=e}dispose(){}};class S{constructor(){this._store=new Map,this._isDisposed=!1,c(this)}dispose(){d(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{f(this._store.values())}finally{this._store.clear()}}has(e){return this._store.has(e)}get size(){return this._store.size}get(e){return this._store.get(e)}set(e,t,i=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(e)?.dispose(),this._store.set(e,t)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}deleteAndLeak(e){const t=this._store.get(e);return this._store.delete(e),t}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}t.DisposableMap=S},7174(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const s=i(7710);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},7241(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.KittyKeyboard=void 0,t.KittyKeyboard=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440},this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24},this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(e){if(e.code.startsWith("Numpad")){const t=e.code.slice(6);if(t>="0"&&t<="9")return 57399+parseInt(t,10);switch(t){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(e){switch(e.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(e){let t=0;return e.shiftKey&&(t|=1),e.altKey&&(t|=2),e.ctrlKey&&(t|=4),e.metaKey&&(t|=8),t>0?t+1:0}_getKeyCode(e){const t=this._getNumpadKeyCode(e);if(void 0!==t)return t;const i=this._getModifierKeyCode(e);if(void 0!==i)return i;const s=this._functionalKeyCodes[e.key];if(void 0!==s)return s;if(e.shiftKey&&e.code){if(e.code.startsWith("Digit")&&6===e.code.length){const t=e.code.charAt(5);if(t>="0"&&t<="9")return t.charCodeAt(0)}if(e.code.startsWith("Key")&&4===e.code.length)return e.code.charAt(3).toLowerCase().charCodeAt(0)}if(1===e.key.length){const t=e.key.codePointAt(0);return t>=65&&t<=90?t+32:t}}_isModifierKey(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}_buildCsiLetterSequence(e,t,i,s){const r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"["+e}_buildSs3Sequence(e,t,i,s){const r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"O"+e}_buildCsiTildeSequence(e,t,i,s){const r=s&&1!==i;let n="["+e;return(t>0||r)&&(n+=";"+(t>0?t:"1"),r&&(n+=":"+i)),n+="~",n}_buildCsiUSequence(e,t,i,s,r,n,o){const a=!!(2&r);let l,h="["+t;4&r&&e.shiftKey&&1===e.key.length&&!n&&!o&&(l=e.key.codePointAt(0),h+=":"+l);const c=16&r&&3!==s&&1===e.key.length&&!n&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,d=a&&1!==s&&(3===s||void 0===c);return(i>0||d||void 0!==c)&&(h+=";",i>0?h+=i:d&&(h+="1"),d&&(h+=":"+s)),void 0!==c&&(h+=";"+c),h+="u",h}evaluate(e,t,i=1){const s={type:0,cancel:!1,key:void 0},r=this._encodeModifiers(e),n=this._isModifierKey(e),o=!!(2&t);if(!o&&3===i)return s;if(n&&!(8&t)&&!o)return s;const a=this._csiLetterKeys[e.key];if(a)return s.key=this._buildCsiLetterSequence(a,r,i,o),s.cancel=!0,s;const l=this._ss3FunctionKeys[e.key];if(l)return s.key=this._buildSs3Sequence(l,r,i,o),s.cancel=!0,s;const h=this._csiTildeKeys[e.key];if(void 0!==h)return s.key=this._buildCsiTildeSequence(h,r,i,o),s.cancel=!0,s;const c=this._getKeyCode(e);if(void 0===c)return s;const d=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);let u=!1;return 8&t||o?u=!0:1&t&&(27===c||127===c||13===c||9===c||32===c||d?u=!0:r>0&&(u=!(e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length))),u?(s.key=this._buildCsiUSequence(e,c,r,i,t,d,n),s.cancel=!0):1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey||(s.key=e.key),s}static shouldUseProtocol(e){return e>0}}},7262(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const i=2147483647;class s{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i256)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=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{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>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},7276(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0;const n=i(4812),o=i(6501),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let l=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tt[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){const e=s.UnicodeService.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return s.UnicodeService.createPropertyValue(0,i,r)}}},7453(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.clone=function e(t,i=5){if("object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},7704(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlidingWindowAverage=t.MovingAverage=t.Counter=void 0,t.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},t.rot=function(e,t){return(t+e%t)%t},t.isPointWithinTriangle=function(e,t,i,s,r,n,o,a){const l=o-i,h=a-s,c=r-i,d=n-s,u=e-i,_=t-s,f=l*l+h*h,p=l*c+h*d,g=l*u+h*_,m=c*c+d*d,v=c*u+d*_,S=1/(f*m-p*p),b=(m*g-p*v)*S,y=(f*v-p*g)*S;return b>=0&&y>=0&&b+y<1},t.Counter=class{constructor(){this._next=0}getNext(){return this._next++}},t.MovingAverage=class{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},t.SlidingWindowAverage=class{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){const t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._ni,set:e=>i=e};t.promptLabel=s;let r="Too much output to announce, navigate to rows manually to read";const n={get:()=>r,set:e=>r=e};t.tooMuchOutput=n},7745(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o0,pointerEvents:l.mainWindow.PointerEvent&&("ontouchstart"in l.mainWindow||navigator.maxTouchPoints>0)}},7792(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=i(6501),o=i(4812),a=i(8636),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function h(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const c=String.fromCharCode,d={DEFAULT:e=>{const t=[h(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${c(t[0])}${c(t[1])}${c(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${h(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${h(e,!0)};${e.x};${e.y}${t}`}};let u=class extends o.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new a.Emitter),this.onProtocolChange=this._onProtocolChange.event;for(const e of Object.keys(l))this.addProtocol(e,l[e]);for(const e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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,i){if(0===e.deltaY||e.shiftKey)return 0;if(void 0===t||void 0===i)return 0;const s=t/i;let r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=u,t.CoreMouseService=u=s([r(0,n.IBufferService),r(1,n.ICoreService),r(2,n.IOptionsService)],u)},7804(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XTERM_VERSION=void 0,t.XTERM_VERSION="6.1.0-beta.141"},7861(e,t){function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"[200~"+e+"[201~":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),r.triggerDataEvent(e,!0),t.value=""}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i,s)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7883(e,t){var i,s;Object.defineProperty(t,"__esModule",{value:!0}),t.KeyMod=t.KeyCodeUtils=t.ScanCodeUtils=t.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE=t.EVENT_KEY_CODE_MAP=t.ScanCode=t.KeyCode=void 0,t.KeyChord=function(e,t){return(e|(65535&t)<<16>>>0)>>>0},function(e){e[e.DependsOnKbLayout=-1]="DependsOnKbLayout",e[e.Unknown=0]="Unknown",e[e.Backspace=1]="Backspace",e[e.Tab=2]="Tab",e[e.Enter=3]="Enter",e[e.Shift=4]="Shift",e[e.Ctrl=5]="Ctrl",e[e.Alt=6]="Alt",e[e.PauseBreak=7]="PauseBreak",e[e.CapsLock=8]="CapsLock",e[e.Escape=9]="Escape",e[e.Space=10]="Space",e[e.PageUp=11]="PageUp",e[e.PageDown=12]="PageDown",e[e.End=13]="End",e[e.Home=14]="Home",e[e.LeftArrow=15]="LeftArrow",e[e.UpArrow=16]="UpArrow",e[e.RightArrow=17]="RightArrow",e[e.DownArrow=18]="DownArrow",e[e.Insert=19]="Insert",e[e.Delete=20]="Delete",e[e.Digit0=21]="Digit0",e[e.Digit1=22]="Digit1",e[e.Digit2=23]="Digit2",e[e.Digit3=24]="Digit3",e[e.Digit4=25]="Digit4",e[e.Digit5=26]="Digit5",e[e.Digit6=27]="Digit6",e[e.Digit7=28]="Digit7",e[e.Digit8=29]="Digit8",e[e.Digit9=30]="Digit9",e[e.KeyA=31]="KeyA",e[e.KeyB=32]="KeyB",e[e.KeyC=33]="KeyC",e[e.KeyD=34]="KeyD",e[e.KeyE=35]="KeyE",e[e.KeyF=36]="KeyF",e[e.KeyG=37]="KeyG",e[e.KeyH=38]="KeyH",e[e.KeyI=39]="KeyI",e[e.KeyJ=40]="KeyJ",e[e.KeyK=41]="KeyK",e[e.KeyL=42]="KeyL",e[e.KeyM=43]="KeyM",e[e.KeyN=44]="KeyN",e[e.KeyO=45]="KeyO",e[e.KeyP=46]="KeyP",e[e.KeyQ=47]="KeyQ",e[e.KeyR=48]="KeyR",e[e.KeyS=49]="KeyS",e[e.KeyT=50]="KeyT",e[e.KeyU=51]="KeyU",e[e.KeyV=52]="KeyV",e[e.KeyW=53]="KeyW",e[e.KeyX=54]="KeyX",e[e.KeyY=55]="KeyY",e[e.KeyZ=56]="KeyZ",e[e.Meta=57]="Meta",e[e.ContextMenu=58]="ContextMenu",e[e.F1=59]="F1",e[e.F2=60]="F2",e[e.F3=61]="F3",e[e.F4=62]="F4",e[e.F5=63]="F5",e[e.F6=64]="F6",e[e.F7=65]="F7",e[e.F8=66]="F8",e[e.F9=67]="F9",e[e.F10=68]="F10",e[e.F11=69]="F11",e[e.F12=70]="F12",e[e.F13=71]="F13",e[e.F14=72]="F14",e[e.F15=73]="F15",e[e.F16=74]="F16",e[e.F17=75]="F17",e[e.F18=76]="F18",e[e.F19=77]="F19",e[e.F20=78]="F20",e[e.F21=79]="F21",e[e.F22=80]="F22",e[e.F23=81]="F23",e[e.F24=82]="F24",e[e.NumLock=83]="NumLock",e[e.ScrollLock=84]="ScrollLock",e[e.Semicolon=85]="Semicolon",e[e.Equal=86]="Equal",e[e.Comma=87]="Comma",e[e.Minus=88]="Minus",e[e.Period=89]="Period",e[e.Slash=90]="Slash",e[e.Backquote=91]="Backquote",e[e.BracketLeft=92]="BracketLeft",e[e.Backslash=93]="Backslash",e[e.BracketRight=94]="BracketRight",e[e.Quote=95]="Quote",e[e.OEM_8=96]="OEM_8",e[e.IntlBackslash=97]="IntlBackslash",e[e.Numpad0=98]="Numpad0",e[e.Numpad1=99]="Numpad1",e[e.Numpad2=100]="Numpad2",e[e.Numpad3=101]="Numpad3",e[e.Numpad4=102]="Numpad4",e[e.Numpad5=103]="Numpad5",e[e.Numpad6=104]="Numpad6",e[e.Numpad7=105]="Numpad7",e[e.Numpad8=106]="Numpad8",e[e.Numpad9=107]="Numpad9",e[e.NumpadMultiply=108]="NumpadMultiply",e[e.NumpadAdd=109]="NumpadAdd",e[e.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",e[e.NumpadSubtract=111]="NumpadSubtract",e[e.NumpadDecimal=112]="NumpadDecimal",e[e.NumpadDivide=113]="NumpadDivide",e[e.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",e[e.ABNT_C1=115]="ABNT_C1",e[e.ABNT_C2=116]="ABNT_C2",e[e.AudioVolumeMute=117]="AudioVolumeMute",e[e.AudioVolumeUp=118]="AudioVolumeUp",e[e.AudioVolumeDown=119]="AudioVolumeDown",e[e.BrowserSearch=120]="BrowserSearch",e[e.BrowserHome=121]="BrowserHome",e[e.BrowserBack=122]="BrowserBack",e[e.BrowserForward=123]="BrowserForward",e[e.MediaTrackNext=124]="MediaTrackNext",e[e.MediaTrackPrevious=125]="MediaTrackPrevious",e[e.MediaStop=126]="MediaStop",e[e.MediaPlayPause=127]="MediaPlayPause",e[e.LaunchMediaPlayer=128]="LaunchMediaPlayer",e[e.LaunchMail=129]="LaunchMail",e[e.LaunchApp2=130]="LaunchApp2",e[e.Clear=131]="Clear",e[e.MAX_VALUE=132]="MAX_VALUE"}(i||(t.KeyCode=i={})),function(e){e[e.DependsOnKbLayout=-1]="DependsOnKbLayout",e[e.None=0]="None",e[e.Hyper=1]="Hyper",e[e.Super=2]="Super",e[e.Fn=3]="Fn",e[e.FnLock=4]="FnLock",e[e.Suspend=5]="Suspend",e[e.Resume=6]="Resume",e[e.Turbo=7]="Turbo",e[e.Sleep=8]="Sleep",e[e.WakeUp=9]="WakeUp",e[e.KeyA=10]="KeyA",e[e.KeyB=11]="KeyB",e[e.KeyC=12]="KeyC",e[e.KeyD=13]="KeyD",e[e.KeyE=14]="KeyE",e[e.KeyF=15]="KeyF",e[e.KeyG=16]="KeyG",e[e.KeyH=17]="KeyH",e[e.KeyI=18]="KeyI",e[e.KeyJ=19]="KeyJ",e[e.KeyK=20]="KeyK",e[e.KeyL=21]="KeyL",e[e.KeyM=22]="KeyM",e[e.KeyN=23]="KeyN",e[e.KeyO=24]="KeyO",e[e.KeyP=25]="KeyP",e[e.KeyQ=26]="KeyQ",e[e.KeyR=27]="KeyR",e[e.KeyS=28]="KeyS",e[e.KeyT=29]="KeyT",e[e.KeyU=30]="KeyU",e[e.KeyV=31]="KeyV",e[e.KeyW=32]="KeyW",e[e.KeyX=33]="KeyX",e[e.KeyY=34]="KeyY",e[e.KeyZ=35]="KeyZ",e[e.Digit1=36]="Digit1",e[e.Digit2=37]="Digit2",e[e.Digit3=38]="Digit3",e[e.Digit4=39]="Digit4",e[e.Digit5=40]="Digit5",e[e.Digit6=41]="Digit6",e[e.Digit7=42]="Digit7",e[e.Digit8=43]="Digit8",e[e.Digit9=44]="Digit9",e[e.Digit0=45]="Digit0",e[e.Enter=46]="Enter",e[e.Escape=47]="Escape",e[e.Backspace=48]="Backspace",e[e.Tab=49]="Tab",e[e.Space=50]="Space",e[e.Minus=51]="Minus",e[e.Equal=52]="Equal",e[e.BracketLeft=53]="BracketLeft",e[e.BracketRight=54]="BracketRight",e[e.Backslash=55]="Backslash",e[e.IntlHash=56]="IntlHash",e[e.Semicolon=57]="Semicolon",e[e.Quote=58]="Quote",e[e.Backquote=59]="Backquote",e[e.Comma=60]="Comma",e[e.Period=61]="Period",e[e.Slash=62]="Slash",e[e.CapsLock=63]="CapsLock",e[e.F1=64]="F1",e[e.F2=65]="F2",e[e.F3=66]="F3",e[e.F4=67]="F4",e[e.F5=68]="F5",e[e.F6=69]="F6",e[e.F7=70]="F7",e[e.F8=71]="F8",e[e.F9=72]="F9",e[e.F10=73]="F10",e[e.F11=74]="F11",e[e.F12=75]="F12",e[e.PrintScreen=76]="PrintScreen",e[e.ScrollLock=77]="ScrollLock",e[e.Pause=78]="Pause",e[e.Insert=79]="Insert",e[e.Home=80]="Home",e[e.PageUp=81]="PageUp",e[e.Delete=82]="Delete",e[e.End=83]="End",e[e.PageDown=84]="PageDown",e[e.ArrowRight=85]="ArrowRight",e[e.ArrowLeft=86]="ArrowLeft",e[e.ArrowDown=87]="ArrowDown",e[e.ArrowUp=88]="ArrowUp",e[e.NumLock=89]="NumLock",e[e.NumpadDivide=90]="NumpadDivide",e[e.NumpadMultiply=91]="NumpadMultiply",e[e.NumpadSubtract=92]="NumpadSubtract",e[e.NumpadAdd=93]="NumpadAdd",e[e.NumpadEnter=94]="NumpadEnter",e[e.Numpad1=95]="Numpad1",e[e.Numpad2=96]="Numpad2",e[e.Numpad3=97]="Numpad3",e[e.Numpad4=98]="Numpad4",e[e.Numpad5=99]="Numpad5",e[e.Numpad6=100]="Numpad6",e[e.Numpad7=101]="Numpad7",e[e.Numpad8=102]="Numpad8",e[e.Numpad9=103]="Numpad9",e[e.Numpad0=104]="Numpad0",e[e.NumpadDecimal=105]="NumpadDecimal",e[e.IntlBackslash=106]="IntlBackslash",e[e.ContextMenu=107]="ContextMenu",e[e.Power=108]="Power",e[e.NumpadEqual=109]="NumpadEqual",e[e.F13=110]="F13",e[e.F14=111]="F14",e[e.F15=112]="F15",e[e.F16=113]="F16",e[e.F17=114]="F17",e[e.F18=115]="F18",e[e.F19=116]="F19",e[e.F20=117]="F20",e[e.F21=118]="F21",e[e.F22=119]="F22",e[e.F23=120]="F23",e[e.F24=121]="F24",e[e.Open=122]="Open",e[e.Help=123]="Help",e[e.Select=124]="Select",e[e.Again=125]="Again",e[e.Undo=126]="Undo",e[e.Cut=127]="Cut",e[e.Copy=128]="Copy",e[e.Paste=129]="Paste",e[e.Find=130]="Find",e[e.AudioVolumeMute=131]="AudioVolumeMute",e[e.AudioVolumeUp=132]="AudioVolumeUp",e[e.AudioVolumeDown=133]="AudioVolumeDown",e[e.NumpadComma=134]="NumpadComma",e[e.IntlRo=135]="IntlRo",e[e.KanaMode=136]="KanaMode",e[e.IntlYen=137]="IntlYen",e[e.Convert=138]="Convert",e[e.NonConvert=139]="NonConvert",e[e.Lang1=140]="Lang1",e[e.Lang2=141]="Lang2",e[e.Lang3=142]="Lang3",e[e.Lang4=143]="Lang4",e[e.Lang5=144]="Lang5",e[e.Abort=145]="Abort",e[e.Props=146]="Props",e[e.NumpadParenLeft=147]="NumpadParenLeft",e[e.NumpadParenRight=148]="NumpadParenRight",e[e.NumpadBackspace=149]="NumpadBackspace",e[e.NumpadMemoryStore=150]="NumpadMemoryStore",e[e.NumpadMemoryRecall=151]="NumpadMemoryRecall",e[e.NumpadMemoryClear=152]="NumpadMemoryClear",e[e.NumpadMemoryAdd=153]="NumpadMemoryAdd",e[e.NumpadMemorySubtract=154]="NumpadMemorySubtract",e[e.NumpadClear=155]="NumpadClear",e[e.NumpadClearEntry=156]="NumpadClearEntry",e[e.ControlLeft=157]="ControlLeft",e[e.ShiftLeft=158]="ShiftLeft",e[e.AltLeft=159]="AltLeft",e[e.MetaLeft=160]="MetaLeft",e[e.ControlRight=161]="ControlRight",e[e.ShiftRight=162]="ShiftRight",e[e.AltRight=163]="AltRight",e[e.MetaRight=164]="MetaRight",e[e.BrightnessUp=165]="BrightnessUp",e[e.BrightnessDown=166]="BrightnessDown",e[e.MediaPlay=167]="MediaPlay",e[e.MediaRecord=168]="MediaRecord",e[e.MediaFastForward=169]="MediaFastForward",e[e.MediaRewind=170]="MediaRewind",e[e.MediaTrackNext=171]="MediaTrackNext",e[e.MediaTrackPrevious=172]="MediaTrackPrevious",e[e.MediaStop=173]="MediaStop",e[e.Eject=174]="Eject",e[e.MediaPlayPause=175]="MediaPlayPause",e[e.MediaSelect=176]="MediaSelect",e[e.LaunchMail=177]="LaunchMail",e[e.LaunchApp2=178]="LaunchApp2",e[e.LaunchApp1=179]="LaunchApp1",e[e.SelectTask=180]="SelectTask",e[e.LaunchScreenSaver=181]="LaunchScreenSaver",e[e.BrowserSearch=182]="BrowserSearch",e[e.BrowserHome=183]="BrowserHome",e[e.BrowserBack=184]="BrowserBack",e[e.BrowserForward=185]="BrowserForward",e[e.BrowserStop=186]="BrowserStop",e[e.BrowserRefresh=187]="BrowserRefresh",e[e.BrowserFavorites=188]="BrowserFavorites",e[e.ZoomToggle=189]="ZoomToggle",e[e.MailReply=190]="MailReply",e[e.MailForward=191]="MailForward",e[e.MailSend=192]="MailSend",e[e.MAX_VALUE=193]="MAX_VALUE"}(s||(t.ScanCode=s={}));class r{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()]||i.Unknown}}const n=new r,o=new r,a=new r;t.EVENT_KEY_CODE_MAP=new Array(230),t.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE={};const l=[],h=Object.create(null),c=Object.create(null);var d,u;t.ScanCodeUtils={lowerCaseToEnum:e=>c[e]||s.None,toEnum:e=>h[e]||s.None,toString:e=>l[e]||"None"},function(e){e.toString=function(e){return n.keyCodeToStr(e)},e.fromString=function(e){return n.strToKeyCode(e)},e.toUserSettingsUS=function(e){return o.keyCodeToStr(e)},e.toUserSettingsGeneral=function(e){return a.keyCodeToStr(e)},e.fromUserSettings=function(e){return o.strToKeyCode(e)||a.strToKeyCode(e)},e.toElectronAccelerator=function(e){if(e>=i.Numpad0&&e<=i.NumpadDivide)return null;switch(e){case i.UpArrow:return"Up";case i.DownArrow:return"Down";case i.LeftArrow:return"Left";case i.RightArrow:return"Right"}return n.keyCodeToStr(e)}}(d||(t.KeyCodeUtils=d={})),function(e){e[e.CtrlCmd=2048]="CtrlCmd",e[e.Shift=1024]="Shift",e[e.Alt=512]="Alt",e[e.WinCtrl=256]="WinCtrl"}(u||(t.KeyMod=u={}))},8158(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const s=i(8636),r=i(4812);class n{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.Emitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.dispose)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},8163(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isAndroid=t.isEdge=t.isSafari=t.isFirefox=t.isChrome=t.OS=t.OperatingSystem=t.setTimeout0=t.setTimeout0IsFaster=t.translationsConfigFile=t.platformLocale=t.locale=t.Language=t.language=t.userAgent=t.platform=t.isCI=t.isMobile=t.isIOS=t.webWorkerOrigin=t.isWebWorker=t.isWeb=t.isElectron=t.isNative=t.isLinuxSnap=t.isLinux=t.isMacintosh=t.isWindows=t.Platform=t.LANGUAGE_DEFAULT=void 0,t.PlatformToString=function(e){switch(e){case y.Web:return"Web";case y.Mac:return"Mac";case y.Linux:return"Linux";case y.Windows:return"Windows"}},t.isLittleEndian=function(){if(!L){L=!0;const e=new Uint8Array(2);e[0]=1,e[1]=2;const t=new Uint16Array(e.buffer);D=513===t[0]}return D},t.isBigSurOrNewer=function(e){return parseFloat(e)>=20},t.LANGUAGE_DEFAULT="en";let i,s,r,n=!1,o=!1,a=!1,l=!1,h=!1,c=!1,d=!1,u=!1,_=!1,f=!1,p=t.LANGUAGE_DEFAULT,g=t.LANGUAGE_DEFAULT;const m=globalThis;let v;void 0!==m.vscode&&void 0!==m.vscode.process?v=m.vscode.process:"undefined"!=typeof process&&"string"==typeof process?.versions?.node&&(v=process);const S="string"==typeof v?.versions?.electron,b=S&&"renderer"===v?.type;if("object"==typeof v){n="win32"===v.platform,o="darwin"===v.platform,a="linux"===v.platform,l=a&&!!v.env.SNAP&&!!v.env.SNAP_REVISION,d=S,_=!!v.env.CI||!!v.env.BUILD_ARTIFACTSTAGINGDIRECTORY,i=t.LANGUAGE_DEFAULT,p=t.LANGUAGE_DEFAULT;const e=v.env.VSCODE_NLS_CONFIG;if(e)try{const r=JSON.parse(e);i=r.userLocale,g=r.osLocale,p=r.resolvedLanguage||t.LANGUAGE_DEFAULT,s=r.languagePack?.translationsConfigFile}catch(e){}h=!0}else"object"!=typeof navigator||b?console.error("Unable to resolve platform."):(r=navigator.userAgent,n=r.indexOf("Windows")>=0,o=r.indexOf("Macintosh")>=0,u=(r.indexOf("Macintosh")>=0||r.indexOf("iPad")>=0||r.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,a=r.indexOf("Linux")>=0,f=r?.indexOf("Mobi")>=0,c=!0,p=globalThis._VSCODE_NLS_LANGUAGE||t.LANGUAGE_DEFAULT,i=navigator.language.toLowerCase(),g=i);var y;!function(e){e[e.Web=0]="Web",e[e.Mac=1]="Mac",e[e.Linux=2]="Linux",e[e.Windows=3]="Windows"}(y||(t.Platform=y={}));let w=y.Web;var C,E;o?w=y.Mac:n?w=y.Windows:a&&(w=y.Linux),t.isWindows=n,t.isMacintosh=o,t.isLinux=a,t.isLinuxSnap=l,t.isNative=h,t.isElectron=d,t.isWeb=c,t.isWebWorker=c&&"function"==typeof m.importScripts,t.webWorkerOrigin=t.isWebWorker?m.origin:void 0,t.isIOS=u,t.isMobile=f,t.isCI=_,t.platform=w,t.userAgent=r,t.language=p,function(e){e.value=function(){return t.language},e.isDefaultVariant=function(){return 2===t.language.length?"en"===t.language:t.language.length>=3&&"e"===t.language[0]&&"n"===t.language[1]&&"-"===t.language[2]},e.isDefault=function(){return"en"===t.language}}(C||(t.Language=C={})),t.locale=i,t.platformLocale=g,t.translationsConfigFile=s,t.setTimeout0IsFaster="function"==typeof m.postMessage&&!m.importScripts,t.setTimeout0=(()=>{if(t.setTimeout0IsFaster){const e=[];m.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i{const s=++t;e.push({id:s,callback:i}),m.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),function(e){e[e.Windows=1]="Windows",e[e.Macintosh=2]="Macintosh",e[e.Linux=3]="Linux"}(E||(t.OperatingSystem=E={})),t.OS=o||u?E.Macintosh:n?E.Windows:E.Linux;let D=!0,L=!1;t.isChrome=!!(t.userAgent&&t.userAgent.indexOf("Chrome")>=0),t.isFirefox=!!(t.userAgent&&t.userAgent.indexOf("Firefox")>=0),t.isSafari=!!(!t.isChrome&&t.userAgent&&t.userAgent.indexOf("Safari")>=0),t.isEdge=!!(t.userAgent&&t.userAgent.indexOf("Edg/")>=0),t.isAndroid=!!(t.userAgent&&t.userAgent.indexOf("Android")>=0)},8234(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(i+=.25),t){const s=Math.abs(e.deltaX),r=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(s,n),1),l=Math.max(Math.min(r,o),1),h=Math.max(s,n),c=Math.max(r,o);h%a===0&&c%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}t.MouseWheelClassifier=b;class y extends _.Widget{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new p.Emitter),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new p.Emitter),this.onWillScroll=this._onWillScroll.event,this._options=function(e){const t={lazyRender:void 0!==e.lazyRender&&e.lazyRender,className:void 0!==e.className?e.className:"",useShadows:void 0===e.useShadows||e.useShadows,handleMouseWheel:void 0===e.handleMouseWheel||e.handleMouseWheel,flipAxes:void 0!==e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:void 0!==e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:void 0!==e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:void 0!==e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:void 0!==e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:void 0!==e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:void 0===e.scrollPredominantAxis||e.scrollPredominantAxis,mouseWheelSmoothScroll:void 0===e.mouseWheelSmoothScroll||e.mouseWheelSmoothScroll,arrowSize:void 0!==e.arrowSize?e.arrowSize:11,listenOnDomNode:void 0!==e.listenOnDomNode?e.listenOnDomNode:null,horizontal:void 0!==e.horizontal?e.horizontal:v.ScrollbarVisibility.Auto,horizontalScrollbarSize:void 0!==e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:void 0!==e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:void 0!==e.horizontalHasArrows&&e.horizontalHasArrows,vertical:void 0!==e.vertical?e.vertical:v.ScrollbarVisibility.Auto,verticalScrollbarSize:void 0!==e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:void 0!==e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:void 0!==e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:void 0!==e.scrollByPage&&e.scrollByPage};return t.horizontalSliderSize=void 0!==e.horizontalSliderSize?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=void 0!==e.verticalSliderSize?e.verticalSliderSize:t.verticalScrollbarSize,m.isMacintosh&&(t.className+=" mac"),t}(t),this._scrollable=i,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));const s={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new u.VerticalScrollbar(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new d.HorizontalScrollbar(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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=(0,h.createFastDomNode)(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=(0,h.createFastDomNode)(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=(0,h.createFastDomNode)(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new f.TimeoutTimer),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=(0,g.dispose)(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,m.isMacintosh&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){void 0!==e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),void 0!==e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),void 0!==e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),void 0!==e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),void 0!==e.horizontal&&(this._options.horizontal=e.horizontal),void 0!==e.vertical&&(this._options.vertical=e.vertical),void 0!==e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),void 0!==e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),void 0!==e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new c.StandardWheelEvent(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=(0,g.dispose)(this._mouseWheelToDispose),e)){const e=e=>{this._onMouseWheel(new c.StandardWheelEvent(e))};this._mouseWheelToDispose.push(l.addDisposableListener(this._listenOnDomNode,l.EventType.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=b.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+s===0?r=s=0:Math.abs(s)>=Math.abs(r)?r=0:s=0),this._options.flipAxes&&([s,r]=[r,s]);const n=!m.isMacintosh&&e.browserEvent&&e.browserEvent.shiftKey;!this._options.scrollYToX&&!n||r||(r=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(r*=this._options.fastScrollSensitivity,s*=this._options.fastScrollSensitivity);const o=this._scrollable.getFutureScrollPosition();let a={};if(s){const e=50*s,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,t)}if(r){const e=50*r,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet(()=>this._hide(),500)}}t.AbstractScrollableElement=y,t.ScrollableElement=class extends y{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new v.Scrollable({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>l.scheduleAtNextAnimationFrame(l.getWindow(e),t)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},t.SmoothScrollableElement=class extends y{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},t.DomScrollableElement=class extends y{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new v.Scrollable({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>l.scheduleAtNextAnimationFrame(l.getWindow(e),t)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(e=>{e.scrollTopChanged&&(this._element.scrollTop=e.scrollTop),e.scrollLeftChanged&&(this._element.scrollLeft=e.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}},8245(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollbarState=void 0;class i{constructor(e,t,i,s,r,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=r,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new i(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,s,r){const n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=s>0&&s>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};const l=Math.round(Math.max(20,Math.floor(i*o/s))),h=(o-l)/(s-i),c=r*h;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){const e=i._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;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return tt(new h.StandardMouseEvent(a.getWindow(e),i))))}onmousedown(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_DOWN,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onmouseover(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_OVER,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onmouseleave(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_LEAVE,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onkeydown(e,t){this._register(a.addDisposableListener(e,a.EventType.KEY_DOWN,e=>t(new l.StandardKeyboardEvent(e))))}onkeyup(e,t){this._register(a.addDisposableListener(e,a.EventType.KEY_UP,e=>t(new l.StandardKeyboardEvent(e))))}oninput(e,t){this._register(a.addDisposableListener(e,a.EventType.INPUT,t))}onblur(e,t){this._register(a.addDisposableListener(e,a.EventType.BLUR,t))}onfocus(e,t){this._register(a.addDisposableListener(e,a.EventType.FOCUS,t))}onchange(e,t){this._register(a.addDisposableListener(e,a.EventType.CHANGE,t))}ignoreGesture(e){return c.Gesture.ignoreTarget(e)}}t.Widget=u},8297(e,t){function i(e,t,i=e.length-1){for(let s=i;s>=0;s--)if(t(e[s]))return s;return-1}function s(e,t,i=0,s=e.length){let r=i,n=s;for(;r=0&&(i=r)}return i},t.findFirstMin=function(e,t){return o(e,(e,i)=>-t(e,i))},t.findMaxIdx=function(e,t){if(0===e.length)return-1;let i=0;for(let s=1;s0&&(i=s);return i},t.mapFindFirst=function(e,t){for(const i of e){const e=t(i);if(void 0!==e)return e}};class n{static{this.assertInvariants=!1}constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(n.assertInvariants){if(this._prevFindLastPredicate)for(const t of this._array)if(this._prevFindLastPredicate(t)&&!e(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");this._prevFindLastPredicate=e}const t=s(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,-1===t?void 0:this._array[t]}}function o(e,t){if(0===e.length)return;let i=e[0];for(let s=1;s0&&(i=r)}return i}t.MonotonousArray=n},8328(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o{try{e.releasePointerCapture(t)}catch(e){}}))}catch(t){n=a.getWindow(e)}this._hooks.add(a.addDisposableListener(n,a.EventType.POINTER_MOVE,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(a.addDisposableListener(n,a.EventType.POINTER_UP,e=>this.stopMonitoring(!0)))}}},8447(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0,t.cancelOnDispose=function(e){const t=new a;return e.add({dispose(){t.cancel()}}),t.token};const s=i(802),r=Object.freeze(function(e,t){const i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});var n;!function(e){e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof o||!(!t||"object"!=typeof t)&&"boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r})}(n||(t.CancellationToken=n={}));class o{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?r:(this._emitter||(this._emitter=new s.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class a{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new o),this._token}cancel(){this._token?this._token instanceof o&&this._token.cancel():this._token=n.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof o&&this._token.dispose():this._token=n.None}}t.CancellationTokenSource=a},8594(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},a=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o{t.add(l.addDisposableListener(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),t.add(l.addDisposableListener(e.document,"touchend",t=>this.onTouchEnd(e,t))),t.add(l.addDisposableListener(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:h.mainWindow,disposables:this._store}))}static addTarget(e){if(!g.isTouchDevice())return _.Disposable.None;g.INSTANCE||(g.INSTANCE=(0,_.markAsSingleton)(new g));const t=g.INSTANCE.targets.push(e);return(0,_.toDisposable)(t)}static ignoreTarget(e){if(!g.isTouchDevice())return _.Disposable.None;g.INSTANCE||(g.INSTANCE=(0,_.markAsSingleton)(new g));const t=g.INSTANCE.ignoreTargets.push(e);return(0,_.toDisposable)(t)}static isTouchDevice(){return"ontouchstart"in h.mainWindow||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=e.targetTouches.length;i=g.HOLD_DELAY&&Math.abs(o.initialPageX-c.tail(o.rollingPageX))<30&&Math.abs(o.initialPageY-c.tail(o.rollingPageY))<30){const e=this.newGestureEvent(p.Contextmenu,o.initialTarget);e.pageX=c.tail(o.rollingPageX),e.pageY=c.tail(o.rollingPageY),this.dispatchEvent(e)}else if(1===s){const t=c.tail(o.rollingPageX),s=c.tail(o.rollingPageY),r=c.tail(o.rollingTimestamps)-o.rollingTimestamps[0],n=t-o.rollingPageX[0],a=s-o.rollingPageY[0],l=[...this.targets].filter(e=>o.initialTarget instanceof Node&&e.contains(o.initialTarget));this.inertia(e,l,i,Math.abs(n)/r,n>0?1:-1,t,Math.abs(a)/r,a>0?1:-1,s)}this.dispatchEvent(this.newGestureEvent(p.End,o.initialTarget)),delete this.activeTouches[n.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===p.Tap){const t=(new Date).getTime();let i=0;i=t-this._lastSetTapCountTime>g.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=t,e.tapCount=i}else e.type!==p.Change&&e.type!==p.Contextmenu||(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const t of this.ignoreTargets)if(t.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let s=0,r=e.initialTarget;for(;r&&r!==i;)s++,r=r.parentElement;t.push([s,i])}t.sort((e,t)=>e[0]-t[0]);for(const[i,s]of t)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,s,r,n,o,a,h){this.handle=l.scheduleAtNextAnimationFrame(e,()=>{const l=Date.now(),c=l-i;let d=0,u=0,_=!0;s+=g.SCROLL_FRICTION*c,o+=g.SCROLL_FRICTION*c,s>0&&(_=!1,d=r*s*c),o>0&&(_=!1,u=a*o*c);const f=this.newGestureEvent(p.Change);f.translationX=d,f.translationY=u,t.forEach(e=>e.dispatchEvent(f)),_||this.inertia(e,t,l,s,r,n+d,o,a,h+u)})}onTouchMove(e){const t=Date.now();for(let i=0,s=e.changedTouches.length;i3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}}t.Gesture=g,o([d.memoize],g,"isTouchDevice",null)},8636(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EventUtils=t.Emitter=void 0;const s=i(4812);var r;t.Emitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,i)=>{if(this._disposed)return(0,s.toDisposable)(()=>{});const r={fn:e,thisArgs:t};this._listeners.push(r);const n=(0,s.toDisposable)(()=>{const e=this._listeners.indexOf(r);-1!==e&&this._listeners.splice(e,1)});return i&&(Array.isArray(i)?i.push(n):i.add(n)),n}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{const{fn:t,thisArgs:i}=this._listeners[0];return void t.call(i,e)}default:{const t=this._listeners.slice();for(const{fn:i,thisArgs:s}of t)i.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},function(e){e.forward=function(e,t){return e(e=>t.fire(e))},e.map=function(e,t){return(i,s,r)=>e(e=>i.call(s,t(e)),void 0,r)},e.any=function(...e){return(t,i,r)=>{const n=new s.DisposableStore;for(const s of e)n.add(s(e=>t.call(i,e)));return r&&(Array.isArray(r)?r.push(n):r.add(n)),n}},e.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}}(r||(t.EventUtils=r={}))},8693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.startsWith("#")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`};const i=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,s=/^[\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}},8801(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;othis._domNodePointerDown(e)))}_createArrow(e){const t=this._register(new c.ScrollbarArrow(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=(0,l.createFastDomNode)(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(a.addDisposableListener(this.slider.domNode,a.EventType.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{const s=a.getDomNodePagePosition(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}const s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{const r=this._sliderOrthogonalPointerPosition(e),n=Math.abs(r-i);if(_.isWindows&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());const o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}t.AbstractScrollbar=f},8811(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=i(6501);let o=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o,t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8841(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createSingleCallFunction=function(e,t){const i=this;let s,r=!1;return function(){if(r)return s;if(r=!0,t)try{s=e.apply(i,arguments)}finally{t()}else s=e.apply(i,arguments);return s}}},8906(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=i(4812),o=i(6501),a=i(7098),l=i(8636),h=i(7093);let c=class extends n.Disposable{get currentLink(){return this._currentLink}constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new l.Emitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new l.Emitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register((0,n.toDisposable)(()=>{(0,n.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register((0,h.addDisposableListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register((0,h.addDisposableListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register((0,h.addDisposableListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register((0,h.addDisposableListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[s,r]of this._linkProviderService.linkProviders.entries())if(t){const t=this._activeProviderReplies?.get(s);t&&(i=this._checkLinkProviderResult(s,e,i))}else r.provideLinks(e.y,t=>{if(this._isMouseOut)return;const r=t?.map(e=>({link:e}));this._activeProviderReplies?.set(s,r),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;se?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;const s=this._activeProviderReplies.get(e);let r=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let e=0;ethis._linkAtPosition(e.link,t));if(s){i=!0,this._handleNewLink(s);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);var i,s;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,s=this._currentLink.link,i.text===s.text&&i.range.start.x===s.range.start.x&&i.range.start.y===s.range.start.y&&i.range.end.x===s.range.end.x&&i.range.end.y===s.range.end.y)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,n.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};t.Linkifier=c,t.Linkifier=c=s([r(1,a.IMouseService),r(2,a.IRenderService),r(3,o.IBufferService),r(4,a.ILinkProviderService)],c)},8938(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=t.DEFAULT_COLOR<<9|256,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},8960(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Constants=void 0,t.toUint8=function(e){return e<0?0:e>i.MAX_UINT_8?i.MAX_UINT_8:0|e},t.toUint32=function(e){return e<0?0:e>i.MAX_UINT_32?i.MAX_UINT_32:0|e},function(e){e[e.MAX_SAFE_SMALL_INTEGER=1073741824]="MAX_SAFE_SMALL_INTEGER",e[e.MIN_SAFE_SMALL_INTEGER=-1073741824]="MIN_SAFE_SMALL_INTEGER",e[e.MAX_UINT_8=255]="MAX_UINT_8",e[e.MAX_UINT_16=65535]="MAX_UINT_16",e[e.MAX_UINT_32=4294967295]="MAX_UINT_32",e[e.UNICODE_SUPPLEMENTARY_PLANE_BEGIN=65536]="UNICODE_SUPPLEMENTARY_PLANE_BEGIN"}(i||(t.Constants=i={}))},8974(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;othis._arrowPointerDown(e))),this._register(c.addStandardDisposableListener(this.domNode,c.EventType.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new c.WindowIntervalTimer),this._pointerdownScheduleRepeatTimer=this._register(new h.TimeoutTimer)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,c.getWindow(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}}t.ScrollbarArrow=d},9078(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=void 0;const n=i(7174),o=i(9302),a=i(4103),l=i(4812),h=i(6501),c=i(8636),d=a.css.toColor("#ffffff"),u=a.css.toColor("#000000"),_=a.css.toColor("#ffffff"),f=u,p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},g=d;let m=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this._register(new c.Emitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:u,cursor:_,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:a.color.blend(u,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:a.color.blend(u,p),scrollbarSliderBackground:a.color.opacity(d,.2),scrollbarSliderHoverBackground:a.color.opacity(d,.4),scrollbarSliderActiveBackground:a.color.opacity(d,.5),overviewRulerBorder:d,ansi:o.DEFAULT_ANSI_COLORS.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)))}_setTheme(e={}){const t=this._colors;if(t.foreground=v(e.foreground,d),t.background=v(e.background,u),t.cursor=a.color.blend(t.background,v(e.cursor,_)),t.cursorAccent=a.color.blend(t.background,v(e.cursorAccent,f)),t.selectionBackgroundTransparent=v(e.selectionBackground,p),t.selectionBackgroundOpaque=a.color.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=v(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=a.color.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?v(e.selectionForeground,a.NULL_COLOR):void 0,t.selectionForeground===a.NULL_COLOR&&(t.selectionForeground=void 0),a.color.isOpaque(t.selectionBackgroundTransparent)){const e=.3;t.selectionBackgroundTransparent=a.color.opacity(t.selectionBackgroundTransparent,e)}if(a.color.isOpaque(t.selectionInactiveBackgroundTransparent)){const e=.3;t.selectionInactiveBackgroundTransparent=a.color.opacity(t.selectionInactiveBackgroundTransparent,e)}if(t.scrollbarSliderBackground=v(e.scrollbarSliderBackground,a.color.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=v(e.scrollbarSliderHoverBackground,a.color.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=v(e.scrollbarSliderActiveBackground,a.color.opacity(t.foreground,.5)),t.overviewRulerBorder=v(e.overviewRulerBorder,g),t.ansi=o.DEFAULT_ANSI_COLORS.slice(),t.ansi[0]=v(e.black,o.DEFAULT_ANSI_COLORS[0]),t.ansi[1]=v(e.red,o.DEFAULT_ANSI_COLORS[1]),t.ansi[2]=v(e.green,o.DEFAULT_ANSI_COLORS[2]),t.ansi[3]=v(e.yellow,o.DEFAULT_ANSI_COLORS[3]),t.ansi[4]=v(e.blue,o.DEFAULT_ANSI_COLORS[4]),t.ansi[5]=v(e.magenta,o.DEFAULT_ANSI_COLORS[5]),t.ansi[6]=v(e.cyan,o.DEFAULT_ANSI_COLORS[6]),t.ansi[7]=v(e.white,o.DEFAULT_ANSI_COLORS[7]),t.ansi[8]=v(e.brightBlack,o.DEFAULT_ANSI_COLORS[8]),t.ansi[9]=v(e.brightRed,o.DEFAULT_ANSI_COLORS[9]),t.ansi[10]=v(e.brightGreen,o.DEFAULT_ANSI_COLORS[10]),t.ansi[11]=v(e.brightYellow,o.DEFAULT_ANSI_COLORS[11]),t.ansi[12]=v(e.brightBlue,o.DEFAULT_ANSI_COLORS[12]),t.ansi[13]=v(e.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),t.ansi[14]=v(e.brightCyan,o.DEFAULT_ANSI_COLORS[14]),t.ansi[15]=v(e.brightWhite,o.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;se.call(t,i,i,this))}[Symbol.iterator](){return this.values()}}t.SetWithKey=s},9176(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257},9249(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Win32InputMode=void 0,t.Win32InputMode=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226},this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40},this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]),this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(e){const t=this._codeToVk[e.code];return void 0!==t?t:e.keyCode||0}_getScanCode(e){return this._codeToScancode[e.code]||0}_getUnicodeChar(e){if(e.ctrlKey&&!e.altKey&&!e.metaKey){if("Enter"===e.key)return 10;if("Backspace"===e.key)return 127}const t=this._keyToControlChar[e.key];if(void 0!==t)return t;if(1===e.key.length){const t=e.key.codePointAt(0)||0;if(e.ctrlKey&&!e.altKey&&!e.metaKey){if(t>=65&&t<=90)return t-64;if(t>=97&&t<=122)return t-96}return t}return 0}_getControlKeyState(e){let t=0;return e.shiftKey&&(t|=16),e.ctrlKey&&("ControlRight"===e.code?t|=4:t|=8),e.altKey&&("AltRight"===e.code?t|=1:t|=2),this._enhancedKeyCodes.has(e.code)&&(t|=256),t}evaluateKeyboardEvent(e,t){return{type:0,cancel:!0,key:`[${this._getVirtualKeyCode(e)};${this._getScanCode(e)};${this._getUnicodeChar(e)};${t?1:0};${this._getControlKeyState(e)};1_`}}}},9302(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_ANSI_COLORS=void 0;const s=i(4103);t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[s.css.toColor("#2e3436"),s.css.toColor("#cc0000"),s.css.toColor("#4e9a06"),s.css.toColor("#c4a000"),s.css.toColor("#3465a4"),s.css.toColor("#75507b"),s.css.toColor("#06989a"),s.css.toColor("#d3d7cf"),s.css.toColor("#555753"),s.css.toColor("#ef2929"),s.css.toColor("#8ae234"),s.css.toColor("#fce94f"),s.css.toColor("#729fcf"),s.css.toColor("#ad7fa8"),s.css.toColor("#34e2e2"),s.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const r=t[i/36%6|0],n=t[i/6%6|0],o=t[i%6];e.push({css:s.channels.toCss(r,n,o),rgba:s.channels.toRgba(r,n,o)})}for(let t=0;t<24;t++){const i=8+10*t;e.push({css:s.channels.toCss(i,i,i),rgba:s.channels.toRgba(i,i,i)})}return e})())},9384(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},9574(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const s=i(8636),r=i(7093),n=i(4812);class o extends n.Disposable{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new a(this._window)),this._onDprChange=this._register(new s.Emitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new s.Emitter),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(s.EventUtils.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register((0,r.addDisposableListener)(this._textarea,"focus",()=>this._isFocused=!0)),this._register((0,r.addDisposableListener)(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=o;class a extends n.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new n.MutableDisposable),this._onDprChange=this._register(new s.Emitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register((0,n.toDisposable)(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,r.addDisposableListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}}},9640(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(4812),o=i(4097),a=i(6501),l=i(8636);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let h=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new l.Emitter),this.onResize=this._onResize.event,this._onScroll=this._register(new l.Emitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this._register(new o.BufferSet(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}resize(e,t){const i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){const i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};t.BufferService=h,t.BufferService=h=s([r(0,a.IOptionsService)],h)},9675(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.FastDomNode=void 0,t.createFastDomNode=function(e){return new i(e)};class i{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){const t=s(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=s(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=s(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=s(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=s(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=s(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=s(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){const t=s(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){const t=s(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){const t=s(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){const t=s(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){const t=s(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){const t=s(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=s(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function s(e){return"number"==typeof e?`${e}px`:e}t.FastDomNode=i},9686(e,t){function i(e,t,i,n){const l=e-s(e,i),h=t-s(t,i),c=Math.abs(l-h)-function(e,t,i){let n=0;const o=e-s(e,i),a=t-s(t,i);for(let s=0;s=0&&et?"A":"B"}function n(e,t,i,s,r,n){let o=e,a=t,l="";for(;(o!==i||a!==s)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function o(e,t){return""+(t?"O":"[")+e}function a(e,t){e=Math.floor(e);let i="";for(let s=0;s0?l-s(l,h):t;const u=l,_=function(e,t,r,n,o,a){let l;return l=i(r,n,o,a).length>0?n-s(n,o):t,e=r&&le?"D":"C",a(Math.abs(h-e),o(d,l));d=c>t?"D":"C";const u=Math.abs(c-t);return a(function(e,t){return t.cols-e}(c>t?e:h,r)+(u-1)*r.cols+1+((c>t?h:e)-1),o(d,l))}},9725(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.StopWatch=void 0;const i=globalThis.performance&&"function"==typeof globalThis.performance.now;class s{static create(e){return new s(e)}constructor(e){this._now=i&&!1===e?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-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}}t.StopWatch=s},9784(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=i(7093),o=i(7098),a=i(5251);let l=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,a.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,a.getCoordsRelativeToElement)((0,n.getWindow)(t),e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=l,t.MouseService=l=s([r(0,o.IRenderService),r(1,o.ICharSizeService)],l)},9807(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BugIndicatingError=t.ErrorNoTelemetry=t.ExpectedError=t.NotSupportedError=t.NotImplementedError=t.ReadonlyError=t.CancellationError=t.errorHandler=t.ErrorHandler=void 0,t.setUnexpectedErrorHandler=function(e){t.errorHandler.setUnexpectedErrorHandler(e)},t.isSigPipeError=function(e){if(!e||"object"!=typeof e)return!1;const t=e;return"EPIPE"===t.code&&"WRITE"===t.syscall?.toUpperCase()},t.onUnexpectedError=function(e){r(e)||t.errorHandler.onUnexpectedError(e)},t.onUnexpectedExternalError=function(e){r(e)||t.errorHandler.onUnexpectedExternalError(e)},t.transformErrorForSerialization=function(e){if(e instanceof Error){const{name:t,message:i}=e;return{$isError:!0,name:t,message:i,stack:e.stacktrace||e.stack,noTelemetry:c.isErrorNoTelemetry(e)}}return e},t.transformErrorFromSerialization=function(e){let t;return e.noTelemetry?t=new c:(t=new Error,t.name=e.name),t.message=e.message,t.stack=e.stack,t},t.isCancellationError=r,t.canceled=function(){const e=new Error(s);return e.name=e.message,e},t.illegalArgument=function(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")},t.illegalState=function(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")},t.getErrorMessage=function(e){return e?e.message?e.message:e.stack?e.stack.split("\n")[0]:String(e):"Error"};class i{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{if(e.stack){if(c.isErrorNoTelemetry(e))throw new c(e.message+"\n\n"+e.stack);throw new Error(e.message+"\n\n"+e.stack)}throw 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)}}t.ErrorHandler=i,t.errorHandler=new i;const s="Canceled";function r(e){return e instanceof n||e instanceof Error&&e.name===s&&e.message===s}class n extends Error{constructor(){super(s),this.name=this.message}}t.CancellationError=n;class o extends TypeError{constructor(e){super(e?`${e} is read-only and cannot be changed`:"Cannot change read-only property")}}t.ReadonlyError=o;class a extends Error{constructor(e){super("NotImplemented"),e&&(this.message=e)}}t.NotImplementedError=a;class l extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}t.NotSupportedError=l;class h extends Error{constructor(){super(...arguments),this.isExpected=!0}}t.ExpectedError=h;class c extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof c)return e;const t=new c;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}}t.ErrorNoTelemetry=c;class d extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,d.prototype)}}t.BugIndicatingError=d},9820(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const s=i(4812);class r extends s.Disposable{constructor(){super(),this.linkProviders=[],this._register((0,s.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{const t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=r},9823(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(726),r=i(7262),n=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=n,this._ident=0}};const o=new r.Params;o.addParam(0);class a{constructor(e){this._handler=e,this._data="",this._params=o,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():o,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>a._payloadLimit&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=o,this._data="",this._hitLimit=!1,e));return this._params=o,this._data="",this._hitLimit=!1,t}}t.DcsHandler=a,a._payloadLimit=1e7},9881(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.SmoothScrollingOperation=t.SmoothScrollingUpdate=t.Scrollable=t.ScrollState=t.ScrollbarVisibility=void 0;const s=i(802),r=i(7150);var n;!function(e){e[e.Auto=1]="Auto",e[e.Hidden=2]="Hidden",e[e.Visible=3]="Visible"}(n||(t.ScrollbarVisibility=n={}));class o{constructor(e,t,i,s,r,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,s|=0,r|=0,n|=0,o|=0),this.rawScrollLeft=s,this.rawScrollTop=o,t<0&&(t=0),s+t>i&&(s=i-t),s<0&&(s=0),r<0&&(r=0),o+r>n&&(o=n-r),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=s,this.height=r,this.scrollHeight=n,this.scrollTop=o}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 o(this._forceIntegerValues,void 0!==e.width?e.width:this.width,void 0!==e.scrollWidth?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,void 0!==e.height?e.height:this.height,void 0!==e.scrollHeight?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new o(this._forceIntegerValues,this.width,this.scrollWidth,void 0!==e.scrollLeft?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,void 0!==e.scrollTop?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,r=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=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:i,scrollWidthChanged:s,scrollLeftChanged:r,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}}t.ScrollState=o;class a extends r.Disposable{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new s.Emitter),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new o(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){const i=this._state.withScrollDimensions(e,t);this._setState(i,Boolean(this._smoothScrolling)),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:void 0===e.scrollLeft?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:void 0===e.scrollTop?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;s=t?new c(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{const t=this._state.withScrollPosition(e);this._smoothScrolling=c.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return Boolean(this._smoothScrolling)}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);return this._setState(t,!0),this._smoothScrolling?e.isDone?(this._smoothScrolling.dispose(),void(this._smoothScrolling=null)):void(this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})):void 0}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}t.Scrollable=a;class l{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function h(e,t){const i=t-e;return function(t){return e+i*(1-(s=1-t,Math.pow(s,3)));var s}}t.SmoothScrollingUpdate=l;class c{constructor(e,t,i,s){this.from=e,this.to=t,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let o,a;return e=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(957),o=i(7098),a=i(4812),l=i(6501),h={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0};let u=class extends a.Disposable{get _width(){return this._optionsService.options.overviewRuler?.width||0}constructor(e,t,i,s,r,o,l,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register((0,a.toDisposable)(()=>this._canvas?.remove()));const c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);c.full=this._canvas.width,c.left=e,c.center=t,c.right=e,this._refreshDrawHeightConstants(),d.full=1,d.left=1,d.center=1+c.left,d.right=1+c.left+c.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);h.left=t,h.center=t,h.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.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(const e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-h[e.position||"full"]/2),c[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=u,t.OverviewRulerRenderer=u=s([r(2,l.IBufferService),r(3,l.IDecorationService),r(4,o.IRenderService),r(5,l.IOptionsService),r(6,o.IThemeService),r(7,o.ICoreBrowserService)],u)}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=i(7721),r=i(1718),n=i(4812),o=i(3027),a=i(5101),l=i(6097),h=i(4335),c=["cols","rows"];let d=0;class u extends n.Disposable{constructor(e){super(),this._core=this._register(new r.CoreBrowserTerminal(e)),this._addonManager=this._register(new o.AddonManager),this._publicOptions={...this._core.options};const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const e in this._core.options){const s={get:t.bind(this,e),set:i.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(c.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get parser(){return this._parser??=new l.ParserApi(this._core)}get unicode(){return this._checkProposedApi(),new h.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer??=this._register(new a.BufferNamespaceApi(this._core))}get markers(){return this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return t.promptLabel.get()},set promptLabel(e){t.promptLabel.set(e)},get tooMuchOutput(){return t.tooMuchOutput.get()},set tooMuchOutput(e){t.tooMuchOutput.set(e)}}}_verifyIntegers(...e){for(d of e)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(d of e)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}e.Terminal=u})(),s})()); +-//# sourceMappingURL=xterm.js.map +\ No newline at end of file ++!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(globalThis,()=>(()=>{"use strict";var e={56(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(4812),r=i(701),n=i(8636);t.DEFAULT_OPTIONS={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:r.isMac,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",overviewRuler:{},quirks:{},vtExtensions:{}};const o=["normal","bold","100","200","300","400","500","600","700","800","900"];class a extends s.Disposable{constructor(e){super(),this._onOptionChange=this._register(new n.Emitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register((0,s.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{-1!==e.indexOf(i)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=a},79(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollbarVisibilityController=void 0;const s=i(1758),r=i(7150),n=i(9881);class o extends r.Disposable{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new s.TimeoutTimer)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility!==n.ScrollbarVisibility.Hidden&&(this._visibility===n.ScrollbarVisibility.Visible||this._rawShouldBeVisible)}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}t.ScrollbarVisibilityController=o},151(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.HorizontalScrollbar=void 0;const s=i(8801),r=i(8245),n=i(9881);class o extends s.AbstractScrollbar{constructor(e,t,i){const s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new r.ScrollbarState(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===n.ScrollbarVisibility.Hidden?0:t.horizontalScrollbarSize,t.vertical===n.ScrollbarVisibility.Hidden?0:t.verticalScrollbarSize,s.width,s.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===n.ScrollbarVisibility.Hidden?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===n.ScrollbarVisibility.Hidden?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}t.HorizontalScrollbar=o},626(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Lazy=void 0,t.Lazy=class{constructor(e){this.executor=e,this._didRun=!1}get hasValue(){return this._didRun}get value(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}},701(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isMac=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isNode=!("undefined"==typeof process||!("title"in process)||"undefined"!=typeof navigator&&!navigator.userAgent.startsWith("Node.js/"));const i=t.isNode?"node":navigator.userAgent,s=t.isNode?"node":navigator.platform;t.isFirefox=i.includes("Firefox"),t.isLegacyEdge=i.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(s),t.isWindows=["Windows","Win16","Win32","WinCE"].includes(s),t.isLinux=s.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(i)},706(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=function(e,t,s,r){const n={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?n.key=t?"OA":"":"UIKeyInputLeftArrow"===e.key?n.key=t?"OD":"":"UIKeyInputRightArrow"===e.key?n.key=t?"OC":"":"UIKeyInputDownArrow"===e.key&&(n.key=t?"OB":"");break;case 8:n.key=e.ctrlKey?"\b":"",e.altKey&&(n.key=""+n.key);break;case 9:if(e.shiftKey){n.key="";break}n.key="\t",n.cancel=!0;break;case 13:n.key=e.altKey?"\r":"\r",n.cancel=!0;break;case 27:n.key="",e.altKey&&(n.key=""),n.cancel=!0;break;case 37:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"D":t?"OD":"";break;case 39:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"C":t?"OC":"";break;case 38:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"A":t?"OA":"";break;case 40:if(e.metaKey)break;n.key=o?"[1;"+(o+1)+"B":t?"OB":"";break;case 45:e.shiftKey||e.ctrlKey||(n.key="[2~");break;case 46:n.key=o?"[3;"+(o+1)+"~":"[3~";break;case 36:n.key=o?"[1;"+(o+1)+"H":t?"OH":"";break;case 35:n.key=o?"[1;"+(o+1)+"F":t?"OF":"";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key="[5;"+(o+1)+"~":n.key="[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key="[6;"+(o+1)+"~":n.key="[6~";break;case 112:n.key=o?"[1;"+(o+1)+"P":"OP";break;case 113:n.key=o?"[1;"+(o+1)+"Q":"OQ";break;case 114:n.key=o?"[1;"+(o+1)+"R":"OR";break;case 115:n.key=o?"[1;"+(o+1)+"S":"OS";break;case 116:n.key=o?"[15;"+(o+1)+"~":"[15~";break;case 117:n.key=o?"[17;"+(o+1)+"~":"[17~";break;case 118:n.key=o?"[18;"+(o+1)+"~":"[18~";break;case 119:n.key=o?"[19;"+(o+1)+"~":"[19~";break;case 120:n.key=o?"[20;"+(o+1)+"~":"[20~";break;case 121:n.key=o?"[21;"+(o+1)+"~":"[21~";break;case 122:n.key=o?"[23;"+(o+1)+"~":"[23~";break;case 123:n.key=o?"[24;"+(o+1)+"~":"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(s&&!r||!e.altKey||e.metaKey)if(!s||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey){if(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length)n.key=e.key;else if(e.key&&e.ctrlKey&&e.shiftKey)switch(e.code){case"Minus":n.key="";break;case"Digit2":n.key="\0";break;case"Digit6":n.key=""}}else 65===e.keyCode&&(n.type=1);else{const t=i[e.keyCode],s=t?.[e.shiftKey?1:0];if(s)n.key=""+s;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),n.key=""+i}else if(32===e.keyCode)n.key=""+(e.ctrlKey?"\0":" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),n.key=""+t,n.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key="\0":e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key="":"/"===e.key?n.key="":219===e.keyCode?n.key="":220===e.keyCode?n.key="":221===e.keyCode&&(n.key="")}return n};const i={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:["'",'"']}},726(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s="";for(let r=t;r65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o);continue}65279!==r&&(t[s++]=r)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const i=e.length;if(!i)return 0;let s,r,n,o,a=0,l=0,h=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,c=l-o;for(;h=i)return 0;if(n=e[h++],128!=(192&n)){h--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===l?r<128?h--:t[a++]=r:3===l?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0)}const c=i-4;let d=h;for(;d=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(l=(31&s)<<6|63&r,l<128){d--;continue}t[a++]=l}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(l=(15&s)<<12|(63&r)<<6|63&n,l<2048||l>=55296&&l<=57343||65279===l)continue;t[a++]=l}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,l<65536||l>1114111)continue;t[a++]=l}}return a}}},732(e,t){function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,"__esModule",{value:!0}),t.reflowLargerGetLinesToRemove=function(e,t,s,r,n,o){const a=[];for(let l=0;l=l&&r0&&(e>u||0===d[e].getTrimmedLength());e--)g++;g>0&&(a.push(l+d.length-g),a.push(g)),l+=d.length-1}return a},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;oi(e,r,t)).reduce((e,t)=>e+t);let o=0,a=0,l=0;for(;lh&&(o-=h,a++);const c=2===e[a].getWidth(o-1);c&&o--;const d=c?s-1:s;r.push(d),l+=d}return r},t.getWrappedLineTrimmedLength=i},793(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const s=i(3055);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},802(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueWithChangeEvent=t.Relay=t.EventBufferer=t.DynamicListEventMultiplexer=t.EventMultiplexer=t.MicrotaskEmitter=t.DebounceEmitter=t.PauseableEmitter=t.AsyncEmitter=t.createEventDeliveryQueue=t.Emitter=t.ListenerRefusalError=t.ListenerLeakError=t.EventProfiling=t.Event=void 0,t.setGlobalLeakWarningThreshold=function(e){const t=c;return c=e,{dispose(){c=t}}};const s=i(9807),r=i(8841),n=i(7150),o=i(6317),a=i(9725);var l;!function(e){function t(e){return(t,i=null,s)=>{let r,n=!1;return r=e(e=>{if(!n)return r?r.dispose():n=!0,t.call(i,e)},null,s),n&&r.dispose(),r}}function i(e,t,i){return r((i,s=null,r)=>e(e=>i.call(s,t(e)),null,r),i)}function s(e,t,i){return r((i,s=null,r)=>e(e=>t(e)&&i.call(s,e),null,r),i)}function r(e,t){let i;const s=new m({onWillAddFirstListener(){i=e(s.fire,s)},onDidRemoveLastListener(){i?.dispose()}});return t?.add(s),s.event}function o(e,t,i=100,s=!1,r=!1,n,o){let a,l,h,c,d=0;const u=new m({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{d++,l=t(l,e),s&&!h&&(u.fire(l),l=void 0),c=()=>{const e=l;l=void 0,h=void 0,(!s||d>1)&&u.fire(e),d=0},"number"==typeof i?(clearTimeout(h),h=setTimeout(c,i)):void 0===h&&(h=0,queueMicrotask(c))})},onWillRemoveListener(){r&&d>0&&c?.()},onDidRemoveLastListener(){c=void 0,a.dispose()}});return o?.add(u),u.event}e.None=()=>n.Disposable.None,e.defer=function(e,t){return o(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return r((i,s=null,r)=>e(e=>{t(e),i.call(s,e)},null,r),i)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,s)=>{return r=(0,n.combinedDisposable)(...e.map(e=>e(e=>t.call(i,e)))),(o=s)instanceof Array?o.push(r):o&&o.add(r),r;var r,o}},e.reduce=function(e,t,s,r){let n=s;return i(e,e=>(n=t(n,e),n),r)},e.debounce=o,e.accumulate=function(t,i=0,s){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,s)},e.latch=function(e,t=(e,t)=>e===t,i){let r,n=!0;return s(e,e=>{const i=n||!t(e,r);return n=!1,r=e,i},i)},e.split=function(t,i,s){return[e.filter(t,i,s),e.filter(t,e=>!i(e),s)]},e.buffer=function(e,t=!1,i=[],s){let r=i.slice(),n=e(e=>{r?r.push(e):a.fire(e)});s&&s.add(n);const o=()=>{r?.forEach(e=>a.fire(e)),r=null},a=new m({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),s&&s.add(n))},onDidAddFirstListener(){r&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return s&&s.add(a),a.event},e.chain=function(e,t){return(i,s,r)=>{const n=t(new l);return e(function(e){const t=n.evaluate(e);t!==a&&i.call(s,t)},void 0,r)}};const a=Symbol("HaltChainable");class l{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:a),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(s=>{const r=i||!e(s,t);return i=!1,t=s,r?s:a}),this}evaluate(e){for(const t of this.steps)if((e=t(e))===a)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){const s=(...e)=>r.fire(i(...e)),r=new m({onWillAddFirstListener:()=>e.on(t,s),onDidRemoveLastListener:()=>e.removeListener(t,s)});return r.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){const s=(...e)=>r.fire(i(...e)),r=new m({onWillAddFirstListener:()=>e.addEventListener(t,s),onDidRemoveLastListener:()=>e.removeEventListener(t,s)});return r.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){const t=new m;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class h{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;const i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new m(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new h(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,s)=>{let r=0,o=!1;const a={beginUpdate(){r++},endUpdate(){r--,0===r&&(e.reportChanges(),o&&(o=!1,t.call(i)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();const l={dispose(){e.removeObserver(a)}};return s instanceof n.DisposableStore?s.add(l):Array.isArray(s)&&s.push(l),l}}}(l||(t.Event=l={}));class h{static{this.all=new Set}static{this._idPool=0}constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${h._idPool++}`,h.all.add(this)}start(e){this._stopWatch=new a.StopWatch,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}}t.EventProfiling=h;let c=-1;class d{static{this._idPool=1}constructor(e,t,i=(d._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){const i=this.threshold;if(i<=0||t{const t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,s]of this._stacks)(!e||t0||this._options?.leakWarningThreshold?new d(e?.onListenerError??s.onUnexpectedError,this._options?.leakWarningThreshold??c):void 0,this._perfMon=this._options?._profName?new h(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);const t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new f(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||s.onUnexpectedError)(i),n.Disposable.None}if(this._disposed)return n.Disposable.None;t&&(e=e.bind(t));const r=new g(e);let o;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(r.stack=u.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof g?(this._deliveryQueue??=new v,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;const a=(0,n.toDisposable)(()=>{o?.(),this._removeListener(r)});return i instanceof n.DisposableStore?i.add(a):Array.isArray(i)&&i.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);const t=this._listeners,i=t.indexOf(e);if(-1===i)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[i]=void 0;const s=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i0}}t.Emitter=m,t.createEventDeliveryQueue=()=>new v;class v{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}t.AsyncEmitter=class extends m{async fireAsync(e,t,i){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new o.LinkedList),((e,t)=>{if(e instanceof g)t(e);else for(let i=0;ithis._asyncDeliveryQueue.push([t.value,e]));this._asyncDeliveryQueue.size>0&&!t.isCancellationRequested;){const[e,r]=this._asyncDeliveryQueue.shift(),n=[],o={...r,token:t,waitUntil:t=>{if(Object.isFrozen(n))throw new Error("waitUntil can NOT be called asynchronous");i&&(t=i(t,e)),n.push(t)}};try{e(o)}catch(e){(0,s.onUnexpectedError)(e);continue}Object.freeze(n),await Promise.allSettled(n).then(e=>{for(const t of e)"rejected"===t.status&&(0,s.onUnexpectedError)(t.reason)})}}};class S extends m{get isPaused(){return 0!==this._isPaused}constructor(e){super(e),this._isPaused=0,this._eventQueue=new o.LinkedList,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(0!==this._isPaused&&0===--this._isPaused)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&0!==this._eventQueue.size;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(0!==this._isPaused?this._eventQueue.push(e):super.fire(e))}}t.PauseableEmitter=S,t.DebounceEmitter=class extends S{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}},t.MicrotaskEmitter=class extends m{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),1===this._queuedEvents.length&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(e=>super.fire(e)),this._queuedEvents=[]}))}};class b{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new m({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),(0,n.toDisposable)((0,r.createSingleCallFunction)(()=>{this.hasListeners&&this.unhook(t);const e=this.events.indexOf(t);this.events.splice(e,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(e=>this.emitter.fire(e))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(const e of this.events)e.listener?.dispose();this.events=[]}}t.EventMultiplexer=b,t.DynamicListEventMultiplexer=class{constructor(e,t,i,s){this._store=new n.DisposableStore;const r=this._store.add(new b),o=this._store.add(new n.DisposableMap);function a(e){o.set(e,r.add(s(e)))}for(const t of e)a(t);this._store.add(t(e=>{a(e)})),this._store.add(i(e=>{o.deleteAndDispose(e)})),this.event=r.event}dispose(){this._store.dispose()}},t.EventBufferer=class{constructor(){this.data=[]}wrapEvent(e,t,i){return(s,r,n)=>e(e=>{const n=this.data[this.data.length-1];if(!t)return void(n?n.buffers.push(()=>s.call(r,e)):s.call(r,e));const o=n;o?(o.items??=[],o.items.push(e),0===o.buffers.length&&n.buffers.push(()=>{o.reducedResult??=i?o.items.reduce(t,i):o.items.reduce(t),s.call(r,o.reducedResult)})):s.call(r,t(i,e))},void 0,n)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(e=>e()),i}},t.Relay=class{constructor(){this.listening=!1,this.inputEvent=l.None,this.inputEventListener=n.Disposable.None,this.emitter=new m({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},t.ValueWithChangeEvent=class{static const(e){return new y(e)}constructor(e){this._value=e,this._onDidChange=new m,this.onDidChange=this._onDidChange.event}get value(){return this._value}set value(e){e!==this._value&&(this._value=e,this._onDidChange.fire(void 0))}};class y{constructor(e){this.value=e,this.onDidChange=l.None}}},945(e,t,i){var s,r=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const o=i(5451),a=i(8938),l=i(3055),h=i(6501);class c extends o.AttributeData{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let d=s=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new l.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){const e=this._getJoinedRanges(s,o,n,t,r);for(let t=0;t1){const e=this._getJoinedRanges(s,o,n,t,r);for(let t=0;t=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},1073(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(5639),r=i(6168),n=i(5451),o=i(6107),a=i(732),l=i(3055),h=i(8938),c=i(8158),d=i(6760);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.savedCharsets=[],this.savedGlevel=0,this.savedOriginMode=!1,this.savedWraparoundMode=!0,this.markers=[],this._nullCell=l.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(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 n.ExtendedAttrs),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 n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){e??=o.DEFAULT_ATTR_DATA;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 s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 t=0;t0){const e=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,e)}this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=this._optionsService.rawOptions.reflowCursorLine,s=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA),i);if(s.length>0){const i=(0,a.reflowLargerCreateNewLayout)(this.lines,s);(0,a.reflowLargerApplyNewLayout)(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;l--){let h=this.lines.get(l);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const c=[h];for(;h.isWrapped&&l>0;)h=this.lines.get(--l),c.unshift(h);if(!i){const e=this.ybase+this.y;if(e>=l&&e0&&(r.push({start:l+c.length+n,newLines:p}),n+=p.length),c.push(...p);let g=u.length-1,m=u[g];0===m&&(g--,m=u[g]);let v=c.length-_-1,S=d;for(;v>=0;){const e=Math.min(S,m);if(void 0===c[g])break;if(c[g].copyCellsFrom(c[v],S-e,m-e,e,!0),m-=e,0===m&&(g--,m=u[g]),S-=e,0===S){v--;const e=Math.max(v,0);S=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t0;)0===this.ybase?this.y0){const e=[],t=[];for(let e=0;e=0;h--)if(a&&a.start>s+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(h--,a.newLines[e]);h++,e.push({index:s+1,amount:a.newLines.length}),l+=a.newLines.length,a=r[++o]}else this.lines.set(h,t[s--]);let h=0;for(let t=e.length-1;t>=0;t--)e[t].index+=h,this.lines.onInsertEmitter.fire(e[t]),h+=e[t].amount;const c=Math.max(0,i+n-this.lines.maxLength);c>0&&this.lines.onTrimEmitter.fire(c)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},1316(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.noBreakWhitespace=t.CodePointIterator=void 0,t.isFalsyOrWhitespace=function(e){return!e||"string"!=typeof e||0===e.trim().length},t.format=function(e,...t){return 0===t.length?e:e.replace(n,function(e,i){const s=parseInt(i,10);return isNaN(s)||s<0||s>=t.length?e:t[s]})},t.format2=function(e,t){return 0===Object.keys(t).length?e:e.replace(o,(e,i)=>t[i]??e)},t.htmlAttributeEncodeValue=function(e){return e.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return e})},t.escape=function(e){return e.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})},t.escapeRegExpCharacters=a,t.count=function(e,t){let i=0,s=e.indexOf(t);for(;-1!==s;)i++,s=e.indexOf(t,s+t.length);return i},t.truncate=function(e,t,i="…"){return e.length<=t?e:`${e.substr(0,t)}${i}`},t.truncateMiddle=function(e,t,i="…"){if(e.length<=t)return e;const s=Math.ceil(t/2)-i.length/2,r=Math.floor(t/2)-i.length/2;return`${e.substr(0,s)}${i}${e.substr(e.length-r)}`},t.trim=function(e,t=" "){return h(l(e,t),t)},t.ltrim=l,t.rtrim=h,t.convertSimple2RegExpPattern=function(e){return e.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")},t.stripWildcards=function(e){return e.replace(/\*/g,"")},t.createRegExp=function(e,t,i={}){if(!e)throw new Error("Cannot create regex from empty string");t||(e=a(e)),i.wholeWord&&(/\B/.test(e.charAt(0))||(e="\\b"+e),/\B/.test(e.charAt(e.length-1))||(e+="\\b"));let s="";return i.global&&(s+="g"),i.matchCase||(s+="i"),i.multiline&&(s+="m"),i.unicode&&(s+="u"),new RegExp(e,s)},t.regExpLeadsToEndlessLoop=function(e){return"^"!==e.source&&"^$"!==e.source&&"$"!==e.source&&"^\\s*$"!==e.source&&!(!e.exec("")||0!==e.lastIndex)},t.splitLines=function(e){return e.split(/\r\n|\r|\n/)},t.splitLinesIncludeSeparators=function(e){const t=[],i=e.split(/(\r\n|\r|\n)/);for(let e=0;e=0;i--){const t=e.charCodeAt(i);if(t!==s.CharCode.Space&&t!==s.CharCode.Tab)return i}return-1},t.replaceAsync=function(e,t,i){const s=[];let r=0;for(const n of e.matchAll(t)){if(s.push(e.slice(r,n.index)),void 0===n.index)throw new Error("match.index should be defined");r=n.index+n[0].length,s.push(i(n[0],...n.slice(1),n.index,e,n.groups))}return s.push(e.slice(r)),Promise.all(s).then(e=>e.join(""))},t.compare=function(e,t){return et?1:0},t.compareSubstring=c,t.compareIgnoreCase=function(e,t){return d(e,t,0,e.length,0,t.length)},t.compareSubstringIgnoreCase=d,t.isAsciiDigit=function(e){return e>=s.CharCode.Digit0&&e<=s.CharCode.Digit9},t.isLowerAsciiLetter=u,t.isUpperAsciiLetter=function(e){return e>=s.CharCode.A&&e<=s.CharCode.Z},t.equalsIgnoreCase=function(e,t){return e.length===t.length&&0===d(e,t)},t.startsWithIgnoreCase=function(e,t){const i=t.length;return!(t.length>e.length)&&0===d(e,t,0,i)},t.commonPrefixLength=function(e,t){const i=Math.min(e.length,t.length);let s;for(s=0;sn)return 1}const o=s-i,a=n-r;return oa?1:0}function d(e,t,i=0,s=e.length,r=0,n=t.length){for(;i=128||a>=128)return c(e.toLowerCase(),t.toLowerCase(),i,s,r,n);u(o)&&(o-=32),u(a)&&(a-=32);const l=o-a;if(0!==l)return l}const o=s-i,a=n-r;return oa?1:0}function u(e){return e>=s.CharCode.a&&e<=s.CharCode.z}function _(e){return 55296<=e&&e<=56319}function f(e){return 56320<=e&&e<=57343}function p(e,t){return t-56320+(e-55296<<10)+65536}function g(e,t,i){const s=e.charCodeAt(i);if(_(s)&&i+11){const s=e.charCodeAt(t-2);if(_(s))return p(s,i)}return i}(this._str,this._offset);return this._offset-=e>=r.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,e}nextCodePoint(){const e=g(this._str,this._len,this._offset);return this._offset+=e>=r.Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN?2:1,e}eol(){return this._offset>=this._len}},t.noBreakWhitespace=" "},1346(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(726),r=[];t.OscParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,s.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e);this._active=r,this._id=-1,this._state=0}}};class n{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n._payloadLimit&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}t.OscHandler=n,n._payloadLimit=1e7},1433(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=i(9176),o=i(8938),a=i(3055),l=i(6501),h=i(4103),c=i(7098),d=i(945),u=i(6181),_=i(5451);let f=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,l,c,u,f,p){const g=[],m=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors;let S,b=e.getNoBgTrimmedLength();i&&b=M,N=P,U=this._workCell;if(m.length>0&&P===m[0][0]&&B){const s=m.shift(),r=this._isCellInSelection(s[0],t);for(C=s[0]+1;C=s[1],B?(x=!0,U=new d.JoinedCellData(this._workCell,e.translateToString(!0,s[0],s[1]),s[1]-s[0]),N=s[1]-1,b=U.getWidth()):M=s[1]}const F=this._isCellInSelection(P,t),W=i&&P===a,K=I&&P>=f&&P<=p;let H=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,e=>{H=!0});let z=U.getChars()||o.WHITESPACE_CELL_CHAR;if(" "===z&&(U.isUnderline()||U.isOverline())&&(z=" "),T=b*c-u.get(z,U.isBold(),U.isItalic()),S){if(y&&(F&&A||!F&&!A&&U.bg===E)&&(F&&A&&v.selectionForeground||U.fg===D)&&U.extended.ext===L&&K===R&&T===k&&!W&&!x&&!H&&B){U.isInvisible()?w+=o.WHITESPACE_CELL_CHAR:w+=z,y++;continue}y&&(S.textContent=w),S=this._document.createElement("span"),y=0,w=""}else S=this._document.createElement("span");if(E=U.bg,D=U.fg,L=U.extended.ext,R=K,k=T,A=F,x&&a>=P&&a<=N&&(a=P),!this._coreService.isCursorHidden&&W&&this._coreService.isCursorInitialized)if(O.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&O.push("xterm-cursor-blink"),O.push("bar"===s?"xterm-cursor-bar":"underline"===s?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":O.push("xterm-cursor-outline");break;case"block":O.push("xterm-cursor-block");break;case"bar":O.push("xterm-cursor-bar");break;case"underline":O.push("xterm-cursor-underline")}if(U.isBold()&&O.push("xterm-bold"),U.isItalic()&&O.push("xterm-italic"),U.isDim()&&O.push("xterm-dim"),w=U.isInvisible()?o.WHITESPACE_CELL_CHAR:U.getChars()||o.WHITESPACE_CELL_CHAR,U.isUnderline()&&(O.push(`xterm-underline-${U.extended.underlineStyle}`)," "===w&&(w=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let e=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&e<8&&(e+=8),S.style.textDecorationColor=v.ansi[e].css}U.isOverline()&&(O.push("xterm-overline")," "===w&&(w=" ")),U.isStrikethrough()&&O.push("xterm-strikethrough"),K&&(S.style.textDecoration="underline");let j=U.getFgColor(),$=U.getFgColorMode(),V=U.getBgColor(),q=U.getBgColorMode();const G=!!U.isInverse();if(G){const e=j;j=V,V=e;const t=$;$=q,q=t}let X,Y,Z,Q=!1;switch(this._decorationService.forEachDecorationAtCell(P,t,void 0,e=>{"top"!==e.options.layer&&Q||(e.backgroundColorRGB&&(q=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,X=e.backgroundColorRGB),e.foregroundColorRGB&&($=50331648,j=e.foregroundColorRGB.rgba>>8&16777215,Y=e.foregroundColorRGB),Q="top"===e.options.layer)}),!Q&&F&&(X=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,V=X.rgba>>8&16777215,q=50331648,Q=!0,v.selectionForeground&&($=50331648,j=v.selectionForeground.rgba>>8&16777215,Y=v.selectionForeground)),Q&&O.push("xterm-decoration-top"),q){case 16777216:case 33554432:Z=v.ansi[V],O.push(`xterm-bg-${V}`);break;case 50331648:Z=h.channels.toColor(V>>16,V>>8&255,255&V),this._addStyle(S,`background-color:#${(V>>>0).toString(16).padStart(6,"0")}`);break;default:G?(Z=v.foreground,O.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):Z=v.background}switch(X||U.isDim()&&(X=h.color.multiplyOpacity(Z,.5)),$){case 16777216:case 33554432:U.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(S,Z,v.ansi[j],U,X,void 0)||O.push(`xterm-fg-${j}`);break;case 50331648:const e=h.channels.toColor(j>>16&255,j>>8&255,255&j);this._applyMinimumContrast(S,Z,e,U,X,Y)||this._addStyle(S,`color:#${j.toString(16).padStart(6,"0")}`);break;default:this._applyMinimumContrast(S,Z,v.foreground,U,X,Y)||G&&O.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}O.length&&(S.className=O.join(" "),O.length=0),W||x||H||!B?S.textContent=w:y++,T!==this.defaultSpacing&&(S.style.letterSpacing=`${T}px`),g.push(S),P=N}return S&&y&&(S.textContent=w),g}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,u.treatGlyphAsBackgroundColor)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=h.color.ensureContrastRatio(r??t,n??i,e),o.setColor((r??t).rgba,(n??i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_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){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t=i[0]&&e=i[0])}};t.DomRendererRowFactory=f,t.DomRendererRowFactory=f=s([r(1,c.ICharacterJoinerService),r(2,l.IOptionsService),r(3,c.ICoreBrowserService),r(4,l.ICoreService),r(5,l.IDecorationService),r(6,c.IThemeService)],f)},1718(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserTerminal=void 0;const s=i(7861),r=i(7721),n=i(3285),o=i(4017),a=i(4196),l=i(9925),h=i(3618),c=i(3955),d=i(4792),u=i(945),_=i(9574),f=i(9820),p=i(9784),g=i(5783),m=i(2079),v=i(7098),S=i(9078),b=i(2136),y=i(4103),w=i(5777),C=i(701),E=i(6107),D=i(8693),L=i(4720),R=i(6501),k=i(2486),A=i(2840),T=i(8906),M=i(8636),O=i(7093),I=i(4812);class P extends w.CoreTerminal{get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}get dimensions(){if(!this._renderService)return;const e=this._renderService.dimensions;return{css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}}constructor(e={}){super(e),this._linkifier=this._register(new I.MutableDisposable),this.browser=C,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new I.MutableDisposable),this._onCursorMove=this._register(new M.Emitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new M.Emitter),this.onKey=this._onKey.event,this._onSelectionChange=this._register(new M.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new M.Emitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new M.Emitter),this.onBell=this._onBell.event,this._onFocus=this._register(new M.Emitter),this._onBlur=this._register(new M.Emitter),this._onA11yCharEmitter=this._register(new M.Emitter),this._onA11yTabEmitter=this._register(new M.Emitter),this._onWillOpen=this._register(new M.Emitter),this._onDimensionsChange=this._register(new M.Emitter),this.onDimensionsChange=this._onDimensionsChange.event,this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._keyboardService=this._instantiationService.createInstance(b.KeyboardService),this._instantiationService.setService(v.IKeyboardService,this._keyboardService),this._linkProviderService=this._instantiationService.createInstance(f.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(n.OscLinkProvider)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(M.EventUtils.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(M.EventUtils.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(M.EventUtils.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(M.EventUtils.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register((0,I.toDisposable)(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i="";switch(t.index){case 256:e="foreground",i="10";break;case 257:e="background",i="11";break;case 258:e="cursor",i="12";break;default:e="ansi",i="4;"+t.index}switch(t.type){case 0:const s=y.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`]${i};${(0,D.toRgbString)(s)}\\`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=y.channels.toColor(...t.color));else{const i=e;this._themeService.modifyColors(e=>e[i]=y.channels.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_reportColorScheme(){if(!this._themeService)return;const e=y.rgb.relativeLuminance(this._themeService.colors.background.rgba>>8)>8)?1:2;this.coreService.triggerDataEvent(`[?997;${e}n`)}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(A.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(""),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register((0,O.addDisposableListener)(this.element,"copy",e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)}));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this._register((0,O.addDisposableListener)(this.textarea,"paste",e)),this._register((0,O.addDisposableListener)(this.element,"paste",e)),C.isFirefox?this._register((0,O.addDisposableListener)(this.element,"mousedown",e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register((0,O.addDisposableListener)(this.element,"contextmenu",e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),C.isLinux&&this._register((0,O.addDisposableListener)(this.element,"auxclick",e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register((0,O.addDisposableListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register((0,O.addDisposableListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register((0,O.addDisposableListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register((0,O.addDisposableListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register((0,O.addDisposableListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.classList.toggle("allow-transparency",this.options.allowTransparency),this._register(this.optionsService.onSpecificOptionChange("allowTransparency",e=>this.element.classList.toggle("allow-transparency",e))),e.appendChild(this.element);const t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register((0,O.addDisposableListener)(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);const i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",r.promptLabel.get()),C.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(_.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??"undefined"!=typeof window?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this._register((0,O.addDisposableListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register((0,O.addDisposableListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(d.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._register(this._inputHandler.onRequestColorSchemeQuery(()=>this._reportColorScheme())),this._register(this._themeService.onChangeColors(()=>{this.coreService.decPrivateModes.colorSchemeUpdates&&this._reportColorScheme()})),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this._register(this._renderService.onDimensionsChange(e=>this._onDimensionsChange.fire({css:{canvas:{...e.css.canvas},cell:{...e.css.cell}},device:{canvas:{...e.device.canvas},cell:{...e.device.cell},char:{...e.device.char}}}))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(h.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService);const s=this._linkifier.value=this._register(this._instantiationService.createInstance(T.Linkifier,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(o.Viewport,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,s)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(M.EventUtils.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(a.BufferDecorationRenderer,this.screenElement)),this._register((0,O.addDisposableListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(A.AccessibilityManager,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService?.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case"mousemove":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":r=0,s=t.button<3?t.button:3;break;case"mousedown":r=1,s=t.button<3?t.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;const i=t.deltaY;if(0===i)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;r=i<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:e=>{i(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag))},wheel:e=>(i(e),e.preventDefault(),e.stopPropagation(),!1),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup??=r.mouseup:(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag??=r.mousedrag:(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register((0,I.toDisposable)(()=>{s.mouseup&&this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)})),this._register((0,O.addDisposableListener)(t,"mousedown",e=>{e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e)&&(i(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag))})),this._register((0,O.addDisposableListener)(t,"wheel",t=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(t))return!1;if(!this.buffer.hasScrollback){if(0===t.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return t.preventDefault(),t.stopPropagation(),!1;const i=""+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(i,!0),t.preventDefault(),t.stopPropagation(),!1}}},{passive:!1}))}refresh(e,t,i=!1){this._renderService?.refreshRows(e,t,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const i=this._keyboardService.evaluateKeyDown(e);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),e.preventDefault(),e.stopPropagation(),!1}if(1===i.type&&this.selectAll(),this._isThirdLevelShift(this.browser,e))return!0;if(i.cancel&&(e.preventDefault(),e.stopPropagation()),!i.key)return!0;if(!this._keyboardService.useKitty&&!this._keyboardService.useWin32InputMode&&e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;""!==i.key&&"\r"!==i.key||(this.textarea.value="");const s=this._keyboardService.useWin32InputMode&&x(e);if(this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!s),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return e.preventDefault(),e.stopPropagation(),!1;this._keyDownHandled=!0}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return"keypress"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){if(this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return;x(e)||this.focus();const t=this._keyboardService.evaluateKeyUp(e);if(t?.key){const i=this._keyboardService.useWin32InputMode&&x(e);this.coreService.triggerDataEvent(t.key,!i)}this.updateCursorStyle(e),this._keyPressHandled=!1}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{const n=t.onCancellationRequested(()=>{n.dispose(),s(i)});e.then(s,r).finally(()=>n.dispose())})},t.raceCancellationError=function(e,t){return new Promise((i,s)=>{const n=t.onCancellationRequested(()=>{n.dispose(),s(new r.CancellationError)});e.then(i,s).finally(()=>n.dispose())})},t.raceCancellablePromises=async function(e){let t=-1;const i=e.map((e,i)=>e.then(e=>(t=i,e)));try{return await Promise.race(i)}finally{e.forEach((e,i)=>{i!==t&&e.cancel()})}},t.raceTimeout=function(e,t,i){let s;const r=setTimeout(()=>{s?.(void 0),i?.()},t);return Promise.race([e.finally(()=>clearTimeout(r)),new Promise(e=>s=e)])},t.asPromise=function(e){return new Promise((t,i)=>{const s=e();c(s)?s.then(t,i):t(s)})},t.promiseWithResolvers=u,t.timeout=g,t.disposableTimeout=function(e,t=0,i){const s=setTimeout(()=>{e(),i&&r.dispose()},t),r=(0,o.toDisposable)(()=>{clearTimeout(s),i?.deleteAndLeak(r)});return i?.add(r),r},t.sequence=function(e){const t=[];let i=0;const s=e.length;return Promise.resolve(null).then(function r(n){null!=n&&t.push(n);const o=i!!e,i=null){let s=0;const r=e.length,n=()=>{if(s>=r)return Promise.resolve(i);const o=e[s++];return Promise.resolve(o()).then(e=>t(e)?Promise.resolve(e):n())};return n()},t.firstParallel=function(e,t=e=>!!e,i=null){if(0===e.length)return Promise.resolve(i);let s=e.length;const r=()=>{s=-1;for(const t of e)t.cancel?.()};return new Promise((n,o)=>{for(const a of e)a.then(e=>{--s>=0&&t(e)?(r(),n(e)):0===s&&n(i)}).catch(e=>{--s>=0&&(r(),o(e))})})},t.retry=async function(e,t,i){let s;for(let r=0;r{const s=t.token.onCancellationRequested(()=>{s.dispose(),t.dispose(),e.reject(new r.CancellationError)});try{for await(const s of i){if(t.token.isCancellationRequested)return;e.emitOne(s)}s.dispose(),t.dispose()}catch(i){s.dispose(),t.dispose(),e.reject(i)}})};const s=i(8447),r=i(9807),n=i(802),o=i(7150),a=i(8163),l=i(5015),h=i(626);function c(e){return!!e&&"function"==typeof e.then}function d(e){const t=new s.CancellationTokenSource,i=e(t.token),n=new Promise((e,s)=>{const n=t.token.onCancellationRequested(()=>{n.dispose(),s(new r.CancellationError)});Promise.resolve(i).then(i=>{n.dispose(),t.dispose(),e(i)},e=>{n.dispose(),t.dispose(),s(e)})});return new class{cancel(){t.cancel(),t.dispose()}then(e,t){return n.then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return n.finally(e)}}}function u(){let e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),resolve:e,reject:t}}class _{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const e=()=>{if(this.queuedPromise=null,this.isDisposed)return;const e=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,e};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=e(),new Promise((e,t)=>{this.activePromise.then(t=>{this.activePromise=null,e(t)},e=>{this.activePromise=null,t(e)})})}dispose(){this.isDisposed=!0}}t.Throttler=_,t.Sequencer=class{constructor(){this.current=Promise.resolve(null)}queue(e){return this.current=this.current.then(()=>e(),()=>e())}},t.SequencerByKey=class{constructor(){this.promiseMap=new Map}queue(e,t){const i=(this.promiseMap.get(e)??Promise.resolve()).catch(()=>{}).then(t).finally(()=>{this.promiseMap.get(e)===i&&this.promiseMap.delete(e)});return this.promiseMap.set(e,i),i}};class f{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((e,t)=>{this.doResolve=e,this.doReject=t}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const e=this.task;return this.task=null,e()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===l.MicrotaskDelay?(e=>{let t=!0;return queueMicrotask(()=>{t&&(t=!1,e())}),{isTriggered:()=>t,dispose:()=>{t=!1}}})(i):((e,t)=>{let i=!0;const s=setTimeout(()=>{i=!1,t()},e);return{isTriggered:()=>i,dispose:()=>{clearTimeout(s),i=!1}}})(t,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new r.CancellationError),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}t.Delayer=f,t.ThrottledDelayer=class{constructor(e){this.delayer=new f(e),this.throttler=new _}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}};class p{constructor(){this._isOpen=!1,this._promise=new Promise((e,t)=>{this._completePromise=e})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}}function g(e,t){return t?new Promise((i,s)=>{const n=setTimeout(()=>{o.dispose(),i()},e),o=t.onCancellationRequested(()=>{clearTimeout(n),o.dispose(),s(new r.CancellationError)})}):d(t=>g(e,t))}t.Barrier=p,t.AutoOpenBarrier=class extends p{constructor(e){super(),this._timeout=setTimeout(()=>this.open(),e)}open(){clearTimeout(this._timeout),super.open()}};class m{constructor(e){this._size=0,this._isDisposed=!1,this.maxDegreeOfParalellism=e,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new n.Emitter}whenIdle(){return this.size>0?n.Event.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(e){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((t,i)=>{this.outstandingPromises.push({factory:e,c:t,e:i}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromisesthis.consumed(),()=>this.consumed())}}consumed(){this._isDisposed||(this.runningPromises--,0===--this._size&&this._onDrained.fire(),this.outstandingPromises.length>0&&this.consume())}clear(){if(this._isDisposed)throw new Error("Object has been disposed");this.outstandingPromises.length=0,this._size=this.runningPromises}dispose(){this._isDisposed=!0,this.outstandingPromises.length=0,this._size=0,this._onDrained.dispose()}}t.Limiter=m,t.Queue=class extends m{constructor(){super(1)}},t.LimitedQueue=class{constructor(){this.sequentializer=new y,this.tasks=0}queue(e){return this.sequentializer.isRunning()?this.sequentializer.queue(()=>this.sequentializer.run(this.tasks++,e())):this.sequentializer.run(this.tasks++,e())}},t.TimeoutTimer=class{constructor(e,t){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new r.BugIndicatingError("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new r.BugIndicatingError("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},t.IntervalTimer=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new r.BugIndicatingError("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const s=i.setInterval(()=>{e()},t);this.disposable=(0,o.toDisposable)(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};class v{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return-1!==this.timeoutToken}flush(){this.isScheduled()&&(this.cancel(),this.doRun())}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}}t.RunOnceScheduler=v,t.ProcessTimeRunOnceScheduler=class{constructor(e,t){t%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${t}ms is not a multiple of 1000ms.`),this.runner=e,this.timeout=t,this.counter=0,this.intervalToken=-1,this.intervalHandler=this.onInterval.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearInterval(this.intervalToken),this.intervalToken=-1)}schedule(e=this.timeout){e%1e3!=0&&console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${e}ms is not a multiple of 1000ms.`),this.cancel(),this.counter=Math.ceil(e/1e3),this.intervalToken=setInterval(this.intervalHandler,1e3)}isScheduled(){return-1!==this.intervalToken}onInterval(){this.counter--,this.counter>0||(clearInterval(this.intervalToken),this.intervalToken=-1,this.runner?.())}},t.RunOnceWorker=class extends v{constructor(e,t){super(e,t),this.units=[]}work(e){this.units.push(e),this.isScheduled()||this.schedule()}doRun(){const e=this.units;this.units=[],this.runner?.(e)}dispose(){this.units=[],super.dispose()}};class S extends o.Disposable{constructor(e,t){super(),this.options=e,this.handler=t,this.pendingWork=[],this.throttler=this._register(new o.MutableDisposable),this.disposed=!1}get pending(){return this.pendingWork.length}work(e){if(this.disposed)return!1;if("number"==typeof this.options.maxBufferedWork)if(this.throttler.value){if(this.pending+e.length>this.options.maxBufferedWork)return!1}else if(this.pending+e.length-this.options.maxWorkChunkSize>this.options.maxBufferedWork)return!1;for(const t of e)this.pendingWork.push(t);return this.throttler.value||this.doWork(),!0}doWork(){this.handler(this.pendingWork.splice(0,this.options.maxWorkChunkSize)),this.pendingWork.length>0&&(this.throttler.value=new v(()=>{this.throttler.clear(),this.doWork()},this.options.throttleDelay),this.throttler.value.schedule())}dispose(){super.dispose(),this.disposed=!0}}t.ThrottledWorker=S,"function"!=typeof globalThis.requestIdleCallback||"function"!=typeof globalThis.cancelIdleCallback?t._runWhenIdle=(e,t)=>{(0,a.setTimeout0)(()=>{if(i)return;const e=Date.now()+15,s={didTimeout:!0,timeRemaining:()=>Math.max(0,e-Date.now())};t(Object.freeze(s))});let i=!1;return{dispose(){i||(i=!0)}}}:t._runWhenIdle=(e,t,i)=>{const s=e.requestIdleCallback(t,"number"==typeof i?{timeout:i}:void 0);let r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},t.runWhenGlobalIdle=e=>(0,t._runWhenIdle)(globalThis,e);class b{constructor(e,i){this._didRun=!1,this._executor=()=>{try{this._value=i()}catch(e){this._error=e}finally{this._didRun=!0}},this._handle=(0,t._runWhenIdle)(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}t.AbstractIdleValue=b,t.GlobalIdleValue=class extends b{constructor(e){super(globalThis,e)}};class y{isRunning(e){return"number"==typeof e?this._running?.taskId===e:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(e,t,i){return this._running={taskId:e,cancel:()=>i?.(),promise:t},t.then(()=>this.doneRunning(e),()=>this.doneRunning(e)),t}doneRunning(e){this._running&&e===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){const e=this._queued;this._queued=void 0,e.run().then(e.promiseResolve,e.promiseReject)}}queue(e){if(this._queued)this._queued.run=e;else{const{promise:t,resolve:i,reject:s}=u();this._queued={run:e,promise:t,promiseResolve:i,promiseReject:s}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}}var w,C,E;t.TaskSequentializer=y,t.IntervalCounter=class{constructor(e,t=()=>Date.now()){this.interval=e,this.nowFn=t,this.lastIncrementTime=0,this.value=0}increment(){const e=this.nowFn();return e-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=e,this.value=0),this.value++,this.value}},function(e){e[e.Resolved=0]="Resolved",e[e.Rejected=1]="Rejected"}(w||(w={}));class D{get isRejected(){return this.outcome?.outcome===w.Rejected}get isResolved(){return this.outcome?.outcome===w.Resolved}get isSettled(){return!!this.outcome}get value(){return this.outcome?.outcome===w.Resolved?this.outcome?.value:void 0}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return new Promise(t=>{this.completeCallback(e),this.outcome={outcome:w.Resolved,value:e},t()})}error(e){return new Promise(t=>{this.errorCallback(e),this.outcome={outcome:w.Rejected,value:e},t()})}cancel(){return this.error(new r.CancellationError)}}t.DeferredPromise=D,function(e){e.settled=async function(e){let t;const i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(void 0!==t)throw t;return i},e.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(e){i(e)}})}}(C||(t.Promises=C={}));class L{get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}constructor(e){this._value=void 0,this._error=void 0,this._isResolved=!1,this.promise=e.then(e=>(this._value=e,this._isResolved=!0,e),e=>{throw this._error=e,this._isResolved=!0,e})}requireValue(){if(!this._isResolved)throw new r.BugIndicatingError("Promise is not resolved yet");if(this._error)throw this._error;return this._value}}t.StatefulPromise=L,t.LazyStatefulPromise=class{constructor(e){this._compute=e,this._promise=new h.Lazy(()=>new L(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}},function(e){e[e.Initial=0]="Initial",e[e.DoneOK=1]="DoneOK",e[e.DoneError=2]="DoneError"}(E||(E={}));class R{static fromArray(e){return new R(t=>{t.emitMany(e)})}static fromPromise(e){return new R(async t=>{t.emitMany(await e)})}static fromPromises(e){return new R(async t=>{await Promise.all(e.map(async e=>t.emitOne(await e)))})}static merge(e){return new R(async t=>{await Promise.all(e.map(async e=>{for await(const i of e)t.emitOne(i)}))})}static{this.EMPTY=R.fromArray([])}constructor(e,t){this._state=E.Initial,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new n.Emitter,queueMicrotask(async()=>{const t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(this._state===E.DoneError)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new R(async i=>{for await(const s of e)i.emitOne(t(s))})}map(e){return R.map(this,e)}static filter(e,t){return new R(async i=>{for await(const s of e)t(s)&&i.emitOne(s)})}filter(e){return R.filter(this,e)}static coalesce(e){return R.filter(e,e=>!!e)}coalesce(){return R.coalesce(this)}static async toPromise(e){const t=[];for await(const i of e)t.push(i);return t}toPromise(){return R.toPromise(this)}emitOne(e){this._state===E.Initial&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===E.Initial&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===E.Initial&&(this._state=E.DoneOK,this._onStateChanged.fire())}reject(e){this._state===E.Initial&&(this._state=E.DoneError,this._error=e,this._onStateChanged.fire())}}t.AsyncIterableObject=R;class k extends R{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}t.CancelableAsyncIterableObject=k,t.AsyncIterableSource=class{constructor(e){let t,i;this._deferred=new D,this._asyncIterable=new R(e=>{if(!t)return i&&e.emitMany(i),this._errorFn=t=>e.reject(t),this._emitFn=t=>e.emitOne(t),this._deferred.p;e.reject(t)},e),this._emitFn=e=>{i||(i=[]),i.push(e)},this._errorFn=e=>{t||(t=e)}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(e){this._errorFn(e),this._deferred.complete()}emitOne(e){this._emitFn(e)}}},2079(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=i(5251),o=i(9686),a=i(5959),l=i(7098),h=i(4812),c=i(701),d=i(9384),u=i(3055),_=i(6501),f=i(8636),p=String.fromCharCode(160),g=new RegExp(p,"g");let m=class extends h.Disposable{constructor(e,t,i,s,r,n,o,l,c){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new f.Emitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new f.Emitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new f.Emitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new f.Emitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this._register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const r=e[0]e.replace(g," ")).join(c.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),c.isLinux&&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:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){const i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return c.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_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){const t=this.hasSelection;if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0,t&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);const i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(c.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),l=a;const h=e[0]-a;let c=0,d=0,u=0,_=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l1&&(_+=s-1,l+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(c++,t--):e>1&&(u+=e-1,a-=e-1),a--,t--}for(;i1&&(_+=e-1,l+=e-1),l++,i++}}l++;let f=a+h-c+u,p=Math.min(this._bufferService.cols,l-a+c+d-u-_);if(t||""!==o.slice(a,l).trim()){if(i&&0===f&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,p+=e}}}if(s&&f+p===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if(t?.isWrapped&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(p+=t.length)}}return{start:f,length:p}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=(0,d.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=m,t.SelectionService=m=s([r(3,_.IBufferService),r(4,_.ICoreService),r(5,l.IMouseService),r(6,_.IOptionsService),r(7,l.IRenderService),r(8,l.ICoreBrowserService)],m)},2136(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardService=void 0;const n=i(706),o=i(7241),a=i(9249),l=i(701),h=i(6501);let c=class{constructor(e,t){this._coreService=e,this._optionsService=t}_getWin32InputMode(){return this._win32InputMode??=new a.Win32InputMode,this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??=new o.KittyKeyboard,this._kittyKeyboard}evaluateKeyDown(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!0);const t=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(e,t,e.repeat?2:1):(0,n.evaluateKeyboardEvent)(e,this._coreService.decPrivateModes.applicationCursorKeys,l.isMac,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(e){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(e,!1);const t=this._coreService.kittyKeyboard.flags;return this.useKitty&&2&t?this._getKittyKeyboard().evaluate(e,t,3):void 0}get useKitty(){const e=this._coreService.kittyKeyboard.flags;return!(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard||!o.KittyKeyboard.shouldUseProtocol(e))}get useWin32InputMode(){return!(!this._optionsService.rawOptions.vtExtensions?.win32InputMode||!this._coreService.decPrivateModes.win32InputMode)}};t.KeyboardService=c,t.KeyboardService=c=s([r(0,h.ICoreService),r(1,h.IOptionsService)],c)},2274(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=function(){return new i};class i{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);a>=e.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&t=this.startCol)}}},2486(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0,t.isValidColorIndex=k;const n=i(6760),o=i(6717),a=i(4812),l=i(726),h=i(6107),c=i(8938),d=i(3055),u=i(5451),_=i(6501),f=i(6415),p=i(1346),g=i(9823),m=i(2607),v=i(8693),S=i(8636),b=i(7804),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},w=131072;function C(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var E;!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(E||(t.WindowsOptionsReportType=E={}));let D=0;class L extends a.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,i,s,r,a,c,d,u=new o.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=a,this._coreMouseService=c,this._unicodeService=d,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this._register(new S.Emitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new S.Emitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new S.Emitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new S.Emitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new S.Emitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new S.Emitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new S.Emitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new S.Emitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new S.Emitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new S.Emitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new S.Emitter),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new S.Emitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new S.Emitter),this.onColor=this._onColor.event,this._onRequestColorSchemeQuery=this._register(new S.Emitter),this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new R(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,i)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})}),this._parser.setDcsHandlerFallback((e,t,i)=>{"HOOK"===t&&(i=i.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:i})}),this._parser.setPrintHandler((e,t,i)=>this.print(e,t,i)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"^"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({prefix:">",final:"q"},e=>this.sendXtVersion(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},e=>this.kittyKeyboardSet(e)),this._parser.registerCsiHandler({prefix:"?",final:"u"},e=>this.kittyKeyboardQuery(e)),this._parser.registerCsiHandler({prefix:">",final:"u"},e=>this.kittyKeyboardPush(e)),this._parser.registerCsiHandler({prefix:"<",final:"u"},e=>this.kittyKeyboardPop(e)),this._parser.setExecuteHandler("",()=>this.bell()),this._parser.setExecuteHandler("\n",()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler("\t",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("„",()=>this.index()),this._parser.setExecuteHandler("…",()=>this.nextLine()),this._parser.setExecuteHandler("ˆ",()=>this.tabSet()),this._parser.registerOscHandler(0,new p.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new p.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new p.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new p.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new p.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new p.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new p.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new p.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new p.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new p.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new p.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new p.OscHandler(e=>this.restoreCursorColor(e))),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(const e in n.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:e},()=>this.selectCharset("("+e)),this._parser.registerEscHandler({intermediates:")",final:e},()=>this.selectCharset(")"+e)),this._parser.registerEscHandler({intermediates:"*",final:e},()=>this.selectCharset("*"+e)),this._parser.registerEscHandler({intermediates:"+",final:e},()=>this.selectCharset("+"+e)),this._parser.registerEscHandler({intermediates:"-",final:e},()=>this.selectCharset("-"+e)),this._parser.registerEscHandler({intermediates:".",final:e},()=>this.selectCharset("."+e)),this._parser.registerEscHandler({intermediates:"/",final:e},()=>this.selectCharset("/"+e));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){if(this._logService.logLevel<=_.LogLevelEnum.WARN){let t;const i=new Promise((e,i)=>{t=setTimeout(()=>i("#SLOW_TIMEOUT"),5e3)});Promise.race([e,i]).then(()=>{void 0!==t&&clearTimeout(t)},e=>{if(void 0!==t&&clearTimeout(t),"#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>w&&(n=this._parseStack.position+w)}if(this._logService.logLevel<=_.LogLevelEnum.DEBUG&&this._logService.debug("parsing data "+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`)),this._logService.logLevel===_.LogLevelEnum.TRACE&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthw)for(let t=n;t0&&2===p.getWidth(this._activeBuffer.x-1)&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let g=this._parser.precedingJoinState;for(let m=t;ma)if(d){const e=p;let t=this._activeBuffer.x-v;if(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!p)return;for(v>0&&p instanceof h.BufferLine&&p.copyCellsFrom(e,t,0,v,!1);t=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(u&&(p.insertCells(this._activeBuffer.x,r-v,this._activeBuffer.getNullCell(_)),2===p.getWidth(a-1)&&p.setCellFromCodepoint(a-1,c.NULL_CELL_CODE,c.NULL_CELL_WIDTH,_)),p.setCellFromCodepoint(this._activeBuffer.x++,s,r,_),r>0)for(;--r;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=g,this._activeBuffer.x0&&0===p.getWidth(this._activeBuffer.x)&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!C(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new g.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new p.OscHandler(t))}registerApcHandler(e,t){return this._parser.registerApcHandler(e,new m.ApcHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const 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(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1))}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i=this._bufferService.cols){const e=this._activeBuffer.lines.get(i+1);e&&(e.isWrapped=!1)}for(;i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--;){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);if(e?.getTrimmedLength())break}for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.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 e=1;e0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent(`P>|xterm.js(${b.XTERM_VERSION})\\`),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}setMode(e){for(let t=0;t(n.triggerDataEvent(`[${t?"":"?"}${e};${i}$y`),!0),u=e=>e?1:2,_=e.params[0];return t?d(_,2===_?4:4===_?u(n.modes.insertMode):12===_?3:20===_?u(c.convertEol):0):1===_?d(_,u(i.applicationCursorKeys)):3===_?d(_,c.windowOptions.setWinLines?80===a?2:132===a?1:0:0):6===_?d(_,u(i.origin)):7===_?d(_,u(i.wraparound)):8===_?d(_,3):9===_?d(_,u("X10"===s)):12===_?d(_,u(c.cursorBlink)):25===_?d(_,u(!n.isCursorHidden)):45===_?d(_,u(i.reverseWraparound)):66===_?d(_,u(i.applicationKeypad)):67===_?d(_,4):1e3===_?d(_,u("VT200"===s)):1002===_?d(_,u("DRAG"===s)):1003===_?d(_,u("ANY"===s)):1004===_?d(_,u(i.sendFocus)):1005===_?d(_,4):1006===_?d(_,u("SGR"===r)):1015===_?d(_,4):1016===_?d(_,u("SGR_PIXELS"===r)):1048===_?d(_,1):47===_||1047===_||1049===_?d(_,u(l===h)):2004===_?d(_,u(i.bracketedPasteMode)):2026===_?d(_,u(i.synchronizedOutput)):9001===_&&this._optionsService.rawOptions.vtExtensions?.win32InputMode?d(_,u(i.win32InputMode)):d(_,0)}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=u.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=h.DEFAULT_ATTR_DATA.fg,e.bg=h.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825:221===i&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??1)?s.fg&=-134217729:222===i&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??1)?s.bg&=-134217729:59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("");break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[${e};${t}R`)}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`[?${e};${t}R`);break;case 15:case 25:case 26:case 53:break;case 996:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??1)&&this._onRequestColorSchemeQuery.fire()}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=0===e.length?1:e.params[0];if(0===t)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}const e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!C(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(E.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(E.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let e=0;e1;){const e=i.shift(),s=i.shift();if(/^\d+$/.exec(e)){const i=parseInt(e);if(k(i))if("?"===s)t.push({type:0,index:i});else{const e=(0,v.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.indexOf(";");if(-1===t)return!0;const i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):!i.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(":");let s;const r=i.findIndex(e=>e.startsWith("id="));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(";");for(let e=0;e=this._specialColors.length);++e,++t)if("?"===i[e])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const s=(0,v.parseColor)(i[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(";");for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new d.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${e}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}kittyKeyboardSet(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=e.params[0]||0,i=e.params[1]||1,s=this._coreService.kittyKeyboard;switch(i){case 1:s.flags=t;break;case 2:s.flags|=t;break;case 3:s.flags&=~t}return!0}kittyKeyboardQuery(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`[?${t}u`),!0}kittyKeyboardPush(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=e.params[0]||0,i=this._coreService.kittyKeyboard,s=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;return s.length>=16&&s.shift(),s.push(i.flags),i.flags=t,!0}kittyKeyboardPop(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;const t=Math.max(1,e.params[0]||1),i=this._coreService.kittyKeyboard,s=this._bufferService.buffer===this._bufferService.buffers.alt?i.altStack:i.mainStack;for(let e=0;e0;e++)i.flags=s.pop();return 0===s.length&&t>0&&(i.flags=0),!0}}t.InputHandler=L;let R=class{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&&(D=e,e=t,t=D),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function k(e){return 0<=e&&e<256}R=s([r(0,_.IBufferService)],R)},2607(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ApcHandler=t.ApcParser=void 0;const s=i(726),r=[];t.ApcParser=class{constructor(){this._state=0,this._active=r,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=r}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=r,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||r,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,"PUT",(0,s.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){3!==this._state&&(1===this._state&&t0&&this._put(e,t,i))}end(e,t=!0){if(0!==this._state){if(3!==this._state){if(1===this._state)return this._active=r,this._id=-1,void(this._state=0);if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",e)}this._active=r,this._id=-1,this._state=0}}};class n{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n._payloadLimit&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}t.ApcHandler=n,n._payloadLimit=1e7},2608(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.SetMap=t.BidirectionalMap=t.CounterSet=t.Touch=void 0,t.getOrSet=function(e,t,i){let s=e.get(t);return void 0===s&&(s=i,e.set(t,s)),s},t.mapToString=function(e){const t=[];return e.forEach((e,i)=>{t.push(`${i} => ${e}`)}),`Map(${e.size}) {${t.join(", ")}}`},t.setToString=function(e){const t=[];return e.forEach(e=>{t.push(e)}),`Set(${e.size}) {${t.join(", ")}}`},t.mapsStrictEqualIgnoreOrder=function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;for(const[i]of t)if(!e.has(i))return!1;return!0},function(e){e[e.None=0]="None",e[e.AsOld=1]="AsOld",e[e.AsNew=2]="AsNew"}(i||(t.Touch=i={})),t.CounterSet=class{constructor(){this.map=new Map}add(e){return this.map.set(e,(this.map.get(e)||0)+1),this}delete(e){let t=this.map.get(e)||0;return 0!==t&&(t--,0===t?this.map.delete(e):this.map.set(e,t),!0)}has(e){return this.map.has(e)}},t.BidirectionalMap=class{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(const[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){const t=this._m1.get(e);return void 0!==t&&(this._m1.delete(e),this._m2.delete(t),!0)}forEach(e,t){this._m1.forEach((i,s)=>{e.call(t,i,s,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},t.SetMap=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),0===i.size&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}}},2744(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0;const s=i(6181);t.WidthCache=class{constructor(e=()=>new r){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._canvasElements=[],this._canvasElements=[e(),e(),e(),e()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._canvasElements[0].setFont(e,t,i,!1),this._canvasElements[1].setFont(e,t,s,!1),this._canvasElements[2].setFont(e,t,i,!0),this._canvasElements[3].setFont(e,t,s,!0),this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];const t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){return this._canvasElements[t].measure(e)}};class r{constructor(){"undefined"!=typeof OffscreenCanvas?(this._canvas=new OffscreenCanvas(1,1),this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d")))}setFont(e,t,i,s){const r=s?"italic":"";this._ctx.font=`${r} ${i} ${t}px ${e}`.trim()}measure(e){return this._ctx.measureText(e).width}}},2811(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvedKeybinding=t.ResolvedChord=t.Keybinding=t.ScanCodeChord=t.KeyCodeChord=void 0,t.decodeKeybinding=function(e,t){if("number"==typeof e){if(0===e)return null;const i=(65535&e)>>>0,s=(4294901760&e)>>>16;return new c(0!==s?[a(i,t),a(s,t)]:[a(i,t)])}{const i=[];for(let s=0;s=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=i(7721),o=i(4292),a=i(4812),l=i(7098),h=i(6501),c=i(7093);let d=class extends a.Disposable{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";const r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new o.TimeBasedDebouncer(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(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register((0,c.addDisposableListener)(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register((0,a.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent=n.tooMuchOutput.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.lines.get(i.ydisp+r),t=[],n=e?.translateToString(!0,void 0,void 0,t)||"",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",s),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent===n.tooMuchOutput.get()&&this._clearLiveRegion(),this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),n.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;const r=({node:e,offset:t})=>{const i=e instanceof Text?e.parentNode:e;let s=parseInt(i?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;const r=this._rowColumns.get(i);if(!r)return console.warn("columns is null. Race condition?"),null;let n=t=this._terminal.cols&&(++s,n=0),{row:s,column:n}},n=r(t),o=r(i);if(n&&o){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,s.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},3058(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Permutation=t.CallbackIterable=t.ArrayQueue=t.booleanComparator=t.numberComparator=t.CompareResult=void 0,t.tail=function(e,t=0){return e[e.length-(1+t)]},t.tail2=function(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]},t.equals=function(e,t,i=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(let s=0,r=e.length;si(e[s],t))},t.binarySearch2=n,t.quickSelect=function e(t,i,s){if((t|=0)>=i.length)throw new TypeError("invalid index");const r=i[Math.floor(i.length*Math.random())],n=[],o=[],a=[];for(const e of i){const t=s(e,r);t<0?n.push(e):t>0?o.push(e):a.push(e)}return t{(async()=>{const o=e.length,l=e.slice(0,i).sort(t);for(let h=i,c=Math.min(i+r,o);hi&&await new Promise(e=>setTimeout(e)),n&&n.isCancellationRequested)throw new s.CancellationError;a(e,t,l,h,c)}return l})().then(o,l)})},t.coalesce=function(e){return e.filter(e=>!!e)},t.coalesceInPlace=function(e){let t=0;for(let i=0;i0},t.distinct=function(e,t=e=>e){const i=new Set;return e.filter(e=>{const s=t(e);return!i.has(s)&&(i.add(s),!0)})},t.uniqueFilter=function(e){const t=new Set;return i=>{const s=e(i);return!t.has(s)&&(t.add(s),!0)}},t.firstOrDefault=function(e,t){return e.length>0?e[0]:t},t.lastOrDefault=function(e,t){return e.length>0?e[e.length-1]:t},t.commonPrefixLength=function(e,t,i=(e,t)=>e===t){let s=0;for(let r=0,n=Math.min(e.length,t.length);rt;e--)s.push(e);return s},t.index=function(e,t,i){return e.reduce((e,s)=>(e[t(s)]=i?i(s):s,e),Object.create(null))},t.insert=function(e,t){return e.push(t),()=>l(e,t)},t.remove=l,t.arrayInsert=function(e,t,i){const s=e.slice(0,t),r=e.slice(t);return s.concat(i,r)},t.shuffle=function(e,t){let i;if("number"==typeof t){let e=t;i=()=>{const t=179426549*Math.sin(e++);return t-Math.floor(t)}}else i=Math.random;for(let t=e.length-1;t>0;t-=1){const s=Math.floor(i()*(t+1)),r=e[t];e[t]=e[s],e[s]=r}},t.pushToStart=function(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))},t.pushToEnd=function(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))},t.pushMany=function(e,t){for(const i of t)e.push(i)},t.mapArrayOrNot=function(e,t){return Array.isArray(e)?e.map(t):t(e)},t.asArray=function(e){return Array.isArray(e)?e:[e]},t.getRandomElement=function(e){return e[Math.floor(Math.random()*e.length)]},t.insertInto=h,t.splice=function(e,t,i,s){const r=c(e,t);let n=e.splice(r,i);return void 0===n&&(n=[]),h(e,r,s),n},t.compareBy=function(e,t){return(i,s)=>t(e(i),e(s))},t.tieBreakComparators=function(...e){return(t,i)=>{for(const s of e){const e=s(t,i);if(!d.isNeitherLessOrGreaterThan(e))return e}return d.neitherLessOrGreaterThan}},t.reverseOrder=function(e){return(t,i)=>-e(t,i)};const s=i(9807),r=i(8297);function n(e,t){let i=0,s=e-1;for(;i<=s;){const e=(i+s)/2|0,r=t(e);if(r<0)i=e+1;else{if(!(r>0))return e;s=e-1}}return-(i+1)}function o(e,t,i){const s=[];function r(e,t,i){if(0===t&&0===i.length)return;const r=s[s.length-1];r&&r.start+r.deleteCount===e?(r.deleteCount+=t,r.toInsert.push(...i)):s.push({start:e,deleteCount:t,toInsert:i})}let n=0,o=0;for(;;){if(n===e.length){r(n,0,t.slice(o));break}if(o===t.length){r(n,e.length-n,[]);break}const s=e[n],a=t[o],l=i(s,a);0===l?(n+=1,o+=1):l<0?(r(n,1,[]),n+=1):l>0&&(r(n,0,[a]),o+=1)}return s}function a(e,t,i,s,n){for(const o=i.length;st(n,e)<0);i.splice(e,0,n)}}}function l(e,t){const i=e.indexOf(t);if(i>-1)return e.splice(i,1),t}function h(e,t,i){const s=c(e,t),r=e.length,n=i.length;e.length=r+n;for(let t=r-1;t>=s;t--)e[t+n]=e[t];for(let t=0;t0},e.isNeitherLessOrGreaterThan=function(e){return 0===e},e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0}(d||(t.CompareResult=d={})),t.numberComparator=(e,t)=>e-t,t.booleanComparator=(e,i)=>(0,t.numberComparator)(e?1:0,i?1:0),t.ArrayQueue=class{constructor(e){this.items=e,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(0!==this.length)return this.items[this.firstIdx]}peekLast(){if(0!==this.length)return this.items[this.lastIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}removeLast(){const e=this.items[this.lastIdx];return this.lastIdx--,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}};class u{static{this.empty=new u(e=>{})}constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new u(t=>this.iterate(i=>!e(i)||t(i)))}map(e){return new u(t=>this.iterate(i=>t(e(i))))}some(e){let t=!1;return this.iterate(i=>(t=e(i),!t)),t}findFirst(e){let t;return this.iterate(i=>!e(i)||(t=i,!1)),t}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(s=>((i||d.isGreaterThan(e(s,t)))&&(i=!1,t=s),!0)),t}}t.CallbackIterable=u;class _{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((i,s)=>t(e[i],e[s]));return new _(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;tthis._flushInserted()),this._insertedValues.push(e)}_flushInserted(){const e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t));let t=0,i=0;const s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(r=this._search(t),-1===r)return!1;if(this._getKey(this._array[r])!==t)return!1;do{if(this._array[r]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(r),!0}while(++re-t);let t=0;const i=new Array(this._array.length-e.length);let s=0;for(let r=0;r0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{yield this._array[r]}while(++r=this._array.length)&&this._getKey(this._array[r])===e))do{t(this._array[r])}while(++r=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},3235(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const s=i(793),r=i(3055);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3285(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=i(3055),o=i(6501);let a=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i,this._workCell=new n.CellData}provideLinks(e,t){const i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,n=this._workCell,o=i.getTrimmedLength();let a=-1,h=-1,c=!1;for(let t=0;tr?r.activate(e,t,n):l(0,t),hover:(e,t)=>r?.hover?.(e,t,n),leave:(e,t)=>r?.leave?.(e,t,n)})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=t,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=a,t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a)},3562(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const s=i(4812),r=i(8636);class n extends s.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new r.Emitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._isSyncWriting)return;let e;for(this._isSyncWriting=!0;e=this._writeBuffer.shift();){this._action(e);const t=this._callbacks.shift();t&&t()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>performance.now()-i>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(i,e);return void s.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}t.WriteBuffer=n},3618(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=i(7098),o=i(6501);let a=class{get isComposing(){return this._isComposing}constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;const e=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){const t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0),0)}}};t.CompositionHelper=a,t.CompositionHelper=a=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],a)},3955(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=i(1433),o=i(2744),a=i(9176),l=i(6181),h=i(2274),c=i(7098),d=i(4103),u=i(4812),_=i(6501),f=i(8636),p=i(7093),g="xterm-dom-renderer-owner-",m="xterm-rows",v="xterm-fg-",S="xterm-bg-",b="xterm-focus",y="xterm-selection",w="xterm-cursor-blink-idle";let C=1,E=class extends u.Disposable{constructor(e,t,i,s,r,a,c,d,_,v,S,b,w,E){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=a,this._linkifier2=c,this._charSizeService=_,this._optionsService=v,this._bufferService=S,this._coreService=b,this._coreBrowserService=w,this._themeService=E,this._terminalClass=C++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this._onRequestRedraw=this._register(new f.Emitter),this.onRequestRedraw=this._onRequestRedraw.event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(m),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(y),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._cursorBlinkStateManager=new D(this._rowContainer,this._coreBrowserService),this._register((0,p.addDisposableListener)(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register((0,u.toDisposable)(()=>this._cursorBlinkStateManager.dispose())),this._register((0,u.toDisposable)(()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new o.WidthCache,this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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(const e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${m} 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} .${m} { 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} .${m} .xterm-dim { color: ${d.color.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;}`;const i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${m}.${b} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${m}.${w} .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${m} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[i,s]of e.ansi.entries())t+=`${this._terminalSelector} .${v}${i} { color: ${s.css}; }${this._terminalSelector} .${v}${i}.xterm-dim { color: ${d.color.multiplyOpacity(s,.5).css}; }${this._terminalSelector} .${S}${i} { background-color: ${s.css}; }`;t+=`${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${v}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${S}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){const e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}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(b),this._cursorBlinkStateManager.pause(),this._requestRedraw(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(b),this._cursorBlinkStateManager.resume(),this._requestRedraw(this._bufferService.buffer.y,this._bufferService.buffer.y)}_requestRedraw(e,t){this._onRequestRedraw.fire({start:e,end:t})}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this._requestRedraw(0,this._bufferService.rows-1),!e||!t)return;if(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection)return;const s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,l=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,l));const h=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,h)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width;let o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+"px",r.style.top=e*this.dimensions.css.cell.height+"px",r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+i.ydisp,t=this._rowElements[l],h=i.lines.get(e);if(!t||!h)break;t.replaceChildren(...this._rowFactory.createRow(h,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,l=a.ybase+a.y,h=Math.min(a.x,r-1),c=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=i;o<=s;++o){const _=o+a.ydisp,f=this._rowElements[o],p=a.lines.get(_);if(!f||!p)break;f.replaceChildren(...this._rowFactory.createRow(p,_,_===l,d,u,h,c,this.dimensions.css.cell.width,this._widthCache,n?o===i?e:0:-1,n?(o===s?t:r)-1:-1))}}};t.DomRenderer=E,t.DomRenderer=E=s([r(7,_.IInstantiationService),r(8,c.ICharSizeService),r(9,_.IOptionsService),r(10,_.IBufferService),r(11,_.ICoreService),r(12,c.ICoreBrowserService),r(13,c.IThemeService)],E);class D{constructor(e,t){this._rowContainer=e,this._coreBrowserService=t,this._isIdlePaused=!1,this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove(w),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove(w),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add(w),this._isIdlePaused=!0,this._idleTimeout=void 0}}},4017(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=i(7098),o=i(4812),a=i(6501),l=i(7093),h=i(8234),c=i(8636),d=i(9881),u=i(8594);let _=class extends o.Disposable{constructor(e,t,i,s,r,n,a,_){super(),this._bufferService=i,this._optionsService=a,this._renderService=_,this._onRequestScrollLines=this._register(new c.Emitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;const f=this._register(new d.Scrollable({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>(0,l.scheduleAtNextAnimationFrame)(s.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new h.SmoothScrollableElement(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(c.EventUtils.runAndSubscribe(n.onChangeColors,()=>{e.style.backgroundColor=n.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register((0,o.toDisposable)(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register((0,o.toDisposable)(()=>this._styleElement.remove())),this._register(c.EventUtils.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join("\n")})),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(e=>this._handleScroll(e))),this._register(u.Gesture.addTarget(t)),this._register((0,l.addDisposableListener)(t,u.EventType.Change,e=>this._handleGestureChange(e)))}scrollLines(e){const t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){this._renderService&&!this._isSyncing&&(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService)return;if(this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;const t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;0!==i&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}_handleGestureChange(e){e.preventDefault(),e.stopPropagation();const t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:t.scrollTop-e.translationY})}};t.Viewport=_,t.Viewport=_=s([r(2,a.IBufferService),r(3,n.ICoreBrowserService),r(4,a.ICoreMouseService),r(5,n.IThemeService),r(6,a.IOptionsService),r(7,n.IRenderService)],_)},4071(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=i(7453),o=i(4812),a=i(6501),l=i(8636),h=Object.freeze({insertMode:!1}),c=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0});let d=class extends o.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorHidden=!1,this._onData=this._register(new l.Emitter),this.onData=this._onData.event,this._onUserInput=this._register(new l.Emitter),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new l.Emitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new l.Emitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.isCursorInitialized=i.rawOptions.showCursorImmediately??!1,this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(c),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}reset(){this.modes=(0,n.clone)(h),this.decPrivateModes=(0,n.clone)(c),this.kittyKeyboard={flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d,t.CoreService=d=s([r(0,a.IBufferService),r(1,a.ILogService),r(2,a.IOptionsService)],d)},4097(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const s=i(4812),r=i(1073),n=i(8636);class o extends s.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new n.Emitter),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 r.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new r.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},4103(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0,t.toPaddedHex=d,t.contrastRatio=u;let i=0,s=0,r=0,n=0;var o,a,l,h,c;function d(e){const t=e.toString(16);return t.length<2?"0"+t:t}function u(e,t){return e>>0},e.toColor=function(t,i,s,r){return{css:e.toCss(t,i,s,r),rgba:e.toRgba(t,i,s,r)}}}(o||(t.channels=o={})),function(e){function t(e,t){return n=Math.round(255*t),[i,s,r]=c.toChannels(e.rgba),{css:o.toCss(i,s,r,n),rgba:o.toRgba(i,s,r,n)}}e.blend=function(e,t){if(n=(255&t.rgba)/255,1===n)return{css:t.css,rgba:t.rgba};const a=t.rgba>>24&255,l=t.rgba>>16&255,h=t.rgba>>8&255,c=e.rgba>>24&255,d=e.rgba>>16&255,u=e.rgba>>8&255;return i=c+Math.round((a-c)*n),s=d+Math.round((l-d)*n),r=u+Math.round((h-u)*n),{css:o.toCss(i,s,r),rgba:o.toRgba(i,s,r)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=c.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return o.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,s,r]=c.toChannels(t),{css:o.toCss(i,s,r),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return n=255&e.rgba,t(e,n*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(a||(t.color=a={})),function(e){let t,a;try{const e=document.createElement("canvas");e.width=1,e.height=1;const i=e.getContext("2d",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation="copy",a=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),o.toColor(i,s,r);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),n=parseInt(e.slice(4,5).repeat(2),16),o.toColor(i,s,r,n);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const l=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return i=parseInt(l[1]),s=parseInt(l[2]),r=parseInt(l[3]),n=Math.round(255*(void 0===l[5]?1:parseFloat(l[5]))),o.toColor(i,s,r,n);if("transparent"===e)return{css:"transparent",rgba:0};if(!t||!a)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=a,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,s,r,n]=t.getImageData(0,0,1,1).data,255!==n)throw new Error("css.toColor: Unsupported css format");return{rgba:o.toRgba(i,s,r,n),css:e}}}(l||(t.css=l={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(h||(t.rgb=h={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));for(;c0||a>0||l>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));return(o<<24|a<<16|l<<8|255)>>>0}function a(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,l=t>>8&255,c=u(h.relativeLuminance2(o,a,l),h.relativeLuminance2(s,r,n));for(;c>>0}e.blend=function(e,t){if(n=(255&t)/255,1===n)return t;const a=t>>24&255,l=t>>16&255,h=t>>8&255,c=e>>24&255,d=e>>16&255,u=e>>8&255;return i=c+Math.round((a-c)*n),s=d+Math.round((l-d)*n),r=u+Math.round((h-u)*n),o.toRgba(i,s,r)},e.ensureContrastRatio=function(e,i,s){const r=h.relativeLuminance(e>>8),n=h.relativeLuminance(i>>8);if(u(r,n)>8));if(ou(r,h.relativeLuminance(t>>8))?n:t}return n}const o=a(e,i,s),l=u(r,h.relativeLuminance(o>>8));if(lu(r,h.relativeLuminance(n>>8))?o:n}return o}},e.reduceLuminance=t,e.increaseLuminance=a,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(c||(t.rgba=c={}))},4196(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(7098),o=i(4812),a=i(6501);let l=class extends o.Disposable{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register((0,o.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer","top"===e?.options?.layer),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`;const i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const 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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;const i=e.options.x??0;"right"===(e.options.anchor||"left")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=l,t.BufferDecorationRenderer=l=s([r(1,a.IBufferService),r(2,n.ICoreBrowserService),r(3,a.IDecorationService),r(4,n.IRenderService)],l)},4218(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Iterable=void 0,function(e){function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;const i=Object.freeze([]);function*s(e){yield e}e.empty=function(){return i},e.single=s,e.wrap=function(e){return t(e)?e:s(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(const s of e)if(t(s,i++))return!0;return!1},e.find=function(e,t){for(const i of e)if(t(i))return i},e.filter=function*(e,t){for(const i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(const s of e)yield t(s,i++)},e.flatMap=function*(e,t){let i=0;for(const s of e)yield*t(s,i++)},e.concat=function*(...e){for(const t of e)yield*t},e.reduce=function(e,t,i){let s=i;for(const i of e)s=t(s,i);return s},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);tr}]},e.asyncToArray=async function(e){const t=[];for await(const i of e)t.push(i);return Promise.resolve(t)}}(i||(t.Iterable=i={}))},4292(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},4333(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.isAndroid=t.isElectron=t.isWebkitWebView=t.isSafari=t.isChrome=t.isWebKit=t.isFirefox=t.onDidChangeFullscreen=t.onDidChangeZoomLevel=void 0,t.addMatchMediaChangeListener=o,t.setZoomLevel=function(e,t){n.INSTANCE.setZoomLevel(e,t)},t.getZoomLevel=function(e){return n.INSTANCE.getZoomLevel(e)},t.getZoomFactor=function(e){return n.INSTANCE.getZoomFactor(e)},t.setZoomFactor=function(e,t){n.INSTANCE.setZoomFactor(e,t)},t.setFullscreen=function(e,t){n.INSTANCE.setFullscreen(e,t)},t.isFullscreen=function(e){return n.INSTANCE.isFullscreen(e)},t.isStandalone=function(){return l},t.isWCOEnabled=function(){return navigator?.windowControlsOverlay?.visible},t.getWCOBoundingRect=function(){return navigator?.windowControlsOverlay?.getTitlebarAreaRect()};const s=i(4693),r=i(802);class n{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new r.Emitter,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new r.Emitter,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new n}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;const i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}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;const i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}}function o(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}t.onDidChangeZoomLevel=n.INSTANCE.onDidChangeZoomLevel,t.onDidChangeFullscreen=n.INSTANCE.onDidChangeFullscreen;const a="object"==typeof navigator?navigator.userAgent:"";t.isFirefox=a.indexOf("Firefox")>=0,t.isWebKit=a.indexOf("AppleWebKit")>=0,t.isChrome=a.indexOf("Chrome")>=0,t.isSafari=!t.isChrome&&a.indexOf("Safari")>=0,t.isWebkitWebView=!t.isChrome&&!t.isSafari&&t.isWebKit,t.isElectron=a.indexOf("Electron/")>=0,t.isAndroid=a.indexOf("Android")>=0;let l=!1;if("function"==typeof s.mainWindow.matchMedia){const e=s.mainWindow.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=s.mainWindow.matchMedia("(display-mode: fullscreen)");l=e.matches,o(s.mainWindow,e,({matches:e})=>{l&&t.matches||(l=e)})}},4335(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},4693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.mainWindow=void 0,t.ensureCodeWindow=function(e,t){},t.mainWindow="object"==typeof window?window:globalThis},4720(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const s=i(4103),r=i(4812),n=i(3087),o=i(8636);let a=0,l=0,h=0,c=0;class d extends r.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new n.SortedList(e=>e?.marker.line),this._onDecorationRegistered=this._register(new o.Emitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new o.Emitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register((0,r.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new u(e);if(t){const e=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0,n=0,o=0;for(const a of this._decorations.values())n=a.marker.line,o=n+(a.options.height??1),t=o||(s=a.options.x??0,r=s+(a.options.width??1),e>=s&&e=c||(a=r.options.x??0,l=a+(r.options.width??1),e>=a&&e=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=i(6501),o=i(4812),a=i(8636);let l=class extends o.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new a.Emitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new d(this._optionsService))}catch{this._measureStrategy=this._register(new c(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l,t.CharSizeService=l=s([r(2,n.IOptionsService)],l);class h extends o.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}}class c extends h{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}}class d extends h{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4812(e,t){function i(e){return{dispose:e}}function s(e){if(e)if(Array.isArray(e))for(const t of e)t.dispose();else e.dispose()}Object.defineProperty(t,"__esModule",{value:!0}),t.MutableDisposable=t.Disposable=t.DisposableStore=void 0,t.toDisposable=i,t.dispose=s,t.combinedDisposable=function(...e){return i(()=>s(e))};class r{constructor(){this._disposables=new Set,this._isDisposed=!1}get isDisposed(){return this._isDisposed}add(e){return this._isDisposed?e.dispose():this._disposables.add(e),e}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.clear()}}}t.DisposableStore=r,t.Disposable=class{constructor(){this._store=new r}dispose(){this._store.dispose()}_register(e){return this._store.add(e)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}}},4838(e,t){function i(e){return(t,i,s)=>{let r=null,n=null;if("function"==typeof s.value?(r="value",n=s.value):"function"==typeof s.get&&(r="get",n=s.get),!n)throw new Error("not supported");s[r]=e(n,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.memoize=function(e,t,i){let s=null,r=null;if("function"==typeof i.value?(s="value",r=i.value,0!==r.length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof i.get&&(s="get",r=i.get),!r)throw new Error("not supported");const n=`$memoize$${t}`;i[s]=function(...e){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,e)}),this[n]}},t.debounce=function(e,t,s){return i((i,r)=>{const n=`$debounce$${r}`,o=`$debounce$result$${r}`;return function(...r){this[o]||(this[o]=s?s():void 0),clearTimeout(this[n]),t&&(this[o]=t(this[o],...r),r=[this[o]]),this[n]=setTimeout(()=>{i.apply(this,r),this[o]=s?s():void 0},e)}})},t.throttle=function(e,t,s){return i((i,r)=>{const n=`$throttle$timer$${r}`,o=`$throttle$result$${r}`,a=`$throttle$lastRun$${r}`,l=`$throttle$pending$${r}`;return function(...r){if(this[o]||(this[o]=s?s():void 0),null!==this[a]&&void 0!==this[a]||(this[a]=-Number.MAX_VALUE),t&&(this[o]=t(this[o],...r)),this[l])return;const h=this[a]+e;h<=Date.now()?(this[a]=Date.now(),i.apply(this,[this[o]]),this[o]=s?s():void 0):(this[l]=!0,this[n]=setTimeout(()=>{this[l]=!1,this[a]=Date.now(),i.apply(this,[this[o]]),this[o]=s?s():void 0},h-Date.now()))}})}},4852(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e??0,t=t??this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},4869(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CharCode=void 0,function(e){e[e.Null=0]="Null",e[e.Backspace=8]="Backspace",e[e.Tab=9]="Tab",e[e.LineFeed=10]="LineFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.DoubleQuote=34]="DoubleQuote",e[e.Hash=35]="Hash",e[e.DollarSign=36]="DollarSign",e[e.PercentSign=37]="PercentSign",e[e.Ampersand=38]="Ampersand",e[e.SingleQuote=39]="SingleQuote",e[e.OpenParen=40]="OpenParen",e[e.CloseParen=41]="CloseParen",e[e.Asterisk=42]="Asterisk",e[e.Plus=43]="Plus",e[e.Comma=44]="Comma",e[e.Dash=45]="Dash",e[e.Period=46]="Period",e[e.Slash=47]="Slash",e[e.Digit0=48]="Digit0",e[e.Digit1=49]="Digit1",e[e.Digit2=50]="Digit2",e[e.Digit3=51]="Digit3",e[e.Digit4=52]="Digit4",e[e.Digit5=53]="Digit5",e[e.Digit6=54]="Digit6",e[e.Digit7=55]="Digit7",e[e.Digit8=56]="Digit8",e[e.Digit9=57]="Digit9",e[e.Colon=58]="Colon",e[e.Semicolon=59]="Semicolon",e[e.LessThan=60]="LessThan",e[e.Equals=61]="Equals",e[e.GreaterThan=62]="GreaterThan",e[e.QuestionMark=63]="QuestionMark",e[e.AtSign=64]="AtSign",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.OpenSquareBracket=91]="OpenSquareBracket",e[e.Backslash=92]="Backslash",e[e.CloseSquareBracket=93]="CloseSquareBracket",e[e.Caret=94]="Caret",e[e.Underline=95]="Underline",e[e.BackTick=96]="BackTick",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.OpenCurlyBrace=123]="OpenCurlyBrace",e[e.Pipe=124]="Pipe",e[e.CloseCurlyBrace=125]="CloseCurlyBrace",e[e.Tilde=126]="Tilde",e[e.NoBreakSpace=160]="NoBreakSpace",e[e.U_Combining_Grave_Accent=768]="U_Combining_Grave_Accent",e[e.U_Combining_Acute_Accent=769]="U_Combining_Acute_Accent",e[e.U_Combining_Circumflex_Accent=770]="U_Combining_Circumflex_Accent",e[e.U_Combining_Tilde=771]="U_Combining_Tilde",e[e.U_Combining_Macron=772]="U_Combining_Macron",e[e.U_Combining_Overline=773]="U_Combining_Overline",e[e.U_Combining_Breve=774]="U_Combining_Breve",e[e.U_Combining_Dot_Above=775]="U_Combining_Dot_Above",e[e.U_Combining_Diaeresis=776]="U_Combining_Diaeresis",e[e.U_Combining_Hook_Above=777]="U_Combining_Hook_Above",e[e.U_Combining_Ring_Above=778]="U_Combining_Ring_Above",e[e.U_Combining_Double_Acute_Accent=779]="U_Combining_Double_Acute_Accent",e[e.U_Combining_Caron=780]="U_Combining_Caron",e[e.U_Combining_Vertical_Line_Above=781]="U_Combining_Vertical_Line_Above",e[e.U_Combining_Double_Vertical_Line_Above=782]="U_Combining_Double_Vertical_Line_Above",e[e.U_Combining_Double_Grave_Accent=783]="U_Combining_Double_Grave_Accent",e[e.U_Combining_Candrabindu=784]="U_Combining_Candrabindu",e[e.U_Combining_Inverted_Breve=785]="U_Combining_Inverted_Breve",e[e.U_Combining_Turned_Comma_Above=786]="U_Combining_Turned_Comma_Above",e[e.U_Combining_Comma_Above=787]="U_Combining_Comma_Above",e[e.U_Combining_Reversed_Comma_Above=788]="U_Combining_Reversed_Comma_Above",e[e.U_Combining_Comma_Above_Right=789]="U_Combining_Comma_Above_Right",e[e.U_Combining_Grave_Accent_Below=790]="U_Combining_Grave_Accent_Below",e[e.U_Combining_Acute_Accent_Below=791]="U_Combining_Acute_Accent_Below",e[e.U_Combining_Left_Tack_Below=792]="U_Combining_Left_Tack_Below",e[e.U_Combining_Right_Tack_Below=793]="U_Combining_Right_Tack_Below",e[e.U_Combining_Left_Angle_Above=794]="U_Combining_Left_Angle_Above",e[e.U_Combining_Horn=795]="U_Combining_Horn",e[e.U_Combining_Left_Half_Ring_Below=796]="U_Combining_Left_Half_Ring_Below",e[e.U_Combining_Up_Tack_Below=797]="U_Combining_Up_Tack_Below",e[e.U_Combining_Down_Tack_Below=798]="U_Combining_Down_Tack_Below",e[e.U_Combining_Plus_Sign_Below=799]="U_Combining_Plus_Sign_Below",e[e.U_Combining_Minus_Sign_Below=800]="U_Combining_Minus_Sign_Below",e[e.U_Combining_Palatalized_Hook_Below=801]="U_Combining_Palatalized_Hook_Below",e[e.U_Combining_Retroflex_Hook_Below=802]="U_Combining_Retroflex_Hook_Below",e[e.U_Combining_Dot_Below=803]="U_Combining_Dot_Below",e[e.U_Combining_Diaeresis_Below=804]="U_Combining_Diaeresis_Below",e[e.U_Combining_Ring_Below=805]="U_Combining_Ring_Below",e[e.U_Combining_Comma_Below=806]="U_Combining_Comma_Below",e[e.U_Combining_Cedilla=807]="U_Combining_Cedilla",e[e.U_Combining_Ogonek=808]="U_Combining_Ogonek",e[e.U_Combining_Vertical_Line_Below=809]="U_Combining_Vertical_Line_Below",e[e.U_Combining_Bridge_Below=810]="U_Combining_Bridge_Below",e[e.U_Combining_Inverted_Double_Arch_Below=811]="U_Combining_Inverted_Double_Arch_Below",e[e.U_Combining_Caron_Below=812]="U_Combining_Caron_Below",e[e.U_Combining_Circumflex_Accent_Below=813]="U_Combining_Circumflex_Accent_Below",e[e.U_Combining_Breve_Below=814]="U_Combining_Breve_Below",e[e.U_Combining_Inverted_Breve_Below=815]="U_Combining_Inverted_Breve_Below",e[e.U_Combining_Tilde_Below=816]="U_Combining_Tilde_Below",e[e.U_Combining_Macron_Below=817]="U_Combining_Macron_Below",e[e.U_Combining_Low_Line=818]="U_Combining_Low_Line",e[e.U_Combining_Double_Low_Line=819]="U_Combining_Double_Low_Line",e[e.U_Combining_Tilde_Overlay=820]="U_Combining_Tilde_Overlay",e[e.U_Combining_Short_Stroke_Overlay=821]="U_Combining_Short_Stroke_Overlay",e[e.U_Combining_Long_Stroke_Overlay=822]="U_Combining_Long_Stroke_Overlay",e[e.U_Combining_Short_Solidus_Overlay=823]="U_Combining_Short_Solidus_Overlay",e[e.U_Combining_Long_Solidus_Overlay=824]="U_Combining_Long_Solidus_Overlay",e[e.U_Combining_Right_Half_Ring_Below=825]="U_Combining_Right_Half_Ring_Below",e[e.U_Combining_Inverted_Bridge_Below=826]="U_Combining_Inverted_Bridge_Below",e[e.U_Combining_Square_Below=827]="U_Combining_Square_Below",e[e.U_Combining_Seagull_Below=828]="U_Combining_Seagull_Below",e[e.U_Combining_X_Above=829]="U_Combining_X_Above",e[e.U_Combining_Vertical_Tilde=830]="U_Combining_Vertical_Tilde",e[e.U_Combining_Double_Overline=831]="U_Combining_Double_Overline",e[e.U_Combining_Grave_Tone_Mark=832]="U_Combining_Grave_Tone_Mark",e[e.U_Combining_Acute_Tone_Mark=833]="U_Combining_Acute_Tone_Mark",e[e.U_Combining_Greek_Perispomeni=834]="U_Combining_Greek_Perispomeni",e[e.U_Combining_Greek_Koronis=835]="U_Combining_Greek_Koronis",e[e.U_Combining_Greek_Dialytika_Tonos=836]="U_Combining_Greek_Dialytika_Tonos",e[e.U_Combining_Greek_Ypogegrammeni=837]="U_Combining_Greek_Ypogegrammeni",e[e.U_Combining_Bridge_Above=838]="U_Combining_Bridge_Above",e[e.U_Combining_Equals_Sign_Below=839]="U_Combining_Equals_Sign_Below",e[e.U_Combining_Double_Vertical_Line_Below=840]="U_Combining_Double_Vertical_Line_Below",e[e.U_Combining_Left_Angle_Below=841]="U_Combining_Left_Angle_Below",e[e.U_Combining_Not_Tilde_Above=842]="U_Combining_Not_Tilde_Above",e[e.U_Combining_Homothetic_Above=843]="U_Combining_Homothetic_Above",e[e.U_Combining_Almost_Equal_To_Above=844]="U_Combining_Almost_Equal_To_Above",e[e.U_Combining_Left_Right_Arrow_Below=845]="U_Combining_Left_Right_Arrow_Below",e[e.U_Combining_Upwards_Arrow_Below=846]="U_Combining_Upwards_Arrow_Below",e[e.U_Combining_Grapheme_Joiner=847]="U_Combining_Grapheme_Joiner",e[e.U_Combining_Right_Arrowhead_Above=848]="U_Combining_Right_Arrowhead_Above",e[e.U_Combining_Left_Half_Ring_Above=849]="U_Combining_Left_Half_Ring_Above",e[e.U_Combining_Fermata=850]="U_Combining_Fermata",e[e.U_Combining_X_Below=851]="U_Combining_X_Below",e[e.U_Combining_Left_Arrowhead_Below=852]="U_Combining_Left_Arrowhead_Below",e[e.U_Combining_Right_Arrowhead_Below=853]="U_Combining_Right_Arrowhead_Below",e[e.U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below=854]="U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below",e[e.U_Combining_Right_Half_Ring_Above=855]="U_Combining_Right_Half_Ring_Above",e[e.U_Combining_Dot_Above_Right=856]="U_Combining_Dot_Above_Right",e[e.U_Combining_Asterisk_Below=857]="U_Combining_Asterisk_Below",e[e.U_Combining_Double_Ring_Below=858]="U_Combining_Double_Ring_Below",e[e.U_Combining_Zigzag_Above=859]="U_Combining_Zigzag_Above",e[e.U_Combining_Double_Breve_Below=860]="U_Combining_Double_Breve_Below",e[e.U_Combining_Double_Breve=861]="U_Combining_Double_Breve",e[e.U_Combining_Double_Macron=862]="U_Combining_Double_Macron",e[e.U_Combining_Double_Macron_Below=863]="U_Combining_Double_Macron_Below",e[e.U_Combining_Double_Tilde=864]="U_Combining_Double_Tilde",e[e.U_Combining_Double_Inverted_Breve=865]="U_Combining_Double_Inverted_Breve",e[e.U_Combining_Double_Rightwards_Arrow_Below=866]="U_Combining_Double_Rightwards_Arrow_Below",e[e.U_Combining_Latin_Small_Letter_A=867]="U_Combining_Latin_Small_Letter_A",e[e.U_Combining_Latin_Small_Letter_E=868]="U_Combining_Latin_Small_Letter_E",e[e.U_Combining_Latin_Small_Letter_I=869]="U_Combining_Latin_Small_Letter_I",e[e.U_Combining_Latin_Small_Letter_O=870]="U_Combining_Latin_Small_Letter_O",e[e.U_Combining_Latin_Small_Letter_U=871]="U_Combining_Latin_Small_Letter_U",e[e.U_Combining_Latin_Small_Letter_C=872]="U_Combining_Latin_Small_Letter_C",e[e.U_Combining_Latin_Small_Letter_D=873]="U_Combining_Latin_Small_Letter_D",e[e.U_Combining_Latin_Small_Letter_H=874]="U_Combining_Latin_Small_Letter_H",e[e.U_Combining_Latin_Small_Letter_M=875]="U_Combining_Latin_Small_Letter_M",e[e.U_Combining_Latin_Small_Letter_R=876]="U_Combining_Latin_Small_Letter_R",e[e.U_Combining_Latin_Small_Letter_T=877]="U_Combining_Latin_Small_Letter_T",e[e.U_Combining_Latin_Small_Letter_V=878]="U_Combining_Latin_Small_Letter_V",e[e.U_Combining_Latin_Small_Letter_X=879]="U_Combining_Latin_Small_Letter_X",e[e.LINE_SEPARATOR=8232]="LINE_SEPARATOR",e[e.PARAGRAPH_SEPARATOR=8233]="PARAGRAPH_SEPARATOR",e[e.NEXT_LINE=133]="NEXT_LINE",e[e.U_CIRCUMFLEX=94]="U_CIRCUMFLEX",e[e.U_GRAVE_ACCENT=96]="U_GRAVE_ACCENT",e[e.U_DIAERESIS=168]="U_DIAERESIS",e[e.U_MACRON=175]="U_MACRON",e[e.U_ACUTE_ACCENT=180]="U_ACUTE_ACCENT",e[e.U_CEDILLA=184]="U_CEDILLA",e[e.U_MODIFIER_LETTER_LEFT_ARROWHEAD=706]="U_MODIFIER_LETTER_LEFT_ARROWHEAD",e[e.U_MODIFIER_LETTER_RIGHT_ARROWHEAD=707]="U_MODIFIER_LETTER_RIGHT_ARROWHEAD",e[e.U_MODIFIER_LETTER_UP_ARROWHEAD=708]="U_MODIFIER_LETTER_UP_ARROWHEAD",e[e.U_MODIFIER_LETTER_DOWN_ARROWHEAD=709]="U_MODIFIER_LETTER_DOWN_ARROWHEAD",e[e.U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING=722]="U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING",e[e.U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING=723]="U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING",e[e.U_MODIFIER_LETTER_UP_TACK=724]="U_MODIFIER_LETTER_UP_TACK",e[e.U_MODIFIER_LETTER_DOWN_TACK=725]="U_MODIFIER_LETTER_DOWN_TACK",e[e.U_MODIFIER_LETTER_PLUS_SIGN=726]="U_MODIFIER_LETTER_PLUS_SIGN",e[e.U_MODIFIER_LETTER_MINUS_SIGN=727]="U_MODIFIER_LETTER_MINUS_SIGN",e[e.U_BREVE=728]="U_BREVE",e[e.U_DOT_ABOVE=729]="U_DOT_ABOVE",e[e.U_RING_ABOVE=730]="U_RING_ABOVE",e[e.U_OGONEK=731]="U_OGONEK",e[e.U_SMALL_TILDE=732]="U_SMALL_TILDE",e[e.U_DOUBLE_ACUTE_ACCENT=733]="U_DOUBLE_ACUTE_ACCENT",e[e.U_MODIFIER_LETTER_RHOTIC_HOOK=734]="U_MODIFIER_LETTER_RHOTIC_HOOK",e[e.U_MODIFIER_LETTER_CROSS_ACCENT=735]="U_MODIFIER_LETTER_CROSS_ACCENT",e[e.U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR=741]="U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR",e[e.U_MODIFIER_LETTER_HIGH_TONE_BAR=742]="U_MODIFIER_LETTER_HIGH_TONE_BAR",e[e.U_MODIFIER_LETTER_MID_TONE_BAR=743]="U_MODIFIER_LETTER_MID_TONE_BAR",e[e.U_MODIFIER_LETTER_LOW_TONE_BAR=744]="U_MODIFIER_LETTER_LOW_TONE_BAR",e[e.U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR=745]="U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR",e[e.U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK=746]="U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK",e[e.U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK=747]="U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK",e[e.U_MODIFIER_LETTER_UNASPIRATED=749]="U_MODIFIER_LETTER_UNASPIRATED",e[e.U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD=751]="U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_UP_ARROWHEAD=752]="U_MODIFIER_LETTER_LOW_UP_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD=753]="U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD=754]="U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD",e[e.U_MODIFIER_LETTER_LOW_RING=755]="U_MODIFIER_LETTER_LOW_RING",e[e.U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT=756]="U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT",e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT=757]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT",e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT=758]="U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT",e[e.U_MODIFIER_LETTER_LOW_TILDE=759]="U_MODIFIER_LETTER_LOW_TILDE",e[e.U_MODIFIER_LETTER_RAISED_COLON=760]="U_MODIFIER_LETTER_RAISED_COLON",e[e.U_MODIFIER_LETTER_BEGIN_HIGH_TONE=761]="U_MODIFIER_LETTER_BEGIN_HIGH_TONE",e[e.U_MODIFIER_LETTER_END_HIGH_TONE=762]="U_MODIFIER_LETTER_END_HIGH_TONE",e[e.U_MODIFIER_LETTER_BEGIN_LOW_TONE=763]="U_MODIFIER_LETTER_BEGIN_LOW_TONE",e[e.U_MODIFIER_LETTER_END_LOW_TONE=764]="U_MODIFIER_LETTER_END_LOW_TONE",e[e.U_MODIFIER_LETTER_SHELF=765]="U_MODIFIER_LETTER_SHELF",e[e.U_MODIFIER_LETTER_OPEN_SHELF=766]="U_MODIFIER_LETTER_OPEN_SHELF",e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROW=767]="U_MODIFIER_LETTER_LOW_LEFT_ARROW",e[e.U_GREEK_LOWER_NUMERAL_SIGN=885]="U_GREEK_LOWER_NUMERAL_SIGN",e[e.U_GREEK_TONOS=900]="U_GREEK_TONOS",e[e.U_GREEK_DIALYTIKA_TONOS=901]="U_GREEK_DIALYTIKA_TONOS",e[e.U_GREEK_KORONIS=8125]="U_GREEK_KORONIS",e[e.U_GREEK_PSILI=8127]="U_GREEK_PSILI",e[e.U_GREEK_PERISPOMENI=8128]="U_GREEK_PERISPOMENI",e[e.U_GREEK_DIALYTIKA_AND_PERISPOMENI=8129]="U_GREEK_DIALYTIKA_AND_PERISPOMENI",e[e.U_GREEK_PSILI_AND_VARIA=8141]="U_GREEK_PSILI_AND_VARIA",e[e.U_GREEK_PSILI_AND_OXIA=8142]="U_GREEK_PSILI_AND_OXIA",e[e.U_GREEK_PSILI_AND_PERISPOMENI=8143]="U_GREEK_PSILI_AND_PERISPOMENI",e[e.U_GREEK_DASIA_AND_VARIA=8157]="U_GREEK_DASIA_AND_VARIA",e[e.U_GREEK_DASIA_AND_OXIA=8158]="U_GREEK_DASIA_AND_OXIA",e[e.U_GREEK_DASIA_AND_PERISPOMENI=8159]="U_GREEK_DASIA_AND_PERISPOMENI",e[e.U_GREEK_DIALYTIKA_AND_VARIA=8173]="U_GREEK_DIALYTIKA_AND_VARIA",e[e.U_GREEK_DIALYTIKA_AND_OXIA=8174]="U_GREEK_DIALYTIKA_AND_OXIA",e[e.U_GREEK_VARIA=8175]="U_GREEK_VARIA",e[e.U_GREEK_OXIA=8189]="U_GREEK_OXIA",e[e.U_GREEK_DASIA=8190]="U_GREEK_DASIA",e[e.U_IDEOGRAPHIC_FULL_STOP=12290]="U_IDEOGRAPHIC_FULL_STOP",e[e.U_LEFT_CORNER_BRACKET=12300]="U_LEFT_CORNER_BRACKET",e[e.U_RIGHT_CORNER_BRACKET=12301]="U_RIGHT_CORNER_BRACKET",e[e.U_LEFT_BLACK_LENTICULAR_BRACKET=12304]="U_LEFT_BLACK_LENTICULAR_BRACKET",e[e.U_RIGHT_BLACK_LENTICULAR_BRACKET=12305]="U_RIGHT_BLACK_LENTICULAR_BRACKET",e[e.U_OVERLINE=8254]="U_OVERLINE",e[e.UTF8_BOM=65279]="UTF8_BOM",e[e.U_FULLWIDTH_SEMICOLON=65307]="U_FULLWIDTH_SEMICOLON",e[e.U_FULLWIDTH_COMMA=65292]="U_FULLWIDTH_COMMA"}(i||(t.CharCode=i={}))},5015(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MicrotaskDelay=void 0,t.MicrotaskDelay=Symbol("MicrotaskDelay")},5101(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(3235),r=i(4812),n=i(8636);class o extends r.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new n.Emitter),this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new s.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},5251(e,t){function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,l,h){if(!o)return;const c=i(e,t,s);return c?(c[0]=Math.ceil((c[0]+(h?a/2:0))/a),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),r+(h?1:0)),c[1]=Math.min(Math.max(c[1],1),n),c):void 0}},5394(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){const e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},5473(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.VerticalScrollbar=void 0;const s=i(8801),r=i(8245),n=i(9881);class o extends s.AbstractScrollbar{constructor(e,t,i){const s=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new r.ScrollbarState(t.verticalHasArrows?t.arrowSize:0,t.vertical===n.ScrollbarVisibility.Hidden?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===n.ScrollbarVisibility.Hidden?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}t.VerticalScrollbar=o},5639(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const s=i(4812),r=i(8636);class n extends s.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new r.Emitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new r.Emitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new r.Emitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;ithis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+i.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this._register(new m.MutableDisposable),this._onBinary=this._register(new g.Emitter),this.onBinary=this._onBinary.event,this._onData=this._register(new g.Emitter),this.onData=this._onData.event,this._onLineFeed=this._register(new g.Emitter),this.onLineFeed=this._onLineFeed.event,this._onRender=this._register(new g.Emitter),this.onRender=this._onRender.event,this._onResize=this._register(new g.Emitter),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new g.Emitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new g.Emitter),this._instantiationService=new r.InstantiationService,this.optionsService=this._register(new a.OptionsService(e)),this._instantiationService.setService(s.IOptionsService,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(o.BufferService)),this._instantiationService.setService(s.IBufferService,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(n.LogService)),this._instantiationService.setService(s.ILogService,this._logService),this.coreService=this._register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(s.ICoreService,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(h.CoreMouseService)),this._instantiationService.setService(s.ICoreMouseService,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(c.UnicodeService)),this._instantiationService.setService(s.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d.CharsetService),this._instantiationService.setService(s.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(p.OscLinkService),this._instantiationService.setService(s.IOscLinkService,this._oscLinkService),this._inputHandler=this._register(new _.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(g.EventUtils.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(g.EventUtils.forward(this._bufferService.onResize,this._onResize)),this._register(g.EventUtils.forward(this.coreService.onData,this._onData)),this._register(g.EventUtils.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["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 f.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this._register(g.EventUtils.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=s.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,o.MINIMUM_COLS),t=Math.max(t,o.MINIMUM_ROWS),this._writeBuffer.flushSync(),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}registerApcHandler(e,t){return this._inputHandler.registerApcHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber&&(e=!!("conpty"===t.backend&&t.buildNumber<21376)),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=S},5783(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=i(4852),o=i(7098),a=i(4812),l=i(6168),h=i(6501),c=i(8636);let d=class extends a.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,o,h,d,_){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=d,this._renderer=this._register(new a.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this._register(new a.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new c.Emitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new c.Emitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new c.Emitter),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new c.Emitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new u(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register((0,a.toDisposable)(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>this._renderer.value?.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(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,void 0,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){const i=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=(0,a.toDisposable)(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1,s=!1){if(this._isPaused)return void(this._needsFullRefresh=!0);if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,t);const r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(this._isNextRenderRedrawOnly=!1),i?this._renderRows(e,t):this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){this._renderer.value&&(this._isPaused?this._needsFullRefresh=!0:this._coreService.decPrivateModes.synchronizedOutput?this._syncOutputHandler.bufferRows(e,t):(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._needsSelectionRefresh=!1,this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode)),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0))}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,e.sync,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d,t.RenderService=d=s([r(2,h.IOptionsService),r(3,o.ICharSizeService),r(4,h.ICoreService),r(5,h.IDecorationService),r(6,h.IBufferService),r(7,o.ICoreBrowserService),r(8,o.IThemeService)],d);class u{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout??=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3)}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;const e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}}},5882(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=t?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)};const s=i(8938)},5959(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},5964(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;oe.index-t.index),s=[];for(const t of i){const i=this._services.get(t.id);if(!i)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);s.push(i)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},6097(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,i)=>t(e,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}registerApcHandler(e,t){return this._core.registerApcHandler(e,t)}}},6107(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(5451),r=i(3055),n=i(8938),o=i(726);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);let a=0;const l=new r.CellData;class h{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t??r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&s?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&s)+(0,o.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t=0;--i)this.setCell(e+t+i,this.loadCell(e+i,l));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[i]}}return this.length=e,4*i*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let r=s-1;r>=0;r--){for(let e=0;e<3;e++)this._data[3*(i+r)+e]=n[3*(t+r)+e];268435456&n[3*(t+r)+2]&&(this._extendedAttrs[i+r]=e._extendedAttrs[t+r])}else for(let r=0;r=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e,t,i,s){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let r="";for(;t>22||1}return s&&s.push(t),r}}t.BufferLine=h},6168(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(701);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class n extends r{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!s.isNode&&"requestIdleCallback"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},6181(e,t){function i(e){return 57508<=e&&e<=57558}function s(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=s,t.allowRescaling=function(e,t,r,n){return 1===t&&r>Math.ceil(1.5*n)&&void 0!==e&&e>255&&!s(e)&&!i(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return i(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}},6201(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.serviceRegistry=void 0,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,r){t[i]===t?t[s].push({id:e,index:r}):(t[s]=[{id:e,index:r}],t[i]=t)}(r,e,n)};return r._id=e,t.serviceRegistry.set(e,r),r};const i="di$target",s="di$dependencies";t.serviceRegistry=new Map},6304(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;ol(t,e),s)):function(e,t){return t=h(181387,t),Object.keys(e).sort().reduce((t,i)=>(t=c(i,t),l(e[i],t)),t)}(e,t);case"string":return c(e,t);case"boolean":return function(e,t){return h(e?433:863,t)}(e,t);case"number":return h(e,t);case"undefined":return h(937,t);default:return h(617,t)}var i,s}function h(e,t){return(t<<5)-t+e|0}function c(e,t){t=h(149417,t);for(let i=0,s=e.length;i>>s)>>>0}function _(e,t=0,i=e.byteLength,s=0){for(let r=0;re.toString(16).padStart(2,"0")).join(""):function(e,t,i="0"){for(;e.length>>0).toString(16),t/4)}t.Hasher=class{constructor(){this._value=0}get value(){return this._value}hash(e){return this._value=l(e,this._value),this._value}},function(e){e[e.BLOCK_SIZE=64]="BLOCK_SIZE",e[e.UNICODE_REPLACEMENT=65533]="UNICODE_REPLACEMENT"}(d||(d={}));class p{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(d.BLOCK_SIZE+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const t=e.length;if(0===t)return;const i=this._buff;let s,r,n=this._buffLen,o=this._leftoverHighSurrogate;for(0!==o?(s=o,r=-1,o=0):(s=e.charCodeAt(0),r=0);;){let l=s;if(a.isHighSurrogate(s)){if(!(r+1>>6,e[t++]=128|(63&i)>>>0):i<65536?(e[t++]=224|(61440&i)>>>12,e[t++]=128|(4032&i)>>>6,e[t++]=128|(63&i)>>>0):(e[t++]=240|(1835008&i)>>>18,e[t++]=128|(258048&i)>>>12,e[t++]=128|(4032&i)>>>6,e[t++]=128|(63&i)>>>0),t>=d.BLOCK_SIZE&&(this._step(),t-=d.BLOCK_SIZE,this._totalLen+=d.BLOCK_SIZE,e[0]=e[d.BLOCK_SIZE+0],e[1]=e[d.BLOCK_SIZE+1],e[2]=e[d.BLOCK_SIZE+2]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,d.UNICODE_REPLACEMENT)),this._totalLen+=this._buffLen,this._wrapUp()),f(this._h0)+f(this._h1)+f(this._h2)+f(this._h3)+f(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,_(this._buff,this._buffLen),this._buffLen>56&&(this._step(),_(this._buff));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=p._bigBlock32,t=this._buffDV;for(let i=0;i<64;i+=4)e.setUint32(i,t.getUint32(i,!1),!1);for(let t=64;t<320;t+=4)e.setUint32(t,u(e.getUint32(t-12,!1)^e.getUint32(t-32,!1)^e.getUint32(t-56,!1)^e.getUint32(t-64,!1),1),!1);let i,s,r,n=this._h0,o=this._h1,a=this._h2,l=this._h3,h=this._h4;for(let t=0;t<80;t++)t<20?(i=o&a|~o&l,s=1518500249):t<40?(i=o^a^l,s=1859775393):t<60?(i=o&a|o&l|a&l,s=2400959708):(i=o^a^l,s=3395469782),r=u(n,5)+i+h+s+e.getUint32(4*t,!1)&4294967295,h=l,l=a,a=u(o,30),o=n,n=r;this._h0=this._h0+n&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+l&4294967295,this._h4=this._h4+h&4294967295}}t.StringSHA1=p},6317(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=void 0;class i{static{this.Undefined=new i(void 0)}constructor(e){this.element=e,this.next=i.Undefined,this.prev=i.Undefined}}class s{constructor(){this._first=i.Undefined,this._last=i.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===i.Undefined}clear(){let e=this._first;for(;e!==i.Undefined;){const t=e.next;e.prev=i.Undefined,e.next=i.Undefined,e=t}this._first=i.Undefined,this._last=i.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const s=new i(e);if(this._first===i.Undefined)this._first=s,this._last=s;else if(t){const e=this._last;this._last=s,s.prev=e,e.next=s}else{const e=this._first;this._first=s,s.next=e,e.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==i.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==i.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==i.Undefined&&e.next!==i.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===i.Undefined&&e.next===i.Undefined?(this._first=i.Undefined,this._last=i.Undefined):e.next===i.Undefined?(this._last=this._last.prev,this._last.next=i.Undefined):e.prev===i.Undefined&&(this._first=this._first.next,this._first.prev=i.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==i.Undefined;)yield e.element,e=e.next}}t.LinkedList=s},6415(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const s=i(7428),r=i(8636);class n{static extractShouldJoin(e){return!!(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new r.Emitter,this.onChange=this._onChange.event;const e=new s.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}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,i=0;const s=e.length;for(let r=0;r=s)return t+this.wcwidth(o);const i=e.charCodeAt(r);56320<=i&&i<=57343?o=1024*(o-55296)+i-56320+65536:t+=this.wcwidth(i)}const a=this.charProperties(o,i);let l=n.extractWidth(a);n.extractShouldJoin(a)&&(l-=n.extractWidth(i)),t+=l,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=n},6501(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(6201);var r;t.IBufferService=(0,s.createDecorator)("BufferService"),t.ICoreMouseService=(0,s.createDecorator)("CoreMouseService"),t.ICoreService=(0,s.createDecorator)("CoreService"),t.ICharsetService=(0,s.createDecorator)("CharsetService"),t.IInstantiationService=(0,s.createDecorator)("InstantiationService"),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.OFF=5]="OFF"}(r||(t.LogLevelEnum=r={})),t.ILogService=(0,s.createDecorator)("LogService"),t.IOptionsService=(0,s.createDecorator)("OptionsService"),t.IOscLinkService=(0,s.createDecorator)("OscLinkService"),t.IUnicodeService=(0,s.createDecorator)("UnicodeService"),t.IDecorationService=(0,s.createDecorator)("DecorationService")},6609(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.IframeUtils=void 0,t.parentOriginHash=async function(e,t){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");const i=JSON.stringify({parentOrigin:e,salt:t}),s=(new TextEncoder).encode(i);return function(e){const t=Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("");return BigInt(`0x${t}`).toString(32).padStart(52,"0")}(await crypto.subtle.digest("sha-256",s))};const i=new WeakMap;function s(e){if(!e.parent||e.parent===e)return null;try{const t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return null}catch(e){return null}return e.parent}t.IframeUtils=class{static getSameOriginWindowChain(e){let t=i.get(e);if(!t){t=[],i.set(e,t);let r,n=e;do{r=s(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r}while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0;const r=this.getSameOriginWindowChain(e);for(const e of r){const r=e.window.deref();if(i+=r?.scrollY??0,s+=r?.scrollX??0,r===t)break;if(!e.iframeElement)break;const n=e.iframeElement.getBoundingClientRect();i+=n.top,s+=n.left}return{top:i,left:s}}}},6717(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(4812),r=i(7262),n=i(1346),o=i(9823),a=i(2607);class l{constructor(e){this.table=new Uint16Array(e)}setDefault(e,t){this.table.fill(e<<8|t)}add(e,t,i,s){this.table[t<<8|e]=i<<8|s}addMany(e,t,i,s){for(let r=0;rt),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,15);e.setDefault(1,0),e.addMany(s,0,2,0);for(const t of n)e.addMany([24,26,153,154],t,3,0),e.addMany(i(128,144),t,3,0),e.addMany(i(144,152),t,3,0),e.add(156,t,0,0),e.add(27,t,11,1),e.add(157,t,4,8),e.addMany([152,158],t,0,7),e.add(159,t,15,14),e.add(155,t,11,3),e.add(144,t,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(95,1,15,14),e.addMany(s,14,16,14),e.addMany(r,14,0,14),e.add(127,14,0,14),e.addMany([27,156,24,26],14,17,0),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(h,0,2,0),e.add(h,8,5,8),e.add(h,6,0,6),e.add(h,11,0,11),e.add(h,13,13,13),e.add(h,14,16,14),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},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((0,s.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new n.OscParser),this._dcsParser=this._register(new o.DcsParser),this._apcParser=this._register(new a.ApcParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let t=0;ts||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(1!==e.final.length)throw new Error("final must be a single byte");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);this._escHandlers[i]??=[];const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);this._csiHandlers[i]??=[];const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}registerApcHandler(e,t){return this._apcParser.registerHandler(e,t)}clearApcHandler(e){this._apcParser.clearHandler(e)}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 7:if(r=e[this._parseStack.chunkPos],s=this._apcParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=255&this._parseStack.transition}for(let i=o;i>8){case 2:for(let s=i+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=0&&(s=o[a](this._params),!0!==s);a--)if(s instanceof Promise)return this._preserveStack(3,o,a,n,i),s;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++i47&&r<60);i--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const l=this._escHandlers[this._collect<<8|r];let c=l?l.length-1:-1;for(;c>=0&&(s=l[c](),!0!==s);c--)if(s instanceof Promise)return this._preserveStack(4,l,c,n,i),s;c<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=i+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r=t||(r=e[s])<32||r>127&&r=t||24===(r=e[s])||26===r||27===r||156===r||r>127&&r{r++,("number"==typeof s&&r>=s||!0===t())&&o.dispose()},i),o=(0,g.toDisposable)(()=>{e.clearInterval(n)});return o},t.measure=function(e,i){return(0,t.scheduleAtNextAnimationFrame)(e,i,1e4)},t.modify=function(e,i){return(0,t.scheduleAtNextAnimationFrame)(e,i,-1e4)},t.addDisposableThrottledListener=function(e,t,i,s,r){return new T(e,t,i,s,r)},t.getComputedStyle=M,t.getClientArea=function e(i,s){const r=(0,t.getWindow)(i),n=r.document;if(i!==n.body)return new I(i.clientWidth,i.clientHeight);if(m.isIOS&&r?.visualViewport)return new I(r.visualViewport.width,r.visualViewport.height);if(r?.innerWidth&&r.innerHeight)return new I(r.innerWidth,r.innerHeight);if(n.body&&n.body.clientWidth&&n.body.clientHeight)return new I(n.body.clientWidth,n.body.clientHeight);if(n.documentElement&&n.documentElement.clientWidth&&n.documentElement.clientHeight)return new I(n.documentElement.clientWidth,n.documentElement.clientHeight);if(s)return e(s);throw new Error("Unable to figure out browser width and height")},t.getTopLeftOffset=P,t.size=function(e,t,i){"number"==typeof t&&(e.style.width=`${t}px`),"number"==typeof i&&(e.style.height=`${i}px`)},t.position=function(e,t,i,s,r,n="absolute"){"number"==typeof t&&(e.style.top=`${t}px`),"number"==typeof i&&(e.style.right=`${i}px`),"number"==typeof s&&(e.style.bottom=`${s}px`),"number"==typeof r&&(e.style.left=`${r}px`),e.style.position=n},t.getDomNodePagePosition=function(e){const i=e.getBoundingClientRect(),s=(0,t.getWindow)(e);return{left:i.left+s.scrollX,top:i.top+s.scrollY,width:i.width,height:i.height}},t.getDomNodeZoomLevel=function(e){let t=e,i=1;do{const e=M(t).zoom;null!=e&&"1"!==e&&(i*=e),t=t.parentElement}while(null!==t&&t!==t.ownerDocument.documentElement);return i},t.getTotalWidth=x,t.getContentWidth=function(e){const t=O.getBorderLeftWidth(e)+O.getBorderRightWidth(e),i=O.getPaddingLeft(e)+O.getPaddingRight(e);return e.offsetWidth-t-i},t.getTotalScrollWidth=B,t.getContentHeight=function(e){const t=O.getBorderTopWidth(e)+O.getBorderBottomWidth(e),i=O.getPaddingTop(e)+O.getPaddingBottom(e);return e.offsetHeight-t-i},t.getTotalHeight=function(e){const t=O.getMarginTop(e)+O.getMarginBottom(e);return e.offsetHeight+t},t.getLargestChildWidth=function(e,t){const i=t.map(t=>Math.max(B(t),x(t))+function(e,t){if(null===e)return 0;const i=P(e),s=P(t);return i.left-s.left}(t,e)||0);return Math.max(...i)},t.isAncestor=N,t.setParentFlowTo=function(e,t){e.dataset[U]=t.id},t.isAncestorUsingFlowTo=function(e,t){let i=e;for(;i;){if(i===t)return!0;if(ee(i)){const e=F(i);if(e){i=e;continue}}i=i.parentNode}return!1},t.findParentWithClass=W,t.hasParentWithClass=function(e,t,i){return!!W(e,t,i)},t.isShadowRoot=K,t.isInShadowDOM=function(e){return!!H(e)},t.getShadowRoot=H,t.getActiveElement=z,t.isActiveElement=function(e){return z()===e},t.isAncestorOfActiveElement=function(e){return N(z(),e)},t.isActiveDocument=function(e){return e.ownerDocument===j()},t.getActiveDocument=j,t.getActiveWindow=function(){const e=j();return e.defaultView?.window??S.mainWindow},t.isGlobalStylesheet=function(e){return $.has(e)},t.createStyleSheet2=function(){return new V},t.createStyleSheet=q,t.cloneGlobalStylesheets=function(e){const t=new g.DisposableStore;for(const[i,s]of $)t.add(G(i,s,e));return t},t.createMetaElement=function(e=S.mainWindow.document.head){return X("meta",e)},t.createLinkElement=function(e=S.mainWindow.document.head){return X("link",e)},t.createCSSRule=function e(t,i,s=Z()){if(s&&i){s.sheet?.insertRule(`${t} {${i}}`,0);for(const r of $.get(s)??[])e(t,i,r)}},t.removeCSSRulesContainingSelector=function e(t,i=Z()){if(!i)return;const s=Q(i),r=[];for(let e=0;e=0;e--)i.sheet?.deleteRule(r[e]);for(const s of $.get(i)??[])e(t,s)},t.isHTMLElement=ee,t.isHTMLAnchorElement=function(e){return e instanceof HTMLAnchorElement||e instanceof(0,t.getWindow)(e).HTMLAnchorElement},t.isHTMLSpanElement=function(e){return e instanceof HTMLSpanElement||e instanceof(0,t.getWindow)(e).HTMLSpanElement},t.isHTMLTextAreaElement=function(e){return e instanceof HTMLTextAreaElement||e instanceof(0,t.getWindow)(e).HTMLTextAreaElement},t.isHTMLInputElement=function(e){return e instanceof HTMLInputElement||e instanceof(0,t.getWindow)(e).HTMLInputElement},t.isHTMLButtonElement=function(e){return e instanceof HTMLButtonElement||e instanceof(0,t.getWindow)(e).HTMLButtonElement},t.isHTMLDivElement=function(e){return e instanceof HTMLDivElement||e instanceof(0,t.getWindow)(e).HTMLDivElement},t.isSVGElement=function(e){return e instanceof SVGElement||e instanceof(0,t.getWindow)(e).SVGElement},t.isMouseEvent=function(e){return e instanceof MouseEvent||e instanceof(0,t.getWindow)(e).MouseEvent},t.isKeyboardEvent=function(e){return e instanceof KeyboardEvent||e instanceof(0,t.getWindow)(e).KeyboardEvent},t.isPointerEvent=function(e){return e instanceof PointerEvent||e instanceof(0,t.getWindow)(e).PointerEvent},t.isDragEvent=function(e){return e instanceof DragEvent||e instanceof(0,t.getWindow)(e).DragEvent},t.isEventLike=function(e){const t=e;return!(!t||"function"!=typeof t.preventDefault||"function"!=typeof t.stopPropagation)},t.saveParentsScrollTop=function(e){const t=[];for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)t[i]=e.scrollTop,e=e.parentNode;return t},t.restoreParentsScrollTop=function(e,t){for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)e.scrollTop!==t[i]&&(e.scrollTop=t[i]),e=e.parentNode},t.trackFocus=function(e){return new te(e)},t.after=function(e,t){return e.after(t),t},t.append=ie,t.prepend=function(e,t){return e.insertBefore(t,e.firstChild),t},t.reset=function(e,...t){e.innerText="",ie(e,...t)},t.$=ae,t.join=function(e,t){const i=[];return e.forEach((e,s)=>{s>0&&(t instanceof Node?i.push(t.cloneNode()):i.push(document.createTextNode(t))),i.push(e)}),i},t.setVisibility=function(e,...t){e?le(...t):he(...t)},t.show=le,t.hide=he,t.removeTabIndexAndUpdateFocus=function(e){if(e&&e.hasAttribute("tabIndex")){if(e.ownerDocument.activeElement===e){const t=function(e){for(;e&&e.nodeType===e.ELEMENT_NODE;){if(ee(e)&&e.hasAttribute("tabIndex"))return e;e=e.parentNode}return null}(e.parentElement);t?.focus()}e.removeAttribute("tabindex")}},t.finalHandler=function(e){return t=>{t.preventDefault(),t.stopPropagation(),e(t)}},t.domContentLoaded=function(e){return new Promise(t=>{if("complete"===e.document.readyState||e.document&&null!==e.document.body)t(void 0);else{const i=()=>{e.window.removeEventListener("DOMContentLoaded",i,!1),t()};e.window.addEventListener("DOMContentLoaded",i,!1)}})},t.computeScreenAwareSize=function(e,t){const i=e.devicePixelRatio*t;return Math.max(1,Math.floor(i))/e.devicePixelRatio},t.windowOpenNoOpener=function(e){S.mainWindow.open(e,"_blank","noopener")},t.windowOpenPopup=function(e){const t=Math.floor(S.mainWindow.screenLeft+S.mainWindow.innerWidth/2-390),i=Math.floor(S.mainWindow.screenTop+S.mainWindow.innerHeight/2-320);S.mainWindow.open(e,"_blank",`width=780,height=640,top=${i},left=${t}`)},t.windowOpenWithSuccess=function(e,t=!0){const i=S.mainWindow.open();return!!i&&(t&&(i.opener=null),i.location.href=e,!0)},t.animate=function(e,i){const s=()=>{i(),r=(0,t.scheduleAtNextAnimationFrame)(e,s)};let r=(0,t.scheduleAtNextAnimationFrame)(e,s);return(0,g.toDisposable)(()=>r.dispose())},t.asCSSPropertyValue=function(e){return`'${e.replace(/'/g,"%27")}'`},t.asCssValueWithDefault=function e(t,i){if(void 0!==t){const s=t.match(/^\s*var\((.+)\)$/);if(s){const t=s[1].split(",",2);return 2===t.length&&(i=e(t[1].trim(),i)),`var(${t[0]}, ${i})`}return t}return i},t.detectFullscreen=function(e){return e.document.fullscreenElement||e.document.webkitFullscreenElement||e.document.webkitIsFullScreen?{mode:ne.DOCUMENT,guess:!1}:e.innerHeight===e.screen.height?{mode:ne.BROWSER,guess:!1}:(m.isMacintosh||m.isLinux)&&e.outerHeight===e.screen.height&&e.outerWidth===e.screen.width?{mode:ne.BROWSER,guess:!0}:null},t.multibyteAwareBtoa=function(e){return btoa(function(e){const t=new Uint16Array(e.length);for(let i=0;i0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),s)for(const e of s)ee(e)?o.appendChild(e):"string"==typeof e?o.append(e):"root"in e&&(Object.assign(l,e),o.appendChild(e.root));for(const[e,t]of Object.entries(i))if("className"!==e)if("style"===e)for(const[e,i]of Object.entries(t))o.style.setProperty(_e(e),"number"==typeof i?i+"px":""+i);else"tabIndex"===e?o.tabIndex=t:o.setAttribute(_e(e),t.toString());return l.root=o,l},t.svgElem=function(e,...t){let i,s;Array.isArray(t[0])?(i={},s=t[0]):(i=t[0]||{},s=t[1]);const r=ue.exec(e);if(!r||!r.groups)throw new Error("Bad use of h");const n=r.groups.tag||"div",o=document.createElementNS("http://www.w3.org/2000/svg",n);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const e of r.groups.class.split("."))""!==e&&a.push(e);if(void 0!==i.className)for(const e of i.className.split("."))""!==e&&a.push(e);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),s)for(const e of s)ee(e)?o.appendChild(e):"string"==typeof e?o.append(e):"root"in e&&(Object.assign(l,e),o.appendChild(e.root));for(const[e,t]of Object.entries(i))if("className"!==e)if("style"===e)for(const[e,i]of Object.entries(t))o.style.setProperty(_e(e),"number"==typeof i?i+"px":""+i);else"tabIndex"===e?o.tabIndex=t:o.setAttribute(_e(e),t.toString());return l.root=o,l},t.copyAttributes=fe,t.trackAttributes=function(e,i,s){fe(e,i,s);const r=new g.DisposableStore;return r.add(t.sharedMutationObserver.observe(e,r,{attributes:!0,attributeFilter:s})(t=>{for(const s of t)"attributes"===s.type&&s.attributeName&&pe(e,i,s.attributeName)})),r};const l=a(i(4333)),h=i(7745),c=i(5394),d=i(5964),u=i(1758),_=i(9807),f=a(i(802)),p=i(7883),g=i(7150),m=a(i(8163)),v=i(6304),S=i(4693),b=i(7704);r=function(){const e=new Map;(0,S.ensureCodeWindow)(S.mainWindow,1);const i={window:S.mainWindow,disposables:new g.DisposableStore};e.set(S.mainWindow.vscodeWindowId,i);const s=new f.Emitter,r=new f.Emitter,n=new f.Emitter;return{onDidRegisterWindow:s.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:r.event,registerWindow(i){if(e.has(i.vscodeWindowId))return g.Disposable.None;const o=new g.DisposableStore,a={window:i,disposables:o.add(new g.DisposableStore)};return e.set(i.vscodeWindowId,a),o.add((0,g.toDisposable)(()=>{e.delete(i.vscodeWindowId),r.fire(i)})),o.add(w(i,t.EventType.BEFORE_UNLOAD,()=>{n.fire(i)})),s.fire(a),o},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(t,s){return("number"==typeof t?e.get(t):void 0)??(s?i:void 0)},getWindow(e){const t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;const i=e;return i?.view?i.view.window:S.mainWindow},getDocument(e){const i=e;return(0,t.getWindow)(i).document}}}(),t.registerWindow=r.registerWindow,t.getWindow=r.getWindow,t.getDocument=r.getDocument,t.getWindows=r.getWindows,t.getWindowsCount=r.getWindowsCount,t.getWindowId=r.getWindowId,t.getWindowById=r.getWindowById,t.hasWindow=r.hasWindow,t.onDidRegisterWindow=r.onDidRegisterWindow,t.onWillUnregisterWindow=r.onWillUnregisterWindow,t.onDidUnregisterWindow=r.onDidUnregisterWindow;class y{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function w(e,t,i,s){return new y(e,t,i,s)}function C(e,t){return function(i){return t(new d.StandardMouseEvent(e,i))}}function E(e,i,s){return w(e,m.isIOS&&h.BrowserFeatures.pointerEvents?t.EventType.POINTER_DOWN:t.EventType.MOUSE_DOWN,i,s)}function D(e,i,s){return w(e,m.isIOS&&h.BrowserFeatures.pointerEvents?t.EventType.POINTER_UP:t.EventType.MOUSE_UP,i,s)}t.addStandardDisposableListener=function(e,i,s,r){let n=s;return"click"===i||"mousedown"===i||"contextmenu"===i?n=C((0,t.getWindow)(e),s):"keydown"!==i&&"keypress"!==i&&"keyup"!==i||(n=function(e){return function(t){return e(new c.StandardKeyboardEvent(t))}}(s)),w(e,i,n,r)},t.addStandardDisposableGenericMouseDownListener=function(e,i,s){return E(e,C((0,t.getWindow)(e),i),s)},t.addStandardDisposableGenericMouseUpListener=function(e,i,s){return D(e,C((0,t.getWindow)(e),i),s)};class L extends u.AbstractIdleValue{constructor(e,t){super(e,t)}}t.WindowIdleValue=L;class R extends u.IntervalTimer{constructor(e){super(),this.defaultTarget=e&&(0,t.getWindow)(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}t.WindowIntervalTimer=R;class k{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){(0,_.onUnexpectedError)(e)}}static sort(e,t){return t.priority-e.priority}}!function(){const e=new Map,i=new Map,s=new Map,r=new Map;t.scheduleAtNextAnimationFrame=(n,o,a=0)=>{const l=(0,t.getWindowId)(n),h=new k(o,a);let c=e.get(l);return c||(c=[],e.set(l,c)),c.push(h),s.get(l)||(s.set(l,!0),n.requestAnimationFrame(()=>(t=>{s.set(t,!1);const n=e.get(t)??[];for(i.set(t,n),e.set(t,[]),r.set(t,!0);n.length>0;)n.sort(k.sort),n.shift().execute();r.set(t,!1)})(l))),h},t.runAtThisOrScheduleAtNextAnimationFrame=(e,s,n)=>{const o=(0,t.getWindowId)(e);if(r.get(o)){const e=new k(s,n);let t=i.get(o);return t||(t=[],i.set(o,t)),t.push(e),e}return(0,t.scheduleAtNextAnimationFrame)(e,s,n)}}();const A=function(e,t){return t};class T extends g.Disposable{constructor(e,t,i,s=A,r=8){super();let n=null,o=0;const a=this._register(new u.TimeoutTimer),l=()=>{o=(new Date).getTime(),i(n),n=null};this._register(w(e,t,e=>{n=s(n,e);const t=(new Date).getTime()-o;t>=r?(a.cancel(),l()):a.setIfNotSet(l,r-t)}))}}function M(e){return(0,t.getWindow)(e).getComputedStyle(e,null)}class O{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){const s=M(e),r=s?s.getPropertyValue(t):"0";return O.convertToPixels(e,r)}static getBorderLeftWidth(e){return O.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return O.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return O.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return O.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return O.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return O.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return O.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return O.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return O.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return O.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return O.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return O.getDimension(e,"margin-bottom","marginBottom")}}class I{static{this.None=new I(0,0)}constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new I(e,t):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(e){return e instanceof I?e:new I(e.width,e.height)}static equals(e,t){return e===t||!(!e||!t)&&e.width===t.width&&e.height===t.height}}function P(e){let t=e.offsetParent,i=e.offsetTop,s=e.offsetLeft;for(;null!==(e=e.parentNode)&&e!==e.ownerDocument.body&&e!==e.ownerDocument.documentElement;){i-=e.scrollTop;const r=K(e)?null:M(e);r&&(s-="rtl"!==r.direction?e.scrollLeft:-e.scrollLeft),e===t&&(s+=O.getBorderLeftWidth(e),i+=O.getBorderTopWidth(e),i+=e.offsetTop,s+=e.offsetLeft,t=e.offsetParent)}return{left:s,top:i}}function x(e){const t=O.getMarginLeft(e)+O.getMarginRight(e);return e.offsetWidth+t}function B(e){const t=O.getMarginLeft(e)+O.getMarginRight(e);return e.scrollWidth+t}function N(e,t){return Boolean(t?.contains(e))}t.Dimension=I;const U="parentFlowToElementId";function F(e){const t=e.dataset[U];return"string"==typeof t?e.ownerDocument.getElementById(t):null}function W(e,t,i){for(;e&&e.nodeType===e.ELEMENT_NODE;){if(e.classList.contains(t))return e;if(i)if("string"==typeof i){if(e.classList.contains(i))return null}else if(e===i)return null;e=e.parentNode}return null}function K(e){return e&&!!e.host&&!!e.mode}function H(e){for(;e.parentNode;){if(e===e.ownerDocument?.body)return null;e=e.parentNode}return K(e)?e:null}function z(){let e=j().activeElement;for(;e?.shadowRoot;)e=e.shadowRoot.activeElement;return e}function j(){return(0,t.getWindowsCount)()<=1?S.mainWindow.document:Array.from((0,t.getWindows)()).map(({window:e})=>e.document).find(e=>e.hasFocus())??S.mainWindow.document}const $=new Map;class V{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.innerText=e:this._styleSheet=q(S.mainWindow.document.head,t=>t.innerText=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function q(e=S.mainWindow.document.head,i,s){const r=document.createElement("style");if(r.type="text/css",r.media="screen",i?.(r),e.appendChild(r),s&&s.add((0,g.toDisposable)(()=>r.remove())),e===S.mainWindow.document.head){const e=new Set;$.set(r,e);for(const{window:i,disposables:n}of(0,t.getWindows)()){if(i===S.mainWindow)continue;const t=n.add(G(r,e,i));s?.add(t)}}return r}function G(e,i,s){const r=new g.DisposableStore,n=e.cloneNode(!0);s.document.head.appendChild(n),r.add((0,g.toDisposable)(()=>n.remove()));for(const t of Q(e))n.sheet?.insertRule(t.cssText,n.sheet?.cssRules.length);return r.add(t.sharedMutationObserver.observe(e,r,{childList:!0})(()=>{n.textContent=e.textContent})),i.add(n),r.add((0,g.toDisposable)(()=>i.delete(n))),r}function X(e,t=S.mainWindow.document.head){const i=document.createElement(e);return t.appendChild(i),i}t.sharedMutationObserver=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));const r=(0,v.hash)(i);let n=s.get(r);if(n)n.users+=1;else{const o=new f.Emitter,a=new MutationObserver(e=>o.fire(e));a.observe(e,i);const l=n={users:1,observer:a,onDidMutate:o.event};t.add((0,g.toDisposable)(()=>{l.users-=1,0===l.users&&(o.dispose(),a.disconnect(),s?.delete(r),0===s?.size&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}};let Y=null;function Z(){return Y||(Y=q()),Y}function Q(e){return e?.sheet?.rules?e.sheet.rules:e?.sheet?.cssRules?e.sheet.cssRules:[]}function J(e){return"string"==typeof e.selectorText}function ee(e){return e instanceof HTMLElement||e instanceof(0,t.getWindow)(e).HTMLElement}t.EventType={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:l.isWebKit?"webkitAnimationStart":"animationstart",ANIMATION_END:l.isWebKit?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:l.isWebKit?"webkitAnimationIteration":"animationiteration"},t.EventHelper={stop:(e,t)=>(e.preventDefault(),t&&e.stopPropagation(),e)};class te extends g.Disposable{static hasFocusWithin(e){if(ee(e)){const t=H(e);return N(t?t.activeElement:e.ownerDocument.activeElement,e)}{const t=e;return N(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new f.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new f.Emitter),this.onDidBlur=this._onDidBlur.event;let i=te.hasFocusWithin(e),s=!1;const r=()=>{s=!1,i||(i=!0,this._onDidFocus.fire())},n=()=>{i&&(s=!0,(ee(e)?(0,t.getWindow)(e):e).setTimeout(()=>{s&&(s=!1,i=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{te.hasFocusWithin(e)!==i&&(i?n():r())},this._register(w(e,t.EventType.FOCUS,r,!0)),this._register(w(e,t.EventType.BLUR,n,!0)),ee(e)&&(this._register(w(e,t.EventType.FOCUS_IN,()=>this._refreshStateHandler())),this._register(w(e,t.EventType.FOCUS_OUT,()=>this._refreshStateHandler())))}refreshState(){this._refreshStateHandler()}}function ie(e,...t){if(e.append(...t),1===t.length&&"string"!=typeof t[0])return t[0]}const se=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var re,ne;function oe(e,t,i,...s){const r=se.exec(t);if(!r)throw new Error("Bad use of emmet");const n=r[1]||"div";let o;return o=e!==re.HTML?document.createElementNS(e,n):document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([e,t])=>{void 0!==t&&(/^on\w+$/.test(e)?o[e]=t:"selected"===e?t&&o.setAttribute(e,"true"):o.setAttribute(e,t))}),o.append(...s),o}function ae(e,t,...i){return oe(re.HTML,e,t,...i)}function le(...e){for(const t of e)t.style.display="",t.removeAttribute("aria-hidden")}function he(...e){for(const t of e)t.style.display="none",t.setAttribute("aria-hidden","true")}!function(e){e.HTML="http://www.w3.org/1999/xhtml",e.SVG="http://www.w3.org/2000/svg"}(re||(t.Namespace=re={})),ae.SVG=function(e,t,...i){return oe(re.SVG,e,t,...i)},function(e){e[e.DOCUMENT=1]="DOCUMENT",e[e.BROWSER=2]="BROWSER"}(ne||(t.DetectedFullscreenMode=ne={}));class ce extends f.Emitter{constructor(){super(),this._subscriptions=new g.DisposableStore,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(f.Event.runAndSubscribe(t.onDidRegisterWindow,({window:e,disposables:t})=>this.registerListeners(e,t),{window:S.mainWindow,disposables:this._subscriptions}))}registerListeners(e,t){t.add(w(e,"keydown",e=>{if(e.defaultPrevented)return;const t=new c.StandardKeyboardEvent(e);if(t.keyCode!==p.KeyCode.Alt||!e.repeat){if(e.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(e.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(e.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(e.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else{if(t.keyCode===p.KeyCode.Alt)return;this._keyStatus.lastKeyPressed=void 0}this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=e,this.fire(this._keyStatus))}},!0)),t.add(w(e,"keyup",e=>{e.defaultPrevented||(!e.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!e.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!e.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!e.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=e,this.fire(this._keyStatus)))},!0)),t.add(w(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(w(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(w(e.document.body,"mousemove",e=>{e.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(w(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return this._keyStatus.altKey||this._keyStatus.ctrlKey||this._keyStatus.metaKey||this._keyStatus.shiftKey}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return ce.instance||(ce.instance=new ce),ce.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}t.ModifierKeyEmitter=ce;class de extends g.Disposable{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(w(this.element,t.EventType.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(w(this.element,t.EventType.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(w(this.element,t.EventType.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(w(this.element,t.EventType.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(w(this.element,t.EventType.DRAG_LEAVE,e=>{this.counter--,0===this.counter&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(w(this.element,t.EventType.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(w(this.element,t.EventType.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}t.DragAndDropObserver=de;const ue=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/;function _e(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function fe(e,t,i){for(const{name:s,value:r}of e.attributes)i&&!i.includes(s)||t.setAttribute(s,r)}function pe(e,t,i){const s=e.getAttribute(i);s?t.setAttribute(i,s):t.removeAttribute(i)}t.SafeTriangle=class{constructor(e,t,i){this.originX=e,this.originY=t,this.triangles=[];const{top:s,left:r,right:n,bottom:o}=i.getBoundingClientRect(),a=this.triangles;let l=0;a[l++]=r,a[l++]=s,a[l++]=n,a[l++]=s,a[l++]=r,a[l++]=s,a[l++]=r,a[l++]=o,a[l++]=n,a[l++]=s,a[l++]=n,a[l++]=o,a[l++]=r,a[l++]=o,a[l++]=n,a[l++]=o}contains(e,t){const{triangles:i,originX:s,originY:r}=this;for(let n=0;n<4;n++)if((0,b.isPointWithinTriangle)(e,t,s,r,i[2*n],i[2*n+1],i[2*n+2],i[2*n+3]))return!0;return!1}}},7098(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.IKeyboardService=t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(6201);t.ICharSizeService=(0,s.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,s.createDecorator)("CoreBrowserService"),t.IMouseService=(0,s.createDecorator)("MouseService"),t.IRenderService=(0,s.createDecorator)("RenderService"),t.ISelectionService=(0,s.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,s.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,s.createDecorator)("ThemeService"),t.ILinkProviderService=(0,s.createDecorator)("LinkProviderService"),t.IKeyboardService=(0,s.createDecorator)("KeyboardService")},7150(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DisposableMap=t.ImmortalReference=t.AsyncReferenceCollection=t.ReferenceCollection=t.SafeDisposable=t.RefCountedDisposable=t.MandatoryMutableDisposable=t.MutableDisposable=t.Disposable=t.DisposableStore=t.DisposableTracker=void 0,t.setDisposableTracker=function(e){l=e},t.trackDisposable=c,t.markAsDisposed=d,t.markAsSingleton=function(e){return l?.markAsSingleton(e),e},t.isDisposable=_,t.dispose=f,t.disposeIfDisposable=function(e){for(const t of e)_(t)&&t.dispose();return[]},t.combinedDisposable=function(...e){const t=p(()=>f(e));return function(e,t){if(l)for(const i of e)l.setParent(i,t)}(e,t),t},t.toDisposable=p,t.disposeOnReturn=function(e){const t=new g;try{e(t)}finally{t.dispose()}};const s=i(3058),r=i(9087),n=i(2608),o=i(8841),a=i(4218);let l=null;class h{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(e){let t=this.livingDisposables.get(e);return t||(t={parent:null,source:null,isSingleton:!1,value:e,idx:h.idx++},this.livingDisposables.set(e,t)),t}trackDisposable(e){const t=this.getDisposableData(e);t.source||(t.source=(new Error).stack)}setParent(e,t){this.getDisposableData(e).parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){const i=t.get(e);if(i)return i;const s=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,s),s}getTrackedDisposables(){const e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>null!==t.source&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let i;if(t)i=t;else{const e=new Map,t=[...this.livingDisposables.values()].filter(t=>null!==t.source&&!this.getRootParent(t,e).isSingleton);if(0===t.length)return;const s=new Set(t.map(e=>e.value));if(i=t.filter(e=>!(e.parent&&s.has(e.parent))),0===i.length)throw new Error("There are cyclic diposable chains!")}if(!i)return;function o(e){const t=e.source.split("\n").map(e=>e.trim().replace("at ","")).filter(e=>""!==e);return function(e,t){for(;e.length>0&&t.some(t=>"string"==typeof t?t===e[0]:e[0].match(t));)e.shift()}(t,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),t.reverse()}const a=new n.SetMap;for(const e of i){const t=o(e);for(let i=0;i<=t.length;i++)a.add(t.slice(0,i).join("\n"),e)}i.sort((0,s.compareBy)(e=>e.idx,s.numberComparator));let l="",h=0;for(const t of i.slice(0,e)){h++;const e=o(t),s=[];for(let t=0;to(e)[t]),e=>e);delete h[e[t]];for(const[e,t]of Object.entries(h))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(n)}l+=`\n\n\n==================== Leaking disposable ${h}/${i.length}: ${t.value.constructor.name} ====================\n${s.join("\n")}\n============================================================\n\n`}return i.length>e&&(l+=`\n\n\n... and ${i.length-e} more leaking disposables\n\n`),{leaks:i,details:l}}}function c(e){return l?.trackDisposable(e),e}function d(e){l?.markAsDisposed(e)}function u(e,t){l?.setParent(e,t)}function _(e){return"object"==typeof e&&null!==e&&"function"==typeof e.dispose&&0===e.dispose.length}function f(e){if(a.Iterable.is(e)){const t=[];for(const i of e)if(i)try{i.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function p(e){const t=c({dispose:(0,o.createSingleCallFunction)(()=>{d(t),e()})});return t}t.DisposableTracker=h;class g{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,c(this)}dispose(){this._isDisposed||(d(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{f(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 u(e,this),this._isDisposed?g.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),u(e,null))}}t.DisposableStore=g;class m{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new g,c(this),u(this._store,this)}dispose(){d(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}t.Disposable=m;class v{constructor(){this._isDisposed=!1,c(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&u(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,d(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){const e=this._value;return this._value=void 0,e&&u(e,null),e}}t.MutableDisposable=v,t.MandatoryMutableDisposable=class{constructor(e){this._disposable=new v,this._isDisposed=!1,this._disposable.value=e}get value(){return this._disposable.value}set value(e){this._isDisposed||e===this._disposable.value||(this._disposable.value=e)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},t.RefCountedDisposable=class{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return 0===--this._counter&&this._disposable.dispose(),this}},t.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,c(this)}set(e){let t=e;return this.unset=()=>t=void 0,this.isset=()=>void 0!==t,this.dispose=()=>{t&&(t(),t=void 0,d(this))},this}},t.ReferenceCollection=class{constructor(){this.references=new Map}acquire(e,...t){let i=this.references.get(e);i||(i={counter:0,object:this.createReferencedObject(e,...t)},this.references.set(e,i));const{object:s}=i,r=(0,o.createSingleCallFunction)(()=>{0===--i.counter&&(this.destroyReferencedObject(e,i.object),this.references.delete(e))});return i.counter++,{object:s,dispose:r}}},t.AsyncReferenceCollection=class{constructor(e){this.referenceCollection=e}async acquire(e,...t){const i=this.referenceCollection.acquire(e,...t);try{return{object:await i.object,dispose:()=>i.dispose()}}catch(e){throw i.dispose(),e}}},t.ImmortalReference=class{constructor(e){this.object=e}dispose(){}};class S{constructor(){this._store=new Map,this._isDisposed=!1,c(this)}dispose(){d(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{f(this._store.values())}finally{this._store.clear()}}has(e){return this._store.has(e)}get size(){return this._store.size}get(e){return this._store.get(e)}set(e,t,i=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(e)?.dispose(),this._store.set(e,t)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}deleteAndLeak(e){const t=this._store.get(e);return this._store.delete(e),t}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}t.DisposableMap=S},7174(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const s=i(7710);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},7241(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.KittyKeyboard=void 0,t.KittyKeyboard=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440},this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24},this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(e){if(e.code.startsWith("Numpad")){const t=e.code.slice(6);if(t>="0"&&t<="9")return 57399+parseInt(t,10);switch(t){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(e){switch(e.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(e){let t=0;return e.shiftKey&&(t|=1),e.altKey&&(t|=2),e.ctrlKey&&(t|=4),e.metaKey&&(t|=8),t>0?t+1:0}_getKeyCode(e){const t=this._getNumpadKeyCode(e);if(void 0!==t)return t;const i=this._getModifierKeyCode(e);if(void 0!==i)return i;const s=this._functionalKeyCodes[e.key];if(void 0!==s)return s;if(e.shiftKey&&e.code){if(e.code.startsWith("Digit")&&6===e.code.length){const t=e.code.charAt(5);if(t>="0"&&t<="9")return t.charCodeAt(0)}if(e.code.startsWith("Key")&&4===e.code.length)return e.code.charAt(3).toLowerCase().charCodeAt(0)}if(1===e.key.length){const t=e.key.codePointAt(0);return t>=65&&t<=90?t+32:t}}_isModifierKey(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}_buildCsiLetterSequence(e,t,i,s){const r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"["+e}_buildSs3Sequence(e,t,i,s){const r=s&&1!==i;if(t>0||r){let s="[1;"+(t>0?t:"1");return r&&(s+=":"+i),s+=e,s}return"O"+e}_buildCsiTildeSequence(e,t,i,s){const r=s&&1!==i;let n="["+e;return(t>0||r)&&(n+=";"+(t>0?t:"1"),r&&(n+=":"+i)),n+="~",n}_buildCsiUSequence(e,t,i,s,r,n,o){const a=!!(2&r);let l,h="["+t;4&r&&e.shiftKey&&1===e.key.length&&!n&&!o&&(l=e.key.codePointAt(0),h+=":"+l);const c=16&r&&3!==s&&1===e.key.length&&!n&&!o&&!e.ctrlKey?e.key.codePointAt(0):void 0,d=a&&1!==s&&(3===s||void 0===c);return(i>0||d||void 0!==c)&&(h+=";",i>0?h+=i:d&&(h+="1"),d&&(h+=":"+s)),void 0!==c&&(h+=";"+c),h+="u",h}evaluate(e,t,i=1){const s={type:0,cancel:!1,key:void 0},r=this._encodeModifiers(e),n=this._isModifierKey(e),o=!!(2&t);if(!o&&3===i)return s;if(n&&!(8&t)&&!o)return s;const a=this._csiLetterKeys[e.key];if(a)return s.key=this._buildCsiLetterSequence(a,r,i,o),s.cancel=!0,s;const l=this._ss3FunctionKeys[e.key];if(l)return s.key=this._buildSs3Sequence(l,r,i,o),s.cancel=!0,s;const h=this._csiTildeKeys[e.key];if(void 0!==h)return s.key=this._buildCsiTildeSequence(h,r,i,o),s.cancel=!0,s;const c=this._getKeyCode(e);if(void 0===c)return s;const d=void 0!==this._functionalKeyCodes[e.key]||void 0!==this._getNumpadKeyCode(e);let u=!1;return 8&t||o?u=!0:1&t&&(27===c||127===c||13===c||9===c||32===c||d?u=!0:r>0&&(u=!(e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length))),u?(s.key=this._buildCsiUSequence(e,c,r,i,t,d,n),s.cancel=!0):1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey||(s.key=e.key),s}static shouldUseProtocol(e){return e>0}}},7262(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const i=2147483647;class s{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i256)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=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{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>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},7276(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.LogService=void 0;const n=i(4812),o=i(6501),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let l=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tt[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){const e=s.UnicodeService.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return s.UnicodeService.createPropertyValue(0,i,r)}}},7453(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.clone=function e(t,i=5){if("object"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},7704(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SlidingWindowAverage=t.MovingAverage=t.Counter=void 0,t.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},t.rot=function(e,t){return(t+e%t)%t},t.isPointWithinTriangle=function(e,t,i,s,r,n,o,a){const l=o-i,h=a-s,c=r-i,d=n-s,u=e-i,_=t-s,f=l*l+h*h,p=l*c+h*d,g=l*u+h*_,m=c*c+d*d,v=c*u+d*_,S=1/(f*m-p*p),b=(m*g-p*v)*S,y=(f*v-p*g)*S;return b>=0&&y>=0&&b+y<1},t.Counter=class{constructor(){this._next=0}getNext(){return this._next++}},t.MovingAverage=class{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},t.SlidingWindowAverage=class{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){const t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._ni,set:e=>i=e};t.promptLabel=s;let r="Too much output to announce, navigate to rows manually to read";const n={get:()=>r,set:e=>r=e};t.tooMuchOutput=n},7745(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o0,pointerEvents:l.mainWindow.PointerEvent&&("ontouchstart"in l.mainWindow||navigator.maxTouchPoints>0)}},7792(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=i(6501),o=i(4812),a=i(8636),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function h(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const c=String.fromCharCode,d={DEFAULT:e=>{const t=[h(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${c(t[0])}${c(t[1])}${c(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${h(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${h(e,!0)};${e.x};${e.y}${t}`}};let u=class extends o.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new a.Emitter),this.onProtocolChange=this._onProtocolChange.event;for(const e of Object.keys(l))this.addProtocol(e,l[e]);for(const e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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,i){if(0===e.deltaY||e.shiftKey)return 0;if(void 0===t||void 0===i)return 0;const s=t/i;let r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=u,t.CoreMouseService=u=s([r(0,n.IBufferService),r(1,n.ICoreService),r(2,n.IOptionsService)],u)},7804(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XTERM_VERSION=void 0,t.XTERM_VERSION="6.1.0-beta.141"},7861(e,t){function i(e){return e.replace(/\r?\n/g,"\r")}function s(e,t){return t?"[200~"+e+"[201~":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),r.triggerDataEvent(e,!0),t.value=""}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData("text/plain"),t,i,s)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7883(e,t){var i,s;Object.defineProperty(t,"__esModule",{value:!0}),t.KeyMod=t.KeyCodeUtils=t.ScanCodeUtils=t.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE=t.EVENT_KEY_CODE_MAP=t.ScanCode=t.KeyCode=void 0,t.KeyChord=function(e,t){return(e|(65535&t)<<16>>>0)>>>0},function(e){e[e.DependsOnKbLayout=-1]="DependsOnKbLayout",e[e.Unknown=0]="Unknown",e[e.Backspace=1]="Backspace",e[e.Tab=2]="Tab",e[e.Enter=3]="Enter",e[e.Shift=4]="Shift",e[e.Ctrl=5]="Ctrl",e[e.Alt=6]="Alt",e[e.PauseBreak=7]="PauseBreak",e[e.CapsLock=8]="CapsLock",e[e.Escape=9]="Escape",e[e.Space=10]="Space",e[e.PageUp=11]="PageUp",e[e.PageDown=12]="PageDown",e[e.End=13]="End",e[e.Home=14]="Home",e[e.LeftArrow=15]="LeftArrow",e[e.UpArrow=16]="UpArrow",e[e.RightArrow=17]="RightArrow",e[e.DownArrow=18]="DownArrow",e[e.Insert=19]="Insert",e[e.Delete=20]="Delete",e[e.Digit0=21]="Digit0",e[e.Digit1=22]="Digit1",e[e.Digit2=23]="Digit2",e[e.Digit3=24]="Digit3",e[e.Digit4=25]="Digit4",e[e.Digit5=26]="Digit5",e[e.Digit6=27]="Digit6",e[e.Digit7=28]="Digit7",e[e.Digit8=29]="Digit8",e[e.Digit9=30]="Digit9",e[e.KeyA=31]="KeyA",e[e.KeyB=32]="KeyB",e[e.KeyC=33]="KeyC",e[e.KeyD=34]="KeyD",e[e.KeyE=35]="KeyE",e[e.KeyF=36]="KeyF",e[e.KeyG=37]="KeyG",e[e.KeyH=38]="KeyH",e[e.KeyI=39]="KeyI",e[e.KeyJ=40]="KeyJ",e[e.KeyK=41]="KeyK",e[e.KeyL=42]="KeyL",e[e.KeyM=43]="KeyM",e[e.KeyN=44]="KeyN",e[e.KeyO=45]="KeyO",e[e.KeyP=46]="KeyP",e[e.KeyQ=47]="KeyQ",e[e.KeyR=48]="KeyR",e[e.KeyS=49]="KeyS",e[e.KeyT=50]="KeyT",e[e.KeyU=51]="KeyU",e[e.KeyV=52]="KeyV",e[e.KeyW=53]="KeyW",e[e.KeyX=54]="KeyX",e[e.KeyY=55]="KeyY",e[e.KeyZ=56]="KeyZ",e[e.Meta=57]="Meta",e[e.ContextMenu=58]="ContextMenu",e[e.F1=59]="F1",e[e.F2=60]="F2",e[e.F3=61]="F3",e[e.F4=62]="F4",e[e.F5=63]="F5",e[e.F6=64]="F6",e[e.F7=65]="F7",e[e.F8=66]="F8",e[e.F9=67]="F9",e[e.F10=68]="F10",e[e.F11=69]="F11",e[e.F12=70]="F12",e[e.F13=71]="F13",e[e.F14=72]="F14",e[e.F15=73]="F15",e[e.F16=74]="F16",e[e.F17=75]="F17",e[e.F18=76]="F18",e[e.F19=77]="F19",e[e.F20=78]="F20",e[e.F21=79]="F21",e[e.F22=80]="F22",e[e.F23=81]="F23",e[e.F24=82]="F24",e[e.NumLock=83]="NumLock",e[e.ScrollLock=84]="ScrollLock",e[e.Semicolon=85]="Semicolon",e[e.Equal=86]="Equal",e[e.Comma=87]="Comma",e[e.Minus=88]="Minus",e[e.Period=89]="Period",e[e.Slash=90]="Slash",e[e.Backquote=91]="Backquote",e[e.BracketLeft=92]="BracketLeft",e[e.Backslash=93]="Backslash",e[e.BracketRight=94]="BracketRight",e[e.Quote=95]="Quote",e[e.OEM_8=96]="OEM_8",e[e.IntlBackslash=97]="IntlBackslash",e[e.Numpad0=98]="Numpad0",e[e.Numpad1=99]="Numpad1",e[e.Numpad2=100]="Numpad2",e[e.Numpad3=101]="Numpad3",e[e.Numpad4=102]="Numpad4",e[e.Numpad5=103]="Numpad5",e[e.Numpad6=104]="Numpad6",e[e.Numpad7=105]="Numpad7",e[e.Numpad8=106]="Numpad8",e[e.Numpad9=107]="Numpad9",e[e.NumpadMultiply=108]="NumpadMultiply",e[e.NumpadAdd=109]="NumpadAdd",e[e.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",e[e.NumpadSubtract=111]="NumpadSubtract",e[e.NumpadDecimal=112]="NumpadDecimal",e[e.NumpadDivide=113]="NumpadDivide",e[e.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",e[e.ABNT_C1=115]="ABNT_C1",e[e.ABNT_C2=116]="ABNT_C2",e[e.AudioVolumeMute=117]="AudioVolumeMute",e[e.AudioVolumeUp=118]="AudioVolumeUp",e[e.AudioVolumeDown=119]="AudioVolumeDown",e[e.BrowserSearch=120]="BrowserSearch",e[e.BrowserHome=121]="BrowserHome",e[e.BrowserBack=122]="BrowserBack",e[e.BrowserForward=123]="BrowserForward",e[e.MediaTrackNext=124]="MediaTrackNext",e[e.MediaTrackPrevious=125]="MediaTrackPrevious",e[e.MediaStop=126]="MediaStop",e[e.MediaPlayPause=127]="MediaPlayPause",e[e.LaunchMediaPlayer=128]="LaunchMediaPlayer",e[e.LaunchMail=129]="LaunchMail",e[e.LaunchApp2=130]="LaunchApp2",e[e.Clear=131]="Clear",e[e.MAX_VALUE=132]="MAX_VALUE"}(i||(t.KeyCode=i={})),function(e){e[e.DependsOnKbLayout=-1]="DependsOnKbLayout",e[e.None=0]="None",e[e.Hyper=1]="Hyper",e[e.Super=2]="Super",e[e.Fn=3]="Fn",e[e.FnLock=4]="FnLock",e[e.Suspend=5]="Suspend",e[e.Resume=6]="Resume",e[e.Turbo=7]="Turbo",e[e.Sleep=8]="Sleep",e[e.WakeUp=9]="WakeUp",e[e.KeyA=10]="KeyA",e[e.KeyB=11]="KeyB",e[e.KeyC=12]="KeyC",e[e.KeyD=13]="KeyD",e[e.KeyE=14]="KeyE",e[e.KeyF=15]="KeyF",e[e.KeyG=16]="KeyG",e[e.KeyH=17]="KeyH",e[e.KeyI=18]="KeyI",e[e.KeyJ=19]="KeyJ",e[e.KeyK=20]="KeyK",e[e.KeyL=21]="KeyL",e[e.KeyM=22]="KeyM",e[e.KeyN=23]="KeyN",e[e.KeyO=24]="KeyO",e[e.KeyP=25]="KeyP",e[e.KeyQ=26]="KeyQ",e[e.KeyR=27]="KeyR",e[e.KeyS=28]="KeyS",e[e.KeyT=29]="KeyT",e[e.KeyU=30]="KeyU",e[e.KeyV=31]="KeyV",e[e.KeyW=32]="KeyW",e[e.KeyX=33]="KeyX",e[e.KeyY=34]="KeyY",e[e.KeyZ=35]="KeyZ",e[e.Digit1=36]="Digit1",e[e.Digit2=37]="Digit2",e[e.Digit3=38]="Digit3",e[e.Digit4=39]="Digit4",e[e.Digit5=40]="Digit5",e[e.Digit6=41]="Digit6",e[e.Digit7=42]="Digit7",e[e.Digit8=43]="Digit8",e[e.Digit9=44]="Digit9",e[e.Digit0=45]="Digit0",e[e.Enter=46]="Enter",e[e.Escape=47]="Escape",e[e.Backspace=48]="Backspace",e[e.Tab=49]="Tab",e[e.Space=50]="Space",e[e.Minus=51]="Minus",e[e.Equal=52]="Equal",e[e.BracketLeft=53]="BracketLeft",e[e.BracketRight=54]="BracketRight",e[e.Backslash=55]="Backslash",e[e.IntlHash=56]="IntlHash",e[e.Semicolon=57]="Semicolon",e[e.Quote=58]="Quote",e[e.Backquote=59]="Backquote",e[e.Comma=60]="Comma",e[e.Period=61]="Period",e[e.Slash=62]="Slash",e[e.CapsLock=63]="CapsLock",e[e.F1=64]="F1",e[e.F2=65]="F2",e[e.F3=66]="F3",e[e.F4=67]="F4",e[e.F5=68]="F5",e[e.F6=69]="F6",e[e.F7=70]="F7",e[e.F8=71]="F8",e[e.F9=72]="F9",e[e.F10=73]="F10",e[e.F11=74]="F11",e[e.F12=75]="F12",e[e.PrintScreen=76]="PrintScreen",e[e.ScrollLock=77]="ScrollLock",e[e.Pause=78]="Pause",e[e.Insert=79]="Insert",e[e.Home=80]="Home",e[e.PageUp=81]="PageUp",e[e.Delete=82]="Delete",e[e.End=83]="End",e[e.PageDown=84]="PageDown",e[e.ArrowRight=85]="ArrowRight",e[e.ArrowLeft=86]="ArrowLeft",e[e.ArrowDown=87]="ArrowDown",e[e.ArrowUp=88]="ArrowUp",e[e.NumLock=89]="NumLock",e[e.NumpadDivide=90]="NumpadDivide",e[e.NumpadMultiply=91]="NumpadMultiply",e[e.NumpadSubtract=92]="NumpadSubtract",e[e.NumpadAdd=93]="NumpadAdd",e[e.NumpadEnter=94]="NumpadEnter",e[e.Numpad1=95]="Numpad1",e[e.Numpad2=96]="Numpad2",e[e.Numpad3=97]="Numpad3",e[e.Numpad4=98]="Numpad4",e[e.Numpad5=99]="Numpad5",e[e.Numpad6=100]="Numpad6",e[e.Numpad7=101]="Numpad7",e[e.Numpad8=102]="Numpad8",e[e.Numpad9=103]="Numpad9",e[e.Numpad0=104]="Numpad0",e[e.NumpadDecimal=105]="NumpadDecimal",e[e.IntlBackslash=106]="IntlBackslash",e[e.ContextMenu=107]="ContextMenu",e[e.Power=108]="Power",e[e.NumpadEqual=109]="NumpadEqual",e[e.F13=110]="F13",e[e.F14=111]="F14",e[e.F15=112]="F15",e[e.F16=113]="F16",e[e.F17=114]="F17",e[e.F18=115]="F18",e[e.F19=116]="F19",e[e.F20=117]="F20",e[e.F21=118]="F21",e[e.F22=119]="F22",e[e.F23=120]="F23",e[e.F24=121]="F24",e[e.Open=122]="Open",e[e.Help=123]="Help",e[e.Select=124]="Select",e[e.Again=125]="Again",e[e.Undo=126]="Undo",e[e.Cut=127]="Cut",e[e.Copy=128]="Copy",e[e.Paste=129]="Paste",e[e.Find=130]="Find",e[e.AudioVolumeMute=131]="AudioVolumeMute",e[e.AudioVolumeUp=132]="AudioVolumeUp",e[e.AudioVolumeDown=133]="AudioVolumeDown",e[e.NumpadComma=134]="NumpadComma",e[e.IntlRo=135]="IntlRo",e[e.KanaMode=136]="KanaMode",e[e.IntlYen=137]="IntlYen",e[e.Convert=138]="Convert",e[e.NonConvert=139]="NonConvert",e[e.Lang1=140]="Lang1",e[e.Lang2=141]="Lang2",e[e.Lang3=142]="Lang3",e[e.Lang4=143]="Lang4",e[e.Lang5=144]="Lang5",e[e.Abort=145]="Abort",e[e.Props=146]="Props",e[e.NumpadParenLeft=147]="NumpadParenLeft",e[e.NumpadParenRight=148]="NumpadParenRight",e[e.NumpadBackspace=149]="NumpadBackspace",e[e.NumpadMemoryStore=150]="NumpadMemoryStore",e[e.NumpadMemoryRecall=151]="NumpadMemoryRecall",e[e.NumpadMemoryClear=152]="NumpadMemoryClear",e[e.NumpadMemoryAdd=153]="NumpadMemoryAdd",e[e.NumpadMemorySubtract=154]="NumpadMemorySubtract",e[e.NumpadClear=155]="NumpadClear",e[e.NumpadClearEntry=156]="NumpadClearEntry",e[e.ControlLeft=157]="ControlLeft",e[e.ShiftLeft=158]="ShiftLeft",e[e.AltLeft=159]="AltLeft",e[e.MetaLeft=160]="MetaLeft",e[e.ControlRight=161]="ControlRight",e[e.ShiftRight=162]="ShiftRight",e[e.AltRight=163]="AltRight",e[e.MetaRight=164]="MetaRight",e[e.BrightnessUp=165]="BrightnessUp",e[e.BrightnessDown=166]="BrightnessDown",e[e.MediaPlay=167]="MediaPlay",e[e.MediaRecord=168]="MediaRecord",e[e.MediaFastForward=169]="MediaFastForward",e[e.MediaRewind=170]="MediaRewind",e[e.MediaTrackNext=171]="MediaTrackNext",e[e.MediaTrackPrevious=172]="MediaTrackPrevious",e[e.MediaStop=173]="MediaStop",e[e.Eject=174]="Eject",e[e.MediaPlayPause=175]="MediaPlayPause",e[e.MediaSelect=176]="MediaSelect",e[e.LaunchMail=177]="LaunchMail",e[e.LaunchApp2=178]="LaunchApp2",e[e.LaunchApp1=179]="LaunchApp1",e[e.SelectTask=180]="SelectTask",e[e.LaunchScreenSaver=181]="LaunchScreenSaver",e[e.BrowserSearch=182]="BrowserSearch",e[e.BrowserHome=183]="BrowserHome",e[e.BrowserBack=184]="BrowserBack",e[e.BrowserForward=185]="BrowserForward",e[e.BrowserStop=186]="BrowserStop",e[e.BrowserRefresh=187]="BrowserRefresh",e[e.BrowserFavorites=188]="BrowserFavorites",e[e.ZoomToggle=189]="ZoomToggle",e[e.MailReply=190]="MailReply",e[e.MailForward=191]="MailForward",e[e.MailSend=192]="MailSend",e[e.MAX_VALUE=193]="MAX_VALUE"}(s||(t.ScanCode=s={}));class r{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()]||i.Unknown}}const n=new r,o=new r,a=new r;t.EVENT_KEY_CODE_MAP=new Array(230),t.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE={};const l=[],h=Object.create(null),c=Object.create(null);var d,u;t.ScanCodeUtils={lowerCaseToEnum:e=>c[e]||s.None,toEnum:e=>h[e]||s.None,toString:e=>l[e]||"None"},function(e){e.toString=function(e){return n.keyCodeToStr(e)},e.fromString=function(e){return n.strToKeyCode(e)},e.toUserSettingsUS=function(e){return o.keyCodeToStr(e)},e.toUserSettingsGeneral=function(e){return a.keyCodeToStr(e)},e.fromUserSettings=function(e){return o.strToKeyCode(e)||a.strToKeyCode(e)},e.toElectronAccelerator=function(e){if(e>=i.Numpad0&&e<=i.NumpadDivide)return null;switch(e){case i.UpArrow:return"Up";case i.DownArrow:return"Down";case i.LeftArrow:return"Left";case i.RightArrow:return"Right"}return n.keyCodeToStr(e)}}(d||(t.KeyCodeUtils=d={})),function(e){e[e.CtrlCmd=2048]="CtrlCmd",e[e.Shift=1024]="Shift",e[e.Alt=512]="Alt",e[e.WinCtrl=256]="WinCtrl"}(u||(t.KeyMod=u={}))},8158(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const s=i(8636),r=i(4812);class n{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.Emitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.dispose)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},8163(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isAndroid=t.isEdge=t.isSafari=t.isFirefox=t.isChrome=t.OS=t.OperatingSystem=t.setTimeout0=t.setTimeout0IsFaster=t.translationsConfigFile=t.platformLocale=t.locale=t.Language=t.language=t.userAgent=t.platform=t.isCI=t.isMobile=t.isIOS=t.webWorkerOrigin=t.isWebWorker=t.isWeb=t.isElectron=t.isNative=t.isLinuxSnap=t.isLinux=t.isMacintosh=t.isWindows=t.Platform=t.LANGUAGE_DEFAULT=void 0,t.PlatformToString=function(e){switch(e){case y.Web:return"Web";case y.Mac:return"Mac";case y.Linux:return"Linux";case y.Windows:return"Windows"}},t.isLittleEndian=function(){if(!L){L=!0;const e=new Uint8Array(2);e[0]=1,e[1]=2;const t=new Uint16Array(e.buffer);D=513===t[0]}return D},t.isBigSurOrNewer=function(e){return parseFloat(e)>=20},t.LANGUAGE_DEFAULT="en";let i,s,r,n=!1,o=!1,a=!1,l=!1,h=!1,c=!1,d=!1,u=!1,_=!1,f=!1,p=t.LANGUAGE_DEFAULT,g=t.LANGUAGE_DEFAULT;const m=globalThis;let v;void 0!==m.vscode&&void 0!==m.vscode.process?v=m.vscode.process:"undefined"!=typeof process&&"string"==typeof process?.versions?.node&&(v=process);const S="string"==typeof v?.versions?.electron,b=S&&"renderer"===v?.type;if("object"==typeof v){n="win32"===v.platform,o="darwin"===v.platform,a="linux"===v.platform,l=a&&!!v.env.SNAP&&!!v.env.SNAP_REVISION,d=S,_=!!v.env.CI||!!v.env.BUILD_ARTIFACTSTAGINGDIRECTORY,i=t.LANGUAGE_DEFAULT,p=t.LANGUAGE_DEFAULT;const e=v.env.VSCODE_NLS_CONFIG;if(e)try{const r=JSON.parse(e);i=r.userLocale,g=r.osLocale,p=r.resolvedLanguage||t.LANGUAGE_DEFAULT,s=r.languagePack?.translationsConfigFile}catch(e){}h=!0}else"object"!=typeof navigator||b?console.error("Unable to resolve platform."):(r=navigator.userAgent,n=r.indexOf("Windows")>=0,o=r.indexOf("Macintosh")>=0,u=(r.indexOf("Macintosh")>=0||r.indexOf("iPad")>=0||r.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,a=r.indexOf("Linux")>=0,f=r?.indexOf("Mobi")>=0,c=!0,p=globalThis._VSCODE_NLS_LANGUAGE||t.LANGUAGE_DEFAULT,i=navigator.language.toLowerCase(),g=i);var y;!function(e){e[e.Web=0]="Web",e[e.Mac=1]="Mac",e[e.Linux=2]="Linux",e[e.Windows=3]="Windows"}(y||(t.Platform=y={}));let w=y.Web;var C,E;o?w=y.Mac:n?w=y.Windows:a&&(w=y.Linux),t.isWindows=n,t.isMacintosh=o,t.isLinux=a,t.isLinuxSnap=l,t.isNative=h,t.isElectron=d,t.isWeb=c,t.isWebWorker=c&&"function"==typeof m.importScripts,t.webWorkerOrigin=t.isWebWorker?m.origin:void 0,t.isIOS=u,t.isMobile=f,t.isCI=_,t.platform=w,t.userAgent=r,t.language=p,function(e){e.value=function(){return t.language},e.isDefaultVariant=function(){return 2===t.language.length?"en"===t.language:t.language.length>=3&&"e"===t.language[0]&&"n"===t.language[1]&&"-"===t.language[2]},e.isDefault=function(){return"en"===t.language}}(C||(t.Language=C={})),t.locale=i,t.platformLocale=g,t.translationsConfigFile=s,t.setTimeout0IsFaster="function"==typeof m.postMessage&&!m.importScripts,t.setTimeout0=(()=>{if(t.setTimeout0IsFaster){const e=[];m.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i{const s=++t;e.push({id:s,callback:i}),m.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),function(e){e[e.Windows=1]="Windows",e[e.Macintosh=2]="Macintosh",e[e.Linux=3]="Linux"}(E||(t.OperatingSystem=E={})),t.OS=o||u?E.Macintosh:n?E.Windows:E.Linux;let D=!0,L=!1;t.isChrome=!!(t.userAgent&&t.userAgent.indexOf("Chrome")>=0),t.isFirefox=!!(t.userAgent&&t.userAgent.indexOf("Firefox")>=0),t.isSafari=!!(!t.isChrome&&t.userAgent&&t.userAgent.indexOf("Safari")>=0),t.isEdge=!!(t.userAgent&&t.userAgent.indexOf("Edg/")>=0),t.isAndroid=!!(t.userAgent&&t.userAgent.indexOf("Android")>=0)},8234(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(i+=.25),t){const s=Math.abs(e.deltaX),r=Math.abs(e.deltaY),n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),a=Math.max(Math.min(s,n),1),l=Math.max(Math.min(r,o),1),h=Math.max(s,n),c=Math.max(r,o);h%a===0&&c%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}t.MouseWheelClassifier=b;class y extends _.Widget{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new p.Emitter),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new p.Emitter),this.onWillScroll=this._onWillScroll.event,this._options=function(e){const t={lazyRender:void 0!==e.lazyRender&&e.lazyRender,className:void 0!==e.className?e.className:"",useShadows:void 0===e.useShadows||e.useShadows,handleMouseWheel:void 0===e.handleMouseWheel||e.handleMouseWheel,flipAxes:void 0!==e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:void 0!==e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:void 0!==e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:void 0!==e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:void 0!==e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:void 0!==e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:void 0===e.scrollPredominantAxis||e.scrollPredominantAxis,mouseWheelSmoothScroll:void 0===e.mouseWheelSmoothScroll||e.mouseWheelSmoothScroll,arrowSize:void 0!==e.arrowSize?e.arrowSize:11,listenOnDomNode:void 0!==e.listenOnDomNode?e.listenOnDomNode:null,horizontal:void 0!==e.horizontal?e.horizontal:v.ScrollbarVisibility.Auto,horizontalScrollbarSize:void 0!==e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:void 0!==e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:void 0!==e.horizontalHasArrows&&e.horizontalHasArrows,vertical:void 0!==e.vertical?e.vertical:v.ScrollbarVisibility.Auto,verticalScrollbarSize:void 0!==e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:void 0!==e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:void 0!==e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:void 0!==e.scrollByPage&&e.scrollByPage};return t.horizontalSliderSize=void 0!==e.horizontalSliderSize?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=void 0!==e.verticalSliderSize?e.verticalSliderSize:t.verticalScrollbarSize,m.isMacintosh&&(t.className+=" mac"),t}(t),this._scrollable=i,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));const s={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new u.VerticalScrollbar(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new d.HorizontalScrollbar(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(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=(0,h.createFastDomNode)(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=(0,h.createFastDomNode)(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=(0,h.createFastDomNode)(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new f.TimeoutTimer),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=(0,g.dispose)(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,m.isMacintosh&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){void 0!==e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),void 0!==e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),void 0!==e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),void 0!==e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),void 0!==e.horizontal&&(this._options.horizontal=e.horizontal),void 0!==e.vertical&&(this._options.vertical=e.vertical),void 0!==e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),void 0!==e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),void 0!==e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new c.StandardWheelEvent(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=(0,g.dispose)(this._mouseWheelToDispose),e)){const e=e=>{this._onMouseWheel(new c.StandardWheelEvent(e))};this._mouseWheelToDispose.push(l.addDisposableListener(this._listenOnDomNode,l.EventType.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=b.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+s===0?r=s=0:Math.abs(s)>=Math.abs(r)?r=0:s=0),this._options.flipAxes&&([s,r]=[r,s]);const n=!m.isMacintosh&&e.browserEvent&&e.browserEvent.shiftKey;!this._options.scrollYToX&&!n||r||(r=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(r*=this._options.fastScrollSensitivity,s*=this._options.fastScrollSensitivity);const o=this._scrollable.getFutureScrollPosition();let a={};if(s){const e=50*s,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,t)}if(r){const e=50*r,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}a=this._scrollable.validateScrollPosition(a),(o.scrollLeft!==a.scrollLeft||o.scrollTop!==a.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet(()=>this._hide(),500)}}t.AbstractScrollableElement=y,t.ScrollableElement=class extends y{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new v.Scrollable({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>l.scheduleAtNextAnimationFrame(l.getWindow(e),t)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},t.SmoothScrollableElement=class extends y{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},t.DomScrollableElement=class extends y{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new v.Scrollable({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:t=>l.scheduleAtNextAnimationFrame(l.getWindow(e),t)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(e=>{e.scrollTopChanged&&(this._element.scrollTop=e.scrollTop),e.scrollLeftChanged&&(this._element.scrollLeft=e.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}},8245(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollbarState=void 0;class i{constructor(e,t,i,s,r,n){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=r,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new i(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,s,r){const n=Math.max(0,i-e),o=Math.max(0,n-2*t),a=s>0&&s>i;if(!a)return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};const l=Math.round(Math.max(20,Math.floor(i*o/s))),h=(o-l)/(s-i),c=r*h;return{computedAvailableSize:Math.round(n),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){const e=i._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;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return tt(new h.StandardMouseEvent(a.getWindow(e),i))))}onmousedown(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_DOWN,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onmouseover(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_OVER,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onmouseleave(e,t){this._register(a.addDisposableListener(e,a.EventType.MOUSE_LEAVE,i=>t(new h.StandardMouseEvent(a.getWindow(e),i))))}onkeydown(e,t){this._register(a.addDisposableListener(e,a.EventType.KEY_DOWN,e=>t(new l.StandardKeyboardEvent(e))))}onkeyup(e,t){this._register(a.addDisposableListener(e,a.EventType.KEY_UP,e=>t(new l.StandardKeyboardEvent(e))))}oninput(e,t){this._register(a.addDisposableListener(e,a.EventType.INPUT,t))}onblur(e,t){this._register(a.addDisposableListener(e,a.EventType.BLUR,t))}onfocus(e,t){this._register(a.addDisposableListener(e,a.EventType.FOCUS,t))}onchange(e,t){this._register(a.addDisposableListener(e,a.EventType.CHANGE,t))}ignoreGesture(e){return c.Gesture.ignoreTarget(e)}}t.Widget=u},8297(e,t){function i(e,t,i=e.length-1){for(let s=i;s>=0;s--)if(t(e[s]))return s;return-1}function s(e,t,i=0,s=e.length){let r=i,n=s;for(;r=0&&(i=r)}return i},t.findFirstMin=function(e,t){return o(e,(e,i)=>-t(e,i))},t.findMaxIdx=function(e,t){if(0===e.length)return-1;let i=0;for(let s=1;s0&&(i=s);return i},t.mapFindFirst=function(e,t){for(const i of e){const e=t(i);if(void 0!==e)return e}};class n{static{this.assertInvariants=!1}constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(n.assertInvariants){if(this._prevFindLastPredicate)for(const t of this._array)if(this._prevFindLastPredicate(t)&&!e(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");this._prevFindLastPredicate=e}const t=s(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,-1===t?void 0:this._array[t]}}function o(e,t){if(0===e.length)return;let i=e[0];for(let s=1;s0&&(i=r)}return i}t.MonotonousArray=n},8328(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o{try{e.releasePointerCapture(t)}catch(e){}}))}catch(t){n=a.getWindow(e)}this._hooks.add(a.addDisposableListener(n,a.EventType.POINTER_MOVE,e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(a.addDisposableListener(n,a.EventType.POINTER_UP,e=>this.stopMonitoring(!0)))}}},8447(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0,t.cancelOnDispose=function(e){const t=new a;return e.add({dispose(){t.cancel()}}),t.token};const s=i(802),r=Object.freeze(function(e,t){const i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});var n;!function(e){e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof o||!(!t||"object"!=typeof t)&&"boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r})}(n||(t.CancellationToken=n={}));class o{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?r:(this._emitter||(this._emitter=new s.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class a{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new o),this._token}cancel(){this._token?this._token instanceof o&&this._token.cancel():this._token=n.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof o&&this._token.dispose():this._token=n.None}}t.CancellationTokenSource=a},8594(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},a=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;o{t.add(l.addDisposableListener(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),t.add(l.addDisposableListener(e.document,"touchend",t=>this.onTouchEnd(e,t))),t.add(l.addDisposableListener(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:h.mainWindow,disposables:this._store}))}static addTarget(e){if(!g.isTouchDevice())return _.Disposable.None;g.INSTANCE||(g.INSTANCE=(0,_.markAsSingleton)(new g));const t=g.INSTANCE.targets.push(e);return(0,_.toDisposable)(t)}static ignoreTarget(e){if(!g.isTouchDevice())return _.Disposable.None;g.INSTANCE||(g.INSTANCE=(0,_.markAsSingleton)(new g));const t=g.INSTANCE.ignoreTargets.push(e);return(0,_.toDisposable)(t)}static isTouchDevice(){return"ontouchstart"in h.mainWindow||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=e.targetTouches.length;i=g.HOLD_DELAY&&Math.abs(o.initialPageX-c.tail(o.rollingPageX))<30&&Math.abs(o.initialPageY-c.tail(o.rollingPageY))<30){const e=this.newGestureEvent(p.Contextmenu,o.initialTarget);e.pageX=c.tail(o.rollingPageX),e.pageY=c.tail(o.rollingPageY),this.dispatchEvent(e)}else if(1===s){const t=c.tail(o.rollingPageX),s=c.tail(o.rollingPageY),r=c.tail(o.rollingTimestamps)-o.rollingTimestamps[0],n=t-o.rollingPageX[0],a=s-o.rollingPageY[0],l=[...this.targets].filter(e=>o.initialTarget instanceof Node&&e.contains(o.initialTarget));this.inertia(e,l,i,Math.abs(n)/r,n>0?1:-1,t,Math.abs(a)/r,a>0?1:-1,s)}this.dispatchEvent(this.newGestureEvent(p.End,o.initialTarget)),delete this.activeTouches[n.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===p.Tap){const t=(new Date).getTime();let i=0;i=t-this._lastSetTapCountTime>g.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=t,e.tapCount=i}else e.type!==p.Change&&e.type!==p.Contextmenu||(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const t of this.ignoreTargets)if(t.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let s=0,r=e.initialTarget;for(;r&&r!==i;)s++,r=r.parentElement;t.push([s,i])}t.sort((e,t)=>e[0]-t[0]);for(const[i,s]of t)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,s,r,n,o,a,h){this.handle=l.scheduleAtNextAnimationFrame(e,()=>{const l=Date.now(),c=l-i;let d=0,u=0,_=!0;s+=g.SCROLL_FRICTION*c,o+=g.SCROLL_FRICTION*c,s>0&&(_=!1,d=r*s*c),o>0&&(_=!1,u=a*o*c);const f=this.newGestureEvent(p.Change);f.translationX=d,f.translationY=u,t.forEach(e=>e.dispatchEvent(f)),_||this.inertia(e,t,l,s,r,n+d,o,a,h+u)})}onTouchMove(e){const t=Date.now();for(let i=0,s=e.changedTouches.length;i3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}}t.Gesture=g,o([d.memoize],g,"isTouchDevice",null)},8636(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EventUtils=t.Emitter=void 0;const s=i(4812);var r;t.Emitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(e,t,i)=>{if(this._disposed)return(0,s.toDisposable)(()=>{});const r={fn:e,thisArgs:t};this._listeners.push(r);const n=(0,s.toDisposable)(()=>{const e=this._listeners.indexOf(r);-1!==e&&this._listeners.splice(e,1)});return i&&(Array.isArray(i)?i.push(n):i.add(n)),n}),this._event}fire(e){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{const{fn:t,thisArgs:i}=this._listeners[0];return void t.call(i,e)}default:{const t=this._listeners.slice();for(const{fn:i,thisArgs:s}of t)i.call(s,e)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},function(e){e.forward=function(e,t){return e(e=>t.fire(e))},e.map=function(e,t){return(i,s,r)=>e(e=>i.call(s,t(e)),void 0,r)},e.any=function(...e){return(t,i,r)=>{const n=new s.DisposableStore;for(const s of e)n.add(s(e=>t.call(i,e)));return r&&(Array.isArray(r)?r.push(n):r.add(n)),n}},e.runAndSubscribe=function(e,t){return t(void 0),e(e=>t(e))}}(r||(t.EventUtils=r={}))},8693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.startsWith("rgb:")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.startsWith("#")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`};const i=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,s=/^[\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}},8801(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;othis._domNodePointerDown(e)))}_createArrow(e){const t=this._register(new c.ScrollbarArrow(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=(0,l.createFastDomNode)(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof s&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(a.addDisposableListener(this.slider.domNode,a.EventType.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{const s=a.getDomNodePagePosition(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}const s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{const r=this._sliderOrthogonalPointerPosition(e),n=Math.abs(r-i);if(_.isWindows&&n>140)return void this._setDesiredScrollPositionNow(s.getScrollPosition());const o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}t.AbstractScrollbar=f},8811(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const n=i(6501);let o=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(s,i)),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o,t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8841(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createSingleCallFunction=function(e,t){const i=this;let s,r=!1;return function(){if(r)return s;if(r=!0,t)try{s=e.apply(i,arguments)}finally{t()}else s=e.apply(i,arguments);return s}}},8906(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=i(4812),o=i(6501),a=i(7098),l=i(8636),h=i(7093);let c=class extends n.Disposable{get currentLink(){return this._currentLink}constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new l.Emitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new l.Emitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register((0,n.toDisposable)(()=>{(0,n.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register((0,h.addDisposableListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register((0,h.addDisposableListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register((0,h.addDisposableListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register((0,h.addDisposableListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[s,r]of this._linkProviderService.linkProviders.entries())if(t){const t=this._activeProviderReplies?.get(s);t&&(i=this._checkLinkProviderResult(s,e,i))}else r.provideLinks(e.y,t=>{if(this._isMouseOut)return;const r=t?.map(e=>({link:e}));this._activeProviderReplies?.set(s,r),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;se?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;const s=this._activeProviderReplies.get(e);let r=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let e=0;ethis._linkAtPosition(e.link,t));if(s){i=!0,this._handleNewLink(s);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);var i,s;t&&this._mouseDownLink&&(i=this._mouseDownLink.link,s=this._currentLink.link,i.text===s.text&&i.range.start.x===s.range.start.x&&i.range.start.y===s.range.start.y&&i.range.end.x===s.range.end.x&&i.range.end.y===s.range.end.y)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,n.dispose)(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};t.Linkifier=c,t.Linkifier=c=s([r(1,a.IMouseService),r(2,a.IRenderService),r(3,o.IBufferService),r(4,a.ILinkProviderService)],c)},8938(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=t.DEFAULT_COLOR<<9|256,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},8960(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.Constants=void 0,t.toUint8=function(e){return e<0?0:e>i.MAX_UINT_8?i.MAX_UINT_8:0|e},t.toUint32=function(e){return e<0?0:e>i.MAX_UINT_32?i.MAX_UINT_32:0|e},function(e){e[e.MAX_SAFE_SMALL_INTEGER=1073741824]="MAX_SAFE_SMALL_INTEGER",e[e.MIN_SAFE_SMALL_INTEGER=-1073741824]="MIN_SAFE_SMALL_INTEGER",e[e.MAX_UINT_8=255]="MAX_UINT_8",e[e.MAX_UINT_16=65535]="MAX_UINT_16",e[e.MAX_UINT_32=4294967295]="MAX_UINT_32",e[e.UNICODE_SUPPLEMENTARY_PLANE_BEGIN=65536]="UNICODE_SUPPLEMENTARY_PLANE_BEGIN"}(i||(t.Constants=i={}))},8974(e,t,i){var s,r=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,r)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(s=function(e){return s=Object.getOwnPropertyNames||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[t.length]=i);return t},s(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=s(e),o=0;othis._arrowPointerDown(e))),this._register(c.addStandardDisposableListener(this.domNode,c.EventType.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new c.WindowIntervalTimer),this._pointerdownScheduleRepeatTimer=this._register(new h.TimeoutTimer)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,c.getWindow(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}}t.ScrollbarArrow=d},9078(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=void 0;const n=i(7174),o=i(9302),a=i(4103),l=i(4812),h=i(6501),c=i(8636),d=a.css.toColor("#ffffff"),u=a.css.toColor("#000000"),_=a.css.toColor("#ffffff"),f=u,p={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},g=d;let m=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this._register(new c.Emitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:u,cursor:_,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:p,selectionBackgroundOpaque:a.color.blend(u,p),selectionInactiveBackgroundTransparent:p,selectionInactiveBackgroundOpaque:a.color.blend(u,p),scrollbarSliderBackground:a.color.opacity(d,.2),scrollbarSliderHoverBackground:a.color.opacity(d,.4),scrollbarSliderActiveBackground:a.color.opacity(d,.5),overviewRulerBorder:d,ansi:o.DEFAULT_ANSI_COLORS.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)))}_setTheme(e={}){const t=this._colors;if(t.foreground=v(e.foreground,d),t.background=v(e.background,u),t.cursor=a.color.blend(t.background,v(e.cursor,_)),t.cursorAccent=a.color.blend(t.background,v(e.cursorAccent,f)),t.selectionBackgroundTransparent=v(e.selectionBackground,p),t.selectionBackgroundOpaque=a.color.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=v(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=a.color.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?v(e.selectionForeground,a.NULL_COLOR):void 0,t.selectionForeground===a.NULL_COLOR&&(t.selectionForeground=void 0),a.color.isOpaque(t.selectionBackgroundTransparent)){const e=.3;t.selectionBackgroundTransparent=a.color.opacity(t.selectionBackgroundTransparent,e)}if(a.color.isOpaque(t.selectionInactiveBackgroundTransparent)){const e=.3;t.selectionInactiveBackgroundTransparent=a.color.opacity(t.selectionInactiveBackgroundTransparent,e)}if(t.scrollbarSliderBackground=v(e.scrollbarSliderBackground,a.color.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=v(e.scrollbarSliderHoverBackground,a.color.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=v(e.scrollbarSliderActiveBackground,a.color.opacity(t.foreground,.5)),t.overviewRulerBorder=v(e.overviewRulerBorder,g),t.ansi=o.DEFAULT_ANSI_COLORS.slice(),t.ansi[0]=v(e.black,o.DEFAULT_ANSI_COLORS[0]),t.ansi[1]=v(e.red,o.DEFAULT_ANSI_COLORS[1]),t.ansi[2]=v(e.green,o.DEFAULT_ANSI_COLORS[2]),t.ansi[3]=v(e.yellow,o.DEFAULT_ANSI_COLORS[3]),t.ansi[4]=v(e.blue,o.DEFAULT_ANSI_COLORS[4]),t.ansi[5]=v(e.magenta,o.DEFAULT_ANSI_COLORS[5]),t.ansi[6]=v(e.cyan,o.DEFAULT_ANSI_COLORS[6]),t.ansi[7]=v(e.white,o.DEFAULT_ANSI_COLORS[7]),t.ansi[8]=v(e.brightBlack,o.DEFAULT_ANSI_COLORS[8]),t.ansi[9]=v(e.brightRed,o.DEFAULT_ANSI_COLORS[9]),t.ansi[10]=v(e.brightGreen,o.DEFAULT_ANSI_COLORS[10]),t.ansi[11]=v(e.brightYellow,o.DEFAULT_ANSI_COLORS[11]),t.ansi[12]=v(e.brightBlue,o.DEFAULT_ANSI_COLORS[12]),t.ansi[13]=v(e.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),t.ansi[14]=v(e.brightCyan,o.DEFAULT_ANSI_COLORS[14]),t.ansi[15]=v(e.brightWhite,o.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;se.call(t,i,i,this))}[Symbol.iterator](){return this.values()}}t.SetWithKey=s},9176(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257},9249(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Win32InputMode=void 0,t.Win32InputMode=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226},this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40},this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]),this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(e){const t=this._codeToVk[e.code];return void 0!==t?t:e.keyCode||0}_getScanCode(e){return this._codeToScancode[e.code]||0}_getUnicodeChar(e){if(e.ctrlKey&&!e.altKey&&!e.metaKey){if("Enter"===e.key)return 10;if("Backspace"===e.key)return 127}const t=this._keyToControlChar[e.key];if(void 0!==t)return t;if(1===e.key.length){const t=e.key.codePointAt(0)||0;if(e.ctrlKey&&!e.altKey&&!e.metaKey){if(t>=65&&t<=90)return t-64;if(t>=97&&t<=122)return t-96}return t}return 0}_getControlKeyState(e){let t=0;return e.shiftKey&&(t|=16),e.ctrlKey&&("ControlRight"===e.code?t|=4:t|=8),e.altKey&&("AltRight"===e.code?t|=1:t|=2),this._enhancedKeyCodes.has(e.code)&&(t|=256),t}evaluateKeyboardEvent(e,t){return{type:0,cancel:!0,key:`[${this._getVirtualKeyCode(e)};${this._getScanCode(e)};${this._getUnicodeChar(e)};${t?1:0};${this._getControlKeyState(e)};1_`}}}},9302(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_ANSI_COLORS=void 0;const s=i(4103);t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[s.css.toColor("#2e3436"),s.css.toColor("#cc0000"),s.css.toColor("#4e9a06"),s.css.toColor("#c4a000"),s.css.toColor("#3465a4"),s.css.toColor("#75507b"),s.css.toColor("#06989a"),s.css.toColor("#d3d7cf"),s.css.toColor("#555753"),s.css.toColor("#ef2929"),s.css.toColor("#8ae234"),s.css.toColor("#fce94f"),s.css.toColor("#729fcf"),s.css.toColor("#ad7fa8"),s.css.toColor("#34e2e2"),s.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const r=t[i/36%6|0],n=t[i/6%6|0],o=t[i%6];e.push({css:s.channels.toCss(r,n,o),rgba:s.channels.toRgba(r,n,o)})}for(let t=0;t<24;t++){const i=8+10*t;e.push({css:s.channels.toCss(i,i,i),rgba:s.channels.toRgba(i,i,i)})}return e})())},9384(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},9574(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const s=i(8636),r=i(7093),n=i(4812);class o extends n.Disposable{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new a(this._window)),this._onDprChange=this._register(new s.Emitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new s.Emitter),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(s.EventUtils.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register((0,r.addDisposableListener)(this._textarea,"focus",()=>this._isFocused=!0)),this._register((0,r.addDisposableListener)(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=o;class a extends n.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new n.MutableDisposable),this._onDprChange=this._register(new s.Emitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register((0,n.toDisposable)(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,r.addDisposableListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}}},9640(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(4812),o=i(4097),a=i(6501),l=i(8636);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let h=class extends n.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new l.Emitter),this.onResize=this._onResize.event,this._onScroll=this._register(new l.Emitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this._register(new o.BufferSet(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}resize(e,t){const i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){const i=this.buffer;if(e<0){if(0===i.ydisp)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};t.BufferService=h,t.BufferService=h=s([r(0,a.IOptionsService)],h)},9675(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.FastDomNode=void 0,t.createFastDomNode=function(e){return new i(e)};class i{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){const t=s(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=s(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=s(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=s(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=s(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=s(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=s(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){const t=s(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){const t=s(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){const t=s(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){const t=s(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){const t=s(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){const t=s(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=s(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function s(e){return"number"==typeof e?`${e}px`:e}t.FastDomNode=i},9686(e,t){function i(e,t,i,n){const l=e-s(e,i),h=t-s(t,i),c=Math.abs(l-h)-function(e,t,i){let n=0;const o=e-s(e,i),a=t-s(t,i);for(let s=0;s=0&&et?"A":"B"}function n(e,t,i,s,r,n){let o=e,a=t,l="";for(;(o!==i||a!==s)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function o(e,t){return""+(t?"O":"[")+e}function a(e,t){e=Math.floor(e);let i="";for(let s=0;s0?l-s(l,h):t;const u=l,_=function(e,t,r,n,o,a){let l;return l=i(r,n,o,a).length>0?n-s(n,o):t,e=r&&le?"D":"C",a(Math.abs(h-e),o(d,l));d=c>t?"D":"C";const u=Math.abs(c-t);return a(function(e,t){return t.cols-e}(c>t?e:h,r)+(u-1)*r.cols+1+((c>t?h:e)-1),o(d,l))}},9725(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.StopWatch=void 0;const i=globalThis.performance&&"function"==typeof globalThis.performance.now;class s{static create(e){return new s(e)}constructor(e){this._now=i&&!1===e?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-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}}t.StopWatch=s},9784(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=i(7093),o=i(7098),a=i(5251);let l=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,a.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,a.getCoordsRelativeToElement)((0,n.getWindow)(t),e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=l,t.MouseService=l=s([r(0,o.IRenderService),r(1,o.ICharSizeService)],l)},9807(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BugIndicatingError=t.ErrorNoTelemetry=t.ExpectedError=t.NotSupportedError=t.NotImplementedError=t.ReadonlyError=t.CancellationError=t.errorHandler=t.ErrorHandler=void 0,t.setUnexpectedErrorHandler=function(e){t.errorHandler.setUnexpectedErrorHandler(e)},t.isSigPipeError=function(e){if(!e||"object"!=typeof e)return!1;const t=e;return"EPIPE"===t.code&&"WRITE"===t.syscall?.toUpperCase()},t.onUnexpectedError=function(e){r(e)||t.errorHandler.onUnexpectedError(e)},t.onUnexpectedExternalError=function(e){r(e)||t.errorHandler.onUnexpectedExternalError(e)},t.transformErrorForSerialization=function(e){if(e instanceof Error){const{name:t,message:i}=e;return{$isError:!0,name:t,message:i,stack:e.stacktrace||e.stack,noTelemetry:c.isErrorNoTelemetry(e)}}return e},t.transformErrorFromSerialization=function(e){let t;return e.noTelemetry?t=new c:(t=new Error,t.name=e.name),t.message=e.message,t.stack=e.stack,t},t.isCancellationError=r,t.canceled=function(){const e=new Error(s);return e.name=e.message,e},t.illegalArgument=function(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")},t.illegalState=function(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")},t.getErrorMessage=function(e){return e?e.message?e.message:e.stack?e.stack.split("\n")[0]:String(e):"Error"};class i{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{if(e.stack){if(c.isErrorNoTelemetry(e))throw new c(e.message+"\n\n"+e.stack);throw new Error(e.message+"\n\n"+e.stack)}throw 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)}}t.ErrorHandler=i,t.errorHandler=new i;const s="Canceled";function r(e){return e instanceof n||e instanceof Error&&e.name===s&&e.message===s}class n extends Error{constructor(){super(s),this.name=this.message}}t.CancellationError=n;class o extends TypeError{constructor(e){super(e?`${e} is read-only and cannot be changed`:"Cannot change read-only property")}}t.ReadonlyError=o;class a extends Error{constructor(e){super("NotImplemented"),e&&(this.message=e)}}t.NotImplementedError=a;class l extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}t.NotSupportedError=l;class h extends Error{constructor(){super(...arguments),this.isExpected=!0}}t.ExpectedError=h;class c extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof c)return e;const t=new c;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}}t.ErrorNoTelemetry=c;class d extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,d.prototype)}}t.BugIndicatingError=d},9820(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const s=i(4812);class r extends s.Disposable{constructor(){super(),this.linkProviders=[],this._register((0,s.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{const t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=r},9823(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(726),r=i(7262),n=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=n,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}registerHandler(e,t){this._handlers[e]??=[];const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=n,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,"PUT",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",e);this._active=n,this._ident=0}};const o=new r.Params;o.addParam(0);class a{constructor(e){this._handler=e,this._data="",this._params=o,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():o,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>a._payloadLimit&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=o,this._data="",this._hitLimit=!1,e));return this._params=o,this._data="",this._hitLimit=!1,t}}t.DcsHandler=a,a._payloadLimit=1e7},9881(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.SmoothScrollingOperation=t.SmoothScrollingUpdate=t.Scrollable=t.ScrollState=t.ScrollbarVisibility=void 0;const s=i(802),r=i(7150);var n;!function(e){e[e.Auto=1]="Auto",e[e.Hidden=2]="Hidden",e[e.Visible=3]="Visible"}(n||(t.ScrollbarVisibility=n={}));class o{constructor(e,t,i,s,r,n,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,s|=0,r|=0,n|=0,o|=0),this.rawScrollLeft=s,this.rawScrollTop=o,t<0&&(t=0),s+t>i&&(s=i-t),s<0&&(s=0),r<0&&(r=0),o+r>n&&(o=n-r),o<0&&(o=0),this.width=t,this.scrollWidth=i,this.scrollLeft=s,this.height=r,this.scrollHeight=n,this.scrollTop=o}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 o(this._forceIntegerValues,void 0!==e.width?e.width:this.width,void 0!==e.scrollWidth?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,void 0!==e.height?e.height:this.height,void 0!==e.scrollHeight?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new o(this._forceIntegerValues,this.width,this.scrollWidth,void 0!==e.scrollLeft?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,void 0!==e.scrollTop?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,r=this.scrollLeft!==e.scrollLeft,n=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,a=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:i,scrollWidthChanged:s,scrollLeftChanged:r,heightChanged:n,scrollHeightChanged:o,scrollTopChanged:a}}}t.ScrollState=o;class a extends r.Disposable{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new s.Emitter),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new o(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){const i=this._state.withScrollDimensions(e,t);this._setState(i,Boolean(this._smoothScrolling)),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:void 0===e.scrollLeft?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:void 0===e.scrollTop?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;s=t?new c(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{const t=this._state.withScrollPosition(e);this._smoothScrolling=c.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return Boolean(this._smoothScrolling)}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);return this._setState(t,!0),this._smoothScrolling?e.isDone?(this._smoothScrolling.dispose(),void(this._smoothScrolling=null)):void(this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})):void 0}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}t.Scrollable=a;class l{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function h(e,t){const i=t-e;return function(t){return e+i*(1-(s=1-t,Math.pow(s,3)));var s}}t.SmoothScrollingUpdate=l;class c{constructor(e,t,i,s){this.from=e,this.to=t,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let o,a;return e=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(957),o=i(7098),a=i(4812),l=i(6501),h={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0};let u=class extends a.Disposable{get _width(){return this._optionsService.options.overviewRuler?.width||0}constructor(e,t,i,s,r,o,l,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._themeService=l,this._coreBrowserService=h,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register((0,a.toDisposable)(()=>this._canvas?.remove()));const c=this._canvas.getContext("2d");if(!c)throw new Error("Ctx cannot be null");this._ctx=c,this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);c.full=this._canvas.width,c.left=e,c.center=t,c.right=e,this._refreshDrawHeightConstants(),d.full=1,d.left=1,d.center=1+c.left,d.right=1+c.left+c.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);h.left=t,h.center=t,h.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.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(const e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-h[e.position||"full"]/2),c[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=u,t.OverviewRulerRenderer=u=s([r(2,l.IBufferService),r(3,l.IDecorationService),r(4,o.IRenderService),r(5,l.IOptionsService),r(6,o.IThemeService),r(7,o.ICoreBrowserService)],u)}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=i(7721),r=i(1718),n=i(4812),o=i(3027),a=i(5101),l=i(6097),h=i(4335),c=["cols","rows"];let d=0;class u extends n.Disposable{constructor(e){super(),this._core=this._register(new r.CoreBrowserTerminal(e)),this._addonManager=this._register(new o.AddonManager),this._publicOptions={...this._core.options};const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const e in this._core.options){const s={get:t.bind(this,e),set:i.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(c.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get onDimensionsChange(){return this._core.onDimensionsChange}get element(){return this._core.element}get parser(){return this._parser??=new l.ParserApi(this._core)}get unicode(){return this._checkProposedApi(),new h.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer??=this._register(new a.BufferNamespaceApi(this._core))}get markers(){return this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,showCursor:!this._core.coreService.isCursorHidden,synchronizedOutputMode:e.synchronizedOutput,win32InputMode:e.win32InputMode,wraparoundMode:e.wraparound}}get dimensions(){return this._core.dimensions}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write("\r\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return t.promptLabel.get()},set promptLabel(e){t.promptLabel.set(e)},get tooMuchOutput(){return t.tooMuchOutput.get()},set tooMuchOutput(e){t.tooMuchOutput.set(e)}}}_verifyIntegers(...e){for(d of e)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(d of e)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}e.Terminal=u})(),s})()); +diff --git a/lib/xterm.mjs b/lib/xterm.mjs +index f8069f0253fee421a8ed4e77a1dd69054b27916f..89f5d89819bc9d5a9405c137ce6c162282407350 100644 +--- a/lib/xterm.mjs ++++ b/lib/xterm.mjs +@@ -43,7 +43,7 @@ ${d.join(` + `)),s.length=0)},3e3),gr=new FinalizationRegistry(t=>{typeof t=="string"&&s.push(t)})}var K=class{constructor(t){this._size=0;this._options=t,this._leakageMon=Po>0||this._options?.leakWarningThreshold?new ss(t?.onListenerError??Pt,this._options?.leakWarningThreshold??Po):void 0,this._perfMon=this._options?._profName?new ns(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Mo){let t=this._listeners;queueMicrotask(()=>{vl(t,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(t,e,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new as(`${l}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||Pt)(d),X.None}if(this._disposed)return X.None;e&&(t=t.bind(e));let r=new Ht(t),n,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=wi.create(),n=this._leakageMon.check(r.stack,this._size+1)),Mo&&(r.stack=o??wi.create()),this._listeners?this._listeners instanceof Ht?(this._deliveryQueue??=new ls,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=xe(()=>{gr?.unregister(a),n?.(),this._removeListener(r)});if(i instanceof ke?i.add(a):Array.isArray(i)&&i.push(a),gr){let l=new Error().stack.split(` + `).slice(2,3).join(` + `).trim(),u=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(l);gr.register(a,u?.[2]??l,a)}return a},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-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--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*bl<=e.length){let n=0;for(let o=0;o0}};var ls=class{constructor(){this.i=-1;this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}};var yr=class yr{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new K;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new K;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,e){if(this.getZoomLevel(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),t)}setFullscreen(t,e){if(this.isFullscreen(e)===t)return;let i=this.getWindowId(e);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};yr.INSTANCE=new yr;var Di=yr;function Sl(s,t,e){typeof t=="string"&&(t=s.matchMedia(t)),t.addEventListener("change",e)}var Wu=Di.INSTANCE.onDidChangeZoomLevel;function Oo(s){return Di.INSTANCE.getZoomFactor(s)}var Ku=Di.INSTANCE.onDidChangeFullscreen,Ut=typeof navigator=="object"?navigator.userAgent:"",Ri=Ut.indexOf("Firefox")>=0,Wt=Ut.indexOf("AppleWebKit")>=0,Li=Ut.indexOf("Chrome")>=0,Tr=!Li&&Ut.indexOf("Safari")>=0;var Gu=Ut.indexOf("Electron/")>=0,zu=Ut.indexOf("Android")>=0,Er=!1;if(typeof pe.matchMedia=="function"){let s=pe.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=pe.matchMedia("(display-mode: fullscreen)");Er=s.matches,Sl(pe,s,({matches:e})=>{Er&&t.matches||(Er=e)})}function Bo(){return Er}var Kt="en",Dr=!1,Rr=!1,Ai=!1,El=!1,Fo=!1,Ho=!1,yl=!1,Tl=!1,Il=!1,xl=!1,xr,wr=Kt,No=Kt,wl,ze,$e=globalThis,we;typeof $e.vscode<"u"&&typeof $e.vscode.process<"u"?we=$e.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(we=process);var Uo=typeof we?.versions?.electron=="string",Dl=Uo&&we?.type==="renderer";if(typeof we=="object"){Dr=we.platform==="win32",Rr=we.platform==="darwin",Ai=we.platform==="linux",El=Ai&&!!we.env.SNAP&&!!we.env.SNAP_REVISION,yl=Uo,Il=!!we.env.CI||!!we.env.BUILD_ARTIFACTSTAGINGDIRECTORY,xr=Kt,wr=Kt;let s=we.env.VSCODE_NLS_CONFIG;if(s)try{let t=JSON.parse(s);xr=t.userLocale,No=t.osLocale,wr=t.resolvedLanguage||Kt,wl=t.languagePack?.translationsConfigFile}catch{}Fo=!0}else typeof navigator=="object"&&!Dl?(ze=navigator.userAgent,Dr=ze.indexOf("Windows")>=0,Rr=ze.indexOf("Macintosh")>=0,Tl=(ze.indexOf("Macintosh")>=0||ze.indexOf("iPad")>=0||ze.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ai=ze.indexOf("Linux")>=0,xl=ze?.indexOf("Mobi")>=0,Ho=!0,wr=globalThis._VSCODE_NLS_LANGUAGE||Kt,xr=navigator.language.toLowerCase(),No=xr):console.error("Unable to resolve platform.");var cs=0;Rr?cs=1:Dr?cs=3:Ai&&(cs=2);var Lr=Dr,ye=Rr,us=Ai;var Ar=Fo;var Rl=Ho&&typeof $e.importScripts=="function",$u=Rl?$e.origin:void 0;var Fe=ze,ot=wr,Ll;(i=>{function s(){return ot}i.value=s;function t(){return ot.length===2?ot==="en":ot.length>=3?ot[0]==="e"&&ot[1]==="n"&&ot[2]==="-":!1}i.isDefaultVariant=t;function e(){return ot==="en"}i.isDefault=e})(Ll||={});var Al=typeof $e.postMessage=="function"&&!$e.importScripts,Wo=(()=>{if(Al){let s=[];$e.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let i=0,r=s.length;i{let i=++t;s.push({id:i,callback:e}),$e.postMessage({vscodeScheduleAsyncWork:i},"*")}}return s=>setTimeout(s)})();var kl=!!(Fe&&Fe.indexOf("Chrome")>=0),Vu=!!(Fe&&Fe.indexOf("Firefox")>=0),qu=!!(!kl&&Fe&&Fe.indexOf("Safari")>=0),Yu=!!(Fe&&Fe.indexOf("Edg/")>=0),ju=!!(Fe&&Fe.indexOf("Android")>=0);var at=typeof navigator=="object"?navigator:{},Cl={clipboard:{writeText:Ar||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(at&&at.clipboard&&at.clipboard.writeText),readText:Ar||!!(at&&at.clipboard&&at.clipboard.readText)},keyboard:Ar||Bo()?0:at.keyboard||Tr?1:2,touch:"ontouchstart"in pe||at.maxTouchPoints>0,pointerEvents:pe.PointerEvent&&("ontouchstart"in pe||navigator.maxTouchPoints>0)};var ki=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},ds=new ki,Ko=new ki,Go=new ki,zo=new Array(230);var hs;(o=>{function s(a){return ds.keyCodeToStr(a)}o.toString=s;function t(a){return ds.strToKeyCode(a)}o.fromString=t;function e(a){return Ko.keyCodeToStr(a)}o.toUserSettingsUS=e;function i(a){return Go.keyCodeToStr(a)}o.toUserSettingsGeneral=i;function r(a){return Ko.strToKeyCode(a)||Go.strToKeyCode(a)}o.fromUserSettings=r;function n(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 ds.keyCodeToStr(a)}o.toElectronAccelerator=n})(hs||={});var kr=class s{constructor(t,e,i,r,n){this.ctrlKey=t;this.shiftKey=e;this.altKey=i;this.metaKey=r;this.keyCode=n}equals(t){return t instanceof s&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${e}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new fs([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}};var fs=class{constructor(t){if(t.length===0)throw Eo("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e{function s(r){return r===i.None||r===i.Cancelled||r instanceof ps?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}i.isCancellationToken=s,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:st.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qo})})(Hl||={});var ps=class{constructor(){this._isCancelled=!1;this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?qo:(this._emitter||(this._emitter=new K),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var Ul=Symbol("MicrotaskDelay");var qe=class{constructor(t,e){this._isDisposed=!1;this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new Mt("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new Mt("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},Pr=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(t,e,i=globalThis){if(this.isDisposed)throw new Mt("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=xe(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};var Wl,Mr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Mr=(s,t)=>{Wo(()=>{if(e)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let e=!1;return{dispose(){e||(e=!0)}}}:Mr=(s,t,e)=>{let i=s.requestIdleCallback(t,typeof e=="number"?{timeout:e}:void 0),r=!1;return{dispose(){r||(r=!0,s.cancelIdleCallback(i))}}},Wl=s=>Mr(globalThis,s)})();var Kl;(e=>{async function s(i){let r,n=await Promise.all(i.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=s;function t(i){return new Promise(async(r,n)=>{try{await i(r,n)}catch(o){n(o)}})}e.withAsyncBody=t})(Kl||={});var Se=class Se{static fromArray(t){return new Se(e=>{e.emitMany(t)})}static fromPromise(t){return new Se(async e=>{e.emitMany(await t)})}static fromPromises(t){return new Se(async e=>{await Promise.all(t.map(async i=>e.emitOne(await i)))})}static merge(t){return new Se(async e=>{await Promise.all(t.map(async i=>{for await(let r of i)e.emitOne(r)}))})}constructor(t,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new K,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,e){return new Se(async i=>{for await(let r of t)i.emitOne(e(r))})}map(t){return Se.map(this,t)}static filter(t,e){return new Se(async i=>{for await(let r of t)e(r)&&i.emitOne(r)})}filter(t){return Se.filter(this,t)}static coalesce(t){return Se.filter(t,e=>!!e)}coalesce(){return Se.coalesce(this)}static async toPromise(t){let e=[];for await(let i of t)e.push(i);return e}toPromise(){return Se.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Se.EMPTY=Se.fromArray([]);var Yo=Se;function jo(s){return 55296<=s&&s<=56319}function ms(s){return 56320<=s&&s<=57343}function Xo(s,t){return(s-55296<<10)+(t-56320)+65536}function Jo(s){return bs(s,0)}function bs(s,t){switch(typeof s){case"object":return s===null?Ye(349,t):Array.isArray(s)?$l(s,t):Vl(s,t);case"string":return ea(s,t);case"boolean":return zl(s,t);case"number":return Ye(s,t);case"undefined":return Ye(937,t);default:return Ye(617,t)}}function Ye(s,t){return(t<<5)-t+s|0}function zl(s,t){return Ye(s?433:863,t)}function ea(s,t){t=Ye(149417,t);for(let e=0,i=s.length;ebs(i,e),t)}function Vl(s,t){return t=Ye(181387,t),Object.keys(s).sort().reduce((e,i)=>(e=ea(i,e),bs(s[i],e)),t)}function _s(s,t,e=32){let i=e-t,r=~((1<>>i)>>>0}function Zo(s,t=0,e=s.byteLength,i=0){for(let r=0;re.toString(16).padStart(2,"0")).join(""):ql((s>>>0).toString(16),t/4)}var Or=class Or{constructor(){this._h0=1732584193;this._h1=4023233417;this._h2=2562383102;this._h3=271733878;this._h4=3285377520;this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let e=t.length;if(e===0)return;let i=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let l=o;if(jo(o))if(a+1>>6,t[e++]=128|(i&63)>>>0):i<65536?(t[e++]=224|(i&61440)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0):(t[e++]=240|(i&1835008)>>>18,t[e++]=128|(i&258048)>>>12,t[e++]=128|(i&4032)>>>6,t[e++]=128|(i&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),e}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Mi(this._h0)+Mi(this._h1)+Mi(this._h2)+Mi(this._h3)+Mi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Zo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Zo(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Or._bigBlock32,e=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,e.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,_s(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let i=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,l,u,d;for(let c=0;c<80;c++)c<20?(l=r&n|~r&o,u=1518500249):c<40?(l=r^n^o,u=1859775393):c<60?(l=r&n|r&o|n&o,u=2400959708):(l=r^n^o,u=3395469782),d=_s(i,5)+l+a+u+t.getUint32(c*4,!1)&4294967295,a=o,o=n,n=_s(r,30),r=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};Or._bigBlock32=new DataView(new ArrayBuffer(320));var Qo=Or;var{registerWindow:rh,getWindow:me,getDocument:nh,getWindows:sh,getWindowsCount:oh,getWindowId:ta,getWindowById:ah,hasWindow:lh,onDidRegisterWindow:ra,onWillUnregisterWindow:ch,onDidUnregisterWindow:uh}=(function(){let s=new Map;pe;let t={window:pe,disposables:new ke};s.set(pe.vscodeWindowId,t);let e=new K,i=new K,r=new K;function n(o,a){return(typeof o=="number"?s.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(s.has(o.vscodeWindowId))return X.None;let a=new ke,l={window:o,disposables:a.add(new ke)};return s.set(o.vscodeWindowId,l),a.add(xe(()=>{s.delete(o.vscodeWindowId),i.fire(o)})),a.add(x(o,$.BEFORE_UNLOAD,()=>{r.fire(o)})),e.fire(l),a},getWindows(){return s.values()},getWindowsCount(){return s.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return s.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:pe},getDocument(o){return me(o).document}}})();var vs=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function x(s,t,e,i){return new vs(s,t,e,i)}function Yl(s,t){return function(e){return t(new Ve(s,e))}}function jl(s){return function(t){return s(new bt(t))}}var gs=function(t,e,i,r){let n=i;return e==="click"||e==="mousedown"||e==="contextmenu"?n=Yl(me(t),i):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=jl(i)),x(t,e,n,r)};var Xl,gt;var Br=class extends Pr{constructor(t){super(),this.defaultTarget=t&&me(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},Pi=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){Pt(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let s=new Map,t=new Map,e=new Map,i=new Map,r=n=>{e.set(n,!1);let o=s.get(n)??[];for(t.set(n,o),s.set(n,[]),i.set(n,!0);o.length>0;)o.sort(Pi.sort),o.shift().execute();i.set(n,!1)};gt=(n,o,a=0)=>{let l=ta(n),u=new Pi(o,a),d=s.get(l);return d||(d=[],s.set(l,d)),d.push(u),e.get(l)||(e.set(l,!0),n.requestAnimationFrame(()=>r(l))),u},Xl=(n,o,a)=>{let l=ta(n);if(i.get(l)){let u=new Pi(o,a),d=t.get(l);return d||(d=[],t.set(l,d)),d.push(u),u}else return gt(n,o,a)}})();var vt=class vt{constructor(t,e){this.width=t;this.height=e}with(t=this.width,e=this.height){return t!==this.width||e!==this.height?new vt(t,e):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof vt?t:new vt(t.width,t.height)}static equals(t,e){return t===e?!0:!t||!e?!1:t.width===e.width&&t.height===e.height}};vt.None=new vt(0,0);var ia=vt;function na(s){let t=s.getBoundingClientRect(),e=me(s);return{left:t.left+e.scrollX,top:t.top+e.scrollY,width:t.width,height:t.height}}var dh=new class{constructor(){this.mutationObservers=new Map}observe(s,t,e){let i=this.mutationObservers.get(s);i||(i=new Map,this.mutationObservers.set(s,i));let r=Jo(e),n=i.get(r);if(n)n.users+=1;else{let o=new K,a=new MutationObserver(u=>o.fire(u));a.observe(s,e);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(xe(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(s))})),i.set(r,n)}return n.onDidMutate}};var $={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Wt?"webkitAnimationStart":"animationstart",ANIMATION_END:Wt?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Wt?"webkitAnimationIteration":"animationiteration"};var Zl=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function sa(s,t,e,...i){let r=Zl.exec(t);if(!r)throw new Error("Bad use of emmet");let n=r[1]||"div",o;return s!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(s,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...i),o}function Ql(s,t,...e){return sa("http://www.w3.org/1999/xhtml",s,t,...e)}Ql.SVG=function(s,t,...e){return sa("http://www.w3.org/2000/svg",s,t,...e)};var Ss=class{constructor(t){this.domNode=t;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}setMaxWidth(t){let e=Te(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Te(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Te(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Te(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Te(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Te(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Te(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Te(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Te(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Te(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Te(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Te(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Te(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Te(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Te(s){return typeof s=="number"?`${s}px`:s}function St(s){return new Ss(s)}var $t=class{constructor(){this._hooks=new ke;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,t&&i&&i(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,i,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=t;try{t.setPointerCapture(e),this._hooks.add(xe(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{o=me(t)}this._hooks.add(x(o,$.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(x(o,$.POINTER_UP,a=>this.stopMonitoring(!0)))}};function oa(s,t,e){let i=null,r=null;if(typeof e.value=="function"?(i="value",r=e.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(i="get",r=e.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;e[i]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Ce;(n=>(n.Tap="-xterm-gesturetap",n.Change="-xterm-gesturechange",n.Start="-xterm-gesturestart",n.End="-xterm-gesturesend",n.Contextmenu="-xterm-gesturecontextmenu"))(Ce||={});var J=class J extends X{constructor(){super();this.dispatched=!1;this.targets=new Nt;this.ignoreTargets=new Nt;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(st.runAndSubscribe(ra,({window:e,disposables:i})=>{i.add(x(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(x(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(x(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:pe,disposables:this._store}))}static addTarget(e){if(!J.isTouchDevice())return X.None;J.INSTANCE||(J.INSTANCE=rs(new J));let i=J.INSTANCE.targets.push(e);return xe(i)}static ignoreTarget(e){if(!J.isTouchDevice())return X.None;J.INSTANCE||(J.INSTANCE=rs(new J));let i=J.INSTANCE.ignoreTargets.push(e);return xe(i)}static isTouchDevice(){return"ontouchstart"in pe||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,n=e.targetTouches.length;r=J.HOLD_DELAY&&Math.abs(u.initialPageX-Ee(u.rollingPageX))<30&&Math.abs(u.initialPageY-Ee(u.rollingPageY))<30){let c=this.newGestureEvent(Ce.Contextmenu,u.initialTarget);c.pageX=Ee(u.rollingPageX),c.pageY=Ee(u.rollingPageY),this.dispatchEvent(c)}else if(n===1){let c=Ee(u.rollingPageX),h=Ee(u.rollingPageY),m=Ee(u.rollingTimestamps)-u.rollingTimestamps[0],p=c-u.rollingPageX[0],_=h-u.rollingPageY[0],f=[...this.targets].filter(L=>u.initialTarget instanceof Node&&L.contains(u.initialTarget));this.inertia(e,f,r,Math.abs(p)/m,p>0?1:-1,c,Math.abs(_)/m,_>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Ce.End,u.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===Ce.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>J.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===Ce.Change||e.type===Ce.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let n=0,o=e.initialTarget;for(;o&&o!==r;)n++,o=o.parentElement;i.push([n,r])}i.sort((r,n)=>r[0]-n[0]);for(let[r,n]of i)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,n,o,a,l,u,d){this.handle=gt(e,()=>{let c=Date.now(),h=c-r,m=0,p=0,_=!0;n+=J.SCROLL_FRICTION*h,l+=J.SCROLL_FRICTION*h,n>0&&(_=!1,m=o*n*h),l>0&&(_=!1,p=u*l*h);let f=this.newGestureEvent(Ce.Change);f.translationX=m,f.translationY=p,i.forEach(L=>L.dispatchEvent(f)),_||this.inertia(e,i,c,n,o,a+m,l,u,d+p)})}onTouchMove(e){let i=Date.now();for(let r=0,n=e.changedTouches.length;r3&&(a.rollingPageX.shift(),a.rollingPageY.shift(),a.rollingTimestamps.shift()),a.rollingPageX.push(o.pageX),a.rollingPageY.push(o.pageY),a.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};J.SCROLL_FRICTION=-.005,J.HOLD_DELAY=700,J.CLEAR_TAP_COUNT_TIME=400,A([oa],J,"isTouchDevice",1);var Vt=J;var lt=class extends X{onclick(t,e){this._register(x(t,$.CLICK,i=>e(new Ve(me(t),i))))}onmousedown(t,e){this._register(x(t,$.MOUSE_DOWN,i=>e(new Ve(me(t),i))))}onmouseover(t,e){this._register(x(t,$.MOUSE_OVER,i=>e(new Ve(me(t),i))))}onmouseleave(t,e){this._register(x(t,$.MOUSE_LEAVE,i=>e(new Ve(me(t),i))))}onkeydown(t,e){this._register(x(t,$.KEY_DOWN,i=>e(new bt(i))))}onkeyup(t,e){this._register(x(t,$.KEY_UP,i=>e(new bt(i))))}oninput(t,e){this._register(x(t,$.INPUT,e))}onblur(t,e){this._register(x(t,$.BLUR,e))}onfocus(t,e){this._register(x(t,$.FOCUS,e))}onchange(t,e){this._register(x(t,$.CHANGE,e))}ignoreGesture(t){return Vt.ignoreTarget(t)}};var aa=11,Nr=class extends lt{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=aa+"px",this.domNode.style.height=aa+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new $t),this._register(gs(this.bgDomNode,$.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(gs(this.domNode,$.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Br),this._pointerdownScheduleRepeatTimer=this._register(new qe)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,me(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}};var ys=class s{constructor(t,e,i,r,n,o,a){this._forceIntegerValues=t;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,i=i|0,r=r|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,e<0&&(e=0),r+e>i&&(r=i-e),r<0&&(r=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=e,this.scrollWidth=i,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,e){return new s(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new s(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,e){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:e,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},Oi=class extends X{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new K);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ys(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,i){let r=this._state.withScrollDimensions(e,i);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){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 r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;i?n=new Hr(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=Hr.start(this._state,r,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(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,i)))}},Fr=class{constructor(t,e,i){this.scrollLeft=t,this.scrollTop=e,this.isDone=i}};function Es(s,t){let e=t-s;return function(i){return s+e*tc(i)}}function Jl(s,t,e){return function(i){return i2.5*i){let n,o;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(t){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(t?" fade":"")))}};var ic=140,qt=class extends lt{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new Ur(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $t),this._shouldRender=!0,this.domNode=St(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(x(this.domNode.domNode,$.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new Nr(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=St(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(x(this.slider.domNode,$.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,i=e+this._scrollbarState.getSliderPosition(),r=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(t);i<=n&&n<=r?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,i;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,i=t.offsetY;else{let n=na(this.domNode.domNode);e=t.pageX-n.left,i=t.pageY-n.top}let r=this._pointerDownRelativePosition(e,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),i=this._sliderOrthogonalPointerPosition(t),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),a=Math.abs(o-i);if(Lr&&a>ic){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let u=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(u))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var Yt=class s{constructor(t,e,i,r,n,o){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new s(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let e=Math.round(t);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(t){let e=Math.round(t);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let e=Math.round(t);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,e,i,r,n){let o=Math.max(0,i-t),a=Math.max(0,o-2*e),l=r>0&&r>i;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(i*a/r))),d=(a-u)/(r-i),c=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=s._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let e=t-this._arrowSize,i=this._scrollPosition;return e0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),e){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(e.deltaX),a=Math.abs(e.deltaY),l=Math.max(Math.min(r,o),1),u=Math.max(Math.min(n,a),1),d=Math.max(r,o),c=Math.max(n,a);d%l===0&&c%u===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};$r.INSTANCE=new $r;var Is=$r,xs=class extends lt{constructor(e,i,r){super();this._onScroll=this._register(new K);this.onScroll=this._onScroll.event;this._onWillScroll=this._register(new K);this.onWillScroll=this._onWillScroll.event;this._options=nc(i),this._scrollable=r,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let n={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Gr(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Kr(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=St(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=St(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=St(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new qe),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=xi(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ye&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ci(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=xi(this._mouseWheelToDispose),e)){let r=n=>{this._onMouseWheel(new Ci(n))};this._mouseWheelToDispose.push(x(this._listenOnDomNode,$.MOUSE_WHEEL,r,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=Is.INSTANCE;ca&&i.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,a=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&a+o===0?a=o=0:Math.abs(o)>=Math.abs(a)?a=0:o=0),this._options.flipAxes&&([o,a]=[a,o]);let l=!ye&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!a&&(a=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(a=a*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),d={};if(o){let c=la*o,h=u.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(d,h)}if(a){let c=la*a,h=u.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(d,h)}d=this._scrollable.validateScrollPosition(d),(u.scrollLeft!==d.scrollLeft||u.scrollTop!==d.scrollTop)&&(ca&&this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",o=i?" top":"",a=r||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),rc)}};var zr=class extends xs{constructor(t,e,i){super(t,e,i)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function nc(s){let t={lazyRender:typeof s.lazyRender<"u"?s.lazyRender:!1,className:typeof s.className<"u"?s.className:"",useShadows:typeof s.useShadows<"u"?s.useShadows:!0,handleMouseWheel:typeof s.handleMouseWheel<"u"?s.handleMouseWheel:!0,flipAxes:typeof s.flipAxes<"u"?s.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof s.consumeMouseWheelIfScrollbarIsNeeded<"u"?s.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof s.alwaysConsumeMouseWheel<"u"?s.alwaysConsumeMouseWheel:!1,scrollYToX:typeof s.scrollYToX<"u"?s.scrollYToX:!1,mouseWheelScrollSensitivity:typeof s.mouseWheelScrollSensitivity<"u"?s.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof s.fastScrollSensitivity<"u"?s.fastScrollSensitivity:5,scrollPredominantAxis:typeof s.scrollPredominantAxis<"u"?s.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof s.mouseWheelSmoothScroll<"u"?s.mouseWheelSmoothScroll:!0,arrowSize:typeof s.arrowSize<"u"?s.arrowSize:11,listenOnDomNode:typeof s.listenOnDomNode<"u"?s.listenOnDomNode:null,horizontal:typeof s.horizontal<"u"?s.horizontal:1,horizontalScrollbarSize:typeof s.horizontalScrollbarSize<"u"?s.horizontalScrollbarSize:10,horizontalSliderSize:typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:0,horizontalHasArrows:typeof s.horizontalHasArrows<"u"?s.horizontalHasArrows:!1,vertical:typeof s.vertical<"u"?s.vertical:1,verticalScrollbarSize:typeof s.verticalScrollbarSize<"u"?s.verticalScrollbarSize:10,verticalHasArrows:typeof s.verticalHasArrows<"u"?s.verticalHasArrows:!1,verticalSliderSize:typeof s.verticalSliderSize<"u"?s.verticalSliderSize:0,scrollByPage:typeof s.scrollByPage<"u"?s.scrollByPage:!1};return t.horizontalSliderSize=typeof s.horizontalSliderSize<"u"?s.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof s.verticalSliderSize<"u"?s.verticalSliderSize:t.verticalScrollbarSize,ye&&(t.className+=" mac"),t}var v=class{constructor(){this._listeners=[];this._disposed=!1}get event(){return this._event?this._event:(this._event=(t,e,i)=>{if(this._disposed)return O(()=>{});let r={fn:t,thisArgs:e};this._listeners.push(r);let n=O(()=>{let o=this._listeners.indexOf(r);o!==-1&&this._listeners.splice(o,1)});return i&&(Array.isArray(i)?i.push(n):i.add(n)),n},this._event)}fire(t){if(!this._disposed)switch(this._listeners.length){case 0:return;case 1:{let{fn:e,thisArgs:i}=this._listeners[0];e.call(i,t);return}default:{let e=this._listeners.slice();for(let{fn:i,thisArgs:r}of e)i.call(r,t)}}}dispose(){this._disposed||(this._disposed=!0,this._listeners.length=0)}},ce;(r=>{function s(n,o){return n(a=>o.fire(a))}r.forward=s;function t(n,o){return(a,l,u)=>n(d=>a.call(l,o(d)),void 0,u)}r.map=t;function e(...n){return(o,a,l)=>{let u=new mt;for(let d of n)u.add(d(c=>o.call(a,c)));return l&&(Array.isArray(l)?l.push(u):l.add(u)),u}}r.any=e;function i(n,o){return o(void 0),n(a=>o(a))}r.runAndSubscribe=i})(ce||={});var jt=class extends D{constructor(e,i,r,n,o,a,l,u){super();this._bufferService=r;this._optionsService=l;this._renderService=u;this._onRequestScrollLines=this._register(new v);this.onRequestScrollLines=this._onRequestScrollLines.event;this._isSyncing=!1;this._isHandlingScroll=!1;this._suppressOnScrollHandler=!1;let d=this._register(new Oi({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>gt(n.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new zr(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ce.runAndSubscribe(a.onChangeColors,()=>{e.style.backgroundColor=a.colors.background.css,this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(O(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(O(()=>this._styleElement.remove())),this._register(ce.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.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))),this._register(Vt.addTarget(i)),this._register(x(i,Ce.Change,c=>this._handleGestureChange(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}_handleGestureChange(e){e.preventDefault(),e.stopPropagation();let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:i.scrollTop-e.translationY})}};jt=A([b(2,F),b(3,ae),b(4,lr),b(5,Le),b(6,N),b(7,le)],jt);var Xt=class extends D{constructor(e,i,r,n,o){super();this._screenElement=e;this._bufferService=i;this._coreBrowserService=r;this._decorationService=n;this._renderService=o;this._decorationElements=new Map;this._altBufferIsActive=!1;this._dimensionsChanged=!1;this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register(O(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Xt=A([b(1,F),b(2,ae),b(3,Ne),b(4,le)],Xt);var Vr=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(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}};var He={full:0,left:0,center:0,right:0},ct={full:0,left:0,center:0,right:0},Bi={full:0,left:0,center:0,right:0},Et=class extends D{constructor(e,i,r,n,o,a,l,u){super();this._viewportElement=e;this._screenElement=i;this._bufferService=r;this._decorationService=n;this._renderService=o;this._optionsService=a;this._themeService=l;this._coreBrowserService=u;this._colorZoneStore=new Vr;this._shouldUpdateDimensions=!0;this._shouldUpdateAnchor=!0;this._lastKnownBufferLength=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(O(()=>this._canvas?.remove()));let d=this._canvas.getContext("2d");if(d)this._ctx=d;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);ct.full=this._canvas.width,ct.left=e,ct.center=i,ct.right=e,this._refreshDrawHeightConstants(),Bi.full=1,Bi.left=1,Bi.center=1+ct.left,Bi.right=1+ct.left+ct.center}_refreshDrawHeightConstants(){He.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);He.left=i,He.center=i,He.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Bi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-He[e.position||"full"]/2),ct[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+He[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Et=A([b(2,F),b(3,Ne),b(4,le),b(5,N),b(6,Le),b(7,ae)],Et);var Zt=class{constructor(t,e,i,r,n,o){this._textarea=t;this._compositionView=e;this._bufferService=i;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;let t=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.lengththis.updateCompositionElements(!0),0)}}};Zt=A([b(2,F),b(3,N),b(4,be),b(5,le)],Zt);var de=0,he=0,fe=0,Z=0,ws={css:"#00000000",rgba:0},V;(i=>{function s(r,n,o,a){return a!==void 0?`#${yt(r)}${yt(n)}${yt(o)}${yt(a)}`:`#${yt(r)}${yt(n)}${yt(o)}`}i.toCss=s;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function e(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=e})(V||={});var U;(a=>{function s(l,u){if(Z=(u.rgba&255)/255,Z===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,c=u.rgba>>16&255,h=u.rgba>>8&255,m=l.rgba>>24&255,p=l.rgba>>16&255,_=l.rgba>>8&255;de=m+Math.round((d-m)*Z),he=p+Math.round((c-p)*Z),fe=_+Math.round((h-_)*Z);let f=V.toCss(de,he,fe),L=V.toRgba(de,he,fe);return{css:f,rgba:L}}a.blend=s;function t(l){return(l.rgba&255)===255}a.isOpaque=t;function e(l,u,d){let c=qr.ensureContrastRatio(l.rgba,u.rgba,d);if(c)return V.toColor(c>>24&255,c>>16&255,c>>8&255)}a.ensureContrastRatio=e;function i(l){let u=(l.rgba|255)>>>0;return[de,he,fe]=qr.toChannels(u),{css:V.toCss(de,he,fe),rgba:u}}a.opaque=i;function r(l,u){return Z=Math.round(u*255),[de,he,fe]=qr.toChannels(l.rgba),{css:V.toCss(de,he,fe,Z),rgba:V.toRgba(de,he,fe,Z)}}a.opacity=r;function n(l,u){return Z=l.rgba&255,r(l,Z*u/255)}a.multiplyOpacity=n;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}a.toColorRGB=o})(U||={});var G;(i=>{let s,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(s=n,s.globalCompositeOperation="copy",t=s.createLinearGradient(0,0,1,1))}catch{}function e(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return de=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),fe=parseInt(r.slice(3,4).repeat(2),16),V.toColor(de,he,fe);case 5:return de=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),fe=parseInt(r.slice(3,4).repeat(2),16),Z=parseInt(r.slice(4,5).repeat(2),16),V.toColor(de,he,fe,Z);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 de=parseInt(n[1]),he=parseInt(n[2]),fe=parseInt(n[3]),Z=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),V.toColor(de,he,fe,Z);if(r==="transparent")return{css:"transparent",rgba:0};if(!s||!t)throw new Error("css.toColor: Unsupported css format");if(s.fillStyle=t,s.fillStyle=r,typeof s.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(s.fillRect(0,0,1,1),[de,he,fe,Z]=s.getImageData(0,0,1,1).data,Z!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:V.toRgba(de,he,fe,Z),css:r}}i.toColor=e})(G||={});var ue;(e=>{function s(i){return t(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=s;function t(i,r,n){let o=i/255,a=r/255,l=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return u*.2126+d*.7152+c*.0722}e.relativeLuminance2=t})(ue||={});var qr;(n=>{function s(o,a){if(Z=(a&255)/255,Z===1)return a;let l=a>>24&255,u=a>>16&255,d=a>>8&255,c=o>>24&255,h=o>>16&255,m=o>>8&255;return de=c+Math.round((l-c)*Z),he=h+Math.round((u-h)*Z),fe=m+Math.round((d-m)*Z),V.toRgba(de,he,fe)}n.blend=s;function t(o,a,l){let u=ue.relativeLuminance(o>>8),d=ue.relativeLuminance(a>>8);if(je(u,d)>8));if(_>8));return _>L?p:f}return p}let h=i(o,a,l),m=je(u,ue.relativeLuminance(h>>8));if(m>8));return m>_?h:p}return h}}n.ensureContrastRatio=t;function e(o,a,l){let u=o>>24&255,d=o>>16&255,c=o>>8&255,h=a>>24&255,m=a>>16&255,p=a>>8&255,_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));for(;_0||m>0||p>0);)h-=Math.max(0,Math.ceil(h*.1)),m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));return(h<<24|m<<16|p<<8|255)>>>0}n.reduceLuminance=e;function i(o,a,l){let u=o>>24&255,d=o>>16&255,c=o>>8&255,h=a>>24&255,m=a>>16&255,p=a>>8&255,_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));for(;_>>0}n.increaseLuminance=i;function r(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}n.toChannels=r})(qr||={});function yt(s){let t=s.toString(16);return t.length<2?"0"+t:t}function je(s,t){return s1){let c=this._getJoinedRanges(r,a,o,e,n);for(let h=0;h1){let d=this._getJoinedRanges(r,a,o,e,n);for(let c=0;c=Hn,w=y,E=this._workCell;if(m.length>0&&y===m[0][0]&&T){let H=m.shift(),Un=this._isCellInSelection(H[0],e);for(P=H[0]+1;P=H[1],T?(I=!0,E=new Yr(this._workCell,t.translateToString(!0,H[0],H[1]),H[1]-H[0]),w=H[1]-1,g=E.getWidth()):Hn=H[1]}let B=this._isCellInSelection(y,e),Y=i&&y===o,ie=Dt&&y>=d&&y<=c,Be=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,H=>{Be=!0});let We=E.getChars()||" ";if(We===" "&&(E.isUnderline()||E.isOverline())&&(We="\xA0"),ft=g*l-u.get(We,E.isBold(),E.isItalic()),!f)f=this._document.createElement("span");else if(L&&(B&&Je||!B&&!Je&&E.bg===S)&&(B&&Je&&p.selectionForeground||E.fg===k)&&E.extended.ext===C&&ie===_e&&ft===Qe&&!Y&&!I&&!Be&&T){E.isInvisible()?R+=" ":R+=We,L++;continue}else L&&(f.textContent=R),f=this._document.createElement("span"),L=0,R="";if(S=E.bg,k=E.fg,C=E.extended.ext,_e=ie,Qe=ft,Je=B,I&&o>=y&&o<=w&&(o=y),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&q.push("xterm-cursor-blink"),q.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break;default:break}}if(E.isBold()&&q.push("xterm-bold"),E.isItalic()&&q.push("xterm-italic"),E.isDim()&&q.push("xterm-dim"),E.isInvisible()?R=" ":R=E.getChars()||" ",E.isUnderline()&&(q.push(`xterm-underline-${E.extended.underlineStyle}`),R===" "&&(R="\xA0"),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())f.style.textDecorationColor=`rgb(${Re.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let H=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&H<8&&(H+=8),f.style.textDecorationColor=p.ansi[H].css}E.isOverline()&&(q.push("xterm-overline"),R===" "&&(R="\xA0")),E.isStrikethrough()&&q.push("xterm-strikethrough"),ie&&(f.style.textDecoration="underline");let oe=E.getFgColor(),et=E.getFgColorMode(),ge=E.getBgColor(),pt=E.getBgColorMode(),Si=!!E.isInverse();if(Si){let H=oe;oe=ge,ge=H;let Un=et;et=pt,pt=Un}let tt,sr,Ei=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,H=>{H.options.layer!=="top"&&Ei||(H.backgroundColorRGB&&(pt=50331648,ge=H.backgroundColorRGB.rgba>>8&16777215,tt=H.backgroundColorRGB),H.foregroundColorRGB&&(et=50331648,oe=H.foregroundColorRGB.rgba>>8&16777215,sr=H.foregroundColorRGB),Ei=H.options.layer==="top")}),!Ei&&B&&(tt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ge=tt.rgba>>8&16777215,pt=50331648,Ei=!0,p.selectionForeground&&(et=50331648,oe=p.selectionForeground.rgba>>8&16777215,sr=p.selectionForeground)),Ei&&q.push("xterm-decoration-top");let it;switch(pt){case 16777216:case 33554432:it=p.ansi[ge],q.push(`xterm-bg-${ge}`);break;case 50331648:it=V.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(f,`background-color:#${(ge>>>0).toString(16).padStart(6,"0")}`);break;case 0:default:Si?(it=p.foreground,q.push(`xterm-bg-${257}`)):it=p.background}switch(tt||E.isDim()&&(tt=U.multiplyOpacity(it,.5)),et){case 16777216:case 33554432:E.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(f,it,p.ansi[oe],E,tt,void 0)||q.push(`xterm-fg-${oe}`);break;case 50331648:let H=V.toColor(oe>>16&255,oe>>8&255,oe&255);this._applyMinimumContrast(f,it,H,E,tt,sr)||this._addStyle(f,`color:#${oe.toString(16).padStart(6,"0")}`);break;case 0:default:this._applyMinimumContrast(f,it,p.foreground,E,tt,sr)||Si&&q.push(`xterm-fg-${257}`)}q.length&&(f.className=q.join(" "),q.length=0),!Y&&!I&&!Be&&T?L++:f.textContent=R,ft!==this.defaultSpacing&&(f.style.letterSpacing=`${ft}px`),h.push(f),y=w}return f&&L&&(f.textContent=R),h}_applyMinimumContrast(t,e,i,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||da(r.getCode()))return!1;let a=this._getContrastCache(r),l;if(!n&&!o&&(l=a.getColor(e.rgba,i.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=U.ensureContrastRatio(n??e,o??i,u),a.setColor((n??e).rgba,(o??i).rgba,l??null)}return l?(this._addStyle(t,`color:${l.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e=i[0]&&t=i[0]}};Jt=A([b(1,dr),b(2,N),b(3,ae),b(4,be),b(5,Ne),b(6,Le)],Jt);var Xr=class{constructor(t=()=>new Rs){this._flat=new Float32Array(256);this._font="";this._fontSize=0;this._weight="normal";this._weightBold="bold";this._canvasElements=[];this._canvasElements=[t(),t(),t(),t()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(t,e,i,r){t===this._font&&e===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=t,this._fontSize=e,this._weight=i,this._weightBold=r,this._canvasElements[0].setFont(t,e,i,!1),this._canvasElements[1].setFont(t,e,r,!1),this._canvasElements[2].setFont(t,e,i,!0),this._canvasElements[3].setFont(t,e,r,!0),this.clear())}get(t,e,i){let r=0;if(!e&&!i&&t.length===1&&(r=t.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let a=this._measure(t,0);return a>0&&(this._flat[r]=a),a}let n=t;e&&(n+="B"),i&&(n+="I");let o=this._holey.get(n);if(o===void 0){let a=0;e&&(a|=1),i&&(a|=2),o=this._measure(t,a),o>0&&this._holey.set(n,o)}return o}_measure(t,e){return this._canvasElements[e].measure(t)}},Rs=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=Ds(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=Ds(this._canvas.getContext("2d")))}setFont(t,e,i,r){let n=r?"italic":"";this._ctx.font=`${n} ${i} ${e}px ${t}`.trim()}measure(t){return this._ctx.measureText(t).width}};var Ls=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let n=t.buffers.active.ydisp,o=e[1]-n,a=i[1]-n,l=Math.max(o,0),u=Math.min(a,t.rows-1);if(l>=t.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function fa(){return new Ls}var As="xterm-dom-renderer-owner-",De="xterm-rows",Zr="xterm-fg-",pa="xterm-bg-",Ni="xterm-focus",Qr="xterm-selection",Jr="xterm-cursor-blink-idle",ac=1,ti=class extends D{constructor(e,i,r,n,o,a,l,u,d,c,h,m,p,_){super();this._terminal=e;this._document=i;this._element=r;this._screenElement=n;this._viewportElement=o;this._helperContainer=a;this._linkifier2=l;this._charSizeService=d;this._optionsService=c;this._bufferService=h;this._coreService=m;this._coreBrowserService=p;this._themeService=_;this._terminalClass=ac++;this._rowElements=[];this._selectionRenderModel=fa();this.onRequestRedraw=this._register(new v).event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(De),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(Qr),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ha(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Jt,document),this._element.classList.add(As+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._cursorBlinkStateManager=new ks(this._rowContainer,this._coreBrowserService),this._register(x(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(O(()=>this._cursorBlinkStateManager.dispose())),this._register(O(()=>{this._element.classList.remove(As+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Xr,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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${De} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${De} { 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}`;i+=`${this._terminalSelector} .${De} .xterm-dim { color: ${U.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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 r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${n} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${De}.${Jr} .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Qr} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qr} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qr} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())i+=`${this._terminalSelector} .${Zr}${a} { color: ${l.css}; }${this._terminalSelector} .${Zr}${a}.xterm-dim { color: ${U.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${pa}${a} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${Zr}${257} { color: ${U.opaque(e.background).css}; }${this._terminalSelector} .${Zr}${257}.xterm-dim { color: ${U.multiplyOpacity(U.opaque(e.background),.5).css}; }${this._terminalSelector} .${pa}${257} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let r=this._rowElements.length;r<=i;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(Ni),this._cursorBlinkStateManager.pause(),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ni),this._cursorBlinkStateManager.resume(),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(r){let d=e[0]>i[0];u.appendChild(this._createSelectionElement(a,d?i[0]:e[0],d?e[0]:i[0],l-a+1))}else{let d=n===a?e[0]:0,c=a===o?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,d,c));let h=l-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,h)),a!==l){let m=o===l?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,m))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,i,r,n=1){let o=this._document.createElement("div"),a=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(r-i);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${a}px`,o.style.width=`${l}px`,o}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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,i){let r=this._bufferService.buffer,n=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=i;d++){let c=d+r.ydisp,h=this._rowElements[d],m=r.lines.get(c);if(!h||!m)break;h.replaceChildren(...this._rowFactory.createRow(m,c,c===n,l,u,o,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${As}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,o,a){r<0&&(e=0),n<0&&(i=0);let l=this._bufferService.rows-1;r=Math.max(Math.min(r,l),0),n=Math.max(Math.min(n,l),0),o=Math.min(o,this._bufferService.cols);let u=this._bufferService.buffer,d=u.ybase+u.y,c=Math.min(u.x,o-1),h=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=r;_<=n;++_){let f=_+u.ydisp,L=this._rowElements[_],R=u.lines.get(f);if(!L||!R)break;L.replaceChildren(...this._rowFactory.createRow(R,f,f===d,m,p,c,h,this.dimensions.css.cell.width,this._widthCache,a?_===r?e:0:-1,a?(_===n?i:o)-1:-1))}}};ti=A([b(7,At),b(8,nt),b(9,N),b(10,F),b(11,be),b(12,ae),b(13,Le)],ti);var ks=class{constructor(t,e){this._rowContainer=t;this._coreBrowserService=e;this._isIdlePaused=!1;this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove(Jr),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove(Jr),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add(Jr),this._isIdlePaused=!0,this._idleTimeout=void 0}};var ii=class extends D{constructor(e,i,r){super();this._optionsService=r;this.width=0;this.height=0;this._onCharSizeChange=this._register(new v);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ms(this._optionsService))}catch{this._measureStrategy=this._register(new Cs(e,i,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())}};ii=A([b(2,N)],ii);var en=class extends D{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},Cs=class extends en{constructor(e,i,r){super();this._document=e;this._parentElement=i;this._optionsService=r;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}},Ms=class extends en{constructor(e){super();this._optionsService=e;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}};var tn=class extends D{constructor(e,i,r){super();this._textarea=e;this._window=i;this.mainDocument=r;this._isFocused=!1;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new Ps(this._window));this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new v);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(ce.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(x(this._textarea,"focus",()=>this._isFocused=!0)),this._register(x(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Ps=class extends D{constructor(e){super();this._parentWindow=e;this._windowResizeListener=this._register(new Ae);this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(O(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=x(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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 rn=class extends D{constructor(){super();this.linkProviders=[];this._register(O(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Fi(s,t,e){let i=e.getBoundingClientRect(),r=s.getComputedStyle(e),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-n,t.clientY-i.top-o]}function ma(s,t,e,i,r,n,o,a,l){if(!n)return;let u=Fi(s,t,e);if(u)return u[0]=Math.ceil((u[0]+(l?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),i+(l?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var ri=class{constructor(t,e){this._renderService=t;this._charSizeService=e}getCoords(t,e,i,r,n){return ma(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(t,e){let i=Fi(me(e),t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};ri=A([b(0,le),b(1,nt)],ri);var nn=class{constructor(t,e){this._renderCallback=t;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t??0,e=e??this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,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 t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}};var sn={};Ja(sn,{getSafariVersion:()=>cc,isChromeOS:()=>Fs,isFirefox:()=>Bs,isLegacyEdge:()=>lc,isLinux:()=>Wi,isMac:()=>dt,isNode:()=>Hi,isSafari:()=>_a,isWindows:()=>Ns});var Hi=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Ui=Hi?"node":navigator.userAgent,Os=Hi?"node":navigator.platform,Bs=Ui.includes("Firefox"),lc=Ui.includes("Edge"),_a=/^((?!chrome|android).)*safari/i.test(Ui);function cc(){if(!_a)return 0;let s=Ui.match(/Version\/(\d+)/);return s===null||s.length<2?0:parseInt(s[1])}var dt=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Os),Ns=["Windows","Win16","Win32","WinCE"].includes(Os),Wi=Os.indexOf("Linux")>=0,Fs=/\bCrOS\b/.test(Ui);var on=class{constructor(){this._tasks=[];this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._in){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=n}this.clear()}},Hs=class extends on{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},Us=class extends on{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ni=!Hi&&"requestIdleCallback"in window?Us:Hs,an=class{constructor(){this._queue=new ni}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}};var si=class extends D{constructor(e,i,r,n,o,a,l,u,d){super();this._rowCount=e;this._optionsService=r;this._charSizeService=n;this._coreService=o;this._coreBrowserService=u;this._renderer=this._register(new Ae);this._pausedResizeTask=new an;this._observerDisposable=this._register(new Ae);this._isPaused=!1;this._needsFullRefresh=!1;this._isNextRenderRedrawOnly=!0;this._needsSelectionRefresh=!1;this._canvasWidth=0;this._canvasHeight=0;this._selectionState={start:void 0,end:void 0,columnSelectMode:!1};this._onDimensionsChange=this._register(new v);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new v);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new v);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new nn((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ws(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(O(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,void 0,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=O(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let o=this._syncOutputHandler.flush();o&&(e=Math.min(e,o.start),i=Math.max(i,o.end)),n||(this._isNextRenderRedrawOnly=!1),r?this._renderRows(e,i):this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.end,i.sync,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};si=A([b(2,N),b(3,nt),b(4,be),b(5,Ne),b(6,F),b(7,ae),b(8,Le)],si);var Ws=class{constructor(t,e,i){this._coreBrowserService=t;this._coreService=e;this._onTimeout=i;this._start=0;this._end=0;this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout??=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3)}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ba(s,t,e,i){let r=e.buffer.x,n=e.buffer.y;if(!e.buffer.hasScrollback)return hc(r,n,s,t,e,i)+ln(n,t,e,i)+fc(r,n,s,t,e,i);let o;if(n===t)return o=r>s?"D":"C",Gi(Math.abs(r-s),Ki(o,i));o=n>t?"D":"C";let a=Math.abs(n-t),l=dc(n>t?s:r,e)+(a-1)*e.cols+1+uc(n>t?r:s,e);return Gi(l,Ki(o,i))}function uc(s,t){return s-1}function dc(s,t){return t.cols-s}function hc(s,t,e,i,r,n){return ln(t,i,r,n).length===0?"":Gi(ga(s,t,s,t-Tt(t,r),!1,r).length,Ki("D",n))}function ln(s,t,e,i){let r=s-Tt(s,e),n=t-Tt(t,e),o=Math.abs(r-n)-pc(s,t,e);return Gi(o,Ki(va(s,t),i))}function fc(s,t,e,i,r,n){let o;ln(t,i,r,n).length>0?o=i-Tt(i,r):o=t;let a=i,l=mc(s,t,e,i,r,n);return Gi(ga(s,o,e,a,l==="C",r).length,Ki(l,n))}function pc(s,t,e){let i=0,r=s-Tt(s,e),n=t-Tt(t,e);for(let o=0;o=0&&s0?o=i-Tt(i,r):o=t,s=e&&ot?"A":"B"}function ga(s,t,e,i,r,n){let o=s,a=t,l="";for(;(o!==e||a!==i)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,s,o),o=0,s=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,s+1),o=n.cols-1,s=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,s,o)}function Ki(s,t){let e=t?"O":"[";return"\x1B"+e+s}function Gi(s,t){s=Math.floor(s);let e="";for(let i=0;ithis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ks(s,t){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return t*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}var Gs=50,_c=15,bc=50,vc=500,gc="\xA0",Sc=new RegExp(gc,"g");var oi=class extends D{constructor(e,i,r,n,o,a,l,u,d){super();this._element=e;this._screenElement=i;this._linkifier=r;this._bufferService=n;this._coreService=o;this._mouseService=a;this._optionsService=l;this._renderService=u;this._coreBrowserService=d;this._dragScrollAmount=0;this._enabled=!0;this._workCell=new j;this._mouseDownTimeStamp=0;this._oldHasSelection=!1;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new v);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new v);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new v);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new v);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 cn(this._bufferService),this._activeSelectionMode=0,this._register(O(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let a=e[0]a.replace(Sc," ")).join(Ns?`\r ++`)})),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))),this._register(Vt.addTarget(i)),this._register(x(i,Ce.Change,c=>this._handleGestureChange(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}_handleGestureChange(e){e.preventDefault(),e.stopPropagation();let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({scrollTop:i.scrollTop-e.translationY})}};jt=A([b(2,F),b(3,ae),b(4,lr),b(5,Le),b(6,N),b(7,le)],jt);var Xt=class extends D{constructor(e,i,r,n,o){super();this._screenElement=e;this._bufferService=i;this._coreBrowserService=r;this._decorationService=n;this._renderService=o;this._decorationElements=new Map;this._altBufferIsActive=!1;this._dimensionsChanged=!1;this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register(O(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Xt=A([b(1,F),b(2,ae),b(3,Ne),b(4,le)],Xt);var Vr=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(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}};var He={full:0,left:0,center:0,right:0},ct={full:0,left:0,center:0,right:0},Bi={full:0,left:0,center:0,right:0},Et=class extends D{constructor(e,i,r,n,o,a,l,u){super();this._viewportElement=e;this._screenElement=i;this._bufferService=r;this._decorationService=n;this._renderService=o;this._optionsService=a;this._themeService=l;this._coreBrowserService=u;this._colorZoneStore=new Vr;this._shouldUpdateDimensions=!0;this._shouldUpdateAnchor=!0;this._lastKnownBufferLength=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(O(()=>this._canvas?.remove()));let d=this._canvas.getContext("2d");if(d)this._ctx=d;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);ct.full=this._canvas.width,ct.left=e,ct.center=i,ct.right=e,this._refreshDrawHeightConstants(),Bi.full=1,Bi.left=1,Bi.center=1+ct.left,Bi.right=1+ct.left+ct.center}_refreshDrawHeightConstants(){He.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);He.left=i,He.center=i,He.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*He.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Bi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-He[e.position||"full"]/2),ct[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+He[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Et=A([b(2,F),b(3,Ne),b(4,le),b(5,N),b(6,Le),b(7,ae)],Et);var Zt=class{constructor(t,e,i,r,n,o){this._textarea=t;this._compositionView=e;this._bufferService=i;this._optionsService=r;this._coreService=n;this._renderService=o;this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){if(this._textareaChangeTimer)return;let t=this._textarea.value;this._textareaChangeTimer=window.setTimeout(()=>{if(this._textareaChangeTimer=void 0,!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.lengththis.updateCompositionElements(!0),0)}}};Zt=A([b(2,F),b(3,N),b(4,be),b(5,le)],Zt);var de=0,he=0,fe=0,Z=0,ws={css:"#00000000",rgba:0},V;(i=>{function s(r,n,o,a){return a!==void 0?`#${yt(r)}${yt(n)}${yt(o)}${yt(a)}`:`#${yt(r)}${yt(n)}${yt(o)}`}i.toCss=s;function t(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}i.toRgba=t;function e(r,n,o,a){return{css:i.toCss(r,n,o,a),rgba:i.toRgba(r,n,o,a)}}i.toColor=e})(V||={});var U;(a=>{function s(l,u){if(Z=(u.rgba&255)/255,Z===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,c=u.rgba>>16&255,h=u.rgba>>8&255,m=l.rgba>>24&255,p=l.rgba>>16&255,_=l.rgba>>8&255;de=m+Math.round((d-m)*Z),he=p+Math.round((c-p)*Z),fe=_+Math.round((h-_)*Z);let f=V.toCss(de,he,fe),L=V.toRgba(de,he,fe);return{css:f,rgba:L}}a.blend=s;function t(l){return(l.rgba&255)===255}a.isOpaque=t;function e(l,u,d){let c=qr.ensureContrastRatio(l.rgba,u.rgba,d);if(c)return V.toColor(c>>24&255,c>>16&255,c>>8&255)}a.ensureContrastRatio=e;function i(l){let u=(l.rgba|255)>>>0;return[de,he,fe]=qr.toChannels(u),{css:V.toCss(de,he,fe),rgba:u}}a.opaque=i;function r(l,u){return Z=Math.round(u*255),[de,he,fe]=qr.toChannels(l.rgba),{css:V.toCss(de,he,fe,Z),rgba:V.toRgba(de,he,fe,Z)}}a.opacity=r;function n(l,u){return Z=l.rgba&255,r(l,Z*u/255)}a.multiplyOpacity=n;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}a.toColorRGB=o})(U||={});var G;(i=>{let s,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(s=n,s.globalCompositeOperation="copy",t=s.createLinearGradient(0,0,1,1))}catch{}function e(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return de=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),fe=parseInt(r.slice(3,4).repeat(2),16),V.toColor(de,he,fe);case 5:return de=parseInt(r.slice(1,2).repeat(2),16),he=parseInt(r.slice(2,3).repeat(2),16),fe=parseInt(r.slice(3,4).repeat(2),16),Z=parseInt(r.slice(4,5).repeat(2),16),V.toColor(de,he,fe,Z);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 de=parseInt(n[1]),he=parseInt(n[2]),fe=parseInt(n[3]),Z=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),V.toColor(de,he,fe,Z);if(r==="transparent")return{css:"transparent",rgba:0};if(!s||!t)throw new Error("css.toColor: Unsupported css format");if(s.fillStyle=t,s.fillStyle=r,typeof s.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(s.fillRect(0,0,1,1),[de,he,fe,Z]=s.getImageData(0,0,1,1).data,Z!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:V.toRgba(de,he,fe,Z),css:r}}i.toColor=e})(G||={});var ue;(e=>{function s(i){return t(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=s;function t(i,r,n){let o=i/255,a=r/255,l=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return u*.2126+d*.7152+c*.0722}e.relativeLuminance2=t})(ue||={});var qr;(n=>{function s(o,a){if(Z=(a&255)/255,Z===1)return a;let l=a>>24&255,u=a>>16&255,d=a>>8&255,c=o>>24&255,h=o>>16&255,m=o>>8&255;return de=c+Math.round((l-c)*Z),he=h+Math.round((u-h)*Z),fe=m+Math.round((d-m)*Z),V.toRgba(de,he,fe)}n.blend=s;function t(o,a,l){let u=ue.relativeLuminance(o>>8),d=ue.relativeLuminance(a>>8);if(je(u,d)>8));if(_>8));return _>L?p:f}return p}let h=i(o,a,l),m=je(u,ue.relativeLuminance(h>>8));if(m>8));return m>_?h:p}return h}}n.ensureContrastRatio=t;function e(o,a,l){let u=o>>24&255,d=o>>16&255,c=o>>8&255,h=a>>24&255,m=a>>16&255,p=a>>8&255,_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));for(;_0||m>0||p>0);)h-=Math.max(0,Math.ceil(h*.1)),m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));return(h<<24|m<<16|p<<8|255)>>>0}n.reduceLuminance=e;function i(o,a,l){let u=o>>24&255,d=o>>16&255,c=o>>8&255,h=a>>24&255,m=a>>16&255,p=a>>8&255,_=je(ue.relativeLuminance2(h,m,p),ue.relativeLuminance2(u,d,c));for(;_>>0}n.increaseLuminance=i;function r(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}n.toChannels=r})(qr||={});function yt(s){let t=s.toString(16);return t.length<2?"0"+t:t}function je(s,t){return s1){let c=this._getJoinedRanges(r,a,o,e,n);for(let h=0;h1){let d=this._getJoinedRanges(r,a,o,e,n);for(let c=0;c=Hn,w=y,E=this._workCell;if(m.length>0&&y===m[0][0]&&T){let H=m.shift(),Un=this._isCellInSelection(H[0],e);for(P=H[0]+1;P=H[1],T?(I=!0,E=new Yr(this._workCell,t.translateToString(!0,H[0],H[1]),H[1]-H[0]),w=H[1]-1,g=E.getWidth()):Hn=H[1]}let B=this._isCellInSelection(y,e),Y=i&&y===o,ie=Dt&&y>=d&&y<=c,Be=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,H=>{Be=!0});let We=E.getChars()||" ";if(We===" "&&(E.isUnderline()||E.isOverline())&&(We="\xA0"),ft=g*l-u.get(We,E.isBold(),E.isItalic()),!f)f=this._document.createElement("span");else if(L&&(B&&Je||!B&&!Je&&E.bg===S)&&(B&&Je&&p.selectionForeground||E.fg===k)&&E.extended.ext===C&&ie===_e&&ft===Qe&&!Y&&!I&&!Be&&T){E.isInvisible()?R+=" ":R+=We,L++;continue}else L&&(f.textContent=R),f=this._document.createElement("span"),L=0,R="";if(S=E.bg,k=E.fg,C=E.extended.ext,_e=ie,Qe=ft,Je=B,I&&o>=y&&o<=w&&(o=y),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&q.push("xterm-cursor-blink"),q.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break;default:break}}if(E.isBold()&&q.push("xterm-bold"),E.isItalic()&&q.push("xterm-italic"),E.isDim()&&q.push("xterm-dim"),E.isInvisible()?R=" ":R=E.getChars()||" ",E.isUnderline()&&(q.push(`xterm-underline-${E.extended.underlineStyle}`),R===" "&&(R="\xA0"),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())f.style.textDecorationColor=`rgb(${Re.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let H=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&H<8&&(H+=8),f.style.textDecorationColor=p.ansi[H].css}E.isOverline()&&(q.push("xterm-overline"),R===" "&&(R="\xA0")),E.isStrikethrough()&&q.push("xterm-strikethrough"),ie&&(f.style.textDecoration="underline");let oe=E.getFgColor(),et=E.getFgColorMode(),ge=E.getBgColor(),pt=E.getBgColorMode(),Si=!!E.isInverse();if(Si){let H=oe;oe=ge,ge=H;let Un=et;et=pt,pt=Un}let tt,sr,Ei=!1;this._decorationService.forEachDecorationAtCell(y,e,void 0,H=>{H.options.layer!=="top"&&Ei||(H.backgroundColorRGB&&(pt=50331648,ge=H.backgroundColorRGB.rgba>>8&16777215,tt=H.backgroundColorRGB),H.foregroundColorRGB&&(et=50331648,oe=H.foregroundColorRGB.rgba>>8&16777215,sr=H.foregroundColorRGB),Ei=H.options.layer==="top")}),!Ei&&B&&(tt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,ge=tt.rgba>>8&16777215,pt=50331648,Ei=!0,p.selectionForeground&&(et=50331648,oe=p.selectionForeground.rgba>>8&16777215,sr=p.selectionForeground)),Ei&&q.push("xterm-decoration-top");let it;switch(pt){case 16777216:case 33554432:it=p.ansi[ge],q.push(`xterm-bg-${ge}`);break;case 50331648:it=V.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(f,`background-color:#${(ge>>>0).toString(16).padStart(6,"0")}`);break;case 0:default:Si?(it=p.foreground,q.push(`xterm-bg-${257}`)):it=p.background}switch(tt||E.isDim()&&(tt=U.multiplyOpacity(it,.5)),et){case 16777216:case 33554432:E.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(f,it,p.ansi[oe],E,tt,void 0)||q.push(`xterm-fg-${oe}`);break;case 50331648:let H=V.toColor(oe>>16&255,oe>>8&255,oe&255);this._applyMinimumContrast(f,it,H,E,tt,sr)||this._addStyle(f,`color:#${oe.toString(16).padStart(6,"0")}`);break;case 0:default:this._applyMinimumContrast(f,it,p.foreground,E,tt,sr)||Si&&q.push(`xterm-fg-${257}`)}q.length&&(f.className=q.join(" "),q.length=0),!Y&&!I&&!Be&&T?L++:f.textContent=R,ft!==this.defaultSpacing&&(f.style.letterSpacing=`${ft}px`),h.push(f),y=w}return f&&L&&(f.textContent=R),h}_applyMinimumContrast(t,e,i,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||da(r.getCode()))return!1;let a=this._getContrastCache(r),l;if(!n&&!o&&(l=a.getColor(e.rgba,i.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=U.ensureContrastRatio(n??e,o??i,u),a.setColor((n??e).rgba,(o??i).rgba,l??null)}return l?(this._addStyle(t,`color:${l.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e=i[0]&&t=i[0]}};Jt=A([b(1,dr),b(2,N),b(3,ae),b(4,be),b(5,Ne),b(6,Le)],Jt);var Xr=class{constructor(t=()=>new Rs){this._flat=new Float32Array(256);this._font="";this._fontSize=0;this._weight="normal";this._weightBold="bold";this._canvasElements=[];this._canvasElements=[t(),t(),t(),t()],this.clear()}dispose(){this._canvasElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(t,e,i,r){t===this._font&&e===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=t,this._fontSize=e,this._weight=i,this._weightBold=r,this._canvasElements[0].setFont(t,e,i,!1),this._canvasElements[1].setFont(t,e,r,!1),this._canvasElements[2].setFont(t,e,i,!0),this._canvasElements[3].setFont(t,e,r,!0),this.clear())}get(t,e,i){let r=0;if(!e&&!i&&t.length===1&&(r=t.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let a=this._measure(t,0);return a>0&&(this._flat[r]=a),a}let n=t;e&&(n+="B"),i&&(n+="I");let o=this._holey.get(n);if(o===void 0){let a=0;e&&(a|=1),i&&(a|=2),o=this._measure(t,a),o>0&&this._holey.set(n,o)}return o}_measure(t,e){return this._canvasElements[e].measure(t)}},Rs=class{constructor(){typeof OffscreenCanvas<"u"?(this._canvas=new OffscreenCanvas(1,1),this._ctx=Ds(this._canvas.getContext("2d"))):(this._canvas=document.createElement("canvas"),this._canvas.width=1,this._canvas.height=1,this._ctx=Ds(this._canvas.getContext("2d")))}setFont(t,e,i,r){let n=r?"italic":"";this._ctx.font=`${n} ${i} ${e}px ${t}`.trim()}measure(t){return this._ctx.measureText(t).width}};var Ls=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let n=t.buffers.active.ydisp,o=e[1]-n,a=i[1]-n,l=Math.max(o,0),u=Math.min(a,t.rows-1);if(l>=t.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&e=this.startCol):!1}};function fa(){return new Ls}var As="xterm-dom-renderer-owner-",De="xterm-rows",Zr="xterm-fg-",pa="xterm-bg-",Ni="xterm-focus",Qr="xterm-selection",Jr="xterm-cursor-blink-idle",ac=1,ti=class extends D{constructor(e,i,r,n,o,a,l,u,d,c,h,m,p,_){super();this._terminal=e;this._document=i;this._element=r;this._screenElement=n;this._viewportElement=o;this._helperContainer=a;this._linkifier2=l;this._charSizeService=d;this._optionsService=c;this._bufferService=h;this._coreService=m;this._coreBrowserService=p;this._themeService=_;this._terminalClass=ac++;this._rowElements=[];this._selectionRenderModel=fa();this._onRequestRedraw=this._register(new v);this.onRequestRedraw=this._onRequestRedraw.event;this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(De),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(Qr),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=ha(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Jt,document),this._element.classList.add(As+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._cursorBlinkStateManager=new ks(this._rowContainer,this._coreBrowserService),this._register(x(this._document,"mousedown",()=>this._cursorBlinkStateManager.restartBlinkAnimation())),this._register(O(()=>this._cursorBlinkStateManager.dispose())),this._register(O(()=>{this._element.classList.remove(As+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Xr,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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${De} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${De} { 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}`;i+=`${this._terminalSelector} .${De} .xterm-dim { color: ${U.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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 r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${n} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${De}.${Ni} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${De}.${Jr} .xterm-cursor.xterm-cursor-blink { animation: none !important;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${De} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Qr} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qr} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qr} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())i+=`${this._terminalSelector} .${Zr}${a} { color: ${l.css}; }${this._terminalSelector} .${Zr}${a}.xterm-dim { color: ${U.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${pa}${a} { background-color: ${l.css}; }`;i+=`${this._terminalSelector} .${Zr}${257} { color: ${U.opaque(e.background).css}; }${this._terminalSelector} .${Zr}${257}.xterm-dim { color: ${U.multiplyOpacity(U.opaque(e.background),.5).css}; }${this._terminalSelector} .${pa}${257} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let r=this._rowElements.length;r<=i;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(Ni),this._cursorBlinkStateManager.pause(),this._requestRedraw(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ni),this._cursorBlinkStateManager.resume(),this._requestRedraw(this._bufferService.buffer.y,this._bufferService.buffer.y)}_requestRedraw(e,i){this._onRequestRedraw.fire({start:e,end:i})}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this._requestRedraw(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(r){let d=e[0]>i[0];u.appendChild(this._createSelectionElement(a,d?i[0]:e[0],d?e[0]:i[0],l-a+1))}else{let d=n===a?e[0]:0,c=a===o?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,d,c));let h=l-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,h)),a!==l){let m=o===l?i[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,m))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,i,r,n=1){let o=this._document.createElement("div"),a=i*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(r-i);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${a}px`,o.style.width=`${l}px`,o}handleCursorMove(){this._cursorBlinkStateManager.restartBlinkAnimation()}_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,i){let r=this._bufferService.buffer,n=r.ybase+r.y,o=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=i;d++){let c=d+r.ydisp,h=this._rowElements[d],m=r.lines.get(c);if(!h||!m)break;h.replaceChildren(...this._rowFactory.createRow(m,c,c===n,l,u,o,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${As}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,r,n,o,a){r<0&&(e=0),n<0&&(i=0);let l=this._bufferService.rows-1;r=Math.max(Math.min(r,l),0),n=Math.max(Math.min(n,l),0),o=Math.min(o,this._bufferService.cols);let u=this._bufferService.buffer,d=u.ybase+u.y,c=Math.min(u.x,o-1),h=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=r;_<=n;++_){let f=_+u.ydisp,L=this._rowElements[_],R=u.lines.get(f);if(!L||!R)break;L.replaceChildren(...this._rowFactory.createRow(R,f,f===d,m,p,c,h,this.dimensions.css.cell.width,this._widthCache,a?_===r?e:0:-1,a?(_===n?i:o)-1:-1))}}};ti=A([b(7,At),b(8,nt),b(9,N),b(10,F),b(11,be),b(12,ae),b(13,Le)],ti);var ks=class{constructor(t,e){this._rowContainer=t;this._coreBrowserService=e;this._isIdlePaused=!1;this._coreBrowserService.isFocused&&this._resetIdleTimer()}dispose(){this._clearIdleTimer()}restartBlinkAnimation(){this._isIdlePaused&&this._rowContainer.classList.remove(Jr),this._resetIdleTimer()}pause(){this._isIdlePaused=!1,this._clearIdleTimer()}resume(){this._isIdlePaused=!1,this._rowContainer.classList.remove(Jr),this._resetIdleTimer()}_resetIdleTimer(){this._isIdlePaused=!1,this._clearIdleTimer(),this._idleTimeout=this._coreBrowserService.window.setTimeout(()=>{this._stopBlinkingDueToIdle()},3e5)}_clearIdleTimer(){this._idleTimeout&&(this._coreBrowserService.window.clearTimeout(this._idleTimeout),this._idleTimeout=void 0)}_stopBlinkingDueToIdle(){this._rowContainer.classList.add(Jr),this._isIdlePaused=!0,this._idleTimeout=void 0}};var ii=class extends D{constructor(e,i,r){super();this._optionsService=r;this.width=0;this.height=0;this._onCharSizeChange=this._register(new v);this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ms(this._optionsService))}catch{this._measureStrategy=this._register(new Cs(e,i,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())}};ii=A([b(2,N)],ii);var en=class extends D{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},Cs=class extends en{constructor(e,i,r){super();this._document=e;this._parentElement=i;this._optionsService=r;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}},Ms=class extends en{constructor(e){super();this._optionsService=e;this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}};var tn=class extends D{constructor(e,i,r){super();this._textarea=e;this._window=i;this.mainDocument=r;this._isFocused=!1;this._cachedIsFocused=void 0;this._screenDprMonitor=this._register(new Ps(this._window));this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._onWindowChange=this._register(new v);this.onWindowChange=this._onWindowChange.event;this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(ce.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(x(this._textarea,"focus",()=>this._isFocused=!0)),this._register(x(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Ps=class extends D{constructor(e){super();this._parentWindow=e;this._windowResizeListener=this._register(new Ae);this._onDprChange=this._register(new v);this.onDprChange=this._onDprChange.event;this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(O(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=x(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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 rn=class extends D{constructor(){super();this.linkProviders=[];this._register(O(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Fi(s,t,e){let i=e.getBoundingClientRect(),r=s.getComputedStyle(e),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-n,t.clientY-i.top-o]}function ma(s,t,e,i,r,n,o,a,l){if(!n)return;let u=Fi(s,t,e);if(u)return u[0]=Math.ceil((u[0]+(l?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),i+(l?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var ri=class{constructor(t,e){this._renderService=t;this._charSizeService=e}getCoords(t,e,i,r,n){return ma(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(t,e){let i=Fi(me(e),t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};ri=A([b(0,le),b(1,nt)],ri);var nn=class{constructor(t,e){this._renderCallback=t;this._coreBrowserService=e;this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t??0,e=e??this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,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 t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}};var sn={};Ja(sn,{getSafariVersion:()=>cc,isChromeOS:()=>Fs,isFirefox:()=>Bs,isLegacyEdge:()=>lc,isLinux:()=>Wi,isMac:()=>dt,isNode:()=>Hi,isSafari:()=>_a,isWindows:()=>Ns});var Hi=!!(typeof process<"u"&&"title"in process&&(typeof navigator>"u"||navigator.userAgent.startsWith("Node.js/"))),Ui=Hi?"node":navigator.userAgent,Os=Hi?"node":navigator.platform,Bs=Ui.includes("Firefox"),lc=Ui.includes("Edge"),_a=/^((?!chrome|android).)*safari/i.test(Ui);function cc(){if(!_a)return 0;let s=Ui.match(/Version\/(\d+)/);return s===null||s.length<2?0:parseInt(s[1])}var dt=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Os),Ns=["Windows","Win16","Win32","WinCE"].includes(Os),Wi=Os.indexOf("Linux")>=0,Fs=/\bCrOS\b/.test(Ui);var on=class{constructor(){this._tasks=[];this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._in){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=n}this.clear()}},Hs=class extends on{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},Us=class extends on{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ni=!Hi&&"requestIdleCallback"in window?Us:Hs,an=class{constructor(){this._queue=new ni}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}};var si=class extends D{constructor(e,i,r,n,o,a,l,u,d){super();this._rowCount=e;this._optionsService=r;this._charSizeService=n;this._coreService=o;this._coreBrowserService=u;this._renderer=this._register(new Ae);this._pausedResizeTask=new an;this._observerDisposable=this._register(new Ae);this._isPaused=!1;this._needsFullRefresh=!1;this._isNextRenderRedrawOnly=!0;this._needsSelectionRefresh=!1;this._canvasWidth=0;this._canvasHeight=0;this._selectionState={start:void 0,end:void 0,columnSelectMode:!1};this._onDimensionsChange=this._register(new v);this.onDimensionsChange=this._onDimensionsChange.event;this._onRenderedViewportChange=this._register(new v);this.onRenderedViewportChange=this._onRenderedViewportChange.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onRefreshRequest=this._register(new v);this.onRefreshRequest=this._onRefreshRequest.event;this._renderDebouncer=new nn((c,h)=>this._renderRows(c,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ws(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(O(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,void 0,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=O(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,r=!1,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let o=this._syncOutputHandler.flush();o&&(e=Math.min(e,o.start),i=Math.max(i,o.end)),n||(this._isNextRenderRedrawOnly=!1),r?this._renderRows(e,i):this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._needsSelectionRefresh=!1,this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode)),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.end,i.sync,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,r){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,i,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};si=A([b(2,N),b(3,nt),b(4,be),b(5,Ne),b(6,F),b(7,ae),b(8,Le)],si);var Ws=class{constructor(t,e,i){this._coreBrowserService=t;this._coreService=e;this._onTimeout=i;this._start=0;this._end=0;this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout??=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3)}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ba(s,t,e,i){let r=e.buffer.x,n=e.buffer.y;if(!e.buffer.hasScrollback)return hc(r,n,s,t,e,i)+ln(n,t,e,i)+fc(r,n,s,t,e,i);let o;if(n===t)return o=r>s?"D":"C",Gi(Math.abs(r-s),Ki(o,i));o=n>t?"D":"C";let a=Math.abs(n-t),l=dc(n>t?s:r,e)+(a-1)*e.cols+1+uc(n>t?r:s,e);return Gi(l,Ki(o,i))}function uc(s,t){return s-1}function dc(s,t){return t.cols-s}function hc(s,t,e,i,r,n){return ln(t,i,r,n).length===0?"":Gi(ga(s,t,s,t-Tt(t,r),!1,r).length,Ki("D",n))}function ln(s,t,e,i){let r=s-Tt(s,e),n=t-Tt(t,e),o=Math.abs(r-n)-pc(s,t,e);return Gi(o,Ki(va(s,t),i))}function fc(s,t,e,i,r,n){let o;ln(t,i,r,n).length>0?o=i-Tt(i,r):o=t;let a=i,l=mc(s,t,e,i,r,n);return Gi(ga(s,o,e,a,l==="C",r).length,Ki(l,n))}function pc(s,t,e){let i=0,r=s-Tt(s,e),n=t-Tt(t,e);for(let o=0;o=0&&s0?o=i-Tt(i,r):o=t,s=e&&ot?"A":"B"}function ga(s,t,e,i,r,n){let o=s,a=t,l="";for(;(o!==e||a!==i)&&a>=0&&an.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,s,o),o=0,s=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,s+1),o=n.cols-1,s=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,s,o)}function Ki(s,t){let e=t?"O":"[";return"\x1B"+e+s}function Gi(s,t){s=Math.floor(s);let e="";for(let i=0;ithis._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ks(s,t){if(s.start.y>s.end.y)throw new Error(`Buffer range end (${s.end.x}, ${s.end.y}) cannot be before start (${s.start.x}, ${s.start.y})`);return t*(s.end.y-s.start.y)+(s.end.x-s.start.x+1)}var Gs=50,_c=15,bc=50,vc=500,gc="\xA0",Sc=new RegExp(gc,"g");var oi=class extends D{constructor(e,i,r,n,o,a,l,u,d){super();this._element=e;this._screenElement=i;this._linkifier=r;this._bufferService=n;this._coreService=o;this._mouseService=a;this._optionsService=l;this._renderService=u;this._coreBrowserService=d;this._dragScrollAmount=0;this._enabled=!0;this._workCell=new j;this._mouseDownTimeStamp=0;this._oldHasSelection=!1;this._oldSelectionStart=void 0;this._oldSelectionEnd=void 0;this._onLinuxMouseSelection=this._register(new v);this.onLinuxMouseSelection=this._onLinuxMouseSelection.event;this._onRedrawRequest=this._register(new v);this.onRequestRedraw=this._onRedrawRequest.event;this._onSelectionChange=this._register(new v);this.onSelectionChange=this._onSelectionChange.event;this._onRequestScrollLines=this._register(new v);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 cn(this._bufferService),this._activeSelectionMode=0,this._register(O(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let a=e[0]a.replace(Sc," ")).join(Ns?`\r + `:` + `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Wi&&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 i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!i?!1:this._areCoordsInSelection(i,r,n)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,i],r,n)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]=i[0]&&e[0]=i[0]}_selectWordAtCursor(e,i){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=Ks(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Fi(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-Gs),Gs),i/=Gs,i/Math.abs(i)+Math.round(i*(_c-1)))}shouldForceSelection(e){return dt?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),bc)}_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){let i=this.hasSelection;if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0,i&&this._fireOnSelectionChange(this._model.finalSelectionStart,this._model.finalSelectionEnd,!1);let r=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);r&&r.length!==this._model.selectionStart[0]&&r.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(dt&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=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 i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&ithis._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let n=0;i>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:o>1&&i!==n&&(r+=o-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,a=o.lines.get(e[1]);if(!a)return;let l=o.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(a,e[0]),d=u,c=e[0]-u,h=0,m=0,p=0,_=0;if(l.charAt(u)===" "){for(;u>0&&l.charAt(u-1)===" ";)u--;for(;d1&&(_+=S-1,d+=S-1);R>0&&u>0&&!this._isCharWordSeparator(a.loadCell(R-1,this._workCell));){a.loadCell(R-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,R--):k>1&&(p+=k-1,u-=k-1),u--,R--}for(;P1&&(_+=k-1,d+=k-1),d++,P++}}d++;let f=u+c-h+p,L=Math.min(this._bufferService.cols,d-u+h+m-p-_);if(!(!i&&l.slice(u,d).trim()==="")){if(r&&f===0&&a.getCodePoint(0)!==32){let R=o.lines.get(e[1]-1);if(R&&a.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let P=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(P){let S=this._bufferService.cols-P.start;f-=S,L+=S}}}if(n&&f+L===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let R=o.lines.get(e[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let P=this._getWordAt([0,e[1]+1],!1,!1,!0);P&&(L+=P.length)}}return{start:f,length:L}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ks(r,this._bufferService.cols)}};oi=A([b(3,F),b(4,be),b(5,Ct),b(6,N),b(7,le),b(8,ae)],oi);var zi=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}};var $i=class{constructor(){this._color=new zi;this._css=new zi}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}};var re=Object.freeze((()=>{let s=[G.toColor("#2e3436"),G.toColor("#cc0000"),G.toColor("#4e9a06"),G.toColor("#c4a000"),G.toColor("#3465a4"),G.toColor("#75507b"),G.toColor("#06989a"),G.toColor("#d3d7cf"),G.toColor("#555753"),G.toColor("#ef2929"),G.toColor("#8ae234"),G.toColor("#fce94f"),G.toColor("#729fcf"),G.toColor("#ad7fa8"),G.toColor("#34e2e2"),G.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let e=0;e<216;e++){let i=t[e/36%6|0],r=t[e/6%6|0],n=t[e%6];s.push({css:V.toCss(i,r,n),rgba:V.toRgba(i,r,n)})}for(let e=0;e<24;e++){let i=8+e*10;s.push({css:V.toCss(i,i,i),rgba:V.toRgba(i,i,i)})}return s})());var It=G.toColor("#ffffff"),qi=G.toColor("#000000"),Sa=G.toColor("#ffffff"),Ea=qi,Vi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ec=It,ai=class extends D{constructor(e){super();this._optionsService=e;this._contrastCache=new $i;this._halfContrastCache=new $i;this._onChangeColors=this._register(new v);this.onChangeColors=this._onChangeColors.event;this._colors={foreground:It,background:qi,cursor:Sa,cursorAccent:Ea,selectionForeground:void 0,selectionBackgroundTransparent:Vi,selectionBackgroundOpaque:U.blend(qi,Vi),selectionInactiveBackgroundTransparent:Vi,selectionInactiveBackgroundOpaque:U.blend(qi,Vi),scrollbarSliderBackground:U.opacity(It,.2),scrollbarSliderHoverBackground:U.opacity(It,.4),scrollbarSliderActiveBackground:U.opacity(It,.5),overviewRulerBorder:It,ansi:re.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 i=this._colors;if(i.foreground=W(e.foreground,It),i.background=W(e.background,qi),i.cursor=U.blend(i.background,W(e.cursor,Sa)),i.cursorAccent=U.blend(i.background,W(e.cursorAccent,Ea)),i.selectionBackgroundTransparent=W(e.selectionBackground,Vi),i.selectionBackgroundOpaque=U.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=W(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=U.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?W(e.selectionForeground,ws):void 0,i.selectionForeground===ws&&(i.selectionForeground=void 0),U.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=U.opacity(i.selectionBackgroundTransparent,.3)),U.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=U.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=W(e.scrollbarSliderBackground,U.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=W(e.scrollbarSliderHoverBackground,U.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=W(e.scrollbarSliderActiveBackground,U.opacity(i.foreground,.5)),i.overviewRulerBorder=W(e.overviewRulerBorder,Ec),i.ansi=re.slice(),i.ansi[0]=W(e.black,re[0]),i.ansi[1]=W(e.red,re[1]),i.ansi[2]=W(e.green,re[2]),i.ansi[3]=W(e.yellow,re[3]),i.ansi[4]=W(e.blue,re[4]),i.ansi[5]=W(e.magenta,re[5]),i.ansi[6]=W(e.cyan,re[6]),i.ansi[7]=W(e.white,re[7]),i.ansi[8]=W(e.brightBlack,re[8]),i.ansi[9]=W(e.brightRed,re[9]),i.ansi[10]=W(e.brightGreen,re[10]),i.ansi[11]=W(e.brightYellow,re[11]),i.ansi[12]=W(e.brightBlue,re[12]),i.ansi[13]=W(e.brightMagenta,re[13]),i.ansi[14]=W(e.brightCyan,re[14]),i.ansi[15]=W(e.brightWhite,re[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let n=0;n"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Ta(s,t,e,i){let r={type:0,cancel:!1,key:void 0},n=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?t?r.key="\x1BOA":r.key="\x1B[A":s.key==="UIKeyInputLeftArrow"?t?r.key="\x1BOD":r.key="\x1B[D":s.key==="UIKeyInputRightArrow"?t?r.key="\x1BOC":r.key="\x1B[C":s.key==="UIKeyInputDownArrow"&&(t?r.key="\x1BOB":r.key="\x1B[B");break;case 8:r.key=s.ctrlKey?"\b":"\x7F",s.altKey&&(r.key="\x1B"+r.key);break;case 9:if(s.shiftKey){r.key="\x1B[Z";break}r.key=" ",r.cancel=!0;break;case 13:r.key=s.altKey?"\x1B\r":"\r",r.cancel=!0;break;case 27:r.key="\x1B",s.altKey&&(r.key="\x1B\x1B"),r.cancel=!0;break;case 37:if(s.metaKey)break;n?r.key="\x1B[1;"+(n+1)+"D":t?r.key="\x1BOD":r.key="\x1B[D";break;case 39:if(s.metaKey)break;n?r.key="\x1B[1;"+(n+1)+"C":t?r.key="\x1BOC":r.key="\x1B[C";break;case 38:if(s.metaKey)break;n?r.key="\x1B[1;"+(n+1)+"A":t?r.key="\x1BOA":r.key="\x1B[A";break;case 40:if(s.metaKey)break;n?r.key="\x1B[1;"+(n+1)+"B":t?r.key="\x1BOB":r.key="\x1B[B";break;case 45:!s.shiftKey&&!s.ctrlKey&&(r.key="\x1B[2~");break;case 46:n?r.key="\x1B[3;"+(n+1)+"~":r.key="\x1B[3~";break;case 36:n?r.key="\x1B[1;"+(n+1)+"H":t?r.key="\x1BOH":r.key="\x1B[H";break;case 35:n?r.key="\x1B[1;"+(n+1)+"F":t?r.key="\x1BOF":r.key="\x1B[F";break;case 33:s.shiftKey?r.type=2:s.ctrlKey?r.key="\x1B[5;"+(n+1)+"~":r.key="\x1B[5~";break;case 34:s.shiftKey?r.type=3:s.ctrlKey?r.key="\x1B[6;"+(n+1)+"~":r.key="\x1B[6~";break;case 112:n?r.key="\x1B[1;"+(n+1)+"P":r.key="\x1BOP";break;case 113:n?r.key="\x1B[1;"+(n+1)+"Q":r.key="\x1BOQ";break;case 114:n?r.key="\x1B[1;"+(n+1)+"R":r.key="\x1BOR";break;case 115:n?r.key="\x1B[1;"+(n+1)+"S":r.key="\x1BOS";break;case 116:n?r.key="\x1B[15;"+(n+1)+"~":r.key="\x1B[15~";break;case 117:n?r.key="\x1B[17;"+(n+1)+"~":r.key="\x1B[17~";break;case 118:n?r.key="\x1B[18;"+(n+1)+"~":r.key="\x1B[18~";break;case 119:n?r.key="\x1B[19;"+(n+1)+"~":r.key="\x1B[19~";break;case 120:n?r.key="\x1B[20;"+(n+1)+"~":r.key="\x1B[20~";break;case 121:n?r.key="\x1B[21;"+(n+1)+"~":r.key="\x1B[21~";break;case 122:n?r.key="\x1B[23;"+(n+1)+"~":r.key="\x1B[23~";break;case 123:n?r.key="\x1B[24;"+(n+1)+"~":r.key="\x1B[24~";break;default:if(s.ctrlKey&&!s.shiftKey&&!s.altKey&&!s.metaKey)s.keyCode>=65&&s.keyCode<=90?r.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?r.key="\0":s.keyCode>=51&&s.keyCode<=55?r.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?r.key="\x7F":s.key==="/"?r.key="":s.keyCode===219?r.key="\x1B":s.keyCode===220?r.key="":s.keyCode===221&&(r.key="");else if((!e||i)&&s.altKey&&!s.metaKey){let a=yc[s.keyCode]?.[s.shiftKey?1:0];if(a)r.key="\x1B"+a;else if(s.keyCode>=65&&s.keyCode<=90){let l=s.ctrlKey?s.keyCode-64:s.keyCode+32,u=String.fromCharCode(l);s.shiftKey&&(u=u.toUpperCase()),r.key="\x1B"+u}else if(s.keyCode===32)r.key="\x1B"+(s.ctrlKey?"\0":" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let l=s.code.slice(3,4);s.shiftKey||(l=l.toLowerCase()),r.key="\x1B"+l,r.cancel=!0}}else if(e&&!s.altKey&&!s.ctrlKey&&!s.shiftKey&&s.metaKey)s.keyCode===65&&(r.type=1);else if(s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1)r.key=s.key;else if(s.key&&s.ctrlKey&&s.shiftKey)switch(s.code){case"Minus":r.key="";break;case"Digit2":r.key="\0";break;case"Digit6":r.key="";break}break}return r}var Yi=class{constructor(){this._functionalKeyCodes={Escape:27,Enter:13,Tab:9,Backspace:127,CapsLock:57358,ScrollLock:57359,NumLock:57360,PrintScreen:57361,Pause:57362,ContextMenu:57363,F13:57376,F14:57377,F15:57378,F16:57379,F17:57380,F18:57381,F19:57382,F20:57383,F21:57384,F22:57385,F23:57386,F24:57387,F25:57388,KP_0:57399,KP_1:57400,KP_2:57401,KP_3:57402,KP_4:57403,KP_5:57404,KP_6:57405,KP_7:57406,KP_8:57407,KP_9:57408,KP_Decimal:57409,KP_Divide:57410,KP_Multiply:57411,KP_Subtract:57412,KP_Add:57413,KP_Enter:57414,KP_Equal:57415,ShiftLeft:57441,ShiftRight:57447,ControlLeft:57442,ControlRight:57448,AltLeft:57443,AltRight:57449,MetaLeft:57444,MetaRight:57450,MediaPlayPause:57430,MediaStop:57432,MediaTrackNext:57435,MediaTrackPrevious:57436,AudioVolumeDown:57438,AudioVolumeUp:57439,AudioVolumeMute:57440};this._csiTildeKeys={Insert:2,Delete:3,PageUp:5,PageDown:6,F5:15,F6:17,F7:18,F8:19,F9:20,F10:21,F11:23,F12:24};this._csiLetterKeys={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"};this._ss3FunctionKeys={F1:"P",F2:"Q",F3:"R",F4:"S"}}_getNumpadKeyCode(t){if(t.code.startsWith("Numpad")){let e=t.code.slice(6);if(e>="0"&&e<="9")return 57399+parseInt(e,10);switch(e){case"Decimal":return 57409;case"Divide":return 57410;case"Multiply":return 57411;case"Subtract":return 57412;case"Add":return 57413;case"Enter":return 57414;case"Equal":return 57415}}}_getModifierKeyCode(t){switch(t.code){case"ShiftLeft":return 57441;case"ShiftRight":return 57447;case"ControlLeft":return 57442;case"ControlRight":return 57448;case"AltLeft":return 57443;case"AltRight":return 57449;case"MetaLeft":return 57444;case"MetaRight":return 57450}}_encodeModifiers(t){let e=0;return t.shiftKey&&(e|=1),t.altKey&&(e|=2),t.ctrlKey&&(e|=4),t.metaKey&&(e|=8),e>0?e+1:0}_getKeyCode(t){let e=this._getNumpadKeyCode(t);if(e!==void 0)return e;let i=this._getModifierKeyCode(t);if(i!==void 0)return i;let r=this._functionalKeyCodes[t.key];if(r!==void 0)return r;if(t.shiftKey&&t.code){if(t.code.startsWith("Digit")&&t.code.length===6){let n=t.code.charAt(5);if(n>="0"&&n<="9")return n.charCodeAt(0)}if(t.code.startsWith("Key")&&t.code.length===4)return t.code.charAt(3).toLowerCase().charCodeAt(0)}if(t.key.length===1){let n=t.key.codePointAt(0);return n>=65&&n<=90?n+32:n}}_isModifierKey(t){return t.key==="Shift"||t.key==="Control"||t.key==="Alt"||t.key==="Meta"}_buildCsiLetterSequence(t,e,i,r){let n=r&&i!==1;if(e>0||n){let o="\x1B[1;"+(e>0?e:"1");return n&&(o+=":"+i),o+=t,o}return"\x1B["+t}_buildSs3Sequence(t,e,i,r){let n=r&&i!==1;if(e>0||n){let o="\x1B[1;"+(e>0?e:"1");return n&&(o+=":"+i),o+=t,o}return"\x1BO"+t}_buildCsiTildeSequence(t,e,i,r){let n=r&&i!==1,o="\x1B["+t;return(e>0||n)&&(o+=";"+(e>0?e:"1"),n&&(o+=":"+i)),o+="~",o}_buildCsiUSequence(t,e,i,r,n,o,a){let l=!!(n&2),u=!!(n&4),d="\x1B["+e,c;u&&t.shiftKey&&t.key.length===1&&!o&&!a&&(c=t.key.codePointAt(0),d+=":"+c);let m=!!(n&16)&&r!==3&&t.key.length===1&&!o&&!a&&!t.ctrlKey?t.key.codePointAt(0):void 0,p=l&&r!==1&&(r===3||m===void 0);return(i>0||p||m!==void 0)&&(d+=";",i>0?d+=i:p&&(d+="1"),p&&(d+=":"+r)),m!==void 0&&(d+=";"+m),d+="u",d}evaluate(t,e,i=1){let r={type:0,cancel:!1,key:void 0},n=this._encodeModifiers(t),o=this._isModifierKey(t),a=!!(e&2);if(!a&&i===3||o&&!(e&8)&&!a)return r;let l=this._csiLetterKeys[t.key];if(l)return r.key=this._buildCsiLetterSequence(l,n,i,a),r.cancel=!0,r;let u=this._ss3FunctionKeys[t.key];if(u)return r.key=this._buildSs3Sequence(u,n,i,a),r.cancel=!0,r;let d=this._csiTildeKeys[t.key];if(d!==void 0)return r.key=this._buildCsiTildeSequence(d,n,i,a),r.cancel=!0,r;let c=this._getKeyCode(t);if(c===void 0)return r;let h=this._functionalKeyCodes[t.key]!==void 0||this._getNumpadKeyCode(t)!==void 0,m=!1;return e&8||a?m=!0:e&1&&(c===27||c===127||c===13||c===9||c===32||h?m=!0:n>0&&(t.shiftKey&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1?m=!1:m=!0)),m?(r.key=this._buildCsiUSequence(t,c,n,i,e,h,o),r.cancel=!0):t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&(r.key=t.key),r}static shouldUseProtocol(t){return t>0}};var un=class{constructor(){this._codeToVk={KeyA:65,KeyB:66,KeyC:67,KeyD:68,KeyE:69,KeyF:70,KeyG:71,KeyH:72,KeyI:73,KeyJ:74,KeyK:75,KeyL:76,KeyM:77,KeyN:78,KeyO:79,KeyP:80,KeyQ:81,KeyR:82,KeyS:83,KeyT:84,KeyU:85,KeyV:86,KeyW:87,KeyX:88,KeyY:89,KeyZ:90,Digit0:48,Digit1:49,Digit2:50,Digit3:51,Digit4:52,Digit5:53,Digit6:54,Digit7:55,Digit8:56,Digit9:57,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,F16:127,F17:128,F18:129,F19:130,F20:131,F21:132,F22:133,F23:134,F24:135,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,NumpadMultiply:106,NumpadAdd:107,NumpadSeparator:108,NumpadSubtract:109,NumpadDecimal:110,NumpadDivide:111,NumpadEnter:13,NumLock:144,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39,Home:36,End:35,PageUp:33,PageDown:34,Insert:45,Delete:46,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,CapsLock:20,ScrollLock:145,Escape:27,Enter:13,Tab:9,Space:32,Backspace:8,Pause:19,ContextMenu:93,PrintScreen:44,Semicolon:186,Equal:187,Comma:188,Minus:189,Period:190,Slash:191,Backquote:192,BracketLeft:219,Backslash:220,BracketRight:221,Quote:222,IntlBackslash:226};this._codeToScancode={KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,F11:87,F12:88,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadMultiply:55,NumpadAdd:78,NumpadSubtract:74,NumpadDecimal:83,NumpadDivide:53,NumpadEnter:28,NumLock:69,ArrowUp:72,ArrowDown:80,ArrowLeft:75,ArrowRight:77,Home:71,End:79,PageUp:73,PageDown:81,Insert:82,Delete:83,ShiftLeft:42,ShiftRight:54,ControlLeft:29,ControlRight:29,AltLeft:56,AltRight:56,CapsLock:58,ScrollLock:70,Escape:1,Enter:28,Tab:15,Space:57,Backspace:14,Pause:69,Semicolon:39,Equal:13,Comma:51,Minus:12,Period:52,Slash:53,Backquote:41,BracketLeft:26,Backslash:43,BracketRight:27,Quote:40};this._enhancedKeyCodes=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","Delete","NumpadEnter","NumpadDivide","ControlRight","AltRight","PrintScreen","Pause","ContextMenu","MetaLeft","MetaRight"]);this._keyToControlChar={Enter:13,Backspace:8,Tab:9,Escape:27}}_getVirtualKeyCode(t){let e=this._codeToVk[t.code];return e!==void 0?e:t.keyCode||0}_getScanCode(t){return this._codeToScancode[t.code]||0}_getUnicodeChar(t){if(t.ctrlKey&&!t.altKey&&!t.metaKey){if(t.key==="Enter")return 10;if(t.key==="Backspace")return 127}let e=this._keyToControlChar[t.key];if(e!==void 0)return e;if(t.key.length===1){let i=t.key.codePointAt(0)||0;if(t.ctrlKey&&!t.altKey&&!t.metaKey){if(i>=65&&i<=90)return i-64;if(i>=97&&i<=122)return i-96}return i}return 0}_getControlKeyState(t){let e=0;return t.shiftKey&&(e|=16),t.ctrlKey&&(t.code==="ControlRight"?e|=4:e|=8),t.altKey&&(t.code==="AltRight"?e|=1:e|=2),this._enhancedKeyCodes.has(t.code)&&(e|=256),e}evaluateKeyboardEvent(t,e){let i=this._getVirtualKeyCode(t),r=this._getScanCode(t),n=this._getUnicodeChar(t),o=e?1:0,a=this._getControlKeyState(t);return{type:0,cancel:!0,key:`\x1B[${i};${r};${n};${o};${a};1_`}}};var li=class{constructor(t,e){this._coreService=t;this._optionsService=e}_getWin32InputMode(){return this._win32InputMode??=new un,this._win32InputMode}_getKittyKeyboard(){return this._kittyKeyboard??=new Yi,this._kittyKeyboard}evaluateKeyDown(t){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(t,!0);let e=this._coreService.kittyKeyboard.flags;return this.useKitty?this._getKittyKeyboard().evaluate(t,e,t.repeat?2:1):Ta(t,this._coreService.decPrivateModes.applicationCursorKeys,dt,this._optionsService.rawOptions.macOptionIsMeta)}evaluateKeyUp(t){if(this.useWin32InputMode)return this._getWin32InputMode().evaluateKeyboardEvent(t,!1);let e=this._coreService.kittyKeyboard.flags;if(this.useKitty&&e&2)return this._getKittyKeyboard().evaluate(t,e,3)}get useKitty(){let t=this._coreService.kittyKeyboard.flags;return!!(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard&&Yi.shouldUseProtocol(t))}get useWin32InputMode(){return!!(this._optionsService.rawOptions.vtExtensions?.win32InputMode&&this._coreService.decPrivateModes.win32InputMode)}};li=A([b(0,be),b(1,N)],li);var $s=class{constructor(...t){this._entries=new Map;for(let[e,i]of t)this.set(e,i)}set(t,e){let i=this._entries.get(t);return this._entries.set(t,e),i}forEach(t){for(let[e,i]of this._entries.entries())t(e,i)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},dn=class{constructor(){this._services=new $s;this._services.set(At,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=_o(t).sort((o,a)=>o.index-a.index),r=[];for(let o of i){let a=this._services.get(o.id);if(!a)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${o.id._id}.`);r.push(a)}let n=i.length>0?i[0].index:e.length;if(e.length!==n)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${n+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}};var Tc={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ic="xterm.js: ",ci=class extends D{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=Tc[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;ithis._length)for(let i=this._length;i=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let o=i-1;o>=0;o--)this.set(e+o+r,this.get(e+o));let n=e+i+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,e){this._data[t*M+1]=e[0],e[1].length>1?(this._combined[t]=e[1],this._data[t*M+0]=t|2097152|e[2]<<22):this._data[t*M+0]=e[1].charCodeAt(0)|e[2]<<22}getWidth(t){return this._data[t*M+0]>>22}hasWidth(t){return this._data[t*M+0]&12582912}getFg(t){return this._data[t*M+1]}getBg(t){return this._data[t*M+2]}hasContent(t){return this._data[t*M+0]&4194303}getCodePoint(t){let e=this._data[t*M+0];return e&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):e&2097151}isCombined(t){return this._data[t*M+0]&2097152}getString(t){let e=this._data[t*M+0];return e&2097152?this._combined[t]:e&2097151?Pe(e&2097151):""}isProtected(t){return this._data[t*M+2]&536870912}loadCell(t,e){return hn=t*M,e.content=this._data[hn+0],e.fg=this._data[hn+1],e.bg=this._data[hn+2],e.content&2097152&&(e.combinedData=this._combined[t]),e.bg&268435456&&(e.extended=this._extendedAttrs[t]),e}setCell(t,e){e.content&2097152&&(this._combined[t]=e.combinedData),e.bg&268435456&&(this._extendedAttrs[t]=e.extended),this._data[t*M+0]=e.content,this._data[t*M+1]=e.fg,this._data[t*M+2]=e.bg}setCellFromCodepoint(t,e,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*M+0]=e|i<<22,this._data[t*M+1]=r.fg,this._data[t*M+2]=r.bg}addCodepointToCell(t,e,i){let r=this._data[t*M+0];r&2097152?this._combined[t]+=Pe(e):r&2097151?(this._combined[t]=Pe(r&2097151)+Pe(e),r&=-2097152,r|=2097152):r=e|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*M+0]=r}insertCells(t,e,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),e=0;--r)this.setCell(t+e+r,this.loadCell(t+r,xa));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o=t&&delete this._extendedAttrs[a]}}return this.length=t,i*4*Vs=0;--t)if(this._data[t*M+0]&4194303)return t+(this._data[t*M+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*M+0]&4194303||this._data[t*M+2]&50331648)return t+(this._data[t*M+0]>>22);return 0}copyCellsFrom(t,e,i,r,n){let o=t._data;if(n)for(let l=r-1;l>=0;l--){for(let u=0;u=e&&(this._combined[u-e+i]=t._combined[u])}}translateToString(t,e,i,r){e=e??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;e>22||1}return r&&r.push(e),n}};function wa(s,t,e,i,r,n){let o=[];for(let a=0;a=a&&i0&&(f>c||d[f].getTrimmedLength()===0);f--)_++;_>0&&(o.push(a+d.length-_),o.push(_)),a+=d.length-1}return o}function Da(s,t){let e=[],i=0,r=t[i],n=0;for(let o=0;oui(s,u,t)).reduce((l,u)=>l+u),n=0,o=0,a=0;for(;al&&(n-=l,o++);let u=s[o].getWidth(n-1)===2;u&&n--;let d=u?e-1:e;i.push(d),a+=d}return i}function ui(s,t,e){if(t===s.length-1)return s[t].getTrimmedLength();let i=!s[t].hasContent(e-1)&&s[t].getWidth(e-1)===1,r=s[t+1].getWidth(0)===2;return i&&r?e-1:e}var pn=class pn{constructor(t){this.line=t;this.isDisposed=!1;this._disposables=[];this._id=pn._nextId++;this._onDispose=this.register(new v);this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ti(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};pn._nextId=1;var fn=pn;var ne={},Ze=ne.B;ne[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};ne.A={"#":"\xA3"};ne.B=void 0;ne[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};ne.C=ne[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};ne.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};ne.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};ne.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};ne.E=ne[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};ne.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};ne.H=ne[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};ne["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};var Aa=4294967295,Zi=class{constructor(t,e,i){this._hasScrollback=t;this._optionsService=e;this._bufferService=i;this.ydisp=0;this.ybase=0;this.y=0;this.x=0;this.tabs={};this.savedY=0;this.savedX=0;this.savedCurAttrData=ee.clone();this.savedCharset=Ze;this.savedCharsets=[];this.savedGlevel=0;this.savedOriginMode=!1;this.savedWraparoundMode=!0;this.markers=[];this._nullCell=j.fromCharData([0,"",1,0]);this._whitespaceCell=j.fromCharData([0," ",1,32]);this._isClearing=!1;this._memoryCleanupQueue=new ni;this._memoryCleanupPosition=0;this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ji(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new rt),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new rt),this._whitespaceCell}getBlankLine(t,e){return new Xe(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&eAa?Aa:e}fillViewportRows(t){if(this.lines.length===0){t??=ee;let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new ji(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(ee),r=0,n=this._getCorrectBufferLength(e);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 Xe(t,i)));else for(let a=this._rows;a>e;a--)this.lines.length>e+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,t-1),this.y=Math.min(this.y,e-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let o=0;o0){let o=Math.max(0,this.lines.length-this.ybase-1);this.y=Math.min(this.y,o)}this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=wa(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(ee),i);if(r.length>0){let n=Da(this.lines,r);Ra(this.lines,n.layout),this._reflowLargerAdjustViewport(t,e,n.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(ee),n=i;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()<=t)continue;let u=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),u.unshift(l);if(!i){let S=this.ybase+this.y;if(S>=a&&S0&&(n.push({start:a+u.length+o,newLines:p}),o+=p.length),u.push(...p);let _=c.length-1,f=c[_];f===0&&(_--,f=c[_]);let L=u.length-h-1,R=d;for(;L>=0;){let S=Math.min(R,f);if(u[_]===void 0)break;if(u[_].copyCellsFrom(u[L],R-S,f-S,S,!0),f-=S,f===0&&(_--,f=c[_]),R-=S,R===0){L--;let k=Math.max(L,0);R=ui(u,k,this._cols)}}for(let S=0;S0;)this.ybase===0?this.y0){let a=[],l=[];for(let f=0;f=0;f--)if(h&&h.start>d+m){for(let L=h.newLines.length-1;L>=0;L--)this.lines.set(f--,h.newLines[L]);f++,a.push({index:d+1,amount:h.newLines.length}),m+=h.newLines.length,h=n[++c]}else this.lines.set(f,l[d--]);let p=0;for(let f=a.length-1;f>=0;f--)a[f].index+=p,this.lines.onInsertEmitter.fire(a[f]),p+=a[f].amount;let _=Math.max(0,u+o-this.lines.maxLength);_>0&&this.lines.onTrimEmitter.fire(_)}}translateBufferLineToString(t,e,i=0,r){let n=this.lines.get(t);return n?n.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t??=this.x;!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.linei.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}};var mn=class extends D{constructor(e,i){super();this._optionsService=e;this._bufferService=i;this._onBufferActivate=this._register(new v);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 Zi(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zi(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}};var js=2,Xs=1,di=class extends D{constructor(e){super();this.isUserScrolling=!1;this._onResize=this._register(new v);this.onResize=this._onResize.event;this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this.cols=Math.max(e.rawOptions.cols||0,js),this.rows=Math.max(e.rawOptions.rows||0,Xs),this.buffers=this._register(new mn(e,this)),this._register(this.buffers.onBufferActivate(i=>{this._onScroll.fire(i.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let r=this.cols!==e,n=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,i),this._cachedBlankLine=n),n.isWrapped=i;let o=r.ybase+r.scrollTop,a=r.ybase+r.scrollBottom;if(r.scrollTop===0){let l=r.lines.isFull;a===r.lines.length-1?l?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(a+1,0,n.clone()),l?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let l=a-o+1;r.lines.shiftElements(o+1,l-1,-1),r.lines.set(a,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,i){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(i||this._onScroll.fire(r.ydisp))}};di=A([b(0,N)],di);var hi={cols:80,rows:24,showCursorImmediately:!1,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:dt,windowOptions:{},windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",overviewRuler:{},quirks:{},vtExtensions:{}},wc=["normal","bold","100","200","300","400","500","600","700","800","900"],_n=class extends D{constructor(e){super();this._onOptionChange=this._register(new v);this.onOptionChange=this._onOptionChange.event;let i={...hi};for(let r in e)if(r in i)try{let n=e[r];i[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(O(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in hi))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,n)=>{if(!(r in hi))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=hi[e]),!Dc(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=hi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=wc.includes(i)?i:hi[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function Dc(s){return s==="block"||s==="underline"||s==="bar"}function fi(s,t=5){if(typeof s!="object")return s;let e=Array.isArray(s)?[]:{};for(let i in s)e[i]=t<=1?s[i]:s[i]&&fi(s[i],t-1);return e}var ka=Object.freeze({insertMode:!1}),Ca=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,colorSchemeUpdates:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,win32InputMode:!1,wraparound:!0}),Ma=()=>({flags:0,mainFlags:0,altFlags:0,mainStack:[],altStack:[]}),pi=class extends D{constructor(e,i,r){super();this._bufferService=e;this._logService=i;this._optionsService=r;this.isCursorHidden=!1;this._onData=this._register(new v);this.onData=this._onData.event;this._onUserInput=this._register(new v);this.onUserInput=this._onUserInput.event;this._onBinary=this._register(new v);this.onBinary=this._onBinary.event;this._onRequestScrollToBottom=this._register(new v);this.onRequestScrollToBottom=this._onRequestScrollToBottom.event;this.isCursorInitialized=r.rawOptions.showCursorImmediately??!1,this.modes=fi(ka),this.decPrivateModes=fi(Ca),this.kittyKeyboard=Ma()}reset(){this.modes=fi(ka),this.decPrivateModes=fi(Ca),this.kittyKeyboard=Ma()}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};pi=A([b(0,F),b(1,cr),b(2,N)],pi);var Pa={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button===4||s.action!==1?!1:(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>!(s.action===32&&s.button===3)},ANY:{events:31,restrict:s=>!0}};function Zs(s,t){let e=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(e|=64,e|=s.action):(e|=s.button&3,s.button&4&&(e|=64),s.button&8&&(e|=128),s.action===32?e|=32:s.action===0&&!t&&(e|=3)),e}var Qs=String.fromCharCode,Oa={DEFAULT:s=>{let t=[Zs(s,!1)+32,s.col+32,s.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Qs(t[0])}${Qs(t[1])}${Qs(t[2])}`},SGR:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Zs(s,!0)};${s.col};${s.row}${t}`},SGR_PIXELS:s=>{let t=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${Zs(s,!0)};${s.x};${s.y}${t}`}},mi=class extends D{constructor(e,i,r){super();this._bufferService=e;this._coreService=i;this._optionsService=r;this._protocols={};this._encodings={};this._activeProtocol="";this._activeEncoding="";this._lastEvent=null;this._wheelPartialScroll=0;this._onProtocolChange=this._register(new v);this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Pa))this.addProtocol(n,Pa[n]);for(let n of Object.keys(Oa))this.addEncoding(n,Oa[n]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}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,i,r){if(e.deltaY===0||e.shiftKey||i===void 0||r===void 0)return 0;let n=i/r,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=n+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,i,r){if(r){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};mi=A([b(0,F),b(1,be),b(2,N)],mi);var Js=[[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]],Ac=[[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]],se;function kc(s,t){let e=0,i=t.length-1,r;if(st[i][1])return!1;for(;i>=e;)if(r=e+i>>1,s>t[r][1])e=r+1;else if(s=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),r=i===0&&e!==0;if(r){let n=Me.extractWidth(e);n===0?r=!1:n>i&&(i=n)}return Me.createPropertyValue(0,i,r)}};var Me=class s{constructor(){this._providers=Object.create(null);this._active="";this._onChange=new v;this.onChange=this._onChange.event;let t=new bn;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,e,i=!1){return(t&16777215)<<3|(e&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let e=0,i=0,r=t.length;for(let n=0;n=r)return e+this.wcwidth(o);let u=t.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:e+=this.wcwidth(u)}let a=this.charProperties(o,i),l=s.extractWidth(a);s.extractShouldJoin(a)&&(l-=s.extractWidth(i)),e+=l,i=a}return e}charProperties(t,e){return this._activeProvider.charProperties(t,e)}};var vn=class{constructor(){this.glevel=0;this._charsets=[]}get charsets(){return this._charsets}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function eo(s){let e=s.buffer.lines.get(s.buffer.ybase+s.buffer.y-1)?.get(s.cols-1),i=s.buffer.lines.get(s.buffer.ybase+s.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Qi=2147483647,Cc=256,_i=class s{constructor(t=32,e=32){this.maxLength=t;this.maxSubParamsLength=e;if(e>Cc)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(e),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let e=new s;if(!t.length)return e;for(let i=Array.isArray(t[0])?1:0;i>8,r=this._subParamsIdx[e]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Qi?Qi:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Qi?Qi:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let e=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-e>0?this._subParams.subarray(e,i):null}getSubParamsAll(){let t={};for(let e=0;e>8,r=this._subParamsIdx[e]&255;r-i>0&&(t[e]=this._subParams.slice(i,r))}return t}addDigit(t){let e;if(this._rejectDigits||!(e=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[e-1];i[e-1]=~r?Math.min(r*10+t,Qi):t}};var Ji=[],gn=class{constructor(){this._state=0;this._active=Ji;this._id=-1;this._handlers=Object.create(null);this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]??=[];let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ji}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=Ji,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ji,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Ke(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Ji,this._id=-1,this._state=0}}},Sn=class Sn{constructor(t){this._handler=t;this._data="";this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ke(t,e,i),this._data.length>Sn._payloadLimit&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}};Sn._payloadLimit=1e7;var ve=Sn;var er=[],En=class{constructor(){this._handlers=Object.create(null);this._active=er;this._ident=0;this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=er}registerHandler(t,e){this._handlers[t]??=[];let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=er,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||er,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ke(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].unhook(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=er,this._ident=0}},tr=new _i;tr.addParam(0);var yn=class yn{constructor(t){this._handler=t;this._data="";this._params=tr;this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():tr,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ke(t,e,i),this._data.length>yn._payloadLimit&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=tr,this._data="",this._hitLimit=!1,i));return this._params=tr,this._data="",this._hitLimit=!1,e}};yn._payloadLimit=1e7;var ir=yn;var bi=[],Tn=class{constructor(){this._state=0;this._active=bi;this._id=-1;this._handlers=Object.create(null);this._handlerFb=()=>{};this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]??=[];let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=bi}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=bi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||bi,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Ke(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){this._state!==3&&(this._state===1&&e0&&this._put(t,e,i))}end(t,e=!0){if(this._state!==0){if(this._state!==3){if(this._state===1){this._active=bi,this._id=-1,this._state=0;return}if(!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,n=this._stack.fallThrough,this._stack.paused=!1),!n&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}}this._active=bi,this._id=-1,this._state=0}}},xn=class xn{constructor(t){this._handler=t;this._data="";this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ke(t,e,i),this._data.length>xn._payloadLimit&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}};xn._payloadLimit=1e7;var In=xn;var to=class{constructor(t){this.table=new Uint16Array(t)}setDefault(t,e){this.table.fill(t<<8|e)}add(t,e,i,r){this.table[e<<8|t]=i<<8|r}addMany(t,e,i,r){for(let n=0;nl),i=(a,l)=>e.slice(a,l),r=i(32,127),n=i(0,24);n.push(25),n.push.apply(n,i(28,32));let o=i(0,15);s.setDefault(1,0),s.addMany(r,0,2,0);for(let a of o)s.addMany([24,26,153,154],a,3,0),s.addMany(i(128,144),a,3,0),s.addMany(i(144,152),a,3,0),s.add(156,a,0,0),s.add(27,a,11,1),s.add(157,a,4,8),s.addMany([152,158],a,0,7),s.add(159,a,15,14),s.add(155,a,11,3),s.add(144,a,11,9);return s.addMany(n,0,3,0),s.addMany(n,1,3,1),s.add(127,1,0,1),s.addMany(n,8,0,8),s.addMany(n,3,3,3),s.add(127,3,0,3),s.addMany(n,4,3,4),s.add(127,4,0,4),s.addMany(n,6,3,6),s.addMany(n,5,3,5),s.add(127,5,0,5),s.addMany(n,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(r,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(i(28,32),8,0,8),s.addMany([88,94],1,0,7),s.addMany(r,7,0,7),s.addMany(n,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(95,1,15,14),s.addMany(r,14,16,14),s.addMany(n,14,0,14),s.add(127,14,0,14),s.addMany([27,156,24,26],14,17,0),s.add(91,1,11,3),s.addMany(i(64,127),3,7,0),s.addMany(i(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(i(48,60),4,8,4),s.addMany(i(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(i(32,64),6,0,6),s.add(127,6,0,6),s.addMany(i(64,127),6,0,0),s.addMany(i(32,48),3,9,5),s.addMany(i(32,48),5,9,5),s.addMany(i(48,64),5,0,6),s.addMany(i(64,127),5,7,0),s.addMany(i(32,48),4,9,5),s.addMany(i(32,48),1,9,2),s.addMany(i(32,48),2,9,2),s.addMany(i(48,127),2,10,0),s.addMany(i(48,80),1,10,0),s.addMany(i(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(i(96,127),1,10,0),s.add(80,1,11,9),s.addMany(n,9,0,9),s.add(127,9,0,9),s.addMany(i(28,32),9,0,9),s.addMany(i(32,48),9,9,12),s.addMany(i(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(n,11,0,11),s.addMany(i(32,128),11,0,11),s.addMany(i(28,32),11,0,11),s.addMany(n,10,0,10),s.add(127,10,0,10),s.addMany(i(28,32),10,0,10),s.addMany(i(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(i(32,48),10,9,12),s.addMany(n,12,0,12),s.add(127,12,0,12),s.addMany(i(28,32),12,0,12),s.addMany(i(32,48),12,9,12),s.addMany(i(48,64),12,0,11),s.addMany(i(64,127),12,12,13),s.addMany(i(64,127),10,12,13),s.addMany(i(64,127),9,12,13),s.addMany(n,13,13,13),s.addMany(r,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(Ie,0,2,0),s.add(Ie,8,5,8),s.add(Ie,6,0,6),s.add(Ie,11,0,11),s.add(Ie,13,13,13),s.add(Ie,14,16,14),s})(),wn=class extends D{constructor(e=Mc){super();this._transitions=e;this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0};this.initialState=0,this.currentState=this.initialState,this._params=new _i,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,n)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(O(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new gn),this._dcsParser=this._register(new En),this._apcParser=this._register(new Tn),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;oa||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(i[0]>n||n>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=n,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]??=[];let n=this._escHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]??=[];let n=this._csiHandlers[r];return n.push(i),{dispose:()=>{let o=n.indexOf(i);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}registerApcHandler(e,i){return this._apcParser.registerHandler(e,i)}clearApcHandler(e){this._apcParser.clearHandler(e)}setApcHandlerFallback(e){this._apcParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._apcParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,r,n,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,i,r){let n=0,o=0,a=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&d>-1){for(;d>=0&&(l=u[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._parseStack.handlerPos=d,l}this._parseStack.handlers=[];break;case 4:if(r===!1&&d>-1){for(;d>=0&&(l=u[d](),l!==!0);d--)if(l instanceof Promise)return this._parseStack.handlerPos=d,l}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(n!==24&&n!==26,r),l)return l;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],l=this._oscParser.end(n!==24&&n!==26,r),l)return l;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 7:if(n=e[this._parseStack.chunkPos],l=this._apcParser.end(n!==24&&n!==26,r),l)return l;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&255}for(let u=a;u>8){case 2:for(let _=u+1;;++_){if(_>=i||(n=e[_])<32||n>126&&n=i||(n=e[_])<32||n>126&&n=i||(n=e[_])<32||n>126&&n=i||(n=e[_])<32||n>126&&n=0&&(l=c[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._preserveStack(3,c,h,o,u),l;h<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++u47&&n<60);u--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let m=this._escHandlers[this._collect<<8|n],p=m?m.length-1:-1;for(;p>=0&&(l=m[p](),l!==!0);p--)if(l instanceof Promise)return this._preserveStack(4,m,p,o,u),l;p<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let _=u+1;;++_)if(_>=i||(n=e[_])===24||n===26||n===27||n>127&&n=i||(n=e[_])<32||n>127&&n=i||(n=e[_])===24||n===26||n===27||n===156||n>127&&n>4:n>>8}return i}}function io(s,t){let e=s.toString(16),i=e.length<2?"0"+e:e;switch(t){case 4:return e[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function Fa(s,t=16){let[e,i,r]=s;return`rgb:${io(e,t)}/${io(i,t)}/${io(r,t)}`}var Ha="6.1.0-beta.141";var Nc={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ht=131072,Ua=10;function Wa(s,t){if(s>24)return t.setWinLines||!1;switch(s){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Ka=5e3,Ga=0,Dn=class extends D{constructor(e,i,r,n,o,a,l,u,d=new wn){super();this._bufferService=e;this._charsetService=i;this._coreService=r;this._logService=n;this._optionsService=o;this._oscLinkService=a;this._coreMouseService=l;this._unicodeService=u;this._parser=d;this._parseBuffer=new Uint32Array(4096);this._stringDecoder=new or;this._utf8Decoder=new ar;this._windowTitle="";this._iconName="";this._windowTitleStack=[];this._iconNameStack=[];this._curAttrData=ee.clone();this._eraseAttrDataInternal=ee.clone();this._onRequestBell=this._register(new v);this.onRequestBell=this._onRequestBell.event;this._onRequestRefreshRows=this._register(new v);this.onRequestRefreshRows=this._onRequestRefreshRows.event;this._onRequestReset=this._register(new v);this.onRequestReset=this._onRequestReset.event;this._onRequestSendFocus=this._register(new v);this.onRequestSendFocus=this._onRequestSendFocus.event;this._onRequestSyncScrollBar=this._register(new v);this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event;this._onRequestWindowsOptionsReport=this._register(new v);this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event;this._onA11yChar=this._register(new v);this.onA11yChar=this._onA11yChar.event;this._onA11yTab=this._register(new v);this.onA11yTab=this._onA11yTab.event;this._onCursorMove=this._register(new v);this.onCursorMove=this._onCursorMove.event;this._onLineFeed=this._register(new v);this.onLineFeed=this._onLineFeed.event;this._onScroll=this._register(new v);this.onScroll=this._onScroll.event;this._onTitleChange=this._register(new v);this.onTitleChange=this._onTitleChange.event;this._onColor=this._register(new v);this.onColor=this._onColor.event;this._onRequestColorSchemeQuery=this._register(new v);this.onRequestColorSchemeQuery=this._onRequestColorSchemeQuery.event;this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0};this._specialColors=[256,257,258];this._register(this._parser),this._dirtyRowTracker=new rr(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:h.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,h,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:h,data:m})}),this._parser.setDcsHandlerFallback((c,h,m)=>{h==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:h,payload:m})}),this._parser.setPrintHandler((c,h,m)=>this.print(c,h,m)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"^"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({prefix:">",final:"q"},c=>this.sendXtVersion(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.registerCsiHandler({prefix:"=",final:"u"},c=>this.kittyKeyboardSet(c)),this._parser.registerCsiHandler({prefix:"?",final:"u"},c=>this.kittyKeyboardQuery(c)),this._parser.registerCsiHandler({prefix:">",final:"u"},c=>this.kittyKeyboardPush(c)),this._parser.registerCsiHandler({prefix:"<",final:"u"},c=>this.kittyKeyboardPop(c)),this._parser.setExecuteHandler("\x07",()=>this.bell()),this._parser.setExecuteHandler(` + `,()=>this.lineFeed()),this._parser.setExecuteHandler("\v",()=>this.lineFeed()),this._parser.setExecuteHandler("\f",()=>this.lineFeed()),this._parser.setExecuteHandler("\r",()=>this.carriageReturn()),this._parser.setExecuteHandler("\b",()=>this.backspace()),this._parser.setExecuteHandler(" ",()=>this.tab()),this._parser.setExecuteHandler("",()=>this.shiftOut()),this._parser.setExecuteHandler("",()=>this.shiftIn()),this._parser.setExecuteHandler("\x84",()=>this.index()),this._parser.setExecuteHandler("\x85",()=>this.nextLine()),this._parser.setExecuteHandler("\x88",()=>this.tabSet()),this._parser.registerOscHandler(0,new ve(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new ve(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new ve(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new ve(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new ve(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new ve(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new ve(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new ve(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new ve(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new ve(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new ve(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new ve(c=>this.restoreCursorColor(c))),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 c in ne)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new ir((c,h)=>this.requestStatusString(c,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){if(this._logService.logLevel<=3){let i,r=new Promise((n,o)=>{i=setTimeout(()=>o("#SLOW_TIMEOUT"),Ka)});Promise.race([e,r]).then(()=>{i!==void 0&&clearTimeout(i)},n=>{if(i!==void 0&&clearTimeout(i),n!=="#SLOW_TIMEOUT")throw n;console.warn(`async parser handler taking longer than ${Ka} ms`)})}}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let r,n=this._activeBuffer.x,o=this._activeBuffer.y,a=0,l=this._parseStack.paused;if(l){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ht&&(a=this._parseStack.position+ht)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.lengthht)for(let c=a;c0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let p=this._parser.precedingJoinState;for(let _=i;_u){if(d){let P=m,S=this._activeBuffer.x-R;if(this._activeBuffer.x=R,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),!m)return;for(R>0&&m instanceof Xe&&m.copyCellsFrom(P,S,0,R,!1);S=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(c&&(m.insertCells(this._activeBuffer.x,o-R,this._activeBuffer.getNullCell(h)),m.getWidth(u-1)===2&&m.setCellFromCodepoint(u-1,0,1,h)),m.setCellFromCodepoint(this._activeBuffer.x++,n,o,h),o>0)for(;--o;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=p,this._activeBuffer.x0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Wa(r.params[0],this._optionsService.rawOptions.windowOptions)?i(r):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new ir(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new ve(i))}registerApcHandler(e,i){return this._parser.registerApcHandler(e,new In(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,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(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,r,n=!1,o=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a&&(a.replaceCells(i,r,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(a.isWrapped=!1))}_resetBufferLine(e,i=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,i=!1){this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);r=this._bufferService.cols){let o=this._activeBuffer.lines.get(r+1);o&&(o.isWrapped=!1)}for(;r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.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 c=d;for(let h=1;h0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent("\x1B[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent("\x1B[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent("\x1B[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent("\x1B[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent("\x1B[>83;40003;0c")),!0}sendXtVersion(e){return e.params[0]>0||this._coreService.triggerDataEvent(`\x1BP>|xterm.js(${Ha})\x1B\\`),!0}_is(e){return(this._optionsService.rawOptions.termName+"").startsWith(e)}setMode(e){for(let i=0;i(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(r||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:a}=this._coreMouseService,l=this._coreService,{buffers:u,cols:d}=this._bufferService,{active:c,alt:h}=u,m=this._optionsService.rawOptions,p=(L,R)=>(l.triggerDataEvent(`\x1B[${i?"":"?"}${L};${R}$y`),!0),_=L=>L?1:2,f=e.params[0];return i?f===2?p(f,4):f===4?p(f,_(l.modes.insertMode)):f===12?p(f,3):f===20?p(f,_(m.convertEol)):p(f,0):f===1?p(f,_(n.applicationCursorKeys)):f===3?p(f,m.windowOptions.setWinLines?d===80?2:d===132?1:0:0):f===6?p(f,_(n.origin)):f===7?p(f,_(n.wraparound)):f===8?p(f,3):f===9?p(f,_(o==="X10")):f===12?p(f,_(m.cursorBlink)):f===25?p(f,_(!l.isCursorHidden)):f===45?p(f,_(n.reverseWraparound)):f===66?p(f,_(n.applicationKeypad)):f===67?p(f,4):f===1e3?p(f,_(o==="VT200")):f===1002?p(f,_(o==="DRAG")):f===1003?p(f,_(o==="ANY")):f===1004?p(f,_(n.sendFocus)):f===1005?p(f,4):f===1006?p(f,_(a==="SGR")):f===1015?p(f,4):f===1016?p(f,_(a==="SGR_PIXELS")):f===1048?p(f,1):f===47||f===1047||f===1049?p(f,_(c===h)):f===2004?p(f,_(n.bracketedPasteMode)):f===2026?p(f,_(n.synchronizedOutput)):f===9001&&this._optionsService.rawOptions.vtExtensions?.win32InputMode?p(f,_(n.win32InputMode)):p(f,0)}_updateAttrColor(e,i,r,n,o){return i===2?(e|=50331648,e&=-16777216,e|=Re.fromColorRGB([r,n,o])):i===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,i,r){let n=[0,0,-1,0,0,0],o=0,a=0;do{if(n[a+o]=e.params[i+a],e.hasSubParams(i+a)){let l=e.getSubParams(i+a),u=0;do n[1]===5&&(o=1),n[a+u+1+o]=l[u];while(++u=2||n[1]===2&&a+o>=5)break;n[1]&&(o=1)}while(++a+i5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=ee.fg,e.bg=ee.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let i=e.length,r,n=this._curAttrData;for(let o=0;o=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=ee.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=ee.bg&16777215):r===38||r===48||r===58?o+=this._extractColor(e,o,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===221&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?n.fg&=-134217729:r===222&&(this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl??!0)?n.bg&=-134217729:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent("\x1B[0n");break;case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[${i};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let i=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`\x1B[?${i};${r}R`);break;case 15:break;case 25:break;case 26:break;case 53:break;case 996:(this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery??!0)&&this._onRequestColorSchemeQuery.fire();break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ee.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=e.length===0?1:e.params[0];if(i===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){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 r=i%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let i=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Wa(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`\x1B[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ua&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ua&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._activeBuffer.savedCharsets=this._charsetService.charsets.slice(),this._activeBuffer.savedGlevel=this._charsetService.glevel,this._activeBuffer.savedOriginMode=this._coreService.decPrivateModes.origin,this._activeBuffer.savedWraparoundMode=this._coreService.decPrivateModes.wraparound,!0}restoreCursor(e){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;for(let i=0;i1;){let n=r.shift(),o=r.shift();if(/^\d+$/.exec(n)){let a=parseInt(n);if(za(a))if(o==="?")i.push({type:0,index:a});else{let l=ro(o);l&&i.push({type:1,index:a,color:l})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let r=e.slice(0,i).trim(),n=e.slice(i+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,o=r.findIndex(a=>a.startsWith("id="));return o!==-1&&(n=r[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let r=e.split(";");for(let n=0;n=this._specialColors.length);++n,++i)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=ro(r[n]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],r=e.split(";");for(let n=0;n=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ee.clone(),this._eraseAttrDataInternal=ee.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new j;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i(this._coreService.triggerDataEvent(`\x1B${l}\x1B\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions,a={block:2,underline:4,bar:6};return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${a[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}kittyKeyboardSet(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let i=e.params[0]||0,r=e.params[1]||1,n=this._coreService.kittyKeyboard;switch(r){case 1:n.flags=i;break;case 2:n.flags|=i;break;case 3:n.flags&=~i;break}return!0}kittyKeyboardQuery(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let i=this._coreService.kittyKeyboard.flags;return this._coreService.triggerDataEvent(`\x1B[?${i}u`),!0}kittyKeyboardPush(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let i=e.params[0]||0,r=this._coreService.kittyKeyboard,o=this._bufferService.buffer===this._bufferService.buffers.alt?r.altStack:r.mainStack;return o.length>=16&&o.shift(),o.push(r.flags),r.flags=i,!0}kittyKeyboardPop(e){if(!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard)return!0;let i=Math.max(1,e.params[0]||1),r=this._coreService.kittyKeyboard,o=this._bufferService.buffer===this._bufferService.buffers.alt?r.altStack:r.mainStack;for(let a=0;a0;a++)r.flags=o.pop();return o.length===0&&i>0&&(r.flags=0),!0}},rr=class{constructor(t){this._bufferService=t;this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){tthis.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Ga=t,t=e,e=Ga),tthis.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};rr=A([b(0,F)],rr);function za(s){return 0<=s&&s<256}var Fc=5e7,$a=12,Hc=50,Rn=class extends D{constructor(e){super();this._action=e;this._writeBuffer=[];this._callbacks=[];this._pendingData=0;this._bufferOffset=0;this._isSyncWriting=!1;this._syncCalls=0;this._didUserInput=!1;this._onWriteParsed=this._register(new v);this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}flushSync(){if(this._isSyncWriting)return;this._isSyncWriting=!0;let e;for(;e=this._writeBuffer.shift();){this._action(e);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._writeBuffer.length=0,this._callbacks.length=0,this._isSyncWriting=!1}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>Fc)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],o=this._action(n,i);if(o){let l=u=>performance.now()-r>=$a?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(r,u);o.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(l);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=$a)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Hc&&(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 vi=class{constructor(t){this._bufferService=t;this._nextId=1;this._entriesWithId=new Map;this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let l=e.addMarker(e.ybase+e.y),u={data:t,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._dataByLinkId.set(u.id,u),u.id}let i=t,r=this._getEntryIdKey(i),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,e.ybase+e.y),n.id;let o=e.addMarker(e.ybase+e.y),a={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(r=>r.line!==e)){let r=this._bufferService.buffer.addMarker(e);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(t){return this._dataByLinkId.get(t)?.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};vi=A([b(0,F)],vi);var Va=!1,Ln=class extends D{constructor(e){super();this._windowsWrappingHeuristics=this._register(new Ae);this._onBinary=this._register(new v);this.onBinary=this._onBinary.event;this._onData=this._register(new v);this.onData=this._onData.event;this._onLineFeed=this._register(new v);this.onLineFeed=this._onLineFeed.event;this._onRender=this._register(new v);this.onRender=this._onRender.event;this._onResize=this._register(new v);this.onResize=this._onResize.event;this._onWriteParsed=this._register(new v);this.onWriteParsed=this._onWriteParsed.event;this._onScroll=this._register(new v);this._instantiationService=new dn,this.optionsService=this._register(new _n(e)),this._instantiationService.setService(N,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(di)),this._instantiationService.setService(F,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ci)),this._instantiationService.setService(cr,this._logService),this.coreService=this._register(this._instantiationService.createInstance(pi)),this._instantiationService.setService(be,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mi)),this._instantiationService.setService(lr,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Me)),this._instantiationService.setService(vo,this.unicodeService),this._charsetService=this._instantiationService.createInstance(vn),this._instantiationService.setService(bo,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(vi),this._instantiationService.setService(ur,this._oscLinkService),this._inputHandler=this._register(new Dn(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ce.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(ce.forward(this._bufferService.onResize,this._onResize)),this._register(ce.forward(this.coreService.onData,this._onData)),this._register(ce.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["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 Rn((i,r)=>this._inputHandler.parse(i,r))),this._register(ce.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new v),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!Va&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Va=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,js),i=Math.max(i,Xs),this._writeBuffer.flushSync(),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}registerApcHandler(e,i){return this._inputHandler.registerApcHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0&&(e=i.backend==="conpty"&&i.buildNumber<21376),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(eo.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(eo(this._bufferService),!1))),this._windowsWrappingHeuristics.value=O(()=>{for(let i of e)i.dispose()})}}};var te=0,An=class{constructor(t){this._getKey=t;this._array=[];this._insertedValues=[];this._flushInsertedTask=new ni;this._isFlushingInserted=!1;this._deletedIndices=[];this._flushDeletedTask=new ni;this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((n,o)=>this._getKey(n)-this._getKey(o)),e=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(r[n]=t[e],e++):r[n]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(te=this._search(e),te===-1)||this._getKey(this._array[te])!==e)return!1;do if(this._array[te]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(te),!0;while(++ten-o),e=0,i=new Array(this._array.length-t.length),r=0;for(let n=0;n0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(te=this._search(t),!(te<0||te>=this._array.length)&&this._getKey(this._array[te])===t))do yield this._array[te];while(++te=this._array.length)&&this._getKey(this._array[te])===t))do e(this._array[te]);while(++te=e;){let r=e+i>>1,n=this._getKey(this._array[r]);if(n>t)i=r-1;else if(n0&&this._getKey(this._array[r-1])===t;)r--;return r}}return e}};var no=0,qa=0,so=0,Ya=0,kn=class extends D{constructor(){super();this._decorations=new An(e=>e?.marker.line);this._onDecorationRegistered=this._register(new v);this.onDecorationRegistered=this._onDecorationRegistered.event;this._onDecorationRemoved=this._register(new v);this.onDecorationRemoved=this._onDecorationRemoved.event;this._register(O(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new oo(e);if(i){let r=i.marker.onDispose(()=>i.dispose()),n=i.onDispose(()=>{n.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),r.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,r){let n=0,o=0,a=0,l=0;for(let u of this._decorations.values())a=u.marker.line,l=a+(u.options.height??1),!(i=l)&&(n=u.options.x??0,o=n+(u.options.width??1),e>=n&&e=Ya)&&(no=o.options.x??0,qa=no+(o.options.width??1),e>=no&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}};var ja=20;var Xa=!1,wt=class extends D{constructor(e,i,r,n){super();this._terminal=e;this._coreBrowserService=r;this._renderService=n;this._rowColumns=new WeakMap;this._liveRegionLineCount=0;this._charsToConsume=[];this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;athis._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Cn(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");Xa?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=o.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(o.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(o.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +diff --git a/lib/xterm.mjs.map b/lib/xterm.mjs.map +index b1518012bdbcac979e0af18d52ac0dff7805858a..7f9dc2b178d39eea5d25062dd6848c1ffe086bc3 100644 +--- a/lib/xterm.mjs.map ++++ b/lib/xterm.mjs.map +@@ -1,7 +1,7 @@ + { + "version": 3, + "sources": ["../src/browser/LocalizableStrings.ts", "../src/browser/Clipboard.ts", "../src/common/input/TextDecoder.ts", "../src/common/buffer/AttributeData.ts", "../src/common/buffer/CellData.ts", "../src/common/services/ServiceRegistry.ts", "../src/common/services/Services.ts", "../src/browser/OscLinkProvider.ts", "../src/browser/services/Services.ts", "../src/common/Lifecycle.ts", "../src/vs/base/browser/window.ts", "../src/vs/base/common/errors.ts", "../src/vs/base/common/functional.ts", "../src/vs/base/common/arraysFind.ts", "../src/vs/base/common/arrays.ts", "../src/vs/base/common/collections.ts", "../src/vs/base/common/map.ts", "../src/vs/base/common/iterator.ts", "../src/vs/base/common/lifecycle.ts", "../src/vs/base/common/linkedList.ts", "../src/vs/base/common/stopwatch.ts", "../src/vs/base/common/event.ts", "../src/vs/base/browser/browser.ts", "../src/vs/base/common/platform.ts", "../src/vs/base/browser/canIUse.ts", "../src/vs/base/common/keyCodes.ts", "../src/vs/base/common/keybindings.ts", "../src/vs/base/browser/keyboardEvent.ts", "../src/vs/base/browser/iframe.ts", "../src/vs/base/browser/mouseEvent.ts", "../src/vs/base/common/cancellation.ts", "../src/vs/base/common/symbols.ts", "../src/vs/base/common/async.ts", "../src/vs/base/common/strings.ts", "../src/vs/base/common/hash.ts", "../src/vs/base/browser/dom.ts", "../src/vs/base/browser/fastDomNode.ts", "../src/vs/base/browser/globalPointerMoveMonitor.ts", "../src/vs/base/common/decorators.ts", "../src/vs/base/browser/touch.ts", "../src/vs/base/browser/ui/widget.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts", "../src/vs/base/common/scrollable.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts", "../src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/scrollbarState.ts", "../src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts", "../src/vs/base/browser/ui/scrollbar/scrollableElement.ts", "../src/common/Event.ts", "../src/browser/Viewport.ts", "../src/browser/decorations/BufferDecorationRenderer.ts", "../src/browser/decorations/ColorZoneStore.ts", "../src/browser/decorations/OverviewRulerRenderer.ts", "../src/browser/input/CompositionHelper.ts", "../src/common/Color.ts", "../src/browser/services/CharacterJoinerService.ts", "../src/browser/renderer/shared/RendererUtils.ts", "../src/browser/renderer/dom/DomRendererRowFactory.ts", "../src/browser/renderer/dom/WidthCache.ts", "../src/browser/renderer/shared/SelectionRenderModel.ts", "../src/browser/renderer/dom/DomRenderer.ts", "../src/browser/services/CharSizeService.ts", "../src/browser/services/CoreBrowserService.ts", "../src/browser/services/LinkProviderService.ts", "../src/browser/input/Mouse.ts", "../src/browser/services/MouseService.ts", "../src/browser/RenderDebouncer.ts", "../src/common/Platform.ts", "../src/common/TaskQueue.ts", "../src/browser/services/RenderService.ts", "../src/browser/input/MoveToCell.ts", "../src/browser/selection/SelectionModel.ts", "../src/common/buffer/BufferRange.ts", "../src/browser/services/SelectionService.ts", "../src/common/MultiKeyMap.ts", "../src/browser/ColorContrastCache.ts", "../src/browser/Types.ts", "../src/browser/services/ThemeService.ts", "../src/common/input/Keyboard.ts", "../src/common/input/KittyKeyboard.ts", "../src/common/input/Win32InputMode.ts", "../src/browser/services/KeyboardService.ts", "../src/common/services/InstantiationService.ts", "../src/common/services/LogService.ts", "../src/common/CircularList.ts", "../src/common/buffer/BufferLine.ts", "../src/common/buffer/BufferReflow.ts", "../src/common/buffer/Marker.ts", "../src/common/data/Charsets.ts", "../src/common/buffer/Buffer.ts", "../src/common/buffer/BufferSet.ts", "../src/common/services/BufferService.ts", "../src/common/services/OptionsService.ts", "../src/common/Clone.ts", "../src/common/services/CoreService.ts", "../src/common/services/CoreMouseService.ts", "../src/common/input/UnicodeV6.ts", "../src/common/services/UnicodeService.ts", "../src/common/services/CharsetService.ts", "../src/common/WindowsMode.ts", "../src/common/parser/Params.ts", "../src/common/parser/OscParser.ts", "../src/common/parser/DcsParser.ts", "../src/common/parser/ApcParser.ts", "../src/common/parser/EscapeSequenceParser.ts", "../src/common/input/XParseColor.ts", "../src/common/Version.ts", "../src/common/InputHandler.ts", "../src/common/input/WriteBuffer.ts", "../src/common/services/OscLinkService.ts", "../src/common/CoreTerminal.ts", "../src/common/SortedList.ts", "../src/common/services/DecorationService.ts", "../src/browser/TimeBasedDebouncer.ts", "../src/browser/AccessibilityManager.ts", "../src/browser/Linkifier.ts", "../src/browser/CoreBrowserTerminal.ts", "../src/common/public/AddonManager.ts", "../src/common/public/BufferLineApiView.ts", "../src/common/public/BufferApiView.ts", "../src/common/public/BufferNamespaceApi.ts", "../src/common/public/ParserApi.ts", "../src/common/public/UnicodeApi.ts", "../src/browser/public/Terminal.ts"], +- "sourcesContent": ["/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// This file contains strings that get exported in the API so they can be localized\n\nlet promptLabelInternal = 'Terminal input';\nconst promptLabel = {\n get: () => promptLabelInternal,\n set: (value: string) => promptLabelInternal = value\n};\n\nlet tooMuchOutputInternal = 'Too much output to announce, navigate to rows manually to read';\nconst tooMuchOutput = {\n get: () => tooMuchOutputInternal,\n set: (value: string) => tooMuchOutputInternal = value\n};\n\nexport {\n promptLabel,\n tooMuchOutput\n};\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService, optionsService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate\n // pair conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number {\n if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {\n return 1;\n }\n return this.fg & FgFlags.UNDERLINE;\n }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\n public isProtected(): number { return this.bg & BgFlags.PROTECTED; }\n public isOverline(): number { return this.bg & BgFlags.OVERLINE; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n public getUnderlineVariantOffset(): number {\n return this.extended.underlineVariantOffset;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n private _ext: number = 0;\n public get ext(): number {\n if (this._urlId) {\n return (\n (this._ext & ~ExtFlags.UNDERLINE_STYLE) |\n (this.underlineStyle << 26)\n );\n }\n return this._ext;\n }\n public set ext(value: number) { this._ext = value; }\n\n public get underlineStyle(): UnderlineStyle {\n // Always return the URL style if it has one\n if (this._urlId) {\n return UnderlineStyle.DASHED;\n }\n return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;\n }\n public set underlineStyle(value: UnderlineStyle) {\n this._ext &= ~ExtFlags.UNDERLINE_STYLE;\n this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;\n }\n\n public get underlineColor(): number {\n return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n public set underlineColor(value: number) {\n this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n\n private _urlId: number = 0;\n public get urlId(): number {\n return this._urlId;\n }\n public set urlId(value: number) {\n this._urlId = value;\n }\n\n public get underlineVariantOffset(): number {\n const val = (this._ext & ExtFlags.VARIANT_OFFSET) >> 29;\n if (val < 0) {\n return val ^ 0xFFFFFFF8;\n }\n return val;\n }\n public set underlineVariantOffset(value: number) {\n this._ext &= ~ExtFlags.VARIANT_OFFSET;\n this._ext |= (value << 29) & ExtFlags.VARIANT_OFFSET;\n }\n\n constructor(\n ext: number = 0,\n urlId: number = 0\n ) {\n this._ext = ext;\n this._urlId = urlId;\n }\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this._ext, this._urlId);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator._id = id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';\nimport { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/Types';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport type { Emitter, IEvent } from 'common/Event';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n onResize: IEvent;\n onScroll: IEvent;\n scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n scrollLines(disp: number, suppressScrollEvent?: boolean): void;\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport interface IBufferResizeEvent {\n cols: number;\n rows: number;\n colsChanged: boolean;\n rowsChanged: boolean;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n serviceBrand: undefined;\n\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: IEvent;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n\n /**\n * Process wheel event taking partial scroll into account.\n */\n consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number;\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n readonly kittyKeyboard: IKittyKeyboardState;\n\n readonly onData: IEvent;\n readonly onUserInput: IEvent;\n readonly onBinary: IEvent;\n readonly onRequestScrollToBottom: IEvent;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasUserInput Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n readonly charsets: (ICharset | undefined)[];\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n _id: string;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs = TArgs extends [] ? []\n : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs : TArgs\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n serviceBrand: undefined;\n\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport enum LogLevelEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n OFF = 5\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n readonly logLevel: LogLevelEnum;\n\n trace(message: any, ...optionalParams: any[]): void;\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n /**\n * Read only access to the raw options object, this is an internal-only fast path for accessing\n * single options without any validation as we trust TypeScript to enforce correct usage\n * internally.\n */\n readonly rawOptions: Required;\n\n /**\n * Options as exposed through the public API, this property uses getters and setters with\n * validation which makes it safer but slower. {@link rawOptions} should be used for pretty much\n * all internal usage for performance reasons.\n */\n readonly options: Required;\n\n /**\n * Adds an event listener for when any option changes.\n */\n readonly onOptionChange: IEvent;\n\n /**\n * Adds an event listener for when a specific option changes, this is a convenience method that is\n * preferred over {@link onOptionChange} when only a single option is being listened to.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onSpecificOptionChange(key: T, listener: (arg1: Required[T]) => any): IDisposable;\n\n /**\n * Adds an event listener for when a set of specific options change, this is a convenience method\n * that is preferred over {@link onOptionChange} when multiple options are being listened to and\n * handled the same way.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface ITerminalOptions {\n allowProposedApi?: boolean;\n allowTransparency?: boolean;\n altClickMovesCursor?: boolean;\n cols?: number;\n convertEol?: boolean;\n cursorBlink?: boolean;\n cursorStyle?: CursorStyle;\n cursorWidth?: number;\n cursorInactiveStyle?: CursorInactiveStyle;\n disableStdin?: boolean;\n documentOverride?: any | null;\n drawBoldTextInBrightColors?: boolean;\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n ignoreBracketedPasteMode?: boolean;\n letterSpacing?: number;\n lineHeight?: number;\n linkHandler?: ILinkHandler | null;\n logLevel?: LogLevel;\n logger?: ILogger | null;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n minimumContrastRatio?: number;\n reflowCursorLine?: boolean;\n rescaleOverlappingGlyphs?: boolean;\n rightClickSelectsWord?: boolean;\n rows?: number;\n showCursorImmediately?: boolean;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollOnUserInput?: boolean;\n scrollSensitivity?: number;\n smoothScrollDuration?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsPty?: IWindowsPty;\n windowOptions?: IWindowOptions;\n wordSeparator?: string;\n overviewRuler?: IOverviewRulerOptions;\n quirks?: ITerminalQuirks;\n scrollOnEraseInDisplay?: boolean;\n vtExtensions?: IVtExtensions;\n\n [key: string]: any;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selectionForeground?: string;\n selectionBackground?: string;\n selectionInactiveBackground?: string;\n scrollbarSliderBackground?: string;\n scrollbarSliderHoverBackground?: string;\n scrollbarSliderActiveBackground?: string;\n overviewRulerBorder?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n extendedAnsi?: string[];\n}\n\nexport interface ITerminalQuirks {\n allowSetCursorBlink?: boolean;\n}\n\nexport interface IVtExtensions {\n kittyKeyboard?: boolean;\n kittySgrBoldFaintControl?: boolean;\n win32InputMode?: boolean;\n colorSchemeQuery?: boolean;\n}\n\nexport const IOscLinkService = createDecorator('OscLinkService');\nexport interface IOscLinkService {\n serviceBrand: undefined;\n /**\n * Registers a link to the service, returning the link ID. The link data is managed by this\n * service and will be freed when this current cursor position is trimmed off the buffer.\n */\n registerLink(linkData: IOscLinkData): number;\n /**\n * Adds a line to a link if needed.\n */\n addLineToLink(linkId: number, y: number): void;\n /** Get the link data associated with a link ID. */\n getLinkData(linkId: number): IOscLinkData | undefined;\n}\n\n/*\n * Width and Grapheme_Cluster_Break properties of a character as a bit mask.\n *\n * bit 0: shouldJoin - should combine with preceding character.\n * bit 1..2: wcwidth - see UnicodeCharWidth.\n * bit 3..31: class of character (currently only 4 bits are used).\n * This is used to determined grapheme clustering - i.e. which codepoints\n * are to be combined into a single compound character.\n *\n * Use the UnicodeService static function createPropertyValue to create a\n * UnicodeCharProperties; use extractShouldJoin, extractWidth, and\n * extractCharKind to extract the components.\n */\nexport type UnicodeCharProperties = number;\n\n/**\n * Width in columns of a character.\n * In a CJK context, \"half-width\" characters (such as Latin) are width 1,\n * while \"full-width\" characters (such as Kanji) are 2 columns wide.\n * Combining characters (such as accents) are width 0.\n */\nexport type UnicodeCharWidth = 0 | 1 | 2;\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: IEvent;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): UnicodeCharWidth;\n getStringCellWidth(s: string): number;\n /**\n * Return character width and type for grapheme clustering.\n * If preceding != 0, it is the return code from the previous character;\n * in that case the result specifies if the characters should be joined.\n */\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): UnicodeCharWidth;\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport const IDecorationService = createDecorator('DecorationService');\nexport interface IDecorationService extends IDisposable {\n serviceBrand: undefined;\n readonly decorations: IterableIterator;\n readonly onDecorationRegistered: IEvent;\n readonly onDecorationRemoved: IEvent;\n registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;\n reset(): void;\n /**\n * Trigger a callback over the decoration at a cell (in no particular order). This uses a callback\n * instead of an iterator as it's typically used in hot code paths.\n */\n forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;\n}\nexport interface IInternalDecoration extends IDecoration {\n readonly options: IDecorationOptions;\n readonly backgroundColorRGB: IColor | undefined;\n readonly foregroundColorRGB: IColor | undefined;\n readonly onRenderEmitter: Emitter;\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILink } from 'browser/Types';\nimport { ILinkProvider } from 'browser/services/Services';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';\n\nexport class OscLinkProvider implements ILinkProvider {\n private readonly _workCell = new CellData();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IOscLinkService private readonly _oscLinkService: IOscLinkService\n ) {\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const line = this._bufferService.buffer.lines.get(y - 1);\n if (!line) {\n callback(undefined);\n return;\n }\n\n const result: ILink[] = [];\n const linkHandler = this._optionsService.rawOptions.linkHandler;\n const cell = this._workCell;\n const lineLength = line.getTrimmedLength();\n let currentLinkId = -1;\n let currentStart = -1;\n let finishLink = false;\n for (let x = 0; x < lineLength; x++) {\n // Minor optimization, only check for content if there isn't a link in case the link ends with\n // a null cell\n if (currentStart === -1 && !line.hasContent(x)) {\n continue;\n }\n\n line.loadCell(x, cell);\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n if (currentStart === -1) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n continue;\n } else {\n finishLink = cell.extended.urlId !== currentLinkId;\n }\n } else {\n if (currentStart !== -1) {\n finishLink = true;\n }\n }\n\n if (finishLink || (currentStart !== -1 && x === lineLength - 1)) {\n const text = this._oscLinkService.getLinkData(currentLinkId)?.uri;\n if (text) {\n // These ranges are 1-based\n const range: IBufferRange = {\n start: {\n x: currentStart + 1,\n y\n },\n end: {\n // Offset end x if it's a link that ends on the last cell in the line\n x: x + (!finishLink && x === lineLength - 1 ? 1 : 0),\n y\n }\n };\n\n let ignoreLink = false;\n if (!linkHandler?.allowNonHttpProtocols) {\n try {\n const parsed = new URL(text);\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n ignoreLink = true;\n }\n } catch {\n // Ignore invalid URLs to prevent unexpected behaviors\n ignoreLink = true;\n }\n }\n\n if (!ignoreLink) {\n // OSC links always use underline and pointer decorations\n result.push({\n text,\n range,\n activate: (e, text) => (linkHandler ? linkHandler.activate(e, text, range) : defaultActivate(e, text)),\n hover: (e, text) => linkHandler?.hover?.(e, text, range),\n leave: (e, text) => linkHandler?.leave?.(e, text, range)\n });\n }\n }\n finishLink = false;\n\n // Clear link or start a new link if one starts immediately\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n } else {\n currentStart = -1;\n currentLinkId = -1;\n }\n }\n }\n\n // TODO: Handle fetching and returning other link ranges to underline other links with the same\n // id\n callback(result);\n }\n}\n\nfunction defaultActivate(e: MouseEvent, uri: string): void {\n const answer = confirm(`Do you want to navigate to ${uri}?\\n\\nWARNING: This link could potentially be dangerous`);\n if (answer) {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { AllColorIndex, IDisposable, IKeyboardResult } from 'common/Types';\nimport type { IEvent } from 'common/Event';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: IEvent;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n\n readonly onDprChange: IEvent;\n readonly onWindowChange: IEvent;\n\n /**\n * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.\n * requestAnimationFrame) should be invoked in the context of this window. This should be set when\n * the window hosting the xterm.js instance changes.\n */\n window: Window & typeof globalThis;\n /**\n * The document of the primary window to be used to create elements when working with multiple\n * windows. This is defined by the documentOverride setting.\n */\n readonly mainDocument: Document;\n /**\n * Helper for getting the devicePixelRatio of the parent window.\n */\n readonly dpr: number;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: IEvent;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedViewportChange: IEvent<{ start: number, end: number }>;\n /**\n * Fires on render\n */\n onRender: IEvent<{ start: number, end: number }>;\n onRefreshRequest: IEvent<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n addRefreshCallback(callback: FrameRequestCallback): number;\n\n refreshRows(start: number, end: number, sync?: boolean): void;\n clearTextureAtlas(): void;\n resize(cols: number, rows: number): void;\n hasRenderer(): boolean;\n setRenderer(renderer: IRenderer): void;\n handleDevicePixelRatioChange(): void;\n handleResize(cols: number, rows: number): void;\n handleCharSizeChanged(): void;\n handleBlur(): void;\n handleFocus(): void;\n handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n handleCursorMove(): void;\n clear(): void;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: IEvent;\n readonly onRequestRedraw: IEvent;\n readonly onRequestScrollLines: IEvent;\n readonly onSelectionChange: IEvent;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n handleMouseDown(event: MouseEvent): void;\n isCellInSelection(x: number, y: number): boolean;\n}\n\nexport const ICharacterJoinerService = createDecorator('CharacterJoinerService');\nexport interface ICharacterJoinerService {\n serviceBrand: undefined;\n\n register(handler: (text: string) => [number, number][]): number;\n deregister(joinerId: number): boolean;\n getJoinedCharacters(row: number): [number, number][];\n}\n\nexport const IThemeService = createDecorator('ThemeService');\nexport interface IThemeService {\n serviceBrand: undefined;\n\n readonly colors: ReadonlyColorSet;\n\n readonly onChangeColors: IEvent;\n\n restoreColor(slot?: AllColorIndex): void;\n /**\n * Allows external modifying of colors in the theme, this is used instead of {@link colors} to\n * prevent accidental writes.\n */\n modifyColors(callback: (colors: IColorSet) => void): void;\n}\n\n\nexport const ILinkProviderService = createDecorator('LinkProviderService');\nexport interface ILinkProviderService extends IDisposable {\n serviceBrand: undefined;\n readonly linkProviders: ReadonlyArray;\n registerLinkProvider(linkProvider: ILinkProvider): IDisposable;\n}\nexport interface ILinkProvider {\n provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;\n}\n\nexport const IKeyboardService = createDecorator('KeyboardService');\nexport interface IKeyboardService {\n serviceBrand: undefined;\n evaluateKeyDown(event: KeyboardEvent): IKeyboardResult;\n evaluateKeyUp(event: KeyboardEvent): IKeyboardResult | undefined;\n readonly useKitty: boolean;\n readonly useWin32InputMode: boolean;\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal lifecycle utilities for xterm.js core.\n * Simplified from VS Code's lifecycle.ts - no tracking/leak detection.\n */\n\nexport interface IDisposable {\n dispose(): void;\n}\n\nexport function toDisposable(fn: () => void): IDisposable {\n return { dispose: fn };\n}\n\nexport function dispose(disposables: T | T[] | undefined): void {\n if (!disposables) {\n return;\n }\n if (Array.isArray(disposables)) {\n for (const d of disposables) {\n d.dispose();\n }\n } else {\n disposables.dispose();\n }\n}\n\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n return toDisposable(() => dispose(disposables));\n}\n\nexport class DisposableStore implements IDisposable {\n private readonly _disposables = new Set();\n private _isDisposed = false;\n\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n public add(o: T): T {\n if (this._isDisposed) {\n o.dispose();\n } else {\n this._disposables.add(o);\n }\n return o;\n }\n\n public dispose(): void {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.clear();\n }\n}\n\nexport abstract class Disposable implements IDisposable {\n protected readonly _store = new DisposableStore();\n\n public dispose(): void {\n this._store.dispose();\n }\n\n protected _register(o: T): T {\n return this._store.add(o);\n }\n}\n\nexport class MutableDisposable implements IDisposable {\n private _value: T | undefined;\n private _isDisposed = false;\n\n public get value(): T | undefined {\n return this._isDisposed ? undefined : this._value;\n }\n\n public set value(value: T | undefined) {\n if (this._isDisposed || value === this._value) {\n return;\n }\n this._value?.dispose();\n this._value = value;\n }\n\n public clear(): void {\n this.value = undefined;\n }\n\n public dispose(): void {\n this._isDisposed = true;\n this._value?.dispose();\n this._value = undefined;\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport type CodeWindow = Window & typeof globalThis & {\n\treadonly vscodeWindowId: number;\n};\n\nexport function ensureCodeWindow(targetWindow: Window, fallbackWindowId: number): asserts targetWindow is CodeWindow {\n}\n\n// eslint-disable-next-line no-restricted-globals\nexport const mainWindow = (typeof window === 'object' ? window : globalThis) as CodeWindow;\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport interface ErrorListenerCallback {\n\t(error: any): void;\n}\n\nexport interface ErrorListenerUnbind {\n\t(): void;\n}\n\n// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n\tprivate unexpectedErrorHandler: (e: any) => void;\n\tprivate listeners: ErrorListenerCallback[];\n\n\tconstructor() {\n\n\t\tthis.listeners = [];\n\n\t\tthis.unexpectedErrorHandler = function (e: any) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (e.stack) {\n\t\t\t\t\tif (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n\t\t\t\t\t\tthrow new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(e.message + '\\n\\n' + e.stack);\n\t\t\t\t}\n\n\t\t\t\tthrow e;\n\t\t\t}, 0);\n\t\t};\n\t}\n\n\taddListener(listener: ErrorListenerCallback): ErrorListenerUnbind {\n\t\tthis.listeners.push(listener);\n\n\t\treturn () => {\n\t\t\tthis._removeListener(listener);\n\t\t};\n\t}\n\n\tprivate emit(e: any): void {\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(e);\n\t\t});\n\t}\n\n\tprivate _removeListener(listener: ErrorListenerCallback): void {\n\t\tthis.listeners.splice(this.listeners.indexOf(listener), 1);\n\t}\n\n\tsetUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\t\tthis.unexpectedErrorHandler = newUnexpectedErrorHandler;\n\t}\n\n\tgetUnexpectedErrorHandler(): (e: any) => void {\n\t\treturn this.unexpectedErrorHandler;\n\t}\n\n\tonUnexpectedError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t\tthis.emit(e);\n\t}\n\n\t// For external errors, we don't want the listeners to be called\n\tonUnexpectedExternalError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t}\n}\n\nexport const errorHandler = new ErrorHandler();\n\n/** @skipMangle */\nexport function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\terrorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nexport function isSigPipeError(e: unknown): e is Error {\n\tif (!e || typeof e !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst cast = e as Record;\n\treturn cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\n\nexport function onUnexpectedError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedError(e);\n\t}\n\treturn undefined;\n}\n\nexport function onUnexpectedExternalError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedExternalError(e);\n\t}\n\treturn undefined;\n}\n\nexport interface SerializedError {\n\treadonly $isError: true;\n\treadonly name: string;\n\treadonly message: string;\n\treadonly stack: string;\n\treadonly noTelemetry: boolean;\n}\n\nexport function transformErrorForSerialization(error: Error): SerializedError;\nexport function transformErrorForSerialization(error: any): any;\nexport function transformErrorForSerialization(error: any): any {\n\tif (error instanceof Error) {\n\t\tconst { name, message } = error;\n\t\tconst stack: string = (error).stacktrace || (error).stack;\n\t\treturn {\n\t\t\t$isError: true,\n\t\t\tname,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t\tnoTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n\t\t};\n\t}\n\n\t// return as is\n\treturn error;\n}\n\nexport function transformErrorFromSerialization(data: SerializedError): Error {\n\tlet error: Error;\n\tif (data.noTelemetry) {\n\t\terror = new ErrorNoTelemetry();\n\t} else {\n\t\terror = new Error();\n\t\terror.name = data.name;\n\t}\n\terror.message = data.message;\n\terror.stack = data.stack;\n\treturn error;\n}\n\n// see https://github.com/v8/v8/wiki/Stack%20Trace%20API#basic-stack-traces\nexport interface V8CallSite {\n\tgetThis(): unknown;\n\tgetTypeName(): string | null;\n\tgetFunction(): Function | undefined;\n\tgetFunctionName(): string | null;\n\tgetMethodName(): string | null;\n\tgetFileName(): string | null;\n\tgetLineNumber(): number | null;\n\tgetColumnNumber(): number | null;\n\tgetEvalOrigin(): string | undefined;\n\tisToplevel(): boolean;\n\tisEval(): boolean;\n\tisNative(): boolean;\n\tisConstructor(): boolean;\n\ttoString(): string;\n}\n\nconst canceledName = 'Canceled';\n\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error: any): boolean {\n\tif (error instanceof CancellationError) {\n\t\treturn true;\n\t}\n\treturn error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n\tconstructor() {\n\t\tsuper(canceledName);\n\t\tthis.name = this.message;\n\t}\n}\n\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled(): Error {\n\tconst error = new Error(canceledName);\n\terror.name = error.message;\n\treturn error;\n}\n\nexport function illegalArgument(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal argument: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal argument');\n\t}\n}\n\nexport function illegalState(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal state: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal state');\n\t}\n}\n\nexport class ReadonlyError extends TypeError {\n\tconstructor(name?: string) {\n\t\tsuper(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n\t}\n}\n\nexport function getErrorMessage(err: any): string {\n\tif (!err) {\n\t\treturn 'Error';\n\t}\n\n\tif (err.message) {\n\t\treturn err.message;\n\t}\n\n\tif (err.stack) {\n\t\treturn err.stack.split('\\n')[0];\n\t}\n\n\treturn String(err);\n}\n\nexport class NotImplementedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotImplemented');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class NotSupportedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotSupported');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class ExpectedError extends Error {\n\treadonly isExpected = true;\n}\n\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nexport class ErrorNoTelemetry extends Error {\n\toverride readonly name: string;\n\n\tconstructor(msg?: string) {\n\t\tsuper(msg);\n\t\tthis.name = 'CodeExpectedError';\n\t}\n\n\tpublic static fromError(err: Error): ErrorNoTelemetry {\n\t\tif (err instanceof ErrorNoTelemetry) {\n\t\t\treturn err;\n\t\t}\n\n\t\tconst result = new ErrorNoTelemetry();\n\t\tresult.message = err.message;\n\t\tresult.stack = err.stack;\n\t\treturn result;\n\t}\n\n\tpublic static isErrorNoTelemetry(err: Error): err is ErrorNoTelemetry {\n\t\treturn err.name === 'CodeExpectedError';\n\t}\n}\n\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nexport class BugIndicatingError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message || 'An unexpected bug occurred.');\n\t\tObject.setPrototypeOf(this, BugIndicatingError.prototype);\n\n\t\t// Because we know for sure only buggy code throws this,\n\t\t// we definitely want to break here and fix the bug.\n\t\t// eslint-disable-next-line no-debugger\n\t\t// debugger;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction(this: unknown, fn: T, fnDidRunCallback?: () => void): T {\n\tconst _this = this;\n\tlet didCall = false;\n\tlet result: unknown;\n\n\treturn function () {\n\t\tif (didCall) {\n\t\t\treturn result;\n\t\t}\n\n\t\tdidCall = true;\n\t\tif (fnDidRunCallback) {\n\t\t\ttry {\n\t\t\t\tresult = fn.apply(_this, arguments);\n\t\t\t} finally {\n\t\t\t\tfnDidRunCallback();\n\t\t\t}\n\t\t} else {\n\t\t\tresult = fn.apply(_this, arguments);\n\t\t}\n\n\t\treturn result;\n\t} as unknown as T;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Comparator } from './arrays';\n\nexport function findLast(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdx(array, predicate);\n\tif (idx === -1) {\n\t\treturn undefined;\n\t}\n\treturn array[idx];\n}\n\nexport function findLastIdx(array: readonly T[], predicate: (item: T) => boolean, fromIndex = array.length - 1): number {\n\tfor (let i = fromIndex; i >= 0; i--) {\n\t\tconst element = array[i];\n\n\t\tif (predicate(element)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nexport function findLastMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdxMonotonous(array, predicate);\n\treturn idx === -1 ? undefined : array[idx];\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nexport function findLastIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\ti = k + 1;\n\t\t} else {\n\t\t\tj = k;\n\t\t}\n\t}\n\treturn i - 1;\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nexport function findFirstMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n\treturn idx === array.length ? undefined : array[idx];\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nexport function findFirstIdxMonotonousOrArrLen(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\tj = k;\n\t\t} else {\n\t\t\ti = k + 1;\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function findFirstIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n\treturn idx === array.length ? -1 : idx;\n}\n\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nexport class MonotonousArray {\n\tpublic static assertInvariants = false;\n\n\tprivate _findLastMonotonousLastIdx = 0;\n\tprivate _prevFindLastPredicate: ((item: T) => boolean) | undefined;\n\n\tconstructor(private readonly _array: readonly T[]) {\n\t}\n\n\t/**\n\t * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n\t * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n\t */\n\tfindLastMonotonous(predicate: (item: T) => boolean): T | undefined {\n\t\tif (MonotonousArray.assertInvariants) {\n\t\t\tif (this._prevFindLastPredicate) {\n\t\t\t\tfor (const item of this._array) {\n\t\t\t\t\tif (this._prevFindLastPredicate(item) && !predicate(item)) {\n\t\t\t\t\t\tthrow new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._prevFindLastPredicate = predicate;\n\t\t}\n\n\t\tconst idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n\t\tthis._findLastMonotonousLastIdx = idx + 1;\n\t\treturn idx === -1 ? undefined : this._array[idx];\n\t}\n}\n\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) > 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) >= 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMin(array: readonly T[], comparator: Comparator): T | undefined {\n\treturn findFirstMax(array, (a, b) => -comparator(a, b));\n}\n\nexport function findMaxIdx(array: readonly T[], comparator: Comparator): number {\n\tif (array.length === 0) {\n\t\treturn -1;\n\t}\n\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, array[maxIdx]) > 0) {\n\t\t\tmaxIdx = i;\n\t\t}\n\t}\n\treturn maxIdx;\n}\n\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst(items: Iterable, mapFn: (value: T) => R | undefined): R | undefined {\n\tfor (const value of items) {\n\t\tconst mapped = mapFn(value);\n\t\tif (mapped !== undefined) {\n\t\t\treturn mapped;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { CancellationError } from 'vs/base/common/errors';\nimport { ISplice } from 'vs/base/common/sequence';\nimport { findFirstIdxMonotonousOrArrLen } from './arraysFind';\n\n/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nexport function tail(array: ArrayLike, n: number = 0): T | undefined {\n\treturn array[array.length - (1 + n)];\n}\n\nexport function tail2(arr: T[]): [T[], T] {\n\tif (arr.length === 0) {\n\t\tthrow new Error('Invalid tail call');\n\t}\n\n\treturn [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\n\nexport function equals(one: ReadonlyArray | undefined, other: ReadonlyArray | undefined, itemEquals: (a: T, b: T) => boolean = (a, b) => a === b): boolean {\n\tif (one === other) {\n\t\treturn true;\n\t}\n\n\tif (!one || !other) {\n\t\treturn false;\n\t}\n\n\tif (one.length !== other.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0, len = one.length; i < len; i++) {\n\t\tif (!itemEquals(one[i], other[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nexport function removeFastWithoutKeepingOrder(array: T[], index: number) {\n\tconst last = array.length - 1;\n\tif (index < last) {\n\t\tarray[index] = array[last];\n\t}\n\tarray.pop();\n}\n\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n * if they are equal, a negative number if the first element precedes the\n * second one in the sorting order, or a positive number if the second element\n * precedes the first one.\n * @return See {@link binarySearch2}\n */\nexport function binarySearch(array: ReadonlyArray, key: T, comparator: (op1: T, op2: T) => number): number {\n\treturn binarySearch2(array.length, i => comparator(array[i], key));\n}\n\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n * collection and returns zero if the value at this index is equal to the\n * search key, a negative number if the value precedes the search key in the\n * sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n * result is -(n+1) (or ~n, using bitwise notation), where n is the index\n * where the key should be inserted to maintain the sorting order.\n */\nexport function binarySearch2(length: number, compareToKey: (index: number) => number): number {\n\tlet low = 0,\n\t\thigh = length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = ((low + high) / 2) | 0;\n\t\tconst comp = compareToKey(mid);\n\t\tif (comp < 0) {\n\t\t\tlow = mid + 1;\n\t\t} else if (comp > 0) {\n\t\t\thigh = mid - 1;\n\t\t} else {\n\t\t\treturn mid;\n\t\t}\n\t}\n\treturn -(low + 1);\n}\n\ntype Compare = (a: T, b: T) => number;\n\n\nexport function quickSelect(nth: number, data: T[], compare: Compare): T {\n\n\tnth = nth | 0;\n\n\tif (nth >= data.length) {\n\t\tthrow new TypeError('invalid index');\n\t}\n\n\tconst pivotValue = data[Math.floor(data.length * Math.random())];\n\tconst lower: T[] = [];\n\tconst higher: T[] = [];\n\tconst pivots: T[] = [];\n\n\tfor (const value of data) {\n\t\tconst val = compare(value, pivotValue);\n\t\tif (val < 0) {\n\t\t\tlower.push(value);\n\t\t} else if (val > 0) {\n\t\t\thigher.push(value);\n\t\t} else {\n\t\t\tpivots.push(value);\n\t\t}\n\t}\n\n\tif (nth < lower.length) {\n\t\treturn quickSelect(nth, lower, compare);\n\t} else if (nth < lower.length + pivots.length) {\n\t\treturn pivots[0];\n\t} else {\n\t\treturn quickSelect(nth - (lower.length + pivots.length), higher, compare);\n\t}\n}\n\nexport function groupBy(data: ReadonlyArray, compare: (a: T, b: T) => number): T[][] {\n\tconst result: T[][] = [];\n\tlet currentGroup: T[] | undefined = undefined;\n\tfor (const element of data.slice(0).sort(compare)) {\n\t\tif (!currentGroup || compare(currentGroup[0], element) !== 0) {\n\t\t\tcurrentGroup = [element];\n\t\t\tresult.push(currentGroup);\n\t\t} else {\n\t\t\tcurrentGroup.push(element);\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nexport function* groupAdjacentBy(items: Iterable, shouldBeGrouped: (item1: T, item2: T) => boolean): Iterable {\n\tlet currentGroup: T[] | undefined;\n\tlet last: T | undefined;\n\tfor (const item of items) {\n\t\tif (last !== undefined && shouldBeGrouped(last, item)) {\n\t\t\tcurrentGroup!.push(item);\n\t\t} else {\n\t\t\tif (currentGroup) {\n\t\t\t\tyield currentGroup;\n\t\t\t}\n\t\t\tcurrentGroup = [item];\n\t\t}\n\t\tlast = item;\n\t}\n\tif (currentGroup) {\n\t\tyield currentGroup;\n\t}\n}\n\nexport function forEachAdjacent(arr: T[], f: (item1: T | undefined, item2: T | undefined) => void): void {\n\tfor (let i = 0; i <= arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n\t}\n}\n\nexport function forEachWithNeighbors(arr: T[], f: (before: T | undefined, element: T, after: T | undefined) => void): void {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n\t}\n}\n\ninterface IMutableSplice extends ISplice {\n\treadonly toInsert: T[];\n\tdeleteCount: number;\n}\n\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nexport function sortedDiff(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): ISplice[] {\n\tconst result: IMutableSplice[] = [];\n\n\tfunction pushSplice(start: number, deleteCount: number, toInsert: T[]): void {\n\t\tif (deleteCount === 0 && toInsert.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst latest = result[result.length - 1];\n\n\t\tif (latest && latest.start + latest.deleteCount === start) {\n\t\t\tlatest.deleteCount += deleteCount;\n\t\t\tlatest.toInsert.push(...toInsert);\n\t\t} else {\n\t\t\tresult.push({ start, deleteCount, toInsert });\n\t\t}\n\t}\n\n\tlet beforeIdx = 0;\n\tlet afterIdx = 0;\n\n\twhile (true) {\n\t\tif (beforeIdx === before.length) {\n\t\t\tpushSplice(beforeIdx, 0, after.slice(afterIdx));\n\t\t\tbreak;\n\t\t}\n\t\tif (afterIdx === after.length) {\n\t\t\tpushSplice(beforeIdx, before.length - beforeIdx, []);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst beforeElement = before[beforeIdx];\n\t\tconst afterElement = after[afterIdx];\n\t\tconst n = compare(beforeElement, afterElement);\n\t\tif (n === 0) {\n\t\t\t// equal\n\t\t\tbeforeIdx += 1;\n\t\t\tafterIdx += 1;\n\t\t} else if (n < 0) {\n\t\t\t// beforeElement is smaller -> before element removed\n\t\t\tpushSplice(beforeIdx, 1, []);\n\t\t\tbeforeIdx += 1;\n\t\t} else if (n > 0) {\n\t\t\t// beforeElement is greater -> after element added\n\t\t\tpushSplice(beforeIdx, 0, [afterElement]);\n\t\t\tafterIdx += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nexport function delta(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): { removed: T[]; added: T[] } {\n\tconst splices = sortedDiff(before, after, compare);\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\n\tfor (const splice of splices) {\n\t\tremoved.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n\t\tadded.push(...splice.toInsert);\n\t}\n\n\treturn { removed, added };\n}\n\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nexport function top(array: ReadonlyArray, compare: (a: T, b: T) => number, n: number): T[] {\n\tif (n === 0) {\n\t\treturn [];\n\t}\n\tconst result = array.slice(0, n).sort(compare);\n\ttopStep(array, compare, result, n, array.length);\n\treturn result;\n}\n\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nexport function topAsync(array: T[], compare: (a: T, b: T) => number, n: number, batch: number, token?: CancellationToken): Promise {\n\tif (n === 0) {\n\t\treturn Promise.resolve([]);\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\t(async () => {\n\t\t\tconst o = array.length;\n\t\t\tconst result = array.slice(0, n).sort(compare);\n\t\t\tfor (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n\t\t\t\tif (i > n) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n\t\t\t\t}\n\t\t\t\tif (token && token.isCancellationRequested) {\n\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t}\n\t\t\t\ttopStep(array, compare, result, i, m);\n\t\t\t}\n\t\t\treturn result;\n\t\t})()\n\t\t\t.then(resolve, reject);\n\t});\n}\n\nfunction topStep(array: ReadonlyArray, compare: (a: T, b: T) => number, result: T[], i: number, m: number): void {\n\tfor (const n = result.length; i < m; i++) {\n\t\tconst element = array[i];\n\t\tif (compare(element, result[n - 1]) < 0) {\n\t\t\tresult.pop();\n\t\t\tconst j = findFirstIdxMonotonousOrArrLen(result, e => compare(element, e) < 0);\n\t\t\tresult.splice(j, 0, element);\n\t\t}\n\t}\n}\n\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce(array: ReadonlyArray): T[] {\n\treturn array.filter((e): e is T => !!e);\n}\n\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace(array: Array): asserts array is Array {\n\tlet to = 0;\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (!!array[i]) {\n\t\t\tarray[to] = array[i];\n\t\t\tto += 1;\n\t\t}\n\t}\n\tarray.length = to;\n}\n\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nexport function move(array: any[], from: number, to: number): void {\n\tarray.splice(to, 0, array.splice(from, 1)[0]);\n}\n\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj: any): boolean {\n\treturn !Array.isArray(obj) || obj.length === 0;\n}\n\n/**\n * @returns True if the provided object is an array and has at least one element.\n */\nexport function isNonEmptyArray(obj: T[] | undefined | null): obj is T[];\nexport function isNonEmptyArray(obj: readonly T[] | undefined | null): obj is readonly T[];\nexport function isNonEmptyArray(obj: T[] | readonly T[] | undefined | null): obj is T[] | readonly T[] {\n\treturn Array.isArray(obj) && obj.length > 0;\n}\n\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nexport function distinct(array: ReadonlyArray, keyFn: (value: T) => any = value => value): T[] {\n\tconst seen = new Set();\n\n\treturn array.filter(element => {\n\t\tconst key = keyFn!(element);\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n}\n\nexport function uniqueFilter(keyFn: (t: T) => R): (t: T) => boolean {\n\tconst seen = new Set();\n\n\treturn element => {\n\t\tconst key = keyFn(element);\n\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(key);\n\t\treturn true;\n\t};\n}\n\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function firstOrDefault(array: ReadonlyArray): T | undefined;\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[0] : notFoundValue;\n}\n\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function lastOrDefault(array: ReadonlyArray): T | undefined;\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[array.length - 1] : notFoundValue;\n}\n\nexport function commonPrefixLength(one: ReadonlyArray, other: ReadonlyArray, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {\n\tlet result = 0;\n\n\tfor (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n\t\tresult++;\n\t}\n\n\treturn result;\n}\n\nexport function range(to: number): number[];\nexport function range(from: number, to: number): number[];\nexport function range(arg: number, to?: number): number[] {\n\tlet from = typeof to === 'number' ? arg : 0;\n\n\tif (typeof to === 'number') {\n\t\tfrom = arg;\n\t} else {\n\t\tfrom = 0;\n\t\tto = arg;\n\t}\n\n\tconst result: number[] = [];\n\n\tif (from <= to) {\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tresult.push(i);\n\t\t}\n\t} else {\n\t\tfor (let i = from; i > to; i--) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function index(array: ReadonlyArray, indexer: (t: T) => string): { [key: string]: T };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper: (t: T) => R): { [key: string]: R };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper?: (t: T) => R): { [key: string]: R } {\n\treturn array.reduce((r, t) => {\n\t\tr[indexer(t)] = mapper ? mapper(t) : t;\n\t\treturn r;\n\t}, Object.create(null));\n}\n\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function insert(array: T[], element: T): () => void {\n\tarray.push(element);\n\n\treturn () => remove(array, element);\n}\n\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function remove(array: T[], element: T): T | undefined {\n\tconst index = array.indexOf(element);\n\tif (index > -1) {\n\t\tarray.splice(index, 1);\n\n\t\treturn element;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nexport function arrayInsert(target: T[], insertIndex: number, insertArr: T[]): T[] {\n\tconst before = target.slice(0, insertIndex);\n\tconst after = target.slice(insertIndex);\n\treturn before.concat(insertArr, after);\n}\n\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nexport function shuffle(array: T[], _seed?: number): void {\n\tlet rand: () => number;\n\n\tif (typeof _seed === 'number') {\n\t\tlet seed = _seed;\n\t\t// Seeded random number generator in JS. Modified from:\n\t\t// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n\t\trand = () => {\n\t\t\tconst x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n\t\t\treturn x - Math.floor(x);\n\t\t};\n\t} else {\n\t\trand = Math.random;\n\t}\n\n\tfor (let i = array.length - 1; i > 0; i -= 1) {\n\t\tconst j = Math.floor(rand() * (i + 1));\n\t\tconst temp = array[i];\n\t\tarray[i] = array[j];\n\t\tarray[j] = temp;\n\t}\n}\n\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.unshift(value);\n\t}\n}\n\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.push(value);\n\t}\n}\n\nexport function pushMany(arr: T[], items: ReadonlyArray): void {\n\tfor (const item of items) {\n\t\tarr.push(item);\n\t}\n}\n\nexport function mapArrayOrNot(items: T | T[], fn: (_: T) => U): U | U[] {\n\treturn Array.isArray(items) ?\n\t\titems.map(fn) :\n\t\tfn(items);\n}\n\nexport function asArray(x: T | T[]): T[];\nexport function asArray(x: T | readonly T[]): readonly T[];\nexport function asArray(x: T | T[]): T[] {\n\treturn Array.isArray(x) ? x : [x];\n}\n\nexport function getRandomElement(arr: T[]): T | undefined {\n\treturn arr[Math.floor(Math.random() * arr.length)];\n}\n\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nexport function insertInto(array: T[], start: number, newItems: T[]): void {\n\tconst startIdx = getActualStartIndex(array, start);\n\tconst originalLength = array.length;\n\tconst newItemsLength = newItems.length;\n\tarray.length = originalLength + newItemsLength;\n\t// Move the items after the start index, start from the end so that we don't overwrite any value.\n\tfor (let i = originalLength - 1; i >= startIdx; i--) {\n\t\tarray[i + newItemsLength] = array[i];\n\t}\n\n\tfor (let i = 0; i < newItemsLength; i++) {\n\t\tarray[i + startIdx] = newItems[i];\n\t}\n}\n\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nexport function splice(array: T[], start: number, deleteCount: number, newItems: T[]): T[] {\n\tconst index = getActualStartIndex(array, start);\n\tlet result = array.splice(index, deleteCount);\n\tif (result === undefined) {\n\t\t// see https://bugs.webkit.org/show_bug.cgi?id=261140\n\t\tresult = [];\n\t}\n\tinsertInto(array, index, newItems);\n\treturn result;\n}\n\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex(array: T[], start: number): number {\n\treturn start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\n\n/**\n * When comparing two values,\n * a negative number indicates that the first value is less than the second,\n * a positive number indicates that the first value is greater than the second,\n * and zero indicates that neither is the case.\n*/\nexport type CompareResult = number;\n\nexport namespace CompareResult {\n\texport function isLessThan(result: CompareResult): boolean {\n\t\treturn result < 0;\n\t}\n\n\texport function isLessThanOrEqual(result: CompareResult): boolean {\n\t\treturn result <= 0;\n\t}\n\n\texport function isGreaterThan(result: CompareResult): boolean {\n\t\treturn result > 0;\n\t}\n\n\texport function isNeitherLessOrGreaterThan(result: CompareResult): boolean {\n\t\treturn result === 0;\n\t}\n\n\texport const greaterThan = 1;\n\texport const lessThan = -1;\n\texport const neitherLessOrGreaterThan = 0;\n}\n\n/**\n * A comparator `c` defines a total order `<=` on `T` as following:\n * `c(a, b) <= 0` iff `a` <= `b`.\n * We also have `c(a, b) == 0` iff `c(b, a) == 0`.\n*/\nexport type Comparator = (a: T, b: T) => CompareResult;\n\nexport function compareBy(selector: (item: TItem) => TCompareBy, comparator: Comparator): Comparator {\n\treturn (a, b) => comparator(selector(a), selector(b));\n}\n\nexport function tieBreakComparators(...comparators: Comparator[]): Comparator {\n\treturn (item1, item2) => {\n\t\tfor (const comparator of comparators) {\n\t\t\tconst result = comparator(item1, item2);\n\t\t\tif (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn CompareResult.neitherLessOrGreaterThan;\n\t};\n}\n\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator: Comparator = (a, b) => a - b;\n\nexport const booleanComparator: Comparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\n\nexport function reverseOrder(comparator: Comparator): Comparator {\n\treturn (a, b) => -comparator(a, b);\n}\n\nexport class ArrayQueue {\n\tprivate firstIdx = 0;\n\tprivate lastIdx = this.items.length - 1;\n\n\t/**\n\t * Constructs a queue that is backed by the given array. Runtime is O(1).\n\t*/\n\tconstructor(private readonly items: readonly T[]) { }\n\n\tget length(): number {\n\t\treturn this.lastIdx - this.firstIdx + 1;\n\t}\n\n\t/**\n\t * Consumes elements from the beginning of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n\t*/\n\ttakeWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := k <= this.lastIdx && predicate(this.items[k])\n\t\t// Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n\n\t\tlet startIdx = this.firstIdx;\n\t\twhile (startIdx < this.items.length && predicate(this.items[startIdx])) {\n\t\t\tstartIdx++;\n\t\t}\n\t\tconst result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n\t\tthis.firstIdx = startIdx;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Consumes elements from the end of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned.\n\t * The result has the same order as the underlying array!\n\t*/\n\ttakeFromEndWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := this.firstIdx >= k && predicate(this.items[k])\n\t\t// Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n\n\t\tlet endIdx = this.lastIdx;\n\t\twhile (endIdx >= 0 && predicate(this.items[endIdx])) {\n\t\t\tendIdx--;\n\t\t}\n\t\tconst result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n\t\tthis.lastIdx = endIdx;\n\t\treturn result;\n\t}\n\n\tpeek(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.firstIdx];\n\t}\n\n\tpeekLast(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.lastIdx];\n\t}\n\n\tdequeue(): T | undefined {\n\t\tconst result = this.items[this.firstIdx];\n\t\tthis.firstIdx++;\n\t\treturn result;\n\t}\n\n\tremoveLast(): T | undefined {\n\t\tconst result = this.items[this.lastIdx];\n\t\tthis.lastIdx--;\n\t\treturn result;\n\t}\n\n\ttakeCount(count: number): T[] {\n\t\tconst result = this.items.slice(this.firstIdx, this.firstIdx + count);\n\t\tthis.firstIdx += count;\n\t\treturn result;\n\t}\n}\n\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable {\n\tpublic static readonly empty = new CallbackIterable(_callback => { });\n\n\tconstructor(\n\t\t/**\n\t\t * Calls the callback for every item.\n\t\t * Stops when the callback returns false.\n\t\t*/\n\t\tpublic readonly iterate: (callback: (item: T) => boolean) => void\n\t) {\n\t}\n\n\tforEach(handler: (item: T) => void) {\n\t\tthis.iterate(item => { handler(item); return true; });\n\t}\n\n\ttoArray(): T[] {\n\t\tconst result: T[] = [];\n\t\tthis.iterate(item => { result.push(item); return true; });\n\t\treturn result;\n\t}\n\n\tfilter(predicate: (item: T) => boolean): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n\t}\n\n\tmap(mapFn: (item: T) => TResult): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n\t}\n\n\tsome(predicate: (item: T) => boolean): boolean {\n\t\tlet result = false;\n\t\tthis.iterate(item => { result = predicate(item); return !result; });\n\t\treturn result;\n\t}\n\n\tfindFirst(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLast(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLastMaxBy(comparator: Comparator): T | undefined {\n\t\tlet result: T | undefined;\n\t\tlet first = true;\n\t\tthis.iterate(item => {\n\t\t\tif (first || CompareResult.isGreaterThan(comparator(item, result!))) {\n\t\t\t\tfirst = false;\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n}\n\n/**\n * Represents a re-arrangement of items in an array.\n */\nexport class Permutation {\n\tconstructor(private readonly _indexMap: readonly number[]) { }\n\n\t/**\n\t * Returns a permutation that sorts the given array according to the given compare function.\n\t */\n\tpublic static createSortPermutation(arr: readonly T[], compareFn: (a: T, b: T) => number): Permutation {\n\t\tconst sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n\t\treturn new Permutation(sortIndices);\n\t}\n\n\t/**\n\t * Returns a new array with the elements of the given array re-arranged according to this permutation.\n\t */\n\tapply(arr: readonly T[]): T[] {\n\t\treturn arr.map((_, index) => arr[this._indexMap[index]]);\n\t}\n\n\t/**\n\t * Returns a new permutation that undoes the re-arrangement of this permutation.\n\t*/\n\tinverse(): Permutation {\n\t\tconst inverseIndexMap = this._indexMap.slice();\n\t\tfor (let i = 0; i < this._indexMap.length; i++) {\n\t\t\tinverseIndexMap[this._indexMap[i]] = i;\n\t\t}\n\t\treturn new Permutation(inverseIndexMap);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are strings.\n */\nexport type IStringDictionary = Record;\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are numbers.\n */\nexport type INumberDictionary = Record;\n\n/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nexport function groupBy(data: V[], groupFn: (element: V) => K): Record {\n\tconst result: Record = Object.create(null);\n\tfor (const element of data) {\n\t\tconst key = groupFn(element);\n\t\tlet target = result[key];\n\t\tif (!target) {\n\t\t\ttarget = result[key] = [];\n\t\t}\n\t\ttarget.push(element);\n\t}\n\treturn result;\n}\n\nexport function diffSets(before: Set, after: Set): { removed: T[]; added: T[] } {\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\tfor (const element of before) {\n\t\tif (!after.has(element)) {\n\t\t\tremoved.push(element);\n\t\t}\n\t}\n\tfor (const element of after) {\n\t\tif (!before.has(element)) {\n\t\t\tadded.push(element);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\nexport function diffMaps(before: Map, after: Map): { removed: V[]; added: V[] } {\n\tconst removed: V[] = [];\n\tconst added: V[] = [];\n\tfor (const [index, value] of before) {\n\t\tif (!after.has(index)) {\n\t\t\tremoved.push(value);\n\t\t}\n\t}\n\tfor (const [index, value] of after) {\n\t\tif (!before.has(index)) {\n\t\t\tadded.push(value);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nexport function intersection(setA: Set, setB: Iterable): Set {\n\tconst result = new Set();\n\tfor (const elem of setB) {\n\t\tif (setA.has(elem)) {\n\t\t\tresult.add(elem);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class SetWithKey implements Set {\n\tprivate _map = new Map();\n\n\tconstructor(values: T[], private toKey: (t: T) => any) {\n\t\tfor (const value of values) {\n\t\t\tthis.add(value);\n\t\t}\n\t}\n\n\tget size(): number {\n\t\treturn this._map.size;\n\t}\n\n\tadd(value: T): this {\n\t\tconst key = this.toKey(value);\n\t\tthis._map.set(key, value);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\treturn this._map.delete(this.toKey(value));\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this._map.has(this.toKey(value));\n\t}\n\n\t*entries(): IterableIterator<[T, T]> {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield [entry, entry];\n\t\t}\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t*values(): IterableIterator {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield entry;\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void {\n\t\tthis._map.forEach(entry => callbackfn.call(thisArg, entry, entry, this));\n\t}\n\n\t[Symbol.iterator](): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t[Symbol.toStringTag]: string = 'SetWithKey';\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport function getOrSet(map: Map, key: K, value: V): V {\n\tlet result = map.get(key);\n\tif (result === undefined) {\n\t\tresult = value;\n\t\tmap.set(key, result);\n\t}\n\n\treturn result;\n}\n\nexport function mapToString(map: Map): string {\n\tconst entries: string[] = [];\n\tmap.forEach((value, key) => {\n\t\tentries.push(`${key} => ${value}`);\n\t});\n\n\treturn `Map(${map.size}) {${entries.join(', ')}}`;\n}\n\nexport function setToString(set: Set): string {\n\tconst entries: K[] = [];\n\tset.forEach(value => {\n\t\tentries.push(value);\n\t});\n\n\treturn `Set(${set.size}) {${entries.join(', ')}}`;\n}\n\nexport const enum Touch {\n\tNone = 0,\n\tAsOld = 1,\n\tAsNew = 2\n}\n\nexport class CounterSet {\n\n\tprivate map = new Map();\n\n\tadd(value: T): CounterSet {\n\t\tthis.map.set(value, (this.map.get(value) || 0) + 1);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\tlet counter = this.map.get(value) || 0;\n\n\t\tif (counter === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tcounter--;\n\n\t\tif (counter === 0) {\n\t\t\tthis.map.delete(value);\n\t\t} else {\n\t\t\tthis.map.set(value, counter);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.map.has(value);\n\t}\n}\n\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nexport class BidirectionalMap {\n\n\tprivate readonly _m1 = new Map();\n\tprivate readonly _m2 = new Map();\n\n\tconstructor(entries?: readonly (readonly [K, V])[]) {\n\t\tif (entries) {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tthis.set(key, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._m1.clear();\n\t\tthis._m2.clear();\n\t}\n\n\tset(key: K, value: V): void {\n\t\tthis._m1.set(key, value);\n\t\tthis._m2.set(value, key);\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._m1.get(key);\n\t}\n\n\tgetKey(value: V): K | undefined {\n\t\treturn this._m2.get(value);\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst value = this._m1.get(key);\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._m1.delete(key);\n\t\tthis._m2.delete(value);\n\t\treturn true;\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: BidirectionalMap) => void, thisArg?: any): void {\n\t\tthis._m1.forEach((value, key) => {\n\t\t\tcallbackfn.call(thisArg, value, key, this);\n\t\t});\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._m1.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._m1.values();\n\t}\n}\n\nexport class SetMap {\n\n\tprivate map = new Map>();\n\n\tadd(key: K, value: V): void {\n\t\tlet values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\tvalues = new Set();\n\t\t\tthis.map.set(key, values);\n\t\t}\n\n\t\tvalues.add(value);\n\t}\n\n\tdelete(key: K, value: V): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.delete(value);\n\n\t\tif (values.size === 0) {\n\t\t\tthis.map.delete(key);\n\t\t}\n\t}\n\n\tforEach(key: K, fn: (value: V) => void): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.forEach(fn);\n\t}\n\n\tget(key: K): ReadonlySet {\n\t\tconst values = this.map.get(key);\n\t\tif (!values) {\n\t\t\treturn new Set();\n\t\t}\n\t\treturn values;\n\t}\n}\n\nexport function mapsStrictEqualIgnoreOrder(a: Map, b: Map): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (a.size !== b.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [key, value] of a) {\n\t\tif (!b.has(key) || b.get(key) !== value) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfor (const [key] of b) {\n\t\tif (!a.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport namespace Iterable {\n\n\texport function is(thing: any): thing is Iterable {\n\t\treturn thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n\t}\n\n\tconst _empty: Iterable = Object.freeze([]);\n\texport function empty(): Iterable {\n\t\treturn _empty;\n\t}\n\n\texport function* single(element: T): Iterable {\n\t\tyield element;\n\t}\n\n\texport function wrap(iterableOrElement: Iterable | T): Iterable {\n\t\tif (is(iterableOrElement)) {\n\t\t\treturn iterableOrElement;\n\t\t} else {\n\t\t\treturn single(iterableOrElement);\n\t\t}\n\t}\n\n\texport function from(iterable: Iterable | undefined | null): Iterable {\n\t\treturn iterable || _empty;\n\t}\n\n\texport function* reverse(array: Array): Iterable {\n\t\tfor (let i = array.length - 1; i >= 0; i--) {\n\t\t\tyield array[i];\n\t\t}\n\t}\n\n\texport function isEmpty(iterable: Iterable | undefined | null): boolean {\n\t\treturn !iterable || iterable[Symbol.iterator]().next().done === true;\n\t}\n\n\texport function first(iterable: Iterable): T | undefined {\n\t\treturn iterable[Symbol.iterator]().next().value;\n\t}\n\n\texport function some(iterable: Iterable, predicate: (t: T, i: number) => unknown): boolean {\n\t\tlet i = 0;\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element, i++)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\texport function find(iterable: Iterable, predicate: (t: T) => t is R): R | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\texport function filter(iterable: Iterable, predicate: (t: T) => t is R): Iterable;\n\texport function filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable;\n\texport function* filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\tyield element;\n\t\t\t}\n\t\t}\n\t}\n\n\texport function* map(iterable: Iterable, fn: (t: T, index: number) => R): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield fn(element, index++);\n\t\t}\n\t}\n\n\texport function* flatMap(iterable: Iterable, fn: (t: T, index: number) => Iterable): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield* fn(element, index++);\n\t\t}\n\t}\n\n\texport function* concat(...iterables: Iterable[]): Iterable {\n\t\tfor (const iterable of iterables) {\n\t\t\tyield* iterable;\n\t\t}\n\t}\n\n\texport function reduce(iterable: Iterable, reducer: (previousValue: R, currentValue: T) => R, initialValue: R): R {\n\t\tlet value = initialValue;\n\t\tfor (const element of iterable) {\n\t\t\tvalue = reducer(value, element);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n\t */\n\texport function* slice(arr: ReadonlyArray, from: number, to = arr.length): Iterable {\n\t\tif (from < 0) {\n\t\t\tfrom += arr.length;\n\t\t}\n\n\t\tif (to < 0) {\n\t\t\tto += arr.length;\n\t\t} else if (to > arr.length) {\n\t\t\tto = arr.length;\n\t\t}\n\n\t\tfor (; from < to; from++) {\n\t\t\tyield arr[from];\n\t\t}\n\t}\n\n\t/**\n\t * Consumes `atMost` elements from iterable and returns the consumed elements,\n\t * and an iterable for the rest of the elements.\n\t */\n\texport function consume(iterable: Iterable, atMost: number = Number.POSITIVE_INFINITY): [T[], Iterable] {\n\t\tconst consumed: T[] = [];\n\n\t\tif (atMost === 0) {\n\t\t\treturn [consumed, iterable];\n\t\t}\n\n\t\tconst iterator = iterable[Symbol.iterator]();\n\n\t\tfor (let i = 0; i < atMost; i++) {\n\t\t\tconst next = iterator.next();\n\n\t\t\tif (next.done) {\n\t\t\t\treturn [consumed, Iterable.empty()];\n\t\t\t}\n\n\t\t\tconsumed.push(next.value);\n\t\t}\n\n\t\treturn [consumed, { [Symbol.iterator]() { return iterator; } }];\n\t}\n\n\texport async function asyncToArray(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn Promise.resolve(result);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { compareBy, numberComparator } from 'vs/base/common/arrays';\nimport { groupBy } from 'vs/base/common/collections';\nimport { SetMap } from './map';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { Iterable } from 'vs/base/common/iterator';\n\n// #region Disposable Tracking\n\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker: IDisposableTracker | null = null;\n\nexport interface IDisposableTracker {\n\t/**\n\t * Is called on construction of a disposable.\n\t*/\n\ttrackDisposable(disposable: IDisposable): void;\n\n\t/**\n\t * Is called when a disposable is registered as child of another disposable (e.g. {@link DisposableStore}).\n\t * If parent is `null`, the disposable is removed from its former parent.\n\t*/\n\tsetParent(child: IDisposable, parent: IDisposable | null): void;\n\n\t/**\n\t * Is called after a disposable is disposed.\n\t*/\n\tmarkAsDisposed(disposable: IDisposable): void;\n\n\t/**\n\t * Indicates that the given object is a singleton which does not need to be disposed.\n\t*/\n\tmarkAsSingleton(disposable: IDisposable): void;\n}\n\nexport interface DisposableInfo {\n\tvalue: IDisposable;\n\tsource: string | null;\n\tparent: IDisposable | null;\n\tisSingleton: boolean;\n\tidx: number;\n}\n\nexport class DisposableTracker implements IDisposableTracker {\n\tprivate static idx = 0;\n\n\tprivate readonly livingDisposables = new Map();\n\n\tprivate getDisposableData(d: IDisposable): DisposableInfo {\n\t\tlet val = this.livingDisposables.get(d);\n\t\tif (!val) {\n\t\t\tval = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n\t\t\tthis.livingDisposables.set(d, val);\n\t\t}\n\t\treturn val;\n\t}\n\n\ttrackDisposable(d: IDisposable): void {\n\t\tconst data = this.getDisposableData(d);\n\t\tif (!data.source) {\n\t\t\tdata.source =\n\t\t\t\tnew Error().stack!;\n\t\t}\n\t}\n\n\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\tconst data = this.getDisposableData(child);\n\t\tdata.parent = parent;\n\t}\n\n\tmarkAsDisposed(x: IDisposable): void {\n\t\tthis.livingDisposables.delete(x);\n\t}\n\n\tmarkAsSingleton(disposable: IDisposable): void {\n\t\tthis.getDisposableData(disposable).isSingleton = true;\n\t}\n\n\tprivate getRootParent(data: DisposableInfo, cache: Map): DisposableInfo {\n\t\tconst cacheValue = cache.get(data);\n\t\tif (cacheValue) {\n\t\t\treturn cacheValue;\n\t\t}\n\n\t\tconst result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n\t\tcache.set(data, result);\n\t\treturn result;\n\t}\n\n\tgetTrackedDisposables(): IDisposable[] {\n\t\tconst rootParentCache = new Map();\n\n\t\tconst leaking = [...this.livingDisposables.entries()]\n\t\t\t.filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n\t\t\t.flatMap(([k]) => k);\n\n\t\treturn leaking;\n\t}\n\n\tcomputeLeakingDisposables(maxReported = 10, preComputedLeaks?: DisposableInfo[]): { leaks: DisposableInfo[]; details: string } | undefined {\n\t\tlet uncoveredLeakingObjs: DisposableInfo[] | undefined;\n\t\tif (preComputedLeaks) {\n\t\t\tuncoveredLeakingObjs = preComputedLeaks;\n\t\t} else {\n\t\t\tconst rootParentCache = new Map();\n\n\t\t\tconst leakingObjects = [...this.livingDisposables.values()]\n\t\t\t\t.filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n\n\t\t\tif (leakingObjects.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n\n\t\t\t// Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n\t\t\tuncoveredLeakingObjs = leakingObjects.filter(l => {\n\t\t\t\treturn !(l.parent && leakingObjsSet.has(l.parent));\n\t\t\t});\n\n\t\t\tif (uncoveredLeakingObjs.length === 0) {\n\t\t\t\tthrow new Error('There are cyclic diposable chains!');\n\t\t\t}\n\t\t}\n\n\t\tif (!uncoveredLeakingObjs) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfunction getStackTracePath(leaking: DisposableInfo): string[] {\n\t\t\tfunction removePrefix(array: string[], linesToRemove: (string | RegExp)[]) {\n\t\t\t\twhile (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n\t\t\t\t\tarray.shift();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst lines = leaking.source!.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n\t\t\tremovePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n\t\t\treturn lines.reverse();\n\t\t}\n\n\t\tconst stackTraceStarts = new SetMap();\n\t\tfor (const leaking of uncoveredLeakingObjs) {\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tfor (let i = 0; i <= stackTracePath.length; i++) {\n\t\t\t\tstackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n\t\t\t}\n\t\t}\n\n\t\t// Put earlier leaks first\n\t\tuncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));\n\n\t\tlet message = '';\n\n\t\tlet i = 0;\n\t\tfor (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n\t\t\ti++;\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tconst stackTraceFormattedLines = [];\n\n\t\t\tfor (let i = 0; i < stackTracePath.length; i++) {\n\t\t\t\tlet line = stackTracePath[i];\n\t\t\t\tconst starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n\t\t\t\tline = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n\n\t\t\t\tconst prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n\t\t\t\tconst continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n\t\t\t\tdelete continuations[stackTracePath[i]];\n\t\t\t\tfor (const [cont, set] of Object.entries(continuations)) {\n\t\t\t\t\tstackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);\n\t\t\t\t}\n\n\t\t\t\tstackTraceFormattedLines.unshift(line);\n\t\t\t}\n\n\t\t\tmessage += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n\t\t}\n\n\t\tif (uncoveredLeakingObjs.length > maxReported) {\n\t\t\tmessage += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n\t\t}\n\n\t\treturn { leaks: uncoveredLeakingObjs, details: message };\n\t}\n}\n\nexport function setDisposableTracker(tracker: IDisposableTracker | null): void {\n\tdisposableTracker = tracker;\n}\n\nif (TRACK_DISPOSABLES) {\n\tconst __is_disposable_tracked__ = '__is_disposable_tracked__';\n\tsetDisposableTracker(new class implements IDisposableTracker {\n\t\ttrackDisposable(x: IDisposable): void {\n\t\t\tconst stack = new Error('Potentially leaked disposable').stack!;\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!(x as any)[__is_disposable_tracked__]) {\n\t\t\t\t\tconsole.log(stack);\n\t\t\t\t}\n\t\t\t}, 3000);\n\t\t}\n\n\t\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\t\tif (child && child !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(child as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmarkAsDisposed(disposable: IDisposable): void {\n\t\t\tif (disposable && disposable !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(disposable as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmarkAsSingleton(disposable: IDisposable): void { }\n\t});\n}\n\nexport function trackDisposable(x: T): T {\n\tdisposableTracker?.trackDisposable(x);\n\treturn x;\n}\n\nexport function markAsDisposed(disposable: IDisposable): void {\n\tdisposableTracker?.markAsDisposed(disposable);\n}\n\nfunction setParentOfDisposable(child: IDisposable, parent: IDisposable | null): void {\n\tdisposableTracker?.setParent(child, parent);\n}\n\nfunction setParentOfDisposables(children: IDisposable[], parent: IDisposable | null): void {\n\tif (!disposableTracker) {\n\t\treturn;\n\t}\n\tfor (const child of children) {\n\t\tdisposableTracker.setParent(child, parent);\n\t}\n}\n\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton(singleton: T): T {\n\tdisposableTracker?.markAsSingleton(singleton);\n\treturn singleton;\n}\n\n// #endregion\n\n/**\n * An object that performs a cleanup operation when `.dispose()` is called.\n *\n * Some examples of how disposables are used:\n *\n * - An event listener that removes itself when `.dispose()` is called.\n * - A resource such as a file system watcher that cleans up the resource when `.dispose()` is called.\n * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.\n */\nexport interface IDisposable {\n\tdispose(): void;\n}\n\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable(thing: E): thing is E & IDisposable {\n\treturn typeof thing === 'object' && thing !== null && typeof (thing).dispose === 'function' && (thing).dispose.length === 0;\n}\n\n/**\n * Disposes of the value(s) passed in.\n */\nexport function dispose(disposable: T): T;\nexport function dispose(disposable: T | undefined): T | undefined;\nexport function dispose = Iterable>(disposables: A): A;\nexport function dispose(disposables: Array): Array;\nexport function dispose(disposables: ReadonlyArray): ReadonlyArray;\nexport function dispose(arg: T | Iterable | undefined): any {\n\tif (Iterable.is(arg)) {\n\t\tconst errors: any[] = [];\n\n\t\tfor (const d of arg) {\n\t\t\tif (d) {\n\t\t\t\ttry {\n\t\t\t\t\td.dispose();\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t} else if (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Encountered errors while disposing of store');\n\t\t}\n\n\t\treturn Array.isArray(arg) ? [] : arg;\n\t} else if (arg) {\n\t\targ.dispose();\n\t\treturn arg;\n\t}\n}\n\nexport function disposeIfDisposable(disposables: Array): Array {\n\tfor (const d of disposables) {\n\t\tif (isDisposable(d)) {\n\t\t\td.dispose();\n\t\t}\n\t}\n\treturn [];\n}\n\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n\tconst parent = toDisposable(() => dispose(disposables));\n\tsetParentOfDisposables(disposables, parent);\n\treturn parent;\n}\n\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nexport function toDisposable(fn: () => void): IDisposable {\n\tconst self = trackDisposable({\n\t\tdispose: createSingleCallFunction(() => {\n\t\t\tmarkAsDisposed(self);\n\t\t\tfn();\n\t\t})\n\t});\n\treturn self;\n}\n\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nexport class DisposableStore implements IDisposable {\n\n\tstatic DISABLE_DISPOSED_WARNING = false;\n\n\tprivate readonly _toDispose = new Set();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Dispose of all registered disposables and mark this object as disposed.\n\t *\n\t * Any future disposables added to this object will be disposed of on `add`.\n\t */\n\tpublic dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clear();\n\t}\n\n\t/**\n\t * @return `true` if this object has been disposed of.\n\t */\n\tpublic get isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\t/**\n\t * Dispose of all registered disposables but do not mark this object as disposed.\n\t */\n\tpublic clear(): void {\n\t\tif (this._toDispose.size === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._toDispose);\n\t\t} finally {\n\t\t\tthis._toDispose.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Add a new {@link IDisposable disposable} to the collection.\n\t */\n\tpublic add(o: T): T {\n\t\tif (!o) {\n\t\t\treturn o;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\n\t\tsetParentOfDisposable(o, this);\n\t\tif (this._isDisposed) {\n\t\t\tif (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n\t\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._toDispose.add(o);\n\t\t}\n\n\t\treturn o;\n\t}\n\n\t/**\n\t * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n\t * disposable even when the disposable is not part in the store.\n\t */\n\tpublic delete(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot dispose a disposable on itself!');\n\t\t}\n\t\tthis._toDispose.delete(o);\n\t\to.dispose();\n\t}\n\n\t/**\n\t * Deletes the value from the store, but does not dispose it.\n\t */\n\tpublic deleteAndLeak(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._toDispose.has(o)) {\n\t\t\tthis._toDispose.delete(o);\n\t\t\tsetParentOfDisposable(o, null);\n\t\t}\n\t}\n}\n\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nexport abstract class Disposable implements IDisposable {\n\n\t/**\n\t * A disposable that does nothing when it is disposed of.\n\t *\n\t * TODO: This should not be a static property.\n\t */\n\tstatic readonly None = Object.freeze({ dispose() { } });\n\n\tprotected readonly _store = new DisposableStore();\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t\tsetParentOfDisposable(this._store, this);\n\t}\n\n\tpublic dispose(): void {\n\t\tmarkAsDisposed(this);\n\n\t\tthis._store.dispose();\n\t}\n\n\t/**\n\t * Adds `o` to the collection of disposables managed by this object.\n\t */\n\tprotected _register(o: T): T {\n\t\tif ((o as unknown as Disposable) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\t\treturn this._store.add(o);\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nexport class MutableDisposable implements IDisposable {\n\tprivate _value?: T;\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tget value(): T | undefined {\n\t\treturn this._isDisposed ? undefined : this._value;\n\t}\n\n\tset value(value: T | undefined) {\n\t\tif (this._isDisposed || value === this._value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._value?.dispose();\n\t\tif (value) {\n\t\t\tsetParentOfDisposable(value, this);\n\t\t}\n\t\tthis._value = value;\n\t}\n\n\t/**\n\t * Resets the stored value and disposed of the previously stored value.\n\t */\n\tclear(): void {\n\t\tthis.value = undefined;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tmarkAsDisposed(this);\n\t\tthis._value?.dispose();\n\t\tthis._value = undefined;\n\t}\n\n\t/**\n\t * Clears the value, but does not dispose it.\n\t * The old value is returned.\n\t*/\n\tclearAndLeak(): T | undefined {\n\t\tconst oldValue = this._value;\n\t\tthis._value = undefined;\n\t\tif (oldValue) {\n\t\t\tsetParentOfDisposable(oldValue, null);\n\t\t}\n\t\treturn oldValue;\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nexport class MandatoryMutableDisposable implements IDisposable {\n\tprivate readonly _disposable = new MutableDisposable();\n\tprivate _isDisposed = false;\n\n\tconstructor(initialValue: T) {\n\t\tthis._disposable.value = initialValue;\n\t}\n\n\tget value(): T {\n\t\treturn this._disposable.value!;\n\t}\n\n\tset value(value: T) {\n\t\tif (this._isDisposed || value === this._disposable.value) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposable.value = value;\n\t}\n\n\tdispose() {\n\t\tthis._isDisposed = true;\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class RefCountedDisposable {\n\n\tprivate _counter: number = 1;\n\n\tconstructor(\n\t\tprivate readonly _disposable: IDisposable,\n\t) { }\n\n\tacquire() {\n\t\tthis._counter++;\n\t\treturn this;\n\t}\n\n\trelease() {\n\t\tif (--this._counter === 0) {\n\t\t\tthis._disposable.dispose();\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nexport class SafeDisposable implements IDisposable {\n\n\tdispose: () => void = () => { };\n\tunset: () => void = () => { };\n\tisset: () => boolean = () => false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tset(fn: Function) {\n\t\tlet callback: Function | undefined = fn;\n\t\tthis.unset = () => callback = undefined;\n\t\tthis.isset = () => callback !== undefined;\n\t\tthis.dispose = () => {\n\t\t\tif (callback) {\n\t\t\t\tcallback();\n\t\t\t\tcallback = undefined;\n\t\t\t\tmarkAsDisposed(this);\n\t\t\t}\n\t\t};\n\t\treturn this;\n\t}\n}\n\nexport interface IReference extends IDisposable {\n\treadonly object: T;\n}\n\nexport abstract class ReferenceCollection {\n\n\tprivate readonly references: Map = new Map();\n\n\tacquire(key: string, ...args: any[]): IReference {\n\t\tlet reference = this.references.get(key);\n\n\t\tif (!reference) {\n\t\t\treference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n\t\t\tthis.references.set(key, reference);\n\t\t}\n\n\t\tconst { object } = reference;\n\t\tconst dispose = createSingleCallFunction(() => {\n\t\t\tif (--reference.counter === 0) {\n\t\t\t\tthis.destroyReferencedObject(key, reference.object);\n\t\t\t\tthis.references.delete(key);\n\t\t\t}\n\t\t});\n\n\t\treference.counter++;\n\n\t\treturn { object, dispose };\n\t}\n\n\tprotected abstract createReferencedObject(key: string, ...args: any[]): T;\n\tprotected abstract destroyReferencedObject(key: string, object: T): void;\n}\n\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nexport class AsyncReferenceCollection {\n\n\tconstructor(private referenceCollection: ReferenceCollection>) { }\n\n\tasync acquire(key: string, ...args: any[]): Promise> {\n\t\tconst ref = this.referenceCollection.acquire(key, ...args);\n\n\t\ttry {\n\t\t\tconst object = await ref.object;\n\n\t\t\treturn {\n\t\t\t\tobject,\n\t\t\t\tdispose: () => ref.dispose()\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tref.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport class ImmortalReference implements IReference {\n\tconstructor(public object: T) { }\n\tdispose(): void { /* noop */ }\n}\n\nexport function disposeOnReturn(fn: (store: DisposableStore) => void): void {\n\tconst store = new DisposableStore();\n\ttry {\n\t\tfn(store);\n\t} finally {\n\t\tstore.dispose();\n\t}\n}\n\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap implements IDisposable {\n\n\tprivate readonly _store = new Map();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Disposes of all stored values and mark this object as disposed.\n\t *\n\t * Trying to use this object after it has been disposed of is an error.\n\t */\n\tdispose(): void {\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clearAndDisposeAll();\n\t}\n\n\t/**\n\t * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n\t */\n\tclearAndDisposeAll(): void {\n\t\tif (!this._store.size) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._store.values());\n\t\t} finally {\n\t\t\tthis._store.clear();\n\t\t}\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this._store.has(key);\n\t}\n\n\tget size(): number {\n\t\treturn this._store.size;\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._store.get(key);\n\t}\n\n\tset(key: K, value: V, skipDisposeOnOverwrite = false): void {\n\t\tif (this._isDisposed) {\n\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n\t\t}\n\n\t\tif (!skipDisposeOnOverwrite) {\n\t\t\tthis._store.get(key)?.dispose();\n\t\t}\n\n\t\tthis._store.set(key, value);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map and also dispose of it.\n\t */\n\tdeleteAndDispose(key: K): void {\n\t\tthis._store.get(key)?.dispose();\n\t\tthis._store.delete(key);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map but return it. The caller is\n\t * responsible for disposing of the value.\n\t */\n\tdeleteAndLeak(key: K): V | undefined {\n\t\tconst value = this._store.get(key);\n\t\tthis._store.delete(key);\n\t\treturn value;\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._store.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._store.values();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this._store[Symbol.iterator]();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nclass Node {\n\n\tstatic readonly Undefined = new Node(undefined);\n\n\telement: E;\n\tnext: Node;\n\tprev: Node;\n\n\tconstructor(element: E) {\n\t\tthis.element = element;\n\t\tthis.next = Node.Undefined;\n\t\tthis.prev = Node.Undefined;\n\t}\n}\n\nexport class LinkedList {\n\n\tprivate _first: Node = Node.Undefined;\n\tprivate _last: Node = Node.Undefined;\n\tprivate _size: number = 0;\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._first === Node.Undefined;\n\t}\n\n\tclear(): void {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tconst next = node.next;\n\t\t\tnode.prev = Node.Undefined;\n\t\t\tnode.next = Node.Undefined;\n\t\t\tnode = next;\n\t\t}\n\n\t\tthis._first = Node.Undefined;\n\t\tthis._last = Node.Undefined;\n\t\tthis._size = 0;\n\t}\n\n\tunshift(element: E): () => void {\n\t\treturn this._insert(element, false);\n\t}\n\n\tpush(element: E): () => void {\n\t\treturn this._insert(element, true);\n\t}\n\n\tprivate _insert(element: E, atTheEnd: boolean): () => void {\n\t\tconst newNode = new Node(element);\n\t\tif (this._first === Node.Undefined) {\n\t\t\tthis._first = newNode;\n\t\t\tthis._last = newNode;\n\n\t\t} else if (atTheEnd) {\n\t\t\t// push\n\t\t\tconst oldLast = this._last;\n\t\t\tthis._last = newNode;\n\t\t\tnewNode.prev = oldLast;\n\t\t\toldLast.next = newNode;\n\n\t\t} else {\n\t\t\t// unshift\n\t\t\tconst oldFirst = this._first;\n\t\t\tthis._first = newNode;\n\t\t\tnewNode.next = oldFirst;\n\t\t\toldFirst.prev = newNode;\n\t\t}\n\t\tthis._size += 1;\n\n\t\tlet didRemove = false;\n\t\treturn () => {\n\t\t\tif (!didRemove) {\n\t\t\t\tdidRemove = true;\n\t\t\t\tthis._remove(newNode);\n\t\t\t}\n\t\t};\n\t}\n\n\tshift(): E | undefined {\n\t\tif (this._first === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._first.element;\n\t\t\tthis._remove(this._first);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tpop(): E | undefined {\n\t\tif (this._last === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._last.element;\n\t\t\tthis._remove(this._last);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tprivate _remove(node: Node): void {\n\t\tif (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n\t\t\t// middle\n\t\t\tconst anchor = node.prev;\n\t\t\tanchor.next = node.next;\n\t\t\tnode.next.prev = anchor;\n\n\t\t} else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n\t\t\t// only node\n\t\t\tthis._first = Node.Undefined;\n\t\t\tthis._last = Node.Undefined;\n\n\t\t} else if (node.next === Node.Undefined) {\n\t\t\t// last\n\t\t\tthis._last = this._last.prev!;\n\t\t\tthis._last.next = Node.Undefined;\n\n\t\t} else if (node.prev === Node.Undefined) {\n\t\t\t// first\n\t\t\tthis._first = this._first.next!;\n\t\t\tthis._first.prev = Node.Undefined;\n\t\t}\n\n\t\t// done\n\t\tthis._size -= 1;\n\t}\n\n\t*[Symbol.iterator](): Iterator {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tyield node.element;\n\t\t\tnode = node.next;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// fake definition so that the valid layers check won't trip on this\ndeclare const globalThis: { performance?: { now(): number } };\n\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\n\nexport class StopWatch {\n\n\tprivate _startTime: number;\n\tprivate _stopTime: number;\n\n\tprivate readonly _now: () => number;\n\n\tpublic static create(highResolution?: boolean): StopWatch {\n\t\treturn new StopWatch(highResolution);\n\t}\n\n\tconstructor(highResolution?: boolean) {\n\t\tthis._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance!.now.bind(globalThis.performance);\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic stop(): void {\n\t\tthis._stopTime = this._now();\n\t}\n\n\tpublic reset(): void {\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic elapsed(): number {\n\t\tif (this._stopTime !== -1) {\n\t\t\treturn this._stopTime - this._startTime;\n\t\t}\n\t\treturn this._now() - this._startTime;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { combinedDisposable, Disposable, DisposableMap, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\nimport { IObservable, IObserver } from 'vs/base/common/observable';\nimport { StopWatch } from 'vs/base/common/stopwatch';\nimport { MicrotaskDelay } from 'vs/base/common/symbols';\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableListenerGCedWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n/**\n * An event with zero or one parameters that can be subscribed to. The event is a function itself.\n */\nexport interface Event {\n\t(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport namespace Event {\n\texport const None: Event = () => Disposable.None;\n\n\tfunction _addLeakageTraceLogic(options: EmitterOptions) {\n\t\tif (_enableSnapshotPotentialLeakWarning) {\n\t\t\tconst { onDidAddListener: origListenerDidAdd } = options;\n\t\t\tconst stack = Stacktrace.create();\n\t\t\tlet count = 0;\n\t\t\toptions.onDidAddListener = () => {\n\t\t\t\tif (++count === 2) {\n\t\t\t\t\tconsole.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n\t\t\t\t\tstack.print();\n\t\t\t\t}\n\t\t\t\torigListenerDidAdd?.();\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n\t * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n\t * result of merging events and to try prevent race conditions that could arise when using related deferred and\n\t * non-deferred events.\n\t *\n\t * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n\t * (eg. latency of keypress to text rendered).\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function defer(event: Event, disposable?: DisposableStore): Event {\n\t\treturn debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Given an event, returns another event which only fires once.\n\t *\n\t * @param event The event source for the new event.\n\t */\n\texport function once(event: Event): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\t// we need this, in case the event fires during the listener call\n\t\t\tlet didFire = false;\n\t\t\tlet result: IDisposable | undefined = undefined;\n\t\t\tresult = event(e => {\n\t\t\t\tif (didFire) {\n\t\t\t\t\treturn;\n\t\t\t\t} else if (result) {\n\t\t\t\t\tresult.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tdidFire = true;\n\t\t\t\t}\n\n\t\t\t\treturn listener.call(thisArgs, e);\n\t\t\t}, null, disposables);\n\n\t\t\tif (didFire) {\n\t\t\t\tresult.dispose();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Maps an event of one type into an event of another type using a mapping function, similar to how\n\t * `Array.prototype.map` works.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param map The mapping function.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function map(event: Event, map: (i: I) => O, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that performs some function on the event object before firing.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param each The function to perform on the event object.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function forEach(event: Event, each: (i: I) => void, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that fires only when some condition is met.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param filter The filter function that defines the condition. The event will fire for the object if this function\n\t * returns true.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function filter(event: Event, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Given an event, returns the same event but typed as `Event`.\n\t */\n\texport function signal(event: Event): Event {\n\t\treturn event as Event as Event;\n\t}\n\n\t/**\n\t * Given a collection of events, returns a single event which emits whenever any of the provided events emit.\n\t */\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\tconst disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n\t\t\treturn addAndReturnDisposable(disposable, disposables);\n\t\t};\n\t}\n\n\t/**\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function reduce(event: Event, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event {\n\t\tlet output: O | undefined = initial;\n\n\t\treturn map(event, e => {\n\t\t\toutput = merge(output, e);\n\t\t\treturn output;\n\t\t}, disposable);\n\t}\n\n\tfunction snapshot(event: Event, disposable: DisposableStore | undefined): Event {\n\t\tlet listener: IDisposable | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tlistener = event(emitter.fire, emitter);\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tlistener?.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Adds the IDisposable to the store if it's set, and returns it. Useful to\n\t * Event function implementation.\n\t */\n\tfunction addAndReturnDisposable(d: T, store: DisposableStore | IDisposable[] | undefined): T {\n\t\tif (store instanceof Array) {\n\t\t\tstore.push(d);\n\t\t} else if (store) {\n\t\t\tstore.add(d);\n\t\t}\n\t\treturn d;\n\t}\n\n\t/**\n\t * Given an event, creates a new emitter that event that will debounce events based on {@link delay} and give an\n\t * array event object of all events that fired.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The original event to debounce.\n\t * @param merge A function that reduces all events into a single event.\n\t * @param delay The number of milliseconds to debounce.\n\t * @param leading Whether to fire a leading event without debouncing.\n\t * @param flushOnListenerRemove Whether to fire all debounced events when a listener is removed. If this is not\n\t * specified, some events could go missing. Use this if it's important that all events are processed, even if the\n\t * listener gets disposed before the debounced event fires.\n\t * @param leakWarningThreshold See {@link EmitterOptions.leakWarningThreshold}.\n\t * @param disposable A disposable store to register the debounce emitter to.\n\t */\n\texport function debounce(event: Event, merge: (last: T | undefined, event: T) => T, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay: number | typeof MicrotaskDelay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold?: number, disposable?: DisposableStore): Event {\n\t\tlet subscription: IDisposable;\n\t\tlet output: O | undefined = undefined;\n\t\tlet handle: any = undefined;\n\t\tlet numDebouncedCalls = 0;\n\t\tlet doFire: (() => void) | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tleakWarningThreshold,\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tsubscription = event(cur => {\n\t\t\t\t\tnumDebouncedCalls++;\n\t\t\t\t\toutput = merge(output, cur);\n\n\t\t\t\t\tif (leading && !handle) {\n\t\t\t\t\t\temitter.fire(output);\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tdoFire = () => {\n\t\t\t\t\t\tconst _output = output;\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t\thandle = undefined;\n\t\t\t\t\t\tif (!leading || numDebouncedCalls > 1) {\n\t\t\t\t\t\t\temitter.fire(_output!);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnumDebouncedCalls = 0;\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof delay === 'number') {\n\t\t\t\t\t\tclearTimeout(handle);\n\t\t\t\t\t\thandle = setTimeout(doFire, delay);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (handle === undefined) {\n\t\t\t\t\t\t\thandle = 0;\n\t\t\t\t\t\t\tqueueMicrotask(doFire);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tonWillRemoveListener() {\n\t\t\t\tif (flushOnListenerRemove && numDebouncedCalls > 0) {\n\t\t\t\t\tdoFire?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tdoFire = undefined;\n\t\t\t\tsubscription.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function accumulate(event: Event, delay: number = 0, disposable?: DisposableStore): Event {\n\t\treturn Event.debounce(event, (last, e) => {\n\t\t\tif (!last) {\n\t\t\t\treturn [e];\n\t\t\t}\n\t\t\tlast.push(e);\n\t\t\treturn last;\n\t\t}, delay, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n\t * event objects from different sources do not fire the same event object.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param equals The equality condition.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t *\n\t * @example\n\t * ```\n\t * // Fire only one time when a single window is opened or focused\n\t * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n\t * ```\n\t */\n\texport function latch(event: Event, equals: (a: T, b: T) => boolean = (a, b) => a === b, disposable?: DisposableStore): Event {\n\t\tlet firstCall = true;\n\t\tlet cache: T;\n\n\t\treturn filter(event, value => {\n\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\tfirstCall = false;\n\t\t\tcache = value;\n\t\t\treturn shouldEmit;\n\t\t}, disposable);\n\t}\n\n\t/**\n\t * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @example\n\t * ```\n\t * const event = new EventEmitter().event;\n\t * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n\t * ```\n\t *\n\t * @param event The event source for the new event.\n\t * @param isT A function that determines what event is of the first type.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function split(event: Event, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event, Event] {\n\t\treturn [\n\t\t\tEvent.filter(event, isT, disposable),\n\t\t\tEvent.filter(event, e => !isT(e), disposable) as Event,\n\t\t];\n\t}\n\n\t/**\n\t * Buffers an event until it has a listener attached.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n\t * `setTimeout` when the first event listener is added.\n\t * @param _buffer Internal: A source event array used for tests.\n\t *\n\t * @example\n\t * ```\n\t * // Start accumulating events, when the first listener is attached, flush\n\t * // the event after a timeout such that multiple listeners attached before\n\t * // the timeout would receive the event\n\t * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n\t * ```\n\t */\n\texport function buffer(event: Event, flushAfterTimeout = false, _buffer: T[] = [], disposable?: DisposableStore): Event {\n\t\tlet buffer: T[] | null = _buffer.slice();\n\n\t\tlet listener: IDisposable | null = event(e => {\n\t\t\tif (buffer) {\n\t\t\t\tbuffer.push(e);\n\t\t\t} else {\n\t\t\t\temitter.fire(e);\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(listener);\n\t\t}\n\n\t\tconst flush = () => {\n\t\t\tbuffer?.forEach(e => emitter.fire(e));\n\t\t\tbuffer = null;\n\t\t};\n\n\t\tconst emitter = new Emitter({\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tif (!listener) {\n\t\t\t\t\tlistener = event(e => emitter.fire(e));\n\t\t\t\t\tif (disposable) {\n\t\t\t\t\t\tdisposable.add(listener);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidAddFirstListener() {\n\t\t\t\tif (buffer) {\n\t\t\t\t\tif (flushAfterTimeout) {\n\t\t\t\t\t\tsetTimeout(flush);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tflush();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tif (listener) {\n\t\t\t\t\tlistener.dispose();\n\t\t\t\t}\n\t\t\t\tlistener = null;\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(emitter);\n\t\t}\n\n\t\treturn emitter.event;\n\t}\n\t/**\n\t * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n\t *\n\t * @example\n\t * ```\n\t * // Normal\n\t * const onEnterPressNormal = Event.filter(\n\t * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n\t * e.keyCode === KeyCode.Enter\n\t * ).event;\n\t *\n\t * // Using chain\n\t * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n\t * .map(e => new StandardKeyboardEvent(e))\n\t * .filter(e => e.keyCode === KeyCode.Enter)\n\t * );\n\t * ```\n\t */\n\texport function chain(event: Event, sythensize: ($: IChainableSythensis) => IChainableSythensis): Event {\n\t\tconst fn: Event = (listener, thisArgs, disposables) => {\n\t\t\tconst cs = sythensize(new ChainableSynthesis()) as ChainableSynthesis;\n\t\t\treturn event(function (value) {\n\t\t\t\tconst result = cs.evaluate(value);\n\t\t\t\tif (result !== HaltChainable) {\n\t\t\t\t\tlistener.call(thisArgs, result);\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\n\t\treturn fn;\n\t}\n\n\tconst HaltChainable = Symbol('HaltChainable');\n\n\tclass ChainableSynthesis implements IChainableSythensis {\n\t\tprivate readonly steps: ((input: any) => any)[] = [];\n\n\t\tmap(fn: (i: any) => O): this {\n\t\t\tthis.steps.push(fn);\n\t\t\treturn this;\n\t\t}\n\n\t\tforEach(fn: (i: any) => void): this {\n\t\t\tthis.steps.push(v => {\n\t\t\t\tfn(v);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tfilter(fn: (e: any) => boolean): this {\n\t\t\tthis.steps.push(v => fn(v) ? v : HaltChainable);\n\t\t\treturn this;\n\t\t}\n\n\t\treduce(merge: (last: R | undefined, event: any) => R, initial?: R | undefined): this {\n\t\t\tlet last = initial;\n\t\t\tthis.steps.push(v => {\n\t\t\t\tlast = merge(last, v);\n\t\t\t\treturn last;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tlatch(equals: (a: any, b: any) => boolean = (a, b) => a === b): ChainableSynthesis {\n\t\t\tlet firstCall = true;\n\t\t\tlet cache: any;\n\t\t\tthis.steps.push(value => {\n\t\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\t\tfirstCall = false;\n\t\t\t\tcache = value;\n\t\t\t\treturn shouldEmit ? value : HaltChainable;\n\t\t\t});\n\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic evaluate(value: any) {\n\t\t\tfor (const step of this.steps) {\n\t\t\t\tvalue = step(value);\n\t\t\t\tif (value === HaltChainable) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn value;\n\t\t}\n\t}\n\n\texport interface IChainableSythensis {\n\t\tmap(fn: (i: T) => O): IChainableSythensis;\n\t\tforEach(fn: (i: T) => void): IChainableSythensis;\n\t\tfilter(fn: (e: T) => e is R): IChainableSythensis;\n\t\tfilter(fn: (e: T) => boolean): IChainableSythensis;\n\t\treduce(merge: (last: R, event: T) => R, initial: R): IChainableSythensis;\n\t\treduce(merge: (last: R | undefined, event: T) => R): IChainableSythensis;\n\t\tlatch(equals?: (a: T, b: T) => boolean): IChainableSythensis;\n\t}\n\n\texport interface NodeEventEmitter {\n\t\ton(event: string | symbol, listener: Function): unknown;\n\t\tremoveListener(event: string | symbol, listener: Function): unknown;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a node event emitter.\n\t */\n\texport function fromNodeEventEmitter(emitter: NodeEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.on(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\texport interface DOMEventEmitter {\n\t\taddEventListener(event: string | symbol, listener: Function): void;\n\t\tremoveEventListener(event: string | symbol, listener: Function): void;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a DOM event emitter.\n\t */\n\texport function fromDOMEventEmitter(emitter: DOMEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * Creates a promise out of an event, using the {@link Event.once} helper.\n\t */\n\texport function toPromise(event: Event): Promise {\n\t\treturn new Promise(resolve => once(event)(resolve));\n\t}\n\n\t/**\n\t * Creates an event out of a promise that fires once when the promise is\n\t * resolved with the result of the promise or `undefined`.\n\t */\n\texport function fromPromise(promise: Promise): Event {\n\t\tconst result = new Emitter();\n\n\t\tpromise.then(res => {\n\t\t\tresult.fire(res);\n\t\t}, () => {\n\t\t\tresult.fire(undefined);\n\t\t}).finally(() => {\n\t\t\tresult.dispose();\n\t\t});\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * A convenience function for forwarding an event to another emitter which\n\t * improves readability.allows Event.forward(event, emitter) instead of `event(e => emitter.fire(e))`.\n\t * @param from The event to forward.\n\t * @param to The emitter to forward the event to.\n\t * @example\n\t * Event.forward(event, emitter);\n\t * // equivalent to\n\t * event(e => emitter.fire(e));\n\t * // equivalent to\n\t * event(emitter.fire, emitter);\n\t */\n\texport function forward(from: Event, to: Emitter): IDisposable {\n\t\treturn from(e => to.fire(e));\n\t}\n\n\t/**\n\t * Adds a listener to an event and calls the listener immediately with undefined as the event object.\n\t *\n\t * @example\n\t * ```\n\t * // Initialize the UI and update it when dataChangeEvent fires\n\t * runAndSubscribe(dataChangeEvent, () => this._updateUI());\n\t * ```\n\t */\n\texport function runAndSubscribe(event: Event, handler: (e: T) => any, initial: T): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any, initial?: T): IDisposable {\n\t\thandler(initial);\n\t\treturn event(e => handler(e));\n\t}\n\n\tclass EmitterObserver implements IObserver {\n\n\t\treadonly emitter: Emitter;\n\n\t\tprivate _counter = 0;\n\t\tprivate _hasChanged = false;\n\n\t\tconstructor(readonly _observable: IObservable, store: DisposableStore | undefined) {\n\t\t\tconst options: EmitterOptions = {\n\t\t\t\tonWillAddFirstListener: () => {\n\t\t\t\t\t_observable.addObserver(this);\n\t\t\t\t},\n\t\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\t\t_observable.removeObserver(this);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (!store) {\n\t\t\t\t_addLeakageTraceLogic(options);\n\t\t\t}\n\t\t\tthis.emitter = new Emitter(options);\n\t\t\tif (store) {\n\t\t\t\tstore.add(this.emitter);\n\t\t\t}\n\t\t}\n\n\t\tbeginUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter++;\n\t\t}\n\n\t\thandlePossibleChange(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t}\n\n\t\thandleChange(_observable: IObservable, _change: TChange): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._hasChanged = true;\n\t\t}\n\n\t\tendUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter--;\n\t\t\tif (this._counter === 0) {\n\t\t\t\tthis._observable.reportChanges();\n\t\t\t\tif (this._hasChanged) {\n\t\t\t\t\tthis._hasChanged = false;\n\t\t\t\t\tthis.emitter.fire(this._observable.get());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates an event emitter that is fired when the observable changes.\n\t * Each listeners subscribes to the emitter.\n\t */\n\texport function fromObservable(obs: IObservable, store?: DisposableStore): Event {\n\t\tconst observer = new EmitterObserver(obs, store);\n\t\treturn observer.emitter.event;\n\t}\n\n\t/**\n\t * Each listener is attached to the observable directly.\n\t */\n\texport function fromObservableLight(observable: IObservable): Event {\n\t\treturn (listener, thisArgs, disposables) => {\n\t\t\tlet count = 0;\n\t\t\tlet didChange = false;\n\t\t\tconst observer: IObserver = {\n\t\t\t\tbeginUpdate() {\n\t\t\t\t\tcount++;\n\t\t\t\t},\n\t\t\t\tendUpdate() {\n\t\t\t\t\tcount--;\n\t\t\t\t\tif (count === 0) {\n\t\t\t\t\t\tobservable.reportChanges();\n\t\t\t\t\t\tif (didChange) {\n\t\t\t\t\t\t\tdidChange = false;\n\t\t\t\t\t\t\tlistener.call(thisArgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandlePossibleChange() {\n\t\t\t\t\t// noop\n\t\t\t\t},\n\t\t\t\thandleChange() {\n\t\t\t\t\tdidChange = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tobservable.addObserver(observer);\n\t\t\tobservable.reportChanges();\n\t\t\tconst disposable = {\n\t\t\t\tdispose() {\n\t\t\t\t\tobservable.removeObserver(observer);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(disposable);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(disposable);\n\t\t\t}\n\n\t\t\treturn disposable;\n\t\t};\n\t}\n}\n\nexport interface EmitterOptions {\n\t/**\n\t * Optional function that's called *before* the very first listener is added\n\t */\n\tonWillAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called *after* the very first listener is added\n\t */\n\tonDidAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called after a listener is added\n\t */\n\tonDidAddListener?: Function;\n\t/**\n\t * Optional function that's called *after* remove the very last listener\n\t */\n\tonDidRemoveLastListener?: Function;\n\t/**\n\t * Optional function that's called *before* a listener is removed\n\t */\n\tonWillRemoveListener?: Function;\n\t/**\n\t * Optional function that's called when a listener throws an error. Defaults to\n\t * {@link onUnexpectedError}\n\t */\n\tonListenerError?: (e: any) => void;\n\t/**\n\t * Number of listeners that are allowed before assuming a leak. Default to\n\t * a globally configured value\n\t *\n\t * @see setGlobalLeakWarningThreshold\n\t */\n\tleakWarningThreshold?: number;\n\t/**\n\t * Pass in a delivery queue, which is useful for ensuring\n\t * in order event delivery across multiple emitters.\n\t */\n\tdeliveryQueue?: EventDeliveryQueue;\n\n\t/** ONLY enable this during development */\n\t_profName?: string;\n}\n\n\nexport class EventProfiling {\n\n\tstatic readonly all = new Set();\n\n\tprivate static _idPool = 0;\n\n\treadonly name: string;\n\tpublic listenerCount: number = 0;\n\tpublic invocationCount = 0;\n\tpublic elapsedOverall = 0;\n\tpublic durations: number[] = [];\n\n\tprivate _stopWatch?: StopWatch;\n\n\tconstructor(name: string) {\n\t\tthis.name = `${name}_${EventProfiling._idPool++}`;\n\t\tEventProfiling.all.add(this);\n\t}\n\n\tstart(listenerCount: number): void {\n\t\tthis._stopWatch = new StopWatch();\n\t\tthis.listenerCount = listenerCount;\n\t}\n\n\tstop(): void {\n\t\tif (this._stopWatch) {\n\t\t\tconst elapsed = this._stopWatch.elapsed();\n\t\t\tthis.durations.push(elapsed);\n\t\t\tthis.elapsedOverall += elapsed;\n\t\t\tthis.invocationCount += 1;\n\t\t\tthis._stopWatch = undefined;\n\t\t}\n\t}\n}\n\nlet _globalLeakWarningThreshold = -1;\nexport function setGlobalLeakWarningThreshold(n: number): IDisposable {\n\tconst oldValue = _globalLeakWarningThreshold;\n\t_globalLeakWarningThreshold = n;\n\treturn {\n\t\tdispose() {\n\t\t\t_globalLeakWarningThreshold = oldValue;\n\t\t}\n\t};\n}\n\nclass LeakageMonitor {\n\n\tprivate static _idPool = 1;\n\n\tprivate _stacks: Map | undefined;\n\tprivate _warnCountdown: number = 0;\n\n\tconstructor(\n\t\tprivate readonly _errorHandler: (err: Error) => void,\n\t\treadonly threshold: number,\n\t\treadonly name: string = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')\n\t) { }\n\n\tdispose(): void {\n\t\tthis._stacks?.clear();\n\t}\n\n\tcheck(stack: Stacktrace, listenerCount: number): undefined | (() => void) {\n\n\t\tconst threshold = this.threshold;\n\t\tif (threshold <= 0 || listenerCount < threshold) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (!this._stacks) {\n\t\t\tthis._stacks = new Map();\n\t\t}\n\t\tconst count = (this._stacks.get(stack.value) || 0);\n\t\tthis._stacks.set(stack.value, count + 1);\n\t\tthis._warnCountdown -= 1;\n\n\t\tif (this._warnCountdown <= 0) {\n\t\t\t// only warn on first exceed and then every time the limit\n\t\t\t// is exceeded by 50% again\n\t\t\tthis._warnCountdown = threshold * 0.5;\n\n\t\t\tconst [topStack, topCount] = this.getMostFrequentStack()!;\n\t\t\tconst message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;\n\t\t\tconsole.warn(message);\n\t\t\tconsole.warn(topStack!);\n\n\t\t\tconst error = new ListenerLeakError(message, topStack);\n\t\t\tthis._errorHandler(error);\n\t\t}\n\n\t\treturn () => {\n\t\t\tconst count = (this._stacks!.get(stack.value) || 0);\n\t\t\tthis._stacks!.set(stack.value, count - 1);\n\t\t};\n\t}\n\n\tgetMostFrequentStack(): [string, number] | undefined {\n\t\tif (!this._stacks) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet topStack: [string, number] | undefined;\n\t\tlet topCount: number = 0;\n\t\tfor (const [stack, count] of this._stacks) {\n\t\t\tif (!topStack || topCount < count) {\n\t\t\t\ttopStack = [stack, count];\n\t\t\t\ttopCount = count;\n\t\t\t}\n\t\t}\n\t\treturn topStack;\n\t}\n}\n\nclass Stacktrace {\n\n\tstatic create() {\n\t\tconst err = new Error();\n\t\treturn new Stacktrace(err.stack ?? '');\n\t}\n\n\tprivate constructor(readonly value: string) { }\n\n\tprint() {\n\t\tconsole.warn(this.value.split('\\n').slice(2).join('\\n'));\n\t}\n}\n\n// error that is logged when going over the configured listener threshold\nexport class ListenerLeakError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerLeakError';\n\t\tthis.stack = stack;\n\t}\n}\n\n// SEVERE error that is logged when having gone way over the configured listener\n// threshold so that the emitter refuses to accept more listeners\nexport class ListenerRefusalError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerRefusalError';\n\t\tthis.stack = stack;\n\t}\n}\n\nlet id = 0;\nclass UniqueContainer {\n\tstack?: Stacktrace;\n\tpublic id = id++;\n\tconstructor(public readonly value: T) { }\n}\nconst compactionThreshold = 2;\n\ntype ListenerContainer = UniqueContainer<(data: T) => void>;\ntype ListenerOrListeners = (ListenerContainer | undefined)[] | ListenerContainer;\n\nconst forEachListener = (listeners: ListenerOrListeners, fn: (c: ListenerContainer) => void) => {\n\tif (listeners instanceof UniqueContainer) {\n\t\tfn(listeners);\n\t} else {\n\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\tconst l = listeners[i];\n\t\t\tif (l) {\n\t\t\t\tfn(l);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\nlet _listenerFinalizers: FinalizationRegistry | undefined;\n\nif (_enableListenerGCedWarning) {\n\tconst leaks: string[] = [];\n\n\tsetInterval(() => {\n\t\tif (leaks.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.warn('[LEAKING LISTENERS] GC\\'ed these listeners that were NOT yet disposed:');\n\t\tconsole.warn(leaks.join('\\n'));\n\t\tleaks.length = 0;\n\t}, 3000);\n\n\t_listenerFinalizers = new FinalizationRegistry(heldValue => {\n\t\tif (typeof heldValue === 'string') {\n\t\t\tleaks.push(heldValue);\n\t\t}\n\t});\n}\n\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n\tclass Document {\n\n\t\tprivate readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n\t\tpublic onDidChange = this._onDidChange.event;\n\n\t\t// getter-style\n\t\t// get onDidChange(): Event<(value:string)=>any> {\n\t\t// \treturn this._onDidChange.event;\n\t\t// }\n\n\t\tprivate _doIt() {\n\t\t\t//...\n\t\t\tthis._onDidChange.fire(value);\n\t\t}\n\t}\n */\nexport class Emitter {\n\n\tprivate readonly _options?: EmitterOptions;\n\tprivate readonly _leakageMon?: LeakageMonitor;\n\tprivate readonly _perfMon?: EventProfiling;\n\tprivate _disposed?: true;\n\tprivate _event?: Event;\n\n\t/**\n\t * A listener, or list of listeners. A single listener is the most common\n\t * for event emitters (#185789), so we optimize that special case to avoid\n\t * wrapping it in an array (just like Node.js itself.)\n\t *\n\t * A list of listeners never 'downgrades' back to a plain function if\n\t * listeners are removed, for two reasons:\n\t *\n\t * 1. That's complicated (especially with the deliveryQueue)\n\t * 2. A listener with >1 listener is likely to have >1 listener again at\n\t * some point, and swapping between arrays and functions may[citation needed]\n\t * introduce unnecessary work and garbage.\n\t *\n\t * The array listeners can be 'sparse', to avoid reallocating the array\n\t * whenever any listener is added or removed. If more than `1 / compactionThreshold`\n\t * of the array is empty, only then is it resized.\n\t */\n\tprotected _listeners?: ListenerOrListeners;\n\n\t/**\n\t * Always to be defined if _listeners is an array. It's no longer a true\n\t * queue, but holds the dispatching 'state'. If `fire()` is called on an\n\t * emitter, any work left in the _deliveryQueue is finished first.\n\t */\n\tprivate _deliveryQueue?: EventDeliveryQueuePrivate;\n\tprotected _size = 0;\n\n\tconstructor(options?: EmitterOptions) {\n\t\tthis._options = options;\n\t\tthis._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold)\n\t\t\t? new LeakageMonitor(options?.onListenerError ?? onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) :\n\t\t\tundefined;\n\t\tthis._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n\t\tthis._deliveryQueue = this._options?.deliveryQueue as EventDeliveryQueuePrivate | undefined;\n\t}\n\n\tdispose() {\n\t\tif (!this._disposed) {\n\t\t\tthis._disposed = true;\n\n\t\t\t// It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n\t\t\t// alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n\t\t\t// unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n\t\t\t// the following programming pattern is very popular:\n\t\t\t//\n\t\t\t// const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n\t\t\t// this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n\t\t\t// ...later...\n\t\t\t// this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n\n\t\t\tif (this._deliveryQueue?.current === this) {\n\t\t\t\tthis._deliveryQueue.reset();\n\t\t\t}\n\t\t\tif (this._listeners) {\n\t\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\t\tconst listeners = this._listeners;\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tforEachListener(listeners, l => l.stack?.print());\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis._listeners = undefined;\n\t\t\t\tthis._size = 0;\n\t\t\t}\n\t\t\tthis._options?.onDidRemoveLastListener?.();\n\t\t\tthis._leakageMon?.dispose();\n\t\t}\n\t}\n\n\t/**\n\t * For the public to allow to subscribe\n\t * to events from this Emitter\n\t */\n\tget event(): Event {\n\t\tthis._event ??= (callback: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n\t\t\tif (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {\n\t\t\t\tconst message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;\n\t\t\t\tconsole.warn(message);\n\n\t\t\t\tconst tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1];\n\t\t\t\tconst error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);\n\t\t\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\t\t\terrorHandler(error);\n\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (this._disposed) {\n\t\t\t\t// todo: should we warn if a listener is added to a disposed emitter? This happens often\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (thisArgs) {\n\t\t\t\tcallback = callback.bind(thisArgs);\n\t\t\t}\n\n\t\t\tconst contained = new UniqueContainer(callback);\n\n\t\t\tlet removeMonitor: Function | undefined;\n\t\t\tlet stack: Stacktrace | undefined;\n\t\t\tif (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n\t\t\t\t// check and record this emitter for potential leakage\n\t\t\t\tcontained.stack = Stacktrace.create();\n\t\t\t\tremoveMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n\t\t\t}\n\n\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\tcontained.stack = stack ?? Stacktrace.create();\n\t\t\t}\n\n\t\t\tif (!this._listeners) {\n\t\t\t\tthis._options?.onWillAddFirstListener?.(this);\n\t\t\t\tthis._listeners = contained;\n\t\t\t\tthis._options?.onDidAddFirstListener?.(this);\n\t\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\t\tthis._deliveryQueue ??= new EventDeliveryQueuePrivate();\n\t\t\t\tthis._listeners = [this._listeners, contained];\n\t\t\t} else {\n\t\t\t\tthis._listeners.push(contained);\n\t\t\t}\n\n\t\t\tthis._size++;\n\n\n\t\t\tconst result = toDisposable(() => {\n\t\t\t\t_listenerFinalizers?.unregister(result);\n\t\t\t\tremoveMonitor?.();\n\t\t\t\tthis._removeListener(contained);\n\t\t\t});\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(result);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(result);\n\t\t\t}\n\n\t\t\tif (_listenerFinalizers) {\n\t\t\t\tconst stack = new Error().stack!.split('\\n').slice(2, 3).join('\\n').trim();\n\t\t\t\tconst match = /(file:|vscode-file:\\/\\/vscode-app)?(\\/[^:]*:\\d+:\\d+)/.exec(stack);\n\t\t\t\t_listenerFinalizers.register(result, match?.[2] ?? stack, result);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\n\t\treturn this._event;\n\t}\n\n\tprivate _removeListener(listener: ListenerContainer) {\n\t\tthis._options?.onWillRemoveListener?.(this);\n\n\t\tif (!this._listeners) {\n\t\t\treturn; // expected if a listener gets disposed\n\t\t}\n\n\t\tif (this._size === 1) {\n\t\t\tthis._listeners = undefined;\n\t\t\tthis._options?.onDidRemoveLastListener?.(this);\n\t\t\tthis._size = 0;\n\t\t\treturn;\n\t\t}\n\n\t\t// size > 1 which requires that listeners be a list:\n\t\tconst listeners = this._listeners as (ListenerContainer | undefined)[];\n\n\t\tconst index = listeners.indexOf(listener);\n\t\tif (index === -1) {\n\t\t\tconsole.log('disposed?', this._disposed);\n\t\t\tconsole.log('size?', this._size);\n\t\t\tconsole.log('arr?', JSON.stringify(this._listeners));\n\t\t\tthrow new Error('Attempted to dispose unknown listener');\n\t\t}\n\n\t\tthis._size--;\n\t\tlisteners[index] = undefined;\n\n\t\tconst adjustDeliveryQueue = this._deliveryQueue!.current === this;\n\t\tif (this._size * compactionThreshold <= listeners.length) {\n\t\t\tlet n = 0;\n\t\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\t\tif (listeners[i]) {\n\t\t\t\t\tlisteners[n++] = listeners[i];\n\t\t\t\t} else if (adjustDeliveryQueue) {\n\t\t\t\t\tthis._deliveryQueue!.end--;\n\t\t\t\t\tif (n < this._deliveryQueue!.i) {\n\t\t\t\t\t\tthis._deliveryQueue!.i--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlisteners.length = n;\n\t\t}\n\t}\n\n\tprivate _deliver(listener: undefined | UniqueContainer<(value: T) => void>, value: T) {\n\t\tif (!listener) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\tif (!errorHandler) {\n\t\t\tlistener.value(value);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlistener.value(value);\n\t\t} catch (e) {\n\t\t\terrorHandler(e);\n\t\t}\n\t}\n\n\t/** Delivers items in the queue. Assumes the queue is ready to go. */\n\tprivate _deliverQueue(dq: EventDeliveryQueuePrivate) {\n\t\tconst listeners = dq.current!._listeners! as (ListenerContainer | undefined)[];\n\t\twhile (dq.i < dq.end) {\n\t\t\t// important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n\t\t\tthis._deliver(listeners[dq.i++], dq.value as T);\n\t\t}\n\t\tdq.reset();\n\t}\n\n\t/**\n\t * To be kept private to fire an event to\n\t * subscribers\n\t */\n\tfire(event: T): void {\n\t\tif (this._deliveryQueue?.current) {\n\t\t\tthis._deliverQueue(this._deliveryQueue);\n\t\t\tthis._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n\t\t}\n\n\t\tthis._perfMon?.start(this._size);\n\n\t\tif (!this._listeners) {\n\t\t\t// no-op\n\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\tthis._deliver(this._listeners, event);\n\t\t} else {\n\t\t\tconst dq = this._deliveryQueue!;\n\t\t\tdq.enqueue(this, event, this._listeners.length);\n\t\t\tthis._deliverQueue(dq);\n\t\t}\n\n\t\tthis._perfMon?.stop();\n\t}\n\n\thasListeners(): boolean {\n\t\treturn this._size > 0;\n\t}\n}\n\nexport interface EventDeliveryQueue {\n\t_isEventDeliveryQueue: true;\n}\n\nexport const createEventDeliveryQueue = (): EventDeliveryQueue => new EventDeliveryQueuePrivate();\n\nclass EventDeliveryQueuePrivate implements EventDeliveryQueue {\n\tdeclare _isEventDeliveryQueue: true;\n\n\t/**\n\t * Index in current's listener list.\n\t */\n\tpublic i = -1;\n\n\t/**\n\t * The last index in the listener's list to deliver.\n\t */\n\tpublic end = 0;\n\n\t/**\n\t * Emitter currently being dispatched on. Emitter._listeners is always an array.\n\t */\n\tpublic current?: Emitter;\n\t/**\n\t * Currently emitting value. Defined whenever `current` is.\n\t */\n\tpublic value?: unknown;\n\n\tpublic enqueue(emitter: Emitter, value: T, end: number) {\n\t\tthis.i = 0;\n\t\tthis.end = end;\n\t\tthis.current = emitter;\n\t\tthis.value = value;\n\t}\n\n\tpublic reset() {\n\t\tthis.i = this.end; // force any current emission loop to stop, mainly for during dispose\n\t\tthis.current = undefined;\n\t\tthis.value = undefined;\n\t}\n}\n\nexport interface IWaitUntil {\n\ttoken: CancellationToken;\n\twaitUntil(thenable: Promise): void;\n}\n\nexport type IWaitUntilData = Omit, 'token'>;\n\nexport class AsyncEmitter extends Emitter {\n\n\tprivate _asyncDeliveryQueue?: LinkedList<[(ev: T) => void, IWaitUntilData]>;\n\n\tasync fireAsync(data: IWaitUntilData, token: CancellationToken, promiseJoin?: (p: Promise, listener: Function) => Promise): Promise {\n\t\tif (!this._listeners) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._asyncDeliveryQueue) {\n\t\t\tthis._asyncDeliveryQueue = new LinkedList();\n\t\t}\n\n\t\tforEachListener(this._listeners, listener => this._asyncDeliveryQueue!.push([listener.value, data]));\n\n\t\twhile (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n\n\t\t\tconst [listener, data] = this._asyncDeliveryQueue.shift()!;\n\t\t\tconst thenables: Promise[] = [];\n\n\t\t\tconst event = {\n\t\t\t\t...data,\n\t\t\t\ttoken,\n\t\t\t\twaitUntil: (p: Promise): void => {\n\t\t\t\t\tif (Object.isFrozen(thenables)) {\n\t\t\t\t\t\tthrow new Error('waitUntil can NOT be called asynchronous');\n\t\t\t\t\t}\n\t\t\t\t\tif (promiseJoin) {\n\t\t\t\t\t\tp = promiseJoin(p, listener);\n\t\t\t\t\t}\n\t\t\t\t\tthenables.push(p);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// freeze thenables-collection to enforce sync-calls to\n\t\t\t// wait until and then wait for all thenables to resolve\n\t\t\tObject.freeze(thenables);\n\n\t\t\tawait Promise.allSettled(thenables).then(values => {\n\t\t\t\tfor (const value of values) {\n\t\t\t\t\tif (value.status === 'rejected') {\n\t\t\t\t\t\tonUnexpectedError(value.reason);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\n\nexport class PauseableEmitter extends Emitter {\n\n\tprivate _isPaused = 0;\n\tprotected _eventQueue = new LinkedList();\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tpublic get isPaused(): boolean {\n\t\treturn this._isPaused !== 0;\n\t}\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\n\tpause(): void {\n\t\tthis._isPaused++;\n\t}\n\n\tresume(): void {\n\t\tif (this._isPaused !== 0 && --this._isPaused === 0) {\n\t\t\tif (this._mergeFn) {\n\t\t\t\t// use the merge function to create a single composite\n\t\t\t\t// event. make a copy in case firing pauses this emitter\n\t\t\t\tif (this._eventQueue.size > 0) {\n\t\t\t\t\tconst events = Array.from(this._eventQueue);\n\t\t\t\t\tthis._eventQueue.clear();\n\t\t\t\t\tsuper.fire(this._mergeFn(events));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// no merging, fire each event individually and test\n\t\t\t\t// that this emitter isn't paused halfway through\n\t\t\t\twhile (!this._isPaused && this._eventQueue.size !== 0) {\n\t\t\t\t\tsuper.fire(this._eventQueue.shift()!);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (this._size) {\n\t\t\tif (this._isPaused !== 0) {\n\t\t\t\tthis._eventQueue.push(event);\n\t\t\t} else {\n\t\t\t\tsuper.fire(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class DebounceEmitter extends PauseableEmitter {\n\n\tprivate readonly _delay: number;\n\tprivate _handle: any | undefined;\n\n\tconstructor(options: EmitterOptions & { merge: (input: T[]) => T; delay?: number }) {\n\t\tsuper(options);\n\t\tthis._delay = options.delay ?? 100;\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (!this._handle) {\n\t\t\tthis.pause();\n\t\t\tthis._handle = setTimeout(() => {\n\t\t\t\tthis._handle = undefined;\n\t\t\t\tthis.resume();\n\t\t\t}, this._delay);\n\t\t}\n\t\tsuper.fire(event);\n\t}\n}\n\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nexport class MicrotaskEmitter extends Emitter {\n\tprivate _queuedEvents: T[] = [];\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\toverride fire(event: T): void {\n\n\t\tif (!this.hasListeners()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._queuedEvents.push(event);\n\t\tif (this._queuedEvents.length === 1) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this._mergeFn) {\n\t\t\t\t\tsuper.fire(this._mergeFn(this._queuedEvents));\n\t\t\t\t} else {\n\t\t\t\t\tthis._queuedEvents.forEach(e => super.fire(e));\n\t\t\t\t}\n\t\t\t\tthis._queuedEvents = [];\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap();\n *\n * thingService.onDidAddThing(thing => {\n * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n * thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n * console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nexport class EventMultiplexer implements IDisposable {\n\n\tprivate readonly emitter: Emitter;\n\tprivate hasListeners = false;\n\tprivate events: { event: Event; listener: IDisposable | null }[] = [];\n\n\tconstructor() {\n\t\tthis.emitter = new Emitter({\n\t\t\tonWillAddFirstListener: () => this.onFirstListenerAdd(),\n\t\t\tonDidRemoveLastListener: () => this.onLastListenerRemove()\n\t\t});\n\t}\n\n\tget event(): Event {\n\t\treturn this.emitter.event;\n\t}\n\n\tadd(event: Event): IDisposable {\n\t\tconst e = { event: event, listener: null };\n\t\tthis.events.push(e);\n\n\t\tif (this.hasListeners) {\n\t\t\tthis.hook(e);\n\t\t}\n\n\t\tconst dispose = () => {\n\t\t\tif (this.hasListeners) {\n\t\t\t\tthis.unhook(e);\n\t\t\t}\n\n\t\t\tconst idx = this.events.indexOf(e);\n\t\t\tthis.events.splice(idx, 1);\n\t\t};\n\n\t\treturn toDisposable(createSingleCallFunction(dispose));\n\t}\n\n\tprivate onFirstListenerAdd(): void {\n\t\tthis.hasListeners = true;\n\t\tthis.events.forEach(e => this.hook(e));\n\t}\n\n\tprivate onLastListenerRemove(): void {\n\t\tthis.hasListeners = false;\n\t\tthis.events.forEach(e => this.unhook(e));\n\t}\n\n\tprivate hook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener = e.event(r => this.emitter.fire(r));\n\t}\n\n\tprivate unhook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener?.dispose();\n\t\te.listener = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.emitter.dispose();\n\n\t\tfor (const e of this.events) {\n\t\t\te.listener?.dispose();\n\t\t}\n\t\tthis.events = [];\n\t}\n}\n\nexport interface IDynamicListEventMultiplexer extends IDisposable {\n\treadonly event: Event;\n}\nexport class DynamicListEventMultiplexer implements IDynamicListEventMultiplexer {\n\tprivate readonly _store = new DisposableStore();\n\n\treadonly event: Event;\n\n\tconstructor(\n\t\titems: TItem[],\n\t\tonAddItem: Event,\n\t\tonRemoveItem: Event,\n\t\tgetEvent: (item: TItem) => Event\n\t) {\n\t\tconst multiplexer = this._store.add(new EventMultiplexer());\n\t\tconst itemListeners = this._store.add(new DisposableMap());\n\n\t\tfunction addItem(instance: TItem) {\n\t\t\titemListeners.set(instance, multiplexer.add(getEvent(instance)));\n\t\t}\n\n\t\t// Existing items\n\t\tfor (const instance of items) {\n\t\t\taddItem(instance);\n\t\t}\n\n\t\t// Added items\n\t\tthis._store.add(onAddItem(instance => {\n\t\t\taddItem(instance);\n\t\t}));\n\n\t\t// Removed items\n\t\tthis._store.add(onRemoveItem(instance => {\n\t\t\titemListeners.deleteAndDispose(instance);\n\t\t}));\n\n\t\tthis.event = multiplexer.event;\n\t}\n\n\tdispose() {\n\t\tthis._store.dispose();\n\t}\n}\n\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nexport class EventBufferer {\n\n\tprivate data: { buffers: Function[] }[] = [];\n\n\twrapEvent(event: Event): Event;\n\twrapEvent(event: Event, reduce: (last: T | undefined, event: T) => T): Event;\n\twrapEvent(event: Event, reduce: (last: O | undefined, event: T) => O, initial: O): Event;\n\twrapEvent(event: Event, reduce?: (last: T | O | undefined, event: T) => T | O, initial?: O): Event {\n\t\treturn (listener, thisArgs?, disposables?) => {\n\t\t\treturn event(i => {\n\t\t\t\tconst data = this.data[this.data.length - 1];\n\n\t\t\t\t// Non-reduce scenario\n\t\t\t\tif (!reduce) {\n\t\t\t\t\t// Buffering case\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\tdata.buffers.push(() => listener.call(thisArgs, i));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Not buffering case\n\t\t\t\t\t\tlistener.call(thisArgs, i);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Reduce scenario\n\t\t\t\tconst reduceData = data as typeof data & {\n\t\t\t\t\t/**\n\t\t\t\t\t * The accumulated items that will be reduced.\n\t\t\t\t\t */\n\t\t\t\t\titems?: T[];\n\t\t\t\t\t/**\n\t\t\t\t\t * The reduced result cached to be shared with other listeners.\n\t\t\t\t\t */\n\t\t\t\t\treducedResult?: T | O;\n\t\t\t\t};\n\n\t\t\t\t// Not buffering case\n\t\t\t\tif (!reduceData) {\n\t\t\t\t\t// TODO: Is there a way to cache this reduce call for all listeners?\n\t\t\t\t\tlistener.call(thisArgs, reduce(initial, i));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Buffering case\n\t\t\t\treduceData.items ??= [];\n\t\t\t\treduceData.items.push(i);\n\t\t\t\tif (reduceData.buffers.length === 0) {\n\t\t\t\t\t// Include a single buffered function that will reduce all events when we're done buffering events\n\t\t\t\t\tdata.buffers.push(() => {\n\t\t\t\t\t\t// cache the reduced result so that the value can be shared across all listeners\n\t\t\t\t\t\treduceData.reducedResult ??= initial\n\t\t\t\t\t\t\t? reduceData.items!.reduce(reduce as (last: O | undefined, event: T) => O, initial)\n\t\t\t\t\t\t\t: reduceData.items!.reduce(reduce as (last: T | undefined, event: T) => T);\n\t\t\t\t\t\tlistener.call(thisArgs, reduceData.reducedResult);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\t}\n\n\tbufferEvents(fn: () => R): R {\n\t\tconst data = { buffers: new Array() };\n\t\tthis.data.push(data);\n\t\tconst r = fn();\n\t\tthis.data.pop();\n\t\tdata.buffers.forEach(flush => flush());\n\t\treturn r;\n\t}\n}\n\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nexport class Relay implements IDisposable {\n\n\tprivate listening = false;\n\tprivate inputEvent: Event = Event.None;\n\tprivate inputEventListener: IDisposable = Disposable.None;\n\n\tprivate readonly emitter = new Emitter({\n\t\tonDidAddFirstListener: () => {\n\t\t\tthis.listening = true;\n\t\t\tthis.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n\t\t},\n\t\tonDidRemoveLastListener: () => {\n\t\t\tthis.listening = false;\n\t\t\tthis.inputEventListener.dispose();\n\t\t}\n\t});\n\n\treadonly event: Event = this.emitter.event;\n\n\tset input(event: Event) {\n\t\tthis.inputEvent = event;\n\n\t\tif (this.listening) {\n\t\t\tthis.inputEventListener.dispose();\n\t\t\tthis.inputEventListener = event(this.emitter.fire, this.emitter);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.inputEventListener.dispose();\n\t\tthis.emitter.dispose();\n\t}\n}\n\nexport interface IValueWithChangeEvent {\n\treadonly onDidChange: Event;\n\tget value(): T;\n}\n\nexport class ValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic static const(value: T): IValueWithChangeEvent {\n\t\treturn new ConstValueWithChangeEvent(value);\n\t}\n\n\tprivate readonly _onDidChange = new Emitter();\n\treadonly onDidChange: Event = this._onDidChange.event;\n\n\tconstructor(private _value: T) { }\n\n\tget value(): T {\n\t\treturn this._value;\n\t}\n\n\tset value(value: T) {\n\t\tif (value !== this._value) {\n\t\t\tthis._value = value;\n\t\t\tthis._onDidChange.fire(undefined);\n\t\t}\n\t}\n}\n\nclass ConstValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic readonly onDidChange: Event = Event.None;\n\n\tconstructor(readonly value: T) { }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { Emitter } from 'vs/base/common/event';\n\nclass WindowManager {\n\n\tstatic readonly INSTANCE = new WindowManager();\n\n\t// --- Zoom Level\n\n\tprivate readonly mapWindowIdToZoomLevel = new Map();\n\n\tprivate readonly _onDidChangeZoomLevel = new Emitter();\n\treadonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n\n\tgetZoomLevel(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;\n\t}\n\tsetZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\t\tif (this.getZoomLevel(targetWindow) === zoomLevel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst targetWindowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);\n\t\tthis._onDidChangeZoomLevel.fire(targetWindowId);\n\t}\n\n\t// --- Zoom Factor\n\n\tprivate readonly mapWindowIdToZoomFactor = new Map();\n\n\tgetZoomFactor(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;\n\t}\n\tsetZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\t\tthis.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);\n\t}\n\n\t// --- Fullscreen\n\n\tprivate readonly _onDidChangeFullscreen = new Emitter();\n\treadonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;\n\n\tprivate readonly mapWindowIdToFullScreen = new Map();\n\n\tsetFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\t\tif (this.isFullscreen(targetWindow) === fullscreen) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst windowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToFullScreen.set(windowId, fullscreen);\n\t\tthis._onDidChangeFullscreen.fire(windowId);\n\t}\n\tisFullscreen(targetWindow: Window): boolean {\n\t\treturn !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));\n\t}\n\n\tprivate getWindowId(targetWindow: Window): number {\n\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t}\n}\n\nexport function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {\n\tif (typeof query === 'string') {\n\t\tquery = targetWindow.matchMedia(query);\n\t}\n\tquery.addEventListener('change', callback);\n}\n\n/** A zoom index, e.g. 1, 2, 3 */\nexport function setZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);\n}\nexport function getZoomLevel(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomLevel(targetWindow);\n}\nexport const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;\n\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nexport function getZoomFactor(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomFactor(targetWindow);\n}\nexport function setZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);\n}\n\nexport function setFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);\n}\nexport function isFullscreen(targetWindow: Window): boolean {\n\treturn WindowManager.INSTANCE.isFullscreen(targetWindow);\n}\nexport const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;\n\nconst userAgent = typeof navigator === 'object' ? navigator.userAgent : '';\n\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\nexport const isElectron = (userAgent.indexOf('Electron/') >= 0);\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\n\nlet standalone = false;\nif (typeof mainWindow.matchMedia === 'function') {\n\tconst standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n\tconst fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');\n\tstandalone = standaloneMatchMedia.matches;\n\taddMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {\n\t\t// entering fullscreen would change standaloneMatchMedia.matches to false\n\t\t// if standalone is true (running as PWA) and entering fullscreen, skip this change\n\t\tif (standalone && fullScreenMatchMedia.matches) {\n\t\t\treturn;\n\t\t}\n\t\t// otherwise update standalone (browser to PWA or PWA to browser)\n\t\tstandalone = matches;\n\t});\n}\nexport function isStandalone(): boolean {\n\treturn standalone;\n}\n\n// Visible means that the feature is enabled, not necessarily being rendered\n// e.g. visible is true even in fullscreen mode where the controls are hidden\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible\nexport function isWCOEnabled(): boolean {\n\treturn (navigator as any)?.windowControlsOverlay?.visible;\n}\n\n// Returns the bounding rect of the titlebar area if it is supported and defined\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect\nexport function getWCOBoundingRect(): DOMRect | undefined {\n\treturn (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from 'vs/nls';\n\nexport const LANGUAGE_DEFAULT = 'en';\n\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale: string | undefined = undefined;\nlet _language: string = LANGUAGE_DEFAULT;\nlet _platformLocale: string = LANGUAGE_DEFAULT;\nlet _translationsConfigFile: string | undefined = undefined;\nlet _userAgent: string | undefined = undefined;\n\nexport interface IProcessEnvironment {\n\t[key: string]: string | undefined;\n}\n\n/**\n * This interface is intentionally not identical to node.js\n * process because it also works in sandboxed environments\n * where the process object is implemented differently. We\n * define the properties here that we need for `platform`\n * to work and nothing else.\n */\nexport interface INodeProcess {\n\tplatform: string;\n\tarch: string;\n\tenv: IProcessEnvironment;\n\tversions?: {\n\t\tnode?: string;\n\t\telectron?: string;\n\t\tchrome?: string;\n\t};\n\ttype?: string;\n\tcwd: () => string;\n}\n\ndeclare const process: INodeProcess;\n\nconst $globalThis: any = globalThis;\n\nlet nodeProcess: INodeProcess | undefined = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n\t// Native environment (sandboxed)\n\tnodeProcess = $globalThis.vscode.process;\n} else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n\t// Native environment (non-sandboxed)\n\tnodeProcess = process;\n}\n\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n\ninterface INavigator {\n\tuserAgent: string;\n\tmaxTouchPoints?: number;\n\tlanguage: string;\n}\ndeclare const navigator: INavigator;\n\n// Native environment\nif (typeof nodeProcess === 'object') {\n\t_isWindows = (nodeProcess.platform === 'win32');\n\t_isMacintosh = (nodeProcess.platform === 'darwin');\n\t_isLinux = (nodeProcess.platform === 'linux');\n\t_isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n\t_isElectron = isElectronProcess;\n\t_isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n\t_locale = LANGUAGE_DEFAULT;\n\t_language = LANGUAGE_DEFAULT;\n\tconst rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n\tif (rawNlsConfig) {\n\t\ttry {\n\t\t\tconst nlsConfig: nls.INLSConfiguration = JSON.parse(rawNlsConfig);\n\t\t\t_locale = nlsConfig.userLocale;\n\t\t\t_platformLocale = nlsConfig.osLocale;\n\t\t\t_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;\n\t\t\t_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;\n\t\t} catch (e) {\n\t\t}\n\t}\n\t_isNative = true;\n}\n\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n\t_userAgent = navigator.userAgent;\n\t_isWindows = _userAgent.indexOf('Windows') >= 0;\n\t_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n\t_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n\t_isLinux = _userAgent.indexOf('Linux') >= 0;\n\t_isMobile = _userAgent?.indexOf('Mobi') >= 0;\n\t_isWeb = true;\n\t// VSCODE_GLOBALS: NLS\n\t_language = globalThis._VSCODE_NLS_LANGUAGE || LANGUAGE_DEFAULT;\n\t_locale = navigator.language.toLowerCase();\n\t_platformLocale = _locale;\n}\n\n// Unknown environment\nelse {\n\tconsole.error('Unable to resolve platform.');\n}\n\nexport const enum Platform {\n\tWeb,\n\tMac,\n\tLinux,\n\tWindows\n}\nexport type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';\n\nexport function PlatformToString(platform: Platform): PlatformName {\n\tswitch (platform) {\n\t\tcase Platform.Web: return 'Web';\n\t\tcase Platform.Mac: return 'Mac';\n\t\tcase Platform.Linux: return 'Linux';\n\t\tcase Platform.Windows: return 'Windows';\n\t}\n}\n\nlet _platform: Platform = Platform.Web;\nif (_isMacintosh) {\n\t_platform = Platform.Mac;\n} else if (_isWindows) {\n\t_platform = Platform.Windows;\n} else if (_isLinux) {\n\t_platform = Platform.Linux;\n}\n\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isLinuxSnap = _isLinuxSnap;\nexport const isNative = _isNative;\nexport const isElectron = _isElectron;\nexport const isWeb = _isWeb;\nexport const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexport const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;\nexport const isIOS = _isIOS;\nexport const isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexport const isCI = _isCI;\nexport const platform = _platform;\nexport const userAgent = _userAgent;\n\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese or de for German)\n */\nexport const language = _language;\n\nexport namespace Language {\n\n\texport function value(): string {\n\t\treturn language;\n\t}\n\n\texport function isDefaultVariant(): boolean {\n\t\tif (language.length === 2) {\n\t\t\treturn language === 'en';\n\t\t} else if (language.length >= 3) {\n\t\t\treturn language[0] === 'e' && language[1] === 'n' && language[2] === '-';\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\texport function isDefault(): boolean {\n\t\treturn language === 'en';\n\t}\n}\n\n/**\n * Desktop: The OS locale or the locale specified by --locale or `argv.json`.\n * Web: matches `platformLocale`.\n *\n * The UI is not necessarily shown in the provided locale.\n */\nexport const locale = _locale;\n\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified otherwise. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexport const platformLocale = _platformLocale;\n\n/**\n * The translations that are available through language packs.\n */\nexport const translationsConfigFile = _translationsConfigFile;\n\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexport const setTimeout0 = (() => {\n\tif (setTimeout0IsFaster) {\n\t\tinterface IQueueElement {\n\t\t\tid: number;\n\t\t\tcallback: () => void;\n\t\t}\n\t\tconst pending: IQueueElement[] = [];\n\n\t\t$globalThis.addEventListener('message', (e: any) => {\n\t\t\tif (e.data && e.data.vscodeScheduleAsyncWork) {\n\t\t\t\tfor (let i = 0, len = pending.length; i < len; i++) {\n\t\t\t\t\tconst candidate = pending[i];\n\t\t\t\t\tif (candidate.id === e.data.vscodeScheduleAsyncWork) {\n\t\t\t\t\t\tpending.splice(i, 1);\n\t\t\t\t\t\tcandidate.callback();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tlet lastId = 0;\n\t\treturn (callback: () => void) => {\n\t\t\tconst myId = ++lastId;\n\t\t\tpending.push({\n\t\t\t\tid: myId,\n\t\t\t\tcallback: callback\n\t\t\t});\n\t\t\t$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n\t\t};\n\t}\n\treturn (callback: () => void) => setTimeout(callback);\n})();\n\nexport const enum OperatingSystem {\n\tWindows = 1,\n\tMacintosh = 2,\n\tLinux = 3\n}\nexport const OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));\n\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian(): boolean {\n\tif (!_isLittleEndianComputed) {\n\t\t_isLittleEndianComputed = true;\n\t\tconst test = new Uint8Array(2);\n\t\ttest[0] = 1;\n\t\ttest[1] = 2;\n\t\tconst view = new Uint16Array(test.buffer);\n\t\t_isLittleEndian = (view[0] === (2 << 8) + 1);\n\t}\n\treturn _isLittleEndian;\n}\n\nexport const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);\nexport const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);\nexport const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));\nexport const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);\nexport const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);\n\nexport function isBigSurOrNewer(osVersion: string): boolean {\n\treturn parseFloat(osVersion) >= 20;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as platform from 'vs/base/common/platform';\n\nexport const enum KeyboardSupport {\n\tAlways,\n\tFullScreen,\n\tNone\n}\n\nconst safeNavigator = typeof navigator === 'object' ? navigator : {} as { [key: string]: any };\n\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexport const BrowserFeatures = {\n\tclipboard: {\n\t\twriteText: (\n\t\t\tplatform.isNative\n\t\t\t|| (document.queryCommandSupported && document.queryCommandSupported('copy'))\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)\n\t\t),\n\t\treadText: (\n\t\t\tplatform.isNative\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText)\n\t\t)\n\t},\n\tkeyboard: (() => {\n\t\tif (platform.isNative || browser.isStandalone()) {\n\t\t\treturn KeyboardSupport.Always;\n\t\t}\n\n\t\tif ((safeNavigator).keyboard || browser.isSafari) {\n\t\t\treturn KeyboardSupport.FullScreen;\n\t\t}\n\n\t\treturn KeyboardSupport.None;\n\t})(),\n\n\t// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\ttouch: 'ontouchstart' in mainWindow || safeNavigator.maxTouchPoints > 0,\n\tpointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)\n};\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Virtual Key Codes, the value does not hold any inherent meaning.\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n * But these are \"more general\", as they should work across browsers & OS`s.\n */\nexport const enum KeyCode {\n\tDependsOnKbLayout = -1,\n\n\t/**\n\t * Placed first to cover the 0 value of the enum.\n\t */\n\tUnknown = 0,\n\n\tBackspace,\n\tTab,\n\tEnter,\n\tShift,\n\tCtrl,\n\tAlt,\n\tPauseBreak,\n\tCapsLock,\n\tEscape,\n\tSpace,\n\tPageUp,\n\tPageDown,\n\tEnd,\n\tHome,\n\tLeftArrow,\n\tUpArrow,\n\tRightArrow,\n\tDownArrow,\n\tInsert,\n\tDelete,\n\n\tDigit0,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\n\tMeta,\n\tContextMenu,\n\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\n\tNumLock,\n\tScrollLock,\n\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ';:' key\n\t */\n\tSemicolon,\n\t/**\n\t * For any country/region, the '+' key\n\t * For the US standard keyboard, the '=+' key\n\t */\n\tEqual,\n\t/**\n\t * For any country/region, the ',' key\n\t * For the US standard keyboard, the ',<' key\n\t */\n\tComma,\n\t/**\n\t * For any country/region, the '-' key\n\t * For the US standard keyboard, the '-_' key\n\t */\n\tMinus,\n\t/**\n\t * For any country/region, the '.' key\n\t * For the US standard keyboard, the '.>' key\n\t */\n\tPeriod,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '/?' key\n\t */\n\tSlash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '`~' key\n\t */\n\tBackquote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '[{' key\n\t */\n\tBracketLeft,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '\\|' key\n\t */\n\tBackslash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ']}' key\n\t */\n\tBracketRight,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ''\"' key\n\t */\n\tQuote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t */\n\tOEM_8,\n\t/**\n\t * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\n\t */\n\tIntlBackslash,\n\n\tNumpad0, // VK_NUMPAD0, 0x60, Numeric keypad 0 key\n\tNumpad1, // VK_NUMPAD1, 0x61, Numeric keypad 1 key\n\tNumpad2, // VK_NUMPAD2, 0x62, Numeric keypad 2 key\n\tNumpad3, // VK_NUMPAD3, 0x63, Numeric keypad 3 key\n\tNumpad4, // VK_NUMPAD4, 0x64, Numeric keypad 4 key\n\tNumpad5, // VK_NUMPAD5, 0x65, Numeric keypad 5 key\n\tNumpad6, // VK_NUMPAD6, 0x66, Numeric keypad 6 key\n\tNumpad7, // VK_NUMPAD7, 0x67, Numeric keypad 7 key\n\tNumpad8, // VK_NUMPAD8, 0x68, Numeric keypad 8 key\n\tNumpad9, // VK_NUMPAD9, 0x69, Numeric keypad 9 key\n\n\tNumpadMultiply,\t// VK_MULTIPLY, 0x6A, Multiply key\n\tNumpadAdd,\t\t// VK_ADD, 0x6B, Add key\n\tNUMPAD_SEPARATOR,\t// VK_SEPARATOR, 0x6C, Separator key\n\tNumpadSubtract,\t// VK_SUBTRACT, 0x6D, Subtract key\n\tNumpadDecimal,\t// VK_DECIMAL, 0x6E, Decimal key\n\tNumpadDivide,\t// VK_DIVIDE, 0x6F,\n\n\t/**\n\t * Cover all key codes when IME is processing input.\n\t */\n\tKEY_IN_COMPOSITION,\n\n\tABNT_C1, // Brazilian (ABNT) Keyboard\n\tABNT_C2, // Brazilian (ABNT) Keyboard\n\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tMediaPlayPause,\n\tLaunchMediaPlayer,\n\tLaunchMail,\n\tLaunchApp2,\n\n\t/**\n\t * VK_CLEAR, 0x0C, CLEAR key\n\t */\n\tClear,\n\n\t/**\n\t * Placed last to cover the length of the enum.\n\t * Please do not depend on this value!\n\t */\n\tMAX_VALUE\n}\n\n/**\n * keyboardEvent.code\n */\nexport const enum ScanCode {\n\tDependsOnKbLayout = -1,\n\tNone,\n\tHyper,\n\tSuper,\n\tFn,\n\tFnLock,\n\tSuspend,\n\tResume,\n\tTurbo,\n\tSleep,\n\tWakeUp,\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\tDigit0,\n\tEnter,\n\tEscape,\n\tBackspace,\n\tTab,\n\tSpace,\n\tMinus,\n\tEqual,\n\tBracketLeft,\n\tBracketRight,\n\tBackslash,\n\tIntlHash,\n\tSemicolon,\n\tQuote,\n\tBackquote,\n\tComma,\n\tPeriod,\n\tSlash,\n\tCapsLock,\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tPrintScreen,\n\tScrollLock,\n\tPause,\n\tInsert,\n\tHome,\n\tPageUp,\n\tDelete,\n\tEnd,\n\tPageDown,\n\tArrowRight,\n\tArrowLeft,\n\tArrowDown,\n\tArrowUp,\n\tNumLock,\n\tNumpadDivide,\n\tNumpadMultiply,\n\tNumpadSubtract,\n\tNumpadAdd,\n\tNumpadEnter,\n\tNumpad1,\n\tNumpad2,\n\tNumpad3,\n\tNumpad4,\n\tNumpad5,\n\tNumpad6,\n\tNumpad7,\n\tNumpad8,\n\tNumpad9,\n\tNumpad0,\n\tNumpadDecimal,\n\tIntlBackslash,\n\tContextMenu,\n\tPower,\n\tNumpadEqual,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\tOpen,\n\tHelp,\n\tSelect,\n\tAgain,\n\tUndo,\n\tCut,\n\tCopy,\n\tPaste,\n\tFind,\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\tNumpadComma,\n\tIntlRo,\n\tKanaMode,\n\tIntlYen,\n\tConvert,\n\tNonConvert,\n\tLang1,\n\tLang2,\n\tLang3,\n\tLang4,\n\tLang5,\n\tAbort,\n\tProps,\n\tNumpadParenLeft,\n\tNumpadParenRight,\n\tNumpadBackspace,\n\tNumpadMemoryStore,\n\tNumpadMemoryRecall,\n\tNumpadMemoryClear,\n\tNumpadMemoryAdd,\n\tNumpadMemorySubtract,\n\tNumpadClear,\n\tNumpadClearEntry,\n\tControlLeft,\n\tShiftLeft,\n\tAltLeft,\n\tMetaLeft,\n\tControlRight,\n\tShiftRight,\n\tAltRight,\n\tMetaRight,\n\tBrightnessUp,\n\tBrightnessDown,\n\tMediaPlay,\n\tMediaRecord,\n\tMediaFastForward,\n\tMediaRewind,\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tEject,\n\tMediaPlayPause,\n\tMediaSelect,\n\tLaunchMail,\n\tLaunchApp2,\n\tLaunchApp1,\n\tSelectTask,\n\tLaunchScreenSaver,\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\tBrowserStop,\n\tBrowserRefresh,\n\tBrowserFavorites,\n\tZoomToggle,\n\tMailReply,\n\tMailForward,\n\tMailSend,\n\n\tMAX_VALUE\n}\n\nclass KeyCodeStrMap {\n\n\tpublic _keyCodeToStr: string[];\n\tpublic _strToKeyCode: { [str: string]: KeyCode };\n\n\tconstructor() {\n\t\tthis._keyCodeToStr = [];\n\t\tthis._strToKeyCode = Object.create(null);\n\t}\n\n\tdefine(keyCode: KeyCode, str: string): void {\n\t\tthis._keyCodeToStr[keyCode] = str;\n\t\tthis._strToKeyCode[str.toLowerCase()] = keyCode;\n\t}\n\n\tkeyCodeToStr(keyCode: KeyCode): string {\n\t\treturn this._keyCodeToStr[keyCode];\n\t}\n\n\tstrToKeyCode(str: string): KeyCode {\n\t\treturn this._strToKeyCode[str.toLowerCase()] || KeyCode.Unknown;\n\t}\n}\n\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexport const EVENT_KEY_CODE_MAP: { [keyCode: number]: KeyCode } = new Array(230);\nexport const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE: { [nativeKeyCode: string]: KeyCode } = {};\nconst scanCodeIntToStr: string[] = [];\nconst scanCodeStrToInt: { [code: string]: number } = Object.create(null);\nconst scanCodeLowerCaseStrToInt: { [code: string]: number } = Object.create(null);\n\nexport const ScanCodeUtils = {\n\tlowerCaseToEnum: (scanCode: string) => scanCodeLowerCaseStrToInt[scanCode] || ScanCode.None,\n\ttoEnum: (scanCode: string) => scanCodeStrToInt[scanCode] || ScanCode.None,\n\ttoString: (scanCode: ScanCode) => scanCodeIntToStr[scanCode] || 'None'\n};\n\n\nexport namespace KeyCodeUtils {\n\texport function toString(keyCode: KeyCode): string {\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromString(key: string): KeyCode {\n\t\treturn uiMap.strToKeyCode(key);\n\t}\n\n\texport function toUserSettingsUS(keyCode: KeyCode): string {\n\t\treturn userSettingsUSMap.keyCodeToStr(keyCode);\n\t}\n\texport function toUserSettingsGeneral(keyCode: KeyCode): string {\n\t\treturn userSettingsGeneralMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromUserSettings(key: string): KeyCode {\n\t\treturn userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n\t}\n\n\texport function toElectronAccelerator(keyCode: KeyCode): string | null {\n\t\tif (keyCode >= KeyCode.Numpad0 && keyCode <= KeyCode.NumpadDivide) {\n\t\t\t// [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n\t\t\t// renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n\t\t\t// numdiv is rendered as \"/\", numsub is rendered as \"-\".\n\t\t\t//\n\t\t\t// This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n\t\t\t// from keybindings based on regular keys.\n\t\t\t//\n\t\t\t// We therefore need to fall back to custom rendering for numpad keys.\n\t\t\treturn null;\n\t\t}\n\n\t\tswitch (keyCode) {\n\t\t\tcase KeyCode.UpArrow:\n\t\t\t\treturn 'Up';\n\t\t\tcase KeyCode.DownArrow:\n\t\t\t\treturn 'Down';\n\t\t\tcase KeyCode.LeftArrow:\n\t\t\t\treturn 'Left';\n\t\t\tcase KeyCode.RightArrow:\n\t\t\t\treturn 'Right';\n\t\t}\n\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n}\n\nexport const enum KeyMod {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n}\n\nexport function KeyChord(firstPart: number, secondPart: number): number {\n\tconst chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n\treturn (firstPart | chordPart) >>> 0;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from 'vs/base/common/errors';\nimport { KeyCode, ScanCode } from 'vs/base/common/keyCodes';\nimport { OperatingSystem } from 'vs/base/common/platform';\n\n/**\n * Binary encoding strategy:\n * ```\n * 1111 11\n * 5432 1098 7654 3210\n * ---- CSAW KKKK KKKK\n * C = bit 11 = ctrlCmd flag\n * S = bit 10 = shift flag\n * A = bit 9 = alt flag\n * W = bit 8 = winCtrl flag\n * K = bits 0-7 = key code\n * ```\n */\nconst enum BinaryKeybindingsMask {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n\tKeyCode = 0x000000FF\n}\n\nexport function decodeKeybinding(keybinding: number | number[], OS: OperatingSystem): Keybinding | null {\n\tif (typeof keybinding === 'number') {\n\t\tif (keybinding === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tconst firstChord = (keybinding & 0x0000FFFF) >>> 0;\n\t\tconst secondChord = (keybinding & 0xFFFF0000) >>> 16;\n\t\tif (secondChord !== 0) {\n\t\t\treturn new Keybinding([\n\t\t\t\tcreateSimpleKeybinding(firstChord, OS),\n\t\t\t\tcreateSimpleKeybinding(secondChord, OS)\n\t\t\t]);\n\t\t}\n\t\treturn new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n\t} else {\n\t\tconst chords = [];\n\t\tfor (let i = 0; i < keybinding.length; i++) {\n\t\t\tchords.push(createSimpleKeybinding(keybinding[i], OS));\n\t\t}\n\t\treturn new Keybinding(chords);\n\t}\n}\n\nexport function createSimpleKeybinding(keybinding: number, OS: OperatingSystem): KeyCodeChord {\n\n\tconst ctrlCmd = (keybinding & BinaryKeybindingsMask.CtrlCmd ? true : false);\n\tconst winCtrl = (keybinding & BinaryKeybindingsMask.WinCtrl ? true : false);\n\n\tconst ctrlKey = (OS === OperatingSystem.Macintosh ? winCtrl : ctrlCmd);\n\tconst shiftKey = (keybinding & BinaryKeybindingsMask.Shift ? true : false);\n\tconst altKey = (keybinding & BinaryKeybindingsMask.Alt ? true : false);\n\tconst metaKey = (OS === OperatingSystem.Macintosh ? ctrlCmd : winCtrl);\n\tconst keyCode = (keybinding & BinaryKeybindingsMask.KeyCode);\n\n\treturn new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n\nexport interface Modifiers {\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n}\n\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class KeyCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyCode: KeyCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof KeyCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.keyCode === other.keyCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;\n\t}\n\n\tpublic isModifierKey(): boolean {\n\t\treturn (\n\t\t\tthis.keyCode === KeyCode.Unknown\n\t\t\t|| this.keyCode === KeyCode.Ctrl\n\t\t\t|| this.keyCode === KeyCode.Meta\n\t\t\t|| this.keyCode === KeyCode.Alt\n\t\t\t|| this.keyCode === KeyCode.Shift\n\t\t);\n\t}\n\n\tpublic toKeybinding(): Keybinding {\n\t\treturn new Keybinding([this]);\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && this.keyCode === KeyCode.Ctrl)\n\t\t\t|| (this.shiftKey && this.keyCode === KeyCode.Shift)\n\t\t\t|| (this.altKey && this.keyCode === KeyCode.Alt)\n\t\t\t|| (this.metaKey && this.keyCode === KeyCode.Meta)\n\t\t);\n\t}\n}\n\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class ScanCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly scanCode: ScanCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof ScanCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.scanCode === other.scanCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && (this.scanCode === ScanCode.ControlLeft || this.scanCode === ScanCode.ControlRight))\n\t\t\t|| (this.shiftKey && (this.scanCode === ScanCode.ShiftLeft || this.scanCode === ScanCode.ShiftRight))\n\t\t\t|| (this.altKey && (this.scanCode === ScanCode.AltLeft || this.scanCode === ScanCode.AltRight))\n\t\t\t|| (this.metaKey && (this.scanCode === ScanCode.MetaLeft || this.scanCode === ScanCode.MetaRight))\n\t\t);\n\t}\n}\n\nexport type Chord = KeyCodeChord | ScanCodeChord;\n\n/**\n * A keybinding is a sequence of chords.\n */\nexport class Keybinding {\n\n\tpublic readonly chords: Chord[];\n\n\tconstructor(chords: Chord[]) {\n\t\tif (chords.length === 0) {\n\t\t\tthrow illegalArgument(`chords`);\n\t\t}\n\t\tthis.chords = chords;\n\t}\n\n\tpublic getHashCode(): string {\n\t\tlet result = '';\n\t\tfor (let i = 0, len = this.chords.length; i < len; i++) {\n\t\t\tif (i !== 0) {\n\t\t\t\tresult += ';';\n\t\t\t}\n\t\t\tresult += this.chords[i].getHashCode();\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic equals(other: Keybinding | null): boolean {\n\t\tif (other === null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.chords.length !== other.chords.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < this.chords.length; i++) {\n\t\t\tif (!this.chords[i].equals(other.chords[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\nexport class ResolvedChord {\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyLabel: string | null,\n\t\tpublic readonly keyAriaLabel: string | null\n\t) { }\n}\n\nexport type SingleModifierChord = 'ctrl' | 'shift' | 'alt' | 'meta';\n\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nexport abstract class ResolvedKeybinding {\n\t/**\n\t * This prints the binding in a format suitable for displaying in the UI.\n\t */\n\tpublic abstract getLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for ARIA.\n\t */\n\tpublic abstract getAriaLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for electron's accelerators.\n\t * See https://github.com/electron/electron/blob/master/docs/api/accelerator.md\n\t */\n\tpublic abstract getElectronAccelerator(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for user settings.\n\t */\n\tpublic abstract getUserSettingsLabel(): string | null;\n\t/**\n\t * Is the user settings label reflecting the label?\n\t */\n\tpublic abstract isWYSIWYG(): boolean;\n\t/**\n\t * Does the keybinding consist of more than one chord?\n\t */\n\tpublic abstract hasMultipleChords(): boolean;\n\t/**\n\t * Returns the chords that comprise of the keybinding.\n\t */\n\tpublic abstract getChords(): ResolvedChord[];\n\t/**\n\t * Returns the chords as strings useful for dispatching.\n\t * Returns null for modifier only chords.\n\t * @example keybinding \"Shift\" -> null\n\t * @example keybinding (\"D\" with shift == true) -> \"shift+D\"\n\t */\n\tpublic abstract getDispatchChords(): (string | null)[];\n\t/**\n\t * Returns the modifier only chords as strings useful for dispatching.\n\t * Returns null for chords that contain more than one modifier or a regular key.\n\t * @example keybinding \"Shift\" -> \"shift\"\n\t * @example keybinding (\"D\" with shift == true\") -> null\n\t */\n\tpublic abstract getSingleModifierDispatchChords(): (SingleModifierChord | null)[];\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { EVENT_KEY_CODE_MAP, KeyCode, KeyCodeUtils, KeyMod } from 'vs/base/common/keyCodes';\nimport { KeyCodeChord } from 'vs/base/common/keybindings';\nimport * as platform from 'vs/base/common/platform';\n\n\n\nfunction extractKeyCode(e: KeyboardEvent): KeyCode {\n\tif (e.charCode) {\n\t\t// \"keypress\" events mostly\n\t\tconst char = String.fromCharCode(e.charCode).toUpperCase();\n\t\treturn KeyCodeUtils.fromString(char);\n\t}\n\n\tconst keyCode = e.keyCode;\n\n\t// browser quirks\n\tif (keyCode === 3) {\n\t\treturn KeyCode.PauseBreak;\n\t} else if (browser.isFirefox) {\n\t\tswitch (keyCode) {\n\t\t\tcase 59: return KeyCode.Semicolon;\n\t\t\tcase 60:\n\t\t\t\tif (platform.isLinux) { return KeyCode.IntlBackslash; }\n\t\t\t\tbreak;\n\t\t\tcase 61: return KeyCode.Equal;\n\t\t\t// based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n\t\t\tcase 107: return KeyCode.NumpadAdd;\n\t\t\tcase 109: return KeyCode.NumpadSubtract;\n\t\t\tcase 173: return KeyCode.Minus;\n\t\t\tcase 224:\n\t\t\t\tif (platform.isMacintosh) { return KeyCode.Meta; }\n\t\t\t\tbreak;\n\t\t}\n\t} else if (browser.isWebKit) {\n\t\tif (platform.isMacintosh && keyCode === 93) {\n\t\t\t// the two meta keys in the Mac have different key codes (91 and 93)\n\t\t\treturn KeyCode.Meta;\n\t\t} else if (!platform.isMacintosh && keyCode === 92) {\n\t\t\treturn KeyCode.Meta;\n\t\t}\n\t}\n\n\t// cross browser keycodes:\n\treturn EVENT_KEY_CODE_MAP[keyCode] || KeyCode.Unknown;\n}\n\nexport interface IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand: true;\n\n\treadonly browserEvent: KeyboardEvent;\n\treadonly target: HTMLElement;\n\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly altGraphKey: boolean;\n\treadonly keyCode: KeyCode;\n\treadonly code: string;\n\n\t/**\n\t * @internal\n\t */\n\ttoKeyCodeChord(): KeyCodeChord;\n\tequals(keybinding: number): boolean;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nconst ctrlKeyMod = (platform.isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd);\nconst altKeyMod = KeyMod.Alt;\nconst shiftKeyMod = KeyMod.Shift;\nconst metaKeyMod = (platform.isMacintosh ? KeyMod.CtrlCmd : KeyMod.WinCtrl);\n\nexport function printKeyboardEvent(e: KeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;\n}\n\nexport function printStandardKeyboardEvent(e: StandardKeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${KeyCodeUtils.toString(e.keyCode)}')`;\n}\n\nexport class StandardKeyboardEvent implements IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand = true;\n\n\tpublic readonly browserEvent: KeyboardEvent;\n\tpublic readonly target: HTMLElement;\n\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly altGraphKey: boolean;\n\tpublic readonly keyCode: KeyCode;\n\tpublic readonly code: string;\n\n\tprivate _asKeybinding: number;\n\tprivate _asKeyCodeChord: KeyCodeChord;\n\n\tconstructor(source: KeyboardEvent) {\n\t\tconst e = source;\n\n\t\tthis.browserEvent = e;\n\t\tthis.target = e.target;\n\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\t\tthis.altGraphKey = e.getModifierState?.('AltGraph');\n\t\tthis.keyCode = extractKeyCode(e);\n\t\tthis.code = e.code;\n\n\t\t// console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n\n\t\tthis.ctrlKey = this.ctrlKey || this.keyCode === KeyCode.Ctrl;\n\t\tthis.altKey = this.altKey || this.keyCode === KeyCode.Alt;\n\t\tthis.shiftKey = this.shiftKey || this.keyCode === KeyCode.Shift;\n\t\tthis.metaKey = this.metaKey || this.keyCode === KeyCode.Meta;\n\n\t\tthis._asKeybinding = this._computeKeybinding();\n\t\tthis._asKeyCodeChord = this._computeKeyCodeChord();\n\n\t\t// console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n\t}\n\n\tpublic preventDefault(): void {\n\t\tif (this.browserEvent && this.browserEvent.preventDefault) {\n\t\t\tthis.browserEvent.preventDefault();\n\t\t}\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tif (this.browserEvent && this.browserEvent.stopPropagation) {\n\t\t\tthis.browserEvent.stopPropagation();\n\t\t}\n\t}\n\n\tpublic toKeyCodeChord(): KeyCodeChord {\n\t\treturn this._asKeyCodeChord;\n\t}\n\n\tpublic equals(other: number): boolean {\n\t\treturn this._asKeybinding === other;\n\t}\n\n\tprivate _computeKeybinding(): number {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\n\t\tlet result = 0;\n\t\tif (this.ctrlKey) {\n\t\t\tresult |= ctrlKeyMod;\n\t\t}\n\t\tif (this.altKey) {\n\t\t\tresult |= altKeyMod;\n\t\t}\n\t\tif (this.shiftKey) {\n\t\t\tresult |= shiftKeyMod;\n\t\t}\n\t\tif (this.metaKey) {\n\t\t\tresult |= metaKeyMod;\n\t\t}\n\t\tresult |= key;\n\n\t\treturn result;\n\t}\n\n\tprivate _computeKeyCodeChord(): KeyCodeChord {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\t\treturn new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Represents a window in a possible chain of iframes\n */\ninterface IWindowChainElement {\n\t/**\n\t * The window object for it\n\t */\n\treadonly window: WeakRef;\n\t/**\n\t * The iframe element inside the window.parent corresponding to window\n\t */\n\treadonly iframeElement: Element | null;\n}\n\nconst sameOriginWindowChainCache = new WeakMap();\n\nfunction getParentWindowIfSameOrigin(w: Window): Window | null {\n\tif (!w.parent || w.parent === w) {\n\t\treturn null;\n\t}\n\n\t// Cannot really tell if we have access to the parent window unless we try to access something in it\n\ttry {\n\t\tconst location = w.location;\n\t\tconst parentLocation = w.parent.location;\n\t\tif (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n\t\t\treturn null;\n\t\t}\n\t} catch (e) {\n\t\treturn null;\n\t}\n\n\treturn w.parent;\n}\n\nexport class IframeUtils {\n\n\t/**\n\t * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n\t * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n\t */\n\tprivate static getSameOriginWindowChain(targetWindow: Window): IWindowChainElement[] {\n\t\tlet windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n\t\tif (!windowChainCache) {\n\t\t\twindowChainCache = [];\n\t\t\tsameOriginWindowChainCache.set(targetWindow, windowChainCache);\n\t\t\tlet w: Window | null = targetWindow;\n\t\t\tlet parent: Window | null;\n\t\t\tdo {\n\t\t\t\tparent = getParentWindowIfSameOrigin(w);\n\t\t\t\tif (parent) {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: w.frameElement || null\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: null\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tw = parent;\n\t\t\t} while (w);\n\t\t}\n\t\treturn windowChainCache.slice(0);\n\t}\n\n\t/**\n\t * Returns the position of `childWindow` relative to `ancestorWindow`\n\t */\n\tpublic static getPositionOfChildWindowRelativeToAncestorWindow(childWindow: Window, ancestorWindow: Window | null) {\n\n\t\tif (!ancestorWindow || childWindow === ancestorWindow) {\n\t\t\treturn {\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0\n\t\t\t};\n\t\t}\n\n\t\tlet top = 0, left = 0;\n\n\t\tconst windowChain = this.getSameOriginWindowChain(childWindow);\n\n\t\tfor (const windowChainEl of windowChain) {\n\t\t\tconst windowInChain = windowChainEl.window.deref();\n\t\t\ttop += windowInChain?.scrollY ?? 0;\n\t\t\tleft += windowInChain?.scrollX ?? 0;\n\n\t\t\tif (windowInChain === ancestorWindow) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!windowChainEl.iframeElement) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n\t\t\ttop += boundingRect.top;\n\t\t\tleft += boundingRect.left;\n\t\t}\n\n\t\treturn {\n\t\t\ttop: top,\n\t\t\tleft: left\n\t\t};\n\t}\n}\n\n/**\n * Returns a sha-256 composed of `parentOrigin` and `salt` converted to base 32\n */\nexport async function parentOriginHash(parentOrigin: string, salt: string): Promise {\n\t// This same code is also inlined at `src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html`\n\tif (!crypto.subtle) {\n\t\tthrow new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);\n\t}\n\n\tconst strData = JSON.stringify({ parentOrigin, salt });\n\tconst encoder = new TextEncoder();\n\tconst arrData = encoder.encode(strData);\n\tconst hash = await crypto.subtle.digest('sha-256', arrData);\n\treturn sha256AsBase32(hash);\n}\n\nfunction sha256AsBase32(bytes: ArrayBuffer): string {\n\tconst array = Array.from(new Uint8Array(bytes));\n\tconst hexArray = array.map(b => b.toString(16).padStart(2, '0')).join('');\n\t// sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32\n\treturn BigInt(`0x${hexArray}`).toString(32).padStart(52, '0');\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { IframeUtils } from 'vs/base/browser/iframe';\nimport * as platform from 'vs/base/common/platform';\n\nexport interface IMouseEvent {\n\treadonly browserEvent: MouseEvent;\n\treadonly leftButton: boolean;\n\treadonly middleButton: boolean;\n\treadonly rightButton: boolean;\n\treadonly buttons: number;\n\treadonly target: HTMLElement;\n\treadonly detail: number;\n\treadonly posx: number;\n\treadonly posy: number;\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly timestamp: number;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport class StandardMouseEvent implements IMouseEvent {\n\n\tpublic readonly browserEvent: MouseEvent;\n\n\tpublic readonly leftButton: boolean;\n\tpublic readonly middleButton: boolean;\n\tpublic readonly rightButton: boolean;\n\tpublic readonly buttons: number;\n\tpublic readonly target: HTMLElement;\n\tpublic detail: number;\n\tpublic readonly posx: number;\n\tpublic readonly posy: number;\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly timestamp: number;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tthis.timestamp = Date.now();\n\t\tthis.browserEvent = e;\n\t\tthis.leftButton = e.button === 0;\n\t\tthis.middleButton = e.button === 1;\n\t\tthis.rightButton = e.button === 2;\n\t\tthis.buttons = e.buttons;\n\n\t\tthis.target = e.target;\n\n\t\tthis.detail = e.detail || 1;\n\t\tif (e.type === 'dblclick') {\n\t\t\tthis.detail = 2;\n\t\t}\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\n\t\tif (typeof e.pageX === 'number') {\n\t\t\tthis.posx = e.pageX;\n\t\t\tthis.posy = e.pageY;\n\t\t} else {\n\t\t\t// Probably hit by MSGestureEvent\n\t\t\tthis.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n\t\t\tthis.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n\t\t}\n\n\t\t// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n\t\tconst iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n\t\tthis.posx -= iframeOffsets.left;\n\t\tthis.posy -= iframeOffsets.top;\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent.stopPropagation();\n\t}\n}\n\nexport class DragMouseEvent extends StandardMouseEvent {\n\n\tpublic readonly dataTransfer: DataTransfer;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tsuper(targetWindow, e);\n\t\tthis.dataTransfer = (e).dataTransfer;\n\t}\n}\n\nexport interface IMouseWheelEvent extends MouseEvent {\n\treadonly wheelDelta: number;\n\treadonly wheelDeltaX: number;\n\treadonly wheelDeltaY: number;\n\n\treadonly deltaX: number;\n\treadonly deltaY: number;\n\treadonly deltaZ: number;\n\treadonly deltaMode: number;\n}\n\ninterface IWebKitMouseWheelEvent {\n\twheelDeltaY: number;\n\twheelDeltaX: number;\n}\n\ninterface IGeckoMouseWheelEvent {\n\tHORIZONTAL_AXIS: number;\n\tVERTICAL_AXIS: number;\n\taxis: number;\n\tdetail: number;\n}\n\nexport class StandardWheelEvent {\n\n\tpublic readonly browserEvent: IMouseWheelEvent | null;\n\tpublic readonly deltaY: number;\n\tpublic readonly deltaX: number;\n\tpublic readonly target: Node;\n\n\tconstructor(e: IMouseWheelEvent | null, deltaX: number = 0, deltaY: number = 0) {\n\n\t\tthis.browserEvent = e || null;\n\t\tthis.target = e ? (e.target || (e).targetNode || e.srcElement) : null;\n\n\t\tthis.deltaY = deltaY;\n\t\tthis.deltaX = deltaX;\n\n\t\tlet shouldFactorDPR: boolean = false;\n\t\tif (browser.isChrome) {\n\t\t\t// Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.\n\t\t\t// See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61\n\t\t\tconst chromeVersionMatch = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n\t\t\tconst chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;\n\t\t\tshouldFactorDPR = chromeMajorVersion <= 122;\n\t\t}\n\n\t\tif (e) {\n\t\t\t// Old (deprecated) wheel events\n\t\t\tconst e1 = e;\n\t\t\tconst e2 = e;\n\t\t\tconst devicePixelRatio = e.view?.devicePixelRatio || 1;\n\n\t\t\t// vertical delta scroll\n\t\t\tif (typeof e1.wheelDeltaY !== 'undefined') {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n\t\t\t\tthis.deltaY = -e2.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = -e.deltaY / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// horizontal delta scroll\n\t\t\tif (typeof e1.wheelDeltaX !== 'undefined') {\n\t\t\t\tif (browser.isSafari && platform.isWindows) {\n\t\t\t\t\tthis.deltaX = - (e1.wheelDeltaX / 120);\n\t\t\t\t} else if (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n\t\t\t\tthis.deltaX = -e.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = -e.deltaX / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Assume a vertical scroll if nothing else worked\n\t\t\tif (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e.wheelDelta / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e.wheelDelta / 120;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent?.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent?.stopPropagation();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexport const MicrotaskDelay = Symbol('MicrotaskDelay');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';\nimport { BugIndicatingError, CancellationError } from 'vs/base/common/errors';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { setTimeout0 } from 'vs/base/common/platform';\nimport { MicrotaskDelay } from './symbols';\nimport { Lazy } from 'vs/base/common/lazy';\n\nexport function isThenable(obj: unknown): obj is Promise {\n\treturn !!obj && typeof (obj as unknown as Promise).then === 'function';\n}\n\nexport interface CancelablePromise extends Promise {\n\tcancel(): void;\n}\n\nexport function createCancelablePromise(callback: (token: CancellationToken) => Promise): CancelablePromise {\n\tconst source = new CancellationTokenSource();\n\n\tconst thenable = callback(source.token);\n\tconst promise = new Promise((resolve, reject) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tPromise.resolve(thenable).then(value => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\tresolve(value);\n\t\t}, err => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\treject(err);\n\t\t});\n\t});\n\n\treturn >new class {\n\t\tcancel() {\n\t\t\tsource.cancel();\n\t\t\tsource.dispose();\n\t\t}\n\t\tthen(resolve?: ((value: T) => TResult1 | Promise) | undefined | null, reject?: ((reason: any) => TResult2 | Promise) | undefined | null): Promise {\n\t\t\treturn promise.then(resolve, reject);\n\t\t}\n\t\tcatch(reject?: ((reason: any) => TResult | Promise) | undefined | null): Promise {\n\t\t\treturn this.then(undefined, reject);\n\t\t}\n\t\tfinally(onfinally?: (() => void) | undefined | null): Promise {\n\t\t\treturn promise.finally(onfinally);\n\t\t}\n\t};\n}\n\n/**\n * Returns a promise that resolves with `undefined` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken): Promise;\n\n/**\n * Returns a promise that resolves with `defaultValue` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue: T): Promise;\n\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue?: T): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\tresolve(defaultValue);\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nexport function raceCancellationError(promise: Promise, token: CancellationToken): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nexport async function raceCancellablePromises(cancellablePromises: CancelablePromise[]): Promise {\n\tlet resolvedPromiseIndex = -1;\n\tconst promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n\ttry {\n\t\tconst result = await Promise.race(promises);\n\t\treturn result;\n\t} finally {\n\t\tcancellablePromises.forEach((cancellablePromise, index) => {\n\t\t\tif (index !== resolvedPromiseIndex) {\n\t\t\t\tcancellablePromise.cancel();\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function raceTimeout(promise: Promise, timeout: number, onTimeout?: () => void): Promise {\n\tlet promiseResolve: ((value: T | undefined) => void) | undefined = undefined;\n\n\tconst timer = setTimeout(() => {\n\t\tpromiseResolve?.(undefined);\n\t\tonTimeout?.();\n\t}, timeout);\n\n\treturn Promise.race([\n\t\tpromise.finally(() => clearTimeout(timer)),\n\t\tnew Promise(resolve => promiseResolve = resolve)\n\t]);\n}\n\nexport function asPromise(callback: () => T | PromiseLike): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst item = callback();\n\t\tif (isThenable(item)) {\n\t\t\titem.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(item);\n\t\t}\n\t});\n}\n\n/**\n * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.\n *\n * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported\n */\nexport function promiseWithResolvers(): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (err?: any) => void } {\n\tlet resolve: (value: T | PromiseLike) => void;\n\tlet reject: (reason?: any) => void;\n\tconst promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\treturn { promise, resolve: resolve!, reject: reject! };\n}\n\nexport interface ITask {\n\t(): T;\n}\n\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nexport class Throttler implements IDisposable {\n\n\tprivate activePromise: Promise | null;\n\tprivate queuedPromise: Promise | null;\n\tprivate queuedPromiseFactory: ITask> | null;\n\n\tprivate isDisposed = false;\n\n\tconstructor() {\n\t\tthis.activePromise = null;\n\t\tthis.queuedPromise = null;\n\t\tthis.queuedPromiseFactory = null;\n\t}\n\n\tqueue(promiseFactory: ITask>): Promise {\n\t\tif (this.isDisposed) {\n\t\t\treturn Promise.reject(new Error('Throttler is disposed'));\n\t\t}\n\n\t\tif (this.activePromise) {\n\t\t\tthis.queuedPromiseFactory = promiseFactory;\n\n\t\t\tif (!this.queuedPromise) {\n\t\t\t\tconst onComplete = () => {\n\t\t\t\t\tthis.queuedPromise = null;\n\n\t\t\t\t\tif (this.isDisposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = this.queue(this.queuedPromiseFactory!);\n\t\t\t\t\tthis.queuedPromiseFactory = null;\n\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\n\t\t\t\tthis.queuedPromise = new Promise(resolve => {\n\t\t\t\t\tthis.activePromise!.then(onComplete, onComplete).then(resolve);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tthis.queuedPromise!.then(resolve, reject);\n\t\t\t});\n\t\t}\n\n\t\tthis.activePromise = promiseFactory();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.activePromise!.then((result: T) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\tresolve(result);\n\t\t\t}, (err: unknown) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\treject(err);\n\t\t\t});\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class Sequencer {\n\n\tprivate current: Promise = Promise.resolve(null);\n\n\tqueue(promiseTask: ITask>): Promise {\n\t\treturn this.current = this.current.then(() => promiseTask(), () => promiseTask());\n\t}\n}\n\nexport class SequencerByKey {\n\n\tprivate promiseMap = new Map>();\n\n\tqueue(key: TKey, promiseTask: ITask>): Promise {\n\t\tconst runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n\t\tconst newPromise = runningPromise\n\t\t\t.catch(() => { })\n\t\t\t.then(promiseTask)\n\t\t\t.finally(() => {\n\t\t\t\tif (this.promiseMap.get(key) === newPromise) {\n\t\t\t\t\tthis.promiseMap.delete(key);\n\t\t\t\t}\n\t\t\t});\n\t\tthis.promiseMap.set(key, newPromise);\n\t\treturn newPromise;\n\t}\n}\n\ninterface IScheduledLater extends IDisposable {\n\tisTriggered(): boolean;\n}\n\nconst timeoutDeferred = (timeout: number, fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tconst handle = setTimeout(() => {\n\t\tscheduled = false;\n\t\tfn();\n\t}, timeout);\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => {\n\t\t\tclearTimeout(handle);\n\t\t\tscheduled = false;\n\t\t},\n\t};\n};\n\nconst microtaskDeferred = (fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tqueueMicrotask(() => {\n\t\tif (scheduled) {\n\t\t\tscheduled = false;\n\t\t\tfn();\n\t\t}\n\t});\n\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => { scheduled = false; },\n\t};\n};\n\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nexport class Delayer implements IDisposable {\n\n\tprivate deferred: IScheduledLater | null;\n\tprivate completionPromise: Promise | null;\n\tprivate doResolve: ((value?: any | Promise) => void) | null;\n\tprivate doReject: ((err: any) => void) | null;\n\tprivate task: ITask> | null;\n\n\tconstructor(public defaultDelay: number | typeof MicrotaskDelay) {\n\t\tthis.deferred = null;\n\t\tthis.completionPromise = null;\n\t\tthis.doResolve = null;\n\t\tthis.doReject = null;\n\t\tthis.task = null;\n\t}\n\n\ttrigger(task: ITask>, delay = this.defaultDelay): Promise {\n\t\tthis.task = task;\n\t\tthis.cancelTimeout();\n\n\t\tif (!this.completionPromise) {\n\t\t\tthis.completionPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis.doResolve = resolve;\n\t\t\t\tthis.doReject = reject;\n\t\t\t}).then(() => {\n\t\t\t\tthis.completionPromise = null;\n\t\t\t\tthis.doResolve = null;\n\t\t\t\tif (this.task) {\n\t\t\t\t\tconst task = this.task;\n\t\t\t\t\tthis.task = null;\n\t\t\t\t\treturn task();\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}\n\n\t\tconst fn = () => {\n\t\t\tthis.deferred = null;\n\t\t\tthis.doResolve?.(null);\n\t\t};\n\n\t\tthis.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n\n\t\treturn this.completionPromise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn !!this.deferred?.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.cancelTimeout();\n\n\t\tif (this.completionPromise) {\n\t\t\tthis.doReject?.(new CancellationError());\n\t\t\tthis.completionPromise = null;\n\t\t}\n\t}\n\n\tprivate cancelTimeout(): void {\n\t\tthis.deferred?.dispose();\n\t\tthis.deferred = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t}\n}\n\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nexport class ThrottledDelayer {\n\n\tprivate delayer: Delayer>;\n\tprivate throttler: Throttler;\n\n\tconstructor(defaultDelay: number) {\n\t\tthis.delayer = new Delayer(defaultDelay);\n\t\tthis.throttler = new Throttler();\n\t}\n\n\ttrigger(promiseFactory: ITask>, delay?: number): Promise {\n\t\treturn this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay) as unknown as Promise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn this.delayer.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.delayer.cancel();\n\t}\n\n\tdispose(): void {\n\t\tthis.delayer.dispose();\n\t\tthis.throttler.dispose();\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nexport class Barrier {\n\tprivate _isOpen: boolean;\n\tprivate _promise: Promise;\n\tprivate _completePromise!: (v: boolean) => void;\n\n\tconstructor() {\n\t\tthis._isOpen = false;\n\t\tthis._promise = new Promise((c, e) => {\n\t\t\tthis._completePromise = c;\n\t\t});\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this._isOpen;\n\t}\n\n\topen(): void {\n\t\tthis._isOpen = true;\n\t\tthis._completePromise(true);\n\t}\n\n\twait(): Promise {\n\t\treturn this._promise;\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nexport class AutoOpenBarrier extends Barrier {\n\n\tprivate readonly _timeout: any;\n\n\tconstructor(autoOpenTimeMs: number) {\n\t\tsuper();\n\t\tthis._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n\t}\n\n\toverride open(): void {\n\t\tclearTimeout(this._timeout);\n\t\tsuper.open();\n\t}\n}\n\nexport function timeout(millis: number): CancelablePromise;\nexport function timeout(millis: number, token: CancellationToken): Promise;\nexport function timeout(millis: number, token?: CancellationToken): CancelablePromise | Promise {\n\tif (!token) {\n\t\treturn createCancelablePromise(token => timeout(millis, token));\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst handle = setTimeout(() => {\n\t\t\tdisposable.dispose();\n\t\t\tresolve();\n\t\t}, millis);\n\t\tconst disposable = token.onCancellationRequested(() => {\n\t\t\tclearTimeout(handle);\n\t\t\tdisposable.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t});\n}\n\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n * // Cancel the timeout and evict it from store.\n * timeoutDisposable.dispose();\n * }\n */\nexport function disposableTimeout(handler: () => void, timeout = 0, store?: DisposableStore): IDisposable {\n\tconst timer = setTimeout(() => {\n\t\thandler();\n\t\tif (store) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, timeout);\n\tconst disposable = toDisposable(() => {\n\t\tclearTimeout(timer);\n\t\tstore?.deleteAndLeak(disposable);\n\t});\n\tstore?.add(disposable);\n\treturn disposable;\n}\n\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\n\nexport function sequence(promiseFactories: ITask>[]): Promise {\n\tconst results: T[] = [];\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tfunction next(): Promise | null {\n\t\treturn index < len ? promiseFactories[index++]() : null;\n\t}\n\n\tfunction thenHandler(result: any): Promise {\n\t\tif (result !== undefined && result !== null) {\n\t\t\tresults.push(result);\n\t\t}\n\n\t\tconst n = next();\n\t\tif (n) {\n\t\t\treturn n.then(thenHandler);\n\t\t}\n\n\t\treturn Promise.resolve(results);\n\t}\n\n\treturn Promise.resolve(null).then(thenHandler);\n}\n\nexport function first(promiseFactories: ITask>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise {\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tconst loop: () => Promise = () => {\n\t\tif (index >= len) {\n\t\t\treturn Promise.resolve(defaultValue);\n\t\t}\n\n\t\tconst factory = promiseFactories[index++];\n\t\tconst promise = Promise.resolve(factory());\n\n\t\treturn promise.then(result => {\n\t\t\tif (shouldStop(result)) {\n\t\t\t\treturn Promise.resolve(result);\n\t\t\t}\n\n\t\t\treturn loop();\n\t\t});\n\t};\n\n\treturn loop();\n}\n\n/**\n * Returns the result of the first promise that matches the \"shouldStop\",\n * running all promises in parallel. Supports cancelable promises.\n */\nexport function firstParallel(promiseList: Promise[], shouldStop?: (t: T) => boolean, defaultValue?: T | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => t is R, defaultValue?: R | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null) {\n\tif (promiseList.length === 0) {\n\t\treturn Promise.resolve(defaultValue);\n\t}\n\n\tlet todo = promiseList.length;\n\tconst finish = () => {\n\t\ttodo = -1;\n\t\tfor (const promise of promiseList) {\n\t\t\t(promise as Partial>).cancel?.();\n\t\t}\n\t};\n\n\treturn new Promise((resolve, reject) => {\n\t\tfor (const promise of promiseList) {\n\t\t\tpromise.then(result => {\n\t\t\t\tif (--todo >= 0 && shouldStop(result)) {\n\t\t\t\t\tfinish();\n\t\t\t\t\tresolve(result);\n\t\t\t\t} else if (todo === 0) {\n\t\t\t\t\tresolve(defaultValue);\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tif (--todo >= 0) {\n\t\t\t\t\t\tfinish();\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\t});\n}\n\ninterface ILimitedTaskFactory {\n\tfactory: ITask>;\n\tc: (value: T | Promise) => void;\n\te: (error?: unknown) => void;\n}\n\nexport interface ILimiter {\n\n\treadonly size: number;\n\n\tqueue(factory: ITask>): Promise;\n\n\tclear(): void;\n}\n\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nexport class Limiter implements ILimiter {\n\n\tprivate _size = 0;\n\tprivate _isDisposed = false;\n\tprivate runningPromises: number;\n\tprivate readonly maxDegreeOfParalellism: number;\n\tprivate readonly outstandingPromises: ILimitedTaskFactory[];\n\tprivate readonly _onDrained: Emitter;\n\n\tconstructor(maxDegreeOfParalellism: number) {\n\t\tthis.maxDegreeOfParalellism = maxDegreeOfParalellism;\n\t\tthis.outstandingPromises = [];\n\t\tthis.runningPromises = 0;\n\t\tthis._onDrained = new Emitter();\n\t}\n\n\t/**\n\t *\n\t * @returns A promise that resolved when all work is done (onDrained) or when\n\t * there is nothing to do\n\t */\n\twhenIdle(): Promise {\n\t\treturn this.size > 0\n\t\t\t? Event.toPromise(this.onDrained)\n\t\t\t: Promise.resolve();\n\t}\n\n\tget onDrained(): Event {\n\t\treturn this._onDrained.event;\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis._size++;\n\n\t\treturn new Promise((c, e) => {\n\t\t\tthis.outstandingPromises.push({ factory, c, e });\n\t\t\tthis.consume();\n\t\t});\n\t}\n\n\tprivate consume(): void {\n\t\twhile (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n\t\t\tconst iLimitedTask = this.outstandingPromises.shift()!;\n\t\t\tthis.runningPromises++;\n\n\t\t\tconst promise = iLimitedTask.factory();\n\t\t\tpromise.then(iLimitedTask.c, iLimitedTask.e);\n\t\t\tpromise.then(() => this.consumed(), () => this.consumed());\n\t\t}\n\t}\n\n\tprivate consumed(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.runningPromises--;\n\t\tif (--this._size === 0) {\n\t\t\tthis._onDrained.fire();\n\t\t}\n\n\t\tif (this.outstandingPromises.length > 0) {\n\t\t\tthis.consume();\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis.outstandingPromises.length = 0;\n\t\tthis._size = this.runningPromises;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tthis.outstandingPromises.length = 0; // stop further processing\n\t\tthis._size = 0;\n\t\tthis._onDrained.dispose();\n\t}\n}\n\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nexport class Queue extends Limiter {\n\n\tconstructor() {\n\t\tsuper(1);\n\t}\n}\n\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nexport class LimitedQueue {\n\n\tprivate readonly sequentializer = new TaskSequentializer();\n\n\tprivate tasks = 0;\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (!this.sequentializer.isRunning()) {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t}\n\n\t\treturn this.sequentializer.queue(() => {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t});\n\t}\n}\n\nexport class TimeoutTimer implements IDisposable {\n\tprivate _token: any;\n\tprivate _isDisposed = false;\n\n\tconstructor();\n\tconstructor(runner: () => void, timeout: number);\n\tconstructor(runner?: () => void, timeout?: number) {\n\t\tthis._token = -1;\n\n\t\tif (typeof runner === 'function' && typeof timeout === 'number') {\n\t\t\tthis.setIfNotSet(runner, timeout);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis._isDisposed = true;\n\t}\n\n\tcancel(): void {\n\t\tif (this._token !== -1) {\n\t\t\tclearTimeout(this._token);\n\t\t\tthis._token = -1;\n\t\t}\n\t}\n\n\tcancelAndSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n\n\tsetIfNotSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tif (this._token !== -1) {\n\t\t\t// timer is already set\n\t\t\treturn;\n\t\t}\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n}\n\nexport class IntervalTimer implements IDisposable {\n\n\tprivate disposable: IDisposable | undefined = undefined;\n\tprivate isDisposed = false;\n\n\tcancel(): void {\n\t\tthis.disposable?.dispose();\n\t\tthis.disposable = undefined;\n\t}\n\n\tcancelAndSet(runner: () => void, interval: number, context = globalThis): void {\n\t\tif (this.isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tconst handle = context.setInterval(() => {\n\t\t\trunner();\n\t\t}, interval);\n\n\t\tthis.disposable = toDisposable(() => {\n\t\t\tcontext.clearInterval(handle);\n\t\t\tthis.disposable = undefined;\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class RunOnceScheduler implements IDisposable {\n\n\tprotected runner: ((...args: unknown[]) => void) | null;\n\n\tprivate timeoutToken: any;\n\tprivate timeout: number;\n\tprivate timeoutHandler: () => void;\n\n\tconstructor(runner: (...args: any[]) => void, delay: number) {\n\t\tthis.timeoutToken = -1;\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.timeoutHandler = this.onTimeout.bind(this);\n\t}\n\n\t/**\n\t * Dispose RunOnceScheduler\n\t */\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\t/**\n\t * Cancel current scheduled runner (if any).\n\t */\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearTimeout(this.timeoutToken);\n\t\t\tthis.timeoutToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tthis.cancel();\n\t\tthis.timeoutToken = setTimeout(this.timeoutHandler, delay);\n\t}\n\n\tget delay(): number {\n\t\treturn this.timeout;\n\t}\n\n\tset delay(value: number) {\n\t\tthis.timeout = value;\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.timeoutToken !== -1;\n\t}\n\n\tflush(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tthis.cancel();\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprivate onTimeout() {\n\t\tthis.timeoutToken = -1;\n\t\tif (this.runner) {\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprotected doRun(): void {\n\t\tthis.runner?.();\n\t}\n}\n\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nexport class ProcessTimeRunOnceScheduler {\n\n\tprivate runner: (() => void) | null;\n\tprivate timeout: number;\n\n\tprivate counter: number;\n\tprivate intervalToken: any;\n\tprivate intervalHandler: () => void;\n\n\tconstructor(runner: () => void, delay: number) {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.counter = 0;\n\t\tthis.intervalToken = -1;\n\t\tthis.intervalHandler = this.onInterval.bind(this);\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearInterval(this.intervalToken);\n\t\t\tthis.intervalToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.cancel();\n\t\tthis.counter = Math.ceil(delay / 1000);\n\t\tthis.intervalToken = setInterval(this.intervalHandler, 1000);\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.intervalToken !== -1;\n\t}\n\n\tprivate onInterval() {\n\t\tthis.counter--;\n\t\tif (this.counter > 0) {\n\t\t\t// still need to wait\n\t\t\treturn;\n\t\t}\n\n\t\t// time elapsed\n\t\tclearInterval(this.intervalToken);\n\t\tthis.intervalToken = -1;\n\t\tthis.runner?.();\n\t}\n}\n\nexport class RunOnceWorker extends RunOnceScheduler {\n\n\tprivate units: T[] = [];\n\n\tconstructor(runner: (units: T[]) => void, timeout: number) {\n\t\tsuper(runner, timeout);\n\t}\n\n\twork(unit: T): void {\n\t\tthis.units.push(unit);\n\n\t\tif (!this.isScheduled()) {\n\t\t\tthis.schedule();\n\t\t}\n\t}\n\n\tprotected override doRun(): void {\n\t\tconst units = this.units;\n\t\tthis.units = [];\n\n\t\tthis.runner?.(units);\n\t}\n\n\toverride dispose(): void {\n\t\tthis.units = [];\n\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IThrottledWorkerOptions {\n\n\t/**\n\t * maximum of units the worker will pass onto handler at once\n\t */\n\tmaxWorkChunkSize: number;\n\n\t/**\n\t * maximum of units the worker will keep in memory for processing\n\t */\n\tmaxBufferedWork: number | undefined;\n\n\t/**\n\t * delay before processing the next round of chunks when chunk size exceeds limits\n\t */\n\tthrottleDelay: number;\n}\n\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nexport class ThrottledWorker extends Disposable {\n\n\tprivate readonly pendingWork: T[] = [];\n\n\tprivate readonly throttler = this._register(new MutableDisposable());\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tprivate options: IThrottledWorkerOptions,\n\t\tprivate readonly handler: (units: T[]) => void\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * The number of work units that are pending to be processed.\n\t */\n\tget pending(): number { return this.pendingWork.length; }\n\n\t/**\n\t * Add units to be worked on. Use `pending` to figure out\n\t * how many units are not yet processed after this method\n\t * was called.\n\t *\n\t * @returns whether the work was accepted or not. If the\n\t * worker is disposed, it will not accept any more work.\n\t * If the number of pending units would become larger\n\t * than `maxPendingWork`, more work will also not be accepted.\n\t */\n\twork(units: readonly T[]): boolean {\n\t\tif (this.disposed) {\n\t\t\treturn false; // work not accepted: disposed\n\t\t}\n\n\t\t// Check for reaching maximum of pending work\n\t\tif (typeof this.options.maxBufferedWork === 'number') {\n\n\t\t\t// Throttled: simple check if pending + units exceeds max pending\n\t\t\tif (this.throttler.value) {\n\t\t\t\tif (this.pending + units.length > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Unthrottled: same as throttled, but account for max chunk getting\n\t\t\t// worked on directly without being pending\n\t\t\telse {\n\t\t\t\tif (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add to pending units first\n\t\tfor (const unit of units) {\n\t\t\tthis.pendingWork.push(unit);\n\t\t}\n\n\t\t// If not throttled, start working directly\n\t\t// Otherwise, when the throttle delay has\n\t\t// past, pending work will be worked again.\n\t\tif (!this.throttler.value) {\n\t\t\tthis.doWork();\n\t\t}\n\n\t\treturn true; // work accepted\n\t}\n\n\tprivate doWork(): void {\n\n\t\t// Extract chunk to handle and handle it\n\t\tthis.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n\n\t\t// If we have remaining work, schedule it after a delay\n\t\tif (this.pendingWork.length > 0) {\n\t\t\tthis.throttler.value = new RunOnceScheduler(() => {\n\t\t\t\tthis.throttler.clear();\n\n\t\t\t\tthis.doWork();\n\t\t\t}, this.options.throttleDelay);\n\t\t\tthis.throttler.value.schedule();\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tthis.disposed = true;\n\t}\n}\n\n//#region -- run on idle tricks ------------\n\nexport interface IdleDeadline {\n\treadonly didTimeout: boolean;\n\ttimeRemaining(): number;\n}\n\ntype IdleApi = Pick;\n\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n *\n * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser\n * context\n */\nexport let runWhenGlobalIdle: (callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\nexport let _runWhenIdle: (targetWindow: IdleApi, callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\n(function () {\n\tif (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n\t\t_runWhenIdle = (_targetWindow, runner) => {\n\t\t\tsetTimeout0(() => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst end = Date.now() + 15; // one frame at 64fps\n\t\t\t\tconst deadline: IdleDeadline = {\n\t\t\t\t\tdidTimeout: true,\n\t\t\t\t\ttimeRemaining() {\n\t\t\t\t\t\treturn Math.max(0, end - Date.now());\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\trunner(Object.freeze(deadline));\n\t\t\t});\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t} else {\n\t\t_runWhenIdle = (targetWindow: IdleApi, runner, timeout?) => {\n\t\t\tconst handle: number = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t\ttargetWindow.cancelIdleCallback(handle);\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n\trunWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);\n})();\n\nexport abstract class AbstractIdleValue {\n\n\tprivate readonly _executor: () => void;\n\tprivate readonly _handle: IDisposable;\n\n\tprivate _didRun: boolean = false;\n\tprivate _value?: T;\n\tprivate _error: unknown;\n\n\tconstructor(targetWindow: IdleApi, executor: () => T) {\n\t\tthis._executor = () => {\n\t\t\ttry {\n\t\t\t\tthis._value = executor();\n\t\t\t} catch (err) {\n\t\t\t\tthis._error = err;\n\t\t\t} finally {\n\t\t\t\tthis._didRun = true;\n\t\t\t}\n\t\t};\n\t\tthis._handle = _runWhenIdle(targetWindow, () => this._executor());\n\t}\n\n\tdispose(): void {\n\t\tthis._handle.dispose();\n\t}\n\n\tget value(): T {\n\t\tif (!this._didRun) {\n\t\t\tthis._handle.dispose();\n\t\t\tthis._executor();\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n\n\tget isInitialized(): boolean {\n\t\treturn this._didRun;\n\t}\n}\n\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nexport class GlobalIdleValue extends AbstractIdleValue {\n\n\tconstructor(executor: () => T) {\n\t\tsuper(globalThis, executor);\n\t}\n}\n\n//#endregion\n\nexport async function retry(task: ITask>, delay: number, retries: number): Promise {\n\tlet lastError: Error | undefined;\n\n\tfor (let i = 0; i < retries; i++) {\n\t\ttry {\n\t\t\treturn await task();\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\n\t\t\tawait timeout(delay);\n\t\t}\n\t}\n\n\tthrow lastError;\n}\n\n//#region Task Sequentializer\n\ninterface IRunningTask {\n\treadonly taskId: number;\n\treadonly cancel: () => void;\n\treadonly promise: Promise;\n}\n\ninterface IQueuedTask {\n\treadonly promise: Promise;\n\treadonly promiseResolve: () => void;\n\treadonly promiseReject: (error: Error) => void;\n\trun: ITask>;\n}\n\nexport interface ITaskSequentializerWithRunningTask {\n\treadonly running: Promise;\n}\n\nexport interface ITaskSequentializerWithQueuedTask {\n\treadonly queued: IQueuedTask;\n}\n\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nexport class TaskSequentializer {\n\n\tprivate _running?: IRunningTask;\n\tprivate _queued?: IQueuedTask;\n\n\tisRunning(taskId?: number): this is ITaskSequentializerWithRunningTask {\n\t\tif (typeof taskId === 'number') {\n\t\t\treturn this._running?.taskId === taskId;\n\t\t}\n\n\t\treturn !!this._running;\n\t}\n\n\tget running(): Promise | undefined {\n\t\treturn this._running?.promise;\n\t}\n\n\tcancelRunning(): void {\n\t\tthis._running?.cancel();\n\t}\n\n\trun(taskId: number, promise: Promise, onCancel?: () => void,): Promise {\n\t\tthis._running = { taskId, cancel: () => onCancel?.(), promise };\n\n\t\tpromise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n\n\t\treturn promise;\n\t}\n\n\tprivate doneRunning(taskId: number): void {\n\t\tif (this._running && taskId === this._running.taskId) {\n\n\t\t\t// only set running to done if the promise finished that is associated with that taskId\n\t\t\tthis._running = undefined;\n\n\t\t\t// schedule the queued task now that we are free if we have any\n\t\t\tthis.runQueued();\n\t\t}\n\t}\n\n\tprivate runQueued(): void {\n\t\tif (this._queued) {\n\t\t\tconst queued = this._queued;\n\t\t\tthis._queued = undefined;\n\n\t\t\t// Run queued task and complete on the associated promise\n\t\t\tqueued.run().then(queued.promiseResolve, queued.promiseReject);\n\t\t}\n\t}\n\n\t/**\n\t * Note: the promise to schedule as next run MUST itself call `run`.\n\t * Otherwise, this sequentializer will report `false` for `isRunning`\n\t * even when this task is running. Missing this detail means that\n\t * suddenly multiple tasks will run in parallel.\n\t */\n\tqueue(run: ITask>): Promise {\n\n\t\t// this is our first queued task, so we create associated promise with it\n\t\t// so that we can return a promise that completes when the task has\n\t\t// completed.\n\t\tif (!this._queued) {\n\t\t\tconst { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers();\n\t\t\tthis._queued = {\n\t\t\t\trun,\n\t\t\t\tpromise,\n\t\t\t\tpromiseResolve: promiseResolve!,\n\t\t\t\tpromiseReject: promiseReject!\n\t\t\t};\n\t\t}\n\n\t\t// we have a previous queued task, just overwrite it\n\t\telse {\n\t\t\tthis._queued.run = run;\n\t\t}\n\n\t\treturn this._queued.promise;\n\t}\n\n\thasQueued(): this is ITaskSequentializerWithQueuedTask {\n\t\treturn !!this._queued;\n\t}\n\n\tasync join(): Promise {\n\t\treturn this._queued?.promise ?? this._running?.promise;\n\t}\n}\n\n//#endregion\n\n//#region\n\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nexport class IntervalCounter {\n\n\tprivate lastIncrementTime = 0;\n\n\tprivate value = 0;\n\n\tconstructor(private readonly interval: number, private readonly nowFn = () => Date.now()) { }\n\n\tincrement(): number {\n\t\tconst now = this.nowFn();\n\n\t\t// We are outside of the range of `interval` and as such\n\t\t// start counting from 0 and remember the time\n\t\tif (now - this.lastIncrementTime > this.interval) {\n\t\t\tthis.lastIncrementTime = now;\n\t\t\tthis.value = 0;\n\t\t}\n\n\t\tthis.value++;\n\n\t\treturn this.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nexport type ValueCallback = (value: T | Promise) => void;\n\nconst enum DeferredOutcome {\n\tResolved,\n\tRejected\n}\n\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise {\n\n\tprivate completeCallback!: ValueCallback;\n\tprivate errorCallback!: (err: unknown) => void;\n\tprivate outcome?: { outcome: DeferredOutcome.Rejected; value: any } | { outcome: DeferredOutcome.Resolved; value: T };\n\n\tpublic get isRejected() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Rejected;\n\t}\n\n\tpublic get isResolved() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved;\n\t}\n\n\tpublic get isSettled() {\n\t\treturn !!this.outcome;\n\t}\n\n\tpublic get value() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;\n\t}\n\n\tpublic readonly p: Promise;\n\n\tconstructor() {\n\t\tthis.p = new Promise((c, e) => {\n\t\t\tthis.completeCallback = c;\n\t\t\tthis.errorCallback = e;\n\t\t});\n\t}\n\n\tpublic complete(value: T) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.completeCallback(value);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Resolved, value };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic error(err: unknown) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.errorCallback(err);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Rejected, value: err };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic cancel() {\n\t\treturn this.error(new CancellationError());\n\t}\n}\n\n//#endregion\n\n//#region Promises\n\nexport namespace Promises {\n\n\t/**\n\t * A drop-in replacement for `Promise.all` with the only difference\n\t * that the method awaits every promise to either fulfill or reject.\n\t *\n\t * Similar to `Promise.all`, only the first error will be returned\n\t * if any.\n\t */\n\texport async function settled(promises: Promise[]): Promise {\n\t\tlet firstError: Error | undefined = undefined;\n\n\t\tconst result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n\t\t\tif (!firstError) {\n\t\t\t\tfirstError = error;\n\t\t\t}\n\n\t\t\treturn undefined; // do not rethrow so that other promises can settle\n\t\t})));\n\n\t\tif (typeof firstError !== 'undefined') {\n\t\t\tthrow firstError;\n\t\t}\n\n\t\treturn result as unknown as T[]; // cast is needed and protected by the `throw` above\n\t}\n\n\t/**\n\t * A helper to create a new `Promise` with a body that is a promise\n\t * itself. By default, an error that raises from the async body will\n\t * end up as a unhandled rejection, so this utility properly awaits the\n\t * body and rejects the promise as a normal promise does without async\n\t * body.\n\t *\n\t * This method should only be used in rare cases where otherwise `async`\n\t * cannot be used (e.g. when callbacks are involved that require this).\n\t */\n\texport function withAsyncBody(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise): Promise {\n\t\t// eslint-disable-next-line no-async-promise-executor\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tawait bodyFn(resolve, reject);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class StatefulPromise {\n\tprivate _value: T | undefined = undefined;\n\tget value(): T | undefined { return this._value; }\n\n\tprivate _error: unknown = undefined;\n\tget error(): unknown { return this._error; }\n\n\tprivate _isResolved = false;\n\tget isResolved() { return this._isResolved; }\n\n\tpublic readonly promise: Promise;\n\n\tconstructor(promise: Promise) {\n\t\tthis.promise = promise.then(\n\t\t\tvalue => {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._error = error;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\tif (!this._isResolved) {\n\t\t\tthrow new BugIndicatingError('Promise is not resolved yet');\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n}\n\nexport class LazyStatefulPromise {\n\tprivate readonly _promise = new Lazy(() => new StatefulPromise(this._compute()));\n\n\tconstructor(\n\t\tprivate readonly _compute: () => Promise,\n\t) { }\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\treturn this._promise.value.requireValue();\n\t}\n\n\t/**\n\t * Returns the promise (and triggers a computation of the promise if not yet done so).\n\t */\n\tpublic getPromise(): Promise {\n\t\treturn this._promise.value.promise;\n\t}\n\n\t/**\n\t * Reads the current value without triggering a computation of the promise.\n\t */\n\tpublic get currentValue(): T | undefined {\n\t\treturn this._promise.rawValue?.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nconst enum AsyncIterableSourceState {\n\tInitial,\n\tDoneOK,\n\tDoneError,\n}\n\n/**\n * An object that allows to emit async values asynchronously or bring the iterable to an error state using `reject()`.\n * This emitter is valid only for the duration of the executor (until the promise returned by the executor settles).\n */\nexport interface AsyncIterableEmitter {\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitOne(value: T): void;\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitMany(values: T[]): void;\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `reject()` have already been called, this method has no effect.\n\t */\n\treject(error: Error): void;\n}\n\n/**\n * An executor for the `AsyncIterableObject` that has access to an emitter.\n */\nexport interface AsyncIterableExecutor {\n\t/**\n\t * @param emitter An object that allows to emit async values valid only for the duration of the executor.\n\t */\n\t(emitter: AsyncIterableEmitter): void | Promise;\n}\n\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nexport class AsyncIterableObject implements AsyncIterable {\n\n\tpublic static fromArray(items: T[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject((writer) => {\n\t\t\twriter.emitMany(items);\n\t\t});\n\t}\n\n\tpublic static fromPromise(promise: Promise): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\temitter.emitMany(await promise);\n\t\t});\n\t}\n\n\tpublic static fromPromises(promises: Promise[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n\t\t});\n\t}\n\n\tpublic static merge(iterables: AsyncIterable[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(iterables.map(async (iterable) => {\n\t\t\t\tfor await (const item of iterable) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}));\n\t\t});\n\t}\n\n\tpublic static EMPTY = AsyncIterableObject.fromArray([]);\n\n\tprivate _state: AsyncIterableSourceState;\n\tprivate _results: T[];\n\tprivate _error: Error | null;\n\tprivate readonly _onReturn?: () => void | Promise;\n\tprivate readonly _onStateChanged: Emitter;\n\n\tconstructor(executor: AsyncIterableExecutor, onReturn?: () => void | Promise) {\n\t\tthis._state = AsyncIterableSourceState.Initial;\n\t\tthis._results = [];\n\t\tthis._error = null;\n\t\tthis._onReturn = onReturn;\n\t\tthis._onStateChanged = new Emitter();\n\n\t\tqueueMicrotask(async () => {\n\t\t\tconst writer: AsyncIterableEmitter = {\n\t\t\t\temitOne: (item) => this.emitOne(item),\n\t\t\t\temitMany: (items) => this.emitMany(items),\n\t\t\t\treject: (error) => this.reject(error)\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait Promise.resolve(executor(writer));\n\t\t\t\tthis.resolve();\n\t\t\t} catch (err) {\n\t\t\t\tthis.reject(err);\n\t\t\t} finally {\n\t\t\t\twriter.emitOne = undefined!;\n\t\t\t\twriter.emitMany = undefined!;\n\t\t\t\twriter.reject = undefined!;\n\t\t\t}\n\t\t});\n\t}\n\n\t[Symbol.asyncIterator](): AsyncIterator {\n\t\tlet i = 0;\n\t\treturn {\n\t\t\tnext: async () => {\n\t\t\t\tdo {\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneError) {\n\t\t\t\t\t\tthrow this._error;\n\t\t\t\t\t}\n\t\t\t\t\tif (i < this._results.length) {\n\t\t\t\t\t\treturn { done: false, value: this._results[i++] };\n\t\t\t\t\t}\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneOK) {\n\t\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t\t}\n\t\t\t\t\tawait Event.toPromise(this._onStateChanged.event);\n\t\t\t\t} while (true);\n\t\t\t},\n\t\t\treturn: async () => {\n\t\t\t\tthis._onReturn?.();\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic static map(iterable: AsyncIterable, mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\temitter.emitOne(mapFn(item));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic map(mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn AsyncIterableObject.map(this, mapFn);\n\t}\n\n\tpublic static filter(iterable: AsyncIterable, filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\tif (filterFn(item)) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic filter(filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn AsyncIterableObject.filter(this, filterFn);\n\t}\n\n\tpublic static coalesce(iterable: AsyncIterable): AsyncIterableObject {\n\t\treturn >AsyncIterableObject.filter(iterable, item => !!item);\n\t}\n\n\tpublic coalesce(): AsyncIterableObject> {\n\t\treturn AsyncIterableObject.coalesce(this) as AsyncIterableObject>;\n\t}\n\n\tpublic static async toPromise(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic toPromise(): Promise {\n\t\treturn AsyncIterableObject.toPromise(this);\n\t}\n\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitOne(value: T): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results.push(value);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitMany(values: T[]): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results = this._results.concat(values);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Calling `resolve()` will mark the result array as complete.\n\t *\n\t * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate resolve(): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneOK;\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate reject(error: Error) {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneError;\n\t\tthis._error = error;\n\t\tthis._onStateChanged.fire();\n\t}\n}\n\nexport class CancelableAsyncIterableObject extends AsyncIterableObject {\n\tconstructor(\n\t\tprivate readonly _source: CancellationTokenSource,\n\t\texecutor: AsyncIterableExecutor\n\t) {\n\t\tsuper(executor);\n\t}\n\n\tcancel(): void {\n\t\tthis._source.cancel();\n\t}\n}\n\nexport function createCancelableAsyncIterable(callback: (token: CancellationToken) => AsyncIterable): CancelableAsyncIterableObject {\n\tconst source = new CancellationTokenSource();\n\tconst innerIterable = callback(source.token);\n\n\treturn new CancelableAsyncIterableObject(source, async (emitter) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(new CancellationError());\n\t\t});\n\t\ttry {\n\t\t\tfor await (const item of innerIterable) {\n\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t// canceled in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\temitter.emitOne(item);\n\t\t\t}\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t} catch (err) {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(err);\n\t\t}\n\t});\n}\n\nexport class AsyncIterableSource {\n\n\tprivate readonly _deferred = new DeferredPromise();\n\tprivate readonly _asyncIterable: AsyncIterableObject;\n\n\tprivate _errorFn: (error: Error) => void;\n\tprivate _emitFn: (item: T) => void;\n\n\t/**\n\t *\n\t * @param onReturn A function that will be called when consuming the async iterable\n\t * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.\n\t * This is NOT called when resolving this source by its owner.\n\t */\n\tconstructor(onReturn?: () => Promise | void) {\n\t\tthis._asyncIterable = new AsyncIterableObject(emitter => {\n\n\t\t\tif (earlyError) {\n\t\t\t\temitter.reject(earlyError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (earlyItems) {\n\t\t\t\temitter.emitMany(earlyItems);\n\t\t\t}\n\t\t\tthis._errorFn = (error: Error) => emitter.reject(error);\n\t\t\tthis._emitFn = (item: T) => emitter.emitOne(item);\n\t\t\treturn this._deferred.p;\n\t\t}, onReturn);\n\n\t\tlet earlyError: Error | undefined;\n\t\tlet earlyItems: T[] | undefined;\n\n\t\tthis._emitFn = (item: T) => {\n\t\t\tif (!earlyItems) {\n\t\t\t\tearlyItems = [];\n\t\t\t}\n\t\t\tearlyItems.push(item);\n\t\t};\n\t\tthis._errorFn = (error: Error) => {\n\t\t\tif (!earlyError) {\n\t\t\t\tearlyError = error;\n\t\t\t}\n\t\t};\n\t}\n\n\tget asyncIterable(): AsyncIterableObject {\n\t\treturn this._asyncIterable;\n\t}\n\n\tresolve(): void {\n\t\tthis._deferred.complete();\n\t}\n\n\treject(error: Error): void {\n\t\tthis._errorFn(error);\n\t\tthis._deferred.complete();\n\t}\n\n\temitOne(item: T): void {\n\t\tthis._emitFn(item);\n\t}\n}\n\n//#endregion\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from 'vs/base/common/charCode';\nimport { Constants } from 'vs/base/common/uint';\n\nexport function isFalsyOrWhitespace(str: string | undefined): boolean {\n\tif (!str || typeof str !== 'string') {\n\t\treturn true;\n\t}\n\treturn str.trim().length === 0;\n}\n\nconst _formatRegexp = /{(\\d+)}/g;\n\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nexport function format(value: string, ...args: any[]): string {\n\tif (args.length === 0) {\n\t\treturn value;\n\t}\n\treturn value.replace(_formatRegexp, function (match, group) {\n\t\tconst idx = parseInt(group, 10);\n\t\treturn isNaN(idx) || idx < 0 || idx >= args.length ?\n\t\t\tmatch :\n\t\t\targs[idx];\n\t});\n}\n\nconst _format2Regexp = /{([^}]+)}/g;\n\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nexport function format2(template: string, values: Record): string {\n\tif (Object.keys(values).length === 0) {\n\t\treturn template;\n\t}\n\treturn template.replace(_format2Regexp, (match, group) => (values[group] ?? match) as string);\n}\n\n/**\n * Encodes the given value so that it can be used as literal value in html attributes.\n *\n * In other words, computes `$val`, such that `attr` in `
` has the runtime value `value`.\n * This prevents XSS injection.\n */\nexport function htmlAttributeEncodeValue(value: string): string {\n\treturn value.replace(/[<>\"'&]/g, ch => {\n\t\tswitch (ch) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '\"': return '"';\n\t\t\tcase '\\'': return ''';\n\t\t\tcase '&': return '&';\n\t\t}\n\t\treturn ch;\n\t});\n}\n\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nexport function escape(html: string): string {\n\treturn html.replace(/[<>&]/g, function (match) {\n\t\tswitch (match) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '&': return '&';\n\t\t\tdefault: return match;\n\t\t}\n\t});\n}\n\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value: string): string {\n\treturn value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n\n/**\n * Counts how often `substr` occurs inside `value`.\n */\nexport function count(value: string, substr: string): number {\n\tlet result = 0;\n\tlet index = value.indexOf(substr);\n\twhile (index !== -1) {\n\t\tresult++;\n\t\tindex = value.indexOf(substr, index + substr.length);\n\t}\n\treturn result;\n}\n\nexport function truncate(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\treturn `${value.substr(0, maxLength)}${suffix}`;\n}\n\nexport function truncateMiddle(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\tconst prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n\tconst suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n\n\treturn `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nexport function trim(haystack: string, needle: string = ' '): string {\n\tconst trimmed = ltrim(haystack, needle);\n\treturn rtrim(trimmed, needle);\n}\n\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function ltrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length;\n\tif (needleLen === 0 || haystack.length === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = 0;\n\n\twhile (haystack.indexOf(needle, offset) === offset) {\n\t\toffset = offset + needleLen;\n\t}\n\treturn haystack.substring(offset);\n}\n\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function rtrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length,\n\t\thaystackLen = haystack.length;\n\n\tif (needleLen === 0 || haystackLen === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = haystackLen,\n\t\tidx = -1;\n\n\twhile (true) {\n\t\tidx = haystack.lastIndexOf(needle, offset - 1);\n\t\tif (idx === -1 || idx + needleLen !== offset) {\n\t\t\tbreak;\n\t\t}\n\t\tif (idx === 0) {\n\t\t\treturn '';\n\t\t}\n\t\toffset = idx;\n\t}\n\n\treturn haystack.substring(0, offset);\n}\n\nexport function convertSimple2RegExpPattern(pattern: string): string {\n\treturn pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\n\nexport function stripWildcards(pattern: string): string {\n\treturn pattern.replace(/\\*/g, '');\n}\n\nexport interface RegExpOptions {\n\tmatchCase?: boolean;\n\twholeWord?: boolean;\n\tmultiline?: boolean;\n\tglobal?: boolean;\n\tunicode?: boolean;\n}\n\nexport function createRegExp(searchString: string, isRegex: boolean, options: RegExpOptions = {}): RegExp {\n\tif (!searchString) {\n\t\tthrow new Error('Cannot create regex from empty string');\n\t}\n\tif (!isRegex) {\n\t\tsearchString = escapeRegExpCharacters(searchString);\n\t}\n\tif (options.wholeWord) {\n\t\tif (!/\\B/.test(searchString.charAt(0))) {\n\t\t\tsearchString = '\\\\b' + searchString;\n\t\t}\n\t\tif (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n\t\t\tsearchString = searchString + '\\\\b';\n\t\t}\n\t}\n\tlet modifiers = '';\n\tif (options.global) {\n\t\tmodifiers += 'g';\n\t}\n\tif (!options.matchCase) {\n\t\tmodifiers += 'i';\n\t}\n\tif (options.multiline) {\n\t\tmodifiers += 'm';\n\t}\n\tif (options.unicode) {\n\t\tmodifiers += 'u';\n\t}\n\n\treturn new RegExp(searchString, modifiers);\n}\n\nexport function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {\n\t// Exit early if it's one of these special cases which are meant to match\n\t// against an empty string\n\tif (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n\t\treturn false;\n\t}\n\n\t// We check against an empty string. If the regular expression doesn't advance\n\t// (e.g. ends in an endless loop) it will match an empty string.\n\tconst match = regexp.exec('');\n\treturn !!(match && regexp.lastIndex === 0);\n}\n\nexport function splitLines(str: string): string[] {\n\treturn str.split(/\\r\\n|\\r|\\n/);\n}\n\nexport function splitLinesIncludeSeparators(str: string): string[] {\n\tconst linesWithSeparators: string[] = [];\n\tconst splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n\tfor (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n\t\tlinesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? ''));\n\t}\n\treturn linesWithSeparators;\n}\n\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function firstNonWhitespaceIndex(str: string): number {\n\tfor (let i = 0, len = str.length; i < len; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nexport function getLeadingWhitespace(str: string, start: number = 0, end: number = str.length): string {\n\tfor (let i = start; i < end; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn str.substring(start, i);\n\t\t}\n\t}\n\treturn str.substring(start, end);\n}\n\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function lastNonWhitespaceIndex(str: string, startIndex: number = str.length - 1): number {\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nexport function replaceAsync(str: string, search: RegExp, replacer: (match: string, ...args: any[]) => Promise): Promise {\n\tconst parts: (string | Promise)[] = [];\n\n\tlet last = 0;\n\tfor (const match of str.matchAll(search)) {\n\t\tparts.push(str.slice(last, match.index));\n\t\tif (match.index === undefined) {\n\t\t\tthrow new Error('match.index should be defined');\n\t\t}\n\n\t\tlast = match.index + match[0].length;\n\t\tparts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n\t}\n\n\tparts.push(str.slice(last));\n\n\treturn Promise.all(parts).then(p => p.join(''));\n}\n\nexport function compare(a: string, b: string): number {\n\tif (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nexport function compareSubstring(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\t\tconst codeA = a.charCodeAt(aStart);\n\t\tconst codeB = b.charCodeAt(bStart);\n\t\tif (codeA < codeB) {\n\t\t\treturn -1;\n\t\t} else if (codeA > codeB) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nexport function compareIgnoreCase(a: string, b: string): number {\n\treturn compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\n\nexport function compareSubstringIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\n\t\tlet codeA = a.charCodeAt(aStart);\n\t\tlet codeB = b.charCodeAt(bStart);\n\n\t\tif (codeA === codeB) {\n\t\t\t// equal\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (codeA >= 128 || codeB >= 128) {\n\t\t\t// not ASCII letters -> fallback to lower-casing strings\n\t\t\treturn compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n\t\t}\n\n\t\t// mapper lower-case ascii letter onto upper-case varinats\n\t\t// [97-122] (lower ascii) --> [65-90] (upper ascii)\n\t\tif (isLowerAsciiLetter(codeA)) {\n\t\t\tcodeA -= 32;\n\t\t}\n\t\tif (isLowerAsciiLetter(codeB)) {\n\t\t\tcodeB -= 32;\n\t\t}\n\n\t\t// compare both code points\n\t\tconst diff = codeA - codeB;\n\t\tif (diff === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn diff;\n\t}\n\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\nexport function isAsciiDigit(code: number): boolean {\n\treturn code >= CharCode.Digit0 && code <= CharCode.Digit9;\n}\n\nexport function isLowerAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.a && code <= CharCode.z;\n}\n\nexport function isUpperAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.A && code <= CharCode.Z;\n}\n\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n\treturn a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\n\nexport function startsWithIgnoreCase(str: string, candidate: string): boolean {\n\tconst candidateLength = candidate.length;\n\tif (candidate.length > str.length) {\n\t\treturn false;\n\t}\n\n\treturn compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(i) !== b.charCodeAt(i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tconst aLastIndex = a.length - 1;\n\tconst bLastIndex = b.length - 1;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode: number): boolean {\n\treturn (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode: number): boolean {\n\treturn (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate: number, lowSurrogate: number): number {\n\treturn ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str: string, len: number, offset: number): number {\n\tconst charCode = str.charCodeAt(offset);\n\tif (isHighSurrogate(charCode) && offset + 1 < len) {\n\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\tif (isLowSurrogate(nextCharCode)) {\n\t\t\treturn computeCodePoint(charCode, nextCharCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str: string, offset: number): number {\n\tconst charCode = str.charCodeAt(offset - 1);\n\tif (isLowSurrogate(charCode) && offset > 1) {\n\t\tconst prevCharCode = str.charCodeAt(offset - 2);\n\t\tif (isHighSurrogate(prevCharCode)) {\n\t\t\treturn computeCodePoint(prevCharCode, charCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\nexport class CodePointIterator {\n\n\tprivate readonly _str: string;\n\tprivate readonly _len: number;\n\tprivate _offset: number;\n\n\tpublic get offset(): number {\n\t\treturn this._offset;\n\t}\n\n\tconstructor(str: string, offset: number = 0) {\n\t\tthis._str = str;\n\t\tthis._len = str.length;\n\t\tthis._offset = offset;\n\t}\n\n\tpublic setOffset(offset: number): void {\n\t\tthis._offset = offset;\n\t}\n\n\tpublic prevCodePoint(): number {\n\t\tconst codePoint = getPrevCodePoint(this._str, this._offset);\n\t\tthis._offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic nextCodePoint(): number {\n\t\tconst codePoint = getNextCodePoint(this._str, this._len, this._offset);\n\t\tthis._offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic eol(): boolean {\n\t\treturn (this._offset >= this._len);\n\t}\n}\n\nexport const noBreakWhitespace = '\\xa0';\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as strings from 'vs/base/common/strings';\n\n/**\n * Return a hash value for an object.\n */\nexport function hash(obj: any): number {\n\treturn doHash(obj, 0);\n}\n\nexport function doHash(obj: any, hashVal: number): number {\n\tswitch (typeof obj) {\n\t\tcase 'object':\n\t\t\tif (obj === null) {\n\t\t\t\treturn numberHash(349, hashVal);\n\t\t\t} else if (Array.isArray(obj)) {\n\t\t\t\treturn arrayHash(obj, hashVal);\n\t\t\t}\n\t\t\treturn objectHash(obj, hashVal);\n\t\tcase 'string':\n\t\t\treturn stringHash(obj, hashVal);\n\t\tcase 'boolean':\n\t\t\treturn booleanHash(obj, hashVal);\n\t\tcase 'number':\n\t\t\treturn numberHash(obj, hashVal);\n\t\tcase 'undefined':\n\t\t\treturn numberHash(937, hashVal);\n\t\tdefault:\n\t\t\treturn numberHash(617, hashVal);\n\t}\n}\n\nexport function numberHash(val: number, initialHashVal: number): number {\n\treturn (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\n\nfunction booleanHash(b: boolean, initialHashVal: number): number {\n\treturn numberHash(b ? 433 : 863, initialHashVal);\n}\n\nexport function stringHash(s: string, hashVal: number) {\n\thashVal = numberHash(149417, hashVal);\n\tfor (let i = 0, length = s.length; i < length; i++) {\n\t\thashVal = numberHash(s.charCodeAt(i), hashVal);\n\t}\n\treturn hashVal;\n}\n\nfunction arrayHash(arr: any[], initialHashVal: number): number {\n\tinitialHashVal = numberHash(104579, initialHashVal);\n\treturn arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\n\nfunction objectHash(obj: any, initialHashVal: number): number {\n\tinitialHashVal = numberHash(181387, initialHashVal);\n\treturn Object.keys(obj).sort().reduce((hashVal, key) => {\n\t\thashVal = stringHash(key, hashVal);\n\t\treturn doHash(obj[key], hashVal);\n\t}, initialHashVal);\n}\n\nexport class Hasher {\n\n\tprivate _value = 0;\n\n\tget value(): number {\n\t\treturn this._value;\n\t}\n\n\thash(obj: any): number {\n\t\tthis._value = doHash(obj, this._value);\n\t\treturn this._value;\n\t}\n}\n\nconst enum SHA1Constant {\n\tBLOCK_SIZE = 64, // 512 / 8\n\tUNICODE_REPLACEMENT = 0xFFFD,\n}\n\nfunction leftRotate(value: number, bits: number, totalBits: number = 32): number {\n\t// delta + bits = totalBits\n\tconst delta = totalBits - bits;\n\n\t// All ones, expect `delta` zeros aligned to the right\n\tconst mask = ~((1 << delta) - 1);\n\n\t// Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n\treturn ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\n\nfunction fill(dest: Uint8Array, index: number = 0, count: number = dest.byteLength, value: number = 0): void {\n\tfor (let i = 0; i < count; i++) {\n\t\tdest[index + i] = value;\n\t}\n}\n\nfunction leftPad(value: string, length: number, char: string = '0'): string {\n\twhile (value.length < length) {\n\t\tvalue = char + value;\n\t}\n\treturn value;\n}\n\nexport function toHexString(buffer: ArrayBuffer): string;\nexport function toHexString(value: number, bitsize?: number): string;\nexport function toHexString(bufferOrValue: ArrayBuffer | number, bitsize: number = 32): string {\n\tif (bufferOrValue instanceof ArrayBuffer) {\n\t\treturn Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n\t}\n\n\treturn leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nexport class StringSHA1 {\n\tprivate static _bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\n\n\tprivate _h0 = 0x67452301;\n\tprivate _h1 = 0xEFCDAB89;\n\tprivate _h2 = 0x98BADCFE;\n\tprivate _h3 = 0x10325476;\n\tprivate _h4 = 0xC3D2E1F0;\n\n\tprivate readonly _buff: Uint8Array;\n\tprivate readonly _buffDV: DataView;\n\tprivate _buffLen: number;\n\tprivate _totalLen: number;\n\tprivate _leftoverHighSurrogate: number;\n\tprivate _finished: boolean;\n\n\tconstructor() {\n\t\tthis._buff = new Uint8Array(SHA1Constant.BLOCK_SIZE + 3 /* to fit any utf-8 */);\n\t\tthis._buffDV = new DataView(this._buff.buffer);\n\t\tthis._buffLen = 0;\n\t\tthis._totalLen = 0;\n\t\tthis._leftoverHighSurrogate = 0;\n\t\tthis._finished = false;\n\t}\n\n\tpublic update(str: string): void {\n\t\tconst strLen = str.length;\n\t\tif (strLen === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buff = this._buff;\n\t\tlet buffLen = this._buffLen;\n\t\tlet leftoverHighSurrogate = this._leftoverHighSurrogate;\n\t\tlet charCode: number;\n\t\tlet offset: number;\n\n\t\tif (leftoverHighSurrogate !== 0) {\n\t\t\tcharCode = leftoverHighSurrogate;\n\t\t\toffset = -1;\n\t\t\tleftoverHighSurrogate = 0;\n\t\t} else {\n\t\t\tcharCode = str.charCodeAt(0);\n\t\t\toffset = 0;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tlet codePoint = charCode;\n\t\t\tif (strings.isHighSurrogate(charCode)) {\n\t\t\t\tif (offset + 1 < strLen) {\n\t\t\t\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\t\t\t\tif (strings.isLowSurrogate(nextCharCode)) {\n\t\t\t\t\t\toffset++;\n\t\t\t\t\t\tcodePoint = strings.computeCodePoint(charCode, nextCharCode);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// illegal => unicode replacement character\n\t\t\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// last character is a surrogate pair\n\t\t\t\t\tleftoverHighSurrogate = charCode;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (strings.isLowSurrogate(charCode)) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t}\n\n\t\t\tbuffLen = this._push(buff, buffLen, codePoint);\n\t\t\toffset++;\n\t\t\tif (offset < strLen) {\n\t\t\t\tcharCode = str.charCodeAt(offset);\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._buffLen = buffLen;\n\t\tthis._leftoverHighSurrogate = leftoverHighSurrogate;\n\t}\n\n\tprivate _push(buff: Uint8Array, buffLen: number, codePoint: number): number {\n\t\tif (codePoint < 0x0080) {\n\t\t\tbuff[buffLen++] = codePoint;\n\t\t} else if (codePoint < 0x0800) {\n\t\t\tbuff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else if (codePoint < 0x10000) {\n\t\t\tbuff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else {\n\t\t\tbuff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t}\n\n\t\tif (buffLen >= SHA1Constant.BLOCK_SIZE) {\n\t\t\tthis._step();\n\t\t\tbuffLen -= SHA1Constant.BLOCK_SIZE;\n\t\t\tthis._totalLen += SHA1Constant.BLOCK_SIZE;\n\t\t\t// take last 3 in case of UTF8 overflow\n\t\t\tbuff[0] = buff[SHA1Constant.BLOCK_SIZE + 0];\n\t\t\tbuff[1] = buff[SHA1Constant.BLOCK_SIZE + 1];\n\t\t\tbuff[2] = buff[SHA1Constant.BLOCK_SIZE + 2];\n\t\t}\n\n\t\treturn buffLen;\n\t}\n\n\tpublic digest(): string {\n\t\tif (!this._finished) {\n\t\t\tthis._finished = true;\n\t\t\tif (this._leftoverHighSurrogate) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tthis._leftoverHighSurrogate = 0;\n\t\t\t\tthis._buffLen = this._push(this._buff, this._buffLen, SHA1Constant.UNICODE_REPLACEMENT);\n\t\t\t}\n\t\t\tthis._totalLen += this._buffLen;\n\t\t\tthis._wrapUp();\n\t\t}\n\n\t\treturn toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n\t}\n\n\tprivate _wrapUp(): void {\n\t\tthis._buff[this._buffLen++] = 0x80;\n\t\tfill(this._buff, this._buffLen);\n\n\t\tif (this._buffLen > 56) {\n\t\t\tthis._step();\n\t\t\tfill(this._buff);\n\t\t}\n\n\t\t// this will fit because the mantissa can cover up to 52 bits\n\t\tconst ml = 8 * this._totalLen;\n\n\t\tthis._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n\t\tthis._buffDV.setUint32(60, ml % 4294967296, false);\n\n\t\tthis._step();\n\t}\n\n\tprivate _step(): void {\n\t\tconst bigBlock32 = StringSHA1._bigBlock32;\n\t\tconst data = this._buffDV;\n\n\t\tfor (let j = 0; j < 64 /* 16*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, data.getUint32(j, false), false);\n\t\t}\n\n\t\tfor (let j = 64; j < 320 /* 80*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n\t\t}\n\n\t\tlet a = this._h0;\n\t\tlet b = this._h1;\n\t\tlet c = this._h2;\n\t\tlet d = this._h3;\n\t\tlet e = this._h4;\n\n\t\tlet f: number, k: number;\n\t\tlet temp: number;\n\n\t\tfor (let j = 0; j < 80; j++) {\n\t\t\tif (j < 20) {\n\t\t\t\tf = (b & c) | ((~b) & d);\n\t\t\t\tk = 0x5A827999;\n\t\t\t} else if (j < 40) {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0x6ED9EBA1;\n\t\t\t} else if (j < 60) {\n\t\t\t\tf = (b & c) | (b & d) | (c & d);\n\t\t\t\tk = 0x8F1BBCDC;\n\t\t\t} else {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0xCA62C1D6;\n\t\t\t}\n\n\t\t\ttemp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n\t\t\te = d;\n\t\t\td = c;\n\t\t\tc = leftRotate(b, 30);\n\t\t\tb = a;\n\t\t\ta = temp;\n\t\t}\n\n\t\tthis._h0 = (this._h0 + a) & 0xffffffff;\n\t\tthis._h1 = (this._h1 + b) & 0xffffffff;\n\t\tthis._h2 = (this._h2 + c) & 0xffffffff;\n\t\tthis._h3 = (this._h3 + d) & 0xffffffff;\n\t\tthis._h4 = (this._h4 + e) & 0xffffffff;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { BrowserFeatures } from 'vs/base/browser/canIUse';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { AbstractIdleValue, IntervalTimer, TimeoutTimer, _runWhenIdle, IdleDeadline } from 'vs/base/common/async';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport * as event from 'vs/base/common/event';\nimport { KeyCode } from 'vs/base/common/keyCodes';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { hash } from 'vs/base/common/hash';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { isPointWithinTriangle } from 'vs/base/common/numbers';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter();\n\tconst onDidUnregisterWindow = new event.Emitter();\n\tconst onWillUnregisterWindow = new event.Emitter();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\n\nexport function clearNodeRecursively(domNode: ChildNode) {\n\twhile (domNode.firstChild) {\n\t\tconst element = domNode.firstChild;\n\t\telement.remove();\n\t\tclearNodeRecursively(element);\n\t}\n}\n\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue extends AbstractIdleValue {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport function disposableWindowInterval(targetWindow: Window, handler: () => void | boolean /* stop interval */ | Promise, interval: number, iterations?: number): IDisposable {\n\tlet iteration = 0;\n\tconst timer = targetWindow.setInterval(() => {\n\t\titeration++;\n\t\tif ((typeof iterations === 'number' && iteration >= iterations) || handler() === true) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, interval);\n\tconst disposable = toDisposable(() => {\n\t\ttargetWindow.clearInterval(timer);\n\t});\n\treturn disposable;\n}\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map();\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function measure(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, 10000 /* must be early */);\n}\n\nexport function modify(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, -10000 /* must be late */);\n}\n\n/**\n * Add a throttled listener. `handler` is fired at most every 8.33333ms or with the next animation frame (if browser supports it).\n */\nexport interface IEventMerger {\n\t(lastEvent: R | null, currentEvent: E): R;\n}\n\nconst MINIMUM_TIME_MS = 8;\nconst DEFAULT_EVENT_MERGER: IEventMerger = function (lastEvent: Event | null, currentEvent: Event) {\n\treturn currentEvent;\n};\n\nclass TimeoutThrottledDomListener extends Disposable {\n\n\tconstructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {\n\t\tsuper();\n\n\t\tlet lastEvent: R | null = null;\n\t\tlet lastHandlerTime = 0;\n\t\tconst timeout = this._register(new TimeoutTimer());\n\n\t\tconst invokeHandler = () => {\n\t\t\tlastHandlerTime = (new Date()).getTime();\n\t\t\thandler(lastEvent);\n\t\t\tlastEvent = null;\n\t\t};\n\n\t\tthis._register(addDisposableListener(node, type, (e) => {\n\n\t\t\tlastEvent = eventMerger(lastEvent, e);\n\t\t\tconst elapsedTime = (new Date()).getTime() - lastHandlerTime;\n\n\t\t\tif (elapsedTime >= minimumTimeMs) {\n\t\t\t\ttimeout.cancel();\n\t\t\t\tinvokeHandler();\n\t\t\t} else {\n\t\t\t\ttimeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\n\t\t\t}\n\t\t}));\n\t}\n}\n\nexport function addDisposableThrottledListener(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger, minimumTimeMs?: number): IDisposable {\n\treturn new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\n}\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, fallback?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallback) {\n\t\treturn getClientArea(fallback);\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string, jsPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (obj).height === 'number' && typeof (obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\nexport function position(element: HTMLElement, top: number, right?: number, bottom?: number, left?: number, position: string = 'absolute'): void {\n\tif (typeof top === 'number') {\n\t\telement.style.top = `${top}px`;\n\t}\n\n\tif (typeof right === 'number') {\n\t\telement.style.right = `${right}px`;\n\t}\n\n\tif (typeof bottom === 'number') {\n\t\telement.style.bottom = `${bottom}px`;\n\t}\n\n\tif (typeof left === 'number') {\n\t\telement.style.left = `${left}px`;\n\t}\n\n\telement.style.position = position;\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\nexport function getTotalScrollWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.scrollWidth + margin;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// Gets the left coordinate of the specified element relative to the specified parent.\nfunction getRelativeLeft(element: HTMLElement, parent: HTMLElement): number {\n\tif (element === null) {\n\t\treturn 0;\n\t}\n\n\tconst elementPosition = getTopLeftOffset(element);\n\tconst parentPosition = getTopLeftOffset(parent);\n\treturn elementPosition.left - parentPosition.left;\n}\n\nexport function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[]): number {\n\tconst childWidths = children.map((child) => {\n\t\treturn Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;\n\t});\n\tconst maxWidth = Math.max(...childWidths);\n\treturn maxWidth;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nconst parentFlowToDataKey = 'parentFlowToElementId';\n\n/**\n * Set an explicit parent to use for nodes that are not part of the\n * regular dom structure.\n */\nexport function setParentFlowTo(fromChildElement: HTMLElement, toParentElement: Element): void {\n\tfromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;\n}\n\nfunction getParentFlowToElement(node: HTMLElement): HTMLElement | null {\n\tconst flowToParentId = node.dataset[parentFlowToDataKey];\n\tif (typeof flowToParentId === 'string') {\n\t\treturn node.ownerDocument.getElementById(flowToParentId);\n\t}\n\treturn null;\n}\n\n/**\n * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit\n * parents set by `setParentFlowTo`.\n */\nexport function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean {\n\tlet node: Node | null = testChild;\n\twhile (node) {\n\t\tif (node === testAncestor) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (isHTMLElement(node)) {\n\t\t\tconst flowToParentElement = getParentFlowToElement(node);\n\t\t\tif (flowToParentElement) {\n\t\t\t\tnode = flowToParentElement;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\n\treturn false;\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (node.classList.contains(clazz)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(node).host && !!(node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns whether the element is in the active `document`. The active\n * document has focus or will be the main windows document.\n */\nexport function isActiveDocument(element: Element): boolean {\n\treturn element.ownerDocument === getActiveDocument();\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\treturn documents.find(doc => doc.hasFocus()) ?? mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\nconst globalStylesheets = new Map>();\n\nexport function isGlobalStylesheet(node: Node): boolean {\n\treturn globalStylesheets.has(node as HTMLStyleElement);\n}\n\n/**\n * A version of createStyleSheet which has a unified API to initialize/set the style content.\n */\nexport function createStyleSheet2(): WrappedStyleElement {\n\treturn new WrappedStyleElement();\n}\n\nclass WrappedStyleElement {\n\tprivate _currentCssStyle = '';\n\tprivate _styleSheet: HTMLStyleElement | undefined = undefined;\n\n\tpublic setStyle(cssStyle: string): void {\n\t\tif (cssStyle === this._currentCssStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._currentCssStyle = cssStyle;\n\n\t\tif (!this._styleSheet) {\n\t\t\tthis._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);\n\t\t} else {\n\t\t\tthis._styleSheet.innerText = cssStyle;\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._styleSheet) {\n\t\t\tthis._styleSheet.remove();\n\t\t\tthis._styleSheet = undefined;\n\t\t}\n\t}\n}\n\nexport function createStyleSheet(container: HTMLElement = mainWindow.document.head, beforeAppend?: (style: HTMLStyleElement) => void, disposableStore?: DisposableStore): HTMLStyleElement {\n\tconst style = document.createElement('style');\n\tstyle.type = 'text/css';\n\tstyle.media = 'screen';\n\tbeforeAppend?.(style);\n\tcontainer.appendChild(style);\n\n\tif (disposableStore) {\n\t\tdisposableStore.add(toDisposable(() => style.remove()));\n\t}\n\n\t// With as container, the stylesheet becomes global and is tracked\n\t// to support auxiliary windows to clone the stylesheet.\n\tif (container === mainWindow.document.head) {\n\t\tconst globalStylesheetClones = new Set();\n\t\tglobalStylesheets.set(style, globalStylesheetClones);\n\n\t\tfor (const { window: targetWindow, disposables } of getWindows()) {\n\t\t\tif (targetWindow === mainWindow) {\n\t\t\t\tcontinue; // main window is already tracked\n\t\t\t}\n\n\t\t\tconst cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n\t\t\tdisposableStore?.add(cloneDisposable);\n\t\t}\n\t}\n\n\treturn style;\n}\n\nexport function cloneGlobalStylesheets(targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tfor (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {\n\t\tdisposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));\n\t}\n\n\treturn disposables;\n}\n\nfunction cloneGlobalStyleSheet(globalStylesheet: HTMLStyleElement, globalStylesheetClones: Set, targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tconst clone = globalStylesheet.cloneNode(true) as HTMLStyleElement;\n\ttargetWindow.document.head.appendChild(clone);\n\tdisposables.add(toDisposable(() => clone.remove()));\n\n\tfor (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n\t\tclone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);\n\t}\n\n\tdisposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n\t\tclone.textContent = globalStylesheet.textContent;\n\t}));\n\n\tglobalStylesheetClones.add(clone);\n\tdisposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));\n\n\treturn disposables;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function createMetaElement(container: HTMLElement = mainWindow.document.head): HTMLMetaElement {\n\treturn createHeadElement('meta', container) as HTMLMetaElement;\n}\n\nexport function createLinkElement(container: HTMLElement = mainWindow.document.head): HTMLLinkElement {\n\treturn createHeadElement('link', container) as HTMLLinkElement;\n}\n\nfunction createHeadElement(tagName: string, container: HTMLElement = mainWindow.document.head): HTMLElement {\n\tconst element = document.createElement(tagName);\n\tcontainer.appendChild(element);\n\treturn element;\n}\n\nlet _sharedStyleSheet: HTMLStyleElement | null = null;\nfunction getSharedStyleSheet(): HTMLStyleElement {\n\tif (!_sharedStyleSheet) {\n\t\t_sharedStyleSheet = createStyleSheet();\n\t}\n\treturn _sharedStyleSheet;\n}\n\nfunction getDynamicStyleSheetRules(style: HTMLStyleElement) {\n\tif (style?.sheet?.rules) {\n\t\t// Chrome, IE\n\t\treturn style.sheet.rules;\n\t}\n\tif (style?.sheet?.cssRules) {\n\t\t// FF\n\t\treturn style.sheet.cssRules;\n\t}\n\treturn [];\n}\n\nexport function createCSSRule(selector: string, cssText: string, style = getSharedStyleSheet()): void {\n\tif (!style || !cssText) {\n\t\treturn;\n\t}\n\n\tstyle.sheet?.insertRule(`${selector} {${cssText}}`, 0);\n\n\t// Apply rule also to all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tcreateCSSRule(selector, cssText, clonedGlobalStylesheet);\n\t}\n}\n\nexport function removeCSSRulesContainingSelector(ruleName: string, style = getSharedStyleSheet()): void {\n\tif (!style) {\n\t\treturn;\n\t}\n\n\tconst rules = getDynamicStyleSheetRules(style);\n\tconst toDelete: number[] = [];\n\tfor (let i = 0; i < rules.length; i++) {\n\t\tconst rule = rules[i];\n\t\tif (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n\t\t\ttoDelete.push(i);\n\t\t}\n\t}\n\n\tfor (let i = toDelete.length - 1; i >= 0; i--) {\n\t\tstyle.sheet?.deleteRule(toDelete[i]);\n\t}\n\n\t// Remove rules also from all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tremoveCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n\t}\n}\n\nfunction isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule {\n\treturn typeof (rule as CSSStyleRule).selectorText === 'string';\n}\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isHTMLSpanElement(e: unknown): e is HTMLSpanElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLSpanElement || e instanceof getWindow(e as Node).HTMLSpanElement;\n}\n\nexport function isHTMLTextAreaElement(e: unknown): e is HTMLTextAreaElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLTextAreaElement || e instanceof getWindow(e as Node).HTMLTextAreaElement;\n}\n\nexport function isHTMLInputElement(e: unknown): e is HTMLInputElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLInputElement || e instanceof getWindow(e as Node).HTMLInputElement;\n}\n\nexport function isHTMLButtonElement(e: unknown): e is HTMLButtonElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLButtonElement || e instanceof getWindow(e as Node).HTMLButtonElement;\n}\n\nexport function isHTMLDivElement(e: unknown): e is HTMLDivElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLDivElement || e instanceof getWindow(e as Node).HTMLDivElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport function isPointerEvent(e: unknown): e is PointerEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof PointerEvent || e instanceof getWindow(e as UIEvent).PointerEvent;\n}\n\nexport function isDragEvent(e: unknown): e is DragEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof DragEvent || e instanceof getWindow(e as UIEvent).DragEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: (e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event;\n\treadonly onDidBlur: event.Event;\n\trefreshState(): void;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter());\n\treadonly onDidFocus = this._onDidFocus.event;\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter());\n\treadonly onDidBlur = this._onDidBlur.event;\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n\n\trefreshState() {\n\t\tthis._refreshStateHandler();\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append(parent: HTMLElement, child: T): T;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array): void {\n\tparent.innerText = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t(result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result as T;\n}\n\nexport function $(description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function (description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function join(nodes: Node[], separator: Node | string): Node[] {\n\tconst result: Node[] = [];\n\n\tnodes.forEach((node, index) => {\n\t\tif (index > 0) {\n\t\t\tif (separator instanceof Node) {\n\t\t\t\tresult.push(separator.cloneNode());\n\t\t\t} else {\n\t\t\t\tresult.push(document.createTextNode(separator));\n\t\t\t}\n\t\t}\n\n\t\tresult.push(node);\n\t});\n\n\treturn result;\n}\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\nfunction findParentWithAttribute(node: Node | null, attribute: string): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (isHTMLElement(node) && node.hasAttribute(attribute)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function removeTabIndexAndUpdateFocus(node: HTMLElement): void {\n\tif (!node || !node.hasAttribute('tabIndex')) {\n\t\treturn;\n\t}\n\n\t// If we are the currently focused element and tabIndex is removed,\n\t// standard DOM behavior is to move focus to the element. We\n\t// typically never want that, rather put focus to the closest element\n\t// in the hierarchy of the parent DOM nodes.\n\tif (node.ownerDocument.activeElement === node) {\n\t\tconst parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');\n\t\tparentFocusable?.focus();\n\t}\n\n\tnode.removeAttribute('tabindex');\n}\n\nexport function finalHandler(fn: (event: T) => any): (event: T) => any {\n\treturn e => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tfn(e);\n\t};\n}\n\nexport function domContentLoaded(targetWindow: Window): Promise {\n\treturn new Promise(resolve => {\n\t\tconst readyState = targetWindow.document.readyState;\n\t\tif (readyState === 'complete' || (targetWindow.document && targetWindow.document.body !== null)) {\n\t\t\tresolve(undefined);\n\t\t} else {\n\t\t\tconst listener = () => {\n\t\t\t\ttargetWindow.window.removeEventListener('DOMContentLoaded', listener, false);\n\t\t\t\tresolve();\n\t\t\t};\n\n\t\t\ttargetWindow.window.addEventListener('DOMContentLoaded', listener, false);\n\t\t}\n\t});\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\n/**\n * Open a new window in a popup. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * Note: this does not set {@link window.opener} to null. This is to allow the opened popup to\n * be able to use {@link window.close} to close itself. Because of this, you should only use\n * this function on urls that you trust.\n *\n * In otherwords, you should almost always use {@link windowOpenNoOpener} instead of this function.\n */\nconst popupWidth = 780, popupHeight = 640;\nexport function windowOpenPopup(url: string): void {\n\tconst left = Math.floor(mainWindow.screenLeft + mainWindow.innerWidth / 2 - popupWidth / 2);\n\tconst top = Math.floor(mainWindow.screenTop + mainWindow.innerHeight / 2 - popupHeight / 2);\n\tmainWindow.open(\n\t\turl,\n\t\t'_blank',\n\t\t`width=${popupWidth},height=${popupHeight},top=${top},left=${left}`\n\t);\n}\n\n/**\n * Attempts to open a window and returns whether it succeeded. This technique is\n * not appropriate in certain contexts, like for example when the JS context is\n * executing inside a sandboxed iframe. If it is not necessary to know if the\n * browser blocked the new window, use {@link windowOpenNoOpener}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * See https://github.com/microsoft/monaco-editor/issues/2474\n * See https://mathiasbynens.github.io/rel-noopener/\n *\n * @param url the url to open\n * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default\n * (true) unless you trust the url that is being opened.\n * @returns boolean indicating if the {@link window.open} call succeeded\n */\nexport function windowOpenWithSuccess(url: string, noOpener = true): boolean {\n\tconst newTab = mainWindow.open();\n\tif (newTab) {\n\t\tif (noOpener) {\n\t\t\t// see `windowOpenNoOpener` for details on why this is important\n\t\t\t(newTab as any).opener = null;\n\t\t}\n\t\tnewTab.location.href = url;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nexport function asCSSPropertyValue(value: string) {\n\treturn `'${value.replace(/'/g, '%27')}'`;\n}\n\nexport function asCssValueWithDefault(cssPropertyValue: string | undefined, dflt: string): string {\n\tif (cssPropertyValue !== undefined) {\n\t\tconst variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n\t\tif (variableMatch) {\n\t\t\tconst varArguments = variableMatch[1].split(',', 2);\n\t\t\tif (varArguments.length === 2) {\n\t\t\t\tdflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n\t\t\t}\n\t\t\treturn `var(${varArguments[0]}, ${dflt})`;\n\t\t}\n\t\treturn cssPropertyValue;\n\t}\n\treturn dflt;\n}\n\nexport enum DetectedFullscreenMode {\n\n\t/**\n\t * The document is fullscreen, e.g. because an element\n\t * in the document requested to be fullscreen.\n\t */\n\tDOCUMENT = 1,\n\n\t/**\n\t * The browser is fullscreen, e.g. because the user enabled\n\t * native window fullscreen for it.\n\t */\n\tBROWSER\n}\n\nexport interface IDetectedFullscreen {\n\n\t/**\n\t * Figure out if the document is fullscreen or the browser.\n\t */\n\tmode: DetectedFullscreenMode;\n\n\t/**\n\t * Whether we know for sure that we are in fullscreen mode or\n\t * it is a guess.\n\t */\n\tguess: boolean;\n}\n\nexport function detectFullscreen(targetWindow: Window): IDetectedFullscreen | null {\n\n\t// Browser fullscreen: use DOM APIs to detect\n\tif (targetWindow.document.fullscreenElement || (targetWindow.document).webkitFullscreenElement || (targetWindow.document).webkitIsFullScreen) {\n\t\treturn { mode: DetectedFullscreenMode.DOCUMENT, guess: false };\n\t}\n\n\t// There is no standard way to figure out if the browser\n\t// is using native fullscreen. Via checking on screen\n\t// height and comparing that to window height, we can guess\n\t// it though.\n\n\tif (targetWindow.innerHeight === targetWindow.screen.height) {\n\t\t// if the height of the window matches the screen height, we can\n\t\t// safely assume that the browser is fullscreen because no browser\n\t\t// chrome is taking height away (e.g. like toolbars).\n\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: false };\n\t}\n\n\tif (platform.isMacintosh || platform.isLinux) {\n\t\t// macOS and Linux do not properly report `innerHeight`, only Windows does\n\t\tif (targetWindow.outerHeight === targetWindow.screen.height && targetWindow.outerWidth === targetWindow.screen.width) {\n\t\t\t// if the height of the browser matches the screen height, we can\n\t\t\t// only guess that we are in fullscreen. It is also possible that\n\t\t\t// the user has turned off taskbars in the OS and the browser is\n\t\t\t// simply able to span the entire size of the screen.\n\t\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: true };\n\t\t}\n\t}\n\n\t// Not in fullscreen\n\treturn null;\n}\n\n/**\n * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte\n *\n * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n */\nfunction toBinary(str: string): string {\n\tconst codeUnits = new Uint16Array(str.length);\n\tfor (let i = 0; i < codeUnits.length; i++) {\n\t\tcodeUnits[i] = str.charCodeAt(i);\n\t}\n\tlet binary = '';\n\tconst uint8array = new Uint8Array(codeUnits.buffer);\n\tfor (let i = 0; i < uint8array.length; i++) {\n\t\tbinary += String.fromCharCode(uint8array[i]);\n\t}\n\treturn binary;\n}\n\n/**\n * Version of the global `btoa` function that handles multi-byte characters instead\n * of throwing an exception.\n */\nexport function multibyteAwareBtoa(str: string): string {\n\treturn btoa(toBinary(str));\n}\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter {\n\n\tprivate readonly _subscriptions = new DisposableStore();\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\tget isModifierPressed(): boolean {\n\t\treturn this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport function getCookieValue(name: string): string | undefined {\n\tconst match = document.cookie.match('(^|[^;]+)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531\n\n\treturn match ? match.pop() : undefined;\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\ntype HTMLElementAttributeKeys = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys : T[K] }>;\ntype ElementAttributes = HTMLElementAttributeKeys & Record;\ntype RemoveHTMLElement = T extends HTMLElement ? never : T;\ntype UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj = UnionToIntersection>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement; id: TId }\n\t: { element: TagToElement; id: 'root' };\n\ntype TagToRecord = TagToElementAndId extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record;\n\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nexport function svgElem\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElementNS('http://www.w3.org/2000/svg', tagName) as any as HTMLElement;\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nfunction copyAttribute(from: Element, to: Element, name: string): void {\n\tconst value = from.getAttribute(name);\n\tif (value) {\n\t\tto.setAttribute(name, value);\n\t} else {\n\t\tto.removeAttribute(name);\n\t}\n}\n\nexport function trackAttributes(from: Element, to: Element, filter?: string[]): IDisposable {\n\tcopyAttributes(from, to, filter);\n\n\tconst disposables = new DisposableStore();\n\n\tdisposables.add(sharedMutationObserver.observe(from, disposables, { attributes: true, attributeFilter: filter })(mutations => {\n\t\tfor (const mutation of mutations) {\n\t\t\tif (mutation.type === 'attributes' && mutation.attributeName) {\n\t\t\t\tcopyAttribute(from, to, mutation.attributeName);\n\t\t\t}\n\t\t}\n\t}));\n\n\treturn disposables;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 triangles, 2 points (x, y) stored for each\n\tprivate triangles: number[] = [];\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.triangles;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { triangles, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, triangles[2 * i], triangles[2 * i + 1], triangles[2 * i + 2], triangles[2 * i + 3])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class FastDomNode {\n\n\tprivate _maxWidth: string = '';\n\tprivate _width: string = '';\n\tprivate _height: string = '';\n\tprivate _top: string = '';\n\tprivate _left: string = '';\n\tprivate _bottom: string = '';\n\tprivate _right: string = '';\n\tprivate _paddingTop: string = '';\n\tprivate _paddingLeft: string = '';\n\tprivate _paddingBottom: string = '';\n\tprivate _paddingRight: string = '';\n\tprivate _fontFamily: string = '';\n\tprivate _fontWeight: string = '';\n\tprivate _fontSize: string = '';\n\tprivate _fontStyle: string = '';\n\tprivate _fontFeatureSettings: string = '';\n\tprivate _fontVariationSettings: string = '';\n\tprivate _textDecoration: string = '';\n\tprivate _lineHeight: string = '';\n\tprivate _letterSpacing: string = '';\n\tprivate _className: string = '';\n\tprivate _display: string = '';\n\tprivate _position: string = '';\n\tprivate _visibility: string = '';\n\tprivate _color: string = '';\n\tprivate _backgroundColor: string = '';\n\tprivate _layerHint: boolean = false;\n\tprivate _contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint' = 'none';\n\tprivate _boxShadow: string = '';\n\n\tconstructor(\n\t\tpublic readonly domNode: T\n\t) { }\n\n\tpublic setMaxWidth(_maxWidth: number | string): void {\n\t\tconst maxWidth = numberAsPixels(_maxWidth);\n\t\tif (this._maxWidth === maxWidth) {\n\t\t\treturn;\n\t\t}\n\t\tthis._maxWidth = maxWidth;\n\t\tthis.domNode.style.maxWidth = this._maxWidth;\n\t}\n\n\tpublic setWidth(_width: number | string): void {\n\t\tconst width = numberAsPixels(_width);\n\t\tif (this._width === width) {\n\t\t\treturn;\n\t\t}\n\t\tthis._width = width;\n\t\tthis.domNode.style.width = this._width;\n\t}\n\n\tpublic setHeight(_height: number | string): void {\n\t\tconst height = numberAsPixels(_height);\n\t\tif (this._height === height) {\n\t\t\treturn;\n\t\t}\n\t\tthis._height = height;\n\t\tthis.domNode.style.height = this._height;\n\t}\n\n\tpublic setTop(_top: number | string): void {\n\t\tconst top = numberAsPixels(_top);\n\t\tif (this._top === top) {\n\t\t\treturn;\n\t\t}\n\t\tthis._top = top;\n\t\tthis.domNode.style.top = this._top;\n\t}\n\n\tpublic setLeft(_left: number | string): void {\n\t\tconst left = numberAsPixels(_left);\n\t\tif (this._left === left) {\n\t\t\treturn;\n\t\t}\n\t\tthis._left = left;\n\t\tthis.domNode.style.left = this._left;\n\t}\n\n\tpublic setBottom(_bottom: number | string): void {\n\t\tconst bottom = numberAsPixels(_bottom);\n\t\tif (this._bottom === bottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._bottom = bottom;\n\t\tthis.domNode.style.bottom = this._bottom;\n\t}\n\n\tpublic setRight(_right: number | string): void {\n\t\tconst right = numberAsPixels(_right);\n\t\tif (this._right === right) {\n\t\t\treturn;\n\t\t}\n\t\tthis._right = right;\n\t\tthis.domNode.style.right = this._right;\n\t}\n\n\tpublic setPaddingTop(_paddingTop: number | string): void {\n\t\tconst paddingTop = numberAsPixels(_paddingTop);\n\t\tif (this._paddingTop === paddingTop) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingTop = paddingTop;\n\t\tthis.domNode.style.paddingTop = this._paddingTop;\n\t}\n\n\tpublic setPaddingLeft(_paddingLeft: number | string): void {\n\t\tconst paddingLeft = numberAsPixels(_paddingLeft);\n\t\tif (this._paddingLeft === paddingLeft) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingLeft = paddingLeft;\n\t\tthis.domNode.style.paddingLeft = this._paddingLeft;\n\t}\n\n\tpublic setPaddingBottom(_paddingBottom: number | string): void {\n\t\tconst paddingBottom = numberAsPixels(_paddingBottom);\n\t\tif (this._paddingBottom === paddingBottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingBottom = paddingBottom;\n\t\tthis.domNode.style.paddingBottom = this._paddingBottom;\n\t}\n\n\tpublic setPaddingRight(_paddingRight: number | string): void {\n\t\tconst paddingRight = numberAsPixels(_paddingRight);\n\t\tif (this._paddingRight === paddingRight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingRight = paddingRight;\n\t\tthis.domNode.style.paddingRight = this._paddingRight;\n\t}\n\n\tpublic setFontFamily(fontFamily: string): void {\n\t\tif (this._fontFamily === fontFamily) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFamily = fontFamily;\n\t\tthis.domNode.style.fontFamily = this._fontFamily;\n\t}\n\n\tpublic setFontWeight(fontWeight: string): void {\n\t\tif (this._fontWeight === fontWeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontWeight = fontWeight;\n\t\tthis.domNode.style.fontWeight = this._fontWeight;\n\t}\n\n\tpublic setFontSize(_fontSize: number | string): void {\n\t\tconst fontSize = numberAsPixels(_fontSize);\n\t\tif (this._fontSize === fontSize) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontSize = fontSize;\n\t\tthis.domNode.style.fontSize = this._fontSize;\n\t}\n\n\tpublic setFontStyle(fontStyle: string): void {\n\t\tif (this._fontStyle === fontStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontStyle = fontStyle;\n\t\tthis.domNode.style.fontStyle = this._fontStyle;\n\t}\n\n\tpublic setFontFeatureSettings(fontFeatureSettings: string): void {\n\t\tif (this._fontFeatureSettings === fontFeatureSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFeatureSettings = fontFeatureSettings;\n\t\tthis.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n\t}\n\n\tpublic setFontVariationSettings(fontVariationSettings: string): void {\n\t\tif (this._fontVariationSettings === fontVariationSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontVariationSettings = fontVariationSettings;\n\t\tthis.domNode.style.fontVariationSettings = this._fontVariationSettings;\n\t}\n\n\tpublic setTextDecoration(textDecoration: string): void {\n\t\tif (this._textDecoration === textDecoration) {\n\t\t\treturn;\n\t\t}\n\t\tthis._textDecoration = textDecoration;\n\t\tthis.domNode.style.textDecoration = this._textDecoration;\n\t}\n\n\tpublic setLineHeight(_lineHeight: number | string): void {\n\t\tconst lineHeight = numberAsPixels(_lineHeight);\n\t\tif (this._lineHeight === lineHeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._lineHeight = lineHeight;\n\t\tthis.domNode.style.lineHeight = this._lineHeight;\n\t}\n\n\tpublic setLetterSpacing(_letterSpacing: number | string): void {\n\t\tconst letterSpacing = numberAsPixels(_letterSpacing);\n\t\tif (this._letterSpacing === letterSpacing) {\n\t\t\treturn;\n\t\t}\n\t\tthis._letterSpacing = letterSpacing;\n\t\tthis.domNode.style.letterSpacing = this._letterSpacing;\n\t}\n\n\tpublic setClassName(className: string): void {\n\t\tif (this._className === className) {\n\t\t\treturn;\n\t\t}\n\t\tthis._className = className;\n\t\tthis.domNode.className = this._className;\n\t}\n\n\tpublic toggleClassName(className: string, shouldHaveIt?: boolean): void {\n\t\tthis.domNode.classList.toggle(className, shouldHaveIt);\n\t\tthis._className = this.domNode.className;\n\t}\n\n\tpublic setDisplay(display: string): void {\n\t\tif (this._display === display) {\n\t\t\treturn;\n\t\t}\n\t\tthis._display = display;\n\t\tthis.domNode.style.display = this._display;\n\t}\n\n\tpublic setPosition(position: string): void {\n\t\tif (this._position === position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._position = position;\n\t\tthis.domNode.style.position = this._position;\n\t}\n\n\tpublic setVisibility(visibility: string): void {\n\t\tif (this._visibility === visibility) {\n\t\t\treturn;\n\t\t}\n\t\tthis._visibility = visibility;\n\t\tthis.domNode.style.visibility = this._visibility;\n\t}\n\n\tpublic setColor(color: string): void {\n\t\tif (this._color === color) {\n\t\t\treturn;\n\t\t}\n\t\tthis._color = color;\n\t\tthis.domNode.style.color = this._color;\n\t}\n\n\tpublic setBackgroundColor(backgroundColor: string): void {\n\t\tif (this._backgroundColor === backgroundColor) {\n\t\t\treturn;\n\t\t}\n\t\tthis._backgroundColor = backgroundColor;\n\t\tthis.domNode.style.backgroundColor = this._backgroundColor;\n\t}\n\n\tpublic setLayerHinting(layerHint: boolean): void {\n\t\tif (this._layerHint === layerHint) {\n\t\t\treturn;\n\t\t}\n\t\tthis._layerHint = layerHint;\n\t\tthis.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n\t}\n\n\tpublic setBoxShadow(boxShadow: string): void {\n\t\tif (this._boxShadow === boxShadow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._boxShadow = boxShadow;\n\t\tthis.domNode.style.boxShadow = boxShadow;\n\t}\n\n\tpublic setContain(contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'): void {\n\t\tif (this._contain === contain) {\n\t\t\treturn;\n\t\t}\n\t\tthis._contain = contain;\n\t\t(this.domNode.style).contain = this._contain;\n\t}\n\n\tpublic setAttribute(name: string, value: string): void {\n\t\tthis.domNode.setAttribute(name, value);\n\t}\n\n\tpublic removeAttribute(name: string): void {\n\t\tthis.domNode.removeAttribute(name);\n\t}\n\n\tpublic appendChild(child: FastDomNode): void {\n\t\tthis.domNode.appendChild(child.domNode);\n\t}\n\n\tpublic removeChild(child: FastDomNode): void {\n\t\tthis.domNode.removeChild(child.domNode);\n\t}\n}\n\nfunction numberAsPixels(value: number | string): string {\n\treturn (typeof value === 'number' ? `${value}px` : value);\n}\n\nexport function createFastDomNode(domNode: T): FastDomNode {\n\treturn new FastDomNode(domNode);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport interface IPointerMoveCallback {\n\t(event: PointerEvent): void;\n}\n\nexport interface IOnStopCallback {\n\t(browserEvent?: PointerEvent | KeyboardEvent): void;\n}\n\nexport class GlobalPointerMoveMonitor implements IDisposable {\n\n\tprivate readonly _hooks = new DisposableStore();\n\tprivate _pointerMoveCallback: IPointerMoveCallback | null = null;\n\tprivate _onStopCallback: IOnStopCallback | null = null;\n\n\tpublic dispose(): void {\n\t\tthis.stopMonitoring(false);\n\t\tthis._hooks.dispose();\n\t}\n\n\tpublic stopMonitoring(invokeStopCallback: boolean, browserEvent?: PointerEvent | KeyboardEvent): void {\n\t\tif (!this.isMonitoring()) {\n\t\t\t// Not monitoring\n\t\t\treturn;\n\t\t}\n\n\t\t// Unhook\n\t\tthis._hooks.clear();\n\t\tthis._pointerMoveCallback = null;\n\t\tconst onStopCallback = this._onStopCallback;\n\t\tthis._onStopCallback = null;\n\n\t\tif (invokeStopCallback && onStopCallback) {\n\t\t\tonStopCallback(browserEvent);\n\t\t}\n\t}\n\n\tpublic isMonitoring(): boolean {\n\t\treturn !!this._pointerMoveCallback;\n\t}\n\n\tpublic startMonitoring(\n\t\tinitialElement: Element,\n\t\tpointerId: number,\n\t\tinitialButtons: number,\n\t\tpointerMoveCallback: IPointerMoveCallback,\n\t\tonStopCallback: IOnStopCallback\n\t): void {\n\t\tif (this.isMonitoring()) {\n\t\t\tthis.stopMonitoring(false);\n\t\t}\n\t\tthis._pointerMoveCallback = pointerMoveCallback;\n\t\tthis._onStopCallback = onStopCallback;\n\n\t\tlet eventSource: Element | Window = initialElement;\n\n\t\ttry {\n\t\t\tinitialElement.setPointerCapture(pointerId);\n\t\t\tthis._hooks.add(toDisposable(() => {\n\t\t\t\ttry {\n\t\t\t\t\tinitialElement.releasePointerCapture(pointerId);\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// See https://github.com/microsoft/vscode/issues/161731\n\t\t\t\t\t//\n\t\t\t\t\t// `releasePointerCapture` sometimes fails when being invoked with the exception:\n\t\t\t\t\t// DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n\t\t\t\t\t// No active pointer with the given id is found.\n\t\t\t\t\t//\n\t\t\t\t\t// There's no need to do anything in case of failure\n\t\t\t\t}\n\t\t\t}));\n\t\t} catch (err) {\n\t\t\t// See https://github.com/microsoft/vscode/issues/144584\n\t\t\t// See https://github.com/microsoft/vscode/issues/146947\n\t\t\t// `setPointerCapture` sometimes fails when being invoked\n\t\t\t// from a `mousedown` listener on macOS and Windows\n\t\t\t// and it always fails on Linux with the exception:\n\t\t\t// DOMException: Failed to execute 'setPointerCapture' on 'Element':\n\t\t\t// No active pointer with the given id is found.\n\t\t\t// In case of failure, we bind the listeners on the window\n\t\t\teventSource = dom.getWindow(initialElement);\n\t\t}\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_MOVE,\n\t\t\t(e) => {\n\t\t\t\tif (e.buttons !== initialButtons) {\n\t\t\t\t\t// Buttons state has changed in the meantime\n\t\t\t\t\tthis.stopMonitoring(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._pointerMoveCallback!(e);\n\t\t\t}\n\t\t));\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_UP,\n\t\t\t(e: PointerEvent) => this.stopMonitoring(true)\n\t\t));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nfunction createDecorator(mapFn: (fn: Function, key: string) => Function): Function {\n\treturn (target: any, key: string, descriptor: any) => {\n\t\tlet fnKey: string | null = null;\n\t\tlet fn: Function | null = null;\n\n\t\tif (typeof descriptor.value === 'function') {\n\t\t\tfnKey = 'value';\n\t\t\tfn = descriptor.value;\n\t\t} else if (typeof descriptor.get === 'function') {\n\t\t\tfnKey = 'get';\n\t\t\tfn = descriptor.get;\n\t\t}\n\n\t\tif (!fn) {\n\t\t\tthrow new Error('not supported');\n\t\t}\n\n\t\tdescriptor[fnKey!] = mapFn(fn, key);\n\t};\n}\n\nexport function memoize(_target: any, key: string, descriptor: any) {\n\tlet fnKey: string | null = null;\n\tlet fn: Function | null = null;\n\n\tif (typeof descriptor.value === 'function') {\n\t\tfnKey = 'value';\n\t\tfn = descriptor.value;\n\n\t\tif (fn!.length !== 0) {\n\t\t\tconsole.warn('Memoize should only be used in functions with zero parameters');\n\t\t}\n\t} else if (typeof descriptor.get === 'function') {\n\t\tfnKey = 'get';\n\t\tfn = descriptor.get;\n\t}\n\n\tif (!fn) {\n\t\tthrow new Error('not supported');\n\t}\n\n\tconst memoizeKey = `$memoize$${key}`;\n\tdescriptor[fnKey!] = function (...args: any[]) {\n\t\tif (!this.hasOwnProperty(memoizeKey)) {\n\t\t\tObject.defineProperty(this, memoizeKey, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t\tvalue: fn.apply(this, args)\n\t\t\t});\n\t\t}\n\n\t\treturn this[memoizeKey];\n\t};\n}\n\nexport interface IDebounceReducer {\n\t(previousValue: T, ...args: any[]): T;\n}\n\nexport function debounce(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$debounce$${key}`;\n\t\tconst resultKey = `$debounce$result$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\n\t\t\tclearTimeout(this[timerKey]);\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t\targs = [this[resultKey]];\n\t\t\t}\n\n\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\tfn.apply(this, args);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}, delay);\n\t\t};\n\t});\n}\n\nexport function throttle(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$throttle$timer$${key}`;\n\t\tconst resultKey = `$throttle$result$${key}`;\n\t\tconst lastRunKey = `$throttle$lastRun$${key}`;\n\t\tconst pendingKey = `$throttle$pending$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\t\t\tif (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n\t\t\t\tthis[lastRunKey] = -Number.MAX_VALUE;\n\t\t\t}\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t}\n\n\t\t\tif (this[pendingKey]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextTime = this[lastRunKey] + delay;\n\t\t\tif (nextTime <= Date.now()) {\n\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t} else {\n\t\t\t\tthis[pendingKey] = true;\n\t\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\t\tthis[pendingKey] = false;\n\t\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t\t}, nextTime - Date.now());\n\t\t\t}\n\t\t};\n\t});\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as DomUtils from 'vs/base/browser/dom';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as arrays from 'vs/base/common/arrays';\nimport { memoize } from 'vs/base/common/decorators';\nimport { Event as EventUtils } from 'vs/base/common/event';\nimport { Disposable, IDisposable, markAsSingleton, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\n\nexport namespace EventType {\n\texport const Tap = '-xterm-gesturetap';\n\texport const Change = '-xterm-gesturechange';\n\texport const Start = '-xterm-gesturestart';\n\texport const End = '-xterm-gesturesend';\n\texport const Contextmenu = '-xterm-gesturecontextmenu';\n}\n\ninterface TouchData {\n\tid: number;\n\tinitialTarget: EventTarget;\n\tinitialTimeStamp: number;\n\tinitialPageX: number;\n\tinitialPageY: number;\n\trollingTimestamps: number[];\n\trollingPageX: number[];\n\trollingPageY: number[];\n}\n\nexport interface GestureEvent extends MouseEvent {\n\tinitialTarget: EventTarget | undefined;\n\ttranslationX: number;\n\ttranslationY: number;\n\tpageX: number;\n\tpageY: number;\n\ttapCount: number;\n}\n\ninterface Touch {\n\tidentifier: number;\n\tscreenX: number;\n\tscreenY: number;\n\tclientX: number;\n\tclientY: number;\n\tpageX: number;\n\tpageY: number;\n\tradiusX: number;\n\tradiusY: number;\n\trotationAngle: number;\n\tforce: number;\n\ttarget: Element;\n}\n\ninterface TouchList {\n\t[i: number]: Touch;\n\tlength: number;\n\titem(index: number): Touch;\n\tidentifiedTouch(id: number): Touch;\n}\n\ninterface TouchEvent extends Event {\n\ttouches: TouchList;\n\ttargetTouches: TouchList;\n\tchangedTouches: TouchList;\n}\n\nexport class Gesture extends Disposable {\n\n\tprivate static readonly SCROLL_FRICTION = -0.005;\n\tprivate static INSTANCE: Gesture;\n\tprivate static readonly HOLD_DELAY = 700;\n\n\tprivate dispatched = false;\n\tprivate readonly targets = new LinkedList();\n\tprivate readonly ignoreTargets = new LinkedList();\n\tprivate handle: IDisposable | null;\n\n\tprivate readonly activeTouches: { [id: number]: TouchData };\n\n\tprivate _lastSetTapCountTime: number;\n\n\tprivate static readonly CLEAR_TAP_COUNT_TIME = 400; // ms\n\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis.activeTouches = {};\n\t\tthis.handle = null;\n\t\tthis._lastSetTapCountTime = 0;\n\n\t\tthis._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e: TouchEvent) => this.onTouchStart(e), { passive: false }));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e: TouchEvent) => this.onTouchEnd(window, e)));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e: TouchEvent) => this.onTouchMove(e), { passive: false }));\n\t\t}, { window: mainWindow, disposables: this._store }));\n\t}\n\n\tpublic static addTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.targets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\tpublic static ignoreTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.ignoreTargets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\t@memoize\n\tstatic isTouchDevice(): boolean {\n\t\t// `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\n\t\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\t\treturn 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tsuper.dispose();\n\t}\n\n\tprivate onTouchStart(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tfor (let i = 0, len = e.targetTouches.length; i < len; i++) {\n\t\t\tconst touch = e.targetTouches.item(i);\n\n\t\t\tthis.activeTouches[touch.identifier] = {\n\t\t\t\tid: touch.identifier,\n\t\t\t\tinitialTarget: touch.target,\n\t\t\t\tinitialTimeStamp: timestamp,\n\t\t\t\tinitialPageX: touch.pageX,\n\t\t\t\tinitialPageY: touch.pageY,\n\t\t\t\trollingTimestamps: [timestamp],\n\t\t\t\trollingPageX: [touch.pageX],\n\t\t\t\trollingPageY: [touch.pageY]\n\t\t\t};\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Start, touch.target);\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate onTouchEnd(targetWindow: Window, e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tconst activeTouchCount = Object.keys(this.activeTouches).length;\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('move of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier],\n\t\t\t\tholdTime = Date.now() - data.initialTimeStamp;\n\n\t\t\tif (holdTime < Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (holdTime >= Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (activeTouchCount === 1) {\n\t\t\t\tconst finalX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tconst finalY = arrays.tail(data.rollingPageY)!;\n\n\t\t\t\tconst deltaT = arrays.tail(data.rollingTimestamps)! - data.rollingTimestamps[0];\n\t\t\t\tconst deltaX = finalX - data.rollingPageX[0];\n\t\t\t\tconst deltaY = finalY - data.rollingPageY[0];\n\n\t\t\t\t// We need to get all the dispatch targets on the start of the inertia event\n\t\t\t\tconst dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, timestamp,\t// time now\n\t\t\t\t\tMath.abs(deltaX) / deltaT,\t\t\t\t\t\t// speed\n\t\t\t\t\tdeltaX > 0 ? 1 : -1,\t\t\t\t\t\t\t// x direction\n\t\t\t\t\tfinalX,\t\t\t\t\t\t\t\t\t\t\t// x now\n\t\t\t\t\tMath.abs(deltaY) / deltaT, \t\t\t\t\t// y speed\n\t\t\t\t\tdeltaY > 0 ? 1 : -1,\t\t\t\t\t\t\t// y direction\n\t\t\t\t\tfinalY\t\t\t\t\t\t\t\t\t\t\t// y now\n\t\t\t\t);\n\t\t\t}\n\n\n\t\t\tthis.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\n\t\t\t// forget about this touch\n\t\t\tdelete this.activeTouches[touch.identifier];\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate newGestureEvent(type: string, initialTarget?: EventTarget): GestureEvent {\n\t\tconst event = document.createEvent('CustomEvent') as unknown as GestureEvent;\n\t\tevent.initEvent(type, false, true);\n\t\tevent.initialTarget = initialTarget;\n\t\tevent.tapCount = 0;\n\t\treturn event;\n\t}\n\n\tprivate dispatchEvent(event: GestureEvent): void {\n\t\tif (event.type === EventType.Tap) {\n\t\t\tconst currentTime = (new Date()).getTime();\n\t\t\tlet setTapCount = 0;\n\t\t\tif (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\n\t\t\t\tsetTapCount = 1;\n\t\t\t} else {\n\t\t\t\tsetTapCount = 2;\n\t\t\t}\n\n\t\t\tthis._lastSetTapCountTime = currentTime;\n\t\t\tevent.tapCount = setTapCount;\n\t\t} else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\n\t\t\t// tap is canceled by scrolling or context menu\n\t\t\tthis._lastSetTapCountTime = 0;\n\t\t}\n\n\t\tif (event.initialTarget instanceof Node) {\n\t\t\tfor (const ignoreTarget of this.ignoreTargets) {\n\t\t\t\tif (ignoreTarget.contains(event.initialTarget)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targets: [number, HTMLElement][] = [];\n\t\t\tfor (const target of this.targets) {\n\t\t\t\tif (target.contains(event.initialTarget)) {\n\t\t\t\t\tlet depth = 0;\n\t\t\t\t\tlet now: Node | null = event.initialTarget;\n\t\t\t\t\twhile (now && now !== target) {\n\t\t\t\t\t\tdepth++;\n\t\t\t\t\t\tnow = now.parentElement;\n\t\t\t\t\t}\n\t\t\t\t\ttargets.push([depth, target]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttargets.sort((a, b) => a[0] - b[0]);\n\n\t\t\tfor (const [_, target] of targets) {\n\t\t\t\ttarget.dispatchEvent(event);\n\t\t\t\tthis.dispatched = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate inertia(targetWindow: Window, dispatchTo: readonly EventTarget[], t1: number, vX: number, dirX: number, x: number, vY: number, dirY: number, y: number): void {\n\t\tthis.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {\n\t\t\tconst now = Date.now();\n\n\t\t\t// velocity: old speed + accel_over_time\n\t\t\tconst deltaT = now - t1;\n\t\t\tlet delta_pos_x = 0, delta_pos_y = 0;\n\t\t\tlet stopped = true;\n\n\t\t\tvX += Gesture.SCROLL_FRICTION * deltaT;\n\t\t\tvY += Gesture.SCROLL_FRICTION * deltaT;\n\n\t\t\tif (vX > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_x = dirX * vX * deltaT;\n\t\t\t}\n\n\t\t\tif (vY > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_y = dirY * vY * deltaT;\n\t\t\t}\n\n\t\t\t// dispatch translation event\n\t\t\tconst evt = this.newGestureEvent(EventType.Change);\n\t\t\tevt.translationX = delta_pos_x;\n\t\t\tevt.translationY = delta_pos_y;\n\t\t\tdispatchTo.forEach(d => d.dispatchEvent(evt));\n\n\t\t\tif (!stopped) {\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate onTouchMove(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('end of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier];\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Change, data.initialTarget);\n\t\t\tevt.translationX = touch.pageX - arrays.tail(data.rollingPageX)!;\n\t\t\tevt.translationY = touch.pageY - arrays.tail(data.rollingPageY)!;\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t// only keep a few data points, to average the final speed\n\t\t\tif (data.rollingPageX.length > 3) {\n\t\t\t\tdata.rollingPageX.shift();\n\t\t\t\tdata.rollingPageY.shift();\n\t\t\t\tdata.rollingTimestamps.shift();\n\t\t\t}\n\n\t\t\tdata.rollingPageX.push(touch.pageX);\n\t\t\tdata.rollingPageY.push(touch.pageY);\n\t\t\tdata.rollingTimestamps.push(timestamp);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { Gesture } from 'vs/base/browser/touch';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport abstract class Widget extends Disposable {\n\n\tprotected onclick(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmousedown(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseover(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseleave(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onkeydown(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected onkeyup(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected oninput(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));\n\t}\n\n\tprotected onblur(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));\n\t}\n\n\tprotected onfocus(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));\n\t}\n\n\tprotected onchange(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));\n\t}\n\n\tprotected ignoreGesture(domNode: HTMLElement): IDisposable {\n\t\treturn Gesture.ignoreTarget(domNode);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport * as dom from 'vs/base/browser/dom';\n\n/**\n * The arrow image size.\n */\nexport const ARROW_IMG_SIZE = 11;\n\nexport interface ScrollbarArrowOptions {\n\tonActivate: () => void;\n\tclassName: string;\n\t// icon: ThemeIcon;\n\n\tbgWidth: number;\n\tbgHeight: number;\n\n\ttop?: number;\n\tleft?: number;\n\tbottom?: number;\n\tright?: number;\n}\n\nexport class ScrollbarArrow extends Widget {\n\n\tprivate _onActivate: () => void;\n\tpublic bgDomNode: HTMLElement;\n\tpublic domNode: HTMLElement;\n\tprivate _pointerdownRepeatTimer: dom.WindowIntervalTimer;\n\tprivate _pointerdownScheduleRepeatTimer: TimeoutTimer;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tconstructor(opts: ScrollbarArrowOptions) {\n\t\tsuper();\n\t\tthis._onActivate = opts.onActivate;\n\n\t\tthis.bgDomNode = document.createElement('div');\n\t\tthis.bgDomNode.className = 'arrow-background';\n\t\tthis.bgDomNode.style.position = 'absolute';\n\t\tthis.bgDomNode.style.width = opts.bgWidth + 'px';\n\t\tthis.bgDomNode.style.height = opts.bgHeight + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.bgDomNode.style.top = '0px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.bgDomNode.style.left = '0px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.bgDomNode.style.bottom = '0px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.bgDomNode.style.right = '0px';\n\t\t}\n\n\t\tthis.domNode = document.createElement('div');\n\t\tthis.domNode.className = opts.className;\n\t\t// this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));\n\n\t\tthis.domNode.style.position = 'absolute';\n\t\tthis.domNode.style.width = ARROW_IMG_SIZE + 'px';\n\t\tthis.domNode.style.height = ARROW_IMG_SIZE + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.domNode.style.top = opts.top + 'px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.domNode.style.left = opts.left + 'px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.domNode.style.bottom = opts.bottom + 'px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.domNode.style.right = opts.right + 'px';\n\t\t}\n\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\t\tthis._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\n\t\tthis._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer());\n\t\tthis._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer());\n\t}\n\n\tprivate _arrowPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst scheduleRepeater = () => {\n\t\t\tthis._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e));\n\t\t};\n\n\t\tthis._onActivate();\n\t\tthis._pointerdownRepeatTimer.cancel();\n\t\tthis._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData) => { /* Intentional empty */ },\n\t\t\t() => {\n\t\t\t\tthis._pointerdownRepeatTimer.cancel();\n\t\t\t\tthis._pointerdownScheduleRepeatTimer.cancel();\n\t\t\t}\n\t\t);\n\n\t\te.preventDefault();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport const enum ScrollbarVisibility {\n\tAuto = 1,\n\tHidden = 2,\n\tVisible = 3\n}\n\nexport interface ScrollEvent {\n\tinSmoothScrolling: boolean;\n\n\toldWidth: number;\n\toldScrollWidth: number;\n\toldScrollLeft: number;\n\n\twidth: number;\n\tscrollWidth: number;\n\tscrollLeft: number;\n\n\toldHeight: number;\n\toldScrollHeight: number;\n\toldScrollTop: number;\n\n\theight: number;\n\tscrollHeight: number;\n\tscrollTop: number;\n\n\twidthChanged: boolean;\n\tscrollWidthChanged: boolean;\n\tscrollLeftChanged: boolean;\n\n\theightChanged: boolean;\n\tscrollHeightChanged: boolean;\n\tscrollTopChanged: boolean;\n}\n\nexport class ScrollState implements IScrollDimensions, IScrollPosition {\n\t_scrollStateBrand: void = undefined;\n\n\tpublic readonly rawScrollLeft: number;\n\tpublic readonly rawScrollTop: number;\n\n\tpublic readonly width: number;\n\tpublic readonly scrollWidth: number;\n\tpublic readonly scrollLeft: number;\n\tpublic readonly height: number;\n\tpublic readonly scrollHeight: number;\n\tpublic readonly scrollTop: number;\n\n\tconstructor(\n\t\tprivate readonly _forceIntegerValues: boolean,\n\t\twidth: number,\n\t\tscrollWidth: number,\n\t\tscrollLeft: number,\n\t\theight: number,\n\t\tscrollHeight: number,\n\t\tscrollTop: number\n\t) {\n\t\tif (this._forceIntegerValues) {\n\t\t\twidth = width | 0;\n\t\t\tscrollWidth = scrollWidth | 0;\n\t\t\tscrollLeft = scrollLeft | 0;\n\t\t\theight = height | 0;\n\t\t\tscrollHeight = scrollHeight | 0;\n\t\t\tscrollTop = scrollTop | 0;\n\t\t}\n\n\t\tthis.rawScrollLeft = scrollLeft; // before validation\n\t\tthis.rawScrollTop = scrollTop; // before validation\n\n\t\tif (width < 0) {\n\t\t\twidth = 0;\n\t\t}\n\t\tif (scrollLeft + width > scrollWidth) {\n\t\t\tscrollLeft = scrollWidth - width;\n\t\t}\n\t\tif (scrollLeft < 0) {\n\t\t\tscrollLeft = 0;\n\t\t}\n\n\t\tif (height < 0) {\n\t\t\theight = 0;\n\t\t}\n\t\tif (scrollTop + height > scrollHeight) {\n\t\t\tscrollTop = scrollHeight - height;\n\t\t}\n\t\tif (scrollTop < 0) {\n\t\t\tscrollTop = 0;\n\t\t}\n\n\t\tthis.width = width;\n\t\tthis.scrollWidth = scrollWidth;\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.height = height;\n\t\tthis.scrollHeight = scrollHeight;\n\t\tthis.scrollTop = scrollTop;\n\t}\n\n\tpublic equals(other: ScrollState): boolean {\n\t\treturn (\n\t\t\tthis.rawScrollLeft === other.rawScrollLeft\n\t\t\t&& this.rawScrollTop === other.rawScrollTop\n\t\t\t&& this.width === other.width\n\t\t\t&& this.scrollWidth === other.scrollWidth\n\t\t\t&& this.scrollLeft === other.scrollLeft\n\t\t\t&& this.height === other.height\n\t\t\t&& this.scrollHeight === other.scrollHeight\n\t\t\t&& this.scrollTop === other.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollDimensions(update: INewScrollDimensions, useRawScrollPositions: boolean): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\t(typeof update.width !== 'undefined' ? update.width : this.width),\n\t\t\t(typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth),\n\t\t\tuseRawScrollPositions ? this.rawScrollLeft : this.scrollLeft,\n\t\t\t(typeof update.height !== 'undefined' ? update.height : this.height),\n\t\t\t(typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight),\n\t\t\tuseRawScrollPositions ? this.rawScrollTop : this.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollPosition(update: INewScrollPosition): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\tthis.width,\n\t\t\tthis.scrollWidth,\n\t\t\t(typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft),\n\t\t\tthis.height,\n\t\t\tthis.scrollHeight,\n\t\t\t(typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop)\n\t\t);\n\t}\n\n\tpublic createScrollEvent(previous: ScrollState, inSmoothScrolling: boolean): ScrollEvent {\n\t\tconst widthChanged = (this.width !== previous.width);\n\t\tconst scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth);\n\t\tconst scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft);\n\n\t\tconst heightChanged = (this.height !== previous.height);\n\t\tconst scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight);\n\t\tconst scrollTopChanged = (this.scrollTop !== previous.scrollTop);\n\n\t\treturn {\n\t\t\tinSmoothScrolling: inSmoothScrolling,\n\t\t\toldWidth: previous.width,\n\t\t\toldScrollWidth: previous.scrollWidth,\n\t\t\toldScrollLeft: previous.scrollLeft,\n\n\t\t\twidth: this.width,\n\t\t\tscrollWidth: this.scrollWidth,\n\t\t\tscrollLeft: this.scrollLeft,\n\n\t\t\toldHeight: previous.height,\n\t\t\toldScrollHeight: previous.scrollHeight,\n\t\t\toldScrollTop: previous.scrollTop,\n\n\t\t\theight: this.height,\n\t\t\tscrollHeight: this.scrollHeight,\n\t\t\tscrollTop: this.scrollTop,\n\n\t\t\twidthChanged: widthChanged,\n\t\t\tscrollWidthChanged: scrollWidthChanged,\n\t\t\tscrollLeftChanged: scrollLeftChanged,\n\n\t\t\theightChanged: heightChanged,\n\t\t\tscrollHeightChanged: scrollHeightChanged,\n\t\t\tscrollTopChanged: scrollTopChanged,\n\t\t};\n\t}\n\n}\n\nexport interface IScrollDimensions {\n\treadonly width: number;\n\treadonly scrollWidth: number;\n\treadonly height: number;\n\treadonly scrollHeight: number;\n}\nexport interface INewScrollDimensions {\n\twidth?: number;\n\tscrollWidth?: number;\n\theight?: number;\n\tscrollHeight?: number;\n}\n\nexport interface IScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n}\nexport interface ISmoothScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n\n\treadonly width: number;\n\treadonly height: number;\n}\nexport interface INewScrollPosition {\n\tscrollLeft?: number;\n\tscrollTop?: number;\n}\n\nexport interface IScrollableOptions {\n\t/**\n\t * Define if the scroll values should always be integers.\n\t */\n\tforceIntegerValues: boolean;\n\t/**\n\t * Set the duration (ms) used for smooth scroll animations.\n\t */\n\tsmoothScrollDuration: number;\n\t/**\n\t * A function to schedule an update at the next frame (used for smooth scroll animations).\n\t */\n\tscheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n}\n\nexport class Scrollable extends Disposable {\n\n\t_scrollableBrand: void = undefined;\n\n\tprivate _smoothScrollDuration: number;\n\tprivate readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n\tprivate _state: ScrollState;\n\tprivate _smoothScrolling: SmoothScrollingOperation | null;\n\n\tprivate _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tconstructor(options: IScrollableOptions) {\n\t\tsuper();\n\n\t\tthis._smoothScrollDuration = options.smoothScrollDuration;\n\t\tthis._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame;\n\t\tthis._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0);\n\t\tthis._smoothScrolling = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tpublic setSmoothScrollDuration(smoothScrollDuration: number): void {\n\t\tthis._smoothScrollDuration = smoothScrollDuration;\n\t}\n\n\tpublic validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition {\n\t\treturn this._state.withScrollPosition(scrollPosition);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions, useRawScrollPositions: boolean): void {\n\t\tconst newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);\n\t\tthis._setState(newState, Boolean(this._smoothScrolling));\n\n\t\t// Validate outstanding animated scroll position target\n\t\tthis._smoothScrolling?.acceptScrollDimensions(this._state);\n\t}\n\n\t/**\n\t * Returns the final scroll position that the instance will have once the smooth scroll animation concludes.\n\t * If no scroll animation is occurring, it will return the current scroll position instead.\n\t */\n\tpublic getFutureScrollPosition(): IScrollPosition {\n\t\tif (this._smoothScrolling) {\n\t\t\treturn this._smoothScrolling.to;\n\t\t}\n\t\treturn this._state;\n\t}\n\n\t/**\n\t * Returns the current scroll position.\n\t * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.\n\t */\n\tpublic getCurrentScrollPosition(): IScrollPosition {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollPositionNow(update: INewScrollPosition): void {\n\t\t// no smooth scrolling requested\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\t// Terminate any outstanding smooth scrolling\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\n\t\tthis._setState(newState, false);\n\t}\n\n\tpublic setScrollPositionSmooth(update: INewScrollPosition, reuseAnimation?: boolean): void {\n\t\tif (this._smoothScrollDuration === 0) {\n\t\t\t// Smooth scrolling not supported.\n\t\t\treturn this.setScrollPositionNow(update);\n\t\t}\n\n\t\tif (this._smoothScrolling) {\n\t\t\t// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop\n\t\t\tupdate = {\n\t\t\t\tscrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft),\n\t\t\t\tscrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop)\n\t\t\t};\n\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tif (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {\n\t\t\t\t// No need to interrupt or extend the current animation since we're going to the same place\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet newSmoothScrolling: SmoothScrollingOperation;\n\t\t\tif (reuseAnimation) {\n\t\t\t\tnewSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);\n\t\t\t} else {\n\t\t\t\tnewSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);\n\t\t\t}\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = newSmoothScrolling;\n\t\t} else {\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tthis._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);\n\t\t}\n\n\t\t// Begin smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tpublic hasPendingScrollAnimation(): boolean {\n\t\treturn Boolean(this._smoothScrolling);\n\t}\n\n\tprivate _performSmoothScrolling(): void {\n\t\tif (!this._smoothScrolling) {\n\t\t\treturn;\n\t\t}\n\t\tconst update = this._smoothScrolling.tick();\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\tthis._setState(newState, true);\n\n\t\tif (!this._smoothScrolling) {\n\t\t\t// Looks like someone canceled the smooth scrolling\n\t\t\t// from the scroll event handler\n\t\t\treturn;\n\t\t}\n\n\t\tif (update.isDone) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Continue smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tprivate _setState(newState: ScrollState, inSmoothScrolling: boolean): void {\n\t\tconst oldState = this._state;\n\t\tif (oldState.equals(newState)) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._state = newState;\n\t\tthis._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));\n\t}\n}\n\nexport class SmoothScrollingUpdate {\n\n\tpublic readonly scrollLeft: number;\n\tpublic readonly scrollTop: number;\n\tpublic readonly isDone: boolean;\n\n\tconstructor(scrollLeft: number, scrollTop: number, isDone: boolean) {\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.scrollTop = scrollTop;\n\t\tthis.isDone = isDone;\n\t}\n\n}\n\ninterface IAnimation {\n\t(completion: number): number;\n}\n\nfunction createEaseOutCubic(from: number, to: number): IAnimation {\n\tconst delta = to - from;\n\treturn function (completion: number): number {\n\t\treturn from + delta * easeOutCubic(completion);\n\t};\n}\n\nfunction createComposed(a: IAnimation, b: IAnimation, cut: number): IAnimation {\n\treturn function (completion: number): number {\n\t\tif (completion < cut) {\n\t\t\treturn a(completion / cut);\n\t\t}\n\t\treturn b((completion - cut) / (1 - cut));\n\t};\n}\n\nexport class SmoothScrollingOperation {\n\n\tpublic readonly from: ISmoothScrollPosition;\n\tpublic to: ISmoothScrollPosition;\n\tpublic readonly duration: number;\n\tpublic readonly startTime: number;\n\tpublic animationFrameDisposable: IDisposable | null;\n\n\tprivate scrollLeft!: IAnimation;\n\tprivate scrollTop!: IAnimation;\n\n\tconstructor(from: ISmoothScrollPosition, to: ISmoothScrollPosition, startTime: number, duration: number) {\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.duration = duration;\n\t\tthis.startTime = startTime;\n\n\t\tthis.animationFrameDisposable = null;\n\n\t\tthis._initAnimations();\n\t}\n\n\tprivate _initAnimations(): void {\n\t\tthis.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);\n\t\tthis.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);\n\t}\n\n\tprivate _initAnimation(from: number, to: number, viewportSize: number): IAnimation {\n\t\tconst delta = Math.abs(from - to);\n\t\tif (delta > 2.5 * viewportSize) {\n\t\t\tlet stop1: number, stop2: number;\n\t\t\tif (from < to) {\n\t\t\t\t// scroll to 75% of the viewportSize\n\t\t\t\tstop1 = from + 0.75 * viewportSize;\n\t\t\t\tstop2 = to - 0.75 * viewportSize;\n\t\t\t} else {\n\t\t\t\tstop1 = from - 0.75 * viewportSize;\n\t\t\t\tstop2 = to + 0.75 * viewportSize;\n\t\t\t}\n\t\t\treturn createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);\n\t\t}\n\t\treturn createEaseOutCubic(from, to);\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this.animationFrameDisposable !== null) {\n\t\t\tthis.animationFrameDisposable.dispose();\n\t\t\tthis.animationFrameDisposable = null;\n\t\t}\n\t}\n\n\tpublic acceptScrollDimensions(state: ScrollState): void {\n\t\tthis.to = state.withScrollPosition(this.to);\n\t\tthis._initAnimations();\n\t}\n\n\tpublic tick(): SmoothScrollingUpdate {\n\t\treturn this._tick(Date.now());\n\t}\n\n\tprotected _tick(now: number): SmoothScrollingUpdate {\n\t\tconst completion = (now - this.startTime) / this.duration;\n\n\t\tif (completion < 1) {\n\t\t\tconst newScrollLeft = this.scrollLeft(completion);\n\t\t\tconst newScrollTop = this.scrollTop(completion);\n\t\t\treturn new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);\n\t\t}\n\n\t\treturn new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);\n\t}\n\n\tpublic combine(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\treturn SmoothScrollingOperation.start(from, to, duration);\n\t}\n\n\tpublic static start(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\t// +10 / -10 : pretend the animation already started for a quicker response to a scroll request\n\t\tduration = duration + 10;\n\t\tconst startTime = Date.now() - 10;\n\n\t\treturn new SmoothScrollingOperation(from, to, startTime, duration);\n\t}\n}\n\nfunction easeInCubic(t: number) {\n\treturn Math.pow(t, 3);\n}\n\nfunction easeOutCubic(t: number) {\n\treturn 1 - easeInCubic(1 - t);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ScrollbarVisibility } from 'vs/base/common/scrollable';\n\nexport class ScrollbarVisibilityController extends Disposable {\n\tprivate _visibility: ScrollbarVisibility;\n\tprivate _visibleClassName: string;\n\tprivate _invisibleClassName: string;\n\tprivate _domNode: FastDomNode | null;\n\tprivate _rawShouldBeVisible: boolean;\n\tprivate _shouldBeVisible: boolean;\n\tprivate _isNeeded: boolean;\n\tprivate _isVisible: boolean;\n\tprivate _revealTimer: TimeoutTimer;\n\n\tconstructor(visibility: ScrollbarVisibility, visibleClassName: string, invisibleClassName: string) {\n\t\tsuper();\n\t\tthis._visibility = visibility;\n\t\tthis._visibleClassName = visibleClassName;\n\t\tthis._invisibleClassName = invisibleClassName;\n\t\tthis._domNode = null;\n\t\tthis._isVisible = false;\n\t\tthis._isNeeded = false;\n\t\tthis._rawShouldBeVisible = false;\n\t\tthis._shouldBeVisible = false;\n\t\tthis._revealTimer = this._register(new TimeoutTimer());\n\t}\n\n\tpublic setVisibility(visibility: ScrollbarVisibility): void {\n\t\tif (this._visibility !== visibility) {\n\t\t\tthis._visibility = visibility;\n\t\t\tthis._updateShouldBeVisible();\n\t\t}\n\t}\n\n\t// ----------------- Hide / Reveal\n\n\tpublic setShouldBeVisible(rawShouldBeVisible: boolean): void {\n\t\tthis._rawShouldBeVisible = rawShouldBeVisible;\n\t\tthis._updateShouldBeVisible();\n\t}\n\n\tprivate _applyVisibilitySetting(): boolean {\n\t\tif (this._visibility === ScrollbarVisibility.Hidden) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this._visibility === ScrollbarVisibility.Visible) {\n\t\t\treturn true;\n\t\t}\n\t\treturn this._rawShouldBeVisible;\n\t}\n\n\tprivate _updateShouldBeVisible(): void {\n\t\tconst shouldBeVisible = this._applyVisibilitySetting();\n\n\t\tif (this._shouldBeVisible !== shouldBeVisible) {\n\t\t\tthis._shouldBeVisible = shouldBeVisible;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setIsNeeded(isNeeded: boolean): void {\n\t\tif (this._isNeeded !== isNeeded) {\n\t\t\tthis._isNeeded = isNeeded;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setDomNode(domNode: FastDomNode): void {\n\t\tthis._domNode = domNode;\n\t\tthis._domNode.setClassName(this._invisibleClassName);\n\n\t\t// Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration\n\t\tthis.setShouldBeVisible(false);\n\t}\n\n\tpublic ensureVisibility(): void {\n\n\t\tif (!this._isNeeded) {\n\t\t\t// Nothing to be rendered\n\t\t\tthis._hide(false);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._shouldBeVisible) {\n\t\t\tthis._reveal();\n\t\t} else {\n\t\t\tthis._hide(true);\n\t\t}\n\t}\n\n\tprivate _reveal(): void {\n\t\tif (this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = true;\n\n\t\t// The CSS animation doesn't play otherwise\n\t\tthis._revealTimer.setIfNotSet(() => {\n\t\t\tthis._domNode?.setClassName(this._visibleClassName);\n\t\t}, 0);\n\t}\n\n\tprivate _hide(withFadeAway: boolean): void {\n\t\tthis._revealTimer.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { createFastDomNode, FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarArrow, ScrollbarArrowOptions } from 'vs/base/browser/ui/scrollbar/scrollbarArrow';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { ScrollbarVisibilityController } from 'vs/base/browser/ui/scrollbar/scrollbarVisibilityController';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n\n/**\n * The orthogonal distance to the slider at which dragging \"resets\". This implements \"snapping\"\n */\nconst POINTER_DRAG_RESET_DISTANCE = 140;\n\nexport interface ISimplifiedPointerEvent {\n\tbuttons: number;\n\tpageX: number;\n\tpageY: number;\n}\n\nexport interface ScrollbarHost {\n\tonMouseWheel(mouseWheelEvent: StandardWheelEvent): void;\n\tonDragStart(): void;\n\tonDragEnd(): void;\n}\n\nexport interface AbstractScrollbarOptions {\n\tlazyRender: boolean;\n\thost: ScrollbarHost;\n\tscrollbarState: ScrollbarState;\n\tvisibility: ScrollbarVisibility;\n\textraScrollbarClassName: string;\n\tscrollable: Scrollable;\n\tscrollByPage: boolean;\n}\n\nexport abstract class AbstractScrollbar extends Widget {\n\n\tprotected _host: ScrollbarHost;\n\tprotected _scrollable: Scrollable;\n\tprotected _scrollByPage: boolean;\n\tprivate _lazyRender: boolean;\n\tprotected _scrollbarState: ScrollbarState;\n\tprotected _visibilityController: ScrollbarVisibilityController;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tpublic domNode: FastDomNode;\n\tpublic slider!: FastDomNode;\n\n\tprotected _shouldRender: boolean;\n\n\tconstructor(opts: AbstractScrollbarOptions) {\n\t\tsuper();\n\t\tthis._lazyRender = opts.lazyRender;\n\t\tthis._host = opts.host;\n\t\tthis._scrollable = opts.scrollable;\n\t\tthis._scrollByPage = opts.scrollByPage;\n\t\tthis._scrollbarState = opts.scrollbarState;\n\t\tthis._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));\n\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._shouldRender = true;\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tthis.domNode.setAttribute('role', 'presentation');\n\t\tthis.domNode.setAttribute('aria-hidden', 'true');\n\n\t\tthis._visibilityController.setDomNode(this.domNode);\n\t\tthis.domNode.setPosition('absolute');\n\n\t\tthis._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e: PointerEvent) => this._domNodePointerDown(e)));\n\t}\n\n\t// ----------------- creation\n\n\t/**\n\t * Creates the dom node for an arrow & adds it to the container\n\t */\n\tprotected _createArrow(opts: ScrollbarArrowOptions): void {\n\t\tconst arrow = this._register(new ScrollbarArrow(opts));\n\t\tthis.domNode.domNode.appendChild(arrow.bgDomNode);\n\t\tthis.domNode.domNode.appendChild(arrow.domNode);\n\t}\n\n\t/**\n\t * Creates the slider dom node, adds it to the container & hooks up the events\n\t */\n\tprotected _createSlider(top: number, left: number, width: number | undefined, height: number | undefined): void {\n\t\tthis.slider = createFastDomNode(document.createElement('div'));\n\t\tthis.slider.setClassName('slider');\n\t\tthis.slider.setPosition('absolute');\n\t\tthis.slider.setTop(top);\n\t\tthis.slider.setLeft(left);\n\t\tif (typeof width === 'number') {\n\t\t\tthis.slider.setWidth(width);\n\t\t}\n\t\tif (typeof height === 'number') {\n\t\t\tthis.slider.setHeight(height);\n\t\t}\n\t\tthis.slider.setLayerHinting(true);\n\t\tthis.slider.setContain('strict');\n\n\t\tthis.domNode.domNode.appendChild(this.slider.domNode);\n\n\t\tthis._register(dom.addDisposableListener(\n\t\t\tthis.slider.domNode,\n\t\t\tdom.EventType.POINTER_DOWN,\n\t\t\t(e: PointerEvent) => {\n\t\t\t\tif (e.button === 0) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t\t}\n\t\t\t}\n\t\t));\n\n\t\tthis.onclick(this.slider.domNode, e => {\n\t\t\tif (e.leftButton) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\t}\n\n\t// ----------------- Update state\n\n\tprotected _onElementSize(visibleSize: number): boolean {\n\t\tif (this._scrollbarState.setVisibleSize(visibleSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollSize(elementScrollSize: number): boolean {\n\t\tif (this._scrollbarState.setScrollSize(elementScrollSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollPosition(elementScrollPosition: number): boolean {\n\t\tif (this._scrollbarState.setScrollPosition(elementScrollPosition)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\t// ----------------- rendering\n\n\tpublic beginReveal(): void {\n\t\tthis._visibilityController.setShouldBeVisible(true);\n\t}\n\n\tpublic beginHide(): void {\n\t\tthis._visibilityController.setShouldBeVisible(false);\n\t}\n\n\tpublic render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\t\tthis._shouldRender = false;\n\n\t\tthis._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());\n\t\tthis._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());\n\t}\n\t// ----------------- DOM events\n\n\tprivate _domNodePointerDown(e: PointerEvent): void {\n\t\tif (e.target !== this.domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onPointerDown(e);\n\t}\n\n\tpublic delegatePointerDown(e: PointerEvent): void {\n\t\tconst domTop = this.domNode.domNode.getClientRects()[0].top;\n\t\tconst sliderStart = domTop + this._scrollbarState.getSliderPosition();\n\t\tconst sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();\n\t\tconst pointerPos = this._sliderPointerPosition(e);\n\t\tif (sliderStart <= pointerPos && pointerPos <= sliderStop) {\n\t\t\t// Act as if it was a pointer down on the slider\n\t\t\tif (e.button === 0) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t}\n\t\t} else {\n\t\t\t// Act as if it was a pointer down on the scrollbar\n\t\t\tthis._onPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _onPointerDown(e: PointerEvent): void {\n\t\tlet offsetX: number;\n\t\tlet offsetY: number;\n\t\tif (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') {\n\t\t\toffsetX = e.offsetX;\n\t\t\toffsetY = e.offsetY;\n\t\t} else {\n\t\t\tconst domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode);\n\t\t\toffsetX = e.pageX - domNodePosition.left;\n\t\t\toffsetY = e.pageY - domNodePosition.top;\n\t\t}\n\n\t\tconst offset = this._pointerDownRelativePosition(offsetX, offsetY);\n\t\tthis._setDesiredScrollPositionNow(\n\t\t\tthis._scrollByPage\n\t\t\t\t? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset)\n\t\t\t\t: this._scrollbarState.getDesiredScrollPositionFromOffset(offset)\n\t\t);\n\n\t\tif (e.button === 0) {\n\t\t\t// left button\n\t\t\te.preventDefault();\n\t\t\tthis._sliderPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _sliderPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst initialPointerPosition = this._sliderPointerPosition(e);\n\t\tconst initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);\n\t\tconst initialScrollbarState = this._scrollbarState.clone();\n\t\tthis.slider.toggleClassName('active', true);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData: PointerEvent) => {\n\t\t\t\tconst pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);\n\n\t\t\t\tif (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {\n\t\t\t\t\t// The pointer has wondered away from the scrollbar => reset dragging\n\t\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst pointerPosition = this._sliderPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerDelta = pointerPosition - initialPointerPosition;\n\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.slider.toggleClassName('active', false);\n\t\t\t\tthis._host.onDragEnd();\n\t\t\t}\n\t\t);\n\n\t\tthis._host.onDragStart();\n\t}\n\n\tprivate _setDesiredScrollPositionNow(_desiredScrollPosition: number): void {\n\n\t\tconst desiredScrollPosition: INewScrollPosition = {};\n\t\tthis.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);\n\n\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t}\n\n\tpublic updateScrollbarSize(scrollbarSize: number): void {\n\t\tthis._updateScrollbarSize(scrollbarSize);\n\t\tthis._scrollbarState.setScrollbarSize(scrollbarSize);\n\t\tthis._shouldRender = true;\n\t\tif (!this._lazyRender) {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._scrollbarState.isNeeded();\n\t}\n\n\t// ----------------- Overwrite these\n\n\tprotected abstract _renderDomNode(largeSize: number, smallSize: number): void;\n\tprotected abstract _updateSlider(sliderSize: number, sliderPosition: number): void;\n\n\tprotected abstract _pointerDownRelativePosition(offsetX: number, offsetY: number): number;\n\tprotected abstract _sliderPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _updateScrollbarSize(size: number): void;\n\n\tpublic abstract writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.\n */\nconst MINIMUM_SLIDER_SIZE = 20;\n\nexport class ScrollbarState {\n\n\t/**\n\t * For the vertical scrollbar: the width.\n\t * For the horizontal scrollbar: the height.\n\t */\n\tprivate _scrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the pair horizontal scrollbar.\n\t * For the horizontal scrollbar: the width of the pair vertical scrollbar.\n\t */\n\tprivate _oppositeScrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the scrollbar's arrows.\n\t * For the horizontal scrollbar: the width of the scrollbar's arrows.\n\t */\n\tprivate readonly _arrowSize: number;\n\n\t// --- variables\n\t/**\n\t * For the vertical scrollbar: the viewport height.\n\t * For the horizontal scrollbar: the viewport width.\n\t */\n\tprivate _visibleSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll height.\n\t * For the horizontal scrollbar: the scroll width.\n\t */\n\tprivate _scrollSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll top.\n\t * For the horizontal scrollbar: the scroll left.\n\t */\n\tprivate _scrollPosition: number;\n\n\t// --- computed variables\n\n\t/**\n\t * `visibleSize` - `oppositeScrollbarSize`\n\t */\n\tprivate _computedAvailableSize: number;\n\t/**\n\t * (`scrollSize` > 0 && `scrollSize` > `visibleSize`)\n\t */\n\tprivate _computedIsNeeded: boolean;\n\n\tprivate _computedSliderSize: number;\n\tprivate _computedSliderRatio: number;\n\tprivate _computedSliderPosition: number;\n\n\tconstructor(arrowSize: number, scrollbarSize: number, oppositeScrollbarSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t\tthis._arrowSize = Math.round(arrowSize);\n\n\t\tthis._visibleSize = visibleSize;\n\t\tthis._scrollSize = scrollSize;\n\t\tthis._scrollPosition = scrollPosition;\n\n\t\tthis._computedAvailableSize = 0;\n\t\tthis._computedIsNeeded = false;\n\t\tthis._computedSliderSize = 0;\n\t\tthis._computedSliderRatio = 0;\n\t\tthis._computedSliderPosition = 0;\n\n\t\tthis._refreshComputedValues();\n\t}\n\n\tpublic clone(): ScrollbarState {\n\t\treturn new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t}\n\n\tpublic setVisibleSize(visibleSize: number): boolean {\n\t\tconst iVisibleSize = Math.round(visibleSize);\n\t\tif (this._visibleSize !== iVisibleSize) {\n\t\t\tthis._visibleSize = iVisibleSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollSize(scrollSize: number): boolean {\n\t\tconst iScrollSize = Math.round(scrollSize);\n\t\tif (this._scrollSize !== iScrollSize) {\n\t\t\tthis._scrollSize = iScrollSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollPosition(scrollPosition: number): boolean {\n\t\tconst iScrollPosition = Math.round(scrollPosition);\n\t\tif (this._scrollPosition !== iScrollPosition) {\n\t\t\tthis._scrollPosition = iScrollPosition;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollbarSize(scrollbarSize: number): void {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t}\n\n\tpublic setOppositeScrollbarSize(oppositeScrollbarSize: number): void {\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t}\n\n\tprivate static _computeValues(oppositeScrollbarSize: number, arrowSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tconst computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);\n\t\tconst computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);\n\t\tconst computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);\n\n\t\tif (!computedIsNeeded) {\n\t\t\t// There is no need for a slider\n\t\t\treturn {\n\t\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\t\tcomputedSliderSize: Math.round(computedRepresentableSize),\n\t\t\t\tcomputedSliderRatio: 0,\n\t\t\t\tcomputedSliderPosition: 0,\n\t\t\t};\n\t\t}\n\n\t\t// We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise\n\t\tconst computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));\n\n\t\t// The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`\n\t\t// in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.\n\t\tconst computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);\n\t\tconst computedSliderPosition = (scrollPosition * computedSliderRatio);\n\n\t\treturn {\n\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\tcomputedSliderSize: Math.round(computedSliderSize),\n\t\t\tcomputedSliderRatio: computedSliderRatio,\n\t\t\tcomputedSliderPosition: Math.round(computedSliderPosition),\n\t\t};\n\t}\n\n\tprivate _refreshComputedValues(): void {\n\t\tconst r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t\tthis._computedAvailableSize = r.computedAvailableSize;\n\t\tthis._computedIsNeeded = r.computedIsNeeded;\n\t\tthis._computedSliderSize = r.computedSliderSize;\n\t\tthis._computedSliderRatio = r.computedSliderRatio;\n\t\tthis._computedSliderPosition = r.computedSliderPosition;\n\t}\n\n\tpublic getArrowSize(): number {\n\t\treturn this._arrowSize;\n\t}\n\n\tpublic getScrollPosition(): number {\n\t\treturn this._scrollPosition;\n\t}\n\n\tpublic getRectangleLargeSize(): number {\n\t\treturn this._computedAvailableSize;\n\t}\n\n\tpublic getRectangleSmallSize(): number {\n\t\treturn this._scrollbarSize;\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._computedIsNeeded;\n\t}\n\n\tpublic getSliderSize(): number {\n\t\treturn this._computedSliderSize;\n\t}\n\n\tpublic getSliderPosition(): number {\n\t\treturn this._computedSliderPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.\n\t * `offset` is based on the same coordinate system as the `sliderPosition`.\n\t */\n\tpublic getDesiredScrollPositionFromOffset(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` from if offset is before or after the slider position.\n\t * If offset is before slider, treat as a page up (or left). If after, page down (or right).\n\t * `offset` and `_computedSliderPosition` are based on the same coordinate system.\n\t * `_visibleSize` corresponds to a \"page\" of lines in the returned coordinate system.\n\t */\n\tpublic getDesiredScrollPositionFromOffsetPaged(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst correctedOffset = offset - this._arrowSize; // compensate if has arrows\n\t\tlet desiredScrollPosition = this._scrollPosition;\n\t\tif (correctedOffset < this._computedSliderPosition) {\n\t\t\tdesiredScrollPosition -= this._visibleSize; // page up/left\n\t\t} else {\n\t\t\tdesiredScrollPosition += this._visibleSize; // page down/right\n\t\t}\n\t\treturn desiredScrollPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that the slider moves by `delta`.\n\t */\n\tpublic getDesiredScrollPositionFromDelta(delta: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = this._computedSliderPosition + delta;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\n\nexport class HorizontalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.horizontalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\tscrollDimensions.width,\n\t\t\t\tscrollDimensions.scrollWidth,\n\t\t\t\tscrollPosition.scrollLeft\n\t\t\t),\n\t\t\tvisibility: options.horizontal,\n\t\t\textraScrollbarClassName: 'horizontal',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.horizontalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonLeft,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: arrowDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonRight,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: undefined,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: arrowDelta,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setWidth(sliderSize);\n\t\tthis.slider.setLeft(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(largeSize);\n\t\tthis.domNode.setHeight(smallSize);\n\t\tthis.domNode.setLeft(0);\n\t\tthis.domNode.setBottom(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.width) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetX;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setHeight(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollLeft = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize);\n\t\tthis._scrollbarState.setOppositeScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\tthis._visibilityController.setVisibility(options.horizontal);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\nexport class VerticalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.verticalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\t\t\t0,\n\t\t\t\tscrollDimensions.height,\n\t\t\t\tscrollDimensions.scrollHeight,\n\t\t\t\tscrollPosition.scrollTop\n\t\t\t),\n\t\t\tvisibility: options.vertical,\n\t\t\textraScrollbarClassName: 'vertical',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.verticalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonUp,\n\t\t\t// \ttop: arrowDelta,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonDown,\n\t\t\t// \ttop: undefined,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: arrowDelta,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setHeight(sliderSize);\n\t\tthis.slider.setTop(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(smallSize);\n\t\tthis.domNode.setHeight(largeSize);\n\t\tthis.domNode.setRight(0);\n\t\tthis.domNode.setTop(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.height) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetY;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setWidth(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollTop = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\tthis._scrollbarState.setOppositeScrollbarSize(0);\n\t\tthis._visibilityController.setVisibility(options.vertical);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getZoomFactor, isChrome } from 'vs/base/browser/browser';\nimport * as dom from 'vs/base/browser/dom';\nimport { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';\nimport { IMouseEvent, IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { HorizontalScrollbar } from 'vs/base/browser/ui/scrollbar/horizontalScrollbar';\nimport { ScrollableElementChangeOptions, ScrollableElementCreationOptions, ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { VerticalScrollbar } from 'vs/base/browser/ui/scrollbar/verticalScrollbar';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { IDisposable, dispose } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollDimensions, INewScrollPosition, IScrollDimensions, IScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n// import 'vs/css!./media/scrollbars';\n\nconst HIDE_TIMEOUT = 500;\nconst SCROLL_WHEEL_SENSITIVITY = 50;\nconst SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;\n\nexport interface IOverviewRulerLayoutInfo {\n\tparent: HTMLElement;\n\tinsertBefore: HTMLElement;\n}\n\nclass MouseWheelClassifierItem {\n\tpublic timestamp: number;\n\tpublic deltaX: number;\n\tpublic deltaY: number;\n\tpublic score: number;\n\n\tconstructor(timestamp: number, deltaX: number, deltaY: number) {\n\t\tthis.timestamp = timestamp;\n\t\tthis.deltaX = deltaX;\n\t\tthis.deltaY = deltaY;\n\t\tthis.score = 0;\n\t}\n}\n\nexport class MouseWheelClassifier {\n\n\tpublic static readonly INSTANCE = new MouseWheelClassifier();\n\n\tprivate readonly _capacity: number;\n\tprivate _memory: MouseWheelClassifierItem[];\n\tprivate _front: number;\n\tprivate _rear: number;\n\n\tconstructor() {\n\t\tthis._capacity = 5;\n\t\tthis._memory = [];\n\t\tthis._front = -1;\n\t\tthis._rear = -1;\n\t}\n\n\tpublic isPhysicalMouseWheel(): boolean {\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\t// no elements\n\t\t\treturn false;\n\t\t}\n\n\t\t// 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...\n\t\tlet remainingInfluence = 1;\n\t\tlet score = 0;\n\t\tlet iteration = 1;\n\n\t\tlet index = this._rear;\n\t\tdo {\n\t\t\tconst influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));\n\t\t\tremainingInfluence -= influence;\n\t\t\tscore += this._memory[index].score * influence;\n\n\t\t\tif (index === this._front) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tindex = (this._capacity + index - 1) % this._capacity;\n\t\t\titeration++;\n\t\t} while (true);\n\n\t\treturn (score <= 0.5);\n\t}\n\n\tpublic acceptStandardWheelEvent(e: StandardWheelEvent): void {\n\t\tif (isChrome) {\n\t\t\tconst targetWindow = dom.getWindow(e.browserEvent);\n\t\t\tconst pageZoomFactor = getZoomFactor(targetWindow);\n\t\t\t// On Chrome, the incoming delta events are multiplied with the OS zoom factor.\n\t\t\t// The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.\n\t\t\tthis.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);\n\t\t} else {\n\t\t\tthis.accept(Date.now(), e.deltaX, e.deltaY);\n\t\t}\n\t}\n\n\tpublic accept(timestamp: number, deltaX: number, deltaY: number): void {\n\t\tlet previousItem = null;\n\t\tconst item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);\n\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\tthis._memory[0] = item;\n\t\t\tthis._front = 0;\n\t\t\tthis._rear = 0;\n\t\t} else {\n\t\t\tpreviousItem = this._memory[this._rear];\n\n\t\t\tthis._rear = (this._rear + 1) % this._capacity;\n\t\t\tif (this._rear === this._front) {\n\t\t\t\t// Drop oldest\n\t\t\t\tthis._front = (this._front + 1) % this._capacity;\n\t\t\t}\n\t\t\tthis._memory[this._rear] = item;\n\t\t}\n\n\t\titem.score = this._computeScore(item, previousItem);\n\t}\n\n\t/**\n\t * A score between 0 and 1 for `item`.\n\t * - a score towards 0 indicates that the source appears to be a physical mouse wheel\n\t * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.\n\t */\n\tprivate _computeScore(item: MouseWheelClassifierItem, previousItem: MouseWheelClassifierItem | null): number {\n\n\t\tif (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {\n\t\t\t// both axes exercised => definitely not a physical mouse wheel\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet score: number = 0.5;\n\n\t\tif (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {\n\t\t\t// non-integer deltas => indicator that this is not a physical mouse wheel\n\t\t\tscore += 0.25;\n\t\t}\n\n\t\t// Non-accelerating scroll => indicator that this is a physical mouse wheel\n\t\t// These can be identified by seeing whether they are the module of one another.\n\t\tif (previousItem) {\n\t\t\tconst absDeltaX = Math.abs(item.deltaX);\n\t\t\tconst absDeltaY = Math.abs(item.deltaY);\n\n\t\t\tconst absPreviousDeltaX = Math.abs(previousItem.deltaX);\n\t\t\tconst absPreviousDeltaY = Math.abs(previousItem.deltaY);\n\n\t\t\t// Min 1 to avoid division by zero, module 1 will still be 0.\n\t\t\tconst minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1);\n\t\t\tconst minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1);\n\n\t\t\tconst maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX);\n\t\t\tconst maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY);\n\n\t\t\tconst isSameModulo = (maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0);\n\t\t\tif (isSameModulo) {\n\t\t\t\tscore -= 0.5;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(Math.max(score, 0), 1);\n\t}\n\n\tprivate _isAlmostInt(value: number): boolean {\n\t\tconst delta = Math.abs(Math.round(value) - value);\n\t\treturn (delta < 0.01);\n\t}\n}\n\nexport abstract class AbstractScrollableElement extends Widget {\n\n\tprivate readonly _options: ScrollableElementResolvedOptions;\n\tprotected readonly _scrollable: Scrollable;\n\tprivate readonly _verticalScrollbar: VerticalScrollbar;\n\tprivate readonly _horizontalScrollbar: HorizontalScrollbar;\n\tprivate readonly _domNode: HTMLElement;\n\n\tprivate readonly _leftShadowDomNode: FastDomNode | null;\n\tprivate readonly _topShadowDomNode: FastDomNode | null;\n\tprivate readonly _topLeftShadowDomNode: FastDomNode | null;\n\n\tprivate readonly _listenOnDomNode: HTMLElement;\n\n\tprivate _mouseWheelToDispose: IDisposable[];\n\n\tprivate _isDragging: boolean;\n\tprivate _mouseIsOver: boolean;\n\n\tprivate readonly _hideTimeout: TimeoutTimer;\n\tprivate _shouldRender: boolean;\n\n\tprivate _revealOnScroll: boolean;\n\n\tprivate readonly _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tprivate readonly _onWillScroll = this._register(new Emitter());\n\tpublic readonly onWillScroll: Event = this._onWillScroll.event;\n\n\tpublic get options(): Readonly {\n\t\treturn this._options;\n\t}\n\n\tprotected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper();\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// element.style.overflow = 'hidden';\n\t\tthis._options = resolveOptions(options);\n\t\tthis._scrollable = scrollable;\n\n\t\tthis._register(this._scrollable.onScroll((e) => {\n\t\t\tthis._onWillScroll.fire(e);\n\t\t\tthis._onDidScroll(e);\n\t\t\tthis._onScroll.fire(e);\n\t\t}));\n\n\t\tconst scrollbarHost: ScrollbarHost = {\n\t\t\tonMouseWheel: (mouseWheelEvent: StandardWheelEvent) => this._onMouseWheel(mouseWheelEvent),\n\t\t\tonDragStart: () => this._onDragStart(),\n\t\t\tonDragEnd: () => this._onDragEnd(),\n\t\t};\n\t\tthis._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost));\n\t\tthis._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));\n\n\t\tthis._domNode = document.createElement('div');\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t\tthis._domNode.setAttribute('role', 'presentation');\n\t\tthis._domNode.style.position = 'relative';\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// this._domNode.style.overflow = 'hidden';\n\t\tthis._domNode.appendChild(element);\n\t\tthis._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);\n\t\tthis._domNode.appendChild(this._verticalScrollbar.domNode.domNode);\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._leftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._leftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._leftShadowDomNode.domNode);\n\n\t\t\tthis._topShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topShadowDomNode.domNode);\n\n\t\t\tthis._topLeftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topLeftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topLeftShadowDomNode.domNode);\n\t\t} else {\n\t\t\tthis._leftShadowDomNode = null;\n\t\t\tthis._topShadowDomNode = null;\n\t\t\tthis._topLeftShadowDomNode = null;\n\t\t}\n\n\t\tthis._listenOnDomNode = this._options.listenOnDomNode || this._domNode;\n\n\t\tthis._mouseWheelToDispose = [];\n\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\n\t\tthis.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e));\n\t\tthis.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));\n\n\t\tthis._hideTimeout = this._register(new TimeoutTimer());\n\t\tthis._isDragging = false;\n\t\tthis._mouseIsOver = false;\n\n\t\tthis._shouldRender = true;\n\n\t\tthis._revealOnScroll = true;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Get the generated 'scrollable' dom node\n\t */\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._domNode;\n\t}\n\n\tpublic getOverviewRulerLayoutInfo(): IOverviewRulerLayoutInfo {\n\t\treturn {\n\t\t\tparent: this._domNode,\n\t\t\tinsertBefore: this._verticalScrollbar.domNode.domNode,\n\t\t};\n\t}\n\n\t/**\n\t * Delegate a pointer down event to the vertical scrollbar.\n\t * This is to help with clicking somewhere else and having the scrollbar react.\n\t */\n\tpublic delegateVerticalScrollbarPointerDown(browserEvent: PointerEvent): void {\n\t\tthis._verticalScrollbar.delegatePointerDown(browserEvent);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._scrollable.getScrollDimensions();\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions): void {\n\t\tthis._scrollable.setScrollDimensions(dimensions, false);\n\t}\n\n\t/**\n\t * Update the class name of the scrollable element.\n\t */\n\tpublic updateClassName(newClassName: string): void {\n\t\tthis._options.className = newClassName;\n\t\t// Defaults are different on Macs\n\t\tif (platform.isMacintosh) {\n\t\t\tthis._options.className += ' mac';\n\t\t}\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t}\n\n\t/**\n\t * Update configuration options for the scrollbar.\n\t */\n\tpublic updateOptions(newOptions: ScrollableElementChangeOptions): void {\n\t\tif (typeof newOptions.handleMouseWheel !== 'undefined') {\n\t\t\tthis._options.handleMouseWheel = newOptions.handleMouseWheel;\n\t\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\t\t}\n\t\tif (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.fastScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.scrollPredominantAxis !== 'undefined') {\n\t\t\tthis._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;\n\t\t}\n\t\tif (typeof newOptions.horizontal !== 'undefined') {\n\t\t\tthis._options.horizontal = newOptions.horizontal;\n\t\t}\n\t\tif (typeof newOptions.vertical !== 'undefined') {\n\t\t\tthis._options.vertical = newOptions.vertical;\n\t\t}\n\t\tif (typeof newOptions.horizontalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.verticalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.scrollByPage !== 'undefined') {\n\t\t\tthis._options.scrollByPage = newOptions.scrollByPage;\n\t\t}\n\t\tthis._horizontalScrollbar.updateOptions(this._options);\n\t\tthis._verticalScrollbar.updateOptions(this._options);\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\tpublic setRevealOnScroll(value: boolean) {\n\t\tthis._revealOnScroll = value;\n\t}\n\n\tpublic delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {\n\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t}\n\n\t// -------------------- mouse wheel scrolling --------------------\n\n\tprivate _setListeningToMouseWheel(shouldListen: boolean): void {\n\t\tconst isListening = (this._mouseWheelToDispose.length > 0);\n\n\t\tif (isListening === shouldListen) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\n\t\t// Stop listening (if necessary)\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\n\t\t// Start listening (if necessary)\n\t\tif (shouldListen) {\n\t\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t\t\t};\n\n\t\t\tthis._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));\n\t\t}\n\t}\n\n\tprivate _onMouseWheel(e: StandardWheelEvent): void {\n\t\tif (e.browserEvent?.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\t\tif (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\t\t}\n\n\t\t// useful for creating unit tests:\n\t\t// console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);\n\n\t\tlet didScroll = false;\n\n\t\tif (e.deltaY || e.deltaX) {\n\t\t\tlet deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;\n\t\t\tlet deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;\n\n\t\t\tif (this._options.scrollPredominantAxis) {\n\t\t\t\tif (this._options.scrollYToX && deltaX + deltaY === 0) {\n\t\t\t\t\t// when configured to map Y to X and we both see\n\t\t\t\t\t// no dominant axis and X and Y are competing with\n\t\t\t\t\t// identical values into opposite directions, we\n\t\t\t\t\t// ignore the delta as we cannot make a decision then\n\t\t\t\t\tdeltaX = deltaY = 0;\n\t\t\t\t} else if (Math.abs(deltaY) >= Math.abs(deltaX)) {\n\t\t\t\t\tdeltaX = 0;\n\t\t\t\t} else {\n\t\t\t\t\tdeltaY = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._options.flipAxes) {\n\t\t\t\t[deltaY, deltaX] = [deltaX, deltaY];\n\t\t\t}\n\n\t\t\t// Convert vertical scrolling to horizontal if shift is held, this\n\t\t\t// is handled at a higher level on Mac\n\t\t\tconst shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;\n\t\t\tif ((this._options.scrollYToX || shiftConvert) && !deltaX) {\n\t\t\t\tdeltaX = deltaY;\n\t\t\t\tdeltaY = 0;\n\t\t\t}\n\n\t\t\tif (e.browserEvent && e.browserEvent.altKey) {\n\t\t\t\t// fastScrolling\n\t\t\t\tdeltaX = deltaX * this._options.fastScrollSensitivity;\n\t\t\t\tdeltaY = deltaY * this._options.fastScrollSensitivity;\n\t\t\t}\n\n\t\t\tconst futureScrollPosition = this._scrollable.getFutureScrollPosition();\n\n\t\t\tlet desiredScrollPosition: INewScrollPosition = {};\n\t\t\tif (deltaY) {\n\t\t\t\tconst deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));\n\t\t\t\tthis._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);\n\t\t\t}\n\t\t\tif (deltaX) {\n\t\t\t\tconst deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));\n\t\t\t\tthis._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);\n\t\t\t}\n\n\t\t\t// Check that we are scrolling towards a location which is valid\n\t\t\tdesiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);\n\n\t\t\tif (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {\n\n\t\t\t\tconst canPerformSmoothScroll = (\n\t\t\t\t\tSCROLL_WHEEL_SMOOTH_SCROLL_ENABLED\n\t\t\t\t\t&& this._options.mouseWheelSmoothScroll\n\t\t\t\t\t&& classifier.isPhysicalMouseWheel()\n\t\t\t\t);\n\n\t\t\t\tif (canPerformSmoothScroll) {\n\t\t\t\t\tthis._scrollable.setScrollPositionSmooth(desiredScrollPosition);\n\t\t\t\t} else {\n\t\t\t\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t\t\t\t}\n\n\t\t\t\tdidScroll = true;\n\t\t\t}\n\t\t}\n\n\t\tlet consumeMouseWheel = didScroll;\n\t\tif (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\t\tif (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\n\t\tif (consumeMouseWheel) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tprivate _onDidScroll(e: ScrollEvent): void {\n\t\tthis._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;\n\t\tthis._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._shouldRender = true;\n\t\t}\n\n\t\tif (this._revealOnScroll) {\n\t\t\tthis._reveal();\n\t\t}\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\t/**\n\t * Render / mutate the DOM now.\n\t * Should be used together with the ctor option `lazyRender`.\n\t */\n\tpublic renderNow(): void {\n\t\tif (!this._options.lazyRender) {\n\t\t\tthrow new Error('Please use `lazyRender` together with `renderNow`!');\n\t\t}\n\n\t\tthis._render();\n\t}\n\n\tprivate _render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._shouldRender = false;\n\n\t\tthis._horizontalScrollbar.render();\n\t\tthis._verticalScrollbar.render();\n\n\t\tif (this._options.useShadows) {\n\t\t\tconst scrollState = this._scrollable.getCurrentScrollPosition();\n\t\t\tconst enableTop = scrollState.scrollTop > 0;\n\t\t\tconst enableLeft = scrollState.scrollLeft > 0;\n\n\t\t\tconst leftClassName = (enableLeft ? ' left' : '');\n\t\t\tconst topClassName = (enableTop ? ' top' : '');\n\t\t\tconst topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : '');\n\t\t\tthis._leftShadowDomNode!.setClassName(`shadow${leftClassName}`);\n\t\t\tthis._topShadowDomNode!.setClassName(`shadow${topClassName}`);\n\t\t\tthis._topLeftShadowDomNode!.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);\n\t\t}\n\t}\n\n\t// -------------------- fade in / fade out --------------------\n\n\tprivate _onDragStart(): void {\n\t\tthis._isDragging = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _onDragEnd(): void {\n\t\tthis._isDragging = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseLeave(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseOver(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _reveal(): void {\n\t\tthis._verticalScrollbar.beginReveal();\n\t\tthis._horizontalScrollbar.beginReveal();\n\t\tthis._scheduleHide();\n\t}\n\n\tprivate _hide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._verticalScrollbar.beginHide();\n\t\t\tthis._horizontalScrollbar.beginHide();\n\t\t}\n\t}\n\n\tprivate _scheduleHide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);\n\t\t}\n\t}\n}\n\nexport class ScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: true,\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n}\n\nexport class SmoothScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper(element, options, scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition & { reuseAnimation?: boolean }): void {\n\t\tif (update.reuseAnimation) {\n\t\t\tthis._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);\n\t\t} else {\n\t\t\tthis._scrollable.setScrollPositionNow(update);\n\t\t}\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n}\n\nexport class DomScrollableElement extends AbstractScrollableElement {\n\n\tprivate _element: HTMLElement;\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t\tthis._element = element;\n\t\tthis._register(this.onScroll((e) => {\n\t\t\tif (e.scrollTopChanged) {\n\t\t\t\tthis._element.scrollTop = e.scrollTop;\n\t\t\t}\n\t\t\tif (e.scrollLeftChanged) {\n\t\t\t\tthis._element.scrollLeft = e.scrollLeft;\n\t\t\t}\n\t\t}));\n\t\tthis.scanDomNode();\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n\tpublic scanDomNode(): void {\n\t\t// width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight\n\t\tthis.setScrollDimensions({\n\t\t\twidth: this._element.clientWidth,\n\t\t\tscrollWidth: this._element.scrollWidth,\n\t\t\theight: this._element.clientHeight,\n\t\t\tscrollHeight: this._element.scrollHeight\n\t\t});\n\t\tthis.setScrollPosition({\n\t\t\tscrollLeft: this._element.scrollLeft,\n\t\t\tscrollTop: this._element.scrollTop,\n\t\t});\n\t}\n}\n\nfunction resolveOptions(opts: ScrollableElementCreationOptions): ScrollableElementResolvedOptions {\n\tconst result: ScrollableElementResolvedOptions = {\n\t\tlazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false),\n\t\tclassName: (typeof opts.className !== 'undefined' ? opts.className : ''),\n\t\tuseShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true),\n\t\thandleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true),\n\t\tflipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false),\n\t\tconsumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false),\n\t\talwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false),\n\t\tscrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false),\n\t\tmouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1),\n\t\tfastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5),\n\t\tscrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true),\n\t\tmouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true),\n\t\tarrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11),\n\n\t\tlistenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null),\n\n\t\thorizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : ScrollbarVisibility.Auto),\n\t\thorizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10),\n\t\thorizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0),\n\t\thorizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false),\n\n\t\tvertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : ScrollbarVisibility.Auto),\n\t\tverticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),\n\t\tverticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),\n\t\tverticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0),\n\n\t\tscrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false)\n\t};\n\n\tresult.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);\n\tresult.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);\n\n\t// Defaults are different on Macs\n\tif (platform.isMacintosh) {\n\t\tresult.className += ' mac';\n\t}\n\n\treturn result;\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal event utilities for xterm.js core.\n * Simplified from VS Code's event.ts - no leak detection/profiling.\n */\n\nimport { IDisposable, DisposableStore, toDisposable } from 'common/Lifecycle';\n\nexport interface IEvent {\n (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport class Emitter {\n private _listeners: { fn: (e: T) => any, thisArgs: any }[] = [];\n private _disposed = false;\n private _event: IEvent | undefined;\n\n public get event(): IEvent {\n if (this._event) {\n return this._event;\n }\n this._event = (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n if (this._disposed) {\n return toDisposable(() => {});\n }\n\n const entry = { fn: listener, thisArgs };\n this._listeners.push(entry);\n\n const result = toDisposable(() => {\n const idx = this._listeners.indexOf(entry);\n if (idx !== -1) {\n this._listeners.splice(idx, 1);\n }\n });\n\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(result);\n } else {\n disposables.add(result);\n }\n }\n\n return result;\n };\n return this._event;\n }\n\n public fire(event: T): void {\n if (this._disposed) {\n return;\n }\n switch (this._listeners.length) {\n case 0: return;\n case 1: {\n const { fn, thisArgs } = this._listeners[0];\n fn.call(thisArgs, event);\n return;\n }\n default: {\n // Snapshot listeners to allow modifications during iteration (2+ listeners)\n const listeners = this._listeners.slice();\n for (const { fn, thisArgs } of listeners) {\n fn.call(thisArgs, event);\n }\n }\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n this._listeners.length = 0;\n }\n}\n\nexport namespace EventUtils {\n export function forward(from: IEvent, to: Emitter): IDisposable {\n return from(e => to.fire(e));\n }\n\n export function map(event: IEvent, map: (i: I) => O): IEvent {\n return (listener: (e: O) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n return event(i => listener.call(thisArgs, map(i)), undefined, disposables);\n };\n }\n\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent {\n return (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n const store = new DisposableStore();\n for (const event of events) {\n store.add(event(e => listener.call(thisArgs, e)));\n }\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(store);\n } else {\n disposables.add(store);\n }\n }\n return store;\n };\n }\n\n export function runAndSubscribe(event: IEvent, handler: (e: T | undefined) => void): IDisposable {\n handler(undefined);\n return event(e => handler(e));\n }\n}\n", "/**\n * Copyright (c) 2024 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { ViewportConstants } from 'browser/shared/Constants';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { CoreMouseEventType } from 'common/Types';\nimport { addDisposableListener, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';\nimport { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';\nimport type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { Emitter, EventUtils } from 'common/Event';\nimport { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';\nimport { Gesture, EventType as GestureEventType, type GestureEvent } from 'vs/base/browser/touch';\n\nexport class Viewport extends Disposable {\n\n protected _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n private _scrollableElement: SmoothScrollableElement;\n private _styleElement: HTMLStyleElement;\n\n private _queuedAnimationFrame?: number;\n private _latestYDisp?: number;\n private _isSyncing: boolean = false;\n private _isHandlingScroll: boolean = false;\n private _suppressOnScrollHandler: boolean = false;\n\n constructor(\n element: HTMLElement,\n screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @ICoreMouseService coreMouseService: ICoreMouseService,\n @IThemeService themeService: IThemeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n const scrollable = this._register(new Scrollable({\n forceIntegerValues: false,\n smoothScrollDuration: this._optionsService.rawOptions.smoothScrollDuration,\n // This is used over `IRenderService.addRefreshCallback` since it can be canceled\n scheduleAtNextAnimationFrame: cb => scheduleAtNextAnimationFrame(coreBrowserService.window, cb)\n }));\n this._register(this._optionsService.onSpecificOptionChange('smoothScrollDuration', () => {\n scrollable.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration);\n }));\n\n this._scrollableElement = this._register(new SmoothScrollableElement(screenElement, {\n vertical: ScrollbarVisibility.Auto,\n horizontal: ScrollbarVisibility.Hidden,\n useShadows: false,\n mouseWheelSmoothScroll: true,\n ...this._getChangeOptions()\n }, scrollable));\n this._register(this._optionsService.onMultipleOptionChange([\n 'scrollSensitivity',\n 'fastScrollSensitivity',\n 'overviewRuler'\n ], () => this._scrollableElement.updateOptions(this._getChangeOptions())));\n // Don't handle mouse wheel if wheel events are supported by the current mouse prototcol\n this._register(coreMouseService.onProtocolChange(type => {\n this._scrollableElement.updateOptions({\n handleMouseWheel: !(type & CoreMouseEventType.WHEEL)\n });\n }));\n\n this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });\n this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {\n element.style.backgroundColor = themeService.colors.background.css;\n this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;\n }));\n element.appendChild(this._scrollableElement.getDomNode());\n this._register(toDisposable(() => this._scrollableElement.getDomNode().remove()));\n\n this._styleElement = coreBrowserService.mainDocument.createElement('style');\n screenElement.appendChild(this._styleElement);\n this._register(toDisposable(() => this._styleElement.remove()));\n this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {\n this._styleElement.textContent = [\n `.xterm .xterm-scrollable-element > .scrollbar > .slider {`,\n ` background: ${themeService.colors.scrollbarSliderBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,\n ` background: ${themeService.colors.scrollbarSliderHoverBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,\n ` background: ${themeService.colors.scrollbarSliderActiveBackground.css};`,\n `}`\n ].join('\\n');\n }));\n\n this._register(this._bufferService.onResize(() => this.queueSync()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n // Reset _latestYDisp when switching buffers to prevent stale scroll position\n // from alt buffer contaminating normal buffer scroll position\n this._latestYDisp = undefined;\n this.queueSync();\n }));\n this._register(this._bufferService.onScroll(() => this._sync()));\n\n this._register(this._scrollableElement.onScroll(e => this._handleScroll(e)));\n\n // Touch/gesture scrolling support\n this._register(Gesture.addTarget(screenElement));\n this._register(addDisposableListener(screenElement, GestureEventType.Change, (e: GestureEvent) => this._handleGestureChange(e)));\n }\n\n public scrollLines(disp: number): void {\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n reuseAnimation: true,\n scrollTop: pos.scrollTop + disp * this._renderService.dimensions.css.cell.height\n });\n }\n\n public scrollToLine(line: number, disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll) {\n this._latestYDisp = line;\n }\n this._scrollableElement.setScrollPosition({\n reuseAnimation: !disableSmoothScroll,\n scrollTop: line * this._renderService.dimensions.css.cell.height\n });\n }\n\n private _getChangeOptions(): ScrollableElementChangeOptions {\n return {\n mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,\n fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,\n verticalScrollbarSize: this._optionsService.rawOptions.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH\n };\n }\n\n public queueSync(ydisp?: number): void {\n // Update state\n if (ydisp !== undefined) {\n this._latestYDisp = ydisp;\n }\n\n // Don't queue more than one callback\n if (this._queuedAnimationFrame !== undefined) {\n return;\n }\n this._queuedAnimationFrame = this._renderService.addRefreshCallback(() => {\n this._queuedAnimationFrame = undefined;\n this._sync(this._latestYDisp);\n });\n }\n\n private _sync(ydisp: number = this._bufferService.buffer.ydisp): void {\n if (!this._renderService || this._isSyncing) {\n return;\n }\n this._isSyncing = true;\n\n // Ignore any onScroll event that happens as a result of dimensions changing as this should\n // never cause a scrollLines call, only setScrollPosition can do that.\n this._suppressOnScrollHandler = true;\n this._scrollableElement.setScrollDimensions({\n height: this._renderService.dimensions.css.canvas.height,\n scrollHeight: this._renderService.dimensions.css.cell.height * this._bufferService.buffer.lines.length\n });\n this._suppressOnScrollHandler = false;\n\n // If ydisp has been changed by some other component (input/buffer), then stop animating smooth\n // scroll and scroll there immediately.\n if (ydisp !== this._latestYDisp) {\n this._scrollableElement.setScrollPosition({\n scrollTop: ydisp * this._renderService.dimensions.css.cell.height\n });\n }\n\n this._isSyncing = false;\n }\n\n private _handleScroll(e: ScrollEvent): void {\n if (!this._renderService) {\n return;\n }\n if (this._isHandlingScroll || this._suppressOnScrollHandler) {\n return;\n }\n this._isHandlingScroll = true;\n const newRow = Math.round(e.scrollTop / this._renderService.dimensions.css.cell.height);\n const diff = newRow - this._bufferService.buffer.ydisp;\n if (diff !== 0) {\n this._latestYDisp = newRow;\n this._onRequestScrollLines.fire(diff);\n }\n this._isHandlingScroll = false;\n }\n\n private _handleGestureChange(e: GestureEvent): void {\n e.preventDefault();\n e.stopPropagation();\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n scrollTop: pos.scrollTop - e.translationY\n });\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';\n\nexport class BufferDecorationRenderer extends Disposable {\n private readonly _container: HTMLElement;\n private readonly _decorationElements: Map = new Map();\n\n private _animationFrame: number | undefined;\n private _altBufferIsActive: boolean = false;\n private _dimensionsChanged: boolean = false;\n\n constructor(\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n this._container = document.createElement('div');\n this._container.classList.add('xterm-decoration-container');\n this._screenElement.appendChild(this._container);\n\n this._register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations()));\n this._register(this._renderService.onDimensionsChange(() => {\n this._dimensionsChanged = true;\n this._queueRefresh();\n }));\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;\n }));\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));\n this._register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));\n this._register(toDisposable(() => {\n this._container.remove();\n this._decorationElements.clear();\n }));\n }\n\n private _queueRefresh(): void {\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._renderService.addRefreshCallback(() => {\n this._doRefreshDecorations();\n this._animationFrame = undefined;\n });\n }\n\n private _doRefreshDecorations(): void {\n for (const decoration of this._decorationService.decorations) {\n this._renderDecoration(decoration);\n }\n this._dimensionsChanged = false;\n }\n\n private _renderDecoration(decoration: IInternalDecoration): void {\n this._refreshStyle(decoration);\n if (this._dimensionsChanged) {\n this._refreshXPosition(decoration);\n }\n }\n\n private _createElement(decoration: IInternalDecoration): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.classList.add('xterm-decoration');\n element.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top');\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${(decoration.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n\n const x = decoration.options.x ?? 0;\n if (x && x > this._bufferService.cols) {\n // exceeded the container width, so hide\n element.style.display = 'none';\n }\n this._refreshXPosition(decoration, element);\n\n return element;\n }\n\n private _refreshStyle(decoration: IInternalDecoration): void {\n const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;\n if (line < 0 || line >= this._bufferService.rows) {\n // outside of viewport\n if (decoration.element) {\n decoration.element.style.display = 'none';\n decoration.onRenderEmitter.fire(decoration.element);\n }\n } else {\n let element = this._decorationElements.get(decoration);\n if (!element) {\n element = this._createElement(decoration);\n decoration.element = element;\n this._decorationElements.set(decoration, element);\n this._container.appendChild(element);\n decoration.onDispose(() => {\n this._decorationElements.delete(decoration);\n element!.remove();\n });\n }\n element.style.display = this._altBufferIsActive ? 'none' : 'block';\n if (!this._altBufferIsActive) {\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${line * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n }\n decoration.onRenderEmitter.fire(element);\n }\n }\n\n private _refreshXPosition(decoration: IInternalDecoration, element: HTMLElement | undefined = decoration.element): void {\n if (!element) {\n return;\n }\n const x = decoration.options.x ?? 0;\n if ((decoration.options.anchor || 'left') === 'right') {\n element.style.right = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n } else {\n element.style.left = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n }\n }\n\n private _removeDecoration(decoration: IInternalDecoration): void {\n this._decorationElements.get(decoration)?.remove();\n this._decorationElements.delete(decoration);\n decoration.dispose();\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInternalDecoration } from 'common/services/Services';\n\nexport interface IColorZoneStore {\n readonly zones: IColorZone[];\n clear(): void;\n addDecoration(decoration: IInternalDecoration): void;\n /**\n * Sets the amount of padding in lines that will be added between zones, if new lines intersect\n * the padding they will be merged into the same zone.\n */\n setPadding(padding: { [position: string]: number }): void;\n}\n\nexport interface IColorZone {\n /** Color in a format supported by canvas' fillStyle. */\n color: string;\n position: 'full' | 'left' | 'center' | 'right' | undefined;\n startBufferLine: number;\n endBufferLine: number;\n}\n\ninterface IMinimalDecorationForColorZone {\n marker: Pick;\n options: Pick;\n}\n\nexport class ColorZoneStore implements IColorZoneStore {\n private _zones: IColorZone[] = [];\n\n // The zone pool is used to keep zone objects from being freed between clearing the color zone\n // store and fetching the zones. This helps reduce GC pressure since the color zones are\n // accumulated on potentially every scroll event.\n private _zonePool: IColorZone[] = [];\n private _zonePoolIndex = 0;\n\n private _linePadding: { [position: string]: number } = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n };\n\n public get zones(): IColorZone[] {\n // Trim the zone pool to free unused memory\n this._zonePool.length = Math.min(this._zonePool.length, this._zones.length);\n return this._zones;\n }\n\n public clear(): void {\n this._zones.length = 0;\n this._zonePoolIndex = 0;\n }\n\n public addDecoration(decoration: IMinimalDecorationForColorZone): void {\n if (!decoration.options.overviewRulerOptions) {\n return;\n }\n for (const z of this._zones) {\n if (z.color === decoration.options.overviewRulerOptions.color &&\n z.position === decoration.options.overviewRulerOptions.position) {\n if (this._lineIntersectsZone(z, decoration.marker.line)) {\n return;\n }\n if (this._lineAdjacentToZone(z, decoration.marker.line, decoration.options.overviewRulerOptions.position)) {\n this._addLineToZone(z, decoration.marker.line);\n return;\n }\n }\n }\n // Create using zone pool if possible\n if (this._zonePoolIndex < this._zonePool.length) {\n this._zonePool[this._zonePoolIndex].color = decoration.options.overviewRulerOptions.color;\n this._zonePool[this._zonePoolIndex].position = decoration.options.overviewRulerOptions.position;\n this._zonePool[this._zonePoolIndex].startBufferLine = decoration.marker.line;\n this._zonePool[this._zonePoolIndex].endBufferLine = decoration.marker.line;\n this._zones.push(this._zonePool[this._zonePoolIndex++]);\n return;\n }\n // Create\n this._zones.push({\n color: decoration.options.overviewRulerOptions.color,\n position: decoration.options.overviewRulerOptions.position,\n startBufferLine: decoration.marker.line,\n endBufferLine: decoration.marker.line\n });\n this._zonePool.push(this._zones[this._zones.length - 1]);\n this._zonePoolIndex++;\n }\n\n public setPadding(padding: { [position: string]: number }): void {\n this._linePadding = padding;\n }\n\n private _lineIntersectsZone(zone: IColorZone, line: number): boolean {\n return (\n line >= zone.startBufferLine &&\n line <= zone.endBufferLine\n );\n }\n\n private _lineAdjacentToZone(zone: IColorZone, line: number, position: IColorZone['position']): boolean {\n return (\n (line >= zone.startBufferLine - this._linePadding[position || 'full']) &&\n (line <= zone.endBufferLine + this._linePadding[position || 'full'])\n );\n }\n\n private _addLineToZone(zone: IColorZone, line: number): void {\n zone.startBufferLine = Math.min(zone.startBufferLine, line);\n zone.endBufferLine = Math.max(zone.endBufferLine, line);\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\n\nconst enum Constants {\n OVERVIEW_RULER_BORDER_WIDTH = 1\n}\n\n// Helper objects to avoid excessive calculation and garbage collection during rendering. These are\n// static values for each render and can be accessed using the decoration position as the key.\nconst drawHeight = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawWidth = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawX = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\n\nexport class OverviewRulerRenderer extends Disposable {\n private readonly _canvas: HTMLCanvasElement;\n private readonly _ctx: CanvasRenderingContext2D;\n private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();\n private get _width(): number {\n return this._optionsService.options.overviewRuler?.width || 0;\n }\n private _animationFrame: number | undefined;\n\n private _shouldUpdateDimensions: boolean | undefined = true;\n private _shouldUpdateAnchor: boolean | undefined = true;\n private _lastKnownBufferLength: number = 0;\n\n private _containerHeight: number | undefined;\n\n constructor(\n private readonly _viewportElement: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IThemeService private readonly _themeService: IThemeService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n this._canvas = this._coreBrowserService.mainDocument.createElement('canvas');\n this._canvas.classList.add('xterm-decoration-overview-ruler');\n this._refreshCanvasDimensions();\n this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);\n this._register(toDisposable(() => this._canvas?.remove()));\n\n const ctx = this._canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Ctx cannot be null');\n } else {\n this._ctx = ctx;\n }\n\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));\n this._register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));\n\n this._register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';\n }));\n this._register(this._bufferService.onScroll(() => {\n if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {\n this._refreshDrawHeightConstants();\n this._refreshColorZonePadding();\n }\n }));\n\n // Container height changed\n this._register(this._renderService.onRender((): void => {\n if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {\n this._queueRefresh(true);\n this._containerHeight = this._screenElement.clientHeight;\n }\n }));\n\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));\n this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));\n this._register(this._themeService.onChangeColors(() => this._queueRefresh()));\n this._queueRefresh(true);\n }\n\n private _refreshDrawConstants(): void {\n // width\n const outerWidth = Math.floor((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n const innerWidth = Math.ceil((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n drawWidth.full = this._canvas.width;\n drawWidth.left = outerWidth;\n drawWidth.center = innerWidth;\n drawWidth.right = outerWidth;\n // height\n this._refreshDrawHeightConstants();\n // x\n drawX.full = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.left = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.center = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left;\n drawX.right = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left + drawWidth.center;\n }\n\n private _refreshDrawHeightConstants(): void {\n drawHeight.full = Math.round(2 * this._coreBrowserService.dpr);\n // Calculate actual pixels per line\n const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;\n // Clamp actual pixels within a range\n const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowserService.dpr);\n drawHeight.left = nonFullHeight;\n drawHeight.center = nonFullHeight;\n drawHeight.right = nonFullHeight;\n }\n\n private _refreshColorZonePadding(): void {\n this._colorZoneStore.setPadding({\n full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),\n left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.left),\n center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.center),\n right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.right)\n });\n this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;\n }\n\n private _refreshCanvasDimensions(): void {\n this._canvas.style.width = `${this._width}px`;\n this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);\n this._canvas.style.height = `${this._screenElement.clientHeight}px`;\n this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);\n this._refreshDrawConstants();\n this._refreshColorZonePadding();\n }\n\n private _refreshDecorations(): void {\n if (this._shouldUpdateDimensions) {\n this._refreshCanvasDimensions();\n }\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._colorZoneStore.clear();\n for (const decoration of this._decorationService.decorations) {\n this._colorZoneStore.addDecoration(decoration);\n }\n this._ctx.lineWidth = 1;\n this._renderRulerOutline();\n const zones = this._colorZoneStore.zones;\n for (const zone of zones) {\n if (zone.position !== 'full') {\n this._renderColorZone(zone);\n }\n }\n for (const zone of zones) {\n if (zone.position === 'full') {\n this._renderColorZone(zone);\n }\n }\n this._shouldUpdateDimensions = false;\n this._shouldUpdateAnchor = false;\n }\n\n private _renderRulerOutline(): void {\n this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;\n this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);\n }\n if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n }\n }\n\n private _renderColorZone(zone: IColorZone): void {\n this._ctx.fillStyle = zone.color;\n this._ctx.fillRect(\n /* x */ drawX[zone.position || 'full'],\n /* y */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n (zone.startBufferLine / this._bufferService.buffers.active.lines.length) - drawHeight[zone.position || 'full'] / 2\n ),\n /* w */ drawWidth[zone.position || 'full'],\n /* h */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n ((zone.endBufferLine - zone.startBufferLine) / this._bufferService.buffers.active.lines.length) + drawHeight[zone.position || 'full']\n )\n );\n }\n\n private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {\n this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;\n this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {\n this._refreshDecorations();\n this._animationFrame = undefined;\n });\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { C0 } from 'common/data/EscapeSequences';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n /**\n * The pending textarea change timer, if any.\n */\n private _textareaChangeTimer?: number;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService private readonly _coreService: ICoreService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: Pick): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @returns Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 20 || ev.keyCode === 229) {\n // 20 is CapsLock, 229 is Enter\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the start position of the new composition to get the string\n // if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, this._compositionPosition.start);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n if (this._textareaChangeTimer) {\n return;\n }\n const oldValue = this._textarea.value;\n this._textareaChangeTimer = window.setTimeout(() => {\n this._textareaChangeTimer = undefined;\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n\n const diff = newValue.replace(oldValue, '');\n\n this._dataAlreadySent = diff;\n\n if (newValue.length > oldValue.length) {\n this._coreService.triggerDataEvent(diff, true);\n } else if (newValue.length < oldValue.length) {\n this._coreService.triggerDataEvent(`${C0.DEL}`, true);\n } else if ((newValue.length === oldValue.length) && (newValue !== oldValue)) {\n this._coreService.triggerDataEvent(newValue, true);\n }\n\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n // Ensure the text area is at least 1x1, otherwise certain IMEs may break\n this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px';\n this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor, IColorRGB } from 'common/Types';\n\nlet $r = 0;\nlet $g = 0;\nlet $b = 0;\nlet $a = 0;\n\nexport const NULL_COLOR: IColor = {\n css: '#00000000',\n rgba: 0\n};\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32\n // on LE systems, before it can be used for direct 32-bit buffer writes.\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n\n export function toColor(r: number, g: number, b: number, a?: number): IColor {\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n $a = (fg.rgba & 0xFF) / 255;\n if ($a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n const css = channels.toCss($r, $g, $b);\n const rgba = channels.toRgba($r, $g, $b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return channels.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n [$r, $g, $b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss($r, $g, $b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n $a = Math.round(opacity * 0xFF);\n [$r, $g, $b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss($r, $g, $b, $a),\n rgba: channels.toRgba($r, $g, $b, $a)\n };\n }\n\n export function multiplyOpacity(color: IColor, factor: number): IColor {\n $a = color.rgba & 0xFF;\n return opacity(color, ($a * factor) / 0xFF);\n }\n\n export function toColorRGB(color: IColor): IColorRGB {\n return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF];\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb',\n * '#rrggbbaa').\n */\nexport namespace css {\n // Attempt to set get the shared canvas context\n let $ctx: CanvasRenderingContext2D | undefined;\n let $litmusColor: CanvasGradient | undefined;\n try {\n // This is guaranteed to run in the first window, so document should be correct\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d', {\n willReadFrequently: true\n });\n if (ctx) {\n $ctx = ctx;\n $ctx.globalCompositeOperation = 'copy';\n $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);\n }\n }\n catch {\n // noop\n }\n\n /**\n * Converts a css string to an IColor, this should handle all valid CSS color strings and will\n * throw if it's invalid. The ideal format to use is `#rrggbb[aa]` as it's the fastest to parse.\n *\n * Only `#rgb[a]`, `#rrggbb[aa]`, `rgb()` and `rgba()` formats are supported when run in a Node\n * environment.\n */\n export function toColor(css: string): IColor {\n // Formats: #rgb[a] and #rrggbb[aa]\n if (css.match(/#[\\da-f]{3,8}/i)) {\n switch (css.length) {\n case 4: { // #rgb\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n return channels.toColor($r, $g, $b);\n }\n case 5: { // #rgba\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n $a = parseInt(css.slice(4, 5).repeat(2), 16);\n return channels.toColor($r, $g, $b, $a);\n }\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n }\n\n // Formats: rgb() or rgba()\n const rgbaMatch = css.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);\n if (rgbaMatch) {\n $r = parseInt(rgbaMatch[1]);\n $g = parseInt(rgbaMatch[2]);\n $b = parseInt(rgbaMatch[3]);\n $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);\n return channels.toColor($r, $g, $b, $a);\n }\n\n // Handle the \"transparent\" keyword\n if (css === 'transparent') {\n return {\n css: 'transparent',\n rgba: 0x00000000\n };\n }\n\n // Validate the context is available for canvas-based color parsing\n if (!$ctx || !$litmusColor) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Validate the color using canvas fillStyle\n // See https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n $ctx.fillStyle = $litmusColor;\n $ctx.fillStyle = css;\n if (typeof $ctx.fillStyle !== 'string') {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n $ctx.fillRect(0, 0, 1, 1);\n [$r, $g, $b, $a] = $ctx.getImageData(0, 0, 1, 1).data;\n\n // Validate the color is non-transparent as color hue gets lost when drawn to the canvas\n if ($a !== 0xFF) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Extract the color from the canvas' fillStyle property which exposes the color value in rgba()\n // format\n // See https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n return {\n rgba: channels.toRgba($r, $g, $b, $a),\n css\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n export function blend(bg: number, fg: number): number {\n $a = (fg & 0xFF) / 0xFF;\n if ($a === 1) {\n return fg;\n }\n const fgR = (fg >> 24) & 0xFF;\n const fgG = (fg >> 16) & 0xFF;\n const fgB = (fg >> 8) & 0xFF;\n const bgR = (bg >> 24) & 0xFF;\n const bgG = (bg >> 16) & 0xFF;\n const bgB = (bg >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n return channels.toRgba($r, $g, $b);\n }\n\n /**\n * Given a foreground color and a background color, either increase or reduce the luminance of the\n * foreground color until the specified contrast ratio is met. If pure white or black is hit\n * without the contrast ratio being met, go the other direction using the background color as the\n * foreground color and take either the first or second result depending on which has the higher\n * contrast ratio.\n *\n * `undefined` will be returned if the contrast ratio is already met.\n *\n * @param bgRgba The background color in rgba format.\n * @param fgRgba The foreground color in rgba format.\n * @param ratio The contrast ratio to achieve.\n */\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n const resultA = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n const resultA = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoiner } from 'browser/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerService implements ICharacterJoinerService {\n public serviceBrand: undefined;\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(\n @IBufferService private _bufferService: IBufferService\n ) { }\n\n public register(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregister(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n let allJoinedRanges: [number, number][] = [];\n try {\n allJoinedRanges = this._characterJoiners[0].handler(text);\n } catch (error) {\n console.error(error);\n }\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n try {\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerService._mergeRanges(allJoinedRanges, joinerRanges[j]);\n }\n } catch (error) {\n console.error(error);\n }\n }\n this._stringRangesToCellRanges(allJoinedRanges, lineData, startCol);\n return allJoinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDimensions, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n\nexport function isPowerlineGlyph(codepoint: number): boolean {\n // Only return true for Powerline symbols which require\n // different padding and should be excluded from minimum contrast\n // ratio standards\n return 0xE0A4 <= codepoint && codepoint <= 0xE0D6;\n}\n\nexport function isRestrictedPowerlineGlyph(codepoint: number): boolean {\n return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;\n}\n\nfunction isNerdFontGlyph(codepoint: number): boolean {\n return 0xE000 <= codepoint && codepoint <= 0xF8FF;\n}\n\nfunction isBoxOrBlockGlyph(codepoint: number): boolean {\n return 0x2500 <= codepoint && codepoint <= 0x259F;\n}\n\nexport function isEmoji(codepoint: number): boolean {\n return (\n codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons\n codepoint >= 0x1F300 && codepoint <= 0x1F5FF || // Misc Symbols and Pictographs\n codepoint >= 0x1F680 && codepoint <= 0x1F6FF || // Transport and Map\n codepoint >= 0x2600 && codepoint <= 0x26FF || // Misc symbols\n codepoint >= 0x2700 && codepoint <= 0x27BF || // Dingbats\n codepoint >= 0xFE00 && codepoint <= 0xFE0F || // Variation Selectors\n codepoint >= 0x1F900 && codepoint <= 0x1F9FF || // Supplemental Symbols and Pictographs\n codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF\n );\n}\n\nexport function allowRescaling(codepoint: number | undefined, width: number, glyphSizeX: number, deviceCellWidth: number): boolean {\n return (\n // Is single cell width\n width === 1 &&\n // Glyph exceeds cell bounds, add 50% to avoid hurting readability by rescaling glyphs that\n // barely overlap\n glyphSizeX > Math.ceil(deviceCellWidth * 1.5) &&\n // Never rescale ascii\n codepoint !== undefined && codepoint > 0xFF &&\n // Never rescale emoji\n !isEmoji(codepoint) &&\n // Never rescale powerline or nerd fonts\n !isPowerlineGlyph(codepoint) && !isNerdFontGlyph(codepoint)\n );\n}\n\nexport function treatGlyphAsBackgroundColor(codepoint: number): boolean {\n return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);\n}\n\nexport function createRenderDimensions(): IRenderDimensions {\n return {\n css: {\n canvas: createDimension(),\n cell: createDimension()\n },\n device: {\n canvas: createDimension(),\n cell: createDimension(),\n char: {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }\n }\n };\n}\n\nfunction createDimension(): IDimensions {\n return {\n width: 0,\n height: 0\n };\n}\n\nexport function computeNextVariantOffset(cellWidth: number, lineWidth: number, currentOffset: number = 0): number {\n return (cellWidth - (Math.round(lineWidth) * 2 - currentOffset)) % (Math.round(lineWidth) * 2);\n}\n", "/**\n * Copyright (c) 2018, 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, IColor } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { channels, color } from 'common/Color';\nimport { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\nimport { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { IColorContrastCache } from 'browser/Types';\n\n\nexport const enum RowCss {\n BOLD_CLASS = 'xterm-bold',\n DIM_CLASS = 'xterm-dim',\n ITALIC_CLASS = 'xterm-italic',\n UNDERLINE_CLASS = 'xterm-underline',\n OVERLINE_CLASS = 'xterm-overline',\n STRIKETHROUGH_CLASS = 'xterm-strikethrough',\n CURSOR_CLASS = 'xterm-cursor',\n CURSOR_BLINK_CLASS = 'xterm-cursor-blink',\n CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',\n CURSOR_STYLE_OUTLINE_CLASS = 'xterm-cursor-outline',\n CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar',\n CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline'\n}\n\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n private _selectionStart: [number, number] | undefined;\n private _selectionEnd: [number, number] | undefined;\n private _columnSelectMode: boolean = false;\n\n public defaultSpacing = 0;\n\n constructor(\n private readonly _document: Document,\n @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IThemeService private readonly _themeService: IThemeService\n ) {}\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionStart = start;\n this._selectionEnd = end;\n this._columnSelectMode = columnSelectMode;\n }\n\n public createRow(\n lineData: IBufferLine,\n row: number,\n isCursorRow: boolean,\n cursorStyle: string | undefined,\n cursorInactiveStyle: string | undefined,\n cursorX: number,\n cursorBlink: boolean,\n cellWidth: number,\n widthCache: WidthCache,\n linkStart: number,\n linkEnd: number\n ): HTMLSpanElement[] {\n\n const elements: HTMLSpanElement[] = [];\n const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n const colors = this._themeService.colors;\n\n let lineLength = lineData.getNoBgTrimmedLength();\n if (isCursorRow && lineLength < cursorX + 1) {\n lineLength = cursorX + 1;\n }\n\n let charElement: HTMLSpanElement | undefined;\n let cellAmount = 0;\n let text = '';\n let i = 0;\n let oldBg = 0;\n let oldFg = 0;\n let oldExt = 0;\n let oldLinkHover: number | boolean = false;\n let oldSpacing = 0;\n let oldIsInSelection: boolean = false;\n let spacing = 0;\n let skipJoinedCheckUntilX = 0;\n const classes: string[] = [];\n\n const hasHover = linkStart !== -1 && linkEnd !== -1;\n\n for (let x = 0; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n let width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n if (width === 0) {\n continue;\n }\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n\n // Indicates whether this cell is part of a joined range that should be ignored as it cannot\n // be rendered entirely, like the selection state differs across the range.\n let isValidJoinRange = (x >= skipJoinedCheckUntilX);\n\n let lastCharX = x;\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n let cell = this._workCell;\n if (joinedRanges.length > 0 && x === joinedRanges[0][0] && isValidJoinRange) {\n const range = joinedRanges.shift()!;\n // If the ligature's selection state is not consistent, don't join it. This helps the\n // selection render correctly regardless whether they should be joined.\n const firstSelectionState = this._isCellInSelection(range[0], row);\n for (i = range[0] + 1; i < range[1]; i++) {\n isValidJoinRange &&= (firstSelectionState === this._isCellInSelection(i, row));\n }\n // Similarly, if the cursor is in the ligature, don't join it.\n isValidJoinRange &&= !isCursorRow || cursorX < range[0] || cursorX >= range[1];\n if (!isValidJoinRange) {\n skipJoinedCheckUntilX = range[1];\n } else {\n isJoined = true;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n cell = new JoinedCellData(\n this._workCell,\n lineData.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n\n // Recalculate width\n width = cell.getWidth();\n }\n }\n\n const isInSelection = this._isCellInSelection(x, row);\n const isCursorCell = isCursorRow && x === cursorX;\n const isLinkHover = hasHover && x >= linkStart && x <= linkEnd;\n\n let isDecorated = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n isDecorated = true;\n });\n\n // get chars to render for this cell\n let chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) {\n chars = '\\xa0';\n }\n\n // lookup char render width and calc spacing\n spacing = width * cellWidth - widthCache.get(chars, cell.isBold(), cell.isItalic());\n\n if (!charElement) {\n charElement = this._document.createElement('span');\n } else {\n /**\n * chars can only be merged on existing span if:\n * - existing span only contains mergeable chars (cellAmount != 0)\n * - bg did not change (or both are in selection)\n * - fg did not change (or both are in selection and selection fg is set)\n * - ext did not change\n * - underline from hover state did not change\n * - cell content renders to same letter-spacing\n * - cell is not cursor\n */\n if (\n cellAmount\n && (\n (isInSelection && oldIsInSelection)\n || (!isInSelection && !oldIsInSelection && cell.bg === oldBg)\n )\n && (\n (isInSelection && oldIsInSelection && colors.selectionForeground)\n || cell.fg === oldFg\n )\n && cell.extended.ext === oldExt\n && isLinkHover === oldLinkHover\n && spacing === oldSpacing\n && !isCursorCell\n && !isJoined\n && !isDecorated\n && isValidJoinRange\n ) {\n // no span alterations, thus only account chars skipping all code below\n if (cell.isInvisible()) {\n text += WHITESPACE_CELL_CHAR;\n } else {\n text += chars;\n }\n cellAmount++;\n continue;\n } else {\n /**\n * cannot merge:\n * - apply left-over text to old span\n * - create new span, reset state holders cellAmount & text\n */\n if (cellAmount) {\n charElement.textContent = text;\n }\n charElement = this._document.createElement('span');\n cellAmount = 0;\n text = '';\n }\n }\n // preserve conditions for next merger eval round\n oldBg = cell.bg;\n oldFg = cell.fg;\n oldExt = cell.extended.ext;\n oldLinkHover = isLinkHover;\n oldSpacing = spacing;\n oldIsInSelection = isInSelection;\n\n if (isJoined) {\n // The DOM renderer colors the background of the cursor but for ligatures all cells are\n // joined. The workaround here is to show a cursor around the whole ligature so it shows up,\n // the cursor looks the same when on any character of the ligature though\n if (cursorX >= x && cursorX <= lastCharX) {\n cursorX = x;\n }\n }\n\n if (!this._coreService.isCursorHidden && isCursorCell && this._coreService.isCursorInitialized) {\n classes.push(RowCss.CURSOR_CLASS);\n if (this._coreBrowserService.isFocused) {\n if (cursorBlink) {\n classes.push(RowCss.CURSOR_BLINK_CLASS);\n }\n classes.push(\n cursorStyle === 'bar'\n ? RowCss.CURSOR_STYLE_BAR_CLASS\n : cursorStyle === 'underline'\n ? RowCss.CURSOR_STYLE_UNDERLINE_CLASS\n : RowCss.CURSOR_STYLE_BLOCK_CLASS\n );\n } else {\n if (cursorInactiveStyle) {\n switch (cursorInactiveStyle) {\n case 'outline':\n classes.push(RowCss.CURSOR_STYLE_OUTLINE_CLASS);\n break;\n case 'block':\n classes.push(RowCss.CURSOR_STYLE_BLOCK_CLASS);\n break;\n case 'bar':\n classes.push(RowCss.CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n classes.push(RowCss.CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n break;\n }\n }\n }\n }\n\n if (cell.isBold()) {\n classes.push(RowCss.BOLD_CLASS);\n }\n\n if (cell.isItalic()) {\n classes.push(RowCss.ITALIC_CLASS);\n }\n\n if (cell.isDim()) {\n classes.push(RowCss.DIM_CLASS);\n }\n\n if (cell.isInvisible()) {\n text = WHITESPACE_CELL_CHAR;\n } else {\n text = cell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n if (cell.isUnderline()) {\n classes.push(`${RowCss.UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n if (!cell.isUnderlineColorDefault()) {\n if (cell.isUnderlineColorRGB()) {\n charElement.style.textDecorationColor = `rgb(${AttributeData.toColorRGB(cell.getUnderlineColor()).join(',')})`;\n } else {\n let fg = cell.getUnderlineColor();\n if (this._optionsService.rawOptions.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n charElement.style.textDecorationColor = colors.ansi[fg].css;\n }\n }\n }\n\n if (cell.isOverline()) {\n classes.push(RowCss.OVERLINE_CLASS);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n }\n\n if (cell.isStrikethrough()) {\n classes.push(RowCss.STRIKETHROUGH_CLASS);\n }\n\n // apply link hover underline late, effectively overrides any previous text-decoration\n // settings\n if (isLinkHover) {\n charElement.style.textDecoration = 'underline';\n }\n\n let fg = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bg = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Apply any decoration foreground/background overrides, this must happen after inverse has\n // been applied\n let bgOverride: IColor | undefined;\n let fgOverride: IColor | undefined;\n let isTop = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n if (d.options.layer !== 'top' && isTop) {\n return;\n }\n if (d.backgroundColorRGB) {\n bgColorMode = Attributes.CM_RGB;\n bg = d.backgroundColorRGB.rgba >> 8 & 0xFFFFFF;\n bgOverride = d.backgroundColorRGB;\n }\n if (d.foregroundColorRGB) {\n fgColorMode = Attributes.CM_RGB;\n fg = d.foregroundColorRGB.rgba >> 8 & 0xFFFFFF;\n fgOverride = d.foregroundColorRGB;\n }\n isTop = d.options.layer === 'top';\n });\n\n // Apply selection\n if (!isTop && isInSelection) {\n // If in the selection, force the element to be above the selection to improve contrast and\n // support opaque selections. The applies background is not actually needed here as\n // selection is drawn in a seperate container, the main purpose of this to ensuring minimum\n // contrast ratio\n bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n bg = bgOverride.rgba >> 8 & 0xFFFFFF;\n bgColorMode = Attributes.CM_RGB;\n // Since an opaque selection is being rendered, the selection pretends to be a decoration to\n // ensure text is drawn above the selection.\n isTop = true;\n // Apply selection foreground if applicable\n if (colors.selectionForeground) {\n fgColorMode = Attributes.CM_RGB;\n fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n fgOverride = colors.selectionForeground;\n }\n }\n\n // If it's a top decoration, render above the selection\n if (isTop) {\n classes.push('xterm-decoration-top');\n }\n\n // Background\n let resolvedBg: IColor;\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n resolvedBg = colors.ansi[bg];\n classes.push(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n resolvedBg = channels.toColor(bg >> 16, bg >> 8 & 0xFF, bg & 0xFF);\n this._addStyle(charElement, `background-color:#${(bg >>> 0).toString(16).padStart(6, '0')}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n resolvedBg = colors.foreground;\n classes.push(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n } else {\n resolvedBg = colors.background;\n }\n }\n\n // If there is no background override by now it's the original color, so apply dim if needed\n if (!bgOverride) {\n if (cell.isDim()) {\n bgOverride = color.multiplyOpacity(resolvedBg, 0.5);\n }\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.ansi[fg], cell, bgOverride, undefined)) {\n classes.push(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = channels.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, resolvedBg, color, cell, bgOverride, fgOverride)) {\n this._addStyle(charElement, `color:#${fg.toString(16).padStart(6, '0')}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.foreground, cell, bgOverride, fgOverride)) {\n if (isInverse) {\n classes.push(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n // apply CSS classes\n // slightly faster than using classList by omitting\n // checks for doubled entries (code above should not have doublets)\n if (classes.length) {\n charElement.className = classes.join(' ');\n classes.length = 0;\n }\n\n // exclude conditions for cell merging - never merge these\n if (!isCursorCell && !isJoined && !isDecorated && isValidJoinRange) {\n cellAmount++;\n } else {\n charElement.textContent = text;\n }\n // apply letter-spacing rule\n if (spacing !== this.defaultSpacing) {\n charElement.style.letterSpacing = `${spacing}px`;\n }\n\n elements.push(charElement);\n x = lastCharX;\n }\n\n // postfix text of last merged span\n if (charElement && cellAmount) {\n charElement.textContent = text;\n }\n\n return elements;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData, bgOverride: IColor | undefined, fgOverride: IColor | undefined): boolean {\n if (this._optionsService.rawOptions.minimumContrastRatio === 1 || treatGlyphAsBackgroundColor(cell.getCode())) {\n return false;\n }\n\n // Try get from cache first, only use the cache when there are no decoration overrides\n const cache = this._getContrastCache(cell);\n let adjustedColor: IColor | undefined | null = undefined;\n if (!bgOverride && !fgOverride) {\n adjustedColor = cache.getColor(bg.rgba, fg.rgba);\n }\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n // Dim cells only require half the contrast, otherwise they wouldn't be distinguishable from\n // non-dim cells\n const ratio = this._optionsService.rawOptions.minimumContrastRatio / (cell.isDim() ? 2 : 1);\n adjustedColor = color.ensureContrastRatio(bgOverride ?? bg, fgOverride ?? fg, ratio);\n cache.setColor((bgOverride ?? bg).rgba, (fgOverride ?? fg).rgba, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _getContrastCache(cell: ICellData): IColorContrastCache {\n if (cell.isDim()) {\n return this._themeService.colors.halfContrastCache;\n }\n return this._themeService.colors.contrastCache;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n\n private _isCellInSelection(x: number, y: number): boolean {\n const start = this._selectionStart;\n const end = this._selectionEnd;\n if (!start || !end) {\n return false;\n }\n if (this._columnSelectMode) {\n if (start[0] <= end[0]) {\n return x >= start[0] && y >= start[1] &&\n x < end[0] && y <= end[1];\n }\n return x < start[0] && y >= start[1] &&\n x >= end[0] && y <= end[1];\n }\n return (y > start[1] && y < end[1]) ||\n (start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||\n (start[1] < end[1] && y === end[1] && x < end[0]) ||\n (start[1] < end[1] && y === start[1] && x >= start[0]);\n }\n}\n", "/**\n * Copyright (c) 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';\nimport { IDisposable } from 'common/Types';\nimport { FontWeight } from 'common/services/Services';\n\n\nexport const enum WidthCacheSettings {\n /** sentinel for unset values in flat cache */\n FLAT_UNSET = -9999,\n /** size of flat cache, size-1 equals highest codepoint handled by flat */\n FLAT_SIZE = 256,\n /** char repeat for measuring */\n REPEAT = 32\n}\n\n\nconst enum FontVariant {\n REGULAR = 0,\n BOLD = 1,\n ITALIC = 2,\n BOLD_ITALIC = 3\n}\n\nexport interface IWidthCacheFontVariantCanvas {\n setFont(fontFamily: string, fontSize: number, fontWeight: FontWeight, italic: boolean): void;\n measure(c: string): number;\n}\n\nexport class WidthCache implements IDisposable {\n // flat cache for regular variant up to CacheSettings.FLAT_SIZE\n // NOTE: ~4x faster access than holey (serving >>80% of terminal content)\n // It has a small memory footprint (only 1MB for full BMP caching),\n // still the sweet spot is not reached before touching 32k different codepoints,\n // thus we store the remaining <<20% of terminal data in a holey structure.\n protected _flat = new Float32Array(WidthCacheSettings.FLAT_SIZE);\n\n // holey cache for bold, italic and bold&italic for any string\n // FIXME: can grow really big over time (~8.5 MB for full BMP caching),\n // so a shared API across terminals is needed\n protected _holey: Map | undefined;\n\n private _font = '';\n private _fontSize = 0;\n private _weight: FontWeight = 'normal';\n private _weightBold: FontWeight = 'bold';\n private _canvasElements: IWidthCacheFontVariantCanvas[] = [];\n\n constructor(\n canvasFactory: () => IWidthCacheFontVariantCanvas = () => new WidthCacheFontVariantCanvas()\n ) {\n this._canvasElements = [\n canvasFactory(),\n canvasFactory(),\n canvasFactory(),\n canvasFactory()\n ];\n\n this.clear();\n }\n\n public dispose(): void {\n this._canvasElements.length = 0;\n this._holey = undefined; // free cache memory via GC\n }\n\n /**\n * Clear the width cache.\n */\n public clear(): void {\n this._flat.fill(WidthCacheSettings.FLAT_UNSET);\n // .clear() has some overhead, re-assign instead (>3 times faster)\n this._holey = new Map();\n }\n\n /**\n * Set the font for measuring.\n * Must be called for any changes on font settings.\n * Also clears the cache.\n */\n public setFont(font: string, fontSize: number, weight: FontWeight, weightBold: FontWeight): void {\n // skip if nothing changed\n if (\n font === this._font &&\n fontSize === this._fontSize &&\n weight === this._weight &&\n weightBold === this._weightBold\n ) {\n return;\n }\n\n this._font = font;\n this._fontSize = fontSize;\n this._weight = weight;\n this._weightBold = weightBold;\n\n this._canvasElements[FontVariant.REGULAR].setFont(font, fontSize, weight, false);\n this._canvasElements[FontVariant.BOLD].setFont(font, fontSize, weightBold, false);\n this._canvasElements[FontVariant.ITALIC].setFont(font, fontSize, weight, true);\n this._canvasElements[FontVariant.BOLD_ITALIC].setFont(font, fontSize, weightBold, true);\n\n this.clear();\n }\n\n /**\n * Get the render width for cell content `c` with current font settings.\n * `variant` denotes the font variant to be used.\n */\n public get(c: string, bold: boolean | number, italic: boolean | number): number {\n let cp = 0;\n if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {\n if (this._flat[cp] !== WidthCacheSettings.FLAT_UNSET) {\n return this._flat[cp];\n }\n const width = this._measure(c, 0);\n if (width > 0) {\n this._flat[cp] = width;\n }\n return width;\n }\n let key = c;\n if (bold) key += 'B';\n if (italic) key += 'I';\n let width = this._holey!.get(key);\n if (width === undefined) {\n let variant = 0;\n if (bold) variant |= FontVariant.BOLD;\n if (italic) variant |= FontVariant.ITALIC;\n width = this._measure(c, variant);\n if (width > 0) {\n this._holey!.set(key, width);\n }\n }\n return width;\n }\n\n protected _measure(c: string, variant: FontVariant): number {\n return this._canvasElements[variant].measure(c);\n }\n}\n\nclass WidthCacheFontVariantCanvas implements IWidthCacheFontVariantCanvas {\n private _canvas: OffscreenCanvas | HTMLCanvasElement;\n private _ctx: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;\n\n constructor() {\n if (typeof OffscreenCanvas !== 'undefined') {\n this._canvas = new OffscreenCanvas(1, 1);\n this._ctx = throwIfFalsy(this._canvas.getContext('2d'));\n } else {\n this._canvas = document.createElement('canvas');\n this._canvas.width = 1;\n this._canvas.height = 1;\n this._ctx = throwIfFalsy(this._canvas.getContext('2d'));\n }\n }\n\n public setFont(fontFamily: string, fontSize: number, fontWeight: FontWeight, italic: boolean): void {\n const fontStyle = italic ? 'italic' : '';\n this._ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`.trim();\n }\n\n public measure(c: string): number {\n return this._ctx.measureText(c).width;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminal } from 'browser/Types';\nimport { ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { Terminal } from '@xterm/xterm';\n\nclass SelectionRenderModel implements ISelectionRenderModel {\n public hasSelection!: boolean;\n public columnSelectMode!: boolean;\n public viewportStartRow!: number;\n public viewportEndRow!: number;\n public viewportCappedStartRow!: number;\n public viewportCappedEndRow!: number;\n public startCol!: number;\n public endCol!: number;\n public selectionStart: [number, number] | undefined;\n public selectionEnd: [number, number] | undefined;\n\n constructor() {\n this.clear();\n }\n\n public clear(): void {\n this.hasSelection = false;\n this.columnSelectMode = false;\n this.viewportStartRow = 0;\n this.viewportEndRow = 0;\n this.viewportCappedStartRow = 0;\n this.viewportCappedEndRow = 0;\n this.startCol = 0;\n this.endCol = 0;\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n }\n\n public update(terminal: ITerminal, start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {\n this.selectionStart = start;\n this.selectionEnd = end;\n // Selection does not exist\n if (!start || !end || (start[0] === end[0] && start[1] === end[1])) {\n this.clear();\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportY = terminal.buffers.active.ydisp;\n const viewportStartRow = start[1] - viewportY;\n const viewportEndRow = end[1] - viewportY;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, terminal.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= terminal.rows || viewportCappedEndRow < 0) {\n this.clear();\n return;\n }\n\n this.hasSelection = true;\n this.columnSelectMode = columnSelectMode;\n this.viewportStartRow = viewportStartRow;\n this.viewportEndRow = viewportEndRow;\n this.viewportCappedStartRow = viewportCappedStartRow;\n this.viewportCappedEndRow = viewportCappedEndRow;\n this.startCol = start[0];\n this.endCol = end[0];\n }\n\n public isCellSelected(terminal: Terminal, x: number, y: number): boolean {\n if (!this.hasSelection) {\n return false;\n }\n y -= terminal.buffer.active.viewportY;\n if (this.columnSelectMode) {\n if (this.startCol <= this.endCol) {\n return x >= this.startCol && y >= this.viewportCappedStartRow &&\n x < this.endCol && y <= this.viewportCappedEndRow;\n }\n return x < this.startCol && y >= this.viewportCappedStartRow &&\n x >= this.endCol && y <= this.viewportCappedEndRow;\n }\n return (y > this.viewportStartRow && y < this.viewportEndRow) ||\n (this.viewportStartRow === this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportEndRow && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol);\n }\n}\n\nexport function createSelectionRenderModel(): ISelectionRenderModel {\n return new SelectionRenderModel();\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { INVERTED_DEFAULT_COLOR, RendererConstants } from 'browser/renderer/shared/Constants';\nimport { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';\nimport { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';\nimport { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';\nimport { color } from 'common/Color';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, ICoreService, IInstantiationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\nconst CURSOR_BLINK_IDLE_CLASS = 'xterm-cursor-blink-idle';\n\nlet nextTerminalId = 1;\n\n/**\n * The standard renderer and fallback for when the webgl addon is slow. This is not meant to be\n * particularly fast and will even lack some features such as custom glyphs, hoever this is more\n * reliable as webgl may not work on some machines.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n private _widthCache: WidthCache;\n private _selectionRenderModel: ISelectionRenderModel = createSelectionRenderModel();\n private _cursorBlinkStateManager: CursorBlinkStateManager;\n\n public dimensions: IRenderDimensions;\n\n public readonly onRequestRedraw = this._register(new Emitter()).event;\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _document: Document,\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _helperContainer: HTMLElement,\n private readonly _linkifier2: ILinkifier2,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService private readonly _themeService: IThemeService\n ) {\n super();\n this._rowContainer = this._document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = this._document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = createRenderDimensions();\n this._updateDimensions();\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n\n this._register(this._themeService.onChangeColors(e => this._injectCss(e)));\n this._injectCss(this._themeService.colors);\n\n this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this._register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));\n this._register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));\n\n this._cursorBlinkStateManager = new CursorBlinkStateManager(this._rowContainer, this._coreBrowserService);\n this._register(addDisposableListener(this._document, 'mousedown', () => this._cursorBlinkStateManager.restartBlinkAnimation()));\n this._register(toDisposable(() => this._cursorBlinkStateManager.dispose()));\n\n this._register(toDisposable(() => {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n this._rowContainer.remove();\n this._selectionContainer.remove();\n this._widthCache.dispose();\n this._themeStyleElement.remove();\n this._dimensionsStyleElement.remove();\n }));\n\n this._widthCache = new WidthCache();\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n private _updateDimensions(): void {\n const dpr = this._coreBrowserService.dpr;\n this.dimensions.device.char.width = this._charSizeService.width * dpr;\n this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * dpr);\n this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing);\n this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight);\n this.dimensions.device.char.left = 0;\n this.dimensions.device.char.top = 0;\n this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols;\n this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows;\n this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / dpr);\n this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / dpr);\n this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols;\n this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.css.canvas.width}px`;\n element.style.height = `${this.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this.dimensions.css.cell.height}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` + // TODO: find workaround for inline-block (creates ~20% render penalty)\n ` height: 100%;` +\n ` vertical-align: top;` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`;\n this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;\n }\n\n private _injectCss(colors: ReadonlyColorSet): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n // Disabling pointer events circumvents a browser behavior that prevents `click` events from\n // being delivered if the target element is replaced during the click. This happened due to\n // refresh() being called during the mousedown handler to start a selection.\n ` pointer-events: none;` +\n ` color: ${colors.foreground.css};` +\n ` font-family: ${this._optionsService.rawOptions.fontFamily};` +\n ` font-size: ${this._optionsService.rawOptions.fontSize}px;` +\n ` font-kerning: none;` +\n ` white-space: pre` +\n `}`;\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .xterm-dim {` +\n ` color: ${color.multiplyOpacity(colors.foreground, 0.5).css};` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${RowCss.BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n const blinkAnimationUnderlineId = `blink_underline_${this._terminalClass}`;\n const blinkAnimationBarId = `blink_bar_${this._terminalClass}`;\n const blinkAnimationBlockId = `blink_block_${this._terminalClass}`;\n styles +=\n `@keyframes ${blinkAnimationUnderlineId} {` +\n ` 50% {` +\n ` border-bottom-style: hidden;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBarId} {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBlockId} {` +\n ` 0% {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: inherit;` +\n ` color: ${colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` animation: ${blinkAnimationUnderlineId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` animation: ${blinkAnimationBarId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: ${blinkAnimationBlockId} 1s step-end infinite;` +\n `}` +\n // Disable cursor blinking when idle\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${CURSOR_BLINK_IDLE_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS} {` +\n ` animation: none !important;` +\n `}` +\n // !important helps fix an issue where the cursor will not render on top of the selection,\n // however it's very hard to fix this issue and retain the blink animation without the use of\n // !important. So this edge case fails when cursor blink is on.\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS}:not(.${RowCss.CURSOR_BLINK_CLASS}) {` +\n ` background-color: ${colors.cursor.css} !important;` +\n ` color: ${colors.cursorAccent.css} !important;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_OUTLINE_CLASS} {` +\n ` outline: 1px solid ${colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` border-bottom: 1px ${colors.cursor.css};` +\n ` border-bottom-style: solid;` +\n ` height: calc(100% - 1px);` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector}.focus .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionBackgroundOpaque.css};` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionInactiveBackgroundOpaque.css};` +\n `}`;\n // Colors\n for (const [i, c] of colors.ansi.entries()) {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(c, 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n }\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(colors.background).css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(color.opaque(colors.background), 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n /**\n * default letter spacing\n * Due to rounding issues in dimensions dpr calc glyph might render\n * slightly too wide or too narrow. The method corrects the stacking offsets\n * by applying a default letter-spacing for all chars.\n * The value gets passed to the row factory to avoid setting this value again\n * (render speedup is roughly 10%).\n */\n private _setDefaultSpacing(): void {\n // measure same char as in CharSizeService to get the base deviation\n const spacing = this.dimensions.css.cell.width - this._widthCache.get('W', false, false);\n this._rowContainer.style.letterSpacing = `${spacing}px`;\n this._rowFactory.defaultSpacing = spacing;\n }\n\n public handleDevicePixelRatioChange(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = this._document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public handleResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n this.handleSelectionChanged(this._selectionRenderModel.selectionStart, this._selectionRenderModel.selectionEnd, this._selectionRenderModel.columnSelectMode);\n }\n\n public handleCharSizeChanged(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n public handleBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n this._cursorBlinkStateManager.pause();\n this.renderRows(0, this._bufferService.rows - 1);\n }\n\n public handleFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n this._cursorBlinkStateManager.resume();\n this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n this._selectionContainer.replaceChildren();\n this._rowFactory.handleSelectionChanged(start, end, columnSelectMode);\n this.renderRows(0, this._bufferService.rows - 1);\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n this._selectionRenderModel.update(this._terminal, start, end, columnSelectMode);\n if (!this._selectionRenderModel.hasSelection) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = this._selectionRenderModel.viewportStartRow;\n const viewportEndRow = this._selectionRenderModel.viewportEndRow;\n const viewportCappedStartRow = this._selectionRenderModel.viewportCappedStartRow;\n const viewportCappedEndRow = this._selectionRenderModel.viewportCappedEndRow;\n\n // Create the selections\n const documentFragment = this._document.createDocumentFragment();\n\n if (columnSelectMode) {\n const isXFlipped = start[0] > end[0];\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = this._document.createElement('div');\n const left = colStart * this.dimensions.css.cell.width;\n let width = this.dimensions.css.cell.width * (colEnd - colStart);\n if (left + width > this.dimensions.css.canvas.width) {\n width = this.dimensions.css.canvas.width - left;\n }\n\n element.style.height = `${rowCount * this.dimensions.css.cell.height}px`;\n element.style.top = `${row * this.dimensions.css.cell.height}px`;\n element.style.left = `${left}px`;\n element.style.width = `${width}px`;\n return element;\n }\n\n public handleCursorMove(): void {\n // Reset idle timer on cursor movement (which happens on input)\n this._cursorBlinkStateManager.restartBlinkAnimation();\n }\n\n private _handleOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n // Refresh CSS\n this._injectCss(this._themeService.colors);\n // update spacing cache\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n /**\n * NOTE: This used to be `e.innerText = '';` but that doesn't work when using `jsdom` and\n * `@testing-library/react`\n *\n * references:\n * - https://github.com/testing-library/react-testing-library/issues/1146\n * - https://github.com/jsdom/jsdom/issues/1245\n */\n e.replaceChildren();\n }\n }\n\n public renderRows(start: number, end: number): void {\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._coreService.decPrivateModes.cursorBlink ?? this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._coreService.decPrivateModes.cursorStyle ?? this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n for (let y = start; y <= end; y++) {\n const row = y + buffer.ydisp;\n const rowElement = this._rowElements[y];\n const lineData = buffer.lines.get(row);\n if (!rowElement || !lineData) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n lineData,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n -1,\n -1\n )\n );\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n private _handleLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _handleLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n /**\n * NOTE: The linkifier may send out of viewport y-values if:\n * - negative y-value: the link started at a higher line\n * - y-value >= maxY: the link ends at a line below viewport\n *\n * For negative y-values we can simply adjust x = 0,\n * as higher up link start means, that everything from\n * (0,0) is a link under top-down-left-right char progression\n *\n * Additionally there might be a small chance of out-of-sync x|y-values\n * from a race condition of render updates vs. link event handler execution:\n * - (sync) resize: chances terminal buffer in sync, schedules render update async\n * - (async) link handler race condition: new buffer metrics, but still on old render state\n * - (async) render update: brings term metrics and render state back in sync\n */\n // clip coords into viewport\n if (y < 0) x = 0;\n if (y2 < 0) x2 = 0;\n const maxY = this._bufferService.rows - 1;\n y = Math.max(Math.min(y, maxY), 0);\n y2 = Math.max(Math.min(y2, maxY), 0);\n\n cols = Math.min(cols, this._bufferService.cols);\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n // refresh rows within link range\n for (let i = y; i <= y2; ++i) {\n const row = i + buffer.ydisp;\n const rowElement = this._rowElements[i];\n const bufferline = buffer.lines.get(row);\n if (!rowElement || !bufferline) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n bufferline,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n enabled ? (i === y ? x : 0) : -1,\n enabled ? ((i === y2 ? x2 : cols) - 1) : -1\n )\n );\n }\n }\n}\n\nclass CursorBlinkStateManager {\n private _idleTimeout: number | undefined;\n private _isIdlePaused: boolean = false;\n\n constructor(\n private readonly _rowContainer: HTMLElement,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n if (this._coreBrowserService.isFocused) {\n this._resetIdleTimer();\n }\n }\n\n public dispose(): void {\n this._clearIdleTimer();\n }\n\n public restartBlinkAnimation(): void {\n if (this._isIdlePaused) {\n this._rowContainer.classList.remove(CURSOR_BLINK_IDLE_CLASS);\n }\n this._resetIdleTimer();\n }\n\n public pause(): void {\n this._isIdlePaused = false;\n this._clearIdleTimer();\n }\n\n public resume(): void {\n this._isIdlePaused = false;\n this._rowContainer.classList.remove(CURSOR_BLINK_IDLE_CLASS);\n this._resetIdleTimer();\n }\n\n private _resetIdleTimer(): void {\n this._isIdlePaused = false;\n this._clearIdleTimer();\n this._idleTimeout = this._coreBrowserService.window.setTimeout(() => {\n this._stopBlinkingDueToIdle();\n }, RendererConstants.CURSOR_BLINK_IDLE_TIMEOUT);\n }\n\n private _clearIdleTimer(): void {\n if (this._idleTimeout) {\n this._coreBrowserService.window.clearTimeout(this._idleTimeout);\n this._idleTimeout = undefined;\n }\n }\n\n private _stopBlinkingDueToIdle(): void {\n this._rowContainer.classList.add(CURSOR_BLINK_IDLE_CLASS);\n this._isIdlePaused = true;\n this._idleTimeout = undefined;\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport class CharSizeService extends Disposable implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private readonly _onCharSizeChange = this._register(new Emitter());\n public readonly onCharSizeChange = this._onCharSizeChange.event;\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n try {\n this._measureStrategy = this._register(new TextMetricsMeasureStrategy(this._optionsService));\n } catch {\n this._measureStrategy = this._register(new DomMeasureStrategy(document, parentElement, this._optionsService));\n }\n this._register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): Readonly;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\nconst enum DomMeasureStrategyConstants {\n REPEAT = 32\n}\n\nabstract class BaseMeasureStategy extends Disposable implements IMeasureStrategy {\n protected _result: IMeasureResult = { width: 0, height: 0 };\n\n protected _validateAndSet(width: number | undefined, height: number | undefined): void {\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (width !== undefined && width > 0 && height !== undefined && height > 0) {\n this._result.width = width;\n this._result.height = height;\n }\n }\n\n public abstract measure(): Readonly;\n}\n\nclass DomMeasureStrategy extends BaseMeasureStategy {\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n super();\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W'.repeat(DomMeasureStrategyConstants.REPEAT);\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._measureElement.style.whiteSpace = 'pre';\n this._measureElement.style.fontKerning = 'none';\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): Readonly {\n this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n this._validateAndSet(Number(this._measureElement.offsetWidth) / DomMeasureStrategyConstants.REPEAT, Number(this._measureElement.offsetHeight));\n\n return this._result;\n }\n}\n\nclass TextMetricsMeasureStrategy extends BaseMeasureStategy {\n private _canvas: OffscreenCanvas;\n private _ctx: OffscreenCanvasRenderingContext2D;\n\n constructor(\n private _optionsService: IOptionsService\n ) {\n super();\n // This will throw if any required API is not supported\n this._canvas = new OffscreenCanvas(100, 100);\n this._ctx = this._canvas.getContext('2d')!;\n const a = this._ctx.measureText('W');\n if (!('width' in a && 'fontBoundingBoxAscent' in a && 'fontBoundingBoxDescent' in a)) {\n throw new Error('Required font metrics not supported');\n }\n }\n\n public measure(): Readonly {\n this._ctx.font = `${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;\n const metrics = this._ctx.measureText('W');\n this._validateAndSet(metrics.width, metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent);\n return this._result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\nimport { Emitter, EventUtils } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\n\nexport class CoreBrowserService extends Disposable implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n private _isFocused = false;\n private _cachedIsFocused: boolean | undefined = undefined;\n private _screenDprMonitor = this._register(new ScreenDprMonitor(this._window));\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n private readonly _onWindowChange = this._register(new Emitter());\n public readonly onWindowChange = this._onWindowChange.event;\n\n constructor(\n private _textarea: HTMLTextAreaElement,\n private _window: Window & typeof globalThis,\n public readonly mainDocument: Document\n ) {\n super();\n\n // Monitor device pixel ratio\n this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));\n this._register(EventUtils.forward(this._screenDprMonitor.onDprChange, this._onDprChange));\n\n this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));\n this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));\n }\n\n public get window(): Window & typeof globalThis {\n return this._window;\n }\n\n public set window(value: Window & typeof globalThis) {\n if (this._window !== value) {\n this._window = value;\n this._onWindowChange.fire(this._window);\n }\n }\n\n public get dpr(): number {\n return this.window.devicePixelRatio;\n }\n\n public get isFocused(): boolean {\n if (this._cachedIsFocused === undefined) {\n this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus();\n queueMicrotask(() => this._cachedIsFocused = undefined);\n }\n return this._cachedIsFocused;\n }\n}\n\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will _register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nclass ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n private _windowResizeListener = this._register(new MutableDisposable());\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n\n constructor(private _parentWindow: Window) {\n super();\n\n // Initialize listener and dpr value\n this._outerListener = () => this._setDprAndFireIfDiffers();\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._updateDpr();\n\n // Monitor active window resize\n this._setWindowResizeListener();\n\n // Setup additional disposables\n this._register(toDisposable(() => this.clearListener()));\n }\n\n\n public setWindow(parentWindow: Window): void {\n this._parentWindow = parentWindow;\n this._setWindowResizeListener();\n this._setDprAndFireIfDiffers();\n }\n\n private _setWindowResizeListener(): void {\n this._windowResizeListener.value = addDisposableListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers());\n }\n\n private _setDprAndFireIfDiffers(): void {\n if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) {\n this._onDprChange.fire(this._parentWindow.devicePixelRatio);\n }\n this._updateDpr();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._outerListener = undefined;\n }\n}\n", "import { ILinkProvider, ILinkProviderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\n\nexport class LinkProviderService extends Disposable implements ILinkProviderService {\n declare public serviceBrand: undefined;\n\n public readonly linkProviders: ILinkProvider[] = [];\n\n constructor() {\n super();\n this._register(toDisposable(() => this.linkProviders.length = 0));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this.linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this.linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this.linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n const elementStyle = window.getComputedStyle(element);\n const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));\n const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));\n return [\n event.clientX - rect.left - leftPadding,\n event.clientY - rect.top - topPadding\n ];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param window The window object the element belongs to.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param hasValidCharSize Whether there is a valid character size available.\n * @param cssCellWidth The cell width device pixel render dimensions.\n * @param cssCellHeight The cell height device pixel render dimensions.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(window: Pick, event: Pick, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, cssCellWidth: number, cssCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);\n coords[1] = Math.ceil(coords[1] / cssCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { getWindow } from 'vs/base/browser/dom';\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getCoordsRelativeToElement } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n window,\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.css.cell.width,\n this._renderService.dimensions.css.cell.height,\n isSelection\n );\n }\n\n public getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined {\n const coords = getCoordsRelativeToElement(getWindow(element), event, element);\n if (!this._charSizeService.hasValidSize) {\n return undefined;\n }\n coords[0] = Math.min(Math.max(coords[0], 0), this._renderService.dimensions.css.canvas.width - 1);\n coords[1] = Math.min(Math.max(coords[1], 0), this._renderService.dimensions.css.canvas.height - 1);\n return {\n col: Math.floor(coords[0] / this._renderService.dimensions.css.cell.width),\n row: Math.floor(coords[1] / this._renderService.dimensions.css.cell.height),\n x: Math.floor(coords[0]),\n y: Math.floor(coords[1])\n };\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { ICoreBrowserService } from 'browser/services/Services';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncerWithCallback {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n private _refreshCallbacks: FrameRequestCallback[] = [];\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n this._refreshCallbacks.push(callback);\n if (!this._animationFrame) {\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n return this._animationFrame;\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart ?? 0;\n rowEnd = rowEnd ?? this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n this._animationFrame = undefined;\n\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n this._runRefreshCallbacks();\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n this._runRefreshCallbacks();\n }\n\n private _runRefreshCallbacks(): void {\n for (const callback of this._refreshCallbacks) {\n callback(0);\n }\n this._refreshCallbacks = [];\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\ndeclare const process: unknown;\n\n// navigator.userAgent is also checked here because bundling with the process module can cause\n// issues otherwise. Note that navigator exists in Node.js 21+ but the userAgent is\n// \"Node.js/\".\nexport const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && (typeof navigator === 'undefined' || navigator.userAgent.startsWith('Node.js/'))) ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isLegacyEdge = userAgent.includes('Edge');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\nexport function getSafariVersion(): number {\n if (!isSafari) {\n return 0;\n }\n const majorVersion = userAgent.match(/Version\\/(\\d+)/);\n if (majorVersion === null || majorVersion.length < 2) {\n return 0;\n }\n return parseInt(majorVersion[1]);\n}\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n// Note that when this is true, isLinux will also be true.\nexport const isChromeOS = /\\bCrOS\\b/.test(userAgent);\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\n\ninterface ITaskQueue {\n /**\n * Adds a task to the queue which will run in a future idle callback.\n * To avoid perceivable stalls on the mainthread, tasks with heavy workload\n * should split their work into smaller pieces and return `true` to get\n * called again until the work is done (on falsy return value).\n */\n enqueue(task: () => boolean | void): void;\n\n /**\n * Flushes the queue, running all remaining tasks synchronously.\n */\n flush(): void;\n\n /**\n * Clears any remaining tasks from the queue, these will not be run.\n */\n clear(): void;\n}\n\ninterface ITaskDeadline {\n timeRemaining(): number;\n}\ntype CallbackWithDeadline = (deadline: ITaskDeadline) => void;\n\nabstract class TaskQueue implements ITaskQueue {\n private _tasks: (() => boolean | void)[] = [];\n private _idleCallback?: number;\n private _i = 0;\n\n protected abstract _requestCallback(callback: CallbackWithDeadline): number;\n protected abstract _cancelCallback(identifier: number): void;\n\n public enqueue(task: () => boolean | void): void {\n this._tasks.push(task);\n this._start();\n }\n\n public flush(): void {\n while (this._i < this._tasks.length) {\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n }\n this.clear();\n }\n\n public clear(): void {\n if (this._idleCallback) {\n this._cancelCallback(this._idleCallback);\n this._idleCallback = undefined;\n }\n this._i = 0;\n this._tasks.length = 0;\n }\n\n private _start(): void {\n if (!this._idleCallback) {\n this._idleCallback = this._requestCallback(this._process.bind(this));\n }\n }\n\n private _process(deadline: ITaskDeadline): void {\n this._idleCallback = undefined;\n let taskDuration = 0;\n let longestTask = 0;\n let lastDeadlineRemaining = deadline.timeRemaining();\n let deadlineRemaining = 0;\n while (this._i < this._tasks.length) {\n taskDuration = performance.now();\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n // other than performance.now, performance.now might not be stable (changes on wall clock\n // changes), this is not an issue here as a clock change during a short running task is very\n // unlikely in case it still happened and leads to negative duration, simply assume 1 msec\n taskDuration = Math.max(1, performance.now() - taskDuration);\n longestTask = Math.max(taskDuration, longestTask);\n // Guess the following task will take a similar time to the longest task in this batch, allow\n // additional room to try avoid exceeding the deadline\n deadlineRemaining = deadline.timeRemaining();\n if (longestTask * 1.5 > deadlineRemaining) {\n // Warn when the time exceeding the deadline is over 20ms, if this happens in practice the\n // task should be split into sub-tasks to ensure the UI remains responsive.\n if (lastDeadlineRemaining - taskDuration < -20) {\n console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(lastDeadlineRemaining - taskDuration))}ms`);\n }\n this._start();\n return;\n }\n lastDeadlineRemaining = deadlineRemaining;\n }\n this.clear();\n }\n}\n\n/**\n * A queue of that runs tasks over several tasks via setTimeout, trying to maintain above 60 frames\n * per second. The tasks will run in the order they are enqueued, but they will run some time later,\n * and care should be taken to ensure they're non-urgent and will not introduce race conditions.\n */\nexport class PriorityTaskQueue extends TaskQueue {\n protected _requestCallback(callback: CallbackWithDeadline): number {\n return setTimeout(() => callback(this._createDeadline(16)));\n }\n\n protected _cancelCallback(identifier: number): void {\n clearTimeout(identifier);\n }\n\n private _createDeadline(duration: number): ITaskDeadline {\n const end = performance.now() + duration;\n return {\n timeRemaining: () => Math.max(0, end - performance.now())\n };\n }\n}\n\nclass IdleTaskQueueInternal extends TaskQueue {\n protected _requestCallback(callback: IdleRequestCallback): number {\n return requestIdleCallback(callback);\n }\n\n protected _cancelCallback(identifier: number): void {\n cancelIdleCallback(identifier);\n }\n}\n\n/**\n * A queue of that runs tasks over several idle callbacks, trying to respect the idle callback's\n * deadline given by the environment. The tasks will run in the order they are enqueued, but they\n * will run some time later, and care should be taken to ensure they're non-urgent and will not\n * introduce race conditions.\n *\n * This reverts to a {@link PriorityTaskQueue} if the environment does not support idle callbacks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdleTaskQueue = (!isNode && 'requestIdleCallback' in window) ? IdleTaskQueueInternal : PriorityTaskQueue;\n\n/**\n * An object that tracks a single debounced task that will run on the next idle frame. When called\n * multiple times, only the last set task will run.\n */\nexport class DebouncedIdleTask {\n private _queue: ITaskQueue;\n\n constructor() {\n this._queue = new IdleTaskQueue();\n }\n\n public set(task: () => boolean | void): void {\n this._queue.clear();\n this._queue.enqueue(task);\n }\n\n public flush(): void {\n this._queue.flush();\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nconst enum Constants {\n SYNCHRONIZED_OUTPUT_TIMEOUT_MS = 1000\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderer: MutableDisposable = this._register(new MutableDisposable());\n private _renderDebouncer: IRenderDebouncerWithCallback;\n private _pausedResizeTask = new DebouncedIdleTask();\n private _observerDisposable = this._register(new MutableDisposable());\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _syncOutputHandler: SynchronizedOutputHandler;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n private readonly _onRenderedViewportChange = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onRefreshRequest = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRefreshRequest = this._onRefreshRequest.event;\n\n public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }\n\n constructor(\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService decorationService: IDecorationService,\n @IBufferService bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end), this._coreBrowserService);\n this._register(this._renderDebouncer);\n\n this._syncOutputHandler = new SynchronizedOutputHandler(\n this._coreBrowserService,\n this._coreService,\n () => this._fullRefresh()\n );\n this._register(toDisposable(() => this._syncOutputHandler.dispose()));\n\n this._register(this._coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange()));\n\n this._register(bufferService.onResize(() => this._fullRefresh()));\n this._register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear()));\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n this._register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));\n\n // Do a full refresh whenever any decoration is added or removed. This may not actually result\n // in changes but since decorations should be used sparingly or added/removed all in the same\n // frame this should have minimal performance impact.\n this._register(decorationService.onDecorationRegistered(() => this._fullRefresh()));\n this._register(decorationService.onDecorationRemoved(() => this._fullRefresh()));\n\n // Clear the renderer when the a change that could affect glyphs occurs\n this._register(this._optionsService.onMultipleOptionChange([\n 'drawBoldTextInBrightColors',\n 'letterSpacing',\n 'lineHeight',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'fontWeightBold',\n 'minimumContrastRatio',\n 'rescaleOverlappingGlyphs'\n ], () => {\n this.clear();\n this.handleResize(bufferService.cols, bufferService.rows);\n this._fullRefresh();\n }));\n\n // Refresh the cursor line when the cursor changes\n this._register(this._optionsService.onMultipleOptionChange([\n 'cursorBlink',\n 'cursorStyle'\n ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, undefined, true)));\n\n this._register(themeService.onChangeColors(() => this._fullRefresh()));\n\n this._registerIntersectionObserver(this._coreBrowserService.window, screenElement);\n this._register(this._coreBrowserService.onWindowChange((w) => this._registerIntersectionObserver(w, screenElement)));\n }\n\n private _registerIntersectionObserver(w: Window & typeof globalThis, screenElement: HTMLElement): void {\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in w) {\n const observer = new w.IntersectionObserver(e => this._handleIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this._observerDisposable.value = toDisposable(() => observer.disconnect());\n }\n }\n\n private _handleIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this._pausedResizeTask.flush();\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, sync: boolean = false, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n\n if (this._coreService.decPrivateModes.synchronizedOutput) {\n this._syncOutputHandler.bufferRows(start, end);\n return;\n }\n\n const buffered = this._syncOutputHandler.flush();\n if (buffered) {\n start = Math.min(start, buffered.start);\n end = Math.max(end, buffered.end);\n }\n\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n\n if (sync) {\n this._renderRows(start, end);\n } else {\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n }\n\n private _renderRows(start: number, end: number): void {\n if (!this._renderer.value) {\n return;\n }\n\n // Skip rendering if synchronized output mode is enabled. This check must happen here\n // (in addition to refreshRows) to handle renders that were queued before the mode was enabled.\n if (this._coreService.decPrivateModes.synchronizedOutput) {\n this._syncOutputHandler.bufferRows(start, end);\n return;\n }\n\n // Since this is debounced, a resize event could have happened between the time a refresh was\n // requested and when this triggers. Clamp the values of start and end to ensure they're valid\n // given the current viewport state.\n start = Math.min(start, this._rowCount - 1);\n end = Math.min(end, this._rowCount - 1);\n\n // Render\n this._renderer.value.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n this._needsSelectionRefresh = false;\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRenderedViewportChange.fire({ start, end });\n }\n this._onRender.fire({ start, end });\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n private _handleOptionsChanged(): void {\n if (!this._renderer.value) {\n return;\n }\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n if (!this._renderer.value) {\n return;\n }\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.value.dimensions);\n }\n\n public hasRenderer(): boolean {\n return !!this._renderer.value;\n }\n\n public setRenderer(renderer: IRenderer): void {\n this._renderer.value = renderer;\n // If the value was not set, the terminal is being disposed so ignore it\n if (this._renderer.value) {\n this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, e.sync, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n return this._renderDebouncer.addRefreshCallback(callback);\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public clearTextureAtlas(): void {\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.clearTextureAtlas?.();\n this._fullRefresh();\n }\n\n public handleDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.handleDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public handleResize(cols: number, rows: number): void {\n if (!this._renderer.value) {\n return;\n }\n if (this._isPaused) {\n this._pausedResizeTask.set(() => this._renderer.value?.handleResize(cols, rows));\n } else {\n this._renderer.value.handleResize(cols, rows);\n }\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public handleCharSizeChanged(): void {\n this._renderer.value?.handleCharSizeChanged();\n }\n\n public handleBlur(): void {\n this._renderer.value?.handleBlur();\n }\n\n public handleFocus(): void {\n this._renderer.value?.handleFocus();\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer.value?.handleSelectionChanged(start, end, columnSelectMode);\n }\n\n public handleCursorMove(): void {\n this._renderer.value?.handleCursorMove();\n }\n\n public clear(): void {\n this._renderer.value?.clear();\n }\n}\n\n/**\n * Buffers row refresh requests during synchronized output mode (DEC mode 2026).\n * When the mode is disabled, the accumulated row range is flushed for rendering.\n * A safety timeout ensures rendering occurs even if the end sequence is not received.\n */\nclass SynchronizedOutputHandler {\n private _start: number = 0;\n private _end: number = 0;\n private _timeout: number | undefined;\n private _isBuffering: boolean = false;\n\n constructor(\n private readonly _coreBrowserService: ICoreBrowserService,\n private readonly _coreService: ICoreService,\n private readonly _onTimeout: () => void\n ) {}\n\n public bufferRows(start: number, end: number): void {\n if (!this._isBuffering) {\n this._start = start;\n this._end = end;\n this._isBuffering = true;\n } else {\n this._start = Math.min(this._start, start);\n this._end = Math.max(this._end, end);\n }\n\n this._timeout ??= this._coreBrowserService.window.setTimeout(() => {\n this._timeout = undefined;\n this._coreService.decPrivateModes.synchronizedOutput = false;\n this._onTimeout();\n }, Constants.SYNCHRONIZED_OUTPUT_TIMEOUT_MS);\n }\n\n public flush(): { start: number, end: number } | undefined {\n if (this._timeout !== undefined) {\n this._coreBrowserService.window.clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n if (!this._isBuffering) {\n return undefined;\n }\n\n const result = { start: this._start, end: this._end };\n this._isBuffering = false;\n return result;\n }\n\n public dispose(): void {\n if (this._timeout !== undefined) {\n this._coreBrowserService.window.clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(startY, bufferService), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line?.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(currentRow: number, bufferService: IBufferService): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line?.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line?.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while ((currentCol !== endCol || currentRow !== endRow) &&\n currentRow >= 0 &&\n currentRow < bufferService.buffer.lines.length) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param str The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n // Ensure the trailing EOL isn't included when the selection ends on the right edge\n if (startPlusLength % this._bufferService.cols === 0) {\n return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];\n }\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n // Keep the whole wrapped word/line selected if the content wraps multiple lines\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @returns Whether a refresh is necessary.\n */\n public handleTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange } from '@xterm/xterm';\n\nexport function getRangeLength(range: IBufferRange, bufferCols: number): number {\n if (range.start.y > range.end.y) {\n throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);\n }\n return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport * as Browser from 'common/Platform';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport { getRangeLength } from 'common/buffer/BufferRange';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private readonly _onLinuxMouseSelection = this._register(new Emitter());\n public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n private readonly _onRedrawRequest = this._register(new Emitter());\n public readonly onRequestRedraw = this._onRedrawRequest.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _linkifier: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._handleMouseMove(event as MouseEvent);\n this._mouseUpListener = event => this._handleMouseUp(event as MouseEvent);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));\n this._register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n\n this._register(toDisposable(() => {\n this._removeMouseDownListeners();\n }));\n\n // Clear selection when resizing vertically. This experience could be improved, this is the\n // simple option to fix the buggy behavior. https://github.com/xtermjs/xterm.js/issues/5300\n this._register(this._bufferService.onResize(e => {\n if (e.rowsChanged) {\n this.clearSelection();\n }\n }));\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n // For column selection it's not enough to rely on final selection's swapping of reversed\n // values, it also needs the x coordinates to swap independently of the y coordinate is needed\n const startCol = start[0] < end[0] ? start[0] : end[0];\n const endCol = start[0] < end[0] ? end[0] : start[0];\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, startCol, endCol);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine?.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n public isCellInSelection(x: number, y: number): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return this._areCoordsInSelection([x, y], start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent, allowWhitespaceOnlySelection: boolean): boolean {\n // Check if there is a link under the cursor first and select that if so\n const range = this._linkifier.currentLink?.link?.range;\n if (range) {\n this._model.selectionStart = [range.start.x - 1, range.start.y - 1];\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n this._model.selectionEnd = undefined;\n return true;\n }\n\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, allowWhitespaceOnlySelection);\n this._model.selectionEnd = undefined;\n return true;\n }\n return false;\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _handleTrim(amount: number): void {\n const needsRefresh = this._model.handleTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(this._coreBrowserService.window, event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.css.canvas.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public handleMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._handleIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._handleSingleClick(event);\n } else if (event.detail === 2) {\n this._handleDoubleClick(event);\n } else if (event.detail === 3) {\n this._handleTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _handleIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _handleSingleClick(event: MouseEvent): void {\n // Track if there was a selection before clearing\n const hadSelection = this.hasSelection;\n\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Fire selection change event if a selection was cleared\n if (hadSelection) {\n this._fireOnSelectionChange(this._model.finalSelectionStart, this._model.finalSelectionEnd, false);\n }\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current word.\n * @param event The mouse event.\n */\n private _handleDoubleClick(event: MouseEvent): void {\n if (this._selectWordAtCursor(event, true)) {\n this._activeSelectionMode = SelectionMode.WORD;\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _handleTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _handleMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n if (this._model.selectionEnd[0] < this._bufferService.cols) {\n this._model.selectionEnd[0]++;\n }\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _handleMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.rawOptions.altClickMovesCursor) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _handleBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._handleTrim(amount));\n }\n\n /**\n * Converts a viewport column (0 to cols - 1) to the character index on the\n * buffer line, the latter takes into account wide and null characters.\n * @param bufferLine The buffer line to use.\n * @param x The x index in the buffer line to convert.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, x: number): number {\n let charIndex = x;\n for (let i = 0; x >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && x !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n this._fireEventIfSelectionChanged();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n if (this._selectWordAtCursor(ev, false)) {\n this.refresh(true);\n }\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords[0]);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine?.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param cell The cell to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.rawOptions.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n const range: IBufferRange = {\n start: { x: 0, y: wrappedRange.first },\n end: { x: this._bufferService.cols - 1, y: wrappedRange.last }\n };\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = undefined;\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class TwoKeyMap {\n private _data: { [bg: string | number]: { [fg: string | number]: TValue | undefined } | undefined } = {};\n\n public set(first: TFirst, second: TSecond, value: TValue): void {\n if (!this._data[first]) {\n this._data[first] = {};\n }\n this._data[first as string | number]![second] = value;\n }\n\n public get(first: TFirst, second: TSecond): TValue | undefined {\n return this._data[first as string | number] ? this._data[first as string | number]![second] : undefined;\n }\n\n public clear(): void {\n this._data = {};\n }\n}\n\nexport class FourKeyMap {\n private _data: TwoKeyMap> = new TwoKeyMap();\n\n public set(first: TFirst, second: TSecond, third: TThird, fourth: TFourth, value: TValue): void {\n if (!this._data.get(first, second)) {\n this._data.set(first, second, new TwoKeyMap());\n }\n this._data.get(first, second)!.set(third, fourth, value);\n }\n\n public get(first: TFirst, second: TSecond, third: TThird, fourth: TFourth): TValue | undefined {\n return this._data.get(first, second)?.get(third, fourth);\n }\n\n public clear(): void {\n this._data.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorContrastCache } from 'browser/Types';\nimport { IColor } from 'common/Types';\nimport { TwoKeyMap } from 'common/MultiKeyMap';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: TwoKeyMap = new TwoKeyMap();\n private _css: TwoKeyMap = new TwoKeyMap();\n\n public setCss(bg: number, fg: number, value: string | null): void {\n this._css.set(bg, fg, value);\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._css.get(bg, fg);\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n this._color.set(bg, fg, value);\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color.get(bg, fg);\n }\n\n public clear(): void {\n this._color.clear();\n this._css.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';\nimport { channels, css } from 'common/Color';\nimport type { IEvent } from 'common/Event';\n\n/**\n * A portion of the public API that are implemented identially internally and simply passed through.\n */\ntype InternalPassthroughApis = Omit;\n\nexport interface ITerminal extends InternalPassthroughApis, ICoreTerminal {\n screenElement: HTMLElement | undefined;\n browser: IBrowser;\n buffer: IBuffer;\n linkifier: ILinkifier2 | undefined;\n options: Required;\n\n readonly dimensions: IRenderDimensionsApi | undefined;\n\n onBlur: IEvent;\n onFocus: IEvent;\n onDimensionsChange: IEvent;\n onA11yChar: IEvent;\n onA11yTab: IEvent;\n onWillOpen: IEvent;\n}\n\nexport type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;\nexport type CustomWheelEventHandler = (event: WheelEvent) => boolean;\n\nexport type LineData = CharData[];\n\nexport interface ICompositionHelper {\n readonly isComposing: boolean;\n compositionstart(): void;\n compositionupdate(ev: CompositionEvent): void;\n compositionend(): void;\n updateCompositionElements(dontRecurse?: boolean): void;\n keydown(ev: KeyboardEvent): boolean;\n}\n\nexport interface IBrowser {\n isNode: boolean;\n userAgent: string;\n platform: string;\n isFirefox: boolean;\n isMac: boolean;\n isIpad: boolean;\n isIphone: boolean;\n isWindows: boolean;\n}\n\nexport interface IColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n cursorAccent: IColor;\n selectionForeground: IColor | undefined;\n selectionBackgroundTransparent: IColor;\n /** The selection blended on top of background. */\n selectionBackgroundOpaque: IColor;\n selectionInactiveBackgroundTransparent: IColor;\n selectionInactiveBackgroundOpaque: IColor;\n scrollbarSliderBackground: IColor;\n scrollbarSliderHoverBackground: IColor;\n scrollbarSliderActiveBackground: IColor;\n overviewRulerBorder: IColor;\n ansi: IColor[];\n /** Maps original colors to colors that respect minimum contrast ratio. */\n contrastCache: IColorContrastCache;\n /** Maps original colors to colors that respect _half_ of the minimum contrast ratio. */\n halfContrastCache: IColorContrastCache;\n}\n\nexport type ReadonlyColorSet = Readonly> & { ansi: Readonly['ansi']> };\n\nexport interface IColorContrastCache {\n clear(): void;\n setCss(bg: number, fg: number, value: string | null): void;\n getCss(bg: number, fg: number): string | null | undefined;\n setColor(bg: number, fg: number, value: IColor | null): void;\n getColor(bg: number, fg: number): IColor | null | undefined;\n}\n\nexport interface IPartialColorSet {\n foreground: IColor;\n background: IColor;\n cursor?: IColor;\n cursorAccent?: IColor;\n selectionBackground?: IColor;\n ansi: IColor[];\n}\n\nexport interface IViewport extends IDisposable {\n scrollBarWidth: number;\n readonly onRequestScrollLines: IEvent<{ amount: number, suppressScrollEvent: boolean }>;\n syncScrollArea(immediate?: boolean, force?: boolean): void;\n getLinesScrolled(ev: WheelEvent): number;\n getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };\n handleWheel(ev: WheelEvent): boolean;\n handleTouchStart(ev: TouchEvent): void;\n handleTouchMove(ev: TouchEvent): boolean;\n scrollLines(disp: number): void; // todo api name?\n reset(): void;\n}\n\nexport interface ILinkifierEvent {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n cols: number;\n fg: number | undefined;\n}\n\ninterface ILinkState {\n decorations: ILinkDecorations;\n isHovered: boolean;\n}\nexport interface ILinkWithState {\n link: ILink;\n state?: ILinkState;\n}\n\nexport interface ILinkifier2 extends IDisposable {\n onShowLinkUnderline: IEvent;\n onHideLinkUnderline: IEvent;\n readonly currentLink: ILinkWithState | undefined;\n}\n\nexport interface ILink {\n range: IBufferRange;\n text: string;\n decorations?: ILinkDecorations;\n activate(event: MouseEvent, text: string): void;\n hover?(event: MouseEvent, text: string): void;\n leave?(event: MouseEvent, text: string): void;\n dispose?(): void;\n}\n\nexport interface ILinkDecorations {\n pointerCursor: boolean;\n underline: boolean;\n}\n\nexport interface IBufferRange {\n start: IBufferCellPosition;\n end: IBufferCellPosition;\n}\n\nexport interface IBufferCellPosition {\n x: number;\n y: number;\n}\n\nexport type CharacterJoinerHandler = (text: string) => [number, number][];\n\nexport interface ICharacterJoiner {\n id: number;\n handler: CharacterJoinerHandler;\n}\n\nexport interface IRenderDebouncer extends IDisposable {\n refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void;\n}\n\nexport interface IRenderDebouncerWithCallback extends IRenderDebouncer {\n addRefreshCallback(callback: FrameRequestCallback): number;\n}\n\nexport interface IBufferElementProvider {\n provideBufferElements(): DocumentFragment | HTMLElement;\n}\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\n css.toColor('#2e3436'),\n css.toColor('#cc0000'),\n css.toColor('#4e9a06'),\n css.toColor('#c4a000'),\n css.toColor('#3465a4'),\n css.toColor('#75507b'),\n css.toColor('#06989a'),\n css.toColor('#d3d7cf'),\n // bright:\n css.toColor('#555753'),\n css.toColor('#ef2929'),\n css.toColor('#8ae234'),\n css.toColor('#fce94f'),\n css.toColor('#729fcf'),\n css.toColor('#ad7fa8'),\n css.toColor('#34e2e2'),\n css.toColor('#eeeeec')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\nimport { IThemeService } from 'browser/services/Services';\nimport { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { color, css, NULL_COLOR } from 'common/Color';\nimport { Disposable } from 'common/Lifecycle';\nimport { IOptionsService, ITheme } from 'common/services/Services';\nimport { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';\nimport { Emitter } from 'common/Event';\n\ninterface IRestoreColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n ansi: IColor[];\n}\n\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\nconst DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;\n\nexport class ThemeService extends Disposable implements IThemeService {\n public serviceBrand: undefined;\n\n private _colors: IColorSet;\n private _contrastCache: IColorContrastCache = new ColorContrastCache();\n private _halfContrastCache: IColorContrastCache = new ColorContrastCache();\n private _restoreColors!: IRestoreColorSet;\n\n public get colors(): ReadonlyColorSet { return this._colors; }\n\n private readonly _onChangeColors = this._register(new Emitter());\n public readonly onChangeColors = this._onChangeColors.event;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this._colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionForeground: undefined,\n selectionBackgroundTransparent: DEFAULT_SELECTION,\n selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,\n selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),\n scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),\n scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),\n overviewRulerBorder: DEFAULT_FOREGROUND,\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache,\n halfContrastCache: this._halfContrastCache\n };\n this._updateRestoreColors();\n this._setTheme(this._optionsService.rawOptions.theme);\n\n this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));\n this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n private _setTheme(theme: ITheme = {}): void {\n const colors = this._colors;\n colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);\n colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);\n colors.cursor = color.blend(colors.background, parseColor(theme.cursor, DEFAULT_CURSOR));\n colors.cursorAccent = color.blend(colors.background, parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT));\n colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);\n colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);\n colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;\n if (colors.selectionForeground === NULL_COLOR) {\n colors.selectionForeground = undefined;\n }\n\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(colors.selectionBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);\n }\n if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);\n }\n colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));\n colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));\n colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));\n colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);\n colors.ansi = DEFAULT_ANSI_COLORS.slice();\n colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n if (theme.extendedAnsi) {\n const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);\n for (let i = 0; i < colorCount; i++) {\n colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);\n }\n }\n // Clear our the cache\n this._contrastCache.clear();\n this._halfContrastCache.clear();\n this._updateRestoreColors();\n this._onChangeColors.fire(this.colors);\n }\n\n public restoreColor(slot?: AllColorIndex): void {\n this._restoreColor(slot);\n this._onChangeColors.fire(this.colors);\n }\n\n private _restoreColor(slot: AllColorIndex | undefined): void {\n // unset slot restores all ansi colors\n if (slot === undefined) {\n for (let i = 0; i < this._restoreColors.ansi.length; ++i) {\n this._colors.ansi[i] = this._restoreColors.ansi[i];\n }\n return;\n }\n switch (slot) {\n case SpecialColorIndex.FOREGROUND:\n this._colors.foreground = this._restoreColors.foreground;\n break;\n case SpecialColorIndex.BACKGROUND:\n this._colors.background = this._restoreColors.background;\n break;\n case SpecialColorIndex.CURSOR:\n this._colors.cursor = this._restoreColors.cursor;\n break;\n default:\n this._colors.ansi[slot] = this._restoreColors.ansi[slot];\n }\n }\n\n public modifyColors(callback: (colors: IColorSet) => void): void {\n callback(this._colors);\n // Assume the change happened\n this._onChangeColors.fire(this.colors);\n }\n\n private _updateRestoreColors(): void {\n this._restoreColors = {\n foreground: this._colors.foreground,\n background: this._colors.background,\n cursor: this._colors.cursor,\n ansi: this._colors.ansi.slice()\n };\n }\n}\n\nfunction parseColor(\n cssString: string | undefined,\n fallback: IColor\n): IColor {\n if (cssString !== undefined) {\n try {\n return css.toColor(cssString);\n } catch {\n // no-op\n }\n }\n return fallback;\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n result.key = ev.ctrlKey ? '\\b' : C0.DEL; // ^H or ^?\n if (ev.altKey) {\n result.key = C0.ESC + result.key;\n }\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[5;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[6;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.key === '/') {\n result.key = C0.US; // https://github.com/xtermjs/xterm.js/issues/5457\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping?.[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n let keyString = String.fromCharCode(keyCode);\n if (ev.shiftKey) {\n keyString = keyString.toUpperCase();\n }\n result.key = C0.ESC + keyString;\n } else if (ev.keyCode === 32) {\n result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');\n } else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {\n // Reference: https://github.com/xtermjs/xterm.js/issues/3725\n // Alt will produce a \"dead key\" (initate composition) with some\n // of the letters in US layout (e.g. N/E/U).\n // It's safe to match against Key* since no other `code` values begin with \"Key\".\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values#code_values_on_mac\n let keyString = ev.code.slice(3, 4);\n if (!ev.shiftKey) {\n keyString = keyString.toLowerCase();\n }\n result.key = C0.ESC + keyString;\n result.cancel = true;\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock,\n // volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey && ev.shiftKey) {\n switch (ev.code) {\n case 'Minus': result.key = C0.US; break; // ^_ (Ctrl+Shift+-_\n case 'Digit2': result.key = C0.NUL; break; // ^@ (Ctrl+Shift+2)\n case 'Digit6': result.key = C0.RS; break; // ^^ (Ctrl+Shift+6)\n }\n }\n break;\n }\n\n return result;\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Kitty keyboard protocol implementation.\n * @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n/**\n * Kitty keyboard protocol enhancement flags (bitfield).\n */\nexport const enum KittyKeyboardFlags {\n NONE = 0b00000,\n /** Disambiguate escape codes - fixes ambiguous legacy encodings */\n DISAMBIGUATE_ESCAPE_CODES = 0b00001,\n /** Report event types - press/repeat/release */\n REPORT_EVENT_TYPES = 0b00010,\n /** Report alternate keys - shifted key and base layout key */\n REPORT_ALTERNATE_KEYS = 0b00100,\n /** Report all keys as escape codes - text-producing keys as CSI u */\n REPORT_ALL_KEYS_AS_ESCAPE_CODES = 0b01000,\n /** Report associated text - includes text codepoints in escape code */\n REPORT_ASSOCIATED_TEXT = 0b10000,\n}\n\n/**\n * Kitty keyboard event types.\n */\nexport const enum KittyKeyboardEventType {\n PRESS = 1,\n REPEAT = 2,\n RELEASE = 3,\n}\n\n/**\n * Kitty modifier bits (different from xterm modifier encoding).\n * Value sent = 1 + modifier_bits\n */\nexport const enum KittyKeyboardModifiers {\n SHIFT = 0b00000001,\n ALT = 0b00000010,\n CTRL = 0b00000100,\n SUPER = 0b00001000,\n HYPER = 0b00010000,\n META = 0b00100000,\n CAPS_LOCK = 0b01000000,\n NUM_LOCK = 0b10000000,\n}\n\n/**\n * Kitty keyboard protocol handler class.\n * Encapsulates all key code mappings and encoding logic.\n */\nexport class KittyKeyboard {\n /**\n * Functional key codes for Kitty protocol.\n * Keys that don't produce text have specific unicode codepoint mappings.\n */\n private readonly _functionalKeyCodes: { [key: string]: number } = {\n 'Escape': 27,\n 'Enter': 13,\n 'Tab': 9,\n 'Backspace': 127,\n 'CapsLock': 57358,\n 'ScrollLock': 57359,\n 'NumLock': 57360,\n 'PrintScreen': 57361,\n 'Pause': 57362,\n 'ContextMenu': 57363,\n // F13-F35 (F1-F12 use legacy encoding)\n 'F13': 57376,\n 'F14': 57377,\n 'F15': 57378,\n 'F16': 57379,\n 'F17': 57380,\n 'F18': 57381,\n 'F19': 57382,\n 'F20': 57383,\n 'F21': 57384,\n 'F22': 57385,\n 'F23': 57386,\n 'F24': 57387,\n 'F25': 57388,\n // Keypad keys\n 'KP_0': 57399,\n 'KP_1': 57400,\n 'KP_2': 57401,\n 'KP_3': 57402,\n 'KP_4': 57403,\n 'KP_5': 57404,\n 'KP_6': 57405,\n 'KP_7': 57406,\n 'KP_8': 57407,\n 'KP_9': 57408,\n 'KP_Decimal': 57409,\n 'KP_Divide': 57410,\n 'KP_Multiply': 57411,\n 'KP_Subtract': 57412,\n 'KP_Add': 57413,\n 'KP_Enter': 57414,\n 'KP_Equal': 57415,\n // Modifier keys\n 'ShiftLeft': 57441,\n 'ShiftRight': 57447,\n 'ControlLeft': 57442,\n 'ControlRight': 57448,\n 'AltLeft': 57443,\n 'AltRight': 57449,\n 'MetaLeft': 57444,\n 'MetaRight': 57450,\n // Media keys\n 'MediaPlayPause': 57430,\n 'MediaStop': 57432,\n 'MediaTrackNext': 57435,\n 'MediaTrackPrevious': 57436,\n 'AudioVolumeDown': 57438,\n 'AudioVolumeUp': 57439,\n 'AudioVolumeMute': 57440\n };\n\n /**\n * Keys that use CSI ~ encoding with a number parameter.\n */\n private readonly _csiTildeKeys: { [key: string]: number } = {\n 'Insert': 2,\n 'Delete': 3,\n 'PageUp': 5,\n 'PageDown': 6,\n 'F5': 15,\n 'F6': 17,\n 'F7': 18,\n 'F8': 19,\n 'F9': 20,\n 'F10': 21,\n 'F11': 23,\n 'F12': 24\n };\n\n /**\n * Keys that use CSI letter encoding (arrows, Home, End).\n */\n private readonly _csiLetterKeys: { [key: string]: string } = {\n 'ArrowUp': 'A',\n 'ArrowDown': 'B',\n 'ArrowRight': 'C',\n 'ArrowLeft': 'D',\n 'Home': 'H',\n 'End': 'F'\n };\n\n /**\n * Function keys F1-F4 use SS3 encoding without modifiers.\n */\n private readonly _ss3FunctionKeys: { [key: string]: string } = {\n 'F1': 'P',\n 'F2': 'Q',\n 'F3': 'R',\n 'F4': 'S'\n };\n\n /**\n * Map browser key codes to Kitty numpad codes.\n */\n private _getNumpadKeyCode(ev: IKeyboardEvent): number | undefined {\n if (ev.code.startsWith('Numpad')) {\n const suffix = ev.code.slice(6);\n if (suffix >= '0' && suffix <= '9') {\n return 57399 + parseInt(suffix, 10);\n }\n switch (suffix) {\n case 'Decimal': return 57409;\n case 'Divide': return 57410;\n case 'Multiply': return 57411;\n case 'Subtract': return 57412;\n case 'Add': return 57413;\n case 'Enter': return 57414;\n case 'Equal': return 57415;\n }\n }\n return undefined;\n }\n\n /**\n * Get modifier key code from code property.\n */\n private _getModifierKeyCode(ev: IKeyboardEvent): number | undefined {\n switch (ev.code) {\n case 'ShiftLeft': return 57441;\n case 'ShiftRight': return 57447;\n case 'ControlLeft': return 57442;\n case 'ControlRight': return 57448;\n case 'AltLeft': return 57443;\n case 'AltRight': return 57449;\n case 'MetaLeft': return 57444;\n case 'MetaRight': return 57450;\n }\n return undefined;\n }\n\n /**\n * Encode modifiers for Kitty protocol.\n * Returns 1 + modifier bits, or 0 if no modifiers.\n */\n private _encodeModifiers(ev: IKeyboardEvent): number {\n let mods = 0;\n if (ev.shiftKey) mods |= KittyKeyboardModifiers.SHIFT;\n if (ev.altKey) mods |= KittyKeyboardModifiers.ALT;\n if (ev.ctrlKey) mods |= KittyKeyboardModifiers.CTRL;\n if (ev.metaKey) mods |= KittyKeyboardModifiers.SUPER;\n return mods > 0 ? mods + 1 : 0;\n }\n\n /**\n * Get the unicode key code for a keyboard event.\n * Returns the lowercase codepoint for letters.\n * For shifted keys, uses the code property to get the base key.\n */\n private _getKeyCode(ev: IKeyboardEvent): number | undefined {\n const numpadCode = this._getNumpadKeyCode(ev);\n if (numpadCode !== undefined) {\n return numpadCode;\n }\n\n const modifierCode = this._getModifierKeyCode(ev);\n if (modifierCode !== undefined) {\n return modifierCode;\n }\n\n const funcCode = this._functionalKeyCodes[ev.key];\n if (funcCode !== undefined) {\n return funcCode;\n }\n\n if (ev.shiftKey && ev.code) {\n if (ev.code.startsWith('Digit') && ev.code.length === 6) {\n const digit = ev.code.charAt(5);\n if (digit >= '0' && digit <= '9') {\n return digit.charCodeAt(0);\n }\n }\n if (ev.code.startsWith('Key') && ev.code.length === 4) {\n const letter = ev.code.charAt(3).toLowerCase();\n return letter.charCodeAt(0);\n }\n }\n\n if (ev.key.length === 1) {\n const code = ev.key.codePointAt(0)!;\n if (code >= 65 && code <= 90) {\n return code + 32;\n }\n return code;\n }\n\n return undefined;\n }\n\n /**\n * Check if a key is a modifier key.\n */\n private _isModifierKey(ev: IKeyboardEvent): boolean {\n return ev.key === 'Shift' || ev.key === 'Control' || ev.key === 'Alt' || ev.key === 'Meta';\n }\n\n /**\n * Build CSI letter sequence for arrow keys, Home, End.\n * Format: CSI [1;mod] letter\n */\n private _buildCsiLetterSequence(\n letter: string,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n if (modifiers > 0 || needsEventType) {\n let seq = C0.ESC + '[1;' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n seq += letter;\n return seq;\n }\n return C0.ESC + '[' + letter;\n }\n\n /**\n * Build SS3 sequence for F1-F4.\n * Without modifiers: SS3 letter\n * With modifiers: CSI 1;mod letter\n */\n private _buildSs3Sequence(\n letter: string,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n if (modifiers > 0 || needsEventType) {\n let seq = C0.ESC + '[1;' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n seq += letter;\n return seq;\n }\n return C0.ESC + 'O' + letter;\n }\n\n /**\n * Build CSI ~ sequence for Insert, Delete, PageUp/Down, F5-F12.\n * Format: CSI number [;mod[:event]] ~\n */\n private _buildCsiTildeSequence(\n number: number,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n let seq = C0.ESC + '[' + number;\n if (modifiers > 0 || needsEventType) {\n seq += ';' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n }\n seq += '~';\n return seq;\n }\n\n /**\n * Build CSI u sequence.\n * Format: CSI keycode[:shifted[:base]] [;mod[:event][;text]] u\n */\n private _buildCsiUSequence(\n ev: IKeyboardEvent,\n keyCode: number,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n flags: number,\n isFunc: boolean,\n isMod: boolean\n ): string {\n const reportEventTypes = !!(flags & KittyKeyboardFlags.REPORT_EVENT_TYPES);\n const reportAlternateKeys = !!(flags & KittyKeyboardFlags.REPORT_ALTERNATE_KEYS);\n\n let seq = C0.ESC + '[' + keyCode;\n\n let shiftedKey: number | undefined;\n if (reportAlternateKeys && ev.shiftKey && ev.key.length === 1 && !isFunc && !isMod) {\n shiftedKey = ev.key.codePointAt(0);\n seq += ':' + shiftedKey;\n }\n\n const reportAssociatedText = !!(flags & KittyKeyboardFlags.REPORT_ASSOCIATED_TEXT) &&\n eventType !== KittyKeyboardEventType.RELEASE &&\n ev.key.length === 1 &&\n !isFunc &&\n !isMod &&\n !ev.ctrlKey;\n const textCode = reportAssociatedText ? ev.key.codePointAt(0) : undefined;\n\n const needsEventType = reportEventTypes &&\n eventType !== KittyKeyboardEventType.PRESS &&\n (eventType === KittyKeyboardEventType.RELEASE || textCode === undefined);\n\n if (modifiers > 0 || needsEventType || textCode !== undefined) {\n seq += ';';\n if (modifiers > 0) {\n seq += modifiers;\n } else if (needsEventType) {\n seq += '1';\n }\n if (needsEventType) {\n seq += ':' + eventType;\n }\n }\n\n if (textCode !== undefined) {\n seq += ';' + textCode;\n }\n\n seq += 'u';\n return seq;\n }\n\n /**\n * Evaluate a keyboard event using Kitty keyboard protocol.\n *\n * @param ev The keyboard event.\n * @param flags The active Kitty keyboard enhancement flags.\n * @param eventType The event type (press, repeat, release).\n * @returns The keyboard result with the encoded key sequence.\n */\n public evaluate(\n ev: IKeyboardEvent,\n flags: number,\n eventType: KittyKeyboardEventType = KittyKeyboardEventType.PRESS\n ): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n cancel: false,\n key: undefined\n };\n\n const modifiers = this._encodeModifiers(ev);\n const isMod = this._isModifierKey(ev);\n const reportEventTypes = !!(flags & KittyKeyboardFlags.REPORT_EVENT_TYPES);\n\n if (!reportEventTypes && eventType === KittyKeyboardEventType.RELEASE) {\n return result;\n }\n\n if (isMod && !(flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES) && !reportEventTypes) {\n return result;\n }\n\n const csiLetter = this._csiLetterKeys[ev.key];\n if (csiLetter) {\n result.key = this._buildCsiLetterSequence(csiLetter, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const ss3Letter = this._ss3FunctionKeys[ev.key];\n if (ss3Letter) {\n result.key = this._buildSs3Sequence(ss3Letter, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const tildeCode = this._csiTildeKeys[ev.key];\n if (tildeCode !== undefined) {\n result.key = this._buildCsiTildeSequence(tildeCode, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const keyCode = this._getKeyCode(ev);\n if (keyCode === undefined) {\n return result;\n }\n\n const isFunc = this._functionalKeyCodes[ev.key] !== undefined || this._getNumpadKeyCode(ev) !== undefined;\n\n let useCsiU = false;\n\n if (flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES) {\n useCsiU = true;\n } else if (reportEventTypes) {\n useCsiU = true;\n } else if (flags & KittyKeyboardFlags.DISAMBIGUATE_ESCAPE_CODES) {\n if (keyCode === 27 || keyCode === 127 || keyCode === 13 || keyCode === 9 || keyCode === 32) {\n useCsiU = true;\n } else if (isFunc) {\n useCsiU = true;\n } else if (modifiers > 0) {\n if (ev.shiftKey && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.key.length === 1) {\n useCsiU = false;\n } else {\n useCsiU = true;\n }\n }\n }\n\n if (useCsiU) {\n result.key = this._buildCsiUSequence(ev, keyCode, modifiers, eventType, flags, isFunc, isMod);\n result.cancel = true;\n } else {\n if (ev.key.length === 1 && !ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n result.key = ev.key;\n }\n }\n\n return result;\n }\n\n /**\n * Check if Kitty protocol should be used based on flags.\n */\n public static shouldUseProtocol(flags: number): boolean {\n return flags > 0;\n }\n}\n", "/**\n * Copyright (c) 2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Win32 input mode implementation.\n * @see https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md\n *\n * Format: CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _\n * Vk: Virtual key code (decimal)\n * Sc: Scan code (decimal)\n * Uc: Unicode character (decimal codepoint, 0 if none)\n * Kd: Key down (1) or up (0)\n * Cs: Control key state (modifier flags)\n * Rc: Repeat count (usually 1)\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n/**\n * Win32 control key state flags (from Windows API).\n */\nexport const enum Win32ControlKeyState {\n RIGHT_ALT_PRESSED = 0b000000001,\n LEFT_ALT_PRESSED = 0b000000010,\n RIGHT_CTRL_PRESSED = 0b000000100,\n LEFT_CTRL_PRESSED = 0b000001000,\n SHIFT_PRESSED = 0b000010000,\n NUMLOCK_ON = 0b000100000,\n SCROLLLOCK_ON = 0b001000000,\n CAPSLOCK_ON = 0b010000000,\n ENHANCED_KEY = 0b100000000,\n}\n\n/**\n * Win32 input mode handler. Lookup tables are only initialized when this class\n * is instantiated, reducing bundle size for environments that don't use this mode.\n */\nexport class Win32InputMode {\n /**\n * Mapping from browser KeyboardEvent.code to Win32 virtual key codes.\n * Based on https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes\n */\n private readonly _codeToVk: { [code: string]: number } = {\n // Letters\n 'KeyA': 0x41, 'KeyB': 0x42, 'KeyC': 0x43, 'KeyD': 0x44, 'KeyE': 0x45,\n 'KeyF': 0x46, 'KeyG': 0x47, 'KeyH': 0x48, 'KeyI': 0x49, 'KeyJ': 0x4A,\n 'KeyK': 0x4B, 'KeyL': 0x4C, 'KeyM': 0x4D, 'KeyN': 0x4E, 'KeyO': 0x4F,\n 'KeyP': 0x50, 'KeyQ': 0x51, 'KeyR': 0x52, 'KeyS': 0x53, 'KeyT': 0x54,\n 'KeyU': 0x55, 'KeyV': 0x56, 'KeyW': 0x57, 'KeyX': 0x58, 'KeyY': 0x59,\n 'KeyZ': 0x5A,\n\n // Digits\n 'Digit0': 0x30, 'Digit1': 0x31, 'Digit2': 0x32, 'Digit3': 0x33, 'Digit4': 0x34,\n 'Digit5': 0x35, 'Digit6': 0x36, 'Digit7': 0x37, 'Digit8': 0x38, 'Digit9': 0x39,\n\n // Function keys\n 'F1': 0x70, 'F2': 0x71, 'F3': 0x72, 'F4': 0x73, 'F5': 0x74, 'F6': 0x75,\n 'F7': 0x76, 'F8': 0x77, 'F9': 0x78, 'F10': 0x79, 'F11': 0x7A, 'F12': 0x7B,\n 'F13': 0x7C, 'F14': 0x7D, 'F15': 0x7E, 'F16': 0x7F, 'F17': 0x80, 'F18': 0x81,\n 'F19': 0x82, 'F20': 0x83, 'F21': 0x84, 'F22': 0x85, 'F23': 0x86, 'F24': 0x87,\n\n // Numpad\n 'Numpad0': 0x60, 'Numpad1': 0x61, 'Numpad2': 0x62, 'Numpad3': 0x63, 'Numpad4': 0x64,\n 'Numpad5': 0x65, 'Numpad6': 0x66, 'Numpad7': 0x67, 'Numpad8': 0x68, 'Numpad9': 0x69,\n 'NumpadMultiply': 0x6A, 'NumpadAdd': 0x6B, 'NumpadSeparator': 0x6C,\n 'NumpadSubtract': 0x6D, 'NumpadDecimal': 0x6E, 'NumpadDivide': 0x6F,\n 'NumpadEnter': 0x0D, // Same as Enter but with ENHANCED_KEY flag\n 'NumLock': 0x90,\n\n // Navigation\n 'ArrowUp': 0x26, 'ArrowDown': 0x28, 'ArrowLeft': 0x25, 'ArrowRight': 0x27,\n 'Home': 0x24, 'End': 0x23, 'PageUp': 0x21, 'PageDown': 0x22,\n 'Insert': 0x2D, 'Delete': 0x2E,\n\n // Modifiers\n 'ShiftLeft': 0x10, 'ShiftRight': 0x10,\n 'ControlLeft': 0x11, 'ControlRight': 0x11,\n 'AltLeft': 0x12, 'AltRight': 0x12,\n 'MetaLeft': 0x5B, 'MetaRight': 0x5C,\n 'CapsLock': 0x14, 'ScrollLock': 0x91,\n\n // Special keys\n 'Escape': 0x1B, 'Enter': 0x0D, 'Tab': 0x09, 'Space': 0x20,\n 'Backspace': 0x08, 'Pause': 0x13, 'ContextMenu': 0x5D, 'PrintScreen': 0x2C,\n\n // OEM keys (US keyboard layout)\n 'Semicolon': 0xBA, // ;:\n 'Equal': 0xBB, // =+\n 'Comma': 0xBC, // ,<\n 'Minus': 0xBD, // -_\n 'Period': 0xBE, // .>\n 'Slash': 0xBF, // /?\n 'Backquote': 0xC0, // `~\n 'BracketLeft': 0xDB, // [{\n 'Backslash': 0xDC, // \\|\n 'BracketRight': 0xDD, // ]}\n 'Quote': 0xDE, // '\"\n 'IntlBackslash': 0xE2 // Non-US backslash\n };\n\n /**\n * Mapping from browser KeyboardEvent.code to approximate Win32 scan codes.\n * Note: Scan codes can vary by keyboard layout. These are approximations\n * based on standard US keyboard layout.\n */\n private readonly _codeToScancode: { [code: string]: number } = {\n // Letters (row by row)\n 'KeyQ': 0x10, 'KeyW': 0x11, 'KeyE': 0x12, 'KeyR': 0x13, 'KeyT': 0x14,\n 'KeyY': 0x15, 'KeyU': 0x16, 'KeyI': 0x17, 'KeyO': 0x18, 'KeyP': 0x19,\n 'KeyA': 0x1E, 'KeyS': 0x1F, 'KeyD': 0x20, 'KeyF': 0x21, 'KeyG': 0x22,\n 'KeyH': 0x23, 'KeyJ': 0x24, 'KeyK': 0x25, 'KeyL': 0x26,\n 'KeyZ': 0x2C, 'KeyX': 0x2D, 'KeyC': 0x2E, 'KeyV': 0x2F, 'KeyB': 0x30,\n 'KeyN': 0x31, 'KeyM': 0x32,\n\n // Digits\n 'Digit1': 0x02, 'Digit2': 0x03, 'Digit3': 0x04, 'Digit4': 0x05, 'Digit5': 0x06,\n 'Digit6': 0x07, 'Digit7': 0x08, 'Digit8': 0x09, 'Digit9': 0x0A, 'Digit0': 0x0B,\n\n // Function keys\n 'F1': 0x3B, 'F2': 0x3C, 'F3': 0x3D, 'F4': 0x3E, 'F5': 0x3F, 'F6': 0x40,\n 'F7': 0x41, 'F8': 0x42, 'F9': 0x43, 'F10': 0x44, 'F11': 0x57, 'F12': 0x58,\n\n // Numpad\n 'Numpad0': 0x52, 'Numpad1': 0x4F, 'Numpad2': 0x50, 'Numpad3': 0x51, 'Numpad4': 0x4B,\n 'Numpad5': 0x4C, 'Numpad6': 0x4D, 'Numpad7': 0x47, 'Numpad8': 0x48, 'Numpad9': 0x49,\n 'NumpadMultiply': 0x37, 'NumpadAdd': 0x4E, 'NumpadSubtract': 0x4A,\n 'NumpadDecimal': 0x53, 'NumpadDivide': 0x35, 'NumpadEnter': 0x1C,\n 'NumLock': 0x45,\n\n // Navigation (extended keys)\n 'ArrowUp': 0x48, 'ArrowDown': 0x50, 'ArrowLeft': 0x4B, 'ArrowRight': 0x4D,\n 'Home': 0x47, 'End': 0x4F, 'PageUp': 0x49, 'PageDown': 0x51,\n 'Insert': 0x52, 'Delete': 0x53,\n\n // Modifiers\n 'ShiftLeft': 0x2A, 'ShiftRight': 0x36,\n 'ControlLeft': 0x1D, 'ControlRight': 0x1D,\n 'AltLeft': 0x38, 'AltRight': 0x38,\n 'CapsLock': 0x3A, 'ScrollLock': 0x46,\n\n // Special keys\n 'Escape': 0x01, 'Enter': 0x1C, 'Tab': 0x0F, 'Space': 0x39,\n 'Backspace': 0x0E, 'Pause': 0x45,\n\n // OEM keys\n 'Semicolon': 0x27, 'Equal': 0x0D, 'Comma': 0x33, 'Minus': 0x0C,\n 'Period': 0x34, 'Slash': 0x35, 'Backquote': 0x29,\n 'BracketLeft': 0x1A, 'Backslash': 0x2B, 'BracketRight': 0x1B, 'Quote': 0x28\n };\n\n /**\n * Codes that represent enhanced keys (extended keyboard keys).\n */\n private readonly _enhancedKeyCodes = new Set([\n 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',\n 'Home', 'End', 'PageUp', 'PageDown', 'Insert', 'Delete',\n 'NumpadEnter', 'NumpadDivide',\n 'ControlRight', 'AltRight',\n 'PrintScreen', 'Pause', 'ContextMenu',\n 'MetaLeft', 'MetaRight'\n ]);\n\n /**\n * Mapping of special keys (ev.key values) to their Unicode control character codes.\n * These keys have multi-character ev.key strings but produce control characters.\n * @see https://docs.microsoft.com/en-us/windows/console/key-event-record-str\n */\n private readonly _keyToControlChar: { [key: string]: number } = {\n 'Enter': 0x0D, // Carriage return\n 'Backspace': 0x08, // Backspace\n 'Tab': 0x09, // Horizontal tab\n 'Escape': 0x1B // Escape\n };\n\n /**\n * Get the Win32 virtual key code for a keyboard event.\n */\n private _getVirtualKeyCode(ev: IKeyboardEvent): number {\n const vk = this._codeToVk[ev.code];\n if (vk !== undefined) {\n return vk;\n }\n // Fall back to keyCode for unmapped keys\n return ev.keyCode || 0;\n }\n\n /**\n * Get the Win32 scan code for a keyboard event.\n * Returns 0 if unknown (scan codes vary by hardware).\n */\n private _getScanCode(ev: IKeyboardEvent): number {\n return this._codeToScancode[ev.code] || 0;\n }\n\n /**\n * Get the unicode character for a keyboard event.\n * Returns 0 for non-character keys.\n */\n private _getUnicodeChar(ev: IKeyboardEvent): number {\n // Handle special keys that produce control characters\n // Ctrl modifies some of these: Ctrl+Enter=LF, Ctrl+Backspace=DEL\n if (ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n if (ev.key === 'Enter') {\n return 0x0A; // Line feed (Ctrl+Enter)\n }\n if (ev.key === 'Backspace') {\n return 0x7F; // DEL (Ctrl+Backspace)\n }\n }\n\n // Check for special keys that always produce control characters\n const controlChar = this._keyToControlChar[ev.key];\n if (controlChar !== undefined) {\n return controlChar;\n }\n\n // Only single-character keys produce unicode output\n if (ev.key.length === 1) {\n const codePoint = ev.key.codePointAt(0) || 0;\n\n // Handle Ctrl+letter combinations - these produce control characters (0x01-0x1A)\n if (ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n // Convert A-Z or a-z to control character (Ctrl+A = 0x01, Ctrl+C = 0x03, etc.)\n if (codePoint >= 0x41 && codePoint <= 0x5A) { // A-Z\n return codePoint - 0x40;\n }\n if (codePoint >= 0x61 && codePoint <= 0x7A) { // a-z\n return codePoint - 0x60;\n }\n }\n\n return codePoint;\n }\n return 0;\n }\n\n /**\n * Get the Win32 control key state flags.\n */\n private _getControlKeyState(ev: IKeyboardEvent): number {\n let state = 0;\n\n if (ev.shiftKey) {\n state |= Win32ControlKeyState.SHIFT_PRESSED;\n }\n\n // Note: We can't distinguish left/right for ctrl/alt in standard browser events,\n // so we use the generic pressed flags. The right-side flags are used when\n // we can detect them (e.g., via code property).\n if (ev.ctrlKey) {\n if (ev.code === 'ControlRight') {\n state |= Win32ControlKeyState.RIGHT_CTRL_PRESSED;\n } else {\n state |= Win32ControlKeyState.LEFT_CTRL_PRESSED;\n }\n }\n\n if (ev.altKey) {\n if (ev.code === 'AltRight') {\n state |= Win32ControlKeyState.RIGHT_ALT_PRESSED;\n } else {\n state |= Win32ControlKeyState.LEFT_ALT_PRESSED;\n }\n }\n\n // Check for enhanced key\n if (this._enhancedKeyCodes.has(ev.code)) {\n state |= Win32ControlKeyState.ENHANCED_KEY;\n }\n\n return state;\n }\n\n /**\n * Evaluate a keyboard event using Win32 input mode.\n *\n * @param ev The keyboard event.\n * @param isKeyDown Whether this is a keydown (true) or keyup (false) event.\n * @returns The keyboard result with the encoded key sequence.\n */\n public evaluateKeyboardEvent(ev: IKeyboardEvent, isKeyDown: boolean): IKeyboardResult {\n const vk = this._getVirtualKeyCode(ev);\n const sc = this._getScanCode(ev);\n const uc = this._getUnicodeChar(ev);\n const kd = isKeyDown ? 1 : 0;\n const cs = this._getControlKeyState(ev);\n const rc = 1; // Repeat count, always 1 for now\n\n // Format: CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _\n return {\n type: KeyboardResultType.SEND_KEY,\n cancel: true,\n key: `${C0.ESC}[${vk};${sc};${uc};${kd};${cs};${rc}_`\n };\n }\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IKeyboardService } from 'browser/services/Services';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from 'common/input/KittyKeyboard';\nimport { Win32InputMode } from 'common/input/Win32InputMode';\nimport { isMac } from 'common/Platform';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\nimport { IKeyboardResult } from 'common/Types';\n\nexport class KeyboardService implements IKeyboardService {\n public serviceBrand: undefined;\n\n private _win32InputMode: Win32InputMode | undefined;\n private _kittyKeyboard: KittyKeyboard | undefined;\n\n constructor(\n @ICoreService private readonly _coreService: ICoreService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n }\n\n private _getWin32InputMode(): Win32InputMode {\n this._win32InputMode ??= new Win32InputMode();\n return this._win32InputMode;\n }\n\n private _getKittyKeyboard(): KittyKeyboard {\n this._kittyKeyboard ??= new KittyKeyboard();\n return this._kittyKeyboard;\n }\n\n public evaluateKeyDown(event: KeyboardEvent): IKeyboardResult {\n // Win32 input mode takes priority (most raw)\n if (this.useWin32InputMode) {\n return this._getWin32InputMode().evaluateKeyboardEvent(event, true);\n }\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n return this.useKitty\n ? this._getKittyKeyboard().evaluate(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS)\n : evaluateKeyboardEvent(event, this._coreService.decPrivateModes.applicationCursorKeys, isMac, this._optionsService.rawOptions.macOptionIsMeta);\n }\n\n public evaluateKeyUp(event: KeyboardEvent): IKeyboardResult | undefined {\n // Win32 input mode sends key up events\n if (this.useWin32InputMode) {\n return this._getWin32InputMode().evaluateKeyboardEvent(event, false);\n }\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n if (this.useKitty && (kittyFlags & KittyKeyboardFlags.REPORT_EVENT_TYPES)) {\n return this._getKittyKeyboard().evaluate(event, kittyFlags, KittyKeyboardEventType.RELEASE);\n }\n return undefined;\n }\n\n public get useKitty(): boolean {\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n return !!(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard && KittyKeyboard.shouldUseProtocol(kittyFlags));\n }\n\n public get useWin32InputMode(): boolean {\n return !!(this._optionsService.rawOptions.vtExtensions?.win32InputMode && this._coreService.decPrivateModes.win32InputMode);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n for (const [key, value] of this._entries.entries()) {\n callback(key, value);\n }\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n public serviceBrand: undefined;\n\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id._id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevelEnum } = {\n trace: LogLevelEnum.TRACE,\n debug: LogLevelEnum.DEBUG,\n info: LogLevelEnum.INFO,\n warn: LogLevelEnum.WARN,\n error: LogLevelEnum.ERROR,\n off: LogLevelEnum.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService extends Disposable implements ILogService {\n public serviceBrand: any;\n\n private _logLevel: LogLevelEnum = LogLevelEnum.OFF;\n public get logLevel(): LogLevelEnum { return this._logLevel; }\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._updateLogLevel();\n this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));\n }\n\n private _updateLogLevel(): void {\n this._logLevel = optionsKeyToLogLevel[this._optionsService.rawOptions.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams);\n }\n\n public trace(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.TRACE) {\n this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.DEBUG) {\n this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.INFO) {\n this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.WARN) {\n this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.ERROR) {\n this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message, optionalParams);\n }\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList extends Disposable implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public readonly onDeleteEmitter = this._register(new Emitter());\n public readonly onDelete = this.onDeleteEmitter.event;\n public readonly onInsertEmitter = this._register(new Emitter());\n public readonly onInsert = this.onInsertEmitter.event;\n public readonly onTrimEmitter = this._register(new Emitter());\n public readonly onTrim = this.onTrimEmitter.event;\n\n constructor(\n private _maxLength: number\n ) {\n super();\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @returns The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @returns The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\nconst $workCell = new CellData();\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData ?? CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /** Get state of protected flag. */\n public isProtected(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG] & BgFlags.PROTECTED;\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n $startIndex = index * CELL_SIZE;\n cell.content = this._data[$startIndex + Cell.CONTENT];\n cell.fg = this._data[$startIndex + Cell.FG];\n cell.bg = this._data[$startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index]!;\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void {\n if (attrs.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = attrs.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = attrs.fg;\n this._data[index * CELL_SIZE + Cell.BG] = attrs.bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number, width: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n }\n if (width) {\n content &= ~Content.WIDTH_MASK;\n content |= width << Content.WIDTH_SHIFT;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n\n if (n < this.length - pos) {\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, $workCell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodepoint(this.length - 1, 0, 1, fillCellData);\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, $workCell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodepoint(pos, 0, 1, fillCellData);\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n while (start < end && start < this.length) {\n if (!this.isProtected(start)) {\n this.setCell(start, fillCellData);\n }\n start++;\n }\n return;\n }\n\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n /**\n * Resize BufferLine to `cols` filling excess cells with `fillCellData`.\n * The underlying array buffer will not change if there is still enough space\n * to hold the new buffer line data.\n * Returns a boolean indicating, whether a `cleanupMemory` call would free\n * excess memory (true after shrinking > CLEANUP_THRESHOLD).\n */\n public resize(cols: number, fillCellData: ICellData): boolean {\n if (cols === this.length) {\n return this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n const uint32Cells = cols * CELL_SIZE;\n if (cols > this.length) {\n if (this._data.buffer.byteLength >= uint32Cells * 4) {\n // optimization: avoid alloc and data copy if buffer has enough room\n this._data = new Uint32Array(this._data.buffer, 0, uint32Cells);\n } else {\n // slow path: new alloc and full data copy\n const data = new Uint32Array(uint32Cells);\n data.set(this._data);\n this._data = data;\n }\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n // optimization: just shrink the view on existing buffer\n this._data = this._data.subarray(0, uint32Cells);\n // Remove any cut off combined data\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n // remove any cut off extended attributes\n const extKeys = Object.keys(this._extendedAttrs);\n for (let i = 0; i < extKeys.length; i++) {\n const key = parseInt(extKeys[i], 10);\n if (key >= cols) {\n delete this._extendedAttrs[key];\n }\n }\n }\n this.length = cols;\n return uint32Cells * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n\n /**\n * Cleanup underlying array buffer.\n * A cleanup will be triggered if the array buffer exceeds the actual used\n * memory by a factor of CLEANUP_THRESHOLD.\n * Returns 0 or 1 indicating whether a cleanup happened.\n */\n public cleanupMemory(): number {\n if (this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength) {\n const data = new Uint32Array(this._data.length);\n data.set(this._data);\n this._data = data;\n return 1;\n }\n return 0;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n for (let i = 0; i < this.length; ++i) {\n if (!this.isProtected(i)) {\n this.setCell(i, fillCellData);\n }\n }\n return;\n }\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public getNoBgTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK) || (this._data[i * CELL_SIZE + Cell.BG] & Attributes.CM_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n /**\n * Translates the buffer line to a string.\n *\n * @param trimRight Whether to trim any empty cells on the right.\n * @param startCol The column to start the string (0-based inclusive).\n * @param endCol The column to end the string (0-based exclusive).\n * @param outColumns if specified, this array will be filled with column numbers such that\n * `returnedString[i]` is displayed at `outColumns[i]` column. `outColumns[returnedString.length]`\n * is where the character following `returnedString` will be displayed.\n *\n * When a single cell is translated to multiple UTF-16 code units (e.g. surrogate pair) in the\n * returned string, the corresponding entries in `outColumns` will have the same column number.\n */\n public translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string {\n startCol = startCol ?? 0;\n endCol = endCol ?? this.length;\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n if (outColumns) {\n outColumns.length = 0;\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n const chars = (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n result += chars;\n if (outColumns) {\n for (let i = 0; i < chars.length; ++i) {\n outColumns.push(startCol);\n }\n }\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by at least 1\n }\n if (outColumns) {\n outColumns.push(startCol);\n }\n return result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param oldCols The columns before resize\n * @param newCols The columns after resize.\n * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).\n * @param nullCell The cell data to use when filling in empty cells.\n * @param reflowCursorLine Whether to reflow the line containing the cursor.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData, reflowCursorLine: boolean): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n if (!reflowCursorLine) {\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable, IMarker } from 'common/Types';\nimport { Emitter } from 'common/Event';\nimport { dispose } from 'common/Lifecycle';\n\nexport class Marker implements IMarker {\n private static _nextId = 1;\n\n public isDisposed: boolean = false;\n private readonly _disposables: IDisposable[] = [];\n\n private readonly _id: number = Marker._nextId++;\n public get id(): number { return this._id; }\n\n private readonly _onDispose = this.register(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n constructor(\n public line: number\n ) {\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n dispose(this._disposables);\n this._disposables.length = 0;\n }\n\n public register(disposable: T): T {\n this._disposables.push(disposable);\n return disposable;\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '\u25C6'\n 'a': '\\u2592', // '\u2592'\n 'b': '\\u2409', // '\u2409' (HT)\n 'c': '\\u240c', // '\u240C' (FF)\n 'd': '\\u240d', // '\u240D' (CR)\n 'e': '\\u240a', // '\u240A' (LF)\n 'f': '\\u00b0', // '\u00B0'\n 'g': '\\u00b1', // '\u00B1'\n 'h': '\\u2424', // '\u2424' (NL)\n 'i': '\\u240b', // '\u240B' (VT)\n 'j': '\\u2518', // '\u2518'\n 'k': '\\u2510', // '\u2510'\n 'l': '\\u250c', // '\u250C'\n 'm': '\\u2514', // '\u2514'\n 'n': '\\u253c', // '\u253C'\n 'o': '\\u23ba', // '\u23BA'\n 'p': '\\u23bb', // '\u23BB'\n 'q': '\\u2500', // '\u2500'\n 'r': '\\u23bc', // '\u23BC'\n 's': '\\u23bd', // '\u23BD'\n 't': '\\u251c', // '\u251C'\n 'u': '\\u2524', // '\u2524'\n 'v': '\\u2534', // '\u2534'\n 'w': '\\u252c', // '\u252C'\n 'x': '\\u2502', // '\u2502'\n 'y': '\\u2264', // '\u2264'\n 'z': '\\u2265', // '\u2265'\n '{': '\\u03c0', // '\u03C0'\n '|': '\\u2260', // '\u2260'\n '}': '\\u00a3', // '\u00A3'\n '~': '\\u00b7' // '\u00B7'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '\u00A3'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '\u00A3',\n '@': '\u00BE',\n '[': 'ij',\n '\\\\': '\u00BD',\n ']': '|',\n '{': '\u00A8',\n '|': 'f',\n '}': '\u00BC',\n '~': '\u00B4'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '\u00A3',\n '@': '\u00E0',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00A7',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00A8'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': '\u00E0',\n '[': '\u00E2',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n '`': '\u00F4',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00FB'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '\u00A7',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00DC',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00DF'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00E9',\n '`': '\u00F9',\n '{': '\u00E0',\n '|': '\u00F2',\n '}': '\u00E8',\n '~': '\u00EC'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': '\u00C4',\n '[': '\u00C6',\n '\\\\': '\u00D8',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E4',\n '{': '\u00E6',\n '|': '\u00F8',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00A1',\n '\\\\': '\u00D1',\n ']': '\u00BF',\n '{': '\u00B0',\n '|': '\u00F1',\n '}': '\u00E7'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': '\u00C9',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': '\u00F9',\n '@': '\u00E0',\n '[': '\u00E9',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n\n '_': '\u00E8',\n '`': '\u00F4',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00FB'\n};\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IdleTaskQueue } from 'common/TaskQueue';\nimport { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/Types';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'common/buffer/BufferReflow';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from 'common/buffer/Constants';\nimport { Marker } from 'common/buffer/Marker';\nimport { IBuffer } from 'common/buffer/Types';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n public tabs: { [column: number]: boolean | undefined } = {};\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public savedCharsets: (ICharset | undefined)[] = [];\n public savedGlevel: number = 0;\n public savedOriginMode: boolean = false;\n public savedWraparoundMode: boolean = true;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n private _isClearing: boolean = false;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.rawOptions.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n fillAttr ??= DEFAULT_ATTR_DATA;\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // count bufferlines with overly big memory to be cleaned afterwards\n let dirtyMemoryLines = 0;\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // if (this._cols > newCols) {\n // console.log('increase!');\n // }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.rawOptions.windowsPty.backend !== undefined || this._optionsService.rawOptions.windowsPty.buildNumber !== undefined) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n\n // Ensure the cursor position invariant: ybase + y must be within buffer bounds\n // This can be violated during reflow or when shrinking rows\n if (this.lines.length > 0) {\n const maxY = Math.max(0, this.lines.length - this.ybase - 1);\n this.y = Math.min(this.y, maxY);\n }\n\n this._memoryCleanupQueue.clear();\n // schedule memory cleanup only, if more than 10% of the lines are affected\n if (dirtyMemoryLines > 0.1 * this.lines.length) {\n this._memoryCleanupPosition = 0;\n this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup());\n }\n }\n\n private _memoryCleanupQueue = new IdleTaskQueue();\n private _memoryCleanupPosition = 0;\n\n private _batchedMemoryCleanup(): boolean {\n let normalRun = true;\n if (this._memoryCleanupPosition >= this.lines.length) {\n // cleanup made it once through all lines, thus rescan in loop below to also catch shifted\n // lines, which should finish rather quick if there are no more cleanups pending\n this._memoryCleanupPosition = 0;\n normalRun = false;\n }\n let counted = 0;\n while (this._memoryCleanupPosition < this.lines.length) {\n counted += this.lines.get(this._memoryCleanupPosition++)!.cleanupMemory();\n // cleanup max 100 lines per batch\n if (counted > 100) {\n return true;\n }\n }\n // normal runs always need another rescan afterwards\n // if we made it here with normalRun=false, we are in a final run\n // and can end the cleanup task for sure\n return normalRun;\n }\n\n private get _isReflowEnabled(): boolean {\n const windowsPty = this._optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber) {\n return this._hasScrollback && windowsPty.backend === 'conpty' && windowsPty.buildNumber >= 21376;\n }\n return this._hasScrollback;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA), reflowCursorLine);\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n if (!reflowCursorLine) {\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n if (wrappedLines[destLineIndex] === undefined) {\n // Sanity check that the line exists, this has been known to fail for an unknown reason\n // which would stop the reflow from happening if an exception would throw.\n break;\n }\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param lineIndex The absolute index of the line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.rawOptions.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n x ??= this.x;\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n x ??= this.x;\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Clears markers on single line.\n * @param y The line to clear.\n */\n public clearMarkers(y: number): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].line === y) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n }\n this._isClearing = false;\n }\n\n /**\n * Clears markers on all lines\n */\n public clearAllMarkers(): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n this.markers[i].dispose();\n }\n this.markers.length = 0;\n this._isClearing = false;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n if (!this._isClearing) {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private readonly _onBufferActivate = this._register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());\n public readonly onBufferActivate = this._onBufferActivate.event;\n\n /**\n * Create a new BufferSet for the given terminal.\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n this._register(this._optionsService.onSpecificOptionChange('scrollback', () => this.resize(this._bufferService.cols, this._bufferService.rows)));\n this._register(this._optionsService.onSpecificOptionChange('tabStopWidth', () => this.setupTabStops()));\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clearAllMarkers();\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n this.setupTabStops(newCols);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData, IBufferLine } from 'common/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private readonly _onResize = this._register(new Emitter());\n public readonly onResize = this._onResize.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n constructor(@IOptionsService optionsService: IOptionsService) {\n super();\n this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);\n this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);\n this.buffers = this._register(new BufferSet(optionsService, this));\n this._register(this.buffers.onBufferActivate(e => {\n this._onScroll.fire(e.activeBuffer.ydisp);\n }));\n }\n\n public resize(cols: number, rows: number): void {\n const colsChanged = this.cols !== cols;\n const rowsChanged = this.rows !== rows;\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n this._onResize.fire({ cols, rows, colsChanged, rowsChanged });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n const buffer = this.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport const DEFAULT_OPTIONS: Readonly> = {\n cols: 80,\n rows: 24,\n showCursorImmediately: false,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n cursorInactiveStyle: 'outline',\n drawBoldTextInBrightColors: true,\n documentOverride: null,\n fastScrollSensitivity: 5,\n fontFamily: 'monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n ignoreBracketedPasteMode: false,\n lineHeight: 1.0,\n letterSpacing: 0,\n linkHandler: null,\n logLevel: 'info',\n logger: null,\n scrollback: 1000,\n scrollOnEraseInDisplay: false,\n scrollOnUserInput: true,\n scrollSensitivity: 1,\n screenReaderMode: false,\n smoothScrollDuration: 0,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: false,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n reflowCursorLine: false,\n rescaleOverlappingGlyphs: false,\n rightClickSelectsWord: isMac,\n windowOptions: {},\n windowsPty: {},\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n overviewRuler: {},\n quirks: {},\n vtExtensions: {}\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService extends Disposable implements IOptionsService {\n public serviceBrand: any;\n\n public readonly rawOptions: Required;\n public options: Required;\n\n private readonly _onOptionChange = this._register(new Emitter());\n public readonly onOptionChange = this._onOptionChange.event;\n\n constructor(options: Partial) {\n super();\n // set the default value of each option\n const defaultOptions = { ...DEFAULT_OPTIONS };\n for (const key in options) {\n if (key in defaultOptions) {\n try {\n const newValue = options[key];\n defaultOptions[key] = this._sanitizeAndValidateOption(key, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n // set up getters and setters for each option\n this.rawOptions = defaultOptions;\n this.options = { ... defaultOptions };\n this._setupOptions();\n\n // Clear out options that could link outside xterm.js as they could easily cause an embedder\n // memory leak\n this._register(toDisposable(() => {\n this.rawOptions.linkHandler = null;\n this.rawOptions.documentOverride = null;\n }));\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onSpecificOptionChange(key: T, listener: (value: ITerminalOptions[T]) => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (eventKey === key) {\n listener(this.rawOptions[key]);\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (keys.indexOf(eventKey) !== -1) {\n listener();\n }\n });\n }\n\n private _setupOptions(): void {\n const getter = (propName: string): any => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n return this.rawOptions[propName];\n };\n\n const setter = (propName: string, value: any): void => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n\n value = this._sanitizeAndValidateOption(propName, value);\n // Don't fire an option change event if they didn't change\n if (this.rawOptions[propName] !== value) {\n this.rawOptions[propName] = value;\n this._onOptionChange.fire(propName);\n }\n };\n\n for (const propName in this.rawOptions) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this.options, propName, desc);\n }\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'cursorStyle':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n if (!isCursorStyle(value)) {\n throw new Error(`\"${value}\" is not a valid value for ${key}`);\n }\n break;\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n break;\n case 'rows':\n case 'cols':\n if (!value && value !== 0) {\n throw new Error(`${key} must be numeric, value: ${value}`);\n }\n break;\n case 'windowsPty':\n value = value ?? {};\n break;\n }\n return value;\n }\n}\n\nfunction isCursorStyle(value: unknown): value is CursorStyle {\n return value === 'block' || value === 'underline' || value === 'bar';\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));\n }\n\n return clonedObject as T;\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'common/Lifecycle';\nimport { IDecPrivateModes, IKittyKeyboardState, IModes } from 'common/Types';\nimport { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n colorSchemeUpdates: false,\n cursorBlink: undefined,\n cursorStyle: undefined,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n synchronizedOutput: false,\n win32InputMode: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nconst DEFAULT_KITTY_KEYBOARD_STATE = (): IKittyKeyboardState => ({\n flags: 0,\n mainFlags: 0,\n altFlags: 0,\n mainStack: [],\n altStack: []\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n public kittyKeyboard: IKittyKeyboardState;\n\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n private readonly _onUserInput = this._register(new Emitter());\n public readonly onUserInput = this._onUserInput.event;\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onRequestScrollToBottom = this._register(new Emitter());\n public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this.isCursorInitialized = _optionsService.rawOptions.showCursorImmediately ?? false;\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (wasUserInput && this._optionsService.rawOptions.scrollOnUserInput && buffer.ybase !== buffer.ydisp) {\n this._onRequestScrollToBottom.fire();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`);\n this._logService.trace(`sending data (codes)`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`);\n this._logService.trace(`sending binary (codes)`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: { [key: string]: ICoreMouseProtocol } = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n },\n SGR_PIXELS: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.x};${e.y}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService extends Disposable implements ICoreMouseService {\n public serviceBrand: any;\n\n private _protocols: { [name: string]: ICoreMouseProtocol } = {};\n private _encodings: { [name: string]: CoreMouseEncoding } = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _lastEvent: ICoreMouseEvent | null = null;\n private _wheelPartialScroll: number = 0;\n\n private readonly _onProtocolChange = this._register(new Emitter());\n public readonly onProtocolChange = this._onProtocolChange.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n this._wheelPartialScroll = 0;\n }\n\n /**\n * Processes a wheel event, accounting for partial scrolls for trackpad, mouse scrolls.\n * This prevents hyper-sensitive scrolling in alt buffer.\n */\n public consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0 || ev.shiftKey) {\n return 0;\n }\n\n if (cellHeight === undefined || dpr === undefined) {\n return 0;\n }\n\n const targetWheelEventPixels = cellHeight / dpr;\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n\n if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n amount /= (targetWheelEventPixels + 0.0); // Prevent integer division\n\n const isLikelyTrackpad = Math.abs(ev.deltaY) < 50;\n if (isLikelyTrackpad) {\n amount *= 0.3;\n }\n\n this._wheelPartialScroll += amount;\n amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);\n this._wheelPartialScroll %= 1;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._bufferService.rows;\n }\n return amount;\n }\n\n private _applyScrollModifier(amount: number, ev: WheelEvent): number {\n // Multiply the scroll speed when the modifier key is pressed\n if (ev.altKey || ev.ctrlKey || ev.shiftKey) {\n return amount * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity;\n }\n return amount * this._optionsService.rawOptions.scrollSensitivity;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move events at grid or pixel level\n if (e.action === CoreMouseAction.MOVE\n && this._lastEvent\n && this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')\n ) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _equalEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent, pixels: boolean): boolean {\n if (pixels) {\n if (e1.x !== e2.x) return false;\n if (e1.y !== e2.y) return false;\n } else {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n }\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n table.fill(1);\n table[0] = 0;\n // control chars\n table.fill(0, 1, 32);\n table.fill(0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n table.fill(2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n table.fill(2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n table.fill(2, 0xac00, 0xd7a4);\n table.fill(2, 0xf900, 0xfb00);\n table.fill(2, 0xfe10, 0xfe1a);\n table.fill(2, 0xfe30, 0xfe70);\n table.fill(2, 0xff00, 0xff61);\n table.fill(2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n table.fill(0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): UnicodeCharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as UnicodeCharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n let width = this.wcwidth(codepoint);\n let shouldJoin = width === 0 && preceding !== 0;\n if (shouldJoin) {\n const oldWidth = UnicodeService.extractWidth(preceding);\n if (oldWidth === 0) {\n shouldJoin = false;\n } else if (oldWidth > width) {\n width = oldWidth;\n }\n }\n return UnicodeService.createPropertyValue(0, width, shouldJoin);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\nimport { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n\n private readonly _onChange = new Emitter();\n public readonly onChange = this._onChange.event;\n\n public static extractShouldJoin(value: UnicodeCharProperties): boolean {\n return (value & 1) !== 0;\n }\n public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {\n return ((value >> 1) & 0x3) as UnicodeCharWidth;\n }\n public static extractCharKind(value: UnicodeCharProperties): number {\n return value >> 3;\n }\n public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {\n return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);\n }\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public dispose(): void {\n this._onChange.dispose();\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): UnicodeCharWidth {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n let precedingInfo = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n const currentInfo = this.charProperties(code, precedingInfo);\n let chWidth = UnicodeService.extractWidth(currentInfo);\n if (UnicodeService.extractShouldJoin(currentInfo)) {\n chWidth -= UnicodeService.extractWidth(precedingInfo);\n }\n result += chWidth;\n precedingInfo = currentInfo;\n }\n return result;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n return this._activeProvider.charProperties(codepoint, preceding);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public get charsets(): (ICharset | undefined)[] {\n return this._charsets;\n }\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (Array.isArray(values[0])) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (Array.isArray(value)) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';\nimport { OscState, ParserConstants } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > OscHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { ParserConstants } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n // force cleanup leftover handlers\n if (this._active.length) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].unhook(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean, promiseResult: boolean = true): void | Promise {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers (fallThrough for async)\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean | Promise) { }\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > DcsHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n if (ret instanceof Promise) {\n // need to hold data and params until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from 'common/parser/Types';\nimport { ApcState, ParserConstants } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IApcHandler[] = [];\n\n/**\n * APC Parser for handling Application Program Command sequences.\n * APC sequences use the format: ESC _ ESC \\\n *\n * Unlike OSC which uses numeric identifiers (e.g., OSC 1337),\n * APC uses the first character as the identifier (e.g., 'G' for Kitty graphics).\n * The identifier is the character code of the first byte after ESC _.\n */\nexport class ApcParser implements IApcParser {\n private _state = ApcState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: ApcFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n /**\n * Register an APC handler for a specific identifier.\n * @param ident The character code of the first byte (e.g., 0x47 for 'G')\n * @param handler The handler to register\n */\n public registerHandler(ident: number, handler: IApcHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: ApcFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === ApcState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = ApcState.ID;\n }\n\n /**\n * Put data to current APC command.\n * For APC, the first character is used as the identifier.\n * Format: ESC _ ESC \\\n * Example: ESC _ G f=100,a=T;... ESC \\ (Kitty graphics, identifier='G')\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === ApcState.ABORT) {\n return;\n }\n if (this._state === ApcState.ID) {\n // The first character is the identifier\n if (start < end) {\n this._id = data[start++];\n this._state = ApcState.PAYLOAD;\n this._start();\n }\n }\n if (this._state === ApcState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an APC command.\n * Whether the APC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === ApcState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== ApcState.ABORT) {\n // if we are still in ID state and get an early end\n // means we got an empty APC sequence with no identifier,\n // which is invalid - just reset and return\n if (this._state === ApcState.ID) {\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n return;\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as APC handlers.\n */\nexport class ApcHandler implements IApcHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > ApcHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType, IApcHandler, IApcParser, ApcFallbackHandlerType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\nimport { ApcParser } from 'common/parser/ApcParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 8,\n TRANSITION_STATE_MASK = 255,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint16Array;\n\n constructor(length: number) {\n this.table = new Uint16Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n this.table.fill(action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.STATE_LENGTH);\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (const state of states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e], state, ParserAction.IGNORE, ParserState.SOS_PM_STRING); // SOS, PM\n table.add(0x9f, state, ParserAction.APC_START, ParserState.APC_STRING); // APC\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm\n table.addMany([0x58, 0x5e], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.add(0x9c, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n // apc\n table.add(0x5f, ParserState.ESCAPE, ParserAction.APC_START, ParserState.APC_STRING);\n table.addMany(PRINTABLES, ParserState.APC_STRING, ParserAction.APC_PUT, ParserState.APC_STRING);\n table.addMany(EXECUTABLES, ParserState.APC_STRING, ParserAction.IGNORE, ParserState.APC_STRING);\n table.add(0x7f, ParserState.APC_STRING, ParserAction.IGNORE, ParserState.APC_STRING);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.APC_STRING, ParserAction.APC_END, ParserState.GROUND);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(NON_ASCII_PRINTABLE, ParserState.APC_STRING, ParserAction.APC_PUT, ParserState.APC_STRING);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingJoinState: number; // UnicodeJoinProperties\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: { [flag: number]: ExecuteHandlerType };\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected readonly _oscParser: IOscParser;\n protected readonly _dcsParser: IDcsParser;\n protected readonly _apcParser: IApcParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n // parser stack save for async handler support\n protected _parseStack: IParserStackState = {\n state: ParserStackType.NONE,\n handlers: [],\n handlerPos: 0,\n transition: 0,\n chunkPos: 0\n };\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._register(toDisposable(() => {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n }));\n this._oscParser = this._register(new OscParser());\n this._dcsParser = this._register(new DcsParser());\n this._apcParser = this._register(new ApcParser());\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({ final: '\\\\' }, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n this._escHandlers[ident] ??= [];\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n this._csiHandlers[ident] ??= [];\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public registerApcHandler(ident: number, handler: IApcHandler): IDisposable {\n return this._apcParser.registerHandler(ident, handler);\n }\n public clearApcHandler(ident: number): void {\n this._apcParser.clearHandler(ident);\n }\n public setApcHandlerFallback(handler: ApcFallbackHandlerType): void {\n this._apcParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n /**\n * Reset parser to initial values.\n *\n * This can also be used to lift the improper continuation error condition\n * when dealing with async handlers. Use this only as a last resort to silence\n * that error when the terminal has no pending data to be processed. Note that\n * the interrupted async handler might continue its work in the future messing\n * up the terminal state even further.\n */\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._apcParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n // abort pending continuation from async handler\n // Here the RESET type indicates, that the next parse call will\n // ignore any saved stack, instead continues sync with next codepoint from GROUND\n if (this._parseStack.state !== ParserStackType.NONE) {\n this._parseStack.state = ParserStackType.RESET;\n this._parseStack.handlers = []; // also release handlers ref\n }\n }\n\n /**\n * Async parse support.\n */\n protected _preserveStack(\n state: ParserStackType,\n handlers: ResumableHandlersType,\n handlerPos: number,\n transition: number,\n chunkPos: number\n ): void {\n this._parseStack.state = state;\n this._parseStack.handlers = handlers;\n this._parseStack.handlerPos = handlerPos;\n this._parseStack.transition = transition;\n this._parseStack.chunkPos = chunkPos;\n }\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n *\n * Note on asynchronous handler support:\n * Any handler returning a promise will be treated as asynchronous.\n * To keep the in-band blocking working for async handlers, `parse` pauses execution,\n * creates a stack save and returns the promise to the caller.\n * For proper continuation of the paused state it is important\n * to await the promise resolving. On resolve the parse must be repeated\n * with the same chunk of data and the resolved value in `promiseResult`\n * until no promise is returned.\n *\n * Important: With only sync handlers defined, parsing is completely synchronous as well.\n * As soon as an async handler is involved, synchronous parsing is not possible anymore.\n *\n * Boilerplate for proper parsing of multiple chunks with async handlers:\n *\n * ```typescript\n * async function parseMultipleChunks(chunks: Uint32Array[]): Promise {\n * for (const chunk of chunks) {\n * let result: void | Promise;\n * let prev: boolean | undefined;\n * while (result = parser.parse(chunk, chunk.length, prev)) {\n * prev = await result;\n * }\n * }\n * // finished parsing all chunks...\n * }\n * ```\n */\n public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise {\n let code = 0;\n let transition = 0;\n let start = 0;\n let handlerResult: void | boolean | Promise;\n\n // resume from async handler\n if (this._parseStack.state) {\n // allow sync parser reset even in continuation mode\n // Note: can be used to recover parser from improper continuation error below\n if (this._parseStack.state === ParserStackType.RESET) {\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND\n } else {\n if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {\n /**\n * Reject further parsing on improper continuation after pausing. This is a really bad\n * condition with screwed up execution order and prolly messed up terminal state,\n * therefore we exit hard with an exception and reject any further parsing.\n *\n * Note: With `Terminal.write` usage this exception should never occur, as the top level\n * calls are guaranteed to handle async conditions properly. If you ever encounter this\n * exception in your terminal integration it indicates, that you injected data chunks to\n * `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for\n * continuation of a running async handler.\n *\n * It is possible to get rid of this error by calling `reset`. But dont rely on that, as\n * the pending async handler still might mess up the terminal later. Instead fix the\n * faulty async handling, so this error will not be thrown anymore.\n */\n this._parseStack.state = ParserStackType.FAIL;\n throw new Error('improper continuation due to previous async handler, giving up parsing');\n }\n\n // we have to resume the old handler loop if:\n // - return value of the promise was `false`\n // - handlers are not exhausted yet\n const handlers = this._parseStack.handlers;\n let handlerPos = this._parseStack.handlerPos - 1;\n switch (this._parseStack.state) {\n case ParserStackType.CSI:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.ESC:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as EscHandlerType[])[handlerPos]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.DCS:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.OSC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.APC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n }\n // cleanup before continuing with the main sync loop\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1;\n this.precedingJoinState = 0;\n this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n\n // continue with main sync loop\n\n // process input string\n for (let i = start; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = this._transitions.table[this.currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingJoinState = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState: this.currentState,\n collect: this._collect,\n params: this._params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[this._collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlers[j](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);\n return handlerResult;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(this._collect << 8 | code, this._params);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n this._params.addParam(0); // ZDM\n break;\n case 0x3a:\n this._params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n this._params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n this._collect <<= 8;\n this._collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[this._collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlersEsc[jj]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);\n return handlerResult;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(this._collect << 8 | code);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.CLEAR:\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n this._dcsParser.hook(this._collect << 8 | code, this._params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._dcsParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.DCS, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.OSC_START:\n this._oscParser.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._oscParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.OSC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.APC_START:\n this._apcParser.start();\n break;\n case ParserAction.APC_PUT:\n // inner loop - exit APC_PUT: 0x18, 0x1a, 0x1b, 0x9c\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || code === 0x9c || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._apcParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.APC_END:\n handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.APC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n }\n this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n\n// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)\nconst RGB_REX = /^([\\da-f])\\/([\\da-f])\\/([\\da-f])$|^([\\da-f]{2})\\/([\\da-f]{2})\\/([\\da-f]{2})$|^([\\da-f]{3})\\/([\\da-f]{3})\\/([\\da-f]{3})$|^([\\da-f]{4})\\/([\\da-f]{4})\\/([\\da-f]{4})$/;\n// '#...' rule - matching any hex digits\nconst HASH_REX = /^[\\da-f]+$/;\n\n/**\n * Parse color spec to RGB values (8 bit per channel).\n * See `man xparsecolor` for details about certain format specifications.\n *\n * Supported formats:\n * - rgb:// with , , in h | hh | hhh | hhhh\n * - #RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB\n *\n * All other formats like rgbi: or device-independent string specifications\n * with float numbering are not supported.\n */\nexport function parseColor(data: string): [number, number, number] | undefined {\n if (!data) return;\n // also handle uppercases\n let low = data.toLowerCase();\n if (low.startsWith('rgb:')) {\n // 'rgb:' specifier\n low = low.slice(4);\n const m = RGB_REX.exec(low);\n if (m) {\n const base = m[1] ? 15 : m[4] ? 255 : m[7] ? 4095 : 65535;\n return [\n Math.round(parseInt(m[1] || m[4] || m[7] || m[10], 16) / base * 255),\n Math.round(parseInt(m[2] || m[5] || m[8] || m[11], 16) / base * 255),\n Math.round(parseInt(m[3] || m[6] || m[9] || m[12], 16) / base * 255)\n ];\n }\n } else if (low.startsWith('#')) {\n // '#' specifier\n low = low.slice(1);\n if (HASH_REX.exec(low) && [3, 6, 9, 12].includes(low.length)) {\n const adv = low.length / 3;\n const result: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 3; ++i) {\n const c = parseInt(low.slice(adv * i, adv * i + adv), 16);\n result[i] = adv === 1 ? c << 4 : adv === 2 ? c : adv === 3 ? c >> 4 : c >> 8;\n }\n return result;\n }\n }\n\n // Named colors are currently not supported due to the large addition to the xterm.js bundle size\n // they would add. In order to support named colors, we would need some way of optionally loading\n // additional payloads so startup/download time is not bloated (see #3530).\n}\n\n// pad hex output to requested bit width\nfunction pad(n: number, bits: number): string {\n const s = n.toString(16);\n const s2 = s.length < 2 ? '0' + s : s;\n switch (bits) {\n case 4:\n return s[0];\n case 8:\n return s2;\n case 12:\n return (s2 + s2).slice(0, 3);\n default:\n return s2 + s2;\n }\n}\n\n/**\n * Convert a given color to rgb:../../.. string of `bits` depth.\n */\nexport function toRgbString(color: [number, number, number], bits: number = 16): string {\n const [r, g, b] = color;\n return `rgb:${pad(r, bits)}/${pad(g, bits)}/${pad(b, bits)}`;\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * The xterm.js version. This is updated by the publish script from package.json.\n */\nexport const XTERM_VERSION = '6.1.0-beta.141';\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'common/Lifecycle';\nimport { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, ICoreMouseService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\nimport { ApcHandler } from 'common/parser/ApcParser';\nimport { IBuffer } from 'common/buffer/Types';\nimport { parseColor } from 'common/input/XParseColor';\nimport { Emitter } from 'common/Event';\nimport { XTERM_VERSION } from 'common/Version';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document xterm VT features here that are currently unsupported\n */\n// @vt: #E[Supported via @xterm/addon-image.] DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image.\"\n// @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps \\| Pt ST\" \"Definitions for user-defined keys.\"\n// @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n// @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\n\n// Work variables to avoid garbage collection\nlet $temp = 0;\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _windowTitle = '';\n private _iconName = '';\n private _dirtyRowTracker: IDirtyRowTracker;\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n public getAttrData(): IAttributeData { return this._curAttrData; }\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _activeBuffer: IBuffer;\n\n private readonly _onRequestBell = this._register(new Emitter());\n public readonly onRequestBell = this._onRequestBell.event;\n private readonly _onRequestRefreshRows = this._register(new Emitter<{ start: number, end: number } | undefined>());\n public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n private readonly _onRequestReset = this._register(new Emitter());\n public readonly onRequestReset = this._onRequestReset.event;\n private readonly _onRequestSendFocus = this._register(new Emitter());\n public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n private readonly _onRequestSyncScrollBar = this._register(new Emitter());\n public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n private readonly _onRequestWindowsOptionsReport = this._register(new Emitter());\n public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n private readonly _onA11yChar = this._register(new Emitter());\n public readonly onA11yChar = this._onA11yChar.event;\n private readonly _onA11yTab = this._register(new Emitter());\n public readonly onA11yTab = this._onA11yTab.event;\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onColor = this._register(new Emitter());\n public readonly onColor = this._onColor.event;\n private readonly _onRequestColorSchemeQuery = this._register(new Emitter());\n public readonly onRequestColorSchemeQuery = this._onRequestColorSchemeQuery.event;\n\n private _parseStack: IParseStack = {\n paused: false,\n cursorStartX: 0,\n cursorStartY: 0,\n decodedLength: 0,\n position: 0\n };\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _oscLinkService: IOscLinkService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this._register(this._parser);\n this._dirtyRowTracker = new DirtyRowTracker(this._bufferService);\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this._register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({ final: '@' }, params => this.insertChars(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: '@' }, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({ final: 'A' }, params => this.cursorUp(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'A' }, params => this.scrollRight(params));\n this._parser.registerCsiHandler({ final: 'B' }, params => this.cursorDown(params));\n this._parser.registerCsiHandler({ final: 'C' }, params => this.cursorForward(params));\n this._parser.registerCsiHandler({ final: 'D' }, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({ final: 'E' }, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({ final: 'F' }, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({ final: 'G' }, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({ final: 'H' }, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({ final: 'I' }, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({ final: 'J' }, params => this.eraseInDisplay(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'J' }, params => this.eraseInDisplay(params, true));\n this._parser.registerCsiHandler({ final: 'K' }, params => this.eraseInLine(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'K' }, params => this.eraseInLine(params, true));\n this._parser.registerCsiHandler({ final: 'L' }, params => this.insertLines(params));\n this._parser.registerCsiHandler({ final: 'M' }, params => this.deleteLines(params));\n this._parser.registerCsiHandler({ final: 'P' }, params => this.deleteChars(params));\n this._parser.registerCsiHandler({ final: 'S' }, params => this.scrollUp(params));\n this._parser.registerCsiHandler({ final: 'T' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: 'X' }, params => this.eraseChars(params));\n this._parser.registerCsiHandler({ final: 'Z' }, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({ final: '^' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: '`' }, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'a' }, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'b' }, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({ final: 'c' }, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'c' }, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({ final: 'd' }, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'e' }, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'f' }, params => this.hVPosition(params));\n this._parser.registerCsiHandler({ final: 'g' }, params => this.tabClear(params));\n this._parser.registerCsiHandler({ final: 'h' }, params => this.setMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({ final: 'l' }, params => this.resetMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({ final: 'm' }, params => this.charAttributes(params));\n this._parser.registerCsiHandler({ final: 'n' }, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'n' }, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({ intermediates: '!', final: 'p' }, params => this.softReset(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'q' }, params => this.sendXtVersion(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'q' }, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({ final: 'r' }, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({ final: 's' }, params => this.saveCursor(params));\n this._parser.registerCsiHandler({ final: 't' }, params => this.windowOptions(params));\n this._parser.registerCsiHandler({ final: 'u' }, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '}' }, params => this.insertColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '~' }, params => this.deleteColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\"', final: 'q' }, params => this.selectProtected(params));\n this._parser.registerCsiHandler({ intermediates: '$', final: 'p' }, params => this.requestMode(params, true));\n this._parser.registerCsiHandler({ prefix: '?', intermediates: '$', final: 'p' }, params => this.requestMode(params, false));\n\n // Kitty keyboard protocol handlers\n this._parser.registerCsiHandler({ prefix: '=', final: 'u' }, params => this.kittyKeyboardSet(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'u' }, params => this.kittyKeyboardQuery(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'u' }, params => this.kittyKeyboardPush(params));\n this._parser.registerCsiHandler({ prefix: '<', final: 'u' }, params => this.kittyKeyboardPop(params));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setOrReportIndexedColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 8 - create hyperlink (not in xterm spec, see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)\n this._parser.registerOscHandler(8, new OscHandler(data => this.setHyperlink(data)));\n // 10 - Change VT100 text foreground color to Pt.\n this._parser.registerOscHandler(10, new OscHandler(data => this.setOrReportFgColor(data)));\n // 11 - Change VT100 text background color to Pt.\n this._parser.registerOscHandler(11, new OscHandler(data => this.setOrReportBgColor(data)));\n // 12 - Change text cursor color to Pt.\n this._parser.registerOscHandler(12, new OscHandler(data => this.setOrReportCursorColor(data)));\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n this._parser.registerOscHandler(104, new OscHandler(data => this.restoreIndexedColor(data)));\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n this._parser.registerOscHandler(110, new OscHandler(data => this.restoreFgColor(data)));\n // 111 - Reset VT100 text background color.\n this._parser.registerOscHandler(111, new OscHandler(data => this.restoreBgColor(data)));\n // 112 - Reset text cursor color.\n this._parser.registerOscHandler(112, new OscHandler(data => this.restoreCursorColor(data)));\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({ final: '7' }, () => this.saveCursor());\n this._parser.registerEscHandler({ final: '8' }, () => this.restoreCursor());\n this._parser.registerEscHandler({ final: 'D' }, () => this.index());\n this._parser.registerEscHandler({ final: 'E' }, () => this.nextLine());\n this._parser.registerEscHandler({ final: 'H' }, () => this.tabSet());\n this._parser.registerEscHandler({ final: 'M' }, () => this.reverseIndex());\n this._parser.registerEscHandler({ final: '=' }, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({ final: '>' }, () => this.keypadNumericMode());\n this._parser.registerEscHandler({ final: 'c' }, () => this.fullReset());\n this._parser.registerEscHandler({ final: 'n' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: 'o' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '|' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '}' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: '~' }, () => this.setgLevel(1));\n this._parser.registerEscHandler({ intermediates: '%', final: '@' }, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({ intermediates: '%', final: 'G' }, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({ intermediates: '(', final: flag }, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({ intermediates: ')', final: flag }, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({ intermediates: '*', final: flag }, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({ intermediates: '+', final: flag }, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({ intermediates: '-', final: flag }, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({ intermediates: '.', final: flag }, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({ intermediates: '/', final: flag }, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({ intermediates: '#', final: '8' }, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({ intermediates: '$', final: 'q' }, new DcsHandler((data, params) => this.requestStatusString(data, params)));\n }\n\n /**\n * Async parse support.\n */\n private _preserveStack(cursorStartX: number, cursorStartY: number, decodedLength: number, position: number): void {\n this._parseStack.paused = true;\n this._parseStack.cursorStartX = cursorStartX;\n this._parseStack.cursorStartY = cursorStartY;\n this._parseStack.decodedLength = decodedLength;\n this._parseStack.position = position;\n }\n\n private _logSlowResolvingAsync(p: Promise): void {\n // log a limited warning about an async handler taking too long\n if (this._logService.logLevel <= LogLevelEnum.WARN) {\n let slowTimeout: ReturnType | undefined;\n const slowPromise = new Promise((_res, rej) => {\n slowTimeout = setTimeout(() => rej('#SLOW_TIMEOUT'), SLOW_ASYNC_LIMIT);\n });\n Promise.race([p, slowPromise])\n .then(() => {\n if (slowTimeout !== undefined) {\n clearTimeout(slowTimeout);\n }\n }, err => {\n if (slowTimeout !== undefined) {\n clearTimeout(slowTimeout);\n }\n if (err !== '#SLOW_TIMEOUT') {\n throw err;\n }\n console.warn(`async parser handler taking longer than ${SLOW_ASYNC_LIMIT} ms`);\n });\n }\n }\n\n private _getCurrentLinkId(): number {\n return this._curAttrData.extended.urlId;\n }\n\n /**\n * Parse call with async handler support.\n *\n * Whether the stack state got preserved for the next call, is indicated by the return value:\n * - undefined (void):\n * all handlers were sync, no stack save, continue normally with next chunk\n * - Promise\\:\n * execution stopped at async handler, stack saved, continue with same chunk and the promise\n * resolve value as `promiseResult` until the method returns `undefined`\n *\n * Note: This method should only be called by `Terminal.write` to ensure correct execution order\n * and proper continuation of async parser handlers.\n */\n public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise {\n let result: void | Promise;\n let cursorStartX = this._activeBuffer.x;\n let cursorStartY = this._activeBuffer.y;\n let start = 0;\n const wasPaused = this._parseStack.paused;\n\n if (wasPaused) {\n // assumption: _parseBuffer never mutates between async calls\n if (result = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {\n this._logSlowResolvingAsync(result);\n return result;\n }\n cursorStartX = this._parseStack.cursorStartX;\n cursorStartY = this._parseStack.cursorStartY;\n this._parseStack.paused = false;\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n start = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;\n }\n }\n\n // Log debug data, the log level gate is to prevent extra work in this hot path\n if (this._logService.logLevel <= LogLevelEnum.DEBUG) {\n this._logService.debug(`parsing data ${typeof data === 'string' ? ` \"${data}\"` : ` \"${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}\"`}`);\n }\n if (this._logService.logLevel === LogLevelEnum.TRACE) {\n this._logService.trace(`parsing data (codes)`, typeof data === 'string'\n ? data.split('').map(e => e.charCodeAt(0))\n : data\n );\n }\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n // Important: do not clear between async calls, otherwise we lost pending update information.\n if (!wasPaused) {\n this._dirtyRowTracker.clearRange();\n }\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = start; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, i);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n } else {\n if (!wasPaused) {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, 0);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n }\n\n if (this._activeBuffer.x !== cursorStartX || this._activeBuffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing, fire only for rows within the\n // _viewport_ which is relative to ydisp, not relative to ybase.\n const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n if (viewportStart < this._bufferService.rows) {\n this._onRequestRefreshRows.fire({\n start: Math.min(viewportStart, this._bufferService.rows - 1),\n end: Math.min(viewportEnd, this._bufferService.rows - 1)\n });\n }\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.rawOptions.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n\n // Defensive check: bufferRow can be undefined if a resize occurred mid-write due to async\n // scheduling gaps in WriteBuffer. See https://github.com/xtermjs/xterm.js/issues/5597\n if (!bufferRow) {\n return;\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr);\n }\n\n let precedingJoinState = this._parser.precedingJoinState;\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // Soft hyphen's (U+00AD) behavior is ambiguous and differs across terminals. We opt to treat\n // it as a zero-width hint to text layout engines and simply ignore it.\n if (code === 0xAD) {\n continue;\n }\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n const currentInfo = this._unicodeService.charProperties(code, precedingJoinState);\n chWidth = UnicodeService.extractWidth(currentInfo);\n const shouldJoin = UnicodeService.extractShouldJoin(currentInfo);\n const oldWidth = shouldJoin ? UnicodeService.extractWidth(precedingJoinState) : 0;\n precedingJoinState = currentInfo;\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n if (this._getCurrentLinkId()) {\n this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y);\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (this._activeBuffer.x + chWidth - oldWidth > cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n const oldRow = bufferRow;\n let oldCol = this._activeBuffer.x - oldWidth;\n this._activeBuffer.x = oldWidth;\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData(), true);\n } else {\n if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (!bufferRow) {\n return;\n }\n if (oldWidth > 0 && bufferRow instanceof BufferLine) {\n // Combining character widens 1 column to 2.\n // Move old character to next line.\n bufferRow.copyCellsFrom(oldRow as BufferLine,\n oldCol, 0, oldWidth, false);\n }\n // clear left over cells to the right\n while (oldCol < cols) {\n oldRow.setCellFromCodepoint(oldCol++, 0, 1, curAttr);\n }\n } else {\n this._activeBuffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert combining char at last cursor position\n // this._activeBuffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for this._activeBuffer.x to avoid overflow left\n if (shouldJoin && this._activeBuffer.x) {\n const offset = bufferRow.getWidth(this._activeBuffer.x - 1) ? 1 : 2;\n // if empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(this._activeBuffer.x - offset,\n code, chWidth);\n for (let delta = chWidth - oldWidth; --delta >= 0;) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n continue;\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(this._activeBuffer.x, chWidth - oldWidth, this._activeBuffer.getNullCell(curAttr));\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodepoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, code, chWidth, curAttr);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that this._activeBuffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n }\n }\n\n this._parser.precedingJoinState = precedingJoinState;\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (this._activeBuffer.x < cols && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x, 0, 1, curAttr);\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Forward registerCsiHandler from parser.\n */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward registerDcsHandler from parser.\n */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward registerEscHandler from parser.\n */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward registerOscHandler from parser.\n */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * Forward registerApcHandler from parser.\n */\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerApcHandler(ident, new ApcHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._optionsService.rawOptions.convertEol) {\n this._activeBuffer.x = 0;\n }\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n } else {\n // There was an explicit line feed (not just a carriage return), so clear the wrapped state of\n // the line. This is particularly important on conpty/Windows where revisiting lines to\n // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics\n // can mess with this so windowsMode should be disabled, which is recommended on Windows build\n // 21376 and above.\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (this._activeBuffer.x >= this._bufferService.cols) {\n this._activeBuffer.x--;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (this._activeBuffer.x === 0\n && this._activeBuffer.y > this._activeBuffer.scrollTop\n && this._activeBuffer.y <= this._activeBuffer.scrollBottom\n && this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)?.isWrapped) {\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n this._activeBuffer.y--;\n this._activeBuffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one\n // cell further back\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (line.hasWidth(this._activeBuffer.x) && !line.hasContent(this._activeBuffer.x)) {\n this._activeBuffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once\n // before early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._activeBuffer.x;\n this._activeBuffer.x = this._activeBuffer.nextStop();\n if (this._optionsService.rawOptions.screenReaderMode) {\n this._onA11yTab.fire(this._activeBuffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._activeBuffer.x = Math.min(maxCol, Math.max(0, this._activeBuffer.x));\n this._activeBuffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y));\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._activeBuffer.x = x;\n this._activeBuffer.y = this._activeBuffer.scrollTop + y;\n } else {\n this._activeBuffer.x = x;\n this._activeBuffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._activeBuffer.x + x, this._activeBuffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._activeBuffer.scrollBottom - this._activeBuffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._activeBuffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._activeBuffer.tabs[this._activeBuffer.x];\n } else if (param === 3) {\n this._activeBuffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.prevStop();\n }\n return true;\n }\n\n /**\n * CSI Ps \" q Select Character Protection Attribute (DECSCA).\n *\n * @vt: #Y CSI DECSCA \"Select Character Protection Attribute\" \"CSI Ps \" q\" \"Whether DECSED and DECSEL can erase (0=default, 2) or not (1).\"\n */\n public selectProtected(params: IParams): boolean {\n const p = params.params[0];\n if (p === 1) this._curAttrData.bg |= BgFlags.PROTECTED;\n if (p === 2 || p === 0) this._curAttrData.bg &= ~BgFlags.PROTECTED;\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y The row index relative to the viewport.\n * @param start The start x index of the range to be erased.\n * @param end The end x index of the range to be erased (exclusive).\n * @param clearWrap clear the isWrapped flag\n * @param respectProtect Whether to respect the protection attribute (DECSCA).\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (!line) {\n return;\n }\n line.replaceCells(\n start,\n end,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n respectProtect\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row. The cell gets replaced with the eraseChar of\n * the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (line) {\n line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);\n this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);\n line.isWrapped = false;\n }\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #Y CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Same as ED with respecting protection flag.\"\n */\n public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(j);\n break;\n case 1:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);\n if (this._activeBuffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n const nextLine = this._activeBuffer.lines.get(j + 1);\n if (nextLine) {\n nextLine.isWrapped = false;\n }\n }\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 2:\n if (this._optionsService.rawOptions.scrollOnEraseInDisplay) {\n j = this._bufferService.rows;\n this._dirtyRowTracker.markRangeDirty(0, j - 1);\n while (j--) {\n const currentLine = this._activeBuffer.lines.get(this._activeBuffer.ybase + j);\n if (currentLine?.getTrimmedLength()) {\n break;\n }\n }\n for (; j >= 0; j--) {\n this._bufferService.scroll(this._eraseAttrData());\n }\n }\n else {\n j = this._bufferService.rows;\n this._dirtyRowTracker.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n }\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._activeBuffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._activeBuffer.lines.trimStart(scrollBackSize);\n this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - scrollBackSize, 0);\n this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #Y CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Same as EL with respecting protecting flag.\"\n */\n public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n break;\n case 1:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);\n break;\n case 2:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);\n break;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1);\n this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(row, 1);\n this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the\n * blank characters. Text between the cursor and right margin moves to the right. Characters moved\n * past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.insertCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to\n * the left. Character attributes move with the characters. The terminal adds blank characters at\n * the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.deleteCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll\n * margins, moving content to the right. Content at the right margin is lost. DECIC has no effect\n * outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.replaceCells(\n this._activeBuffer.x,\n this._activeBuffer.x + (params.params[0] || 1),\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * We extend xterm's behavior to allow repeating entire grapheme clusters.\n * This isn't 100% xterm-compatible, but it seems saner and more useful.\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty, the\n * preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is\n * set. REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n const joinState = this._parser.precedingJoinState;\n if (!joinState) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const chWidth = UnicodeService.extractWidth(joinState);\n const x = this._activeBuffer.x - chWidth;\n const bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n const text = bufferRow.getString(x);\n const data = new Uint32Array(text.length * length);\n let idata = 0;\n for (let itext = 0; itext < text.length;) {\n const ch = text.codePointAt(itext) || 0;\n data[idata++] = ch;\n itext += ch > 0xffff ? 2 : 1;\n }\n let tlength = idata;\n for (let i = 1; i < length; ++i) {\n data.copyWithin(tlength, 0, idata);\n tlength += idata;\n }\n this.print(data, 0, tlength);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * CSI > Ps q\n * Ps = 0 => Report xterm name and version (XTVERSION).\n *\n * The response is a DCS sequence identifying the version: DCS > | text ST\n *\n * @vt: #Y CSI XTVERSION \"Report Xterm Version\" \"CSI > q\" \"Report the terminal name and version.\"\n */\n public sendXtVersion(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n this._coreService.triggerDataEvent(`${C0.ESC}P>|xterm.js(${XTERM_VERSION})${C0.ESC}\\\\`);\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.rawOptions.termName + '').startsWith(term);\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). | #Y |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n this._optionsService.options.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #P[Requires the allowSetCursorBlink quirk option enabled.] |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1016 | Enable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n if (this._optionsService.rawOptions.quirks?.allowSetCursorBlink) {\n this._optionsService.options.cursorBlink = true;\n }\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n this._onRequestSendFocus.fire();\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'SGR_PIXELS';\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n // Swap kitty keyboard flags: save main, restore alt\n if (this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n const state = this._coreService.kittyKeyboard;\n state.mainFlags = state.flags;\n state.flags = state.altFlags;\n }\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n case 2026: // synchronized output (https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md)\n this._coreService.decPrivateModes.synchronizedOutput = true;\n break;\n case 2031: // color scheme updates (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._coreService.decPrivateModes.colorSchemeUpdates = true;\n }\n break;\n case 9001: // win32-input-mode (https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md)\n if (this._optionsService.rawOptions.vtExtensions?.win32InputMode) {\n this._coreService.decPrivateModes.win32InputMode = true;\n }\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). | #Y |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n this._optionsService.options.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #P[Requires the allowSetCursorBlink quirk option enabled.] |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1016 | Disable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n if (this._optionsService.rawOptions.quirks?.allowSetCursorBlink) {\n this._optionsService.options.cursorBlink = false;\n }\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Swap kitty keyboard flags: save alt, restore main\n if (this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n const state = this._coreService.kittyKeyboard;\n state.altFlags = state.flags;\n state.flags = state.mainFlags;\n }\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n case 2026: // synchronized output (https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md)\n this._coreService.decPrivateModes.synchronizedOutput = false;\n this._onRequestRefreshRows.fire(undefined);\n break;\n case 2031: // color scheme updates (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._coreService.decPrivateModes.colorSchemeUpdates = false;\n }\n break;\n case 9001: // win32-input-mode\n if (this._optionsService.rawOptions.vtExtensions?.win32InputMode) {\n this._coreService.decPrivateModes.win32InputMode = false;\n }\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI Ps $ p Request ANSI Mode (DECRQM).\n *\n * Reports CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM,\n * and Pm is the mode value:\n * 0 - not recognized\n * 1 - set\n * 2 - reset\n * 3 - permanently set\n * 4 - permanently reset\n *\n * @vt: #Y CSI DECRQM \"Request Mode\" \"CSI Ps $p\" \"Request mode state.\"\n * Returns a report as `CSI Ps; Pm $ y` (DECRPM), where `Ps` is the mode number as in SM/RM\n * or DECSET/DECRST, and `Pm` is the mode value:\n * - 0: not recognized\n * - 1: set\n * - 2: reset\n * - 3: permanently set\n * - 4: permanently reset\n *\n * For modes not understood xterm.js always returns `notRecognized`. In general this means,\n * that a certain operation mode is not implemented and cannot be used.\n *\n * Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried\n * and only report, whether the alternate buffer is set.\n *\n * Mouse encodings and mouse protocols are handled mutual exclusive,\n * thus only one of each of those can be set at a given time.\n *\n * There is a chance, that some mode reports are not fully in line with xterm.js' behavior,\n * e.g. if the default implementation already exposes a certain behavior. If you find\n * discrepancies in the mode reports, please file a bug.\n */\n public requestMode(params: IParams, ansi: boolean): boolean {\n // return value as in DECRPM\n const enum V {\n NOT_RECOGNIZED = 0,\n SET = 1,\n RESET = 2,\n PERMANENTLY_SET = 3,\n PERMANENTLY_RESET = 4\n }\n\n // access helpers\n const dm = this._coreService.decPrivateModes;\n const { activeProtocol: mouseProtocol, activeEncoding: mouseEncoding } = this._coreMouseService;\n const cs = this._coreService;\n const { buffers, cols } = this._bufferService;\n const { active, alt } = buffers;\n const opts = this._optionsService.rawOptions;\n\n const f = (m: number, v: V): boolean => {\n cs.triggerDataEvent(`${C0.ESC}[${ansi ? '' : '?'}${m};${v}$y`);\n return true;\n };\n const b2v = (value: boolean): V => value ? V.SET : V.RESET;\n\n const p = params.params[0];\n\n if (ansi) {\n if (p === 2) return f(p, V.PERMANENTLY_RESET);\n if (p === 4) return f(p, b2v(cs.modes.insertMode));\n if (p === 12) return f(p, V.PERMANENTLY_SET);\n if (p === 20) return f(p, b2v(opts.convertEol));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n if (p === 1) return f(p, b2v(dm.applicationCursorKeys));\n if (p === 3) return f(p, opts.windowOptions.setWinLines ? (cols === 80 ? V.RESET : cols === 132 ? V.SET : V.NOT_RECOGNIZED) : V.NOT_RECOGNIZED);\n if (p === 6) return f(p, b2v(dm.origin));\n if (p === 7) return f(p, b2v(dm.wraparound));\n if (p === 8) return f(p, V.PERMANENTLY_SET);\n if (p === 9) return f(p, b2v(mouseProtocol === 'X10'));\n if (p === 12) return f(p, b2v(opts.cursorBlink));\n if (p === 25) return f(p, b2v(!cs.isCursorHidden));\n if (p === 45) return f(p, b2v(dm.reverseWraparound));\n if (p === 66) return f(p, b2v(dm.applicationKeypad));\n if (p === 67) return f(p, V.PERMANENTLY_RESET);\n if (p === 1000) return f(p, b2v(mouseProtocol === 'VT200'));\n if (p === 1002) return f(p, b2v(mouseProtocol === 'DRAG'));\n if (p === 1003) return f(p, b2v(mouseProtocol === 'ANY'));\n if (p === 1004) return f(p, b2v(dm.sendFocus));\n if (p === 1005) return f(p, V.PERMANENTLY_RESET);\n if (p === 1006) return f(p, b2v(mouseEncoding === 'SGR'));\n if (p === 1015) return f(p, V.PERMANENTLY_RESET);\n if (p === 1016) return f(p, b2v(mouseEncoding === 'SGR_PIXELS'));\n if (p === 1048) return f(p, V.SET); // xterm always returns SET here\n if (p === 47 || p === 1047 || p === 1049) return f(p, b2v(active === alt));\n if (p === 2004) return f(p, b2v(dm.bracketedPasteMode));\n if (p === 2026) return f(p, b2v(dm.synchronizedOutput));\n if (p === 9001) return this._optionsService.rawOptions.vtExtensions?.win32InputMode ? f(p, b2v(dm.win32InputMode)) : f(p, V.NOT_RECOGNIZED);\n return f(p, V.NOT_RECOGNIZED);\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n private _processSGR0(attr: IAttributeData): void {\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n attr.extended = attr.extended.clone();\n // Reset underline style and color. Note that we don't want to reset other\n // fields such as the url id.\n attr.extended.underlineStyle = UnderlineStyle.NONE;\n attr.extended.underlineColor &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters (strikethrough). | #Y |\n * | 21 | Doubly underlined. | #Y |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out (strikethrough). | #Y |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 53 | Overlined. | #Y |\n * | 55 | Not Overlined. | #Y |\n * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 221 | Not bold (kitty extension). | #Y |\n * | 222 | Not faint (kitty extension). | #Y |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #Y |\n * | 3 | Curly underline. | #Y |\n * | 4 | Dotted underline. | #Y |\n * | 5 | Dashed underline. | #Y |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58)\n * as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._processSGR0(this._curAttrData);\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n this._processSGR0(attr);\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 9) {\n // strikethrough\n attr.fg |= FgFlags.STRIKETHROUGH;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n this._processUnderline(UnderlineStyle.NONE, attr);\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 29) {\n // not strikethrough\n attr.fg &= ~FgFlags.STRIKETHROUGH;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 53) {\n // overline\n attr.bg |= BgFlags.OVERLINE;\n } else if (p === 55) {\n // not overline\n attr.bg &= ~BgFlags.OVERLINE;\n } else if (p === 221 && (this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl ?? true)) {\n // not bold (kitty extension)\n attr.fg &= ~FgFlags.BOLD;\n } else if (p === 222 && (this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl ?? true)) {\n // not faint (kitty extension)\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n case 996:\n // color scheme query (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._onRequestColorSchemeQuery.fire();\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full\n * terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be\n * sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._activeBuffer.scrollTop = 0;\n this._activeBuffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._activeBuffer.savedX = 0;\n this._activeBuffer.savedY = this._activeBuffer.ybase;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> reset to option.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - 0: reset to option\n * - empty, 1: blinking block\n * - 2: steady block\n * - 3: blinking underline\n * - 4: steady underline\n * - 5: blinking bar\n * - 6: steady bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.length === 0 ? 1 : params.params[0];\n if (param === 0) {\n this._coreService.decPrivateModes.cursorStyle = undefined;\n this._coreService.decPrivateModes.cursorBlink = undefined;\n } else {\n switch (param) {\n case 1:\n case 2:\n this._coreService.decPrivateModes.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._coreService.decPrivateModes.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._coreService.decPrivateModes.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._coreService.decPrivateModes.cursorBlink = isBlinking;\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._activeBuffer.scrollTop = top - 1;\n this._activeBuffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._activeBuffer.savedX = this._activeBuffer.x;\n this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n this._activeBuffer.savedCharsets = this._charsetService.charsets.slice();\n this._activeBuffer.savedGlevel = this._charsetService.glevel;\n this._activeBuffer.savedOriginMode = this._coreService.decPrivateModes.origin;\n this._activeBuffer.savedWraparoundMode = this._coreService.decPrivateModes.wraparound;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._activeBuffer.x = this._activeBuffer.savedX || 0;\n this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0);\n this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg;\n for (let i = 0; i < this._activeBuffer.savedCharsets.length; i++) {\n this._charsetService.setgCharset(i, this._activeBuffer.savedCharsets[i]);\n }\n this._charsetService.setgLevel(this._activeBuffer.savedGlevel);\n this._coreService.decPrivateModes.origin = this._activeBuffer.savedOriginMode;\n this._coreService.decPrivateModes.wraparound = this._activeBuffer.savedWraparoundMode;\n this._restrictCursor();\n return true;\n }\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event\n * `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. The color format of `spec` is derived from\n * `XParseColor` (see OSC 10 for supported formats). There may be multipe `c ; spec` pairs present\n * in the same instruction. If `spec` contains `?` the terminal returns a sequence with the\n * currently set color.\n */\n public setOrReportIndexedColor(data: string): boolean {\n const event: IColorEvent = [];\n const slots = data.split(';');\n while (slots.length > 1) {\n const idx = slots.shift() as string;\n const spec = slots.shift() as string;\n if (/^\\d+$/.exec(idx)) {\n const index = parseInt(idx);\n if (isValidColorIndex(index)) {\n if (spec === '?') {\n event.push({ type: ColorRequestType.REPORT, index });\n } else {\n const color = parseColor(spec);\n if (color) {\n event.push({ type: ColorRequestType.SET, index, color });\n }\n }\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 8 ; ; ST - create hyperlink\n * OSC 8 ; ; ST - finish hyperlink\n *\n * Test case:\n *\n * ```sh\n * printf '\\e]8;;http://example.com\\e\\\\This is a link\\e]8;;\\e\\\\\\n'\n * ```\n *\n * @vt: #Y OSC 8 \"Create hyperlink\" \"OSC 8 ; params ; uri BEL\" \"Create a hyperlink to `uri` using `params`.\"\n * `uri` is a hyperlink starting with `http://`, `https://`, `ftp://`, `file://` or `mailto://`. `params` is an\n * optional list of key=value assignments, separated by the : character.\n * Example: `id=xyz123:foo=bar:baz=quux`.\n * Currently only the id key is defined. Cells that share the same ID and URI share hover\n * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.\n */\n public setHyperlink(data: string): boolean {\n // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)\n const idx = data.indexOf(';');\n if (idx === -1) {\n // malformed sequence, just return as handled\n return true;\n }\n const id = data.slice(0, idx).trim();\n const uri = data.slice(idx + 1);\n if (uri) {\n return this._createHyperlink(id, uri);\n }\n if (id.trim()) {\n return false;\n }\n return this._finishHyperlink();\n }\n\n private _createHyperlink(params: string, uri: string): boolean {\n // It's legal to open a new hyperlink without explicitly finishing the previous one\n if (this._getCurrentLinkId()) {\n this._finishHyperlink();\n }\n const parsedParams = params.split(':');\n let id: string | undefined;\n const idParamIndex = parsedParams.findIndex(e => e.startsWith('id='));\n if (idParamIndex !== -1) {\n id = parsedParams[idParamIndex].slice(3) || undefined;\n }\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id, uri });\n this._curAttrData.updateExtended();\n return true;\n }\n\n private _finishHyperlink(): boolean {\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = 0;\n this._curAttrData.updateExtended();\n return true;\n }\n\n // special colors - OSC 10 | 11 | 12\n private _specialColors = [SpecialColorIndex.FOREGROUND, SpecialColorIndex.BACKGROUND, SpecialColorIndex.CURSOR];\n\n /**\n * Apply colors requests for special colors in OSC 10 | 11 | 12.\n * Since these commands are stacking from multiple parameters,\n * we handle them in a loop with an entry offset to `_specialColors`.\n */\n private _setOrReportSpecialColor(data: string, offset: number): boolean {\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i, ++offset) {\n if (offset >= this._specialColors.length) break;\n if (slots[i] === '?') {\n this._onColor.fire([{ type: ColorRequestType.REPORT, index: this._specialColors[offset] }]);\n } else {\n const color = parseColor(slots[i]);\n if (color) {\n this._onColor.fire([{ type: ColorRequestType.SET, index: this._specialColors[offset], color }]);\n }\n }\n }\n return true;\n }\n\n /**\n * OSC 10 ; | ST - set or query default foreground color\n *\n * @vt: #Y OSC 10 \"Set or query default foreground color\" \"OSC 10 ; Pt BEL\" \"Set or query default foreground color.\"\n * To set the color, the following color specification formats are supported:\n * - `rgb://` for `, , ` in `h | hh | hhh | hhhh`, where\n * `h` is a single hexadecimal digit (case insignificant). The different widths scale\n * from 4 bit (`h`) to 16 bit (`hhhh`) and get converted to 8 bit (`hh`).\n * - `#RGB` - 4 bits per channel, expanded to `#R0G0B0`\n * - `#RRGGBB` - 8 bits per channel\n * - `#RRRGGGBBB` - 12 bits per channel, truncated to `#RRGGBB`\n * - `#RRRRGGGGBBBB` - 16 bits per channel, truncated to `#RRGGBB`\n *\n * **Note:** X11 named colors are currently unsupported.\n *\n * If `Pt` contains `?` instead of a color specification, the terminal\n * returns a sequence with the current default foreground color\n * (use that sequence to restore the color after changes).\n *\n * **Note:** Other than xterm, xterm.js does not support OSC 12 - 19.\n * Therefore stacking multiple `Pt` separated by `;` only works for the first two entries.\n */\n public setOrReportFgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 0);\n }\n\n /**\n * OSC 11 ; | ST - set or query default background color\n *\n * @vt: #Y OSC 11 \"Set or query default background color\" \"OSC 11 ; Pt BEL\" \"Same as OSC 10, but for default background.\"\n */\n public setOrReportBgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 1);\n }\n\n /**\n * OSC 12 ; | ST - set or query default cursor color\n *\n * @vt: #Y OSC 12 \"Set or query default cursor color\" \"OSC 12 ; Pt BEL\" \"Same as OSC 10, but for default cursor color.\"\n */\n public setOrReportCursorColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 2);\n }\n\n /**\n * OSC 104 ; ST - restore ANSI color \n *\n * @vt: #Y OSC 104 \"Reset ANSI color\" \"OSC 104 ; c BEL\" \"Reset color number `c` to themed color.\"\n * `c` is the color index between 0 and 255. This function restores the default color for `c` as\n * specified by the loaded theme. Any number of `c` parameters may be given.\n * If no parameters are given, the entire indexed color table will be reset.\n */\n public restoreIndexedColor(data: string): boolean {\n if (!data) {\n this._onColor.fire([{ type: ColorRequestType.RESTORE }]);\n return true;\n }\n const event: IColorEvent = [];\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i) {\n if (/^\\d+$/.exec(slots[i])) {\n const index = parseInt(slots[i]);\n if (isValidColorIndex(index)) {\n event.push({ type: ColorRequestType.RESTORE, index });\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 110 ST - restore default foreground color\n *\n * @vt: #Y OSC 110 \"Restore default foreground color\" \"OSC 110 BEL\" \"Restore default foreground to themed color.\"\n */\n public restoreFgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.FOREGROUND }]);\n return true;\n }\n\n /**\n * OSC 111 ST - restore default background color\n *\n * @vt: #Y OSC 111 \"Restore default background color\" \"OSC 111 BEL\" \"Restore default background to themed color.\"\n */\n public restoreBgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.BACKGROUND }]);\n return true;\n }\n\n /**\n * OSC 112 ST - restore default cursor color\n *\n * @vt: #Y OSC 112 \"Restore default cursor color\" \"OSC 112 BEL\" \"Restore default cursor to themed color.\"\n */\n public restoreCursorColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.CURSOR }]);\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._activeBuffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] ?? DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._activeBuffer.tabs[this._activeBuffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n if (this._activeBuffer.y === this._activeBuffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;\n this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, scrollRegionHeight, 1);\n this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n } else {\n this._activeBuffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n *\n * @vt: #Y ESC RIS \"Full Reset\" \"ESC c\" \"Reset to initial state.\"\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = this._activeBuffer.ybase + this._activeBuffer.y + yOffset;\n const line = this._activeBuffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowTracker.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n\n\n /**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[Limited support, see below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the\n * corresponding CSI string, `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | `Ps \" q` (DECSCA 2 is reported as Ps = 0) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\n public requestStatusString(data: string, params: IParams): boolean {\n const f = (s: string): boolean => {\n this._coreService.triggerDataEvent(`${C0.ESC}${s}${C0.ESC}\\\\`);\n return true;\n };\n\n // access helpers\n const b = this._bufferService.buffer;\n const opts = this._optionsService.rawOptions;\n const STYLES: { [key: string]: number } = { 'block': 2, 'underline': 4, 'bar': 6 };\n\n if (data === '\"q') return f(`P1$r${this._curAttrData.isProtected() ? 1 : 0}\"q`);\n if (data === '\"p') return f(`P1$r61;1\"p`);\n if (data === 'r') return f(`P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r`);\n // FIXME: report real SGR settings instead of 0m\n if (data === 'm') return f(`P1$r0m`);\n if (data === ' q') return f(`P1$r${STYLES[opts.cursorStyle] - (opts.cursorBlink ? 1 : 0)} q`);\n return f(`P0$r`);\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n this._dirtyRowTracker.markRangeDirty(y1, y2);\n }\n\n // #region Kitty keyboard\n\n /**\n * CSI = flags ; mode u\n * Set Kitty keyboard protocol flags.\n * mode: 1=set, 2=set-only-specified, 3=reset-only-specified\n *\n * @vt: #Y CSI KKBDSET \"Kitty Keyboard Set\" \"CSI = Ps ; Pm u\" \"Set Kitty keyboard protocol flags.\"\n */\n public kittyKeyboardSet(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = params.params[0] || 0;\n const mode = params.params[1] || 1;\n const state = this._coreService.kittyKeyboard;\n\n switch (mode) {\n case 1: // Set all flags\n state.flags = flags;\n break;\n case 2: // Set only specified flags (OR)\n state.flags |= flags;\n break;\n case 3: // Reset only specified flags (AND NOT)\n state.flags &= ~flags;\n break;\n }\n return true;\n }\n\n /**\n * CSI ? u\n * Query Kitty keyboard protocol flags.\n * Terminal responds with CSI ? flags u\n *\n * @vt: #Y CSI KKBDQUERY \"Kitty Keyboard Query\" \"CSI ? u\" \"Query Kitty keyboard protocol flags.\"\n */\n public kittyKeyboardQuery(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = this._coreService.kittyKeyboard.flags;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${flags}u`);\n return true;\n }\n\n /**\n * CSI > flags u\n * Push Kitty keyboard flags onto stack and set new flags.\n *\n * @vt: #Y CSI KKBDPUSH \"Kitty Keyboard Push\" \"CSI > Ps u\" \"Push keyboard flags to stack and set new flags.\"\n */\n public kittyKeyboardPush(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = params.params[0] || 0;\n const state = this._coreService.kittyKeyboard;\n const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;\n const stack = isAlt ? state.altStack : state.mainStack;\n\n // Evict oldest entry if stack is full (DoS protection, limit of 16)\n if (stack.length >= 16) {\n stack.shift();\n }\n\n // Push current flags onto stack and set new flags\n stack.push(state.flags);\n state.flags = flags;\n return true;\n }\n\n /**\n * CSI < count u\n * Pop Kitty keyboard flags from stack.\n *\n * @vt: #Y CSI KKBDPOP \"Kitty Keyboard Pop\" \"CSI < Ps u\" \"Pop keyboard flags from stack.\"\n */\n public kittyKeyboardPop(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const count = Math.max(1, params.params[0] || 1);\n const state = this._coreService.kittyKeyboard;\n const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;\n const stack = isAlt ? state.altStack : state.mainStack;\n\n // Pop specified number of entries from stack\n for (let i = 0; i < count && stack.length > 0; i++) {\n state.flags = stack.pop()!;\n }\n // If stack is empty after popping, reset to 0\n if (stack.length === 0 && count > 0) {\n state.flags = 0;\n }\n return true;\n }\n\n // #endregion\n}\n\nexport interface IDirtyRowTracker {\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nclass DirtyRowTracker implements IDirtyRowTracker {\n public start!: number;\n public end!: number;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this.start = this._bufferService.buffer.y;\n this.end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this.start) {\n this.start = y;\n } else if (y > this.end) {\n this.end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n $temp = y1;\n y1 = y2;\n y2 = $temp;\n }\n if (y1 < this.start) {\n this.start = y1;\n }\n if (y2 > this.end) {\n this.end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n\nexport function isValidColorIndex(value: number): value is ColorIndex {\n return 0 <= value && value < 256;\n}\n", "\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer extends Disposable {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n private _isSyncWriting = false;\n private _syncCalls = 0;\n private _didUserInput = false;\n\n private readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) {\n super();\n }\n\n public handleUserInput(): void {\n this._didUserInput = true;\n }\n\n /**\n * Flushes all pending writes synchronously. This is useful when you need to\n * ensure all queued data is processed before performing an operation that\n * depends upon everything being parsed like resize.\n *\n * Note: This is unreliable with async parser handlers as it does not wait for\n * promises to resolve.\n */\n public flushSync(): void {\n // exit early if another sync write loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // Process all pending chunks synchronously\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n\n // Reset buffer state\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n\n this._isSyncWriting = false;\n }\n\n /**\n * @deprecated Unreliable, to be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n // stop writeSync recursions with maxSubsequentCalls argument\n // This is dangerous to use as it will lose the current data chunk\n // and return immediately.\n if (maxSubsequentCalls !== undefined && this._syncCalls > maxSubsequentCalls) {\n // comment next line if a whole loop block should only contain x `writeSync` calls\n // (total flat vs. deep nested limit)\n this._syncCalls = 0;\n return;\n }\n // append chunk to buffer\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(undefined);\n\n // increase recursion counter\n this._syncCalls++;\n // exit early if another writeSync loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n // we have to do it here as single loop steps to not corrupt loop subject\n // by another writeSync call triggered from _action\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n // reset to avoid reprocessing of chunks with scheduled innerWrite call\n // stopping scheduled innerWrite by offset > length condition\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n\n // allow another writeSync to loop\n this._isSyncWriting = false;\n this._syncCalls = 0;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n\n // If this is the first write call after the user has done some input,\n // parse it immediately to minimize input latency,\n // otherwise schedule for the next event\n if (this._didUserInput) {\n this._didUserInput = false;\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n this._innerWrite();\n return;\n }\n\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n /**\n * Inner write call, that enters the sliced chunk processing by timing.\n *\n * `lastTime` indicates, when the last _innerWrite call had started.\n * It is used to aggregate async handler execution under a timeout constraint\n * effectively lowering the redrawing needs, schematically:\n *\n * macroTask _innerWrite:\n * if (performance.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):\n * schedule microTask _innerWrite(lastTime)\n * else:\n * schedule macroTask _innerWrite(0)\n *\n * overall execution order on task queues:\n *\n * macrotasks: [...] --> _innerWrite(0) --> [...] --> screenUpdate --> [...]\n * m t: |\n * i a: [...]\n * c s: |\n * r k: while < timeout:\n * o s: _innerWrite(timeout)\n *\n * `promiseResult` depicts the promise resolve value of an async handler.\n * This value gets carried forward through all saved stack states of the\n * paused parser for proper continuation.\n *\n * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.\n */\n protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {\n const startTime = lastTime || performance.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const result = this._action(data, promiseResult);\n if (result) {\n /**\n * If we get a promise as return value, we re-schedule the continuation\n * as thenable on the promise and exit right away.\n *\n * The exit here means, that we block input processing at the current active chunk,\n * the exact execution position within the chunk is preserved by the saved\n * stack content in InputHandler and EscapeSequenceParser.\n *\n * Resuming happens automatically from that saved stack state.\n * Also the resolved promise value is passed along the callstack to\n * `EscapeSequenceParser.parse` to correctly resume the stopped handler loop.\n *\n * Exceptions on async handlers will be logged to console async, but do not interrupt\n * the input processing (continues with next handler at the current input position).\n */\n\n /**\n * If a promise takes long to resolve, we should schedule continuation behind setTimeout.\n * This might already be too late, if our .then enters really late (executor + prev thens\n * took very long). This cannot be solved here for the handler itself (it is the handlers\n * responsibility to slice hard work), but we can at least schedule a screen update as we\n * gain control.\n */\n const continuation: (r: boolean) => void = (r: boolean) => performance.now() - startTime >= WRITE_TIMEOUT_MS\n ? setTimeout(() => this._innerWrite(0, r))\n : this._innerWrite(startTime, r);\n\n /**\n * Optimization considerations:\n * The continuation above favors FPS over throughput by eval'ing `startTime` on resolve.\n * This might schedule too many screen updates with bad throughput drops (in case a slow\n * resolving handler sliced its work properly behind setTimeout calls). We cannot spot\n * this condition here, also the renderer has no way to spot nonsense updates either.\n * FIXME: A proper fix for this would track the FPS at the renderer entry level separately.\n *\n * If favoring of FPS shows bad throughtput impact, use the following instead. It favors\n * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the\n * current microtask queue (executed before setTimeout).\n */\n // const continuation: (r: boolean) => void = performance.now() - startTime >=\n // WRITE_TIMEOUT_MS\n // ? r => setTimeout(() => this._innerWrite(0, r))\n // : r => this._innerWrite(startTime, r);\n\n // Handle exceptions synchronously to current band position, idea:\n // 1. spawn a single microtask which we allow to throw hard\n // 2. spawn a promise immediately resolving to `true`\n // (executed on the same queue, thus properly aligned before continuation happens)\n result.catch(err => {\n queueMicrotask(() => {throw err;});\n return Promise.resolve(false);\n }).then(continuation);\n return;\n }\n\n const cb = this._callbacks[this._bufferOffset];\n if (cb) cb();\n this._bufferOffset++;\n this._pendingData -= data.length;\n\n if (performance.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite());\n } else {\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n this._onWriteParsed.fire();\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, IOscLinkService } from 'common/services/Services';\nimport { IMarker, IOscLinkData } from 'common/Types';\n\nexport class OscLinkService implements IOscLinkService {\n public serviceBrand: any;\n\n private _nextId = 1;\n\n /**\n * A map of the link key to link entry. This is used to add additional lines to links with ids.\n */\n private _entriesWithId: Map = new Map();\n\n /**\n * A map of the link id to the link entry. The \"link id\" (number) which is the numberic\n * representation of a unique link should not be confused with \"id\" (string) which comes in with\n * `id=` in the OSC link's properties.\n */\n private _dataByLinkId: Map = new Map();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n }\n\n public registerLink(data: IOscLinkData): number {\n const buffer = this._bufferService.buffer;\n\n // Links with no id will only ever be registered a single time\n if (data.id === undefined) {\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryNoId = {\n data,\n id: this._nextId++,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n // Add the line to the link if it already exists\n const castData = data as Required;\n const key = this._getEntryIdKey(castData);\n const match = this._entriesWithId.get(key);\n if (match) {\n this.addLineToLink(match.id, buffer.ybase + buffer.y);\n return match.id;\n }\n\n // Create the link\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryWithId = {\n id: this._nextId++,\n key: this._getEntryIdKey(castData),\n data: castData,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._entriesWithId.set(entry.key, entry);\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n public addLineToLink(linkId: number, y: number): void {\n const entry = this._dataByLinkId.get(linkId);\n if (!entry) {\n return;\n }\n if (entry.lines.every(e => e.line !== y)) {\n const marker = this._bufferService.buffer.addMarker(y);\n entry.lines.push(marker);\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n }\n }\n\n public getLinkData(linkId: number): IOscLinkData | undefined {\n return this._dataByLinkId.get(linkId)?.data;\n }\n\n private _getEntryIdKey(linkData: Required): string {\n return `${linkData.id};;${linkData.uri}`;\n }\n\n private _removeMarkerFromLink(entry: IOscLinkEntryNoId | IOscLinkEntryWithId, marker: IMarker): void {\n const index = entry.lines.indexOf(marker);\n if (index === -1) {\n return;\n }\n entry.lines.splice(index, 1);\n if (entry.lines.length === 0) {\n if (entry.data.id !== undefined) {\n this._entriesWithId.delete((entry as IOscLinkEntryWithId).key);\n }\n this._dataByLinkId.delete(entry.id);\n }\n }\n}\n\ninterface IOscLinkEntry {\n data: T;\n id: number;\n lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry> {\n key: string;\n}\n", "/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\nimport { OscLinkService } from 'common/services/OscLinkService';\nimport { Emitter, EventUtils, type IEvent } from 'common/Event';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\n\n// Only trigger this warning a single time per session\nlet hasWriteSyncWarnHappened = false;\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _oscLinkService: IOscLinkService;\n\n public readonly coreMouseService: ICoreMouseService;\n public readonly coreService: ICoreService;\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsWrappingHeuristics = this._register(new MutableDisposable());\n\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n protected _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n protected readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n protected readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n /**\n * Internally we track the source of the scroll but this is meaningless outside the library so\n * it's filtered out.\n */\n protected _onScrollApi?: Emitter;\n protected _onScroll = this._register(new Emitter());\n public get onScroll(): IEvent {\n if (!this._onScrollApi) {\n this._onScrollApi = this._register(new Emitter());\n this._onScroll.event(ev => {\n this._onScrollApi?.fire(ev.position);\n });\n }\n return this._onScrollApi.event;\n }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n public get options(): Required { return this.optionsService.options; }\n public set options(options: ITerminalOptions) {\n for (const key in options) {\n this.optionsService.options[key] = options[key];\n }\n }\n\n constructor(\n options: Partial\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = this._register(new OptionsService(options));\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this._register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this._register(this._instantiationService.createInstance(LogService));\n this._instantiationService.setService(ILogService, this._logService);\n this.coreService = this._register(this._instantiationService.createInstance(CoreService));\n this._instantiationService.setService(ICoreService, this.coreService);\n this.coreMouseService = this._register(this._instantiationService.createInstance(CoreMouseService));\n this._instantiationService.setService(ICoreMouseService, this.coreMouseService);\n this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n this._oscLinkService = this._instantiationService.createInstance(OscLinkService);\n this._instantiationService.setService(IOscLinkService, this._oscLinkService);\n\n\n // Register input handler and handle/forward events\n this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));\n this._register(EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed));\n\n // Setup listeners\n this._register(EventUtils.forward(this._bufferService.onResize, this._onResize));\n this._register(EventUtils.forward(this.coreService.onData, this._onData));\n this._register(EventUtils.forward(this.coreService.onBinary, this._onBinary));\n this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));\n this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));\n this._register(this.optionsService.onMultipleOptionChange(['windowsPty'], () => this._handleWindowsPtyOptionChange()));\n this._register(this._bufferService.onScroll(() => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n // Setup WriteBuffer\n this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));\n this._register(EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n /**\n * Write data to terminal synchonously.\n *\n * This method is unreliable with async parser handlers, thus should not\n * be used anymore. If you need blocking semantics on data input consider\n * `write` with a callback instead.\n *\n * @deprecated Unreliable, will be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {\n this._logService.warn('writeSync is unreliable and will be removed soon.');\n hasWriteSyncWarnHappened = true;\n }\n this._writeBuffer.writeSync(data, maxSubsequentCalls);\n }\n\n public input(data: string, wasUserInput: boolean = true): void {\n this.coreService.triggerDataEvent(data, wasUserInput);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n // Flush pending writes before resize to avoid race conditions where async\n // writes are processed with incorrect dimensions\n this._writeBuffer.flushSync();\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n this._bufferService.scroll(eraseAttr, isWrapped);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid\n * unwanted events being handled by the viewport when the event was triggered from the viewport\n * originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n this._bufferService.scrollLines(disp, suppressScrollEvent);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._inputHandler.registerEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerOscHandler(ident, callback);\n }\n\n /** Add handler for APC escape sequence. See xterm.d.ts for details. */\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerApcHandler(ident, callback);\n }\n\n protected _setup(): void {\n this._handleWindowsPtyOptionChange();\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this.coreService.reset();\n this.coreMouseService.reset();\n }\n\n\n private _handleWindowsPtyOptionChange(): void {\n let value = false;\n const windowsPty = this.optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber !== undefined && windowsPty.buildNumber !== undefined) {\n value = !!(windowsPty.backend === 'conpty' && windowsPty.buildNumber < 21376);\n }\n if (value) {\n this._enableWindowsWrappingHeuristics();\n } else {\n this._windowsWrappingHeuristics.clear();\n }\n }\n\n protected _enableWindowsWrappingHeuristics(): void {\n if (!this._windowsWrappingHeuristics.value) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.registerCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsWrappingHeuristics.value = toDisposable(() => {\n for (const d of disposables) {\n d.dispose();\n }\n });\n }\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IdleTaskQueue } from 'common/TaskQueue';\n\n// Work variables to avoid garbage collection.\nlet i = 0;\n\n/**\n * A generic list that is maintained in sorted order and allows values with duplicate keys. Deferred\n * batch insertion and deletion is used to significantly reduce the time it takes to insert and\n * delete a large amount of items in succession. This list is based on binary search and as such\n * locating a key will take O(log n) amortized, this includes the by key iterator.\n */\nexport class SortedList {\n private _array: T[] = [];\n\n private readonly _insertedValues: T[] = [];\n private readonly _flushInsertedTask = new IdleTaskQueue();\n private _isFlushingInserted = false;\n\n private readonly _deletedIndices: number[] = [];\n private readonly _flushDeletedTask = new IdleTaskQueue();\n private _isFlushingDeleted = false;\n\n constructor(\n private readonly _getKey: (value: T) => number\n ) {\n }\n\n public clear(): void {\n this._array.length = 0;\n this._insertedValues.length = 0;\n this._flushInsertedTask.clear();\n this._isFlushingInserted = false;\n this._deletedIndices.length = 0;\n this._flushDeletedTask.clear();\n this._isFlushingDeleted = false;\n }\n\n public insert(value: T): void {\n this._flushCleanupDeleted();\n if (this._insertedValues.length === 0) {\n this._flushInsertedTask.enqueue(() => this._flushInserted());\n }\n this._insertedValues.push(value);\n }\n\n private _flushInserted(): void {\n const sortedAddedValues = this._insertedValues.sort((a, b) => this._getKey(a) - this._getKey(b));\n let sortedAddedValuesIndex = 0;\n let arrayIndex = 0;\n\n const newArray = new Array(this._array.length + this._insertedValues.length);\n\n for (let newArrayIndex = 0; newArrayIndex < newArray.length; newArrayIndex++) {\n if (arrayIndex >= this._array.length || this._getKey(sortedAddedValues[sortedAddedValuesIndex]) <= this._getKey(this._array[arrayIndex])) {\n newArray[newArrayIndex] = sortedAddedValues[sortedAddedValuesIndex];\n sortedAddedValuesIndex++;\n } else {\n newArray[newArrayIndex] = this._array[arrayIndex++];\n }\n }\n\n this._array = newArray;\n this._insertedValues.length = 0;\n }\n\n private _flushCleanupInserted(): void {\n if (!this._isFlushingInserted && this._insertedValues.length > 0) {\n this._flushInsertedTask.flush();\n }\n }\n\n public delete(value: T): boolean {\n this._flushCleanupInserted();\n if (this._array.length === 0) {\n return false;\n }\n const key = this._getKey(value);\n if (key === undefined) {\n return false;\n }\n i = this._search(key);\n if (i === -1) {\n return false;\n }\n if (this._getKey(this._array[i]) !== key) {\n return false;\n }\n do {\n if (this._array[i] === value) {\n if (this._deletedIndices.length === 0) {\n this._flushDeletedTask.enqueue(() => this._flushDeleted());\n }\n this._deletedIndices.push(i);\n return true;\n }\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n return false;\n }\n\n private _flushDeleted(): void {\n this._isFlushingDeleted = true;\n const sortedDeletedIndices = this._deletedIndices.sort((a, b) => a - b);\n let sortedDeletedIndicesIndex = 0;\n const newArray = new Array(this._array.length - sortedDeletedIndices.length);\n let newArrayIndex = 0;\n for (let i = 0; i < this._array.length; i++) {\n if (sortedDeletedIndices[sortedDeletedIndicesIndex] === i) {\n sortedDeletedIndicesIndex++;\n } else {\n newArray[newArrayIndex++] = this._array[i];\n }\n }\n this._array = newArray;\n this._deletedIndices.length = 0;\n this._isFlushingDeleted = false;\n }\n\n private _flushCleanupDeleted(): void {\n if (!this._isFlushingDeleted && this._deletedIndices.length > 0) {\n this._flushDeletedTask.flush();\n }\n }\n\n public *getKeyIterator(key: number): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n yield this._array[i];\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public forEachByKey(key: number, callback: (value: T) => void): void {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n callback(this._array[i]);\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public values(): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n // Duplicate the array to avoid issues when _array changes while iterating\n return [...this._array].values();\n }\n\n private _search(key: number): number {\n let min = 0;\n let max = this._array.length - 1;\n while (max >= min) {\n let mid = (min + max) >> 1;\n const midKey = this._getKey(this._array[mid]);\n if (midKey > key) {\n max = mid - 1;\n } else if (midKey < key) {\n min = mid + 1;\n } else {\n // key in list, walk to lowest duplicate\n while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n mid--;\n }\n return mid;\n }\n }\n // key not in list\n // still return closest min (also used as insert position)\n return min;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { css } from 'common/Color';\nimport { Disposable, DisposableStore, toDisposable } from 'common/Lifecycle';\nimport { IDecorationService, IInternalDecoration } from 'common/services/Services';\nimport { SortedList } from 'common/SortedList';\nimport { IColor } from 'common/Types';\nimport { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';\nimport { Emitter } from 'common/Event';\n\n// Work variables to avoid garbage collection\nlet $xmin = 0;\nlet $xmax = 0;\nlet $ymin = 0;\nlet $ymax = 0;\n\nexport class DecorationService extends Disposable implements IDecorationService {\n public serviceBrand: any;\n\n /**\n * A list of all decorations, sorted by the marker's line value. This relies on the fact that\n * while marker line values do change, they should all change by the same amount so this should\n * never become out of order.\n */\n private readonly _decorations: SortedList = new SortedList(e => e?.marker.line);\n\n private readonly _onDecorationRegistered = this._register(new Emitter());\n public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n private readonly _onDecorationRemoved = this._register(new Emitter());\n public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n public get decorations(): IterableIterator { return this._decorations.values(); }\n\n constructor() {\n super();\n\n this._register(toDisposable(() => this.reset()));\n }\n\n public registerDecoration(options: IDecorationOptions): IDecoration | undefined {\n if (options.marker.isDisposed) {\n return undefined;\n }\n const decoration = new Decoration(options);\n if (decoration) {\n const markerDispose = decoration.marker.onDispose(() => decoration.dispose());\n const listener = decoration.onDispose(() => {\n listener.dispose();\n if (decoration) {\n if (this._decorations.delete(decoration)) {\n this._onDecorationRemoved.fire(decoration);\n }\n markerDispose.dispose();\n }\n });\n this._decorations.insert(decoration);\n this._onDecorationRegistered.fire(decoration);\n }\n return decoration;\n }\n\n public reset(): void {\n for (const d of this._decorations.values()) {\n d.dispose();\n }\n this._decorations.clear();\n }\n\n public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator {\n let xmin = 0;\n let xmax = 0;\n let ymin = 0;\n let ymax = 0;\n for (const d of this._decorations.values()) {\n ymin = d.marker.line;\n ymax = ymin + (d.options.height ?? 1);\n if (line < ymin || line >= ymax) {\n continue;\n }\n xmin = d.options.x ?? 0;\n xmax = xmin + (d.options.width ?? 1);\n if (x >= xmin && x < xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n yield d;\n }\n }\n }\n\n public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void {\n for (const d of this._decorations.values()) {\n $ymin = d.marker.line;\n $ymax = $ymin + (d.options.height ?? 1);\n if (line < $ymin || line >= $ymax) {\n continue;\n }\n $xmin = d.options.x ?? 0;\n $xmax = $xmin + (d.options.width ?? 1);\n if (x >= $xmin && x < $xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n callback(d);\n }\n }\n }\n}\n\nclass Decoration extends DisposableStore implements IInternalDecoration {\n public readonly marker: IMarker;\n public element: HTMLElement | undefined;\n\n public readonly onRenderEmitter = this.add(new Emitter());\n public readonly onRender = this.onRenderEmitter.event;\n private readonly _onDispose = this.add(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n private _cachedBg: IColor | undefined | null = null;\n public get backgroundColorRGB(): IColor | undefined {\n if (this._cachedBg === null) {\n if (this.options.backgroundColor) {\n this._cachedBg = css.toColor(this.options.backgroundColor);\n } else {\n this._cachedBg = undefined;\n }\n }\n return this._cachedBg;\n }\n\n private _cachedFg: IColor | undefined | null = null;\n public get foregroundColorRGB(): IColor | undefined {\n if (this._cachedFg === null) {\n if (this.options.foregroundColor) {\n this._cachedFg = css.toColor(this.options.foregroundColor);\n } else {\n this._cachedFg = undefined;\n }\n }\n return this._cachedFg;\n }\n\n constructor(\n public readonly options: IDecorationOptions\n ) {\n super();\n this.marker = options.marker;\n if (this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position) {\n this.options.overviewRulerOptions.position = 'full';\n }\n }\n\n public override dispose(): void {\n this._onDispose.fire();\n super.dispose();\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nconst RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second\n\nimport { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to update screen readers to update at most once configurable interval of time.\n */\nexport class TimeBasedDebouncer implements IRenderDebouncer {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n\n // The last moment that the Terminal was refreshed at\n private _lastRefreshMs = 0;\n // Whether a trailing refresh should be triggered due to a refresh request that was throttled\n private _additionalRefreshRequested = false;\n\n private _refreshTimeoutID: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _debounceThresholdMS = RENDER_DEBOUNCE_THRESHOLD_MS\n ) {\n }\n\n public dispose(): void {\n if (this._refreshTimeoutID) {\n clearTimeout(this._refreshTimeoutID);\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart ?? 0;\n rowEnd = rowEnd ?? this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n // Only refresh if the time since last refresh is above a threshold, otherwise wait for\n // enough time to pass before refreshing again.\n const refreshRequestTime: number = performance.now();\n if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {\n // Enough time has lapsed since the last refresh; refresh immediately\n this._lastRefreshMs = refreshRequestTime;\n this._innerRefresh();\n } else if (!this._additionalRefreshRequested) {\n // This is the first additional request throttled; set up trailing refresh\n const elapsed = refreshRequestTime - this._lastRefreshMs;\n const waitPeriodBeforeTrailingRefresh = this._debounceThresholdMS - elapsed;\n this._additionalRefreshRequested = true;\n\n this._refreshTimeoutID = window.setTimeout(() => {\n this._lastRefreshMs = performance.now();\n this._innerRefresh();\n this._additionalRefreshRequested = false;\n this._refreshTimeoutID = undefined; // No longer need to clear the timeout\n }, waitPeriodBeforeTrailingRefresh);\n }\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal, IRenderDebouncer } from 'browser/Types';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IInstantiationService } from 'common/services/Services';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\n// Turn this on to unhide the accessibility tree and display it under\n// (instead of overlapping with) the terminal.\nconst DEBUG = false;\n\nexport class AccessibilityManager extends Disposable {\n private _debugRootContainer: HTMLElement | undefined;\n private _accessibilityContainer: HTMLElement;\n\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _rowColumns: WeakMap = new WeakMap();\n\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n private _liveRegionDebouncer: IRenderDebouncer;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n const doc = this._coreBrowserService.mainDocument;\n this._accessibilityContainer = doc.createElement('div');\n this._accessibilityContainer.classList.add('xterm-accessibility');\n\n this._rowContainer = doc.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._accessibilityContainer.appendChild(this._rowContainer);\n\n this._liveRegion = doc.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityContainer.appendChild(this._liveRegion);\n this._liveRegionDebouncer = this._register(new TimeBasedDebouncer(this._renderRows.bind(this)));\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n\n if (DEBUG) {\n this._accessibilityContainer.classList.add('debug');\n this._rowContainer.classList.add('debug');\n\n // Use a `
` container so that the css will still apply.\n this._debugRootContainer = doc.createElement('div');\n this._debugRootContainer.classList.add('xterm');\n\n this._debugRootContainer.appendChild(doc.createTextNode('------start a11y------'));\n this._debugRootContainer.appendChild(this._accessibilityContainer);\n this._debugRootContainer.appendChild(doc.createTextNode('------end a11y------'));\n\n this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);\n } else {\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);\n }\n\n this._register(this._terminal.onResize(e => this._handleResize(e.rows)));\n this._register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this._register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this._register(this._terminal.onA11yChar(char => this._handleChar(char)));\n this._register(this._terminal.onLineFeed(() => this._handleChar('\\n')));\n this._register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));\n this._register(this._terminal.onKey(e => this._handleKey(e.key)));\n this._register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this._register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n this._register(addDisposableListener(doc, 'selectionchange', () => this._handleSelectionChange()));\n this._register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));\n\n this._refreshRowsDimensions();\n this._refreshRows();\n this._register(toDisposable(() => {\n if (DEBUG) {\n this._debugRootContainer!.remove();\n } else {\n this._accessibilityContainer.remove();\n }\n this._rowElements.length = 0;\n }));\n }\n\n private _handleTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._handleChar(' ');\n }\n }\n\n private _handleChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent = Strings.tooMuchOutput.get();\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n }\n\n private _handleKey(keyChar: string): void {\n this._clearLiveRegion();\n // Only add the char if there is no control character.\n if (!/\\p{Control}/u.test(keyChar)) {\n this._charsToConsume.push(keyChar);\n }\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const line = buffer.lines.get(buffer.ydisp + i);\n const columns: number[] = [];\n const lineData = line?.translateToString(true, undefined, undefined, columns) || '';\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.textContent = '\\u00a0';\n this._rowColumns.set(element, [0, 1]);\n } else {\n element.textContent = lineData;\n this._rowColumns.set(element, columns);\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n this._alignRowWidth(element);\n }\n }\n this._announceCharacters();\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n if (this._liveRegion.textContent === Strings.tooMuchOutput.get()) {\n this._clearLiveRegion();\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n\n private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target as HTMLElement;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _handleSelectionChange(): void {\n if (this._rowElements.length === 0) {\n return;\n }\n\n const selection = this._coreBrowserService.mainDocument.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.isCollapsed) {\n // Only do something when the anchorNode is inside the row container. This\n // behavior mirrors what we do with mouse --- if the mouse clicks\n // somewhere outside of the terminal, we don't clear the selection.\n if (this._rowContainer.contains(selection.anchorNode)) {\n this._terminal.clearSelection();\n }\n return;\n }\n\n if (!selection.anchorNode || !selection.focusNode) {\n console.error('anchorNode and/or focusNode are null');\n return;\n }\n\n // Sort the two selection points in document order.\n let begin = { node: selection.anchorNode, offset: selection.anchorOffset };\n let end = { node: selection.focusNode, offset: selection.focusOffset };\n if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {\n [begin, end] = [end, begin];\n }\n\n // Clamp begin/end to the inside of the row container.\n if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {\n begin = { node: this._rowElements[0].childNodes[0], offset: 0 };\n }\n if (!this._rowContainer.contains(begin.node)) {\n // This happens when `begin` is below the last row.\n return;\n }\n const lastRowElement = this._rowElements.slice(-1)[0];\n if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {\n end = {\n node: lastRowElement,\n offset: lastRowElement.textContent?.length ?? 0\n };\n }\n if (!this._rowContainer.contains(end.node)) {\n // This happens when `end` is above the first row.\n return;\n }\n\n const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {\n // `node` is either the row element or the Text node inside it.\n const rowElement: any = node instanceof Text ? node.parentNode : node;\n let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;\n if (isNaN(row)) {\n console.warn('row is invalid. Race condition?');\n return null;\n }\n\n const columns = this._rowColumns.get(rowElement);\n if (!columns) {\n console.warn('columns is null. Race condition?');\n return null;\n }\n\n let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;\n if (column >= this._terminal.cols) {\n ++row;\n column = 0;\n }\n return {\n row,\n column\n };\n };\n\n const beginRowColumn = toRowColumn(begin);\n const endRowColumn = toRowColumn(end);\n\n if (!beginRowColumn || !endRowColumn) {\n return;\n }\n\n if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {\n // This should not happen unless we have some bugs.\n throw new Error('invalid range');\n }\n\n this._terminal.select(\n beginRowColumn.column,\n beginRowColumn.row,\n (endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column\n );\n }\n\n private _handleResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.css.cell.height) {\n return;\n }\n Object.assign(this._accessibilityContainer.style, {\n width: `${this._renderService.dimensions.css.canvas.width}px`,\n fontSize: `${this._terminal.options.fontSize}px`\n });\n if (this._rowElements.length !== this._terminal.rows) {\n this._handleResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n this._alignRowWidth(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\n }\n\n /**\n * Scale the width of a row so that each of the character is (mostly) aligned\n * with the actual rendering. This will allow the screen reader to draw\n * selection outline at the correct position.\n *\n * On top of using the \"monospace\" font and correct font size, the scaling\n * here is necessary to handle characters that are not covered by the font\n * (e.g. CJK).\n */\n private _alignRowWidth(element: HTMLElement): void {\n element.style.transform = '';\n const width = element.getBoundingClientRect().width;\n const lastColumn = this._rowColumns.get(element)?.slice(-1)?.[0];\n if (!lastColumn) {\n return;\n }\n const targetWidth = lastColumn * this._renderService.dimensions.css.cell.width;\n element.style.transform = `scaleX(${targetWidth / width})`;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';\nimport { Disposable, dispose, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { IBufferService } from 'common/services/Services';\nimport { ILinkProviderService, IMouseService, IRenderService } from './services/Services';\nimport { Emitter } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nexport class Linkifier extends Disposable implements ILinkifier2 {\n public get currentLink(): ILinkWithState | undefined { return this._currentLink; }\n protected _currentLink: ILinkWithState | undefined;\n private _mouseDownLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _wasResized: boolean = false;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private readonly _onShowLinkUnderline = this._register(new Emitter());\n public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n private readonly _onHideLinkUnderline = this._register(new Emitter());\n public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;\n\n constructor(\n private readonly _element: HTMLElement,\n @IMouseService private readonly _mouseService: IMouseService,\n @IRenderService private readonly _renderService: IRenderService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ILinkProviderService private readonly _linkProviderService: ILinkProviderService\n ) {\n super();\n this._register(toDisposable(() => {\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n this._lastMouseEvent = undefined;\n // Clear out link providers as they could easily cause an embedder memory leak\n this._activeProviderReplies?.clear();\n }));\n // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.\n this._register(this._bufferService.onResize(() => {\n this._clearCurrentLink();\n this._wasResized = true;\n }));\n this._register(addDisposableListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this._register(addDisposableListener(this._element, 'mousemove', this._handleMouseMove.bind(this)));\n this._register(addDisposableListener(this._element, 'mousedown', this._handleMouseDown.bind(this)));\n this._register(addDisposableListener(this._element, 'mouseup', this._handleMouseUp.bind(this)));\n }\n\n private _handleMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._handleHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _handleHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine\n // should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y || this._wasResized) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n this._wasResized = false;\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n for (const [i, linkProvider] of this._linkProviderService.linkProviders.entries()) {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n }\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _handleMouseDown(): void {\n this._mouseDownLink = this._currentLink;\n }\n\n private _handleMouseUp(event: MouseEvent): void {\n if (!this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n\n if (this._mouseDownLink && linkEquals(this._mouseDownLink.link, this._currentLink.link) && this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._lastMouseEvent) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Listen to viewport changes to re-render the link under the cursor (only when the line the\n // link is on changes)\n this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n // Sanity check, this shouldn't happen in practice as this listener would be disposed\n if (!this._currentLink) {\n return;\n }\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n const end = this._bufferService.buffer.ydisp + 1 + e.end;\n // Only clear the link if the viewport change happened on this line\n if (this._currentLink.link.range.start.y >= start && this._currentLink.link.range.end.y <= end) {\n this._clearCurrentLink(start, end);\n if (this._lastMouseEvent) {\n // re-eval previously active link after changes\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService!);\n if (position) {\n this._askForLink(position, false);\n }\n }\n }\n }));\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const lower = link.range.start.y * this._bufferService.cols + link.range.start.x;\n const upper = link.range.end.y * this._bufferService.cols + link.range.end.x;\n const current = position.y * this._bufferService.cols + position.x;\n return (lower <= current && current <= upper);\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n\nfunction linkEquals(a: ILink, b: ILink): boolean {\n return (\n a.text === b.text &&\n a.range.start.x === b.range.start.x &&\n a.range.start.y === b.range.start.y &&\n a.range.end.x === b.range.end.x &&\n a.range.end.y === b.range.end.y\n );\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';\nimport { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'browser/Types';\nimport { Viewport } from 'browser/Viewport';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { LinkProviderService } from 'browser/services/LinkProviderService';\nimport { MouseService } from 'browser/services/MouseService';\nimport { RenderService } from 'browser/services/RenderService';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';\nimport { ThemeService } from 'browser/services/ThemeService';\nimport { KeyboardService } from 'browser/services/KeyboardService';\nimport { channels, color, rgb } from 'common/Color';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport * as Browser from 'common/Platform';\nimport { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IBuffer } from 'common/buffer/Types';\nimport { C0, C1ESCAPED } from 'common/data/EscapeSequences';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { Linkifier } from './Linkifier';\nimport { Emitter, EventUtils, type IEvent } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { MutableDisposable, toDisposable } from 'common/Lifecycle';\n\nexport class CoreBrowserTerminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n private readonly _linkifier: MutableDisposable = this._register(new MutableDisposable());\n public get linkifier(): ILinkifier2 | undefined { return this._linkifier.value; }\n private _overviewRulerRenderer: OverviewRulerRenderer | undefined;\n private _viewport: Viewport | undefined;\n\n public browser: IBrowser = Browser as any;\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n private _customWheelEventHandler: CustomWheelEventHandler | undefined;\n\n // Browser services\n private readonly _decorationService: DecorationService;\n private readonly _keyboardService: IKeyboardService;\n private readonly _linkProviderService: ILinkProviderService;\n\n // Optional browser services\n private _charSizeService: ICharSizeService | undefined;\n private _coreBrowserService: ICoreBrowserService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _themeService: IThemeService | undefined;\n private _characterJoinerService: ICharacterJoinerService | undefined;\n private _selectionService: ISelectionService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n /**\n * Records whether a keydown event has occured since the last keyup event, i.e. whether a key\n * is currently \"pressed\".\n */\n private _keyDownSeen: boolean = false;\n\n /**\n * Records whether the keypress event has already been handled and triggered a data event, if so\n * the input event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyPressHandled: boolean = false;\n\n /**\n * Records whether there has been a keydown event for a dead key without a corresponding keydown\n * event for the composed/alternative character. If we cancel the keydown event for the dead key,\n * no events will be emitted for the final character.\n */\n private _unprocessedDeadKey: boolean = false;\n\n private _compositionHelper: ICompositionHelper | undefined;\n private _accessibilityManager: MutableDisposable = this._register(new MutableDisposable());\n\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onKey = this._register(new Emitter<{ key: string, domEvent: KeyboardEvent }>());\n public readonly onKey = this._onKey.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onBell = this._register(new Emitter());\n public readonly onBell = this._onBell.event;\n\n private _onFocus = this._register(new Emitter());\n public get onFocus(): IEvent { return this._onFocus.event; }\n private _onBlur = this._register(new Emitter());\n public get onBlur(): IEvent { return this._onBlur.event; }\n private _onA11yCharEmitter = this._register(new Emitter());\n public get onA11yChar(): IEvent { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = this._register(new Emitter());\n public get onA11yTab(): IEvent { return this._onA11yTabEmitter.event; }\n private _onWillOpen = this._register(new Emitter());\n public get onWillOpen(): IEvent { return this._onWillOpen.event; }\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n\n public get dimensions(): IRenderDimensionsApi | undefined {\n if (!this._renderService) {\n return undefined;\n }\n const dimensions = this._renderService.dimensions;\n return {\n css: {\n canvas: { ...dimensions.css.canvas },\n cell: { ...dimensions.css.cell }\n },\n device: {\n canvas: { ...dimensions.device.canvas },\n cell: { ...dimensions.device.cell },\n char: { ...dimensions.device.char }\n }\n };\n }\n\n constructor(\n options: Partial = {}\n ) {\n super(options);\n\n this._setup();\n\n this._decorationService = this._instantiationService.createInstance(DecorationService);\n this._instantiationService.setService(IDecorationService, this._decorationService);\n this._keyboardService = this._instantiationService.createInstance(KeyboardService);\n this._instantiationService.setService(IKeyboardService, this._keyboardService);\n this._linkProviderService = this._instantiationService.createInstance(LinkProviderService);\n this._instantiationService.setService(ILinkProviderService, this._linkProviderService);\n this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OscLinkProvider));\n\n // Setup InputHandler listeners\n this._register(this._inputHandler.onRequestBell(() => this._onBell.fire()));\n this._register(this._inputHandler.onRequestRefreshRows((e) => this.refresh(e?.start ?? 0, e?.end ?? (this.rows - 1))));\n this._register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));\n this._register(this._inputHandler.onRequestReset(() => this.reset()));\n this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));\n this._register(EventUtils.forward(this._inputHandler.onCursorMove, this._onCursorMove));\n this._register(EventUtils.forward(this._inputHandler.onTitleChange, this._onTitleChange));\n this._register(EventUtils.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this._register(EventUtils.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n\n this._register(toDisposable(() => {\n this._customKeyEventHandler = undefined;\n this.element?.parentNode?.removeChild(this.element);\n }));\n }\n\n /**\n * Handle color event from inputhandler for OSC 4|104 | 10|110 | 11|111 | 12|112.\n * An event from OSC 4|104 may contain multiple set or report requests, and multiple\n * or none restore requests (resetting all),\n * while an event from OSC 10|110 | 11|111 | 12|112 always contains a single request.\n */\n private _handleColorEvent(event: IColorEvent): void {\n if (!this._themeService) return;\n for (const req of event) {\n let acc: 'foreground' | 'background' | 'cursor' | 'ansi';\n let ident = '';\n switch (req.index) {\n case SpecialColorIndex.FOREGROUND: // OSC 10 | 110\n acc = 'foreground';\n ident = '10';\n break;\n case SpecialColorIndex.BACKGROUND: // OSC 11 | 111\n acc = 'background';\n ident = '11';\n break;\n case SpecialColorIndex.CURSOR: // OSC 12 | 112\n acc = 'cursor';\n ident = '12';\n break;\n default: // OSC 4 | 104\n // we can skip the [0..255] range check here (already done in inputhandler)\n acc = 'ansi';\n ident = '4;' + req.index;\n }\n switch (req.type) {\n case ColorRequestType.REPORT:\n const colorRgb = color.toColorRGB(acc === 'ansi'\n ? this._themeService.colors.ansi[req.index]\n : this._themeService.colors[acc]);\n this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(colorRgb)}${C1ESCAPED.ST}`);\n break;\n case ColorRequestType.SET:\n if (acc === 'ansi') {\n this._themeService.modifyColors(colors => colors.ansi[req.index] = channels.toColor(...req.color));\n } else {\n const narrowedAcc = acc;\n this._themeService.modifyColors(colors => colors[narrowedAcc] = channels.toColor(...req.color));\n }\n break;\n case ColorRequestType.RESTORE:\n this._themeService.restoreColor(req.index);\n break;\n }\n }\n }\n\n /**\n * Reports the current color scheme (dark or light) based on the relative luminance\n * of the background and foreground theme colors.\n * Sends CSI ? 997 ; 1 n for dark mode or CSI ? 997 ; 2 n for light mode.\n */\n private _reportColorScheme(): void {\n if (!this._themeService) return;\n const bgLuminance = rgb.relativeLuminance(this._themeService.colors.background.rgba >> 8);\n const fgLuminance = rgb.relativeLuminance(this._themeService.colors.foreground.rgba >> 8);\n // Dark mode = background is darker than foreground (lower luminance)\n const colorSchemeMode = bgLuminance < fgLuminance ? 1 : 2;\n this.coreService.triggerDataEvent(`${C0.ESC}[?997;${colorSchemeMode}n`);\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n private _handleScreenReaderModeOptionChange(value: boolean): void {\n if (value) {\n if (!this._accessibilityManager.value && this._renderService) {\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n } else {\n this._accessibilityManager.clear();\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _handleTextAreaFocus(ev: FocusEvent): void {\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _handleTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing || !this._renderService) {\n return;\n }\n const cursorY = this.buffer.ybase + this.buffer.y;\n const bufferLine = this.buffer.lines.get(cursorY);\n if (!bufferLine) {\n return;\n }\n const cursorX = Math.min(this.buffer.x, this.cols - 1);\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const width = bufferLine.getWidth(cursorX);\n const cellWidth = this._renderService.dimensions.css.cell.width * width;\n const cursorTop = this.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = cellWidth + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this._register(addDisposableListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this.coreService, this.optionsService);\n this._register(addDisposableListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this._register(addDisposableListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this._register(addDisposableListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this._register(addDisposableListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this._register(addDisposableListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this._register(addDisposableListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this._register(addDisposableListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this._register(addDisposableListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this._register(addDisposableListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this._register(addDisposableListener(this.textarea!, 'input', (ev: InputEvent) => this._inputEvent(ev), true));\n this._register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n // If the terminal is already opened\n if (this.element?.ownerDocument.defaultView && this._coreBrowserService) {\n // Adjust the window if needed\n if (this.element.ownerDocument.defaultView !== this._coreBrowserService.window) {\n this._coreBrowserService.window = this.element.ownerDocument.defaultView;\n }\n return;\n }\n\n this._document = parent.ownerDocument;\n if (this.options.documentOverride && this.options.documentOverride instanceof Document) {\n this._document = this.optionsService.rawOptions.documentOverride as Document;\n }\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.classList.toggle('allow-transparency', this.options.allowTransparency);\n this._register(this.optionsService.onSpecificOptionChange('allowTransparency', value => this.element!.classList.toggle('allow-transparency', value)));\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = this._document.createDocumentFragment();\n this._viewportElement = this._document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n\n this.screenElement = this._document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n this._register(addDisposableListener(this.screenElement, 'mousemove', (ev: MouseEvent) => this.updateCursorStyle(ev)));\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = this._document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n const textarea = this.textarea = this._document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel.get());\n if (!Browser.isChromeOS) {\n // ChromeVox on ChromeOS does not like this. See\n // https://issuetracker.google.com/issues/260170397\n this.textarea.setAttribute('aria-multiline', 'false');\n }\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n this._register(this.optionsService.onSpecificOptionChange('disableStdin', () => textarea.readOnly = this.optionsService.rawOptions.disableStdin));\n this.textarea.readOnly = this.optionsService.rawOptions.disableStdin;\n\n // Register the core browser service before the generic textarea handlers are registered so it\n // handles them first. Otherwise the renderers may use the wrong focus state.\n this._coreBrowserService = this._register(this._instantiationService.createInstance(CoreBrowserService,\n this.textarea,\n parent.ownerDocument.defaultView ?? window,\n // Force unsafe null in node.js environment for tests\n this._document ?? (typeof window !== 'undefined') ? window.document : null as any\n ));\n this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);\n\n this._register(addDisposableListener(this.textarea, 'focus', (ev: FocusEvent) => this._handleTextAreaFocus(ev)));\n this._register(addDisposableListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._themeService = this._instantiationService.createInstance(ThemeService);\n this._instantiationService.setService(IThemeService, this._themeService);\n\n // CSI ? 996 n - color scheme query (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n this._register(this._inputHandler.onRequestColorSchemeQuery(() => this._reportColorScheme()));\n\n // Emit unsolicited color scheme notification on theme change when DECSET 2031 is enabled\n this._register(this._themeService.onChangeColors(() => {\n if (this.coreService.decPrivateModes.colorSchemeUpdates) {\n this._reportColorScheme();\n }\n }));\n\n this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\n\n this._renderService = this._register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this._register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));\n this._register(this._renderService.onDimensionsChange(e => this._onDimensionsChange.fire({\n css: {\n canvas: { ...e.css.canvas },\n cell: { ...e.css.cell }\n },\n device: {\n canvas: { ...e.device.canvas },\n cell: { ...e.device.cell },\n char: { ...e.device.char }\n }\n })));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._compositionView = this._document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n const linkifier = this._linkifier.value = this._register(this._instantiationService.createInstance(Linkifier, this.screenElement));\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n try {\n this._onWillOpen.fire(this.element);\n }\n catch { /* fails to load addon for some reason */ }\n if (!this._renderService.hasRenderer()) {\n this._renderService.setRenderer(this._createRenderer());\n }\n\n this._register(this.onCursorMove(() => {\n this._renderService!.handleCursorMove();\n this._syncTextArea();\n }));\n this._register(this.onResize(() => this._renderService!.handleResize(this.cols, this.rows)));\n this._register(this.onBlur(() => this._renderService!.handleBlur()));\n this._register(this.onFocus(() => this._renderService!.handleFocus()));\n\n this._viewport = this._register(this._instantiationService.createInstance(Viewport, this.element, this.screenElement));\n this._register(this._viewport.onRequestScrollLines(e => {\n super.scrollLines(e, false);\n this.refresh(0, this.rows - 1);\n }));\n\n this._selectionService = this._register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement,\n linkifier\n ));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this._register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this._register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this._register(this._selectionService.onRequestRedraw(e => this._renderService!.handleSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this._register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this._register(EventUtils.any(\n this._onScroll.event,\n this._inputHandler.onScroll\n )(() => {\n this._selectionService!.refresh();\n this._viewport?.queueSync();\n }));\n\n this._register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));\n this._register(addDisposableListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this.coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n this._register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));\n\n if (this.options.overviewRuler.width) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n this.optionsService.onSpecificOptionChange('overviewRuler', value => {\n if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n });\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n return this._instantiationService.createInstance(DomRenderer, this, this._document!, this.element!, this.screenElement!, this._viewportElement!, this._helperContainer!, this.linkifier!);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // Get mouse coordinates\n const pos = self._mouseService?.getMouseReportCoords(ev, self.screenElement!);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev as any).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n if (self._customWheelEventHandler && self._customWheelEventHandler(ev as WheelEvent) === false) {\n return false;\n }\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n const lines = self.coreMouseService.consumeWheelEvent(\n ev as WheelEvent,\n self._renderService?.dimensions?.device?.cell?.height,\n self._coreBrowserService?.dpr\n );\n if (lines === 0) {\n return false;\n }\n action = deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self.coreMouseService.triggerMouseEvent({\n col: pos.col,\n row: pos.row,\n x: pos.x,\n y: pos.y,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this._register(this.coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.rawOptions.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this.coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else {\n requestedEvents.mouseup ??= eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else {\n requestedEvents.mousedrag ??= eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol;\n\n // Ensure document-level listeners are removed on dispose\n this._register(toDisposable(() => {\n if (requestedEvents.mouseup) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }));\n\n /**\n * \"Always on\" event listeners.\n */\n this._register(addDisposableListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this.coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n }));\n\n this._register(addDisposableListener(el, 'wheel', (ev: WheelEvent) => {\n // do nothing, if app side handles wheel itself\n if (requestedEvents.wheel) return;\n\n if (this._customWheelEventHandler && this._customWheelEventHandler(ev) === false) {\n return false;\n }\n\n if (!this.buffer.hasScrollback) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux even when mouse\n // events are not enabled.\n // This used implementation used get the actual lines/partial lines scrolled from the\n // viewport but since moving to the new viewport implementation has been simplified to\n // simply send a single up or down sequence.\n\n // Do nothing if there's no vertical scroll\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n\n const lines = self.coreMouseService.consumeWheelEvent(\n ev as WheelEvent,\n self._renderService?.dimensions?.device?.cell?.height,\n self._coreBrowserService?.dpr\n );\n if (lines === 0) {\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n this.coreService.triggerDataEvent(sequence, true);\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number, sync: boolean = false): void {\n this._renderService?.refreshRows(start, end, sync);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent | MouseEvent): void {\n if (this._selectionService?.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this.coreService.isCursorInitialized) {\n this.coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n // All scrollLines methods need to go via the viewport in order to support smooth scroll\n if (this._viewport) {\n this._viewport.scrollLines(disp);\n } else {\n super.scrollLines(disp, suppressScrollEvent);\n }\n this.refresh(0, this.rows - 1);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll && this._viewport) {\n this._viewport.scrollToLine(this.buffer.ybase, true);\n } else {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this.coreService, this.optionsService);\n }\n\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n public attachCustomWheelEventHandler(customWheelEventHandler: CustomWheelEventHandler): void {\n this._customWheelEventHandler = customWheelEventHandler;\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._linkProviderService.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n const joinerId = this._characterJoinerService.register(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n if (this._characterJoinerService.deregister(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public registerMarker(cursorYOffset: number): IMarker {\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n return this._decorationService.registerDecoration(decorationOptions);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): IBufferRange | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n start: {\n x: this._selectionService.selectionStart![0],\n y: this._selectionService.selectionStart![1]\n },\n end: {\n x: this._selectionService.selectionEnd![0],\n y: this._selectionService.selectionEnd![1]\n }\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown [KeyboardEvent].\n *\n * [KeyboardEvent]: https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n this._keyDownSeen = true;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n // Ignore composing with Alt key on Mac when macOptionIsMeta is enabled\n const shouldIgnoreComposition = this.browser.isMac && this.options.macOptionIsMeta && event.altKey;\n\n if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) {\n if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) {\n this.scrollToBottom(true);\n }\n return false;\n }\n\n if (!shouldIgnoreComposition && (event.key === 'Dead' || event.key === 'AltGraph')) {\n this._unprocessedDeadKey = true;\n }\n\n const result = this._keyboardService.evaluateKeyDown(event);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n event.preventDefault();\n event.stopPropagation();\n }\n\n if (!result.key) {\n return true;\n }\n\n // HACK: Process A-Z in the keypress event to fix an issue with macOS IMEs where lower case\n // letters cannot be input while caps lock is on. Skip this hack when using kitty protocol\n // or Win32 input mode as they need to send proper sequences for all key events.\n if (!this._keyboardService.useKitty && !this._keyboardService.useWin32InputMode && event.key && !event.ctrlKey && !event.altKey && !event.metaKey && event.key.length === 1) {\n if (event.key.charCodeAt(0) >= 65 && event.key.charCodeAt(0) <= 90) {\n return true;\n }\n }\n\n if (this._unprocessedDeadKey) {\n this._unprocessedDeadKey = false;\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n const wasModifierOnly = this._keyboardService.useWin32InputMode && wasModifierKeyOnlyEvent(event);\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this.coreService.triggerDataEvent(result.key, !wasModifierOnly);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt\n // is also depressed) so that the cursor textarea can be updated, which triggers the screen\n // reader to read it.\n if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: KeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.getModifierState('AltGraph'));\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n this._keyDownSeen = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n // Handle key release for Kitty keyboard protocol\n const result = this._keyboardService.evaluateKeyUp(ev);\n if (result?.key) {\n const wasModifierOnly = this._keyboardService.useWin32InputMode && wasModifierKeyOnlyEvent(ev);\n this.coreService.triggerDataEvent(result.key, !wasModifierOnly);\n }\n\n this.updateCursorStyle(ev);\n this._keyPressHandled = false;\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n this._keyPressHandled = false;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this.coreService.triggerDataEvent(key, true);\n\n this._keyPressHandled = true;\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n return true;\n }\n\n /**\n * Handle an input event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/Web/API/InputEvent\n * @param ev The input event to be handled.\n */\n protected _inputEvent(ev: InputEvent): boolean {\n // Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to\n // support reading out character input which can doubling up input characters\n // Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679\n if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {\n if (this._keyPressHandled) {\n return false;\n }\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n const text = ev.data;\n this.coreService.triggerDataEvent(text, true);\n return true;\n }\n\n return false;\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.clearAllMarkers();\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n // IMPORTANT: Fire scroll event before viewport is reset. This ensures embedders get the clear\n // scroll event and that the viewport's state will be valid for immediate writes.\n this._onScroll.fire({ position: this.buffer.ydisp });\n this.refresh(0, this.rows - 1);\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n this._decorationService.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1, true);\n }\n\n public clearTextureAtlas(): void {\n this._renderService?.clearTextureAtlas();\n }\n\n private _reportFocus(): void {\n if (this.element?.classList.contains('focus')) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n } else {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.css.canvas.width.toFixed(0);\n const canvasHeight = this._renderService.dimensions.css.canvas.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.css.cell.width.toFixed(0);\n const cellHeight = this._renderService.dimensions.css.cell.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18 || // Alt\n ev.keyCode === 91 || // Meta (Left)\n ev.keyCode === 92 || // Meta (Right)\n ev.keyCode === 93 || // Meta (Menu)\n ev.keyCode === 224 || // Meta (Firefox)\n ev.key === 'Meta';\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from '@xterm/xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal as any);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { ICoreTerminal } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = this._register(new Emitter());\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n super();\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerApcHandler(ident, callback);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { ITerminalOptions } from 'common/Types';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';\nimport type { IEvent } from 'common/Event';\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nlet $value = 0;\n\nexport class Terminal extends Disposable implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n private _publicOptions: Required;\n\n constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {\n super();\n\n this._core = this._register(new TerminalCore(options));\n this._addonManager = this._register(new AddonManager());\n\n this._publicOptions = { ... this._core.options };\n const getter = (propName: string): any => {\n return this._core.options[propName];\n };\n const setter = (propName: string, value: any): void => {\n this._checkReadonlyOptions(propName);\n this._core.options[propName] = value;\n };\n\n for (const propName in this._core.options) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this._publicOptions, propName, desc);\n }\n }\n\n private _checkReadonlyOptions(propName: string): void {\n // Throw an error if any constructor only option is modified\n // from terminal.options\n // Modifications from anywhere else are allowed\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(propName)) {\n throw new Error(`Option \"${propName}\" can only be set in the constructor`);\n }\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.rawOptions.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onBell(): IEvent { return this._core.onBell; }\n public get onBinary(): IEvent { return this._core.onBinary; }\n public get onCursorMove(): IEvent { return this._core.onCursorMove; }\n public get onData(): IEvent { return this._core.onData; }\n public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onLineFeed(): IEvent { return this._core.onLineFeed; }\n public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }\n public get onScroll(): IEvent { return this._core.onScroll; }\n public get onSelectionChange(): IEvent { return this._core.onSelectionChange; }\n public get onTitleChange(): IEvent { return this._core.onTitleChange; }\n public get onWriteParsed(): IEvent { return this._core.onWriteParsed; }\n public get onDimensionsChange(): IEvent { return this._core.onDimensionsChange; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n return this._parser ??= new ParserApi(this._core);\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n return this._buffer ??= this._register(new BufferNamespaceApi(this._core));\n }\n public get markers(): ReadonlyArray {\n return this._core.markers;\n }\n public get modes(): IModes {\n const m = this._core.coreService.decPrivateModes;\n let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';\n switch (this._core.coreMouseService.activeProtocol) {\n case 'X10': mouseTrackingMode = 'x10'; break;\n case 'VT200': mouseTrackingMode = 'vt200'; break;\n case 'DRAG': mouseTrackingMode = 'drag'; break;\n case 'ANY': mouseTrackingMode = 'any'; break;\n }\n return {\n applicationCursorKeysMode: m.applicationCursorKeys,\n applicationKeypadMode: m.applicationKeypad,\n bracketedPasteMode: m.bracketedPasteMode,\n insertMode: this._core.coreService.modes.insertMode,\n mouseTrackingMode: mouseTrackingMode,\n originMode: m.origin,\n reverseWraparoundMode: m.reverseWraparound,\n sendFocusMode: m.sendFocus,\n showCursor: !this._core.coreService.isCursorHidden,\n synchronizedOutputMode: m.synchronizedOutput,\n win32InputMode: m.win32InputMode,\n wraparoundMode: m.wraparound\n };\n }\n public get dimensions(): IRenderDimensions | undefined {\n return this._core.dimensions;\n }\n public get options(): Required {\n return this._publicOptions;\n }\n public set options(options: ITerminalOptions) {\n for (const propName in options) {\n this._publicOptions[propName] = options[propName];\n }\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public input(data: string, wasUserInput: boolean = true): void {\n this._core.input(data, wasUserInput);\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void {\n this._core.attachCustomWheelEventHandler(customWheelEventHandler);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number = 0): IMarker {\n this._verifyIntegers(cursorYOffset);\n return this._core.registerMarker(cursorYOffset);\n }\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);\n return this._core.registerDecoration(decorationOptions);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): IBufferRange | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n super.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public clearTextureAtlas(): void {\n this._core.clearTextureAtlas();\n }\n public loadAddon(addon: ITerminalAddon): void {\n this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n // A wrapper is required here because esbuild prevents setting an `export let`\n return {\n get promptLabel(): string { return Strings.promptLabel.get(); },\n set promptLabel(value: string) { Strings.promptLabel.set(value); },\n get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },\n set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }\n };\n }\n\n private _verifyIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value === Infinity || isNaN($value) || $value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n\n private _verifyPositiveIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value && ($value === Infinity || isNaN($value) || $value % 1 !== 0 || $value < 0)) {\n throw new Error('This API only accepts positive integers');\n }\n }\n }\n}\n"], +- "mappings": ";;;;;;;;;;;;;;;;qSAOA,IAAIA,GAAsB,iBACpBC,GAAc,CAClB,IAAK,IAAMD,GACX,IAAME,GAAkBF,GAAsBE,CAChD,EAEIC,GAAwB,iEACtBC,GAAgB,CACpB,IAAK,IAAMD,GACX,IAAMD,GAAkBC,GAAwBD,CAClD,ECLO,SAASG,GAAuBC,EAAsB,CAC3D,OAAOA,EAAK,QAAQ,SAAU,IAAI,CACpC,CAMO,SAASC,GAAoBD,EAAcE,EA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C,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,EACzD,MAAM,IAAI,MAAM,gCAAgC,CAGtD,CAEQ,2BAA2BwC,EAAwB,CACzD,IAAKxC,MAAUwC,EACb,GAAIxC,KAAWA,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,GAAKA,GAAS,GAClF,MAAM,IAAI,MAAM,yCAAyC,CAG/D,CACF", ++ "sourcesContent": ["/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n// This file contains strings that get exported in the API so they can be localized\n\nlet promptLabelInternal = 'Terminal input';\nconst promptLabel = {\n get: () => promptLabelInternal,\n set: (value: string) => promptLabelInternal = value\n};\n\nlet tooMuchOutputInternal = 'Too much output to announce, navigate to rows manually to read';\nconst tooMuchOutput = {\n get: () => tooMuchOutputInternal,\n set: (value: string) => tooMuchOutputInternal = value\n};\n\nexport {\n promptLabel,\n tooMuchOutput\n};\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ISelectionService } from 'browser/services/Services';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\n\n/**\n * Prepares text to be pasted into the terminal by normalizing the line endings\n * @param text The pasted text that needs processing before inserting into the terminal\n */\nexport function prepareTextForTerminal(text: string): string {\n return text.replace(/\\r?\\n/g, '\\r');\n}\n\n/**\n * Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste\n * @param text The pasted text to bracket\n */\nexport function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {\n if (bracketedPasteMode) {\n return '\\x1b[200~' + text + '\\x1b[201~';\n }\n return text;\n}\n\n/**\n * Binds copy functionality to the given terminal.\n * @param ev The original copy event to be handled\n */\nexport function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {\n if (ev.clipboardData) {\n ev.clipboardData.setData('text/plain', selectionService.selectionText);\n }\n // Prevent or the original text will be copied.\n ev.preventDefault();\n}\n\n/**\n * Redirect the clipboard's data to the terminal's input handler.\n */\nexport function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n ev.stopPropagation();\n if (ev.clipboardData) {\n const text = ev.clipboardData.getData('text/plain');\n paste(text, textarea, coreService, optionsService);\n }\n}\n\nexport function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {\n text = prepareTextForTerminal(text);\n text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);\n coreService.triggerDataEvent(text, true);\n textarea.value = '';\n}\n\n/**\n * Moves the textarea under the mouse cursor and focuses it.\n * @param ev The original right click event to be handled.\n * @param textarea The terminal's textarea.\n */\nexport function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {\n\n // Calculate textarea position relative to the screen element\n const pos = screenElement.getBoundingClientRect();\n const left = ev.clientX - pos.left - 10;\n const top = ev.clientY - pos.top - 10;\n\n // Bring textarea at the cursor position\n textarea.style.width = '20px';\n textarea.style.height = '20px';\n textarea.style.left = `${left}px`;\n textarea.style.top = `${top}px`;\n textarea.style.zIndex = '1000';\n\n textarea.focus();\n}\n\n/**\n * Bind to right-click event and allow right-click copy and paste.\n */\nexport function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {\n moveTextAreaUnderMouseCursor(ev, textarea, screenElement);\n\n if (shouldSelectWord) {\n selectionService.rightClickSelect(ev);\n }\n\n // Get textarea ready to copy from the context menu\n textarea.value = selectionService.selectionText;\n textarea.select();\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * Polyfill - Convert UTF32 codepoint into JS string.\n * Note: The built-in String.fromCodePoint happens to be much slower\n * due to additional sanity checks. We can avoid them since\n * we always operate on legal UTF32 (granted by the input decoders)\n * and use this faster version instead.\n */\nexport function stringFromCodePoint(codePoint: number): string {\n if (codePoint > 0xFFFF) {\n codePoint -= 0x10000;\n return String.fromCharCode((codePoint >> 10) + 0xD800) + String.fromCharCode((codePoint % 0x400) + 0xDC00);\n }\n return String.fromCharCode(codePoint);\n}\n\n/**\n * Convert UTF32 char codes into JS string.\n * Basically the same as `stringFromCodePoint` but for multiple codepoints\n * in a loop (which is a lot faster).\n */\nexport function utf32ToString(data: Uint32Array, start: number = 0, end: number = data.length): string {\n let result = '';\n for (let i = start; i < end; ++i) {\n let codepoint = data[i];\n if (codepoint > 0xFFFF) {\n // JS strings are encoded as UTF16, thus a non BMP codepoint gets converted into a surrogate\n // pair conversion rules:\n // - subtract 0x10000 from code point, leaving a 20 bit number\n // - add high 10 bits to 0xD800 --> first surrogate\n // - add low 10 bits to 0xDC00 --> second surrogate\n codepoint -= 0x10000;\n result += String.fromCharCode((codepoint >> 10) + 0xD800) + String.fromCharCode((codepoint % 0x400) + 0xDC00);\n } else {\n result += String.fromCharCode(codepoint);\n }\n }\n return result;\n}\n\n/**\n * StringToUtf32 - decodes UTF16 sequences into UTF32 codepoints.\n * To keep the decoder in line with JS strings it handles single surrogates as UCS2.\n */\nexport class StringToUtf32 {\n private _interim: number = 0;\n\n /**\n * Clears interim and resets decoder to clean state.\n */\n public clear(): void {\n this._interim = 0;\n }\n\n /**\n * Decode JS string to UTF32 codepoints.\n * The methods assumes stream input and will store partly transmitted\n * surrogate pairs and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided input data does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: string, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let startPos = 0;\n\n // handle leftover surrogate high\n if (this._interim) {\n const second = input.charCodeAt(startPos++);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (this._interim - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = this._interim;\n target[size++] = second;\n }\n this._interim = 0;\n }\n\n for (let i = startPos; i < length; ++i) {\n const code = input.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n this._interim = code;\n return size;\n }\n const second = input.charCodeAt(i);\n if (0xDC00 <= second && second <= 0xDFFF) {\n target[size++] = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n // illegal codepoint (USC2 handling)\n target[size++] = code;\n target[size++] = second;\n }\n continue;\n }\n if (code === 0xFEFF) {\n // BOM\n continue;\n }\n target[size++] = code;\n }\n return size;\n }\n}\n\n/**\n * Utf8Decoder - decodes UTF8 byte sequences into UTF32 codepoints.\n */\nexport class Utf8ToUtf32 {\n public interim: Uint8Array = new Uint8Array(3);\n\n /**\n * Clears interim bytes and resets decoder to clean state.\n */\n public clear(): void {\n this.interim.fill(0);\n }\n\n /**\n * Decodes UTF8 byte sequences in `input` to UTF32 codepoints in `target`.\n * The methods assumes stream input and will store partly transmitted bytes\n * and decode them with the next data chunk.\n * Note: The method does no bound checks for target, therefore make sure\n * the provided data chunk does not exceed the size of `target`.\n * Returns the number of written codepoints in `target`.\n */\n public decode(input: Uint8Array, target: Uint32Array): number {\n const length = input.length;\n\n if (!length) {\n return 0;\n }\n\n let size = 0;\n let byte1: number;\n let byte2: number;\n let byte3: number;\n let byte4: number;\n let codepoint = 0;\n let startPos = 0;\n\n // handle leftover bytes\n if (this.interim[0]) {\n let discardInterim = false;\n let cp = this.interim[0];\n cp &= ((((cp & 0xE0) === 0xC0)) ? 0x1F : (((cp & 0xF0) === 0xE0)) ? 0x0F : 0x07);\n let pos = 0;\n let tmp: number;\n while ((tmp = this.interim[++pos] & 0x3F) && pos < 4) {\n cp <<= 6;\n cp |= tmp;\n }\n // missing bytes - read ahead from input\n const type = (((this.interim[0] & 0xE0) === 0xC0)) ? 2 : (((this.interim[0] & 0xF0) === 0xE0)) ? 3 : 4;\n const missing = type - pos;\n while (startPos < missing) {\n if (startPos >= length) {\n return 0;\n }\n tmp = input[startPos++];\n if ((tmp & 0xC0) !== 0x80) {\n // wrong continuation, discard interim bytes completely\n startPos--;\n discardInterim = true;\n break;\n } else {\n // need to save so we can continue short inputs in next call\n this.interim[pos++] = tmp;\n cp <<= 6;\n cp |= tmp & 0x3F;\n }\n }\n if (!discardInterim) {\n // final test is type dependent\n if (type === 2) {\n if (cp < 0x80) {\n // wrong starter byte\n startPos--;\n } else {\n target[size++] = cp;\n }\n } else if (type === 3) {\n if (cp < 0x0800 || (cp >= 0xD800 && cp <= 0xDFFF) || cp === 0xFEFF) {\n // illegal codepoint or BOM\n } else {\n target[size++] = cp;\n }\n } else {\n if (cp < 0x010000 || cp > 0x10FFFF) {\n // illegal codepoint\n } else {\n target[size++] = cp;\n }\n }\n }\n this.interim.fill(0);\n }\n\n // loop through input\n const fourStop = length - 4;\n let i = startPos;\n while (i < length) {\n /**\n * ASCII shortcut with loop unrolled to 4 consecutive ASCII chars.\n * This is a compromise between speed gain for ASCII\n * and penalty for non ASCII:\n * For best ASCII performance the char should be stored directly into target,\n * but even a single attempt to write to target and compare afterwards\n * penalizes non ASCII really bad (-50%), thus we load the char into byteX first,\n * which reduces ASCII performance by ~15%.\n * This trial for ASCII reduces non ASCII performance by ~10% which seems acceptible\n * compared to the gains.\n * Note that this optimization only takes place for 4 consecutive ASCII chars,\n * for any shorter it bails out. Worst case - all 4 bytes being read but\n * thrown away due to the last being a non ASCII char (-10% performance).\n */\n while (i < fourStop\n && !((byte1 = input[i]) & 0x80)\n && !((byte2 = input[i + 1]) & 0x80)\n && !((byte3 = input[i + 2]) & 0x80)\n && !((byte4 = input[i + 3]) & 0x80))\n {\n target[size++] = byte1;\n target[size++] = byte2;\n target[size++] = byte3;\n target[size++] = byte4;\n i += 4;\n }\n\n // reread byte1\n byte1 = input[i++];\n\n // 1 byte\n if (byte1 < 0x80) {\n target[size++] = byte1;\n\n // 2 bytes\n } else if ((byte1 & 0xE0) === 0xC0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x1F) << 6 | (byte2 & 0x3F);\n if (codepoint < 0x80) {\n // wrong starter byte\n i--;\n continue;\n }\n target[size++] = codepoint;\n\n // 3 bytes\n } else if ((byte1 & 0xF0) === 0xE0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F);\n if (codepoint < 0x0800 || (codepoint >= 0xD800 && codepoint <= 0xDFFF) || codepoint === 0xFEFF) {\n // illegal codepoint or BOM, no i-- here\n continue;\n }\n target[size++] = codepoint;\n\n // 4 bytes\n } else if ((byte1 & 0xF8) === 0xF0) {\n if (i >= length) {\n this.interim[0] = byte1;\n return size;\n }\n byte2 = input[i++];\n if ((byte2 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n return size;\n }\n byte3 = input[i++];\n if ((byte3 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n if (i >= length) {\n this.interim[0] = byte1;\n this.interim[1] = byte2;\n this.interim[2] = byte3;\n return size;\n }\n byte4 = input[i++];\n if ((byte4 & 0xC0) !== 0x80) {\n // wrong continuation\n i--;\n continue;\n }\n codepoint = (byte1 & 0x07) << 18 | (byte2 & 0x3F) << 12 | (byte3 & 0x3F) << 6 | (byte4 & 0x3F);\n if (codepoint < 0x010000 || codepoint > 0x10FFFF) {\n // illegal codepoint, no i-- here\n continue;\n }\n target[size++] = codepoint;\n } else {\n // illegal byte, just skip\n }\n }\n return size;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';\nimport { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';\n\nexport class AttributeData implements IAttributeData {\n public static toColorRGB(value: number): IColorRGB {\n return [\n value >>> Attributes.RED_SHIFT & 255,\n value >>> Attributes.GREEN_SHIFT & 255,\n value & 255\n ];\n }\n\n public static fromColorRGB(value: IColorRGB): number {\n return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;\n }\n\n public clone(): IAttributeData {\n const newObj = new AttributeData();\n newObj.fg = this.fg;\n newObj.bg = this.bg;\n newObj.extended = this.extended.clone();\n return newObj;\n }\n\n // data\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n\n // flags\n public isInverse(): number { return this.fg & FgFlags.INVERSE; }\n public isBold(): number { return this.fg & FgFlags.BOLD; }\n public isUnderline(): number {\n if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {\n return 1;\n }\n return this.fg & FgFlags.UNDERLINE;\n }\n public isBlink(): number { return this.fg & FgFlags.BLINK; }\n public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }\n public isItalic(): number { return this.bg & BgFlags.ITALIC; }\n public isDim(): number { return this.bg & BgFlags.DIM; }\n public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }\n public isProtected(): number { return this.bg & BgFlags.PROTECTED; }\n public isOverline(): number { return this.bg & BgFlags.OVERLINE; }\n\n // color modes\n public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }\n public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }\n public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }\n public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }\n public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }\n public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }\n public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }\n\n // colors\n public getFgColor(): number {\n switch (this.fg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n public getBgColor(): number {\n switch (this.bg & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;\n default: return -1; // CM_DEFAULT defaults to -1\n }\n }\n\n // extended attrs\n public hasExtendedAttrs(): number {\n return this.bg & BgFlags.HAS_EXTENDED;\n }\n public updateExtended(): void {\n if (this.extended.isEmpty()) {\n this.bg &= ~BgFlags.HAS_EXTENDED;\n } else {\n this.bg |= BgFlags.HAS_EXTENDED;\n }\n }\n public getUnderlineColor(): number {\n if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {\n switch (this.extended.underlineColor & Attributes.CM_MASK) {\n case Attributes.CM_P16:\n case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;\n case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;\n default: return this.getFgColor();\n }\n }\n return this.getFgColor();\n }\n public getUnderlineColorMode(): number {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? this.extended.underlineColor & Attributes.CM_MASK\n : this.getFgColorMode();\n }\n public isUnderlineColorRGB(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB\n : this.isFgRGB();\n }\n public isUnderlineColorPalette(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16\n || (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256\n : this.isFgPalette();\n }\n public isUnderlineColorDefault(): boolean {\n return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor\n ? (this.extended.underlineColor & Attributes.CM_MASK) === 0\n : this.isFgDefault();\n }\n public getUnderlineStyle(): UnderlineStyle {\n return this.fg & FgFlags.UNDERLINE\n ? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)\n : UnderlineStyle.NONE;\n }\n public getUnderlineVariantOffset(): number {\n return this.extended.underlineVariantOffset;\n }\n}\n\n\n/**\n * Extended attributes for a cell.\n * Holds information about different underline styles and color.\n */\nexport class ExtendedAttrs implements IExtendedAttrs {\n private _ext: number = 0;\n public get ext(): number {\n if (this._urlId) {\n return (\n (this._ext & ~ExtFlags.UNDERLINE_STYLE) |\n (this.underlineStyle << 26)\n );\n }\n return this._ext;\n }\n public set ext(value: number) { this._ext = value; }\n\n public get underlineStyle(): UnderlineStyle {\n // Always return the URL style if it has one\n if (this._urlId) {\n return UnderlineStyle.DASHED;\n }\n return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;\n }\n public set underlineStyle(value: UnderlineStyle) {\n this._ext &= ~ExtFlags.UNDERLINE_STYLE;\n this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;\n }\n\n public get underlineColor(): number {\n return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n public set underlineColor(value: number) {\n this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);\n }\n\n private _urlId: number = 0;\n public get urlId(): number {\n return this._urlId;\n }\n public set urlId(value: number) {\n this._urlId = value;\n }\n\n public get underlineVariantOffset(): number {\n const val = (this._ext & ExtFlags.VARIANT_OFFSET) >> 29;\n if (val < 0) {\n return val ^ 0xFFFFFFF8;\n }\n return val;\n }\n public set underlineVariantOffset(value: number) {\n this._ext &= ~ExtFlags.VARIANT_OFFSET;\n this._ext |= (value << 29) & ExtFlags.VARIANT_OFFSET;\n }\n\n constructor(\n ext: number = 0,\n urlId: number = 0\n ) {\n this._ext = ext;\n this._urlId = urlId;\n }\n\n public clone(): IExtendedAttrs {\n return new ExtendedAttrs(this._ext, this._urlId);\n }\n\n /**\n * Convenient method to indicate whether the object holds no additional information,\n * that needs to be persistant in the buffer.\n */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IServiceIdentifier } from 'common/services/Services';\n\nconst DI_TARGET = 'di$target';\nconst DI_DEPENDENCIES = 'di$dependencies';\n\nexport const serviceRegistry: Map> = new Map();\n\nexport function getServiceDependencies(ctor: any): { id: IServiceIdentifier, index: number, optional: boolean }[] {\n return ctor[DI_DEPENDENCIES] || [];\n}\n\nexport function createDecorator(id: string): IServiceIdentifier {\n if (serviceRegistry.has(id)) {\n return serviceRegistry.get(id)!;\n }\n\n const decorator: any = function (target: Function, key: string, index: number): any {\n if (arguments.length !== 3) {\n throw new Error('@IServiceName-decorator can only be used to decorate a parameter');\n }\n\n storeServiceDependency(decorator, target, index);\n };\n\n decorator._id = id;\n\n serviceRegistry.set(id, decorator);\n return decorator;\n}\n\nfunction storeServiceDependency(id: Function, target: Function, index: number): void {\n if ((target as any)[DI_TARGET] === target) {\n (target as any)[DI_DEPENDENCIES].push({ id, index });\n } else {\n (target as any)[DI_DEPENDENCIES] = [{ id, index }];\n (target as any)[DI_TARGET] = target;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';\nimport { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/Types';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport type { Emitter, IEvent } from 'common/Event';\n\nexport const IBufferService = createDecorator('BufferService');\nexport interface IBufferService {\n serviceBrand: undefined;\n\n readonly cols: number;\n readonly rows: number;\n readonly buffer: IBuffer;\n readonly buffers: IBufferSet;\n isUserScrolling: boolean;\n onResize: IEvent;\n onScroll: IEvent;\n scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;\n scrollLines(disp: number, suppressScrollEvent?: boolean): void;\n resize(cols: number, rows: number): void;\n reset(): void;\n}\n\nexport interface IBufferResizeEvent {\n cols: number;\n rows: number;\n colsChanged: boolean;\n rowsChanged: boolean;\n}\n\nexport const ICoreMouseService = createDecorator('CoreMouseService');\nexport interface ICoreMouseService {\n serviceBrand: undefined;\n\n activeProtocol: string;\n activeEncoding: string;\n areMouseEventsActive: boolean;\n addProtocol(name: string, protocol: ICoreMouseProtocol): void;\n addEncoding(name: string, encoding: CoreMouseEncoding): void;\n reset(): void;\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n triggerMouseEvent(event: ICoreMouseEvent): boolean;\n\n /**\n * Event to announce changes in mouse tracking.\n */\n onProtocolChange: IEvent;\n\n /**\n * Human readable version of mouse events.\n */\n explainEvents(events: CoreMouseEventType): { [event: string]: boolean };\n\n /**\n * Process wheel event taking partial scroll into account.\n */\n consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number;\n}\n\nexport const ICoreService = createDecorator('CoreService');\nexport interface ICoreService {\n serviceBrand: undefined;\n\n /**\n * Initially the cursor will not be visible until the first time the terminal\n * is focused.\n */\n isCursorInitialized: boolean;\n isCursorHidden: boolean;\n\n readonly modes: IModes;\n readonly decPrivateModes: IDecPrivateModes;\n readonly kittyKeyboard: IKittyKeyboardState;\n\n readonly onData: IEvent;\n readonly onUserInput: IEvent;\n readonly onBinary: IEvent;\n readonly onRequestScrollToBottom: IEvent;\n\n reset(): void;\n\n /**\n * Triggers the onData event in the public API.\n * @param data The data that is being emitted.\n * @param wasUserInput Whether the data originated from the user (as opposed to\n * resulting from parsing incoming data). When true this will also:\n * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.\n * - Fire the `onUserInput` event (so selection can be cleared).\n */\n triggerDataEvent(data: string, wasUserInput?: boolean): void;\n\n /**\n * Triggers the onBinary event in the public API.\n * @param data The data that is being emitted.\n */\n triggerBinaryEvent(data: string): void;\n}\n\nexport const ICharsetService = createDecorator('CharsetService');\nexport interface ICharsetService {\n serviceBrand: undefined;\n\n charset: ICharset | undefined;\n readonly glevel: number;\n readonly charsets: (ICharset | undefined)[];\n\n reset(): void;\n\n /**\n * Set the G level of the terminal.\n * @param g\n */\n setgLevel(g: number): void;\n\n /**\n * Set the charset for the given G level of the terminal.\n * @param g\n * @param charset\n */\n setgCharset(g: number, charset: ICharset | undefined): void;\n}\n\nexport interface IServiceIdentifier {\n (...args: any[]): void;\n type: T;\n _id: string;\n}\n\nexport interface IBrandedService {\n serviceBrand: undefined;\n}\n\ntype GetLeadingNonServiceArgs = TArgs extends [] ? []\n : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs : TArgs\n : never;\n\nexport const IInstantiationService = createDecorator('InstantiationService');\nexport interface IInstantiationService {\n serviceBrand: undefined;\n\n setService(id: IServiceIdentifier, instance: T): void;\n getService(id: IServiceIdentifier): T | undefined;\n createInstance any, R extends InstanceType>(t: Ctor, ...args: GetLeadingNonServiceArgs>): R;\n}\n\nexport enum LogLevelEnum {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,\n ERROR = 4,\n OFF = 5\n}\n\nexport const ILogService = createDecorator('LogService');\nexport interface ILogService {\n serviceBrand: undefined;\n\n readonly logLevel: LogLevelEnum;\n\n trace(message: any, ...optionalParams: any[]): void;\n debug(message: any, ...optionalParams: any[]): void;\n info(message: any, ...optionalParams: any[]): void;\n warn(message: any, ...optionalParams: any[]): void;\n error(message: any, ...optionalParams: any[]): void;\n}\n\nexport const IOptionsService = createDecorator('OptionsService');\nexport interface IOptionsService {\n serviceBrand: undefined;\n\n /**\n * Read only access to the raw options object, this is an internal-only fast path for accessing\n * single options without any validation as we trust TypeScript to enforce correct usage\n * internally.\n */\n readonly rawOptions: Required;\n\n /**\n * Options as exposed through the public API, this property uses getters and setters with\n * validation which makes it safer but slower. {@link rawOptions} should be used for pretty much\n * all internal usage for performance reasons.\n */\n readonly options: Required;\n\n /**\n * Adds an event listener for when any option changes.\n */\n readonly onOptionChange: IEvent;\n\n /**\n * Adds an event listener for when a specific option changes, this is a convenience method that is\n * preferred over {@link onOptionChange} when only a single option is being listened to.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onSpecificOptionChange(key: T, listener: (arg1: Required[T]) => any): IDisposable;\n\n /**\n * Adds an event listener for when a set of specific options change, this is a convenience method\n * that is preferred over {@link onOptionChange} when multiple options are being listened to and\n * handled the same way.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;\n}\n\nexport type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface ITerminalOptions {\n allowProposedApi?: boolean;\n allowTransparency?: boolean;\n altClickMovesCursor?: boolean;\n cols?: number;\n convertEol?: boolean;\n cursorBlink?: boolean;\n cursorStyle?: CursorStyle;\n cursorWidth?: number;\n cursorInactiveStyle?: CursorInactiveStyle;\n disableStdin?: boolean;\n documentOverride?: any | null;\n drawBoldTextInBrightColors?: boolean;\n fastScrollSensitivity?: number;\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: FontWeight;\n fontWeightBold?: FontWeight;\n ignoreBracketedPasteMode?: boolean;\n letterSpacing?: number;\n lineHeight?: number;\n linkHandler?: ILinkHandler | null;\n logLevel?: LogLevel;\n logger?: ILogger | null;\n macOptionIsMeta?: boolean;\n macOptionClickForcesSelection?: boolean;\n minimumContrastRatio?: number;\n reflowCursorLine?: boolean;\n rescaleOverlappingGlyphs?: boolean;\n rightClickSelectsWord?: boolean;\n rows?: number;\n showCursorImmediately?: boolean;\n screenReaderMode?: boolean;\n scrollback?: number;\n scrollOnUserInput?: boolean;\n scrollSensitivity?: number;\n smoothScrollDuration?: number;\n tabStopWidth?: number;\n theme?: ITheme;\n windowsPty?: IWindowsPty;\n windowOptions?: IWindowOptions;\n wordSeparator?: string;\n overviewRuler?: IOverviewRulerOptions;\n quirks?: ITerminalQuirks;\n scrollOnEraseInDisplay?: boolean;\n vtExtensions?: IVtExtensions;\n\n [key: string]: any;\n termName: string;\n}\n\nexport interface ITheme {\n foreground?: string;\n background?: string;\n cursor?: string;\n cursorAccent?: string;\n selectionForeground?: string;\n selectionBackground?: string;\n selectionInactiveBackground?: string;\n scrollbarSliderBackground?: string;\n scrollbarSliderHoverBackground?: string;\n scrollbarSliderActiveBackground?: string;\n overviewRulerBorder?: string;\n black?: string;\n red?: string;\n green?: string;\n yellow?: string;\n blue?: string;\n magenta?: string;\n cyan?: string;\n white?: string;\n brightBlack?: string;\n brightRed?: string;\n brightGreen?: string;\n brightYellow?: string;\n brightBlue?: string;\n brightMagenta?: string;\n brightCyan?: string;\n brightWhite?: string;\n extendedAnsi?: string[];\n}\n\nexport interface ITerminalQuirks {\n allowSetCursorBlink?: boolean;\n}\n\nexport interface IVtExtensions {\n kittyKeyboard?: boolean;\n kittySgrBoldFaintControl?: boolean;\n win32InputMode?: boolean;\n colorSchemeQuery?: boolean;\n}\n\nexport const IOscLinkService = createDecorator('OscLinkService');\nexport interface IOscLinkService {\n serviceBrand: undefined;\n /**\n * Registers a link to the service, returning the link ID. The link data is managed by this\n * service and will be freed when this current cursor position is trimmed off the buffer.\n */\n registerLink(linkData: IOscLinkData): number;\n /**\n * Adds a line to a link if needed.\n */\n addLineToLink(linkId: number, y: number): void;\n /** Get the link data associated with a link ID. */\n getLinkData(linkId: number): IOscLinkData | undefined;\n}\n\n/*\n * Width and Grapheme_Cluster_Break properties of a character as a bit mask.\n *\n * bit 0: shouldJoin - should combine with preceding character.\n * bit 1..2: wcwidth - see UnicodeCharWidth.\n * bit 3..31: class of character (currently only 4 bits are used).\n * This is used to determined grapheme clustering - i.e. which codepoints\n * are to be combined into a single compound character.\n *\n * Use the UnicodeService static function createPropertyValue to create a\n * UnicodeCharProperties; use extractShouldJoin, extractWidth, and\n * extractCharKind to extract the components.\n */\nexport type UnicodeCharProperties = number;\n\n/**\n * Width in columns of a character.\n * In a CJK context, \"half-width\" characters (such as Latin) are width 1,\n * while \"full-width\" characters (such as Kanji) are 2 columns wide.\n * Combining characters (such as accents) are width 0.\n */\nexport type UnicodeCharWidth = 0 | 1 | 2;\n\nexport const IUnicodeService = createDecorator('UnicodeService');\nexport interface IUnicodeService {\n serviceBrand: undefined;\n /** Register an Unicode version provider. */\n register(provider: IUnicodeVersionProvider): void;\n /** Registered Unicode versions. */\n readonly versions: string[];\n /** Currently active version. */\n activeVersion: string;\n /** Event triggered, when activate version changed. */\n readonly onChange: IEvent;\n\n /**\n * Unicode version dependent\n */\n wcwidth(codepoint: number): UnicodeCharWidth;\n getStringCellWidth(s: string): number;\n /**\n * Return character width and type for grapheme clustering.\n * If preceding != 0, it is the return code from the previous character;\n * in that case the result specifies if the characters should be joined.\n */\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport interface IUnicodeVersionProvider {\n readonly version: string;\n wcwidth(ucs: number): UnicodeCharWidth;\n charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;\n}\n\nexport const IDecorationService = createDecorator('DecorationService');\nexport interface IDecorationService extends IDisposable {\n serviceBrand: undefined;\n readonly decorations: IterableIterator;\n readonly onDecorationRegistered: IEvent;\n readonly onDecorationRemoved: IEvent;\n registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;\n reset(): void;\n /**\n * Trigger a callback over the decoration at a cell (in no particular order). This uses a callback\n * instead of an iterator as it's typically used in hot code paths.\n */\n forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;\n}\nexport interface IInternalDecoration extends IDecoration {\n readonly options: IDecorationOptions;\n readonly backgroundColorRGB: IColor | undefined;\n readonly foregroundColorRGB: IColor | undefined;\n readonly onRenderEmitter: Emitter;\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILink } from 'browser/Types';\nimport { ILinkProvider } from 'browser/services/Services';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';\n\nexport class OscLinkProvider implements ILinkProvider {\n private readonly _workCell = new CellData();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IOscLinkService private readonly _oscLinkService: IOscLinkService\n ) {\n }\n\n public provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void {\n const line = this._bufferService.buffer.lines.get(y - 1);\n if (!line) {\n callback(undefined);\n return;\n }\n\n const result: ILink[] = [];\n const linkHandler = this._optionsService.rawOptions.linkHandler;\n const cell = this._workCell;\n const lineLength = line.getTrimmedLength();\n let currentLinkId = -1;\n let currentStart = -1;\n let finishLink = false;\n for (let x = 0; x < lineLength; x++) {\n // Minor optimization, only check for content if there isn't a link in case the link ends with\n // a null cell\n if (currentStart === -1 && !line.hasContent(x)) {\n continue;\n }\n\n line.loadCell(x, cell);\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n if (currentStart === -1) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n continue;\n } else {\n finishLink = cell.extended.urlId !== currentLinkId;\n }\n } else {\n if (currentStart !== -1) {\n finishLink = true;\n }\n }\n\n if (finishLink || (currentStart !== -1 && x === lineLength - 1)) {\n const text = this._oscLinkService.getLinkData(currentLinkId)?.uri;\n if (text) {\n // These ranges are 1-based\n const range: IBufferRange = {\n start: {\n x: currentStart + 1,\n y\n },\n end: {\n // Offset end x if it's a link that ends on the last cell in the line\n x: x + (!finishLink && x === lineLength - 1 ? 1 : 0),\n y\n }\n };\n\n let ignoreLink = false;\n if (!linkHandler?.allowNonHttpProtocols) {\n try {\n const parsed = new URL(text);\n if (!['http:', 'https:'].includes(parsed.protocol)) {\n ignoreLink = true;\n }\n } catch {\n // Ignore invalid URLs to prevent unexpected behaviors\n ignoreLink = true;\n }\n }\n\n if (!ignoreLink) {\n // OSC links always use underline and pointer decorations\n result.push({\n text,\n range,\n activate: (e, text) => (linkHandler ? linkHandler.activate(e, text, range) : defaultActivate(e, text)),\n hover: (e, text) => linkHandler?.hover?.(e, text, range),\n leave: (e, text) => linkHandler?.leave?.(e, text, range)\n });\n }\n }\n finishLink = false;\n\n // Clear link or start a new link if one starts immediately\n if (cell.hasExtendedAttrs() && cell.extended.urlId) {\n currentStart = x;\n currentLinkId = cell.extended.urlId;\n } else {\n currentStart = -1;\n currentLinkId = -1;\n }\n }\n }\n\n // TODO: Handle fetching and returning other link ranges to underline other links with the same\n // id\n callback(result);\n }\n}\n\nfunction defaultActivate(e: MouseEvent, uri: string): void {\n const answer = confirm(`Do you want to navigate to ${uri}?\\n\\nWARNING: This link could potentially be dangerous`);\n if (answer) {\n const newWindow = window.open();\n if (newWindow) {\n try {\n newWindow.opener = null;\n } catch {\n // no-op, Electron can throw\n }\n newWindow.location.href = uri;\n } else {\n console.warn('Opening link blocked as opener could not be cleared');\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { IColorSet, ILink, ReadonlyColorSet } from 'browser/Types';\nimport { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { createDecorator } from 'common/services/ServiceRegistry';\nimport { AllColorIndex, IDisposable, IKeyboardResult } from 'common/Types';\nimport type { IEvent } from 'common/Event';\n\nexport const ICharSizeService = createDecorator('CharSizeService');\nexport interface ICharSizeService {\n serviceBrand: undefined;\n\n readonly width: number;\n readonly height: number;\n readonly hasValidSize: boolean;\n\n readonly onCharSizeChange: IEvent;\n\n measure(): void;\n}\n\nexport const ICoreBrowserService = createDecorator('CoreBrowserService');\nexport interface ICoreBrowserService {\n serviceBrand: undefined;\n\n readonly isFocused: boolean;\n\n readonly onDprChange: IEvent;\n readonly onWindowChange: IEvent;\n\n /**\n * Gets or sets the parent window that the terminal is rendered into. DOM and rendering APIs (e.g.\n * requestAnimationFrame) should be invoked in the context of this window. This should be set when\n * the window hosting the xterm.js instance changes.\n */\n window: Window & typeof globalThis;\n /**\n * The document of the primary window to be used to create elements when working with multiple\n * windows. This is defined by the documentOverride setting.\n */\n readonly mainDocument: Document;\n /**\n * Helper for getting the devicePixelRatio of the parent window.\n */\n readonly dpr: number;\n}\n\nexport const IMouseService = createDecorator('MouseService');\nexport interface IMouseService {\n serviceBrand: undefined;\n\n getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined;\n getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined;\n}\n\nexport const IRenderService = createDecorator('RenderService');\nexport interface IRenderService extends IDisposable {\n serviceBrand: undefined;\n\n onDimensionsChange: IEvent;\n /**\n * Fires when buffer changes are rendered. This does not fire when only cursor\n * or selections are rendered.\n */\n onRenderedViewportChange: IEvent<{ start: number, end: number }>;\n /**\n * Fires on render\n */\n onRender: IEvent<{ start: number, end: number }>;\n onRefreshRequest: IEvent<{ start: number, end: number }>;\n\n dimensions: IRenderDimensions;\n\n addRefreshCallback(callback: FrameRequestCallback): number;\n\n refreshRows(start: number, end: number, sync?: boolean): void;\n clearTextureAtlas(): void;\n resize(cols: number, rows: number): void;\n hasRenderer(): boolean;\n setRenderer(renderer: IRenderer): void;\n handleDevicePixelRatioChange(): void;\n handleResize(cols: number, rows: number): void;\n handleCharSizeChanged(): void;\n handleBlur(): void;\n handleFocus(): void;\n handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void;\n handleCursorMove(): void;\n clear(): void;\n}\n\nexport const ISelectionService = createDecorator('SelectionService');\nexport interface ISelectionService {\n serviceBrand: undefined;\n\n readonly selectionText: string;\n readonly hasSelection: boolean;\n readonly selectionStart: [number, number] | undefined;\n readonly selectionEnd: [number, number] | undefined;\n\n readonly onLinuxMouseSelection: IEvent;\n readonly onRequestRedraw: IEvent;\n readonly onRequestScrollLines: IEvent;\n readonly onSelectionChange: IEvent;\n\n disable(): void;\n enable(): void;\n reset(): void;\n setSelection(row: number, col: number, length: number): void;\n selectAll(): void;\n selectLines(start: number, end: number): void;\n clearSelection(): void;\n rightClickSelect(event: MouseEvent): void;\n shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;\n shouldForceSelection(event: MouseEvent): boolean;\n refresh(isLinuxMouseSelection?: boolean): void;\n handleMouseDown(event: MouseEvent): void;\n isCellInSelection(x: number, y: number): boolean;\n}\n\nexport const ICharacterJoinerService = createDecorator('CharacterJoinerService');\nexport interface ICharacterJoinerService {\n serviceBrand: undefined;\n\n register(handler: (text: string) => [number, number][]): number;\n deregister(joinerId: number): boolean;\n getJoinedCharacters(row: number): [number, number][];\n}\n\nexport const IThemeService = createDecorator('ThemeService');\nexport interface IThemeService {\n serviceBrand: undefined;\n\n readonly colors: ReadonlyColorSet;\n\n readonly onChangeColors: IEvent;\n\n restoreColor(slot?: AllColorIndex): void;\n /**\n * Allows external modifying of colors in the theme, this is used instead of {@link colors} to\n * prevent accidental writes.\n */\n modifyColors(callback: (colors: IColorSet) => void): void;\n}\n\n\nexport const ILinkProviderService = createDecorator('LinkProviderService');\nexport interface ILinkProviderService extends IDisposable {\n serviceBrand: undefined;\n readonly linkProviders: ReadonlyArray;\n registerLinkProvider(linkProvider: ILinkProvider): IDisposable;\n}\nexport interface ILinkProvider {\n provideLinks(y: number, callback: (links: ILink[] | undefined) => void): void;\n}\n\nexport const IKeyboardService = createDecorator('KeyboardService');\nexport interface IKeyboardService {\n serviceBrand: undefined;\n evaluateKeyDown(event: KeyboardEvent): IKeyboardResult;\n evaluateKeyUp(event: KeyboardEvent): IKeyboardResult | undefined;\n readonly useKitty: boolean;\n readonly useWin32InputMode: boolean;\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal lifecycle utilities for xterm.js core.\n * Simplified from VS Code's lifecycle.ts - no tracking/leak detection.\n */\n\nexport interface IDisposable {\n dispose(): void;\n}\n\nexport function toDisposable(fn: () => void): IDisposable {\n return { dispose: fn };\n}\n\nexport function dispose(disposables: T | T[] | undefined): void {\n if (!disposables) {\n return;\n }\n if (Array.isArray(disposables)) {\n for (const d of disposables) {\n d.dispose();\n }\n } else {\n disposables.dispose();\n }\n}\n\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n return toDisposable(() => dispose(disposables));\n}\n\nexport class DisposableStore implements IDisposable {\n private readonly _disposables = new Set();\n private _isDisposed = false;\n\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n public add(o: T): T {\n if (this._isDisposed) {\n o.dispose();\n } else {\n this._disposables.add(o);\n }\n return o;\n }\n\n public dispose(): void {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.clear();\n }\n}\n\nexport abstract class Disposable implements IDisposable {\n protected readonly _store = new DisposableStore();\n\n public dispose(): void {\n this._store.dispose();\n }\n\n protected _register(o: T): T {\n return this._store.add(o);\n }\n}\n\nexport class MutableDisposable implements IDisposable {\n private _value: T | undefined;\n private _isDisposed = false;\n\n public get value(): T | undefined {\n return this._isDisposed ? undefined : this._value;\n }\n\n public set value(value: T | undefined) {\n if (this._isDisposed || value === this._value) {\n return;\n }\n this._value?.dispose();\n this._value = value;\n }\n\n public clear(): void {\n this.value = undefined;\n }\n\n public dispose(): void {\n this._isDisposed = true;\n this._value?.dispose();\n this._value = undefined;\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport type CodeWindow = Window & typeof globalThis & {\n\treadonly vscodeWindowId: number;\n};\n\nexport function ensureCodeWindow(targetWindow: Window, fallbackWindowId: number): asserts targetWindow is CodeWindow {\n}\n\n// eslint-disable-next-line no-restricted-globals\nexport const mainWindow = (typeof window === 'object' ? window : globalThis) as CodeWindow;\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport interface ErrorListenerCallback {\n\t(error: any): void;\n}\n\nexport interface ErrorListenerUnbind {\n\t(): void;\n}\n\n// Avoid circular dependency on EventEmitter by implementing a subset of the interface.\nexport class ErrorHandler {\n\tprivate unexpectedErrorHandler: (e: any) => void;\n\tprivate listeners: ErrorListenerCallback[];\n\n\tconstructor() {\n\n\t\tthis.listeners = [];\n\n\t\tthis.unexpectedErrorHandler = function (e: any) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (e.stack) {\n\t\t\t\t\tif (ErrorNoTelemetry.isErrorNoTelemetry(e)) {\n\t\t\t\t\t\tthrow new ErrorNoTelemetry(e.message + '\\n\\n' + e.stack);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(e.message + '\\n\\n' + e.stack);\n\t\t\t\t}\n\n\t\t\t\tthrow e;\n\t\t\t}, 0);\n\t\t};\n\t}\n\n\taddListener(listener: ErrorListenerCallback): ErrorListenerUnbind {\n\t\tthis.listeners.push(listener);\n\n\t\treturn () => {\n\t\t\tthis._removeListener(listener);\n\t\t};\n\t}\n\n\tprivate emit(e: any): void {\n\t\tthis.listeners.forEach((listener) => {\n\t\t\tlistener(e);\n\t\t});\n\t}\n\n\tprivate _removeListener(listener: ErrorListenerCallback): void {\n\t\tthis.listeners.splice(this.listeners.indexOf(listener), 1);\n\t}\n\n\tsetUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\t\tthis.unexpectedErrorHandler = newUnexpectedErrorHandler;\n\t}\n\n\tgetUnexpectedErrorHandler(): (e: any) => void {\n\t\treturn this.unexpectedErrorHandler;\n\t}\n\n\tonUnexpectedError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t\tthis.emit(e);\n\t}\n\n\t// For external errors, we don't want the listeners to be called\n\tonUnexpectedExternalError(e: any): void {\n\t\tthis.unexpectedErrorHandler(e);\n\t}\n}\n\nexport const errorHandler = new ErrorHandler();\n\n/** @skipMangle */\nexport function setUnexpectedErrorHandler(newUnexpectedErrorHandler: (e: any) => void): void {\n\terrorHandler.setUnexpectedErrorHandler(newUnexpectedErrorHandler);\n}\n\n/**\n * Returns if the error is a SIGPIPE error. SIGPIPE errors should generally be\n * logged at most once, to avoid a loop.\n *\n * @see https://github.com/microsoft/vscode-remote-release/issues/6481\n */\nexport function isSigPipeError(e: unknown): e is Error {\n\tif (!e || typeof e !== 'object') {\n\t\treturn false;\n\t}\n\n\tconst cast = e as Record;\n\treturn cast.code === 'EPIPE' && cast.syscall?.toUpperCase() === 'WRITE';\n}\n\nexport function onUnexpectedError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedError(e);\n\t}\n\treturn undefined;\n}\n\nexport function onUnexpectedExternalError(e: any): undefined {\n\t// ignore errors from cancelled promises\n\tif (!isCancellationError(e)) {\n\t\terrorHandler.onUnexpectedExternalError(e);\n\t}\n\treturn undefined;\n}\n\nexport interface SerializedError {\n\treadonly $isError: true;\n\treadonly name: string;\n\treadonly message: string;\n\treadonly stack: string;\n\treadonly noTelemetry: boolean;\n}\n\nexport function transformErrorForSerialization(error: Error): SerializedError;\nexport function transformErrorForSerialization(error: any): any;\nexport function transformErrorForSerialization(error: any): any {\n\tif (error instanceof Error) {\n\t\tconst { name, message } = error;\n\t\tconst stack: string = (error).stacktrace || (error).stack;\n\t\treturn {\n\t\t\t$isError: true,\n\t\t\tname,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t\tnoTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)\n\t\t};\n\t}\n\n\t// return as is\n\treturn error;\n}\n\nexport function transformErrorFromSerialization(data: SerializedError): Error {\n\tlet error: Error;\n\tif (data.noTelemetry) {\n\t\terror = new ErrorNoTelemetry();\n\t} else {\n\t\terror = new Error();\n\t\terror.name = data.name;\n\t}\n\terror.message = data.message;\n\terror.stack = data.stack;\n\treturn error;\n}\n\n// see https://github.com/v8/v8/wiki/Stack%20Trace%20API#basic-stack-traces\nexport interface V8CallSite {\n\tgetThis(): unknown;\n\tgetTypeName(): string | null;\n\tgetFunction(): Function | undefined;\n\tgetFunctionName(): string | null;\n\tgetMethodName(): string | null;\n\tgetFileName(): string | null;\n\tgetLineNumber(): number | null;\n\tgetColumnNumber(): number | null;\n\tgetEvalOrigin(): string | undefined;\n\tisToplevel(): boolean;\n\tisEval(): boolean;\n\tisNative(): boolean;\n\tisConstructor(): boolean;\n\ttoString(): string;\n}\n\nconst canceledName = 'Canceled';\n\n/**\n * Checks if the given error is a promise in canceled state\n */\nexport function isCancellationError(error: any): boolean {\n\tif (error instanceof CancellationError) {\n\t\treturn true;\n\t}\n\treturn error instanceof Error && error.name === canceledName && error.message === canceledName;\n}\n\n// !!!IMPORTANT!!!\n// Do NOT change this class because it is also used as an API-type.\nexport class CancellationError extends Error {\n\tconstructor() {\n\t\tsuper(canceledName);\n\t\tthis.name = this.message;\n\t}\n}\n\n/**\n * @deprecated use {@link CancellationError `new CancellationError()`} instead\n */\nexport function canceled(): Error {\n\tconst error = new Error(canceledName);\n\terror.name = error.message;\n\treturn error;\n}\n\nexport function illegalArgument(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal argument: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal argument');\n\t}\n}\n\nexport function illegalState(name?: string): Error {\n\tif (name) {\n\t\treturn new Error(`Illegal state: ${name}`);\n\t} else {\n\t\treturn new Error('Illegal state');\n\t}\n}\n\nexport class ReadonlyError extends TypeError {\n\tconstructor(name?: string) {\n\t\tsuper(name ? `${name} is read-only and cannot be changed` : 'Cannot change read-only property');\n\t}\n}\n\nexport function getErrorMessage(err: any): string {\n\tif (!err) {\n\t\treturn 'Error';\n\t}\n\n\tif (err.message) {\n\t\treturn err.message;\n\t}\n\n\tif (err.stack) {\n\t\treturn err.stack.split('\\n')[0];\n\t}\n\n\treturn String(err);\n}\n\nexport class NotImplementedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotImplemented');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class NotSupportedError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper('NotSupported');\n\t\tif (message) {\n\t\t\tthis.message = message;\n\t\t}\n\t}\n}\n\nexport class ExpectedError extends Error {\n\treadonly isExpected = true;\n}\n\n/**\n * Error that when thrown won't be logged in telemetry as an unhandled error.\n */\nexport class ErrorNoTelemetry extends Error {\n\toverride readonly name: string;\n\n\tconstructor(msg?: string) {\n\t\tsuper(msg);\n\t\tthis.name = 'CodeExpectedError';\n\t}\n\n\tpublic static fromError(err: Error): ErrorNoTelemetry {\n\t\tif (err instanceof ErrorNoTelemetry) {\n\t\t\treturn err;\n\t\t}\n\n\t\tconst result = new ErrorNoTelemetry();\n\t\tresult.message = err.message;\n\t\tresult.stack = err.stack;\n\t\treturn result;\n\t}\n\n\tpublic static isErrorNoTelemetry(err: Error): err is ErrorNoTelemetry {\n\t\treturn err.name === 'CodeExpectedError';\n\t}\n}\n\n/**\n * This error indicates a bug.\n * Do not throw this for invalid user input.\n * Only catch this error to recover gracefully from bugs.\n */\nexport class BugIndicatingError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message || 'An unexpected bug occurred.');\n\t\tObject.setPrototypeOf(this, BugIndicatingError.prototype);\n\n\t\t// Because we know for sure only buggy code throws this,\n\t\t// we definitely want to break here and fix the bug.\n\t\t// eslint-disable-next-line no-debugger\n\t\t// debugger;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Given a function, returns a function that is only calling that function once.\n */\nexport function createSingleCallFunction(this: unknown, fn: T, fnDidRunCallback?: () => void): T {\n\tconst _this = this;\n\tlet didCall = false;\n\tlet result: unknown;\n\n\treturn function () {\n\t\tif (didCall) {\n\t\t\treturn result;\n\t\t}\n\n\t\tdidCall = true;\n\t\tif (fnDidRunCallback) {\n\t\t\ttry {\n\t\t\t\tresult = fn.apply(_this, arguments);\n\t\t\t} finally {\n\t\t\t\tfnDidRunCallback();\n\t\t\t}\n\t\t} else {\n\t\t\tresult = fn.apply(_this, arguments);\n\t\t}\n\n\t\treturn result;\n\t} as unknown as T;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Comparator } from './arrays';\n\nexport function findLast(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdx(array, predicate);\n\tif (idx === -1) {\n\t\treturn undefined;\n\t}\n\treturn array[idx];\n}\n\nexport function findLastIdx(array: readonly T[], predicate: (item: T) => boolean, fromIndex = array.length - 1): number {\n\tfor (let i = fromIndex; i >= 0; i--) {\n\t\tconst element = array[i];\n\n\t\tif (predicate(element)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `undefined` if no item matches, otherwise the last item that matches the predicate.\n */\nexport function findLastMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findLastIdxMonotonous(array, predicate);\n\treturn idx === -1 ? undefined : array[idx];\n}\n\n/**\n * Finds the last item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n *\n * @returns `startIdx - 1` if predicate is false for all items, otherwise the index of the last item that matches the predicate.\n */\nexport function findLastIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\ti = k + 1;\n\t\t} else {\n\t\t\tj = k;\n\t\t}\n\t}\n\treturn i - 1;\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `undefined` if no item matches, otherwise the first item that matches the predicate.\n */\nexport function findFirstMonotonous(array: readonly T[], predicate: (item: T) => boolean): T | undefined {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate);\n\treturn idx === array.length ? undefined : array[idx];\n}\n\n/**\n * Finds the first item where predicate is true using binary search.\n * `predicate` must be monotonous, i.e. `arr.map(predicate)` must be like `[false, ..., false, true, ..., true]`!\n *\n * @returns `endIdxEx` if predicate is false for all items, otherwise the index of the first item that matches the predicate.\n */\nexport function findFirstIdxMonotonousOrArrLen(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tlet i = startIdx;\n\tlet j = endIdxEx;\n\twhile (i < j) {\n\t\tconst k = Math.floor((i + j) / 2);\n\t\tif (predicate(array[k])) {\n\t\t\tj = k;\n\t\t} else {\n\t\t\ti = k + 1;\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function findFirstIdxMonotonous(array: readonly T[], predicate: (item: T) => boolean, startIdx = 0, endIdxEx = array.length): number {\n\tconst idx = findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx);\n\treturn idx === array.length ? -1 : idx;\n}\n\n/**\n * Use this when\n * * You have a sorted array\n * * You query this array with a monotonous predicate to find the last item that has a certain property.\n * * You query this array multiple times with monotonous predicates that get weaker and weaker.\n */\nexport class MonotonousArray {\n\tpublic static assertInvariants = false;\n\n\tprivate _findLastMonotonousLastIdx = 0;\n\tprivate _prevFindLastPredicate: ((item: T) => boolean) | undefined;\n\n\tconstructor(private readonly _array: readonly T[]) {\n\t}\n\n\t/**\n\t * The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!\n\t * For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.\n\t */\n\tfindLastMonotonous(predicate: (item: T) => boolean): T | undefined {\n\t\tif (MonotonousArray.assertInvariants) {\n\t\t\tif (this._prevFindLastPredicate) {\n\t\t\t\tfor (const item of this._array) {\n\t\t\t\t\tif (this._prevFindLastPredicate(item) && !predicate(item)) {\n\t\t\t\t\t\tthrow new Error('MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._prevFindLastPredicate = predicate;\n\t\t}\n\n\t\tconst idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);\n\t\tthis._findLastMonotonousLastIdx = idx + 1;\n\t\treturn idx === -1 ? undefined : this._array[idx];\n\t}\n}\n\n/**\n * Returns the first item that is equal to or greater than every other item.\n*/\nexport function findFirstMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) > 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the last item that is equal to or greater than every other item.\n*/\nexport function findLastMax(array: readonly T[], comparator: Comparator): T | undefined {\n\tif (array.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tlet max = array[0];\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, max) >= 0) {\n\t\t\tmax = item;\n\t\t}\n\t}\n\treturn max;\n}\n\n/**\n * Returns the first item that is equal to or less than every other item.\n*/\nexport function findFirstMin(array: readonly T[], comparator: Comparator): T | undefined {\n\treturn findFirstMax(array, (a, b) => -comparator(a, b));\n}\n\nexport function findMaxIdx(array: readonly T[], comparator: Comparator): number {\n\tif (array.length === 0) {\n\t\treturn -1;\n\t}\n\n\tlet maxIdx = 0;\n\tfor (let i = 1; i < array.length; i++) {\n\t\tconst item = array[i];\n\t\tif (comparator(item, array[maxIdx]) > 0) {\n\t\t\tmaxIdx = i;\n\t\t}\n\t}\n\treturn maxIdx;\n}\n\n/**\n * Returns the first mapped value of the array which is not undefined.\n */\nexport function mapFindFirst(items: Iterable, mapFn: (value: T) => R | undefined): R | undefined {\n\tfor (const value of items) {\n\t\tconst mapped = mapFn(value);\n\t\tif (mapped !== undefined) {\n\t\t\treturn mapped;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { CancellationError } from 'vs/base/common/errors';\nimport { ISplice } from 'vs/base/common/sequence';\nimport { findFirstIdxMonotonousOrArrLen } from './arraysFind';\n\n/**\n * Returns the last element of an array.\n * @param array The array.\n * @param n Which element from the end (default is zero).\n */\nexport function tail(array: ArrayLike, n: number = 0): T | undefined {\n\treturn array[array.length - (1 + n)];\n}\n\nexport function tail2(arr: T[]): [T[], T] {\n\tif (arr.length === 0) {\n\t\tthrow new Error('Invalid tail call');\n\t}\n\n\treturn [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\n\nexport function equals(one: ReadonlyArray | undefined, other: ReadonlyArray | undefined, itemEquals: (a: T, b: T) => boolean = (a, b) => a === b): boolean {\n\tif (one === other) {\n\t\treturn true;\n\t}\n\n\tif (!one || !other) {\n\t\treturn false;\n\t}\n\n\tif (one.length !== other.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0, len = one.length; i < len; i++) {\n\t\tif (!itemEquals(one[i], other[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Remove the element at `index` by replacing it with the last element. This is faster than `splice`\n * but changes the order of the array\n */\nexport function removeFastWithoutKeepingOrder(array: T[], index: number) {\n\tconst last = array.length - 1;\n\tif (index < last) {\n\t\tarray[index] = array[last];\n\t}\n\tarray.pop();\n}\n\n/**\n * Performs a binary search algorithm over a sorted array.\n *\n * @param array The array being searched.\n * @param key The value we search for.\n * @param comparator A function that takes two array elements and returns zero\n * if they are equal, a negative number if the first element precedes the\n * second one in the sorting order, or a positive number if the second element\n * precedes the first one.\n * @return See {@link binarySearch2}\n */\nexport function binarySearch(array: ReadonlyArray, key: T, comparator: (op1: T, op2: T) => number): number {\n\treturn binarySearch2(array.length, i => comparator(array[i], key));\n}\n\n/**\n * Performs a binary search algorithm over a sorted collection. Useful for cases\n * when we need to perform a binary search over something that isn't actually an\n * array, and converting data to an array would defeat the use of binary search\n * in the first place.\n *\n * @param length The collection length.\n * @param compareToKey A function that takes an index of an element in the\n * collection and returns zero if the value at this index is equal to the\n * search key, a negative number if the value precedes the search key in the\n * sorting order, or a positive number if the search key precedes the value.\n * @return A non-negative index of an element, if found. If not found, the\n * result is -(n+1) (or ~n, using bitwise notation), where n is the index\n * where the key should be inserted to maintain the sorting order.\n */\nexport function binarySearch2(length: number, compareToKey: (index: number) => number): number {\n\tlet low = 0,\n\t\thigh = length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = ((low + high) / 2) | 0;\n\t\tconst comp = compareToKey(mid);\n\t\tif (comp < 0) {\n\t\t\tlow = mid + 1;\n\t\t} else if (comp > 0) {\n\t\t\thigh = mid - 1;\n\t\t} else {\n\t\t\treturn mid;\n\t\t}\n\t}\n\treturn -(low + 1);\n}\n\ntype Compare = (a: T, b: T) => number;\n\n\nexport function quickSelect(nth: number, data: T[], compare: Compare): T {\n\n\tnth = nth | 0;\n\n\tif (nth >= data.length) {\n\t\tthrow new TypeError('invalid index');\n\t}\n\n\tconst pivotValue = data[Math.floor(data.length * Math.random())];\n\tconst lower: T[] = [];\n\tconst higher: T[] = [];\n\tconst pivots: T[] = [];\n\n\tfor (const value of data) {\n\t\tconst val = compare(value, pivotValue);\n\t\tif (val < 0) {\n\t\t\tlower.push(value);\n\t\t} else if (val > 0) {\n\t\t\thigher.push(value);\n\t\t} else {\n\t\t\tpivots.push(value);\n\t\t}\n\t}\n\n\tif (nth < lower.length) {\n\t\treturn quickSelect(nth, lower, compare);\n\t} else if (nth < lower.length + pivots.length) {\n\t\treturn pivots[0];\n\t} else {\n\t\treturn quickSelect(nth - (lower.length + pivots.length), higher, compare);\n\t}\n}\n\nexport function groupBy(data: ReadonlyArray, compare: (a: T, b: T) => number): T[][] {\n\tconst result: T[][] = [];\n\tlet currentGroup: T[] | undefined = undefined;\n\tfor (const element of data.slice(0).sort(compare)) {\n\t\tif (!currentGroup || compare(currentGroup[0], element) !== 0) {\n\t\t\tcurrentGroup = [element];\n\t\t\tresult.push(currentGroup);\n\t\t} else {\n\t\t\tcurrentGroup.push(element);\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Splits the given items into a list of (non-empty) groups.\n * `shouldBeGrouped` is used to decide if two consecutive items should be in the same group.\n * The order of the items is preserved.\n */\nexport function* groupAdjacentBy(items: Iterable, shouldBeGrouped: (item1: T, item2: T) => boolean): Iterable {\n\tlet currentGroup: T[] | undefined;\n\tlet last: T | undefined;\n\tfor (const item of items) {\n\t\tif (last !== undefined && shouldBeGrouped(last, item)) {\n\t\t\tcurrentGroup!.push(item);\n\t\t} else {\n\t\t\tif (currentGroup) {\n\t\t\t\tyield currentGroup;\n\t\t\t}\n\t\t\tcurrentGroup = [item];\n\t\t}\n\t\tlast = item;\n\t}\n\tif (currentGroup) {\n\t\tyield currentGroup;\n\t}\n}\n\nexport function forEachAdjacent(arr: T[], f: (item1: T | undefined, item2: T | undefined) => void): void {\n\tfor (let i = 0; i <= arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);\n\t}\n}\n\nexport function forEachWithNeighbors(arr: T[], f: (before: T | undefined, element: T, after: T | undefined) => void): void {\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tf(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);\n\t}\n}\n\ninterface IMutableSplice extends ISplice {\n\treadonly toInsert: T[];\n\tdeleteCount: number;\n}\n\n/**\n * Diffs two *sorted* arrays and computes the splices which apply the diff.\n */\nexport function sortedDiff(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): ISplice[] {\n\tconst result: IMutableSplice[] = [];\n\n\tfunction pushSplice(start: number, deleteCount: number, toInsert: T[]): void {\n\t\tif (deleteCount === 0 && toInsert.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst latest = result[result.length - 1];\n\n\t\tif (latest && latest.start + latest.deleteCount === start) {\n\t\t\tlatest.deleteCount += deleteCount;\n\t\t\tlatest.toInsert.push(...toInsert);\n\t\t} else {\n\t\t\tresult.push({ start, deleteCount, toInsert });\n\t\t}\n\t}\n\n\tlet beforeIdx = 0;\n\tlet afterIdx = 0;\n\n\twhile (true) {\n\t\tif (beforeIdx === before.length) {\n\t\t\tpushSplice(beforeIdx, 0, after.slice(afterIdx));\n\t\t\tbreak;\n\t\t}\n\t\tif (afterIdx === after.length) {\n\t\t\tpushSplice(beforeIdx, before.length - beforeIdx, []);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst beforeElement = before[beforeIdx];\n\t\tconst afterElement = after[afterIdx];\n\t\tconst n = compare(beforeElement, afterElement);\n\t\tif (n === 0) {\n\t\t\t// equal\n\t\t\tbeforeIdx += 1;\n\t\t\tafterIdx += 1;\n\t\t} else if (n < 0) {\n\t\t\t// beforeElement is smaller -> before element removed\n\t\t\tpushSplice(beforeIdx, 1, []);\n\t\t\tbeforeIdx += 1;\n\t\t} else if (n > 0) {\n\t\t\t// beforeElement is greater -> after element added\n\t\t\tpushSplice(beforeIdx, 0, [afterElement]);\n\t\t\tafterIdx += 1;\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Takes two *sorted* arrays and computes their delta (removed, added elements).\n * Finishes in `Math.min(before.length, after.length)` steps.\n */\nexport function delta(before: ReadonlyArray, after: ReadonlyArray, compare: (a: T, b: T) => number): { removed: T[]; added: T[] } {\n\tconst splices = sortedDiff(before, after, compare);\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\n\tfor (const splice of splices) {\n\t\tremoved.push(...before.slice(splice.start, splice.start + splice.deleteCount));\n\t\tadded.push(...splice.toInsert);\n\t}\n\n\treturn { removed, added };\n}\n\n/**\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @return The first n elements from array when sorted with compare.\n */\nexport function top(array: ReadonlyArray, compare: (a: T, b: T) => number, n: number): T[] {\n\tif (n === 0) {\n\t\treturn [];\n\t}\n\tconst result = array.slice(0, n).sort(compare);\n\ttopStep(array, compare, result, n, array.length);\n\treturn result;\n}\n\n/**\n * Asynchronous variant of `top()` allowing for splitting up work in batches between which the event loop can run.\n *\n * Returns the top N elements from the array.\n *\n * Faster than sorting the entire array when the array is a lot larger than N.\n *\n * @param array The unsorted array.\n * @param compare A sort function for the elements.\n * @param n The number of elements to return.\n * @param batch The number of elements to examine before yielding to the event loop.\n * @return The first n elements from array when sorted with compare.\n */\nexport function topAsync(array: T[], compare: (a: T, b: T) => number, n: number, batch: number, token?: CancellationToken): Promise {\n\tif (n === 0) {\n\t\treturn Promise.resolve([]);\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\t(async () => {\n\t\t\tconst o = array.length;\n\t\t\tconst result = array.slice(0, n).sort(compare);\n\t\t\tfor (let i = n, m = Math.min(n + batch, o); i < o; i = m, m = Math.min(m + batch, o)) {\n\t\t\t\tif (i > n) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve)); // any other delay function would starve I/O\n\t\t\t\t}\n\t\t\t\tif (token && token.isCancellationRequested) {\n\t\t\t\t\tthrow new CancellationError();\n\t\t\t\t}\n\t\t\t\ttopStep(array, compare, result, i, m);\n\t\t\t}\n\t\t\treturn result;\n\t\t})()\n\t\t\t.then(resolve, reject);\n\t});\n}\n\nfunction topStep(array: ReadonlyArray, compare: (a: T, b: T) => number, result: T[], i: number, m: number): void {\n\tfor (const n = result.length; i < m; i++) {\n\t\tconst element = array[i];\n\t\tif (compare(element, result[n - 1]) < 0) {\n\t\t\tresult.pop();\n\t\t\tconst j = findFirstIdxMonotonousOrArrLen(result, e => compare(element, e) < 0);\n\t\t\tresult.splice(j, 0, element);\n\t\t}\n\t}\n}\n\n/**\n * @returns New array with all falsy values removed. The original array IS NOT modified.\n */\nexport function coalesce(array: ReadonlyArray): T[] {\n\treturn array.filter((e): e is T => !!e);\n}\n\n/**\n * Remove all falsy values from `array`. The original array IS modified.\n */\nexport function coalesceInPlace(array: Array): asserts array is Array {\n\tlet to = 0;\n\tfor (let i = 0; i < array.length; i++) {\n\t\tif (!!array[i]) {\n\t\t\tarray[to] = array[i];\n\t\t\tto += 1;\n\t\t}\n\t}\n\tarray.length = to;\n}\n\n/**\n * @deprecated Use `Array.copyWithin` instead\n */\nexport function move(array: any[], from: number, to: number): void {\n\tarray.splice(to, 0, array.splice(from, 1)[0]);\n}\n\n/**\n * @returns false if the provided object is an array and not empty.\n */\nexport function isFalsyOrEmpty(obj: any): boolean {\n\treturn !Array.isArray(obj) || obj.length === 0;\n}\n\n/**\n * @returns True if the provided object is an array and has at least one element.\n */\nexport function isNonEmptyArray(obj: T[] | undefined | null): obj is T[];\nexport function isNonEmptyArray(obj: readonly T[] | undefined | null): obj is readonly T[];\nexport function isNonEmptyArray(obj: T[] | readonly T[] | undefined | null): obj is T[] | readonly T[] {\n\treturn Array.isArray(obj) && obj.length > 0;\n}\n\n/**\n * Removes duplicates from the given array. The optional keyFn allows to specify\n * how elements are checked for equality by returning an alternate value for each.\n */\nexport function distinct(array: ReadonlyArray, keyFn: (value: T) => any = value => value): T[] {\n\tconst seen = new Set();\n\n\treturn array.filter(element => {\n\t\tconst key = keyFn!(element);\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n}\n\nexport function uniqueFilter(keyFn: (t: T) => R): (t: T) => boolean {\n\tconst seen = new Set();\n\n\treturn element => {\n\t\tconst key = keyFn(element);\n\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tseen.add(key);\n\t\treturn true;\n\t};\n}\n\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function firstOrDefault(array: ReadonlyArray): T | undefined;\nexport function firstOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[0] : notFoundValue;\n}\n\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue: NotFound): T | NotFound;\nexport function lastOrDefault(array: ReadonlyArray): T | undefined;\nexport function lastOrDefault(array: ReadonlyArray, notFoundValue?: NotFound): T | NotFound | undefined {\n\treturn array.length > 0 ? array[array.length - 1] : notFoundValue;\n}\n\nexport function commonPrefixLength(one: ReadonlyArray, other: ReadonlyArray, equals: (a: T, b: T) => boolean = (a, b) => a === b): number {\n\tlet result = 0;\n\n\tfor (let i = 0, len = Math.min(one.length, other.length); i < len && equals(one[i], other[i]); i++) {\n\t\tresult++;\n\t}\n\n\treturn result;\n}\n\nexport function range(to: number): number[];\nexport function range(from: number, to: number): number[];\nexport function range(arg: number, to?: number): number[] {\n\tlet from = typeof to === 'number' ? arg : 0;\n\n\tif (typeof to === 'number') {\n\t\tfrom = arg;\n\t} else {\n\t\tfrom = 0;\n\t\tto = arg;\n\t}\n\n\tconst result: number[] = [];\n\n\tif (from <= to) {\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tresult.push(i);\n\t\t}\n\t} else {\n\t\tfor (let i = from; i > to; i--) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function index(array: ReadonlyArray, indexer: (t: T) => string): { [key: string]: T };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper: (t: T) => R): { [key: string]: R };\nexport function index(array: ReadonlyArray, indexer: (t: T) => string, mapper?: (t: T) => R): { [key: string]: R } {\n\treturn array.reduce((r, t) => {\n\t\tr[indexer(t)] = mapper ? mapper(t) : t;\n\t\treturn r;\n\t}, Object.create(null));\n}\n\n/**\n * Inserts an element into an array. Returns a function which, when\n * called, will remove that element from the array.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function insert(array: T[], element: T): () => void {\n\tarray.push(element);\n\n\treturn () => remove(array, element);\n}\n\n/**\n * Removes an element from an array if it can be found.\n *\n * @deprecated In almost all cases, use a `Set` instead.\n */\nexport function remove(array: T[], element: T): T | undefined {\n\tconst index = array.indexOf(element);\n\tif (index > -1) {\n\t\tarray.splice(index, 1);\n\n\t\treturn element;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Insert `insertArr` inside `target` at `insertIndex`.\n * Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array\n */\nexport function arrayInsert(target: T[], insertIndex: number, insertArr: T[]): T[] {\n\tconst before = target.slice(0, insertIndex);\n\tconst after = target.slice(insertIndex);\n\treturn before.concat(insertArr, after);\n}\n\n/**\n * Uses Fisher-Yates shuffle to shuffle the given array\n */\nexport function shuffle(array: T[], _seed?: number): void {\n\tlet rand: () => number;\n\n\tif (typeof _seed === 'number') {\n\t\tlet seed = _seed;\n\t\t// Seeded random number generator in JS. Modified from:\n\t\t// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript\n\t\trand = () => {\n\t\t\tconst x = Math.sin(seed++) * 179426549; // throw away most significant digits and reduce any potential bias\n\t\t\treturn x - Math.floor(x);\n\t\t};\n\t} else {\n\t\trand = Math.random;\n\t}\n\n\tfor (let i = array.length - 1; i > 0; i -= 1) {\n\t\tconst j = Math.floor(rand() * (i + 1));\n\t\tconst temp = array[i];\n\t\tarray[i] = array[j];\n\t\tarray[j] = temp;\n\t}\n}\n\n/**\n * Pushes an element to the start of the array, if found.\n */\nexport function pushToStart(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.unshift(value);\n\t}\n}\n\n/**\n * Pushes an element to the end of the array, if found.\n */\nexport function pushToEnd(arr: T[], value: T): void {\n\tconst index = arr.indexOf(value);\n\n\tif (index > -1) {\n\t\tarr.splice(index, 1);\n\t\tarr.push(value);\n\t}\n}\n\nexport function pushMany(arr: T[], items: ReadonlyArray): void {\n\tfor (const item of items) {\n\t\tarr.push(item);\n\t}\n}\n\nexport function mapArrayOrNot(items: T | T[], fn: (_: T) => U): U | U[] {\n\treturn Array.isArray(items) ?\n\t\titems.map(fn) :\n\t\tfn(items);\n}\n\nexport function asArray(x: T | T[]): T[];\nexport function asArray(x: T | readonly T[]): readonly T[];\nexport function asArray(x: T | T[]): T[] {\n\treturn Array.isArray(x) ? x : [x];\n}\n\nexport function getRandomElement(arr: T[]): T | undefined {\n\treturn arr[Math.floor(Math.random() * arr.length)];\n}\n\n/**\n * Insert the new items in the array.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start inserting elements.\n * @param newItems The items to be inserted\n */\nexport function insertInto(array: T[], start: number, newItems: T[]): void {\n\tconst startIdx = getActualStartIndex(array, start);\n\tconst originalLength = array.length;\n\tconst newItemsLength = newItems.length;\n\tarray.length = originalLength + newItemsLength;\n\t// Move the items after the start index, start from the end so that we don't overwrite any value.\n\tfor (let i = originalLength - 1; i >= startIdx; i--) {\n\t\tarray[i + newItemsLength] = array[i];\n\t}\n\n\tfor (let i = 0; i < newItemsLength; i++) {\n\t\tarray[i + startIdx] = newItems[i];\n\t}\n}\n\n/**\n * Removes elements from an array and inserts new elements in their place, returning the deleted elements. Alternative to the native Array.splice method, it\n * can only support limited number of items due to the maximum call stack size limit.\n * @param array The original array.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @returns An array containing the elements that were deleted.\n */\nexport function splice(array: T[], start: number, deleteCount: number, newItems: T[]): T[] {\n\tconst index = getActualStartIndex(array, start);\n\tlet result = array.splice(index, deleteCount);\n\tif (result === undefined) {\n\t\t// see https://bugs.webkit.org/show_bug.cgi?id=261140\n\t\tresult = [];\n\t}\n\tinsertInto(array, index, newItems);\n\treturn result;\n}\n\n/**\n * Determine the actual start index (same logic as the native splice() or slice())\n * If greater than the length of the array, start will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.\n * If negative, it will begin that many elements from the end of the array. (In this case, the origin -1, meaning -n is the index of the nth last element, and is therefore equivalent to the index of array.length - n.) If array.length + start is less than 0, it will begin from index 0.\n * @param array The target array.\n * @param start The operation index.\n */\nfunction getActualStartIndex(array: T[], start: number): number {\n\treturn start < 0 ? Math.max(start + array.length, 0) : Math.min(start, array.length);\n}\n\n/**\n * When comparing two values,\n * a negative number indicates that the first value is less than the second,\n * a positive number indicates that the first value is greater than the second,\n * and zero indicates that neither is the case.\n*/\nexport type CompareResult = number;\n\nexport namespace CompareResult {\n\texport function isLessThan(result: CompareResult): boolean {\n\t\treturn result < 0;\n\t}\n\n\texport function isLessThanOrEqual(result: CompareResult): boolean {\n\t\treturn result <= 0;\n\t}\n\n\texport function isGreaterThan(result: CompareResult): boolean {\n\t\treturn result > 0;\n\t}\n\n\texport function isNeitherLessOrGreaterThan(result: CompareResult): boolean {\n\t\treturn result === 0;\n\t}\n\n\texport const greaterThan = 1;\n\texport const lessThan = -1;\n\texport const neitherLessOrGreaterThan = 0;\n}\n\n/**\n * A comparator `c` defines a total order `<=` on `T` as following:\n * `c(a, b) <= 0` iff `a` <= `b`.\n * We also have `c(a, b) == 0` iff `c(b, a) == 0`.\n*/\nexport type Comparator = (a: T, b: T) => CompareResult;\n\nexport function compareBy(selector: (item: TItem) => TCompareBy, comparator: Comparator): Comparator {\n\treturn (a, b) => comparator(selector(a), selector(b));\n}\n\nexport function tieBreakComparators(...comparators: Comparator[]): Comparator {\n\treturn (item1, item2) => {\n\t\tfor (const comparator of comparators) {\n\t\t\tconst result = comparator(item1, item2);\n\t\t\tif (!CompareResult.isNeitherLessOrGreaterThan(result)) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn CompareResult.neitherLessOrGreaterThan;\n\t};\n}\n\n/**\n * The natural order on numbers.\n*/\nexport const numberComparator: Comparator = (a, b) => a - b;\n\nexport const booleanComparator: Comparator = (a, b) => numberComparator(a ? 1 : 0, b ? 1 : 0);\n\nexport function reverseOrder(comparator: Comparator): Comparator {\n\treturn (a, b) => -comparator(a, b);\n}\n\nexport class ArrayQueue {\n\tprivate firstIdx = 0;\n\tprivate lastIdx = this.items.length - 1;\n\n\t/**\n\t * Constructs a queue that is backed by the given array. Runtime is O(1).\n\t*/\n\tconstructor(private readonly items: readonly T[]) { }\n\n\tget length(): number {\n\t\treturn this.lastIdx - this.firstIdx + 1;\n\t}\n\n\t/**\n\t * Consumes elements from the beginning of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned. Has a runtime of O(result.length).\n\t*/\n\ttakeWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := k <= this.lastIdx && predicate(this.items[k])\n\t\t// Find s := min { k | k >= this.firstIdx && !P(k) } and return this.data[this.firstIdx...s)\n\n\t\tlet startIdx = this.firstIdx;\n\t\twhile (startIdx < this.items.length && predicate(this.items[startIdx])) {\n\t\t\tstartIdx++;\n\t\t}\n\t\tconst result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);\n\t\tthis.firstIdx = startIdx;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Consumes elements from the end of the queue as long as the predicate returns true.\n\t * If no elements were consumed, `null` is returned.\n\t * The result has the same order as the underlying array!\n\t*/\n\ttakeFromEndWhile(predicate: (value: T) => boolean): T[] | null {\n\t\t// P(k) := this.firstIdx >= k && predicate(this.items[k])\n\t\t// Find s := max { k | k <= this.lastIdx && !P(k) } and return this.data(s...this.lastIdx]\n\n\t\tlet endIdx = this.lastIdx;\n\t\twhile (endIdx >= 0 && predicate(this.items[endIdx])) {\n\t\t\tendIdx--;\n\t\t}\n\t\tconst result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);\n\t\tthis.lastIdx = endIdx;\n\t\treturn result;\n\t}\n\n\tpeek(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.firstIdx];\n\t}\n\n\tpeekLast(): T | undefined {\n\t\tif (this.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.items[this.lastIdx];\n\t}\n\n\tdequeue(): T | undefined {\n\t\tconst result = this.items[this.firstIdx];\n\t\tthis.firstIdx++;\n\t\treturn result;\n\t}\n\n\tremoveLast(): T | undefined {\n\t\tconst result = this.items[this.lastIdx];\n\t\tthis.lastIdx--;\n\t\treturn result;\n\t}\n\n\ttakeCount(count: number): T[] {\n\t\tconst result = this.items.slice(this.firstIdx, this.firstIdx + count);\n\t\tthis.firstIdx += count;\n\t\treturn result;\n\t}\n}\n\n/**\n * This class is faster than an iterator and array for lazy computed data.\n*/\nexport class CallbackIterable {\n\tpublic static readonly empty = new CallbackIterable(_callback => { });\n\n\tconstructor(\n\t\t/**\n\t\t * Calls the callback for every item.\n\t\t * Stops when the callback returns false.\n\t\t*/\n\t\tpublic readonly iterate: (callback: (item: T) => boolean) => void\n\t) {\n\t}\n\n\tforEach(handler: (item: T) => void) {\n\t\tthis.iterate(item => { handler(item); return true; });\n\t}\n\n\ttoArray(): T[] {\n\t\tconst result: T[] = [];\n\t\tthis.iterate(item => { result.push(item); return true; });\n\t\treturn result;\n\t}\n\n\tfilter(predicate: (item: T) => boolean): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => predicate(item) ? cb(item) : true));\n\t}\n\n\tmap(mapFn: (item: T) => TResult): CallbackIterable {\n\t\treturn new CallbackIterable(cb => this.iterate(item => cb(mapFn(item))));\n\t}\n\n\tsome(predicate: (item: T) => boolean): boolean {\n\t\tlet result = false;\n\t\tthis.iterate(item => { result = predicate(item); return !result; });\n\t\treturn result;\n\t}\n\n\tfindFirst(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLast(predicate: (item: T) => boolean): T | undefined {\n\t\tlet result: T | undefined;\n\t\tthis.iterate(item => {\n\t\t\tif (predicate(item)) {\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n\n\tfindLastMaxBy(comparator: Comparator): T | undefined {\n\t\tlet result: T | undefined;\n\t\tlet first = true;\n\t\tthis.iterate(item => {\n\t\t\tif (first || CompareResult.isGreaterThan(comparator(item, result!))) {\n\t\t\t\tfirst = false;\n\t\t\t\tresult = item;\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\treturn result;\n\t}\n}\n\n/**\n * Represents a re-arrangement of items in an array.\n */\nexport class Permutation {\n\tconstructor(private readonly _indexMap: readonly number[]) { }\n\n\t/**\n\t * Returns a permutation that sorts the given array according to the given compare function.\n\t */\n\tpublic static createSortPermutation(arr: readonly T[], compareFn: (a: T, b: T) => number): Permutation {\n\t\tconst sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));\n\t\treturn new Permutation(sortIndices);\n\t}\n\n\t/**\n\t * Returns a new array with the elements of the given array re-arranged according to this permutation.\n\t */\n\tapply(arr: readonly T[]): T[] {\n\t\treturn arr.map((_, index) => arr[this._indexMap[index]]);\n\t}\n\n\t/**\n\t * Returns a new permutation that undoes the re-arrangement of this permutation.\n\t*/\n\tinverse(): Permutation {\n\t\tconst inverseIndexMap = this._indexMap.slice();\n\t\tfor (let i = 0; i < this._indexMap.length; i++) {\n\t\t\tinverseIndexMap[this._indexMap[i]] = i;\n\t\t}\n\t\treturn new Permutation(inverseIndexMap);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are strings.\n */\nexport type IStringDictionary = Record;\n\n/**\n * An interface for a JavaScript object that\n * acts a dictionary. The keys are numbers.\n */\nexport type INumberDictionary = Record;\n\n/**\n * Groups the collection into a dictionary based on the provided\n * group function.\n */\nexport function groupBy(data: V[], groupFn: (element: V) => K): Record {\n\tconst result: Record = Object.create(null);\n\tfor (const element of data) {\n\t\tconst key = groupFn(element);\n\t\tlet target = result[key];\n\t\tif (!target) {\n\t\t\ttarget = result[key] = [];\n\t\t}\n\t\ttarget.push(element);\n\t}\n\treturn result;\n}\n\nexport function diffSets(before: Set, after: Set): { removed: T[]; added: T[] } {\n\tconst removed: T[] = [];\n\tconst added: T[] = [];\n\tfor (const element of before) {\n\t\tif (!after.has(element)) {\n\t\t\tremoved.push(element);\n\t\t}\n\t}\n\tfor (const element of after) {\n\t\tif (!before.has(element)) {\n\t\t\tadded.push(element);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\nexport function diffMaps(before: Map, after: Map): { removed: V[]; added: V[] } {\n\tconst removed: V[] = [];\n\tconst added: V[] = [];\n\tfor (const [index, value] of before) {\n\t\tif (!after.has(index)) {\n\t\t\tremoved.push(value);\n\t\t}\n\t}\n\tfor (const [index, value] of after) {\n\t\tif (!before.has(index)) {\n\t\t\tadded.push(value);\n\t\t}\n\t}\n\treturn { removed, added };\n}\n\n/**\n * Computes the intersection of two sets.\n *\n * @param setA - The first set.\n * @param setB - The second iterable.\n * @returns A new set containing the elements that are in both `setA` and `setB`.\n */\nexport function intersection(setA: Set, setB: Iterable): Set {\n\tconst result = new Set();\n\tfor (const elem of setB) {\n\t\tif (setA.has(elem)) {\n\t\t\tresult.add(elem);\n\t\t}\n\t}\n\treturn result;\n}\n\nexport class SetWithKey implements Set {\n\tprivate _map = new Map();\n\n\tconstructor(values: T[], private toKey: (t: T) => any) {\n\t\tfor (const value of values) {\n\t\t\tthis.add(value);\n\t\t}\n\t}\n\n\tget size(): number {\n\t\treturn this._map.size;\n\t}\n\n\tadd(value: T): this {\n\t\tconst key = this.toKey(value);\n\t\tthis._map.set(key, value);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\treturn this._map.delete(this.toKey(value));\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this._map.has(this.toKey(value));\n\t}\n\n\t*entries(): IterableIterator<[T, T]> {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield [entry, entry];\n\t\t}\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t*values(): IterableIterator {\n\t\tfor (const entry of this._map.values()) {\n\t\t\tyield entry;\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._map.clear();\n\t}\n\n\tforEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void {\n\t\tthis._map.forEach(entry => callbackfn.call(thisArg, entry, entry, this));\n\t}\n\n\t[Symbol.iterator](): IterableIterator {\n\t\treturn this.values();\n\t}\n\n\t[Symbol.toStringTag]: string = 'SetWithKey';\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport function getOrSet(map: Map, key: K, value: V): V {\n\tlet result = map.get(key);\n\tif (result === undefined) {\n\t\tresult = value;\n\t\tmap.set(key, result);\n\t}\n\n\treturn result;\n}\n\nexport function mapToString(map: Map): string {\n\tconst entries: string[] = [];\n\tmap.forEach((value, key) => {\n\t\tentries.push(`${key} => ${value}`);\n\t});\n\n\treturn `Map(${map.size}) {${entries.join(', ')}}`;\n}\n\nexport function setToString(set: Set): string {\n\tconst entries: K[] = [];\n\tset.forEach(value => {\n\t\tentries.push(value);\n\t});\n\n\treturn `Set(${set.size}) {${entries.join(', ')}}`;\n}\n\nexport const enum Touch {\n\tNone = 0,\n\tAsOld = 1,\n\tAsNew = 2\n}\n\nexport class CounterSet {\n\n\tprivate map = new Map();\n\n\tadd(value: T): CounterSet {\n\t\tthis.map.set(value, (this.map.get(value) || 0) + 1);\n\t\treturn this;\n\t}\n\n\tdelete(value: T): boolean {\n\t\tlet counter = this.map.get(value) || 0;\n\n\t\tif (counter === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tcounter--;\n\n\t\tif (counter === 0) {\n\t\t\tthis.map.delete(value);\n\t\t} else {\n\t\t\tthis.map.set(value, counter);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\thas(value: T): boolean {\n\t\treturn this.map.has(value);\n\t}\n}\n\n/**\n * A map that allows access both by keys and values.\n * **NOTE**: values need to be unique.\n */\nexport class BidirectionalMap {\n\n\tprivate readonly _m1 = new Map();\n\tprivate readonly _m2 = new Map();\n\n\tconstructor(entries?: readonly (readonly [K, V])[]) {\n\t\tif (entries) {\n\t\t\tfor (const [key, value] of entries) {\n\t\t\t\tthis.set(key, value);\n\t\t\t}\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis._m1.clear();\n\t\tthis._m2.clear();\n\t}\n\n\tset(key: K, value: V): void {\n\t\tthis._m1.set(key, value);\n\t\tthis._m2.set(value, key);\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._m1.get(key);\n\t}\n\n\tgetKey(value: V): K | undefined {\n\t\treturn this._m2.get(value);\n\t}\n\n\tdelete(key: K): boolean {\n\t\tconst value = this._m1.get(key);\n\t\tif (value === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._m1.delete(key);\n\t\tthis._m2.delete(value);\n\t\treturn true;\n\t}\n\n\tforEach(callbackfn: (value: V, key: K, map: BidirectionalMap) => void, thisArg?: any): void {\n\t\tthis._m1.forEach((value, key) => {\n\t\t\tcallbackfn.call(thisArg, value, key, this);\n\t\t});\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._m1.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._m1.values();\n\t}\n}\n\nexport class SetMap {\n\n\tprivate map = new Map>();\n\n\tadd(key: K, value: V): void {\n\t\tlet values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\tvalues = new Set();\n\t\t\tthis.map.set(key, values);\n\t\t}\n\n\t\tvalues.add(value);\n\t}\n\n\tdelete(key: K, value: V): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.delete(value);\n\n\t\tif (values.size === 0) {\n\t\t\tthis.map.delete(key);\n\t\t}\n\t}\n\n\tforEach(key: K, fn: (value: V) => void): void {\n\t\tconst values = this.map.get(key);\n\n\t\tif (!values) {\n\t\t\treturn;\n\t\t}\n\n\t\tvalues.forEach(fn);\n\t}\n\n\tget(key: K): ReadonlySet {\n\t\tconst values = this.map.get(key);\n\t\tif (!values) {\n\t\t\treturn new Set();\n\t\t}\n\t\treturn values;\n\t}\n}\n\nexport function mapsStrictEqualIgnoreOrder(a: Map, b: Map): boolean {\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\tif (a.size !== b.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [key, value] of a) {\n\t\tif (!b.has(key) || b.get(key) !== value) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfor (const [key] of b) {\n\t\tif (!a.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport namespace Iterable {\n\n\texport function is(thing: any): thing is Iterable {\n\t\treturn thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';\n\t}\n\n\tconst _empty: Iterable = Object.freeze([]);\n\texport function empty(): Iterable {\n\t\treturn _empty;\n\t}\n\n\texport function* single(element: T): Iterable {\n\t\tyield element;\n\t}\n\n\texport function wrap(iterableOrElement: Iterable | T): Iterable {\n\t\tif (is(iterableOrElement)) {\n\t\t\treturn iterableOrElement;\n\t\t} else {\n\t\t\treturn single(iterableOrElement);\n\t\t}\n\t}\n\n\texport function from(iterable: Iterable | undefined | null): Iterable {\n\t\treturn iterable || _empty;\n\t}\n\n\texport function* reverse(array: Array): Iterable {\n\t\tfor (let i = array.length - 1; i >= 0; i--) {\n\t\t\tyield array[i];\n\t\t}\n\t}\n\n\texport function isEmpty(iterable: Iterable | undefined | null): boolean {\n\t\treturn !iterable || iterable[Symbol.iterator]().next().done === true;\n\t}\n\n\texport function first(iterable: Iterable): T | undefined {\n\t\treturn iterable[Symbol.iterator]().next().value;\n\t}\n\n\texport function some(iterable: Iterable, predicate: (t: T, i: number) => unknown): boolean {\n\t\tlet i = 0;\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element, i++)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\texport function find(iterable: Iterable, predicate: (t: T) => t is R): R | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined;\n\texport function find(iterable: Iterable, predicate: (t: T) => boolean): T | undefined {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\treturn element;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\texport function filter(iterable: Iterable, predicate: (t: T) => t is R): Iterable;\n\texport function filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable;\n\texport function* filter(iterable: Iterable, predicate: (t: T) => boolean): Iterable {\n\t\tfor (const element of iterable) {\n\t\t\tif (predicate(element)) {\n\t\t\t\tyield element;\n\t\t\t}\n\t\t}\n\t}\n\n\texport function* map(iterable: Iterable, fn: (t: T, index: number) => R): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield fn(element, index++);\n\t\t}\n\t}\n\n\texport function* flatMap(iterable: Iterable, fn: (t: T, index: number) => Iterable): Iterable {\n\t\tlet index = 0;\n\t\tfor (const element of iterable) {\n\t\t\tyield* fn(element, index++);\n\t\t}\n\t}\n\n\texport function* concat(...iterables: Iterable[]): Iterable {\n\t\tfor (const iterable of iterables) {\n\t\t\tyield* iterable;\n\t\t}\n\t}\n\n\texport function reduce(iterable: Iterable, reducer: (previousValue: R, currentValue: T) => R, initialValue: R): R {\n\t\tlet value = initialValue;\n\t\tfor (const element of iterable) {\n\t\t\tvalue = reducer(value, element);\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Returns an iterable slice of the array, with the same semantics as `array.slice()`.\n\t */\n\texport function* slice(arr: ReadonlyArray, from: number, to = arr.length): Iterable {\n\t\tif (from < 0) {\n\t\t\tfrom += arr.length;\n\t\t}\n\n\t\tif (to < 0) {\n\t\t\tto += arr.length;\n\t\t} else if (to > arr.length) {\n\t\t\tto = arr.length;\n\t\t}\n\n\t\tfor (; from < to; from++) {\n\t\t\tyield arr[from];\n\t\t}\n\t}\n\n\t/**\n\t * Consumes `atMost` elements from iterable and returns the consumed elements,\n\t * and an iterable for the rest of the elements.\n\t */\n\texport function consume(iterable: Iterable, atMost: number = Number.POSITIVE_INFINITY): [T[], Iterable] {\n\t\tconst consumed: T[] = [];\n\n\t\tif (atMost === 0) {\n\t\t\treturn [consumed, iterable];\n\t\t}\n\n\t\tconst iterator = iterable[Symbol.iterator]();\n\n\t\tfor (let i = 0; i < atMost; i++) {\n\t\t\tconst next = iterator.next();\n\n\t\t\tif (next.done) {\n\t\t\t\treturn [consumed, Iterable.empty()];\n\t\t\t}\n\n\t\t\tconsumed.push(next.value);\n\t\t}\n\n\t\treturn [consumed, { [Symbol.iterator]() { return iterator; } }];\n\t}\n\n\texport async function asyncToArray(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn Promise.resolve(result);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { compareBy, numberComparator } from 'vs/base/common/arrays';\nimport { groupBy } from 'vs/base/common/collections';\nimport { SetMap } from './map';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { Iterable } from 'vs/base/common/iterator';\n\n// #region Disposable Tracking\n\n/**\n * Enables logging of potentially leaked disposables.\n *\n * A disposable is considered leaked if it is not disposed or not registered as the child of\n * another disposable. This tracking is very simple an only works for classes that either\n * extend Disposable or use a DisposableStore. This means there are a lot of false positives.\n */\nconst TRACK_DISPOSABLES = false;\nlet disposableTracker: IDisposableTracker | null = null;\n\nexport interface IDisposableTracker {\n\t/**\n\t * Is called on construction of a disposable.\n\t*/\n\ttrackDisposable(disposable: IDisposable): void;\n\n\t/**\n\t * Is called when a disposable is registered as child of another disposable (e.g. {@link DisposableStore}).\n\t * If parent is `null`, the disposable is removed from its former parent.\n\t*/\n\tsetParent(child: IDisposable, parent: IDisposable | null): void;\n\n\t/**\n\t * Is called after a disposable is disposed.\n\t*/\n\tmarkAsDisposed(disposable: IDisposable): void;\n\n\t/**\n\t * Indicates that the given object is a singleton which does not need to be disposed.\n\t*/\n\tmarkAsSingleton(disposable: IDisposable): void;\n}\n\nexport interface DisposableInfo {\n\tvalue: IDisposable;\n\tsource: string | null;\n\tparent: IDisposable | null;\n\tisSingleton: boolean;\n\tidx: number;\n}\n\nexport class DisposableTracker implements IDisposableTracker {\n\tprivate static idx = 0;\n\n\tprivate readonly livingDisposables = new Map();\n\n\tprivate getDisposableData(d: IDisposable): DisposableInfo {\n\t\tlet val = this.livingDisposables.get(d);\n\t\tif (!val) {\n\t\t\tval = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };\n\t\t\tthis.livingDisposables.set(d, val);\n\t\t}\n\t\treturn val;\n\t}\n\n\ttrackDisposable(d: IDisposable): void {\n\t\tconst data = this.getDisposableData(d);\n\t\tif (!data.source) {\n\t\t\tdata.source =\n\t\t\t\tnew Error().stack!;\n\t\t}\n\t}\n\n\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\tconst data = this.getDisposableData(child);\n\t\tdata.parent = parent;\n\t}\n\n\tmarkAsDisposed(x: IDisposable): void {\n\t\tthis.livingDisposables.delete(x);\n\t}\n\n\tmarkAsSingleton(disposable: IDisposable): void {\n\t\tthis.getDisposableData(disposable).isSingleton = true;\n\t}\n\n\tprivate getRootParent(data: DisposableInfo, cache: Map): DisposableInfo {\n\t\tconst cacheValue = cache.get(data);\n\t\tif (cacheValue) {\n\t\t\treturn cacheValue;\n\t\t}\n\n\t\tconst result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;\n\t\tcache.set(data, result);\n\t\treturn result;\n\t}\n\n\tgetTrackedDisposables(): IDisposable[] {\n\t\tconst rootParentCache = new Map();\n\n\t\tconst leaking = [...this.livingDisposables.entries()]\n\t\t\t.filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)\n\t\t\t.flatMap(([k]) => k);\n\n\t\treturn leaking;\n\t}\n\n\tcomputeLeakingDisposables(maxReported = 10, preComputedLeaks?: DisposableInfo[]): { leaks: DisposableInfo[]; details: string } | undefined {\n\t\tlet uncoveredLeakingObjs: DisposableInfo[] | undefined;\n\t\tif (preComputedLeaks) {\n\t\t\tuncoveredLeakingObjs = preComputedLeaks;\n\t\t} else {\n\t\t\tconst rootParentCache = new Map();\n\n\t\t\tconst leakingObjects = [...this.livingDisposables.values()]\n\t\t\t\t.filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);\n\n\t\t\tif (leakingObjects.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst leakingObjsSet = new Set(leakingObjects.map(o => o.value));\n\n\t\t\t// Remove all objects that are a child of other leaking objects. Assumes there are no cycles.\n\t\t\tuncoveredLeakingObjs = leakingObjects.filter(l => {\n\t\t\t\treturn !(l.parent && leakingObjsSet.has(l.parent));\n\t\t\t});\n\n\t\t\tif (uncoveredLeakingObjs.length === 0) {\n\t\t\t\tthrow new Error('There are cyclic diposable chains!');\n\t\t\t}\n\t\t}\n\n\t\tif (!uncoveredLeakingObjs) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tfunction getStackTracePath(leaking: DisposableInfo): string[] {\n\t\t\tfunction removePrefix(array: string[], linesToRemove: (string | RegExp)[]) {\n\t\t\t\twhile (array.length > 0 && linesToRemove.some(regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp))) {\n\t\t\t\t\tarray.shift();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst lines = leaking.source!.split('\\n').map(p => p.trim().replace('at ', '')).filter(l => l !== '');\n\t\t\tremovePrefix(lines, ['Error', /^trackDisposable \\(.*\\)$/, /^DisposableTracker.trackDisposable \\(.*\\)$/]);\n\t\t\treturn lines.reverse();\n\t\t}\n\n\t\tconst stackTraceStarts = new SetMap();\n\t\tfor (const leaking of uncoveredLeakingObjs) {\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tfor (let i = 0; i <= stackTracePath.length; i++) {\n\t\t\t\tstackTraceStarts.add(stackTracePath.slice(0, i).join('\\n'), leaking);\n\t\t\t}\n\t\t}\n\n\t\t// Put earlier leaks first\n\t\tuncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));\n\n\t\tlet message = '';\n\n\t\tlet i = 0;\n\t\tfor (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {\n\t\t\ti++;\n\t\t\tconst stackTracePath = getStackTracePath(leaking);\n\t\t\tconst stackTraceFormattedLines = [];\n\n\t\t\tfor (let i = 0; i < stackTracePath.length; i++) {\n\t\t\t\tlet line = stackTracePath[i];\n\t\t\t\tconst starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\\n'));\n\t\t\t\tline = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;\n\n\t\t\t\tconst prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\\n'));\n\t\t\t\tconst continuations = groupBy([...prevStarts].map(d => getStackTracePath(d)[i]), v => v);\n\t\t\t\tdelete continuations[stackTracePath[i]];\n\t\t\t\tfor (const [cont, set] of Object.entries(continuations)) {\n\t\t\t\t\tstackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);\n\t\t\t\t}\n\n\t\t\t\tstackTraceFormattedLines.unshift(line);\n\t\t\t}\n\n\t\t\tmessage += `\\n\\n\\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\\n${stackTraceFormattedLines.join('\\n')}\\n============================================================\\n\\n`;\n\t\t}\n\n\t\tif (uncoveredLeakingObjs.length > maxReported) {\n\t\t\tmessage += `\\n\\n\\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\\n\\n`;\n\t\t}\n\n\t\treturn { leaks: uncoveredLeakingObjs, details: message };\n\t}\n}\n\nexport function setDisposableTracker(tracker: IDisposableTracker | null): void {\n\tdisposableTracker = tracker;\n}\n\nif (TRACK_DISPOSABLES) {\n\tconst __is_disposable_tracked__ = '__is_disposable_tracked__';\n\tsetDisposableTracker(new class implements IDisposableTracker {\n\t\ttrackDisposable(x: IDisposable): void {\n\t\t\tconst stack = new Error('Potentially leaked disposable').stack!;\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (!(x as any)[__is_disposable_tracked__]) {\n\t\t\t\t\tconsole.log(stack);\n\t\t\t\t}\n\t\t\t}, 3000);\n\t\t}\n\n\t\tsetParent(child: IDisposable, parent: IDisposable | null): void {\n\t\t\tif (child && child !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(child as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmarkAsDisposed(disposable: IDisposable): void {\n\t\t\tif (disposable && disposable !== Disposable.None) {\n\t\t\t\ttry {\n\t\t\t\t\t(disposable as any)[__is_disposable_tracked__] = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// noop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmarkAsSingleton(disposable: IDisposable): void { }\n\t});\n}\n\nexport function trackDisposable(x: T): T {\n\tdisposableTracker?.trackDisposable(x);\n\treturn x;\n}\n\nexport function markAsDisposed(disposable: IDisposable): void {\n\tdisposableTracker?.markAsDisposed(disposable);\n}\n\nfunction setParentOfDisposable(child: IDisposable, parent: IDisposable | null): void {\n\tdisposableTracker?.setParent(child, parent);\n}\n\nfunction setParentOfDisposables(children: IDisposable[], parent: IDisposable | null): void {\n\tif (!disposableTracker) {\n\t\treturn;\n\t}\n\tfor (const child of children) {\n\t\tdisposableTracker.setParent(child, parent);\n\t}\n}\n\n/**\n * Indicates that the given object is a singleton which does not need to be disposed.\n*/\nexport function markAsSingleton(singleton: T): T {\n\tdisposableTracker?.markAsSingleton(singleton);\n\treturn singleton;\n}\n\n// #endregion\n\n/**\n * An object that performs a cleanup operation when `.dispose()` is called.\n *\n * Some examples of how disposables are used:\n *\n * - An event listener that removes itself when `.dispose()` is called.\n * - A resource such as a file system watcher that cleans up the resource when `.dispose()` is called.\n * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.\n */\nexport interface IDisposable {\n\tdispose(): void;\n}\n\n/**\n * Check if `thing` is {@link IDisposable disposable}.\n */\nexport function isDisposable(thing: E): thing is E & IDisposable {\n\treturn typeof thing === 'object' && thing !== null && typeof (thing).dispose === 'function' && (thing).dispose.length === 0;\n}\n\n/**\n * Disposes of the value(s) passed in.\n */\nexport function dispose(disposable: T): T;\nexport function dispose(disposable: T | undefined): T | undefined;\nexport function dispose = Iterable>(disposables: A): A;\nexport function dispose(disposables: Array): Array;\nexport function dispose(disposables: ReadonlyArray): ReadonlyArray;\nexport function dispose(arg: T | Iterable | undefined): any {\n\tif (Iterable.is(arg)) {\n\t\tconst errors: any[] = [];\n\n\t\tfor (const d of arg) {\n\t\t\tif (d) {\n\t\t\t\ttry {\n\t\t\t\t\td.dispose();\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t} else if (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, 'Encountered errors while disposing of store');\n\t\t}\n\n\t\treturn Array.isArray(arg) ? [] : arg;\n\t} else if (arg) {\n\t\targ.dispose();\n\t\treturn arg;\n\t}\n}\n\nexport function disposeIfDisposable(disposables: Array): Array {\n\tfor (const d of disposables) {\n\t\tif (isDisposable(d)) {\n\t\t\td.dispose();\n\t\t}\n\t}\n\treturn [];\n}\n\n/**\n * Combine multiple disposable values into a single {@link IDisposable}.\n */\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n\tconst parent = toDisposable(() => dispose(disposables));\n\tsetParentOfDisposables(disposables, parent);\n\treturn parent;\n}\n\n/**\n * Turn a function that implements dispose into an {@link IDisposable}.\n *\n * @param fn Clean up function, guaranteed to be called only **once**.\n */\nexport function toDisposable(fn: () => void): IDisposable {\n\tconst self = trackDisposable({\n\t\tdispose: createSingleCallFunction(() => {\n\t\t\tmarkAsDisposed(self);\n\t\t\tfn();\n\t\t})\n\t});\n\treturn self;\n}\n\n/**\n * Manages a collection of disposable values.\n *\n * This is the preferred way to manage multiple disposables. A `DisposableStore` is safer to work with than an\n * `IDisposable[]` as it considers edge cases, such as registering the same value multiple times or adding an item to a\n * store that has already been disposed of.\n */\nexport class DisposableStore implements IDisposable {\n\n\tstatic DISABLE_DISPOSED_WARNING = false;\n\n\tprivate readonly _toDispose = new Set();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Dispose of all registered disposables and mark this object as disposed.\n\t *\n\t * Any future disposables added to this object will be disposed of on `add`.\n\t */\n\tpublic dispose(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clear();\n\t}\n\n\t/**\n\t * @return `true` if this object has been disposed of.\n\t */\n\tpublic get isDisposed(): boolean {\n\t\treturn this._isDisposed;\n\t}\n\n\t/**\n\t * Dispose of all registered disposables but do not mark this object as disposed.\n\t */\n\tpublic clear(): void {\n\t\tif (this._toDispose.size === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._toDispose);\n\t\t} finally {\n\t\t\tthis._toDispose.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Add a new {@link IDisposable disposable} to the collection.\n\t */\n\tpublic add(o: T): T {\n\t\tif (!o) {\n\t\t\treturn o;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\n\t\tsetParentOfDisposable(o, this);\n\t\tif (this._isDisposed) {\n\t\t\tif (!DisposableStore.DISABLE_DISPOSED_WARNING) {\n\t\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._toDispose.add(o);\n\t\t}\n\n\t\treturn o;\n\t}\n\n\t/**\n\t * Deletes a disposable from store and disposes of it. This will not throw or warn and proceed to dispose the\n\t * disposable even when the disposable is not part in the store.\n\t */\n\tpublic delete(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif ((o as unknown as DisposableStore) === this) {\n\t\t\tthrow new Error('Cannot dispose a disposable on itself!');\n\t\t}\n\t\tthis._toDispose.delete(o);\n\t\to.dispose();\n\t}\n\n\t/**\n\t * Deletes the value from the store, but does not dispose it.\n\t */\n\tpublic deleteAndLeak(o: T): void {\n\t\tif (!o) {\n\t\t\treturn;\n\t\t}\n\t\tif (this._toDispose.has(o)) {\n\t\t\tthis._toDispose.delete(o);\n\t\t\tsetParentOfDisposable(o, null);\n\t\t}\n\t}\n}\n\n/**\n * Abstract base class for a {@link IDisposable disposable} object.\n *\n * Subclasses can {@linkcode _register} disposables that will be automatically cleaned up when this object is disposed of.\n */\nexport abstract class Disposable implements IDisposable {\n\n\t/**\n\t * A disposable that does nothing when it is disposed of.\n\t *\n\t * TODO: This should not be a static property.\n\t */\n\tstatic readonly None = Object.freeze({ dispose() { } });\n\n\tprotected readonly _store = new DisposableStore();\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t\tsetParentOfDisposable(this._store, this);\n\t}\n\n\tpublic dispose(): void {\n\t\tmarkAsDisposed(this);\n\n\t\tthis._store.dispose();\n\t}\n\n\t/**\n\t * Adds `o` to the collection of disposables managed by this object.\n\t */\n\tprotected _register(o: T): T {\n\t\tif ((o as unknown as Disposable) === this) {\n\t\t\tthrow new Error('Cannot register a disposable on itself!');\n\t\t}\n\t\treturn this._store.add(o);\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed.\n *\n * This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can\n * also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.\n */\nexport class MutableDisposable implements IDisposable {\n\tprivate _value?: T;\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tget value(): T | undefined {\n\t\treturn this._isDisposed ? undefined : this._value;\n\t}\n\n\tset value(value: T | undefined) {\n\t\tif (this._isDisposed || value === this._value) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._value?.dispose();\n\t\tif (value) {\n\t\t\tsetParentOfDisposable(value, this);\n\t\t}\n\t\tthis._value = value;\n\t}\n\n\t/**\n\t * Resets the stored value and disposed of the previously stored value.\n\t */\n\tclear(): void {\n\t\tthis.value = undefined;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tmarkAsDisposed(this);\n\t\tthis._value?.dispose();\n\t\tthis._value = undefined;\n\t}\n\n\t/**\n\t * Clears the value, but does not dispose it.\n\t * The old value is returned.\n\t*/\n\tclearAndLeak(): T | undefined {\n\t\tconst oldValue = this._value;\n\t\tthis._value = undefined;\n\t\tif (oldValue) {\n\t\t\tsetParentOfDisposable(oldValue, null);\n\t\t}\n\t\treturn oldValue;\n\t}\n}\n\n/**\n * Manages the lifecycle of a disposable value that may be changed like {@link MutableDisposable}, but the value must\n * exist and cannot be undefined.\n */\nexport class MandatoryMutableDisposable implements IDisposable {\n\tprivate readonly _disposable = new MutableDisposable();\n\tprivate _isDisposed = false;\n\n\tconstructor(initialValue: T) {\n\t\tthis._disposable.value = initialValue;\n\t}\n\n\tget value(): T {\n\t\treturn this._disposable.value!;\n\t}\n\n\tset value(value: T) {\n\t\tif (this._isDisposed || value === this._disposable.value) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposable.value = value;\n\t}\n\n\tdispose() {\n\t\tthis._isDisposed = true;\n\t\tthis._disposable.dispose();\n\t}\n}\n\nexport class RefCountedDisposable {\n\n\tprivate _counter: number = 1;\n\n\tconstructor(\n\t\tprivate readonly _disposable: IDisposable,\n\t) { }\n\n\tacquire() {\n\t\tthis._counter++;\n\t\treturn this;\n\t}\n\n\trelease() {\n\t\tif (--this._counter === 0) {\n\t\t\tthis._disposable.dispose();\n\t\t}\n\t\treturn this;\n\t}\n}\n\n/**\n * A safe disposable can be `unset` so that a leaked reference (listener)\n * can be cut-off.\n */\nexport class SafeDisposable implements IDisposable {\n\n\tdispose: () => void = () => { };\n\tunset: () => void = () => { };\n\tisset: () => boolean = () => false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\tset(fn: Function) {\n\t\tlet callback: Function | undefined = fn;\n\t\tthis.unset = () => callback = undefined;\n\t\tthis.isset = () => callback !== undefined;\n\t\tthis.dispose = () => {\n\t\t\tif (callback) {\n\t\t\t\tcallback();\n\t\t\t\tcallback = undefined;\n\t\t\t\tmarkAsDisposed(this);\n\t\t\t}\n\t\t};\n\t\treturn this;\n\t}\n}\n\nexport interface IReference extends IDisposable {\n\treadonly object: T;\n}\n\nexport abstract class ReferenceCollection {\n\n\tprivate readonly references: Map = new Map();\n\n\tacquire(key: string, ...args: any[]): IReference {\n\t\tlet reference = this.references.get(key);\n\n\t\tif (!reference) {\n\t\t\treference = { counter: 0, object: this.createReferencedObject(key, ...args) };\n\t\t\tthis.references.set(key, reference);\n\t\t}\n\n\t\tconst { object } = reference;\n\t\tconst dispose = createSingleCallFunction(() => {\n\t\t\tif (--reference.counter === 0) {\n\t\t\t\tthis.destroyReferencedObject(key, reference.object);\n\t\t\t\tthis.references.delete(key);\n\t\t\t}\n\t\t});\n\n\t\treference.counter++;\n\n\t\treturn { object, dispose };\n\t}\n\n\tprotected abstract createReferencedObject(key: string, ...args: any[]): T;\n\tprotected abstract destroyReferencedObject(key: string, object: T): void;\n}\n\n/**\n * Unwraps a reference collection of promised values. Makes sure\n * references are disposed whenever promises get rejected.\n */\nexport class AsyncReferenceCollection {\n\n\tconstructor(private referenceCollection: ReferenceCollection>) { }\n\n\tasync acquire(key: string, ...args: any[]): Promise> {\n\t\tconst ref = this.referenceCollection.acquire(key, ...args);\n\n\t\ttry {\n\t\t\tconst object = await ref.object;\n\n\t\t\treturn {\n\t\t\t\tobject,\n\t\t\t\tdispose: () => ref.dispose()\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tref.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nexport class ImmortalReference implements IReference {\n\tconstructor(public object: T) { }\n\tdispose(): void { /* noop */ }\n}\n\nexport function disposeOnReturn(fn: (store: DisposableStore) => void): void {\n\tconst store = new DisposableStore();\n\ttry {\n\t\tfn(store);\n\t} finally {\n\t\tstore.dispose();\n\t}\n}\n\n/**\n * A map the manages the lifecycle of the values that it stores.\n */\nexport class DisposableMap implements IDisposable {\n\n\tprivate readonly _store = new Map();\n\tprivate _isDisposed = false;\n\n\tconstructor() {\n\t\ttrackDisposable(this);\n\t}\n\n\t/**\n\t * Disposes of all stored values and mark this object as disposed.\n\t *\n\t * Trying to use this object after it has been disposed of is an error.\n\t */\n\tdispose(): void {\n\t\tmarkAsDisposed(this);\n\t\tthis._isDisposed = true;\n\t\tthis.clearAndDisposeAll();\n\t}\n\n\t/**\n\t * Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.\n\t */\n\tclearAndDisposeAll(): void {\n\t\tif (!this._store.size) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispose(this._store.values());\n\t\t} finally {\n\t\t\tthis._store.clear();\n\t\t}\n\t}\n\n\thas(key: K): boolean {\n\t\treturn this._store.has(key);\n\t}\n\n\tget size(): number {\n\t\treturn this._store.size;\n\t}\n\n\tget(key: K): V | undefined {\n\t\treturn this._store.get(key);\n\t}\n\n\tset(key: K, value: V, skipDisposeOnOverwrite = false): void {\n\t\tif (this._isDisposed) {\n\t\t\tconsole.warn(new Error('Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!').stack);\n\t\t}\n\n\t\tif (!skipDisposeOnOverwrite) {\n\t\t\tthis._store.get(key)?.dispose();\n\t\t}\n\n\t\tthis._store.set(key, value);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map and also dispose of it.\n\t */\n\tdeleteAndDispose(key: K): void {\n\t\tthis._store.get(key)?.dispose();\n\t\tthis._store.delete(key);\n\t}\n\n\t/**\n\t * Delete the value stored for `key` from this map but return it. The caller is\n\t * responsible for disposing of the value.\n\t */\n\tdeleteAndLeak(key: K): V | undefined {\n\t\tconst value = this._store.get(key);\n\t\tthis._store.delete(key);\n\t\treturn value;\n\t}\n\n\tkeys(): IterableIterator {\n\t\treturn this._store.keys();\n\t}\n\n\tvalues(): IterableIterator {\n\t\treturn this._store.values();\n\t}\n\n\t[Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this._store[Symbol.iterator]();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nclass Node {\n\n\tstatic readonly Undefined = new Node(undefined);\n\n\telement: E;\n\tnext: Node;\n\tprev: Node;\n\n\tconstructor(element: E) {\n\t\tthis.element = element;\n\t\tthis.next = Node.Undefined;\n\t\tthis.prev = Node.Undefined;\n\t}\n}\n\nexport class LinkedList {\n\n\tprivate _first: Node = Node.Undefined;\n\tprivate _last: Node = Node.Undefined;\n\tprivate _size: number = 0;\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this._first === Node.Undefined;\n\t}\n\n\tclear(): void {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tconst next = node.next;\n\t\t\tnode.prev = Node.Undefined;\n\t\t\tnode.next = Node.Undefined;\n\t\t\tnode = next;\n\t\t}\n\n\t\tthis._first = Node.Undefined;\n\t\tthis._last = Node.Undefined;\n\t\tthis._size = 0;\n\t}\n\n\tunshift(element: E): () => void {\n\t\treturn this._insert(element, false);\n\t}\n\n\tpush(element: E): () => void {\n\t\treturn this._insert(element, true);\n\t}\n\n\tprivate _insert(element: E, atTheEnd: boolean): () => void {\n\t\tconst newNode = new Node(element);\n\t\tif (this._first === Node.Undefined) {\n\t\t\tthis._first = newNode;\n\t\t\tthis._last = newNode;\n\n\t\t} else if (atTheEnd) {\n\t\t\t// push\n\t\t\tconst oldLast = this._last;\n\t\t\tthis._last = newNode;\n\t\t\tnewNode.prev = oldLast;\n\t\t\toldLast.next = newNode;\n\n\t\t} else {\n\t\t\t// unshift\n\t\t\tconst oldFirst = this._first;\n\t\t\tthis._first = newNode;\n\t\t\tnewNode.next = oldFirst;\n\t\t\toldFirst.prev = newNode;\n\t\t}\n\t\tthis._size += 1;\n\n\t\tlet didRemove = false;\n\t\treturn () => {\n\t\t\tif (!didRemove) {\n\t\t\t\tdidRemove = true;\n\t\t\t\tthis._remove(newNode);\n\t\t\t}\n\t\t};\n\t}\n\n\tshift(): E | undefined {\n\t\tif (this._first === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._first.element;\n\t\t\tthis._remove(this._first);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tpop(): E | undefined {\n\t\tif (this._last === Node.Undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst res = this._last.element;\n\t\t\tthis._remove(this._last);\n\t\t\treturn res;\n\t\t}\n\t}\n\n\tprivate _remove(node: Node): void {\n\t\tif (node.prev !== Node.Undefined && node.next !== Node.Undefined) {\n\t\t\t// middle\n\t\t\tconst anchor = node.prev;\n\t\t\tanchor.next = node.next;\n\t\t\tnode.next.prev = anchor;\n\n\t\t} else if (node.prev === Node.Undefined && node.next === Node.Undefined) {\n\t\t\t// only node\n\t\t\tthis._first = Node.Undefined;\n\t\t\tthis._last = Node.Undefined;\n\n\t\t} else if (node.next === Node.Undefined) {\n\t\t\t// last\n\t\t\tthis._last = this._last.prev!;\n\t\t\tthis._last.next = Node.Undefined;\n\n\t\t} else if (node.prev === Node.Undefined) {\n\t\t\t// first\n\t\t\tthis._first = this._first.next!;\n\t\t\tthis._first.prev = Node.Undefined;\n\t\t}\n\n\t\t// done\n\t\tthis._size -= 1;\n\t}\n\n\t*[Symbol.iterator](): Iterator {\n\t\tlet node = this._first;\n\t\twhile (node !== Node.Undefined) {\n\t\t\tyield node.element;\n\t\t\tnode = node.next;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n// fake definition so that the valid layers check won't trip on this\ndeclare const globalThis: { performance?: { now(): number } };\n\nconst hasPerformanceNow = (globalThis.performance && typeof globalThis.performance.now === 'function');\n\nexport class StopWatch {\n\n\tprivate _startTime: number;\n\tprivate _stopTime: number;\n\n\tprivate readonly _now: () => number;\n\n\tpublic static create(highResolution?: boolean): StopWatch {\n\t\treturn new StopWatch(highResolution);\n\t}\n\n\tconstructor(highResolution?: boolean) {\n\t\tthis._now = hasPerformanceNow && highResolution === false ? Date.now : globalThis.performance!.now.bind(globalThis.performance);\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic stop(): void {\n\t\tthis._stopTime = this._now();\n\t}\n\n\tpublic reset(): void {\n\t\tthis._startTime = this._now();\n\t\tthis._stopTime = -1;\n\t}\n\n\tpublic elapsed(): number {\n\t\tif (this._stopTime !== -1) {\n\t\t\treturn this._stopTime - this._startTime;\n\t\t}\n\t\treturn this._now() - this._startTime;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken } from 'vs/base/common/cancellation';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport { createSingleCallFunction } from 'vs/base/common/functional';\nimport { combinedDisposable, Disposable, DisposableMap, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\nimport { IObservable, IObserver } from 'vs/base/common/observable';\nimport { StopWatch } from 'vs/base/common/stopwatch';\nimport { MicrotaskDelay } from 'vs/base/common/symbols';\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a listener is GC'ed without having been disposed. This is a LEAK.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableListenerGCedWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableDisposeWithListenerWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n\n// -----------------------------------------------------------------------------------------------------------------------\n// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.\n// See https://github.com/microsoft/vscode/issues/142851\n// -----------------------------------------------------------------------------------------------------------------------\nconst _enableSnapshotPotentialLeakWarning = false\n\t// || Boolean(\"TRUE\") // causes a linter warning so that it cannot be pushed\n\t;\n\n/**\n * An event with zero or one parameters that can be subscribed to. The event is a function itself.\n */\nexport interface Event {\n\t(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport namespace Event {\n\texport const None: Event = () => Disposable.None;\n\n\tfunction _addLeakageTraceLogic(options: EmitterOptions) {\n\t\tif (_enableSnapshotPotentialLeakWarning) {\n\t\t\tconst { onDidAddListener: origListenerDidAdd } = options;\n\t\t\tconst stack = Stacktrace.create();\n\t\t\tlet count = 0;\n\t\t\toptions.onDidAddListener = () => {\n\t\t\t\tif (++count === 2) {\n\t\t\t\t\tconsole.warn('snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here');\n\t\t\t\t\tstack.print();\n\t\t\t\t}\n\t\t\t\torigListenerDidAdd?.();\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Given an event, returns another event which debounces calls and defers the listeners to a later task via a shared\n\t * `setTimeout`. The event is converted into a signal (`Event`) to avoid additional object creation as a\n\t * result of merging events and to try prevent race conditions that could arise when using related deferred and\n\t * non-deferred events.\n\t *\n\t * This is useful for deferring non-critical work (eg. general UI updates) to ensure it does not block critical work\n\t * (eg. latency of keypress to text rendered).\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function defer(event: Event, disposable?: DisposableStore): Event {\n\t\treturn debounce(event, () => void 0, 0, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Given an event, returns another event which only fires once.\n\t *\n\t * @param event The event source for the new event.\n\t */\n\texport function once(event: Event): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\t// we need this, in case the event fires during the listener call\n\t\t\tlet didFire = false;\n\t\t\tlet result: IDisposable | undefined = undefined;\n\t\t\tresult = event(e => {\n\t\t\t\tif (didFire) {\n\t\t\t\t\treturn;\n\t\t\t\t} else if (result) {\n\t\t\t\t\tresult.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tdidFire = true;\n\t\t\t\t}\n\n\t\t\t\treturn listener.call(thisArgs, e);\n\t\t\t}, null, disposables);\n\n\t\t\tif (didFire) {\n\t\t\t\tresult.dispose();\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Maps an event of one type into an event of another type using a mapping function, similar to how\n\t * `Array.prototype.map` works.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param map The mapping function.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function map(event: Event, map: (i: I) => O, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that performs some function on the event object before firing.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param each The function to perform on the event object.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function forEach(event: Event, each: (i: I) => void, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(i => { each(i); listener.call(thisArgs, i); }, null, disposables), disposable);\n\t}\n\n\t/**\n\t * Wraps an event in another event that fires only when some condition is met.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param filter The filter function that defines the condition. The event will fire for the object if this function\n\t * returns true.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function filter(event: Event, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event;\n\texport function filter(event: Event, filter: (e: T) => boolean, disposable?: DisposableStore): Event {\n\t\treturn snapshot((listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);\n\t}\n\n\t/**\n\t * Given an event, returns the same event but typed as `Event`.\n\t */\n\texport function signal(event: Event): Event {\n\t\treturn event as Event as Event;\n\t}\n\n\t/**\n\t * Given a collection of events, returns a single event which emits whenever any of the provided events emit.\n\t */\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event;\n\texport function any(...events: Event[]): Event {\n\t\treturn (listener, thisArgs = null, disposables?) => {\n\t\t\tconst disposable = combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e))));\n\t\t\treturn addAndReturnDisposable(disposable, disposables);\n\t\t};\n\t}\n\n\t/**\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function reduce(event: Event, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event {\n\t\tlet output: O | undefined = initial;\n\n\t\treturn map(event, e => {\n\t\t\toutput = merge(output, e);\n\t\t\treturn output;\n\t\t}, disposable);\n\t}\n\n\tfunction snapshot(event: Event, disposable: DisposableStore | undefined): Event {\n\t\tlet listener: IDisposable | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tlistener = event(emitter.fire, emitter);\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tlistener?.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Adds the IDisposable to the store if it's set, and returns it. Useful to\n\t * Event function implementation.\n\t */\n\tfunction addAndReturnDisposable(d: T, store: DisposableStore | IDisposable[] | undefined): T {\n\t\tif (store instanceof Array) {\n\t\t\tstore.push(d);\n\t\t} else if (store) {\n\t\t\tstore.add(d);\n\t\t}\n\t\treturn d;\n\t}\n\n\t/**\n\t * Given an event, creates a new emitter that event that will debounce events based on {@link delay} and give an\n\t * array event object of all events that fired.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The original event to debounce.\n\t * @param merge A function that reduces all events into a single event.\n\t * @param delay The number of milliseconds to debounce.\n\t * @param leading Whether to fire a leading event without debouncing.\n\t * @param flushOnListenerRemove Whether to fire all debounced events when a listener is removed. If this is not\n\t * specified, some events could go missing. Use this if it's important that all events are processed, even if the\n\t * listener gets disposed before the debounced event fires.\n\t * @param leakWarningThreshold See {@link EmitterOptions.leakWarningThreshold}.\n\t * @param disposable A disposable store to register the debounce emitter to.\n\t */\n\texport function debounce(event: Event, merge: (last: T | undefined, event: T) => T, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay?: number | typeof MicrotaskDelay, leading?: boolean, flushOnListenerRemove?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event;\n\texport function debounce(event: Event, merge: (last: O | undefined, event: I) => O, delay: number | typeof MicrotaskDelay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold?: number, disposable?: DisposableStore): Event {\n\t\tlet subscription: IDisposable;\n\t\tlet output: O | undefined = undefined;\n\t\tlet handle: any = undefined;\n\t\tlet numDebouncedCalls = 0;\n\t\tlet doFire: (() => void) | undefined;\n\n\t\tconst options: EmitterOptions | undefined = {\n\t\t\tleakWarningThreshold,\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tsubscription = event(cur => {\n\t\t\t\t\tnumDebouncedCalls++;\n\t\t\t\t\toutput = merge(output, cur);\n\n\t\t\t\t\tif (leading && !handle) {\n\t\t\t\t\t\temitter.fire(output);\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tdoFire = () => {\n\t\t\t\t\t\tconst _output = output;\n\t\t\t\t\t\toutput = undefined;\n\t\t\t\t\t\thandle = undefined;\n\t\t\t\t\t\tif (!leading || numDebouncedCalls > 1) {\n\t\t\t\t\t\t\temitter.fire(_output!);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnumDebouncedCalls = 0;\n\t\t\t\t\t};\n\n\t\t\t\t\tif (typeof delay === 'number') {\n\t\t\t\t\t\tclearTimeout(handle);\n\t\t\t\t\t\thandle = setTimeout(doFire, delay);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (handle === undefined) {\n\t\t\t\t\t\t\thandle = 0;\n\t\t\t\t\t\t\tqueueMicrotask(doFire);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\tonWillRemoveListener() {\n\t\t\t\tif (flushOnListenerRemove && numDebouncedCalls > 0) {\n\t\t\t\t\tdoFire?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tdoFire = undefined;\n\t\t\t\tsubscription.dispose();\n\t\t\t}\n\t\t};\n\n\t\tif (!disposable) {\n\t\t\t_addLeakageTraceLogic(options);\n\t\t}\n\n\t\tconst emitter = new Emitter(options);\n\n\t\tdisposable?.add(emitter);\n\n\t\treturn emitter.event;\n\t}\n\n\t/**\n\t * Debounces an event, firing after some delay (default=0) with an array of all event original objects.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t */\n\texport function accumulate(event: Event, delay: number = 0, disposable?: DisposableStore): Event {\n\t\treturn Event.debounce(event, (last, e) => {\n\t\t\tif (!last) {\n\t\t\t\treturn [e];\n\t\t\t}\n\t\t\tlast.push(e);\n\t\t\treturn last;\n\t\t}, delay, undefined, true, undefined, disposable);\n\t}\n\n\t/**\n\t * Filters an event such that some condition is _not_ met more than once in a row, effectively ensuring duplicate\n\t * event objects from different sources do not fire the same event object.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param equals The equality condition.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t *\n\t * @example\n\t * ```\n\t * // Fire only one time when a single window is opened or focused\n\t * Event.latch(Event.any(onDidOpenWindow, onDidFocusWindow))\n\t * ```\n\t */\n\texport function latch(event: Event, equals: (a: T, b: T) => boolean = (a, b) => a === b, disposable?: DisposableStore): Event {\n\t\tlet firstCall = true;\n\t\tlet cache: T;\n\n\t\treturn filter(event, value => {\n\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\tfirstCall = false;\n\t\t\tcache = value;\n\t\t\treturn shouldEmit;\n\t\t}, disposable);\n\t}\n\n\t/**\n\t * Splits an event whose parameter is a union type into 2 separate events for each type in the union.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @example\n\t * ```\n\t * const event = new EventEmitter().event;\n\t * const [numberEvent, undefinedEvent] = Event.split(event, isUndefined);\n\t * ```\n\t *\n\t * @param event The event source for the new event.\n\t * @param isT A function that determines what event is of the first type.\n\t * @param disposable A disposable store to add the new EventEmitter to.\n\t */\n\texport function split(event: Event, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event, Event] {\n\t\treturn [\n\t\t\tEvent.filter(event, isT, disposable),\n\t\t\tEvent.filter(event, e => !isT(e), disposable) as Event,\n\t\t];\n\t}\n\n\t/**\n\t * Buffers an event until it has a listener attached.\n\t *\n\t * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned\n\t * event is accessible to \"third parties\", e.g the event is a public property. Otherwise a leaked listener on the\n\t * returned event causes this utility to leak a listener on the original event.\n\t *\n\t * @param event The event source for the new event.\n\t * @param flushAfterTimeout Determines whether to flush the buffer after a timeout immediately or after a\n\t * `setTimeout` when the first event listener is added.\n\t * @param _buffer Internal: A source event array used for tests.\n\t *\n\t * @example\n\t * ```\n\t * // Start accumulating events, when the first listener is attached, flush\n\t * // the event after a timeout such that multiple listeners attached before\n\t * // the timeout would receive the event\n\t * this.onInstallExtension = Event.buffer(service.onInstallExtension, true);\n\t * ```\n\t */\n\texport function buffer(event: Event, flushAfterTimeout = false, _buffer: T[] = [], disposable?: DisposableStore): Event {\n\t\tlet buffer: T[] | null = _buffer.slice();\n\n\t\tlet listener: IDisposable | null = event(e => {\n\t\t\tif (buffer) {\n\t\t\t\tbuffer.push(e);\n\t\t\t} else {\n\t\t\t\temitter.fire(e);\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(listener);\n\t\t}\n\n\t\tconst flush = () => {\n\t\t\tbuffer?.forEach(e => emitter.fire(e));\n\t\t\tbuffer = null;\n\t\t};\n\n\t\tconst emitter = new Emitter({\n\t\t\tonWillAddFirstListener() {\n\t\t\t\tif (!listener) {\n\t\t\t\t\tlistener = event(e => emitter.fire(e));\n\t\t\t\t\tif (disposable) {\n\t\t\t\t\t\tdisposable.add(listener);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidAddFirstListener() {\n\t\t\t\tif (buffer) {\n\t\t\t\t\tif (flushAfterTimeout) {\n\t\t\t\t\t\tsetTimeout(flush);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tflush();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tonDidRemoveLastListener() {\n\t\t\t\tif (listener) {\n\t\t\t\t\tlistener.dispose();\n\t\t\t\t}\n\t\t\t\tlistener = null;\n\t\t\t}\n\t\t});\n\n\t\tif (disposable) {\n\t\t\tdisposable.add(emitter);\n\t\t}\n\n\t\treturn emitter.event;\n\t}\n\t/**\n\t * Wraps the event in an {@link IChainableEvent}, allowing a more functional programming style.\n\t *\n\t * @example\n\t * ```\n\t * // Normal\n\t * const onEnterPressNormal = Event.filter(\n\t * Event.map(onKeyPress.event, e => new StandardKeyboardEvent(e)),\n\t * e.keyCode === KeyCode.Enter\n\t * ).event;\n\t *\n\t * // Using chain\n\t * const onEnterPressChain = Event.chain(onKeyPress.event, $ => $\n\t * .map(e => new StandardKeyboardEvent(e))\n\t * .filter(e => e.keyCode === KeyCode.Enter)\n\t * );\n\t * ```\n\t */\n\texport function chain(event: Event, sythensize: ($: IChainableSythensis) => IChainableSythensis): Event {\n\t\tconst fn: Event = (listener, thisArgs, disposables) => {\n\t\t\tconst cs = sythensize(new ChainableSynthesis()) as ChainableSynthesis;\n\t\t\treturn event(function (value) {\n\t\t\t\tconst result = cs.evaluate(value);\n\t\t\t\tif (result !== HaltChainable) {\n\t\t\t\t\tlistener.call(thisArgs, result);\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\n\t\treturn fn;\n\t}\n\n\tconst HaltChainable = Symbol('HaltChainable');\n\n\tclass ChainableSynthesis implements IChainableSythensis {\n\t\tprivate readonly steps: ((input: any) => any)[] = [];\n\n\t\tmap(fn: (i: any) => O): this {\n\t\t\tthis.steps.push(fn);\n\t\t\treturn this;\n\t\t}\n\n\t\tforEach(fn: (i: any) => void): this {\n\t\t\tthis.steps.push(v => {\n\t\t\t\tfn(v);\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tfilter(fn: (e: any) => boolean): this {\n\t\t\tthis.steps.push(v => fn(v) ? v : HaltChainable);\n\t\t\treturn this;\n\t\t}\n\n\t\treduce(merge: (last: R | undefined, event: any) => R, initial?: R | undefined): this {\n\t\t\tlet last = initial;\n\t\t\tthis.steps.push(v => {\n\t\t\t\tlast = merge(last, v);\n\t\t\t\treturn last;\n\t\t\t});\n\t\t\treturn this;\n\t\t}\n\n\t\tlatch(equals: (a: any, b: any) => boolean = (a, b) => a === b): ChainableSynthesis {\n\t\t\tlet firstCall = true;\n\t\t\tlet cache: any;\n\t\t\tthis.steps.push(value => {\n\t\t\t\tconst shouldEmit = firstCall || !equals(value, cache);\n\t\t\t\tfirstCall = false;\n\t\t\t\tcache = value;\n\t\t\t\treturn shouldEmit ? value : HaltChainable;\n\t\t\t});\n\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic evaluate(value: any) {\n\t\t\tfor (const step of this.steps) {\n\t\t\t\tvalue = step(value);\n\t\t\t\tif (value === HaltChainable) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn value;\n\t\t}\n\t}\n\n\texport interface IChainableSythensis {\n\t\tmap(fn: (i: T) => O): IChainableSythensis;\n\t\tforEach(fn: (i: T) => void): IChainableSythensis;\n\t\tfilter(fn: (e: T) => e is R): IChainableSythensis;\n\t\tfilter(fn: (e: T) => boolean): IChainableSythensis;\n\t\treduce(merge: (last: R, event: T) => R, initial: R): IChainableSythensis;\n\t\treduce(merge: (last: R | undefined, event: T) => R): IChainableSythensis;\n\t\tlatch(equals?: (a: T, b: T) => boolean): IChainableSythensis;\n\t}\n\n\texport interface NodeEventEmitter {\n\t\ton(event: string | symbol, listener: Function): unknown;\n\t\tremoveListener(event: string | symbol, listener: Function): unknown;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a node event emitter.\n\t */\n\texport function fromNodeEventEmitter(emitter: NodeEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.on(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\texport interface DOMEventEmitter {\n\t\taddEventListener(event: string | symbol, listener: Function): void;\n\t\tremoveEventListener(event: string | symbol, listener: Function): void;\n\t}\n\n\t/**\n\t * Creates an {@link Event} from a DOM event emitter.\n\t */\n\texport function fromDOMEventEmitter(emitter: DOMEventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event {\n\t\tconst fn = (...args: any[]) => result.fire(map(...args));\n\t\tconst onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);\n\t\tconst onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);\n\t\tconst result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * Creates a promise out of an event, using the {@link Event.once} helper.\n\t */\n\texport function toPromise(event: Event): Promise {\n\t\treturn new Promise(resolve => once(event)(resolve));\n\t}\n\n\t/**\n\t * Creates an event out of a promise that fires once when the promise is\n\t * resolved with the result of the promise or `undefined`.\n\t */\n\texport function fromPromise(promise: Promise): Event {\n\t\tconst result = new Emitter();\n\n\t\tpromise.then(res => {\n\t\t\tresult.fire(res);\n\t\t}, () => {\n\t\t\tresult.fire(undefined);\n\t\t}).finally(() => {\n\t\t\tresult.dispose();\n\t\t});\n\n\t\treturn result.event;\n\t}\n\n\t/**\n\t * A convenience function for forwarding an event to another emitter which\n\t * improves readability.allows Event.forward(event, emitter) instead of `event(e => emitter.fire(e))`.\n\t * @param from The event to forward.\n\t * @param to The emitter to forward the event to.\n\t * @example\n\t * Event.forward(event, emitter);\n\t * // equivalent to\n\t * event(e => emitter.fire(e));\n\t * // equivalent to\n\t * event(emitter.fire, emitter);\n\t */\n\texport function forward(from: Event, to: Emitter): IDisposable {\n\t\treturn from(e => to.fire(e));\n\t}\n\n\t/**\n\t * Adds a listener to an event and calls the listener immediately with undefined as the event object.\n\t *\n\t * @example\n\t * ```\n\t * // Initialize the UI and update it when dataChangeEvent fires\n\t * runAndSubscribe(dataChangeEvent, () => this._updateUI());\n\t * ```\n\t */\n\texport function runAndSubscribe(event: Event, handler: (e: T) => any, initial: T): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any): IDisposable;\n\texport function runAndSubscribe(event: Event, handler: (e: T | undefined) => any, initial?: T): IDisposable {\n\t\thandler(initial);\n\t\treturn event(e => handler(e));\n\t}\n\n\tclass EmitterObserver implements IObserver {\n\n\t\treadonly emitter: Emitter;\n\n\t\tprivate _counter = 0;\n\t\tprivate _hasChanged = false;\n\n\t\tconstructor(readonly _observable: IObservable, store: DisposableStore | undefined) {\n\t\t\tconst options: EmitterOptions = {\n\t\t\t\tonWillAddFirstListener: () => {\n\t\t\t\t\t_observable.addObserver(this);\n\t\t\t\t},\n\t\t\t\tonDidRemoveLastListener: () => {\n\t\t\t\t\t_observable.removeObserver(this);\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (!store) {\n\t\t\t\t_addLeakageTraceLogic(options);\n\t\t\t}\n\t\t\tthis.emitter = new Emitter(options);\n\t\t\tif (store) {\n\t\t\t\tstore.add(this.emitter);\n\t\t\t}\n\t\t}\n\n\t\tbeginUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter++;\n\t\t}\n\n\t\thandlePossibleChange(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t}\n\n\t\thandleChange(_observable: IObservable, _change: TChange): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._hasChanged = true;\n\t\t}\n\n\t\tendUpdate(_observable: IObservable): void {\n\t\t\t// assert(_observable === this.obs);\n\t\t\tthis._counter--;\n\t\t\tif (this._counter === 0) {\n\t\t\t\tthis._observable.reportChanges();\n\t\t\t\tif (this._hasChanged) {\n\t\t\t\t\tthis._hasChanged = false;\n\t\t\t\t\tthis.emitter.fire(this._observable.get());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates an event emitter that is fired when the observable changes.\n\t * Each listeners subscribes to the emitter.\n\t */\n\texport function fromObservable(obs: IObservable, store?: DisposableStore): Event {\n\t\tconst observer = new EmitterObserver(obs, store);\n\t\treturn observer.emitter.event;\n\t}\n\n\t/**\n\t * Each listener is attached to the observable directly.\n\t */\n\texport function fromObservableLight(observable: IObservable): Event {\n\t\treturn (listener, thisArgs, disposables) => {\n\t\t\tlet count = 0;\n\t\t\tlet didChange = false;\n\t\t\tconst observer: IObserver = {\n\t\t\t\tbeginUpdate() {\n\t\t\t\t\tcount++;\n\t\t\t\t},\n\t\t\t\tendUpdate() {\n\t\t\t\t\tcount--;\n\t\t\t\t\tif (count === 0) {\n\t\t\t\t\t\tobservable.reportChanges();\n\t\t\t\t\t\tif (didChange) {\n\t\t\t\t\t\t\tdidChange = false;\n\t\t\t\t\t\t\tlistener.call(thisArgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandlePossibleChange() {\n\t\t\t\t\t// noop\n\t\t\t\t},\n\t\t\t\thandleChange() {\n\t\t\t\t\tdidChange = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tobservable.addObserver(observer);\n\t\t\tobservable.reportChanges();\n\t\t\tconst disposable = {\n\t\t\t\tdispose() {\n\t\t\t\t\tobservable.removeObserver(observer);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(disposable);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(disposable);\n\t\t\t}\n\n\t\t\treturn disposable;\n\t\t};\n\t}\n}\n\nexport interface EmitterOptions {\n\t/**\n\t * Optional function that's called *before* the very first listener is added\n\t */\n\tonWillAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called *after* the very first listener is added\n\t */\n\tonDidAddFirstListener?: Function;\n\t/**\n\t * Optional function that's called after a listener is added\n\t */\n\tonDidAddListener?: Function;\n\t/**\n\t * Optional function that's called *after* remove the very last listener\n\t */\n\tonDidRemoveLastListener?: Function;\n\t/**\n\t * Optional function that's called *before* a listener is removed\n\t */\n\tonWillRemoveListener?: Function;\n\t/**\n\t * Optional function that's called when a listener throws an error. Defaults to\n\t * {@link onUnexpectedError}\n\t */\n\tonListenerError?: (e: any) => void;\n\t/**\n\t * Number of listeners that are allowed before assuming a leak. Default to\n\t * a globally configured value\n\t *\n\t * @see setGlobalLeakWarningThreshold\n\t */\n\tleakWarningThreshold?: number;\n\t/**\n\t * Pass in a delivery queue, which is useful for ensuring\n\t * in order event delivery across multiple emitters.\n\t */\n\tdeliveryQueue?: EventDeliveryQueue;\n\n\t/** ONLY enable this during development */\n\t_profName?: string;\n}\n\n\nexport class EventProfiling {\n\n\tstatic readonly all = new Set();\n\n\tprivate static _idPool = 0;\n\n\treadonly name: string;\n\tpublic listenerCount: number = 0;\n\tpublic invocationCount = 0;\n\tpublic elapsedOverall = 0;\n\tpublic durations: number[] = [];\n\n\tprivate _stopWatch?: StopWatch;\n\n\tconstructor(name: string) {\n\t\tthis.name = `${name}_${EventProfiling._idPool++}`;\n\t\tEventProfiling.all.add(this);\n\t}\n\n\tstart(listenerCount: number): void {\n\t\tthis._stopWatch = new StopWatch();\n\t\tthis.listenerCount = listenerCount;\n\t}\n\n\tstop(): void {\n\t\tif (this._stopWatch) {\n\t\t\tconst elapsed = this._stopWatch.elapsed();\n\t\t\tthis.durations.push(elapsed);\n\t\t\tthis.elapsedOverall += elapsed;\n\t\t\tthis.invocationCount += 1;\n\t\t\tthis._stopWatch = undefined;\n\t\t}\n\t}\n}\n\nlet _globalLeakWarningThreshold = -1;\nexport function setGlobalLeakWarningThreshold(n: number): IDisposable {\n\tconst oldValue = _globalLeakWarningThreshold;\n\t_globalLeakWarningThreshold = n;\n\treturn {\n\t\tdispose() {\n\t\t\t_globalLeakWarningThreshold = oldValue;\n\t\t}\n\t};\n}\n\nclass LeakageMonitor {\n\n\tprivate static _idPool = 1;\n\n\tprivate _stacks: Map | undefined;\n\tprivate _warnCountdown: number = 0;\n\n\tconstructor(\n\t\tprivate readonly _errorHandler: (err: Error) => void,\n\t\treadonly threshold: number,\n\t\treadonly name: string = (LeakageMonitor._idPool++).toString(16).padStart(3, '0')\n\t) { }\n\n\tdispose(): void {\n\t\tthis._stacks?.clear();\n\t}\n\n\tcheck(stack: Stacktrace, listenerCount: number): undefined | (() => void) {\n\n\t\tconst threshold = this.threshold;\n\t\tif (threshold <= 0 || listenerCount < threshold) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (!this._stacks) {\n\t\t\tthis._stacks = new Map();\n\t\t}\n\t\tconst count = (this._stacks.get(stack.value) || 0);\n\t\tthis._stacks.set(stack.value, count + 1);\n\t\tthis._warnCountdown -= 1;\n\n\t\tif (this._warnCountdown <= 0) {\n\t\t\t// only warn on first exceed and then every time the limit\n\t\t\t// is exceeded by 50% again\n\t\t\tthis._warnCountdown = threshold * 0.5;\n\n\t\t\tconst [topStack, topCount] = this.getMostFrequentStack()!;\n\t\t\tconst message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;\n\t\t\tconsole.warn(message);\n\t\t\tconsole.warn(topStack!);\n\n\t\t\tconst error = new ListenerLeakError(message, topStack);\n\t\t\tthis._errorHandler(error);\n\t\t}\n\n\t\treturn () => {\n\t\t\tconst count = (this._stacks!.get(stack.value) || 0);\n\t\t\tthis._stacks!.set(stack.value, count - 1);\n\t\t};\n\t}\n\n\tgetMostFrequentStack(): [string, number] | undefined {\n\t\tif (!this._stacks) {\n\t\t\treturn undefined;\n\t\t}\n\t\tlet topStack: [string, number] | undefined;\n\t\tlet topCount: number = 0;\n\t\tfor (const [stack, count] of this._stacks) {\n\t\t\tif (!topStack || topCount < count) {\n\t\t\t\ttopStack = [stack, count];\n\t\t\t\ttopCount = count;\n\t\t\t}\n\t\t}\n\t\treturn topStack;\n\t}\n}\n\nclass Stacktrace {\n\n\tstatic create() {\n\t\tconst err = new Error();\n\t\treturn new Stacktrace(err.stack ?? '');\n\t}\n\n\tprivate constructor(readonly value: string) { }\n\n\tprint() {\n\t\tconsole.warn(this.value.split('\\n').slice(2).join('\\n'));\n\t}\n}\n\n// error that is logged when going over the configured listener threshold\nexport class ListenerLeakError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerLeakError';\n\t\tthis.stack = stack;\n\t}\n}\n\n// SEVERE error that is logged when having gone way over the configured listener\n// threshold so that the emitter refuses to accept more listeners\nexport class ListenerRefusalError extends Error {\n\tconstructor(message: string, stack: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ListenerRefusalError';\n\t\tthis.stack = stack;\n\t}\n}\n\nlet id = 0;\nclass UniqueContainer {\n\tstack?: Stacktrace;\n\tpublic id = id++;\n\tconstructor(public readonly value: T) { }\n}\nconst compactionThreshold = 2;\n\ntype ListenerContainer = UniqueContainer<(data: T) => void>;\ntype ListenerOrListeners = (ListenerContainer | undefined)[] | ListenerContainer;\n\nconst forEachListener = (listeners: ListenerOrListeners, fn: (c: ListenerContainer) => void) => {\n\tif (listeners instanceof UniqueContainer) {\n\t\tfn(listeners);\n\t} else {\n\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\tconst l = listeners[i];\n\t\t\tif (l) {\n\t\t\t\tfn(l);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\nlet _listenerFinalizers: FinalizationRegistry | undefined;\n\nif (_enableListenerGCedWarning) {\n\tconst leaks: string[] = [];\n\n\tsetInterval(() => {\n\t\tif (leaks.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.warn('[LEAKING LISTENERS] GC\\'ed these listeners that were NOT yet disposed:');\n\t\tconsole.warn(leaks.join('\\n'));\n\t\tleaks.length = 0;\n\t}, 3000);\n\n\t_listenerFinalizers = new FinalizationRegistry(heldValue => {\n\t\tif (typeof heldValue === 'string') {\n\t\t\tleaks.push(heldValue);\n\t\t}\n\t});\n}\n\n/**\n * The Emitter can be used to expose an Event to the public\n * to fire it from the insides.\n * Sample:\n\tclass Document {\n\n\t\tprivate readonly _onDidChange = new Emitter<(value:string)=>any>();\n\n\t\tpublic onDidChange = this._onDidChange.event;\n\n\t\t// getter-style\n\t\t// get onDidChange(): Event<(value:string)=>any> {\n\t\t// \treturn this._onDidChange.event;\n\t\t// }\n\n\t\tprivate _doIt() {\n\t\t\t//...\n\t\t\tthis._onDidChange.fire(value);\n\t\t}\n\t}\n */\nexport class Emitter {\n\n\tprivate readonly _options?: EmitterOptions;\n\tprivate readonly _leakageMon?: LeakageMonitor;\n\tprivate readonly _perfMon?: EventProfiling;\n\tprivate _disposed?: true;\n\tprivate _event?: Event;\n\n\t/**\n\t * A listener, or list of listeners. A single listener is the most common\n\t * for event emitters (#185789), so we optimize that special case to avoid\n\t * wrapping it in an array (just like Node.js itself.)\n\t *\n\t * A list of listeners never 'downgrades' back to a plain function if\n\t * listeners are removed, for two reasons:\n\t *\n\t * 1. That's complicated (especially with the deliveryQueue)\n\t * 2. A listener with >1 listener is likely to have >1 listener again at\n\t * some point, and swapping between arrays and functions may[citation needed]\n\t * introduce unnecessary work and garbage.\n\t *\n\t * The array listeners can be 'sparse', to avoid reallocating the array\n\t * whenever any listener is added or removed. If more than `1 / compactionThreshold`\n\t * of the array is empty, only then is it resized.\n\t */\n\tprotected _listeners?: ListenerOrListeners;\n\n\t/**\n\t * Always to be defined if _listeners is an array. It's no longer a true\n\t * queue, but holds the dispatching 'state'. If `fire()` is called on an\n\t * emitter, any work left in the _deliveryQueue is finished first.\n\t */\n\tprivate _deliveryQueue?: EventDeliveryQueuePrivate;\n\tprotected _size = 0;\n\n\tconstructor(options?: EmitterOptions) {\n\t\tthis._options = options;\n\t\tthis._leakageMon = (_globalLeakWarningThreshold > 0 || this._options?.leakWarningThreshold)\n\t\t\t? new LeakageMonitor(options?.onListenerError ?? onUnexpectedError, this._options?.leakWarningThreshold ?? _globalLeakWarningThreshold) :\n\t\t\tundefined;\n\t\tthis._perfMon = this._options?._profName ? new EventProfiling(this._options._profName) : undefined;\n\t\tthis._deliveryQueue = this._options?.deliveryQueue as EventDeliveryQueuePrivate | undefined;\n\t}\n\n\tdispose() {\n\t\tif (!this._disposed) {\n\t\t\tthis._disposed = true;\n\n\t\t\t// It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter\n\t\t\t// alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and\n\t\t\t// unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the\n\t\t\t// the following programming pattern is very popular:\n\t\t\t//\n\t\t\t// const someModel = this._disposables.add(new ModelObject()); // (1) create and register model\n\t\t\t// this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener\n\t\t\t// ...later...\n\t\t\t// this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the \"overall dispose\" is done\n\n\t\t\tif (this._deliveryQueue?.current === this) {\n\t\t\t\tthis._deliveryQueue.reset();\n\t\t\t}\n\t\t\tif (this._listeners) {\n\t\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\t\tconst listeners = this._listeners;\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tforEachListener(listeners, l => l.stack?.print());\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis._listeners = undefined;\n\t\t\t\tthis._size = 0;\n\t\t\t}\n\t\t\tthis._options?.onDidRemoveLastListener?.();\n\t\t\tthis._leakageMon?.dispose();\n\t\t}\n\t}\n\n\t/**\n\t * For the public to allow to subscribe\n\t * to events from this Emitter\n\t */\n\tget event(): Event {\n\t\tthis._event ??= (callback: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n\t\t\tif (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {\n\t\t\t\tconst message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;\n\t\t\t\tconsole.warn(message);\n\n\t\t\t\tconst tuple = this._leakageMon.getMostFrequentStack() ?? ['UNKNOWN stack', -1];\n\t\t\t\tconst error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);\n\t\t\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\t\t\terrorHandler(error);\n\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (this._disposed) {\n\t\t\t\t// todo: should we warn if a listener is added to a disposed emitter? This happens often\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tif (thisArgs) {\n\t\t\t\tcallback = callback.bind(thisArgs);\n\t\t\t}\n\n\t\t\tconst contained = new UniqueContainer(callback);\n\n\t\t\tlet removeMonitor: Function | undefined;\n\t\t\tlet stack: Stacktrace | undefined;\n\t\t\tif (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {\n\t\t\t\t// check and record this emitter for potential leakage\n\t\t\t\tcontained.stack = Stacktrace.create();\n\t\t\t\tremoveMonitor = this._leakageMon.check(contained.stack, this._size + 1);\n\t\t\t}\n\n\t\t\tif (_enableDisposeWithListenerWarning) {\n\t\t\t\tcontained.stack = stack ?? Stacktrace.create();\n\t\t\t}\n\n\t\t\tif (!this._listeners) {\n\t\t\t\tthis._options?.onWillAddFirstListener?.(this);\n\t\t\t\tthis._listeners = contained;\n\t\t\t\tthis._options?.onDidAddFirstListener?.(this);\n\t\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\t\tthis._deliveryQueue ??= new EventDeliveryQueuePrivate();\n\t\t\t\tthis._listeners = [this._listeners, contained];\n\t\t\t} else {\n\t\t\t\tthis._listeners.push(contained);\n\t\t\t}\n\n\t\t\tthis._size++;\n\n\n\t\t\tconst result = toDisposable(() => {\n\t\t\t\t_listenerFinalizers?.unregister(result);\n\t\t\t\tremoveMonitor?.();\n\t\t\t\tthis._removeListener(contained);\n\t\t\t});\n\t\t\tif (disposables instanceof DisposableStore) {\n\t\t\t\tdisposables.add(result);\n\t\t\t} else if (Array.isArray(disposables)) {\n\t\t\t\tdisposables.push(result);\n\t\t\t}\n\n\t\t\tif (_listenerFinalizers) {\n\t\t\t\tconst stack = new Error().stack!.split('\\n').slice(2, 3).join('\\n').trim();\n\t\t\t\tconst match = /(file:|vscode-file:\\/\\/vscode-app)?(\\/[^:]*:\\d+:\\d+)/.exec(stack);\n\t\t\t\t_listenerFinalizers.register(result, match?.[2] ?? stack, result);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t};\n\n\t\treturn this._event;\n\t}\n\n\tprivate _removeListener(listener: ListenerContainer) {\n\t\tthis._options?.onWillRemoveListener?.(this);\n\n\t\tif (!this._listeners) {\n\t\t\treturn; // expected if a listener gets disposed\n\t\t}\n\n\t\tif (this._size === 1) {\n\t\t\tthis._listeners = undefined;\n\t\t\tthis._options?.onDidRemoveLastListener?.(this);\n\t\t\tthis._size = 0;\n\t\t\treturn;\n\t\t}\n\n\t\t// size > 1 which requires that listeners be a list:\n\t\tconst listeners = this._listeners as (ListenerContainer | undefined)[];\n\n\t\tconst index = listeners.indexOf(listener);\n\t\tif (index === -1) {\n\t\t\tconsole.log('disposed?', this._disposed);\n\t\t\tconsole.log('size?', this._size);\n\t\t\tconsole.log('arr?', JSON.stringify(this._listeners));\n\t\t\tthrow new Error('Attempted to dispose unknown listener');\n\t\t}\n\n\t\tthis._size--;\n\t\tlisteners[index] = undefined;\n\n\t\tconst adjustDeliveryQueue = this._deliveryQueue!.current === this;\n\t\tif (this._size * compactionThreshold <= listeners.length) {\n\t\t\tlet n = 0;\n\t\t\tfor (let i = 0; i < listeners.length; i++) {\n\t\t\t\tif (listeners[i]) {\n\t\t\t\t\tlisteners[n++] = listeners[i];\n\t\t\t\t} else if (adjustDeliveryQueue) {\n\t\t\t\t\tthis._deliveryQueue!.end--;\n\t\t\t\t\tif (n < this._deliveryQueue!.i) {\n\t\t\t\t\t\tthis._deliveryQueue!.i--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlisteners.length = n;\n\t\t}\n\t}\n\n\tprivate _deliver(listener: undefined | UniqueContainer<(value: T) => void>, value: T) {\n\t\tif (!listener) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst errorHandler = this._options?.onListenerError || onUnexpectedError;\n\t\tif (!errorHandler) {\n\t\t\tlistener.value(value);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlistener.value(value);\n\t\t} catch (e) {\n\t\t\terrorHandler(e);\n\t\t}\n\t}\n\n\t/** Delivers items in the queue. Assumes the queue is ready to go. */\n\tprivate _deliverQueue(dq: EventDeliveryQueuePrivate) {\n\t\tconst listeners = dq.current!._listeners! as (ListenerContainer | undefined)[];\n\t\twhile (dq.i < dq.end) {\n\t\t\t// important: dq.i is incremented before calling deliver() because it might reenter deliverQueue()\n\t\t\tthis._deliver(listeners[dq.i++], dq.value as T);\n\t\t}\n\t\tdq.reset();\n\t}\n\n\t/**\n\t * To be kept private to fire an event to\n\t * subscribers\n\t */\n\tfire(event: T): void {\n\t\tif (this._deliveryQueue?.current) {\n\t\t\tthis._deliverQueue(this._deliveryQueue);\n\t\t\tthis._perfMon?.stop(); // last fire() will have starting perfmon, stop it before starting the next dispatch\n\t\t}\n\n\t\tthis._perfMon?.start(this._size);\n\n\t\tif (!this._listeners) {\n\t\t\t// no-op\n\t\t} else if (this._listeners instanceof UniqueContainer) {\n\t\t\tthis._deliver(this._listeners, event);\n\t\t} else {\n\t\t\tconst dq = this._deliveryQueue!;\n\t\t\tdq.enqueue(this, event, this._listeners.length);\n\t\t\tthis._deliverQueue(dq);\n\t\t}\n\n\t\tthis._perfMon?.stop();\n\t}\n\n\thasListeners(): boolean {\n\t\treturn this._size > 0;\n\t}\n}\n\nexport interface EventDeliveryQueue {\n\t_isEventDeliveryQueue: true;\n}\n\nexport const createEventDeliveryQueue = (): EventDeliveryQueue => new EventDeliveryQueuePrivate();\n\nclass EventDeliveryQueuePrivate implements EventDeliveryQueue {\n\tdeclare _isEventDeliveryQueue: true;\n\n\t/**\n\t * Index in current's listener list.\n\t */\n\tpublic i = -1;\n\n\t/**\n\t * The last index in the listener's list to deliver.\n\t */\n\tpublic end = 0;\n\n\t/**\n\t * Emitter currently being dispatched on. Emitter._listeners is always an array.\n\t */\n\tpublic current?: Emitter;\n\t/**\n\t * Currently emitting value. Defined whenever `current` is.\n\t */\n\tpublic value?: unknown;\n\n\tpublic enqueue(emitter: Emitter, value: T, end: number) {\n\t\tthis.i = 0;\n\t\tthis.end = end;\n\t\tthis.current = emitter;\n\t\tthis.value = value;\n\t}\n\n\tpublic reset() {\n\t\tthis.i = this.end; // force any current emission loop to stop, mainly for during dispose\n\t\tthis.current = undefined;\n\t\tthis.value = undefined;\n\t}\n}\n\nexport interface IWaitUntil {\n\ttoken: CancellationToken;\n\twaitUntil(thenable: Promise): void;\n}\n\nexport type IWaitUntilData = Omit, 'token'>;\n\nexport class AsyncEmitter extends Emitter {\n\n\tprivate _asyncDeliveryQueue?: LinkedList<[(ev: T) => void, IWaitUntilData]>;\n\n\tasync fireAsync(data: IWaitUntilData, token: CancellationToken, promiseJoin?: (p: Promise, listener: Function) => Promise): Promise {\n\t\tif (!this._listeners) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._asyncDeliveryQueue) {\n\t\t\tthis._asyncDeliveryQueue = new LinkedList();\n\t\t}\n\n\t\tforEachListener(this._listeners, listener => this._asyncDeliveryQueue!.push([listener.value, data]));\n\n\t\twhile (this._asyncDeliveryQueue.size > 0 && !token.isCancellationRequested) {\n\n\t\t\tconst [listener, data] = this._asyncDeliveryQueue.shift()!;\n\t\t\tconst thenables: Promise[] = [];\n\n\t\t\tconst event = {\n\t\t\t\t...data,\n\t\t\t\ttoken,\n\t\t\t\twaitUntil: (p: Promise): void => {\n\t\t\t\t\tif (Object.isFrozen(thenables)) {\n\t\t\t\t\t\tthrow new Error('waitUntil can NOT be called asynchronous');\n\t\t\t\t\t}\n\t\t\t\t\tif (promiseJoin) {\n\t\t\t\t\t\tp = promiseJoin(p, listener);\n\t\t\t\t\t}\n\t\t\t\t\tthenables.push(p);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tlistener(event);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedError(e);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// freeze thenables-collection to enforce sync-calls to\n\t\t\t// wait until and then wait for all thenables to resolve\n\t\t\tObject.freeze(thenables);\n\n\t\t\tawait Promise.allSettled(thenables).then(values => {\n\t\t\t\tfor (const value of values) {\n\t\t\t\t\tif (value.status === 'rejected') {\n\t\t\t\t\t\tonUnexpectedError(value.reason);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\n\nexport class PauseableEmitter extends Emitter {\n\n\tprivate _isPaused = 0;\n\tprotected _eventQueue = new LinkedList();\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tpublic get isPaused(): boolean {\n\t\treturn this._isPaused !== 0;\n\t}\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\n\tpause(): void {\n\t\tthis._isPaused++;\n\t}\n\n\tresume(): void {\n\t\tif (this._isPaused !== 0 && --this._isPaused === 0) {\n\t\t\tif (this._mergeFn) {\n\t\t\t\t// use the merge function to create a single composite\n\t\t\t\t// event. make a copy in case firing pauses this emitter\n\t\t\t\tif (this._eventQueue.size > 0) {\n\t\t\t\t\tconst events = Array.from(this._eventQueue);\n\t\t\t\t\tthis._eventQueue.clear();\n\t\t\t\t\tsuper.fire(this._mergeFn(events));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// no merging, fire each event individually and test\n\t\t\t\t// that this emitter isn't paused halfway through\n\t\t\t\twhile (!this._isPaused && this._eventQueue.size !== 0) {\n\t\t\t\t\tsuper.fire(this._eventQueue.shift()!);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (this._size) {\n\t\t\tif (this._isPaused !== 0) {\n\t\t\t\tthis._eventQueue.push(event);\n\t\t\t} else {\n\t\t\t\tsuper.fire(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class DebounceEmitter extends PauseableEmitter {\n\n\tprivate readonly _delay: number;\n\tprivate _handle: any | undefined;\n\n\tconstructor(options: EmitterOptions & { merge: (input: T[]) => T; delay?: number }) {\n\t\tsuper(options);\n\t\tthis._delay = options.delay ?? 100;\n\t}\n\n\toverride fire(event: T): void {\n\t\tif (!this._handle) {\n\t\t\tthis.pause();\n\t\t\tthis._handle = setTimeout(() => {\n\t\t\t\tthis._handle = undefined;\n\t\t\t\tthis.resume();\n\t\t\t}, this._delay);\n\t\t}\n\t\tsuper.fire(event);\n\t}\n}\n\n/**\n * An emitter which queue all events and then process them at the\n * end of the event loop.\n */\nexport class MicrotaskEmitter extends Emitter {\n\tprivate _queuedEvents: T[] = [];\n\tprivate _mergeFn?: (input: T[]) => T;\n\n\tconstructor(options?: EmitterOptions & { merge?: (input: T[]) => T }) {\n\t\tsuper(options);\n\t\tthis._mergeFn = options?.merge;\n\t}\n\toverride fire(event: T): void {\n\n\t\tif (!this.hasListeners()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._queuedEvents.push(event);\n\t\tif (this._queuedEvents.length === 1) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this._mergeFn) {\n\t\t\t\t\tsuper.fire(this._mergeFn(this._queuedEvents));\n\t\t\t\t} else {\n\t\t\t\t\tthis._queuedEvents.forEach(e => super.fire(e));\n\t\t\t\t}\n\t\t\t\tthis._queuedEvents = [];\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * An event emitter that multiplexes many events into a single event.\n *\n * @example Listen to the `onData` event of all `Thing`s, dynamically adding and removing `Thing`s\n * to the multiplexer as needed.\n *\n * ```typescript\n * const anythingDataMultiplexer = new EventMultiplexer<{ data: string }>();\n *\n * const thingListeners = DisposableMap();\n *\n * thingService.onDidAddThing(thing => {\n * thingListeners.set(thing, anythingDataMultiplexer.add(thing.onData);\n * });\n * thingService.onDidRemoveThing(thing => {\n * thingListeners.deleteAndDispose(thing);\n * });\n *\n * anythingDataMultiplexer.event(e => {\n * console.log('Something fired data ' + e.data)\n * });\n * ```\n */\nexport class EventMultiplexer implements IDisposable {\n\n\tprivate readonly emitter: Emitter;\n\tprivate hasListeners = false;\n\tprivate events: { event: Event; listener: IDisposable | null }[] = [];\n\n\tconstructor() {\n\t\tthis.emitter = new Emitter({\n\t\t\tonWillAddFirstListener: () => this.onFirstListenerAdd(),\n\t\t\tonDidRemoveLastListener: () => this.onLastListenerRemove()\n\t\t});\n\t}\n\n\tget event(): Event {\n\t\treturn this.emitter.event;\n\t}\n\n\tadd(event: Event): IDisposable {\n\t\tconst e = { event: event, listener: null };\n\t\tthis.events.push(e);\n\n\t\tif (this.hasListeners) {\n\t\t\tthis.hook(e);\n\t\t}\n\n\t\tconst dispose = () => {\n\t\t\tif (this.hasListeners) {\n\t\t\t\tthis.unhook(e);\n\t\t\t}\n\n\t\t\tconst idx = this.events.indexOf(e);\n\t\t\tthis.events.splice(idx, 1);\n\t\t};\n\n\t\treturn toDisposable(createSingleCallFunction(dispose));\n\t}\n\n\tprivate onFirstListenerAdd(): void {\n\t\tthis.hasListeners = true;\n\t\tthis.events.forEach(e => this.hook(e));\n\t}\n\n\tprivate onLastListenerRemove(): void {\n\t\tthis.hasListeners = false;\n\t\tthis.events.forEach(e => this.unhook(e));\n\t}\n\n\tprivate hook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener = e.event(r => this.emitter.fire(r));\n\t}\n\n\tprivate unhook(e: { event: Event; listener: IDisposable | null }): void {\n\t\te.listener?.dispose();\n\t\te.listener = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.emitter.dispose();\n\n\t\tfor (const e of this.events) {\n\t\t\te.listener?.dispose();\n\t\t}\n\t\tthis.events = [];\n\t}\n}\n\nexport interface IDynamicListEventMultiplexer extends IDisposable {\n\treadonly event: Event;\n}\nexport class DynamicListEventMultiplexer implements IDynamicListEventMultiplexer {\n\tprivate readonly _store = new DisposableStore();\n\n\treadonly event: Event;\n\n\tconstructor(\n\t\titems: TItem[],\n\t\tonAddItem: Event,\n\t\tonRemoveItem: Event,\n\t\tgetEvent: (item: TItem) => Event\n\t) {\n\t\tconst multiplexer = this._store.add(new EventMultiplexer());\n\t\tconst itemListeners = this._store.add(new DisposableMap());\n\n\t\tfunction addItem(instance: TItem) {\n\t\t\titemListeners.set(instance, multiplexer.add(getEvent(instance)));\n\t\t}\n\n\t\t// Existing items\n\t\tfor (const instance of items) {\n\t\t\taddItem(instance);\n\t\t}\n\n\t\t// Added items\n\t\tthis._store.add(onAddItem(instance => {\n\t\t\taddItem(instance);\n\t\t}));\n\n\t\t// Removed items\n\t\tthis._store.add(onRemoveItem(instance => {\n\t\t\titemListeners.deleteAndDispose(instance);\n\t\t}));\n\n\t\tthis.event = multiplexer.event;\n\t}\n\n\tdispose() {\n\t\tthis._store.dispose();\n\t}\n}\n\n/**\n * The EventBufferer is useful in situations in which you want\n * to delay firing your events during some code.\n * You can wrap that code and be sure that the event will not\n * be fired during that wrap.\n *\n * ```\n * const emitter: Emitter;\n * const delayer = new EventDelayer();\n * const delayedEvent = delayer.wrapEvent(emitter.event);\n *\n * delayedEvent(console.log);\n *\n * delayer.bufferEvents(() => {\n * emitter.fire(); // event will not be fired yet\n * });\n *\n * // event will only be fired at this point\n * ```\n */\nexport class EventBufferer {\n\n\tprivate data: { buffers: Function[] }[] = [];\n\n\twrapEvent(event: Event): Event;\n\twrapEvent(event: Event, reduce: (last: T | undefined, event: T) => T): Event;\n\twrapEvent(event: Event, reduce: (last: O | undefined, event: T) => O, initial: O): Event;\n\twrapEvent(event: Event, reduce?: (last: T | O | undefined, event: T) => T | O, initial?: O): Event {\n\t\treturn (listener, thisArgs?, disposables?) => {\n\t\t\treturn event(i => {\n\t\t\t\tconst data = this.data[this.data.length - 1];\n\n\t\t\t\t// Non-reduce scenario\n\t\t\t\tif (!reduce) {\n\t\t\t\t\t// Buffering case\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\tdata.buffers.push(() => listener.call(thisArgs, i));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Not buffering case\n\t\t\t\t\t\tlistener.call(thisArgs, i);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Reduce scenario\n\t\t\t\tconst reduceData = data as typeof data & {\n\t\t\t\t\t/**\n\t\t\t\t\t * The accumulated items that will be reduced.\n\t\t\t\t\t */\n\t\t\t\t\titems?: T[];\n\t\t\t\t\t/**\n\t\t\t\t\t * The reduced result cached to be shared with other listeners.\n\t\t\t\t\t */\n\t\t\t\t\treducedResult?: T | O;\n\t\t\t\t};\n\n\t\t\t\t// Not buffering case\n\t\t\t\tif (!reduceData) {\n\t\t\t\t\t// TODO: Is there a way to cache this reduce call for all listeners?\n\t\t\t\t\tlistener.call(thisArgs, reduce(initial, i));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Buffering case\n\t\t\t\treduceData.items ??= [];\n\t\t\t\treduceData.items.push(i);\n\t\t\t\tif (reduceData.buffers.length === 0) {\n\t\t\t\t\t// Include a single buffered function that will reduce all events when we're done buffering events\n\t\t\t\t\tdata.buffers.push(() => {\n\t\t\t\t\t\t// cache the reduced result so that the value can be shared across all listeners\n\t\t\t\t\t\treduceData.reducedResult ??= initial\n\t\t\t\t\t\t\t? reduceData.items!.reduce(reduce as (last: O | undefined, event: T) => O, initial)\n\t\t\t\t\t\t\t: reduceData.items!.reduce(reduce as (last: T | undefined, event: T) => T);\n\t\t\t\t\t\tlistener.call(thisArgs, reduceData.reducedResult);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, undefined, disposables);\n\t\t};\n\t}\n\n\tbufferEvents(fn: () => R): R {\n\t\tconst data = { buffers: new Array() };\n\t\tthis.data.push(data);\n\t\tconst r = fn();\n\t\tthis.data.pop();\n\t\tdata.buffers.forEach(flush => flush());\n\t\treturn r;\n\t}\n}\n\n/**\n * A Relay is an event forwarder which functions as a replugabble event pipe.\n * Once created, you can connect an input event to it and it will simply forward\n * events from that input event through its own `event` property. The `input`\n * can be changed at any point in time.\n */\nexport class Relay implements IDisposable {\n\n\tprivate listening = false;\n\tprivate inputEvent: Event = Event.None;\n\tprivate inputEventListener: IDisposable = Disposable.None;\n\n\tprivate readonly emitter = new Emitter({\n\t\tonDidAddFirstListener: () => {\n\t\t\tthis.listening = true;\n\t\t\tthis.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);\n\t\t},\n\t\tonDidRemoveLastListener: () => {\n\t\t\tthis.listening = false;\n\t\t\tthis.inputEventListener.dispose();\n\t\t}\n\t});\n\n\treadonly event: Event = this.emitter.event;\n\n\tset input(event: Event) {\n\t\tthis.inputEvent = event;\n\n\t\tif (this.listening) {\n\t\t\tthis.inputEventListener.dispose();\n\t\t\tthis.inputEventListener = event(this.emitter.fire, this.emitter);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.inputEventListener.dispose();\n\t\tthis.emitter.dispose();\n\t}\n}\n\nexport interface IValueWithChangeEvent {\n\treadonly onDidChange: Event;\n\tget value(): T;\n}\n\nexport class ValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic static const(value: T): IValueWithChangeEvent {\n\t\treturn new ConstValueWithChangeEvent(value);\n\t}\n\n\tprivate readonly _onDidChange = new Emitter();\n\treadonly onDidChange: Event = this._onDidChange.event;\n\n\tconstructor(private _value: T) { }\n\n\tget value(): T {\n\t\treturn this._value;\n\t}\n\n\tset value(value: T) {\n\t\tif (value !== this._value) {\n\t\t\tthis._value = value;\n\t\t\tthis._onDidChange.fire(undefined);\n\t\t}\n\t}\n}\n\nclass ConstValueWithChangeEvent implements IValueWithChangeEvent {\n\tpublic readonly onDidChange: Event = Event.None;\n\n\tconstructor(readonly value: T) { }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { Emitter } from 'vs/base/common/event';\n\nclass WindowManager {\n\n\tstatic readonly INSTANCE = new WindowManager();\n\n\t// --- Zoom Level\n\n\tprivate readonly mapWindowIdToZoomLevel = new Map();\n\n\tprivate readonly _onDidChangeZoomLevel = new Emitter();\n\treadonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;\n\n\tgetZoomLevel(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;\n\t}\n\tsetZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\t\tif (this.getZoomLevel(targetWindow) === zoomLevel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst targetWindowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);\n\t\tthis._onDidChangeZoomLevel.fire(targetWindowId);\n\t}\n\n\t// --- Zoom Factor\n\n\tprivate readonly mapWindowIdToZoomFactor = new Map();\n\n\tgetZoomFactor(targetWindow: Window): number {\n\t\treturn this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;\n\t}\n\tsetZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\t\tthis.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);\n\t}\n\n\t// --- Fullscreen\n\n\tprivate readonly _onDidChangeFullscreen = new Emitter();\n\treadonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;\n\n\tprivate readonly mapWindowIdToFullScreen = new Map();\n\n\tsetFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\t\tif (this.isFullscreen(targetWindow) === fullscreen) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst windowId = this.getWindowId(targetWindow);\n\t\tthis.mapWindowIdToFullScreen.set(windowId, fullscreen);\n\t\tthis._onDidChangeFullscreen.fire(windowId);\n\t}\n\tisFullscreen(targetWindow: Window): boolean {\n\t\treturn !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));\n\t}\n\n\tprivate getWindowId(targetWindow: Window): number {\n\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t}\n}\n\nexport function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {\n\tif (typeof query === 'string') {\n\t\tquery = targetWindow.matchMedia(query);\n\t}\n\tquery.addEventListener('change', callback);\n}\n\n/** A zoom index, e.g. 1, 2, 3 */\nexport function setZoomLevel(zoomLevel: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);\n}\nexport function getZoomLevel(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomLevel(targetWindow);\n}\nexport const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;\n\n/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */\nexport function getZoomFactor(targetWindow: Window): number {\n\treturn WindowManager.INSTANCE.getZoomFactor(targetWindow);\n}\nexport function setZoomFactor(zoomFactor: number, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);\n}\n\nexport function setFullscreen(fullscreen: boolean, targetWindow: Window): void {\n\tWindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);\n}\nexport function isFullscreen(targetWindow: Window): boolean {\n\treturn WindowManager.INSTANCE.isFullscreen(targetWindow);\n}\nexport const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;\n\nconst userAgent = typeof navigator === 'object' ? navigator.userAgent : '';\n\nexport const isFirefox = (userAgent.indexOf('Firefox') >= 0);\nexport const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);\nexport const isChrome = (userAgent.indexOf('Chrome') >= 0);\nexport const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));\nexport const isWebkitWebView = (!isChrome && !isSafari && isWebKit);\nexport const isElectron = (userAgent.indexOf('Electron/') >= 0);\nexport const isAndroid = (userAgent.indexOf('Android') >= 0);\n\nlet standalone = false;\nif (typeof mainWindow.matchMedia === 'function') {\n\tconst standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');\n\tconst fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');\n\tstandalone = standaloneMatchMedia.matches;\n\taddMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {\n\t\t// entering fullscreen would change standaloneMatchMedia.matches to false\n\t\t// if standalone is true (running as PWA) and entering fullscreen, skip this change\n\t\tif (standalone && fullScreenMatchMedia.matches) {\n\t\t\treturn;\n\t\t}\n\t\t// otherwise update standalone (browser to PWA or PWA to browser)\n\t\tstandalone = matches;\n\t});\n}\nexport function isStandalone(): boolean {\n\treturn standalone;\n}\n\n// Visible means that the feature is enabled, not necessarily being rendered\n// e.g. visible is true even in fullscreen mode where the controls are hidden\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible\nexport function isWCOEnabled(): boolean {\n\treturn (navigator as any)?.windowControlsOverlay?.visible;\n}\n\n// Returns the bounding rect of the titlebar area if it is supported and defined\n// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect\nexport function getWCOBoundingRect(): DOMRect | undefined {\n\treturn (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as nls from 'vs/nls';\n\nexport const LANGUAGE_DEFAULT = 'en';\n\nlet _isWindows = false;\nlet _isMacintosh = false;\nlet _isLinux = false;\nlet _isLinuxSnap = false;\nlet _isNative = false;\nlet _isWeb = false;\nlet _isElectron = false;\nlet _isIOS = false;\nlet _isCI = false;\nlet _isMobile = false;\nlet _locale: string | undefined = undefined;\nlet _language: string = LANGUAGE_DEFAULT;\nlet _platformLocale: string = LANGUAGE_DEFAULT;\nlet _translationsConfigFile: string | undefined = undefined;\nlet _userAgent: string | undefined = undefined;\n\nexport interface IProcessEnvironment {\n\t[key: string]: string | undefined;\n}\n\n/**\n * This interface is intentionally not identical to node.js\n * process because it also works in sandboxed environments\n * where the process object is implemented differently. We\n * define the properties here that we need for `platform`\n * to work and nothing else.\n */\nexport interface INodeProcess {\n\tplatform: string;\n\tarch: string;\n\tenv: IProcessEnvironment;\n\tversions?: {\n\t\tnode?: string;\n\t\telectron?: string;\n\t\tchrome?: string;\n\t};\n\ttype?: string;\n\tcwd: () => string;\n}\n\ndeclare const process: INodeProcess;\n\nconst $globalThis: any = globalThis;\n\nlet nodeProcess: INodeProcess | undefined = undefined;\nif (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {\n\t// Native environment (sandboxed)\n\tnodeProcess = $globalThis.vscode.process;\n} else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {\n\t// Native environment (non-sandboxed)\n\tnodeProcess = process;\n}\n\nconst isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';\nconst isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';\n\ninterface INavigator {\n\tuserAgent: string;\n\tmaxTouchPoints?: number;\n\tlanguage: string;\n}\ndeclare const navigator: INavigator;\n\n// Native environment\nif (typeof nodeProcess === 'object') {\n\t_isWindows = (nodeProcess.platform === 'win32');\n\t_isMacintosh = (nodeProcess.platform === 'darwin');\n\t_isLinux = (nodeProcess.platform === 'linux');\n\t_isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];\n\t_isElectron = isElectronProcess;\n\t_isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];\n\t_locale = LANGUAGE_DEFAULT;\n\t_language = LANGUAGE_DEFAULT;\n\tconst rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];\n\tif (rawNlsConfig) {\n\t\ttry {\n\t\t\tconst nlsConfig: nls.INLSConfiguration = JSON.parse(rawNlsConfig);\n\t\t\t_locale = nlsConfig.userLocale;\n\t\t\t_platformLocale = nlsConfig.osLocale;\n\t\t\t_language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;\n\t\t\t_translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;\n\t\t} catch (e) {\n\t\t}\n\t}\n\t_isNative = true;\n}\n\n// Web environment\nelse if (typeof navigator === 'object' && !isElectronRenderer) {\n\t_userAgent = navigator.userAgent;\n\t_isWindows = _userAgent.indexOf('Windows') >= 0;\n\t_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;\n\t_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;\n\t_isLinux = _userAgent.indexOf('Linux') >= 0;\n\t_isMobile = _userAgent?.indexOf('Mobi') >= 0;\n\t_isWeb = true;\n\t// VSCODE_GLOBALS: NLS\n\t_language = globalThis._VSCODE_NLS_LANGUAGE || LANGUAGE_DEFAULT;\n\t_locale = navigator.language.toLowerCase();\n\t_platformLocale = _locale;\n}\n\n// Unknown environment\nelse {\n\tconsole.error('Unable to resolve platform.');\n}\n\nexport const enum Platform {\n\tWeb,\n\tMac,\n\tLinux,\n\tWindows\n}\nexport type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';\n\nexport function PlatformToString(platform: Platform): PlatformName {\n\tswitch (platform) {\n\t\tcase Platform.Web: return 'Web';\n\t\tcase Platform.Mac: return 'Mac';\n\t\tcase Platform.Linux: return 'Linux';\n\t\tcase Platform.Windows: return 'Windows';\n\t}\n}\n\nlet _platform: Platform = Platform.Web;\nif (_isMacintosh) {\n\t_platform = Platform.Mac;\n} else if (_isWindows) {\n\t_platform = Platform.Windows;\n} else if (_isLinux) {\n\t_platform = Platform.Linux;\n}\n\nexport const isWindows = _isWindows;\nexport const isMacintosh = _isMacintosh;\nexport const isLinux = _isLinux;\nexport const isLinuxSnap = _isLinuxSnap;\nexport const isNative = _isNative;\nexport const isElectron = _isElectron;\nexport const isWeb = _isWeb;\nexport const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');\nexport const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;\nexport const isIOS = _isIOS;\nexport const isMobile = _isMobile;\n/**\n * Whether we run inside a CI environment, such as\n * GH actions or Azure Pipelines.\n */\nexport const isCI = _isCI;\nexport const platform = _platform;\nexport const userAgent = _userAgent;\n\n/**\n * The language used for the user interface. The format of\n * the string is all lower case (e.g. zh-tw for Traditional\n * Chinese or de for German)\n */\nexport const language = _language;\n\nexport namespace Language {\n\n\texport function value(): string {\n\t\treturn language;\n\t}\n\n\texport function isDefaultVariant(): boolean {\n\t\tif (language.length === 2) {\n\t\t\treturn language === 'en';\n\t\t} else if (language.length >= 3) {\n\t\t\treturn language[0] === 'e' && language[1] === 'n' && language[2] === '-';\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\texport function isDefault(): boolean {\n\t\treturn language === 'en';\n\t}\n}\n\n/**\n * Desktop: The OS locale or the locale specified by --locale or `argv.json`.\n * Web: matches `platformLocale`.\n *\n * The UI is not necessarily shown in the provided locale.\n */\nexport const locale = _locale;\n\n/**\n * This will always be set to the OS/browser's locale regardless of\n * what was specified otherwise. The format of the string is all\n * lower case (e.g. zh-tw for Traditional Chinese). The UI is not\n * necessarily shown in the provided locale.\n */\nexport const platformLocale = _platformLocale;\n\n/**\n * The translations that are available through language packs.\n */\nexport const translationsConfigFile = _translationsConfigFile;\n\nexport const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);\n\n/**\n * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.\n *\n * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay\n * that browsers set when the nesting level is > 5.\n */\nexport const setTimeout0 = (() => {\n\tif (setTimeout0IsFaster) {\n\t\tinterface IQueueElement {\n\t\t\tid: number;\n\t\t\tcallback: () => void;\n\t\t}\n\t\tconst pending: IQueueElement[] = [];\n\n\t\t$globalThis.addEventListener('message', (e: any) => {\n\t\t\tif (e.data && e.data.vscodeScheduleAsyncWork) {\n\t\t\t\tfor (let i = 0, len = pending.length; i < len; i++) {\n\t\t\t\t\tconst candidate = pending[i];\n\t\t\t\t\tif (candidate.id === e.data.vscodeScheduleAsyncWork) {\n\t\t\t\t\t\tpending.splice(i, 1);\n\t\t\t\t\t\tcandidate.callback();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tlet lastId = 0;\n\t\treturn (callback: () => void) => {\n\t\t\tconst myId = ++lastId;\n\t\t\tpending.push({\n\t\t\t\tid: myId,\n\t\t\t\tcallback: callback\n\t\t\t});\n\t\t\t$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');\n\t\t};\n\t}\n\treturn (callback: () => void) => setTimeout(callback);\n})();\n\nexport const enum OperatingSystem {\n\tWindows = 1,\n\tMacintosh = 2,\n\tLinux = 3\n}\nexport const OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));\n\nlet _isLittleEndian = true;\nlet _isLittleEndianComputed = false;\nexport function isLittleEndian(): boolean {\n\tif (!_isLittleEndianComputed) {\n\t\t_isLittleEndianComputed = true;\n\t\tconst test = new Uint8Array(2);\n\t\ttest[0] = 1;\n\t\ttest[1] = 2;\n\t\tconst view = new Uint16Array(test.buffer);\n\t\t_isLittleEndian = (view[0] === (2 << 8) + 1);\n\t}\n\treturn _isLittleEndian;\n}\n\nexport const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);\nexport const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);\nexport const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));\nexport const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);\nexport const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);\n\nexport function isBigSurOrNewer(osVersion: string): boolean {\n\treturn parseFloat(osVersion) >= 20;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as platform from 'vs/base/common/platform';\n\nexport const enum KeyboardSupport {\n\tAlways,\n\tFullScreen,\n\tNone\n}\n\nconst safeNavigator = typeof navigator === 'object' ? navigator : {} as { [key: string]: any };\n\n/**\n * Browser feature we can support in current platform, browser and environment.\n */\nexport const BrowserFeatures = {\n\tclipboard: {\n\t\twriteText: (\n\t\t\tplatform.isNative\n\t\t\t|| (document.queryCommandSupported && document.queryCommandSupported('copy'))\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)\n\t\t),\n\t\treadText: (\n\t\t\tplatform.isNative\n\t\t\t|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText)\n\t\t)\n\t},\n\tkeyboard: (() => {\n\t\tif (platform.isNative || browser.isStandalone()) {\n\t\t\treturn KeyboardSupport.Always;\n\t\t}\n\n\t\tif ((safeNavigator).keyboard || browser.isSafari) {\n\t\t\treturn KeyboardSupport.FullScreen;\n\t\t}\n\n\t\treturn KeyboardSupport.None;\n\t})(),\n\n\t// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be\n\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\ttouch: 'ontouchstart' in mainWindow || safeNavigator.maxTouchPoints > 0,\n\tpointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)\n};\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Virtual Key Codes, the value does not hold any inherent meaning.\n * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx\n * But these are \"more general\", as they should work across browsers & OS`s.\n */\nexport const enum KeyCode {\n\tDependsOnKbLayout = -1,\n\n\t/**\n\t * Placed first to cover the 0 value of the enum.\n\t */\n\tUnknown = 0,\n\n\tBackspace,\n\tTab,\n\tEnter,\n\tShift,\n\tCtrl,\n\tAlt,\n\tPauseBreak,\n\tCapsLock,\n\tEscape,\n\tSpace,\n\tPageUp,\n\tPageDown,\n\tEnd,\n\tHome,\n\tLeftArrow,\n\tUpArrow,\n\tRightArrow,\n\tDownArrow,\n\tInsert,\n\tDelete,\n\n\tDigit0,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\n\tMeta,\n\tContextMenu,\n\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\n\tNumLock,\n\tScrollLock,\n\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ';:' key\n\t */\n\tSemicolon,\n\t/**\n\t * For any country/region, the '+' key\n\t * For the US standard keyboard, the '=+' key\n\t */\n\tEqual,\n\t/**\n\t * For any country/region, the ',' key\n\t * For the US standard keyboard, the ',<' key\n\t */\n\tComma,\n\t/**\n\t * For any country/region, the '-' key\n\t * For the US standard keyboard, the '-_' key\n\t */\n\tMinus,\n\t/**\n\t * For any country/region, the '.' key\n\t * For the US standard keyboard, the '.>' key\n\t */\n\tPeriod,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '/?' key\n\t */\n\tSlash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '`~' key\n\t */\n\tBackquote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '[{' key\n\t */\n\tBracketLeft,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the '\\|' key\n\t */\n\tBackslash,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ']}' key\n\t */\n\tBracketRight,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t * For the US standard keyboard, the ''\"' key\n\t */\n\tQuote,\n\t/**\n\t * Used for miscellaneous characters; it can vary by keyboard.\n\t */\n\tOEM_8,\n\t/**\n\t * Either the angle bracket key or the backslash key on the RT 102-key keyboard.\n\t */\n\tIntlBackslash,\n\n\tNumpad0, // VK_NUMPAD0, 0x60, Numeric keypad 0 key\n\tNumpad1, // VK_NUMPAD1, 0x61, Numeric keypad 1 key\n\tNumpad2, // VK_NUMPAD2, 0x62, Numeric keypad 2 key\n\tNumpad3, // VK_NUMPAD3, 0x63, Numeric keypad 3 key\n\tNumpad4, // VK_NUMPAD4, 0x64, Numeric keypad 4 key\n\tNumpad5, // VK_NUMPAD5, 0x65, Numeric keypad 5 key\n\tNumpad6, // VK_NUMPAD6, 0x66, Numeric keypad 6 key\n\tNumpad7, // VK_NUMPAD7, 0x67, Numeric keypad 7 key\n\tNumpad8, // VK_NUMPAD8, 0x68, Numeric keypad 8 key\n\tNumpad9, // VK_NUMPAD9, 0x69, Numeric keypad 9 key\n\n\tNumpadMultiply,\t// VK_MULTIPLY, 0x6A, Multiply key\n\tNumpadAdd,\t\t// VK_ADD, 0x6B, Add key\n\tNUMPAD_SEPARATOR,\t// VK_SEPARATOR, 0x6C, Separator key\n\tNumpadSubtract,\t// VK_SUBTRACT, 0x6D, Subtract key\n\tNumpadDecimal,\t// VK_DECIMAL, 0x6E, Decimal key\n\tNumpadDivide,\t// VK_DIVIDE, 0x6F,\n\n\t/**\n\t * Cover all key codes when IME is processing input.\n\t */\n\tKEY_IN_COMPOSITION,\n\n\tABNT_C1, // Brazilian (ABNT) Keyboard\n\tABNT_C2, // Brazilian (ABNT) Keyboard\n\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tMediaPlayPause,\n\tLaunchMediaPlayer,\n\tLaunchMail,\n\tLaunchApp2,\n\n\t/**\n\t * VK_CLEAR, 0x0C, CLEAR key\n\t */\n\tClear,\n\n\t/**\n\t * Placed last to cover the length of the enum.\n\t * Please do not depend on this value!\n\t */\n\tMAX_VALUE\n}\n\n/**\n * keyboardEvent.code\n */\nexport const enum ScanCode {\n\tDependsOnKbLayout = -1,\n\tNone,\n\tHyper,\n\tSuper,\n\tFn,\n\tFnLock,\n\tSuspend,\n\tResume,\n\tTurbo,\n\tSleep,\n\tWakeUp,\n\tKeyA,\n\tKeyB,\n\tKeyC,\n\tKeyD,\n\tKeyE,\n\tKeyF,\n\tKeyG,\n\tKeyH,\n\tKeyI,\n\tKeyJ,\n\tKeyK,\n\tKeyL,\n\tKeyM,\n\tKeyN,\n\tKeyO,\n\tKeyP,\n\tKeyQ,\n\tKeyR,\n\tKeyS,\n\tKeyT,\n\tKeyU,\n\tKeyV,\n\tKeyW,\n\tKeyX,\n\tKeyY,\n\tKeyZ,\n\tDigit1,\n\tDigit2,\n\tDigit3,\n\tDigit4,\n\tDigit5,\n\tDigit6,\n\tDigit7,\n\tDigit8,\n\tDigit9,\n\tDigit0,\n\tEnter,\n\tEscape,\n\tBackspace,\n\tTab,\n\tSpace,\n\tMinus,\n\tEqual,\n\tBracketLeft,\n\tBracketRight,\n\tBackslash,\n\tIntlHash,\n\tSemicolon,\n\tQuote,\n\tBackquote,\n\tComma,\n\tPeriod,\n\tSlash,\n\tCapsLock,\n\tF1,\n\tF2,\n\tF3,\n\tF4,\n\tF5,\n\tF6,\n\tF7,\n\tF8,\n\tF9,\n\tF10,\n\tF11,\n\tF12,\n\tPrintScreen,\n\tScrollLock,\n\tPause,\n\tInsert,\n\tHome,\n\tPageUp,\n\tDelete,\n\tEnd,\n\tPageDown,\n\tArrowRight,\n\tArrowLeft,\n\tArrowDown,\n\tArrowUp,\n\tNumLock,\n\tNumpadDivide,\n\tNumpadMultiply,\n\tNumpadSubtract,\n\tNumpadAdd,\n\tNumpadEnter,\n\tNumpad1,\n\tNumpad2,\n\tNumpad3,\n\tNumpad4,\n\tNumpad5,\n\tNumpad6,\n\tNumpad7,\n\tNumpad8,\n\tNumpad9,\n\tNumpad0,\n\tNumpadDecimal,\n\tIntlBackslash,\n\tContextMenu,\n\tPower,\n\tNumpadEqual,\n\tF13,\n\tF14,\n\tF15,\n\tF16,\n\tF17,\n\tF18,\n\tF19,\n\tF20,\n\tF21,\n\tF22,\n\tF23,\n\tF24,\n\tOpen,\n\tHelp,\n\tSelect,\n\tAgain,\n\tUndo,\n\tCut,\n\tCopy,\n\tPaste,\n\tFind,\n\tAudioVolumeMute,\n\tAudioVolumeUp,\n\tAudioVolumeDown,\n\tNumpadComma,\n\tIntlRo,\n\tKanaMode,\n\tIntlYen,\n\tConvert,\n\tNonConvert,\n\tLang1,\n\tLang2,\n\tLang3,\n\tLang4,\n\tLang5,\n\tAbort,\n\tProps,\n\tNumpadParenLeft,\n\tNumpadParenRight,\n\tNumpadBackspace,\n\tNumpadMemoryStore,\n\tNumpadMemoryRecall,\n\tNumpadMemoryClear,\n\tNumpadMemoryAdd,\n\tNumpadMemorySubtract,\n\tNumpadClear,\n\tNumpadClearEntry,\n\tControlLeft,\n\tShiftLeft,\n\tAltLeft,\n\tMetaLeft,\n\tControlRight,\n\tShiftRight,\n\tAltRight,\n\tMetaRight,\n\tBrightnessUp,\n\tBrightnessDown,\n\tMediaPlay,\n\tMediaRecord,\n\tMediaFastForward,\n\tMediaRewind,\n\tMediaTrackNext,\n\tMediaTrackPrevious,\n\tMediaStop,\n\tEject,\n\tMediaPlayPause,\n\tMediaSelect,\n\tLaunchMail,\n\tLaunchApp2,\n\tLaunchApp1,\n\tSelectTask,\n\tLaunchScreenSaver,\n\tBrowserSearch,\n\tBrowserHome,\n\tBrowserBack,\n\tBrowserForward,\n\tBrowserStop,\n\tBrowserRefresh,\n\tBrowserFavorites,\n\tZoomToggle,\n\tMailReply,\n\tMailForward,\n\tMailSend,\n\n\tMAX_VALUE\n}\n\nclass KeyCodeStrMap {\n\n\tpublic _keyCodeToStr: string[];\n\tpublic _strToKeyCode: { [str: string]: KeyCode };\n\n\tconstructor() {\n\t\tthis._keyCodeToStr = [];\n\t\tthis._strToKeyCode = Object.create(null);\n\t}\n\n\tdefine(keyCode: KeyCode, str: string): void {\n\t\tthis._keyCodeToStr[keyCode] = str;\n\t\tthis._strToKeyCode[str.toLowerCase()] = keyCode;\n\t}\n\n\tkeyCodeToStr(keyCode: KeyCode): string {\n\t\treturn this._keyCodeToStr[keyCode];\n\t}\n\n\tstrToKeyCode(str: string): KeyCode {\n\t\treturn this._strToKeyCode[str.toLowerCase()] || KeyCode.Unknown;\n\t}\n}\n\nconst uiMap = new KeyCodeStrMap();\nconst userSettingsUSMap = new KeyCodeStrMap();\nconst userSettingsGeneralMap = new KeyCodeStrMap();\nexport const EVENT_KEY_CODE_MAP: { [keyCode: number]: KeyCode } = new Array(230);\nexport const NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE: { [nativeKeyCode: string]: KeyCode } = {};\nconst scanCodeIntToStr: string[] = [];\nconst scanCodeStrToInt: { [code: string]: number } = Object.create(null);\nconst scanCodeLowerCaseStrToInt: { [code: string]: number } = Object.create(null);\n\nexport const ScanCodeUtils = {\n\tlowerCaseToEnum: (scanCode: string) => scanCodeLowerCaseStrToInt[scanCode] || ScanCode.None,\n\ttoEnum: (scanCode: string) => scanCodeStrToInt[scanCode] || ScanCode.None,\n\ttoString: (scanCode: ScanCode) => scanCodeIntToStr[scanCode] || 'None'\n};\n\n\nexport namespace KeyCodeUtils {\n\texport function toString(keyCode: KeyCode): string {\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromString(key: string): KeyCode {\n\t\treturn uiMap.strToKeyCode(key);\n\t}\n\n\texport function toUserSettingsUS(keyCode: KeyCode): string {\n\t\treturn userSettingsUSMap.keyCodeToStr(keyCode);\n\t}\n\texport function toUserSettingsGeneral(keyCode: KeyCode): string {\n\t\treturn userSettingsGeneralMap.keyCodeToStr(keyCode);\n\t}\n\texport function fromUserSettings(key: string): KeyCode {\n\t\treturn userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);\n\t}\n\n\texport function toElectronAccelerator(keyCode: KeyCode): string | null {\n\t\tif (keyCode >= KeyCode.Numpad0 && keyCode <= KeyCode.NumpadDivide) {\n\t\t\t// [Electron Accelerators] Electron is able to parse numpad keys, but unfortunately it\n\t\t\t// renders them just as regular keys in menus. For example, num0 is rendered as \"0\",\n\t\t\t// numdiv is rendered as \"/\", numsub is rendered as \"-\".\n\t\t\t//\n\t\t\t// This can lead to incredible confusion, as it makes numpad based keybindings indistinguishable\n\t\t\t// from keybindings based on regular keys.\n\t\t\t//\n\t\t\t// We therefore need to fall back to custom rendering for numpad keys.\n\t\t\treturn null;\n\t\t}\n\n\t\tswitch (keyCode) {\n\t\t\tcase KeyCode.UpArrow:\n\t\t\t\treturn 'Up';\n\t\t\tcase KeyCode.DownArrow:\n\t\t\t\treturn 'Down';\n\t\t\tcase KeyCode.LeftArrow:\n\t\t\t\treturn 'Left';\n\t\t\tcase KeyCode.RightArrow:\n\t\t\t\treturn 'Right';\n\t\t}\n\n\t\treturn uiMap.keyCodeToStr(keyCode);\n\t}\n}\n\nexport const enum KeyMod {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n}\n\nexport function KeyChord(firstPart: number, secondPart: number): number {\n\tconst chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;\n\treturn (firstPart | chordPart) >>> 0;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { illegalArgument } from 'vs/base/common/errors';\nimport { KeyCode, ScanCode } from 'vs/base/common/keyCodes';\nimport { OperatingSystem } from 'vs/base/common/platform';\n\n/**\n * Binary encoding strategy:\n * ```\n * 1111 11\n * 5432 1098 7654 3210\n * ---- CSAW KKKK KKKK\n * C = bit 11 = ctrlCmd flag\n * S = bit 10 = shift flag\n * A = bit 9 = alt flag\n * W = bit 8 = winCtrl flag\n * K = bits 0-7 = key code\n * ```\n */\nconst enum BinaryKeybindingsMask {\n\tCtrlCmd = (1 << 11) >>> 0,\n\tShift = (1 << 10) >>> 0,\n\tAlt = (1 << 9) >>> 0,\n\tWinCtrl = (1 << 8) >>> 0,\n\tKeyCode = 0x000000FF\n}\n\nexport function decodeKeybinding(keybinding: number | number[], OS: OperatingSystem): Keybinding | null {\n\tif (typeof keybinding === 'number') {\n\t\tif (keybinding === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tconst firstChord = (keybinding & 0x0000FFFF) >>> 0;\n\t\tconst secondChord = (keybinding & 0xFFFF0000) >>> 16;\n\t\tif (secondChord !== 0) {\n\t\t\treturn new Keybinding([\n\t\t\t\tcreateSimpleKeybinding(firstChord, OS),\n\t\t\t\tcreateSimpleKeybinding(secondChord, OS)\n\t\t\t]);\n\t\t}\n\t\treturn new Keybinding([createSimpleKeybinding(firstChord, OS)]);\n\t} else {\n\t\tconst chords = [];\n\t\tfor (let i = 0; i < keybinding.length; i++) {\n\t\t\tchords.push(createSimpleKeybinding(keybinding[i], OS));\n\t\t}\n\t\treturn new Keybinding(chords);\n\t}\n}\n\nexport function createSimpleKeybinding(keybinding: number, OS: OperatingSystem): KeyCodeChord {\n\n\tconst ctrlCmd = (keybinding & BinaryKeybindingsMask.CtrlCmd ? true : false);\n\tconst winCtrl = (keybinding & BinaryKeybindingsMask.WinCtrl ? true : false);\n\n\tconst ctrlKey = (OS === OperatingSystem.Macintosh ? winCtrl : ctrlCmd);\n\tconst shiftKey = (keybinding & BinaryKeybindingsMask.Shift ? true : false);\n\tconst altKey = (keybinding & BinaryKeybindingsMask.Alt ? true : false);\n\tconst metaKey = (OS === OperatingSystem.Macintosh ? ctrlCmd : winCtrl);\n\tconst keyCode = (keybinding & BinaryKeybindingsMask.KeyCode);\n\n\treturn new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);\n}\n\nexport interface Modifiers {\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n}\n\n/**\n * Represents a chord which uses the `keyCode` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class KeyCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyCode: KeyCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof KeyCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.keyCode === other.keyCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;\n\t}\n\n\tpublic isModifierKey(): boolean {\n\t\treturn (\n\t\t\tthis.keyCode === KeyCode.Unknown\n\t\t\t|| this.keyCode === KeyCode.Ctrl\n\t\t\t|| this.keyCode === KeyCode.Meta\n\t\t\t|| this.keyCode === KeyCode.Alt\n\t\t\t|| this.keyCode === KeyCode.Shift\n\t\t);\n\t}\n\n\tpublic toKeybinding(): Keybinding {\n\t\treturn new Keybinding([this]);\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && this.keyCode === KeyCode.Ctrl)\n\t\t\t|| (this.shiftKey && this.keyCode === KeyCode.Shift)\n\t\t\t|| (this.altKey && this.keyCode === KeyCode.Alt)\n\t\t\t|| (this.metaKey && this.keyCode === KeyCode.Meta)\n\t\t);\n\t}\n}\n\n/**\n * Represents a chord which uses the `code` field of keyboard events.\n * A chord is a combination of keys pressed simultaneously.\n */\nexport class ScanCodeChord implements Modifiers {\n\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly scanCode: ScanCode\n\t) { }\n\n\tpublic equals(other: Chord): boolean {\n\t\treturn (\n\t\t\tother instanceof ScanCodeChord\n\t\t\t&& this.ctrlKey === other.ctrlKey\n\t\t\t&& this.shiftKey === other.shiftKey\n\t\t\t&& this.altKey === other.altKey\n\t\t\t&& this.metaKey === other.metaKey\n\t\t\t&& this.scanCode === other.scanCode\n\t\t);\n\t}\n\n\tpublic getHashCode(): string {\n\t\tconst ctrl = this.ctrlKey ? '1' : '0';\n\t\tconst shift = this.shiftKey ? '1' : '0';\n\t\tconst alt = this.altKey ? '1' : '0';\n\t\tconst meta = this.metaKey ? '1' : '0';\n\t\treturn `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;\n\t}\n\n\t/**\n\t * Does this keybinding refer to the key code of a modifier and it also has the modifier flag?\n\t */\n\tpublic isDuplicateModifierCase(): boolean {\n\t\treturn (\n\t\t\t(this.ctrlKey && (this.scanCode === ScanCode.ControlLeft || this.scanCode === ScanCode.ControlRight))\n\t\t\t|| (this.shiftKey && (this.scanCode === ScanCode.ShiftLeft || this.scanCode === ScanCode.ShiftRight))\n\t\t\t|| (this.altKey && (this.scanCode === ScanCode.AltLeft || this.scanCode === ScanCode.AltRight))\n\t\t\t|| (this.metaKey && (this.scanCode === ScanCode.MetaLeft || this.scanCode === ScanCode.MetaRight))\n\t\t);\n\t}\n}\n\nexport type Chord = KeyCodeChord | ScanCodeChord;\n\n/**\n * A keybinding is a sequence of chords.\n */\nexport class Keybinding {\n\n\tpublic readonly chords: Chord[];\n\n\tconstructor(chords: Chord[]) {\n\t\tif (chords.length === 0) {\n\t\t\tthrow illegalArgument(`chords`);\n\t\t}\n\t\tthis.chords = chords;\n\t}\n\n\tpublic getHashCode(): string {\n\t\tlet result = '';\n\t\tfor (let i = 0, len = this.chords.length; i < len; i++) {\n\t\t\tif (i !== 0) {\n\t\t\t\tresult += ';';\n\t\t\t}\n\t\t\tresult += this.chords[i].getHashCode();\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic equals(other: Keybinding | null): boolean {\n\t\tif (other === null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.chords.length !== other.chords.length) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (let i = 0; i < this.chords.length; i++) {\n\t\t\tif (!this.chords[i].equals(other.chords[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\nexport class ResolvedChord {\n\tconstructor(\n\t\tpublic readonly ctrlKey: boolean,\n\t\tpublic readonly shiftKey: boolean,\n\t\tpublic readonly altKey: boolean,\n\t\tpublic readonly metaKey: boolean,\n\t\tpublic readonly keyLabel: string | null,\n\t\tpublic readonly keyAriaLabel: string | null\n\t) { }\n}\n\nexport type SingleModifierChord = 'ctrl' | 'shift' | 'alt' | 'meta';\n\n/**\n * A resolved keybinding. Consists of one or multiple chords.\n */\nexport abstract class ResolvedKeybinding {\n\t/**\n\t * This prints the binding in a format suitable for displaying in the UI.\n\t */\n\tpublic abstract getLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for ARIA.\n\t */\n\tpublic abstract getAriaLabel(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for electron's accelerators.\n\t * See https://github.com/electron/electron/blob/master/docs/api/accelerator.md\n\t */\n\tpublic abstract getElectronAccelerator(): string | null;\n\t/**\n\t * This prints the binding in a format suitable for user settings.\n\t */\n\tpublic abstract getUserSettingsLabel(): string | null;\n\t/**\n\t * Is the user settings label reflecting the label?\n\t */\n\tpublic abstract isWYSIWYG(): boolean;\n\t/**\n\t * Does the keybinding consist of more than one chord?\n\t */\n\tpublic abstract hasMultipleChords(): boolean;\n\t/**\n\t * Returns the chords that comprise of the keybinding.\n\t */\n\tpublic abstract getChords(): ResolvedChord[];\n\t/**\n\t * Returns the chords as strings useful for dispatching.\n\t * Returns null for modifier only chords.\n\t * @example keybinding \"Shift\" -> null\n\t * @example keybinding (\"D\" with shift == true) -> \"shift+D\"\n\t */\n\tpublic abstract getDispatchChords(): (string | null)[];\n\t/**\n\t * Returns the modifier only chords as strings useful for dispatching.\n\t * Returns null for chords that contain more than one modifier or a regular key.\n\t * @example keybinding \"Shift\" -> \"shift\"\n\t * @example keybinding (\"D\" with shift == true\") -> null\n\t */\n\tpublic abstract getSingleModifierDispatchChords(): (SingleModifierChord | null)[];\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { EVENT_KEY_CODE_MAP, KeyCode, KeyCodeUtils, KeyMod } from 'vs/base/common/keyCodes';\nimport { KeyCodeChord } from 'vs/base/common/keybindings';\nimport * as platform from 'vs/base/common/platform';\n\n\n\nfunction extractKeyCode(e: KeyboardEvent): KeyCode {\n\tif (e.charCode) {\n\t\t// \"keypress\" events mostly\n\t\tconst char = String.fromCharCode(e.charCode).toUpperCase();\n\t\treturn KeyCodeUtils.fromString(char);\n\t}\n\n\tconst keyCode = e.keyCode;\n\n\t// browser quirks\n\tif (keyCode === 3) {\n\t\treturn KeyCode.PauseBreak;\n\t} else if (browser.isFirefox) {\n\t\tswitch (keyCode) {\n\t\t\tcase 59: return KeyCode.Semicolon;\n\t\t\tcase 60:\n\t\t\t\tif (platform.isLinux) { return KeyCode.IntlBackslash; }\n\t\t\t\tbreak;\n\t\t\tcase 61: return KeyCode.Equal;\n\t\t\t// based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys\n\t\t\tcase 107: return KeyCode.NumpadAdd;\n\t\t\tcase 109: return KeyCode.NumpadSubtract;\n\t\t\tcase 173: return KeyCode.Minus;\n\t\t\tcase 224:\n\t\t\t\tif (platform.isMacintosh) { return KeyCode.Meta; }\n\t\t\t\tbreak;\n\t\t}\n\t} else if (browser.isWebKit) {\n\t\tif (platform.isMacintosh && keyCode === 93) {\n\t\t\t// the two meta keys in the Mac have different key codes (91 and 93)\n\t\t\treturn KeyCode.Meta;\n\t\t} else if (!platform.isMacintosh && keyCode === 92) {\n\t\t\treturn KeyCode.Meta;\n\t\t}\n\t}\n\n\t// cross browser keycodes:\n\treturn EVENT_KEY_CODE_MAP[keyCode] || KeyCode.Unknown;\n}\n\nexport interface IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand: true;\n\n\treadonly browserEvent: KeyboardEvent;\n\treadonly target: HTMLElement;\n\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly altGraphKey: boolean;\n\treadonly keyCode: KeyCode;\n\treadonly code: string;\n\n\t/**\n\t * @internal\n\t */\n\ttoKeyCodeChord(): KeyCodeChord;\n\tequals(keybinding: number): boolean;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nconst ctrlKeyMod = (platform.isMacintosh ? KeyMod.WinCtrl : KeyMod.CtrlCmd);\nconst altKeyMod = KeyMod.Alt;\nconst shiftKeyMod = KeyMod.Shift;\nconst metaKeyMod = (platform.isMacintosh ? KeyMod.CtrlCmd : KeyMod.WinCtrl);\n\nexport function printKeyboardEvent(e: KeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;\n}\n\nexport function printStandardKeyboardEvent(e: StandardKeyboardEvent): string {\n\tconst modifiers: string[] = [];\n\tif (e.ctrlKey) {\n\t\tmodifiers.push(`ctrl`);\n\t}\n\tif (e.shiftKey) {\n\t\tmodifiers.push(`shift`);\n\t}\n\tif (e.altKey) {\n\t\tmodifiers.push(`alt`);\n\t}\n\tif (e.metaKey) {\n\t\tmodifiers.push(`meta`);\n\t}\n\treturn `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${KeyCodeUtils.toString(e.keyCode)}')`;\n}\n\nexport class StandardKeyboardEvent implements IKeyboardEvent {\n\n\treadonly _standardKeyboardEventBrand = true;\n\n\tpublic readonly browserEvent: KeyboardEvent;\n\tpublic readonly target: HTMLElement;\n\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly altGraphKey: boolean;\n\tpublic readonly keyCode: KeyCode;\n\tpublic readonly code: string;\n\n\tprivate _asKeybinding: number;\n\tprivate _asKeyCodeChord: KeyCodeChord;\n\n\tconstructor(source: KeyboardEvent) {\n\t\tconst e = source;\n\n\t\tthis.browserEvent = e;\n\t\tthis.target = e.target;\n\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\t\tthis.altGraphKey = e.getModifierState?.('AltGraph');\n\t\tthis.keyCode = extractKeyCode(e);\n\t\tthis.code = e.code;\n\n\t\t// console.info(e.type + \": keyCode: \" + e.keyCode + \", which: \" + e.which + \", charCode: \" + e.charCode + \", detail: \" + e.detail + \" ====> \" + this.keyCode + ' -- ' + KeyCode[this.keyCode]);\n\n\t\tthis.ctrlKey = this.ctrlKey || this.keyCode === KeyCode.Ctrl;\n\t\tthis.altKey = this.altKey || this.keyCode === KeyCode.Alt;\n\t\tthis.shiftKey = this.shiftKey || this.keyCode === KeyCode.Shift;\n\t\tthis.metaKey = this.metaKey || this.keyCode === KeyCode.Meta;\n\n\t\tthis._asKeybinding = this._computeKeybinding();\n\t\tthis._asKeyCodeChord = this._computeKeyCodeChord();\n\n\t\t// console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);\n\t}\n\n\tpublic preventDefault(): void {\n\t\tif (this.browserEvent && this.browserEvent.preventDefault) {\n\t\t\tthis.browserEvent.preventDefault();\n\t\t}\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tif (this.browserEvent && this.browserEvent.stopPropagation) {\n\t\t\tthis.browserEvent.stopPropagation();\n\t\t}\n\t}\n\n\tpublic toKeyCodeChord(): KeyCodeChord {\n\t\treturn this._asKeyCodeChord;\n\t}\n\n\tpublic equals(other: number): boolean {\n\t\treturn this._asKeybinding === other;\n\t}\n\n\tprivate _computeKeybinding(): number {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\n\t\tlet result = 0;\n\t\tif (this.ctrlKey) {\n\t\t\tresult |= ctrlKeyMod;\n\t\t}\n\t\tif (this.altKey) {\n\t\t\tresult |= altKeyMod;\n\t\t}\n\t\tif (this.shiftKey) {\n\t\t\tresult |= shiftKeyMod;\n\t\t}\n\t\tif (this.metaKey) {\n\t\t\tresult |= metaKeyMod;\n\t\t}\n\t\tresult |= key;\n\n\t\treturn result;\n\t}\n\n\tprivate _computeKeyCodeChord(): KeyCodeChord {\n\t\tlet key = KeyCode.Unknown;\n\t\tif (this.keyCode !== KeyCode.Ctrl && this.keyCode !== KeyCode.Shift && this.keyCode !== KeyCode.Alt && this.keyCode !== KeyCode.Meta) {\n\t\t\tkey = this.keyCode;\n\t\t}\n\t\treturn new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Represents a window in a possible chain of iframes\n */\ninterface IWindowChainElement {\n\t/**\n\t * The window object for it\n\t */\n\treadonly window: WeakRef;\n\t/**\n\t * The iframe element inside the window.parent corresponding to window\n\t */\n\treadonly iframeElement: Element | null;\n}\n\nconst sameOriginWindowChainCache = new WeakMap();\n\nfunction getParentWindowIfSameOrigin(w: Window): Window | null {\n\tif (!w.parent || w.parent === w) {\n\t\treturn null;\n\t}\n\n\t// Cannot really tell if we have access to the parent window unless we try to access something in it\n\ttry {\n\t\tconst location = w.location;\n\t\tconst parentLocation = w.parent.location;\n\t\tif (location.origin !== 'null' && parentLocation.origin !== 'null' && location.origin !== parentLocation.origin) {\n\t\t\treturn null;\n\t\t}\n\t} catch (e) {\n\t\treturn null;\n\t}\n\n\treturn w.parent;\n}\n\nexport class IframeUtils {\n\n\t/**\n\t * Returns a chain of embedded windows with the same origin (which can be accessed programmatically).\n\t * Having a chain of length 1 might mean that the current execution environment is running outside of an iframe or inside an iframe embedded in a window with a different origin.\n\t */\n\tprivate static getSameOriginWindowChain(targetWindow: Window): IWindowChainElement[] {\n\t\tlet windowChainCache = sameOriginWindowChainCache.get(targetWindow);\n\t\tif (!windowChainCache) {\n\t\t\twindowChainCache = [];\n\t\t\tsameOriginWindowChainCache.set(targetWindow, windowChainCache);\n\t\t\tlet w: Window | null = targetWindow;\n\t\t\tlet parent: Window | null;\n\t\t\tdo {\n\t\t\t\tparent = getParentWindowIfSameOrigin(w);\n\t\t\t\tif (parent) {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: w.frameElement || null\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\twindowChainCache.push({\n\t\t\t\t\t\twindow: new WeakRef(w),\n\t\t\t\t\t\tiframeElement: null\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tw = parent;\n\t\t\t} while (w);\n\t\t}\n\t\treturn windowChainCache.slice(0);\n\t}\n\n\t/**\n\t * Returns the position of `childWindow` relative to `ancestorWindow`\n\t */\n\tpublic static getPositionOfChildWindowRelativeToAncestorWindow(childWindow: Window, ancestorWindow: Window | null) {\n\n\t\tif (!ancestorWindow || childWindow === ancestorWindow) {\n\t\t\treturn {\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0\n\t\t\t};\n\t\t}\n\n\t\tlet top = 0, left = 0;\n\n\t\tconst windowChain = this.getSameOriginWindowChain(childWindow);\n\n\t\tfor (const windowChainEl of windowChain) {\n\t\t\tconst windowInChain = windowChainEl.window.deref();\n\t\t\ttop += windowInChain?.scrollY ?? 0;\n\t\t\tleft += windowInChain?.scrollX ?? 0;\n\n\t\t\tif (windowInChain === ancestorWindow) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!windowChainEl.iframeElement) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst boundingRect = windowChainEl.iframeElement.getBoundingClientRect();\n\t\t\ttop += boundingRect.top;\n\t\t\tleft += boundingRect.left;\n\t\t}\n\n\t\treturn {\n\t\t\ttop: top,\n\t\t\tleft: left\n\t\t};\n\t}\n}\n\n/**\n * Returns a sha-256 composed of `parentOrigin` and `salt` converted to base 32\n */\nexport async function parentOriginHash(parentOrigin: string, salt: string): Promise {\n\t// This same code is also inlined at `src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html`\n\tif (!crypto.subtle) {\n\t\tthrow new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);\n\t}\n\n\tconst strData = JSON.stringify({ parentOrigin, salt });\n\tconst encoder = new TextEncoder();\n\tconst arrData = encoder.encode(strData);\n\tconst hash = await crypto.subtle.digest('sha-256', arrData);\n\treturn sha256AsBase32(hash);\n}\n\nfunction sha256AsBase32(bytes: ArrayBuffer): string {\n\tconst array = Array.from(new Uint8Array(bytes));\n\tconst hexArray = array.map(b => b.toString(16).padStart(2, '0')).join('');\n\t// sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32\n\treturn BigInt(`0x${hexArray}`).toString(32).padStart(52, '0');\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { IframeUtils } from 'vs/base/browser/iframe';\nimport * as platform from 'vs/base/common/platform';\n\nexport interface IMouseEvent {\n\treadonly browserEvent: MouseEvent;\n\treadonly leftButton: boolean;\n\treadonly middleButton: boolean;\n\treadonly rightButton: boolean;\n\treadonly buttons: number;\n\treadonly target: HTMLElement;\n\treadonly detail: number;\n\treadonly posx: number;\n\treadonly posy: number;\n\treadonly ctrlKey: boolean;\n\treadonly shiftKey: boolean;\n\treadonly altKey: boolean;\n\treadonly metaKey: boolean;\n\treadonly timestamp: number;\n\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport class StandardMouseEvent implements IMouseEvent {\n\n\tpublic readonly browserEvent: MouseEvent;\n\n\tpublic readonly leftButton: boolean;\n\tpublic readonly middleButton: boolean;\n\tpublic readonly rightButton: boolean;\n\tpublic readonly buttons: number;\n\tpublic readonly target: HTMLElement;\n\tpublic detail: number;\n\tpublic readonly posx: number;\n\tpublic readonly posy: number;\n\tpublic readonly ctrlKey: boolean;\n\tpublic readonly shiftKey: boolean;\n\tpublic readonly altKey: boolean;\n\tpublic readonly metaKey: boolean;\n\tpublic readonly timestamp: number;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tthis.timestamp = Date.now();\n\t\tthis.browserEvent = e;\n\t\tthis.leftButton = e.button === 0;\n\t\tthis.middleButton = e.button === 1;\n\t\tthis.rightButton = e.button === 2;\n\t\tthis.buttons = e.buttons;\n\n\t\tthis.target = e.target;\n\n\t\tthis.detail = e.detail || 1;\n\t\tif (e.type === 'dblclick') {\n\t\t\tthis.detail = 2;\n\t\t}\n\t\tthis.ctrlKey = e.ctrlKey;\n\t\tthis.shiftKey = e.shiftKey;\n\t\tthis.altKey = e.altKey;\n\t\tthis.metaKey = e.metaKey;\n\n\t\tif (typeof e.pageX === 'number') {\n\t\t\tthis.posx = e.pageX;\n\t\t\tthis.posy = e.pageY;\n\t\t} else {\n\t\t\t// Probably hit by MSGestureEvent\n\t\t\tthis.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;\n\t\t\tthis.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;\n\t\t}\n\n\t\t// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.\n\t\tconst iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);\n\t\tthis.posx -= iframeOffsets.left;\n\t\tthis.posy -= iframeOffsets.top;\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent.stopPropagation();\n\t}\n}\n\nexport class DragMouseEvent extends StandardMouseEvent {\n\n\tpublic readonly dataTransfer: DataTransfer;\n\n\tconstructor(targetWindow: Window, e: MouseEvent) {\n\t\tsuper(targetWindow, e);\n\t\tthis.dataTransfer = (e).dataTransfer;\n\t}\n}\n\nexport interface IMouseWheelEvent extends MouseEvent {\n\treadonly wheelDelta: number;\n\treadonly wheelDeltaX: number;\n\treadonly wheelDeltaY: number;\n\n\treadonly deltaX: number;\n\treadonly deltaY: number;\n\treadonly deltaZ: number;\n\treadonly deltaMode: number;\n}\n\ninterface IWebKitMouseWheelEvent {\n\twheelDeltaY: number;\n\twheelDeltaX: number;\n}\n\ninterface IGeckoMouseWheelEvent {\n\tHORIZONTAL_AXIS: number;\n\tVERTICAL_AXIS: number;\n\taxis: number;\n\tdetail: number;\n}\n\nexport class StandardWheelEvent {\n\n\tpublic readonly browserEvent: IMouseWheelEvent | null;\n\tpublic readonly deltaY: number;\n\tpublic readonly deltaX: number;\n\tpublic readonly target: Node;\n\n\tconstructor(e: IMouseWheelEvent | null, deltaX: number = 0, deltaY: number = 0) {\n\n\t\tthis.browserEvent = e || null;\n\t\tthis.target = e ? (e.target || (e).targetNode || e.srcElement) : null;\n\n\t\tthis.deltaY = deltaY;\n\t\tthis.deltaX = deltaX;\n\n\t\tlet shouldFactorDPR: boolean = false;\n\t\tif (browser.isChrome) {\n\t\t\t// Chrome version >= 123 contains the fix to factor devicePixelRatio into the wheel event.\n\t\t\t// See https://chromium.googlesource.com/chromium/src.git/+/be51b448441ff0c9d1f17e0f25c4bf1ab3f11f61\n\t\t\tconst chromeVersionMatch = navigator.userAgent.match(/Chrome\\/(\\d+)/);\n\t\t\tconst chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;\n\t\t\tshouldFactorDPR = chromeMajorVersion <= 122;\n\t\t}\n\n\t\tif (e) {\n\t\t\t// Old (deprecated) wheel events\n\t\t\tconst e1 = e;\n\t\t\tconst e2 = e;\n\t\t\tconst devicePixelRatio = e.view?.devicePixelRatio || 1;\n\n\t\t\t// vertical delta scroll\n\t\t\tif (typeof e1.wheelDeltaY !== 'undefined') {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e1.wheelDeltaY / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {\n\t\t\t\tthis.deltaY = -e2.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaY = -e.deltaY;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = -e.deltaY / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// horizontal delta scroll\n\t\t\tif (typeof e1.wheelDeltaX !== 'undefined') {\n\t\t\t\tif (browser.isSafari && platform.isWindows) {\n\t\t\t\t\tthis.deltaX = - (e1.wheelDeltaX / 120);\n\t\t\t\t} else if (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = e1.wheelDeltaX / 120;\n\t\t\t\t}\n\t\t\t} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {\n\t\t\t\tthis.deltaX = -e.detail / 3;\n\t\t\t} else if (e.type === 'wheel') {\n\t\t\t\t// Modern wheel event\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent\n\t\t\t\tconst ev = e;\n\n\t\t\t\tif (ev.deltaMode === ev.DOM_DELTA_LINE) {\n\t\t\t\t\t// the deltas are expressed in lines\n\t\t\t\t\tif (browser.isFirefox && !platform.isMacintosh) {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX / 3;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.deltaX = -e.deltaX;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaX = -e.deltaX / 40;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Assume a vertical scroll if nothing else worked\n\t\t\tif (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {\n\t\t\t\tif (shouldFactorDPR) {\n\t\t\t\t\t// Refs https://github.com/microsoft/vscode/issues/146403#issuecomment-1854538928\n\t\t\t\t\tthis.deltaY = e.wheelDelta / (120 * devicePixelRatio);\n\t\t\t\t} else {\n\t\t\t\t\tthis.deltaY = e.wheelDelta / 120;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic preventDefault(): void {\n\t\tthis.browserEvent?.preventDefault();\n\t}\n\n\tpublic stopPropagation(): void {\n\t\tthis.browserEvent?.stopPropagation();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';\n\nexport interface CancellationToken {\n\n\t/**\n\t * A flag signalling is cancellation has been requested.\n\t */\n\treadonly isCancellationRequested: boolean;\n\n\t/**\n\t * An event which fires when cancellation is requested. This event\n\t * only ever fires `once` as cancellation can only happen once. Listeners\n\t * that are registered after cancellation will be called (next event loop run),\n\t * but also only once.\n\t *\n\t * @event\n\t */\n\treadonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;\n}\n\nconst shortcutEvent: Event = Object.freeze(function (callback, context?): IDisposable {\n\tconst handle = setTimeout(callback.bind(context), 0);\n\treturn { dispose() { clearTimeout(handle); } };\n});\n\nexport namespace CancellationToken {\n\n\texport function isCancellationToken(thing: unknown): thing is CancellationToken {\n\t\tif (thing === CancellationToken.None || thing === CancellationToken.Cancelled) {\n\t\t\treturn true;\n\t\t}\n\t\tif (thing instanceof MutableToken) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!thing || typeof thing !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\treturn typeof (thing as CancellationToken).isCancellationRequested === 'boolean'\n\t\t\t&& typeof (thing as CancellationToken).onCancellationRequested === 'function';\n\t}\n\n\n\texport const None = Object.freeze({\n\t\tisCancellationRequested: false,\n\t\tonCancellationRequested: Event.None\n\t});\n\n\texport const Cancelled = Object.freeze({\n\t\tisCancellationRequested: true,\n\t\tonCancellationRequested: shortcutEvent\n\t});\n}\n\nclass MutableToken implements CancellationToken {\n\n\tprivate _isCancelled: boolean = false;\n\tprivate _emitter: Emitter | null = null;\n\n\tpublic cancel() {\n\t\tif (!this._isCancelled) {\n\t\t\tthis._isCancelled = true;\n\t\t\tif (this._emitter) {\n\t\t\t\tthis._emitter.fire(undefined);\n\t\t\t\tthis.dispose();\n\t\t\t}\n\t\t}\n\t}\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this._isCancelled;\n\t}\n\n\tget onCancellationRequested(): Event {\n\t\tif (this._isCancelled) {\n\t\t\treturn shortcutEvent;\n\t\t}\n\t\tif (!this._emitter) {\n\t\t\tthis._emitter = new Emitter();\n\t\t}\n\t\treturn this._emitter.event;\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._emitter) {\n\t\t\tthis._emitter.dispose();\n\t\t\tthis._emitter = null;\n\t\t}\n\t}\n}\n\nexport class CancellationTokenSource {\n\n\tprivate _token?: CancellationToken = undefined;\n\tprivate _parentListener?: IDisposable = undefined;\n\n\tconstructor(parent?: CancellationToken) {\n\t\tthis._parentListener = parent && parent.onCancellationRequested(this.cancel, this);\n\t}\n\n\tget token(): CancellationToken {\n\t\tif (!this._token) {\n\t\t\t// be lazy and create the token only when\n\t\t\t// actually needed\n\t\t\tthis._token = new MutableToken();\n\t\t}\n\t\treturn this._token;\n\t}\n\n\tcancel(): void {\n\t\tif (!this._token) {\n\t\t\t// save an object by returning the default\n\t\t\t// cancelled token when cancellation happens\n\t\t\t// before someone asks for the token\n\t\t\tthis._token = CancellationToken.Cancelled;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually cancel\n\t\t\tthis._token.cancel();\n\t\t}\n\t}\n\n\tdispose(cancel: boolean = false): void {\n\t\tif (cancel) {\n\t\t\tthis.cancel();\n\t\t}\n\t\tthis._parentListener?.dispose();\n\t\tif (!this._token) {\n\t\t\t// ensure to initialize with an empty token if we had none\n\t\t\tthis._token = CancellationToken.None;\n\n\t\t} else if (this._token instanceof MutableToken) {\n\t\t\t// actually dispose\n\t\t\tthis._token.dispose();\n\t\t}\n\t}\n}\n\nexport function cancelOnDispose(store: DisposableStore): CancellationToken {\n\tconst source = new CancellationTokenSource();\n\tstore.add({ dispose() { source.cancel(); } });\n\treturn source.token;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Can be passed into the Delayed to defer using a microtask\n * */\nexport const MicrotaskDelay = Symbol('MicrotaskDelay');\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';\nimport { BugIndicatingError, CancellationError } from 'vs/base/common/errors';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport { setTimeout0 } from 'vs/base/common/platform';\nimport { MicrotaskDelay } from './symbols';\nimport { Lazy } from 'vs/base/common/lazy';\n\nexport function isThenable(obj: unknown): obj is Promise {\n\treturn !!obj && typeof (obj as unknown as Promise).then === 'function';\n}\n\nexport interface CancelablePromise extends Promise {\n\tcancel(): void;\n}\n\nexport function createCancelablePromise(callback: (token: CancellationToken) => Promise): CancelablePromise {\n\tconst source = new CancellationTokenSource();\n\n\tconst thenable = callback(source.token);\n\tconst promise = new Promise((resolve, reject) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tPromise.resolve(thenable).then(value => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\tresolve(value);\n\t\t}, err => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\treject(err);\n\t\t});\n\t});\n\n\treturn >new class {\n\t\tcancel() {\n\t\t\tsource.cancel();\n\t\t\tsource.dispose();\n\t\t}\n\t\tthen(resolve?: ((value: T) => TResult1 | Promise) | undefined | null, reject?: ((reason: any) => TResult2 | Promise) | undefined | null): Promise {\n\t\t\treturn promise.then(resolve, reject);\n\t\t}\n\t\tcatch(reject?: ((reason: any) => TResult | Promise) | undefined | null): Promise {\n\t\t\treturn this.then(undefined, reject);\n\t\t}\n\t\tfinally(onfinally?: (() => void) | undefined | null): Promise {\n\t\t\treturn promise.finally(onfinally);\n\t\t}\n\t};\n}\n\n/**\n * Returns a promise that resolves with `undefined` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken): Promise;\n\n/**\n * Returns a promise that resolves with `defaultValue` as soon as the passed token is cancelled.\n * @see {@link raceCancellationError}\n */\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue: T): Promise;\n\nexport function raceCancellation(promise: Promise, token: CancellationToken, defaultValue?: T): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\tresolve(defaultValue);\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.\n * @see {@link raceCancellation}\n */\nexport function raceCancellationError(promise: Promise, token: CancellationToken): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst ref = token.onCancellationRequested(() => {\n\t\t\tref.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t\tpromise.then(resolve, reject).finally(() => ref.dispose());\n\t});\n}\n\n/**\n * Returns as soon as one of the promises resolves or rejects and cancels remaining promises\n */\nexport async function raceCancellablePromises(cancellablePromises: CancelablePromise[]): Promise {\n\tlet resolvedPromiseIndex = -1;\n\tconst promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));\n\ttry {\n\t\tconst result = await Promise.race(promises);\n\t\treturn result;\n\t} finally {\n\t\tcancellablePromises.forEach((cancellablePromise, index) => {\n\t\t\tif (index !== resolvedPromiseIndex) {\n\t\t\t\tcancellablePromise.cancel();\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function raceTimeout(promise: Promise, timeout: number, onTimeout?: () => void): Promise {\n\tlet promiseResolve: ((value: T | undefined) => void) | undefined = undefined;\n\n\tconst timer = setTimeout(() => {\n\t\tpromiseResolve?.(undefined);\n\t\tonTimeout?.();\n\t}, timeout);\n\n\treturn Promise.race([\n\t\tpromise.finally(() => clearTimeout(timer)),\n\t\tnew Promise(resolve => promiseResolve = resolve)\n\t]);\n}\n\nexport function asPromise(callback: () => T | PromiseLike): Promise {\n\treturn new Promise((resolve, reject) => {\n\t\tconst item = callback();\n\t\tif (isThenable(item)) {\n\t\t\titem.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(item);\n\t\t}\n\t});\n}\n\n/**\n * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.\n *\n * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported\n */\nexport function promiseWithResolvers(): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (err?: any) => void } {\n\tlet resolve: (value: T | PromiseLike) => void;\n\tlet reject: (reason?: any) => void;\n\tconst promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\treturn { promise, resolve: resolve!, reject: reject! };\n}\n\nexport interface ITask {\n\t(): T;\n}\n\n/**\n * A helper to prevent accumulation of sequential async tasks.\n *\n * Imagine a mail man with the sole task of delivering letters. As soon as\n * a letter submitted for delivery, he drives to the destination, delivers it\n * and returns to his base. Imagine that during the trip, N more letters were submitted.\n * When the mail man returns, he picks those N letters and delivers them all in a\n * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.\n *\n * The throttler implements this via the queue() method, by providing it a task\n * factory. Following the example:\n *\n * \t\tconst throttler = new Throttler();\n * \t\tconst letters = [];\n *\n * \t\tfunction deliver() {\n * \t\t\tconst lettersToDeliver = letters;\n * \t\t\tletters = [];\n * \t\t\treturn makeTheTrip(lettersToDeliver);\n * \t\t}\n *\n * \t\tfunction onLetterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tthrottler.queue(deliver);\n * \t\t}\n */\nexport class Throttler implements IDisposable {\n\n\tprivate activePromise: Promise | null;\n\tprivate queuedPromise: Promise | null;\n\tprivate queuedPromiseFactory: ITask> | null;\n\n\tprivate isDisposed = false;\n\n\tconstructor() {\n\t\tthis.activePromise = null;\n\t\tthis.queuedPromise = null;\n\t\tthis.queuedPromiseFactory = null;\n\t}\n\n\tqueue(promiseFactory: ITask>): Promise {\n\t\tif (this.isDisposed) {\n\t\t\treturn Promise.reject(new Error('Throttler is disposed'));\n\t\t}\n\n\t\tif (this.activePromise) {\n\t\t\tthis.queuedPromiseFactory = promiseFactory;\n\n\t\t\tif (!this.queuedPromise) {\n\t\t\t\tconst onComplete = () => {\n\t\t\t\t\tthis.queuedPromise = null;\n\n\t\t\t\t\tif (this.isDisposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = this.queue(this.queuedPromiseFactory!);\n\t\t\t\t\tthis.queuedPromiseFactory = null;\n\n\t\t\t\t\treturn result;\n\t\t\t\t};\n\n\t\t\t\tthis.queuedPromise = new Promise(resolve => {\n\t\t\t\t\tthis.activePromise!.then(onComplete, onComplete).then(resolve);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tthis.queuedPromise!.then(resolve, reject);\n\t\t\t});\n\t\t}\n\n\t\tthis.activePromise = promiseFactory();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.activePromise!.then((result: T) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\tresolve(result);\n\t\t\t}, (err: unknown) => {\n\t\t\t\tthis.activePromise = null;\n\t\t\t\treject(err);\n\t\t\t});\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class Sequencer {\n\n\tprivate current: Promise = Promise.resolve(null);\n\n\tqueue(promiseTask: ITask>): Promise {\n\t\treturn this.current = this.current.then(() => promiseTask(), () => promiseTask());\n\t}\n}\n\nexport class SequencerByKey {\n\n\tprivate promiseMap = new Map>();\n\n\tqueue(key: TKey, promiseTask: ITask>): Promise {\n\t\tconst runningPromise = this.promiseMap.get(key) ?? Promise.resolve();\n\t\tconst newPromise = runningPromise\n\t\t\t.catch(() => { })\n\t\t\t.then(promiseTask)\n\t\t\t.finally(() => {\n\t\t\t\tif (this.promiseMap.get(key) === newPromise) {\n\t\t\t\t\tthis.promiseMap.delete(key);\n\t\t\t\t}\n\t\t\t});\n\t\tthis.promiseMap.set(key, newPromise);\n\t\treturn newPromise;\n\t}\n}\n\ninterface IScheduledLater extends IDisposable {\n\tisTriggered(): boolean;\n}\n\nconst timeoutDeferred = (timeout: number, fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tconst handle = setTimeout(() => {\n\t\tscheduled = false;\n\t\tfn();\n\t}, timeout);\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => {\n\t\t\tclearTimeout(handle);\n\t\t\tscheduled = false;\n\t\t},\n\t};\n};\n\nconst microtaskDeferred = (fn: () => void): IScheduledLater => {\n\tlet scheduled = true;\n\tqueueMicrotask(() => {\n\t\tif (scheduled) {\n\t\t\tscheduled = false;\n\t\t\tfn();\n\t\t}\n\t});\n\n\treturn {\n\t\tisTriggered: () => scheduled,\n\t\tdispose: () => { scheduled = false; },\n\t};\n};\n\n/**\n * A helper to delay (debounce) execution of a task that is being requested often.\n *\n * Following the throttler, now imagine the mail man wants to optimize the number of\n * trips proactively. The trip itself can be long, so he decides not to make the trip\n * as soon as a letter is submitted. Instead he waits a while, in case more\n * letters are submitted. After said waiting period, if no letters were submitted, he\n * decides to make the trip. Imagine that N more letters were submitted after the first\n * one, all within a short period of time between each other. Even though N+1\n * submissions occurred, only 1 delivery was made.\n *\n * The delayer offers this behavior via the trigger() method, into which both the task\n * to be executed and the waiting period (delay) must be passed in as arguments. Following\n * the example:\n *\n * \t\tconst delayer = new Delayer(WAITING_PERIOD);\n * \t\tconst letters = [];\n *\n * \t\tfunction letterReceived(l) {\n * \t\t\tletters.push(l);\n * \t\t\tdelayer.trigger(() => { return makeTheTrip(); });\n * \t\t}\n */\nexport class Delayer implements IDisposable {\n\n\tprivate deferred: IScheduledLater | null;\n\tprivate completionPromise: Promise | null;\n\tprivate doResolve: ((value?: any | Promise) => void) | null;\n\tprivate doReject: ((err: any) => void) | null;\n\tprivate task: ITask> | null;\n\n\tconstructor(public defaultDelay: number | typeof MicrotaskDelay) {\n\t\tthis.deferred = null;\n\t\tthis.completionPromise = null;\n\t\tthis.doResolve = null;\n\t\tthis.doReject = null;\n\t\tthis.task = null;\n\t}\n\n\ttrigger(task: ITask>, delay = this.defaultDelay): Promise {\n\t\tthis.task = task;\n\t\tthis.cancelTimeout();\n\n\t\tif (!this.completionPromise) {\n\t\t\tthis.completionPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis.doResolve = resolve;\n\t\t\t\tthis.doReject = reject;\n\t\t\t}).then(() => {\n\t\t\t\tthis.completionPromise = null;\n\t\t\t\tthis.doResolve = null;\n\t\t\t\tif (this.task) {\n\t\t\t\t\tconst task = this.task;\n\t\t\t\t\tthis.task = null;\n\t\t\t\t\treturn task();\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t}\n\n\t\tconst fn = () => {\n\t\t\tthis.deferred = null;\n\t\t\tthis.doResolve?.(null);\n\t\t};\n\n\t\tthis.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);\n\n\t\treturn this.completionPromise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn !!this.deferred?.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.cancelTimeout();\n\n\t\tif (this.completionPromise) {\n\t\t\tthis.doReject?.(new CancellationError());\n\t\t\tthis.completionPromise = null;\n\t\t}\n\t}\n\n\tprivate cancelTimeout(): void {\n\t\tthis.deferred?.dispose();\n\t\tthis.deferred = null;\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t}\n}\n\n/**\n * A helper to delay execution of a task that is being requested often, while\n * preventing accumulation of consecutive executions, while the task runs.\n *\n * The mail man is clever and waits for a certain amount of time, before going\n * out to deliver letters. While the mail man is going out, more letters arrive\n * and can only be delivered once he is back. Once he is back the mail man will\n * do one more trip to deliver the letters that have accumulated while he was out.\n */\nexport class ThrottledDelayer {\n\n\tprivate delayer: Delayer>;\n\tprivate throttler: Throttler;\n\n\tconstructor(defaultDelay: number) {\n\t\tthis.delayer = new Delayer(defaultDelay);\n\t\tthis.throttler = new Throttler();\n\t}\n\n\ttrigger(promiseFactory: ITask>, delay?: number): Promise {\n\t\treturn this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay) as unknown as Promise;\n\t}\n\n\tisTriggered(): boolean {\n\t\treturn this.delayer.isTriggered();\n\t}\n\n\tcancel(): void {\n\t\tthis.delayer.cancel();\n\t}\n\n\tdispose(): void {\n\t\tthis.delayer.dispose();\n\t\tthis.throttler.dispose();\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently.\n */\nexport class Barrier {\n\tprivate _isOpen: boolean;\n\tprivate _promise: Promise;\n\tprivate _completePromise!: (v: boolean) => void;\n\n\tconstructor() {\n\t\tthis._isOpen = false;\n\t\tthis._promise = new Promise((c, e) => {\n\t\t\tthis._completePromise = c;\n\t\t});\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this._isOpen;\n\t}\n\n\topen(): void {\n\t\tthis._isOpen = true;\n\t\tthis._completePromise(true);\n\t}\n\n\twait(): Promise {\n\t\treturn this._promise;\n\t}\n}\n\n/**\n * A barrier that is initially closed and then becomes opened permanently after a certain period of\n * time or when open is called explicitly\n */\nexport class AutoOpenBarrier extends Barrier {\n\n\tprivate readonly _timeout: any;\n\n\tconstructor(autoOpenTimeMs: number) {\n\t\tsuper();\n\t\tthis._timeout = setTimeout(() => this.open(), autoOpenTimeMs);\n\t}\n\n\toverride open(): void {\n\t\tclearTimeout(this._timeout);\n\t\tsuper.open();\n\t}\n}\n\nexport function timeout(millis: number): CancelablePromise;\nexport function timeout(millis: number, token: CancellationToken): Promise;\nexport function timeout(millis: number, token?: CancellationToken): CancelablePromise | Promise {\n\tif (!token) {\n\t\treturn createCancelablePromise(token => timeout(millis, token));\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst handle = setTimeout(() => {\n\t\t\tdisposable.dispose();\n\t\t\tresolve();\n\t\t}, millis);\n\t\tconst disposable = token.onCancellationRequested(() => {\n\t\t\tclearTimeout(handle);\n\t\t\tdisposable.dispose();\n\t\t\treject(new CancellationError());\n\t\t});\n\t});\n}\n\n/**\n * Creates a timeout that can be disposed using its returned value.\n * @param handler The timeout handler.\n * @param timeout An optional timeout in milliseconds.\n * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.\n *\n * @example\n * const store = new DisposableStore;\n * // Call the timeout after 1000ms at which point it will be automatically\n * // evicted from the store.\n * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);\n *\n * if (foo) {\n * // Cancel the timeout and evict it from store.\n * timeoutDisposable.dispose();\n * }\n */\nexport function disposableTimeout(handler: () => void, timeout = 0, store?: DisposableStore): IDisposable {\n\tconst timer = setTimeout(() => {\n\t\thandler();\n\t\tif (store) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, timeout);\n\tconst disposable = toDisposable(() => {\n\t\tclearTimeout(timer);\n\t\tstore?.deleteAndLeak(disposable);\n\t});\n\tstore?.add(disposable);\n\treturn disposable;\n}\n\n/**\n * Runs the provided list of promise factories in sequential order. The returned\n * promise will complete to an array of results from each promise.\n */\n\nexport function sequence(promiseFactories: ITask>[]): Promise {\n\tconst results: T[] = [];\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tfunction next(): Promise | null {\n\t\treturn index < len ? promiseFactories[index++]() : null;\n\t}\n\n\tfunction thenHandler(result: any): Promise {\n\t\tif (result !== undefined && result !== null) {\n\t\t\tresults.push(result);\n\t\t}\n\n\t\tconst n = next();\n\t\tif (n) {\n\t\t\treturn n.then(thenHandler);\n\t\t}\n\n\t\treturn Promise.resolve(results);\n\t}\n\n\treturn Promise.resolve(null).then(thenHandler);\n}\n\nexport function first(promiseFactories: ITask>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise {\n\tlet index = 0;\n\tconst len = promiseFactories.length;\n\n\tconst loop: () => Promise = () => {\n\t\tif (index >= len) {\n\t\t\treturn Promise.resolve(defaultValue);\n\t\t}\n\n\t\tconst factory = promiseFactories[index++];\n\t\tconst promise = Promise.resolve(factory());\n\n\t\treturn promise.then(result => {\n\t\t\tif (shouldStop(result)) {\n\t\t\t\treturn Promise.resolve(result);\n\t\t\t}\n\n\t\t\treturn loop();\n\t\t});\n\t};\n\n\treturn loop();\n}\n\n/**\n * Returns the result of the first promise that matches the \"shouldStop\",\n * running all promises in parallel. Supports cancelable promises.\n */\nexport function firstParallel(promiseList: Promise[], shouldStop?: (t: T) => boolean, defaultValue?: T | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => t is R, defaultValue?: R | null): Promise;\nexport function firstParallel(promiseList: Promise[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null) {\n\tif (promiseList.length === 0) {\n\t\treturn Promise.resolve(defaultValue);\n\t}\n\n\tlet todo = promiseList.length;\n\tconst finish = () => {\n\t\ttodo = -1;\n\t\tfor (const promise of promiseList) {\n\t\t\t(promise as Partial>).cancel?.();\n\t\t}\n\t};\n\n\treturn new Promise((resolve, reject) => {\n\t\tfor (const promise of promiseList) {\n\t\t\tpromise.then(result => {\n\t\t\t\tif (--todo >= 0 && shouldStop(result)) {\n\t\t\t\t\tfinish();\n\t\t\t\t\tresolve(result);\n\t\t\t\t} else if (todo === 0) {\n\t\t\t\t\tresolve(defaultValue);\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tif (--todo >= 0) {\n\t\t\t\t\t\tfinish();\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\t});\n}\n\ninterface ILimitedTaskFactory {\n\tfactory: ITask>;\n\tc: (value: T | Promise) => void;\n\te: (error?: unknown) => void;\n}\n\nexport interface ILimiter {\n\n\treadonly size: number;\n\n\tqueue(factory: ITask>): Promise;\n\n\tclear(): void;\n}\n\n/**\n * A helper to queue N promises and run them all with a max degree of parallelism. The helper\n * ensures that at any time no more than M promises are running at the same time.\n */\nexport class Limiter implements ILimiter {\n\n\tprivate _size = 0;\n\tprivate _isDisposed = false;\n\tprivate runningPromises: number;\n\tprivate readonly maxDegreeOfParalellism: number;\n\tprivate readonly outstandingPromises: ILimitedTaskFactory[];\n\tprivate readonly _onDrained: Emitter;\n\n\tconstructor(maxDegreeOfParalellism: number) {\n\t\tthis.maxDegreeOfParalellism = maxDegreeOfParalellism;\n\t\tthis.outstandingPromises = [];\n\t\tthis.runningPromises = 0;\n\t\tthis._onDrained = new Emitter();\n\t}\n\n\t/**\n\t *\n\t * @returns A promise that resolved when all work is done (onDrained) or when\n\t * there is nothing to do\n\t */\n\twhenIdle(): Promise {\n\t\treturn this.size > 0\n\t\t\t? Event.toPromise(this.onDrained)\n\t\t\t: Promise.resolve();\n\t}\n\n\tget onDrained(): Event {\n\t\treturn this._onDrained.event;\n\t}\n\n\tget size(): number {\n\t\treturn this._size;\n\t}\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis._size++;\n\n\t\treturn new Promise((c, e) => {\n\t\t\tthis.outstandingPromises.push({ factory, c, e });\n\t\t\tthis.consume();\n\t\t});\n\t}\n\n\tprivate consume(): void {\n\t\twhile (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {\n\t\t\tconst iLimitedTask = this.outstandingPromises.shift()!;\n\t\t\tthis.runningPromises++;\n\n\t\t\tconst promise = iLimitedTask.factory();\n\t\t\tpromise.then(iLimitedTask.c, iLimitedTask.e);\n\t\t\tpromise.then(() => this.consumed(), () => this.consumed());\n\t\t}\n\t}\n\n\tprivate consumed(): void {\n\t\tif (this._isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.runningPromises--;\n\t\tif (--this._size === 0) {\n\t\t\tthis._onDrained.fire();\n\t\t}\n\n\t\tif (this.outstandingPromises.length > 0) {\n\t\t\tthis.consume();\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new Error('Object has been disposed');\n\t\t}\n\t\tthis.outstandingPromises.length = 0;\n\t\tthis._size = this.runningPromises;\n\t}\n\n\tdispose(): void {\n\t\tthis._isDisposed = true;\n\t\tthis.outstandingPromises.length = 0; // stop further processing\n\t\tthis._size = 0;\n\t\tthis._onDrained.dispose();\n\t}\n}\n\n/**\n * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.\n */\nexport class Queue extends Limiter {\n\n\tconstructor() {\n\t\tsuper(1);\n\t}\n}\n\n/**\n * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that\n * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will\n * replace the currently queued task until it executes.\n *\n * As such, the returned promise may not be from the factory that is passed in but from the next factory that\n * is running after having called `queue`.\n */\nexport class LimitedQueue {\n\n\tprivate readonly sequentializer = new TaskSequentializer();\n\n\tprivate tasks = 0;\n\n\tqueue(factory: ITask>): Promise {\n\t\tif (!this.sequentializer.isRunning()) {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t}\n\n\t\treturn this.sequentializer.queue(() => {\n\t\t\treturn this.sequentializer.run(this.tasks++, factory());\n\t\t});\n\t}\n}\n\nexport class TimeoutTimer implements IDisposable {\n\tprivate _token: any;\n\tprivate _isDisposed = false;\n\n\tconstructor();\n\tconstructor(runner: () => void, timeout: number);\n\tconstructor(runner?: () => void, timeout?: number) {\n\t\tthis._token = -1;\n\n\t\tif (typeof runner === 'function' && typeof timeout === 'number') {\n\t\t\tthis.setIfNotSet(runner, timeout);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis._isDisposed = true;\n\t}\n\n\tcancel(): void {\n\t\tif (this._token !== -1) {\n\t\t\tclearTimeout(this._token);\n\t\t\tthis._token = -1;\n\t\t}\n\t}\n\n\tcancelAndSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n\n\tsetIfNotSet(runner: () => void, timeout: number): void {\n\t\tif (this._isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);\n\t\t}\n\n\t\tif (this._token !== -1) {\n\t\t\t// timer is already set\n\t\t\treturn;\n\t\t}\n\t\tthis._token = setTimeout(() => {\n\t\t\tthis._token = -1;\n\t\t\trunner();\n\t\t}, timeout);\n\t}\n}\n\nexport class IntervalTimer implements IDisposable {\n\n\tprivate disposable: IDisposable | undefined = undefined;\n\tprivate isDisposed = false;\n\n\tcancel(): void {\n\t\tthis.disposable?.dispose();\n\t\tthis.disposable = undefined;\n\t}\n\n\tcancelAndSet(runner: () => void, interval: number, context = globalThis): void {\n\t\tif (this.isDisposed) {\n\t\t\tthrow new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);\n\t\t}\n\n\t\tthis.cancel();\n\t\tconst handle = context.setInterval(() => {\n\t\t\trunner();\n\t\t}, interval);\n\n\t\tthis.disposable = toDisposable(() => {\n\t\t\tcontext.clearInterval(handle);\n\t\t\tthis.disposable = undefined;\n\t\t});\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.isDisposed = true;\n\t}\n}\n\nexport class RunOnceScheduler implements IDisposable {\n\n\tprotected runner: ((...args: unknown[]) => void) | null;\n\n\tprivate timeoutToken: any;\n\tprivate timeout: number;\n\tprivate timeoutHandler: () => void;\n\n\tconstructor(runner: (...args: any[]) => void, delay: number) {\n\t\tthis.timeoutToken = -1;\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.timeoutHandler = this.onTimeout.bind(this);\n\t}\n\n\t/**\n\t * Dispose RunOnceScheduler\n\t */\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\t/**\n\t * Cancel current scheduled runner (if any).\n\t */\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearTimeout(this.timeoutToken);\n\t\t\tthis.timeoutToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tthis.cancel();\n\t\tthis.timeoutToken = setTimeout(this.timeoutHandler, delay);\n\t}\n\n\tget delay(): number {\n\t\treturn this.timeout;\n\t}\n\n\tset delay(value: number) {\n\t\tthis.timeout = value;\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.timeoutToken !== -1;\n\t}\n\n\tflush(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tthis.cancel();\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprivate onTimeout() {\n\t\tthis.timeoutToken = -1;\n\t\tif (this.runner) {\n\t\t\tthis.doRun();\n\t\t}\n\t}\n\n\tprotected doRun(): void {\n\t\tthis.runner?.();\n\t}\n}\n\n/**\n * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.\n * > **NOTE**: Only offers 1s resolution.\n *\n * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep\n * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But\n * this scheduler will execute 3hrs **after waking the computer from sleep**.\n */\nexport class ProcessTimeRunOnceScheduler {\n\n\tprivate runner: (() => void) | null;\n\tprivate timeout: number;\n\n\tprivate counter: number;\n\tprivate intervalToken: any;\n\tprivate intervalHandler: () => void;\n\n\tconstructor(runner: () => void, delay: number) {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.runner = runner;\n\t\tthis.timeout = delay;\n\t\tthis.counter = 0;\n\t\tthis.intervalToken = -1;\n\t\tthis.intervalHandler = this.onInterval.bind(this);\n\t}\n\n\tdispose(): void {\n\t\tthis.cancel();\n\t\tthis.runner = null;\n\t}\n\n\tcancel(): void {\n\t\tif (this.isScheduled()) {\n\t\t\tclearInterval(this.intervalToken);\n\t\t\tthis.intervalToken = -1;\n\t\t}\n\t}\n\n\t/**\n\t * Cancel previous runner (if any) & schedule a new runner.\n\t */\n\tschedule(delay = this.timeout): void {\n\t\tif (delay % 1000 !== 0) {\n\t\t\tconsole.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);\n\t\t}\n\t\tthis.cancel();\n\t\tthis.counter = Math.ceil(delay / 1000);\n\t\tthis.intervalToken = setInterval(this.intervalHandler, 1000);\n\t}\n\n\t/**\n\t * Returns true if scheduled.\n\t */\n\tisScheduled(): boolean {\n\t\treturn this.intervalToken !== -1;\n\t}\n\n\tprivate onInterval() {\n\t\tthis.counter--;\n\t\tif (this.counter > 0) {\n\t\t\t// still need to wait\n\t\t\treturn;\n\t\t}\n\n\t\t// time elapsed\n\t\tclearInterval(this.intervalToken);\n\t\tthis.intervalToken = -1;\n\t\tthis.runner?.();\n\t}\n}\n\nexport class RunOnceWorker extends RunOnceScheduler {\n\n\tprivate units: T[] = [];\n\n\tconstructor(runner: (units: T[]) => void, timeout: number) {\n\t\tsuper(runner, timeout);\n\t}\n\n\twork(unit: T): void {\n\t\tthis.units.push(unit);\n\n\t\tif (!this.isScheduled()) {\n\t\t\tthis.schedule();\n\t\t}\n\t}\n\n\tprotected override doRun(): void {\n\t\tconst units = this.units;\n\t\tthis.units = [];\n\n\t\tthis.runner?.(units);\n\t}\n\n\toverride dispose(): void {\n\t\tthis.units = [];\n\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IThrottledWorkerOptions {\n\n\t/**\n\t * maximum of units the worker will pass onto handler at once\n\t */\n\tmaxWorkChunkSize: number;\n\n\t/**\n\t * maximum of units the worker will keep in memory for processing\n\t */\n\tmaxBufferedWork: number | undefined;\n\n\t/**\n\t * delay before processing the next round of chunks when chunk size exceeds limits\n\t */\n\tthrottleDelay: number;\n}\n\n/**\n * The `ThrottledWorker` will accept units of work `T`\n * to handle. The contract is:\n * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)\n * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)\n * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)\n */\nexport class ThrottledWorker extends Disposable {\n\n\tprivate readonly pendingWork: T[] = [];\n\n\tprivate readonly throttler = this._register(new MutableDisposable());\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tprivate options: IThrottledWorkerOptions,\n\t\tprivate readonly handler: (units: T[]) => void\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * The number of work units that are pending to be processed.\n\t */\n\tget pending(): number { return this.pendingWork.length; }\n\n\t/**\n\t * Add units to be worked on. Use `pending` to figure out\n\t * how many units are not yet processed after this method\n\t * was called.\n\t *\n\t * @returns whether the work was accepted or not. If the\n\t * worker is disposed, it will not accept any more work.\n\t * If the number of pending units would become larger\n\t * than `maxPendingWork`, more work will also not be accepted.\n\t */\n\twork(units: readonly T[]): boolean {\n\t\tif (this.disposed) {\n\t\t\treturn false; // work not accepted: disposed\n\t\t}\n\n\t\t// Check for reaching maximum of pending work\n\t\tif (typeof this.options.maxBufferedWork === 'number') {\n\n\t\t\t// Throttled: simple check if pending + units exceeds max pending\n\t\t\tif (this.throttler.value) {\n\t\t\t\tif (this.pending + units.length > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Unthrottled: same as throttled, but account for max chunk getting\n\t\t\t// worked on directly without being pending\n\t\t\telse {\n\t\t\t\tif (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {\n\t\t\t\t\treturn false; // work not accepted: too much pending work\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add to pending units first\n\t\tfor (const unit of units) {\n\t\t\tthis.pendingWork.push(unit);\n\t\t}\n\n\t\t// If not throttled, start working directly\n\t\t// Otherwise, when the throttle delay has\n\t\t// past, pending work will be worked again.\n\t\tif (!this.throttler.value) {\n\t\t\tthis.doWork();\n\t\t}\n\n\t\treturn true; // work accepted\n\t}\n\n\tprivate doWork(): void {\n\n\t\t// Extract chunk to handle and handle it\n\t\tthis.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));\n\n\t\t// If we have remaining work, schedule it after a delay\n\t\tif (this.pendingWork.length > 0) {\n\t\t\tthis.throttler.value = new RunOnceScheduler(() => {\n\t\t\t\tthis.throttler.clear();\n\n\t\t\t\tthis.doWork();\n\t\t\t}, this.options.throttleDelay);\n\t\t\tthis.throttler.value.schedule();\n\t\t}\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\n\t\tthis.disposed = true;\n\t}\n}\n\n//#region -- run on idle tricks ------------\n\nexport interface IdleDeadline {\n\treadonly didTimeout: boolean;\n\ttimeRemaining(): number;\n}\n\ntype IdleApi = Pick;\n\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n *\n * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser\n * context\n */\nexport let runWhenGlobalIdle: (callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\nexport let _runWhenIdle: (targetWindow: IdleApi, callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;\n\n(function () {\n\tif (typeof globalThis.requestIdleCallback !== 'function' || typeof globalThis.cancelIdleCallback !== 'function') {\n\t\t_runWhenIdle = (_targetWindow, runner) => {\n\t\t\tsetTimeout0(() => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst end = Date.now() + 15; // one frame at 64fps\n\t\t\t\tconst deadline: IdleDeadline = {\n\t\t\t\t\tdidTimeout: true,\n\t\t\t\t\ttimeRemaining() {\n\t\t\t\t\t\treturn Math.max(0, end - Date.now());\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\trunner(Object.freeze(deadline));\n\t\t\t});\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t} else {\n\t\t_runWhenIdle = (targetWindow: IdleApi, runner, timeout?) => {\n\t\t\tconst handle: number = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\tif (disposed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tdisposed = true;\n\t\t\t\t\ttargetWindow.cancelIdleCallback(handle);\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t}\n\trunWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);\n})();\n\nexport abstract class AbstractIdleValue {\n\n\tprivate readonly _executor: () => void;\n\tprivate readonly _handle: IDisposable;\n\n\tprivate _didRun: boolean = false;\n\tprivate _value?: T;\n\tprivate _error: unknown;\n\n\tconstructor(targetWindow: IdleApi, executor: () => T) {\n\t\tthis._executor = () => {\n\t\t\ttry {\n\t\t\t\tthis._value = executor();\n\t\t\t} catch (err) {\n\t\t\t\tthis._error = err;\n\t\t\t} finally {\n\t\t\t\tthis._didRun = true;\n\t\t\t}\n\t\t};\n\t\tthis._handle = _runWhenIdle(targetWindow, () => this._executor());\n\t}\n\n\tdispose(): void {\n\t\tthis._handle.dispose();\n\t}\n\n\tget value(): T {\n\t\tif (!this._didRun) {\n\t\t\tthis._handle.dispose();\n\t\t\tthis._executor();\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n\n\tget isInitialized(): boolean {\n\t\treturn this._didRun;\n\t}\n}\n\n/**\n * An `IdleValue` that always uses the current window (which might be throttled or inactive)\n *\n * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser\n * context\n */\nexport class GlobalIdleValue extends AbstractIdleValue {\n\n\tconstructor(executor: () => T) {\n\t\tsuper(globalThis, executor);\n\t}\n}\n\n//#endregion\n\nexport async function retry(task: ITask>, delay: number, retries: number): Promise {\n\tlet lastError: Error | undefined;\n\n\tfor (let i = 0; i < retries; i++) {\n\t\ttry {\n\t\t\treturn await task();\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\n\t\t\tawait timeout(delay);\n\t\t}\n\t}\n\n\tthrow lastError;\n}\n\n//#region Task Sequentializer\n\ninterface IRunningTask {\n\treadonly taskId: number;\n\treadonly cancel: () => void;\n\treadonly promise: Promise;\n}\n\ninterface IQueuedTask {\n\treadonly promise: Promise;\n\treadonly promiseResolve: () => void;\n\treadonly promiseReject: (error: Error) => void;\n\trun: ITask>;\n}\n\nexport interface ITaskSequentializerWithRunningTask {\n\treadonly running: Promise;\n}\n\nexport interface ITaskSequentializerWithQueuedTask {\n\treadonly queued: IQueuedTask;\n}\n\n/**\n * @deprecated use `LimitedQueue` instead for an easier to use API\n */\nexport class TaskSequentializer {\n\n\tprivate _running?: IRunningTask;\n\tprivate _queued?: IQueuedTask;\n\n\tisRunning(taskId?: number): this is ITaskSequentializerWithRunningTask {\n\t\tif (typeof taskId === 'number') {\n\t\t\treturn this._running?.taskId === taskId;\n\t\t}\n\n\t\treturn !!this._running;\n\t}\n\n\tget running(): Promise | undefined {\n\t\treturn this._running?.promise;\n\t}\n\n\tcancelRunning(): void {\n\t\tthis._running?.cancel();\n\t}\n\n\trun(taskId: number, promise: Promise, onCancel?: () => void,): Promise {\n\t\tthis._running = { taskId, cancel: () => onCancel?.(), promise };\n\n\t\tpromise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));\n\n\t\treturn promise;\n\t}\n\n\tprivate doneRunning(taskId: number): void {\n\t\tif (this._running && taskId === this._running.taskId) {\n\n\t\t\t// only set running to done if the promise finished that is associated with that taskId\n\t\t\tthis._running = undefined;\n\n\t\t\t// schedule the queued task now that we are free if we have any\n\t\t\tthis.runQueued();\n\t\t}\n\t}\n\n\tprivate runQueued(): void {\n\t\tif (this._queued) {\n\t\t\tconst queued = this._queued;\n\t\t\tthis._queued = undefined;\n\n\t\t\t// Run queued task and complete on the associated promise\n\t\t\tqueued.run().then(queued.promiseResolve, queued.promiseReject);\n\t\t}\n\t}\n\n\t/**\n\t * Note: the promise to schedule as next run MUST itself call `run`.\n\t * Otherwise, this sequentializer will report `false` for `isRunning`\n\t * even when this task is running. Missing this detail means that\n\t * suddenly multiple tasks will run in parallel.\n\t */\n\tqueue(run: ITask>): Promise {\n\n\t\t// this is our first queued task, so we create associated promise with it\n\t\t// so that we can return a promise that completes when the task has\n\t\t// completed.\n\t\tif (!this._queued) {\n\t\t\tconst { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers();\n\t\t\tthis._queued = {\n\t\t\t\trun,\n\t\t\t\tpromise,\n\t\t\t\tpromiseResolve: promiseResolve!,\n\t\t\t\tpromiseReject: promiseReject!\n\t\t\t};\n\t\t}\n\n\t\t// we have a previous queued task, just overwrite it\n\t\telse {\n\t\t\tthis._queued.run = run;\n\t\t}\n\n\t\treturn this._queued.promise;\n\t}\n\n\thasQueued(): this is ITaskSequentializerWithQueuedTask {\n\t\treturn !!this._queued;\n\t}\n\n\tasync join(): Promise {\n\t\treturn this._queued?.promise ?? this._running?.promise;\n\t}\n}\n\n//#endregion\n\n//#region\n\n/**\n * The `IntervalCounter` allows to count the number\n * of calls to `increment()` over a duration of\n * `interval`. This utility can be used to conditionally\n * throttle a frequent task when a certain threshold\n * is reached.\n */\nexport class IntervalCounter {\n\n\tprivate lastIncrementTime = 0;\n\n\tprivate value = 0;\n\n\tconstructor(private readonly interval: number, private readonly nowFn = () => Date.now()) { }\n\n\tincrement(): number {\n\t\tconst now = this.nowFn();\n\n\t\t// We are outside of the range of `interval` and as such\n\t\t// start counting from 0 and remember the time\n\t\tif (now - this.lastIncrementTime > this.interval) {\n\t\t\tthis.lastIncrementTime = now;\n\t\t\tthis.value = 0;\n\t\t}\n\n\t\tthis.value++;\n\n\t\treturn this.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nexport type ValueCallback = (value: T | Promise) => void;\n\nconst enum DeferredOutcome {\n\tResolved,\n\tRejected\n}\n\n/**\n * Creates a promise whose resolution or rejection can be controlled imperatively.\n */\nexport class DeferredPromise {\n\n\tprivate completeCallback!: ValueCallback;\n\tprivate errorCallback!: (err: unknown) => void;\n\tprivate outcome?: { outcome: DeferredOutcome.Rejected; value: any } | { outcome: DeferredOutcome.Resolved; value: T };\n\n\tpublic get isRejected() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Rejected;\n\t}\n\n\tpublic get isResolved() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved;\n\t}\n\n\tpublic get isSettled() {\n\t\treturn !!this.outcome;\n\t}\n\n\tpublic get value() {\n\t\treturn this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;\n\t}\n\n\tpublic readonly p: Promise;\n\n\tconstructor() {\n\t\tthis.p = new Promise((c, e) => {\n\t\t\tthis.completeCallback = c;\n\t\t\tthis.errorCallback = e;\n\t\t});\n\t}\n\n\tpublic complete(value: T) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.completeCallback(value);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Resolved, value };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic error(err: unknown) {\n\t\treturn new Promise(resolve => {\n\t\t\tthis.errorCallback(err);\n\t\t\tthis.outcome = { outcome: DeferredOutcome.Rejected, value: err };\n\t\t\tresolve();\n\t\t});\n\t}\n\n\tpublic cancel() {\n\t\treturn this.error(new CancellationError());\n\t}\n}\n\n//#endregion\n\n//#region Promises\n\nexport namespace Promises {\n\n\t/**\n\t * A drop-in replacement for `Promise.all` with the only difference\n\t * that the method awaits every promise to either fulfill or reject.\n\t *\n\t * Similar to `Promise.all`, only the first error will be returned\n\t * if any.\n\t */\n\texport async function settled(promises: Promise[]): Promise {\n\t\tlet firstError: Error | undefined = undefined;\n\n\t\tconst result = await Promise.all(promises.map(promise => promise.then(value => value, error => {\n\t\t\tif (!firstError) {\n\t\t\t\tfirstError = error;\n\t\t\t}\n\n\t\t\treturn undefined; // do not rethrow so that other promises can settle\n\t\t})));\n\n\t\tif (typeof firstError !== 'undefined') {\n\t\t\tthrow firstError;\n\t\t}\n\n\t\treturn result as unknown as T[]; // cast is needed and protected by the `throw` above\n\t}\n\n\t/**\n\t * A helper to create a new `Promise` with a body that is a promise\n\t * itself. By default, an error that raises from the async body will\n\t * end up as a unhandled rejection, so this utility properly awaits the\n\t * body and rejects the promise as a normal promise does without async\n\t * body.\n\t *\n\t * This method should only be used in rare cases where otherwise `async`\n\t * cannot be used (e.g. when callbacks are involved that require this).\n\t */\n\texport function withAsyncBody(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise): Promise {\n\t\t// eslint-disable-next-line no-async-promise-executor\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tawait bodyFn(resolve, reject);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport class StatefulPromise {\n\tprivate _value: T | undefined = undefined;\n\tget value(): T | undefined { return this._value; }\n\n\tprivate _error: unknown = undefined;\n\tget error(): unknown { return this._error; }\n\n\tprivate _isResolved = false;\n\tget isResolved() { return this._isResolved; }\n\n\tpublic readonly promise: Promise;\n\n\tconstructor(promise: Promise) {\n\t\tthis.promise = promise.then(\n\t\t\tvalue => {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._error = error;\n\t\t\t\tthis._isResolved = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\tif (!this._isResolved) {\n\t\t\tthrow new BugIndicatingError('Promise is not resolved yet');\n\t\t}\n\t\tif (this._error) {\n\t\t\tthrow this._error;\n\t\t}\n\t\treturn this._value!;\n\t}\n}\n\nexport class LazyStatefulPromise {\n\tprivate readonly _promise = new Lazy(() => new StatefulPromise(this._compute()));\n\n\tconstructor(\n\t\tprivate readonly _compute: () => Promise,\n\t) { }\n\n\t/**\n\t * Returns the resolved value.\n\t * Throws if the promise is not resolved yet.\n\t */\n\tpublic requireValue(): T {\n\t\treturn this._promise.value.requireValue();\n\t}\n\n\t/**\n\t * Returns the promise (and triggers a computation of the promise if not yet done so).\n\t */\n\tpublic getPromise(): Promise {\n\t\treturn this._promise.value.promise;\n\t}\n\n\t/**\n\t * Reads the current value without triggering a computation of the promise.\n\t */\n\tpublic get currentValue(): T | undefined {\n\t\treturn this._promise.rawValue?.value;\n\t}\n}\n\n//#endregion\n\n//#region\n\nconst enum AsyncIterableSourceState {\n\tInitial,\n\tDoneOK,\n\tDoneError,\n}\n\n/**\n * An object that allows to emit async values asynchronously or bring the iterable to an error state using `reject()`.\n * This emitter is valid only for the duration of the executor (until the promise returned by the executor settles).\n */\nexport interface AsyncIterableEmitter {\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitOne(value: T): void;\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `reject()` has already been called, this method has no effect.\n\t */\n\temitMany(values: T[]): void;\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `reject()` have already been called, this method has no effect.\n\t */\n\treject(error: Error): void;\n}\n\n/**\n * An executor for the `AsyncIterableObject` that has access to an emitter.\n */\nexport interface AsyncIterableExecutor {\n\t/**\n\t * @param emitter An object that allows to emit async values valid only for the duration of the executor.\n\t */\n\t(emitter: AsyncIterableEmitter): void | Promise;\n}\n\n/**\n * A rich implementation for an `AsyncIterable`.\n */\nexport class AsyncIterableObject implements AsyncIterable {\n\n\tpublic static fromArray(items: T[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject((writer) => {\n\t\t\twriter.emitMany(items);\n\t\t});\n\t}\n\n\tpublic static fromPromise(promise: Promise): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\temitter.emitMany(await promise);\n\t\t});\n\t}\n\n\tpublic static fromPromises(promises: Promise[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(promises.map(async (p) => emitter.emitOne(await p)));\n\t\t});\n\t}\n\n\tpublic static merge(iterables: AsyncIterable[]): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tawait Promise.all(iterables.map(async (iterable) => {\n\t\t\t\tfor await (const item of iterable) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}));\n\t\t});\n\t}\n\n\tpublic static EMPTY = AsyncIterableObject.fromArray([]);\n\n\tprivate _state: AsyncIterableSourceState;\n\tprivate _results: T[];\n\tprivate _error: Error | null;\n\tprivate readonly _onReturn?: () => void | Promise;\n\tprivate readonly _onStateChanged: Emitter;\n\n\tconstructor(executor: AsyncIterableExecutor, onReturn?: () => void | Promise) {\n\t\tthis._state = AsyncIterableSourceState.Initial;\n\t\tthis._results = [];\n\t\tthis._error = null;\n\t\tthis._onReturn = onReturn;\n\t\tthis._onStateChanged = new Emitter();\n\n\t\tqueueMicrotask(async () => {\n\t\t\tconst writer: AsyncIterableEmitter = {\n\t\t\t\temitOne: (item) => this.emitOne(item),\n\t\t\t\temitMany: (items) => this.emitMany(items),\n\t\t\t\treject: (error) => this.reject(error)\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tawait Promise.resolve(executor(writer));\n\t\t\t\tthis.resolve();\n\t\t\t} catch (err) {\n\t\t\t\tthis.reject(err);\n\t\t\t} finally {\n\t\t\t\twriter.emitOne = undefined!;\n\t\t\t\twriter.emitMany = undefined!;\n\t\t\t\twriter.reject = undefined!;\n\t\t\t}\n\t\t});\n\t}\n\n\t[Symbol.asyncIterator](): AsyncIterator {\n\t\tlet i = 0;\n\t\treturn {\n\t\t\tnext: async () => {\n\t\t\t\tdo {\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneError) {\n\t\t\t\t\t\tthrow this._error;\n\t\t\t\t\t}\n\t\t\t\t\tif (i < this._results.length) {\n\t\t\t\t\t\treturn { done: false, value: this._results[i++] };\n\t\t\t\t\t}\n\t\t\t\t\tif (this._state === AsyncIterableSourceState.DoneOK) {\n\t\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t\t}\n\t\t\t\t\tawait Event.toPromise(this._onStateChanged.event);\n\t\t\t\t} while (true);\n\t\t\t},\n\t\t\treturn: async () => {\n\t\t\t\tthis._onReturn?.();\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic static map(iterable: AsyncIterable, mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\temitter.emitOne(mapFn(item));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic map(mapFn: (item: T) => R): AsyncIterableObject {\n\t\treturn AsyncIterableObject.map(this, mapFn);\n\t}\n\n\tpublic static filter(iterable: AsyncIterable, filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn new AsyncIterableObject(async (emitter) => {\n\t\t\tfor await (const item of iterable) {\n\t\t\t\tif (filterFn(item)) {\n\t\t\t\t\temitter.emitOne(item);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic filter(filterFn: (item: T) => boolean): AsyncIterableObject {\n\t\treturn AsyncIterableObject.filter(this, filterFn);\n\t}\n\n\tpublic static coalesce(iterable: AsyncIterable): AsyncIterableObject {\n\t\treturn >AsyncIterableObject.filter(iterable, item => !!item);\n\t}\n\n\tpublic coalesce(): AsyncIterableObject> {\n\t\treturn AsyncIterableObject.coalesce(this) as AsyncIterableObject>;\n\t}\n\n\tpublic static async toPromise(iterable: AsyncIterable): Promise {\n\t\tconst result: T[] = [];\n\t\tfor await (const item of iterable) {\n\t\t\tresult.push(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic toPromise(): Promise {\n\t\treturn AsyncIterableObject.toPromise(this);\n\t}\n\n\t/**\n\t * The value will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitOne(value: T): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results.push(value);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * The values will be appended at the end.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate emitMany(values: T[]): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\t// it is important to add new values at the end,\n\t\t// as we may have iterators already running on the array\n\t\tthis._results = this._results.concat(values);\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Calling `resolve()` will mark the result array as complete.\n\t *\n\t * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate resolve(): void {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneOK;\n\t\tthis._onStateChanged.fire();\n\t}\n\n\t/**\n\t * Writing an error will permanently invalidate this iterable.\n\t * The current users will receive an error thrown, as will all future users.\n\t *\n\t * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.\n\t */\n\tprivate reject(error: Error) {\n\t\tif (this._state !== AsyncIterableSourceState.Initial) {\n\t\t\treturn;\n\t\t}\n\t\tthis._state = AsyncIterableSourceState.DoneError;\n\t\tthis._error = error;\n\t\tthis._onStateChanged.fire();\n\t}\n}\n\nexport class CancelableAsyncIterableObject extends AsyncIterableObject {\n\tconstructor(\n\t\tprivate readonly _source: CancellationTokenSource,\n\t\texecutor: AsyncIterableExecutor\n\t) {\n\t\tsuper(executor);\n\t}\n\n\tcancel(): void {\n\t\tthis._source.cancel();\n\t}\n}\n\nexport function createCancelableAsyncIterable(callback: (token: CancellationToken) => AsyncIterable): CancelableAsyncIterableObject {\n\tconst source = new CancellationTokenSource();\n\tconst innerIterable = callback(source.token);\n\n\treturn new CancelableAsyncIterableObject(source, async (emitter) => {\n\t\tconst subscription = source.token.onCancellationRequested(() => {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(new CancellationError());\n\t\t});\n\t\ttry {\n\t\t\tfor await (const item of innerIterable) {\n\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t// canceled in the meantime\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\temitter.emitOne(item);\n\t\t\t}\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t} catch (err) {\n\t\t\tsubscription.dispose();\n\t\t\tsource.dispose();\n\t\t\temitter.reject(err);\n\t\t}\n\t});\n}\n\nexport class AsyncIterableSource {\n\n\tprivate readonly _deferred = new DeferredPromise();\n\tprivate readonly _asyncIterable: AsyncIterableObject;\n\n\tprivate _errorFn: (error: Error) => void;\n\tprivate _emitFn: (item: T) => void;\n\n\t/**\n\t *\n\t * @param onReturn A function that will be called when consuming the async iterable\n\t * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.\n\t * This is NOT called when resolving this source by its owner.\n\t */\n\tconstructor(onReturn?: () => Promise | void) {\n\t\tthis._asyncIterable = new AsyncIterableObject(emitter => {\n\n\t\t\tif (earlyError) {\n\t\t\t\temitter.reject(earlyError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (earlyItems) {\n\t\t\t\temitter.emitMany(earlyItems);\n\t\t\t}\n\t\t\tthis._errorFn = (error: Error) => emitter.reject(error);\n\t\t\tthis._emitFn = (item: T) => emitter.emitOne(item);\n\t\t\treturn this._deferred.p;\n\t\t}, onReturn);\n\n\t\tlet earlyError: Error | undefined;\n\t\tlet earlyItems: T[] | undefined;\n\n\t\tthis._emitFn = (item: T) => {\n\t\t\tif (!earlyItems) {\n\t\t\t\tearlyItems = [];\n\t\t\t}\n\t\t\tearlyItems.push(item);\n\t\t};\n\t\tthis._errorFn = (error: Error) => {\n\t\t\tif (!earlyError) {\n\t\t\t\tearlyError = error;\n\t\t\t}\n\t\t};\n\t}\n\n\tget asyncIterable(): AsyncIterableObject {\n\t\treturn this._asyncIterable;\n\t}\n\n\tresolve(): void {\n\t\tthis._deferred.complete();\n\t}\n\n\treject(error: Error): void {\n\t\tthis._errorFn(error);\n\t\tthis._deferred.complete();\n\t}\n\n\temitOne(item: T): void {\n\t\tthis._emitFn(item);\n\t}\n}\n\n//#endregion\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { CharCode } from 'vs/base/common/charCode';\nimport { Constants } from 'vs/base/common/uint';\n\nexport function isFalsyOrWhitespace(str: string | undefined): boolean {\n\tif (!str || typeof str !== 'string') {\n\t\treturn true;\n\t}\n\treturn str.trim().length === 0;\n}\n\nconst _formatRegexp = /{(\\d+)}/g;\n\n/**\n * Helper to produce a string with a variable number of arguments. Insert variable segments\n * into the string using the {n} notation where N is the index of the argument following the string.\n * @param value string to which formatting is applied\n * @param args replacements for {n}-entries\n */\nexport function format(value: string, ...args: any[]): string {\n\tif (args.length === 0) {\n\t\treturn value;\n\t}\n\treturn value.replace(_formatRegexp, function (match, group) {\n\t\tconst idx = parseInt(group, 10);\n\t\treturn isNaN(idx) || idx < 0 || idx >= args.length ?\n\t\t\tmatch :\n\t\t\targs[idx];\n\t});\n}\n\nconst _format2Regexp = /{([^}]+)}/g;\n\n/**\n * Helper to create a string from a template and a string record.\n * Similar to `format` but with objects instead of positional arguments.\n */\nexport function format2(template: string, values: Record): string {\n\tif (Object.keys(values).length === 0) {\n\t\treturn template;\n\t}\n\treturn template.replace(_format2Regexp, (match, group) => (values[group] ?? match) as string);\n}\n\n/**\n * Encodes the given value so that it can be used as literal value in html attributes.\n *\n * In other words, computes `$val`, such that `attr` in `
` has the runtime value `value`.\n * This prevents XSS injection.\n */\nexport function htmlAttributeEncodeValue(value: string): string {\n\treturn value.replace(/[<>\"'&]/g, ch => {\n\t\tswitch (ch) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '\"': return '"';\n\t\t\tcase '\\'': return ''';\n\t\t\tcase '&': return '&';\n\t\t}\n\t\treturn ch;\n\t});\n}\n\n/**\n * Converts HTML characters inside the string to use entities instead. Makes the string safe from\n * being used e.g. in HTMLElement.innerHTML.\n */\nexport function escape(html: string): string {\n\treturn html.replace(/[<>&]/g, function (match) {\n\t\tswitch (match) {\n\t\t\tcase '<': return '<';\n\t\t\tcase '>': return '>';\n\t\t\tcase '&': return '&';\n\t\t\tdefault: return match;\n\t\t}\n\t});\n}\n\n/**\n * Escapes regular expression characters in a given string\n */\nexport function escapeRegExpCharacters(value: string): string {\n\treturn value.replace(/[\\\\\\{\\}\\*\\+\\?\\|\\^\\$\\.\\[\\]\\(\\)]/g, '\\\\$&');\n}\n\n/**\n * Counts how often `substr` occurs inside `value`.\n */\nexport function count(value: string, substr: string): number {\n\tlet result = 0;\n\tlet index = value.indexOf(substr);\n\twhile (index !== -1) {\n\t\tresult++;\n\t\tindex = value.indexOf(substr, index + substr.length);\n\t}\n\treturn result;\n}\n\nexport function truncate(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\treturn `${value.substr(0, maxLength)}${suffix}`;\n}\n\nexport function truncateMiddle(value: string, maxLength: number, suffix = '\u2026'): string {\n\tif (value.length <= maxLength) {\n\t\treturn value;\n\t}\n\n\tconst prefixLength = Math.ceil(maxLength / 2) - suffix.length / 2;\n\tconst suffixLength = Math.floor(maxLength / 2) - suffix.length / 2;\n\n\treturn `${value.substr(0, prefixLength)}${suffix}${value.substr(value.length - suffixLength)}`;\n}\n\n/**\n * Removes all occurrences of needle from the beginning and end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim (default is a blank)\n */\nexport function trim(haystack: string, needle: string = ' '): string {\n\tconst trimmed = ltrim(haystack, needle);\n\treturn rtrim(trimmed, needle);\n}\n\n/**\n * Removes all occurrences of needle from the beginning of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function ltrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length;\n\tif (needleLen === 0 || haystack.length === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = 0;\n\n\twhile (haystack.indexOf(needle, offset) === offset) {\n\t\toffset = offset + needleLen;\n\t}\n\treturn haystack.substring(offset);\n}\n\n/**\n * Removes all occurrences of needle from the end of haystack.\n * @param haystack string to trim\n * @param needle the thing to trim\n */\nexport function rtrim(haystack: string, needle: string): string {\n\tif (!haystack || !needle) {\n\t\treturn haystack;\n\t}\n\n\tconst needleLen = needle.length,\n\t\thaystackLen = haystack.length;\n\n\tif (needleLen === 0 || haystackLen === 0) {\n\t\treturn haystack;\n\t}\n\n\tlet offset = haystackLen,\n\t\tidx = -1;\n\n\twhile (true) {\n\t\tidx = haystack.lastIndexOf(needle, offset - 1);\n\t\tif (idx === -1 || idx + needleLen !== offset) {\n\t\t\tbreak;\n\t\t}\n\t\tif (idx === 0) {\n\t\t\treturn '';\n\t\t}\n\t\toffset = idx;\n\t}\n\n\treturn haystack.substring(0, offset);\n}\n\nexport function convertSimple2RegExpPattern(pattern: string): string {\n\treturn pattern.replace(/[\\-\\\\\\{\\}\\+\\?\\|\\^\\$\\.\\,\\[\\]\\(\\)\\#\\s]/g, '\\\\$&').replace(/[\\*]/g, '.*');\n}\n\nexport function stripWildcards(pattern: string): string {\n\treturn pattern.replace(/\\*/g, '');\n}\n\nexport interface RegExpOptions {\n\tmatchCase?: boolean;\n\twholeWord?: boolean;\n\tmultiline?: boolean;\n\tglobal?: boolean;\n\tunicode?: boolean;\n}\n\nexport function createRegExp(searchString: string, isRegex: boolean, options: RegExpOptions = {}): RegExp {\n\tif (!searchString) {\n\t\tthrow new Error('Cannot create regex from empty string');\n\t}\n\tif (!isRegex) {\n\t\tsearchString = escapeRegExpCharacters(searchString);\n\t}\n\tif (options.wholeWord) {\n\t\tif (!/\\B/.test(searchString.charAt(0))) {\n\t\t\tsearchString = '\\\\b' + searchString;\n\t\t}\n\t\tif (!/\\B/.test(searchString.charAt(searchString.length - 1))) {\n\t\t\tsearchString = searchString + '\\\\b';\n\t\t}\n\t}\n\tlet modifiers = '';\n\tif (options.global) {\n\t\tmodifiers += 'g';\n\t}\n\tif (!options.matchCase) {\n\t\tmodifiers += 'i';\n\t}\n\tif (options.multiline) {\n\t\tmodifiers += 'm';\n\t}\n\tif (options.unicode) {\n\t\tmodifiers += 'u';\n\t}\n\n\treturn new RegExp(searchString, modifiers);\n}\n\nexport function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {\n\t// Exit early if it's one of these special cases which are meant to match\n\t// against an empty string\n\tif (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\\\s*$') {\n\t\treturn false;\n\t}\n\n\t// We check against an empty string. If the regular expression doesn't advance\n\t// (e.g. ends in an endless loop) it will match an empty string.\n\tconst match = regexp.exec('');\n\treturn !!(match && regexp.lastIndex === 0);\n}\n\nexport function splitLines(str: string): string[] {\n\treturn str.split(/\\r\\n|\\r|\\n/);\n}\n\nexport function splitLinesIncludeSeparators(str: string): string[] {\n\tconst linesWithSeparators: string[] = [];\n\tconst splitLinesAndSeparators = str.split(/(\\r\\n|\\r|\\n)/);\n\tfor (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {\n\t\tlinesWithSeparators.push(splitLinesAndSeparators[2 * i] + (splitLinesAndSeparators[2 * i + 1] ?? ''));\n\t}\n\treturn linesWithSeparators;\n}\n\n/**\n * Returns first index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function firstNonWhitespaceIndex(str: string): number {\n\tfor (let i = 0, len = str.length; i < len; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Returns the leading whitespace of the string.\n * If the string contains only whitespaces, returns entire string\n */\nexport function getLeadingWhitespace(str: string, start: number = 0, end: number = str.length): string {\n\tfor (let i = start; i < end; i++) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn str.substring(start, i);\n\t\t}\n\t}\n\treturn str.substring(start, end);\n}\n\n/**\n * Returns last index of the string that is not whitespace.\n * If string is empty or contains only whitespaces, returns -1\n */\nexport function lastNonWhitespaceIndex(str: string, startIndex: number = str.length - 1): number {\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst chCode = str.charCodeAt(i);\n\t\tif (chCode !== CharCode.Space && chCode !== CharCode.Tab) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Function that works identically to String.prototype.replace, except, the\n * replace function is allowed to be async and return a Promise.\n */\nexport function replaceAsync(str: string, search: RegExp, replacer: (match: string, ...args: any[]) => Promise): Promise {\n\tconst parts: (string | Promise)[] = [];\n\n\tlet last = 0;\n\tfor (const match of str.matchAll(search)) {\n\t\tparts.push(str.slice(last, match.index));\n\t\tif (match.index === undefined) {\n\t\t\tthrow new Error('match.index should be defined');\n\t\t}\n\n\t\tlast = match.index + match[0].length;\n\t\tparts.push(replacer(match[0], ...match.slice(1), match.index, str, match.groups));\n\t}\n\n\tparts.push(str.slice(last));\n\n\treturn Promise.all(parts).then(p => p.join(''));\n}\n\nexport function compare(a: string, b: string): number {\n\tif (a < b) {\n\t\treturn -1;\n\t} else if (a > b) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nexport function compareSubstring(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\t\tconst codeA = a.charCodeAt(aStart);\n\t\tconst codeB = b.charCodeAt(bStart);\n\t\tif (codeA < codeB) {\n\t\t\treturn -1;\n\t\t} else if (codeA > codeB) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nexport function compareIgnoreCase(a: string, b: string): number {\n\treturn compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);\n}\n\nexport function compareSubstringIgnoreCase(a: string, b: string, aStart: number = 0, aEnd: number = a.length, bStart: number = 0, bEnd: number = b.length): number {\n\n\tfor (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {\n\n\t\tlet codeA = a.charCodeAt(aStart);\n\t\tlet codeB = b.charCodeAt(bStart);\n\n\t\tif (codeA === codeB) {\n\t\t\t// equal\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (codeA >= 128 || codeB >= 128) {\n\t\t\t// not ASCII letters -> fallback to lower-casing strings\n\t\t\treturn compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);\n\t\t}\n\n\t\t// mapper lower-case ascii letter onto upper-case varinats\n\t\t// [97-122] (lower ascii) --> [65-90] (upper ascii)\n\t\tif (isLowerAsciiLetter(codeA)) {\n\t\t\tcodeA -= 32;\n\t\t}\n\t\tif (isLowerAsciiLetter(codeB)) {\n\t\t\tcodeB -= 32;\n\t\t}\n\n\t\t// compare both code points\n\t\tconst diff = codeA - codeB;\n\t\tif (diff === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn diff;\n\t}\n\n\tconst aLen = aEnd - aStart;\n\tconst bLen = bEnd - bStart;\n\n\tif (aLen < bLen) {\n\t\treturn -1;\n\t} else if (aLen > bLen) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\nexport function isAsciiDigit(code: number): boolean {\n\treturn code >= CharCode.Digit0 && code <= CharCode.Digit9;\n}\n\nexport function isLowerAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.a && code <= CharCode.z;\n}\n\nexport function isUpperAsciiLetter(code: number): boolean {\n\treturn code >= CharCode.A && code <= CharCode.Z;\n}\n\nexport function equalsIgnoreCase(a: string, b: string): boolean {\n\treturn a.length === b.length && compareSubstringIgnoreCase(a, b) === 0;\n}\n\nexport function startsWithIgnoreCase(str: string, candidate: string): boolean {\n\tconst candidateLength = candidate.length;\n\tif (candidate.length > str.length) {\n\t\treturn false;\n\t}\n\n\treturn compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;\n}\n\n/**\n * @returns the length of the common prefix of the two strings.\n */\nexport function commonPrefixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(i) !== b.charCodeAt(i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * @returns the length of the common suffix of the two strings.\n */\nexport function commonSuffixLength(a: string, b: string): number {\n\n\tconst len = Math.min(a.length, b.length);\n\tlet i: number;\n\n\tconst aLastIndex = a.length - 1;\n\tconst bLastIndex = b.length - 1;\n\n\tfor (i = 0; i < len; i++) {\n\t\tif (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn len;\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isHighSurrogate(charCode: number): boolean {\n\treturn (0xD800 <= charCode && charCode <= 0xDBFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function isLowSurrogate(charCode: number): boolean {\n\treturn (0xDC00 <= charCode && charCode <= 0xDFFF);\n}\n\n/**\n * See http://en.wikipedia.org/wiki/Surrogate_pair\n */\nexport function computeCodePoint(highSurrogate: number, lowSurrogate: number): number {\n\treturn ((highSurrogate - 0xD800) << 10) + (lowSurrogate - 0xDC00) + 0x10000;\n}\n\n/**\n * get the code point that begins at offset `offset`\n */\nexport function getNextCodePoint(str: string, len: number, offset: number): number {\n\tconst charCode = str.charCodeAt(offset);\n\tif (isHighSurrogate(charCode) && offset + 1 < len) {\n\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\tif (isLowSurrogate(nextCharCode)) {\n\t\t\treturn computeCodePoint(charCode, nextCharCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\n/**\n * get the code point that ends right before offset `offset`\n */\nfunction getPrevCodePoint(str: string, offset: number): number {\n\tconst charCode = str.charCodeAt(offset - 1);\n\tif (isLowSurrogate(charCode) && offset > 1) {\n\t\tconst prevCharCode = str.charCodeAt(offset - 2);\n\t\tif (isHighSurrogate(prevCharCode)) {\n\t\t\treturn computeCodePoint(prevCharCode, charCode);\n\t\t}\n\t}\n\treturn charCode;\n}\n\nexport class CodePointIterator {\n\n\tprivate readonly _str: string;\n\tprivate readonly _len: number;\n\tprivate _offset: number;\n\n\tpublic get offset(): number {\n\t\treturn this._offset;\n\t}\n\n\tconstructor(str: string, offset: number = 0) {\n\t\tthis._str = str;\n\t\tthis._len = str.length;\n\t\tthis._offset = offset;\n\t}\n\n\tpublic setOffset(offset: number): void {\n\t\tthis._offset = offset;\n\t}\n\n\tpublic prevCodePoint(): number {\n\t\tconst codePoint = getPrevCodePoint(this._str, this._offset);\n\t\tthis._offset -= (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic nextCodePoint(): number {\n\t\tconst codePoint = getNextCodePoint(this._str, this._len, this._offset);\n\t\tthis._offset += (codePoint >= Constants.UNICODE_SUPPLEMENTARY_PLANE_BEGIN ? 2 : 1);\n\t\treturn codePoint;\n\t}\n\n\tpublic eol(): boolean {\n\t\treturn (this._offset >= this._len);\n\t}\n}\n\nexport const noBreakWhitespace = '\\xa0';\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as strings from 'vs/base/common/strings';\n\n/**\n * Return a hash value for an object.\n */\nexport function hash(obj: any): number {\n\treturn doHash(obj, 0);\n}\n\nexport function doHash(obj: any, hashVal: number): number {\n\tswitch (typeof obj) {\n\t\tcase 'object':\n\t\t\tif (obj === null) {\n\t\t\t\treturn numberHash(349, hashVal);\n\t\t\t} else if (Array.isArray(obj)) {\n\t\t\t\treturn arrayHash(obj, hashVal);\n\t\t\t}\n\t\t\treturn objectHash(obj, hashVal);\n\t\tcase 'string':\n\t\t\treturn stringHash(obj, hashVal);\n\t\tcase 'boolean':\n\t\t\treturn booleanHash(obj, hashVal);\n\t\tcase 'number':\n\t\t\treturn numberHash(obj, hashVal);\n\t\tcase 'undefined':\n\t\t\treturn numberHash(937, hashVal);\n\t\tdefault:\n\t\t\treturn numberHash(617, hashVal);\n\t}\n}\n\nexport function numberHash(val: number, initialHashVal: number): number {\n\treturn (((initialHashVal << 5) - initialHashVal) + val) | 0; // hashVal * 31 + ch, keep as int32\n}\n\nfunction booleanHash(b: boolean, initialHashVal: number): number {\n\treturn numberHash(b ? 433 : 863, initialHashVal);\n}\n\nexport function stringHash(s: string, hashVal: number) {\n\thashVal = numberHash(149417, hashVal);\n\tfor (let i = 0, length = s.length; i < length; i++) {\n\t\thashVal = numberHash(s.charCodeAt(i), hashVal);\n\t}\n\treturn hashVal;\n}\n\nfunction arrayHash(arr: any[], initialHashVal: number): number {\n\tinitialHashVal = numberHash(104579, initialHashVal);\n\treturn arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);\n}\n\nfunction objectHash(obj: any, initialHashVal: number): number {\n\tinitialHashVal = numberHash(181387, initialHashVal);\n\treturn Object.keys(obj).sort().reduce((hashVal, key) => {\n\t\thashVal = stringHash(key, hashVal);\n\t\treturn doHash(obj[key], hashVal);\n\t}, initialHashVal);\n}\n\nexport class Hasher {\n\n\tprivate _value = 0;\n\n\tget value(): number {\n\t\treturn this._value;\n\t}\n\n\thash(obj: any): number {\n\t\tthis._value = doHash(obj, this._value);\n\t\treturn this._value;\n\t}\n}\n\nconst enum SHA1Constant {\n\tBLOCK_SIZE = 64, // 512 / 8\n\tUNICODE_REPLACEMENT = 0xFFFD,\n}\n\nfunction leftRotate(value: number, bits: number, totalBits: number = 32): number {\n\t// delta + bits = totalBits\n\tconst delta = totalBits - bits;\n\n\t// All ones, expect `delta` zeros aligned to the right\n\tconst mask = ~((1 << delta) - 1);\n\n\t// Join (value left-shifted `bits` bits) with (masked value right-shifted `delta` bits)\n\treturn ((value << bits) | ((mask & value) >>> delta)) >>> 0;\n}\n\nfunction fill(dest: Uint8Array, index: number = 0, count: number = dest.byteLength, value: number = 0): void {\n\tfor (let i = 0; i < count; i++) {\n\t\tdest[index + i] = value;\n\t}\n}\n\nfunction leftPad(value: string, length: number, char: string = '0'): string {\n\twhile (value.length < length) {\n\t\tvalue = char + value;\n\t}\n\treturn value;\n}\n\nexport function toHexString(buffer: ArrayBuffer): string;\nexport function toHexString(value: number, bitsize?: number): string;\nexport function toHexString(bufferOrValue: ArrayBuffer | number, bitsize: number = 32): string {\n\tif (bufferOrValue instanceof ArrayBuffer) {\n\t\treturn Array.from(new Uint8Array(bufferOrValue)).map(b => b.toString(16).padStart(2, '0')).join('');\n\t}\n\n\treturn leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);\n}\n\n/**\n * A SHA1 implementation that works with strings and does not allocate.\n */\nexport class StringSHA1 {\n\tprivate static _bigBlock32 = new DataView(new ArrayBuffer(320)); // 80 * 4 = 320\n\n\tprivate _h0 = 0x67452301;\n\tprivate _h1 = 0xEFCDAB89;\n\tprivate _h2 = 0x98BADCFE;\n\tprivate _h3 = 0x10325476;\n\tprivate _h4 = 0xC3D2E1F0;\n\n\tprivate readonly _buff: Uint8Array;\n\tprivate readonly _buffDV: DataView;\n\tprivate _buffLen: number;\n\tprivate _totalLen: number;\n\tprivate _leftoverHighSurrogate: number;\n\tprivate _finished: boolean;\n\n\tconstructor() {\n\t\tthis._buff = new Uint8Array(SHA1Constant.BLOCK_SIZE + 3 /* to fit any utf-8 */);\n\t\tthis._buffDV = new DataView(this._buff.buffer);\n\t\tthis._buffLen = 0;\n\t\tthis._totalLen = 0;\n\t\tthis._leftoverHighSurrogate = 0;\n\t\tthis._finished = false;\n\t}\n\n\tpublic update(str: string): void {\n\t\tconst strLen = str.length;\n\t\tif (strLen === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buff = this._buff;\n\t\tlet buffLen = this._buffLen;\n\t\tlet leftoverHighSurrogate = this._leftoverHighSurrogate;\n\t\tlet charCode: number;\n\t\tlet offset: number;\n\n\t\tif (leftoverHighSurrogate !== 0) {\n\t\t\tcharCode = leftoverHighSurrogate;\n\t\t\toffset = -1;\n\t\t\tleftoverHighSurrogate = 0;\n\t\t} else {\n\t\t\tcharCode = str.charCodeAt(0);\n\t\t\toffset = 0;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tlet codePoint = charCode;\n\t\t\tif (strings.isHighSurrogate(charCode)) {\n\t\t\t\tif (offset + 1 < strLen) {\n\t\t\t\t\tconst nextCharCode = str.charCodeAt(offset + 1);\n\t\t\t\t\tif (strings.isLowSurrogate(nextCharCode)) {\n\t\t\t\t\t\toffset++;\n\t\t\t\t\t\tcodePoint = strings.computeCodePoint(charCode, nextCharCode);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// illegal => unicode replacement character\n\t\t\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// last character is a surrogate pair\n\t\t\t\t\tleftoverHighSurrogate = charCode;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (strings.isLowSurrogate(charCode)) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tcodePoint = SHA1Constant.UNICODE_REPLACEMENT;\n\t\t\t}\n\n\t\t\tbuffLen = this._push(buff, buffLen, codePoint);\n\t\t\toffset++;\n\t\t\tif (offset < strLen) {\n\t\t\t\tcharCode = str.charCodeAt(offset);\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._buffLen = buffLen;\n\t\tthis._leftoverHighSurrogate = leftoverHighSurrogate;\n\t}\n\n\tprivate _push(buff: Uint8Array, buffLen: number, codePoint: number): number {\n\t\tif (codePoint < 0x0080) {\n\t\t\tbuff[buffLen++] = codePoint;\n\t\t} else if (codePoint < 0x0800) {\n\t\t\tbuff[buffLen++] = 0b11000000 | ((codePoint & 0b00000000000000000000011111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else if (codePoint < 0x10000) {\n\t\t\tbuff[buffLen++] = 0b11100000 | ((codePoint & 0b00000000000000001111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t} else {\n\t\t\tbuff[buffLen++] = 0b11110000 | ((codePoint & 0b00000000000111000000000000000000) >>> 18);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000111111000000000000) >>> 12);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000111111000000) >>> 6);\n\t\t\tbuff[buffLen++] = 0b10000000 | ((codePoint & 0b00000000000000000000000000111111) >>> 0);\n\t\t}\n\n\t\tif (buffLen >= SHA1Constant.BLOCK_SIZE) {\n\t\t\tthis._step();\n\t\t\tbuffLen -= SHA1Constant.BLOCK_SIZE;\n\t\t\tthis._totalLen += SHA1Constant.BLOCK_SIZE;\n\t\t\t// take last 3 in case of UTF8 overflow\n\t\t\tbuff[0] = buff[SHA1Constant.BLOCK_SIZE + 0];\n\t\t\tbuff[1] = buff[SHA1Constant.BLOCK_SIZE + 1];\n\t\t\tbuff[2] = buff[SHA1Constant.BLOCK_SIZE + 2];\n\t\t}\n\n\t\treturn buffLen;\n\t}\n\n\tpublic digest(): string {\n\t\tif (!this._finished) {\n\t\t\tthis._finished = true;\n\t\t\tif (this._leftoverHighSurrogate) {\n\t\t\t\t// illegal => unicode replacement character\n\t\t\t\tthis._leftoverHighSurrogate = 0;\n\t\t\t\tthis._buffLen = this._push(this._buff, this._buffLen, SHA1Constant.UNICODE_REPLACEMENT);\n\t\t\t}\n\t\t\tthis._totalLen += this._buffLen;\n\t\t\tthis._wrapUp();\n\t\t}\n\n\t\treturn toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);\n\t}\n\n\tprivate _wrapUp(): void {\n\t\tthis._buff[this._buffLen++] = 0x80;\n\t\tfill(this._buff, this._buffLen);\n\n\t\tif (this._buffLen > 56) {\n\t\t\tthis._step();\n\t\t\tfill(this._buff);\n\t\t}\n\n\t\t// this will fit because the mantissa can cover up to 52 bits\n\t\tconst ml = 8 * this._totalLen;\n\n\t\tthis._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);\n\t\tthis._buffDV.setUint32(60, ml % 4294967296, false);\n\n\t\tthis._step();\n\t}\n\n\tprivate _step(): void {\n\t\tconst bigBlock32 = StringSHA1._bigBlock32;\n\t\tconst data = this._buffDV;\n\n\t\tfor (let j = 0; j < 64 /* 16*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, data.getUint32(j, false), false);\n\t\t}\n\n\t\tfor (let j = 64; j < 320 /* 80*4 */; j += 4) {\n\t\t\tbigBlock32.setUint32(j, leftRotate((bigBlock32.getUint32(j - 12, false) ^ bigBlock32.getUint32(j - 32, false) ^ bigBlock32.getUint32(j - 56, false) ^ bigBlock32.getUint32(j - 64, false)), 1), false);\n\t\t}\n\n\t\tlet a = this._h0;\n\t\tlet b = this._h1;\n\t\tlet c = this._h2;\n\t\tlet d = this._h3;\n\t\tlet e = this._h4;\n\n\t\tlet f: number, k: number;\n\t\tlet temp: number;\n\n\t\tfor (let j = 0; j < 80; j++) {\n\t\t\tif (j < 20) {\n\t\t\t\tf = (b & c) | ((~b) & d);\n\t\t\t\tk = 0x5A827999;\n\t\t\t} else if (j < 40) {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0x6ED9EBA1;\n\t\t\t} else if (j < 60) {\n\t\t\t\tf = (b & c) | (b & d) | (c & d);\n\t\t\t\tk = 0x8F1BBCDC;\n\t\t\t} else {\n\t\t\t\tf = b ^ c ^ d;\n\t\t\t\tk = 0xCA62C1D6;\n\t\t\t}\n\n\t\t\ttemp = (leftRotate(a, 5) + f + e + k + bigBlock32.getUint32(j * 4, false)) & 0xffffffff;\n\t\t\te = d;\n\t\t\td = c;\n\t\t\tc = leftRotate(b, 30);\n\t\t\tb = a;\n\t\t\ta = temp;\n\t\t}\n\n\t\tthis._h0 = (this._h0 + a) & 0xffffffff;\n\t\tthis._h1 = (this._h1 + b) & 0xffffffff;\n\t\tthis._h2 = (this._h2 + c) & 0xffffffff;\n\t\tthis._h3 = (this._h3 + d) & 0xffffffff;\n\t\tthis._h4 = (this._h4 + e) & 0xffffffff;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from 'vs/base/browser/browser';\nimport { BrowserFeatures } from 'vs/base/browser/canIUse';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { AbstractIdleValue, IntervalTimer, TimeoutTimer, _runWhenIdle, IdleDeadline } from 'vs/base/common/async';\nimport { onUnexpectedError } from 'vs/base/common/errors';\nimport * as event from 'vs/base/common/event';\nimport { KeyCode } from 'vs/base/common/keyCodes';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { hash } from 'vs/base/common/hash';\nimport { CodeWindow, ensureCodeWindow, mainWindow } from 'vs/base/browser/window';\nimport { isPointWithinTriangle } from 'vs/base/common/numbers';\n\nexport interface IRegisteredCodeWindow {\n\treadonly window: CodeWindow;\n\treadonly disposables: DisposableStore;\n}\n\n//# region Multi-Window Support Utilities\n\nexport const {\n\tregisterWindow,\n\tgetWindow,\n\tgetDocument,\n\tgetWindows,\n\tgetWindowsCount,\n\tgetWindowId,\n\tgetWindowById,\n\thasWindow,\n\tonDidRegisterWindow,\n\tonWillUnregisterWindow,\n\tonDidUnregisterWindow\n} = (function () {\n\tconst windows = new Map();\n\n\tensureCodeWindow(mainWindow, 1);\n\tconst mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };\n\twindows.set(mainWindow.vscodeWindowId, mainWindowRegistration);\n\n\tconst onDidRegisterWindow = new event.Emitter();\n\tconst onDidUnregisterWindow = new event.Emitter();\n\tconst onWillUnregisterWindow = new event.Emitter();\n\n\tfunction getWindowById(windowId: number): IRegisteredCodeWindow | undefined;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain: true): IRegisteredCodeWindow;\n\tfunction getWindowById(windowId: number | undefined, fallbackToMain?: boolean): IRegisteredCodeWindow | undefined {\n\t\tconst window = typeof windowId === 'number' ? windows.get(windowId) : undefined;\n\n\t\treturn window ?? (fallbackToMain ? mainWindowRegistration : undefined);\n\t}\n\n\treturn {\n\t\tonDidRegisterWindow: onDidRegisterWindow.event,\n\t\tonWillUnregisterWindow: onWillUnregisterWindow.event,\n\t\tonDidUnregisterWindow: onDidUnregisterWindow.event,\n\t\tregisterWindow(window: CodeWindow): IDisposable {\n\t\t\tif (windows.has(window.vscodeWindowId)) {\n\t\t\t\treturn Disposable.None;\n\t\t\t}\n\n\t\t\tconst disposables = new DisposableStore();\n\n\t\t\tconst registeredWindow = {\n\t\t\t\twindow,\n\t\t\t\tdisposables: disposables.add(new DisposableStore())\n\t\t\t};\n\t\t\twindows.set(window.vscodeWindowId, registeredWindow);\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\twindows.delete(window.vscodeWindowId);\n\t\t\t\tonDidUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tdisposables.add(addDisposableListener(window, EventType.BEFORE_UNLOAD, () => {\n\t\t\t\tonWillUnregisterWindow.fire(window);\n\t\t\t}));\n\n\t\t\tonDidRegisterWindow.fire(registeredWindow);\n\n\t\t\treturn disposables;\n\t\t},\n\t\tgetWindows(): Iterable {\n\t\t\treturn windows.values();\n\t\t},\n\t\tgetWindowsCount(): number {\n\t\t\treturn windows.size;\n\t\t},\n\t\tgetWindowId(targetWindow: Window): number {\n\t\t\treturn (targetWindow as CodeWindow).vscodeWindowId;\n\t\t},\n\t\thasWindow(windowId: number): boolean {\n\t\t\treturn windows.has(windowId);\n\t\t},\n\t\tgetWindowById,\n\t\tgetWindow(e: Node | UIEvent | undefined | null): CodeWindow {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\tif (candidateNode?.ownerDocument?.defaultView) {\n\t\t\t\treturn candidateNode.ownerDocument.defaultView.window as CodeWindow;\n\t\t\t}\n\n\t\t\tconst candidateEvent = e as UIEvent | undefined | null;\n\t\t\tif (candidateEvent?.view) {\n\t\t\t\treturn candidateEvent.view.window as CodeWindow;\n\t\t\t}\n\n\t\t\treturn mainWindow;\n\t\t},\n\t\tgetDocument(e: Node | UIEvent | undefined | null): Document {\n\t\t\tconst candidateNode = e as Node | undefined | null;\n\t\t\treturn getWindow(candidateNode).document;\n\t\t}\n\t};\n})();\n\n//#endregion\n\nexport function clearNode(node: HTMLElement): void {\n\twhile (node.firstChild) {\n\t\tnode.firstChild.remove();\n\t}\n}\n\n\nexport function clearNodeRecursively(domNode: ChildNode) {\n\twhile (domNode.firstChild) {\n\t\tconst element = domNode.firstChild;\n\t\telement.remove();\n\t\tclearNodeRecursively(element);\n\t}\n}\n\n\nclass DomListener implements IDisposable {\n\n\tprivate _handler: (e: any) => void;\n\tprivate _node: EventTarget;\n\tprivate readonly _type: string;\n\tprivate readonly _options: boolean | AddEventListenerOptions;\n\n\tconstructor(node: EventTarget, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {\n\t\tthis._node = node;\n\t\tthis._type = type;\n\t\tthis._handler = handler;\n\t\tthis._options = (options || false);\n\t\tthis._node.addEventListener(this._type, this._handler, this._options);\n\t}\n\n\tdispose(): void {\n\t\tif (!this._handler) {\n\t\t\t// Already disposed\n\t\t\treturn;\n\t\t}\n\n\t\tthis._node.removeEventListener(this._type, this._handler, this._options);\n\n\t\t// Prevent leakers from holding on to the dom or handler func\n\t\tthis._node = null!;\n\t\tthis._handler = null!;\n\t}\n}\n\nexport function addDisposableListener(node: EventTarget, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, options: AddEventListenerOptions): IDisposable;\nexport function addDisposableListener(node: EventTarget, type: string, handler: (event: any) => void, useCaptureOrOptions?: boolean | AddEventListenerOptions): IDisposable {\n\treturn new DomListener(node, type, handler, useCaptureOrOptions);\n}\n\nexport interface IAddStandardDisposableListenerSignature {\n\t(node: HTMLElement, type: 'click', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'mousedown', handler: (event: IMouseEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keydown', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keypress', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'keyup', handler: (event: IKeyboardEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerdown', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointermove', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: 'pointerup', handler: (event: PointerEvent) => void, useCapture?: boolean): IDisposable;\n\t(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;\n}\nfunction _wrapAsStandardMouseEvent(targetWindow: Window, handler: (e: IMouseEvent) => void): (e: MouseEvent) => void {\n\treturn function (e: MouseEvent) {\n\t\treturn handler(new StandardMouseEvent(targetWindow, e));\n\t};\n}\nfunction _wrapAsStandardKeyboardEvent(handler: (e: IKeyboardEvent) => void): (e: KeyboardEvent) => void {\n\treturn function (e: KeyboardEvent) {\n\t\treturn handler(new StandardKeyboardEvent(e));\n\t};\n}\nexport const addStandardDisposableListener: IAddStandardDisposableListenerSignature = function addStandardDisposableListener(node: HTMLElement, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tlet wrapHandler = handler;\n\n\tif (type === 'click' || type === 'mousedown' || type === 'contextmenu') {\n\t\twrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\t} else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {\n\t\twrapHandler = _wrapAsStandardKeyboardEvent(handler);\n\t}\n\n\treturn addDisposableListener(node, type, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);\n};\n\nexport const addStandardDisposableGenericMouseUpListener = function addStandardDisposableListener(node: HTMLElement, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\tconst wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);\n\n\treturn addDisposableGenericMouseUpListener(node, wrapHandler, useCapture);\n};\nexport function addDisposableGenericMouseDownListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseMoveListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_MOVE : EventType.MOUSE_MOVE, handler, useCapture);\n}\n\nexport function addDisposableGenericMouseUpListener(node: EventTarget, handler: (event: any) => void, useCapture?: boolean): IDisposable {\n\treturn addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);\n}\n\n/**\n * Execute the callback the next time the browser is idle, returning an\n * {@link IDisposable} that will cancel the callback when disposed. This wraps\n * [requestIdleCallback] so it will fallback to [setTimeout] if the environment\n * doesn't support it.\n *\n * @param targetWindow The window for which to run the idle callback\n * @param callback The callback to run when idle, this includes an\n * [IdleDeadline] that provides the time alloted for the idle callback by the\n * browser. Not respecting this deadline will result in a degraded user\n * experience.\n * @param timeout A timeout at which point to queue no longer wait for an idle\n * callback but queue it on the regular event loop (like setTimeout). Typically\n * this should not be used.\n *\n * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline\n * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback\n * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout\n */\nexport function runWhenWindowIdle(targetWindow: Window | typeof globalThis, callback: (idle: IdleDeadline) => void, timeout?: number): IDisposable {\n\treturn _runWhenIdle(targetWindow, callback, timeout);\n}\n\n/**\n * An implementation of the \"idle-until-urgent\"-strategy as introduced\n * here: https://philipwalton.com/articles/idle-until-urgent/\n */\nexport class WindowIdleValue extends AbstractIdleValue {\n\tconstructor(targetWindow: Window | typeof globalThis, executor: () => T) {\n\t\tsuper(targetWindow, executor);\n\t}\n}\n\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed immediately.\n * @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).\n */\nexport let runAtThisOrScheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n/**\n * Schedule a callback to be run at the next animation frame.\n * This allows multiple parties to register callbacks that should run at the next animation frame.\n * If currently in an animation frame, `runner` will be executed at the next animation frame.\n * @return token that can be used to cancel the scheduled runner.\n */\nexport let scheduleAtNextAnimationFrame: (targetWindow: Window, runner: () => void, priority?: number) => IDisposable;\n\nexport function disposableWindowInterval(targetWindow: Window, handler: () => void | boolean /* stop interval */ | Promise, interval: number, iterations?: number): IDisposable {\n\tlet iteration = 0;\n\tconst timer = targetWindow.setInterval(() => {\n\t\titeration++;\n\t\tif ((typeof iterations === 'number' && iteration >= iterations) || handler() === true) {\n\t\t\tdisposable.dispose();\n\t\t}\n\t}, interval);\n\tconst disposable = toDisposable(() => {\n\t\ttargetWindow.clearInterval(timer);\n\t});\n\treturn disposable;\n}\n\nexport class WindowIntervalTimer extends IntervalTimer {\n\n\tprivate readonly defaultTarget?: Window & typeof globalThis;\n\n\t/**\n\t *\n\t * @param node The optional node from which the target window is determined\n\t */\n\tconstructor(node?: Node) {\n\t\tsuper();\n\t\tthis.defaultTarget = node && getWindow(node);\n\t}\n\n\toverride cancelAndSet(runner: () => void, interval: number, targetWindow?: Window & typeof globalThis): void {\n\t\treturn super.cancelAndSet(runner, interval, targetWindow ?? this.defaultTarget);\n\t}\n}\n\nclass AnimationFrameQueueItem implements IDisposable {\n\n\tprivate _runner: () => void;\n\tpublic priority: number;\n\tprivate _canceled: boolean;\n\n\tconstructor(runner: () => void, priority: number = 0) {\n\t\tthis._runner = runner;\n\t\tthis.priority = priority;\n\t\tthis._canceled = false;\n\t}\n\n\tdispose(): void {\n\t\tthis._canceled = true;\n\t}\n\n\texecute(): void {\n\t\tif (this._canceled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis._runner();\n\t\t} catch (e) {\n\t\t\tonUnexpectedError(e);\n\t\t}\n\t}\n\n\t// Sort by priority (largest to lowest)\n\tstatic sort(a: AnimationFrameQueueItem, b: AnimationFrameQueueItem): number {\n\t\treturn b.priority - a.priority;\n\t}\n}\n\n(function () {\n\t/**\n\t * The runners scheduled at the next animation frame\n\t */\n\tconst NEXT_QUEUE = new Map();\n\t/**\n\t * The runners scheduled at the current animation frame\n\t */\n\tconst CURRENT_QUEUE = new Map();\n\t/**\n\t * A flag to keep track if the native requestAnimationFrame was already called\n\t */\n\tconst animFrameRequested = new Map();\n\t/**\n\t * A flag to indicate if currently handling a native requestAnimationFrame callback\n\t */\n\tconst inAnimationFrameRunner = new Map();\n\n\tconst animationFrameRunner = (targetWindowId: number) => {\n\t\tanimFrameRequested.set(targetWindowId, false);\n\n\t\tconst currentQueue = NEXT_QUEUE.get(targetWindowId) ?? [];\n\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\tNEXT_QUEUE.set(targetWindowId, []);\n\n\t\tinAnimationFrameRunner.set(targetWindowId, true);\n\t\twhile (currentQueue.length > 0) {\n\t\t\tcurrentQueue.sort(AnimationFrameQueueItem.sort);\n\t\t\tconst top = currentQueue.shift()!;\n\t\t\ttop.execute();\n\t\t}\n\t\tinAnimationFrameRunner.set(targetWindowId, false);\n\t};\n\n\tscheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority: number = 0) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\n\t\tlet nextQueue = NEXT_QUEUE.get(targetWindowId);\n\t\tif (!nextQueue) {\n\t\t\tnextQueue = [];\n\t\t\tNEXT_QUEUE.set(targetWindowId, nextQueue);\n\t\t}\n\t\tnextQueue.push(item);\n\n\t\tif (!animFrameRequested.get(targetWindowId)) {\n\t\t\tanimFrameRequested.set(targetWindowId, true);\n\t\t\ttargetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));\n\t\t}\n\n\t\treturn item;\n\t};\n\n\trunAtThisOrScheduleAtNextAnimationFrame = (targetWindow: Window, runner: () => void, priority?: number) => {\n\t\tconst targetWindowId = getWindowId(targetWindow);\n\t\tif (inAnimationFrameRunner.get(targetWindowId)) {\n\t\t\tconst item = new AnimationFrameQueueItem(runner, priority);\n\t\t\tlet currentQueue = CURRENT_QUEUE.get(targetWindowId);\n\t\t\tif (!currentQueue) {\n\t\t\t\tcurrentQueue = [];\n\t\t\t\tCURRENT_QUEUE.set(targetWindowId, currentQueue);\n\t\t\t}\n\t\t\tcurrentQueue.push(item);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn scheduleAtNextAnimationFrame(targetWindow, runner, priority);\n\t\t}\n\t};\n})();\n\nexport function measure(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, 10000 /* must be early */);\n}\n\nexport function modify(targetWindow: Window, callback: () => void): IDisposable {\n\treturn scheduleAtNextAnimationFrame(targetWindow, callback, -10000 /* must be late */);\n}\n\n/**\n * Add a throttled listener. `handler` is fired at most every 8.33333ms or with the next animation frame (if browser supports it).\n */\nexport interface IEventMerger {\n\t(lastEvent: R | null, currentEvent: E): R;\n}\n\nconst MINIMUM_TIME_MS = 8;\nconst DEFAULT_EVENT_MERGER: IEventMerger = function (lastEvent: Event | null, currentEvent: Event) {\n\treturn currentEvent;\n};\n\nclass TimeoutThrottledDomListener extends Disposable {\n\n\tconstructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger = DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {\n\t\tsuper();\n\n\t\tlet lastEvent: R | null = null;\n\t\tlet lastHandlerTime = 0;\n\t\tconst timeout = this._register(new TimeoutTimer());\n\n\t\tconst invokeHandler = () => {\n\t\t\tlastHandlerTime = (new Date()).getTime();\n\t\t\thandler(lastEvent);\n\t\t\tlastEvent = null;\n\t\t};\n\n\t\tthis._register(addDisposableListener(node, type, (e) => {\n\n\t\t\tlastEvent = eventMerger(lastEvent, e);\n\t\t\tconst elapsedTime = (new Date()).getTime() - lastHandlerTime;\n\n\t\t\tif (elapsedTime >= minimumTimeMs) {\n\t\t\t\ttimeout.cancel();\n\t\t\t\tinvokeHandler();\n\t\t\t} else {\n\t\t\t\ttimeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);\n\t\t\t}\n\t\t}));\n\t}\n}\n\nexport function addDisposableThrottledListener(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger, minimumTimeMs?: number): IDisposable {\n\treturn new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);\n}\n\nexport function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {\n\treturn getWindow(el).getComputedStyle(el, null);\n}\n\nexport function getClientArea(element: HTMLElement, fallback?: HTMLElement): Dimension {\n\tconst elWindow = getWindow(element);\n\tconst elDocument = elWindow.document;\n\n\t// Try with DOM clientWidth / clientHeight\n\tif (element !== elDocument.body) {\n\t\treturn new Dimension(element.clientWidth, element.clientHeight);\n\t}\n\n\t// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight\n\tif (platform.isIOS && elWindow?.visualViewport) {\n\t\treturn new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);\n\t}\n\n\t// Try innerWidth / innerHeight\n\tif (elWindow?.innerWidth && elWindow.innerHeight) {\n\t\treturn new Dimension(elWindow.innerWidth, elWindow.innerHeight);\n\t}\n\n\t// Try with document.body.clientWidth / document.body.clientHeight\n\tif (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {\n\t\treturn new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);\n\t}\n\n\t// Try with document.documentElement.clientWidth / document.documentElement.clientHeight\n\tif (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {\n\t\treturn new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);\n\t}\n\n\tif (fallback) {\n\t\treturn getClientArea(fallback);\n\t}\n\n\tthrow new Error('Unable to figure out browser width and height');\n}\n\nclass SizeUtils {\n\t// Adapted from WinJS\n\t// Converts a CSS positioning string for the specified element to pixels.\n\tprivate static convertToPixels(element: HTMLElement, value: string): number {\n\t\treturn parseFloat(value) || 0;\n\t}\n\n\tprivate static getDimension(element: HTMLElement, cssPropertyName: string, jsPropertyName: string): number {\n\t\tconst computedStyle = getComputedStyle(element);\n\t\tconst value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : '0';\n\t\treturn SizeUtils.convertToPixels(element, value);\n\t}\n\n\tstatic getBorderLeftWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');\n\t}\n\tstatic getBorderRightWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');\n\t}\n\tstatic getBorderTopWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');\n\t}\n\tstatic getBorderBottomWidth(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');\n\t}\n\n\tstatic getPaddingLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');\n\t}\n\tstatic getPaddingRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-right', 'paddingRight');\n\t}\n\tstatic getPaddingTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-top', 'paddingTop');\n\t}\n\tstatic getPaddingBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');\n\t}\n\n\tstatic getMarginLeft(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-left', 'marginLeft');\n\t}\n\tstatic getMarginTop(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-top', 'marginTop');\n\t}\n\tstatic getMarginRight(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-right', 'marginRight');\n\t}\n\tstatic getMarginBottom(element: HTMLElement): number {\n\t\treturn SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');\n\t}\n}\n\n// ----------------------------------------------------------------------------------------\n// Position & Dimension\n\nexport interface IDimension {\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport class Dimension implements IDimension {\n\n\tstatic readonly None = new Dimension(0, 0);\n\n\tconstructor(\n\t\treadonly width: number,\n\t\treadonly height: number,\n\t) { }\n\n\twith(width: number = this.width, height: number = this.height): Dimension {\n\t\tif (width !== this.width || height !== this.height) {\n\t\t\treturn new Dimension(width, height);\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\tstatic is(obj: unknown): obj is IDimension {\n\t\treturn typeof obj === 'object' && typeof (obj).height === 'number' && typeof (obj).width === 'number';\n\t}\n\n\tstatic lift(obj: IDimension): Dimension {\n\t\tif (obj instanceof Dimension) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\treturn new Dimension(obj.width, obj.height);\n\t\t}\n\t}\n\n\tstatic equals(a: Dimension | undefined, b: Dimension | undefined): boolean {\n\t\tif (a === b) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!a || !b) {\n\t\t\treturn false;\n\t\t}\n\t\treturn a.width === b.width && a.height === b.height;\n\t}\n}\n\nexport interface IDomPosition {\n\treadonly left: number;\n\treadonly top: number;\n}\n\nexport function getTopLeftOffset(element: HTMLElement): IDomPosition {\n\t// Adapted from WinJS.Utilities.getPosition\n\t// and added borders to the mix\n\n\tlet offsetParent = element.offsetParent;\n\tlet top = element.offsetTop;\n\tlet left = element.offsetLeft;\n\n\twhile (\n\t\t(element = element.parentNode) !== null\n\t\t&& element !== element.ownerDocument.body\n\t\t&& element !== element.ownerDocument.documentElement\n\t) {\n\t\ttop -= element.scrollTop;\n\t\tconst c = isShadowRoot(element) ? null : getComputedStyle(element);\n\t\tif (c) {\n\t\t\tleft -= c.direction !== 'rtl' ? element.scrollLeft : -element.scrollLeft;\n\t\t}\n\n\t\tif (element === offsetParent) {\n\t\t\tleft += SizeUtils.getBorderLeftWidth(element);\n\t\t\ttop += SizeUtils.getBorderTopWidth(element);\n\t\t\ttop += element.offsetTop;\n\t\t\tleft += element.offsetLeft;\n\t\t\toffsetParent = element.offsetParent;\n\t\t}\n\t}\n\n\treturn {\n\t\tleft: left,\n\t\ttop: top\n\t};\n}\n\nexport interface IDomNodePagePosition {\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n}\n\nexport function size(element: HTMLElement, width: number | null, height: number | null): void {\n\tif (typeof width === 'number') {\n\t\telement.style.width = `${width}px`;\n\t}\n\n\tif (typeof height === 'number') {\n\t\telement.style.height = `${height}px`;\n\t}\n}\n\nexport function position(element: HTMLElement, top: number, right?: number, bottom?: number, left?: number, position: string = 'absolute'): void {\n\tif (typeof top === 'number') {\n\t\telement.style.top = `${top}px`;\n\t}\n\n\tif (typeof right === 'number') {\n\t\telement.style.right = `${right}px`;\n\t}\n\n\tif (typeof bottom === 'number') {\n\t\telement.style.bottom = `${bottom}px`;\n\t}\n\n\tif (typeof left === 'number') {\n\t\telement.style.left = `${left}px`;\n\t}\n\n\telement.style.position = position;\n}\n\n/**\n * Returns the position of a dom node relative to the entire page.\n */\nexport function getDomNodePagePosition(domNode: HTMLElement): IDomNodePagePosition {\n\tconst bb = domNode.getBoundingClientRect();\n\tconst window = getWindow(domNode);\n\treturn {\n\t\tleft: bb.left + window.scrollX,\n\t\ttop: bb.top + window.scrollY,\n\t\twidth: bb.width,\n\t\theight: bb.height\n\t};\n}\n\n/**\n * Returns the effective zoom on a given element before window zoom level is applied\n */\nexport function getDomNodeZoomLevel(domNode: HTMLElement): number {\n\tlet testElement: HTMLElement | null = domNode;\n\tlet zoom = 1.0;\n\tdo {\n\t\tconst elementZoomLevel = (getComputedStyle(testElement) as any).zoom;\n\t\tif (elementZoomLevel !== null && elementZoomLevel !== undefined && elementZoomLevel !== '1') {\n\t\t\tzoom *= elementZoomLevel;\n\t\t}\n\n\t\ttestElement = testElement.parentElement;\n\t} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);\n\n\treturn zoom;\n}\n\n\n// Adapted from WinJS\n// Gets the width of the element, including margins.\nexport function getTotalWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.offsetWidth + margin;\n}\n\nexport function getContentWidth(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);\n\tconst padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);\n\treturn element.offsetWidth - border - padding;\n}\n\nexport function getTotalScrollWidth(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);\n\treturn element.scrollWidth + margin;\n}\n\n// Adapted from WinJS\n// Gets the height of the content of the specified element. The content height does not include borders or padding.\nexport function getContentHeight(element: HTMLElement): number {\n\tconst border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);\n\tconst padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);\n\treturn element.offsetHeight - border - padding;\n}\n\n// Adapted from WinJS\n// Gets the height of the element, including its margins.\nexport function getTotalHeight(element: HTMLElement): number {\n\tconst margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);\n\treturn element.offsetHeight + margin;\n}\n\n// Gets the left coordinate of the specified element relative to the specified parent.\nfunction getRelativeLeft(element: HTMLElement, parent: HTMLElement): number {\n\tif (element === null) {\n\t\treturn 0;\n\t}\n\n\tconst elementPosition = getTopLeftOffset(element);\n\tconst parentPosition = getTopLeftOffset(parent);\n\treturn elementPosition.left - parentPosition.left;\n}\n\nexport function getLargestChildWidth(parent: HTMLElement, children: HTMLElement[]): number {\n\tconst childWidths = children.map((child) => {\n\t\treturn Math.max(getTotalScrollWidth(child), getTotalWidth(child)) + getRelativeLeft(child, parent) || 0;\n\t});\n\tconst maxWidth = Math.max(...childWidths);\n\treturn maxWidth;\n}\n\n// ----------------------------------------------------------------------------------------\n\nexport function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean {\n\treturn Boolean(testAncestor?.contains(testChild));\n}\n\nconst parentFlowToDataKey = 'parentFlowToElementId';\n\n/**\n * Set an explicit parent to use for nodes that are not part of the\n * regular dom structure.\n */\nexport function setParentFlowTo(fromChildElement: HTMLElement, toParentElement: Element): void {\n\tfromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;\n}\n\nfunction getParentFlowToElement(node: HTMLElement): HTMLElement | null {\n\tconst flowToParentId = node.dataset[parentFlowToDataKey];\n\tif (typeof flowToParentId === 'string') {\n\t\treturn node.ownerDocument.getElementById(flowToParentId);\n\t}\n\treturn null;\n}\n\n/**\n * Check if `testAncestor` is an ancestor of `testChild`, observing the explicit\n * parents set by `setParentFlowTo`.\n */\nexport function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean {\n\tlet node: Node | null = testChild;\n\twhile (node) {\n\t\tif (node === testAncestor) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (isHTMLElement(node)) {\n\t\t\tconst flowToParentElement = getParentFlowToElement(node);\n\t\t\tif (flowToParentElement) {\n\t\t\t\tnode = flowToParentElement;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n\n\treturn false;\n}\n\nexport function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (node.classList.contains(clazz)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tif (stopAtClazzOrNode) {\n\t\t\tif (typeof stopAtClazzOrNode === 'string') {\n\t\t\t\tif (node.classList.contains(stopAtClazzOrNode)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (node === stopAtClazzOrNode) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): boolean {\n\treturn !!findParentWithClass(node, clazz, stopAtClazzOrNode);\n}\n\nexport function isShadowRoot(node: Node): node is ShadowRoot {\n\treturn (\n\t\tnode && !!(node).host && !!(node).mode\n\t);\n}\n\nexport function isInShadowDOM(domNode: Node): boolean {\n\treturn !!getShadowRoot(domNode);\n}\n\nexport function getShadowRoot(domNode: Node): ShadowRoot | null {\n\twhile (domNode.parentNode) {\n\t\tif (domNode === domNode.ownerDocument?.body) {\n\t\t\t// reached the body\n\t\t\treturn null;\n\t\t}\n\t\tdomNode = domNode.parentNode;\n\t}\n\treturn isShadowRoot(domNode) ? domNode : null;\n}\n\n/**\n * Returns the active element across all child windows\n * based on document focus. Falls back to the main\n * window if no window has focus.\n */\nexport function getActiveElement(): Element | null {\n\tlet result = getActiveDocument().activeElement;\n\n\twhile (result?.shadowRoot) {\n\t\tresult = result.shadowRoot.activeElement;\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns true if the focused window active element matches\n * the provided element. Falls back to the main window if no\n * window has focus.\n */\nexport function isActiveElement(element: Element): boolean {\n\treturn getActiveElement() === element;\n}\n\n/**\n * Returns true if the focused window active element is contained in\n * `ancestor`. Falls back to the main window if no window has focus.\n */\nexport function isAncestorOfActiveElement(ancestor: Element): boolean {\n\treturn isAncestor(getActiveElement(), ancestor);\n}\n\n/**\n * Returns whether the element is in the active `document`. The active\n * document has focus or will be the main windows document.\n */\nexport function isActiveDocument(element: Element): boolean {\n\treturn element.ownerDocument === getActiveDocument();\n}\n\n/**\n * Returns the active document across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main windows document.\n */\nexport function getActiveDocument(): Document {\n\tif (getWindowsCount() <= 1) {\n\t\treturn mainWindow.document;\n\t}\n\n\tconst documents = Array.from(getWindows()).map(({ window }) => window.document);\n\treturn documents.find(doc => doc.hasFocus()) ?? mainWindow.document;\n}\n\n/**\n * Returns the active window across main and child windows.\n * Prefers the window with focus, otherwise falls back to\n * the main window.\n */\nexport function getActiveWindow(): CodeWindow {\n\tconst document = getActiveDocument();\n\treturn (document.defaultView?.window ?? mainWindow) as CodeWindow;\n}\n\nconst globalStylesheets = new Map>();\n\nexport function isGlobalStylesheet(node: Node): boolean {\n\treturn globalStylesheets.has(node as HTMLStyleElement);\n}\n\n/**\n * A version of createStyleSheet which has a unified API to initialize/set the style content.\n */\nexport function createStyleSheet2(): WrappedStyleElement {\n\treturn new WrappedStyleElement();\n}\n\nclass WrappedStyleElement {\n\tprivate _currentCssStyle = '';\n\tprivate _styleSheet: HTMLStyleElement | undefined = undefined;\n\n\tpublic setStyle(cssStyle: string): void {\n\t\tif (cssStyle === this._currentCssStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._currentCssStyle = cssStyle;\n\n\t\tif (!this._styleSheet) {\n\t\t\tthis._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);\n\t\t} else {\n\t\t\tthis._styleSheet.innerText = cssStyle;\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this._styleSheet) {\n\t\t\tthis._styleSheet.remove();\n\t\t\tthis._styleSheet = undefined;\n\t\t}\n\t}\n}\n\nexport function createStyleSheet(container: HTMLElement = mainWindow.document.head, beforeAppend?: (style: HTMLStyleElement) => void, disposableStore?: DisposableStore): HTMLStyleElement {\n\tconst style = document.createElement('style');\n\tstyle.type = 'text/css';\n\tstyle.media = 'screen';\n\tbeforeAppend?.(style);\n\tcontainer.appendChild(style);\n\n\tif (disposableStore) {\n\t\tdisposableStore.add(toDisposable(() => style.remove()));\n\t}\n\n\t// With as container, the stylesheet becomes global and is tracked\n\t// to support auxiliary windows to clone the stylesheet.\n\tif (container === mainWindow.document.head) {\n\t\tconst globalStylesheetClones = new Set();\n\t\tglobalStylesheets.set(style, globalStylesheetClones);\n\n\t\tfor (const { window: targetWindow, disposables } of getWindows()) {\n\t\t\tif (targetWindow === mainWindow) {\n\t\t\t\tcontinue; // main window is already tracked\n\t\t\t}\n\n\t\t\tconst cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));\n\t\t\tdisposableStore?.add(cloneDisposable);\n\t\t}\n\t}\n\n\treturn style;\n}\n\nexport function cloneGlobalStylesheets(targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tfor (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {\n\t\tdisposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));\n\t}\n\n\treturn disposables;\n}\n\nfunction cloneGlobalStyleSheet(globalStylesheet: HTMLStyleElement, globalStylesheetClones: Set, targetWindow: Window): IDisposable {\n\tconst disposables = new DisposableStore();\n\n\tconst clone = globalStylesheet.cloneNode(true) as HTMLStyleElement;\n\ttargetWindow.document.head.appendChild(clone);\n\tdisposables.add(toDisposable(() => clone.remove()));\n\n\tfor (const rule of getDynamicStyleSheetRules(globalStylesheet)) {\n\t\tclone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);\n\t}\n\n\tdisposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {\n\t\tclone.textContent = globalStylesheet.textContent;\n\t}));\n\n\tglobalStylesheetClones.add(clone);\n\tdisposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));\n\n\treturn disposables;\n}\n\ninterface IMutationObserver {\n\tusers: number;\n\treadonly observer: MutationObserver;\n\treadonly onDidMutate: event.Event;\n}\n\nexport const sharedMutationObserver = new class {\n\n\treadonly mutationObservers = new Map>();\n\n\tobserve(target: Node, disposables: DisposableStore, options?: MutationObserverInit): event.Event {\n\t\tlet mutationObserversPerTarget = this.mutationObservers.get(target);\n\t\tif (!mutationObserversPerTarget) {\n\t\t\tmutationObserversPerTarget = new Map();\n\t\t\tthis.mutationObservers.set(target, mutationObserversPerTarget);\n\t\t}\n\n\t\tconst optionsHash = hash(options);\n\t\tlet mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);\n\t\tif (!mutationObserverPerOptions) {\n\t\t\tconst onDidMutate = new event.Emitter();\n\t\t\tconst observer = new MutationObserver(mutations => onDidMutate.fire(mutations));\n\t\t\tobserver.observe(target, options);\n\n\t\t\tconst resolvedMutationObserverPerOptions = mutationObserverPerOptions = {\n\t\t\t\tusers: 1,\n\t\t\t\tobserver,\n\t\t\t\tonDidMutate: onDidMutate.event\n\t\t\t};\n\n\t\t\tdisposables.add(toDisposable(() => {\n\t\t\t\tresolvedMutationObserverPerOptions.users -= 1;\n\n\t\t\t\tif (resolvedMutationObserverPerOptions.users === 0) {\n\t\t\t\t\tonDidMutate.dispose();\n\t\t\t\t\tobserver.disconnect();\n\n\t\t\t\t\tmutationObserversPerTarget?.delete(optionsHash);\n\t\t\t\t\tif (mutationObserversPerTarget?.size === 0) {\n\t\t\t\t\t\tthis.mutationObservers.delete(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\tmutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);\n\t\t} else {\n\t\t\tmutationObserverPerOptions.users += 1;\n\t\t}\n\n\t\treturn mutationObserverPerOptions.onDidMutate;\n\t}\n};\n\nexport function createMetaElement(container: HTMLElement = mainWindow.document.head): HTMLMetaElement {\n\treturn createHeadElement('meta', container) as HTMLMetaElement;\n}\n\nexport function createLinkElement(container: HTMLElement = mainWindow.document.head): HTMLLinkElement {\n\treturn createHeadElement('link', container) as HTMLLinkElement;\n}\n\nfunction createHeadElement(tagName: string, container: HTMLElement = mainWindow.document.head): HTMLElement {\n\tconst element = document.createElement(tagName);\n\tcontainer.appendChild(element);\n\treturn element;\n}\n\nlet _sharedStyleSheet: HTMLStyleElement | null = null;\nfunction getSharedStyleSheet(): HTMLStyleElement {\n\tif (!_sharedStyleSheet) {\n\t\t_sharedStyleSheet = createStyleSheet();\n\t}\n\treturn _sharedStyleSheet;\n}\n\nfunction getDynamicStyleSheetRules(style: HTMLStyleElement) {\n\tif (style?.sheet?.rules) {\n\t\t// Chrome, IE\n\t\treturn style.sheet.rules;\n\t}\n\tif (style?.sheet?.cssRules) {\n\t\t// FF\n\t\treturn style.sheet.cssRules;\n\t}\n\treturn [];\n}\n\nexport function createCSSRule(selector: string, cssText: string, style = getSharedStyleSheet()): void {\n\tif (!style || !cssText) {\n\t\treturn;\n\t}\n\n\tstyle.sheet?.insertRule(`${selector} {${cssText}}`, 0);\n\n\t// Apply rule also to all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tcreateCSSRule(selector, cssText, clonedGlobalStylesheet);\n\t}\n}\n\nexport function removeCSSRulesContainingSelector(ruleName: string, style = getSharedStyleSheet()): void {\n\tif (!style) {\n\t\treturn;\n\t}\n\n\tconst rules = getDynamicStyleSheetRules(style);\n\tconst toDelete: number[] = [];\n\tfor (let i = 0; i < rules.length; i++) {\n\t\tconst rule = rules[i];\n\t\tif (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {\n\t\t\ttoDelete.push(i);\n\t\t}\n\t}\n\n\tfor (let i = toDelete.length - 1; i >= 0; i--) {\n\t\tstyle.sheet?.deleteRule(toDelete[i]);\n\t}\n\n\t// Remove rules also from all cloned global stylesheets\n\tfor (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {\n\t\tremoveCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);\n\t}\n}\n\nfunction isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule {\n\treturn typeof (rule as CSSStyleRule).selectorText === 'string';\n}\n\nexport function isHTMLElement(e: unknown): e is HTMLElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;\n}\n\nexport function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLAnchorElement || e instanceof getWindow(e as Node).HTMLAnchorElement;\n}\n\nexport function isHTMLSpanElement(e: unknown): e is HTMLSpanElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLSpanElement || e instanceof getWindow(e as Node).HTMLSpanElement;\n}\n\nexport function isHTMLTextAreaElement(e: unknown): e is HTMLTextAreaElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLTextAreaElement || e instanceof getWindow(e as Node).HTMLTextAreaElement;\n}\n\nexport function isHTMLInputElement(e: unknown): e is HTMLInputElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLInputElement || e instanceof getWindow(e as Node).HTMLInputElement;\n}\n\nexport function isHTMLButtonElement(e: unknown): e is HTMLButtonElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLButtonElement || e instanceof getWindow(e as Node).HTMLButtonElement;\n}\n\nexport function isHTMLDivElement(e: unknown): e is HTMLDivElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof HTMLDivElement || e instanceof getWindow(e as Node).HTMLDivElement;\n}\n\nexport function isSVGElement(e: unknown): e is SVGElement {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof SVGElement || e instanceof getWindow(e as Node).SVGElement;\n}\n\nexport function isMouseEvent(e: unknown): e is MouseEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof MouseEvent || e instanceof getWindow(e as UIEvent).MouseEvent;\n}\n\nexport function isKeyboardEvent(e: unknown): e is KeyboardEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof KeyboardEvent || e instanceof getWindow(e as UIEvent).KeyboardEvent;\n}\n\nexport function isPointerEvent(e: unknown): e is PointerEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof PointerEvent || e instanceof getWindow(e as UIEvent).PointerEvent;\n}\n\nexport function isDragEvent(e: unknown): e is DragEvent {\n\t// eslint-disable-next-line no-restricted-syntax\n\treturn e instanceof DragEvent || e instanceof getWindow(e as UIEvent).DragEvent;\n}\n\nexport const EventType = {\n\t// Mouse\n\tCLICK: 'click',\n\tAUXCLICK: 'auxclick',\n\tDBLCLICK: 'dblclick',\n\tMOUSE_UP: 'mouseup',\n\tMOUSE_DOWN: 'mousedown',\n\tMOUSE_OVER: 'mouseover',\n\tMOUSE_MOVE: 'mousemove',\n\tMOUSE_OUT: 'mouseout',\n\tMOUSE_ENTER: 'mouseenter',\n\tMOUSE_LEAVE: 'mouseleave',\n\tMOUSE_WHEEL: 'wheel',\n\tPOINTER_UP: 'pointerup',\n\tPOINTER_DOWN: 'pointerdown',\n\tPOINTER_MOVE: 'pointermove',\n\tPOINTER_LEAVE: 'pointerleave',\n\tCONTEXT_MENU: 'contextmenu',\n\tWHEEL: 'wheel',\n\t// Keyboard\n\tKEY_DOWN: 'keydown',\n\tKEY_PRESS: 'keypress',\n\tKEY_UP: 'keyup',\n\t// HTML Document\n\tLOAD: 'load',\n\tBEFORE_UNLOAD: 'beforeunload',\n\tUNLOAD: 'unload',\n\tPAGE_SHOW: 'pageshow',\n\tPAGE_HIDE: 'pagehide',\n\tPASTE: 'paste',\n\tABORT: 'abort',\n\tERROR: 'error',\n\tRESIZE: 'resize',\n\tSCROLL: 'scroll',\n\tFULLSCREEN_CHANGE: 'fullscreenchange',\n\tWK_FULLSCREEN_CHANGE: 'webkitfullscreenchange',\n\t// Form\n\tSELECT: 'select',\n\tCHANGE: 'change',\n\tSUBMIT: 'submit',\n\tRESET: 'reset',\n\tFOCUS: 'focus',\n\tFOCUS_IN: 'focusin',\n\tFOCUS_OUT: 'focusout',\n\tBLUR: 'blur',\n\tINPUT: 'input',\n\t// Local Storage\n\tSTORAGE: 'storage',\n\t// Drag\n\tDRAG_START: 'dragstart',\n\tDRAG: 'drag',\n\tDRAG_ENTER: 'dragenter',\n\tDRAG_LEAVE: 'dragleave',\n\tDRAG_OVER: 'dragover',\n\tDROP: 'drop',\n\tDRAG_END: 'dragend',\n\t// Animation\n\tANIMATION_START: browser.isWebKit ? 'webkitAnimationStart' : 'animationstart',\n\tANIMATION_END: browser.isWebKit ? 'webkitAnimationEnd' : 'animationend',\n\tANIMATION_ITERATION: browser.isWebKit ? 'webkitAnimationIteration' : 'animationiteration'\n} as const;\n\nexport interface EventLike {\n\tpreventDefault(): void;\n\tstopPropagation(): void;\n}\n\nexport function isEventLike(obj: unknown): obj is EventLike {\n\tconst candidate = obj as EventLike | undefined;\n\n\treturn !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');\n}\n\nexport const EventHelper = {\n\tstop: (e: T, cancelBubble?: boolean): T => {\n\t\te.preventDefault();\n\t\tif (cancelBubble) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\treturn e;\n\t}\n};\n\nexport interface IFocusTracker extends Disposable {\n\treadonly onDidFocus: event.Event;\n\treadonly onDidBlur: event.Event;\n\trefreshState(): void;\n}\n\nexport function saveParentsScrollTop(node: Element): number[] {\n\tconst r: number[] = [];\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tr[i] = node.scrollTop;\n\t\tnode = node.parentNode;\n\t}\n\treturn r;\n}\n\nexport function restoreParentsScrollTop(node: Element, state: number[]): void {\n\tfor (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {\n\t\tif (node.scrollTop !== state[i]) {\n\t\t\tnode.scrollTop = state[i];\n\t\t}\n\t\tnode = node.parentNode;\n\t}\n}\n\nclass FocusTracker extends Disposable implements IFocusTracker {\n\n\tprivate readonly _onDidFocus = this._register(new event.Emitter());\n\treadonly onDidFocus = this._onDidFocus.event;\n\n\tprivate readonly _onDidBlur = this._register(new event.Emitter());\n\treadonly onDidBlur = this._onDidBlur.event;\n\n\tprivate _refreshStateHandler: () => void;\n\n\tprivate static hasFocusWithin(element: HTMLElement | Window): boolean {\n\t\tif (isHTMLElement(element)) {\n\t\t\tconst shadowRoot = getShadowRoot(element);\n\t\t\tconst activeElement = (shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement);\n\t\t\treturn isAncestor(activeElement, element);\n\t\t} else {\n\t\t\tconst window = element;\n\t\t\treturn isAncestor(window.document.activeElement, window.document);\n\t\t}\n\t}\n\n\tconstructor(element: HTMLElement | Window) {\n\t\tsuper();\n\t\tlet hasFocus = FocusTracker.hasFocusWithin(element);\n\t\tlet loosingFocus = false;\n\n\t\tconst onFocus = () => {\n\t\t\tloosingFocus = false;\n\t\t\tif (!hasFocus) {\n\t\t\t\thasFocus = true;\n\t\t\t\tthis._onDidFocus.fire();\n\t\t\t}\n\t\t};\n\n\t\tconst onBlur = () => {\n\t\t\tif (hasFocus) {\n\t\t\t\tloosingFocus = true;\n\t\t\t\t(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {\n\t\t\t\t\tif (loosingFocus) {\n\t\t\t\t\t\tloosingFocus = false;\n\t\t\t\t\t\thasFocus = false;\n\t\t\t\t\t\tthis._onDidBlur.fire();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t};\n\n\t\tthis._refreshStateHandler = () => {\n\t\t\tconst currentNodeHasFocus = FocusTracker.hasFocusWithin(element);\n\t\t\tif (currentNodeHasFocus !== hasFocus) {\n\t\t\t\tif (hasFocus) {\n\t\t\t\t\tonBlur();\n\t\t\t\t} else {\n\t\t\t\t\tonFocus();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));\n\t\tthis._register(addDisposableListener(element, EventType.BLUR, onBlur, true));\n\t\tif (isHTMLElement(element)) {\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));\n\t\t\tthis._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));\n\t\t}\n\n\t}\n\n\trefreshState() {\n\t\tthis._refreshStateHandler();\n\t}\n}\n\n/**\n * Creates a new `IFocusTracker` instance that tracks focus changes on the given `element` and its descendants.\n *\n * @param element The `HTMLElement` or `Window` to track focus changes on.\n * @returns An `IFocusTracker` instance.\n */\nexport function trackFocus(element: HTMLElement | Window): IFocusTracker {\n\treturn new FocusTracker(element);\n}\n\nexport function after(sibling: HTMLElement, child: T): T {\n\tsibling.after(child);\n\treturn child;\n}\n\nexport function append(parent: HTMLElement, child: T): T;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): void;\nexport function append(parent: HTMLElement, ...children: (T | string)[]): T | void {\n\tparent.append(...children);\n\tif (children.length === 1 && typeof children[0] !== 'string') {\n\t\treturn children[0];\n\t}\n}\n\nexport function prepend(parent: HTMLElement, child: T): T {\n\tparent.insertBefore(child, parent.firstChild);\n\treturn child;\n}\n\n/**\n * Removes all children from `parent` and appends `children`\n */\nexport function reset(parent: HTMLElement, ...children: Array): void {\n\tparent.innerText = '';\n\tappend(parent, ...children);\n}\n\nconst SELECTOR_REGEX = /([\\w\\-]+)?(#([\\w\\-]+))?((\\.([\\w\\-]+))*)/;\n\nexport enum Namespace {\n\tHTML = 'http://www.w3.org/1999/xhtml',\n\tSVG = 'http://www.w3.org/2000/svg'\n}\n\nfunction _$(namespace: Namespace, description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\tconst match = SELECTOR_REGEX.exec(description);\n\n\tif (!match) {\n\t\tthrow new Error('Bad use of emmet');\n\t}\n\n\tconst tagName = match[1] || 'div';\n\tlet result: T;\n\n\tif (namespace !== Namespace.HTML) {\n\t\tresult = document.createElementNS(namespace as string, tagName) as T;\n\t} else {\n\t\tresult = document.createElement(tagName) as unknown as T;\n\t}\n\n\tif (match[3]) {\n\t\tresult.id = match[3];\n\t}\n\tif (match[4]) {\n\t\tresult.className = match[4].replace(/\\./g, ' ').trim();\n\t}\n\n\tif (attrs) {\n\t\tObject.entries(attrs).forEach(([name, value]) => {\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (/^on\\w+$/.test(name)) {\n\t\t\t\t(result)[name] = value;\n\t\t\t} else if (name === 'selected') {\n\t\t\t\tif (value) {\n\t\t\t\t\tresult.setAttribute(name, 'true');\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tresult.setAttribute(name, value);\n\t\t\t}\n\t\t});\n\t}\n\n\tresult.append(...children);\n\n\treturn result as T;\n}\n\nexport function $(description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.HTML, description, attrs, ...children);\n}\n\n$.SVG = function (description: string, attrs?: { [key: string]: any }, ...children: Array): T {\n\treturn _$(Namespace.SVG, description, attrs, ...children);\n};\n\nexport function join(nodes: Node[], separator: Node | string): Node[] {\n\tconst result: Node[] = [];\n\n\tnodes.forEach((node, index) => {\n\t\tif (index > 0) {\n\t\t\tif (separator instanceof Node) {\n\t\t\t\tresult.push(separator.cloneNode());\n\t\t\t} else {\n\t\t\t\tresult.push(document.createTextNode(separator));\n\t\t\t}\n\t\t}\n\n\t\tresult.push(node);\n\t});\n\n\treturn result;\n}\n\nexport function setVisibility(visible: boolean, ...elements: HTMLElement[]): void {\n\tif (visible) {\n\t\tshow(...elements);\n\t} else {\n\t\thide(...elements);\n\t}\n}\n\nexport function show(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = '';\n\t\telement.removeAttribute('aria-hidden');\n\t}\n}\n\nexport function hide(...elements: HTMLElement[]): void {\n\tfor (const element of elements) {\n\t\telement.style.display = 'none';\n\t\telement.setAttribute('aria-hidden', 'true');\n\t}\n}\n\nfunction findParentWithAttribute(node: Node | null, attribute: string): HTMLElement | null {\n\twhile (node && node.nodeType === node.ELEMENT_NODE) {\n\t\tif (isHTMLElement(node) && node.hasAttribute(attribute)) {\n\t\t\treturn node;\n\t\t}\n\n\t\tnode = node.parentNode;\n\t}\n\n\treturn null;\n}\n\nexport function removeTabIndexAndUpdateFocus(node: HTMLElement): void {\n\tif (!node || !node.hasAttribute('tabIndex')) {\n\t\treturn;\n\t}\n\n\t// If we are the currently focused element and tabIndex is removed,\n\t// standard DOM behavior is to move focus to the element. We\n\t// typically never want that, rather put focus to the closest element\n\t// in the hierarchy of the parent DOM nodes.\n\tif (node.ownerDocument.activeElement === node) {\n\t\tconst parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');\n\t\tparentFocusable?.focus();\n\t}\n\n\tnode.removeAttribute('tabindex');\n}\n\nexport function finalHandler(fn: (event: T) => any): (event: T) => any {\n\treturn e => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\tfn(e);\n\t};\n}\n\nexport function domContentLoaded(targetWindow: Window): Promise {\n\treturn new Promise(resolve => {\n\t\tconst readyState = targetWindow.document.readyState;\n\t\tif (readyState === 'complete' || (targetWindow.document && targetWindow.document.body !== null)) {\n\t\t\tresolve(undefined);\n\t\t} else {\n\t\t\tconst listener = () => {\n\t\t\t\ttargetWindow.window.removeEventListener('DOMContentLoaded', listener, false);\n\t\t\t\tresolve();\n\t\t\t};\n\n\t\t\ttargetWindow.window.addEventListener('DOMContentLoaded', listener, false);\n\t\t}\n\t});\n}\n\n/**\n * Find a value usable for a dom node size such that the likelihood that it would be\n * displayed with constant screen pixels size is as high as possible.\n *\n * e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio\n * of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/\"snaps\"\n * with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.\n */\nexport function computeScreenAwareSize(window: Window, cssPx: number): number {\n\tconst screenPx = window.devicePixelRatio * cssPx;\n\treturn Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;\n}\n\n/**\n * Open safely a new window. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * To protect against malicious code in the linked site, particularly phishing attempts,\n * the window.opener should be set to null to prevent the linked site from having access\n * to change the location of the current page.\n * See https://mathiasbynens.github.io/rel-noopener/\n */\nexport function windowOpenNoOpener(url: string): void {\n\t// By using 'noopener' in the `windowFeatures` argument, the newly created window will\n\t// not be able to use `window.opener` to reach back to the current page.\n\t// See https://stackoverflow.com/a/46958731\n\t// See https://developer.mozilla.org/en-US/docs/Web/API/Window/open#noopener\n\t// However, this also doesn't allow us to realize if the browser blocked\n\t// the creation of the window.\n\tmainWindow.open(url, '_blank', 'noopener');\n}\n\n/**\n * Open a new window in a popup. This is the best way to do so, but you cannot tell\n * if the window was opened or if it was blocked by the browser's popup blocker.\n * If you want to tell if the browser blocked the new window, use {@link windowOpenWithSuccess}.\n *\n * Note: this does not set {@link window.opener} to null. This is to allow the opened popup to\n * be able to use {@link window.close} to close itself. Because of this, you should only use\n * this function on urls that you trust.\n *\n * In otherwords, you should almost always use {@link windowOpenNoOpener} instead of this function.\n */\nconst popupWidth = 780, popupHeight = 640;\nexport function windowOpenPopup(url: string): void {\n\tconst left = Math.floor(mainWindow.screenLeft + mainWindow.innerWidth / 2 - popupWidth / 2);\n\tconst top = Math.floor(mainWindow.screenTop + mainWindow.innerHeight / 2 - popupHeight / 2);\n\tmainWindow.open(\n\t\turl,\n\t\t'_blank',\n\t\t`width=${popupWidth},height=${popupHeight},top=${top},left=${left}`\n\t);\n}\n\n/**\n * Attempts to open a window and returns whether it succeeded. This technique is\n * not appropriate in certain contexts, like for example when the JS context is\n * executing inside a sandboxed iframe. If it is not necessary to know if the\n * browser blocked the new window, use {@link windowOpenNoOpener}.\n *\n * See https://github.com/microsoft/monaco-editor/issues/601\n * See https://github.com/microsoft/monaco-editor/issues/2474\n * See https://mathiasbynens.github.io/rel-noopener/\n *\n * @param url the url to open\n * @param noOpener whether or not to set the {@link window.opener} to null. You should leave the default\n * (true) unless you trust the url that is being opened.\n * @returns boolean indicating if the {@link window.open} call succeeded\n */\nexport function windowOpenWithSuccess(url: string, noOpener = true): boolean {\n\tconst newTab = mainWindow.open();\n\tif (newTab) {\n\t\tif (noOpener) {\n\t\t\t// see `windowOpenNoOpener` for details on why this is important\n\t\t\t(newTab as any).opener = null;\n\t\t}\n\t\tnewTab.location.href = url;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function animate(targetWindow: Window, fn: () => void): IDisposable {\n\tconst step = () => {\n\t\tfn();\n\t\tstepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\t};\n\n\tlet stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);\n\treturn toDisposable(() => stepDisposable.dispose());\n}\n\nexport function asCSSPropertyValue(value: string) {\n\treturn `'${value.replace(/'/g, '%27')}'`;\n}\n\nexport function asCssValueWithDefault(cssPropertyValue: string | undefined, dflt: string): string {\n\tif (cssPropertyValue !== undefined) {\n\t\tconst variableMatch = cssPropertyValue.match(/^\\s*var\\((.+)\\)$/);\n\t\tif (variableMatch) {\n\t\t\tconst varArguments = variableMatch[1].split(',', 2);\n\t\t\tif (varArguments.length === 2) {\n\t\t\t\tdflt = asCssValueWithDefault(varArguments[1].trim(), dflt);\n\t\t\t}\n\t\t\treturn `var(${varArguments[0]}, ${dflt})`;\n\t\t}\n\t\treturn cssPropertyValue;\n\t}\n\treturn dflt;\n}\n\nexport enum DetectedFullscreenMode {\n\n\t/**\n\t * The document is fullscreen, e.g. because an element\n\t * in the document requested to be fullscreen.\n\t */\n\tDOCUMENT = 1,\n\n\t/**\n\t * The browser is fullscreen, e.g. because the user enabled\n\t * native window fullscreen for it.\n\t */\n\tBROWSER\n}\n\nexport interface IDetectedFullscreen {\n\n\t/**\n\t * Figure out if the document is fullscreen or the browser.\n\t */\n\tmode: DetectedFullscreenMode;\n\n\t/**\n\t * Whether we know for sure that we are in fullscreen mode or\n\t * it is a guess.\n\t */\n\tguess: boolean;\n}\n\nexport function detectFullscreen(targetWindow: Window): IDetectedFullscreen | null {\n\n\t// Browser fullscreen: use DOM APIs to detect\n\tif (targetWindow.document.fullscreenElement || (targetWindow.document).webkitFullscreenElement || (targetWindow.document).webkitIsFullScreen) {\n\t\treturn { mode: DetectedFullscreenMode.DOCUMENT, guess: false };\n\t}\n\n\t// There is no standard way to figure out if the browser\n\t// is using native fullscreen. Via checking on screen\n\t// height and comparing that to window height, we can guess\n\t// it though.\n\n\tif (targetWindow.innerHeight === targetWindow.screen.height) {\n\t\t// if the height of the window matches the screen height, we can\n\t\t// safely assume that the browser is fullscreen because no browser\n\t\t// chrome is taking height away (e.g. like toolbars).\n\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: false };\n\t}\n\n\tif (platform.isMacintosh || platform.isLinux) {\n\t\t// macOS and Linux do not properly report `innerHeight`, only Windows does\n\t\tif (targetWindow.outerHeight === targetWindow.screen.height && targetWindow.outerWidth === targetWindow.screen.width) {\n\t\t\t// if the height of the browser matches the screen height, we can\n\t\t\t// only guess that we are in fullscreen. It is also possible that\n\t\t\t// the user has turned off taskbars in the OS and the browser is\n\t\t\t// simply able to span the entire size of the screen.\n\t\t\treturn { mode: DetectedFullscreenMode.BROWSER, guess: true };\n\t\t}\n\t}\n\n\t// Not in fullscreen\n\treturn null;\n}\n\n/**\n * Convert a Unicode string to a string in which each 16-bit unit occupies only one byte\n *\n * From https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa\n */\nfunction toBinary(str: string): string {\n\tconst codeUnits = new Uint16Array(str.length);\n\tfor (let i = 0; i < codeUnits.length; i++) {\n\t\tcodeUnits[i] = str.charCodeAt(i);\n\t}\n\tlet binary = '';\n\tconst uint8array = new Uint8Array(codeUnits.buffer);\n\tfor (let i = 0; i < uint8array.length; i++) {\n\t\tbinary += String.fromCharCode(uint8array[i]);\n\t}\n\treturn binary;\n}\n\n/**\n * Version of the global `btoa` function that handles multi-byte characters instead\n * of throwing an exception.\n */\nexport function multibyteAwareBtoa(str: string): string {\n\treturn btoa(toBinary(str));\n}\n\ntype ModifierKey = 'alt' | 'ctrl' | 'shift' | 'meta';\n\nexport interface IModifierKeyStatus {\n\taltKey: boolean;\n\tshiftKey: boolean;\n\tctrlKey: boolean;\n\tmetaKey: boolean;\n\tlastKeyPressed?: ModifierKey;\n\tlastKeyReleased?: ModifierKey;\n\tevent?: KeyboardEvent;\n}\n\nexport class ModifierKeyEmitter extends event.Emitter {\n\n\tprivate readonly _subscriptions = new DisposableStore();\n\tprivate _keyStatus: IModifierKeyStatus;\n\tprivate static instance: ModifierKeyEmitter;\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\n\t\tthis._subscriptions.add(event.Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => this.registerListeners(window, disposables), { window: mainWindow, disposables: this._subscriptions }));\n\t}\n\n\tprivate registerListeners(window: Window, disposables: DisposableStore): void {\n\t\tdisposables.add(addDisposableListener(window, 'keydown', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\t// If Alt-key keydown event is repeated, ignore it #112347\n\t\t\t// Only known to be necessary for Alt-Key at the moment #115810\n\t\t\tif (event.keyCode === KeyCode.Alt && e.repeat) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (e.altKey && !this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'alt';\n\t\t\t} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'ctrl';\n\t\t\t} else if (e.metaKey && !this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'meta';\n\t\t\t} else if (e.shiftKey && !this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = 'shift';\n\t\t\t} else if (event.keyCode !== KeyCode.Alt) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyPressed) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'keyup', e => {\n\t\t\tif (e.defaultPrevented) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!e.altKey && this._keyStatus.altKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'alt';\n\t\t\t} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'ctrl';\n\t\t\t} else if (!e.metaKey && this._keyStatus.metaKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'meta';\n\t\t\t} else if (!e.shiftKey && this._keyStatus.shiftKey) {\n\t\t\t\tthis._keyStatus.lastKeyReleased = 'shift';\n\t\t\t} else {\n\t\t\t\tthis._keyStatus.lastKeyReleased = undefined;\n\t\t\t}\n\n\t\t\tif (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\n\t\t\tthis._keyStatus.altKey = e.altKey;\n\t\t\tthis._keyStatus.ctrlKey = e.ctrlKey;\n\t\t\tthis._keyStatus.metaKey = e.metaKey;\n\t\t\tthis._keyStatus.shiftKey = e.shiftKey;\n\n\t\t\tif (this._keyStatus.lastKeyReleased) {\n\t\t\t\tthis._keyStatus.event = e;\n\t\t\t\tthis.fire(this._keyStatus);\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousedown', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mouseup', () => {\n\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window.document.body, 'mousemove', e => {\n\t\t\tif (e.buttons) {\n\t\t\t\tthis._keyStatus.lastKeyPressed = undefined;\n\t\t\t}\n\t\t}, true));\n\n\t\tdisposables.add(addDisposableListener(window, 'blur', () => {\n\t\t\tthis.resetKeyStatus();\n\t\t}));\n\t}\n\n\tget keyStatus(): IModifierKeyStatus {\n\t\treturn this._keyStatus;\n\t}\n\n\tget isModifierPressed(): boolean {\n\t\treturn this._keyStatus.altKey || this._keyStatus.ctrlKey || this._keyStatus.metaKey || this._keyStatus.shiftKey;\n\t}\n\n\t/**\n\t * Allows to explicitly reset the key status based on more knowledge (#109062)\n\t */\n\tresetKeyStatus(): void {\n\t\tthis.doResetKeyStatus();\n\t\tthis.fire(this._keyStatus);\n\t}\n\n\tprivate doResetKeyStatus(): void {\n\t\tthis._keyStatus = {\n\t\t\taltKey: false,\n\t\t\tshiftKey: false,\n\t\t\tctrlKey: false,\n\t\t\tmetaKey: false\n\t\t};\n\t}\n\n\tstatic getInstance() {\n\t\tif (!ModifierKeyEmitter.instance) {\n\t\t\tModifierKeyEmitter.instance = new ModifierKeyEmitter();\n\t\t}\n\n\t\treturn ModifierKeyEmitter.instance;\n\t}\n\n\toverride dispose() {\n\t\tsuper.dispose();\n\t\tthis._subscriptions.dispose();\n\t}\n}\n\nexport function getCookieValue(name: string): string | undefined {\n\tconst match = document.cookie.match('(^|[^;]+)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531\n\n\treturn match ? match.pop() : undefined;\n}\n\nexport interface IDragAndDropObserverCallbacks {\n\treadonly onDragEnter?: (e: DragEvent) => void;\n\treadonly onDragLeave?: (e: DragEvent) => void;\n\treadonly onDrop?: (e: DragEvent) => void;\n\treadonly onDragEnd?: (e: DragEvent) => void;\n\treadonly onDragStart?: (e: DragEvent) => void;\n\treadonly onDrag?: (e: DragEvent) => void;\n\treadonly onDragOver?: (e: DragEvent, dragDuration: number) => void;\n}\n\nexport class DragAndDropObserver extends Disposable {\n\n\t// A helper to fix issues with repeated DRAG_ENTER / DRAG_LEAVE\n\t// calls see https://github.com/microsoft/vscode/issues/14470\n\t// when the element has child elements where the events are fired\n\t// repeadedly.\n\tprivate counter: number = 0;\n\n\t// Allows to measure the duration of the drag operation.\n\tprivate dragStartTime = 0;\n\n\tconstructor(private readonly element: HTMLElement, private readonly callbacks: IDragAndDropObserverCallbacks) {\n\t\tsuper();\n\n\t\tthis.registerListeners();\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (this.callbacks.onDragStart) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_START, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDragStart?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tif (this.callbacks.onDrag) {\n\t\t\tthis._register(addDisposableListener(this.element, EventType.DRAG, (e: DragEvent) => {\n\t\t\t\tthis.callbacks.onDrag?.(e);\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e: DragEvent) => {\n\t\t\tthis.counter++;\n\t\t\tthis.dragStartTime = e.timeStamp;\n\n\t\t\tthis.callbacks.onDragEnter?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e: DragEvent) => {\n\t\t\te.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n\n\t\t\tthis.callbacks.onDragOver?.(e, e.timeStamp - this.dragStartTime);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e: DragEvent) => {\n\t\t\tthis.counter--;\n\n\t\t\tif (this.counter === 0) {\n\t\t\t\tthis.dragStartTime = 0;\n\n\t\t\t\tthis.callbacks.onDragLeave?.(e);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DRAG_END, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDragEnd?.(e);\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.element, EventType.DROP, (e: DragEvent) => {\n\t\t\tthis.counter = 0;\n\t\t\tthis.dragStartTime = 0;\n\n\t\t\tthis.callbacks.onDrop?.(e);\n\t\t}));\n\t}\n}\n\ntype HTMLElementAttributeKeys = Partial<{ [K in keyof T]: T[K] extends Function ? never : T[K] extends object ? HTMLElementAttributeKeys : T[K] }>;\ntype ElementAttributes = HTMLElementAttributeKeys & Record;\ntype RemoveHTMLElement = T extends HTMLElement ? never : T;\ntype UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;\ntype ArrayToObj = UnionToIntersection>;\ntype HHTMLElementTagNameMap = HTMLElementTagNameMap & { '': HTMLDivElement };\n\ntype TagToElement = T extends `${infer TStart}#${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends `${infer TStart}.${string}`\n\t? TStart extends keyof HHTMLElementTagNameMap\n\t? HHTMLElementTagNameMap[TStart]\n\t: HTMLElement\n\t: T extends keyof HTMLElementTagNameMap\n\t? HTMLElementTagNameMap[T]\n\t: HTMLElement;\n\ntype TagToElementAndId = TTag extends `${infer TTag}@${infer TId}`\n\t? { element: TagToElement; id: TId }\n\t: { element: TagToElement; id: 'root' };\n\ntype TagToRecord = TagToElementAndId extends { element: infer TElement; id: infer TId }\n\t? Record<(TId extends string ? TId : never) | 'root', TElement>\n\t: never;\n\ntype Child = HTMLElement | string | Record;\n\nconst H_REGEX = /(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?/;\n\n/**\n * A helper function to create nested dom nodes.\n *\n *\n * ```ts\n * const elements = h('div.code-view', [\n * \th('div.title@title'),\n * \th('div.container', [\n * \t\th('div.gutter@gutterDiv'),\n * \t\th('div@editor'),\n * \t]),\n * ]);\n * const editor = createEditor(elements.editor);\n * ```\n*/\nexport function h\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function h(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElement(tagName);\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nexport function svgElem\n\t(tag: TTag):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>):\n\tTagToRecord extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem\n\t(tag: TTag, attributes: Partial>>, children: [...T]):\n\t(ArrayToObj & TagToRecord) extends infer Y ? { [TKey in keyof Y]: Y[TKey] } : never;\n\nexport function svgElem(tag: string, ...args: [] | [attributes: { $: string } & Partial> | Record, children?: any[]] | [children: any[]]): Record {\n\tlet attributes: { $?: string } & Partial>;\n\tlet children: (Record | HTMLElement)[] | undefined;\n\n\tif (Array.isArray(args[0])) {\n\t\tattributes = {};\n\t\tchildren = args[0];\n\t} else {\n\t\tattributes = args[0] as any || {};\n\t\tchildren = args[1];\n\t}\n\n\tconst match = H_REGEX.exec(tag);\n\n\tif (!match || !match.groups) {\n\t\tthrow new Error('Bad use of h');\n\t}\n\n\tconst tagName = match.groups['tag'] || 'div';\n\tconst el = document.createElementNS('http://www.w3.org/2000/svg', tagName) as any as HTMLElement;\n\n\tif (match.groups['id']) {\n\t\tel.id = match.groups['id'];\n\t}\n\n\tconst classNames = [];\n\tif (match.groups['class']) {\n\t\tfor (const className of match.groups['class'].split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (attributes.className !== undefined) {\n\t\tfor (const className of attributes.className.split('.')) {\n\t\t\tif (className !== '') {\n\t\t\t\tclassNames.push(className);\n\t\t\t}\n\t\t}\n\t}\n\tif (classNames.length > 0) {\n\t\tel.className = classNames.join(' ');\n\t}\n\n\tconst result: Record = {};\n\n\tif (match.groups['name']) {\n\t\tresult[match.groups['name']] = el;\n\t}\n\n\tif (children) {\n\t\tfor (const c of children) {\n\t\t\tif (isHTMLElement(c)) {\n\t\t\t\tel.appendChild(c);\n\t\t\t} else if (typeof c === 'string') {\n\t\t\t\tel.append(c);\n\t\t\t} else if ('root' in c) {\n\t\t\t\tObject.assign(result, c);\n\t\t\t\tel.appendChild(c.root);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tif (key === 'className') {\n\t\t\tcontinue;\n\t\t} else if (key === 'style') {\n\t\t\tfor (const [cssKey, cssValue] of Object.entries(value)) {\n\t\t\t\tel.style.setProperty(\n\t\t\t\t\tcamelCaseToHyphenCase(cssKey),\n\t\t\t\t\ttypeof cssValue === 'number' ? cssValue + 'px' : '' + cssValue\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (key === 'tabIndex') {\n\t\t\tel.tabIndex = value;\n\t\t} else {\n\t\t\tel.setAttribute(camelCaseToHyphenCase(key), value.toString());\n\t\t}\n\t}\n\n\tresult['root'] = el;\n\n\treturn result;\n}\n\nfunction camelCaseToHyphenCase(str: string) {\n\treturn str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\n\nexport function copyAttributes(from: Element, to: Element, filter?: string[]): void {\n\tfor (const { name, value } of from.attributes) {\n\t\tif (!filter || filter.includes(name)) {\n\t\t\tto.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nfunction copyAttribute(from: Element, to: Element, name: string): void {\n\tconst value = from.getAttribute(name);\n\tif (value) {\n\t\tto.setAttribute(name, value);\n\t} else {\n\t\tto.removeAttribute(name);\n\t}\n}\n\nexport function trackAttributes(from: Element, to: Element, filter?: string[]): IDisposable {\n\tcopyAttributes(from, to, filter);\n\n\tconst disposables = new DisposableStore();\n\n\tdisposables.add(sharedMutationObserver.observe(from, disposables, { attributes: true, attributeFilter: filter })(mutations => {\n\t\tfor (const mutation of mutations) {\n\t\t\tif (mutation.type === 'attributes' && mutation.attributeName) {\n\t\t\t\tcopyAttribute(from, to, mutation.attributeName);\n\t\t\t}\n\t\t}\n\t}));\n\n\treturn disposables;\n}\n\n/**\n * Helper for calculating the \"safe triangle\" occluded by hovers to avoid early dismissal.\n * @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/ for example\n */\nexport class SafeTriangle {\n\t// 4 triangles, 2 points (x, y) stored for each\n\tprivate triangles: number[] = [];\n\n\tconstructor(\n\t\tprivate readonly originX: number,\n\t\tprivate readonly originY: number,\n\t\ttarget: HTMLElement\n\t) {\n\t\tconst { top, left, right, bottom } = target.getBoundingClientRect();\n\t\tconst t = this.triangles;\n\t\tlet i = 0;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\n\t\tt[i++] = left;\n\t\tt[i++] = top;\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = right;\n\t\tt[i++] = top;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\n\t\tt[i++] = left;\n\t\tt[i++] = bottom;\n\t\tt[i++] = right;\n\t\tt[i++] = bottom;\n\t}\n\n\tpublic contains(x: number, y: number) {\n\t\tconst { triangles, originX, originY } = this;\n\t\tfor (let i = 0; i < 4; i++) {\n\t\t\tif (isPointWithinTriangle(x, y, originX, originY, triangles[2 * i], triangles[2 * i + 1], triangles[2 * i + 2], triangles[2 * i + 3])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nexport class FastDomNode {\n\n\tprivate _maxWidth: string = '';\n\tprivate _width: string = '';\n\tprivate _height: string = '';\n\tprivate _top: string = '';\n\tprivate _left: string = '';\n\tprivate _bottom: string = '';\n\tprivate _right: string = '';\n\tprivate _paddingTop: string = '';\n\tprivate _paddingLeft: string = '';\n\tprivate _paddingBottom: string = '';\n\tprivate _paddingRight: string = '';\n\tprivate _fontFamily: string = '';\n\tprivate _fontWeight: string = '';\n\tprivate _fontSize: string = '';\n\tprivate _fontStyle: string = '';\n\tprivate _fontFeatureSettings: string = '';\n\tprivate _fontVariationSettings: string = '';\n\tprivate _textDecoration: string = '';\n\tprivate _lineHeight: string = '';\n\tprivate _letterSpacing: string = '';\n\tprivate _className: string = '';\n\tprivate _display: string = '';\n\tprivate _position: string = '';\n\tprivate _visibility: string = '';\n\tprivate _color: string = '';\n\tprivate _backgroundColor: string = '';\n\tprivate _layerHint: boolean = false;\n\tprivate _contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint' = 'none';\n\tprivate _boxShadow: string = '';\n\n\tconstructor(\n\t\tpublic readonly domNode: T\n\t) { }\n\n\tpublic setMaxWidth(_maxWidth: number | string): void {\n\t\tconst maxWidth = numberAsPixels(_maxWidth);\n\t\tif (this._maxWidth === maxWidth) {\n\t\t\treturn;\n\t\t}\n\t\tthis._maxWidth = maxWidth;\n\t\tthis.domNode.style.maxWidth = this._maxWidth;\n\t}\n\n\tpublic setWidth(_width: number | string): void {\n\t\tconst width = numberAsPixels(_width);\n\t\tif (this._width === width) {\n\t\t\treturn;\n\t\t}\n\t\tthis._width = width;\n\t\tthis.domNode.style.width = this._width;\n\t}\n\n\tpublic setHeight(_height: number | string): void {\n\t\tconst height = numberAsPixels(_height);\n\t\tif (this._height === height) {\n\t\t\treturn;\n\t\t}\n\t\tthis._height = height;\n\t\tthis.domNode.style.height = this._height;\n\t}\n\n\tpublic setTop(_top: number | string): void {\n\t\tconst top = numberAsPixels(_top);\n\t\tif (this._top === top) {\n\t\t\treturn;\n\t\t}\n\t\tthis._top = top;\n\t\tthis.domNode.style.top = this._top;\n\t}\n\n\tpublic setLeft(_left: number | string): void {\n\t\tconst left = numberAsPixels(_left);\n\t\tif (this._left === left) {\n\t\t\treturn;\n\t\t}\n\t\tthis._left = left;\n\t\tthis.domNode.style.left = this._left;\n\t}\n\n\tpublic setBottom(_bottom: number | string): void {\n\t\tconst bottom = numberAsPixels(_bottom);\n\t\tif (this._bottom === bottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._bottom = bottom;\n\t\tthis.domNode.style.bottom = this._bottom;\n\t}\n\n\tpublic setRight(_right: number | string): void {\n\t\tconst right = numberAsPixels(_right);\n\t\tif (this._right === right) {\n\t\t\treturn;\n\t\t}\n\t\tthis._right = right;\n\t\tthis.domNode.style.right = this._right;\n\t}\n\n\tpublic setPaddingTop(_paddingTop: number | string): void {\n\t\tconst paddingTop = numberAsPixels(_paddingTop);\n\t\tif (this._paddingTop === paddingTop) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingTop = paddingTop;\n\t\tthis.domNode.style.paddingTop = this._paddingTop;\n\t}\n\n\tpublic setPaddingLeft(_paddingLeft: number | string): void {\n\t\tconst paddingLeft = numberAsPixels(_paddingLeft);\n\t\tif (this._paddingLeft === paddingLeft) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingLeft = paddingLeft;\n\t\tthis.domNode.style.paddingLeft = this._paddingLeft;\n\t}\n\n\tpublic setPaddingBottom(_paddingBottom: number | string): void {\n\t\tconst paddingBottom = numberAsPixels(_paddingBottom);\n\t\tif (this._paddingBottom === paddingBottom) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingBottom = paddingBottom;\n\t\tthis.domNode.style.paddingBottom = this._paddingBottom;\n\t}\n\n\tpublic setPaddingRight(_paddingRight: number | string): void {\n\t\tconst paddingRight = numberAsPixels(_paddingRight);\n\t\tif (this._paddingRight === paddingRight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._paddingRight = paddingRight;\n\t\tthis.domNode.style.paddingRight = this._paddingRight;\n\t}\n\n\tpublic setFontFamily(fontFamily: string): void {\n\t\tif (this._fontFamily === fontFamily) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFamily = fontFamily;\n\t\tthis.domNode.style.fontFamily = this._fontFamily;\n\t}\n\n\tpublic setFontWeight(fontWeight: string): void {\n\t\tif (this._fontWeight === fontWeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontWeight = fontWeight;\n\t\tthis.domNode.style.fontWeight = this._fontWeight;\n\t}\n\n\tpublic setFontSize(_fontSize: number | string): void {\n\t\tconst fontSize = numberAsPixels(_fontSize);\n\t\tif (this._fontSize === fontSize) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontSize = fontSize;\n\t\tthis.domNode.style.fontSize = this._fontSize;\n\t}\n\n\tpublic setFontStyle(fontStyle: string): void {\n\t\tif (this._fontStyle === fontStyle) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontStyle = fontStyle;\n\t\tthis.domNode.style.fontStyle = this._fontStyle;\n\t}\n\n\tpublic setFontFeatureSettings(fontFeatureSettings: string): void {\n\t\tif (this._fontFeatureSettings === fontFeatureSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontFeatureSettings = fontFeatureSettings;\n\t\tthis.domNode.style.fontFeatureSettings = this._fontFeatureSettings;\n\t}\n\n\tpublic setFontVariationSettings(fontVariationSettings: string): void {\n\t\tif (this._fontVariationSettings === fontVariationSettings) {\n\t\t\treturn;\n\t\t}\n\t\tthis._fontVariationSettings = fontVariationSettings;\n\t\tthis.domNode.style.fontVariationSettings = this._fontVariationSettings;\n\t}\n\n\tpublic setTextDecoration(textDecoration: string): void {\n\t\tif (this._textDecoration === textDecoration) {\n\t\t\treturn;\n\t\t}\n\t\tthis._textDecoration = textDecoration;\n\t\tthis.domNode.style.textDecoration = this._textDecoration;\n\t}\n\n\tpublic setLineHeight(_lineHeight: number | string): void {\n\t\tconst lineHeight = numberAsPixels(_lineHeight);\n\t\tif (this._lineHeight === lineHeight) {\n\t\t\treturn;\n\t\t}\n\t\tthis._lineHeight = lineHeight;\n\t\tthis.domNode.style.lineHeight = this._lineHeight;\n\t}\n\n\tpublic setLetterSpacing(_letterSpacing: number | string): void {\n\t\tconst letterSpacing = numberAsPixels(_letterSpacing);\n\t\tif (this._letterSpacing === letterSpacing) {\n\t\t\treturn;\n\t\t}\n\t\tthis._letterSpacing = letterSpacing;\n\t\tthis.domNode.style.letterSpacing = this._letterSpacing;\n\t}\n\n\tpublic setClassName(className: string): void {\n\t\tif (this._className === className) {\n\t\t\treturn;\n\t\t}\n\t\tthis._className = className;\n\t\tthis.domNode.className = this._className;\n\t}\n\n\tpublic toggleClassName(className: string, shouldHaveIt?: boolean): void {\n\t\tthis.domNode.classList.toggle(className, shouldHaveIt);\n\t\tthis._className = this.domNode.className;\n\t}\n\n\tpublic setDisplay(display: string): void {\n\t\tif (this._display === display) {\n\t\t\treturn;\n\t\t}\n\t\tthis._display = display;\n\t\tthis.domNode.style.display = this._display;\n\t}\n\n\tpublic setPosition(position: string): void {\n\t\tif (this._position === position) {\n\t\t\treturn;\n\t\t}\n\t\tthis._position = position;\n\t\tthis.domNode.style.position = this._position;\n\t}\n\n\tpublic setVisibility(visibility: string): void {\n\t\tif (this._visibility === visibility) {\n\t\t\treturn;\n\t\t}\n\t\tthis._visibility = visibility;\n\t\tthis.domNode.style.visibility = this._visibility;\n\t}\n\n\tpublic setColor(color: string): void {\n\t\tif (this._color === color) {\n\t\t\treturn;\n\t\t}\n\t\tthis._color = color;\n\t\tthis.domNode.style.color = this._color;\n\t}\n\n\tpublic setBackgroundColor(backgroundColor: string): void {\n\t\tif (this._backgroundColor === backgroundColor) {\n\t\t\treturn;\n\t\t}\n\t\tthis._backgroundColor = backgroundColor;\n\t\tthis.domNode.style.backgroundColor = this._backgroundColor;\n\t}\n\n\tpublic setLayerHinting(layerHint: boolean): void {\n\t\tif (this._layerHint === layerHint) {\n\t\t\treturn;\n\t\t}\n\t\tthis._layerHint = layerHint;\n\t\tthis.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';\n\t}\n\n\tpublic setBoxShadow(boxShadow: string): void {\n\t\tif (this._boxShadow === boxShadow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._boxShadow = boxShadow;\n\t\tthis.domNode.style.boxShadow = boxShadow;\n\t}\n\n\tpublic setContain(contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint'): void {\n\t\tif (this._contain === contain) {\n\t\t\treturn;\n\t\t}\n\t\tthis._contain = contain;\n\t\t(this.domNode.style).contain = this._contain;\n\t}\n\n\tpublic setAttribute(name: string, value: string): void {\n\t\tthis.domNode.setAttribute(name, value);\n\t}\n\n\tpublic removeAttribute(name: string): void {\n\t\tthis.domNode.removeAttribute(name);\n\t}\n\n\tpublic appendChild(child: FastDomNode): void {\n\t\tthis.domNode.appendChild(child.domNode);\n\t}\n\n\tpublic removeChild(child: FastDomNode): void {\n\t\tthis.domNode.removeChild(child.domNode);\n\t}\n}\n\nfunction numberAsPixels(value: number | string): string {\n\treturn (typeof value === 'number' ? `${value}px` : value);\n}\n\nexport function createFastDomNode(domNode: T): FastDomNode {\n\treturn new FastDomNode(domNode);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';\n\nexport interface IPointerMoveCallback {\n\t(event: PointerEvent): void;\n}\n\nexport interface IOnStopCallback {\n\t(browserEvent?: PointerEvent | KeyboardEvent): void;\n}\n\nexport class GlobalPointerMoveMonitor implements IDisposable {\n\n\tprivate readonly _hooks = new DisposableStore();\n\tprivate _pointerMoveCallback: IPointerMoveCallback | null = null;\n\tprivate _onStopCallback: IOnStopCallback | null = null;\n\n\tpublic dispose(): void {\n\t\tthis.stopMonitoring(false);\n\t\tthis._hooks.dispose();\n\t}\n\n\tpublic stopMonitoring(invokeStopCallback: boolean, browserEvent?: PointerEvent | KeyboardEvent): void {\n\t\tif (!this.isMonitoring()) {\n\t\t\t// Not monitoring\n\t\t\treturn;\n\t\t}\n\n\t\t// Unhook\n\t\tthis._hooks.clear();\n\t\tthis._pointerMoveCallback = null;\n\t\tconst onStopCallback = this._onStopCallback;\n\t\tthis._onStopCallback = null;\n\n\t\tif (invokeStopCallback && onStopCallback) {\n\t\t\tonStopCallback(browserEvent);\n\t\t}\n\t}\n\n\tpublic isMonitoring(): boolean {\n\t\treturn !!this._pointerMoveCallback;\n\t}\n\n\tpublic startMonitoring(\n\t\tinitialElement: Element,\n\t\tpointerId: number,\n\t\tinitialButtons: number,\n\t\tpointerMoveCallback: IPointerMoveCallback,\n\t\tonStopCallback: IOnStopCallback\n\t): void {\n\t\tif (this.isMonitoring()) {\n\t\t\tthis.stopMonitoring(false);\n\t\t}\n\t\tthis._pointerMoveCallback = pointerMoveCallback;\n\t\tthis._onStopCallback = onStopCallback;\n\n\t\tlet eventSource: Element | Window = initialElement;\n\n\t\ttry {\n\t\t\tinitialElement.setPointerCapture(pointerId);\n\t\t\tthis._hooks.add(toDisposable(() => {\n\t\t\t\ttry {\n\t\t\t\t\tinitialElement.releasePointerCapture(pointerId);\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// See https://github.com/microsoft/vscode/issues/161731\n\t\t\t\t\t//\n\t\t\t\t\t// `releasePointerCapture` sometimes fails when being invoked with the exception:\n\t\t\t\t\t// DOMException: Failed to execute 'releasePointerCapture' on 'Element':\n\t\t\t\t\t// No active pointer with the given id is found.\n\t\t\t\t\t//\n\t\t\t\t\t// There's no need to do anything in case of failure\n\t\t\t\t}\n\t\t\t}));\n\t\t} catch (err) {\n\t\t\t// See https://github.com/microsoft/vscode/issues/144584\n\t\t\t// See https://github.com/microsoft/vscode/issues/146947\n\t\t\t// `setPointerCapture` sometimes fails when being invoked\n\t\t\t// from a `mousedown` listener on macOS and Windows\n\t\t\t// and it always fails on Linux with the exception:\n\t\t\t// DOMException: Failed to execute 'setPointerCapture' on 'Element':\n\t\t\t// No active pointer with the given id is found.\n\t\t\t// In case of failure, we bind the listeners on the window\n\t\t\teventSource = dom.getWindow(initialElement);\n\t\t}\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_MOVE,\n\t\t\t(e) => {\n\t\t\t\tif (e.buttons !== initialButtons) {\n\t\t\t\t\t// Buttons state has changed in the meantime\n\t\t\t\t\tthis.stopMonitoring(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._pointerMoveCallback!(e);\n\t\t\t}\n\t\t));\n\n\t\tthis._hooks.add(dom.addDisposableListener(\n\t\t\teventSource,\n\t\t\tdom.EventType.POINTER_UP,\n\t\t\t(e: PointerEvent) => this.stopMonitoring(true)\n\t\t));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nfunction createDecorator(mapFn: (fn: Function, key: string) => Function): Function {\n\treturn (target: any, key: string, descriptor: any) => {\n\t\tlet fnKey: string | null = null;\n\t\tlet fn: Function | null = null;\n\n\t\tif (typeof descriptor.value === 'function') {\n\t\t\tfnKey = 'value';\n\t\t\tfn = descriptor.value;\n\t\t} else if (typeof descriptor.get === 'function') {\n\t\t\tfnKey = 'get';\n\t\t\tfn = descriptor.get;\n\t\t}\n\n\t\tif (!fn) {\n\t\t\tthrow new Error('not supported');\n\t\t}\n\n\t\tdescriptor[fnKey!] = mapFn(fn, key);\n\t};\n}\n\nexport function memoize(_target: any, key: string, descriptor: any) {\n\tlet fnKey: string | null = null;\n\tlet fn: Function | null = null;\n\n\tif (typeof descriptor.value === 'function') {\n\t\tfnKey = 'value';\n\t\tfn = descriptor.value;\n\n\t\tif (fn!.length !== 0) {\n\t\t\tconsole.warn('Memoize should only be used in functions with zero parameters');\n\t\t}\n\t} else if (typeof descriptor.get === 'function') {\n\t\tfnKey = 'get';\n\t\tfn = descriptor.get;\n\t}\n\n\tif (!fn) {\n\t\tthrow new Error('not supported');\n\t}\n\n\tconst memoizeKey = `$memoize$${key}`;\n\tdescriptor[fnKey!] = function (...args: any[]) {\n\t\tif (!this.hasOwnProperty(memoizeKey)) {\n\t\t\tObject.defineProperty(this, memoizeKey, {\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t\tvalue: fn.apply(this, args)\n\t\t\t});\n\t\t}\n\n\t\treturn this[memoizeKey];\n\t};\n}\n\nexport interface IDebounceReducer {\n\t(previousValue: T, ...args: any[]): T;\n}\n\nexport function debounce(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$debounce$${key}`;\n\t\tconst resultKey = `$debounce$result$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\n\t\t\tclearTimeout(this[timerKey]);\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t\targs = [this[resultKey]];\n\t\t\t}\n\n\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\tfn.apply(this, args);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}, delay);\n\t\t};\n\t});\n}\n\nexport function throttle(delay: number, reducer?: IDebounceReducer, initialValueProvider?: () => T): Function {\n\treturn createDecorator((fn, key) => {\n\t\tconst timerKey = `$throttle$timer$${key}`;\n\t\tconst resultKey = `$throttle$result$${key}`;\n\t\tconst lastRunKey = `$throttle$lastRun$${key}`;\n\t\tconst pendingKey = `$throttle$pending$${key}`;\n\n\t\treturn function (this: any, ...args: any[]) {\n\t\t\tif (!this[resultKey]) {\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t}\n\t\t\tif (this[lastRunKey] === null || this[lastRunKey] === undefined) {\n\t\t\t\tthis[lastRunKey] = -Number.MAX_VALUE;\n\t\t\t}\n\n\t\t\tif (reducer) {\n\t\t\t\tthis[resultKey] = reducer(this[resultKey], ...args);\n\t\t\t}\n\n\t\t\tif (this[pendingKey]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextTime = this[lastRunKey] + delay;\n\t\t\tif (nextTime <= Date.now()) {\n\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t} else {\n\t\t\t\tthis[pendingKey] = true;\n\t\t\t\tthis[timerKey] = setTimeout(() => {\n\t\t\t\t\tthis[pendingKey] = false;\n\t\t\t\t\tthis[lastRunKey] = Date.now();\n\t\t\t\t\tfn.apply(this, [this[resultKey]]);\n\t\t\t\t\tthis[resultKey] = initialValueProvider ? initialValueProvider() : undefined;\n\t\t\t\t}, nextTime - Date.now());\n\t\t\t}\n\t\t};\n\t});\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as DomUtils from 'vs/base/browser/dom';\nimport { mainWindow } from 'vs/base/browser/window';\nimport * as arrays from 'vs/base/common/arrays';\nimport { memoize } from 'vs/base/common/decorators';\nimport { Event as EventUtils } from 'vs/base/common/event';\nimport { Disposable, IDisposable, markAsSingleton, toDisposable } from 'vs/base/common/lifecycle';\nimport { LinkedList } from 'vs/base/common/linkedList';\n\nexport namespace EventType {\n\texport const Tap = '-xterm-gesturetap';\n\texport const Change = '-xterm-gesturechange';\n\texport const Start = '-xterm-gesturestart';\n\texport const End = '-xterm-gesturesend';\n\texport const Contextmenu = '-xterm-gesturecontextmenu';\n}\n\ninterface TouchData {\n\tid: number;\n\tinitialTarget: EventTarget;\n\tinitialTimeStamp: number;\n\tinitialPageX: number;\n\tinitialPageY: number;\n\trollingTimestamps: number[];\n\trollingPageX: number[];\n\trollingPageY: number[];\n}\n\nexport interface GestureEvent extends MouseEvent {\n\tinitialTarget: EventTarget | undefined;\n\ttranslationX: number;\n\ttranslationY: number;\n\tpageX: number;\n\tpageY: number;\n\ttapCount: number;\n}\n\ninterface Touch {\n\tidentifier: number;\n\tscreenX: number;\n\tscreenY: number;\n\tclientX: number;\n\tclientY: number;\n\tpageX: number;\n\tpageY: number;\n\tradiusX: number;\n\tradiusY: number;\n\trotationAngle: number;\n\tforce: number;\n\ttarget: Element;\n}\n\ninterface TouchList {\n\t[i: number]: Touch;\n\tlength: number;\n\titem(index: number): Touch;\n\tidentifiedTouch(id: number): Touch;\n}\n\ninterface TouchEvent extends Event {\n\ttouches: TouchList;\n\ttargetTouches: TouchList;\n\tchangedTouches: TouchList;\n}\n\nexport class Gesture extends Disposable {\n\n\tprivate static readonly SCROLL_FRICTION = -0.005;\n\tprivate static INSTANCE: Gesture;\n\tprivate static readonly HOLD_DELAY = 700;\n\n\tprivate dispatched = false;\n\tprivate readonly targets = new LinkedList();\n\tprivate readonly ignoreTargets = new LinkedList();\n\tprivate handle: IDisposable | null;\n\n\tprivate readonly activeTouches: { [id: number]: TouchData };\n\n\tprivate _lastSetTapCountTime: number;\n\n\tprivate static readonly CLEAR_TAP_COUNT_TIME = 400; // ms\n\n\n\tprivate constructor() {\n\t\tsuper();\n\n\t\tthis.activeTouches = {};\n\t\tthis.handle = null;\n\t\tthis._lastSetTapCountTime = 0;\n\n\t\tthis._register(EventUtils.runAndSubscribe(DomUtils.onDidRegisterWindow, ({ window, disposables }) => {\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchstart', (e: TouchEvent) => this.onTouchStart(e), { passive: false }));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchend', (e: TouchEvent) => this.onTouchEnd(window, e)));\n\t\t\tdisposables.add(DomUtils.addDisposableListener(window.document, 'touchmove', (e: TouchEvent) => this.onTouchMove(e), { passive: false }));\n\t\t}, { window: mainWindow, disposables: this._store }));\n\t}\n\n\tpublic static addTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.targets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\tpublic static ignoreTarget(element: HTMLElement): IDisposable {\n\t\tif (!Gesture.isTouchDevice()) {\n\t\t\treturn Disposable.None;\n\t\t}\n\t\tif (!Gesture.INSTANCE) {\n\t\t\tGesture.INSTANCE = markAsSingleton(new Gesture());\n\t\t}\n\n\t\tconst remove = Gesture.INSTANCE.ignoreTargets.push(element);\n\t\treturn toDisposable(remove);\n\t}\n\n\t@memoize\n\tstatic isTouchDevice(): boolean {\n\t\t// `'ontouchstart' in window` always evaluates to true with typescript's modern typings. This causes `window` to be\n\t\t// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast\n\t\treturn 'ontouchstart' in mainWindow || navigator.maxTouchPoints > 0;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tsuper.dispose();\n\t}\n\n\tprivate onTouchStart(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tif (this.handle) {\n\t\t\tthis.handle.dispose();\n\t\t\tthis.handle = null;\n\t\t}\n\n\t\tfor (let i = 0, len = e.targetTouches.length; i < len; i++) {\n\t\t\tconst touch = e.targetTouches.item(i);\n\n\t\t\tthis.activeTouches[touch.identifier] = {\n\t\t\t\tid: touch.identifier,\n\t\t\t\tinitialTarget: touch.target,\n\t\t\t\tinitialTimeStamp: timestamp,\n\t\t\t\tinitialPageX: touch.pageX,\n\t\t\t\tinitialPageY: touch.pageY,\n\t\t\t\trollingTimestamps: [timestamp],\n\t\t\t\trollingPageX: [touch.pageX],\n\t\t\t\trollingPageY: [touch.pageY]\n\t\t\t};\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Start, touch.target);\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate onTouchEnd(targetWindow: Window, e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tconst activeTouchCount = Object.keys(this.activeTouches).length;\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('move of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier],\n\t\t\t\tholdTime = Date.now() - data.initialTimeStamp;\n\n\t\t\tif (holdTime < Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Tap, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (holdTime >= Gesture.HOLD_DELAY\n\t\t\t\t&& Math.abs(data.initialPageX - arrays.tail(data.rollingPageX)!) < 30\n\t\t\t\t&& Math.abs(data.initialPageY - arrays.tail(data.rollingPageY)!) < 30) {\n\n\t\t\t\tconst evt = this.newGestureEvent(EventType.Contextmenu, data.initialTarget);\n\t\t\t\tevt.pageX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tevt.pageY = arrays.tail(data.rollingPageY)!;\n\t\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t} else if (activeTouchCount === 1) {\n\t\t\t\tconst finalX = arrays.tail(data.rollingPageX)!;\n\t\t\t\tconst finalY = arrays.tail(data.rollingPageY)!;\n\n\t\t\t\tconst deltaT = arrays.tail(data.rollingTimestamps)! - data.rollingTimestamps[0];\n\t\t\t\tconst deltaX = finalX - data.rollingPageX[0];\n\t\t\t\tconst deltaY = finalY - data.rollingPageY[0];\n\n\t\t\t\t// We need to get all the dispatch targets on the start of the inertia event\n\t\t\t\tconst dispatchTo = [...this.targets].filter(t => data.initialTarget instanceof Node && t.contains(data.initialTarget));\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, timestamp,\t// time now\n\t\t\t\t\tMath.abs(deltaX) / deltaT,\t\t\t\t\t\t// speed\n\t\t\t\t\tdeltaX > 0 ? 1 : -1,\t\t\t\t\t\t\t// x direction\n\t\t\t\t\tfinalX,\t\t\t\t\t\t\t\t\t\t\t// x now\n\t\t\t\t\tMath.abs(deltaY) / deltaT, \t\t\t\t\t// y speed\n\t\t\t\t\tdeltaY > 0 ? 1 : -1,\t\t\t\t\t\t\t// y direction\n\t\t\t\t\tfinalY\t\t\t\t\t\t\t\t\t\t\t// y now\n\t\t\t\t);\n\t\t\t}\n\n\n\t\t\tthis.dispatchEvent(this.newGestureEvent(EventType.End, data.initialTarget));\n\t\t\t// forget about this touch\n\t\t\tdelete this.activeTouches[touch.identifier];\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n\n\tprivate newGestureEvent(type: string, initialTarget?: EventTarget): GestureEvent {\n\t\tconst event = document.createEvent('CustomEvent') as unknown as GestureEvent;\n\t\tevent.initEvent(type, false, true);\n\t\tevent.initialTarget = initialTarget;\n\t\tevent.tapCount = 0;\n\t\treturn event;\n\t}\n\n\tprivate dispatchEvent(event: GestureEvent): void {\n\t\tif (event.type === EventType.Tap) {\n\t\t\tconst currentTime = (new Date()).getTime();\n\t\t\tlet setTapCount = 0;\n\t\t\tif (currentTime - this._lastSetTapCountTime > Gesture.CLEAR_TAP_COUNT_TIME) {\n\t\t\t\tsetTapCount = 1;\n\t\t\t} else {\n\t\t\t\tsetTapCount = 2;\n\t\t\t}\n\n\t\t\tthis._lastSetTapCountTime = currentTime;\n\t\t\tevent.tapCount = setTapCount;\n\t\t} else if (event.type === EventType.Change || event.type === EventType.Contextmenu) {\n\t\t\t// tap is canceled by scrolling or context menu\n\t\t\tthis._lastSetTapCountTime = 0;\n\t\t}\n\n\t\tif (event.initialTarget instanceof Node) {\n\t\t\tfor (const ignoreTarget of this.ignoreTargets) {\n\t\t\t\tif (ignoreTarget.contains(event.initialTarget)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst targets: [number, HTMLElement][] = [];\n\t\t\tfor (const target of this.targets) {\n\t\t\t\tif (target.contains(event.initialTarget)) {\n\t\t\t\t\tlet depth = 0;\n\t\t\t\t\tlet now: Node | null = event.initialTarget;\n\t\t\t\t\twhile (now && now !== target) {\n\t\t\t\t\t\tdepth++;\n\t\t\t\t\t\tnow = now.parentElement;\n\t\t\t\t\t}\n\t\t\t\t\ttargets.push([depth, target]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttargets.sort((a, b) => a[0] - b[0]);\n\n\t\t\tfor (const [_, target] of targets) {\n\t\t\t\ttarget.dispatchEvent(event);\n\t\t\t\tthis.dispatched = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate inertia(targetWindow: Window, dispatchTo: readonly EventTarget[], t1: number, vX: number, dirX: number, x: number, vY: number, dirY: number, y: number): void {\n\t\tthis.handle = DomUtils.scheduleAtNextAnimationFrame(targetWindow, () => {\n\t\t\tconst now = Date.now();\n\n\t\t\t// velocity: old speed + accel_over_time\n\t\t\tconst deltaT = now - t1;\n\t\t\tlet delta_pos_x = 0, delta_pos_y = 0;\n\t\t\tlet stopped = true;\n\n\t\t\tvX += Gesture.SCROLL_FRICTION * deltaT;\n\t\t\tvY += Gesture.SCROLL_FRICTION * deltaT;\n\n\t\t\tif (vX > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_x = dirX * vX * deltaT;\n\t\t\t}\n\n\t\t\tif (vY > 0) {\n\t\t\t\tstopped = false;\n\t\t\t\tdelta_pos_y = dirY * vY * deltaT;\n\t\t\t}\n\n\t\t\t// dispatch translation event\n\t\t\tconst evt = this.newGestureEvent(EventType.Change);\n\t\t\tevt.translationX = delta_pos_x;\n\t\t\tevt.translationY = delta_pos_y;\n\t\t\tdispatchTo.forEach(d => d.dispatchEvent(evt));\n\n\t\t\tif (!stopped) {\n\t\t\t\tthis.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate onTouchMove(e: TouchEvent): void {\n\t\tconst timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.\n\n\t\tfor (let i = 0, len = e.changedTouches.length; i < len; i++) {\n\n\t\t\tconst touch = e.changedTouches.item(i);\n\n\t\t\tif (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {\n\t\t\t\tconsole.warn('end of an UNKNOWN touch', touch);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst data = this.activeTouches[touch.identifier];\n\n\t\t\tconst evt = this.newGestureEvent(EventType.Change, data.initialTarget);\n\t\t\tevt.translationX = touch.pageX - arrays.tail(data.rollingPageX)!;\n\t\t\tevt.translationY = touch.pageY - arrays.tail(data.rollingPageY)!;\n\t\t\tevt.pageX = touch.pageX;\n\t\t\tevt.pageY = touch.pageY;\n\t\t\tthis.dispatchEvent(evt);\n\n\t\t\t// only keep a few data points, to average the final speed\n\t\t\tif (data.rollingPageX.length > 3) {\n\t\t\t\tdata.rollingPageX.shift();\n\t\t\t\tdata.rollingPageY.shift();\n\t\t\t\tdata.rollingTimestamps.shift();\n\t\t\t}\n\n\t\t\tdata.rollingPageX.push(touch.pageX);\n\t\t\tdata.rollingPageY.push(touch.pageY);\n\t\t\tdata.rollingTimestamps.push(timestamp);\n\t\t}\n\n\t\tif (this.dispatched) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.dispatched = false;\n\t\t}\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';\nimport { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';\nimport { Gesture } from 'vs/base/browser/touch';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport abstract class Widget extends Disposable {\n\n\tprotected onclick(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CLICK, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmousedown(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_DOWN, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseover(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_OVER, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onmouseleave(domNode: HTMLElement, listener: (e: IMouseEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.MOUSE_LEAVE, (e: MouseEvent) => listener(new StandardMouseEvent(dom.getWindow(domNode), e))));\n\t}\n\n\tprotected onkeydown(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected onkeyup(domNode: HTMLElement, listener: (e: IKeyboardEvent) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.KEY_UP, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));\n\t}\n\n\tprotected oninput(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.INPUT, listener));\n\t}\n\n\tprotected onblur(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.BLUR, listener));\n\t}\n\n\tprotected onfocus(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.FOCUS, listener));\n\t}\n\n\tprotected onchange(domNode: HTMLElement, listener: (e: Event) => void): void {\n\t\tthis._register(dom.addDisposableListener(domNode, dom.EventType.CHANGE, listener));\n\t}\n\n\tprotected ignoreGesture(domNode: HTMLElement): IDisposable {\n\t\treturn Gesture.ignoreTarget(domNode);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport * as dom from 'vs/base/browser/dom';\n\n/**\n * The arrow image size.\n */\nexport const ARROW_IMG_SIZE = 11;\n\nexport interface ScrollbarArrowOptions {\n\tonActivate: () => void;\n\tclassName: string;\n\t// icon: ThemeIcon;\n\n\tbgWidth: number;\n\tbgHeight: number;\n\n\ttop?: number;\n\tleft?: number;\n\tbottom?: number;\n\tright?: number;\n}\n\nexport class ScrollbarArrow extends Widget {\n\n\tprivate _onActivate: () => void;\n\tpublic bgDomNode: HTMLElement;\n\tpublic domNode: HTMLElement;\n\tprivate _pointerdownRepeatTimer: dom.WindowIntervalTimer;\n\tprivate _pointerdownScheduleRepeatTimer: TimeoutTimer;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tconstructor(opts: ScrollbarArrowOptions) {\n\t\tsuper();\n\t\tthis._onActivate = opts.onActivate;\n\n\t\tthis.bgDomNode = document.createElement('div');\n\t\tthis.bgDomNode.className = 'arrow-background';\n\t\tthis.bgDomNode.style.position = 'absolute';\n\t\tthis.bgDomNode.style.width = opts.bgWidth + 'px';\n\t\tthis.bgDomNode.style.height = opts.bgHeight + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.bgDomNode.style.top = '0px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.bgDomNode.style.left = '0px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.bgDomNode.style.bottom = '0px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.bgDomNode.style.right = '0px';\n\t\t}\n\n\t\tthis.domNode = document.createElement('div');\n\t\tthis.domNode.className = opts.className;\n\t\t// this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));\n\n\t\tthis.domNode.style.position = 'absolute';\n\t\tthis.domNode.style.width = ARROW_IMG_SIZE + 'px';\n\t\tthis.domNode.style.height = ARROW_IMG_SIZE + 'px';\n\t\tif (typeof opts.top !== 'undefined') {\n\t\t\tthis.domNode.style.top = opts.top + 'px';\n\t\t}\n\t\tif (typeof opts.left !== 'undefined') {\n\t\t\tthis.domNode.style.left = opts.left + 'px';\n\t\t}\n\t\tif (typeof opts.bottom !== 'undefined') {\n\t\t\tthis.domNode.style.bottom = opts.bottom + 'px';\n\t\t}\n\t\tif (typeof opts.right !== 'undefined') {\n\t\t\tthis.domNode.style.right = opts.right + 'px';\n\t\t}\n\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._register(dom.addStandardDisposableListener(this.bgDomNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\t\tthis._register(dom.addStandardDisposableListener(this.domNode, dom.EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));\n\n\t\tthis._pointerdownRepeatTimer = this._register(new dom.WindowIntervalTimer());\n\t\tthis._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer());\n\t}\n\n\tprivate _arrowPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst scheduleRepeater = () => {\n\t\t\tthis._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1000 / 24, dom.getWindow(e));\n\t\t};\n\n\t\tthis._onActivate();\n\t\tthis._pointerdownRepeatTimer.cancel();\n\t\tthis._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData) => { /* Intentional empty */ },\n\t\t\t() => {\n\t\t\t\tthis._pointerdownRepeatTimer.cancel();\n\t\t\t\tthis._pointerdownScheduleRepeatTimer.cancel();\n\t\t\t}\n\t\t);\n\n\t\te.preventDefault();\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { Disposable, IDisposable } from 'vs/base/common/lifecycle';\n\nexport const enum ScrollbarVisibility {\n\tAuto = 1,\n\tHidden = 2,\n\tVisible = 3\n}\n\nexport interface ScrollEvent {\n\tinSmoothScrolling: boolean;\n\n\toldWidth: number;\n\toldScrollWidth: number;\n\toldScrollLeft: number;\n\n\twidth: number;\n\tscrollWidth: number;\n\tscrollLeft: number;\n\n\toldHeight: number;\n\toldScrollHeight: number;\n\toldScrollTop: number;\n\n\theight: number;\n\tscrollHeight: number;\n\tscrollTop: number;\n\n\twidthChanged: boolean;\n\tscrollWidthChanged: boolean;\n\tscrollLeftChanged: boolean;\n\n\theightChanged: boolean;\n\tscrollHeightChanged: boolean;\n\tscrollTopChanged: boolean;\n}\n\nexport class ScrollState implements IScrollDimensions, IScrollPosition {\n\t_scrollStateBrand: void = undefined;\n\n\tpublic readonly rawScrollLeft: number;\n\tpublic readonly rawScrollTop: number;\n\n\tpublic readonly width: number;\n\tpublic readonly scrollWidth: number;\n\tpublic readonly scrollLeft: number;\n\tpublic readonly height: number;\n\tpublic readonly scrollHeight: number;\n\tpublic readonly scrollTop: number;\n\n\tconstructor(\n\t\tprivate readonly _forceIntegerValues: boolean,\n\t\twidth: number,\n\t\tscrollWidth: number,\n\t\tscrollLeft: number,\n\t\theight: number,\n\t\tscrollHeight: number,\n\t\tscrollTop: number\n\t) {\n\t\tif (this._forceIntegerValues) {\n\t\t\twidth = width | 0;\n\t\t\tscrollWidth = scrollWidth | 0;\n\t\t\tscrollLeft = scrollLeft | 0;\n\t\t\theight = height | 0;\n\t\t\tscrollHeight = scrollHeight | 0;\n\t\t\tscrollTop = scrollTop | 0;\n\t\t}\n\n\t\tthis.rawScrollLeft = scrollLeft; // before validation\n\t\tthis.rawScrollTop = scrollTop; // before validation\n\n\t\tif (width < 0) {\n\t\t\twidth = 0;\n\t\t}\n\t\tif (scrollLeft + width > scrollWidth) {\n\t\t\tscrollLeft = scrollWidth - width;\n\t\t}\n\t\tif (scrollLeft < 0) {\n\t\t\tscrollLeft = 0;\n\t\t}\n\n\t\tif (height < 0) {\n\t\t\theight = 0;\n\t\t}\n\t\tif (scrollTop + height > scrollHeight) {\n\t\t\tscrollTop = scrollHeight - height;\n\t\t}\n\t\tif (scrollTop < 0) {\n\t\t\tscrollTop = 0;\n\t\t}\n\n\t\tthis.width = width;\n\t\tthis.scrollWidth = scrollWidth;\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.height = height;\n\t\tthis.scrollHeight = scrollHeight;\n\t\tthis.scrollTop = scrollTop;\n\t}\n\n\tpublic equals(other: ScrollState): boolean {\n\t\treturn (\n\t\t\tthis.rawScrollLeft === other.rawScrollLeft\n\t\t\t&& this.rawScrollTop === other.rawScrollTop\n\t\t\t&& this.width === other.width\n\t\t\t&& this.scrollWidth === other.scrollWidth\n\t\t\t&& this.scrollLeft === other.scrollLeft\n\t\t\t&& this.height === other.height\n\t\t\t&& this.scrollHeight === other.scrollHeight\n\t\t\t&& this.scrollTop === other.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollDimensions(update: INewScrollDimensions, useRawScrollPositions: boolean): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\t(typeof update.width !== 'undefined' ? update.width : this.width),\n\t\t\t(typeof update.scrollWidth !== 'undefined' ? update.scrollWidth : this.scrollWidth),\n\t\t\tuseRawScrollPositions ? this.rawScrollLeft : this.scrollLeft,\n\t\t\t(typeof update.height !== 'undefined' ? update.height : this.height),\n\t\t\t(typeof update.scrollHeight !== 'undefined' ? update.scrollHeight : this.scrollHeight),\n\t\t\tuseRawScrollPositions ? this.rawScrollTop : this.scrollTop\n\t\t);\n\t}\n\n\tpublic withScrollPosition(update: INewScrollPosition): ScrollState {\n\t\treturn new ScrollState(\n\t\t\tthis._forceIntegerValues,\n\t\t\tthis.width,\n\t\t\tthis.scrollWidth,\n\t\t\t(typeof update.scrollLeft !== 'undefined' ? update.scrollLeft : this.rawScrollLeft),\n\t\t\tthis.height,\n\t\t\tthis.scrollHeight,\n\t\t\t(typeof update.scrollTop !== 'undefined' ? update.scrollTop : this.rawScrollTop)\n\t\t);\n\t}\n\n\tpublic createScrollEvent(previous: ScrollState, inSmoothScrolling: boolean): ScrollEvent {\n\t\tconst widthChanged = (this.width !== previous.width);\n\t\tconst scrollWidthChanged = (this.scrollWidth !== previous.scrollWidth);\n\t\tconst scrollLeftChanged = (this.scrollLeft !== previous.scrollLeft);\n\n\t\tconst heightChanged = (this.height !== previous.height);\n\t\tconst scrollHeightChanged = (this.scrollHeight !== previous.scrollHeight);\n\t\tconst scrollTopChanged = (this.scrollTop !== previous.scrollTop);\n\n\t\treturn {\n\t\t\tinSmoothScrolling: inSmoothScrolling,\n\t\t\toldWidth: previous.width,\n\t\t\toldScrollWidth: previous.scrollWidth,\n\t\t\toldScrollLeft: previous.scrollLeft,\n\n\t\t\twidth: this.width,\n\t\t\tscrollWidth: this.scrollWidth,\n\t\t\tscrollLeft: this.scrollLeft,\n\n\t\t\toldHeight: previous.height,\n\t\t\toldScrollHeight: previous.scrollHeight,\n\t\t\toldScrollTop: previous.scrollTop,\n\n\t\t\theight: this.height,\n\t\t\tscrollHeight: this.scrollHeight,\n\t\t\tscrollTop: this.scrollTop,\n\n\t\t\twidthChanged: widthChanged,\n\t\t\tscrollWidthChanged: scrollWidthChanged,\n\t\t\tscrollLeftChanged: scrollLeftChanged,\n\n\t\t\theightChanged: heightChanged,\n\t\t\tscrollHeightChanged: scrollHeightChanged,\n\t\t\tscrollTopChanged: scrollTopChanged,\n\t\t};\n\t}\n\n}\n\nexport interface IScrollDimensions {\n\treadonly width: number;\n\treadonly scrollWidth: number;\n\treadonly height: number;\n\treadonly scrollHeight: number;\n}\nexport interface INewScrollDimensions {\n\twidth?: number;\n\tscrollWidth?: number;\n\theight?: number;\n\tscrollHeight?: number;\n}\n\nexport interface IScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n}\nexport interface ISmoothScrollPosition {\n\treadonly scrollLeft: number;\n\treadonly scrollTop: number;\n\n\treadonly width: number;\n\treadonly height: number;\n}\nexport interface INewScrollPosition {\n\tscrollLeft?: number;\n\tscrollTop?: number;\n}\n\nexport interface IScrollableOptions {\n\t/**\n\t * Define if the scroll values should always be integers.\n\t */\n\tforceIntegerValues: boolean;\n\t/**\n\t * Set the duration (ms) used for smooth scroll animations.\n\t */\n\tsmoothScrollDuration: number;\n\t/**\n\t * A function to schedule an update at the next frame (used for smooth scroll animations).\n\t */\n\tscheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n}\n\nexport class Scrollable extends Disposable {\n\n\t_scrollableBrand: void = undefined;\n\n\tprivate _smoothScrollDuration: number;\n\tprivate readonly _scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable;\n\tprivate _state: ScrollState;\n\tprivate _smoothScrolling: SmoothScrollingOperation | null;\n\n\tprivate _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tconstructor(options: IScrollableOptions) {\n\t\tsuper();\n\n\t\tthis._smoothScrollDuration = options.smoothScrollDuration;\n\t\tthis._scheduleAtNextAnimationFrame = options.scheduleAtNextAnimationFrame;\n\t\tthis._state = new ScrollState(options.forceIntegerValues, 0, 0, 0, 0, 0, 0);\n\t\tthis._smoothScrolling = null;\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tpublic setSmoothScrollDuration(smoothScrollDuration: number): void {\n\t\tthis._smoothScrollDuration = smoothScrollDuration;\n\t}\n\n\tpublic validateScrollPosition(scrollPosition: INewScrollPosition): IScrollPosition {\n\t\treturn this._state.withScrollPosition(scrollPosition);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions, useRawScrollPositions: boolean): void {\n\t\tconst newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);\n\t\tthis._setState(newState, Boolean(this._smoothScrolling));\n\n\t\t// Validate outstanding animated scroll position target\n\t\tthis._smoothScrolling?.acceptScrollDimensions(this._state);\n\t}\n\n\t/**\n\t * Returns the final scroll position that the instance will have once the smooth scroll animation concludes.\n\t * If no scroll animation is occurring, it will return the current scroll position instead.\n\t */\n\tpublic getFutureScrollPosition(): IScrollPosition {\n\t\tif (this._smoothScrolling) {\n\t\t\treturn this._smoothScrolling.to;\n\t\t}\n\t\treturn this._state;\n\t}\n\n\t/**\n\t * Returns the current scroll position.\n\t * Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.\n\t */\n\tpublic getCurrentScrollPosition(): IScrollPosition {\n\t\treturn this._state;\n\t}\n\n\tpublic setScrollPositionNow(update: INewScrollPosition): void {\n\t\t// no smooth scrolling requested\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\t// Terminate any outstanding smooth scrolling\n\t\tif (this._smoothScrolling) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t}\n\n\t\tthis._setState(newState, false);\n\t}\n\n\tpublic setScrollPositionSmooth(update: INewScrollPosition, reuseAnimation?: boolean): void {\n\t\tif (this._smoothScrollDuration === 0) {\n\t\t\t// Smooth scrolling not supported.\n\t\t\treturn this.setScrollPositionNow(update);\n\t\t}\n\n\t\tif (this._smoothScrolling) {\n\t\t\t// Combine our pending scrollLeft/scrollTop with incoming scrollLeft/scrollTop\n\t\t\tupdate = {\n\t\t\t\tscrollLeft: (typeof update.scrollLeft === 'undefined' ? this._smoothScrolling.to.scrollLeft : update.scrollLeft),\n\t\t\t\tscrollTop: (typeof update.scrollTop === 'undefined' ? this._smoothScrolling.to.scrollTop : update.scrollTop)\n\t\t\t};\n\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tif (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {\n\t\t\t\t// No need to interrupt or extend the current animation since we're going to the same place\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet newSmoothScrolling: SmoothScrollingOperation;\n\t\t\tif (reuseAnimation) {\n\t\t\t\tnewSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);\n\t\t\t} else {\n\t\t\t\tnewSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);\n\t\t\t}\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = newSmoothScrolling;\n\t\t} else {\n\t\t\t// Validate `update`\n\t\t\tconst validTarget = this._state.withScrollPosition(update);\n\n\t\t\tthis._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);\n\t\t}\n\n\t\t// Begin smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tpublic hasPendingScrollAnimation(): boolean {\n\t\treturn Boolean(this._smoothScrolling);\n\t}\n\n\tprivate _performSmoothScrolling(): void {\n\t\tif (!this._smoothScrolling) {\n\t\t\treturn;\n\t\t}\n\t\tconst update = this._smoothScrolling.tick();\n\t\tconst newState = this._state.withScrollPosition(update);\n\n\t\tthis._setState(newState, true);\n\n\t\tif (!this._smoothScrolling) {\n\t\t\t// Looks like someone canceled the smooth scrolling\n\t\t\t// from the scroll event handler\n\t\t\treturn;\n\t\t}\n\n\t\tif (update.isDone) {\n\t\t\tthis._smoothScrolling.dispose();\n\t\t\tthis._smoothScrolling = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Continue smooth scrolling animation\n\t\tthis._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {\n\t\t\tif (!this._smoothScrolling) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._smoothScrolling.animationFrameDisposable = null;\n\t\t\tthis._performSmoothScrolling();\n\t\t});\n\t}\n\n\tprivate _setState(newState: ScrollState, inSmoothScrolling: boolean): void {\n\t\tconst oldState = this._state;\n\t\tif (oldState.equals(newState)) {\n\t\t\t// no change\n\t\t\treturn;\n\t\t}\n\t\tthis._state = newState;\n\t\tthis._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));\n\t}\n}\n\nexport class SmoothScrollingUpdate {\n\n\tpublic readonly scrollLeft: number;\n\tpublic readonly scrollTop: number;\n\tpublic readonly isDone: boolean;\n\n\tconstructor(scrollLeft: number, scrollTop: number, isDone: boolean) {\n\t\tthis.scrollLeft = scrollLeft;\n\t\tthis.scrollTop = scrollTop;\n\t\tthis.isDone = isDone;\n\t}\n\n}\n\ninterface IAnimation {\n\t(completion: number): number;\n}\n\nfunction createEaseOutCubic(from: number, to: number): IAnimation {\n\tconst delta = to - from;\n\treturn function (completion: number): number {\n\t\treturn from + delta * easeOutCubic(completion);\n\t};\n}\n\nfunction createComposed(a: IAnimation, b: IAnimation, cut: number): IAnimation {\n\treturn function (completion: number): number {\n\t\tif (completion < cut) {\n\t\t\treturn a(completion / cut);\n\t\t}\n\t\treturn b((completion - cut) / (1 - cut));\n\t};\n}\n\nexport class SmoothScrollingOperation {\n\n\tpublic readonly from: ISmoothScrollPosition;\n\tpublic to: ISmoothScrollPosition;\n\tpublic readonly duration: number;\n\tpublic readonly startTime: number;\n\tpublic animationFrameDisposable: IDisposable | null;\n\n\tprivate scrollLeft!: IAnimation;\n\tprivate scrollTop!: IAnimation;\n\n\tconstructor(from: ISmoothScrollPosition, to: ISmoothScrollPosition, startTime: number, duration: number) {\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.duration = duration;\n\t\tthis.startTime = startTime;\n\n\t\tthis.animationFrameDisposable = null;\n\n\t\tthis._initAnimations();\n\t}\n\n\tprivate _initAnimations(): void {\n\t\tthis.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);\n\t\tthis.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);\n\t}\n\n\tprivate _initAnimation(from: number, to: number, viewportSize: number): IAnimation {\n\t\tconst delta = Math.abs(from - to);\n\t\tif (delta > 2.5 * viewportSize) {\n\t\t\tlet stop1: number, stop2: number;\n\t\t\tif (from < to) {\n\t\t\t\t// scroll to 75% of the viewportSize\n\t\t\t\tstop1 = from + 0.75 * viewportSize;\n\t\t\t\tstop2 = to - 0.75 * viewportSize;\n\t\t\t} else {\n\t\t\t\tstop1 = from - 0.75 * viewportSize;\n\t\t\t\tstop2 = to + 0.75 * viewportSize;\n\t\t\t}\n\t\t\treturn createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);\n\t\t}\n\t\treturn createEaseOutCubic(from, to);\n\t}\n\n\tpublic dispose(): void {\n\t\tif (this.animationFrameDisposable !== null) {\n\t\t\tthis.animationFrameDisposable.dispose();\n\t\t\tthis.animationFrameDisposable = null;\n\t\t}\n\t}\n\n\tpublic acceptScrollDimensions(state: ScrollState): void {\n\t\tthis.to = state.withScrollPosition(this.to);\n\t\tthis._initAnimations();\n\t}\n\n\tpublic tick(): SmoothScrollingUpdate {\n\t\treturn this._tick(Date.now());\n\t}\n\n\tprotected _tick(now: number): SmoothScrollingUpdate {\n\t\tconst completion = (now - this.startTime) / this.duration;\n\n\t\tif (completion < 1) {\n\t\t\tconst newScrollLeft = this.scrollLeft(completion);\n\t\t\tconst newScrollTop = this.scrollTop(completion);\n\t\t\treturn new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);\n\t\t}\n\n\t\treturn new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);\n\t}\n\n\tpublic combine(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\treturn SmoothScrollingOperation.start(from, to, duration);\n\t}\n\n\tpublic static start(from: ISmoothScrollPosition, to: ISmoothScrollPosition, duration: number): SmoothScrollingOperation {\n\t\t// +10 / -10 : pretend the animation already started for a quicker response to a scroll request\n\t\tduration = duration + 10;\n\t\tconst startTime = Date.now() - 10;\n\n\t\treturn new SmoothScrollingOperation(from, to, startTime, duration);\n\t}\n}\n\nfunction easeInCubic(t: number) {\n\treturn Math.pow(t, 3);\n}\n\nfunction easeOutCubic(t: number) {\n\treturn 1 - easeInCubic(1 - t);\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Disposable } from 'vs/base/common/lifecycle';\nimport { ScrollbarVisibility } from 'vs/base/common/scrollable';\n\nexport class ScrollbarVisibilityController extends Disposable {\n\tprivate _visibility: ScrollbarVisibility;\n\tprivate _visibleClassName: string;\n\tprivate _invisibleClassName: string;\n\tprivate _domNode: FastDomNode | null;\n\tprivate _rawShouldBeVisible: boolean;\n\tprivate _shouldBeVisible: boolean;\n\tprivate _isNeeded: boolean;\n\tprivate _isVisible: boolean;\n\tprivate _revealTimer: TimeoutTimer;\n\n\tconstructor(visibility: ScrollbarVisibility, visibleClassName: string, invisibleClassName: string) {\n\t\tsuper();\n\t\tthis._visibility = visibility;\n\t\tthis._visibleClassName = visibleClassName;\n\t\tthis._invisibleClassName = invisibleClassName;\n\t\tthis._domNode = null;\n\t\tthis._isVisible = false;\n\t\tthis._isNeeded = false;\n\t\tthis._rawShouldBeVisible = false;\n\t\tthis._shouldBeVisible = false;\n\t\tthis._revealTimer = this._register(new TimeoutTimer());\n\t}\n\n\tpublic setVisibility(visibility: ScrollbarVisibility): void {\n\t\tif (this._visibility !== visibility) {\n\t\t\tthis._visibility = visibility;\n\t\t\tthis._updateShouldBeVisible();\n\t\t}\n\t}\n\n\t// ----------------- Hide / Reveal\n\n\tpublic setShouldBeVisible(rawShouldBeVisible: boolean): void {\n\t\tthis._rawShouldBeVisible = rawShouldBeVisible;\n\t\tthis._updateShouldBeVisible();\n\t}\n\n\tprivate _applyVisibilitySetting(): boolean {\n\t\tif (this._visibility === ScrollbarVisibility.Hidden) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this._visibility === ScrollbarVisibility.Visible) {\n\t\t\treturn true;\n\t\t}\n\t\treturn this._rawShouldBeVisible;\n\t}\n\n\tprivate _updateShouldBeVisible(): void {\n\t\tconst shouldBeVisible = this._applyVisibilitySetting();\n\n\t\tif (this._shouldBeVisible !== shouldBeVisible) {\n\t\t\tthis._shouldBeVisible = shouldBeVisible;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setIsNeeded(isNeeded: boolean): void {\n\t\tif (this._isNeeded !== isNeeded) {\n\t\t\tthis._isNeeded = isNeeded;\n\t\t\tthis.ensureVisibility();\n\t\t}\n\t}\n\n\tpublic setDomNode(domNode: FastDomNode): void {\n\t\tthis._domNode = domNode;\n\t\tthis._domNode.setClassName(this._invisibleClassName);\n\n\t\t// Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration\n\t\tthis.setShouldBeVisible(false);\n\t}\n\n\tpublic ensureVisibility(): void {\n\n\t\tif (!this._isNeeded) {\n\t\t\t// Nothing to be rendered\n\t\t\tthis._hide(false);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._shouldBeVisible) {\n\t\t\tthis._reveal();\n\t\t} else {\n\t\t\tthis._hide(true);\n\t\t}\n\t}\n\n\tprivate _reveal(): void {\n\t\tif (this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = true;\n\n\t\t// The CSS animation doesn't play otherwise\n\t\tthis._revealTimer.setIfNotSet(() => {\n\t\t\tthis._domNode?.setClassName(this._visibleClassName);\n\t\t}, 0);\n\t}\n\n\tprivate _hide(withFadeAway: boolean): void {\n\t\tthis._revealTimer.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._domNode?.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from 'vs/base/browser/dom';\nimport { createFastDomNode, FastDomNode } from 'vs/base/browser/fastDomNode';\nimport { GlobalPointerMoveMonitor } from 'vs/base/browser/globalPointerMoveMonitor';\nimport { StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarArrow, ScrollbarArrowOptions } from 'vs/base/browser/ui/scrollbar/scrollbarArrow';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { ScrollbarVisibilityController } from 'vs/base/browser/ui/scrollbar/scrollbarVisibilityController';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n\n/**\n * The orthogonal distance to the slider at which dragging \"resets\". This implements \"snapping\"\n */\nconst POINTER_DRAG_RESET_DISTANCE = 140;\n\nexport interface ISimplifiedPointerEvent {\n\tbuttons: number;\n\tpageX: number;\n\tpageY: number;\n}\n\nexport interface ScrollbarHost {\n\tonMouseWheel(mouseWheelEvent: StandardWheelEvent): void;\n\tonDragStart(): void;\n\tonDragEnd(): void;\n}\n\nexport interface AbstractScrollbarOptions {\n\tlazyRender: boolean;\n\thost: ScrollbarHost;\n\tscrollbarState: ScrollbarState;\n\tvisibility: ScrollbarVisibility;\n\textraScrollbarClassName: string;\n\tscrollable: Scrollable;\n\tscrollByPage: boolean;\n}\n\nexport abstract class AbstractScrollbar extends Widget {\n\n\tprotected _host: ScrollbarHost;\n\tprotected _scrollable: Scrollable;\n\tprotected _scrollByPage: boolean;\n\tprivate _lazyRender: boolean;\n\tprotected _scrollbarState: ScrollbarState;\n\tprotected _visibilityController: ScrollbarVisibilityController;\n\tprivate _pointerMoveMonitor: GlobalPointerMoveMonitor;\n\n\tpublic domNode: FastDomNode;\n\tpublic slider!: FastDomNode;\n\n\tprotected _shouldRender: boolean;\n\n\tconstructor(opts: AbstractScrollbarOptions) {\n\t\tsuper();\n\t\tthis._lazyRender = opts.lazyRender;\n\t\tthis._host = opts.host;\n\t\tthis._scrollable = opts.scrollable;\n\t\tthis._scrollByPage = opts.scrollByPage;\n\t\tthis._scrollbarState = opts.scrollbarState;\n\t\tthis._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));\n\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\tthis._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());\n\t\tthis._shouldRender = true;\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tthis.domNode.setAttribute('role', 'presentation');\n\t\tthis.domNode.setAttribute('aria-hidden', 'true');\n\n\t\tthis._visibilityController.setDomNode(this.domNode);\n\t\tthis.domNode.setPosition('absolute');\n\n\t\tthis._register(dom.addDisposableListener(this.domNode.domNode, dom.EventType.POINTER_DOWN, (e: PointerEvent) => this._domNodePointerDown(e)));\n\t}\n\n\t// ----------------- creation\n\n\t/**\n\t * Creates the dom node for an arrow & adds it to the container\n\t */\n\tprotected _createArrow(opts: ScrollbarArrowOptions): void {\n\t\tconst arrow = this._register(new ScrollbarArrow(opts));\n\t\tthis.domNode.domNode.appendChild(arrow.bgDomNode);\n\t\tthis.domNode.domNode.appendChild(arrow.domNode);\n\t}\n\n\t/**\n\t * Creates the slider dom node, adds it to the container & hooks up the events\n\t */\n\tprotected _createSlider(top: number, left: number, width: number | undefined, height: number | undefined): void {\n\t\tthis.slider = createFastDomNode(document.createElement('div'));\n\t\tthis.slider.setClassName('slider');\n\t\tthis.slider.setPosition('absolute');\n\t\tthis.slider.setTop(top);\n\t\tthis.slider.setLeft(left);\n\t\tif (typeof width === 'number') {\n\t\t\tthis.slider.setWidth(width);\n\t\t}\n\t\tif (typeof height === 'number') {\n\t\t\tthis.slider.setHeight(height);\n\t\t}\n\t\tthis.slider.setLayerHinting(true);\n\t\tthis.slider.setContain('strict');\n\n\t\tthis.domNode.domNode.appendChild(this.slider.domNode);\n\n\t\tthis._register(dom.addDisposableListener(\n\t\t\tthis.slider.domNode,\n\t\t\tdom.EventType.POINTER_DOWN,\n\t\t\t(e: PointerEvent) => {\n\t\t\t\tif (e.button === 0) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t\t}\n\t\t\t}\n\t\t));\n\n\t\tthis.onclick(this.slider.domNode, e => {\n\t\t\tif (e.leftButton) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\t}\n\n\t// ----------------- Update state\n\n\tprotected _onElementSize(visibleSize: number): boolean {\n\t\tif (this._scrollbarState.setVisibleSize(visibleSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollSize(elementScrollSize: number): boolean {\n\t\tif (this._scrollbarState.setScrollSize(elementScrollSize)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _onElementScrollPosition(elementScrollPosition: number): boolean {\n\t\tif (this._scrollbarState.setScrollPosition(elementScrollPosition)) {\n\t\t\tthis._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());\n\t\t\tthis._shouldRender = true;\n\t\t\tif (!this._lazyRender) {\n\t\t\t\tthis.render();\n\t\t\t}\n\t\t}\n\t\treturn this._shouldRender;\n\t}\n\n\t// ----------------- rendering\n\n\tpublic beginReveal(): void {\n\t\tthis._visibilityController.setShouldBeVisible(true);\n\t}\n\n\tpublic beginHide(): void {\n\t\tthis._visibilityController.setShouldBeVisible(false);\n\t}\n\n\tpublic render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\t\tthis._shouldRender = false;\n\n\t\tthis._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());\n\t\tthis._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());\n\t}\n\t// ----------------- DOM events\n\n\tprivate _domNodePointerDown(e: PointerEvent): void {\n\t\tif (e.target !== this.domNode.domNode) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onPointerDown(e);\n\t}\n\n\tpublic delegatePointerDown(e: PointerEvent): void {\n\t\tconst domTop = this.domNode.domNode.getClientRects()[0].top;\n\t\tconst sliderStart = domTop + this._scrollbarState.getSliderPosition();\n\t\tconst sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();\n\t\tconst pointerPos = this._sliderPointerPosition(e);\n\t\tif (sliderStart <= pointerPos && pointerPos <= sliderStop) {\n\t\t\t// Act as if it was a pointer down on the slider\n\t\t\tif (e.button === 0) {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis._sliderPointerDown(e);\n\t\t\t}\n\t\t} else {\n\t\t\t// Act as if it was a pointer down on the scrollbar\n\t\t\tthis._onPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _onPointerDown(e: PointerEvent): void {\n\t\tlet offsetX: number;\n\t\tlet offsetY: number;\n\t\tif (e.target === this.domNode.domNode && typeof e.offsetX === 'number' && typeof e.offsetY === 'number') {\n\t\t\toffsetX = e.offsetX;\n\t\t\toffsetY = e.offsetY;\n\t\t} else {\n\t\t\tconst domNodePosition = dom.getDomNodePagePosition(this.domNode.domNode);\n\t\t\toffsetX = e.pageX - domNodePosition.left;\n\t\t\toffsetY = e.pageY - domNodePosition.top;\n\t\t}\n\n\t\tconst offset = this._pointerDownRelativePosition(offsetX, offsetY);\n\t\tthis._setDesiredScrollPositionNow(\n\t\t\tthis._scrollByPage\n\t\t\t\t? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset)\n\t\t\t\t: this._scrollbarState.getDesiredScrollPositionFromOffset(offset)\n\t\t);\n\n\t\tif (e.button === 0) {\n\t\t\t// left button\n\t\t\te.preventDefault();\n\t\t\tthis._sliderPointerDown(e);\n\t\t}\n\t}\n\n\tprivate _sliderPointerDown(e: PointerEvent): void {\n\t\tif (!e.target || !(e.target instanceof Element)) {\n\t\t\treturn;\n\t\t}\n\t\tconst initialPointerPosition = this._sliderPointerPosition(e);\n\t\tconst initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);\n\t\tconst initialScrollbarState = this._scrollbarState.clone();\n\t\tthis.slider.toggleClassName('active', true);\n\n\t\tthis._pointerMoveMonitor.startMonitoring(\n\t\t\te.target,\n\t\t\te.pointerId,\n\t\t\te.buttons,\n\t\t\t(pointerMoveData: PointerEvent) => {\n\t\t\t\tconst pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);\n\n\t\t\t\tif (platform.isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {\n\t\t\t\t\t// The pointer has wondered away from the scrollbar => reset dragging\n\t\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst pointerPosition = this._sliderPointerPosition(pointerMoveData);\n\t\t\t\tconst pointerDelta = pointerPosition - initialPointerPosition;\n\t\t\t\tthis._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis.slider.toggleClassName('active', false);\n\t\t\t\tthis._host.onDragEnd();\n\t\t\t}\n\t\t);\n\n\t\tthis._host.onDragStart();\n\t}\n\n\tprivate _setDesiredScrollPositionNow(_desiredScrollPosition: number): void {\n\n\t\tconst desiredScrollPosition: INewScrollPosition = {};\n\t\tthis.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);\n\n\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t}\n\n\tpublic updateScrollbarSize(scrollbarSize: number): void {\n\t\tthis._updateScrollbarSize(scrollbarSize);\n\t\tthis._scrollbarState.setScrollbarSize(scrollbarSize);\n\t\tthis._shouldRender = true;\n\t\tif (!this._lazyRender) {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._scrollbarState.isNeeded();\n\t}\n\n\t// ----------------- Overwrite these\n\n\tprotected abstract _renderDomNode(largeSize: number, smallSize: number): void;\n\tprotected abstract _updateSlider(sliderSize: number, sliderPosition: number): void;\n\n\tprotected abstract _pointerDownRelativePosition(offsetX: number, offsetY: number): number;\n\tprotected abstract _sliderPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number;\n\tprotected abstract _updateScrollbarSize(size: number): void;\n\n\tpublic abstract writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.\n */\nconst MINIMUM_SLIDER_SIZE = 20;\n\nexport class ScrollbarState {\n\n\t/**\n\t * For the vertical scrollbar: the width.\n\t * For the horizontal scrollbar: the height.\n\t */\n\tprivate _scrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the pair horizontal scrollbar.\n\t * For the horizontal scrollbar: the width of the pair vertical scrollbar.\n\t */\n\tprivate _oppositeScrollbarSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the height of the scrollbar's arrows.\n\t * For the horizontal scrollbar: the width of the scrollbar's arrows.\n\t */\n\tprivate readonly _arrowSize: number;\n\n\t// --- variables\n\t/**\n\t * For the vertical scrollbar: the viewport height.\n\t * For the horizontal scrollbar: the viewport width.\n\t */\n\tprivate _visibleSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll height.\n\t * For the horizontal scrollbar: the scroll width.\n\t */\n\tprivate _scrollSize: number;\n\n\t/**\n\t * For the vertical scrollbar: the scroll top.\n\t * For the horizontal scrollbar: the scroll left.\n\t */\n\tprivate _scrollPosition: number;\n\n\t// --- computed variables\n\n\t/**\n\t * `visibleSize` - `oppositeScrollbarSize`\n\t */\n\tprivate _computedAvailableSize: number;\n\t/**\n\t * (`scrollSize` > 0 && `scrollSize` > `visibleSize`)\n\t */\n\tprivate _computedIsNeeded: boolean;\n\n\tprivate _computedSliderSize: number;\n\tprivate _computedSliderRatio: number;\n\tprivate _computedSliderPosition: number;\n\n\tconstructor(arrowSize: number, scrollbarSize: number, oppositeScrollbarSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t\tthis._arrowSize = Math.round(arrowSize);\n\n\t\tthis._visibleSize = visibleSize;\n\t\tthis._scrollSize = scrollSize;\n\t\tthis._scrollPosition = scrollPosition;\n\n\t\tthis._computedAvailableSize = 0;\n\t\tthis._computedIsNeeded = false;\n\t\tthis._computedSliderSize = 0;\n\t\tthis._computedSliderRatio = 0;\n\t\tthis._computedSliderPosition = 0;\n\n\t\tthis._refreshComputedValues();\n\t}\n\n\tpublic clone(): ScrollbarState {\n\t\treturn new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t}\n\n\tpublic setVisibleSize(visibleSize: number): boolean {\n\t\tconst iVisibleSize = Math.round(visibleSize);\n\t\tif (this._visibleSize !== iVisibleSize) {\n\t\t\tthis._visibleSize = iVisibleSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollSize(scrollSize: number): boolean {\n\t\tconst iScrollSize = Math.round(scrollSize);\n\t\tif (this._scrollSize !== iScrollSize) {\n\t\t\tthis._scrollSize = iScrollSize;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollPosition(scrollPosition: number): boolean {\n\t\tconst iScrollPosition = Math.round(scrollPosition);\n\t\tif (this._scrollPosition !== iScrollPosition) {\n\t\t\tthis._scrollPosition = iScrollPosition;\n\t\t\tthis._refreshComputedValues();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic setScrollbarSize(scrollbarSize: number): void {\n\t\tthis._scrollbarSize = Math.round(scrollbarSize);\n\t}\n\n\tpublic setOppositeScrollbarSize(oppositeScrollbarSize: number): void {\n\t\tthis._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);\n\t}\n\n\tprivate static _computeValues(oppositeScrollbarSize: number, arrowSize: number, visibleSize: number, scrollSize: number, scrollPosition: number) {\n\t\tconst computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);\n\t\tconst computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);\n\t\tconst computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);\n\n\t\tif (!computedIsNeeded) {\n\t\t\t// There is no need for a slider\n\t\t\treturn {\n\t\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\t\tcomputedSliderSize: Math.round(computedRepresentableSize),\n\t\t\t\tcomputedSliderRatio: 0,\n\t\t\t\tcomputedSliderPosition: 0,\n\t\t\t};\n\t\t}\n\n\t\t// We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise\n\t\tconst computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));\n\n\t\t// The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`\n\t\t// in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.\n\t\tconst computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);\n\t\tconst computedSliderPosition = (scrollPosition * computedSliderRatio);\n\n\t\treturn {\n\t\t\tcomputedAvailableSize: Math.round(computedAvailableSize),\n\t\t\tcomputedIsNeeded: computedIsNeeded,\n\t\t\tcomputedSliderSize: Math.round(computedSliderSize),\n\t\t\tcomputedSliderRatio: computedSliderRatio,\n\t\t\tcomputedSliderPosition: Math.round(computedSliderPosition),\n\t\t};\n\t}\n\n\tprivate _refreshComputedValues(): void {\n\t\tconst r = ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);\n\t\tthis._computedAvailableSize = r.computedAvailableSize;\n\t\tthis._computedIsNeeded = r.computedIsNeeded;\n\t\tthis._computedSliderSize = r.computedSliderSize;\n\t\tthis._computedSliderRatio = r.computedSliderRatio;\n\t\tthis._computedSliderPosition = r.computedSliderPosition;\n\t}\n\n\tpublic getArrowSize(): number {\n\t\treturn this._arrowSize;\n\t}\n\n\tpublic getScrollPosition(): number {\n\t\treturn this._scrollPosition;\n\t}\n\n\tpublic getRectangleLargeSize(): number {\n\t\treturn this._computedAvailableSize;\n\t}\n\n\tpublic getRectangleSmallSize(): number {\n\t\treturn this._scrollbarSize;\n\t}\n\n\tpublic isNeeded(): boolean {\n\t\treturn this._computedIsNeeded;\n\t}\n\n\tpublic getSliderSize(): number {\n\t\treturn this._computedSliderSize;\n\t}\n\n\tpublic getSliderPosition(): number {\n\t\treturn this._computedSliderPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.\n\t * `offset` is based on the same coordinate system as the `sliderPosition`.\n\t */\n\tpublic getDesiredScrollPositionFromOffset(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` from if offset is before or after the slider position.\n\t * If offset is before slider, treat as a page up (or left). If after, page down (or right).\n\t * `offset` and `_computedSliderPosition` are based on the same coordinate system.\n\t * `_visibleSize` corresponds to a \"page\" of lines in the returned coordinate system.\n\t */\n\tpublic getDesiredScrollPositionFromOffsetPaged(offset: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst correctedOffset = offset - this._arrowSize; // compensate if has arrows\n\t\tlet desiredScrollPosition = this._scrollPosition;\n\t\tif (correctedOffset < this._computedSliderPosition) {\n\t\t\tdesiredScrollPosition -= this._visibleSize; // page up/left\n\t\t} else {\n\t\t\tdesiredScrollPosition += this._visibleSize; // page down/right\n\t\t}\n\t\treturn desiredScrollPosition;\n\t}\n\n\t/**\n\t * Compute a desired `scrollPosition` such that the slider moves by `delta`.\n\t */\n\tpublic getDesiredScrollPositionFromDelta(delta: number): number {\n\t\tif (!this._computedIsNeeded) {\n\t\t\t// no need for a slider\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst desiredSliderPosition = this._computedSliderPosition + delta;\n\t\treturn Math.round(desiredSliderPosition / this._computedSliderRatio);\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\n\nexport class HorizontalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.horizontalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\tscrollDimensions.width,\n\t\t\t\tscrollDimensions.scrollWidth,\n\t\t\t\tscrollPosition.scrollLeft\n\t\t\t),\n\t\t\tvisibility: options.horizontal,\n\t\t\textraScrollbarClassName: 'horizontal',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.horizontalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonLeft,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: arrowDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonRight,\n\t\t\t// \ttop: scrollbarDelta,\n\t\t\t// \tleft: undefined,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: arrowDelta,\n\t\t\t// \tbgWidth: options.arrowSize,\n\t\t\t// \tbgHeight: options.horizontalScrollbarSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setWidth(sliderSize);\n\t\tthis.slider.setLeft(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(largeSize);\n\t\tthis.domNode.setHeight(smallSize);\n\t\tthis.domNode.setLeft(0);\n\t\tthis.domNode.setBottom(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.width) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetX;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setHeight(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollLeft = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.horizontal === ScrollbarVisibility.Hidden ? 0 : options.horizontalScrollbarSize);\n\t\tthis._scrollbarState.setOppositeScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\tthis._visibilityController.setVisibility(options.horizontal);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { AbstractScrollbar, ISimplifiedPointerEvent, ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { ScrollbarState } from 'vs/base/browser/ui/scrollbar/scrollbarState';\nimport { INewScrollPosition, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';\n\n\n\nexport class VerticalScrollbar extends AbstractScrollbar {\n\n\tconstructor(scrollable: Scrollable, options: ScrollableElementResolvedOptions, host: ScrollbarHost) {\n\t\tconst scrollDimensions = scrollable.getScrollDimensions();\n\t\tconst scrollPosition = scrollable.getCurrentScrollPosition();\n\t\tsuper({\n\t\t\tlazyRender: options.lazyRender,\n\t\t\thost: host,\n\t\t\tscrollbarState: new ScrollbarState(\n\t\t\t\t(options.verticalHasArrows ? options.arrowSize : 0),\n\t\t\t\t(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize),\n\t\t\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\t\t\t0,\n\t\t\t\tscrollDimensions.height,\n\t\t\t\tscrollDimensions.scrollHeight,\n\t\t\t\tscrollPosition.scrollTop\n\t\t\t),\n\t\t\tvisibility: options.vertical,\n\t\t\textraScrollbarClassName: 'vertical',\n\t\t\tscrollable: scrollable,\n\t\t\tscrollByPage: options.scrollByPage\n\t\t});\n\n\t\tif (options.verticalHasArrows) {\n throw new Error('horizontalHasArrows is not supported in xterm.js');\n\t\t\t// const arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;\n\t\t\t// const scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonUp,\n\t\t\t// \ttop: arrowDelta,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: undefined,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1)),\n\t\t\t// });\n\n\t\t\t// this._createArrow({\n\t\t\t// \tclassName: 'scra',\n\t\t\t// \ticon: Codicon.scrollbarButtonDown,\n\t\t\t// \ttop: undefined,\n\t\t\t// \tleft: scrollbarDelta,\n\t\t\t// \tbottom: arrowDelta,\n\t\t\t// \tright: undefined,\n\t\t\t// \tbgWidth: options.verticalScrollbarSize,\n\t\t\t// \tbgHeight: options.arrowSize,\n\t\t\t// \tonActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1)),\n\t\t\t// });\n\t\t}\n\n\t\tthis._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);\n\t}\n\n\tprotected _updateSlider(sliderSize: number, sliderPosition: number): void {\n\t\tthis.slider.setHeight(sliderSize);\n\t\tthis.slider.setTop(sliderPosition);\n\t}\n\n\tprotected _renderDomNode(largeSize: number, smallSize: number): void {\n\t\tthis.domNode.setWidth(smallSize);\n\t\tthis.domNode.setHeight(largeSize);\n\t\tthis.domNode.setRight(0);\n\t\tthis.domNode.setTop(0);\n\t}\n\n\tpublic onDidScroll(e: ScrollEvent): boolean {\n\t\tthis._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;\n\t\tthis._shouldRender = this._onElementSize(e.height) || this._shouldRender;\n\t\treturn this._shouldRender;\n\t}\n\n\tprotected _pointerDownRelativePosition(offsetX: number, offsetY: number): number {\n\t\treturn offsetY;\n\t}\n\n\tprotected _sliderPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageY;\n\t}\n\n\tprotected _sliderOrthogonalPointerPosition(e: ISimplifiedPointerEvent): number {\n\t\treturn e.pageX;\n\t}\n\n\tprotected _updateScrollbarSize(size: number): void {\n\t\tthis.slider.setWidth(size);\n\t}\n\n\tpublic writeScrollPosition(target: INewScrollPosition, scrollPosition: number): void {\n\t\ttarget.scrollTop = scrollPosition;\n\t}\n\n\tpublic updateOptions(options: ScrollableElementResolvedOptions): void {\n\t\tthis.updateScrollbarSize(options.vertical === ScrollbarVisibility.Hidden ? 0 : options.verticalScrollbarSize);\n\t\t// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom\n\t\tthis._scrollbarState.setOppositeScrollbarSize(0);\n\t\tthis._visibilityController.setVisibility(options.vertical);\n\t\tthis._scrollByPage = options.scrollByPage;\n\t}\n\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { getZoomFactor, isChrome } from 'vs/base/browser/browser';\nimport * as dom from 'vs/base/browser/dom';\nimport { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';\nimport { IMouseEvent, IMouseWheelEvent, StandardWheelEvent } from 'vs/base/browser/mouseEvent';\nimport { ScrollbarHost } from 'vs/base/browser/ui/scrollbar/abstractScrollbar';\nimport { HorizontalScrollbar } from 'vs/base/browser/ui/scrollbar/horizontalScrollbar';\nimport { ScrollableElementChangeOptions, ScrollableElementCreationOptions, ScrollableElementResolvedOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { VerticalScrollbar } from 'vs/base/browser/ui/scrollbar/verticalScrollbar';\nimport { Widget } from 'vs/base/browser/ui/widget';\nimport { TimeoutTimer } from 'vs/base/common/async';\nimport { Emitter, Event } from 'vs/base/common/event';\nimport { IDisposable, dispose } from 'vs/base/common/lifecycle';\nimport * as platform from 'vs/base/common/platform';\nimport { INewScrollDimensions, INewScrollPosition, IScrollDimensions, IScrollPosition, ScrollEvent, Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';\n// import 'vs/css!./media/scrollbars';\n\nconst HIDE_TIMEOUT = 500;\nconst SCROLL_WHEEL_SENSITIVITY = 50;\nconst SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;\n\nexport interface IOverviewRulerLayoutInfo {\n\tparent: HTMLElement;\n\tinsertBefore: HTMLElement;\n}\n\nclass MouseWheelClassifierItem {\n\tpublic timestamp: number;\n\tpublic deltaX: number;\n\tpublic deltaY: number;\n\tpublic score: number;\n\n\tconstructor(timestamp: number, deltaX: number, deltaY: number) {\n\t\tthis.timestamp = timestamp;\n\t\tthis.deltaX = deltaX;\n\t\tthis.deltaY = deltaY;\n\t\tthis.score = 0;\n\t}\n}\n\nexport class MouseWheelClassifier {\n\n\tpublic static readonly INSTANCE = new MouseWheelClassifier();\n\n\tprivate readonly _capacity: number;\n\tprivate _memory: MouseWheelClassifierItem[];\n\tprivate _front: number;\n\tprivate _rear: number;\n\n\tconstructor() {\n\t\tthis._capacity = 5;\n\t\tthis._memory = [];\n\t\tthis._front = -1;\n\t\tthis._rear = -1;\n\t}\n\n\tpublic isPhysicalMouseWheel(): boolean {\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\t// no elements\n\t\t\treturn false;\n\t\t}\n\n\t\t// 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...\n\t\tlet remainingInfluence = 1;\n\t\tlet score = 0;\n\t\tlet iteration = 1;\n\n\t\tlet index = this._rear;\n\t\tdo {\n\t\t\tconst influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));\n\t\t\tremainingInfluence -= influence;\n\t\t\tscore += this._memory[index].score * influence;\n\n\t\t\tif (index === this._front) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tindex = (this._capacity + index - 1) % this._capacity;\n\t\t\titeration++;\n\t\t} while (true);\n\n\t\treturn (score <= 0.5);\n\t}\n\n\tpublic acceptStandardWheelEvent(e: StandardWheelEvent): void {\n\t\tif (isChrome) {\n\t\t\tconst targetWindow = dom.getWindow(e.browserEvent);\n\t\t\tconst pageZoomFactor = getZoomFactor(targetWindow);\n\t\t\t// On Chrome, the incoming delta events are multiplied with the OS zoom factor.\n\t\t\t// The OS zoom factor can be reverse engineered by using the device pixel ratio and the configured zoom factor into account.\n\t\t\tthis.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);\n\t\t} else {\n\t\t\tthis.accept(Date.now(), e.deltaX, e.deltaY);\n\t\t}\n\t}\n\n\tpublic accept(timestamp: number, deltaX: number, deltaY: number): void {\n\t\tlet previousItem = null;\n\t\tconst item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);\n\n\t\tif (this._front === -1 && this._rear === -1) {\n\t\t\tthis._memory[0] = item;\n\t\t\tthis._front = 0;\n\t\t\tthis._rear = 0;\n\t\t} else {\n\t\t\tpreviousItem = this._memory[this._rear];\n\n\t\t\tthis._rear = (this._rear + 1) % this._capacity;\n\t\t\tif (this._rear === this._front) {\n\t\t\t\t// Drop oldest\n\t\t\t\tthis._front = (this._front + 1) % this._capacity;\n\t\t\t}\n\t\t\tthis._memory[this._rear] = item;\n\t\t}\n\n\t\titem.score = this._computeScore(item, previousItem);\n\t}\n\n\t/**\n\t * A score between 0 and 1 for `item`.\n\t * - a score towards 0 indicates that the source appears to be a physical mouse wheel\n\t * - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.\n\t */\n\tprivate _computeScore(item: MouseWheelClassifierItem, previousItem: MouseWheelClassifierItem | null): number {\n\n\t\tif (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {\n\t\t\t// both axes exercised => definitely not a physical mouse wheel\n\t\t\treturn 1;\n\t\t}\n\n\t\tlet score: number = 0.5;\n\n\t\tif (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {\n\t\t\t// non-integer deltas => indicator that this is not a physical mouse wheel\n\t\t\tscore += 0.25;\n\t\t}\n\n\t\t// Non-accelerating scroll => indicator that this is a physical mouse wheel\n\t\t// These can be identified by seeing whether they are the module of one another.\n\t\tif (previousItem) {\n\t\t\tconst absDeltaX = Math.abs(item.deltaX);\n\t\t\tconst absDeltaY = Math.abs(item.deltaY);\n\n\t\t\tconst absPreviousDeltaX = Math.abs(previousItem.deltaX);\n\t\t\tconst absPreviousDeltaY = Math.abs(previousItem.deltaY);\n\n\t\t\t// Min 1 to avoid division by zero, module 1 will still be 0.\n\t\t\tconst minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1);\n\t\t\tconst minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1);\n\n\t\t\tconst maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX);\n\t\t\tconst maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY);\n\n\t\t\tconst isSameModulo = (maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0);\n\t\t\tif (isSameModulo) {\n\t\t\t\tscore -= 0.5;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(Math.max(score, 0), 1);\n\t}\n\n\tprivate _isAlmostInt(value: number): boolean {\n\t\tconst delta = Math.abs(Math.round(value) - value);\n\t\treturn (delta < 0.01);\n\t}\n}\n\nexport abstract class AbstractScrollableElement extends Widget {\n\n\tprivate readonly _options: ScrollableElementResolvedOptions;\n\tprotected readonly _scrollable: Scrollable;\n\tprivate readonly _verticalScrollbar: VerticalScrollbar;\n\tprivate readonly _horizontalScrollbar: HorizontalScrollbar;\n\tprivate readonly _domNode: HTMLElement;\n\n\tprivate readonly _leftShadowDomNode: FastDomNode | null;\n\tprivate readonly _topShadowDomNode: FastDomNode | null;\n\tprivate readonly _topLeftShadowDomNode: FastDomNode | null;\n\n\tprivate readonly _listenOnDomNode: HTMLElement;\n\n\tprivate _mouseWheelToDispose: IDisposable[];\n\n\tprivate _isDragging: boolean;\n\tprivate _mouseIsOver: boolean;\n\n\tprivate readonly _hideTimeout: TimeoutTimer;\n\tprivate _shouldRender: boolean;\n\n\tprivate _revealOnScroll: boolean;\n\n\tprivate readonly _onScroll = this._register(new Emitter());\n\tpublic readonly onScroll: Event = this._onScroll.event;\n\n\tprivate readonly _onWillScroll = this._register(new Emitter());\n\tpublic readonly onWillScroll: Event = this._onWillScroll.event;\n\n\tpublic get options(): Readonly {\n\t\treturn this._options;\n\t}\n\n\tprotected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper();\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// element.style.overflow = 'hidden';\n\t\tthis._options = resolveOptions(options);\n\t\tthis._scrollable = scrollable;\n\n\t\tthis._register(this._scrollable.onScroll((e) => {\n\t\t\tthis._onWillScroll.fire(e);\n\t\t\tthis._onDidScroll(e);\n\t\t\tthis._onScroll.fire(e);\n\t\t}));\n\n\t\tconst scrollbarHost: ScrollbarHost = {\n\t\t\tonMouseWheel: (mouseWheelEvent: StandardWheelEvent) => this._onMouseWheel(mouseWheelEvent),\n\t\t\tonDragStart: () => this._onDragStart(),\n\t\t\tonDragEnd: () => this._onDragEnd(),\n\t\t};\n\t\tthis._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost));\n\t\tthis._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));\n\n\t\tthis._domNode = document.createElement('div');\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t\tthis._domNode.setAttribute('role', 'presentation');\n\t\tthis._domNode.style.position = 'relative';\n\t\t// HACK: xterm.js currnetly requires overflow to allow decorations to escape the container\n\t\t// this._domNode.style.overflow = 'hidden';\n\t\tthis._domNode.appendChild(element);\n\t\tthis._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);\n\t\tthis._domNode.appendChild(this._verticalScrollbar.domNode.domNode);\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._leftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._leftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._leftShadowDomNode.domNode);\n\n\t\t\tthis._topShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topShadowDomNode.domNode);\n\n\t\t\tthis._topLeftShadowDomNode = createFastDomNode(document.createElement('div'));\n\t\t\tthis._topLeftShadowDomNode.setClassName('shadow');\n\t\t\tthis._domNode.appendChild(this._topLeftShadowDomNode.domNode);\n\t\t} else {\n\t\t\tthis._leftShadowDomNode = null;\n\t\t\tthis._topShadowDomNode = null;\n\t\t\tthis._topLeftShadowDomNode = null;\n\t\t}\n\n\t\tthis._listenOnDomNode = this._options.listenOnDomNode || this._domNode;\n\n\t\tthis._mouseWheelToDispose = [];\n\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\n\t\tthis.onmouseover(this._listenOnDomNode, (e) => this._onMouseOver(e));\n\t\tthis.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));\n\n\t\tthis._hideTimeout = this._register(new TimeoutTimer());\n\t\tthis._isDragging = false;\n\t\tthis._mouseIsOver = false;\n\n\t\tthis._shouldRender = true;\n\n\t\tthis._revealOnScroll = true;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Get the generated 'scrollable' dom node\n\t */\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._domNode;\n\t}\n\n\tpublic getOverviewRulerLayoutInfo(): IOverviewRulerLayoutInfo {\n\t\treturn {\n\t\t\tparent: this._domNode,\n\t\t\tinsertBefore: this._verticalScrollbar.domNode.domNode,\n\t\t};\n\t}\n\n\t/**\n\t * Delegate a pointer down event to the vertical scrollbar.\n\t * This is to help with clicking somewhere else and having the scrollbar react.\n\t */\n\tpublic delegateVerticalScrollbarPointerDown(browserEvent: PointerEvent): void {\n\t\tthis._verticalScrollbar.delegatePointerDown(browserEvent);\n\t}\n\n\tpublic getScrollDimensions(): IScrollDimensions {\n\t\treturn this._scrollable.getScrollDimensions();\n\t}\n\n\tpublic setScrollDimensions(dimensions: INewScrollDimensions): void {\n\t\tthis._scrollable.setScrollDimensions(dimensions, false);\n\t}\n\n\t/**\n\t * Update the class name of the scrollable element.\n\t */\n\tpublic updateClassName(newClassName: string): void {\n\t\tthis._options.className = newClassName;\n\t\t// Defaults are different on Macs\n\t\tif (platform.isMacintosh) {\n\t\t\tthis._options.className += ' mac';\n\t\t}\n\t\tthis._domNode.className = 'xterm-scrollable-element ' + this._options.className;\n\t}\n\n\t/**\n\t * Update configuration options for the scrollbar.\n\t */\n\tpublic updateOptions(newOptions: ScrollableElementChangeOptions): void {\n\t\tif (typeof newOptions.handleMouseWheel !== 'undefined') {\n\t\t\tthis._options.handleMouseWheel = newOptions.handleMouseWheel;\n\t\t\tthis._setListeningToMouseWheel(this._options.handleMouseWheel);\n\t\t}\n\t\tif (typeof newOptions.mouseWheelScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.fastScrollSensitivity !== 'undefined') {\n\t\t\tthis._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;\n\t\t}\n\t\tif (typeof newOptions.scrollPredominantAxis !== 'undefined') {\n\t\t\tthis._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;\n\t\t}\n\t\tif (typeof newOptions.horizontal !== 'undefined') {\n\t\t\tthis._options.horizontal = newOptions.horizontal;\n\t\t}\n\t\tif (typeof newOptions.vertical !== 'undefined') {\n\t\t\tthis._options.vertical = newOptions.vertical;\n\t\t}\n\t\tif (typeof newOptions.horizontalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.verticalScrollbarSize !== 'undefined') {\n\t\t\tthis._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;\n\t\t}\n\t\tif (typeof newOptions.scrollByPage !== 'undefined') {\n\t\t\tthis._options.scrollByPage = newOptions.scrollByPage;\n\t\t}\n\t\tthis._horizontalScrollbar.updateOptions(this._options);\n\t\tthis._verticalScrollbar.updateOptions(this._options);\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\tpublic setRevealOnScroll(value: boolean) {\n\t\tthis._revealOnScroll = value;\n\t}\n\n\tpublic delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {\n\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t}\n\n\t// -------------------- mouse wheel scrolling --------------------\n\n\tprivate _setListeningToMouseWheel(shouldListen: boolean): void {\n\t\tconst isListening = (this._mouseWheelToDispose.length > 0);\n\n\t\tif (isListening === shouldListen) {\n\t\t\t// No change\n\t\t\treturn;\n\t\t}\n\n\t\t// Stop listening (if necessary)\n\t\tthis._mouseWheelToDispose = dispose(this._mouseWheelToDispose);\n\n\t\t// Start listening (if necessary)\n\t\tif (shouldListen) {\n\t\t\tconst onMouseWheel = (browserEvent: IMouseWheelEvent) => {\n\t\t\t\tthis._onMouseWheel(new StandardWheelEvent(browserEvent));\n\t\t\t};\n\n\t\t\tthis._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, dom.EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));\n\t\t}\n\t}\n\n\tprivate _onMouseWheel(e: StandardWheelEvent): void {\n\t\tif (e.browserEvent?.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst classifier = MouseWheelClassifier.INSTANCE;\n\t\tif (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {\n\t\t\tclassifier.acceptStandardWheelEvent(e);\n\t\t}\n\n\t\t// useful for creating unit tests:\n\t\t// console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);\n\n\t\tlet didScroll = false;\n\n\t\tif (e.deltaY || e.deltaX) {\n\t\t\tlet deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;\n\t\t\tlet deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;\n\n\t\t\tif (this._options.scrollPredominantAxis) {\n\t\t\t\tif (this._options.scrollYToX && deltaX + deltaY === 0) {\n\t\t\t\t\t// when configured to map Y to X and we both see\n\t\t\t\t\t// no dominant axis and X and Y are competing with\n\t\t\t\t\t// identical values into opposite directions, we\n\t\t\t\t\t// ignore the delta as we cannot make a decision then\n\t\t\t\t\tdeltaX = deltaY = 0;\n\t\t\t\t} else if (Math.abs(deltaY) >= Math.abs(deltaX)) {\n\t\t\t\t\tdeltaX = 0;\n\t\t\t\t} else {\n\t\t\t\t\tdeltaY = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._options.flipAxes) {\n\t\t\t\t[deltaY, deltaX] = [deltaX, deltaY];\n\t\t\t}\n\n\t\t\t// Convert vertical scrolling to horizontal if shift is held, this\n\t\t\t// is handled at a higher level on Mac\n\t\t\tconst shiftConvert = !platform.isMacintosh && e.browserEvent && e.browserEvent.shiftKey;\n\t\t\tif ((this._options.scrollYToX || shiftConvert) && !deltaX) {\n\t\t\t\tdeltaX = deltaY;\n\t\t\t\tdeltaY = 0;\n\t\t\t}\n\n\t\t\tif (e.browserEvent && e.browserEvent.altKey) {\n\t\t\t\t// fastScrolling\n\t\t\t\tdeltaX = deltaX * this._options.fastScrollSensitivity;\n\t\t\t\tdeltaY = deltaY * this._options.fastScrollSensitivity;\n\t\t\t}\n\n\t\t\tconst futureScrollPosition = this._scrollable.getFutureScrollPosition();\n\n\t\t\tlet desiredScrollPosition: INewScrollPosition = {};\n\t\t\tif (deltaY) {\n\t\t\t\tconst deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));\n\t\t\t\tthis._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);\n\t\t\t}\n\t\t\tif (deltaX) {\n\t\t\t\tconst deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;\n\t\t\t\t// Here we convert values such as -0.3 to -1 or 0.3 to 1, otherwise low speed scrolling will never scroll\n\t\t\t\tconst desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));\n\t\t\t\tthis._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);\n\t\t\t}\n\n\t\t\t// Check that we are scrolling towards a location which is valid\n\t\t\tdesiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);\n\n\t\t\tif (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {\n\n\t\t\t\tconst canPerformSmoothScroll = (\n\t\t\t\t\tSCROLL_WHEEL_SMOOTH_SCROLL_ENABLED\n\t\t\t\t\t&& this._options.mouseWheelSmoothScroll\n\t\t\t\t\t&& classifier.isPhysicalMouseWheel()\n\t\t\t\t);\n\n\t\t\t\tif (canPerformSmoothScroll) {\n\t\t\t\t\tthis._scrollable.setScrollPositionSmooth(desiredScrollPosition);\n\t\t\t\t} else {\n\t\t\t\t\tthis._scrollable.setScrollPositionNow(desiredScrollPosition);\n\t\t\t\t}\n\n\t\t\t\tdidScroll = true;\n\t\t\t}\n\t\t}\n\n\t\tlet consumeMouseWheel = didScroll;\n\t\tif (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\t\tif (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {\n\t\t\tconsumeMouseWheel = true;\n\t\t}\n\n\t\tif (consumeMouseWheel) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tprivate _onDidScroll(e: ScrollEvent): void {\n\t\tthis._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;\n\t\tthis._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;\n\n\t\tif (this._options.useShadows) {\n\t\t\tthis._shouldRender = true;\n\t\t}\n\n\t\tif (this._revealOnScroll) {\n\t\t\tthis._reveal();\n\t\t}\n\n\t\tif (!this._options.lazyRender) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\t/**\n\t * Render / mutate the DOM now.\n\t * Should be used together with the ctor option `lazyRender`.\n\t */\n\tpublic renderNow(): void {\n\t\tif (!this._options.lazyRender) {\n\t\t\tthrow new Error('Please use `lazyRender` together with `renderNow`!');\n\t\t}\n\n\t\tthis._render();\n\t}\n\n\tprivate _render(): void {\n\t\tif (!this._shouldRender) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._shouldRender = false;\n\n\t\tthis._horizontalScrollbar.render();\n\t\tthis._verticalScrollbar.render();\n\n\t\tif (this._options.useShadows) {\n\t\t\tconst scrollState = this._scrollable.getCurrentScrollPosition();\n\t\t\tconst enableTop = scrollState.scrollTop > 0;\n\t\t\tconst enableLeft = scrollState.scrollLeft > 0;\n\n\t\t\tconst leftClassName = (enableLeft ? ' left' : '');\n\t\t\tconst topClassName = (enableTop ? ' top' : '');\n\t\t\tconst topLeftClassName = (enableLeft || enableTop ? ' top-left-corner' : '');\n\t\t\tthis._leftShadowDomNode!.setClassName(`shadow${leftClassName}`);\n\t\t\tthis._topShadowDomNode!.setClassName(`shadow${topClassName}`);\n\t\t\tthis._topLeftShadowDomNode!.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);\n\t\t}\n\t}\n\n\t// -------------------- fade in / fade out --------------------\n\n\tprivate _onDragStart(): void {\n\t\tthis._isDragging = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _onDragEnd(): void {\n\t\tthis._isDragging = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseLeave(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = false;\n\t\tthis._hide();\n\t}\n\n\tprivate _onMouseOver(e: IMouseEvent): void {\n\t\tthis._mouseIsOver = true;\n\t\tthis._reveal();\n\t}\n\n\tprivate _reveal(): void {\n\t\tthis._verticalScrollbar.beginReveal();\n\t\tthis._horizontalScrollbar.beginReveal();\n\t\tthis._scheduleHide();\n\t}\n\n\tprivate _hide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._verticalScrollbar.beginHide();\n\t\t\tthis._horizontalScrollbar.beginHide();\n\t\t}\n\t}\n\n\tprivate _scheduleHide(): void {\n\t\tif (!this._mouseIsOver && !this._isDragging) {\n\t\t\tthis._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);\n\t\t}\n\t}\n}\n\nexport class ScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: true,\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n}\n\nexport class SmoothScrollableElement extends AbstractScrollableElement {\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable: Scrollable) {\n\t\tsuper(element, options, scrollable);\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition & { reuseAnimation?: boolean }): void {\n\t\tif (update.reuseAnimation) {\n\t\t\tthis._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);\n\t\t} else {\n\t\t\tthis._scrollable.setScrollPositionNow(update);\n\t\t}\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n}\n\nexport class DomScrollableElement extends AbstractScrollableElement {\n\n\tprivate _element: HTMLElement;\n\n\tconstructor(element: HTMLElement, options: ScrollableElementCreationOptions) {\n\t\toptions = options || {};\n\t\toptions.mouseWheelSmoothScroll = false;\n\t\tconst scrollable = new Scrollable({\n\t\t\tforceIntegerValues: false, // See https://github.com/microsoft/vscode/issues/139877\n\t\t\tsmoothScrollDuration: 0,\n\t\t\tscheduleAtNextAnimationFrame: (callback) => dom.scheduleAtNextAnimationFrame(dom.getWindow(element), callback)\n\t\t});\n\t\tsuper(element, options, scrollable);\n\t\tthis._register(scrollable);\n\t\tthis._element = element;\n\t\tthis._register(this.onScroll((e) => {\n\t\t\tif (e.scrollTopChanged) {\n\t\t\t\tthis._element.scrollTop = e.scrollTop;\n\t\t\t}\n\t\t\tif (e.scrollLeftChanged) {\n\t\t\t\tthis._element.scrollLeft = e.scrollLeft;\n\t\t\t}\n\t\t}));\n\t\tthis.scanDomNode();\n\t}\n\n\tpublic setScrollPosition(update: INewScrollPosition): void {\n\t\tthis._scrollable.setScrollPositionNow(update);\n\t}\n\n\tpublic getScrollPosition(): IScrollPosition {\n\t\treturn this._scrollable.getCurrentScrollPosition();\n\t}\n\n\tpublic scanDomNode(): void {\n\t\t// width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight\n\t\tthis.setScrollDimensions({\n\t\t\twidth: this._element.clientWidth,\n\t\t\tscrollWidth: this._element.scrollWidth,\n\t\t\theight: this._element.clientHeight,\n\t\t\tscrollHeight: this._element.scrollHeight\n\t\t});\n\t\tthis.setScrollPosition({\n\t\t\tscrollLeft: this._element.scrollLeft,\n\t\t\tscrollTop: this._element.scrollTop,\n\t\t});\n\t}\n}\n\nfunction resolveOptions(opts: ScrollableElementCreationOptions): ScrollableElementResolvedOptions {\n\tconst result: ScrollableElementResolvedOptions = {\n\t\tlazyRender: (typeof opts.lazyRender !== 'undefined' ? opts.lazyRender : false),\n\t\tclassName: (typeof opts.className !== 'undefined' ? opts.className : ''),\n\t\tuseShadows: (typeof opts.useShadows !== 'undefined' ? opts.useShadows : true),\n\t\thandleMouseWheel: (typeof opts.handleMouseWheel !== 'undefined' ? opts.handleMouseWheel : true),\n\t\tflipAxes: (typeof opts.flipAxes !== 'undefined' ? opts.flipAxes : false),\n\t\tconsumeMouseWheelIfScrollbarIsNeeded: (typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== 'undefined' ? opts.consumeMouseWheelIfScrollbarIsNeeded : false),\n\t\talwaysConsumeMouseWheel: (typeof opts.alwaysConsumeMouseWheel !== 'undefined' ? opts.alwaysConsumeMouseWheel : false),\n\t\tscrollYToX: (typeof opts.scrollYToX !== 'undefined' ? opts.scrollYToX : false),\n\t\tmouseWheelScrollSensitivity: (typeof opts.mouseWheelScrollSensitivity !== 'undefined' ? opts.mouseWheelScrollSensitivity : 1),\n\t\tfastScrollSensitivity: (typeof opts.fastScrollSensitivity !== 'undefined' ? opts.fastScrollSensitivity : 5),\n\t\tscrollPredominantAxis: (typeof opts.scrollPredominantAxis !== 'undefined' ? opts.scrollPredominantAxis : true),\n\t\tmouseWheelSmoothScroll: (typeof opts.mouseWheelSmoothScroll !== 'undefined' ? opts.mouseWheelSmoothScroll : true),\n\t\tarrowSize: (typeof opts.arrowSize !== 'undefined' ? opts.arrowSize : 11),\n\n\t\tlistenOnDomNode: (typeof opts.listenOnDomNode !== 'undefined' ? opts.listenOnDomNode : null),\n\n\t\thorizontal: (typeof opts.horizontal !== 'undefined' ? opts.horizontal : ScrollbarVisibility.Auto),\n\t\thorizontalScrollbarSize: (typeof opts.horizontalScrollbarSize !== 'undefined' ? opts.horizontalScrollbarSize : 10),\n\t\thorizontalSliderSize: (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : 0),\n\t\thorizontalHasArrows: (typeof opts.horizontalHasArrows !== 'undefined' ? opts.horizontalHasArrows : false),\n\n\t\tvertical: (typeof opts.vertical !== 'undefined' ? opts.vertical : ScrollbarVisibility.Auto),\n\t\tverticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),\n\t\tverticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),\n\t\tverticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0),\n\n\t\tscrollByPage: (typeof opts.scrollByPage !== 'undefined' ? opts.scrollByPage : false)\n\t};\n\n\tresult.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);\n\tresult.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);\n\n\t// Defaults are different on Macs\n\tif (platform.isMacintosh) {\n\t\tresult.className += ' mac';\n\t}\n\n\treturn result;\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal event utilities for xterm.js core.\n * Simplified from VS Code's event.ts - no leak detection/profiling.\n */\n\nimport { IDisposable, DisposableStore, toDisposable } from 'common/Lifecycle';\n\nexport interface IEvent {\n (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport class Emitter {\n private _listeners: { fn: (e: T) => any, thisArgs: any }[] = [];\n private _disposed = false;\n private _event: IEvent | undefined;\n\n public get event(): IEvent {\n if (this._event) {\n return this._event;\n }\n this._event = (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n if (this._disposed) {\n return toDisposable(() => {});\n }\n\n const entry = { fn: listener, thisArgs };\n this._listeners.push(entry);\n\n const result = toDisposable(() => {\n const idx = this._listeners.indexOf(entry);\n if (idx !== -1) {\n this._listeners.splice(idx, 1);\n }\n });\n\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(result);\n } else {\n disposables.add(result);\n }\n }\n\n return result;\n };\n return this._event;\n }\n\n public fire(event: T): void {\n if (this._disposed) {\n return;\n }\n switch (this._listeners.length) {\n case 0: return;\n case 1: {\n const { fn, thisArgs } = this._listeners[0];\n fn.call(thisArgs, event);\n return;\n }\n default: {\n // Snapshot listeners to allow modifications during iteration (2+ listeners)\n const listeners = this._listeners.slice();\n for (const { fn, thisArgs } of listeners) {\n fn.call(thisArgs, event);\n }\n }\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n this._listeners.length = 0;\n }\n}\n\nexport namespace EventUtils {\n export function forward(from: IEvent, to: Emitter): IDisposable {\n return from(e => to.fire(e));\n }\n\n export function map(event: IEvent, map: (i: I) => O): IEvent {\n return (listener: (e: O) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n return event(i => listener.call(thisArgs, map(i)), undefined, disposables);\n };\n }\n\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent {\n return (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n const store = new DisposableStore();\n for (const event of events) {\n store.add(event(e => listener.call(thisArgs, e)));\n }\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(store);\n } else {\n disposables.add(store);\n }\n }\n return store;\n };\n }\n\n export function runAndSubscribe(event: IEvent, handler: (e: T | undefined) => void): IDisposable {\n handler(undefined);\n return event(e => handler(e));\n }\n}\n", "/**\n * Copyright (c) 2024 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { ViewportConstants } from 'browser/shared/Constants';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { CoreMouseEventType } from 'common/Types';\nimport { addDisposableListener, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom';\nimport { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';\nimport type { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';\nimport { Emitter, EventUtils } from 'common/Event';\nimport { Scrollable, ScrollbarVisibility, type ScrollEvent } from 'vs/base/common/scrollable';\nimport { Gesture, EventType as GestureEventType, type GestureEvent } from 'vs/base/browser/touch';\n\nexport class Viewport extends Disposable {\n\n protected _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n private _scrollableElement: SmoothScrollableElement;\n private _styleElement: HTMLStyleElement;\n\n private _queuedAnimationFrame?: number;\n private _latestYDisp?: number;\n private _isSyncing: boolean = false;\n private _isHandlingScroll: boolean = false;\n private _suppressOnScrollHandler: boolean = false;\n\n constructor(\n element: HTMLElement,\n screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService coreBrowserService: ICoreBrowserService,\n @ICoreMouseService coreMouseService: ICoreMouseService,\n @IThemeService themeService: IThemeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n const scrollable = this._register(new Scrollable({\n forceIntegerValues: false,\n smoothScrollDuration: this._optionsService.rawOptions.smoothScrollDuration,\n // This is used over `IRenderService.addRefreshCallback` since it can be canceled\n scheduleAtNextAnimationFrame: cb => scheduleAtNextAnimationFrame(coreBrowserService.window, cb)\n }));\n this._register(this._optionsService.onSpecificOptionChange('smoothScrollDuration', () => {\n scrollable.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration);\n }));\n\n this._scrollableElement = this._register(new SmoothScrollableElement(screenElement, {\n vertical: ScrollbarVisibility.Auto,\n horizontal: ScrollbarVisibility.Hidden,\n useShadows: false,\n mouseWheelSmoothScroll: true,\n ...this._getChangeOptions()\n }, scrollable));\n this._register(this._optionsService.onMultipleOptionChange([\n 'scrollSensitivity',\n 'fastScrollSensitivity',\n 'overviewRuler'\n ], () => this._scrollableElement.updateOptions(this._getChangeOptions())));\n // Don't handle mouse wheel if wheel events are supported by the current mouse prototcol\n this._register(coreMouseService.onProtocolChange(type => {\n this._scrollableElement.updateOptions({\n handleMouseWheel: !(type & CoreMouseEventType.WHEEL)\n });\n }));\n\n this._scrollableElement.setScrollDimensions({ height: 0, scrollHeight: 0 });\n this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {\n element.style.backgroundColor = themeService.colors.background.css;\n this._scrollableElement.getDomNode().style.backgroundColor = themeService.colors.background.css;\n }));\n element.appendChild(this._scrollableElement.getDomNode());\n this._register(toDisposable(() => this._scrollableElement.getDomNode().remove()));\n\n this._styleElement = coreBrowserService.mainDocument.createElement('style');\n screenElement.appendChild(this._styleElement);\n this._register(toDisposable(() => this._styleElement.remove()));\n this._register(EventUtils.runAndSubscribe(themeService.onChangeColors, () => {\n this._styleElement.textContent = [\n `.xterm .xterm-scrollable-element > .scrollbar > .slider {`,\n ` background: ${themeService.colors.scrollbarSliderBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,\n ` background: ${themeService.colors.scrollbarSliderHoverBackground.css};`,\n `}`,\n `.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,\n ` background: ${themeService.colors.scrollbarSliderActiveBackground.css};`,\n `}`\n ].join('\\n');\n }));\n\n this._register(this._bufferService.onResize(() => this.queueSync()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n // Reset _latestYDisp when switching buffers to prevent stale scroll position\n // from alt buffer contaminating normal buffer scroll position\n this._latestYDisp = undefined;\n this.queueSync();\n }));\n this._register(this._bufferService.onScroll(() => this._sync()));\n\n this._register(this._scrollableElement.onScroll(e => this._handleScroll(e)));\n\n // Touch/gesture scrolling support\n this._register(Gesture.addTarget(screenElement));\n this._register(addDisposableListener(screenElement, GestureEventType.Change, (e: GestureEvent) => this._handleGestureChange(e)));\n }\n\n public scrollLines(disp: number): void {\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n reuseAnimation: true,\n scrollTop: pos.scrollTop + disp * this._renderService.dimensions.css.cell.height\n });\n }\n\n public scrollToLine(line: number, disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll) {\n this._latestYDisp = line;\n }\n this._scrollableElement.setScrollPosition({\n reuseAnimation: !disableSmoothScroll,\n scrollTop: line * this._renderService.dimensions.css.cell.height\n });\n }\n\n private _getChangeOptions(): ScrollableElementChangeOptions {\n return {\n mouseWheelScrollSensitivity: this._optionsService.rawOptions.scrollSensitivity,\n fastScrollSensitivity: this._optionsService.rawOptions.fastScrollSensitivity,\n verticalScrollbarSize: this._optionsService.rawOptions.overviewRuler?.width || ViewportConstants.DEFAULT_SCROLL_BAR_WIDTH\n };\n }\n\n public queueSync(ydisp?: number): void {\n // Update state\n if (ydisp !== undefined) {\n this._latestYDisp = ydisp;\n }\n\n // Don't queue more than one callback\n if (this._queuedAnimationFrame !== undefined) {\n return;\n }\n this._queuedAnimationFrame = this._renderService.addRefreshCallback(() => {\n this._queuedAnimationFrame = undefined;\n this._sync(this._latestYDisp);\n });\n }\n\n private _sync(ydisp: number = this._bufferService.buffer.ydisp): void {\n if (!this._renderService || this._isSyncing) {\n return;\n }\n this._isSyncing = true;\n\n // Ignore any onScroll event that happens as a result of dimensions changing as this should\n // never cause a scrollLines call, only setScrollPosition can do that.\n this._suppressOnScrollHandler = true;\n this._scrollableElement.setScrollDimensions({\n height: this._renderService.dimensions.css.canvas.height,\n scrollHeight: this._renderService.dimensions.css.cell.height * this._bufferService.buffer.lines.length\n });\n this._suppressOnScrollHandler = false;\n\n // If ydisp has been changed by some other component (input/buffer), then stop animating smooth\n // scroll and scroll there immediately.\n if (ydisp !== this._latestYDisp) {\n this._scrollableElement.setScrollPosition({\n scrollTop: ydisp * this._renderService.dimensions.css.cell.height\n });\n }\n\n this._isSyncing = false;\n }\n\n private _handleScroll(e: ScrollEvent): void {\n if (!this._renderService) {\n return;\n }\n if (this._isHandlingScroll || this._suppressOnScrollHandler) {\n return;\n }\n this._isHandlingScroll = true;\n const newRow = Math.round(e.scrollTop / this._renderService.dimensions.css.cell.height);\n const diff = newRow - this._bufferService.buffer.ydisp;\n if (diff !== 0) {\n this._latestYDisp = newRow;\n this._onRequestScrollLines.fire(diff);\n }\n this._isHandlingScroll = false;\n }\n\n private _handleGestureChange(e: GestureEvent): void {\n e.preventDefault();\n e.stopPropagation();\n const pos = this._scrollableElement.getScrollPosition();\n this._scrollableElement.setScrollPosition({\n scrollTop: pos.scrollTop - e.translationY\n });\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';\n\nexport class BufferDecorationRenderer extends Disposable {\n private readonly _container: HTMLElement;\n private readonly _decorationElements: Map = new Map();\n\n private _animationFrame: number | undefined;\n private _altBufferIsActive: boolean = false;\n private _dimensionsChanged: boolean = false;\n\n constructor(\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n\n this._container = document.createElement('div');\n this._container.classList.add('xterm-decoration-container');\n this._screenElement.appendChild(this._container);\n\n this._register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations()));\n this._register(this._renderService.onDimensionsChange(() => {\n this._dimensionsChanged = true;\n this._queueRefresh();\n }));\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;\n }));\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh()));\n this._register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration)));\n this._register(toDisposable(() => {\n this._container.remove();\n this._decorationElements.clear();\n }));\n }\n\n private _queueRefresh(): void {\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._renderService.addRefreshCallback(() => {\n this._doRefreshDecorations();\n this._animationFrame = undefined;\n });\n }\n\n private _doRefreshDecorations(): void {\n for (const decoration of this._decorationService.decorations) {\n this._renderDecoration(decoration);\n }\n this._dimensionsChanged = false;\n }\n\n private _renderDecoration(decoration: IInternalDecoration): void {\n this._refreshStyle(decoration);\n if (this._dimensionsChanged) {\n this._refreshXPosition(decoration);\n }\n }\n\n private _createElement(decoration: IInternalDecoration): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.classList.add('xterm-decoration');\n element.classList.toggle('xterm-decoration-top-layer', decoration?.options?.layer === 'top');\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${(decoration.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n\n const x = decoration.options.x ?? 0;\n if (x && x > this._bufferService.cols) {\n // exceeded the container width, so hide\n element.style.display = 'none';\n }\n this._refreshXPosition(decoration, element);\n\n return element;\n }\n\n private _refreshStyle(decoration: IInternalDecoration): void {\n const line = decoration.marker.line - this._bufferService.buffers.active.ydisp;\n if (line < 0 || line >= this._bufferService.rows) {\n // outside of viewport\n if (decoration.element) {\n decoration.element.style.display = 'none';\n decoration.onRenderEmitter.fire(decoration.element);\n }\n } else {\n let element = this._decorationElements.get(decoration);\n if (!element) {\n element = this._createElement(decoration);\n decoration.element = element;\n this._decorationElements.set(decoration, element);\n this._container.appendChild(element);\n decoration.onDispose(() => {\n this._decorationElements.delete(decoration);\n element!.remove();\n });\n }\n element.style.display = this._altBufferIsActive ? 'none' : 'block';\n if (!this._altBufferIsActive) {\n element.style.width = `${Math.round((decoration.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`;\n element.style.height = `${(decoration.options.height || 1) * this._renderService.dimensions.css.cell.height}px`;\n element.style.top = `${line * this._renderService.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;\n }\n decoration.onRenderEmitter.fire(element);\n }\n }\n\n private _refreshXPosition(decoration: IInternalDecoration, element: HTMLElement | undefined = decoration.element): void {\n if (!element) {\n return;\n }\n const x = decoration.options.x ?? 0;\n if ((decoration.options.anchor || 'left') === 'right') {\n element.style.right = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n } else {\n element.style.left = x ? `${x * this._renderService.dimensions.css.cell.width}px` : '';\n }\n }\n\n private _removeDecoration(decoration: IInternalDecoration): void {\n this._decorationElements.get(decoration)?.remove();\n this._decorationElements.delete(decoration);\n decoration.dispose();\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInternalDecoration } from 'common/services/Services';\n\nexport interface IColorZoneStore {\n readonly zones: IColorZone[];\n clear(): void;\n addDecoration(decoration: IInternalDecoration): void;\n /**\n * Sets the amount of padding in lines that will be added between zones, if new lines intersect\n * the padding they will be merged into the same zone.\n */\n setPadding(padding: { [position: string]: number }): void;\n}\n\nexport interface IColorZone {\n /** Color in a format supported by canvas' fillStyle. */\n color: string;\n position: 'full' | 'left' | 'center' | 'right' | undefined;\n startBufferLine: number;\n endBufferLine: number;\n}\n\ninterface IMinimalDecorationForColorZone {\n marker: Pick;\n options: Pick;\n}\n\nexport class ColorZoneStore implements IColorZoneStore {\n private _zones: IColorZone[] = [];\n\n // The zone pool is used to keep zone objects from being freed between clearing the color zone\n // store and fetching the zones. This helps reduce GC pressure since the color zones are\n // accumulated on potentially every scroll event.\n private _zonePool: IColorZone[] = [];\n private _zonePoolIndex = 0;\n\n private _linePadding: { [position: string]: number } = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n };\n\n public get zones(): IColorZone[] {\n // Trim the zone pool to free unused memory\n this._zonePool.length = Math.min(this._zonePool.length, this._zones.length);\n return this._zones;\n }\n\n public clear(): void {\n this._zones.length = 0;\n this._zonePoolIndex = 0;\n }\n\n public addDecoration(decoration: IMinimalDecorationForColorZone): void {\n if (!decoration.options.overviewRulerOptions) {\n return;\n }\n for (const z of this._zones) {\n if (z.color === decoration.options.overviewRulerOptions.color &&\n z.position === decoration.options.overviewRulerOptions.position) {\n if (this._lineIntersectsZone(z, decoration.marker.line)) {\n return;\n }\n if (this._lineAdjacentToZone(z, decoration.marker.line, decoration.options.overviewRulerOptions.position)) {\n this._addLineToZone(z, decoration.marker.line);\n return;\n }\n }\n }\n // Create using zone pool if possible\n if (this._zonePoolIndex < this._zonePool.length) {\n this._zonePool[this._zonePoolIndex].color = decoration.options.overviewRulerOptions.color;\n this._zonePool[this._zonePoolIndex].position = decoration.options.overviewRulerOptions.position;\n this._zonePool[this._zonePoolIndex].startBufferLine = decoration.marker.line;\n this._zonePool[this._zonePoolIndex].endBufferLine = decoration.marker.line;\n this._zones.push(this._zonePool[this._zonePoolIndex++]);\n return;\n }\n // Create\n this._zones.push({\n color: decoration.options.overviewRulerOptions.color,\n position: decoration.options.overviewRulerOptions.position,\n startBufferLine: decoration.marker.line,\n endBufferLine: decoration.marker.line\n });\n this._zonePool.push(this._zones[this._zones.length - 1]);\n this._zonePoolIndex++;\n }\n\n public setPadding(padding: { [position: string]: number }): void {\n this._linePadding = padding;\n }\n\n private _lineIntersectsZone(zone: IColorZone, line: number): boolean {\n return (\n line >= zone.startBufferLine &&\n line <= zone.endBufferLine\n );\n }\n\n private _lineAdjacentToZone(zone: IColorZone, line: number, position: IColorZone['position']): boolean {\n return (\n (line >= zone.startBufferLine - this._linePadding[position || 'full']) &&\n (line <= zone.endBufferLine + this._linePadding[position || 'full'])\n );\n }\n\n private _addLineToZone(zone: IColorZone, line: number): void {\n zone.startBufferLine = Math.min(zone.startBufferLine, line);\n zone.endBufferLine = Math.max(zone.endBufferLine, line);\n }\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';\nimport { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';\n\nconst enum Constants {\n OVERVIEW_RULER_BORDER_WIDTH = 1\n}\n\n// Helper objects to avoid excessive calculation and garbage collection during rendering. These are\n// static values for each render and can be accessed using the decoration position as the key.\nconst drawHeight = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawWidth = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\nconst drawX = {\n full: 0,\n left: 0,\n center: 0,\n right: 0\n};\n\nexport class OverviewRulerRenderer extends Disposable {\n private readonly _canvas: HTMLCanvasElement;\n private readonly _ctx: CanvasRenderingContext2D;\n private readonly _colorZoneStore: IColorZoneStore = new ColorZoneStore();\n private get _width(): number {\n return this._optionsService.options.overviewRuler?.width || 0;\n }\n private _animationFrame: number | undefined;\n\n private _shouldUpdateDimensions: boolean | undefined = true;\n private _shouldUpdateAnchor: boolean | undefined = true;\n private _lastKnownBufferLength: number = 0;\n\n private _containerHeight: number | undefined;\n\n constructor(\n private readonly _viewportElement: HTMLElement,\n private readonly _screenElement: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IRenderService private readonly _renderService: IRenderService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IThemeService private readonly _themeService: IThemeService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n this._canvas = this._coreBrowserService.mainDocument.createElement('canvas');\n this._canvas.classList.add('xterm-decoration-overview-ruler');\n this._refreshCanvasDimensions();\n this._viewportElement.parentElement?.insertBefore(this._canvas, this._viewportElement);\n this._register(toDisposable(() => this._canvas?.remove()));\n\n const ctx = this._canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Ctx cannot be null');\n } else {\n this._ctx = ctx;\n }\n\n this._register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(undefined, true)));\n this._register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(undefined, true)));\n\n this._register(this._renderService.onRenderedViewportChange(() => this._queueRefresh()));\n this._register(this._bufferService.buffers.onBufferActivate(() => {\n this._canvas!.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block';\n }));\n this._register(this._bufferService.onScroll(() => {\n if (this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length) {\n this._refreshDrawHeightConstants();\n this._refreshColorZonePadding();\n }\n }));\n\n // Container height changed\n this._register(this._renderService.onRender((): void => {\n if (!this._containerHeight || this._containerHeight !== this._screenElement.clientHeight) {\n this._queueRefresh(true);\n this._containerHeight = this._screenElement.clientHeight;\n }\n }));\n\n this._register(this._coreBrowserService.onDprChange(() => this._queueRefresh(true)));\n this._register(this._optionsService.onSpecificOptionChange('overviewRuler', () => this._queueRefresh(true)));\n this._register(this._themeService.onChangeColors(() => this._queueRefresh()));\n this._queueRefresh(true);\n }\n\n private _refreshDrawConstants(): void {\n // width\n const outerWidth = Math.floor((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n const innerWidth = Math.ceil((this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH) / 3);\n drawWidth.full = this._canvas.width;\n drawWidth.left = outerWidth;\n drawWidth.center = innerWidth;\n drawWidth.right = outerWidth;\n // height\n this._refreshDrawHeightConstants();\n // x\n drawX.full = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.left = Constants.OVERVIEW_RULER_BORDER_WIDTH;\n drawX.center = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left;\n drawX.right = Constants.OVERVIEW_RULER_BORDER_WIDTH + drawWidth.left + drawWidth.center;\n }\n\n private _refreshDrawHeightConstants(): void {\n drawHeight.full = Math.round(2 * this._coreBrowserService.dpr);\n // Calculate actual pixels per line\n const pixelsPerLine = this._canvas.height / this._bufferService.buffer.lines.length;\n // Clamp actual pixels within a range\n const nonFullHeight = Math.round(Math.max(Math.min(pixelsPerLine, 12), 6) * this._coreBrowserService.dpr);\n drawHeight.left = nonFullHeight;\n drawHeight.center = nonFullHeight;\n drawHeight.right = nonFullHeight;\n }\n\n private _refreshColorZonePadding(): void {\n this._colorZoneStore.setPadding({\n full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.full),\n left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.left),\n center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.center),\n right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * drawHeight.right)\n });\n this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;\n }\n\n private _refreshCanvasDimensions(): void {\n this._canvas.style.width = `${this._width}px`;\n this._canvas.width = Math.round(this._width * this._coreBrowserService.dpr);\n this._canvas.style.height = `${this._screenElement.clientHeight}px`;\n this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowserService.dpr);\n this._refreshDrawConstants();\n this._refreshColorZonePadding();\n }\n\n private _refreshDecorations(): void {\n if (this._shouldUpdateDimensions) {\n this._refreshCanvasDimensions();\n }\n this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\n this._colorZoneStore.clear();\n for (const decoration of this._decorationService.decorations) {\n this._colorZoneStore.addDecoration(decoration);\n }\n this._ctx.lineWidth = 1;\n this._renderRulerOutline();\n const zones = this._colorZoneStore.zones;\n for (const zone of zones) {\n if (zone.position !== 'full') {\n this._renderColorZone(zone);\n }\n }\n for (const zone of zones) {\n if (zone.position === 'full') {\n this._renderColorZone(zone);\n }\n }\n this._shouldUpdateDimensions = false;\n this._shouldUpdateAnchor = false;\n }\n\n private _renderRulerOutline(): void {\n this._ctx.fillStyle = this._themeService.colors.overviewRulerBorder.css;\n this._ctx.fillRect(0, 0, Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n if (this._optionsService.rawOptions.overviewRuler.showTopBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, 0, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, Constants.OVERVIEW_RULER_BORDER_WIDTH);\n }\n if (this._optionsService.rawOptions.overviewRuler.showBottomBorder) {\n this._ctx.fillRect(Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.width - Constants.OVERVIEW_RULER_BORDER_WIDTH, this._canvas.height);\n }\n }\n\n private _renderColorZone(zone: IColorZone): void {\n this._ctx.fillStyle = zone.color;\n this._ctx.fillRect(\n /* x */ drawX[zone.position || 'full'],\n /* y */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n (zone.startBufferLine / this._bufferService.buffers.active.lines.length) - drawHeight[zone.position || 'full'] / 2\n ),\n /* w */ drawWidth[zone.position || 'full'],\n /* h */ Math.round(\n (this._canvas.height - 1) * // -1 to ensure at least 2px are allowed for decoration on last line\n ((zone.endBufferLine - zone.startBufferLine) / this._bufferService.buffers.active.lines.length) + drawHeight[zone.position || 'full']\n )\n );\n }\n\n private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {\n this._shouldUpdateDimensions = updateCanvasDimensions || this._shouldUpdateDimensions;\n this._shouldUpdateAnchor = updateAnchor || this._shouldUpdateAnchor;\n if (this._animationFrame !== undefined) {\n return;\n }\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {\n this._refreshDecorations();\n this._animationFrame = undefined;\n });\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderService } from 'browser/services/Services';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { C0 } from 'common/data/EscapeSequences';\n\ninterface IPosition {\n start: number;\n end: number;\n}\n\n/**\n * Encapsulates the logic for handling compositionstart, compositionupdate and compositionend\n * events, displaying the in-progress composition to the UI and forwarding the final composition\n * to the handler.\n */\nexport class CompositionHelper {\n /**\n * Whether input composition is currently happening, eg. via a mobile keyboard, speech input or\n * IME. This variable determines whether the compositionText should be displayed on the UI.\n */\n private _isComposing: boolean;\n public get isComposing(): boolean { return this._isComposing; }\n\n /**\n * The position within the input textarea's value of the current composition.\n */\n private _compositionPosition: IPosition;\n\n /**\n * Whether a composition is in the process of being sent, setting this to false will cancel any\n * in-progress composition.\n */\n private _isSendingComposition: boolean;\n\n /**\n * Data already sent due to keydown event.\n */\n private _dataAlreadySent: string;\n\n /**\n * The pending textarea change timer, if any.\n */\n private _textareaChangeTimer?: number;\n\n constructor(\n private readonly _textarea: HTMLTextAreaElement,\n private readonly _compositionView: HTMLElement,\n @IBufferService private readonly _bufferService: IBufferService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreService private readonly _coreService: ICoreService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n this._isComposing = false;\n this._isSendingComposition = false;\n this._compositionPosition = { start: 0, end: 0 };\n this._dataAlreadySent = '';\n }\n\n /**\n * Handles the compositionstart event, activating the composition view.\n */\n public compositionstart(): void {\n this._isComposing = true;\n this._compositionPosition.start = this._textarea.value.length;\n this._compositionView.textContent = '';\n this._dataAlreadySent = '';\n this._compositionView.classList.add('active');\n }\n\n /**\n * Handles the compositionupdate event, updating the composition view.\n * @param ev The event.\n */\n public compositionupdate(ev: Pick): void {\n this._compositionView.textContent = ev.data;\n this.updateCompositionElements();\n setTimeout(() => {\n this._compositionPosition.end = this._textarea.value.length;\n }, 0);\n }\n\n /**\n * Handles the compositionend event, hiding the composition view and sending the composition to\n * the handler.\n */\n public compositionend(): void {\n this._finalizeComposition(true);\n }\n\n /**\n * Handles the keydown event, routing any necessary events to the CompositionHelper functions.\n * @param ev The keydown event.\n * @returns Whether the Terminal should continue processing the keydown event.\n */\n public keydown(ev: KeyboardEvent): boolean {\n if (this._isComposing || this._isSendingComposition) {\n if (ev.keyCode === 20 || ev.keyCode === 229) {\n // 20 is CapsLock, 229 is Enter\n // Continue composing if the keyCode is the \"composition character\"\n return false;\n }\n if (ev.keyCode === 16 || ev.keyCode === 17 || ev.keyCode === 18) {\n // Continue composing if the keyCode is a modifier key\n return false;\n }\n // Finish composition immediately. This is mainly here for the case where enter is\n // pressed and the handler needs to be triggered before the command is executed.\n this._finalizeComposition(false);\n }\n\n if (ev.keyCode === 229) {\n // If the \"composition character\" is used but gets to this point it means a non-composition\n // character (eg. numbers and punctuation) was pressed when the IME was active.\n this._handleAnyTextareaChanges();\n return false;\n }\n\n return true;\n }\n\n /**\n * Finalizes the composition, resuming regular input actions. This is called when a composition\n * is ending.\n * @param waitForPropagation Whether to wait for events to propagate before sending\n * the input. This should be false if a non-composition keystroke is entered before the\n * compositionend event is triggered, such as enter, so that the composition is sent before\n * the command is executed.\n */\n private _finalizeComposition(waitForPropagation: boolean): void {\n this._compositionView.classList.remove('active');\n this._isComposing = false;\n\n if (!waitForPropagation) {\n // Cancel any delayed composition send requests and send the input immediately.\n this._isSendingComposition = false;\n const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);\n this._coreService.triggerDataEvent(input, true);\n } else {\n // Make a deep copy of the composition position here as a new compositionstart event may\n // fire before the setTimeout executes.\n const currentCompositionPosition = {\n start: this._compositionPosition.start,\n end: this._compositionPosition.end\n };\n\n // Since composition* events happen before the changes take place in the textarea on most\n // browsers, use a setTimeout with 0ms time to allow the native compositionend event to\n // complete. This ensures the correct character is retrieved.\n // This solution was used because:\n // - The compositionend event's data property is unreliable, at least on Chromium\n // - The last compositionupdate event's data property does not always accurately describe\n // the character, a counter example being Korean where an ending consonsant can move to\n // the following character if the following input is a vowel.\n this._isSendingComposition = true;\n setTimeout(() => {\n // Ensure that the input has not already been sent\n if (this._isSendingComposition) {\n this._isSendingComposition = false;\n let input;\n // Add length of data already sent due to keydown event,\n // otherwise input characters can be duplicated. (Issue #3191)\n currentCompositionPosition.start += this._dataAlreadySent.length;\n if (this._isComposing) {\n // Use the start position of the new composition to get the string\n // if a new composition has started.\n input = this._textarea.value.substring(currentCompositionPosition.start, this._compositionPosition.start);\n } else {\n // Don't use the end position here in order to pick up any characters after the\n // composition has finished, for example when typing a non-composition character\n // (eg. 2) after a composition character.\n input = this._textarea.value.substring(currentCompositionPosition.start);\n }\n if (input.length > 0) {\n this._coreService.triggerDataEvent(input, true);\n }\n }\n }, 0);\n }\n }\n\n /**\n * Apply any changes made to the textarea after the current event chain is allowed to complete.\n * This should be called when not currently composing but a keydown event with the \"composition\n * character\" (229) is triggered, in order to allow non-composition text to be entered when an\n * IME is active.\n */\n private _handleAnyTextareaChanges(): void {\n if (this._textareaChangeTimer) {\n return;\n }\n const oldValue = this._textarea.value;\n this._textareaChangeTimer = window.setTimeout(() => {\n this._textareaChangeTimer = undefined;\n // Ignore if a composition has started since the timeout\n if (!this._isComposing) {\n const newValue = this._textarea.value;\n\n const diff = newValue.replace(oldValue, '');\n\n this._dataAlreadySent = diff;\n\n if (newValue.length > oldValue.length) {\n this._coreService.triggerDataEvent(diff, true);\n } else if (newValue.length < oldValue.length) {\n this._coreService.triggerDataEvent(`${C0.DEL}`, true);\n } else if ((newValue.length === oldValue.length) && (newValue !== oldValue)) {\n this._coreService.triggerDataEvent(newValue, true);\n }\n\n }\n }, 0);\n }\n\n /**\n * Positions the composition view on top of the cursor and the textarea just below it (so the\n * IME helper dialog is positioned correctly).\n * @param dontRecurse Whether to use setTimeout to recursively trigger another update, this is\n * necessary as the IME events across browsers are not consistently triggered.\n */\n public updateCompositionElements(dontRecurse?: boolean): void {\n if (!this._isComposing) {\n return;\n }\n\n if (this._bufferService.buffer.isCursorInViewport) {\n const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);\n\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const cursorTop = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n this._compositionView.style.left = cursorLeft + 'px';\n this._compositionView.style.top = cursorTop + 'px';\n this._compositionView.style.height = cellHeight + 'px';\n this._compositionView.style.lineHeight = cellHeight + 'px';\n this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + 'px';\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n const compositionViewBounds = this._compositionView.getBoundingClientRect();\n this._textarea.style.left = cursorLeft + 'px';\n this._textarea.style.top = cursorTop + 'px';\n // Ensure the text area is at least 1x1, otherwise certain IMEs may break\n this._textarea.style.width = Math.max(compositionViewBounds.width, 1) + 'px';\n this._textarea.style.height = Math.max(compositionViewBounds.height, 1) + 'px';\n this._textarea.style.lineHeight = compositionViewBounds.height + 'px';\n }\n\n if (!dontRecurse) {\n setTimeout(() => this.updateCompositionElements(true), 0);\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColor, IColorRGB } from 'common/Types';\n\nlet $r = 0;\nlet $g = 0;\nlet $b = 0;\nlet $a = 0;\n\nexport const NULL_COLOR: IColor = {\n css: '#00000000',\n rgba: 0\n};\n\n/**\n * Helper functions where the source type is \"channels\" (individual color channels as numbers).\n */\nexport namespace channels {\n export function toCss(r: number, g: number, b: number, a?: number): string {\n if (a !== undefined) {\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}${toPaddedHex(a)}`;\n }\n return `#${toPaddedHex(r)}${toPaddedHex(g)}${toPaddedHex(b)}`;\n }\n\n export function toRgba(r: number, g: number, b: number, a: number = 0xFF): number {\n // Note: The aggregated number is RGBA32 (BE), thus needs to be converted to ABGR32\n // on LE systems, before it can be used for direct 32-bit buffer writes.\n // >>> 0 forces an unsigned int\n return (r << 24 | g << 16 | b << 8 | a) >>> 0;\n }\n\n export function toColor(r: number, g: number, b: number, a?: number): IColor {\n return {\n css: channels.toCss(r, g, b, a),\n rgba: channels.toRgba(r, g, b, a)\n };\n }\n}\n\n/**\n * Helper functions where the source type is `IColor`.\n */\nexport namespace color {\n export function blend(bg: IColor, fg: IColor): IColor {\n $a = (fg.rgba & 0xFF) / 255;\n if ($a === 1) {\n return {\n css: fg.css,\n rgba: fg.rgba\n };\n }\n const fgR = (fg.rgba >> 24) & 0xFF;\n const fgG = (fg.rgba >> 16) & 0xFF;\n const fgB = (fg.rgba >> 8) & 0xFF;\n const bgR = (bg.rgba >> 24) & 0xFF;\n const bgG = (bg.rgba >> 16) & 0xFF;\n const bgB = (bg.rgba >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n const css = channels.toCss($r, $g, $b);\n const rgba = channels.toRgba($r, $g, $b);\n return { css, rgba };\n }\n\n export function isOpaque(color: IColor): boolean {\n return (color.rgba & 0xFF) === 0xFF;\n }\n\n export function ensureContrastRatio(bg: IColor, fg: IColor, ratio: number): IColor | undefined {\n const result = rgba.ensureContrastRatio(bg.rgba, fg.rgba, ratio);\n if (!result) {\n return undefined;\n }\n return channels.toColor(\n (result >> 24 & 0xFF),\n (result >> 16 & 0xFF),\n (result >> 8 & 0xFF)\n );\n }\n\n export function opaque(color: IColor): IColor {\n const rgbaColor = (color.rgba | 0xFF) >>> 0;\n [$r, $g, $b] = rgba.toChannels(rgbaColor);\n return {\n css: channels.toCss($r, $g, $b),\n rgba: rgbaColor\n };\n }\n\n export function opacity(color: IColor, opacity: number): IColor {\n $a = Math.round(opacity * 0xFF);\n [$r, $g, $b] = rgba.toChannels(color.rgba);\n return {\n css: channels.toCss($r, $g, $b, $a),\n rgba: channels.toRgba($r, $g, $b, $a)\n };\n }\n\n export function multiplyOpacity(color: IColor, factor: number): IColor {\n $a = color.rgba & 0xFF;\n return opacity(color, ($a * factor) / 0xFF);\n }\n\n export function toColorRGB(color: IColor): IColorRGB {\n return [(color.rgba >> 24) & 0xFF, (color.rgba >> 16) & 0xFF, (color.rgba >> 8) & 0xFF];\n }\n}\n\n/**\n * Helper functions where the source type is \"css\" (string: '#rgb', '#rgba', '#rrggbb',\n * '#rrggbbaa').\n */\nexport namespace css {\n // Attempt to set get the shared canvas context\n let $ctx: CanvasRenderingContext2D | undefined;\n let $litmusColor: CanvasGradient | undefined;\n try {\n // This is guaranteed to run in the first window, so document should be correct\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext('2d', {\n willReadFrequently: true\n });\n if (ctx) {\n $ctx = ctx;\n $ctx.globalCompositeOperation = 'copy';\n $litmusColor = $ctx.createLinearGradient(0, 0, 1, 1);\n }\n }\n catch {\n // noop\n }\n\n /**\n * Converts a css string to an IColor, this should handle all valid CSS color strings and will\n * throw if it's invalid. The ideal format to use is `#rrggbb[aa]` as it's the fastest to parse.\n *\n * Only `#rgb[a]`, `#rrggbb[aa]`, `rgb()` and `rgba()` formats are supported when run in a Node\n * environment.\n */\n export function toColor(css: string): IColor {\n // Formats: #rgb[a] and #rrggbb[aa]\n if (css.match(/#[\\da-f]{3,8}/i)) {\n switch (css.length) {\n case 4: { // #rgb\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n return channels.toColor($r, $g, $b);\n }\n case 5: { // #rgba\n $r = parseInt(css.slice(1, 2).repeat(2), 16);\n $g = parseInt(css.slice(2, 3).repeat(2), 16);\n $b = parseInt(css.slice(3, 4).repeat(2), 16);\n $a = parseInt(css.slice(4, 5).repeat(2), 16);\n return channels.toColor($r, $g, $b, $a);\n }\n case 7: // #rrggbb\n return {\n css,\n rgba: (parseInt(css.slice(1), 16) << 8 | 0xFF) >>> 0\n };\n case 9: // #rrggbbaa\n return {\n css,\n rgba: parseInt(css.slice(1), 16) >>> 0\n };\n }\n }\n\n // Formats: rgb() or rgba()\n const rgbaMatch = css.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);\n if (rgbaMatch) {\n $r = parseInt(rgbaMatch[1]);\n $g = parseInt(rgbaMatch[2]);\n $b = parseInt(rgbaMatch[3]);\n $a = Math.round((rgbaMatch[5] === undefined ? 1 : parseFloat(rgbaMatch[5])) * 0xFF);\n return channels.toColor($r, $g, $b, $a);\n }\n\n // Handle the \"transparent\" keyword\n if (css === 'transparent') {\n return {\n css: 'transparent',\n rgba: 0x00000000\n };\n }\n\n // Validate the context is available for canvas-based color parsing\n if (!$ctx || !$litmusColor) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Validate the color using canvas fillStyle\n // See https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles\n $ctx.fillStyle = $litmusColor;\n $ctx.fillStyle = css;\n if (typeof $ctx.fillStyle !== 'string') {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n $ctx.fillRect(0, 0, 1, 1);\n [$r, $g, $b, $a] = $ctx.getImageData(0, 0, 1, 1).data;\n\n // Validate the color is non-transparent as color hue gets lost when drawn to the canvas\n if ($a !== 0xFF) {\n throw new Error('css.toColor: Unsupported css format');\n }\n\n // Extract the color from the canvas' fillStyle property which exposes the color value in rgba()\n // format\n // See https://html.spec.whatwg.org/multipage/canvas.html#serialisation-of-a-color\n return {\n rgba: channels.toRgba($r, $g, $b, $a),\n css\n };\n }\n}\n\n/**\n * Helper functions where the source type is \"rgb\" (number: 0xrrggbb).\n */\nexport namespace rgb {\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param rgb The color to use.\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance(rgb: number): number {\n return relativeLuminance2(\n (rgb >> 16) & 0xFF,\n (rgb >> 8 ) & 0xFF,\n (rgb ) & 0xFF);\n }\n\n /**\n * Gets the relative luminance of an RGB color, this is useful in determining the contrast ratio\n * between two colors.\n * @param r The red channel (0x00 to 0xFF).\n * @param g The green channel (0x00 to 0xFF).\n * @param b The blue channel (0x00 to 0xFF).\n * @see https://www.w3.org/TR/WCAG20/#relativeluminancedef\n */\n export function relativeLuminance2(r: number, g: number, b: number): number {\n const rs = r / 255;\n const gs = g / 255;\n const bs = b / 255;\n const rr = rs <= 0.03928 ? rs / 12.92 : Math.pow((rs + 0.055) / 1.055, 2.4);\n const rg = gs <= 0.03928 ? gs / 12.92 : Math.pow((gs + 0.055) / 1.055, 2.4);\n const rb = bs <= 0.03928 ? bs / 12.92 : Math.pow((bs + 0.055) / 1.055, 2.4);\n return rr * 0.2126 + rg * 0.7152 + rb * 0.0722;\n }\n}\n\n/**\n * Helper functions where the source type is \"rgba\" (number: 0xrrggbbaa).\n */\nexport namespace rgba {\n export function blend(bg: number, fg: number): number {\n $a = (fg & 0xFF) / 0xFF;\n if ($a === 1) {\n return fg;\n }\n const fgR = (fg >> 24) & 0xFF;\n const fgG = (fg >> 16) & 0xFF;\n const fgB = (fg >> 8) & 0xFF;\n const bgR = (bg >> 24) & 0xFF;\n const bgG = (bg >> 16) & 0xFF;\n const bgB = (bg >> 8) & 0xFF;\n $r = bgR + Math.round((fgR - bgR) * $a);\n $g = bgG + Math.round((fgG - bgG) * $a);\n $b = bgB + Math.round((fgB - bgB) * $a);\n return channels.toRgba($r, $g, $b);\n }\n\n /**\n * Given a foreground color and a background color, either increase or reduce the luminance of the\n * foreground color until the specified contrast ratio is met. If pure white or black is hit\n * without the contrast ratio being met, go the other direction using the background color as the\n * foreground color and take either the first or second result depending on which has the higher\n * contrast ratio.\n *\n * `undefined` will be returned if the contrast ratio is already met.\n *\n * @param bgRgba The background color in rgba format.\n * @param fgRgba The foreground color in rgba format.\n * @param ratio The contrast ratio to achieve.\n */\n export function ensureContrastRatio(bgRgba: number, fgRgba: number, ratio: number): number | undefined {\n const bgL = rgb.relativeLuminance(bgRgba >> 8);\n const fgL = rgb.relativeLuminance(fgRgba >> 8);\n const cr = contrastRatio(bgL, fgL);\n if (cr < ratio) {\n if (fgL < bgL) {\n const resultA = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n const resultA = increaseLuminance(bgRgba, fgRgba, ratio);\n const resultARatio = contrastRatio(bgL, rgb.relativeLuminance(resultA >> 8));\n if (resultARatio < ratio) {\n const resultB = reduceLuminance(bgRgba, fgRgba, ratio);\n const resultBRatio = contrastRatio(bgL, rgb.relativeLuminance(resultB >> 8));\n return resultARatio > resultBRatio ? resultA : resultB;\n }\n return resultA;\n }\n return undefined;\n }\n\n export function reduceLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to reducing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR > 0 || fgG > 0 || fgB > 0)) {\n // Reduce by 10% until the ratio is hit\n fgR -= Math.max(0, Math.ceil(fgR * 0.1));\n fgG -= Math.max(0, Math.ceil(fgG * 0.1));\n fgB -= Math.max(0, Math.ceil(fgB * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function increaseLuminance(bgRgba: number, fgRgba: number, ratio: number): number {\n // This is a naive but fast approach to increasing luminance as converting to\n // HSL and back is expensive\n const bgR = (bgRgba >> 24) & 0xFF;\n const bgG = (bgRgba >> 16) & 0xFF;\n const bgB = (bgRgba >> 8) & 0xFF;\n let fgR = (fgRgba >> 24) & 0xFF;\n let fgG = (fgRgba >> 16) & 0xFF;\n let fgB = (fgRgba >> 8) & 0xFF;\n let cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n while (cr < ratio && (fgR < 0xFF || fgG < 0xFF || fgB < 0xFF)) {\n // Increase by 10% until the ratio is hit\n fgR = Math.min(0xFF, fgR + Math.ceil((255 - fgR) * 0.1));\n fgG = Math.min(0xFF, fgG + Math.ceil((255 - fgG) * 0.1));\n fgB = Math.min(0xFF, fgB + Math.ceil((255 - fgB) * 0.1));\n cr = contrastRatio(rgb.relativeLuminance2(fgR, fgG, fgB), rgb.relativeLuminance2(bgR, bgG, bgB));\n }\n return (fgR << 24 | fgG << 16 | fgB << 8 | 0xFF) >>> 0;\n }\n\n export function toChannels(value: number): [number, number, number, number] {\n return [(value >> 24) & 0xFF, (value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF];\n }\n}\n\nexport function toPaddedHex(c: number): string {\n const s = c.toString(16);\n return s.length < 2 ? '0' + s : s;\n}\n\n/**\n * Gets the contrast ratio between two relative luminance values.\n * @param l1 The first relative luminance.\n * @param l2 The first relative luminance.\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n */\nexport function contrastRatio(l1: number, l2: number): number {\n if (l1 < l2) {\n return (l2 + 0.05) / (l1 + 0.05);\n }\n return (l1 + 0.05) / (l2 + 0.05);\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, CharData } from 'common/Types';\nimport { ICharacterJoiner } from 'browser/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferService } from 'common/services/Services';\nimport { ICharacterJoinerService } from 'browser/services/Services';\n\nexport class JoinedCellData extends AttributeData implements ICellData {\n private _width: number;\n // .content carries no meaning for joined CellData, simply nullify it\n // thus we have to overload all other .content accessors\n public content: number = 0;\n public fg: number;\n public bg: number;\n public combinedData: string = '';\n\n constructor(firstCell: ICellData, chars: string, width: number) {\n super();\n this.fg = firstCell.fg;\n this.bg = firstCell.bg;\n this.combinedData = chars;\n this._width = width;\n }\n\n public isCombined(): number {\n // always mark joined cell data as combined\n return Content.IS_COMBINED_MASK;\n }\n\n public getWidth(): number {\n return this._width;\n }\n\n public getChars(): string {\n return this.combinedData;\n }\n\n public getCode(): number {\n // code always gets the highest possible fake codepoint (read as -1)\n // this is needed as code is used by caches as identifier\n return 0x1FFFFF;\n }\n\n public setFromCharData(value: CharData): void {\n throw new Error('not implemented');\n }\n\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n}\n\nexport class CharacterJoinerService implements ICharacterJoinerService {\n public serviceBrand: undefined;\n\n private _characterJoiners: ICharacterJoiner[] = [];\n private _nextCharacterJoinerId: number = 0;\n private _workCell: CellData = new CellData();\n\n constructor(\n @IBufferService private _bufferService: IBufferService\n ) { }\n\n public register(handler: (text: string) => [number, number][]): number {\n const joiner: ICharacterJoiner = {\n id: this._nextCharacterJoinerId++,\n handler\n };\n\n this._characterJoiners.push(joiner);\n return joiner.id;\n }\n\n public deregister(joinerId: number): boolean {\n for (let i = 0; i < this._characterJoiners.length; i++) {\n if (this._characterJoiners[i].id === joinerId) {\n this._characterJoiners.splice(i, 1);\n return true;\n }\n }\n\n return false;\n }\n\n public getJoinedCharacters(row: number): [number, number][] {\n if (this._characterJoiners.length === 0) {\n return [];\n }\n\n const line = this._bufferService.buffer.lines.get(row);\n if (!line || line.length === 0) {\n return [];\n }\n\n const ranges: [number, number][] = [];\n const lineStr = line.translateToString(true);\n\n // Because some cells can be represented by multiple javascript characters,\n // we track the cell and the string indexes separately. This allows us to\n // translate the string ranges we get from the joiners back into cell ranges\n // for use when rendering\n let rangeStartColumn = 0;\n let currentStringIndex = 0;\n let rangeStartStringIndex = 0;\n let rangeAttrFG = line.getFg(0);\n let rangeAttrBG = line.getBg(0);\n\n for (let x = 0; x < line.getTrimmedLength(); x++) {\n line.loadCell(x, this._workCell);\n\n if (this._workCell.getWidth() === 0) {\n // If this character is of width 0, skip it.\n continue;\n }\n\n // End of range\n if (this._workCell.fg !== rangeAttrFG || this._workCell.bg !== rangeAttrBG) {\n // If we ended up with a sequence of more than one character,\n // look for ranges to join.\n if (x - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n // Reset our markers for a new range.\n rangeStartColumn = x;\n rangeStartStringIndex = currentStringIndex;\n rangeAttrFG = this._workCell.fg;\n rangeAttrBG = this._workCell.bg;\n }\n\n currentStringIndex += this._workCell.getChars().length || WHITESPACE_CELL_CHAR.length;\n }\n\n // Process any trailing ranges.\n if (this._bufferService.cols - rangeStartColumn > 1) {\n const joinedRanges = this._getJoinedRanges(\n lineStr,\n rangeStartStringIndex,\n currentStringIndex,\n line,\n rangeStartColumn\n );\n for (let i = 0; i < joinedRanges.length; i++) {\n ranges.push(joinedRanges[i]);\n }\n }\n\n return ranges;\n }\n\n /**\n * Given a segment of a line of text, find all ranges of text that should be\n * joined in a single rendering unit. Ranges are internally converted to\n * column ranges, rather than string ranges.\n * @param line String representation of the full line of text\n * @param startIndex Start position of the range to search in the string (inclusive)\n * @param endIndex End position of the range to search in the string (exclusive)\n */\n private _getJoinedRanges(line: string, startIndex: number, endIndex: number, lineData: IBufferLine, startCol: number): [number, number][] {\n const text = line.substring(startIndex, endIndex);\n // At this point we already know that there is at least one joiner so\n // we can just pull its value and assign it directly rather than\n // merging it into an empty array, which incurs unnecessary writes.\n let allJoinedRanges: [number, number][] = [];\n try {\n allJoinedRanges = this._characterJoiners[0].handler(text);\n } catch (error) {\n console.error(error);\n }\n for (let i = 1; i < this._characterJoiners.length; i++) {\n // We merge any overlapping ranges across the different joiners\n try {\n const joinerRanges = this._characterJoiners[i].handler(text);\n for (let j = 0; j < joinerRanges.length; j++) {\n CharacterJoinerService._mergeRanges(allJoinedRanges, joinerRanges[j]);\n }\n } catch (error) {\n console.error(error);\n }\n }\n this._stringRangesToCellRanges(allJoinedRanges, lineData, startCol);\n return allJoinedRanges;\n }\n\n /**\n * Modifies the provided ranges in-place to adjust for variations between\n * string length and cell width so that the range represents a cell range,\n * rather than the string range the joiner provides.\n * @param ranges String ranges containing start (inclusive) and end (exclusive) index\n * @param line Cell data for the relevant line in the terminal\n * @param startCol Offset within the line to start from\n */\n private _stringRangesToCellRanges(ranges: [number, number][], line: IBufferLine, startCol: number): void {\n let currentRangeIndex = 0;\n let currentRangeStarted = false;\n let currentStringIndex = 0;\n let currentRange = ranges[currentRangeIndex];\n\n // If we got through all of the ranges, stop searching\n if (!currentRange) {\n return;\n }\n\n for (let x = startCol; x < this._bufferService.cols; x++) {\n const width = line.getWidth(x);\n const length = line.getString(x).length || WHITESPACE_CELL_CHAR.length;\n\n // We skip zero-width characters when creating the string to join the text\n // so we do the same here\n if (width === 0) {\n continue;\n }\n\n // Adjust the start of the range\n if (!currentRangeStarted && currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n }\n\n // Adjust the end of the range\n if (currentRange[1] <= currentStringIndex) {\n currentRange[1] = x;\n\n // We're finished with this range, so we move to the next one\n currentRange = ranges[++currentRangeIndex];\n\n // If there are no more ranges left, stop searching\n if (!currentRange) {\n break;\n }\n\n // Ranges can be on adjacent characters. Because the end index of the\n // ranges are exclusive, this means that the index for the start of a\n // range can be the same as the end index of the previous range. To\n // account for the start of the next range, we check here just in case.\n if (currentRange[0] <= currentStringIndex) {\n currentRange[0] = x;\n currentRangeStarted = true;\n } else {\n currentRangeStarted = false;\n }\n }\n\n // Adjust the string index based on the character length to line up with\n // the column adjustment\n currentStringIndex += length;\n }\n\n // If there is still a range left at the end, it must extend all the way to\n // the end of the line.\n if (currentRange) {\n currentRange[1] = this._bufferService.cols;\n }\n }\n\n /**\n * Merges the range defined by the provided start and end into the list of\n * existing ranges. The merge is done in place on the existing range for\n * performance and is also returned.\n * @param ranges Existing range list\n * @param newRange Tuple of two numbers representing the new range to merge in.\n * @returns The ranges input with the new range merged in place\n */\n private static _mergeRanges(ranges: [number, number][], newRange: [number, number]): [number, number][] {\n let inRange = false;\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n if (!inRange) {\n if (newRange[1] <= range[0]) {\n // Case 1: New range is before the search range\n ranges.splice(i, 0, newRange);\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 2: New range is either wholly contained within the\n // search range or overlaps with the front of it\n range[0] = Math.min(newRange[0], range[0]);\n return ranges;\n }\n\n if (newRange[0] < range[1]) {\n // Case 3: New range either wholly contains the search range\n // or overlaps with the end of it\n range[0] = Math.min(newRange[0], range[0]);\n inRange = true;\n }\n\n // Case 4: New range starts after the search range\n continue;\n } else {\n if (newRange[1] <= range[0]) {\n // Case 5: New range extends from previous range but doesn't\n // reach the current one\n ranges[i - 1][1] = newRange[1];\n return ranges;\n }\n\n if (newRange[1] <= range[1]) {\n // Case 6: New range extends from prvious range into the\n // current range\n ranges[i - 1][1] = Math.max(newRange[1], range[1]);\n ranges.splice(i, 1);\n return ranges;\n }\n\n // Case 7: New range extends from previous range past the\n // end of the current range\n ranges.splice(i, 1);\n i--;\n }\n }\n\n if (inRange) {\n // Case 8: New range extends past the last existing range\n ranges[ranges.length - 1][1] = newRange[1];\n } else {\n // Case 9: New range starts after the last existing range\n ranges.push(newRange);\n }\n\n return ranges;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDimensions, IRenderDimensions } from 'browser/renderer/shared/Types';\n\nexport function throwIfFalsy(value: T | undefined | null): T {\n if (!value) {\n throw new Error('value must not be falsy');\n }\n return value;\n}\n\nexport function isPowerlineGlyph(codepoint: number): boolean {\n // Only return true for Powerline symbols which require\n // different padding and should be excluded from minimum contrast\n // ratio standards\n return 0xE0A4 <= codepoint && codepoint <= 0xE0D6;\n}\n\nexport function isRestrictedPowerlineGlyph(codepoint: number): boolean {\n return 0xE0B0 <= codepoint && codepoint <= 0xE0B7;\n}\n\nfunction isNerdFontGlyph(codepoint: number): boolean {\n return 0xE000 <= codepoint && codepoint <= 0xF8FF;\n}\n\nfunction isBoxOrBlockGlyph(codepoint: number): boolean {\n return 0x2500 <= codepoint && codepoint <= 0x259F;\n}\n\nexport function isEmoji(codepoint: number): boolean {\n return (\n codepoint >= 0x1F600 && codepoint <= 0x1F64F || // Emoticons\n codepoint >= 0x1F300 && codepoint <= 0x1F5FF || // Misc Symbols and Pictographs\n codepoint >= 0x1F680 && codepoint <= 0x1F6FF || // Transport and Map\n codepoint >= 0x2600 && codepoint <= 0x26FF || // Misc symbols\n codepoint >= 0x2700 && codepoint <= 0x27BF || // Dingbats\n codepoint >= 0xFE00 && codepoint <= 0xFE0F || // Variation Selectors\n codepoint >= 0x1F900 && codepoint <= 0x1F9FF || // Supplemental Symbols and Pictographs\n codepoint >= 0x1F1E6 && codepoint <= 0x1F1FF\n );\n}\n\nexport function allowRescaling(codepoint: number | undefined, width: number, glyphSizeX: number, deviceCellWidth: number): boolean {\n return (\n // Is single cell width\n width === 1 &&\n // Glyph exceeds cell bounds, add 50% to avoid hurting readability by rescaling glyphs that\n // barely overlap\n glyphSizeX > Math.ceil(deviceCellWidth * 1.5) &&\n // Never rescale ascii\n codepoint !== undefined && codepoint > 0xFF &&\n // Never rescale emoji\n !isEmoji(codepoint) &&\n // Never rescale powerline or nerd fonts\n !isPowerlineGlyph(codepoint) && !isNerdFontGlyph(codepoint)\n );\n}\n\nexport function treatGlyphAsBackgroundColor(codepoint: number): boolean {\n return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);\n}\n\nexport function createRenderDimensions(): IRenderDimensions {\n return {\n css: {\n canvas: createDimension(),\n cell: createDimension()\n },\n device: {\n canvas: createDimension(),\n cell: createDimension(),\n char: {\n width: 0,\n height: 0,\n left: 0,\n top: 0\n }\n }\n };\n}\n\nfunction createDimension(): IDimensions {\n return {\n width: 0,\n height: 0\n };\n}\n\nexport function computeNextVariantOffset(cellWidth: number, lineWidth: number, currentOffset: number = 0): number {\n return (cellWidth - (Math.round(lineWidth) * 2 - currentOffset)) % (Math.round(lineWidth) * 2);\n}\n", "/**\n * Copyright (c) 2018, 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferLine, ICellData, IColor } from 'common/Types';\nimport { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';\nimport { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { channels, color } from 'common/Color';\nimport { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { JoinedCellData } from 'browser/services/CharacterJoinerService';\nimport { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { IColorContrastCache } from 'browser/Types';\n\n\nexport const enum RowCss {\n BOLD_CLASS = 'xterm-bold',\n DIM_CLASS = 'xterm-dim',\n ITALIC_CLASS = 'xterm-italic',\n UNDERLINE_CLASS = 'xterm-underline',\n OVERLINE_CLASS = 'xterm-overline',\n STRIKETHROUGH_CLASS = 'xterm-strikethrough',\n CURSOR_CLASS = 'xterm-cursor',\n CURSOR_BLINK_CLASS = 'xterm-cursor-blink',\n CURSOR_STYLE_BLOCK_CLASS = 'xterm-cursor-block',\n CURSOR_STYLE_OUTLINE_CLASS = 'xterm-cursor-outline',\n CURSOR_STYLE_BAR_CLASS = 'xterm-cursor-bar',\n CURSOR_STYLE_UNDERLINE_CLASS = 'xterm-cursor-underline'\n}\n\n\nexport class DomRendererRowFactory {\n private _workCell: CellData = new CellData();\n\n private _selectionStart: [number, number] | undefined;\n private _selectionEnd: [number, number] | undefined;\n private _columnSelectMode: boolean = false;\n\n public defaultSpacing = 0;\n\n constructor(\n private readonly _document: Document,\n @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService private readonly _decorationService: IDecorationService,\n @IThemeService private readonly _themeService: IThemeService\n ) {}\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionStart = start;\n this._selectionEnd = end;\n this._columnSelectMode = columnSelectMode;\n }\n\n public createRow(\n lineData: IBufferLine,\n row: number,\n isCursorRow: boolean,\n cursorStyle: string | undefined,\n cursorInactiveStyle: string | undefined,\n cursorX: number,\n cursorBlink: boolean,\n cellWidth: number,\n widthCache: WidthCache,\n linkStart: number,\n linkEnd: number\n ): HTMLSpanElement[] {\n\n const elements: HTMLSpanElement[] = [];\n const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);\n const colors = this._themeService.colors;\n\n let lineLength = lineData.getNoBgTrimmedLength();\n if (isCursorRow && lineLength < cursorX + 1) {\n lineLength = cursorX + 1;\n }\n\n let charElement: HTMLSpanElement | undefined;\n let cellAmount = 0;\n let text = '';\n let i = 0;\n let oldBg = 0;\n let oldFg = 0;\n let oldExt = 0;\n let oldLinkHover: number | boolean = false;\n let oldSpacing = 0;\n let oldIsInSelection: boolean = false;\n let spacing = 0;\n let skipJoinedCheckUntilX = 0;\n const classes: string[] = [];\n\n const hasHover = linkStart !== -1 && linkEnd !== -1;\n\n for (let x = 0; x < lineLength; x++) {\n lineData.loadCell(x, this._workCell);\n let width = this._workCell.getWidth();\n\n // The character to the left is a wide character, drawing is owned by the char at x-1\n if (width === 0) {\n continue;\n }\n\n // If true, indicates that the current character(s) to draw were joined.\n let isJoined = false;\n\n // Indicates whether this cell is part of a joined range that should be ignored as it cannot\n // be rendered entirely, like the selection state differs across the range.\n let isValidJoinRange = (x >= skipJoinedCheckUntilX);\n\n let lastCharX = x;\n\n // Process any joined character ranges as needed. Because of how the\n // ranges are produced, we know that they are valid for the characters\n // and attributes of our input.\n let cell = this._workCell;\n if (joinedRanges.length > 0 && x === joinedRanges[0][0] && isValidJoinRange) {\n const range = joinedRanges.shift()!;\n // If the ligature's selection state is not consistent, don't join it. This helps the\n // selection render correctly regardless whether they should be joined.\n const firstSelectionState = this._isCellInSelection(range[0], row);\n for (i = range[0] + 1; i < range[1]; i++) {\n isValidJoinRange &&= (firstSelectionState === this._isCellInSelection(i, row));\n }\n // Similarly, if the cursor is in the ligature, don't join it.\n isValidJoinRange &&= !isCursorRow || cursorX < range[0] || cursorX >= range[1];\n if (!isValidJoinRange) {\n skipJoinedCheckUntilX = range[1];\n } else {\n isJoined = true;\n\n // We already know the exact start and end column of the joined range,\n // so we get the string and width representing it directly\n cell = new JoinedCellData(\n this._workCell,\n lineData.translateToString(true, range[0], range[1]),\n range[1] - range[0]\n );\n\n // Skip over the cells occupied by this range in the loop\n lastCharX = range[1] - 1;\n\n // Recalculate width\n width = cell.getWidth();\n }\n }\n\n const isInSelection = this._isCellInSelection(x, row);\n const isCursorCell = isCursorRow && x === cursorX;\n const isLinkHover = hasHover && x >= linkStart && x <= linkEnd;\n\n let isDecorated = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n isDecorated = true;\n });\n\n // get chars to render for this cell\n let chars = cell.getChars() || WHITESPACE_CELL_CHAR;\n if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) {\n chars = '\\xa0';\n }\n\n // lookup char render width and calc spacing\n spacing = width * cellWidth - widthCache.get(chars, cell.isBold(), cell.isItalic());\n\n if (!charElement) {\n charElement = this._document.createElement('span');\n } else {\n /**\n * chars can only be merged on existing span if:\n * - existing span only contains mergeable chars (cellAmount != 0)\n * - bg did not change (or both are in selection)\n * - fg did not change (or both are in selection and selection fg is set)\n * - ext did not change\n * - underline from hover state did not change\n * - cell content renders to same letter-spacing\n * - cell is not cursor\n */\n if (\n cellAmount\n && (\n (isInSelection && oldIsInSelection)\n || (!isInSelection && !oldIsInSelection && cell.bg === oldBg)\n )\n && (\n (isInSelection && oldIsInSelection && colors.selectionForeground)\n || cell.fg === oldFg\n )\n && cell.extended.ext === oldExt\n && isLinkHover === oldLinkHover\n && spacing === oldSpacing\n && !isCursorCell\n && !isJoined\n && !isDecorated\n && isValidJoinRange\n ) {\n // no span alterations, thus only account chars skipping all code below\n if (cell.isInvisible()) {\n text += WHITESPACE_CELL_CHAR;\n } else {\n text += chars;\n }\n cellAmount++;\n continue;\n } else {\n /**\n * cannot merge:\n * - apply left-over text to old span\n * - create new span, reset state holders cellAmount & text\n */\n if (cellAmount) {\n charElement.textContent = text;\n }\n charElement = this._document.createElement('span');\n cellAmount = 0;\n text = '';\n }\n }\n // preserve conditions for next merger eval round\n oldBg = cell.bg;\n oldFg = cell.fg;\n oldExt = cell.extended.ext;\n oldLinkHover = isLinkHover;\n oldSpacing = spacing;\n oldIsInSelection = isInSelection;\n\n if (isJoined) {\n // The DOM renderer colors the background of the cursor but for ligatures all cells are\n // joined. The workaround here is to show a cursor around the whole ligature so it shows up,\n // the cursor looks the same when on any character of the ligature though\n if (cursorX >= x && cursorX <= lastCharX) {\n cursorX = x;\n }\n }\n\n if (!this._coreService.isCursorHidden && isCursorCell && this._coreService.isCursorInitialized) {\n classes.push(RowCss.CURSOR_CLASS);\n if (this._coreBrowserService.isFocused) {\n if (cursorBlink) {\n classes.push(RowCss.CURSOR_BLINK_CLASS);\n }\n classes.push(\n cursorStyle === 'bar'\n ? RowCss.CURSOR_STYLE_BAR_CLASS\n : cursorStyle === 'underline'\n ? RowCss.CURSOR_STYLE_UNDERLINE_CLASS\n : RowCss.CURSOR_STYLE_BLOCK_CLASS\n );\n } else {\n if (cursorInactiveStyle) {\n switch (cursorInactiveStyle) {\n case 'outline':\n classes.push(RowCss.CURSOR_STYLE_OUTLINE_CLASS);\n break;\n case 'block':\n classes.push(RowCss.CURSOR_STYLE_BLOCK_CLASS);\n break;\n case 'bar':\n classes.push(RowCss.CURSOR_STYLE_BAR_CLASS);\n break;\n case 'underline':\n classes.push(RowCss.CURSOR_STYLE_UNDERLINE_CLASS);\n break;\n default:\n break;\n }\n }\n }\n }\n\n if (cell.isBold()) {\n classes.push(RowCss.BOLD_CLASS);\n }\n\n if (cell.isItalic()) {\n classes.push(RowCss.ITALIC_CLASS);\n }\n\n if (cell.isDim()) {\n classes.push(RowCss.DIM_CLASS);\n }\n\n if (cell.isInvisible()) {\n text = WHITESPACE_CELL_CHAR;\n } else {\n text = cell.getChars() || WHITESPACE_CELL_CHAR;\n }\n\n if (cell.isUnderline()) {\n classes.push(`${RowCss.UNDERLINE_CLASS}-${cell.extended.underlineStyle}`);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n if (!cell.isUnderlineColorDefault()) {\n if (cell.isUnderlineColorRGB()) {\n charElement.style.textDecorationColor = `rgb(${AttributeData.toColorRGB(cell.getUnderlineColor()).join(',')})`;\n } else {\n let fg = cell.getUnderlineColor();\n if (this._optionsService.rawOptions.drawBoldTextInBrightColors && cell.isBold() && fg < 8) {\n fg += 8;\n }\n charElement.style.textDecorationColor = colors.ansi[fg].css;\n }\n }\n }\n\n if (cell.isOverline()) {\n classes.push(RowCss.OVERLINE_CLASS);\n if (text === ' ') {\n text = '\\xa0'; // =  \n }\n }\n\n if (cell.isStrikethrough()) {\n classes.push(RowCss.STRIKETHROUGH_CLASS);\n }\n\n // apply link hover underline late, effectively overrides any previous text-decoration\n // settings\n if (isLinkHover) {\n charElement.style.textDecoration = 'underline';\n }\n\n let fg = cell.getFgColor();\n let fgColorMode = cell.getFgColorMode();\n let bg = cell.getBgColor();\n let bgColorMode = cell.getBgColorMode();\n const isInverse = !!cell.isInverse();\n if (isInverse) {\n const temp = fg;\n fg = bg;\n bg = temp;\n const temp2 = fgColorMode;\n fgColorMode = bgColorMode;\n bgColorMode = temp2;\n }\n\n // Apply any decoration foreground/background overrides, this must happen after inverse has\n // been applied\n let bgOverride: IColor | undefined;\n let fgOverride: IColor | undefined;\n let isTop = false;\n this._decorationService.forEachDecorationAtCell(x, row, undefined, d => {\n if (d.options.layer !== 'top' && isTop) {\n return;\n }\n if (d.backgroundColorRGB) {\n bgColorMode = Attributes.CM_RGB;\n bg = d.backgroundColorRGB.rgba >> 8 & 0xFFFFFF;\n bgOverride = d.backgroundColorRGB;\n }\n if (d.foregroundColorRGB) {\n fgColorMode = Attributes.CM_RGB;\n fg = d.foregroundColorRGB.rgba >> 8 & 0xFFFFFF;\n fgOverride = d.foregroundColorRGB;\n }\n isTop = d.options.layer === 'top';\n });\n\n // Apply selection\n if (!isTop && isInSelection) {\n // If in the selection, force the element to be above the selection to improve contrast and\n // support opaque selections. The applies background is not actually needed here as\n // selection is drawn in a seperate container, the main purpose of this to ensuring minimum\n // contrast ratio\n bgOverride = this._coreBrowserService.isFocused ? colors.selectionBackgroundOpaque : colors.selectionInactiveBackgroundOpaque;\n bg = bgOverride.rgba >> 8 & 0xFFFFFF;\n bgColorMode = Attributes.CM_RGB;\n // Since an opaque selection is being rendered, the selection pretends to be a decoration to\n // ensure text is drawn above the selection.\n isTop = true;\n // Apply selection foreground if applicable\n if (colors.selectionForeground) {\n fgColorMode = Attributes.CM_RGB;\n fg = colors.selectionForeground.rgba >> 8 & 0xFFFFFF;\n fgOverride = colors.selectionForeground;\n }\n }\n\n // If it's a top decoration, render above the selection\n if (isTop) {\n classes.push('xterm-decoration-top');\n }\n\n // Background\n let resolvedBg: IColor;\n switch (bgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n resolvedBg = colors.ansi[bg];\n classes.push(`xterm-bg-${bg}`);\n break;\n case Attributes.CM_RGB:\n resolvedBg = channels.toColor(bg >> 16, bg >> 8 & 0xFF, bg & 0xFF);\n this._addStyle(charElement, `background-color:#${(bg >>> 0).toString(16).padStart(6, '0')}`);\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (isInverse) {\n resolvedBg = colors.foreground;\n classes.push(`xterm-bg-${INVERTED_DEFAULT_COLOR}`);\n } else {\n resolvedBg = colors.background;\n }\n }\n\n // If there is no background override by now it's the original color, so apply dim if needed\n if (!bgOverride) {\n if (cell.isDim()) {\n bgOverride = color.multiplyOpacity(resolvedBg, 0.5);\n }\n }\n\n // Foreground\n switch (fgColorMode) {\n case Attributes.CM_P16:\n case Attributes.CM_P256:\n if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) {\n fg += 8;\n }\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.ansi[fg], cell, bgOverride, undefined)) {\n classes.push(`xterm-fg-${fg}`);\n }\n break;\n case Attributes.CM_RGB:\n const color = channels.toColor(\n (fg >> 16) & 0xFF,\n (fg >> 8) & 0xFF,\n (fg ) & 0xFF\n );\n if (!this._applyMinimumContrast(charElement, resolvedBg, color, cell, bgOverride, fgOverride)) {\n this._addStyle(charElement, `color:#${fg.toString(16).padStart(6, '0')}`);\n }\n break;\n case Attributes.CM_DEFAULT:\n default:\n if (!this._applyMinimumContrast(charElement, resolvedBg, colors.foreground, cell, bgOverride, fgOverride)) {\n if (isInverse) {\n classes.push(`xterm-fg-${INVERTED_DEFAULT_COLOR}`);\n }\n }\n }\n\n // apply CSS classes\n // slightly faster than using classList by omitting\n // checks for doubled entries (code above should not have doublets)\n if (classes.length) {\n charElement.className = classes.join(' ');\n classes.length = 0;\n }\n\n // exclude conditions for cell merging - never merge these\n if (!isCursorCell && !isJoined && !isDecorated && isValidJoinRange) {\n cellAmount++;\n } else {\n charElement.textContent = text;\n }\n // apply letter-spacing rule\n if (spacing !== this.defaultSpacing) {\n charElement.style.letterSpacing = `${spacing}px`;\n }\n\n elements.push(charElement);\n x = lastCharX;\n }\n\n // postfix text of last merged span\n if (charElement && cellAmount) {\n charElement.textContent = text;\n }\n\n return elements;\n }\n\n private _applyMinimumContrast(element: HTMLElement, bg: IColor, fg: IColor, cell: ICellData, bgOverride: IColor | undefined, fgOverride: IColor | undefined): boolean {\n if (this._optionsService.rawOptions.minimumContrastRatio === 1 || treatGlyphAsBackgroundColor(cell.getCode())) {\n return false;\n }\n\n // Try get from cache first, only use the cache when there are no decoration overrides\n const cache = this._getContrastCache(cell);\n let adjustedColor: IColor | undefined | null = undefined;\n if (!bgOverride && !fgOverride) {\n adjustedColor = cache.getColor(bg.rgba, fg.rgba);\n }\n\n // Calculate and store in cache\n if (adjustedColor === undefined) {\n // Dim cells only require half the contrast, otherwise they wouldn't be distinguishable from\n // non-dim cells\n const ratio = this._optionsService.rawOptions.minimumContrastRatio / (cell.isDim() ? 2 : 1);\n adjustedColor = color.ensureContrastRatio(bgOverride ?? bg, fgOverride ?? fg, ratio);\n cache.setColor((bgOverride ?? bg).rgba, (fgOverride ?? fg).rgba, adjustedColor ?? null);\n }\n\n if (adjustedColor) {\n this._addStyle(element, `color:${adjustedColor.css}`);\n return true;\n }\n\n return false;\n }\n\n private _getContrastCache(cell: ICellData): IColorContrastCache {\n if (cell.isDim()) {\n return this._themeService.colors.halfContrastCache;\n }\n return this._themeService.colors.contrastCache;\n }\n\n private _addStyle(element: HTMLElement, style: string): void {\n element.setAttribute('style', `${element.getAttribute('style') || ''}${style};`);\n }\n\n private _isCellInSelection(x: number, y: number): boolean {\n const start = this._selectionStart;\n const end = this._selectionEnd;\n if (!start || !end) {\n return false;\n }\n if (this._columnSelectMode) {\n if (start[0] <= end[0]) {\n return x >= start[0] && y >= start[1] &&\n x < end[0] && y <= end[1];\n }\n return x < start[0] && y >= start[1] &&\n x >= end[0] && y <= end[1];\n }\n return (y > start[1] && y < end[1]) ||\n (start[1] === end[1] && y === start[1] && x >= start[0] && x < end[0]) ||\n (start[1] < end[1] && y === end[1] && x < end[0]) ||\n (start[1] < end[1] && y === start[1] && x >= start[0]);\n }\n}\n", "/**\n * Copyright (c) 2023 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';\nimport { IDisposable } from 'common/Types';\nimport { FontWeight } from 'common/services/Services';\n\n\nexport const enum WidthCacheSettings {\n /** sentinel for unset values in flat cache */\n FLAT_UNSET = -9999,\n /** size of flat cache, size-1 equals highest codepoint handled by flat */\n FLAT_SIZE = 256,\n /** char repeat for measuring */\n REPEAT = 32\n}\n\n\nconst enum FontVariant {\n REGULAR = 0,\n BOLD = 1,\n ITALIC = 2,\n BOLD_ITALIC = 3\n}\n\nexport interface IWidthCacheFontVariantCanvas {\n setFont(fontFamily: string, fontSize: number, fontWeight: FontWeight, italic: boolean): void;\n measure(c: string): number;\n}\n\nexport class WidthCache implements IDisposable {\n // flat cache for regular variant up to CacheSettings.FLAT_SIZE\n // NOTE: ~4x faster access than holey (serving >>80% of terminal content)\n // It has a small memory footprint (only 1MB for full BMP caching),\n // still the sweet spot is not reached before touching 32k different codepoints,\n // thus we store the remaining <<20% of terminal data in a holey structure.\n protected _flat = new Float32Array(WidthCacheSettings.FLAT_SIZE);\n\n // holey cache for bold, italic and bold&italic for any string\n // FIXME: can grow really big over time (~8.5 MB for full BMP caching),\n // so a shared API across terminals is needed\n protected _holey: Map | undefined;\n\n private _font = '';\n private _fontSize = 0;\n private _weight: FontWeight = 'normal';\n private _weightBold: FontWeight = 'bold';\n private _canvasElements: IWidthCacheFontVariantCanvas[] = [];\n\n constructor(\n canvasFactory: () => IWidthCacheFontVariantCanvas = () => new WidthCacheFontVariantCanvas()\n ) {\n this._canvasElements = [\n canvasFactory(),\n canvasFactory(),\n canvasFactory(),\n canvasFactory()\n ];\n\n this.clear();\n }\n\n public dispose(): void {\n this._canvasElements.length = 0;\n this._holey = undefined; // free cache memory via GC\n }\n\n /**\n * Clear the width cache.\n */\n public clear(): void {\n this._flat.fill(WidthCacheSettings.FLAT_UNSET);\n // .clear() has some overhead, re-assign instead (>3 times faster)\n this._holey = new Map();\n }\n\n /**\n * Set the font for measuring.\n * Must be called for any changes on font settings.\n * Also clears the cache.\n */\n public setFont(font: string, fontSize: number, weight: FontWeight, weightBold: FontWeight): void {\n // skip if nothing changed\n if (\n font === this._font &&\n fontSize === this._fontSize &&\n weight === this._weight &&\n weightBold === this._weightBold\n ) {\n return;\n }\n\n this._font = font;\n this._fontSize = fontSize;\n this._weight = weight;\n this._weightBold = weightBold;\n\n this._canvasElements[FontVariant.REGULAR].setFont(font, fontSize, weight, false);\n this._canvasElements[FontVariant.BOLD].setFont(font, fontSize, weightBold, false);\n this._canvasElements[FontVariant.ITALIC].setFont(font, fontSize, weight, true);\n this._canvasElements[FontVariant.BOLD_ITALIC].setFont(font, fontSize, weightBold, true);\n\n this.clear();\n }\n\n /**\n * Get the render width for cell content `c` with current font settings.\n * `variant` denotes the font variant to be used.\n */\n public get(c: string, bold: boolean | number, italic: boolean | number): number {\n let cp = 0;\n if (!bold && !italic && c.length === 1 && (cp = c.charCodeAt(0)) < WidthCacheSettings.FLAT_SIZE) {\n if (this._flat[cp] !== WidthCacheSettings.FLAT_UNSET) {\n return this._flat[cp];\n }\n const width = this._measure(c, 0);\n if (width > 0) {\n this._flat[cp] = width;\n }\n return width;\n }\n let key = c;\n if (bold) key += 'B';\n if (italic) key += 'I';\n let width = this._holey!.get(key);\n if (width === undefined) {\n let variant = 0;\n if (bold) variant |= FontVariant.BOLD;\n if (italic) variant |= FontVariant.ITALIC;\n width = this._measure(c, variant);\n if (width > 0) {\n this._holey!.set(key, width);\n }\n }\n return width;\n }\n\n protected _measure(c: string, variant: FontVariant): number {\n return this._canvasElements[variant].measure(c);\n }\n}\n\nclass WidthCacheFontVariantCanvas implements IWidthCacheFontVariantCanvas {\n private _canvas: OffscreenCanvas | HTMLCanvasElement;\n private _ctx: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;\n\n constructor() {\n if (typeof OffscreenCanvas !== 'undefined') {\n this._canvas = new OffscreenCanvas(1, 1);\n this._ctx = throwIfFalsy(this._canvas.getContext('2d'));\n } else {\n this._canvas = document.createElement('canvas');\n this._canvas.width = 1;\n this._canvas.height = 1;\n this._ctx = throwIfFalsy(this._canvas.getContext('2d'));\n }\n }\n\n public setFont(fontFamily: string, fontSize: number, fontWeight: FontWeight, italic: boolean): void {\n const fontStyle = italic ? 'italic' : '';\n this._ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`.trim();\n }\n\n public measure(c: string): number {\n return this._ctx.measureText(c).width;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminal } from 'browser/Types';\nimport { ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { Terminal } from '@xterm/xterm';\n\nclass SelectionRenderModel implements ISelectionRenderModel {\n public hasSelection!: boolean;\n public columnSelectMode!: boolean;\n public viewportStartRow!: number;\n public viewportEndRow!: number;\n public viewportCappedStartRow!: number;\n public viewportCappedEndRow!: number;\n public startCol!: number;\n public endCol!: number;\n public selectionStart: [number, number] | undefined;\n public selectionEnd: [number, number] | undefined;\n\n constructor() {\n this.clear();\n }\n\n public clear(): void {\n this.hasSelection = false;\n this.columnSelectMode = false;\n this.viewportStartRow = 0;\n this.viewportEndRow = 0;\n this.viewportCappedStartRow = 0;\n this.viewportCappedEndRow = 0;\n this.startCol = 0;\n this.endCol = 0;\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n }\n\n public update(terminal: ITerminal, start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {\n this.selectionStart = start;\n this.selectionEnd = end;\n // Selection does not exist\n if (!start || !end || (start[0] === end[0] && start[1] === end[1])) {\n this.clear();\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportY = terminal.buffers.active.ydisp;\n const viewportStartRow = start[1] - viewportY;\n const viewportEndRow = end[1] - viewportY;\n const viewportCappedStartRow = Math.max(viewportStartRow, 0);\n const viewportCappedEndRow = Math.min(viewportEndRow, terminal.rows - 1);\n\n // No need to draw the selection\n if (viewportCappedStartRow >= terminal.rows || viewportCappedEndRow < 0) {\n this.clear();\n return;\n }\n\n this.hasSelection = true;\n this.columnSelectMode = columnSelectMode;\n this.viewportStartRow = viewportStartRow;\n this.viewportEndRow = viewportEndRow;\n this.viewportCappedStartRow = viewportCappedStartRow;\n this.viewportCappedEndRow = viewportCappedEndRow;\n this.startCol = start[0];\n this.endCol = end[0];\n }\n\n public isCellSelected(terminal: Terminal, x: number, y: number): boolean {\n if (!this.hasSelection) {\n return false;\n }\n y -= terminal.buffer.active.viewportY;\n if (this.columnSelectMode) {\n if (this.startCol <= this.endCol) {\n return x >= this.startCol && y >= this.viewportCappedStartRow &&\n x < this.endCol && y <= this.viewportCappedEndRow;\n }\n return x < this.startCol && y >= this.viewportCappedStartRow &&\n x >= this.endCol && y <= this.viewportCappedEndRow;\n }\n return (y > this.viewportStartRow && y < this.viewportEndRow) ||\n (this.viewportStartRow === this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportEndRow && x < this.endCol) ||\n (this.viewportStartRow < this.viewportEndRow && y === this.viewportStartRow && x >= this.startCol);\n }\n}\n\nexport function createSelectionRenderModel(): ISelectionRenderModel {\n return new SelectionRenderModel();\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';\nimport { WidthCache } from 'browser/renderer/dom/WidthCache';\nimport { INVERTED_DEFAULT_COLOR, RendererConstants } from 'browser/renderer/shared/Constants';\nimport { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';\nimport { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';\nimport { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';\nimport { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';\nimport { color } from 'common/Color';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IBufferService, ICoreService, IInstantiationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\n\nconst TERMINAL_CLASS_PREFIX = 'xterm-dom-renderer-owner-';\nconst ROW_CONTAINER_CLASS = 'xterm-rows';\nconst FG_CLASS_PREFIX = 'xterm-fg-';\nconst BG_CLASS_PREFIX = 'xterm-bg-';\nconst FOCUS_CLASS = 'xterm-focus';\nconst SELECTION_CLASS = 'xterm-selection';\nconst CURSOR_BLINK_IDLE_CLASS = 'xterm-cursor-blink-idle';\n\nlet nextTerminalId = 1;\n\n/**\n * The standard renderer and fallback for when the webgl addon is slow. This is not meant to be\n * particularly fast and will even lack some features such as custom glyphs, hoever this is more\n * reliable as webgl may not work on some machines.\n */\nexport class DomRenderer extends Disposable implements IRenderer {\n private _rowFactory: DomRendererRowFactory;\n private _terminalClass: number = nextTerminalId++;\n\n private _themeStyleElement!: HTMLStyleElement;\n private _dimensionsStyleElement!: HTMLStyleElement;\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[] = [];\n private _selectionContainer: HTMLElement;\n private _widthCache: WidthCache;\n private _selectionRenderModel: ISelectionRenderModel = createSelectionRenderModel();\n private _cursorBlinkStateManager: CursorBlinkStateManager;\n\n public dimensions: IRenderDimensions;\n\n private readonly _onRequestRedraw = this._register(new Emitter());\n public readonly onRequestRedraw = this._onRequestRedraw.event;\n\n constructor(\n private readonly _terminal: ITerminal,\n private readonly _document: Document,\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _viewportElement: HTMLElement,\n private readonly _helperContainer: HTMLElement,\n private readonly _linkifier2: ILinkifier2,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService private readonly _themeService: IThemeService\n ) {\n super();\n this._rowContainer = this._document.createElement('div');\n this._rowContainer.classList.add(ROW_CONTAINER_CLASS);\n this._rowContainer.style.lineHeight = 'normal';\n this._rowContainer.setAttribute('aria-hidden', 'true');\n this._refreshRowElements(this._bufferService.cols, this._bufferService.rows);\n this._selectionContainer = this._document.createElement('div');\n this._selectionContainer.classList.add(SELECTION_CLASS);\n this._selectionContainer.setAttribute('aria-hidden', 'true');\n\n this.dimensions = createRenderDimensions();\n this._updateDimensions();\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n\n this._register(this._themeService.onChangeColors(e => this._injectCss(e)));\n this._injectCss(this._themeService.colors);\n\n this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);\n\n this._element.classList.add(TERMINAL_CLASS_PREFIX + this._terminalClass);\n this._screenElement.appendChild(this._rowContainer);\n this._screenElement.appendChild(this._selectionContainer);\n\n this._register(this._linkifier2.onShowLinkUnderline(e => this._handleLinkHover(e)));\n this._register(this._linkifier2.onHideLinkUnderline(e => this._handleLinkLeave(e)));\n\n this._cursorBlinkStateManager = new CursorBlinkStateManager(this._rowContainer, this._coreBrowserService);\n this._register(addDisposableListener(this._document, 'mousedown', () => this._cursorBlinkStateManager.restartBlinkAnimation()));\n this._register(toDisposable(() => this._cursorBlinkStateManager.dispose()));\n\n this._register(toDisposable(() => {\n this._element.classList.remove(TERMINAL_CLASS_PREFIX + this._terminalClass);\n\n // Outside influences such as React unmounts may manipulate the DOM before our disposal.\n // https://github.com/xtermjs/xterm.js/issues/2960\n this._rowContainer.remove();\n this._selectionContainer.remove();\n this._widthCache.dispose();\n this._themeStyleElement.remove();\n this._dimensionsStyleElement.remove();\n }));\n\n this._widthCache = new WidthCache();\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n private _updateDimensions(): void {\n const dpr = this._coreBrowserService.dpr;\n this.dimensions.device.char.width = this._charSizeService.width * dpr;\n this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * dpr);\n this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing);\n this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight);\n this.dimensions.device.char.left = 0;\n this.dimensions.device.char.top = 0;\n this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols;\n this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows;\n this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / dpr);\n this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / dpr);\n this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols;\n this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;\n\n for (const element of this._rowElements) {\n element.style.width = `${this.dimensions.css.canvas.width}px`;\n element.style.height = `${this.dimensions.css.cell.height}px`;\n element.style.lineHeight = `${this.dimensions.css.cell.height}px`;\n // Make sure rows don't overflow onto following row\n element.style.overflow = 'hidden';\n }\n\n if (!this._dimensionsStyleElement) {\n this._dimensionsStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._dimensionsStyleElement);\n }\n\n const styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} span {` +\n ` display: inline-block;` + // TODO: find workaround for inline-block (creates ~20% render penalty)\n ` height: 100%;` +\n ` vertical-align: top;` +\n `}`;\n\n this._dimensionsStyleElement.textContent = styles;\n\n this._selectionContainer.style.height = this._viewportElement.style.height;\n this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`;\n this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;\n }\n\n private _injectCss(colors: ReadonlyColorSet): void {\n if (!this._themeStyleElement) {\n this._themeStyleElement = this._document.createElement('style');\n this._screenElement.appendChild(this._themeStyleElement);\n }\n\n // Base CSS\n let styles =\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} {` +\n // Disabling pointer events circumvents a browser behavior that prevents `click` events from\n // being delivered if the target element is replaced during the click. This happened due to\n // refresh() being called during the mousedown handler to start a selection.\n ` pointer-events: none;` +\n ` color: ${colors.foreground.css};` +\n ` font-family: ${this._optionsService.rawOptions.fontFamily};` +\n ` font-size: ${this._optionsService.rawOptions.fontSize}px;` +\n ` font-kerning: none;` +\n ` white-space: pre` +\n `}`;\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .xterm-dim {` +\n ` color: ${color.multiplyOpacity(colors.foreground, 0.5).css};` +\n `}`;\n // Text styles\n styles +=\n `${this._terminalSelector} span:not(.${RowCss.BOLD_CLASS}) {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeight};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.BOLD_CLASS} {` +\n ` font-weight: ${this._optionsService.rawOptions.fontWeightBold};` +\n `}` +\n `${this._terminalSelector} span.${RowCss.ITALIC_CLASS} {` +\n ` font-style: italic;` +\n `}`;\n // Blink animation\n const blinkAnimationUnderlineId = `blink_underline_${this._terminalClass}`;\n const blinkAnimationBarId = `blink_bar_${this._terminalClass}`;\n const blinkAnimationBlockId = `blink_block_${this._terminalClass}`;\n styles +=\n `@keyframes ${blinkAnimationUnderlineId} {` +\n ` 50% {` +\n ` border-bottom-style: hidden;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBarId} {` +\n ` 50% {` +\n ` box-shadow: none;` +\n ` }` +\n `}`;\n styles +=\n `@keyframes ${blinkAnimationBlockId} {` +\n ` 0% {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n ` }` +\n ` 50% {` +\n ` background-color: inherit;` +\n ` color: ${colors.cursor.css};` +\n ` }` +\n `}`;\n // Cursor\n styles +=\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` animation: ${blinkAnimationUnderlineId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` animation: ${blinkAnimationBarId} 1s step-end infinite;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${FOCUS_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` animation: ${blinkAnimationBlockId} 1s step-end infinite;` +\n `}` +\n // Disable cursor blinking when idle\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS}.${CURSOR_BLINK_IDLE_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_BLINK_CLASS} {` +\n ` animation: none !important;` +\n `}` +\n // !important helps fix an issue where the cursor will not render on top of the selection,\n // however it's very hard to fix this issue and retain the blink animation without the use of\n // !important. So this edge case fails when cursor blink is on.\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS} {` +\n ` background-color: ${colors.cursor.css};` +\n ` color: ${colors.cursorAccent.css};` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BLOCK_CLASS}:not(.${RowCss.CURSOR_BLINK_CLASS}) {` +\n ` background-color: ${colors.cursor.css} !important;` +\n ` color: ${colors.cursorAccent.css} !important;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_OUTLINE_CLASS} {` +\n ` outline: 1px solid ${colors.cursor.css};` +\n ` outline-offset: -1px;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_BAR_CLASS} {` +\n ` box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${colors.cursor.css} inset;` +\n `}` +\n `${this._terminalSelector} .${ROW_CONTAINER_CLASS} .${RowCss.CURSOR_CLASS}.${RowCss.CURSOR_STYLE_UNDERLINE_CLASS} {` +\n ` border-bottom: 1px ${colors.cursor.css};` +\n ` border-bottom-style: solid;` +\n ` height: calc(100% - 1px);` +\n `}`;\n // Selection\n styles +=\n `${this._terminalSelector} .${SELECTION_CLASS} {` +\n ` position: absolute;` +\n ` top: 0;` +\n ` left: 0;` +\n ` z-index: 1;` +\n ` pointer-events: none;` +\n `}` +\n `${this._terminalSelector}.focus .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionBackgroundOpaque.css};` +\n `}` +\n `${this._terminalSelector} .${SELECTION_CLASS} div {` +\n ` position: absolute;` +\n ` background-color: ${colors.selectionInactiveBackgroundOpaque.css};` +\n `}`;\n // Colors\n for (const [i, c] of colors.ansi.entries()) {\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i} { color: ${c.css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${i}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(c, 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${i} { background-color: ${c.css}; }`;\n }\n styles +=\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { color: ${color.opaque(colors.background).css}; }` +\n `${this._terminalSelector} .${FG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR}.${RowCss.DIM_CLASS} { color: ${color.multiplyOpacity(color.opaque(colors.background), 0.5).css}; }` +\n `${this._terminalSelector} .${BG_CLASS_PREFIX}${INVERTED_DEFAULT_COLOR} { background-color: ${colors.foreground.css}; }`;\n\n this._themeStyleElement.textContent = styles;\n }\n\n /**\n * default letter spacing\n * Due to rounding issues in dimensions dpr calc glyph might render\n * slightly too wide or too narrow. The method corrects the stacking offsets\n * by applying a default letter-spacing for all chars.\n * The value gets passed to the row factory to avoid setting this value again\n * (render speedup is roughly 10%).\n */\n private _setDefaultSpacing(): void {\n // measure same char as in CharSizeService to get the base deviation\n const spacing = this.dimensions.css.cell.width - this._widthCache.get('W', false, false);\n this._rowContainer.style.letterSpacing = `${spacing}px`;\n this._rowFactory.defaultSpacing = spacing;\n }\n\n public handleDevicePixelRatioChange(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n private _refreshRowElements(cols: number, rows: number): void {\n // Add missing elements\n for (let i = this._rowElements.length; i <= rows; i++) {\n const row = this._document.createElement('div');\n this._rowContainer.appendChild(row);\n this._rowElements.push(row);\n }\n // Remove excess elements\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n }\n\n public handleResize(cols: number, rows: number): void {\n this._refreshRowElements(cols, rows);\n this._updateDimensions();\n this.handleSelectionChanged(this._selectionRenderModel.selectionStart, this._selectionRenderModel.selectionEnd, this._selectionRenderModel.columnSelectMode);\n }\n\n public handleCharSizeChanged(): void {\n this._updateDimensions();\n this._widthCache.clear();\n this._setDefaultSpacing();\n }\n\n public handleBlur(): void {\n this._rowContainer.classList.remove(FOCUS_CLASS);\n this._cursorBlinkStateManager.pause();\n this._requestRedraw(0, this._bufferService.rows - 1);\n }\n\n public handleFocus(): void {\n this._rowContainer.classList.add(FOCUS_CLASS);\n this._cursorBlinkStateManager.resume();\n this._requestRedraw(this._bufferService.buffer.y, this._bufferService.buffer.y);\n }\n\n /** Keep row drawing under RenderService's pause and synchronized-output gates. */\n private _requestRedraw(start: number, end: number): void {\n this._onRequestRedraw.fire({ start, end });\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n // Remove all selections\n this._selectionContainer.replaceChildren();\n this._rowFactory.handleSelectionChanged(start, end, columnSelectMode);\n this._requestRedraw(0, this._bufferService.rows - 1);\n\n // Selection does not exist\n if (!start || !end) {\n return;\n }\n\n this._selectionRenderModel.update(this._terminal, start, end, columnSelectMode);\n if (!this._selectionRenderModel.hasSelection) {\n return;\n }\n\n // Translate from buffer position to viewport position\n const viewportStartRow = this._selectionRenderModel.viewportStartRow;\n const viewportEndRow = this._selectionRenderModel.viewportEndRow;\n const viewportCappedStartRow = this._selectionRenderModel.viewportCappedStartRow;\n const viewportCappedEndRow = this._selectionRenderModel.viewportCappedEndRow;\n\n // Create the selections\n const documentFragment = this._document.createDocumentFragment();\n\n if (columnSelectMode) {\n const isXFlipped = start[0] > end[0];\n documentFragment.appendChild(\n this._createSelectionElement(viewportCappedStartRow, isXFlipped ? end[0] : start[0], isXFlipped ? start[0] : end[0], viewportCappedEndRow - viewportCappedStartRow + 1)\n );\n } else {\n // Draw first row\n const startCol = viewportStartRow === viewportCappedStartRow ? start[0] : 0;\n const endCol = viewportCappedStartRow === viewportEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow, startCol, endCol));\n // Draw middle rows\n const middleRowsCount = viewportCappedEndRow - viewportCappedStartRow - 1;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedStartRow + 1, 0, this._bufferService.cols, middleRowsCount));\n // Draw final row\n if (viewportCappedStartRow !== viewportCappedEndRow) {\n // Only draw viewportEndRow if it's not the same as viewporttartRow\n const endCol = viewportEndRow === viewportCappedEndRow ? end[0] : this._bufferService.cols;\n documentFragment.appendChild(this._createSelectionElement(viewportCappedEndRow, 0, endCol));\n }\n }\n this._selectionContainer.appendChild(documentFragment);\n }\n\n /**\n * Creates a selection element at the specified position.\n * @param row The row of the selection.\n * @param colStart The start column.\n * @param colEnd The end columns.\n */\n private _createSelectionElement(row: number, colStart: number, colEnd: number, rowCount: number = 1): HTMLElement {\n const element = this._document.createElement('div');\n const left = colStart * this.dimensions.css.cell.width;\n let width = this.dimensions.css.cell.width * (colEnd - colStart);\n if (left + width > this.dimensions.css.canvas.width) {\n width = this.dimensions.css.canvas.width - left;\n }\n\n element.style.height = `${rowCount * this.dimensions.css.cell.height}px`;\n element.style.top = `${row * this.dimensions.css.cell.height}px`;\n element.style.left = `${left}px`;\n element.style.width = `${width}px`;\n return element;\n }\n\n public handleCursorMove(): void {\n // Reset idle timer on cursor movement (which happens on input)\n this._cursorBlinkStateManager.restartBlinkAnimation();\n }\n\n private _handleOptionsChanged(): void {\n // Force a refresh\n this._updateDimensions();\n // Refresh CSS\n this._injectCss(this._themeService.colors);\n // update spacing cache\n this._widthCache.setFont(\n this._optionsService.rawOptions.fontFamily,\n this._optionsService.rawOptions.fontSize,\n this._optionsService.rawOptions.fontWeight,\n this._optionsService.rawOptions.fontWeightBold\n );\n this._setDefaultSpacing();\n }\n\n public clear(): void {\n for (const e of this._rowElements) {\n /**\n * NOTE: This used to be `e.innerText = '';` but that doesn't work when using `jsdom` and\n * `@testing-library/react`\n *\n * references:\n * - https://github.com/testing-library/react-testing-library/issues/1146\n * - https://github.com/jsdom/jsdom/issues/1245\n */\n e.replaceChildren();\n }\n }\n\n public renderRows(start: number, end: number): void {\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, this._bufferService.cols - 1);\n const cursorBlink = this._coreService.decPrivateModes.cursorBlink ?? this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._coreService.decPrivateModes.cursorStyle ?? this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n for (let y = start; y <= end; y++) {\n const row = y + buffer.ydisp;\n const rowElement = this._rowElements[y];\n const lineData = buffer.lines.get(row);\n if (!rowElement || !lineData) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n lineData,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n -1,\n -1\n )\n );\n }\n }\n\n private get _terminalSelector(): string {\n return `.${TERMINAL_CLASS_PREFIX}${this._terminalClass}`;\n }\n\n private _handleLinkHover(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, true);\n }\n\n private _handleLinkLeave(e: ILinkifierEvent): void {\n this._setCellUnderline(e.x1, e.x2, e.y1, e.y2, e.cols, false);\n }\n\n private _setCellUnderline(x: number, x2: number, y: number, y2: number, cols: number, enabled: boolean): void {\n /**\n * NOTE: The linkifier may send out of viewport y-values if:\n * - negative y-value: the link started at a higher line\n * - y-value >= maxY: the link ends at a line below viewport\n *\n * For negative y-values we can simply adjust x = 0,\n * as higher up link start means, that everything from\n * (0,0) is a link under top-down-left-right char progression\n *\n * Additionally there might be a small chance of out-of-sync x|y-values\n * from a race condition of render updates vs. link event handler execution:\n * - (sync) resize: chances terminal buffer in sync, schedules render update async\n * - (async) link handler race condition: new buffer metrics, but still on old render state\n * - (async) render update: brings term metrics and render state back in sync\n */\n // clip coords into viewport\n if (y < 0) x = 0;\n if (y2 < 0) x2 = 0;\n const maxY = this._bufferService.rows - 1;\n y = Math.max(Math.min(y, maxY), 0);\n y2 = Math.max(Math.min(y2, maxY), 0);\n\n cols = Math.min(cols, this._bufferService.cols);\n const buffer = this._bufferService.buffer;\n const cursorAbsoluteY = buffer.ybase + buffer.y;\n const cursorX = Math.min(buffer.x, cols - 1);\n const cursorBlink = this._optionsService.rawOptions.cursorBlink;\n const cursorStyle = this._optionsService.rawOptions.cursorStyle;\n const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;\n\n // refresh rows within link range\n for (let i = y; i <= y2; ++i) {\n const row = i + buffer.ydisp;\n const rowElement = this._rowElements[i];\n const bufferline = buffer.lines.get(row);\n if (!rowElement || !bufferline) {\n break;\n }\n rowElement.replaceChildren(\n ...this._rowFactory.createRow(\n bufferline,\n row,\n row === cursorAbsoluteY,\n cursorStyle,\n cursorInactiveStyle,\n cursorX,\n cursorBlink,\n this.dimensions.css.cell.width,\n this._widthCache,\n enabled ? (i === y ? x : 0) : -1,\n enabled ? ((i === y2 ? x2 : cols) - 1) : -1\n )\n );\n }\n }\n}\n\nclass CursorBlinkStateManager {\n private _idleTimeout: number | undefined;\n private _isIdlePaused: boolean = false;\n\n constructor(\n private readonly _rowContainer: HTMLElement,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n if (this._coreBrowserService.isFocused) {\n this._resetIdleTimer();\n }\n }\n\n public dispose(): void {\n this._clearIdleTimer();\n }\n\n public restartBlinkAnimation(): void {\n if (this._isIdlePaused) {\n this._rowContainer.classList.remove(CURSOR_BLINK_IDLE_CLASS);\n }\n this._resetIdleTimer();\n }\n\n public pause(): void {\n this._isIdlePaused = false;\n this._clearIdleTimer();\n }\n\n public resume(): void {\n this._isIdlePaused = false;\n this._rowContainer.classList.remove(CURSOR_BLINK_IDLE_CLASS);\n this._resetIdleTimer();\n }\n\n private _resetIdleTimer(): void {\n this._isIdlePaused = false;\n this._clearIdleTimer();\n this._idleTimeout = this._coreBrowserService.window.setTimeout(() => {\n this._stopBlinkingDueToIdle();\n }, RendererConstants.CURSOR_BLINK_IDLE_TIMEOUT);\n }\n\n private _clearIdleTimer(): void {\n if (this._idleTimeout) {\n this._coreBrowserService.window.clearTimeout(this._idleTimeout);\n this._idleTimeout = undefined;\n }\n }\n\n private _stopBlinkingDueToIdle(): void {\n this._rowContainer.classList.add(CURSOR_BLINK_IDLE_CLASS);\n this._isIdlePaused = true;\n this._idleTimeout = undefined;\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOptionsService } from 'common/services/Services';\nimport { ICharSizeService } from 'browser/services/Services';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport class CharSizeService extends Disposable implements ICharSizeService {\n public serviceBrand: undefined;\n\n public width: number = 0;\n public height: number = 0;\n private _measureStrategy: IMeasureStrategy;\n\n public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }\n\n private readonly _onCharSizeChange = this._register(new Emitter());\n public readonly onCharSizeChange = this._onCharSizeChange.event;\n\n constructor(\n document: Document,\n parentElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n try {\n this._measureStrategy = this._register(new TextMetricsMeasureStrategy(this._optionsService));\n } catch {\n this._measureStrategy = this._register(new DomMeasureStrategy(document, parentElement, this._optionsService));\n }\n this._register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));\n }\n\n public measure(): void {\n const result = this._measureStrategy.measure();\n if (result.width !== this.width || result.height !== this.height) {\n this.width = result.width;\n this.height = result.height;\n this._onCharSizeChange.fire();\n }\n }\n}\n\ninterface IMeasureStrategy {\n measure(): Readonly;\n}\n\ninterface IMeasureResult {\n width: number;\n height: number;\n}\n\nconst enum DomMeasureStrategyConstants {\n REPEAT = 32\n}\n\nabstract class BaseMeasureStategy extends Disposable implements IMeasureStrategy {\n protected _result: IMeasureResult = { width: 0, height: 0 };\n\n protected _validateAndSet(width: number | undefined, height: number | undefined): void {\n // If values are 0 then the element is likely currently display:none, in which case we should\n // retain the previous value.\n if (width !== undefined && width > 0 && height !== undefined && height > 0) {\n this._result.width = width;\n this._result.height = height;\n }\n }\n\n public abstract measure(): Readonly;\n}\n\nclass DomMeasureStrategy extends BaseMeasureStategy {\n private _measureElement: HTMLElement;\n\n constructor(\n private _document: Document,\n private _parentElement: HTMLElement,\n private _optionsService: IOptionsService\n ) {\n super();\n this._measureElement = this._document.createElement('span');\n this._measureElement.classList.add('xterm-char-measure-element');\n this._measureElement.textContent = 'W'.repeat(DomMeasureStrategyConstants.REPEAT);\n this._measureElement.setAttribute('aria-hidden', 'true');\n this._measureElement.style.whiteSpace = 'pre';\n this._measureElement.style.fontKerning = 'none';\n this._parentElement.appendChild(this._measureElement);\n }\n\n public measure(): Readonly {\n this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily;\n this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;\n\n // Note that this triggers a synchronous layout\n this._validateAndSet(Number(this._measureElement.offsetWidth) / DomMeasureStrategyConstants.REPEAT, Number(this._measureElement.offsetHeight));\n\n return this._result;\n }\n}\n\nclass TextMetricsMeasureStrategy extends BaseMeasureStategy {\n private _canvas: OffscreenCanvas;\n private _ctx: OffscreenCanvasRenderingContext2D;\n\n constructor(\n private _optionsService: IOptionsService\n ) {\n super();\n // This will throw if any required API is not supported\n this._canvas = new OffscreenCanvas(100, 100);\n this._ctx = this._canvas.getContext('2d')!;\n const a = this._ctx.measureText('W');\n if (!('width' in a && 'fontBoundingBoxAscent' in a && 'fontBoundingBoxDescent' in a)) {\n throw new Error('Required font metrics not supported');\n }\n }\n\n public measure(): Readonly {\n this._ctx.font = `${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;\n const metrics = this._ctx.measureText('W');\n this._validateAndSet(metrics.width, metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent);\n return this._result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreBrowserService } from './Services';\nimport { Emitter, EventUtils } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\n\nexport class CoreBrowserService extends Disposable implements ICoreBrowserService {\n public serviceBrand: undefined;\n\n private _isFocused = false;\n private _cachedIsFocused: boolean | undefined = undefined;\n private _screenDprMonitor = this._register(new ScreenDprMonitor(this._window));\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n private readonly _onWindowChange = this._register(new Emitter());\n public readonly onWindowChange = this._onWindowChange.event;\n\n constructor(\n private _textarea: HTMLTextAreaElement,\n private _window: Window & typeof globalThis,\n public readonly mainDocument: Document\n ) {\n super();\n\n // Monitor device pixel ratio\n this._register(this.onWindowChange(w => this._screenDprMonitor.setWindow(w)));\n this._register(EventUtils.forward(this._screenDprMonitor.onDprChange, this._onDprChange));\n\n this._register(addDisposableListener(this._textarea, 'focus', () => this._isFocused = true));\n this._register(addDisposableListener(this._textarea, 'blur', () => this._isFocused = false));\n }\n\n public get window(): Window & typeof globalThis {\n return this._window;\n }\n\n public set window(value: Window & typeof globalThis) {\n if (this._window !== value) {\n this._window = value;\n this._onWindowChange.fire(this._window);\n }\n }\n\n public get dpr(): number {\n return this.window.devicePixelRatio;\n }\n\n public get isFocused(): boolean {\n if (this._cachedIsFocused === undefined) {\n this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus();\n queueMicrotask(() => this._cachedIsFocused = undefined);\n }\n return this._cachedIsFocused;\n }\n}\n\n\n/**\n * The screen device pixel ratio monitor allows listening for when the\n * window.devicePixelRatio value changes. This is done not with polling but with\n * the use of window.matchMedia to watch media queries. When the event fires,\n * the listener will be reattached using a different media query to ensure that\n * any further changes will _register.\n *\n * The listener should fire on both window zoom changes and switching to a\n * monitor with a different DPI.\n */\nclass ScreenDprMonitor extends Disposable {\n private _currentDevicePixelRatio: number;\n private _outerListener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | undefined;\n private _resolutionMediaMatchList: MediaQueryList | undefined;\n private _windowResizeListener = this._register(new MutableDisposable());\n\n private readonly _onDprChange = this._register(new Emitter());\n public readonly onDprChange = this._onDprChange.event;\n\n constructor(private _parentWindow: Window) {\n super();\n\n // Initialize listener and dpr value\n this._outerListener = () => this._setDprAndFireIfDiffers();\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._updateDpr();\n\n // Monitor active window resize\n this._setWindowResizeListener();\n\n // Setup additional disposables\n this._register(toDisposable(() => this.clearListener()));\n }\n\n\n public setWindow(parentWindow: Window): void {\n this._parentWindow = parentWindow;\n this._setWindowResizeListener();\n this._setDprAndFireIfDiffers();\n }\n\n private _setWindowResizeListener(): void {\n this._windowResizeListener.value = addDisposableListener(this._parentWindow, 'resize', () => this._setDprAndFireIfDiffers());\n }\n\n private _setDprAndFireIfDiffers(): void {\n if (this._parentWindow.devicePixelRatio !== this._currentDevicePixelRatio) {\n this._onDprChange.fire(this._parentWindow.devicePixelRatio);\n }\n this._updateDpr();\n }\n\n private _updateDpr(): void {\n if (!this._outerListener) {\n return;\n }\n\n // Clear listeners for old DPR\n this._resolutionMediaMatchList?.removeListener(this._outerListener);\n\n // Add listeners for new DPR\n this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio;\n this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`);\n this._resolutionMediaMatchList.addListener(this._outerListener);\n }\n\n public clearListener(): void {\n if (!this._resolutionMediaMatchList || !this._outerListener) {\n return;\n }\n this._resolutionMediaMatchList.removeListener(this._outerListener);\n this._resolutionMediaMatchList = undefined;\n this._outerListener = undefined;\n }\n}\n", "import { ILinkProvider, ILinkProviderService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\n\nexport class LinkProviderService extends Disposable implements ILinkProviderService {\n declare public serviceBrand: undefined;\n\n public readonly linkProviders: ILinkProvider[] = [];\n\n constructor() {\n super();\n this._register(toDisposable(() => this.linkProviders.length = 0));\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n this.linkProviders.push(linkProvider);\n return {\n dispose: () => {\n // Remove the link provider from the list\n const providerIndex = this.linkProviders.indexOf(linkProvider);\n\n if (providerIndex !== -1) {\n this.linkProviders.splice(providerIndex, 1);\n }\n }\n };\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport function getCoordsRelativeToElement(window: Pick, event: {clientX: number, clientY: number}, element: HTMLElement): [number, number] {\n const rect = element.getBoundingClientRect();\n const elementStyle = window.getComputedStyle(element);\n const leftPadding = parseInt(elementStyle.getPropertyValue('padding-left'));\n const topPadding = parseInt(elementStyle.getPropertyValue('padding-top'));\n return [\n event.clientX - rect.left - leftPadding,\n event.clientY - rect.top - topPadding\n ];\n}\n\n/**\n * Gets coordinates within the terminal for a particular mouse event. The result\n * is returned as an array in the form [x, y] instead of an object as it's a\n * little faster and this function is used in some low level code.\n * @param window The window object the element belongs to.\n * @param event The mouse event.\n * @param element The terminal's container element.\n * @param colCount The number of columns in the terminal.\n * @param rowCount The number of rows n the terminal.\n * @param hasValidCharSize Whether there is a valid character size available.\n * @param cssCellWidth The cell width device pixel render dimensions.\n * @param cssCellHeight The cell height device pixel render dimensions.\n * @param isSelection Whether the request is for the selection or not. This will\n * apply an offset to the x value such that the left half of the cell will\n * select that cell and the right half will select the next cell.\n */\nexport function getCoords(window: Pick, event: Pick, element: HTMLElement, colCount: number, rowCount: number, hasValidCharSize: boolean, cssCellWidth: number, cssCellHeight: number, isSelection?: boolean): [number, number] | undefined {\n // Coordinates cannot be measured if there are no valid\n if (!hasValidCharSize) {\n return undefined;\n }\n\n const coords = getCoordsRelativeToElement(window, event, element);\n if (!coords) {\n return undefined;\n }\n\n coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);\n coords[1] = Math.ceil(coords[1] / cssCellHeight);\n\n // Ensure coordinates are within the terminal viewport. Note that selections\n // need an addition point of precision to cover the end point (as characters\n // cover half of one char and half of the next).\n coords[0] = Math.min(Math.max(coords[0], 1), colCount + (isSelection ? 1 : 0));\n coords[1] = Math.min(Math.max(coords[1], 1), rowCount);\n\n return coords;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { getWindow } from 'vs/base/browser/dom';\nimport { ICharSizeService, IRenderService, IMouseService } from './Services';\nimport { getCoords, getCoordsRelativeToElement } from 'browser/input/Mouse';\n\nexport class MouseService implements IMouseService {\n public serviceBrand: undefined;\n\n constructor(\n @IRenderService private readonly _renderService: IRenderService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService\n ) {\n }\n\n public getCoords(event: {clientX: number, clientY: number}, element: HTMLElement, colCount: number, rowCount: number, isSelection?: boolean): [number, number] | undefined {\n return getCoords(\n window,\n event,\n element,\n colCount,\n rowCount,\n this._charSizeService.hasValidSize,\n this._renderService.dimensions.css.cell.width,\n this._renderService.dimensions.css.cell.height,\n isSelection\n );\n }\n\n public getMouseReportCoords(event: MouseEvent, element: HTMLElement): { col: number, row: number, x: number, y: number } | undefined {\n const coords = getCoordsRelativeToElement(getWindow(element), event, element);\n if (!this._charSizeService.hasValidSize) {\n return undefined;\n }\n coords[0] = Math.min(Math.max(coords[0], 0), this._renderService.dimensions.css.canvas.width - 1);\n coords[1] = Math.min(Math.max(coords[1], 0), this._renderService.dimensions.css.canvas.height - 1);\n return {\n col: Math.floor(coords[0] / this._renderService.dimensions.css.cell.width),\n row: Math.floor(coords[1] / this._renderService.dimensions.css.cell.height),\n x: Math.floor(coords[0]),\n y: Math.floor(coords[1])\n };\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { ICoreBrowserService } from 'browser/services/Services';\n\n/**\n * Debounces calls to render terminal rows using animation frames.\n */\nexport class RenderDebouncer implements IRenderDebouncerWithCallback {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n private _animationFrame: number | undefined;\n private _refreshCallbacks: FrameRequestCallback[] = [];\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _coreBrowserService: ICoreBrowserService\n ) {\n }\n\n public dispose(): void {\n if (this._animationFrame) {\n this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);\n this._animationFrame = undefined;\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n this._refreshCallbacks.push(callback);\n if (!this._animationFrame) {\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n return this._animationFrame;\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart ?? 0;\n rowEnd = rowEnd ?? this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n if (this._animationFrame) {\n return;\n }\n\n this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());\n }\n\n private _innerRefresh(): void {\n this._animationFrame = undefined;\n\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n this._runRefreshCallbacks();\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n this._runRefreshCallbacks();\n }\n\n private _runRefreshCallbacks(): void {\n for (const callback of this._refreshCallbacks) {\n callback(0);\n }\n this._refreshCallbacks = [];\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\ninterface INavigator {\n userAgent: string;\n language: string;\n platform: string;\n}\n\n// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but\n// we want this module to live in common.\ndeclare const navigator: INavigator;\ndeclare const process: unknown;\n\n// navigator.userAgent is also checked here because bundling with the process module can cause\n// issues otherwise. Note that navigator exists in Node.js 21+ but the userAgent is\n// \"Node.js/\".\nexport const isNode = (typeof process !== 'undefined' && 'title' in (process as any) && (typeof navigator === 'undefined' || navigator.userAgent.startsWith('Node.js/'))) ? true : false;\nconst userAgent = (isNode) ? 'node' : navigator.userAgent;\nconst platform = (isNode) ? 'node' : navigator.platform;\n\nexport const isFirefox = userAgent.includes('Firefox');\nexport const isLegacyEdge = userAgent.includes('Edge');\nexport const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);\nexport function getSafariVersion(): number {\n if (!isSafari) {\n return 0;\n }\n const majorVersion = userAgent.match(/Version\\/(\\d+)/);\n if (majorVersion === null || majorVersion.length < 2) {\n return 0;\n }\n return parseInt(majorVersion[1]);\n}\n\n// Find the users platform. We use this to interpret the meta key\n// and ISO third level shifts.\n// http://stackoverflow.com/q/19877924/577598\nexport const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);\nexport const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);\nexport const isLinux = platform.indexOf('Linux') >= 0;\n// Note that when this is true, isLinux will also be true.\nexport const isChromeOS = /\\bCrOS\\b/.test(userAgent);\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { isNode } from 'common/Platform';\n\ninterface ITaskQueue {\n /**\n * Adds a task to the queue which will run in a future idle callback.\n * To avoid perceivable stalls on the mainthread, tasks with heavy workload\n * should split their work into smaller pieces and return `true` to get\n * called again until the work is done (on falsy return value).\n */\n enqueue(task: () => boolean | void): void;\n\n /**\n * Flushes the queue, running all remaining tasks synchronously.\n */\n flush(): void;\n\n /**\n * Clears any remaining tasks from the queue, these will not be run.\n */\n clear(): void;\n}\n\ninterface ITaskDeadline {\n timeRemaining(): number;\n}\ntype CallbackWithDeadline = (deadline: ITaskDeadline) => void;\n\nabstract class TaskQueue implements ITaskQueue {\n private _tasks: (() => boolean | void)[] = [];\n private _idleCallback?: number;\n private _i = 0;\n\n protected abstract _requestCallback(callback: CallbackWithDeadline): number;\n protected abstract _cancelCallback(identifier: number): void;\n\n public enqueue(task: () => boolean | void): void {\n this._tasks.push(task);\n this._start();\n }\n\n public flush(): void {\n while (this._i < this._tasks.length) {\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n }\n this.clear();\n }\n\n public clear(): void {\n if (this._idleCallback) {\n this._cancelCallback(this._idleCallback);\n this._idleCallback = undefined;\n }\n this._i = 0;\n this._tasks.length = 0;\n }\n\n private _start(): void {\n if (!this._idleCallback) {\n this._idleCallback = this._requestCallback(this._process.bind(this));\n }\n }\n\n private _process(deadline: ITaskDeadline): void {\n this._idleCallback = undefined;\n let taskDuration = 0;\n let longestTask = 0;\n let lastDeadlineRemaining = deadline.timeRemaining();\n let deadlineRemaining = 0;\n while (this._i < this._tasks.length) {\n taskDuration = performance.now();\n if (!this._tasks[this._i]()) {\n this._i++;\n }\n // other than performance.now, performance.now might not be stable (changes on wall clock\n // changes), this is not an issue here as a clock change during a short running task is very\n // unlikely in case it still happened and leads to negative duration, simply assume 1 msec\n taskDuration = Math.max(1, performance.now() - taskDuration);\n longestTask = Math.max(taskDuration, longestTask);\n // Guess the following task will take a similar time to the longest task in this batch, allow\n // additional room to try avoid exceeding the deadline\n deadlineRemaining = deadline.timeRemaining();\n if (longestTask * 1.5 > deadlineRemaining) {\n // Warn when the time exceeding the deadline is over 20ms, if this happens in practice the\n // task should be split into sub-tasks to ensure the UI remains responsive.\n if (lastDeadlineRemaining - taskDuration < -20) {\n console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(lastDeadlineRemaining - taskDuration))}ms`);\n }\n this._start();\n return;\n }\n lastDeadlineRemaining = deadlineRemaining;\n }\n this.clear();\n }\n}\n\n/**\n * A queue of that runs tasks over several tasks via setTimeout, trying to maintain above 60 frames\n * per second. The tasks will run in the order they are enqueued, but they will run some time later,\n * and care should be taken to ensure they're non-urgent and will not introduce race conditions.\n */\nexport class PriorityTaskQueue extends TaskQueue {\n protected _requestCallback(callback: CallbackWithDeadline): number {\n return setTimeout(() => callback(this._createDeadline(16)));\n }\n\n protected _cancelCallback(identifier: number): void {\n clearTimeout(identifier);\n }\n\n private _createDeadline(duration: number): ITaskDeadline {\n const end = performance.now() + duration;\n return {\n timeRemaining: () => Math.max(0, end - performance.now())\n };\n }\n}\n\nclass IdleTaskQueueInternal extends TaskQueue {\n protected _requestCallback(callback: IdleRequestCallback): number {\n return requestIdleCallback(callback);\n }\n\n protected _cancelCallback(identifier: number): void {\n cancelIdleCallback(identifier);\n }\n}\n\n/**\n * A queue of that runs tasks over several idle callbacks, trying to respect the idle callback's\n * deadline given by the environment. The tasks will run in the order they are enqueued, but they\n * will run some time later, and care should be taken to ensure they're non-urgent and will not\n * introduce race conditions.\n *\n * This reverts to a {@link PriorityTaskQueue} if the environment does not support idle callbacks.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdleTaskQueue = (!isNode && 'requestIdleCallback' in window) ? IdleTaskQueueInternal : PriorityTaskQueue;\n\n/**\n * An object that tracks a single debounced task that will run on the next idle frame. When called\n * multiple times, only the last set task will run.\n */\nexport class DebouncedIdleTask {\n private _queue: ITaskQueue;\n\n constructor() {\n this._queue = new IdleTaskQueue();\n }\n\n public set(task: () => boolean | void): void {\n this._queue.clear();\n this._queue.enqueue(task);\n }\n\n public flush(): void {\n this._queue.flush();\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { RenderDebouncer } from 'browser/RenderDebouncer';\nimport { IRenderDebouncerWithCallback } from 'browser/Types';\nimport { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';\nimport { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\nimport { DebouncedIdleTask } from 'common/TaskQueue';\nimport { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\ninterface ISelectionState {\n start: [number, number] | undefined;\n end: [number, number] | undefined;\n columnSelectMode: boolean;\n}\n\nconst enum Constants {\n SYNCHRONIZED_OUTPUT_TIMEOUT_MS = 1000\n}\n\nexport class RenderService extends Disposable implements IRenderService {\n public serviceBrand: undefined;\n\n private _renderer: MutableDisposable = this._register(new MutableDisposable());\n private _renderDebouncer: IRenderDebouncerWithCallback;\n private _pausedResizeTask = new DebouncedIdleTask();\n private _observerDisposable = this._register(new MutableDisposable());\n\n private _isPaused: boolean = false;\n private _needsFullRefresh: boolean = false;\n private _isNextRenderRedrawOnly: boolean = true;\n private _needsSelectionRefresh: boolean = false;\n private _canvasWidth: number = 0;\n private _canvasHeight: number = 0;\n private _syncOutputHandler: SynchronizedOutputHandler;\n private _selectionState: ISelectionState = {\n start: undefined,\n end: undefined,\n columnSelectMode: false\n };\n\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n private readonly _onRenderedViewportChange = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;\n private readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onRefreshRequest = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRefreshRequest = this._onRefreshRequest.event;\n\n public get dimensions(): IRenderDimensions { return this._renderer.value!.dimensions; }\n\n constructor(\n private _rowCount: number,\n screenElement: HTMLElement,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @ICharSizeService private readonly _charSizeService: ICharSizeService,\n @ICoreService private readonly _coreService: ICoreService,\n @IDecorationService decorationService: IDecorationService,\n @IBufferService bufferService: IBufferService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IThemeService themeService: IThemeService\n ) {\n super();\n\n this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end), this._coreBrowserService);\n this._register(this._renderDebouncer);\n\n this._syncOutputHandler = new SynchronizedOutputHandler(\n this._coreBrowserService,\n this._coreService,\n () => this._fullRefresh()\n );\n this._register(toDisposable(() => this._syncOutputHandler.dispose()));\n\n this._register(this._coreBrowserService.onDprChange(() => this.handleDevicePixelRatioChange()));\n\n this._register(bufferService.onResize(() => this._fullRefresh()));\n this._register(bufferService.buffers.onBufferActivate(() => this._renderer.value?.clear()));\n this._register(this._optionsService.onOptionChange(() => this._handleOptionsChanged()));\n this._register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged()));\n\n // Do a full refresh whenever any decoration is added or removed. This may not actually result\n // in changes but since decorations should be used sparingly or added/removed all in the same\n // frame this should have minimal performance impact.\n this._register(decorationService.onDecorationRegistered(() => this._fullRefresh()));\n this._register(decorationService.onDecorationRemoved(() => this._fullRefresh()));\n\n // Clear the renderer when the a change that could affect glyphs occurs\n this._register(this._optionsService.onMultipleOptionChange([\n 'drawBoldTextInBrightColors',\n 'letterSpacing',\n 'lineHeight',\n 'fontFamily',\n 'fontSize',\n 'fontWeight',\n 'fontWeightBold',\n 'minimumContrastRatio',\n 'rescaleOverlappingGlyphs'\n ], () => {\n this.clear();\n this.handleResize(bufferService.cols, bufferService.rows);\n this._fullRefresh();\n }));\n\n // Refresh the cursor line when the cursor changes\n this._register(this._optionsService.onMultipleOptionChange([\n 'cursorBlink',\n 'cursorStyle'\n ], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, undefined, true)));\n\n this._register(themeService.onChangeColors(() => this._fullRefresh()));\n\n this._registerIntersectionObserver(this._coreBrowserService.window, screenElement);\n this._register(this._coreBrowserService.onWindowChange((w) => this._registerIntersectionObserver(w, screenElement)));\n }\n\n private _registerIntersectionObserver(w: Window & typeof globalThis, screenElement: HTMLElement): void {\n // Detect whether IntersectionObserver is detected and enable renderer pause\n // and resume based on terminal visibility if so\n if ('IntersectionObserver' in w) {\n const observer = new w.IntersectionObserver(e => this._handleIntersectionChange(e[e.length - 1]), { threshold: 0 });\n observer.observe(screenElement);\n this._observerDisposable.value = toDisposable(() => observer.disconnect());\n }\n }\n\n private _handleIntersectionChange(entry: IntersectionObserverEntry): void {\n this._isPaused = entry.isIntersecting === undefined ? (entry.intersectionRatio === 0) : !entry.isIntersecting;\n\n // Terminal was hidden on open\n if (!this._isPaused && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n\n if (!this._isPaused && this._needsFullRefresh) {\n this._pausedResizeTask.flush();\n this.refreshRows(0, this._rowCount - 1);\n this._needsFullRefresh = false;\n }\n }\n\n public refreshRows(start: number, end: number, sync: boolean = false, isRedrawOnly: boolean = false): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n\n if (this._coreService.decPrivateModes.synchronizedOutput) {\n this._syncOutputHandler.bufferRows(start, end);\n return;\n }\n\n const buffered = this._syncOutputHandler.flush();\n if (buffered) {\n start = Math.min(start, buffered.start);\n end = Math.max(end, buffered.end);\n }\n\n if (!isRedrawOnly) {\n this._isNextRenderRedrawOnly = false;\n }\n\n if (sync) {\n this._renderRows(start, end);\n } else {\n this._renderDebouncer.refresh(start, end, this._rowCount);\n }\n }\n\n private _renderRows(start: number, end: number): void {\n if (!this._renderer.value) {\n return;\n }\n\n // A frame requested before the terminal was paused may still arrive.\n if (this._isPaused) {\n this._needsFullRefresh = true;\n return;\n }\n\n // Skip rendering if synchronized output mode is enabled. This check must happen here\n // (in addition to refreshRows) to handle renders that were queued before the mode was enabled.\n if (this._coreService.decPrivateModes.synchronizedOutput) {\n this._syncOutputHandler.bufferRows(start, end);\n return;\n }\n\n // Since this is debounced, a resize event could have happened between the time a refresh was\n // requested and when this triggers. Clamp the values of start and end to ensure they're valid\n // given the current viewport state.\n start = Math.min(start, this._rowCount - 1);\n end = Math.min(end, this._rowCount - 1);\n\n // Render\n this._renderer.value.renderRows(start, end);\n\n // Update selection if needed\n if (this._needsSelectionRefresh) {\n // The renderer may request another redraw while replaying the selection.\n this._needsSelectionRefresh = false;\n this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode);\n }\n\n // Fire render event only if it was not a redraw\n if (!this._isNextRenderRedrawOnly) {\n this._onRenderedViewportChange.fire({ start, end });\n }\n this._onRender.fire({ start, end });\n this._isNextRenderRedrawOnly = true;\n }\n\n public resize(cols: number, rows: number): void {\n this._rowCount = rows;\n this._fireOnCanvasResize();\n }\n\n private _handleOptionsChanged(): void {\n if (!this._renderer.value) {\n return;\n }\n this.refreshRows(0, this._rowCount - 1);\n this._fireOnCanvasResize();\n }\n\n private _fireOnCanvasResize(): void {\n if (!this._renderer.value) {\n return;\n }\n // Don't fire the event if the dimensions haven't changed\n if (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight) {\n return;\n }\n this._onDimensionsChange.fire(this._renderer.value.dimensions);\n }\n\n public hasRenderer(): boolean {\n return !!this._renderer.value;\n }\n\n public setRenderer(renderer: IRenderer): void {\n this._renderer.value = renderer;\n // If the value was not set, the terminal is being disposed so ignore it\n if (this._renderer.value) {\n this._renderer.value.onRequestRedraw(e => this.refreshRows(e.start, e.end, e.sync, true));\n\n // Force a refresh\n this._needsSelectionRefresh = true;\n this._fullRefresh();\n }\n }\n\n public addRefreshCallback(callback: FrameRequestCallback): number {\n return this._renderDebouncer.addRefreshCallback(callback);\n }\n\n private _fullRefresh(): void {\n if (this._isPaused) {\n this._needsFullRefresh = true;\n } else {\n this.refreshRows(0, this._rowCount - 1);\n }\n }\n\n public clearTextureAtlas(): void {\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.clearTextureAtlas?.();\n this._fullRefresh();\n }\n\n public handleDevicePixelRatioChange(): void {\n // Force char size measurement as DomMeasureStrategy(getBoundingClientRect) is not stable\n // when devicePixelRatio changes\n this._charSizeService.measure();\n\n if (!this._renderer.value) {\n return;\n }\n this._renderer.value.handleDevicePixelRatioChange();\n this.refreshRows(0, this._rowCount - 1);\n }\n\n public handleResize(cols: number, rows: number): void {\n if (!this._renderer.value) {\n return;\n }\n if (this._isPaused) {\n this._pausedResizeTask.set(() => this._renderer.value?.handleResize(cols, rows));\n } else {\n this._renderer.value.handleResize(cols, rows);\n }\n this._fullRefresh();\n }\n\n // TODO: Is this useful when we have onResize?\n public handleCharSizeChanged(): void {\n this._renderer.value?.handleCharSizeChanged();\n }\n\n public handleBlur(): void {\n this._renderer.value?.handleBlur();\n }\n\n public handleFocus(): void {\n this._renderer.value?.handleFocus();\n }\n\n public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {\n this._selectionState.start = start;\n this._selectionState.end = end;\n this._selectionState.columnSelectMode = columnSelectMode;\n this._renderer.value?.handleSelectionChanged(start, end, columnSelectMode);\n }\n\n public handleCursorMove(): void {\n this._renderer.value?.handleCursorMove();\n }\n\n public clear(): void {\n this._renderer.value?.clear();\n }\n}\n\n/**\n * Buffers row refresh requests during synchronized output mode (DEC mode 2026).\n * When the mode is disabled, the accumulated row range is flushed for rendering.\n * A safety timeout ensures rendering occurs even if the end sequence is not received.\n */\nclass SynchronizedOutputHandler {\n private _start: number = 0;\n private _end: number = 0;\n private _timeout: number | undefined;\n private _isBuffering: boolean = false;\n\n constructor(\n private readonly _coreBrowserService: ICoreBrowserService,\n private readonly _coreService: ICoreService,\n private readonly _onTimeout: () => void\n ) {}\n\n public bufferRows(start: number, end: number): void {\n if (!this._isBuffering) {\n this._start = start;\n this._end = end;\n this._isBuffering = true;\n } else {\n this._start = Math.min(this._start, start);\n this._end = Math.max(this._end, end);\n }\n\n this._timeout ??= this._coreBrowserService.window.setTimeout(() => {\n this._timeout = undefined;\n this._coreService.decPrivateModes.synchronizedOutput = false;\n this._onTimeout();\n }, Constants.SYNCHRONIZED_OUTPUT_TIMEOUT_MS);\n }\n\n public flush(): { start: number, end: number } | undefined {\n if (this._timeout !== undefined) {\n this._coreBrowserService.window.clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n if (!this._isBuffering) {\n return undefined;\n }\n\n const result = { start: this._start, end: this._end };\n this._isBuffering = false;\n return result;\n }\n\n public dispose(): void {\n if (this._timeout !== undefined) {\n this._coreBrowserService.window.clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { C0 } from 'common/data/EscapeSequences';\nimport { IBufferService } from 'common/services/Services';\n\nconst enum Direction {\n UP = 'A',\n DOWN = 'B',\n RIGHT = 'C',\n LEFT = 'D'\n}\n\n/**\n * Concatenates all the arrow sequences together.\n * Resets the starting row to an unwrapped row, moves to the requested row,\n * then moves to requested col.\n */\nexport function moveToCellSequence(targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startX = bufferService.buffer.x;\n const startY = bufferService.buffer.y;\n\n // The alt buffer should try to navigate between rows\n if (!bufferService.buffer.hasScrollback) {\n return resetStartingRow(startX, startY, targetX, targetY, bufferService, applicationCursor) +\n moveToRequestedRow(startY, targetY, bufferService, applicationCursor) +\n moveToRequestedCol(startX, startY, targetX, targetY, bufferService, applicationCursor);\n }\n\n // Only move horizontally for the normal buffer\n let direction;\n if (startY === targetY) {\n direction = startX > targetX ? Direction.LEFT : Direction.RIGHT;\n return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));\n }\n direction = startY > targetY ? Direction.LEFT : Direction.RIGHT;\n const rowDifference = Math.abs(startY - targetY);\n const cellsToMove = colsFromRowEnd(startY > targetY ? targetX : startX, bufferService) +\n (rowDifference - 1) * bufferService.cols + 1 /* wrap around 1 row */ +\n colsFromRowBeginning(startY > targetY ? startX : targetX, bufferService);\n return repeat(cellsToMove, sequence(direction, applicationCursor));\n}\n\n/**\n * Find the number of cols from a row beginning to a col.\n */\nfunction colsFromRowBeginning(currX: number, bufferService: IBufferService): number {\n return currX - 1;\n}\n\n/**\n * Find the number of cols from a col to row end.\n */\nfunction colsFromRowEnd(currX: number, bufferService: IBufferService): number {\n return bufferService.cols - currX;\n}\n\n/**\n * If the initial position of the cursor is on a row that is wrapped, move the\n * cursor up to the first row that is not wrapped to have accurate vertical\n * positioning.\n */\nfunction resetStartingRow(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length === 0) {\n return '';\n }\n return repeat(bufferLine(\n startX, startY, startX,\n startY - wrappedRowsForRow(startY, bufferService), false, bufferService\n ).length, sequence(Direction.LEFT, applicationCursor));\n}\n\n/**\n * Using the reset starting and ending row, move to the requested row,\n * ignoring wrapped rows\n */\nfunction moveToRequestedRow(startY: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n const rowsToMove = Math.abs(startRow - endRow) - wrappedRowsCount(startY, targetY, bufferService);\n\n return repeat(rowsToMove, sequence(verticalDirection(startY, targetY), applicationCursor));\n}\n\n/**\n * Move to the requested col on the ending row\n */\nfunction moveToRequestedCol(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {\n let startRow;\n if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n const endRow = targetY;\n const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);\n\n return repeat(bufferLine(\n startX, startRow, targetX, endRow,\n direction === Direction.RIGHT, bufferService\n ).length, sequence(direction, applicationCursor));\n}\n\n/**\n * Utility functions\n */\n\n/**\n * Calculates the number of wrapped rows between the unwrapped starting and\n * ending rows. These rows need to ignored since the cursor skips over them.\n */\nfunction wrappedRowsCount(startY: number, targetY: number, bufferService: IBufferService): number {\n let wrappedRows = 0;\n const startRow = startY - wrappedRowsForRow(startY, bufferService);\n const endRow = targetY - wrappedRowsForRow(targetY, bufferService);\n\n for (let i = 0; i < Math.abs(startRow - endRow); i++) {\n const direction = verticalDirection(startY, targetY) === Direction.UP ? -1 : 1;\n const line = bufferService.buffer.lines.get(startRow + (direction * i));\n if (line?.isWrapped) {\n wrappedRows++;\n }\n }\n\n return wrappedRows;\n}\n\n/**\n * Calculates the number of wrapped rows that make up a given row.\n * @param currentRow The row to determine how many wrapped rows make it up\n */\nfunction wrappedRowsForRow(currentRow: number, bufferService: IBufferService): number {\n let rowCount = 0;\n let line = bufferService.buffer.lines.get(currentRow);\n let lineWraps = line?.isWrapped;\n\n while (lineWraps && currentRow >= 0 && currentRow < bufferService.rows) {\n rowCount++;\n line = bufferService.buffer.lines.get(--currentRow);\n lineWraps = line?.isWrapped;\n }\n\n return rowCount;\n}\n\n/**\n * Direction determiners\n */\n\n/**\n * Determines if the right or left arrow is needed\n */\nfunction horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {\n let startRow;\n if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {\n startRow = targetY - wrappedRowsForRow(targetY, bufferService);\n } else {\n startRow = startY;\n }\n\n if ((startX < targetX &&\n startRow <= targetY) || // down/right or same y/right\n (startX >= targetX &&\n startRow < targetY)) { // down/left or same y/left\n return Direction.RIGHT;\n }\n return Direction.LEFT;\n}\n\n/**\n * Determines if the up or down arrow is needed\n */\nfunction verticalDirection(startY: number, targetY: number): Direction {\n return startY > targetY ? Direction.UP : Direction.DOWN;\n}\n\n/**\n * Constructs the string of chars in the buffer from a starting row and col\n * to an ending row and col\n * @param startCol The starting column position\n * @param startRow The starting row position\n * @param endCol The ending column position\n * @param endRow The ending row position\n * @param forward Direction to move\n */\nfunction bufferLine(\n startCol: number,\n startRow: number,\n endCol: number,\n endRow: number,\n forward: boolean,\n bufferService: IBufferService\n): string {\n let currentCol = startCol;\n let currentRow = startRow;\n let bufferStr = '';\n\n while ((currentCol !== endCol || currentRow !== endRow) &&\n currentRow >= 0 &&\n currentRow < bufferService.buffer.lines.length) {\n currentCol += forward ? 1 : -1;\n\n if (forward && currentCol > bufferService.cols - 1) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n currentCol = 0;\n startCol = 0;\n currentRow++;\n } else if (!forward && currentCol < 0) {\n bufferStr += bufferService.buffer.translateBufferLineToString(\n currentRow, false, 0, startCol + 1\n );\n currentCol = bufferService.cols - 1;\n startCol = currentCol;\n currentRow--;\n }\n }\n\n return bufferStr + bufferService.buffer.translateBufferLineToString(\n currentRow, false, startCol, currentCol\n );\n}\n\n/**\n * Constructs the escape sequence for clicking an arrow\n * @param direction The direction to move\n */\nfunction sequence(direction: Direction, applicationCursor: boolean): string {\n const mod = applicationCursor ? 'O' : '[';\n return C0.ESC + mod + direction;\n}\n\n/**\n * Returns a string repeated a given number of times\n * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat\n * @param count The number of times to repeat the string\n * @param str The string that is to be repeated\n */\nfunction repeat(count: number, str: string): string {\n count = Math.floor(count);\n let rpt = '';\n for (let i = 0; i < count; i++) {\n rpt += str;\n }\n return rpt;\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferService } from 'common/services/Services';\n\n/**\n * Represents a selection within the buffer. This model only cares about column\n * and row coordinates, not wide characters.\n */\nexport class SelectionModel {\n /**\n * Whether select all is currently active.\n */\n public isSelectAllActive: boolean = false;\n\n /**\n * The minimal length of the selection from the start position. When double\n * clicking on a word, the word will be selected which makes the selection\n * start at the start of the word and makes this variable the length.\n */\n public selectionStartLength: number = 0;\n\n /**\n * The [x, y] position the selection starts at.\n */\n public selectionStart: [number, number] | undefined;\n\n /**\n * The [x, y] position the selection ends at.\n */\n public selectionEnd: [number, number] | undefined;\n\n constructor(\n private _bufferService: IBufferService\n ) {\n }\n\n /**\n * Clears the current selection.\n */\n public clearSelection(): void {\n this.selectionStart = undefined;\n this.selectionEnd = undefined;\n this.isSelectAllActive = false;\n this.selectionStartLength = 0;\n }\n\n /**\n * The final selection start, taking into consideration select all.\n */\n public get finalSelectionStart(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [0, 0];\n }\n\n if (!this.selectionEnd || !this.selectionStart) {\n return this.selectionStart;\n }\n\n return this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;\n }\n\n /**\n * The final selection end, taking into consideration select all, double click\n * word selection and triple click line selection.\n */\n public get finalSelectionEnd(): [number, number] | undefined {\n if (this.isSelectAllActive) {\n return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];\n }\n\n if (!this.selectionStart) {\n return undefined;\n }\n\n // Use the selection start + length if the end doesn't exist or they're reversed\n if (!this.selectionEnd || this.areSelectionValuesReversed()) {\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n // Ensure the trailing EOL isn't included when the selection ends on the right edge\n if (startPlusLength % this._bufferService.cols === 0) {\n return [this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols) - 1];\n }\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [startPlusLength, this.selectionStart[1]];\n }\n\n // Ensure the the word/line is selected after a double/triple click\n if (this.selectionStartLength) {\n // Select the larger of the two when start and end are on the same line\n if (this.selectionEnd[1] === this.selectionStart[1]) {\n // Keep the whole wrapped word/line selected if the content wraps multiple lines\n const startPlusLength = this.selectionStart[0] + this.selectionStartLength;\n if (startPlusLength > this._bufferService.cols) {\n return [startPlusLength % this._bufferService.cols, this.selectionStart[1] + Math.floor(startPlusLength / this._bufferService.cols)];\n }\n return [Math.max(startPlusLength, this.selectionEnd[0]), this.selectionEnd[1]];\n }\n }\n return this.selectionEnd;\n }\n\n /**\n * Returns whether the selection start and end are reversed.\n */\n public areSelectionValuesReversed(): boolean {\n const start = this.selectionStart;\n const end = this.selectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[1] > end[1] || (start[1] === end[1] && start[0] > end[0]);\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n * @returns Whether a refresh is necessary.\n */\n public handleTrim(amount: number): boolean {\n // Adjust the selection position based on the trimmed amount.\n if (this.selectionStart) {\n this.selectionStart[1] -= amount;\n }\n if (this.selectionEnd) {\n this.selectionEnd[1] -= amount;\n }\n\n // The selection has moved off the buffer, clear it.\n if (this.selectionEnd && this.selectionEnd[1] < 0) {\n this.clearSelection();\n return true;\n }\n\n // If the selection start is trimmed, ensure the start column is 0.\n if (this.selectionStart && this.selectionStart[1] < 0) {\n this.selectionStart[1] = 0;\n }\n return false;\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange } from '@xterm/xterm';\n\nexport function getRangeLength(range: IBufferRange, bufferCols: number): number {\n if (range.start.y > range.end.y) {\n throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);\n }\n return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferRange, ILinkifier2 } from 'browser/Types';\nimport { getCoordsRelativeToElement } from 'browser/input/Mouse';\nimport { moveToCellSequence } from 'browser/input/MoveToCell';\nimport { SelectionModel } from 'browser/selection/SelectionModel';\nimport { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';\nimport { ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport * as Browser from 'common/Platform';\nimport { IBufferLine, IDisposable } from 'common/Types';\nimport { getRangeLength } from 'common/buffer/BufferRange';\nimport { CellData } from 'common/buffer/CellData';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\n/**\n * The number of pixels the mouse needs to be above or below the viewport in\n * order to scroll at the maximum speed.\n */\nconst DRAG_SCROLL_MAX_THRESHOLD = 50;\n\n/**\n * The maximum scrolling speed\n */\nconst DRAG_SCROLL_MAX_SPEED = 15;\n\n/**\n * The number of milliseconds between drag scroll updates.\n */\nconst DRAG_SCROLL_INTERVAL = 50;\n\n/**\n * The maximum amount of time that can have elapsed for an alt click to move the\n * cursor.\n */\nconst ALT_CLICK_MOVE_CURSOR_TIME = 500;\n\nconst NON_BREAKING_SPACE_CHAR = String.fromCharCode(160);\nconst ALL_NON_BREAKING_SPACE_REGEX = new RegExp(NON_BREAKING_SPACE_CHAR, 'g');\n\n/**\n * Represents a position of a word on a line.\n */\ninterface IWordPosition {\n start: number;\n length: number;\n}\n\n/**\n * A selection mode, this drives how the selection behaves on mouse move.\n */\nexport const enum SelectionMode {\n NORMAL,\n WORD,\n LINE,\n COLUMN\n}\n\n/**\n * A class that manages the selection of the terminal. With help from\n * SelectionModel, SelectionService handles with all logic associated with\n * dealing with the selection, including handling mouse interaction, wide\n * characters and fetching the actual text within the selection. Rendering is\n * not handled by the SelectionService but the onRedrawRequest event is fired\n * when the selection is ready to be redrawn (on an animation frame).\n */\nexport class SelectionService extends Disposable implements ISelectionService {\n public serviceBrand: undefined;\n\n protected _model: SelectionModel;\n\n /**\n * The amount to scroll every drag scroll update (depends on how far the mouse\n * drag is above or below the terminal).\n */\n private _dragScrollAmount: number = 0;\n\n /**\n * The current selection mode.\n */\n protected _activeSelectionMode: SelectionMode;\n\n /**\n * A setInterval timer that is active while the mouse is down whose callback\n * scrolls the viewport when necessary.\n */\n private _dragScrollIntervalTimer: number | undefined;\n\n /**\n * The animation frame ID used for refreshing the selection.\n */\n private _refreshAnimationFrame: number | undefined;\n\n /**\n * Whether selection is enabled.\n */\n private _enabled = true;\n\n private _mouseMoveListener: EventListener;\n private _mouseUpListener: EventListener;\n private _trimListener: IDisposable;\n private _workCell: CellData = new CellData();\n\n private _mouseDownTimeStamp: number = 0;\n private _oldHasSelection: boolean = false;\n private _oldSelectionStart: [number, number] | undefined = undefined;\n private _oldSelectionEnd: [number, number] | undefined = undefined;\n\n private readonly _onLinuxMouseSelection = this._register(new Emitter());\n public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;\n private readonly _onRedrawRequest = this._register(new Emitter());\n public readonly onRequestRedraw = this._onRedrawRequest.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onRequestScrollLines = this._register(new Emitter());\n public readonly onRequestScrollLines = this._onRequestScrollLines.event;\n\n constructor(\n private readonly _element: HTMLElement,\n private readonly _screenElement: HTMLElement,\n private readonly _linkifier: ILinkifier2,\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IMouseService private readonly _mouseService: IMouseService,\n @IOptionsService private readonly _optionsService: IOptionsService,\n @IRenderService private readonly _renderService: IRenderService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService\n ) {\n super();\n\n // Init listeners\n this._mouseMoveListener = event => this._handleMouseMove(event as MouseEvent);\n this._mouseUpListener = event => this._handleMouseUp(event as MouseEvent);\n this._coreService.onUserInput(() => {\n if (this.hasSelection) {\n this.clearSelection();\n }\n });\n this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._handleTrim(amount));\n this._register(this._bufferService.buffers.onBufferActivate(e => this._handleBufferActivate(e)));\n\n this.enable();\n\n this._model = new SelectionModel(this._bufferService);\n this._activeSelectionMode = SelectionMode.NORMAL;\n\n this._register(toDisposable(() => {\n this._removeMouseDownListeners();\n }));\n\n // Clear selection when resizing vertically. This experience could be improved, this is the\n // simple option to fix the buggy behavior. https://github.com/xtermjs/xterm.js/issues/5300\n this._register(this._bufferService.onResize(e => {\n if (e.rowsChanged) {\n this.clearSelection();\n }\n }));\n }\n\n public reset(): void {\n this.clearSelection();\n }\n\n /**\n * Disables the selection manager. This is useful for when terminal mouse\n * are enabled.\n */\n public disable(): void {\n this.clearSelection();\n this._enabled = false;\n }\n\n /**\n * Enable the selection manager.\n */\n public enable(): void {\n this._enabled = true;\n }\n\n public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }\n public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }\n\n /**\n * Gets whether there is an active text selection.\n */\n public get hasSelection(): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return start[0] !== end[0] || start[1] !== end[1];\n }\n\n /**\n * Gets the text currently selected.\n */\n public get selectionText(): string {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return '';\n }\n\n const buffer = this._bufferService.buffer;\n const result: string[] = [];\n\n if (this._activeSelectionMode === SelectionMode.COLUMN) {\n // Ignore zero width selections\n if (start[0] === end[0]) {\n return '';\n }\n\n // For column selection it's not enough to rely on final selection's swapping of reversed\n // values, it also needs the x coordinates to swap independently of the y coordinate is needed\n const startCol = start[0] < end[0] ? start[0] : end[0];\n const endCol = start[0] < end[0] ? end[0] : start[0];\n for (let i = start[1]; i <= end[1]; i++) {\n const lineText = buffer.translateBufferLineToString(i, true, startCol, endCol);\n result.push(lineText);\n }\n } else {\n // Get first row\n const startRowEndCol = start[1] === end[1] ? end[0] : undefined;\n result.push(buffer.translateBufferLineToString(start[1], true, start[0], startRowEndCol));\n\n // Get middle rows\n for (let i = start[1] + 1; i <= end[1] - 1; i++) {\n const bufferLine = buffer.lines.get(i);\n const lineText = buffer.translateBufferLineToString(i, true);\n if (bufferLine?.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n\n // Get final row\n if (start[1] !== end[1]) {\n const bufferLine = buffer.lines.get(end[1]);\n const lineText = buffer.translateBufferLineToString(end[1], true, 0, end[0]);\n if (bufferLine && bufferLine!.isWrapped) {\n result[result.length - 1] += lineText;\n } else {\n result.push(lineText);\n }\n }\n }\n\n // Format string by replacing non-breaking space chars with regular spaces\n // and joining the array into a multi-line string.\n const formattedResult = result.map(line => {\n return line.replace(ALL_NON_BREAKING_SPACE_REGEX, ' ');\n }).join(Browser.isWindows ? '\\r\\n' : '\\n');\n\n return formattedResult;\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Queues a refresh, redrawing the selection on the next opportunity.\n * @param isLinuxMouseSelection Whether the selection should be registered as a new\n * selection on Linux.\n */\n public refresh(isLinuxMouseSelection?: boolean): void {\n // Queue the refresh for the renderer\n if (!this._refreshAnimationFrame) {\n this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh());\n }\n\n // If the platform is Linux and the refresh call comes from a mouse event,\n // we need to update the selection for middle click to paste selection.\n if (Browser.isLinux && isLinuxMouseSelection) {\n const selectionText = this.selectionText;\n if (selectionText.length) {\n this._onLinuxMouseSelection.fire(this.selectionText);\n }\n }\n }\n\n /**\n * Fires the refresh event, causing consumers to pick it up and redraw the\n * selection state.\n */\n private _refresh(): void {\n this._refreshAnimationFrame = undefined;\n this._onRedrawRequest.fire({\n start: this._model.finalSelectionStart,\n end: this._model.finalSelectionEnd,\n columnSelectMode: this._activeSelectionMode === SelectionMode.COLUMN\n });\n }\n\n /**\n * Checks if the current click was inside the current selection\n * @param event The mouse event\n */\n private _isClickInSelection(event: MouseEvent): boolean {\n const coords = this._getMouseBufferCoords(event);\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n\n if (!start || !end || !coords) {\n return false;\n }\n\n return this._areCoordsInSelection(coords, start, end);\n }\n\n public isCellInSelection(x: number, y: number): boolean {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n if (!start || !end) {\n return false;\n }\n return this._areCoordsInSelection([x, y], start, end);\n }\n\n protected _areCoordsInSelection(coords: [number, number], start: [number, number], end: [number, number]): boolean {\n return (coords[1] > start[1] && coords[1] < end[1]) ||\n (start[1] === end[1] && coords[1] === start[1] && coords[0] >= start[0] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === end[1] && coords[0] < end[0]) ||\n (start[1] < end[1] && coords[1] === start[1] && coords[0] >= start[0]);\n }\n\n /**\n * Selects word at the current mouse event coordinates.\n * @param event The mouse event.\n */\n private _selectWordAtCursor(event: MouseEvent, allowWhitespaceOnlySelection: boolean): boolean {\n // Check if there is a link under the cursor first and select that if so\n const range = this._linkifier.currentLink?.link?.range;\n if (range) {\n this._model.selectionStart = [range.start.x - 1, range.start.y - 1];\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n this._model.selectionEnd = undefined;\n return true;\n }\n\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._selectWordAt(coords, allowWhitespaceOnlySelection);\n this._model.selectionEnd = undefined;\n return true;\n }\n return false;\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._model.isSelectAllActive = true;\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n public selectLines(start: number, end: number): void {\n this._model.clearSelection();\n start = Math.max(start, 0);\n end = Math.min(end, this._bufferService.buffer.lines.length - 1);\n this._model.selectionStart = [0, start];\n this._model.selectionEnd = [this._bufferService.cols, end];\n this.refresh();\n this._onSelectionChange.fire();\n }\n\n /**\n * Handle the buffer being trimmed, adjust the selection position.\n * @param amount The amount the buffer is being trimmed.\n */\n private _handleTrim(amount: number): void {\n const needsRefresh = this._model.handleTrim(amount);\n if (needsRefresh) {\n this.refresh();\n }\n }\n\n /**\n * Gets the 0-based [x, y] buffer coordinates of the current mouse event.\n * @param event The mouse event.\n */\n private _getMouseBufferCoords(event: MouseEvent): [number, number] | undefined {\n const coords = this._mouseService.getCoords(event, this._screenElement, this._bufferService.cols, this._bufferService.rows, true);\n if (!coords) {\n return undefined;\n }\n\n // Convert to 0-based\n coords[0]--;\n coords[1]--;\n\n // Convert viewport coords to buffer coords\n coords[1] += this._bufferService.buffer.ydisp;\n return coords;\n }\n\n /**\n * Gets the amount the viewport should be scrolled based on how far out of the\n * terminal the mouse is.\n * @param event The mouse event.\n */\n private _getMouseEventScrollAmount(event: MouseEvent): number {\n let offset = getCoordsRelativeToElement(this._coreBrowserService.window, event, this._screenElement)[1];\n const terminalHeight = this._renderService.dimensions.css.canvas.height;\n if (offset >= 0 && offset <= terminalHeight) {\n return 0;\n }\n if (offset > terminalHeight) {\n offset -= terminalHeight;\n }\n\n offset = Math.min(Math.max(offset, -DRAG_SCROLL_MAX_THRESHOLD), DRAG_SCROLL_MAX_THRESHOLD);\n offset /= DRAG_SCROLL_MAX_THRESHOLD;\n return (offset / Math.abs(offset)) + Math.round(offset * (DRAG_SCROLL_MAX_SPEED - 1));\n }\n\n /**\n * Returns whether the selection manager should force selection, regardless of\n * whether the terminal is in mouse events mode.\n * @param event The mouse event.\n */\n public shouldForceSelection(event: MouseEvent): boolean {\n if (Browser.isMac) {\n return event.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection;\n }\n\n return event.shiftKey;\n }\n\n /**\n * Handles te mousedown event, setting up for a new selection.\n * @param event The mousedown event.\n */\n public handleMouseDown(event: MouseEvent): void {\n this._mouseDownTimeStamp = event.timeStamp;\n // If we have selection, we want the context menu on right click even if the\n // terminal is in mouse mode.\n if (event.button === 2 && this.hasSelection) {\n return;\n }\n\n // Only action the primary button\n if (event.button !== 0) {\n return;\n }\n\n // Allow selection when using a specific modifier key, even when disabled\n if (!this._enabled) {\n if (!this.shouldForceSelection(event)) {\n return;\n }\n\n // Don't send the mouse down event to the current process, we want to select\n event.stopPropagation();\n }\n\n // Tell the browser not to start a regular selection\n event.preventDefault();\n\n // Reset drag scroll state\n this._dragScrollAmount = 0;\n\n if (this._enabled && event.shiftKey) {\n this._handleIncrementalClick(event);\n } else {\n if (event.detail === 1) {\n this._handleSingleClick(event);\n } else if (event.detail === 2) {\n this._handleDoubleClick(event);\n } else if (event.detail === 3) {\n this._handleTripleClick(event);\n }\n }\n\n this._addMouseDownListeners();\n this.refresh(true);\n }\n\n /**\n * Adds listeners when mousedown is triggered.\n */\n private _addMouseDownListeners(): void {\n // Listen on the document so that dragging outside of viewport works\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.addEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.addEventListener('mouseup', this._mouseUpListener);\n }\n this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), DRAG_SCROLL_INTERVAL);\n }\n\n /**\n * Removes the listeners that are registered when mousedown is triggered.\n */\n private _removeMouseDownListeners(): void {\n if (this._screenElement.ownerDocument) {\n this._screenElement.ownerDocument.removeEventListener('mousemove', this._mouseMoveListener);\n this._screenElement.ownerDocument.removeEventListener('mouseup', this._mouseUpListener);\n }\n this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer);\n this._dragScrollIntervalTimer = undefined;\n }\n\n /**\n * Performs an incremental click, setting the selection end position to the mouse\n * position.\n * @param event The mouse event.\n */\n private _handleIncrementalClick(event: MouseEvent): void {\n if (this._model.selectionStart) {\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n }\n }\n\n /**\n * Performs a single click, resetting relevant state and setting the selection\n * start position.\n * @param event The mouse event.\n */\n private _handleSingleClick(event: MouseEvent): void {\n // Track if there was a selection before clearing\n const hadSelection = this.hasSelection;\n\n this._model.selectionStartLength = 0;\n this._model.isSelectAllActive = false;\n this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;\n\n // Initialize the new selection\n this._model.selectionStart = this._getMouseBufferCoords(event);\n if (!this._model.selectionStart) {\n return;\n }\n this._model.selectionEnd = undefined;\n\n // Fire selection change event if a selection was cleared\n if (hadSelection) {\n this._fireOnSelectionChange(this._model.finalSelectionStart, this._model.finalSelectionEnd, false);\n }\n\n // Ensure the line exists\n const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);\n if (!line) {\n return;\n }\n\n // Return early if the click event is not in the buffer (eg. in scroll bar)\n if (line.length === this._model.selectionStart[0]) {\n return;\n }\n\n // If the mouse is over the second half of a wide character, adjust the\n // selection to cover the whole character\n if (line.hasWidth(this._model.selectionStart[0]) === 0) {\n this._model.selectionStart[0]++;\n }\n }\n\n /**\n * Performs a double click, selecting the current word.\n * @param event The mouse event.\n */\n private _handleDoubleClick(event: MouseEvent): void {\n if (this._selectWordAtCursor(event, true)) {\n this._activeSelectionMode = SelectionMode.WORD;\n }\n }\n\n /**\n * Performs a triple click, selecting the current line and activating line\n * select mode.\n * @param event The mouse event.\n */\n private _handleTripleClick(event: MouseEvent): void {\n const coords = this._getMouseBufferCoords(event);\n if (coords) {\n this._activeSelectionMode = SelectionMode.LINE;\n this._selectLineAt(coords[1]);\n }\n }\n\n /**\n * Returns whether the selection manager should operate in column select mode\n * @param event the mouse or keyboard event\n */\n public shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean {\n return event.altKey && !(Browser.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);\n }\n\n /**\n * Handles the mousemove event when the mouse button is down, recording the\n * end of the selection and refreshing the selection.\n * @param event The mousemove event.\n */\n private _handleMouseMove(event: MouseEvent): void {\n // If the mousemove listener is active it means that a selection is\n // currently being made, we should stop propagation to prevent mouse events\n // to be sent to the pty.\n event.stopImmediatePropagation();\n\n // Do nothing if there is no selection start, this can happen if the first\n // click in the terminal is an incremental click\n if (!this._model.selectionStart) {\n return;\n }\n\n // Record the previous position so we know whether to redraw the selection\n // at the end.\n const previousSelectionEnd = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;\n\n // Set the initial selection end based on the mouse coordinates\n this._model.selectionEnd = this._getMouseBufferCoords(event);\n if (!this._model.selectionEnd) {\n this.refresh(true);\n return;\n }\n\n // Select the entire line if line select mode is active.\n if (this._activeSelectionMode === SelectionMode.LINE) {\n if (this._model.selectionEnd[1] < this._model.selectionStart[1]) {\n this._model.selectionEnd[0] = 0;\n } else {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n } else if (this._activeSelectionMode === SelectionMode.WORD) {\n this._selectToWordAt(this._model.selectionEnd);\n }\n\n // Determine the amount of scrolling that will happen.\n this._dragScrollAmount = this._getMouseEventScrollAmount(event);\n\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n if (this._dragScrollAmount > 0) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n } else if (this._dragScrollAmount < 0) {\n this._model.selectionEnd[0] = 0;\n }\n }\n\n // If the character is a wide character include the cell to the right in the\n // selection. Note that selections at the very end of the line will never\n // have a character.\n const buffer = this._bufferService.buffer;\n if (this._model.selectionEnd[1] < buffer.lines.length) {\n const line = buffer.lines.get(this._model.selectionEnd[1]);\n if (line && line.hasWidth(this._model.selectionEnd[0]) === 0) {\n if (this._model.selectionEnd[0] < this._bufferService.cols) {\n this._model.selectionEnd[0]++;\n }\n }\n }\n\n // Only draw here if the selection changes.\n if (!previousSelectionEnd ||\n previousSelectionEnd[0] !== this._model.selectionEnd[0] ||\n previousSelectionEnd[1] !== this._model.selectionEnd[1]) {\n this.refresh(true);\n }\n }\n\n /**\n * The callback that occurs every DRAG_SCROLL_INTERVAL ms that does the\n * scrolling of the viewport.\n */\n private _dragScroll(): void {\n if (!this._model.selectionEnd || !this._model.selectionStart) {\n return;\n }\n if (this._dragScrollAmount) {\n this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: false });\n // Re-evaluate selection\n // If the cursor was above or below the viewport, make sure it's at the\n // start or end of the viewport respectively. This should only happen when\n // NOT in column select mode.\n const buffer = this._bufferService.buffer;\n if (this._dragScrollAmount > 0) {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = this._bufferService.cols;\n }\n this._model.selectionEnd[1] = Math.min(buffer.ydisp + this._bufferService.rows, buffer.lines.length - 1);\n } else {\n if (this._activeSelectionMode !== SelectionMode.COLUMN) {\n this._model.selectionEnd[0] = 0;\n }\n this._model.selectionEnd[1] = buffer.ydisp;\n }\n this.refresh();\n }\n }\n\n /**\n * Handles the mouseup event, removing the mousedown listeners.\n * @param event The mouseup event.\n */\n private _handleMouseUp(event: MouseEvent): void {\n const timeElapsed = event.timeStamp - this._mouseDownTimeStamp;\n\n this._removeMouseDownListeners();\n\n if (this.selectionText.length <= 1 && timeElapsed < ALT_CLICK_MOVE_CURSOR_TIME && event.altKey && this._optionsService.rawOptions.altClickMovesCursor) {\n if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {\n const coordinates = this._mouseService.getCoords(\n event,\n this._element,\n this._bufferService.cols,\n this._bufferService.rows,\n false\n );\n if (coordinates && coordinates[0] !== undefined && coordinates[1] !== undefined) {\n const sequence = moveToCellSequence(coordinates[0] - 1, coordinates[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);\n this._coreService.triggerDataEvent(sequence, true);\n }\n }\n } else {\n this._fireEventIfSelectionChanged();\n }\n }\n\n private _fireEventIfSelectionChanged(): void {\n const start = this._model.finalSelectionStart;\n const end = this._model.finalSelectionEnd;\n const hasSelection = !!start && !!end && (start[0] !== end[0] || start[1] !== end[1]);\n\n if (!hasSelection) {\n if (this._oldHasSelection) {\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n return;\n }\n\n // Sanity check, these should not be undefined as there is a selection\n if (!start || !end) {\n return;\n }\n\n if (!this._oldSelectionStart || !this._oldSelectionEnd || (\n start[0] !== this._oldSelectionStart[0] || start[1] !== this._oldSelectionStart[1] ||\n end[0] !== this._oldSelectionEnd[0] || end[1] !== this._oldSelectionEnd[1])) {\n\n this._fireOnSelectionChange(start, end, hasSelection);\n }\n }\n\n private _fireOnSelectionChange(start: [number, number] | undefined, end: [number, number] | undefined, hasSelection: boolean): void {\n this._oldSelectionStart = start;\n this._oldSelectionEnd = end;\n this._oldHasSelection = hasSelection;\n this._onSelectionChange.fire();\n }\n\n private _handleBufferActivate(e: {activeBuffer: IBuffer, inactiveBuffer: IBuffer}): void {\n this.clearSelection();\n // Only adjust the selection on trim, shiftElements is rarely used (only in\n // reverseIndex) and delete in a splice is only ever used when the same\n // number of elements was just added. Given this is could actually be\n // beneficial to leave the selection as is for these cases.\n this._trimListener.dispose();\n this._trimListener = e.activeBuffer.lines.onTrim(amount => this._handleTrim(amount));\n }\n\n /**\n * Converts a viewport column (0 to cols - 1) to the character index on the\n * buffer line, the latter takes into account wide and null characters.\n * @param bufferLine The buffer line to use.\n * @param x The x index in the buffer line to convert.\n */\n private _convertViewportColToCharacterIndex(bufferLine: IBufferLine, x: number): number {\n let charIndex = x;\n for (let i = 0; x >= i; i++) {\n const length = bufferLine.loadCell(i, this._workCell).getChars().length;\n if (this._workCell.getWidth() === 0) {\n // Wide characters aren't included in the line string so decrement the\n // index so the index is back on the wide character.\n charIndex--;\n } else if (length > 1 && x !== i) {\n // Emojis take up multiple characters, so adjust accordingly. For these\n // we don't want ot include the character at the column as we're\n // returning the start index in the string, not the end index.\n charIndex += length - 1;\n }\n }\n return charIndex;\n }\n\n public setSelection(col: number, row: number, length: number): void {\n this._model.clearSelection();\n this._removeMouseDownListeners();\n this._model.selectionStart = [col, row];\n this._model.selectionStartLength = length;\n this.refresh();\n this._fireEventIfSelectionChanged();\n }\n\n public rightClickSelect(ev: MouseEvent): void {\n if (!this._isClickInSelection(ev)) {\n if (this._selectWordAtCursor(ev, false)) {\n this.refresh(true);\n }\n this._fireEventIfSelectionChanged();\n }\n }\n\n /**\n * Gets positional information for the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _getWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean, followWrappedLinesAbove: boolean = true, followWrappedLinesBelow: boolean = true): IWordPosition | undefined {\n // Ensure coords are within viewport (eg. not within scroll bar)\n if (coords[0] >= this._bufferService.cols) {\n return undefined;\n }\n\n const buffer = this._bufferService.buffer;\n const bufferLine = buffer.lines.get(coords[1]);\n if (!bufferLine) {\n return undefined;\n }\n\n const line = buffer.translateBufferLineToString(coords[1], false);\n\n // Get actual index, taking into consideration wide characters\n let startIndex = this._convertViewportColToCharacterIndex(bufferLine, coords[0]);\n let endIndex = startIndex;\n\n // Record offset to be used later\n const charOffset = coords[0] - startIndex;\n let leftWideCharCount = 0;\n let rightWideCharCount = 0;\n let leftLongCharOffset = 0;\n let rightLongCharOffset = 0;\n\n if (line.charAt(startIndex) === ' ') {\n // Expand until non-whitespace is hit\n while (startIndex > 0 && line.charAt(startIndex - 1) === ' ') {\n startIndex--;\n }\n while (endIndex < line.length && line.charAt(endIndex + 1) === ' ') {\n endIndex++;\n }\n } else {\n // Expand until whitespace is hit. This algorithm works by scanning left\n // and right from the starting position, keeping both the index format\n // (line) and the column format (bufferLine) in sync. When a wide\n // character is hit, it is recorded and the column index is adjusted.\n let startCol = coords[0];\n let endCol = coords[0];\n\n // Consider the initial position, skip it and increment the wide char\n // variable\n if (bufferLine.getWidth(startCol) === 0) {\n leftWideCharCount++;\n startCol--;\n }\n if (bufferLine.getWidth(endCol) === 2) {\n rightWideCharCount++;\n endCol++;\n }\n\n // Adjust the end index for characters whose length are > 1 (emojis)\n const length = bufferLine.getString(endCol).length;\n if (length > 1) {\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n\n // Expand the string in both directions until a space is hit\n while (startCol > 0 && startIndex > 0 && !this._isCharWordSeparator(bufferLine.loadCell(startCol - 1, this._workCell))) {\n bufferLine.loadCell(startCol - 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 0) {\n // If the next character is a wide char, record it and skip the column\n leftWideCharCount++;\n startCol--;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n leftLongCharOffset += length - 1;\n startIndex -= length - 1;\n }\n startIndex--;\n startCol--;\n }\n while (endCol < bufferLine.length && endIndex + 1 < line.length && !this._isCharWordSeparator(bufferLine.loadCell(endCol + 1, this._workCell))) {\n bufferLine.loadCell(endCol + 1, this._workCell);\n const length = this._workCell.getChars().length;\n if (this._workCell.getWidth() === 2) {\n // If the next character is a wide char, record it and skip the column\n rightWideCharCount++;\n endCol++;\n } else if (length > 1) {\n // If the next character's string is longer than 1 char (eg. emoji),\n // adjust the index\n rightLongCharOffset += length - 1;\n endIndex += length - 1;\n }\n endIndex++;\n endCol++;\n }\n }\n\n // Incremenet the end index so it is at the start of the next character\n endIndex++;\n\n // Calculate the start _column_, converting the the string indexes back to\n // column coordinates.\n let start =\n startIndex // The index of the selection's start char in the line string\n + charOffset // The difference between the initial char's column and index\n - leftWideCharCount // The number of wide chars left of the initial char\n + leftLongCharOffset; // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n\n // Calculate the length in _columns_, converting the the string indexes back\n // to column coordinates.\n let length = Math.min(this._bufferService.cols, // Disallow lengths larger than the terminal cols\n endIndex // The index of the selection's end char in the line string\n - startIndex // The index of the selection's start char in the line string\n + leftWideCharCount // The number of wide chars left of the initial char\n + rightWideCharCount // The number of wide chars right of the initial char (inclusive)\n - leftLongCharOffset // The number of additional chars left of the initial char added by columns with strings longer than 1 (emojis)\n - rightLongCharOffset); // The number of additional chars right of the initial char (inclusive) added by columns with strings longer than 1 (emojis)\n\n if (!allowWhitespaceOnlySelection && line.slice(startIndex, endIndex).trim() === '') {\n return undefined;\n }\n\n // Recurse upwards if the line is wrapped and the word wraps to the above line\n if (followWrappedLinesAbove) {\n if (start === 0 && bufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const previousBufferLine = buffer.lines.get(coords[1] - 1);\n if (previousBufferLine && bufferLine.isWrapped && previousBufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const previousLineWordPosition = this._getWordAt([this._bufferService.cols - 1, coords[1] - 1], false, true, false);\n if (previousLineWordPosition) {\n const offset = this._bufferService.cols - previousLineWordPosition.start;\n start -= offset;\n length += offset;\n }\n }\n }\n }\n\n // Recurse downwards if the line is wrapped and the word wraps to the next line\n if (followWrappedLinesBelow) {\n if (start + length === this._bufferService.cols && bufferLine.getCodePoint(this._bufferService.cols - 1) !== 32 /* ' ' */) {\n const nextBufferLine = buffer.lines.get(coords[1] + 1);\n if (nextBufferLine?.isWrapped && nextBufferLine.getCodePoint(0) !== 32 /* ' ' */) {\n const nextLineWordPosition = this._getWordAt([0, coords[1] + 1], false, false, true);\n if (nextLineWordPosition) {\n length += nextLineWordPosition.length;\n }\n }\n }\n }\n\n return { start, length };\n }\n\n /**\n * Selects the word at the coordinates specified.\n * @param coords The coordinates to get the word at.\n * @param allowWhitespaceOnlySelection If whitespace should be selected\n */\n protected _selectWordAt(coords: [number, number], allowWhitespaceOnlySelection: boolean): void {\n const wordPosition = this._getWordAt(coords, allowWhitespaceOnlySelection);\n if (wordPosition) {\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n coords[1]--;\n }\n this._model.selectionStart = [wordPosition.start, coords[1]];\n this._model.selectionStartLength = wordPosition.length;\n }\n }\n\n /**\n * Sets the selection end to the word at the coordinated specified.\n * @param coords The coordinates to get the word at.\n */\n private _selectToWordAt(coords: [number, number]): void {\n const wordPosition = this._getWordAt(coords, true);\n if (wordPosition) {\n let endRow = coords[1];\n\n // Adjust negative start value\n while (wordPosition.start < 0) {\n wordPosition.start += this._bufferService.cols;\n endRow--;\n }\n\n // Adjust wrapped length value, this only needs to happen when values are reversed as in that\n // case we're interested in the start of the word, not the end\n if (!this._model.areSelectionValuesReversed()) {\n while (wordPosition.start + wordPosition.length > this._bufferService.cols) {\n wordPosition.length -= this._bufferService.cols;\n endRow++;\n }\n }\n\n this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? wordPosition.start : wordPosition.start + wordPosition.length, endRow];\n }\n }\n\n /**\n * Gets whether the character is considered a word separator by the select\n * word logic.\n * @param cell The cell to check.\n */\n private _isCharWordSeparator(cell: CellData): boolean {\n // Zero width characters are never separators as they are always to the\n // right of wide characters\n if (cell.getWidth() === 0) {\n return false;\n }\n return this._optionsService.rawOptions.wordSeparator.indexOf(cell.getChars()) >= 0;\n }\n\n /**\n * Selects the line specified.\n * @param line The line index.\n */\n protected _selectLineAt(line: number): void {\n const wrappedRange = this._bufferService.buffer.getWrappedRangeForLine(line);\n const range: IBufferRange = {\n start: { x: 0, y: wrappedRange.first },\n end: { x: this._bufferService.cols - 1, y: wrappedRange.last }\n };\n this._model.selectionStart = [0, wrappedRange.first];\n this._model.selectionEnd = undefined;\n this._model.selectionStartLength = getRangeLength(range, this._bufferService.cols);\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nexport class TwoKeyMap {\n private _data: { [bg: string | number]: { [fg: string | number]: TValue | undefined } | undefined } = {};\n\n public set(first: TFirst, second: TSecond, value: TValue): void {\n if (!this._data[first]) {\n this._data[first] = {};\n }\n this._data[first as string | number]![second] = value;\n }\n\n public get(first: TFirst, second: TSecond): TValue | undefined {\n return this._data[first as string | number] ? this._data[first as string | number]![second] : undefined;\n }\n\n public clear(): void {\n this._data = {};\n }\n}\n\nexport class FourKeyMap {\n private _data: TwoKeyMap> = new TwoKeyMap();\n\n public set(first: TFirst, second: TSecond, third: TThird, fourth: TFourth, value: TValue): void {\n if (!this._data.get(first, second)) {\n this._data.set(first, second, new TwoKeyMap());\n }\n this._data.get(first, second)!.set(third, fourth, value);\n }\n\n public get(first: TFirst, second: TSecond, third: TThird, fourth: TFourth): TValue | undefined {\n return this._data.get(first, second)?.get(third, fourth);\n }\n\n public clear(): void {\n this._data.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IColorContrastCache } from 'browser/Types';\nimport { IColor } from 'common/Types';\nimport { TwoKeyMap } from 'common/MultiKeyMap';\n\nexport class ColorContrastCache implements IColorContrastCache {\n private _color: TwoKeyMap = new TwoKeyMap();\n private _css: TwoKeyMap = new TwoKeyMap();\n\n public setCss(bg: number, fg: number, value: string | null): void {\n this._css.set(bg, fg, value);\n }\n\n public getCss(bg: number, fg: number): string | null | undefined {\n return this._css.get(bg, fg);\n }\n\n public setColor(bg: number, fg: number, value: IColor | null): void {\n this._color.set(bg, fg, value);\n }\n\n public getColor(bg: number, fg: number): IColor | null | undefined {\n return this._color.get(bg, fg);\n }\n\n public clear(): void {\n this._color.clear();\n this._css.clear();\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IDisposable, IRenderDimensions as IRenderDimensionsApi, Terminal as ITerminalApi } from '@xterm/xterm';\nimport { channels, css } from 'common/Color';\nimport type { IEvent } from 'common/Event';\n\n/**\n * A portion of the public API that are implemented identially internally and simply passed through.\n */\ntype InternalPassthroughApis = Omit;\n\nexport interface ITerminal extends InternalPassthroughApis, ICoreTerminal {\n screenElement: HTMLElement | undefined;\n browser: IBrowser;\n buffer: IBuffer;\n linkifier: ILinkifier2 | undefined;\n options: Required;\n\n readonly dimensions: IRenderDimensionsApi | undefined;\n\n onBlur: IEvent;\n onFocus: IEvent;\n onDimensionsChange: IEvent;\n onA11yChar: IEvent;\n onA11yTab: IEvent;\n onWillOpen: IEvent;\n}\n\nexport type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;\nexport type CustomWheelEventHandler = (event: WheelEvent) => boolean;\n\nexport type LineData = CharData[];\n\nexport interface ICompositionHelper {\n readonly isComposing: boolean;\n compositionstart(): void;\n compositionupdate(ev: CompositionEvent): void;\n compositionend(): void;\n updateCompositionElements(dontRecurse?: boolean): void;\n keydown(ev: KeyboardEvent): boolean;\n}\n\nexport interface IBrowser {\n isNode: boolean;\n userAgent: string;\n platform: string;\n isFirefox: boolean;\n isMac: boolean;\n isIpad: boolean;\n isIphone: boolean;\n isWindows: boolean;\n}\n\nexport interface IColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n cursorAccent: IColor;\n selectionForeground: IColor | undefined;\n selectionBackgroundTransparent: IColor;\n /** The selection blended on top of background. */\n selectionBackgroundOpaque: IColor;\n selectionInactiveBackgroundTransparent: IColor;\n selectionInactiveBackgroundOpaque: IColor;\n scrollbarSliderBackground: IColor;\n scrollbarSliderHoverBackground: IColor;\n scrollbarSliderActiveBackground: IColor;\n overviewRulerBorder: IColor;\n ansi: IColor[];\n /** Maps original colors to colors that respect minimum contrast ratio. */\n contrastCache: IColorContrastCache;\n /** Maps original colors to colors that respect _half_ of the minimum contrast ratio. */\n halfContrastCache: IColorContrastCache;\n}\n\nexport type ReadonlyColorSet = Readonly> & { ansi: Readonly['ansi']> };\n\nexport interface IColorContrastCache {\n clear(): void;\n setCss(bg: number, fg: number, value: string | null): void;\n getCss(bg: number, fg: number): string | null | undefined;\n setColor(bg: number, fg: number, value: IColor | null): void;\n getColor(bg: number, fg: number): IColor | null | undefined;\n}\n\nexport interface IPartialColorSet {\n foreground: IColor;\n background: IColor;\n cursor?: IColor;\n cursorAccent?: IColor;\n selectionBackground?: IColor;\n ansi: IColor[];\n}\n\nexport interface IViewport extends IDisposable {\n scrollBarWidth: number;\n readonly onRequestScrollLines: IEvent<{ amount: number, suppressScrollEvent: boolean }>;\n syncScrollArea(immediate?: boolean, force?: boolean): void;\n getLinesScrolled(ev: WheelEvent): number;\n getBufferElements(startLine: number, endLine?: number): { bufferElements: HTMLElement[], cursorElement?: HTMLElement };\n handleWheel(ev: WheelEvent): boolean;\n handleTouchStart(ev: TouchEvent): void;\n handleTouchMove(ev: TouchEvent): boolean;\n scrollLines(disp: number): void; // todo api name?\n reset(): void;\n}\n\nexport interface ILinkifierEvent {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n cols: number;\n fg: number | undefined;\n}\n\ninterface ILinkState {\n decorations: ILinkDecorations;\n isHovered: boolean;\n}\nexport interface ILinkWithState {\n link: ILink;\n state?: ILinkState;\n}\n\nexport interface ILinkifier2 extends IDisposable {\n onShowLinkUnderline: IEvent;\n onHideLinkUnderline: IEvent;\n readonly currentLink: ILinkWithState | undefined;\n}\n\nexport interface ILink {\n range: IBufferRange;\n text: string;\n decorations?: ILinkDecorations;\n activate(event: MouseEvent, text: string): void;\n hover?(event: MouseEvent, text: string): void;\n leave?(event: MouseEvent, text: string): void;\n dispose?(): void;\n}\n\nexport interface ILinkDecorations {\n pointerCursor: boolean;\n underline: boolean;\n}\n\nexport interface IBufferRange {\n start: IBufferCellPosition;\n end: IBufferCellPosition;\n}\n\nexport interface IBufferCellPosition {\n x: number;\n y: number;\n}\n\nexport type CharacterJoinerHandler = (text: string) => [number, number][];\n\nexport interface ICharacterJoiner {\n id: number;\n handler: CharacterJoinerHandler;\n}\n\nexport interface IRenderDebouncer extends IDisposable {\n refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void;\n}\n\nexport interface IRenderDebouncerWithCallback extends IRenderDebouncer {\n addRefreshCallback(callback: FrameRequestCallback): number;\n}\n\nexport interface IBufferElementProvider {\n provideBufferElements(): DocumentFragment | HTMLElement;\n}\n\n// An IIFE to generate DEFAULT_ANSI_COLORS.\nexport const DEFAULT_ANSI_COLORS = Object.freeze((() => {\n const colors = [\n // dark:\n css.toColor('#2e3436'),\n css.toColor('#cc0000'),\n css.toColor('#4e9a06'),\n css.toColor('#c4a000'),\n css.toColor('#3465a4'),\n css.toColor('#75507b'),\n css.toColor('#06989a'),\n css.toColor('#d3d7cf'),\n // bright:\n css.toColor('#555753'),\n css.toColor('#ef2929'),\n css.toColor('#8ae234'),\n css.toColor('#fce94f'),\n css.toColor('#729fcf'),\n css.toColor('#ad7fa8'),\n css.toColor('#34e2e2'),\n css.toColor('#eeeeec')\n ];\n\n // Fill in the remaining 240 ANSI colors.\n // Generate colors (16-231)\n const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];\n for (let i = 0; i < 216; i++) {\n const r = v[(i / 36) % 6 | 0];\n const g = v[(i / 6) % 6 | 0];\n const b = v[i % 6];\n colors.push({\n css: channels.toCss(r, g, b),\n rgba: channels.toRgba(r, g, b)\n });\n }\n\n // Generate greys (232-255)\n for (let i = 0; i < 24; i++) {\n const c = 8 + i * 10;\n colors.push({\n css: channels.toCss(c, c, c),\n rgba: channels.toRgba(c, c, c)\n });\n }\n\n return colors;\n})());\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ColorContrastCache } from 'browser/ColorContrastCache';\nimport { IThemeService } from 'browser/services/Services';\nimport { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';\nimport { color, css, NULL_COLOR } from 'common/Color';\nimport { Disposable } from 'common/Lifecycle';\nimport { IOptionsService, ITheme } from 'common/services/Services';\nimport { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';\nimport { Emitter } from 'common/Event';\n\ninterface IRestoreColorSet {\n foreground: IColor;\n background: IColor;\n cursor: IColor;\n ansi: IColor[];\n}\n\n\nconst DEFAULT_FOREGROUND = css.toColor('#ffffff');\nconst DEFAULT_BACKGROUND = css.toColor('#000000');\nconst DEFAULT_CURSOR = css.toColor('#ffffff');\nconst DEFAULT_CURSOR_ACCENT = DEFAULT_BACKGROUND;\nconst DEFAULT_SELECTION = {\n css: 'rgba(255, 255, 255, 0.3)',\n rgba: 0xFFFFFF4D\n};\nconst DEFAULT_OVERVIEW_RULER_BORDER = DEFAULT_FOREGROUND;\n\nexport class ThemeService extends Disposable implements IThemeService {\n public serviceBrand: undefined;\n\n private _colors: IColorSet;\n private _contrastCache: IColorContrastCache = new ColorContrastCache();\n private _halfContrastCache: IColorContrastCache = new ColorContrastCache();\n private _restoreColors!: IRestoreColorSet;\n\n public get colors(): ReadonlyColorSet { return this._colors; }\n\n private readonly _onChangeColors = this._register(new Emitter());\n public readonly onChangeColors = this._onChangeColors.event;\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n\n this._colors = {\n foreground: DEFAULT_FOREGROUND,\n background: DEFAULT_BACKGROUND,\n cursor: DEFAULT_CURSOR,\n cursorAccent: DEFAULT_CURSOR_ACCENT,\n selectionForeground: undefined,\n selectionBackgroundTransparent: DEFAULT_SELECTION,\n selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,\n selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),\n scrollbarSliderBackground: color.opacity(DEFAULT_FOREGROUND, 0.2),\n scrollbarSliderHoverBackground: color.opacity(DEFAULT_FOREGROUND, 0.4),\n scrollbarSliderActiveBackground: color.opacity(DEFAULT_FOREGROUND, 0.5),\n overviewRulerBorder: DEFAULT_FOREGROUND,\n ansi: DEFAULT_ANSI_COLORS.slice(),\n contrastCache: this._contrastCache,\n halfContrastCache: this._halfContrastCache\n };\n this._updateRestoreColors();\n this._setTheme(this._optionsService.rawOptions.theme);\n\n this._register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));\n this._register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));\n }\n\n /**\n * Sets the terminal's theme.\n * @param theme The theme to use. If a partial theme is provided then default\n * colors will be used where colors are not defined.\n */\n private _setTheme(theme: ITheme = {}): void {\n const colors = this._colors;\n colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);\n colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);\n colors.cursor = color.blend(colors.background, parseColor(theme.cursor, DEFAULT_CURSOR));\n colors.cursorAccent = color.blend(colors.background, parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT));\n colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);\n colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);\n colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);\n colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;\n if (colors.selectionForeground === NULL_COLOR) {\n colors.selectionForeground = undefined;\n }\n\n /**\n * If selection color is opaque, blend it with background with 0.3 opacity\n * Issue #2737\n */\n if (color.isOpaque(colors.selectionBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);\n }\n if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {\n const opacity = 0.3;\n colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);\n }\n colors.scrollbarSliderBackground = parseColor(theme.scrollbarSliderBackground, color.opacity(colors.foreground, 0.2));\n colors.scrollbarSliderHoverBackground = parseColor(theme.scrollbarSliderHoverBackground, color.opacity(colors.foreground, 0.4));\n colors.scrollbarSliderActiveBackground = parseColor(theme.scrollbarSliderActiveBackground, color.opacity(colors.foreground, 0.5));\n colors.overviewRulerBorder = parseColor(theme.overviewRulerBorder, DEFAULT_OVERVIEW_RULER_BORDER);\n colors.ansi = DEFAULT_ANSI_COLORS.slice();\n colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);\n colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);\n colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);\n colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);\n colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);\n colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);\n colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);\n colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);\n colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);\n colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);\n colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);\n colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);\n colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);\n colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);\n colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);\n colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);\n if (theme.extendedAnsi) {\n const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);\n for (let i = 0; i < colorCount; i++) {\n colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);\n }\n }\n // Clear our the cache\n this._contrastCache.clear();\n this._halfContrastCache.clear();\n this._updateRestoreColors();\n this._onChangeColors.fire(this.colors);\n }\n\n public restoreColor(slot?: AllColorIndex): void {\n this._restoreColor(slot);\n this._onChangeColors.fire(this.colors);\n }\n\n private _restoreColor(slot: AllColorIndex | undefined): void {\n // unset slot restores all ansi colors\n if (slot === undefined) {\n for (let i = 0; i < this._restoreColors.ansi.length; ++i) {\n this._colors.ansi[i] = this._restoreColors.ansi[i];\n }\n return;\n }\n switch (slot) {\n case SpecialColorIndex.FOREGROUND:\n this._colors.foreground = this._restoreColors.foreground;\n break;\n case SpecialColorIndex.BACKGROUND:\n this._colors.background = this._restoreColors.background;\n break;\n case SpecialColorIndex.CURSOR:\n this._colors.cursor = this._restoreColors.cursor;\n break;\n default:\n this._colors.ansi[slot] = this._restoreColors.ansi[slot];\n }\n }\n\n public modifyColors(callback: (colors: IColorSet) => void): void {\n callback(this._colors);\n // Assume the change happened\n this._onChangeColors.fire(this.colors);\n }\n\n private _updateRestoreColors(): void {\n this._restoreColors = {\n foreground: this._colors.foreground,\n background: this._colors.background,\n cursor: this._colors.cursor,\n ansi: this._colors.ansi.slice()\n };\n }\n}\n\nfunction parseColor(\n cssString: string | undefined,\n fallback: IColor\n): IColor {\n if (cssString !== undefined) {\n try {\n return css.toColor(cssString);\n } catch {\n // no-op\n }\n }\n return fallback;\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n// reg + shift key mappings for digits and special chars\nconst KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {\n // digits 0-9\n 48: ['0', ')'],\n 49: ['1', '!'],\n 50: ['2', '@'],\n 51: ['3', '#'],\n 52: ['4', '$'],\n 53: ['5', '%'],\n 54: ['6', '^'],\n 55: ['7', '&'],\n 56: ['8', '*'],\n 57: ['9', '('],\n\n // special chars\n 186: [';', ':'],\n 187: ['=', '+'],\n 188: [',', '<'],\n 189: ['-', '_'],\n 190: ['.', '>'],\n 191: ['/', '?'],\n 192: ['`', '~'],\n 219: ['[', '{'],\n 220: ['\\\\', '|'],\n 221: [']', '}'],\n 222: ['\\'', '\"']\n};\n\nexport function evaluateKeyboardEvent(\n ev: IKeyboardEvent,\n applicationCursorMode: boolean,\n isMac: boolean,\n macOptionIsMeta: boolean\n): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n // Whether to cancel event propagation (NOTE: this may not be needed since the event is\n // canceled at the end of keyDown\n cancel: false,\n // The new key even to emit\n key: undefined\n };\n const modifiers = (ev.shiftKey ? 1 : 0) | (ev.altKey ? 2 : 0) | (ev.ctrlKey ? 4 : 0) | (ev.metaKey ? 8 : 0);\n switch (ev.keyCode) {\n case 0:\n if (ev.key === 'UIKeyInputUpArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n }\n else if (ev.key === 'UIKeyInputLeftArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n }\n else if (ev.key === 'UIKeyInputRightArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n }\n else if (ev.key === 'UIKeyInputDownArrow') {\n if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n }\n break;\n case 8:\n // backspace\n result.key = ev.ctrlKey ? '\\b' : C0.DEL; // ^H or ^?\n if (ev.altKey) {\n result.key = C0.ESC + result.key;\n }\n break;\n case 9:\n // tab\n if (ev.shiftKey) {\n result.key = C0.ESC + '[Z';\n break;\n }\n result.key = C0.HT;\n result.cancel = true;\n break;\n case 13:\n // return/enter\n result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;\n result.cancel = true;\n break;\n case 27:\n // escape\n result.key = C0.ESC;\n if (ev.altKey) {\n result.key = C0.ESC + C0.ESC;\n }\n result.cancel = true;\n break;\n case 37:\n // left-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'D';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OD';\n } else {\n result.key = C0.ESC + '[D';\n }\n break;\n case 39:\n // right-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'C';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OC';\n } else {\n result.key = C0.ESC + '[C';\n }\n break;\n case 38:\n // up-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'A';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OA';\n } else {\n result.key = C0.ESC + '[A';\n }\n break;\n case 40:\n // down-arrow\n if (ev.metaKey) {\n break;\n }\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'B';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OB';\n } else {\n result.key = C0.ESC + '[B';\n }\n break;\n case 45:\n // insert\n if (!ev.shiftKey && !ev.ctrlKey) {\n // or + are used to\n // copy-paste on some systems.\n result.key = C0.ESC + '[2~';\n }\n break;\n case 46:\n // delete\n if (modifiers) {\n result.key = C0.ESC + '[3;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[3~';\n }\n break;\n case 36:\n // home\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'H';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OH';\n } else {\n result.key = C0.ESC + '[H';\n }\n break;\n case 35:\n // end\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'F';\n } else if (applicationCursorMode) {\n result.key = C0.ESC + 'OF';\n } else {\n result.key = C0.ESC + '[F';\n }\n break;\n case 33:\n // page up\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_UP;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[5;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[5~';\n }\n break;\n case 34:\n // page down\n if (ev.shiftKey) {\n result.type = KeyboardResultType.PAGE_DOWN;\n } else if (ev.ctrlKey) {\n result.key = C0.ESC + '[6;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[6~';\n }\n break;\n case 112:\n // F1-F12\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'P';\n } else {\n result.key = C0.ESC + 'OP';\n }\n break;\n case 113:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'Q';\n } else {\n result.key = C0.ESC + 'OQ';\n }\n break;\n case 114:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'R';\n } else {\n result.key = C0.ESC + 'OR';\n }\n break;\n case 115:\n if (modifiers) {\n result.key = C0.ESC + '[1;' + (modifiers + 1) + 'S';\n } else {\n result.key = C0.ESC + 'OS';\n }\n break;\n case 116:\n if (modifiers) {\n result.key = C0.ESC + '[15;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[15~';\n }\n break;\n case 117:\n if (modifiers) {\n result.key = C0.ESC + '[17;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[17~';\n }\n break;\n case 118:\n if (modifiers) {\n result.key = C0.ESC + '[18;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[18~';\n }\n break;\n case 119:\n if (modifiers) {\n result.key = C0.ESC + '[19;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[19~';\n }\n break;\n case 120:\n if (modifiers) {\n result.key = C0.ESC + '[20;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[20~';\n }\n break;\n case 121:\n if (modifiers) {\n result.key = C0.ESC + '[21;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[21~';\n }\n break;\n case 122:\n if (modifiers) {\n result.key = C0.ESC + '[23;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[23~';\n }\n break;\n case 123:\n if (modifiers) {\n result.key = C0.ESC + '[24;' + (modifiers + 1) + '~';\n } else {\n result.key = C0.ESC + '[24~';\n }\n break;\n default:\n // a-z and space\n if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {\n if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n result.key = String.fromCharCode(ev.keyCode - 64);\n } else if (ev.keyCode === 32) {\n result.key = C0.NUL;\n } else if (ev.keyCode >= 51 && ev.keyCode <= 55) {\n // escape, file sep, group sep, record sep, unit sep\n result.key = String.fromCharCode(ev.keyCode - 51 + 27);\n } else if (ev.keyCode === 56) {\n result.key = C0.DEL;\n } else if (ev.key === '/') {\n result.key = C0.US; // https://github.com/xtermjs/xterm.js/issues/5457\n } else if (ev.keyCode === 219) {\n result.key = C0.ESC;\n } else if (ev.keyCode === 220) {\n result.key = C0.FS;\n } else if (ev.keyCode === 221) {\n result.key = C0.GS;\n }\n } else if ((!isMac || macOptionIsMeta) && ev.altKey && !ev.metaKey) {\n // On macOS this is a third level shift when !macOptionIsMeta. Use instead.\n const keyMapping = KEYCODE_KEY_MAPPINGS[ev.keyCode];\n const key = keyMapping?.[!ev.shiftKey ? 0 : 1];\n if (key) {\n result.key = C0.ESC + key;\n } else if (ev.keyCode >= 65 && ev.keyCode <= 90) {\n const keyCode = ev.ctrlKey ? ev.keyCode - 64 : ev.keyCode + 32;\n let keyString = String.fromCharCode(keyCode);\n if (ev.shiftKey) {\n keyString = keyString.toUpperCase();\n }\n result.key = C0.ESC + keyString;\n } else if (ev.keyCode === 32) {\n result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');\n } else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {\n // Reference: https://github.com/xtermjs/xterm.js/issues/3725\n // Alt will produce a \"dead key\" (initate composition) with some\n // of the letters in US layout (e.g. N/E/U).\n // It's safe to match against Key* since no other `code` values begin with \"Key\".\n // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values#code_values_on_mac\n let keyString = ev.code.slice(3, 4);\n if (!ev.shiftKey) {\n keyString = keyString.toLowerCase();\n }\n result.key = C0.ESC + keyString;\n result.cancel = true;\n }\n } else if (isMac && !ev.altKey && !ev.ctrlKey && !ev.shiftKey && ev.metaKey) {\n if (ev.keyCode === 65) { // cmd + a\n result.type = KeyboardResultType.SELECT_ALL;\n }\n } else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {\n // Include only keys that that result in a _single_ character; don't include num lock,\n // volume up, etc.\n result.key = ev.key;\n } else if (ev.key && ev.ctrlKey && ev.shiftKey) {\n switch (ev.code) {\n case 'Minus': result.key = C0.US; break; // ^_ (Ctrl+Shift+-_\n case 'Digit2': result.key = C0.NUL; break; // ^@ (Ctrl+Shift+2)\n case 'Digit6': result.key = C0.RS; break; // ^^ (Ctrl+Shift+6)\n }\n }\n break;\n }\n\n return result;\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Kitty keyboard protocol implementation.\n * @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n/**\n * Kitty keyboard protocol enhancement flags (bitfield).\n */\nexport const enum KittyKeyboardFlags {\n NONE = 0b00000,\n /** Disambiguate escape codes - fixes ambiguous legacy encodings */\n DISAMBIGUATE_ESCAPE_CODES = 0b00001,\n /** Report event types - press/repeat/release */\n REPORT_EVENT_TYPES = 0b00010,\n /** Report alternate keys - shifted key and base layout key */\n REPORT_ALTERNATE_KEYS = 0b00100,\n /** Report all keys as escape codes - text-producing keys as CSI u */\n REPORT_ALL_KEYS_AS_ESCAPE_CODES = 0b01000,\n /** Report associated text - includes text codepoints in escape code */\n REPORT_ASSOCIATED_TEXT = 0b10000,\n}\n\n/**\n * Kitty keyboard event types.\n */\nexport const enum KittyKeyboardEventType {\n PRESS = 1,\n REPEAT = 2,\n RELEASE = 3,\n}\n\n/**\n * Kitty modifier bits (different from xterm modifier encoding).\n * Value sent = 1 + modifier_bits\n */\nexport const enum KittyKeyboardModifiers {\n SHIFT = 0b00000001,\n ALT = 0b00000010,\n CTRL = 0b00000100,\n SUPER = 0b00001000,\n HYPER = 0b00010000,\n META = 0b00100000,\n CAPS_LOCK = 0b01000000,\n NUM_LOCK = 0b10000000,\n}\n\n/**\n * Kitty keyboard protocol handler class.\n * Encapsulates all key code mappings and encoding logic.\n */\nexport class KittyKeyboard {\n /**\n * Functional key codes for Kitty protocol.\n * Keys that don't produce text have specific unicode codepoint mappings.\n */\n private readonly _functionalKeyCodes: { [key: string]: number } = {\n 'Escape': 27,\n 'Enter': 13,\n 'Tab': 9,\n 'Backspace': 127,\n 'CapsLock': 57358,\n 'ScrollLock': 57359,\n 'NumLock': 57360,\n 'PrintScreen': 57361,\n 'Pause': 57362,\n 'ContextMenu': 57363,\n // F13-F35 (F1-F12 use legacy encoding)\n 'F13': 57376,\n 'F14': 57377,\n 'F15': 57378,\n 'F16': 57379,\n 'F17': 57380,\n 'F18': 57381,\n 'F19': 57382,\n 'F20': 57383,\n 'F21': 57384,\n 'F22': 57385,\n 'F23': 57386,\n 'F24': 57387,\n 'F25': 57388,\n // Keypad keys\n 'KP_0': 57399,\n 'KP_1': 57400,\n 'KP_2': 57401,\n 'KP_3': 57402,\n 'KP_4': 57403,\n 'KP_5': 57404,\n 'KP_6': 57405,\n 'KP_7': 57406,\n 'KP_8': 57407,\n 'KP_9': 57408,\n 'KP_Decimal': 57409,\n 'KP_Divide': 57410,\n 'KP_Multiply': 57411,\n 'KP_Subtract': 57412,\n 'KP_Add': 57413,\n 'KP_Enter': 57414,\n 'KP_Equal': 57415,\n // Modifier keys\n 'ShiftLeft': 57441,\n 'ShiftRight': 57447,\n 'ControlLeft': 57442,\n 'ControlRight': 57448,\n 'AltLeft': 57443,\n 'AltRight': 57449,\n 'MetaLeft': 57444,\n 'MetaRight': 57450,\n // Media keys\n 'MediaPlayPause': 57430,\n 'MediaStop': 57432,\n 'MediaTrackNext': 57435,\n 'MediaTrackPrevious': 57436,\n 'AudioVolumeDown': 57438,\n 'AudioVolumeUp': 57439,\n 'AudioVolumeMute': 57440\n };\n\n /**\n * Keys that use CSI ~ encoding with a number parameter.\n */\n private readonly _csiTildeKeys: { [key: string]: number } = {\n 'Insert': 2,\n 'Delete': 3,\n 'PageUp': 5,\n 'PageDown': 6,\n 'F5': 15,\n 'F6': 17,\n 'F7': 18,\n 'F8': 19,\n 'F9': 20,\n 'F10': 21,\n 'F11': 23,\n 'F12': 24\n };\n\n /**\n * Keys that use CSI letter encoding (arrows, Home, End).\n */\n private readonly _csiLetterKeys: { [key: string]: string } = {\n 'ArrowUp': 'A',\n 'ArrowDown': 'B',\n 'ArrowRight': 'C',\n 'ArrowLeft': 'D',\n 'Home': 'H',\n 'End': 'F'\n };\n\n /**\n * Function keys F1-F4 use SS3 encoding without modifiers.\n */\n private readonly _ss3FunctionKeys: { [key: string]: string } = {\n 'F1': 'P',\n 'F2': 'Q',\n 'F3': 'R',\n 'F4': 'S'\n };\n\n /**\n * Map browser key codes to Kitty numpad codes.\n */\n private _getNumpadKeyCode(ev: IKeyboardEvent): number | undefined {\n if (ev.code.startsWith('Numpad')) {\n const suffix = ev.code.slice(6);\n if (suffix >= '0' && suffix <= '9') {\n return 57399 + parseInt(suffix, 10);\n }\n switch (suffix) {\n case 'Decimal': return 57409;\n case 'Divide': return 57410;\n case 'Multiply': return 57411;\n case 'Subtract': return 57412;\n case 'Add': return 57413;\n case 'Enter': return 57414;\n case 'Equal': return 57415;\n }\n }\n return undefined;\n }\n\n /**\n * Get modifier key code from code property.\n */\n private _getModifierKeyCode(ev: IKeyboardEvent): number | undefined {\n switch (ev.code) {\n case 'ShiftLeft': return 57441;\n case 'ShiftRight': return 57447;\n case 'ControlLeft': return 57442;\n case 'ControlRight': return 57448;\n case 'AltLeft': return 57443;\n case 'AltRight': return 57449;\n case 'MetaLeft': return 57444;\n case 'MetaRight': return 57450;\n }\n return undefined;\n }\n\n /**\n * Encode modifiers for Kitty protocol.\n * Returns 1 + modifier bits, or 0 if no modifiers.\n */\n private _encodeModifiers(ev: IKeyboardEvent): number {\n let mods = 0;\n if (ev.shiftKey) mods |= KittyKeyboardModifiers.SHIFT;\n if (ev.altKey) mods |= KittyKeyboardModifiers.ALT;\n if (ev.ctrlKey) mods |= KittyKeyboardModifiers.CTRL;\n if (ev.metaKey) mods |= KittyKeyboardModifiers.SUPER;\n return mods > 0 ? mods + 1 : 0;\n }\n\n /**\n * Get the unicode key code for a keyboard event.\n * Returns the lowercase codepoint for letters.\n * For shifted keys, uses the code property to get the base key.\n */\n private _getKeyCode(ev: IKeyboardEvent): number | undefined {\n const numpadCode = this._getNumpadKeyCode(ev);\n if (numpadCode !== undefined) {\n return numpadCode;\n }\n\n const modifierCode = this._getModifierKeyCode(ev);\n if (modifierCode !== undefined) {\n return modifierCode;\n }\n\n const funcCode = this._functionalKeyCodes[ev.key];\n if (funcCode !== undefined) {\n return funcCode;\n }\n\n if (ev.shiftKey && ev.code) {\n if (ev.code.startsWith('Digit') && ev.code.length === 6) {\n const digit = ev.code.charAt(5);\n if (digit >= '0' && digit <= '9') {\n return digit.charCodeAt(0);\n }\n }\n if (ev.code.startsWith('Key') && ev.code.length === 4) {\n const letter = ev.code.charAt(3).toLowerCase();\n return letter.charCodeAt(0);\n }\n }\n\n if (ev.key.length === 1) {\n const code = ev.key.codePointAt(0)!;\n if (code >= 65 && code <= 90) {\n return code + 32;\n }\n return code;\n }\n\n return undefined;\n }\n\n /**\n * Check if a key is a modifier key.\n */\n private _isModifierKey(ev: IKeyboardEvent): boolean {\n return ev.key === 'Shift' || ev.key === 'Control' || ev.key === 'Alt' || ev.key === 'Meta';\n }\n\n /**\n * Build CSI letter sequence for arrow keys, Home, End.\n * Format: CSI [1;mod] letter\n */\n private _buildCsiLetterSequence(\n letter: string,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n if (modifiers > 0 || needsEventType) {\n let seq = C0.ESC + '[1;' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n seq += letter;\n return seq;\n }\n return C0.ESC + '[' + letter;\n }\n\n /**\n * Build SS3 sequence for F1-F4.\n * Without modifiers: SS3 letter\n * With modifiers: CSI 1;mod letter\n */\n private _buildSs3Sequence(\n letter: string,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n if (modifiers > 0 || needsEventType) {\n let seq = C0.ESC + '[1;' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n seq += letter;\n return seq;\n }\n return C0.ESC + 'O' + letter;\n }\n\n /**\n * Build CSI ~ sequence for Insert, Delete, PageUp/Down, F5-F12.\n * Format: CSI number [;mod[:event]] ~\n */\n private _buildCsiTildeSequence(\n number: number,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n reportEventTypes: boolean\n ): string {\n const needsEventType = reportEventTypes && eventType !== KittyKeyboardEventType.PRESS;\n\n let seq = C0.ESC + '[' + number;\n if (modifiers > 0 || needsEventType) {\n seq += ';' + (modifiers > 0 ? modifiers : '1');\n if (needsEventType) {\n seq += ':' + eventType;\n }\n }\n seq += '~';\n return seq;\n }\n\n /**\n * Build CSI u sequence.\n * Format: CSI keycode[:shifted[:base]] [;mod[:event][;text]] u\n */\n private _buildCsiUSequence(\n ev: IKeyboardEvent,\n keyCode: number,\n modifiers: number,\n eventType: KittyKeyboardEventType,\n flags: number,\n isFunc: boolean,\n isMod: boolean\n ): string {\n const reportEventTypes = !!(flags & KittyKeyboardFlags.REPORT_EVENT_TYPES);\n const reportAlternateKeys = !!(flags & KittyKeyboardFlags.REPORT_ALTERNATE_KEYS);\n\n let seq = C0.ESC + '[' + keyCode;\n\n let shiftedKey: number | undefined;\n if (reportAlternateKeys && ev.shiftKey && ev.key.length === 1 && !isFunc && !isMod) {\n shiftedKey = ev.key.codePointAt(0);\n seq += ':' + shiftedKey;\n }\n\n const reportAssociatedText = !!(flags & KittyKeyboardFlags.REPORT_ASSOCIATED_TEXT) &&\n eventType !== KittyKeyboardEventType.RELEASE &&\n ev.key.length === 1 &&\n !isFunc &&\n !isMod &&\n !ev.ctrlKey;\n const textCode = reportAssociatedText ? ev.key.codePointAt(0) : undefined;\n\n const needsEventType = reportEventTypes &&\n eventType !== KittyKeyboardEventType.PRESS &&\n (eventType === KittyKeyboardEventType.RELEASE || textCode === undefined);\n\n if (modifiers > 0 || needsEventType || textCode !== undefined) {\n seq += ';';\n if (modifiers > 0) {\n seq += modifiers;\n } else if (needsEventType) {\n seq += '1';\n }\n if (needsEventType) {\n seq += ':' + eventType;\n }\n }\n\n if (textCode !== undefined) {\n seq += ';' + textCode;\n }\n\n seq += 'u';\n return seq;\n }\n\n /**\n * Evaluate a keyboard event using Kitty keyboard protocol.\n *\n * @param ev The keyboard event.\n * @param flags The active Kitty keyboard enhancement flags.\n * @param eventType The event type (press, repeat, release).\n * @returns The keyboard result with the encoded key sequence.\n */\n public evaluate(\n ev: IKeyboardEvent,\n flags: number,\n eventType: KittyKeyboardEventType = KittyKeyboardEventType.PRESS\n ): IKeyboardResult {\n const result: IKeyboardResult = {\n type: KeyboardResultType.SEND_KEY,\n cancel: false,\n key: undefined\n };\n\n const modifiers = this._encodeModifiers(ev);\n const isMod = this._isModifierKey(ev);\n const reportEventTypes = !!(flags & KittyKeyboardFlags.REPORT_EVENT_TYPES);\n\n if (!reportEventTypes && eventType === KittyKeyboardEventType.RELEASE) {\n return result;\n }\n\n if (isMod && !(flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES) && !reportEventTypes) {\n return result;\n }\n\n const csiLetter = this._csiLetterKeys[ev.key];\n if (csiLetter) {\n result.key = this._buildCsiLetterSequence(csiLetter, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const ss3Letter = this._ss3FunctionKeys[ev.key];\n if (ss3Letter) {\n result.key = this._buildSs3Sequence(ss3Letter, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const tildeCode = this._csiTildeKeys[ev.key];\n if (tildeCode !== undefined) {\n result.key = this._buildCsiTildeSequence(tildeCode, modifiers, eventType, reportEventTypes);\n result.cancel = true;\n return result;\n }\n\n const keyCode = this._getKeyCode(ev);\n if (keyCode === undefined) {\n return result;\n }\n\n const isFunc = this._functionalKeyCodes[ev.key] !== undefined || this._getNumpadKeyCode(ev) !== undefined;\n\n let useCsiU = false;\n\n if (flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES) {\n useCsiU = true;\n } else if (reportEventTypes) {\n useCsiU = true;\n } else if (flags & KittyKeyboardFlags.DISAMBIGUATE_ESCAPE_CODES) {\n if (keyCode === 27 || keyCode === 127 || keyCode === 13 || keyCode === 9 || keyCode === 32) {\n useCsiU = true;\n } else if (isFunc) {\n useCsiU = true;\n } else if (modifiers > 0) {\n if (ev.shiftKey && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.key.length === 1) {\n useCsiU = false;\n } else {\n useCsiU = true;\n }\n }\n }\n\n if (useCsiU) {\n result.key = this._buildCsiUSequence(ev, keyCode, modifiers, eventType, flags, isFunc, isMod);\n result.cancel = true;\n } else {\n if (ev.key.length === 1 && !ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n result.key = ev.key;\n }\n }\n\n return result;\n }\n\n /**\n * Check if Kitty protocol should be used based on flags.\n */\n public static shouldUseProtocol(flags: number): boolean {\n return flags > 0;\n }\n}\n", "/**\n * Copyright (c) 2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Win32 input mode implementation.\n * @see https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md\n *\n * Format: CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _\n * Vk: Virtual key code (decimal)\n * Sc: Scan code (decimal)\n * Uc: Unicode character (decimal codepoint, 0 if none)\n * Kd: Key down (1) or up (0)\n * Cs: Control key state (modifier flags)\n * Rc: Repeat count (usually 1)\n */\n\nimport { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/Types';\nimport { C0 } from 'common/data/EscapeSequences';\n\n/**\n * Win32 control key state flags (from Windows API).\n */\nexport const enum Win32ControlKeyState {\n RIGHT_ALT_PRESSED = 0b000000001,\n LEFT_ALT_PRESSED = 0b000000010,\n RIGHT_CTRL_PRESSED = 0b000000100,\n LEFT_CTRL_PRESSED = 0b000001000,\n SHIFT_PRESSED = 0b000010000,\n NUMLOCK_ON = 0b000100000,\n SCROLLLOCK_ON = 0b001000000,\n CAPSLOCK_ON = 0b010000000,\n ENHANCED_KEY = 0b100000000,\n}\n\n/**\n * Win32 input mode handler. Lookup tables are only initialized when this class\n * is instantiated, reducing bundle size for environments that don't use this mode.\n */\nexport class Win32InputMode {\n /**\n * Mapping from browser KeyboardEvent.code to Win32 virtual key codes.\n * Based on https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes\n */\n private readonly _codeToVk: { [code: string]: number } = {\n // Letters\n 'KeyA': 0x41, 'KeyB': 0x42, 'KeyC': 0x43, 'KeyD': 0x44, 'KeyE': 0x45,\n 'KeyF': 0x46, 'KeyG': 0x47, 'KeyH': 0x48, 'KeyI': 0x49, 'KeyJ': 0x4A,\n 'KeyK': 0x4B, 'KeyL': 0x4C, 'KeyM': 0x4D, 'KeyN': 0x4E, 'KeyO': 0x4F,\n 'KeyP': 0x50, 'KeyQ': 0x51, 'KeyR': 0x52, 'KeyS': 0x53, 'KeyT': 0x54,\n 'KeyU': 0x55, 'KeyV': 0x56, 'KeyW': 0x57, 'KeyX': 0x58, 'KeyY': 0x59,\n 'KeyZ': 0x5A,\n\n // Digits\n 'Digit0': 0x30, 'Digit1': 0x31, 'Digit2': 0x32, 'Digit3': 0x33, 'Digit4': 0x34,\n 'Digit5': 0x35, 'Digit6': 0x36, 'Digit7': 0x37, 'Digit8': 0x38, 'Digit9': 0x39,\n\n // Function keys\n 'F1': 0x70, 'F2': 0x71, 'F3': 0x72, 'F4': 0x73, 'F5': 0x74, 'F6': 0x75,\n 'F7': 0x76, 'F8': 0x77, 'F9': 0x78, 'F10': 0x79, 'F11': 0x7A, 'F12': 0x7B,\n 'F13': 0x7C, 'F14': 0x7D, 'F15': 0x7E, 'F16': 0x7F, 'F17': 0x80, 'F18': 0x81,\n 'F19': 0x82, 'F20': 0x83, 'F21': 0x84, 'F22': 0x85, 'F23': 0x86, 'F24': 0x87,\n\n // Numpad\n 'Numpad0': 0x60, 'Numpad1': 0x61, 'Numpad2': 0x62, 'Numpad3': 0x63, 'Numpad4': 0x64,\n 'Numpad5': 0x65, 'Numpad6': 0x66, 'Numpad7': 0x67, 'Numpad8': 0x68, 'Numpad9': 0x69,\n 'NumpadMultiply': 0x6A, 'NumpadAdd': 0x6B, 'NumpadSeparator': 0x6C,\n 'NumpadSubtract': 0x6D, 'NumpadDecimal': 0x6E, 'NumpadDivide': 0x6F,\n 'NumpadEnter': 0x0D, // Same as Enter but with ENHANCED_KEY flag\n 'NumLock': 0x90,\n\n // Navigation\n 'ArrowUp': 0x26, 'ArrowDown': 0x28, 'ArrowLeft': 0x25, 'ArrowRight': 0x27,\n 'Home': 0x24, 'End': 0x23, 'PageUp': 0x21, 'PageDown': 0x22,\n 'Insert': 0x2D, 'Delete': 0x2E,\n\n // Modifiers\n 'ShiftLeft': 0x10, 'ShiftRight': 0x10,\n 'ControlLeft': 0x11, 'ControlRight': 0x11,\n 'AltLeft': 0x12, 'AltRight': 0x12,\n 'MetaLeft': 0x5B, 'MetaRight': 0x5C,\n 'CapsLock': 0x14, 'ScrollLock': 0x91,\n\n // Special keys\n 'Escape': 0x1B, 'Enter': 0x0D, 'Tab': 0x09, 'Space': 0x20,\n 'Backspace': 0x08, 'Pause': 0x13, 'ContextMenu': 0x5D, 'PrintScreen': 0x2C,\n\n // OEM keys (US keyboard layout)\n 'Semicolon': 0xBA, // ;:\n 'Equal': 0xBB, // =+\n 'Comma': 0xBC, // ,<\n 'Minus': 0xBD, // -_\n 'Period': 0xBE, // .>\n 'Slash': 0xBF, // /?\n 'Backquote': 0xC0, // `~\n 'BracketLeft': 0xDB, // [{\n 'Backslash': 0xDC, // \\|\n 'BracketRight': 0xDD, // ]}\n 'Quote': 0xDE, // '\"\n 'IntlBackslash': 0xE2 // Non-US backslash\n };\n\n /**\n * Mapping from browser KeyboardEvent.code to approximate Win32 scan codes.\n * Note: Scan codes can vary by keyboard layout. These are approximations\n * based on standard US keyboard layout.\n */\n private readonly _codeToScancode: { [code: string]: number } = {\n // Letters (row by row)\n 'KeyQ': 0x10, 'KeyW': 0x11, 'KeyE': 0x12, 'KeyR': 0x13, 'KeyT': 0x14,\n 'KeyY': 0x15, 'KeyU': 0x16, 'KeyI': 0x17, 'KeyO': 0x18, 'KeyP': 0x19,\n 'KeyA': 0x1E, 'KeyS': 0x1F, 'KeyD': 0x20, 'KeyF': 0x21, 'KeyG': 0x22,\n 'KeyH': 0x23, 'KeyJ': 0x24, 'KeyK': 0x25, 'KeyL': 0x26,\n 'KeyZ': 0x2C, 'KeyX': 0x2D, 'KeyC': 0x2E, 'KeyV': 0x2F, 'KeyB': 0x30,\n 'KeyN': 0x31, 'KeyM': 0x32,\n\n // Digits\n 'Digit1': 0x02, 'Digit2': 0x03, 'Digit3': 0x04, 'Digit4': 0x05, 'Digit5': 0x06,\n 'Digit6': 0x07, 'Digit7': 0x08, 'Digit8': 0x09, 'Digit9': 0x0A, 'Digit0': 0x0B,\n\n // Function keys\n 'F1': 0x3B, 'F2': 0x3C, 'F3': 0x3D, 'F4': 0x3E, 'F5': 0x3F, 'F6': 0x40,\n 'F7': 0x41, 'F8': 0x42, 'F9': 0x43, 'F10': 0x44, 'F11': 0x57, 'F12': 0x58,\n\n // Numpad\n 'Numpad0': 0x52, 'Numpad1': 0x4F, 'Numpad2': 0x50, 'Numpad3': 0x51, 'Numpad4': 0x4B,\n 'Numpad5': 0x4C, 'Numpad6': 0x4D, 'Numpad7': 0x47, 'Numpad8': 0x48, 'Numpad9': 0x49,\n 'NumpadMultiply': 0x37, 'NumpadAdd': 0x4E, 'NumpadSubtract': 0x4A,\n 'NumpadDecimal': 0x53, 'NumpadDivide': 0x35, 'NumpadEnter': 0x1C,\n 'NumLock': 0x45,\n\n // Navigation (extended keys)\n 'ArrowUp': 0x48, 'ArrowDown': 0x50, 'ArrowLeft': 0x4B, 'ArrowRight': 0x4D,\n 'Home': 0x47, 'End': 0x4F, 'PageUp': 0x49, 'PageDown': 0x51,\n 'Insert': 0x52, 'Delete': 0x53,\n\n // Modifiers\n 'ShiftLeft': 0x2A, 'ShiftRight': 0x36,\n 'ControlLeft': 0x1D, 'ControlRight': 0x1D,\n 'AltLeft': 0x38, 'AltRight': 0x38,\n 'CapsLock': 0x3A, 'ScrollLock': 0x46,\n\n // Special keys\n 'Escape': 0x01, 'Enter': 0x1C, 'Tab': 0x0F, 'Space': 0x39,\n 'Backspace': 0x0E, 'Pause': 0x45,\n\n // OEM keys\n 'Semicolon': 0x27, 'Equal': 0x0D, 'Comma': 0x33, 'Minus': 0x0C,\n 'Period': 0x34, 'Slash': 0x35, 'Backquote': 0x29,\n 'BracketLeft': 0x1A, 'Backslash': 0x2B, 'BracketRight': 0x1B, 'Quote': 0x28\n };\n\n /**\n * Codes that represent enhanced keys (extended keyboard keys).\n */\n private readonly _enhancedKeyCodes = new Set([\n 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight',\n 'Home', 'End', 'PageUp', 'PageDown', 'Insert', 'Delete',\n 'NumpadEnter', 'NumpadDivide',\n 'ControlRight', 'AltRight',\n 'PrintScreen', 'Pause', 'ContextMenu',\n 'MetaLeft', 'MetaRight'\n ]);\n\n /**\n * Mapping of special keys (ev.key values) to their Unicode control character codes.\n * These keys have multi-character ev.key strings but produce control characters.\n * @see https://docs.microsoft.com/en-us/windows/console/key-event-record-str\n */\n private readonly _keyToControlChar: { [key: string]: number } = {\n 'Enter': 0x0D, // Carriage return\n 'Backspace': 0x08, // Backspace\n 'Tab': 0x09, // Horizontal tab\n 'Escape': 0x1B // Escape\n };\n\n /**\n * Get the Win32 virtual key code for a keyboard event.\n */\n private _getVirtualKeyCode(ev: IKeyboardEvent): number {\n const vk = this._codeToVk[ev.code];\n if (vk !== undefined) {\n return vk;\n }\n // Fall back to keyCode for unmapped keys\n return ev.keyCode || 0;\n }\n\n /**\n * Get the Win32 scan code for a keyboard event.\n * Returns 0 if unknown (scan codes vary by hardware).\n */\n private _getScanCode(ev: IKeyboardEvent): number {\n return this._codeToScancode[ev.code] || 0;\n }\n\n /**\n * Get the unicode character for a keyboard event.\n * Returns 0 for non-character keys.\n */\n private _getUnicodeChar(ev: IKeyboardEvent): number {\n // Handle special keys that produce control characters\n // Ctrl modifies some of these: Ctrl+Enter=LF, Ctrl+Backspace=DEL\n if (ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n if (ev.key === 'Enter') {\n return 0x0A; // Line feed (Ctrl+Enter)\n }\n if (ev.key === 'Backspace') {\n return 0x7F; // DEL (Ctrl+Backspace)\n }\n }\n\n // Check for special keys that always produce control characters\n const controlChar = this._keyToControlChar[ev.key];\n if (controlChar !== undefined) {\n return controlChar;\n }\n\n // Only single-character keys produce unicode output\n if (ev.key.length === 1) {\n const codePoint = ev.key.codePointAt(0) || 0;\n\n // Handle Ctrl+letter combinations - these produce control characters (0x01-0x1A)\n if (ev.ctrlKey && !ev.altKey && !ev.metaKey) {\n // Convert A-Z or a-z to control character (Ctrl+A = 0x01, Ctrl+C = 0x03, etc.)\n if (codePoint >= 0x41 && codePoint <= 0x5A) { // A-Z\n return codePoint - 0x40;\n }\n if (codePoint >= 0x61 && codePoint <= 0x7A) { // a-z\n return codePoint - 0x60;\n }\n }\n\n return codePoint;\n }\n return 0;\n }\n\n /**\n * Get the Win32 control key state flags.\n */\n private _getControlKeyState(ev: IKeyboardEvent): number {\n let state = 0;\n\n if (ev.shiftKey) {\n state |= Win32ControlKeyState.SHIFT_PRESSED;\n }\n\n // Note: We can't distinguish left/right for ctrl/alt in standard browser events,\n // so we use the generic pressed flags. The right-side flags are used when\n // we can detect them (e.g., via code property).\n if (ev.ctrlKey) {\n if (ev.code === 'ControlRight') {\n state |= Win32ControlKeyState.RIGHT_CTRL_PRESSED;\n } else {\n state |= Win32ControlKeyState.LEFT_CTRL_PRESSED;\n }\n }\n\n if (ev.altKey) {\n if (ev.code === 'AltRight') {\n state |= Win32ControlKeyState.RIGHT_ALT_PRESSED;\n } else {\n state |= Win32ControlKeyState.LEFT_ALT_PRESSED;\n }\n }\n\n // Check for enhanced key\n if (this._enhancedKeyCodes.has(ev.code)) {\n state |= Win32ControlKeyState.ENHANCED_KEY;\n }\n\n return state;\n }\n\n /**\n * Evaluate a keyboard event using Win32 input mode.\n *\n * @param ev The keyboard event.\n * @param isKeyDown Whether this is a keydown (true) or keyup (false) event.\n * @returns The keyboard result with the encoded key sequence.\n */\n public evaluateKeyboardEvent(ev: IKeyboardEvent, isKeyDown: boolean): IKeyboardResult {\n const vk = this._getVirtualKeyCode(ev);\n const sc = this._getScanCode(ev);\n const uc = this._getUnicodeChar(ev);\n const kd = isKeyDown ? 1 : 0;\n const cs = this._getControlKeyState(ev);\n const rc = 1; // Repeat count, always 1 for now\n\n // Format: CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _\n return {\n type: KeyboardResultType.SEND_KEY,\n cancel: true,\n key: `${C0.ESC}[${vk};${sc};${uc};${kd};${cs};${rc}_`\n };\n }\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IKeyboardService } from 'browser/services/Services';\nimport { evaluateKeyboardEvent } from 'common/input/Keyboard';\nimport { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from 'common/input/KittyKeyboard';\nimport { Win32InputMode } from 'common/input/Win32InputMode';\nimport { isMac } from 'common/Platform';\nimport { ICoreService, IOptionsService } from 'common/services/Services';\nimport { IKeyboardResult } from 'common/Types';\n\nexport class KeyboardService implements IKeyboardService {\n public serviceBrand: undefined;\n\n private _win32InputMode: Win32InputMode | undefined;\n private _kittyKeyboard: KittyKeyboard | undefined;\n\n constructor(\n @ICoreService private readonly _coreService: ICoreService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n }\n\n private _getWin32InputMode(): Win32InputMode {\n this._win32InputMode ??= new Win32InputMode();\n return this._win32InputMode;\n }\n\n private _getKittyKeyboard(): KittyKeyboard {\n this._kittyKeyboard ??= new KittyKeyboard();\n return this._kittyKeyboard;\n }\n\n public evaluateKeyDown(event: KeyboardEvent): IKeyboardResult {\n // Win32 input mode takes priority (most raw)\n if (this.useWin32InputMode) {\n return this._getWin32InputMode().evaluateKeyboardEvent(event, true);\n }\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n return this.useKitty\n ? this._getKittyKeyboard().evaluate(event, kittyFlags, event.repeat ? KittyKeyboardEventType.REPEAT : KittyKeyboardEventType.PRESS)\n : evaluateKeyboardEvent(event, this._coreService.decPrivateModes.applicationCursorKeys, isMac, this._optionsService.rawOptions.macOptionIsMeta);\n }\n\n public evaluateKeyUp(event: KeyboardEvent): IKeyboardResult | undefined {\n // Win32 input mode sends key up events\n if (this.useWin32InputMode) {\n return this._getWin32InputMode().evaluateKeyboardEvent(event, false);\n }\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n if (this.useKitty && (kittyFlags & KittyKeyboardFlags.REPORT_EVENT_TYPES)) {\n return this._getKittyKeyboard().evaluate(event, kittyFlags, KittyKeyboardEventType.RELEASE);\n }\n return undefined;\n }\n\n public get useKitty(): boolean {\n const kittyFlags = this._coreService.kittyKeyboard.flags;\n return !!(this._optionsService.rawOptions.vtExtensions?.kittyKeyboard && KittyKeyboard.shouldUseProtocol(kittyFlags));\n }\n\n public get useWin32InputMode(): boolean {\n return !!(this._optionsService.rawOptions.vtExtensions?.win32InputMode && this._coreService.decPrivateModes.win32InputMode);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * This was heavily inspired from microsoft/vscode's dependency injection system (MIT).\n */\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IInstantiationService, IServiceIdentifier } from 'common/services/Services';\nimport { getServiceDependencies } from 'common/services/ServiceRegistry';\n\nexport class ServiceCollection {\n\n private _entries = new Map, any>();\n\n constructor(...entries: [IServiceIdentifier, any][]) {\n for (const [id, service] of entries) {\n this.set(id, service);\n }\n }\n\n public set(id: IServiceIdentifier, instance: T): T {\n const result = this._entries.get(id);\n this._entries.set(id, instance);\n return result;\n }\n\n public forEach(callback: (id: IServiceIdentifier, instance: any) => any): void {\n for (const [key, value] of this._entries.entries()) {\n callback(key, value);\n }\n }\n\n public has(id: IServiceIdentifier): boolean {\n return this._entries.has(id);\n }\n\n public get(id: IServiceIdentifier): T | undefined {\n return this._entries.get(id);\n }\n}\n\nexport class InstantiationService implements IInstantiationService {\n public serviceBrand: undefined;\n\n private readonly _services: ServiceCollection = new ServiceCollection();\n\n constructor() {\n this._services.set(IInstantiationService, this);\n }\n\n public setService(id: IServiceIdentifier, instance: T): void {\n this._services.set(id, instance);\n }\n\n public getService(id: IServiceIdentifier): T | undefined {\n return this._services.get(id);\n }\n\n public createInstance(ctor: any, ...args: any[]): T {\n const serviceDependencies = getServiceDependencies(ctor).sort((a, b) => a.index - b.index);\n\n const serviceArgs: any[] = [];\n for (const dependency of serviceDependencies) {\n const service = this._services.get(dependency.id);\n if (!service) {\n throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id._id}.`);\n }\n serviceArgs.push(service);\n }\n\n const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;\n\n // check for argument mismatches, adjust static args if needed\n if (args.length !== firstServiceArgPos) {\n throw new Error(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);\n }\n\n // now create the instance\n return new ctor(...[...args, ...serviceArgs]);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';\n\ntype LogType = (message?: any, ...optionalParams: any[]) => void;\n\ninterface IConsole {\n log: LogType;\n error: LogType;\n info: LogType;\n trace: LogType;\n warn: LogType;\n}\n\n// console is available on both node.js and browser contexts but the common\n// module doesn't depend on them so we need to explicitly declare it.\ndeclare const console: IConsole;\n\nconst optionsKeyToLogLevel: { [key: string]: LogLevelEnum } = {\n trace: LogLevelEnum.TRACE,\n debug: LogLevelEnum.DEBUG,\n info: LogLevelEnum.INFO,\n warn: LogLevelEnum.WARN,\n error: LogLevelEnum.ERROR,\n off: LogLevelEnum.OFF\n};\n\nconst LOG_PREFIX = 'xterm.js: ';\n\nexport class LogService extends Disposable implements ILogService {\n public serviceBrand: any;\n\n private _logLevel: LogLevelEnum = LogLevelEnum.OFF;\n public get logLevel(): LogLevelEnum { return this._logLevel; }\n\n constructor(\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this._updateLogLevel();\n this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));\n }\n\n private _updateLogLevel(): void {\n this._logLevel = optionsKeyToLogLevel[this._optionsService.rawOptions.logLevel];\n }\n\n private _evalLazyOptionalParams(optionalParams: any[]): void {\n for (let i = 0; i < optionalParams.length; i++) {\n if (typeof optionalParams[i] === 'function') {\n optionalParams[i] = optionalParams[i]();\n }\n }\n }\n\n private _log(type: LogType, message: string, optionalParams: any[]): void {\n this._evalLazyOptionalParams(optionalParams);\n type.call(console, (this._optionsService.options.logger ? '' : LOG_PREFIX) + message, ...optionalParams);\n }\n\n public trace(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.TRACE) {\n this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public debug(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.DEBUG) {\n this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, message, optionalParams);\n }\n }\n\n public info(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.INFO) {\n this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, message, optionalParams);\n }\n }\n\n public warn(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.WARN) {\n this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, message, optionalParams);\n }\n }\n\n public error(message: string, ...optionalParams: any[]): void {\n if (this._logLevel <= LogLevelEnum.ERROR) {\n this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, message, optionalParams);\n }\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICircularList } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport interface IInsertEvent {\n index: number;\n amount: number;\n}\n\nexport interface IDeleteEvent {\n index: number;\n amount: number;\n}\n\n/**\n * Represents a circular list; a list with a maximum size that wraps around when push is called,\n * overriding values at the start of the list.\n */\nexport class CircularList extends Disposable implements ICircularList {\n protected _array: (T | undefined)[];\n private _startIndex: number;\n private _length: number;\n\n public readonly onDeleteEmitter = this._register(new Emitter());\n public readonly onDelete = this.onDeleteEmitter.event;\n public readonly onInsertEmitter = this._register(new Emitter());\n public readonly onInsert = this.onInsertEmitter.event;\n public readonly onTrimEmitter = this._register(new Emitter());\n public readonly onTrim = this.onTrimEmitter.event;\n\n constructor(\n private _maxLength: number\n ) {\n super();\n this._array = new Array(this._maxLength);\n this._startIndex = 0;\n this._length = 0;\n }\n\n public get maxLength(): number {\n return this._maxLength;\n }\n\n public set maxLength(newMaxLength: number) {\n // There was no change in maxLength, return early.\n if (this._maxLength === newMaxLength) {\n return;\n }\n\n // Reconstruct array, starting at index 0. Only transfer values from the\n // indexes 0 to length.\n const newArray = new Array(newMaxLength);\n for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {\n newArray[i] = this._array[this._getCyclicIndex(i)];\n }\n this._array = newArray;\n this._maxLength = newMaxLength;\n this._startIndex = 0;\n }\n\n public get length(): number {\n return this._length;\n }\n\n public set length(newLength: number) {\n if (newLength > this._length) {\n for (let i = this._length; i < newLength; i++) {\n this._array[i] = undefined;\n }\n }\n this._length = newLength;\n }\n\n /**\n * Gets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index of the value to get.\n * @returns The value corresponding to the index.\n */\n public get(index: number): T | undefined {\n return this._array[this._getCyclicIndex(index)];\n }\n\n /**\n * Sets the value at an index.\n *\n * Note that for performance reasons there is no bounds checking here, the index reference is\n * circular so this should always return a value and never throw.\n * @param index The index to set.\n * @param value The value to set.\n */\n public set(index: number, value: T | undefined): void {\n this._array[this._getCyclicIndex(index)] = value;\n }\n\n /**\n * Pushes a new value onto the list, wrapping around to the start of the array, overriding index 0\n * if the maximum length is reached.\n * @param value The value to push onto the list.\n */\n public push(value: T): void {\n this._array[this._getCyclicIndex(this._length)] = value;\n if (this._length === this._maxLength) {\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n } else {\n this._length++;\n }\n }\n\n /**\n * Advance ringbuffer index and return current element for recycling.\n * Note: The buffer must be full for this method to work.\n * @throws When the buffer is not full.\n */\n public recycle(): T {\n if (this._length !== this._maxLength) {\n throw new Error('Can only recycle when the buffer is full');\n }\n this._startIndex = ++this._startIndex % this._maxLength;\n this.onTrimEmitter.fire(1);\n return this._array[this._getCyclicIndex(this._length - 1)]!;\n }\n\n /**\n * Ringbuffer is at max length.\n */\n public get isFull(): boolean {\n return this._length === this._maxLength;\n }\n\n /**\n * Removes and returns the last value on the list.\n * @returns The popped value.\n */\n public pop(): T | undefined {\n return this._array[this._getCyclicIndex(this._length-- - 1)];\n }\n\n /**\n * Deletes and/or inserts items at a particular index (in that order). Unlike\n * Array.prototype.splice, this operation does not return the deleted items as a new array in\n * order to save creating a new array. Note that this operation may shift all values in the list\n * in the worst case.\n * @param start The index to delete and/or insert.\n * @param deleteCount The number of elements to delete.\n * @param items The items to insert.\n */\n public splice(start: number, deleteCount: number, ...items: T[]): void {\n // Delete items\n if (deleteCount) {\n for (let i = start; i < this._length - deleteCount; i++) {\n this._array[this._getCyclicIndex(i)] = this._array[this._getCyclicIndex(i + deleteCount)];\n }\n this._length -= deleteCount;\n this.onDeleteEmitter.fire({ index: start, amount: deleteCount });\n }\n\n // Add items\n for (let i = this._length - 1; i >= start; i--) {\n this._array[this._getCyclicIndex(i + items.length)] = this._array[this._getCyclicIndex(i)];\n }\n for (let i = 0; i < items.length; i++) {\n this._array[this._getCyclicIndex(start + i)] = items[i];\n }\n if (items.length) {\n this.onInsertEmitter.fire({ index: start, amount: items.length });\n }\n\n // Adjust length as needed\n if (this._length + items.length > this._maxLength) {\n const countToTrim = (this._length + items.length) - this._maxLength;\n this._startIndex += countToTrim;\n this._length = this._maxLength;\n this.onTrimEmitter.fire(countToTrim);\n } else {\n this._length += items.length;\n }\n }\n\n /**\n * Trims a number of items from the start of the list.\n * @param count The number of items to remove.\n */\n public trimStart(count: number): void {\n if (count > this._length) {\n count = this._length;\n }\n this._startIndex += count;\n this._length -= count;\n this.onTrimEmitter.fire(count);\n }\n\n public shiftElements(start: number, count: number, offset: number): void {\n if (count <= 0) {\n return;\n }\n if (start < 0 || start >= this._length) {\n throw new Error('start argument out of range');\n }\n if (start + offset < 0) {\n throw new Error('Cannot shift elements in list beyond index 0');\n }\n\n if (offset > 0) {\n for (let i = count - 1; i >= 0; i--) {\n this.set(start + i + offset, this.get(start + i));\n }\n const expandListBy = (start + count + offset) - this._length;\n if (expandListBy > 0) {\n this._length += expandListBy;\n while (this._length > this._maxLength) {\n this._length--;\n this._startIndex++;\n this.onTrimEmitter.fire(1);\n }\n }\n } else {\n for (let i = 0; i < count; i++) {\n this.set(start + i + offset, this.get(start + i));\n }\n }\n }\n\n /**\n * Gets the cyclic index for the specified regular index. The cyclic index can then be used on the\n * backing array to get the element associated with the regular index.\n * @param index The regular index.\n * @returns The cyclic index.\n */\n private _getCyclicIndex(index: number): number {\n return (this._startIndex + index) % this._maxLength;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\nconst $workCell = new CellData();\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData ?? CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_MASK);\n }\n // return empty string for empty cells\n return '';\n }\n\n /** Get state of protected flag. */\n public isProtected(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG] & BgFlags.PROTECTED;\n }\n\n /**\n * Load data at `index` into `cell`. This is used to access cells in a way that's more friendly\n * to GC as it significantly reduced the amount of new objects/references needed.\n */\n public loadCell(index: number, cell: ICellData): ICellData {\n $startIndex = index * CELL_SIZE;\n cell.content = this._data[$startIndex + Cell.CONTENT];\n cell.fg = this._data[$startIndex + Cell.FG];\n cell.bg = this._data[$startIndex + Cell.BG];\n if (cell.content & Content.IS_COMBINED_MASK) {\n cell.combinedData = this._combined[index];\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n cell.extended = this._extendedAttrs[index]!;\n }\n return cell;\n }\n\n /**\n * Set data at `index` to `cell`.\n */\n public setCell(index: number, cell: ICellData): void {\n if (cell.content & Content.IS_COMBINED_MASK) {\n this._combined[index] = cell.combinedData;\n }\n if (cell.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = cell.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = cell.content;\n this._data[index * CELL_SIZE + Cell.FG] = cell.fg;\n this._data[index * CELL_SIZE + Cell.BG] = cell.bg;\n }\n\n /**\n * Set cell data from input handler.\n * Since the input handler see the incoming chars as UTF32 codepoints,\n * it gets an optimized access method.\n */\n public setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void {\n if (attrs.bg & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[index] = attrs.extended;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = codePoint | (width << Content.WIDTH_SHIFT);\n this._data[index * CELL_SIZE + Cell.FG] = attrs.fg;\n this._data[index * CELL_SIZE + Cell.BG] = attrs.bg;\n }\n\n /**\n * Add a codepoint to a cell from input handler.\n * During input stage combining chars with a width of 0 follow and stack\n * onto a leading char. Since we already set the attrs\n * by the previous `setDataFromCodePoint` call, we can omit it here.\n */\n public addCodepointToCell(index: number, codePoint: number, width: number): void {\n let content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n // we already have a combined string, simply add\n this._combined[index] += stringFromCodePoint(codePoint);\n } else {\n if (content & Content.CODEPOINT_MASK) {\n // normal case for combining chars:\n // - move current leading char + new one into combined string\n // - set combined flag\n this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);\n content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0\n content |= Content.IS_COMBINED_MASK;\n } else {\n // should not happen - we actually have no data in the cell yet\n // simply set the data in the cell buffer with a width of 1\n content = codePoint | (1 << Content.WIDTH_SHIFT);\n }\n }\n if (width) {\n content &= ~Content.WIDTH_MASK;\n content |= width << Content.WIDTH_SHIFT;\n }\n this._data[index * CELL_SIZE + Cell.CONTENT] = content;\n }\n\n public insertCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n\n // handle fullwidth at pos: reset cell one to the left if pos is second cell of a wide char\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n\n if (n < this.length - pos) {\n for (let i = this.length - pos - n - 1; i >= 0; --i) {\n this.setCell(pos + n + i, this.loadCell(pos + i, $workCell));\n }\n for (let i = 0; i < n; ++i) {\n this.setCell(pos + i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at line end: reset last cell if it is first cell of a wide char\n if (this.getWidth(this.length - 1) === 2) {\n this.setCellFromCodepoint(this.length - 1, 0, 1, fillCellData);\n }\n }\n\n public deleteCells(pos: number, n: number, fillCellData: ICellData): void {\n pos %= this.length;\n if (n < this.length - pos) {\n for (let i = 0; i < this.length - pos - n; ++i) {\n this.setCell(pos + i, this.loadCell(pos + n + i, $workCell));\n }\n for (let i = this.length - n; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n for (let i = pos; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n // handle fullwidth at pos:\n // - reset pos-1 if wide char\n // - reset pos if width==0 (previous second cell of a wide char)\n if (pos && this.getWidth(pos - 1) === 2) {\n this.setCellFromCodepoint(pos - 1, 0, 1, fillCellData);\n }\n if (this.getWidth(pos) === 0 && !this.hasContent(pos)) {\n this.setCellFromCodepoint(pos, 0, 1, fillCellData);\n }\n }\n\n public replaceCells(start: number, end: number, fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n if (start && this.getWidth(start - 1) === 2 && !this.isProtected(start - 1)) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n if (end < this.length && this.getWidth(end - 1) === 2 && !this.isProtected(end)) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n while (start < end && start < this.length) {\n if (!this.isProtected(start)) {\n this.setCell(start, fillCellData);\n }\n start++;\n }\n return;\n }\n\n // handle fullwidth at start: reset cell one to the left if start is second cell of a wide char\n if (start && this.getWidth(start - 1) === 2) {\n this.setCellFromCodepoint(start - 1, 0, 1, fillCellData);\n }\n // handle fullwidth at last cell + 1: reset to empty cell if it is second part of a wide char\n if (end < this.length && this.getWidth(end - 1) === 2) {\n this.setCellFromCodepoint(end, 0, 1, fillCellData);\n }\n\n while (start < end && start < this.length) {\n this.setCell(start++, fillCellData);\n }\n }\n\n /**\n * Resize BufferLine to `cols` filling excess cells with `fillCellData`.\n * The underlying array buffer will not change if there is still enough space\n * to hold the new buffer line data.\n * Returns a boolean indicating, whether a `cleanupMemory` call would free\n * excess memory (true after shrinking > CLEANUP_THRESHOLD).\n */\n public resize(cols: number, fillCellData: ICellData): boolean {\n if (cols === this.length) {\n return this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n const uint32Cells = cols * CELL_SIZE;\n if (cols > this.length) {\n if (this._data.buffer.byteLength >= uint32Cells * 4) {\n // optimization: avoid alloc and data copy if buffer has enough room\n this._data = new Uint32Array(this._data.buffer, 0, uint32Cells);\n } else {\n // slow path: new alloc and full data copy\n const data = new Uint32Array(uint32Cells);\n data.set(this._data);\n this._data = data;\n }\n for (let i = this.length; i < cols; ++i) {\n this.setCell(i, fillCellData);\n }\n } else {\n // optimization: just shrink the view on existing buffer\n this._data = this._data.subarray(0, uint32Cells);\n // Remove any cut off combined data\n const keys = Object.keys(this._combined);\n for (let i = 0; i < keys.length; i++) {\n const key = parseInt(keys[i], 10);\n if (key >= cols) {\n delete this._combined[key];\n }\n }\n // remove any cut off extended attributes\n const extKeys = Object.keys(this._extendedAttrs);\n for (let i = 0; i < extKeys.length; i++) {\n const key = parseInt(extKeys[i], 10);\n if (key >= cols) {\n delete this._extendedAttrs[key];\n }\n }\n }\n this.length = cols;\n return uint32Cells * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength;\n }\n\n /**\n * Cleanup underlying array buffer.\n * A cleanup will be triggered if the array buffer exceeds the actual used\n * memory by a factor of CLEANUP_THRESHOLD.\n * Returns 0 or 1 indicating whether a cleanup happened.\n */\n public cleanupMemory(): number {\n if (this._data.length * 4 * CLEANUP_THRESHOLD < this._data.buffer.byteLength) {\n const data = new Uint32Array(this._data.length);\n data.set(this._data);\n this._data = data;\n return 1;\n }\n return 0;\n }\n\n /** fill a line with fillCharData */\n public fill(fillCellData: ICellData, respectProtect: boolean = false): void {\n // full branching on respectProtect==true, hopefully getting fast JIT for standard case\n if (respectProtect) {\n for (let i = 0; i < this.length; ++i) {\n if (!this.isProtected(i)) {\n this.setCell(i, fillCellData);\n }\n }\n return;\n }\n this._combined = {};\n this._extendedAttrs = {};\n for (let i = 0; i < this.length; ++i) {\n this.setCell(i, fillCellData);\n }\n }\n\n /** alter to a full copy of line */\n public copyFrom(line: BufferLine): void {\n if (this.length !== line.length) {\n this._data = new Uint32Array(line._data);\n } else {\n // use high speed copy if lengths are equal\n this._data.set(line._data);\n }\n this.length = line.length;\n this._combined = {};\n for (const el in line._combined) {\n this._combined[el] = line._combined[el];\n }\n this._extendedAttrs = {};\n for (const el in line._extendedAttrs) {\n this._extendedAttrs[el] = line._extendedAttrs[el];\n }\n this.isWrapped = line.isWrapped;\n }\n\n /** create a new clone */\n public clone(): IBufferLine {\n const newLine = new BufferLine(0);\n newLine._data = new Uint32Array(this._data);\n newLine.length = this.length;\n for (const el in this._combined) {\n newLine._combined[el] = this._combined[el];\n }\n for (const el in this._extendedAttrs) {\n newLine._extendedAttrs[el] = this._extendedAttrs[el];\n }\n newLine.isWrapped = this.isWrapped;\n return newLine;\n }\n\n public getTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public getNoBgTrimmedLength(): number {\n for (let i = this.length - 1; i >= 0; --i) {\n if ((this._data[i * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK) || (this._data[i * CELL_SIZE + Cell.BG] & Attributes.CM_MASK)) {\n return i + (this._data[i * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT);\n }\n }\n return 0;\n }\n\n public copyCellsFrom(src: BufferLine, srcCol: number, destCol: number, length: number, applyInReverse: boolean): void {\n const srcData = src._data;\n if (applyInReverse) {\n for (let cell = length - 1; cell >= 0; cell--) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n } else {\n for (let cell = 0; cell < length; cell++) {\n for (let i = 0; i < CELL_SIZE; i++) {\n this._data[(destCol + cell) * CELL_SIZE + i] = srcData[(srcCol + cell) * CELL_SIZE + i];\n }\n if (srcData[(srcCol + cell) * CELL_SIZE + Cell.BG] & BgFlags.HAS_EXTENDED) {\n this._extendedAttrs[destCol + cell] = src._extendedAttrs[srcCol + cell];\n }\n }\n }\n\n // Move any combined data over as needed, FIXME: repeat for extended attrs\n const srcCombinedKeys = Object.keys(src._combined);\n for (let i = 0; i < srcCombinedKeys.length; i++) {\n const key = parseInt(srcCombinedKeys[i], 10);\n if (key >= srcCol) {\n this._combined[key - srcCol + destCol] = src._combined[key];\n }\n }\n }\n\n /**\n * Translates the buffer line to a string.\n *\n * @param trimRight Whether to trim any empty cells on the right.\n * @param startCol The column to start the string (0-based inclusive).\n * @param endCol The column to end the string (0-based exclusive).\n * @param outColumns if specified, this array will be filled with column numbers such that\n * `returnedString[i]` is displayed at `outColumns[i]` column. `outColumns[returnedString.length]`\n * is where the character following `returnedString` will be displayed.\n *\n * When a single cell is translated to multiple UTF-16 code units (e.g. surrogate pair) in the\n * returned string, the corresponding entries in `outColumns` will have the same column number.\n */\n public translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string {\n startCol = startCol ?? 0;\n endCol = endCol ?? this.length;\n if (trimRight) {\n endCol = Math.min(endCol, this.getTrimmedLength());\n }\n if (outColumns) {\n outColumns.length = 0;\n }\n let result = '';\n while (startCol < endCol) {\n const content = this._data[startCol * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n const chars = (content & Content.IS_COMBINED_MASK) ? this._combined[startCol] : (cp) ? stringFromCodePoint(cp) : WHITESPACE_CELL_CHAR;\n result += chars;\n if (outColumns) {\n for (let i = 0; i < chars.length; ++i) {\n outColumns.push(startCol);\n }\n }\n startCol += (content >> Content.WIDTH_SHIFT) || 1; // always advance by at least 1\n }\n if (outColumns) {\n outColumns.push(startCol);\n }\n return result;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { BufferLine } from 'common/buffer/BufferLine';\nimport { CircularList } from 'common/CircularList';\nimport { IBufferLine, ICellData } from 'common/Types';\n\nexport interface INewLayoutResult {\n layout: number[];\n countRemoved: number;\n}\n\n/**\n * Evaluates and returns indexes to be removed after a reflow larger occurs. Lines will be removed\n * when a wrapped line unwraps.\n * @param lines The buffer lines.\n * @param oldCols The columns before resize\n * @param newCols The columns after resize.\n * @param bufferAbsoluteY The absolute y position of the cursor (baseY + cursorY).\n * @param nullCell The cell data to use when filling in empty cells.\n * @param reflowCursorLine Whether to reflow the line containing the cursor.\n */\nexport function reflowLargerGetLinesToRemove(lines: CircularList, oldCols: number, newCols: number, bufferAbsoluteY: number, nullCell: ICellData, reflowCursorLine: boolean): number[] {\n // Gather all BufferLines that need to be removed from the Buffer here so that they can be\n // batched up and only committed once\n const toRemove: number[] = [];\n\n for (let y = 0; y < lines.length - 1; y++) {\n // Check if this row is wrapped\n let i = y;\n let nextLine = lines.get(++i) as BufferLine;\n if (!nextLine.isWrapped) {\n continue;\n }\n\n // Check how many lines it's wrapped for\n const wrappedLines: BufferLine[] = [lines.get(y) as BufferLine];\n while (i < lines.length && nextLine.isWrapped) {\n wrappedLines.push(nextLine);\n nextLine = lines.get(++i) as BufferLine;\n }\n\n if (!reflowCursorLine) {\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n if (bufferAbsoluteY >= y && bufferAbsoluteY < i) {\n y += wrappedLines.length - 1;\n continue;\n }\n }\n\n // Copy buffer data to new locations\n let destLineIndex = 0;\n let destCol = getWrappedLineTrimmedLength(wrappedLines, destLineIndex, oldCols);\n let srcLineIndex = 1;\n let srcCol = 0;\n while (srcLineIndex < wrappedLines.length) {\n const srcTrimmedTineLength = getWrappedLineTrimmedLength(wrappedLines, srcLineIndex, oldCols);\n const srcRemainingCells = srcTrimmedTineLength - srcCol;\n const destRemainingCells = newCols - destCol;\n const cellsToCopy = Math.min(srcRemainingCells, destRemainingCells);\n\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol, destCol, cellsToCopy, false);\n\n destCol += cellsToCopy;\n if (destCol === newCols) {\n destLineIndex++;\n destCol = 0;\n }\n srcCol += cellsToCopy;\n if (srcCol === srcTrimmedTineLength) {\n srcLineIndex++;\n srcCol = 0;\n }\n\n // Make sure the last cell isn't wide, if it is copy it to the current dest\n if (destCol === 0 && destLineIndex !== 0) {\n if (wrappedLines[destLineIndex - 1].getWidth(newCols - 1) === 2) {\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[destLineIndex - 1], newCols - 1, destCol++, 1, false);\n // Null out the end of the last row\n wrappedLines[destLineIndex - 1].setCell(newCols - 1, nullCell);\n }\n }\n }\n\n // Clear out remaining cells or fragments could remain;\n wrappedLines[destLineIndex].replaceCells(destCol, newCols, nullCell);\n\n // Work backwards and remove any rows at the end that only contain null cells\n let countToRemove = 0;\n for (let i = wrappedLines.length - 1; i > 0; i--) {\n if (i > destLineIndex || wrappedLines[i].getTrimmedLength() === 0) {\n countToRemove++;\n } else {\n break;\n }\n }\n\n if (countToRemove > 0) {\n toRemove.push(y + wrappedLines.length - countToRemove); // index\n toRemove.push(countToRemove);\n }\n\n y += wrappedLines.length - 1;\n }\n return toRemove;\n}\n\n/**\n * Creates and return the new layout for lines given an array of indexes to be removed.\n * @param lines The buffer lines.\n * @param toRemove The indexes to remove.\n */\nexport function reflowLargerCreateNewLayout(lines: CircularList, toRemove: number[]): INewLayoutResult {\n const layout: number[] = [];\n // First iterate through the list and get the actual indexes to use for rows\n let nextToRemoveIndex = 0;\n let nextToRemoveStart = toRemove[nextToRemoveIndex];\n let countRemovedSoFar = 0;\n for (let i = 0; i < lines.length; i++) {\n if (nextToRemoveStart === i) {\n const countToRemove = toRemove[++nextToRemoveIndex];\n\n // Tell markers that there was a deletion\n lines.onDeleteEmitter.fire({\n index: i - countRemovedSoFar,\n amount: countToRemove\n });\n\n i += countToRemove - 1;\n countRemovedSoFar += countToRemove;\n nextToRemoveStart = toRemove[++nextToRemoveIndex];\n } else {\n layout.push(i);\n }\n }\n return {\n layout,\n countRemoved: countRemovedSoFar\n };\n}\n\n/**\n * Applies a new layout to the buffer. This essentially does the same as many splice calls but it's\n * done all at once in a single iteration through the list since splice is very expensive.\n * @param lines The buffer lines.\n * @param newLayout The new layout to apply.\n */\nexport function reflowLargerApplyNewLayout(lines: CircularList, newLayout: number[]): void {\n // Record original lines so they don't get overridden when we rearrange the list\n const newLayoutLines: BufferLine[] = [];\n for (let i = 0; i < newLayout.length; i++) {\n newLayoutLines.push(lines.get(newLayout[i]) as BufferLine);\n }\n\n // Rearrange the list\n for (let i = 0; i < newLayoutLines.length; i++) {\n lines.set(i, newLayoutLines[i]);\n }\n lines.length = newLayout.length;\n}\n\n/**\n * Gets the new line lengths for a given wrapped line. The purpose of this function it to pre-\n * compute the wrapping points since wide characters may need to be wrapped onto the following line.\n * This function will return an array of numbers of where each line wraps to, the resulting array\n * will only contain the values `newCols` (when the line does not end with a wide character) and\n * `newCols - 1` (when the line does end with a wide character), except for the last value which\n * will contain the remaining items to fill the line.\n *\n * Calling this with a `newCols` value of `1` will lock up.\n *\n * @param wrappedLines The wrapped lines to evaluate.\n * @param oldCols The columns before resize.\n * @param newCols The columns after resize.\n */\nexport function reflowSmallerGetNewLineLengths(wrappedLines: BufferLine[], oldCols: number, newCols: number): number[] {\n const newLineLengths: number[] = [];\n const cellsNeeded = wrappedLines.map((l, i) => getWrappedLineTrimmedLength(wrappedLines, i, oldCols)).reduce((p, c) => p + c);\n\n // Use srcCol and srcLine to find the new wrapping point, use that to get the cellsAvailable and\n // linesNeeded\n let srcCol = 0;\n let srcLine = 0;\n let cellsAvailable = 0;\n while (cellsAvailable < cellsNeeded) {\n if (cellsNeeded - cellsAvailable < newCols) {\n // Add the final line and exit the loop\n newLineLengths.push(cellsNeeded - cellsAvailable);\n break;\n }\n srcCol += newCols;\n const oldTrimmedLength = getWrappedLineTrimmedLength(wrappedLines, srcLine, oldCols);\n if (srcCol > oldTrimmedLength) {\n srcCol -= oldTrimmedLength;\n srcLine++;\n }\n const endsWithWide = wrappedLines[srcLine].getWidth(srcCol - 1) === 2;\n if (endsWithWide) {\n srcCol--;\n }\n const lineLength = endsWithWide ? newCols - 1 : newCols;\n newLineLengths.push(lineLength);\n cellsAvailable += lineLength;\n }\n\n return newLineLengths;\n}\n\nexport function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number {\n // If this is the last row in the wrapped line, get the actual trimmed length\n if (i === lines.length - 1) {\n return lines[i].getTrimmedLength();\n }\n // Detect whether the following line starts with a wide character and the end of the current line\n // is null, if so then we can be pretty sure the null character should be excluded from the line\n // length]\n const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1;\n const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2;\n if (endsInNull && followingLineStartsWithWide) {\n return cols - 1;\n }\n return cols;\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable, IMarker } from 'common/Types';\nimport { Emitter } from 'common/Event';\nimport { dispose } from 'common/Lifecycle';\n\nexport class Marker implements IMarker {\n private static _nextId = 1;\n\n public isDisposed: boolean = false;\n private readonly _disposables: IDisposable[] = [];\n\n private readonly _id: number = Marker._nextId++;\n public get id(): number { return this._id; }\n\n private readonly _onDispose = this.register(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n constructor(\n public line: number\n ) {\n }\n\n public dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n this.line = -1;\n // Emit before super.dispose such that dispose listeners get a change to react\n this._onDispose.fire();\n dispose(this._disposables);\n this._disposables.length = 0;\n }\n\n public register(disposable: T): T {\n this._disposables.push(disposable);\n return disposable;\n }\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharset } from 'common/Types';\n\n/**\n * The character sets supported by the terminal. These enable several languages\n * to be represented within the terminal with only 8-bit encoding. See ISO 2022\n * for a discussion on character sets. Only VT100 character sets are supported.\n */\nexport const CHARSETS: { [key: string]: ICharset | undefined } = {};\n\n/**\n * The default character set, US.\n */\nexport const DEFAULT_CHARSET: ICharset | undefined = CHARSETS['B'];\n\n/**\n * DEC Special Character and Line Drawing Set.\n * Reference: http://vt100.net/docs/vt102-ug/table5-13.html\n * A lot of curses apps use this if they see TERM=xterm.\n * testing: echo -e '\\e(0a\\e(B'\n * The xterm output sometimes seems to conflict with the\n * reference above. xterm seems in line with the reference\n * when running vttest however.\n * The table below now uses xterm's output from vttest.\n */\nCHARSETS['0'] = {\n '`': '\\u25c6', // '\u25C6'\n 'a': '\\u2592', // '\u2592'\n 'b': '\\u2409', // '\u2409' (HT)\n 'c': '\\u240c', // '\u240C' (FF)\n 'd': '\\u240d', // '\u240D' (CR)\n 'e': '\\u240a', // '\u240A' (LF)\n 'f': '\\u00b0', // '\u00B0'\n 'g': '\\u00b1', // '\u00B1'\n 'h': '\\u2424', // '\u2424' (NL)\n 'i': '\\u240b', // '\u240B' (VT)\n 'j': '\\u2518', // '\u2518'\n 'k': '\\u2510', // '\u2510'\n 'l': '\\u250c', // '\u250C'\n 'm': '\\u2514', // '\u2514'\n 'n': '\\u253c', // '\u253C'\n 'o': '\\u23ba', // '\u23BA'\n 'p': '\\u23bb', // '\u23BB'\n 'q': '\\u2500', // '\u2500'\n 'r': '\\u23bc', // '\u23BC'\n 's': '\\u23bd', // '\u23BD'\n 't': '\\u251c', // '\u251C'\n 'u': '\\u2524', // '\u2524'\n 'v': '\\u2534', // '\u2534'\n 'w': '\\u252c', // '\u252C'\n 'x': '\\u2502', // '\u2502'\n 'y': '\\u2264', // '\u2264'\n 'z': '\\u2265', // '\u2265'\n '{': '\\u03c0', // '\u03C0'\n '|': '\\u2260', // '\u2260'\n '}': '\\u00a3', // '\u00A3'\n '~': '\\u00b7' // '\u00B7'\n};\n\n/**\n * British character set\n * ESC (A\n * Reference: http://vt100.net/docs/vt220-rm/table2-5.html\n */\nCHARSETS['A'] = {\n '#': '\u00A3'\n};\n\n/**\n * United States character set\n * ESC (B\n */\nCHARSETS['B'] = undefined;\n\n/**\n * Dutch character set\n * ESC (4\n * Reference: http://vt100.net/docs/vt220-rm/table2-6.html\n */\nCHARSETS['4'] = {\n '#': '\u00A3',\n '@': '\u00BE',\n '[': 'ij',\n '\\\\': '\u00BD',\n ']': '|',\n '{': '\u00A8',\n '|': 'f',\n '}': '\u00BC',\n '~': '\u00B4'\n};\n\n/**\n * Finnish character set\n * ESC (C or ESC (5\n * Reference: http://vt100.net/docs/vt220-rm/table2-7.html\n */\nCHARSETS['C'] =\nCHARSETS['5'] = {\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * French character set\n * ESC (R\n * Reference: http://vt100.net/docs/vt220-rm/table2-8.html\n */\nCHARSETS['R'] = {\n '#': '\u00A3',\n '@': '\u00E0',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00A7',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00A8'\n};\n\n/**\n * French Canadian character set\n * ESC (Q\n * Reference: http://vt100.net/docs/vt220-rm/table2-9.html\n */\nCHARSETS['Q'] = {\n '@': '\u00E0',\n '[': '\u00E2',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n '`': '\u00F4',\n '{': '\u00E9',\n '|': '\u00F9',\n '}': '\u00E8',\n '~': '\u00FB'\n};\n\n/**\n * German character set\n * ESC (K\n * Reference: http://vt100.net/docs/vt220-rm/table2-10.html\n */\nCHARSETS['K'] = {\n '@': '\u00A7',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00DC',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00DF'\n};\n\n/**\n * Italian character set\n * ESC (Y\n * Reference: http://vt100.net/docs/vt220-rm/table2-11.html\n */\nCHARSETS['Y'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00B0',\n '\\\\': '\u00E7',\n ']': '\u00E9',\n '`': '\u00F9',\n '{': '\u00E0',\n '|': '\u00F2',\n '}': '\u00E8',\n '~': '\u00EC'\n};\n\n/**\n * Norwegian/Danish character set\n * ESC (E or ESC (6\n * Reference: http://vt100.net/docs/vt220-rm/table2-12.html\n */\nCHARSETS['E'] =\nCHARSETS['6'] = {\n '@': '\u00C4',\n '[': '\u00C6',\n '\\\\': '\u00D8',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E4',\n '{': '\u00E6',\n '|': '\u00F8',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Spanish character set\n * ESC (Z\n * Reference: http://vt100.net/docs/vt220-rm/table2-13.html\n */\nCHARSETS['Z'] = {\n '#': '\u00A3',\n '@': '\u00A7',\n '[': '\u00A1',\n '\\\\': '\u00D1',\n ']': '\u00BF',\n '{': '\u00B0',\n '|': '\u00F1',\n '}': '\u00E7'\n};\n\n/**\n * Swedish character set\n * ESC (H or ESC (7\n * Reference: http://vt100.net/docs/vt220-rm/table2-14.html\n */\nCHARSETS['H'] =\nCHARSETS['7'] = {\n '@': '\u00C9',\n '[': '\u00C4',\n '\\\\': '\u00D6',\n ']': '\u00C5',\n '^': '\u00DC',\n '`': '\u00E9',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00E5',\n '~': '\u00FC'\n};\n\n/**\n * Swiss character set\n * ESC (=\n * Reference: http://vt100.net/docs/vt220-rm/table2-15.html\n */\nCHARSETS['='] = {\n '#': '\u00F9',\n '@': '\u00E0',\n '[': '\u00E9',\n '\\\\': '\u00E7',\n ']': '\u00EA',\n '^': '\u00EE',\n\n '_': '\u00E8',\n '`': '\u00F4',\n '{': '\u00E4',\n '|': '\u00F6',\n '}': '\u00FC',\n '~': '\u00FB'\n};\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CircularList, IInsertEvent } from 'common/CircularList';\nimport { IdleTaskQueue } from 'common/TaskQueue';\nimport { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/Types';\nimport { ExtendedAttrs } from 'common/buffer/AttributeData';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'common/buffer/BufferReflow';\nimport { CellData } from 'common/buffer/CellData';\nimport { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE, WHITESPACE_CELL_WIDTH } from 'common/buffer/Constants';\nimport { Marker } from 'common/buffer/Marker';\nimport { IBuffer } from 'common/buffer/Types';\nimport { DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\n\nexport const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1\n\n/**\n * This class represents a terminal buffer (an internal state of the terminal), where the\n * following information is stored (in high-level):\n * - text content of this particular buffer\n * - cursor position\n * - scroll position\n */\nexport class Buffer implements IBuffer {\n public lines: CircularList;\n public ydisp: number = 0;\n public ybase: number = 0;\n public y: number = 0;\n public x: number = 0;\n public scrollBottom: number;\n public scrollTop: number;\n public tabs: { [column: number]: boolean | undefined } = {};\n public savedY: number = 0;\n public savedX: number = 0;\n public savedCurAttrData = DEFAULT_ATTR_DATA.clone();\n public savedCharset: ICharset | undefined = DEFAULT_CHARSET;\n public savedCharsets: (ICharset | undefined)[] = [];\n public savedGlevel: number = 0;\n public savedOriginMode: boolean = false;\n public savedWraparoundMode: boolean = true;\n public markers: Marker[] = [];\n private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]);\n private _cols: number;\n private _rows: number;\n private _isClearing: boolean = false;\n\n constructor(\n private _hasScrollback: boolean,\n private _optionsService: IOptionsService,\n private _bufferService: IBufferService\n ) {\n this._cols = this._bufferService.cols;\n this._rows = this._bufferService.rows;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n public getNullCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._nullCell.fg = attr.fg;\n this._nullCell.bg = attr.bg;\n this._nullCell.extended = attr.extended;\n } else {\n this._nullCell.fg = 0;\n this._nullCell.bg = 0;\n this._nullCell.extended = new ExtendedAttrs();\n }\n return this._nullCell;\n }\n\n public getWhitespaceCell(attr?: IAttributeData): ICellData {\n if (attr) {\n this._whitespaceCell.fg = attr.fg;\n this._whitespaceCell.bg = attr.bg;\n this._whitespaceCell.extended = attr.extended;\n } else {\n this._whitespaceCell.fg = 0;\n this._whitespaceCell.bg = 0;\n this._whitespaceCell.extended = new ExtendedAttrs();\n }\n return this._whitespaceCell;\n }\n\n public getBlankLine(attr: IAttributeData, isWrapped?: boolean): IBufferLine {\n return new BufferLine(this._bufferService.cols, this.getNullCell(attr), isWrapped);\n }\n\n public get hasScrollback(): boolean {\n return this._hasScrollback && this.lines.maxLength > this._rows;\n }\n\n public get isCursorInViewport(): boolean {\n const absoluteY = this.ybase + this.y;\n const relativeY = absoluteY - this.ydisp;\n return (relativeY >= 0 && relativeY < this._rows);\n }\n\n /**\n * Gets the correct buffer length based on the rows provided, the terminal's\n * scrollback and whether this buffer is flagged to have scrollback or not.\n * @param rows The terminal rows to use in the calculation.\n */\n private _getCorrectBufferLength(rows: number): number {\n if (!this._hasScrollback) {\n return rows;\n }\n\n const correctBufferLength = rows + this._optionsService.rawOptions.scrollback;\n\n return correctBufferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBufferLength;\n }\n\n /**\n * Fills the buffer's viewport with blank lines.\n */\n public fillViewportRows(fillAttr?: IAttributeData): void {\n if (this.lines.length === 0) {\n fillAttr ??= DEFAULT_ATTR_DATA;\n let i = this._rows;\n while (i--) {\n this.lines.push(this.getBlankLine(fillAttr));\n }\n }\n }\n\n /**\n * Clears the buffer to it's initial state, discarding all previous data.\n */\n public clear(): void {\n this.ydisp = 0;\n this.ybase = 0;\n this.y = 0;\n this.x = 0;\n this.lines = new CircularList(this._getCorrectBufferLength(this._rows));\n this.scrollTop = 0;\n this.scrollBottom = this._rows - 1;\n this.setupTabStops();\n }\n\n /**\n * Resizes the buffer, adjusting its data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n\n // count bufferlines with overly big memory to be cleaned afterwards\n let dirtyMemoryLines = 0;\n\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n\n // if (this._cols > newCols) {\n // console.log('increase!');\n // }\n\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.rawOptions.windowsPty.backend !== undefined || this._optionsService.rawOptions.windowsPty.buildNumber !== undefined) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n } else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n } else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n } else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n } else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n\n this.scrollTop = 0;\n }\n\n this.scrollBottom = newRows - 1;\n\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n // +boolean for fast 0 or 1 conversion\n dirtyMemoryLines += +this.lines.get(i)!.resize(newCols, nullCell);\n }\n }\n }\n\n this._cols = newCols;\n this._rows = newRows;\n\n // Ensure the cursor position invariant: ybase + y must be within buffer bounds\n // This can be violated during reflow or when shrinking rows\n if (this.lines.length > 0) {\n const maxY = Math.max(0, this.lines.length - this.ybase - 1);\n this.y = Math.min(this.y, maxY);\n }\n\n this._memoryCleanupQueue.clear();\n // schedule memory cleanup only, if more than 10% of the lines are affected\n if (dirtyMemoryLines > 0.1 * this.lines.length) {\n this._memoryCleanupPosition = 0;\n this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup());\n }\n }\n\n private _memoryCleanupQueue = new IdleTaskQueue();\n private _memoryCleanupPosition = 0;\n\n private _batchedMemoryCleanup(): boolean {\n let normalRun = true;\n if (this._memoryCleanupPosition >= this.lines.length) {\n // cleanup made it once through all lines, thus rescan in loop below to also catch shifted\n // lines, which should finish rather quick if there are no more cleanups pending\n this._memoryCleanupPosition = 0;\n normalRun = false;\n }\n let counted = 0;\n while (this._memoryCleanupPosition < this.lines.length) {\n counted += this.lines.get(this._memoryCleanupPosition++)!.cleanupMemory();\n // cleanup max 100 lines per batch\n if (counted > 100) {\n return true;\n }\n }\n // normal runs always need another rescan afterwards\n // if we made it here with normalRun=false, we are in a final run\n // and can end the cleanup task for sure\n return normalRun;\n }\n\n private get _isReflowEnabled(): boolean {\n const windowsPty = this._optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber) {\n return this._hasScrollback && windowsPty.backend === 'conpty' && windowsPty.buildNumber >= 21376;\n }\n return this._hasScrollback;\n }\n\n private _reflow(newCols: number, newRows: number): void {\n if (this._cols === newCols) {\n return;\n }\n\n // Iterate through rows, ignore the last one as it cannot be wrapped\n if (newCols > this._cols) {\n this._reflowLarger(newCols, newRows);\n } else {\n this._reflowSmaller(newCols, newRows);\n }\n }\n\n private _reflowLarger(newCols: number, newRows: number): void {\n const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;\n const toRemove: number[] = reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(DEFAULT_ATTR_DATA), reflowCursorLine);\n if (toRemove.length > 0) {\n const newLayoutResult = reflowLargerCreateNewLayout(this.lines, toRemove);\n reflowLargerApplyNewLayout(this.lines, newLayoutResult.layout);\n this._reflowLargerAdjustViewport(newCols, newRows, newLayoutResult.countRemoved);\n }\n }\n\n private _reflowLargerAdjustViewport(newCols: number, newRows: number, countRemoved: number): void {\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Adjust viewport based on number of items removed\n let viewportAdjustments = countRemoved;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y > 0) {\n this.y--;\n }\n if (this.lines.length < newRows) {\n // Add an extra row at the bottom of the viewport\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n } else {\n if (this.ydisp === this.ybase) {\n this.ydisp--;\n }\n this.ybase--;\n }\n }\n this.savedY = Math.max(this.savedY - countRemoved, 0);\n }\n\n private _reflowSmaller(newCols: number, newRows: number): void {\n const reflowCursorLine = this._optionsService.rawOptions.reflowCursorLine;\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Gather all BufferLines that need to be inserted into the Buffer here so that they can be\n // batched up and only committed once\n const toInsert = [];\n let countToInsert = 0;\n // Go backwards as many lines may be trimmed and this will avoid considering them\n for (let y = this.lines.length - 1; y >= 0; y--) {\n // Check whether this line is a problem\n let nextLine = this.lines.get(y) as BufferLine;\n if (!nextLine || !nextLine.isWrapped && nextLine.getTrimmedLength() <= newCols) {\n continue;\n }\n\n // Gather wrapped lines and adjust y to be the starting line\n const wrappedLines: BufferLine[] = [nextLine];\n while (nextLine.isWrapped && y > 0) {\n nextLine = this.lines.get(--y) as BufferLine;\n wrappedLines.unshift(nextLine);\n }\n\n if (!reflowCursorLine) {\n // If these lines contain the cursor don't touch them, the program will handle fixing up\n // wrapped lines with the cursor\n const absoluteY = this.ybase + this.y;\n if (absoluteY >= y && absoluteY < y + wrappedLines.length) {\n continue;\n }\n }\n\n const lastLineLength = wrappedLines[wrappedLines.length - 1].getTrimmedLength();\n const destLineLengths = reflowSmallerGetNewLineLengths(wrappedLines, this._cols, newCols);\n const linesToAdd = destLineLengths.length - wrappedLines.length;\n let trimmedLines: number;\n if (this.ybase === 0 && this.y !== this.lines.length - 1) {\n // If the top section of the buffer is not yet filled\n trimmedLines = Math.max(0, this.y - this.lines.maxLength + linesToAdd);\n } else {\n trimmedLines = Math.max(0, this.lines.length - this.lines.maxLength + linesToAdd);\n }\n\n // Add the new lines\n const newLines: BufferLine[] = [];\n for (let i = 0; i < linesToAdd; i++) {\n const newLine = this.getBlankLine(DEFAULT_ATTR_DATA, true) as BufferLine;\n newLines.push(newLine);\n }\n if (newLines.length > 0) {\n toInsert.push({\n // countToInsert here gets the actual index, taking into account other inserted items.\n // using this we can iterate through the list forwards\n start: y + wrappedLines.length + countToInsert,\n newLines\n });\n countToInsert += newLines.length;\n }\n wrappedLines.push(...newLines);\n\n // Copy buffer data to new locations, this needs to happen backwards to do in-place\n let destLineIndex = destLineLengths.length - 1; // Math.floor(cellsNeeded / newCols);\n let destCol = destLineLengths[destLineIndex]; // cellsNeeded % newCols;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n let srcLineIndex = wrappedLines.length - linesToAdd - 1;\n let srcCol = lastLineLength;\n while (srcLineIndex >= 0) {\n const cellsToCopy = Math.min(srcCol, destCol);\n if (wrappedLines[destLineIndex] === undefined) {\n // Sanity check that the line exists, this has been known to fail for an unknown reason\n // which would stop the reflow from happening if an exception would throw.\n break;\n }\n wrappedLines[destLineIndex].copyCellsFrom(wrappedLines[srcLineIndex], srcCol - cellsToCopy, destCol - cellsToCopy, cellsToCopy, true);\n destCol -= cellsToCopy;\n if (destCol === 0) {\n destLineIndex--;\n destCol = destLineLengths[destLineIndex];\n }\n srcCol -= cellsToCopy;\n if (srcCol === 0) {\n srcLineIndex--;\n const wrappedLinesIndex = Math.max(srcLineIndex, 0);\n srcCol = getWrappedLineTrimmedLength(wrappedLines, wrappedLinesIndex, this._cols);\n }\n }\n\n // Null out the end of the line ends if a wide character wrapped to the following line\n for (let i = 0; i < wrappedLines.length; i++) {\n if (destLineLengths[i] < newCols) {\n wrappedLines[i].setCell(destLineLengths[i], nullCell);\n }\n }\n\n // Adjust viewport as needed\n let viewportAdjustments = linesToAdd - trimmedLines;\n while (viewportAdjustments-- > 0) {\n if (this.ybase === 0) {\n if (this.y < newRows - 1) {\n this.y++;\n this.lines.pop();\n } else {\n this.ybase++;\n this.ydisp++;\n }\n } else {\n // Ensure ybase does not exceed its maximum value\n if (this.ybase < Math.min(this.lines.maxLength, this.lines.length + countToInsert) - newRows) {\n if (this.ybase === this.ydisp) {\n this.ydisp++;\n }\n this.ybase++;\n }\n }\n }\n this.savedY = Math.min(this.savedY + linesToAdd, this.ybase + newRows - 1);\n }\n\n // Rearrange lines in the buffer if there are any insertions, this is done at the end rather\n // than earlier so that it's a single O(n) pass through the buffer, instead of O(n^2) from many\n // costly calls to CircularList.splice.\n if (toInsert.length > 0) {\n // Record buffer insert events and then play them back backwards so that the indexes are\n // correct\n const insertEvents: IInsertEvent[] = [];\n\n // Record original lines so they don't get overridden when we rearrange the list\n const originalLines: BufferLine[] = [];\n for (let i = 0; i < this.lines.length; i++) {\n originalLines.push(this.lines.get(i) as BufferLine);\n }\n const originalLinesLength = this.lines.length;\n\n let originalLineIndex = originalLinesLength - 1;\n let nextToInsertIndex = 0;\n let nextToInsert = toInsert[nextToInsertIndex];\n this.lines.length = Math.min(this.lines.maxLength, this.lines.length + countToInsert);\n let countInsertedSoFar = 0;\n for (let i = Math.min(this.lines.maxLength - 1, originalLinesLength + countToInsert - 1); i >= 0; i--) {\n if (nextToInsert && nextToInsert.start > originalLineIndex + countInsertedSoFar) {\n // Insert extra lines here, adjusting i as needed\n for (let nextI = nextToInsert.newLines.length - 1; nextI >= 0; nextI--) {\n this.lines.set(i--, nextToInsert.newLines[nextI]);\n }\n i++;\n\n // Create insert events for later\n insertEvents.push({\n index: originalLineIndex + 1,\n amount: nextToInsert.newLines.length\n });\n\n countInsertedSoFar += nextToInsert.newLines.length;\n nextToInsert = toInsert[++nextToInsertIndex];\n } else {\n this.lines.set(i, originalLines[originalLineIndex--]);\n }\n }\n\n // Update markers\n let insertCountEmitted = 0;\n for (let i = insertEvents.length - 1; i >= 0; i--) {\n insertEvents[i].index += insertCountEmitted;\n this.lines.onInsertEmitter.fire(insertEvents[i]);\n insertCountEmitted += insertEvents[i].amount;\n }\n const amountToTrim = Math.max(0, originalLinesLength + countToInsert - this.lines.maxLength);\n if (amountToTrim > 0) {\n this.lines.onTrimEmitter.fire(amountToTrim);\n }\n }\n }\n\n /**\n * Translates a buffer line to a string, with optional start and end columns.\n * Wide characters will count as two columns in the resulting string. This\n * function is useful for getting the actual text underneath the raw selection\n * position.\n * @param lineIndex The absolute index of the line being translated.\n * @param trimRight Whether to trim whitespace to the right.\n * @param startCol The column to start at.\n * @param endCol The column to end at.\n */\n public translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol: number = 0, endCol?: number): string {\n const line = this.lines.get(lineIndex);\n if (!line) {\n return '';\n }\n return line.translateToString(trimRight, startCol, endCol);\n }\n\n public getWrappedRangeForLine(y: number): { first: number, last: number } {\n let first = y;\n let last = y;\n // Scan upwards for wrapped lines\n while (first > 0 && this.lines.get(first)!.isWrapped) {\n first--;\n }\n // Scan downwards for wrapped lines\n while (last + 1 < this.lines.length && this.lines.get(last + 1)!.isWrapped) {\n last++;\n }\n return { first, last };\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n if (i !== null && i !== undefined) {\n if (!this.tabs[i]) {\n i = this.prevStop(i);\n }\n } else {\n this.tabs = {};\n i = 0;\n }\n\n for (; i < this._cols; i += this._optionsService.rawOptions.tabStopWidth) {\n this.tabs[i] = true;\n }\n }\n\n /**\n * Move the cursor to the previous tab stop from the given position (default is current).\n * @param x The position to move the cursor to the previous tab stop.\n */\n public prevStop(x?: number): number {\n x ??= this.x;\n while (!this.tabs[--x] && x > 0);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Move the cursor one tab stop forward from the given position (default is current).\n * @param x The position to move the cursor one tab stop forward.\n */\n public nextStop(x?: number): number {\n x ??= this.x;\n while (!this.tabs[++x] && x < this._cols);\n return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;\n }\n\n /**\n * Clears markers on single line.\n * @param y The line to clear.\n */\n public clearMarkers(y: number): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].line === y) {\n this.markers[i].dispose();\n this.markers.splice(i--, 1);\n }\n }\n this._isClearing = false;\n }\n\n /**\n * Clears markers on all lines\n */\n public clearAllMarkers(): void {\n this._isClearing = true;\n for (let i = 0; i < this.markers.length; i++) {\n this.markers[i].dispose();\n }\n this.markers.length = 0;\n this._isClearing = false;\n }\n\n public addMarker(y: number): Marker {\n const marker = new Marker(y);\n this.markers.push(marker);\n marker.register(this.lines.onTrim(amount => {\n marker.line -= amount;\n // The marker should be disposed when the line is trimmed from the buffer\n if (marker.line < 0) {\n marker.dispose();\n }\n }));\n marker.register(this.lines.onInsert(event => {\n if (marker.line >= event.index) {\n marker.line += event.amount;\n }\n }));\n marker.register(this.lines.onDelete(event => {\n // Delete the marker if it's within the range\n if (marker.line >= event.index && marker.line < event.index + event.amount) {\n marker.dispose();\n }\n\n // Shift the marker if it's after the deleted range\n if (marker.line > event.index) {\n marker.line -= event.amount;\n }\n }));\n marker.register(marker.onDispose(() => this._removeMarker(marker)));\n return marker;\n }\n\n private _removeMarker(marker: Marker): void {\n if (!this._isClearing) {\n this.markers.splice(this.markers.indexOf(marker), 1);\n }\n }\n}\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData } from 'common/Types';\nimport { Buffer } from 'common/buffer/Buffer';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\n/**\n * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and\n * provides also utilities for working with them.\n */\nexport class BufferSet extends Disposable implements IBufferSet {\n private _normal!: Buffer;\n private _alt!: Buffer;\n private _activeBuffer!: Buffer;\n\n private readonly _onBufferActivate = this._register(new Emitter<{ activeBuffer: IBuffer, inactiveBuffer: IBuffer }>());\n public readonly onBufferActivate = this._onBufferActivate.event;\n\n /**\n * Create a new BufferSet for the given terminal.\n */\n constructor(\n private readonly _optionsService: IOptionsService,\n private readonly _bufferService: IBufferService\n ) {\n super();\n this.reset();\n this._register(this._optionsService.onSpecificOptionChange('scrollback', () => this.resize(this._bufferService.cols, this._bufferService.rows)));\n this._register(this._optionsService.onSpecificOptionChange('tabStopWidth', () => this.setupTabStops()));\n }\n\n public reset(): void {\n this._normal = new Buffer(true, this._optionsService, this._bufferService);\n this._normal.fillViewportRows();\n\n // The alt buffer should never have scrollback.\n // See http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer\n this._alt = new Buffer(false, this._optionsService, this._bufferService);\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n\n this.setupTabStops();\n }\n\n /**\n * Returns the alt Buffer of the BufferSet\n */\n public get alt(): Buffer {\n return this._alt;\n }\n\n /**\n * Returns the currently active Buffer of the BufferSet\n */\n public get active(): Buffer {\n return this._activeBuffer;\n }\n\n /**\n * Returns the normal Buffer of the BufferSet\n */\n public get normal(): Buffer {\n return this._normal;\n }\n\n /**\n * Sets the normal Buffer of the BufferSet as its currently active Buffer\n */\n public activateNormalBuffer(): void {\n if (this._activeBuffer === this._normal) {\n return;\n }\n this._normal.x = this._alt.x;\n this._normal.y = this._alt.y;\n // The alt buffer should always be cleared when we switch to the normal\n // buffer. This frees up memory since the alt buffer should always be new\n // when activated.\n this._alt.clearAllMarkers();\n this._alt.clear();\n this._activeBuffer = this._normal;\n this._onBufferActivate.fire({\n activeBuffer: this._normal,\n inactiveBuffer: this._alt\n });\n }\n\n /**\n * Sets the alt Buffer of the BufferSet as its currently active Buffer\n */\n public activateAltBuffer(fillAttr?: IAttributeData): void {\n if (this._activeBuffer === this._alt) {\n return;\n }\n // Since the alt buffer is always cleared when the normal buffer is\n // activated, we want to fill it when switching to it.\n this._alt.fillViewportRows(fillAttr);\n this._alt.x = this._normal.x;\n this._alt.y = this._normal.y;\n this._activeBuffer = this._alt;\n this._onBufferActivate.fire({\n activeBuffer: this._alt,\n inactiveBuffer: this._normal\n });\n }\n\n /**\n * Resizes both normal and alt buffers, adjusting their data accordingly.\n * @param newCols The new number of columns.\n * @param newRows The new number of rows.\n */\n public resize(newCols: number, newRows: number): void {\n this._normal.resize(newCols, newRows);\n this._alt.resize(newCols, newRows);\n this.setupTabStops(newCols);\n }\n\n /**\n * Setup the tab stops.\n * @param i The index to start setting up tab stops from.\n */\n public setupTabStops(i?: number): void {\n this._normal.setupTabStops(i);\n this._alt.setupTabStops(i);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { IAttributeData, IBufferLine } from 'common/Types';\nimport { BufferSet } from 'common/buffer/BufferSet';\nimport { IBuffer, IBufferSet } from 'common/buffer/Types';\nimport { IBufferService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars\nexport const MINIMUM_ROWS = 1;\n\nexport class BufferService extends Disposable implements IBufferService {\n public serviceBrand: any;\n\n public cols: number;\n public rows: number;\n public buffers: IBufferSet;\n /** Whether the user is scrolling (locks the scroll position) */\n public isUserScrolling: boolean = false;\n\n private readonly _onResize = this._register(new Emitter());\n public readonly onResize = this._onResize.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n\n public get buffer(): IBuffer { return this.buffers.active; }\n\n /** An IBufferline to clone/copy from for new blank lines */\n private _cachedBlankLine: IBufferLine | undefined;\n\n constructor(@IOptionsService optionsService: IOptionsService) {\n super();\n this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);\n this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);\n this.buffers = this._register(new BufferSet(optionsService, this));\n this._register(this.buffers.onBufferActivate(e => {\n this._onScroll.fire(e.activeBuffer.ydisp);\n }));\n }\n\n public resize(cols: number, rows: number): void {\n const colsChanged = this.cols !== cols;\n const rowsChanged = this.rows !== rows;\n this.cols = cols;\n this.rows = rows;\n this.buffers.resize(cols, rows);\n this._onResize.fire({ cols, rows, colsChanged, rowsChanged });\n }\n\n public reset(): void {\n this.buffers.reset();\n this.isUserScrolling = false;\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n const buffer = this.buffer;\n\n let newLine: IBufferLine | undefined;\n newLine = this._cachedBlankLine;\n if (!newLine || newLine.length !== this.cols || newLine.getFg(0) !== eraseAttr.fg || newLine.getBg(0) !== eraseAttr.bg) {\n newLine = buffer.getBlankLine(eraseAttr, isWrapped);\n this._cachedBlankLine = newLine;\n }\n newLine.isWrapped = isWrapped;\n\n const topRow = buffer.ybase + buffer.scrollTop;\n const bottomRow = buffer.ybase + buffer.scrollBottom;\n\n if (buffer.scrollTop === 0) {\n // Determine whether the buffer is going to be trimmed after insertion.\n const willBufferBeTrimmed = buffer.lines.isFull;\n\n // Insert the line using the fastest method\n if (bottomRow === buffer.lines.length - 1) {\n if (willBufferBeTrimmed) {\n buffer.lines.recycle().copyFrom(newLine);\n } else {\n buffer.lines.push(newLine.clone());\n }\n } else {\n buffer.lines.splice(bottomRow + 1, 0, newLine.clone());\n }\n\n // Only adjust ybase and ydisp when the buffer is not trimmed\n if (!willBufferBeTrimmed) {\n buffer.ybase++;\n // Only scroll the ydisp with ybase if the user has not scrolled up\n if (!this.isUserScrolling) {\n buffer.ydisp++;\n }\n } else {\n // When the buffer is full and the user has scrolled up, keep the text\n // stable unless ydisp is right at the top\n if (this.isUserScrolling) {\n buffer.ydisp = Math.max(buffer.ydisp - 1, 0);\n }\n }\n } else {\n // scrollTop is non-zero which means no line will be going to the\n // scrollback, instead we can just shift them in-place.\n const scrollRegionHeight = bottomRow - topRow + 1 /* as it's zero-based */;\n buffer.lines.shiftElements(topRow + 1, scrollRegionHeight - 1, -1);\n buffer.lines.set(bottomRow, newLine.clone());\n }\n\n // Move the viewport to the bottom of the buffer unless the user is\n // scrolling.\n if (!this.isUserScrolling) {\n buffer.ydisp = buffer.ybase;\n }\n\n this._onScroll.fire(buffer.ydisp);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used\n * to avoid unwanted events being handled by the viewport when the event was triggered from the\n * viewport originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n const buffer = this.buffer;\n if (disp < 0) {\n if (buffer.ydisp === 0) {\n return;\n }\n this.isUserScrolling = true;\n } else if (disp + buffer.ydisp >= buffer.ybase) {\n this.isUserScrolling = false;\n }\n\n const oldYdisp = buffer.ydisp;\n buffer.ydisp = Math.max(Math.min(buffer.ydisp + disp, buffer.ybase), 0);\n\n // No change occurred, don't trigger scroll/refresh\n if (oldYdisp === buffer.ydisp) {\n return;\n }\n\n if (!suppressScrollEvent) {\n this._onScroll.fire(buffer.ydisp);\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { isMac } from 'common/Platform';\nimport { CursorStyle, IDisposable } from 'common/Types';\nimport { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport const DEFAULT_OPTIONS: Readonly> = {\n cols: 80,\n rows: 24,\n showCursorImmediately: false,\n cursorBlink: false,\n cursorStyle: 'block',\n cursorWidth: 1,\n cursorInactiveStyle: 'outline',\n drawBoldTextInBrightColors: true,\n documentOverride: null,\n fastScrollSensitivity: 5,\n fontFamily: 'monospace',\n fontSize: 15,\n fontWeight: 'normal',\n fontWeightBold: 'bold',\n ignoreBracketedPasteMode: false,\n lineHeight: 1.0,\n letterSpacing: 0,\n linkHandler: null,\n logLevel: 'info',\n logger: null,\n scrollback: 1000,\n scrollOnEraseInDisplay: false,\n scrollOnUserInput: true,\n scrollSensitivity: 1,\n screenReaderMode: false,\n smoothScrollDuration: 0,\n macOptionIsMeta: false,\n macOptionClickForcesSelection: false,\n minimumContrastRatio: 1,\n disableStdin: false,\n allowProposedApi: false,\n allowTransparency: false,\n tabStopWidth: 8,\n theme: {},\n reflowCursorLine: false,\n rescaleOverlappingGlyphs: false,\n rightClickSelectsWord: isMac,\n windowOptions: {},\n windowsPty: {},\n wordSeparator: ' ()[]{}\\',\"`',\n altClickMovesCursor: true,\n convertEol: false,\n termName: 'xterm',\n overviewRuler: {},\n quirks: {},\n vtExtensions: {}\n};\n\nconst FONT_WEIGHT_OPTIONS: Extract[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];\n\nexport class OptionsService extends Disposable implements IOptionsService {\n public serviceBrand: any;\n\n public readonly rawOptions: Required;\n public options: Required;\n\n private readonly _onOptionChange = this._register(new Emitter());\n public readonly onOptionChange = this._onOptionChange.event;\n\n constructor(options: Partial) {\n super();\n // set the default value of each option\n const defaultOptions = { ...DEFAULT_OPTIONS };\n for (const key in options) {\n if (key in defaultOptions) {\n try {\n const newValue = options[key];\n defaultOptions[key] = this._sanitizeAndValidateOption(key, newValue);\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n // set up getters and setters for each option\n this.rawOptions = defaultOptions;\n this.options = { ... defaultOptions };\n this._setupOptions();\n\n // Clear out options that could link outside xterm.js as they could easily cause an embedder\n // memory leak\n this._register(toDisposable(() => {\n this.rawOptions.linkHandler = null;\n this.rawOptions.documentOverride = null;\n }));\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onSpecificOptionChange(key: T, listener: (value: ITerminalOptions[T]) => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (eventKey === key) {\n listener(this.rawOptions[key]);\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable {\n return this.onOptionChange(eventKey => {\n if (keys.indexOf(eventKey) !== -1) {\n listener();\n }\n });\n }\n\n private _setupOptions(): void {\n const getter = (propName: string): any => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n return this.rawOptions[propName];\n };\n\n const setter = (propName: string, value: any): void => {\n if (!(propName in DEFAULT_OPTIONS)) {\n throw new Error(`No option with key \"${propName}\"`);\n }\n\n value = this._sanitizeAndValidateOption(propName, value);\n // Don't fire an option change event if they didn't change\n if (this.rawOptions[propName] !== value) {\n this.rawOptions[propName] = value;\n this._onOptionChange.fire(propName);\n }\n };\n\n for (const propName in this.rawOptions) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this.options, propName, desc);\n }\n }\n\n private _sanitizeAndValidateOption(key: string, value: any): any {\n switch (key) {\n case 'cursorStyle':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n if (!isCursorStyle(value)) {\n throw new Error(`\"${value}\" is not a valid value for ${key}`);\n }\n break;\n case 'wordSeparator':\n if (!value) {\n value = DEFAULT_OPTIONS[key];\n }\n break;\n case 'fontWeight':\n case 'fontWeightBold':\n if (typeof value === 'number' && 1 <= value && value <= 1000) {\n // already valid numeric value\n break;\n }\n value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];\n break;\n case 'cursorWidth':\n value = Math.floor(value);\n // Fall through for bounds check\n case 'lineHeight':\n case 'tabStopWidth':\n if (value < 1) {\n throw new Error(`${key} cannot be less than 1, value: ${value}`);\n }\n break;\n case 'minimumContrastRatio':\n value = Math.max(1, Math.min(21, Math.round(value * 10) / 10));\n break;\n case 'scrollback':\n value = Math.min(value, 4294967295);\n if (value < 0) {\n throw new Error(`${key} cannot be less than 0, value: ${value}`);\n }\n break;\n case 'fastScrollSensitivity':\n case 'scrollSensitivity':\n if (value <= 0) {\n throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);\n }\n break;\n case 'rows':\n case 'cols':\n if (!value && value !== 0) {\n throw new Error(`${key} must be numeric, value: ${value}`);\n }\n break;\n case 'windowsPty':\n value = value ?? {};\n break;\n }\n return value;\n }\n}\n\nfunction isCursorStyle(value: unknown): value is CursorStyle {\n return value === 'block' || value === 'underline' || value === 'bar';\n}\n", "/**\n * Copyright (c) 2016 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/*\n * A simple utility for cloning values\n */\nexport function clone(val: T, depth: number = 5): T {\n if (typeof val !== 'object') {\n return val;\n }\n\n // If we're cloning an array, use an array as the base, otherwise use an object\n const clonedObject: any = Array.isArray(val) ? [] : {};\n\n for (const key in val) {\n // Recursively clone eack item unless we're at the maximum depth\n clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));\n }\n\n return clonedObject as T;\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { clone } from 'common/Clone';\nimport { Disposable } from 'common/Lifecycle';\nimport { IDecPrivateModes, IKittyKeyboardState, IModes } from 'common/Types';\nimport { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nconst DEFAULT_MODES: IModes = Object.freeze({\n insertMode: false\n});\n\nconst DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({\n applicationCursorKeys: false,\n applicationKeypad: false,\n bracketedPasteMode: false,\n colorSchemeUpdates: false,\n cursorBlink: undefined,\n cursorStyle: undefined,\n origin: false,\n reverseWraparound: false,\n sendFocus: false,\n synchronizedOutput: false,\n win32InputMode: false,\n wraparound: true // defaults: xterm - true, vt100 - false\n});\n\nconst DEFAULT_KITTY_KEYBOARD_STATE = (): IKittyKeyboardState => ({\n flags: 0,\n mainFlags: 0,\n altFlags: 0,\n mainStack: [],\n altStack: []\n});\n\nexport class CoreService extends Disposable implements ICoreService {\n public serviceBrand: any;\n\n public isCursorInitialized: boolean;\n public isCursorHidden: boolean = false;\n public modes: IModes;\n public decPrivateModes: IDecPrivateModes;\n public kittyKeyboard: IKittyKeyboardState;\n\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n private readonly _onUserInput = this._register(new Emitter());\n public readonly onUserInput = this._onUserInput.event;\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onRequestScrollToBottom = this._register(new Emitter());\n public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ILogService private readonly _logService: ILogService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n this.isCursorInitialized = _optionsService.rawOptions.showCursorImmediately ?? false;\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();\n }\n\n public reset(): void {\n this.modes = clone(DEFAULT_MODES);\n this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);\n this.kittyKeyboard = DEFAULT_KITTY_KEYBOARD_STATE();\n }\n\n public triggerDataEvent(data: string, wasUserInput: boolean = false): void {\n // Prevents all events to pty process if stdin is disabled\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n\n // Input is being sent to the terminal, the terminal should focus the prompt.\n const buffer = this._bufferService.buffer;\n if (wasUserInput && this._optionsService.rawOptions.scrollOnUserInput && buffer.ybase !== buffer.ydisp) {\n this._onRequestScrollToBottom.fire();\n }\n\n // Fire onUserInput so listeners can react as well (eg. clear selection)\n if (wasUserInput) {\n this._onUserInput.fire();\n }\n\n // Fire onData API\n this._logService.debug(`sending data \"${data}\"`);\n this._logService.trace(`sending data (codes)`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onData.fire(data);\n }\n\n public triggerBinaryEvent(data: string): void {\n if (this._optionsService.rawOptions.disableStdin) {\n return;\n }\n this._logService.debug(`sending binary \"${data}\"`);\n this._logService.trace(`sending binary (codes)`, () => data.split('').map(e => e.charCodeAt(0)));\n this._onBinary.fire(data);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, ICoreService, ICoreMouseService, IOptionsService } from 'common/services/Services';\nimport { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\n/**\n * Supported default protocols.\n */\nconst DEFAULT_PROTOCOLS: { [key: string]: ICoreMouseProtocol } = {\n /**\n * NONE\n * Events: none\n * Modifiers: none\n */\n NONE: {\n events: CoreMouseEventType.NONE,\n restrict: () => false\n },\n /**\n * X10\n * Events: mousedown\n * Modifiers: none\n */\n X10: {\n events: CoreMouseEventType.DOWN,\n restrict: (e: ICoreMouseEvent) => {\n // no wheel, no move, no up\n if (e.button === CoreMouseButton.WHEEL || e.action !== CoreMouseAction.DOWN) {\n return false;\n }\n // no modifiers\n e.ctrl = false;\n e.alt = false;\n e.shift = false;\n return true;\n }\n },\n /**\n * VT200\n * Events: mousedown / mouseup / wheel\n * Modifiers: all\n */\n VT200: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL,\n restrict: (e: ICoreMouseEvent) => {\n // no move\n if (e.action === CoreMouseAction.MOVE) {\n return false;\n }\n return true;\n }\n },\n /**\n * DRAG\n * Events: mousedown / mouseup / wheel / mousedrag\n * Modifiers: all\n */\n DRAG: {\n events: CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL | CoreMouseEventType.DRAG,\n restrict: (e: ICoreMouseEvent) => {\n // no move without button\n if (e.action === CoreMouseAction.MOVE && e.button === CoreMouseButton.NONE) {\n return false;\n }\n return true;\n }\n },\n /**\n * ANY\n * Events: all mouse related events\n * Modifiers: all\n */\n ANY: {\n events:\n CoreMouseEventType.DOWN | CoreMouseEventType.UP | CoreMouseEventType.WHEEL\n | CoreMouseEventType.DRAG | CoreMouseEventType.MOVE,\n restrict: (e: ICoreMouseEvent) => true\n }\n};\n\nconst enum Modifiers {\n SHIFT = 4,\n ALT = 8,\n CTRL = 16\n}\n\n// helper for default encoders to generate the event code.\nfunction eventCode(e: ICoreMouseEvent, isSGR: boolean): number {\n let code = (e.ctrl ? Modifiers.CTRL : 0) | (e.shift ? Modifiers.SHIFT : 0) | (e.alt ? Modifiers.ALT : 0);\n if (e.button === CoreMouseButton.WHEEL) {\n code |= 64;\n code |= e.action;\n } else {\n code |= e.button & 3;\n if (e.button & 4) {\n code |= 64;\n }\n if (e.button & 8) {\n code |= 128;\n }\n if (e.action === CoreMouseAction.MOVE) {\n code |= CoreMouseAction.MOVE;\n } else if (e.action === CoreMouseAction.UP && !isSGR) {\n // special case - only SGR can report button on release\n // all others have to go with NONE\n code |= CoreMouseButton.NONE;\n }\n }\n return code;\n}\n\nconst S = String.fromCharCode;\n\n/**\n * Supported default encodings.\n */\nconst DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {\n /**\n * DEFAULT - CSI M Pb Px Py\n * Single byte encoding for coords and event code.\n * Can encode values up to 223 (1-based).\n */\n DEFAULT: (e: ICoreMouseEvent) => {\n const params = [eventCode(e, false) + 32, e.col + 32, e.row + 32];\n // supress mouse report if we exceed addressible range\n // Note this is handled differently by emulators\n // - xterm: sends 0;0 coords instead\n // - vte, konsole: no report\n if (params[0] > 255 || params[1] > 255 || params[2] > 255) {\n return '';\n }\n return `\\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`;\n },\n /**\n * SGR - CSI < Pb ; Px ; Py M|m\n * No encoding limitation.\n * Can report button on release and works with a well formed sequence.\n */\n SGR: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`;\n },\n SGR_PIXELS: (e: ICoreMouseEvent) => {\n const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M';\n return `\\x1b[<${eventCode(e, true)};${e.x};${e.y}${final}`;\n }\n};\n\n/**\n * CoreMouseService\n *\n * Provides mouse tracking reports with different protocols and encodings.\n * - protocols: NONE (default), X10, VT200, DRAG, ANY\n * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507)\n *\n * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`.\n * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`.\n * Switching a protocol will send a notification event `onProtocolChange`\n * with a list of needed events to track.\n *\n * The service handles the mouse tracking state and decides whether to send\n * a tracking report to the backend based on protocol and encoding limitations.\n * To send a mouse event call `triggerMouseEvent`.\n */\nexport class CoreMouseService extends Disposable implements ICoreMouseService {\n public serviceBrand: any;\n\n private _protocols: { [name: string]: ICoreMouseProtocol } = {};\n private _encodings: { [name: string]: CoreMouseEncoding } = {};\n private _activeProtocol: string = '';\n private _activeEncoding: string = '';\n private _lastEvent: ICoreMouseEvent | null = null;\n private _wheelPartialScroll: number = 0;\n\n private readonly _onProtocolChange = this._register(new Emitter());\n public readonly onProtocolChange = this._onProtocolChange.event;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService,\n @ICoreService private readonly _coreService: ICoreService,\n @IOptionsService private readonly _optionsService: IOptionsService\n ) {\n super();\n // register default protocols and encodings\n for (const name of Object.keys(DEFAULT_PROTOCOLS)) this.addProtocol(name, DEFAULT_PROTOCOLS[name]);\n for (const name of Object.keys(DEFAULT_ENCODINGS)) this.addEncoding(name, DEFAULT_ENCODINGS[name]);\n // call reset to set defaults\n this.reset();\n }\n\n public addProtocol(name: string, protocol: ICoreMouseProtocol): void {\n this._protocols[name] = protocol;\n }\n\n public addEncoding(name: string, encoding: CoreMouseEncoding): void {\n this._encodings[name] = encoding;\n }\n\n public get activeProtocol(): string {\n return this._activeProtocol;\n }\n\n public get areMouseEventsActive(): boolean {\n return this._protocols[this._activeProtocol].events !== 0;\n }\n\n public set activeProtocol(name: string) {\n if (!this._protocols[name]) {\n throw new Error(`unknown protocol \"${name}\"`);\n }\n this._activeProtocol = name;\n this._onProtocolChange.fire(this._protocols[name].events);\n }\n\n public get activeEncoding(): string {\n return this._activeEncoding;\n }\n\n public set activeEncoding(name: string) {\n if (!this._encodings[name]) {\n throw new Error(`unknown encoding \"${name}\"`);\n }\n this._activeEncoding = name;\n }\n\n public reset(): void {\n this.activeProtocol = 'NONE';\n this.activeEncoding = 'DEFAULT';\n this._lastEvent = null;\n this._wheelPartialScroll = 0;\n }\n\n /**\n * Processes a wheel event, accounting for partial scrolls for trackpad, mouse scrolls.\n * This prevents hyper-sensitive scrolling in alt buffer.\n */\n public consumeWheelEvent(ev: WheelEvent, cellHeight?: number, dpr?: number): number {\n // Do nothing if it's not a vertical scroll event\n if (ev.deltaY === 0 || ev.shiftKey) {\n return 0;\n }\n\n if (cellHeight === undefined || dpr === undefined) {\n return 0;\n }\n\n const targetWheelEventPixels = cellHeight / dpr;\n let amount = this._applyScrollModifier(ev.deltaY, ev);\n\n if (ev.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n amount /= (targetWheelEventPixels + 0.0); // Prevent integer division\n\n const isLikelyTrackpad = Math.abs(ev.deltaY) < 50;\n if (isLikelyTrackpad) {\n amount *= 0.3;\n }\n\n this._wheelPartialScroll += amount;\n amount = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1);\n this._wheelPartialScroll %= 1;\n } else if (ev.deltaMode === WheelEvent.DOM_DELTA_PAGE) {\n amount *= this._bufferService.rows;\n }\n return amount;\n }\n\n private _applyScrollModifier(amount: number, ev: WheelEvent): number {\n // Multiply the scroll speed when the modifier key is pressed\n if (ev.altKey || ev.ctrlKey || ev.shiftKey) {\n return amount * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity;\n }\n return amount * this._optionsService.rawOptions.scrollSensitivity;\n }\n\n /**\n * Triggers a mouse event to be sent.\n *\n * Returns true if the event passed all protocol restrictions and a report\n * was sent, otherwise false. The return value may be used to decide whether\n * the default event action in the bowser component should be omitted.\n *\n * Note: The method will change values of the given event object\n * to fullfill protocol and encoding restrictions.\n */\n public triggerMouseEvent(e: ICoreMouseEvent): boolean {\n // range check for col/row\n if (e.col < 0 || e.col >= this._bufferService.cols\n || e.row < 0 || e.row >= this._bufferService.rows) {\n return false;\n }\n\n // filter nonsense combinations of button + action\n if (e.button === CoreMouseButton.WHEEL && e.action === CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button === CoreMouseButton.NONE && e.action !== CoreMouseAction.MOVE) {\n return false;\n }\n if (e.button !== CoreMouseButton.WHEEL && (e.action === CoreMouseAction.LEFT || e.action === CoreMouseAction.RIGHT)) {\n return false;\n }\n\n // report 1-based coords\n e.col++;\n e.row++;\n\n // debounce move events at grid or pixel level\n if (e.action === CoreMouseAction.MOVE\n && this._lastEvent\n && this._equalEvents(this._lastEvent, e, this._activeEncoding === 'SGR_PIXELS')\n ) {\n return false;\n }\n\n // apply protocol restrictions\n if (!this._protocols[this._activeProtocol].restrict(e)) {\n return false;\n }\n\n // encode report and send\n const report = this._encodings[this._activeEncoding](e);\n if (report) {\n // always send DEFAULT as binary data\n if (this._activeEncoding === 'DEFAULT') {\n this._coreService.triggerBinaryEvent(report);\n } else {\n this._coreService.triggerDataEvent(report, true);\n }\n }\n\n this._lastEvent = e;\n\n return true;\n }\n\n public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {\n return {\n down: !!(events & CoreMouseEventType.DOWN),\n up: !!(events & CoreMouseEventType.UP),\n drag: !!(events & CoreMouseEventType.DRAG),\n move: !!(events & CoreMouseEventType.MOVE),\n wheel: !!(events & CoreMouseEventType.WHEEL)\n };\n }\n\n private _equalEvents(e1: ICoreMouseEvent, e2: ICoreMouseEvent, pixels: boolean): boolean {\n if (pixels) {\n if (e1.x !== e2.x) return false;\n if (e1.y !== e2.y) return false;\n } else {\n if (e1.col !== e2.col) return false;\n if (e1.row !== e2.row) return false;\n }\n if (e1.button !== e2.button) return false;\n if (e1.action !== e2.action) return false;\n if (e1.ctrl !== e2.ctrl) return false;\n if (e1.alt !== e2.alt) return false;\n if (e1.shift !== e2.shift) return false;\n return true;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\n\nconst BMP_COMBINING = [\n [0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],\n [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2],\n [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603],\n [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670],\n [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED],\n [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A],\n [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902],\n [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D],\n [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981],\n [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD],\n [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C],\n [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D],\n [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC],\n [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD],\n [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C],\n [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D],\n [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0],\n [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48],\n [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC],\n [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD],\n [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D],\n [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6],\n [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E],\n [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC],\n [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35],\n [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E],\n [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97],\n [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030],\n [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039],\n [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F],\n [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753],\n [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD],\n [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD],\n [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922],\n [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B],\n [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34],\n [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42],\n [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF],\n [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063],\n [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F],\n [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B],\n [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F],\n [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB]\n];\nconst HIGH_COMBINING = [\n [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F],\n [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169],\n [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD],\n [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F],\n [0xE0100, 0xE01EF]\n];\n\n// BMP lookup table, lazy initialized during first addon loading\nlet table: Uint8Array;\n\nfunction bisearch(ucs: number, data: number[][]): boolean {\n let min = 0;\n let max = data.length - 1;\n let mid;\n if (ucs < data[0][0] || ucs > data[max][1]) {\n return false;\n }\n while (max >= min) {\n mid = (min + max) >> 1;\n if (ucs > data[mid][1]) {\n min = mid + 1;\n } else if (ucs < data[mid][0]) {\n max = mid - 1;\n } else {\n return true;\n }\n }\n return false;\n}\n\nexport class UnicodeV6 implements IUnicodeVersionProvider {\n public readonly version = '6';\n\n constructor() {\n // init lookup table once\n if (!table) {\n table = new Uint8Array(65536);\n table.fill(1);\n table[0] = 0;\n // control chars\n table.fill(0, 1, 32);\n table.fill(0, 0x7f, 0xa0);\n\n // apply wide char rules first\n // wide chars\n table.fill(2, 0x1100, 0x1160);\n table[0x2329] = 2;\n table[0x232a] = 2;\n table.fill(2, 0x2e80, 0xa4d0);\n table[0x303f] = 1; // wrongly in last line\n\n table.fill(2, 0xac00, 0xd7a4);\n table.fill(2, 0xf900, 0xfb00);\n table.fill(2, 0xfe10, 0xfe1a);\n table.fill(2, 0xfe30, 0xfe70);\n table.fill(2, 0xff00, 0xff61);\n table.fill(2, 0xffe0, 0xffe7);\n\n // apply combining last to ensure we overwrite\n // wrongly wide set chars:\n // the original algo evals combining first and falls\n // through to wide check so we simply do here the opposite\n // combining 0\n for (let r = 0; r < BMP_COMBINING.length; ++r) {\n table.fill(0, BMP_COMBINING[r][0], BMP_COMBINING[r][1] + 1);\n }\n }\n }\n\n public wcwidth(num: number): UnicodeCharWidth {\n if (num < 32) return 0;\n if (num < 127) return 1;\n if (num < 65536) return table[num] as UnicodeCharWidth;\n if (bisearch(num, HIGH_COMBINING)) return 0;\n if ((num >= 0x20000 && num <= 0x2fffd) || (num >= 0x30000 && num <= 0x3fffd)) return 2;\n return 1;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n let width = this.wcwidth(codepoint);\n let shouldJoin = width === 0 && preceding !== 0;\n if (shouldJoin) {\n const oldWidth = UnicodeService.extractWidth(preceding);\n if (oldWidth === 0) {\n shouldJoin = false;\n } else if (oldWidth > width) {\n width = oldWidth;\n }\n }\n return UnicodeService.createPropertyValue(0, width, shouldJoin);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { UnicodeV6 } from 'common/input/UnicodeV6';\nimport { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';\nimport { Emitter } from 'common/Event';\n\nexport class UnicodeService implements IUnicodeService {\n public serviceBrand: any;\n\n private _providers: {[key: string]: IUnicodeVersionProvider} = Object.create(null);\n private _active: string = '';\n private _activeProvider: IUnicodeVersionProvider;\n\n private readonly _onChange = new Emitter();\n public readonly onChange = this._onChange.event;\n\n public static extractShouldJoin(value: UnicodeCharProperties): boolean {\n return (value & 1) !== 0;\n }\n public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {\n return ((value >> 1) & 0x3) as UnicodeCharWidth;\n }\n public static extractCharKind(value: UnicodeCharProperties): number {\n return value >> 3;\n }\n public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {\n return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);\n }\n\n constructor() {\n const defaultProvider = new UnicodeV6();\n this.register(defaultProvider);\n this._active = defaultProvider.version;\n this._activeProvider = defaultProvider;\n }\n\n public dispose(): void {\n this._onChange.dispose();\n }\n\n public get versions(): string[] {\n return Object.keys(this._providers);\n }\n\n public get activeVersion(): string {\n return this._active;\n }\n\n public set activeVersion(version: string) {\n if (!this._providers[version]) {\n throw new Error(`unknown Unicode version \"${version}\"`);\n }\n this._active = version;\n this._activeProvider = this._providers[version];\n this._onChange.fire(version);\n }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._providers[provider.version] = provider;\n }\n\n /**\n * Unicode version dependent interface.\n */\n public wcwidth(num: number): UnicodeCharWidth {\n return this._activeProvider.wcwidth(num);\n }\n\n public getStringCellWidth(s: string): number {\n let result = 0;\n let precedingInfo = 0;\n const length = s.length;\n for (let i = 0; i < length; ++i) {\n let code = s.charCodeAt(i);\n // surrogate pair first\n if (0xD800 <= code && code <= 0xDBFF) {\n if (++i >= length) {\n // this should not happen with strings retrieved from\n // Buffer.translateToString as it converts from UTF-32\n // and therefore always should contain the second part\n // for any other string we still have to handle it somehow:\n // simply treat the lonely surrogate first as a single char (UCS-2 behavior)\n return result + this.wcwidth(code);\n }\n const second = s.charCodeAt(i);\n // convert surrogate pair to high codepoint only for valid second part (UTF-16)\n // otherwise treat them independently (UCS-2 behavior)\n if (0xDC00 <= second && second <= 0xDFFF) {\n code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n } else {\n result += this.wcwidth(second);\n }\n }\n const currentInfo = this.charProperties(code, precedingInfo);\n let chWidth = UnicodeService.extractWidth(currentInfo);\n if (UnicodeService.extractShouldJoin(currentInfo)) {\n chWidth -= UnicodeService.extractWidth(precedingInfo);\n }\n result += chWidth;\n precedingInfo = currentInfo;\n }\n return result;\n }\n\n public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {\n return this._activeProvider.charProperties(codepoint, preceding);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICharsetService } from 'common/services/Services';\nimport { ICharset } from 'common/Types';\n\nexport class CharsetService implements ICharsetService {\n public serviceBrand: any;\n\n public charset: ICharset | undefined;\n public glevel: number = 0;\n\n private _charsets: (ICharset | undefined)[] = [];\n\n public get charsets(): (ICharset | undefined)[] {\n return this._charsets;\n }\n\n public reset(): void {\n this.charset = undefined;\n this._charsets = [];\n this.glevel = 0;\n }\n\n public setgLevel(g: number): void {\n this.glevel = g;\n this.charset = this._charsets[g];\n }\n\n public setgCharset(g: number, charset: ICharset | undefined): void {\n this._charsets[g] = charset;\n if (this.glevel === g) {\n this.charset = charset;\n }\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';\nimport { IBufferService } from 'common/services/Services';\n\nexport function updateWindowsModeWrappedState(bufferService: IBufferService): void {\n // Winpty does not support wraparound mode which means that lines will never\n // be marked as wrapped. This causes issues for things like copying a line\n // retaining the wrapped new line characters or if consumers are listening\n // in on the data stream.\n //\n // The workaround for this is to listen to every incoming line feed and mark\n // the line as wrapped if the last character in the previous line is not a\n // space. This is certainly not without its problems, but generally on\n // Windows when text reaches the end of the terminal it's likely going to be\n // wrapped.\n const line = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y - 1);\n const lastChar = line?.get(bufferService.cols - 1);\n\n const nextLine = bufferService.buffer.lines.get(bufferService.buffer.ybase + bufferService.buffer.y);\n if (nextLine && lastChar) {\n nextLine.isWrapped = (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE);\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IParams, ParamsArray } from 'common/parser/Types';\n\n// max value supported for a single param/subparam (clamped to positive int32 range)\nconst MAX_VALUE = 0x7FFFFFFF;\n// max allowed subparams for a single sequence (hardcoded limitation)\nconst MAX_SUBPARAMS = 256;\n\n/**\n * Params storage class.\n * This type is used by the parser to accumulate sequence parameters and sub parameters\n * and transmit them to the input handler actions.\n *\n * NOTES:\n * - params object for action handlers is borrowed, use `.toArray` or `.clone` to get a copy\n * - never read beyond `params.length - 1` (likely to contain arbitrary data)\n * - `.getSubParams` returns a borrowed typed array, use `.getSubParamsAll` for cloned sub params\n * - hardcoded limitations:\n * - max. value for a single (sub) param is 2^31 - 1 (greater values are clamped to that)\n * - max. 256 sub params possible\n * - negative values are not allowed beside -1 (placeholder for default value)\n *\n * About ZDM (Zero Default Mode):\n * ZDM is not orchestrated by this class. If the parser is in ZDM,\n * it should add 0 for empty params, otherwise -1. This does not apply\n * to subparams, empty subparams should always be added with -1.\n */\nexport class Params implements IParams {\n // params store and length\n public params: Int32Array;\n public length: number;\n\n // sub params store and length\n protected _subParams: Int32Array;\n protected _subParamsLength: number;\n\n // sub params offsets from param: param idx --> [start, end] offset\n private _subParamsIdx: Uint16Array;\n private _rejectDigits: boolean;\n private _rejectSubDigits: boolean;\n private _digitIsSub: boolean;\n\n /**\n * Create a `Params` type from JS array representation.\n */\n public static fromArray(values: ParamsArray): Params {\n const params = new Params();\n if (!values.length) {\n return params;\n }\n // skip leading sub params\n for (let i = (Array.isArray(values[0])) ? 1 : 0; i < values.length; ++i) {\n const value = values[i];\n if (Array.isArray(value)) {\n for (let k = 0; k < value.length; ++k) {\n params.addSubParam(value[k]);\n }\n } else {\n params.addParam(value);\n }\n }\n return params;\n }\n\n /**\n * @param maxLength max length of storable parameters\n * @param maxSubParamsLength max length of storable sub parameters\n */\n constructor(public maxLength: number = 32, public maxSubParamsLength: number = 32) {\n if (maxSubParamsLength > MAX_SUBPARAMS) {\n throw new Error('maxSubParamsLength must not be greater than 256');\n }\n this.params = new Int32Array(maxLength);\n this.length = 0;\n this._subParams = new Int32Array(maxSubParamsLength);\n this._subParamsLength = 0;\n this._subParamsIdx = new Uint16Array(maxLength);\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Clone object.\n */\n public clone(): Params {\n const newParams = new Params(this.maxLength, this.maxSubParamsLength);\n newParams.params.set(this.params);\n newParams.length = this.length;\n newParams._subParams.set(this._subParams);\n newParams._subParamsLength = this._subParamsLength;\n newParams._subParamsIdx.set(this._subParamsIdx);\n newParams._rejectDigits = this._rejectDigits;\n newParams._rejectSubDigits = this._rejectSubDigits;\n newParams._digitIsSub = this._digitIsSub;\n return newParams;\n }\n\n /**\n * Get a JS array representation of the current parameters and sub parameters.\n * The array is structured as follows:\n * sequence: \"1;2:3:4;5::6\"\n * array : [1, 2, [3, 4], 5, [-1, 6]]\n */\n public toArray(): ParamsArray {\n const res: ParamsArray = [];\n for (let i = 0; i < this.length; ++i) {\n res.push(this.params[i]);\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n res.push(Array.prototype.slice.call(this._subParams, start, end));\n }\n }\n return res;\n }\n\n /**\n * Reset to initial empty state.\n */\n public reset(): void {\n this.length = 0;\n this._subParamsLength = 0;\n this._rejectDigits = false;\n this._rejectSubDigits = false;\n this._digitIsSub = false;\n }\n\n /**\n * Add a parameter value.\n * `Params` only stores up to `maxLength` parameters, any later\n * parameter will be ignored.\n * Note: VT devices only stored up to 16 values, xterm seems to\n * store up to 30.\n */\n public addParam(value: number): void {\n this._digitIsSub = false;\n if (this.length >= this.maxLength) {\n this._rejectDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength;\n this.params[this.length++] = value > MAX_VALUE ? MAX_VALUE : value;\n }\n\n /**\n * Add a sub parameter value.\n * The sub parameter is automatically associated with the last parameter value.\n * Thus it is not possible to add a subparameter without any parameter added yet.\n * `Params` only stores up to `subParamsLength` sub parameters, any later\n * sub parameter will be ignored.\n */\n public addSubParam(value: number): void {\n this._digitIsSub = true;\n if (!this.length) {\n return;\n }\n if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) {\n this._rejectSubDigits = true;\n return;\n }\n if (value < -1) {\n throw new Error('values lesser than -1 are not allowed');\n }\n this._subParams[this._subParamsLength++] = value > MAX_VALUE ? MAX_VALUE : value;\n this._subParamsIdx[this.length - 1]++;\n }\n\n /**\n * Whether parameter at index `idx` has sub parameters.\n */\n public hasSubParams(idx: number): boolean {\n return ((this._subParamsIdx[idx] & 0xFF) - (this._subParamsIdx[idx] >> 8) > 0);\n }\n\n /**\n * Return sub parameters for parameter at index `idx`.\n * Note: The values are borrowed, thus you need to copy\n * the values if you need to hold them in nonlocal scope.\n */\n public getSubParams(idx: number): Int32Array | null {\n const start = this._subParamsIdx[idx] >> 8;\n const end = this._subParamsIdx[idx] & 0xFF;\n if (end - start > 0) {\n return this._subParams.subarray(start, end);\n }\n return null;\n }\n\n /**\n * Return all sub parameters as {idx: subparams} mapping.\n * Note: The values are not borrowed.\n */\n public getSubParamsAll(): {[idx: number]: Int32Array} {\n const result: {[idx: number]: Int32Array} = {};\n for (let i = 0; i < this.length; ++i) {\n const start = this._subParamsIdx[i] >> 8;\n const end = this._subParamsIdx[i] & 0xFF;\n if (end - start > 0) {\n result[i] = this._subParams.slice(start, end);\n }\n }\n return result;\n }\n\n /**\n * Add a single digit value to current parameter.\n * This is used by the parser to account digits on a char by char basis.\n */\n public addDigit(value: number): void {\n let length;\n if (this._rejectDigits\n || !(length = this._digitIsSub ? this._subParamsLength : this.length)\n || (this._digitIsSub && this._rejectSubDigits)\n ) {\n return;\n }\n\n const store = this._digitIsSub ? this._subParams : this.params;\n const cur = store[length - 1];\n store[length - 1] = ~cur ? Math.min(cur * 10 + value, MAX_VALUE) : value;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';\nimport { OscState, ParserConstants } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IOscHandler[] = [];\n\nexport class OscParser implements IOscParser {\n private _state = OscState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: OscFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public registerHandler(ident: number, handler: IOscHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n public setHandlerFallback(handler: OscFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === OscState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = OscState.ID;\n }\n\n /**\n * Put data to current OSC command.\n * Expects the identifier of the OSC command in the form\n * OSC id ; payload ST/BEL\n * Payload chunks are not further processed and get\n * directly passed to the handlers.\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === OscState.ABORT) {\n return;\n }\n if (this._state === OscState.ID) {\n while (start < end) {\n const code = data[start++];\n if (code === 0x3b) {\n this._state = OscState.PAYLOAD;\n this._start();\n break;\n }\n if (code < 0x30 || 0x39 < code) {\n this._state = OscState.ABORT;\n return;\n }\n if (this._id === -1) {\n this._id = 0;\n }\n this._id = this._id * 10 + code - 48;\n }\n }\n if (this._state === OscState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an OSC command.\n * Whether the OSC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === OscState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== OscState.ABORT) {\n // if we are still in ID state and get an early end\n // means that the command has no payload thus we still have\n // to announce START and send END right after\n if (this._state === OscState.ID) {\n this._start();\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = OscState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as OSC handlers.\n */\nexport class OscHandler implements IOscHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > OscHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IDisposable } from 'common/Types';\nimport { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { Params } from 'common/parser/Params';\nimport { ParserConstants } from 'common/parser/Constants';\n\nconst EMPTY_HANDLERS: IDcsHandler[] = [];\n\nexport class DcsParser implements IDcsParser {\n private _handlers: IHandlerCollection = Object.create(null);\n private _active: IDcsHandler[] = EMPTY_HANDLERS;\n private _ident: number = 0;\n private _handlerFb: DcsFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public registerHandler(ident: number, handler: IDcsHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public reset(): void {\n // force cleanup leftover handlers\n if (this._active.length) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].unhook(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n\n public hook(ident: number, params: IParams): void {\n // always reset leftover handlers\n this.reset();\n this._ident = ident;\n this._active = this._handlers[ident] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._ident, 'HOOK', params);\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].hook(params);\n }\n }\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public unhook(success: boolean, promiseResult: boolean = true): void | Promise {\n if (!this._active.length) {\n this._handlerFb(this._ident, 'UNHOOK', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers (fallThrough for async)\n for (; j >= 0; j--) {\n handlerResult = this._active[j].unhook(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n this._active = EMPTY_HANDLERS;\n this._ident = 0;\n }\n}\n\n// predefine empty params as [0] (ZDM)\nconst EMPTY_PARAMS = new Params();\nEMPTY_PARAMS.addParam(0);\n\n/**\n * Convenient class to create a DCS handler from a single callback function.\n * Note: The payload is currently limited to 50 MB (hardcoded).\n */\nexport class DcsHandler implements IDcsHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _params: IParams = EMPTY_PARAMS;\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string, params: IParams) => boolean | Promise) { }\n\n public hook(params: IParams): void {\n // since we need to preserve params until `unhook`, we have to clone it\n // (only borrowed from parser and spans multiple parser states)\n // perf optimization:\n // clone only, if we have non empty params, otherwise stick with default\n this._params = (params.length > 1 || params.params[0]) ? params.clone() : EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > DcsHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public unhook(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data, this._params);\n if (ret instanceof Promise) {\n // need to hold data and params until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._params = EMPTY_PARAMS;\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from 'common/parser/Types';\nimport { ApcState, ParserConstants } from 'common/parser/Constants';\nimport { utf32ToString } from 'common/input/TextDecoder';\nimport { IDisposable } from 'common/Types';\n\nconst EMPTY_HANDLERS: IApcHandler[] = [];\n\n/**\n * APC Parser for handling Application Program Command sequences.\n * APC sequences use the format: ESC _ ESC \\\n *\n * Unlike OSC which uses numeric identifiers (e.g., OSC 1337),\n * APC uses the first character as the identifier (e.g., 'G' for Kitty graphics).\n * The identifier is the character code of the first byte after ESC _.\n */\nexport class ApcParser implements IApcParser {\n private _state = ApcState.START;\n private _active = EMPTY_HANDLERS;\n private _id = -1;\n private _handlers: IHandlerCollection = Object.create(null);\n private _handlerFb: ApcFallbackHandlerType = () => { };\n private _stack: ISubParserStackState = {\n paused: false,\n loopPosition: 0,\n fallThrough: false\n };\n\n /**\n * Register an APC handler for a specific identifier.\n * @param ident The character code of the first byte (e.g., 0x47 for 'G')\n * @param handler The handler to register\n */\n public registerHandler(ident: number, handler: IApcHandler): IDisposable {\n this._handlers[ident] ??= [];\n const handlerList = this._handlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n\n public clearHandler(ident: number): void {\n if (this._handlers[ident]) delete this._handlers[ident];\n }\n\n public setHandlerFallback(handler: ApcFallbackHandlerType): void {\n this._handlerFb = handler;\n }\n\n public dispose(): void {\n this._handlers = Object.create(null);\n this._handlerFb = () => { };\n this._active = EMPTY_HANDLERS;\n }\n\n public reset(): void {\n // force cleanup handlers if payload was already sent\n if (this._state === ApcState.PAYLOAD) {\n for (let j = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; j >= 0; --j) {\n this._active[j].end(false);\n }\n }\n this._stack.paused = false;\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n }\n\n private _start(): void {\n this._active = this._handlers[this._id] || EMPTY_HANDLERS;\n if (!this._active.length) {\n this._handlerFb(this._id, 'START');\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].start();\n }\n }\n }\n\n private _put(data: Uint32Array, start: number, end: number): void {\n if (!this._active.length) {\n this._handlerFb(this._id, 'PUT', utf32ToString(data, start, end));\n } else {\n for (let j = this._active.length - 1; j >= 0; j--) {\n this._active[j].put(data, start, end);\n }\n }\n }\n\n public start(): void {\n // always reset leftover handlers\n this.reset();\n this._state = ApcState.ID;\n }\n\n /**\n * Put data to current APC command.\n * For APC, the first character is used as the identifier.\n * Format: ESC _ ESC \\\n * Example: ESC _ G f=100,a=T;... ESC \\ (Kitty graphics, identifier='G')\n */\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._state === ApcState.ABORT) {\n return;\n }\n if (this._state === ApcState.ID) {\n // The first character is the identifier\n if (start < end) {\n this._id = data[start++];\n this._state = ApcState.PAYLOAD;\n this._start();\n }\n }\n if (this._state === ApcState.PAYLOAD && end - start > 0) {\n this._put(data, start, end);\n }\n }\n\n /**\n * Indicates end of an APC command.\n * Whether the APC got aborted or finished normally\n * is indicated by `success`.\n */\n public end(success: boolean, promiseResult: boolean = true): void | Promise {\n if (this._state === ApcState.START) {\n return;\n }\n // do nothing if command was faulty\n if (this._state !== ApcState.ABORT) {\n // if we are still in ID state and get an early end\n // means we got an empty APC sequence with no identifier,\n // which is invalid - just reset and return\n if (this._state === ApcState.ID) {\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n return;\n }\n\n if (!this._active.length) {\n this._handlerFb(this._id, 'END', success);\n } else {\n let handlerResult: boolean | Promise = false;\n let j = this._active.length - 1;\n let fallThrough = false;\n if (this._stack.paused) {\n j = this._stack.loopPosition - 1;\n handlerResult = promiseResult;\n fallThrough = this._stack.fallThrough;\n this._stack.paused = false;\n }\n if (!fallThrough && handlerResult === false) {\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(success);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = false;\n return handlerResult;\n }\n }\n j--;\n }\n // cleanup left over handlers\n // we always have to call .end for proper cleanup,\n // here we use `success` to indicate whether a handler should execute\n for (; j >= 0; j--) {\n handlerResult = this._active[j].end(false);\n if (handlerResult instanceof Promise) {\n this._stack.paused = true;\n this._stack.loopPosition = j;\n this._stack.fallThrough = true;\n return handlerResult;\n }\n }\n }\n\n }\n this._active = EMPTY_HANDLERS;\n this._id = -1;\n this._state = ApcState.START;\n }\n}\n\n/**\n * Convenient class to allow attaching string based handler functions\n * as APC handlers.\n */\nexport class ApcHandler implements IApcHandler {\n private static _payloadLimit = ParserConstants.PAYLOAD_LIMIT;\n\n private _data = '';\n private _hitLimit: boolean = false;\n\n constructor(private _handler: (data: string) => boolean | Promise) { }\n\n public start(): void {\n this._data = '';\n this._hitLimit = false;\n }\n\n public put(data: Uint32Array, start: number, end: number): void {\n if (this._hitLimit) {\n return;\n }\n this._data += utf32ToString(data, start, end);\n if (this._data.length > ApcHandler._payloadLimit) {\n this._data = '';\n this._hitLimit = true;\n }\n }\n\n public end(success: boolean): boolean | Promise {\n let ret: boolean | Promise = false;\n if (this._hitLimit) {\n ret = false;\n } else if (success) {\n ret = this._handler(this._data);\n if (ret instanceof Promise) {\n // need to hold data until `ret` got resolved\n // dont care for errors, data will be freed anyway on next start\n return ret.then(res => {\n this._data = '';\n this._hitLimit = false;\n return res;\n });\n }\n }\n this._data = '';\n this._hitLimit = false;\n return ret;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType, IApcHandler, IApcParser, ApcFallbackHandlerType } from 'common/parser/Types';\nimport { ParserState, ParserAction } from 'common/parser/Constants';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { Params } from 'common/parser/Params';\nimport { OscParser } from 'common/parser/OscParser';\nimport { DcsParser } from 'common/parser/DcsParser';\nimport { ApcParser } from 'common/parser/ApcParser';\n\n/**\n * Table values are generated like this:\n * index: currentState << TableValue.INDEX_STATE_SHIFT | charCode\n * value: action << TableValue.TRANSITION_ACTION_SHIFT | nextState\n */\nconst enum TableAccess {\n TRANSITION_ACTION_SHIFT = 8,\n TRANSITION_STATE_MASK = 255,\n INDEX_STATE_SHIFT = 8\n}\n\n/**\n * Transition table for EscapeSequenceParser.\n */\nexport class TransitionTable {\n public table: Uint16Array;\n\n constructor(length: number) {\n this.table = new Uint16Array(length);\n }\n\n /**\n * Set default transition.\n * @param action default action\n * @param next default next state\n */\n public setDefault(action: ParserAction, next: ParserState): void {\n this.table.fill(action << TableAccess.TRANSITION_ACTION_SHIFT | next);\n }\n\n /**\n * Add a transition to the transition table.\n * @param code input character code\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public add(code: number, state: ParserState, action: ParserAction, next: ParserState): void {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | code] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n\n /**\n * Add transitions for multiple input character codes.\n * @param codes input character code array\n * @param state current parser state\n * @param action parser action to be done\n * @param next next parser state\n */\n public addMany(codes: number[], state: ParserState, action: ParserAction, next: ParserState): void {\n for (let i = 0; i < codes.length; i++) {\n this.table[state << TableAccess.INDEX_STATE_SHIFT | codes[i]] = action << TableAccess.TRANSITION_ACTION_SHIFT | next;\n }\n }\n}\n\n\n// Pseudo-character placeholder for printable non-ascii characters (unicode).\nconst NON_ASCII_PRINTABLE = 0xA0;\n\n\n/**\n * VT500 compatible transition table.\n * Taken from https://vt100.net/emu/dec_ansi_parser.\n */\nexport const VT500_TRANSITION_TABLE = (function (): TransitionTable {\n const table: TransitionTable = new TransitionTable(4095);\n\n // range macro for byte\n const BYTE_VALUES = 256;\n const blueprint = Array.apply(null, Array(BYTE_VALUES)).map((unused: any, i: number) => i);\n const r = (start: number, end: number): number[] => blueprint.slice(start, end);\n\n // Default definitions.\n const PRINTABLES = r(0x20, 0x7f); // 0x20 (SP) included, 0x7F (DEL) excluded\n const EXECUTABLES = r(0x00, 0x18);\n EXECUTABLES.push(0x19);\n EXECUTABLES.push.apply(EXECUTABLES, r(0x1c, 0x20));\n\n const states: number[] = r(ParserState.GROUND, ParserState.STATE_LENGTH);\n\n // set default transition\n table.setDefault(ParserAction.ERROR, ParserState.GROUND);\n // printables\n table.addMany(PRINTABLES, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n // global anywhere rules\n for (const state of states) {\n table.addMany([0x18, 0x1a, 0x99, 0x9a], state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x80, 0x90), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(r(0x90, 0x98), state, ParserAction.EXECUTE, ParserState.GROUND);\n table.add(0x9c, state, ParserAction.IGNORE, ParserState.GROUND); // ST as terminator\n table.add(0x1b, state, ParserAction.CLEAR, ParserState.ESCAPE); // ESC\n table.add(0x9d, state, ParserAction.OSC_START, ParserState.OSC_STRING); // OSC\n table.addMany([0x98, 0x9e], state, ParserAction.IGNORE, ParserState.SOS_PM_STRING); // SOS, PM\n table.add(0x9f, state, ParserAction.APC_START, ParserState.APC_STRING); // APC\n table.add(0x9b, state, ParserAction.CLEAR, ParserState.CSI_ENTRY); // CSI\n table.add(0x90, state, ParserAction.CLEAR, ParserState.DCS_ENTRY); // DCS\n }\n // rules for executables and 7f\n table.addMany(EXECUTABLES, ParserState.GROUND, ParserAction.EXECUTE, ParserState.GROUND);\n table.addMany(EXECUTABLES, ParserState.ESCAPE, ParserAction.EXECUTE, ParserState.ESCAPE);\n table.add(0x7f, ParserState.ESCAPE, ParserAction.IGNORE, ParserState.ESCAPE);\n table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n table.addMany(EXECUTABLES, ParserState.CSI_ENTRY, ParserAction.EXECUTE, ParserState.CSI_ENTRY);\n table.add(0x7f, ParserState.CSI_ENTRY, ParserAction.IGNORE, ParserState.CSI_ENTRY);\n table.addMany(EXECUTABLES, ParserState.CSI_PARAM, ParserAction.EXECUTE, ParserState.CSI_PARAM);\n table.add(0x7f, ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_PARAM);\n table.addMany(EXECUTABLES, ParserState.CSI_IGNORE, ParserAction.EXECUTE, ParserState.CSI_IGNORE);\n table.addMany(EXECUTABLES, ParserState.CSI_INTERMEDIATE, ParserAction.EXECUTE, ParserState.CSI_INTERMEDIATE);\n table.add(0x7f, ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.ESCAPE_INTERMEDIATE, ParserAction.EXECUTE, ParserState.ESCAPE_INTERMEDIATE);\n table.add(0x7f, ParserState.ESCAPE_INTERMEDIATE, ParserAction.IGNORE, ParserState.ESCAPE_INTERMEDIATE);\n // osc\n table.add(0x5d, ParserState.ESCAPE, ParserAction.OSC_START, ParserState.OSC_STRING);\n table.addMany(PRINTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(0x7f, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.addMany([0x9c, 0x1b, 0x18, 0x1a, 0x07], ParserState.OSC_STRING, ParserAction.OSC_END, ParserState.GROUND);\n table.addMany(r(0x1c, 0x20), ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);\n // sos/pm\n table.addMany([0x58, 0x5e], ParserState.ESCAPE, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.addMany(PRINTABLES, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.addMany(EXECUTABLES, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n table.add(0x9c, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.GROUND);\n table.add(0x7f, ParserState.SOS_PM_STRING, ParserAction.IGNORE, ParserState.SOS_PM_STRING);\n // apc\n table.add(0x5f, ParserState.ESCAPE, ParserAction.APC_START, ParserState.APC_STRING);\n table.addMany(PRINTABLES, ParserState.APC_STRING, ParserAction.APC_PUT, ParserState.APC_STRING);\n table.addMany(EXECUTABLES, ParserState.APC_STRING, ParserAction.IGNORE, ParserState.APC_STRING);\n table.add(0x7f, ParserState.APC_STRING, ParserAction.IGNORE, ParserState.APC_STRING);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.APC_STRING, ParserAction.APC_END, ParserState.GROUND);\n // csi entries\n table.add(0x5b, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.CSI_ENTRY);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_ENTRY, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_ENTRY, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.CSI_PARAM, ParserAction.PARAM, ParserState.CSI_PARAM);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_PARAM, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.CSI_PARAM, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x20, 0x40), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(0x7f, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_ENTRY, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.CSI_INTERMEDIATE, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.CSI_INTERMEDIATE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.CSI_INTERMEDIATE, ParserAction.CSI_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x20, 0x30), ParserState.CSI_PARAM, ParserAction.COLLECT, ParserState.CSI_INTERMEDIATE);\n // esc_intermediate\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.ESCAPE_INTERMEDIATE, ParserAction.COLLECT, ParserState.ESCAPE_INTERMEDIATE);\n table.addMany(r(0x30, 0x7f), ParserState.ESCAPE_INTERMEDIATE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x30, 0x50), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x51, 0x58), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany([0x59, 0x5a, 0x5c], ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n table.addMany(r(0x60, 0x7f), ParserState.ESCAPE, ParserAction.ESC_DISPATCH, ParserState.GROUND);\n // dcs entry\n table.add(0x50, ParserState.ESCAPE, ParserAction.CLEAR, ParserState.DCS_ENTRY);\n table.addMany(EXECUTABLES, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.add(0x7f, ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_ENTRY, ParserAction.IGNORE, ParserState.DCS_ENTRY);\n table.addMany(r(0x20, 0x30), ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_ENTRY, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_ENTRY, ParserAction.COLLECT, ParserState.DCS_PARAM);\n table.addMany(EXECUTABLES, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x80), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(EXECUTABLES, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.add(0x7f, ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_PARAM);\n table.addMany(r(0x30, 0x3c), ParserState.DCS_PARAM, ParserAction.PARAM, ParserState.DCS_PARAM);\n table.addMany([0x3c, 0x3d, 0x3e, 0x3f], ParserState.DCS_PARAM, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_PARAM, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(EXECUTABLES, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.add(0x7f, ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x1c, 0x20), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x20, 0x30), ParserState.DCS_INTERMEDIATE, ParserAction.COLLECT, ParserState.DCS_INTERMEDIATE);\n table.addMany(r(0x30, 0x40), ParserState.DCS_INTERMEDIATE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_INTERMEDIATE, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_PARAM, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(r(0x40, 0x7f), ParserState.DCS_ENTRY, ParserAction.DCS_HOOK, ParserState.DCS_PASSTHROUGH);\n table.addMany(EXECUTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.addMany(PRINTABLES, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(0x7f, ParserState.DCS_PASSTHROUGH, ParserAction.IGNORE, ParserState.DCS_PASSTHROUGH);\n table.addMany([0x1b, 0x9c, 0x18, 0x1a], ParserState.DCS_PASSTHROUGH, ParserAction.DCS_UNHOOK, ParserState.GROUND);\n // special handling of unicode chars\n table.add(NON_ASCII_PRINTABLE, ParserState.GROUND, ParserAction.PRINT, ParserState.GROUND);\n table.add(NON_ASCII_PRINTABLE, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);\n table.add(NON_ASCII_PRINTABLE, ParserState.CSI_IGNORE, ParserAction.IGNORE, ParserState.CSI_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_IGNORE, ParserAction.IGNORE, ParserState.DCS_IGNORE);\n table.add(NON_ASCII_PRINTABLE, ParserState.DCS_PASSTHROUGH, ParserAction.DCS_PUT, ParserState.DCS_PASSTHROUGH);\n table.add(NON_ASCII_PRINTABLE, ParserState.APC_STRING, ParserAction.APC_PUT, ParserState.APC_STRING);\n return table;\n})();\n\n\n/**\n * EscapeSequenceParser.\n * This class implements the ANSI/DEC compatible parser described by\n * Paul Williams (https://vt100.net/emu/dec_ansi_parser).\n *\n * To implement custom ANSI compliant escape sequences it is not needed to\n * alter this parser, instead consider registering a custom handler.\n * For non ANSI compliant sequences change the transition table with\n * the optional `transitions` constructor argument and\n * reimplement the `parse` method.\n *\n * This parser is currently hardcoded to operate in ZDM (Zero Default Mode)\n * as suggested by the original parser, thus empty parameters are set to 0.\n * This this is not in line with the latest ECMA-48 specification\n * (ZDM was part of the early specs and got completely removed later on).\n *\n * Other than the original parser from vt100.net this parser supports\n * sub parameters in digital parameters separated by colons. Empty sub parameters\n * are set to -1 (no ZDM for sub parameters).\n *\n * About prefix and intermediate bytes:\n * This parser follows the assumptions of the vt100.net parser with these restrictions:\n * - only one prefix byte is allowed as first parameter byte, byte range 0x3c .. 0x3f\n * - max. two intermediates are respected, byte range 0x20 .. 0x2f\n * Note that this is not in line with ECMA-48 which does not limit either of those.\n * Furthermore ECMA-48 allows the prefix byte range at any param byte position. Currently\n * there are no known sequences that follow the broader definition of the specification.\n *\n * TODO: implement error recovery hook via error handler return values\n */\nexport class EscapeSequenceParser extends Disposable implements IEscapeSequenceParser {\n public initialState: number;\n public currentState: number;\n public precedingJoinState: number; // UnicodeJoinProperties\n\n // buffers over several parse calls\n protected _params: Params;\n protected _collect: number;\n\n // handler lookup containers\n protected _printHandler: PrintHandlerType;\n protected _executeHandlers: { [flag: number]: ExecuteHandlerType };\n protected _csiHandlers: IHandlerCollection;\n protected _escHandlers: IHandlerCollection;\n protected readonly _oscParser: IOscParser;\n protected readonly _dcsParser: IDcsParser;\n protected readonly _apcParser: IApcParser;\n protected _errorHandler: (state: IParsingState) => IParsingState;\n\n // fallback handlers\n protected _printHandlerFb: PrintFallbackHandlerType;\n protected _executeHandlerFb: ExecuteFallbackHandlerType;\n protected _csiHandlerFb: CsiFallbackHandlerType;\n protected _escHandlerFb: EscFallbackHandlerType;\n protected _errorHandlerFb: (state: IParsingState) => IParsingState;\n\n // parser stack save for async handler support\n protected _parseStack: IParserStackState = {\n state: ParserStackType.NONE,\n handlers: [],\n handlerPos: 0,\n transition: 0,\n chunkPos: 0\n };\n\n constructor(\n protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE\n ) {\n super();\n\n this.initialState = ParserState.GROUND;\n this.currentState = this.initialState;\n this._params = new Params(); // defaults to 32 storable params/subparams\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n\n // set default fallback handlers and handler lookup containers\n this._printHandlerFb = (data, start, end): void => { };\n this._executeHandlerFb = (code: number): void => { };\n this._csiHandlerFb = (ident: number, params: IParams): void => { };\n this._escHandlerFb = (ident: number): void => { };\n this._errorHandlerFb = (state: IParsingState): IParsingState => state;\n this._printHandler = this._printHandlerFb;\n this._executeHandlers = Object.create(null);\n this._csiHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n this._register(toDisposable(() => {\n this._csiHandlers = Object.create(null);\n this._executeHandlers = Object.create(null);\n this._escHandlers = Object.create(null);\n }));\n this._oscParser = this._register(new OscParser());\n this._dcsParser = this._register(new DcsParser());\n this._apcParser = this._register(new ApcParser());\n this._errorHandler = this._errorHandlerFb;\n\n // swallow 7bit ST (ESC+\\)\n this.registerEscHandler({ final: '\\\\' }, () => true);\n }\n\n protected _identifier(id: IFunctionIdentifier, finalRange: number[] = [0x40, 0x7e]): number {\n let res = 0;\n if (id.prefix) {\n if (id.prefix.length > 1) {\n throw new Error('only one byte as prefix supported');\n }\n res = id.prefix.charCodeAt(0);\n if (res && 0x3c > res || res > 0x3f) {\n throw new Error('prefix must be in range 0x3c .. 0x3f');\n }\n }\n if (id.intermediates) {\n if (id.intermediates.length > 2) {\n throw new Error('only two bytes as intermediates are supported');\n }\n for (let i = 0; i < id.intermediates.length; ++i) {\n const intermediate = id.intermediates.charCodeAt(i);\n if (0x20 > intermediate || intermediate > 0x2f) {\n throw new Error('intermediate must be in range 0x20 .. 0x2f');\n }\n res <<= 8;\n res |= intermediate;\n }\n }\n if (id.final.length !== 1) {\n throw new Error('final must be a single byte');\n }\n const finalCode = id.final.charCodeAt(0);\n if (finalRange[0] > finalCode || finalCode > finalRange[1]) {\n throw new Error(`final must be in range ${finalRange[0]} .. ${finalRange[1]}`);\n }\n res <<= 8;\n res |= finalCode;\n\n return res;\n }\n\n public identToString(ident: number): string {\n const res: string[] = [];\n while (ident) {\n res.push(String.fromCharCode(ident & 0xFF));\n ident >>= 8;\n }\n return res.reverse().join('');\n }\n\n public setPrintHandler(handler: PrintHandlerType): void {\n this._printHandler = handler;\n }\n public clearPrintHandler(): void {\n this._printHandler = this._printHandlerFb;\n }\n\n public registerEscHandler(id: IFunctionIdentifier, handler: EscHandlerType): IDisposable {\n const ident = this._identifier(id, [0x30, 0x7e]);\n this._escHandlers[ident] ??= [];\n const handlerList = this._escHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearEscHandler(id: IFunctionIdentifier): void {\n if (this._escHandlers[this._identifier(id, [0x30, 0x7e])]) delete this._escHandlers[this._identifier(id, [0x30, 0x7e])];\n }\n public setEscHandlerFallback(handler: EscFallbackHandlerType): void {\n this._escHandlerFb = handler;\n }\n\n public setExecuteHandler(flag: string, handler: ExecuteHandlerType): void {\n this._executeHandlers[flag.charCodeAt(0)] = handler;\n }\n public clearExecuteHandler(flag: string): void {\n if (this._executeHandlers[flag.charCodeAt(0)]) delete this._executeHandlers[flag.charCodeAt(0)];\n }\n public setExecuteHandlerFallback(handler: ExecuteFallbackHandlerType): void {\n this._executeHandlerFb = handler;\n }\n\n public registerCsiHandler(id: IFunctionIdentifier, handler: CsiHandlerType): IDisposable {\n const ident = this._identifier(id);\n this._csiHandlers[ident] ??= [];\n const handlerList = this._csiHandlers[ident];\n handlerList.push(handler);\n return {\n dispose: () => {\n const handlerIndex = handlerList.indexOf(handler);\n if (handlerIndex !== -1) {\n handlerList.splice(handlerIndex, 1);\n }\n }\n };\n }\n public clearCsiHandler(id: IFunctionIdentifier): void {\n if (this._csiHandlers[this._identifier(id)]) delete this._csiHandlers[this._identifier(id)];\n }\n public setCsiHandlerFallback(callback: (ident: number, params: IParams) => void): void {\n this._csiHandlerFb = callback;\n }\n\n public registerDcsHandler(id: IFunctionIdentifier, handler: IDcsHandler): IDisposable {\n return this._dcsParser.registerHandler(this._identifier(id), handler);\n }\n public clearDcsHandler(id: IFunctionIdentifier): void {\n this._dcsParser.clearHandler(this._identifier(id));\n }\n public setDcsHandlerFallback(handler: DcsFallbackHandlerType): void {\n this._dcsParser.setHandlerFallback(handler);\n }\n\n public registerOscHandler(ident: number, handler: IOscHandler): IDisposable {\n return this._oscParser.registerHandler(ident, handler);\n }\n public clearOscHandler(ident: number): void {\n this._oscParser.clearHandler(ident);\n }\n public setOscHandlerFallback(handler: OscFallbackHandlerType): void {\n this._oscParser.setHandlerFallback(handler);\n }\n\n public registerApcHandler(ident: number, handler: IApcHandler): IDisposable {\n return this._apcParser.registerHandler(ident, handler);\n }\n public clearApcHandler(ident: number): void {\n this._apcParser.clearHandler(ident);\n }\n public setApcHandlerFallback(handler: ApcFallbackHandlerType): void {\n this._apcParser.setHandlerFallback(handler);\n }\n\n public setErrorHandler(callback: (state: IParsingState) => IParsingState): void {\n this._errorHandler = callback;\n }\n public clearErrorHandler(): void {\n this._errorHandler = this._errorHandlerFb;\n }\n\n /**\n * Reset parser to initial values.\n *\n * This can also be used to lift the improper continuation error condition\n * when dealing with async handlers. Use this only as a last resort to silence\n * that error when the terminal has no pending data to be processed. Note that\n * the interrupted async handler might continue its work in the future messing\n * up the terminal state even further.\n */\n public reset(): void {\n this.currentState = this.initialState;\n this._oscParser.reset();\n this._dcsParser.reset();\n this._apcParser.reset();\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n // abort pending continuation from async handler\n // Here the RESET type indicates, that the next parse call will\n // ignore any saved stack, instead continues sync with next codepoint from GROUND\n if (this._parseStack.state !== ParserStackType.NONE) {\n this._parseStack.state = ParserStackType.RESET;\n this._parseStack.handlers = []; // also release handlers ref\n }\n }\n\n /**\n * Async parse support.\n */\n protected _preserveStack(\n state: ParserStackType,\n handlers: ResumableHandlersType,\n handlerPos: number,\n transition: number,\n chunkPos: number\n ): void {\n this._parseStack.state = state;\n this._parseStack.handlers = handlers;\n this._parseStack.handlerPos = handlerPos;\n this._parseStack.transition = transition;\n this._parseStack.chunkPos = chunkPos;\n }\n\n /**\n * Parse UTF32 codepoints in `data` up to `length`.\n *\n * Note: For several actions with high data load the parsing is optimized\n * by using local read ahead loops with hardcoded conditions to\n * avoid costly table lookups. Make sure that any change of table values\n * will be reflected in the loop conditions as well and vice versa.\n * Affected states/actions:\n * - GROUND:PRINT\n * - CSI_PARAM:PARAM\n * - DCS_PARAM:PARAM\n * - OSC_STRING:OSC_PUT\n * - DCS_PASSTHROUGH:DCS_PUT\n *\n * Note on asynchronous handler support:\n * Any handler returning a promise will be treated as asynchronous.\n * To keep the in-band blocking working for async handlers, `parse` pauses execution,\n * creates a stack save and returns the promise to the caller.\n * For proper continuation of the paused state it is important\n * to await the promise resolving. On resolve the parse must be repeated\n * with the same chunk of data and the resolved value in `promiseResult`\n * until no promise is returned.\n *\n * Important: With only sync handlers defined, parsing is completely synchronous as well.\n * As soon as an async handler is involved, synchronous parsing is not possible anymore.\n *\n * Boilerplate for proper parsing of multiple chunks with async handlers:\n *\n * ```typescript\n * async function parseMultipleChunks(chunks: Uint32Array[]): Promise {\n * for (const chunk of chunks) {\n * let result: void | Promise;\n * let prev: boolean | undefined;\n * while (result = parser.parse(chunk, chunk.length, prev)) {\n * prev = await result;\n * }\n * }\n * // finished parsing all chunks...\n * }\n * ```\n */\n public parse(data: Uint32Array, length: number, promiseResult?: boolean): void | Promise {\n let code = 0;\n let transition = 0;\n let start = 0;\n let handlerResult: void | boolean | Promise;\n\n // resume from async handler\n if (this._parseStack.state) {\n // allow sync parser reset even in continuation mode\n // Note: can be used to recover parser from improper continuation error below\n if (this._parseStack.state === ParserStackType.RESET) {\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1; // continue with next codepoint in GROUND\n } else {\n if (promiseResult === undefined || this._parseStack.state === ParserStackType.FAIL) {\n /**\n * Reject further parsing on improper continuation after pausing. This is a really bad\n * condition with screwed up execution order and prolly messed up terminal state,\n * therefore we exit hard with an exception and reject any further parsing.\n *\n * Note: With `Terminal.write` usage this exception should never occur, as the top level\n * calls are guaranteed to handle async conditions properly. If you ever encounter this\n * exception in your terminal integration it indicates, that you injected data chunks to\n * `InputHandler.parse` or `EscapeSequenceParser.parse` synchronously without waiting for\n * continuation of a running async handler.\n *\n * It is possible to get rid of this error by calling `reset`. But dont rely on that, as\n * the pending async handler still might mess up the terminal later. Instead fix the\n * faulty async handling, so this error will not be thrown anymore.\n */\n this._parseStack.state = ParserStackType.FAIL;\n throw new Error('improper continuation due to previous async handler, giving up parsing');\n }\n\n // we have to resume the old handler loop if:\n // - return value of the promise was `false`\n // - handlers are not exhausted yet\n const handlers = this._parseStack.handlers;\n let handlerPos = this._parseStack.handlerPos - 1;\n switch (this._parseStack.state) {\n case ParserStackType.CSI:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as CsiHandlerType[])[handlerPos](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.ESC:\n if (promiseResult === false && handlerPos > -1) {\n for (; handlerPos >= 0; handlerPos--) {\n handlerResult = (handlers as EscHandlerType[])[handlerPos]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._parseStack.handlerPos = handlerPos;\n return handlerResult;\n }\n }\n }\n this._parseStack.handlers = [];\n break;\n case ParserStackType.DCS:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.OSC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserStackType.APC:\n code = data[this._parseStack.chunkPos];\n handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a, promiseResult);\n if (handlerResult) {\n return handlerResult;\n }\n if (code === 0x1b) this._parseStack.transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n }\n // cleanup before continuing with the main sync loop\n this._parseStack.state = ParserStackType.NONE;\n start = this._parseStack.chunkPos + 1;\n this.precedingJoinState = 0;\n this.currentState = this._parseStack.transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n\n // continue with main sync loop\n\n // process input string\n for (let i = start; i < length; ++i) {\n code = data[i];\n\n // normal transition & action lookup\n transition = this._transitions.table[this.currentState << TableAccess.INDEX_STATE_SHIFT | (code < 0xa0 ? code : NON_ASCII_PRINTABLE)];\n switch (transition >> TableAccess.TRANSITION_ACTION_SHIFT) {\n case ParserAction.PRINT:\n // read ahead with loop unrolling\n // Note: 0x20 (SP) is included, 0x7F (DEL) is excluded\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n if (++j >= length || (code = data[j]) < 0x20 || (code > 0x7e && code < NON_ASCII_PRINTABLE)) {\n this._printHandler(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.EXECUTE:\n if (this._executeHandlers[code]) this._executeHandlers[code]();\n else this._executeHandlerFb(code);\n this.precedingJoinState = 0;\n break;\n case ParserAction.IGNORE:\n break;\n case ParserAction.ERROR:\n const inject: IParsingState = this._errorHandler(\n {\n position: i,\n code,\n currentState: this.currentState,\n collect: this._collect,\n params: this._params,\n abort: false\n });\n if (inject.abort) return;\n // inject values: currently not implemented\n break;\n case ParserAction.CSI_DISPATCH:\n // Trigger CSI Handler\n const handlers = this._csiHandlers[this._collect << 8 | code];\n let j = handlers ? handlers.length - 1 : -1;\n for (; j >= 0; j--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlers[j](this._params);\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.CSI, handlers, j, transition, i);\n return handlerResult;\n }\n }\n if (j < 0) {\n this._csiHandlerFb(this._collect << 8 | code, this._params);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.PARAM:\n // inner loop: digits (0x30 - 0x39) and ; (0x3b) and : (0x3a)\n do {\n switch (code) {\n case 0x3b:\n this._params.addParam(0); // ZDM\n break;\n case 0x3a:\n this._params.addSubParam(-1);\n break;\n default: // 0x30 - 0x39\n this._params.addDigit(code - 48);\n }\n } while (++i < length && (code = data[i]) > 0x2f && code < 0x3c);\n i--;\n break;\n case ParserAction.COLLECT:\n this._collect <<= 8;\n this._collect |= code;\n break;\n case ParserAction.ESC_DISPATCH:\n const handlersEsc = this._escHandlers[this._collect << 8 | code];\n let jj = handlersEsc ? handlersEsc.length - 1 : -1;\n for (; jj >= 0; jj--) {\n // true means success and to stop bubbling\n // a promise indicates an async handler that needs to finish before progressing\n handlerResult = handlersEsc[jj]();\n if (handlerResult === true) {\n break;\n } else if (handlerResult instanceof Promise) {\n this._preserveStack(ParserStackType.ESC, handlersEsc, jj, transition, i);\n return handlerResult;\n }\n }\n if (jj < 0) {\n this._escHandlerFb(this._collect << 8 | code);\n }\n this.precedingJoinState = 0;\n break;\n case ParserAction.CLEAR:\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n break;\n case ParserAction.DCS_HOOK:\n this._dcsParser.hook(this._collect << 8 | code, this._params);\n break;\n case ParserAction.DCS_PUT:\n // inner loop - exit DCS_PUT: 0x18, 0x1a, 0x1b, 0x7f, 0x80 - 0x9f\n // unhook triggered by: 0x1b, 0x9c (success) and 0x18, 0x1a (abort)\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._dcsParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.DCS_UNHOOK:\n handlerResult = this._dcsParser.unhook(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.DCS, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.OSC_START:\n this._oscParser.start();\n break;\n case ParserAction.OSC_PUT:\n // inner loop: 0x20 (SP) included, 0x7F (DEL) included\n for (let j = i + 1; ; j++) {\n if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._oscParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.OSC_END:\n handlerResult = this._oscParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.OSC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n case ParserAction.APC_START:\n this._apcParser.start();\n break;\n case ParserAction.APC_PUT:\n // inner loop - exit APC_PUT: 0x18, 0x1a, 0x1b, 0x9c\n for (let j = i + 1; ; ++j) {\n if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || code === 0x9c || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {\n this._apcParser.put(data, i, j);\n i = j - 1;\n break;\n }\n }\n break;\n case ParserAction.APC_END:\n handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a);\n if (handlerResult) {\n this._preserveStack(ParserStackType.APC, [], 0, transition, i);\n return handlerResult;\n }\n if (code === 0x1b) transition |= ParserState.ESCAPE;\n this._params.reset();\n this._params.addParam(0); // ZDM\n this._collect = 0;\n this.precedingJoinState = 0;\n break;\n }\n this.currentState = transition & TableAccess.TRANSITION_STATE_MASK;\n }\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n\n// 'rgb:' rule - matching: r/g/b | rr/gg/bb | rrr/ggg/bbb | rrrr/gggg/bbbb (hex digits)\nconst RGB_REX = /^([\\da-f])\\/([\\da-f])\\/([\\da-f])$|^([\\da-f]{2})\\/([\\da-f]{2})\\/([\\da-f]{2})$|^([\\da-f]{3})\\/([\\da-f]{3})\\/([\\da-f]{3})$|^([\\da-f]{4})\\/([\\da-f]{4})\\/([\\da-f]{4})$/;\n// '#...' rule - matching any hex digits\nconst HASH_REX = /^[\\da-f]+$/;\n\n/**\n * Parse color spec to RGB values (8 bit per channel).\n * See `man xparsecolor` for details about certain format specifications.\n *\n * Supported formats:\n * - rgb:// with , , in h | hh | hhh | hhhh\n * - #RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB\n *\n * All other formats like rgbi: or device-independent string specifications\n * with float numbering are not supported.\n */\nexport function parseColor(data: string): [number, number, number] | undefined {\n if (!data) return;\n // also handle uppercases\n let low = data.toLowerCase();\n if (low.startsWith('rgb:')) {\n // 'rgb:' specifier\n low = low.slice(4);\n const m = RGB_REX.exec(low);\n if (m) {\n const base = m[1] ? 15 : m[4] ? 255 : m[7] ? 4095 : 65535;\n return [\n Math.round(parseInt(m[1] || m[4] || m[7] || m[10], 16) / base * 255),\n Math.round(parseInt(m[2] || m[5] || m[8] || m[11], 16) / base * 255),\n Math.round(parseInt(m[3] || m[6] || m[9] || m[12], 16) / base * 255)\n ];\n }\n } else if (low.startsWith('#')) {\n // '#' specifier\n low = low.slice(1);\n if (HASH_REX.exec(low) && [3, 6, 9, 12].includes(low.length)) {\n const adv = low.length / 3;\n const result: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 3; ++i) {\n const c = parseInt(low.slice(adv * i, adv * i + adv), 16);\n result[i] = adv === 1 ? c << 4 : adv === 2 ? c : adv === 3 ? c >> 4 : c >> 8;\n }\n return result;\n }\n }\n\n // Named colors are currently not supported due to the large addition to the xterm.js bundle size\n // they would add. In order to support named colors, we would need some way of optionally loading\n // additional payloads so startup/download time is not bloated (see #3530).\n}\n\n// pad hex output to requested bit width\nfunction pad(n: number, bits: number): string {\n const s = n.toString(16);\n const s2 = s.length < 2 ? '0' + s : s;\n switch (bits) {\n case 4:\n return s[0];\n case 8:\n return s2;\n case 12:\n return (s2 + s2).slice(0, 3);\n default:\n return s2 + s2;\n }\n}\n\n/**\n * Convert a given color to rgb:../../.. string of `bits` depth.\n */\nexport function toRgbString(color: [number, number, number], bits: number = 16): string {\n const [r, g, b] = color;\n return `rgb:${pad(r, bits)}/${pad(g, bits)}/${pad(b, bits)}`;\n}\n", "/**\n * Copyright (c) 2025 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\n/**\n * The xterm.js version. This is updated by the publish script from package.json.\n */\nexport const XTERM_VERSION = '6.1.0-beta.141';\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n */\n\nimport { IInputHandler, IAttributeData, IDisposable, IWindowOptions, IColorEvent, IParseStack, ColorIndex, ColorRequestType, SpecialColorIndex } from 'common/Types';\nimport { C0, C1 } from 'common/data/EscapeSequences';\nimport { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';\nimport { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';\nimport { Disposable } from 'common/Lifecycle';\nimport { StringToUtf32, stringFromCodePoint, Utf8ToUtf32 } from 'common/input/TextDecoder';\nimport { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IParsingState, IEscapeSequenceParser, IParams, IFunctionIdentifier } from 'common/parser/Types';\nimport { NULL_CELL_CODE, NULL_CELL_WIDTH, Attributes, FgFlags, BgFlags, Content, UnderlineStyle } from 'common/buffer/Constants';\nimport { CellData } from 'common/buffer/CellData';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { ICoreService, IBufferService, IOptionsService, ILogService, ICoreMouseService, ICharsetService, IUnicodeService, LogLevelEnum, IOscLinkService } from 'common/services/Services';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { OscHandler } from 'common/parser/OscParser';\nimport { DcsHandler } from 'common/parser/DcsParser';\nimport { ApcHandler } from 'common/parser/ApcParser';\nimport { IBuffer } from 'common/buffer/Types';\nimport { parseColor } from 'common/input/XParseColor';\nimport { Emitter } from 'common/Event';\nimport { XTERM_VERSION } from 'common/Version';\n\n/**\n * Map collect to glevel. Used in `selectCharset`.\n */\nconst GLEVEL: { [key: string]: number } = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };\n\n/**\n * VT commands done by the parser - FIXME: move this to the parser?\n */\n// @vt: #Y ESC CSI \"Control Sequence Introducer\" \"ESC [\" \"Start of a CSI sequence.\"\n// @vt: #Y ESC OSC \"Operating System Command\" \"ESC ]\" \"Start of an OSC sequence.\"\n// @vt: #Y ESC DCS \"Device Control String\" \"ESC P\" \"Start of a DCS sequence.\"\n// @vt: #Y ESC ST \"String Terminator\" \"ESC \\\" \"Terminator used for string type sequences.\"\n// @vt: #Y ESC PM \"Privacy Message\" \"ESC ^\" \"Start of a privacy message.\"\n// @vt: #Y ESC APC \"Application Program Command\" \"ESC _\" \"Start of an APC sequence.\"\n// @vt: #Y C1 CSI \"Control Sequence Introducer\" \"\\x9B\" \"Start of a CSI sequence.\"\n// @vt: #Y C1 OSC \"Operating System Command\" \"\\x9D\" \"Start of an OSC sequence.\"\n// @vt: #Y C1 DCS \"Device Control String\" \"\\x90\" \"Start of a DCS sequence.\"\n// @vt: #Y C1 ST \"String Terminator\" \"\\x9C\" \"Terminator used for string type sequences.\"\n// @vt: #Y C1 PM \"Privacy Message\" \"\\x9E\" \"Start of a privacy message.\"\n// @vt: #Y C1 APC \"Application Program Command\" \"\\x9F\" \"Start of an APC sequence.\"\n// @vt: #Y C0 NUL \"Null\" \"\\0, \\x00\" \"NUL is ignored.\"\n// @vt: #Y C0 ESC \"Escape\" \"\\e, \\x1B\" \"Start of a sequence. Cancels any other sequence.\"\n\n/**\n * Document xterm VT features here that are currently unsupported\n */\n// @vt: #E[Supported via @xterm/addon-image.] DCS SIXEL \"SIXEL Graphics\" \"DCS Ps ; Ps ; Ps ; q \tPt ST\" \"Draw SIXEL image.\"\n// @vt: #N DCS DECUDK \"User Defined Keys\" \"DCS Ps ; Ps \\| Pt ST\" \"Definitions for user-defined keys.\"\n// @vt: #N DCS XTGETTCAP \"Request Terminfo String\" \"DCS + q Pt ST\" \"Request Terminfo String.\"\n// @vt: #N DCS XTSETTCAP \"Set Terminfo Data\" \"DCS + p Pt ST\" \"Set Terminfo Data.\"\n// @vt: #N OSC 1 \"Set Icon Name\" \"OSC 1 ; Pt BEL\" \"Set icon name.\"\n\n/**\n * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher.\n */\nconst MAX_PARSEBUFFER_LENGTH = 131072;\n\n/**\n * Limit length of title and icon name stacks.\n */\nconst STACK_LIMIT = 10;\n\n// map params to window option\nfunction paramToWindowOption(n: number, opts: IWindowOptions): boolean {\n if (n > 24) {\n return opts.setWinLines || false;\n }\n switch (n) {\n case 1: return !!opts.restoreWin;\n case 2: return !!opts.minimizeWin;\n case 3: return !!opts.setWinPosition;\n case 4: return !!opts.setWinSizePixels;\n case 5: return !!opts.raiseWin;\n case 6: return !!opts.lowerWin;\n case 7: return !!opts.refreshWin;\n case 8: return !!opts.setWinSizeChars;\n case 9: return !!opts.maximizeWin;\n case 10: return !!opts.fullscreenWin;\n case 11: return !!opts.getWinState;\n case 13: return !!opts.getWinPosition;\n case 14: return !!opts.getWinSizePixels;\n case 15: return !!opts.getScreenSizePixels;\n case 16: return !!opts.getCellSizePixels;\n case 18: return !!opts.getWinSizeChars;\n case 19: return !!opts.getScreenSizeChars;\n case 20: return !!opts.getIconTitle;\n case 21: return !!opts.getWinTitle;\n case 22: return !!opts.pushTitle;\n case 23: return !!opts.popTitle;\n case 24: return !!opts.setWinLines;\n }\n return false;\n}\n\nexport enum WindowsOptionsReportType {\n GET_WIN_SIZE_PIXELS = 0,\n GET_CELL_SIZE_PIXELS = 1\n}\n\n// create a warning log if an async handler takes longer than the limit (in ms)\nconst SLOW_ASYNC_LIMIT = 5000;\n\n// Work variables to avoid garbage collection\nlet $temp = 0;\n\n/**\n * The terminal's standard implementation of IInputHandler, this handles all\n * input from the Parser.\n *\n * Refer to http://invisible-island.net/xterm/ctlseqs/ctlseqs.html to understand\n * each function's header comment.\n */\nexport class InputHandler extends Disposable implements IInputHandler {\n private _parseBuffer: Uint32Array = new Uint32Array(4096);\n private _stringDecoder: StringToUtf32 = new StringToUtf32();\n private _utf8Decoder: Utf8ToUtf32 = new Utf8ToUtf32();\n private _windowTitle = '';\n private _iconName = '';\n private _dirtyRowTracker: IDirtyRowTracker;\n protected _windowTitleStack: string[] = [];\n protected _iconNameStack: string[] = [];\n\n private _curAttrData: IAttributeData = DEFAULT_ATTR_DATA.clone();\n public getAttrData(): IAttributeData { return this._curAttrData; }\n private _eraseAttrDataInternal: IAttributeData = DEFAULT_ATTR_DATA.clone();\n\n private _activeBuffer: IBuffer;\n\n private readonly _onRequestBell = this._register(new Emitter());\n public readonly onRequestBell = this._onRequestBell.event;\n private readonly _onRequestRefreshRows = this._register(new Emitter<{ start: number, end: number } | undefined>());\n public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;\n private readonly _onRequestReset = this._register(new Emitter());\n public readonly onRequestReset = this._onRequestReset.event;\n private readonly _onRequestSendFocus = this._register(new Emitter());\n public readonly onRequestSendFocus = this._onRequestSendFocus.event;\n private readonly _onRequestSyncScrollBar = this._register(new Emitter());\n public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;\n private readonly _onRequestWindowsOptionsReport = this._register(new Emitter());\n public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;\n\n private readonly _onA11yChar = this._register(new Emitter());\n public readonly onA11yChar = this._onA11yChar.event;\n private readonly _onA11yTab = this._register(new Emitter());\n public readonly onA11yTab = this._onA11yTab.event;\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n private readonly _onScroll = this._register(new Emitter());\n public readonly onScroll = this._onScroll.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onColor = this._register(new Emitter());\n public readonly onColor = this._onColor.event;\n private readonly _onRequestColorSchemeQuery = this._register(new Emitter());\n public readonly onRequestColorSchemeQuery = this._onRequestColorSchemeQuery.event;\n\n private _parseStack: IParseStack = {\n paused: false,\n cursorStartX: 0,\n cursorStartY: 0,\n decodedLength: 0,\n position: 0\n };\n\n constructor(\n private readonly _bufferService: IBufferService,\n private readonly _charsetService: ICharsetService,\n private readonly _coreService: ICoreService,\n private readonly _logService: ILogService,\n private readonly _optionsService: IOptionsService,\n private readonly _oscLinkService: IOscLinkService,\n private readonly _coreMouseService: ICoreMouseService,\n private readonly _unicodeService: IUnicodeService,\n private readonly _parser: IEscapeSequenceParser = new EscapeSequenceParser()\n ) {\n super();\n this._register(this._parser);\n this._dirtyRowTracker = new DirtyRowTracker(this._bufferService);\n\n // Track properties used in performance critical code manually to avoid using slow getters\n this._activeBuffer = this._bufferService.buffer;\n this._register(this._bufferService.buffers.onBufferActivate(e => this._activeBuffer = e.activeBuffer));\n\n /**\n * custom fallback handlers\n */\n this._parser.setCsiHandlerFallback((ident, params) => {\n this._logService.debug('Unknown CSI code: ', { identifier: this._parser.identToString(ident), params: params.toArray() });\n });\n this._parser.setEscHandlerFallback(ident => {\n this._logService.debug('Unknown ESC code: ', { identifier: this._parser.identToString(ident) });\n });\n this._parser.setExecuteHandlerFallback(code => {\n this._logService.debug('Unknown EXECUTE code: ', { code });\n });\n this._parser.setOscHandlerFallback((identifier, action, data) => {\n this._logService.debug('Unknown OSC code: ', { identifier, action, data });\n });\n this._parser.setDcsHandlerFallback((ident, action, payload) => {\n if (action === 'HOOK') {\n payload = payload.toArray();\n }\n this._logService.debug('Unknown DCS code: ', { identifier: this._parser.identToString(ident), action, payload });\n });\n\n /**\n * print handler\n */\n this._parser.setPrintHandler((data, start, end) => this.print(data, start, end));\n\n /**\n * CSI handler\n */\n this._parser.registerCsiHandler({ final: '@' }, params => this.insertChars(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: '@' }, params => this.scrollLeft(params));\n this._parser.registerCsiHandler({ final: 'A' }, params => this.cursorUp(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'A' }, params => this.scrollRight(params));\n this._parser.registerCsiHandler({ final: 'B' }, params => this.cursorDown(params));\n this._parser.registerCsiHandler({ final: 'C' }, params => this.cursorForward(params));\n this._parser.registerCsiHandler({ final: 'D' }, params => this.cursorBackward(params));\n this._parser.registerCsiHandler({ final: 'E' }, params => this.cursorNextLine(params));\n this._parser.registerCsiHandler({ final: 'F' }, params => this.cursorPrecedingLine(params));\n this._parser.registerCsiHandler({ final: 'G' }, params => this.cursorCharAbsolute(params));\n this._parser.registerCsiHandler({ final: 'H' }, params => this.cursorPosition(params));\n this._parser.registerCsiHandler({ final: 'I' }, params => this.cursorForwardTab(params));\n this._parser.registerCsiHandler({ final: 'J' }, params => this.eraseInDisplay(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'J' }, params => this.eraseInDisplay(params, true));\n this._parser.registerCsiHandler({ final: 'K' }, params => this.eraseInLine(params, false));\n this._parser.registerCsiHandler({ prefix: '?', final: 'K' }, params => this.eraseInLine(params, true));\n this._parser.registerCsiHandler({ final: 'L' }, params => this.insertLines(params));\n this._parser.registerCsiHandler({ final: 'M' }, params => this.deleteLines(params));\n this._parser.registerCsiHandler({ final: 'P' }, params => this.deleteChars(params));\n this._parser.registerCsiHandler({ final: 'S' }, params => this.scrollUp(params));\n this._parser.registerCsiHandler({ final: 'T' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: 'X' }, params => this.eraseChars(params));\n this._parser.registerCsiHandler({ final: 'Z' }, params => this.cursorBackwardTab(params));\n this._parser.registerCsiHandler({ final: '^' }, params => this.scrollDown(params));\n this._parser.registerCsiHandler({ final: '`' }, params => this.charPosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'a' }, params => this.hPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'b' }, params => this.repeatPrecedingCharacter(params));\n this._parser.registerCsiHandler({ final: 'c' }, params => this.sendDeviceAttributesPrimary(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'c' }, params => this.sendDeviceAttributesSecondary(params));\n this._parser.registerCsiHandler({ final: 'd' }, params => this.linePosAbsolute(params));\n this._parser.registerCsiHandler({ final: 'e' }, params => this.vPositionRelative(params));\n this._parser.registerCsiHandler({ final: 'f' }, params => this.hVPosition(params));\n this._parser.registerCsiHandler({ final: 'g' }, params => this.tabClear(params));\n this._parser.registerCsiHandler({ final: 'h' }, params => this.setMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this.setModePrivate(params));\n this._parser.registerCsiHandler({ final: 'l' }, params => this.resetMode(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this.resetModePrivate(params));\n this._parser.registerCsiHandler({ final: 'm' }, params => this.charAttributes(params));\n this._parser.registerCsiHandler({ final: 'n' }, params => this.deviceStatus(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'n' }, params => this.deviceStatusPrivate(params));\n this._parser.registerCsiHandler({ intermediates: '!', final: 'p' }, params => this.softReset(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'q' }, params => this.sendXtVersion(params));\n this._parser.registerCsiHandler({ intermediates: ' ', final: 'q' }, params => this.setCursorStyle(params));\n this._parser.registerCsiHandler({ final: 'r' }, params => this.setScrollRegion(params));\n this._parser.registerCsiHandler({ final: 's' }, params => this.saveCursor(params));\n this._parser.registerCsiHandler({ final: 't' }, params => this.windowOptions(params));\n this._parser.registerCsiHandler({ final: 'u' }, params => this.restoreCursor(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '}' }, params => this.insertColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\\'', final: '~' }, params => this.deleteColumns(params));\n this._parser.registerCsiHandler({ intermediates: '\"', final: 'q' }, params => this.selectProtected(params));\n this._parser.registerCsiHandler({ intermediates: '$', final: 'p' }, params => this.requestMode(params, true));\n this._parser.registerCsiHandler({ prefix: '?', intermediates: '$', final: 'p' }, params => this.requestMode(params, false));\n\n // Kitty keyboard protocol handlers\n this._parser.registerCsiHandler({ prefix: '=', final: 'u' }, params => this.kittyKeyboardSet(params));\n this._parser.registerCsiHandler({ prefix: '?', final: 'u' }, params => this.kittyKeyboardQuery(params));\n this._parser.registerCsiHandler({ prefix: '>', final: 'u' }, params => this.kittyKeyboardPush(params));\n this._parser.registerCsiHandler({ prefix: '<', final: 'u' }, params => this.kittyKeyboardPop(params));\n\n /**\n * execute handler\n */\n this._parser.setExecuteHandler(C0.BEL, () => this.bell());\n this._parser.setExecuteHandler(C0.LF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.VT, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.FF, () => this.lineFeed());\n this._parser.setExecuteHandler(C0.CR, () => this.carriageReturn());\n this._parser.setExecuteHandler(C0.BS, () => this.backspace());\n this._parser.setExecuteHandler(C0.HT, () => this.tab());\n this._parser.setExecuteHandler(C0.SO, () => this.shiftOut());\n this._parser.setExecuteHandler(C0.SI, () => this.shiftIn());\n // FIXME: What do to with missing? Old code just added those to print.\n\n this._parser.setExecuteHandler(C1.IND, () => this.index());\n this._parser.setExecuteHandler(C1.NEL, () => this.nextLine());\n this._parser.setExecuteHandler(C1.HTS, () => this.tabSet());\n\n /**\n * OSC handler\n */\n // 0 - icon name + title\n this._parser.registerOscHandler(0, new OscHandler(data => { this.setTitle(data); this.setIconName(data); return true; }));\n // 1 - icon name\n this._parser.registerOscHandler(1, new OscHandler(data => this.setIconName(data)));\n // 2 - title\n this._parser.registerOscHandler(2, new OscHandler(data => this.setTitle(data)));\n // 3 - set property X in the form \"prop=value\"\n // 4 - Change Color Number\n this._parser.registerOscHandler(4, new OscHandler(data => this.setOrReportIndexedColor(data)));\n // 5 - Change Special Color Number\n // 6 - Enable/disable Special Color Number c\n // 7 - current directory? (not in xterm spec, see https://gitlab.com/gnachman/iterm2/issues/3939)\n // 8 - create hyperlink (not in xterm spec, see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)\n this._parser.registerOscHandler(8, new OscHandler(data => this.setHyperlink(data)));\n // 10 - Change VT100 text foreground color to Pt.\n this._parser.registerOscHandler(10, new OscHandler(data => this.setOrReportFgColor(data)));\n // 11 - Change VT100 text background color to Pt.\n this._parser.registerOscHandler(11, new OscHandler(data => this.setOrReportBgColor(data)));\n // 12 - Change text cursor color to Pt.\n this._parser.registerOscHandler(12, new OscHandler(data => this.setOrReportCursorColor(data)));\n // 13 - Change mouse foreground color to Pt.\n // 14 - Change mouse background color to Pt.\n // 15 - Change Tektronix foreground color to Pt.\n // 16 - Change Tektronix background color to Pt.\n // 17 - Change highlight background color to Pt.\n // 18 - Change Tektronix cursor color to Pt.\n // 19 - Change highlight foreground color to Pt.\n // 46 - Change Log File to Pt.\n // 50 - Set Font to Pt.\n // 51 - reserved for Emacs shell.\n // 52 - Manipulate Selection Data.\n // 104 ; c - Reset Color Number c.\n this._parser.registerOscHandler(104, new OscHandler(data => this.restoreIndexedColor(data)));\n // 105 ; c - Reset Special Color Number c.\n // 106 ; c; f - Enable/disable Special Color Number c.\n // 110 - Reset VT100 text foreground color.\n this._parser.registerOscHandler(110, new OscHandler(data => this.restoreFgColor(data)));\n // 111 - Reset VT100 text background color.\n this._parser.registerOscHandler(111, new OscHandler(data => this.restoreBgColor(data)));\n // 112 - Reset text cursor color.\n this._parser.registerOscHandler(112, new OscHandler(data => this.restoreCursorColor(data)));\n // 113 - Reset mouse foreground color.\n // 114 - Reset mouse background color.\n // 115 - Reset Tektronix foreground color.\n // 116 - Reset Tektronix background color.\n // 117 - Reset highlight color.\n // 118 - Reset Tektronix cursor color.\n // 119 - Reset highlight foreground color.\n\n /**\n * ESC handlers\n */\n this._parser.registerEscHandler({ final: '7' }, () => this.saveCursor());\n this._parser.registerEscHandler({ final: '8' }, () => this.restoreCursor());\n this._parser.registerEscHandler({ final: 'D' }, () => this.index());\n this._parser.registerEscHandler({ final: 'E' }, () => this.nextLine());\n this._parser.registerEscHandler({ final: 'H' }, () => this.tabSet());\n this._parser.registerEscHandler({ final: 'M' }, () => this.reverseIndex());\n this._parser.registerEscHandler({ final: '=' }, () => this.keypadApplicationMode());\n this._parser.registerEscHandler({ final: '>' }, () => this.keypadNumericMode());\n this._parser.registerEscHandler({ final: 'c' }, () => this.fullReset());\n this._parser.registerEscHandler({ final: 'n' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: 'o' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '|' }, () => this.setgLevel(3));\n this._parser.registerEscHandler({ final: '}' }, () => this.setgLevel(2));\n this._parser.registerEscHandler({ final: '~' }, () => this.setgLevel(1));\n this._parser.registerEscHandler({ intermediates: '%', final: '@' }, () => this.selectDefaultCharset());\n this._parser.registerEscHandler({ intermediates: '%', final: 'G' }, () => this.selectDefaultCharset());\n for (const flag in CHARSETS) {\n this._parser.registerEscHandler({ intermediates: '(', final: flag }, () => this.selectCharset('(' + flag));\n this._parser.registerEscHandler({ intermediates: ')', final: flag }, () => this.selectCharset(')' + flag));\n this._parser.registerEscHandler({ intermediates: '*', final: flag }, () => this.selectCharset('*' + flag));\n this._parser.registerEscHandler({ intermediates: '+', final: flag }, () => this.selectCharset('+' + flag));\n this._parser.registerEscHandler({ intermediates: '-', final: flag }, () => this.selectCharset('-' + flag));\n this._parser.registerEscHandler({ intermediates: '.', final: flag }, () => this.selectCharset('.' + flag));\n this._parser.registerEscHandler({ intermediates: '/', final: flag }, () => this.selectCharset('/' + flag)); // TODO: supported?\n }\n this._parser.registerEscHandler({ intermediates: '#', final: '8' }, () => this.screenAlignmentPattern());\n\n /**\n * error handler\n */\n this._parser.setErrorHandler((state: IParsingState) => {\n this._logService.error('Parsing error: ', state);\n return state;\n });\n\n /**\n * DCS handler\n */\n this._parser.registerDcsHandler({ intermediates: '$', final: 'q' }, new DcsHandler((data, params) => this.requestStatusString(data, params)));\n }\n\n /**\n * Async parse support.\n */\n private _preserveStack(cursorStartX: number, cursorStartY: number, decodedLength: number, position: number): void {\n this._parseStack.paused = true;\n this._parseStack.cursorStartX = cursorStartX;\n this._parseStack.cursorStartY = cursorStartY;\n this._parseStack.decodedLength = decodedLength;\n this._parseStack.position = position;\n }\n\n private _logSlowResolvingAsync(p: Promise): void {\n // log a limited warning about an async handler taking too long\n if (this._logService.logLevel <= LogLevelEnum.WARN) {\n let slowTimeout: ReturnType | undefined;\n const slowPromise = new Promise((_res, rej) => {\n slowTimeout = setTimeout(() => rej('#SLOW_TIMEOUT'), SLOW_ASYNC_LIMIT);\n });\n Promise.race([p, slowPromise])\n .then(() => {\n if (slowTimeout !== undefined) {\n clearTimeout(slowTimeout);\n }\n }, err => {\n if (slowTimeout !== undefined) {\n clearTimeout(slowTimeout);\n }\n if (err !== '#SLOW_TIMEOUT') {\n throw err;\n }\n console.warn(`async parser handler taking longer than ${SLOW_ASYNC_LIMIT} ms`);\n });\n }\n }\n\n private _getCurrentLinkId(): number {\n return this._curAttrData.extended.urlId;\n }\n\n /**\n * Parse call with async handler support.\n *\n * Whether the stack state got preserved for the next call, is indicated by the return value:\n * - undefined (void):\n * all handlers were sync, no stack save, continue normally with next chunk\n * - Promise\\:\n * execution stopped at async handler, stack saved, continue with same chunk and the promise\n * resolve value as `promiseResult` until the method returns `undefined`\n *\n * Note: This method should only be called by `Terminal.write` to ensure correct execution order\n * and proper continuation of async parser handlers.\n */\n public parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise {\n let result: void | Promise;\n let cursorStartX = this._activeBuffer.x;\n let cursorStartY = this._activeBuffer.y;\n let start = 0;\n const wasPaused = this._parseStack.paused;\n\n if (wasPaused) {\n // assumption: _parseBuffer never mutates between async calls\n if (result = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, promiseResult)) {\n this._logSlowResolvingAsync(result);\n return result;\n }\n cursorStartX = this._parseStack.cursorStartX;\n cursorStartY = this._parseStack.cursorStartY;\n this._parseStack.paused = false;\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n start = this._parseStack.position + MAX_PARSEBUFFER_LENGTH;\n }\n }\n\n // Log debug data, the log level gate is to prevent extra work in this hot path\n if (this._logService.logLevel <= LogLevelEnum.DEBUG) {\n this._logService.debug(`parsing data ${typeof data === 'string' ? ` \"${data}\"` : ` \"${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}\"`}`);\n }\n if (this._logService.logLevel === LogLevelEnum.TRACE) {\n this._logService.trace(`parsing data (codes)`, typeof data === 'string'\n ? data.split('').map(e => e.charCodeAt(0))\n : data\n );\n }\n\n // resize input buffer if needed\n if (this._parseBuffer.length < data.length) {\n if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) {\n this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH));\n }\n }\n\n // Clear the dirty row service so we know which lines changed as a result of parsing\n // Important: do not clear between async calls, otherwise we lost pending update information.\n if (!wasPaused) {\n this._dirtyRowTracker.clearRange();\n }\n\n // process big data in smaller chunks\n if (data.length > MAX_PARSEBUFFER_LENGTH) {\n for (let i = start; i < data.length; i += MAX_PARSEBUFFER_LENGTH) {\n const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length;\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer)\n : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, i);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n } else {\n if (!wasPaused) {\n const len = (typeof data === 'string')\n ? this._stringDecoder.decode(data, this._parseBuffer)\n : this._utf8Decoder.decode(data, this._parseBuffer);\n if (result = this._parser.parse(this._parseBuffer, len)) {\n this._preserveStack(cursorStartX, cursorStartY, len, 0);\n this._logSlowResolvingAsync(result);\n return result;\n }\n }\n }\n\n if (this._activeBuffer.x !== cursorStartX || this._activeBuffer.y !== cursorStartY) {\n this._onCursorMove.fire();\n }\n\n // Refresh any dirty rows accumulated as part of parsing, fire only for rows within the\n // _viewport_ which is relative to ydisp, not relative to ybase.\n const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n if (viewportStart < this._bufferService.rows) {\n this._onRequestRefreshRows.fire({\n start: Math.min(viewportStart, this._bufferService.rows - 1),\n end: Math.min(viewportEnd, this._bufferService.rows - 1)\n });\n }\n }\n\n public print(data: Uint32Array, start: number, end: number): void {\n let code: number;\n let chWidth: number;\n const charset = this._charsetService.charset;\n const screenReaderMode = this._optionsService.rawOptions.screenReaderMode;\n const cols = this._bufferService.cols;\n const wraparoundMode = this._coreService.decPrivateModes.wraparound;\n const insertMode = this._coreService.modes.insertMode;\n const curAttr = this._curAttrData;\n let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n\n // Defensive check: bufferRow can be undefined if a resize occurred mid-write due to async\n // scheduling gaps in WriteBuffer. See https://github.com/xtermjs/xterm.js/issues/5597\n if (!bufferRow) {\n return;\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n // handle wide chars: reset start_cell-1 if we would overwrite the second cell of a wide char\n if (this._activeBuffer.x && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x - 1) === 2) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, curAttr);\n }\n\n let precedingJoinState = this._parser.precedingJoinState;\n for (let pos = start; pos < end; ++pos) {\n code = data[pos];\n\n // Soft hyphen's (U+00AD) behavior is ambiguous and differs across terminals. We opt to treat\n // it as a zero-width hint to text layout engines and simply ignore it.\n if (code === 0xAD) {\n continue;\n }\n\n // get charset replacement character\n // charset is only defined for ASCII, therefore we only\n // search for an replacement char if code < 127\n if (code < 127 && charset) {\n const ch = charset[String.fromCharCode(code)];\n if (ch) {\n code = ch.charCodeAt(0);\n }\n }\n\n const currentInfo = this._unicodeService.charProperties(code, precedingJoinState);\n chWidth = UnicodeService.extractWidth(currentInfo);\n const shouldJoin = UnicodeService.extractShouldJoin(currentInfo);\n const oldWidth = shouldJoin ? UnicodeService.extractWidth(precedingJoinState) : 0;\n precedingJoinState = currentInfo;\n\n if (screenReaderMode) {\n this._onA11yChar.fire(stringFromCodePoint(code));\n }\n if (this._getCurrentLinkId()) {\n this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y);\n }\n\n // goto next line if ch would overflow\n // NOTE: To avoid costly width checks here,\n // the terminal does not allow a cols < 2.\n if (this._activeBuffer.x + chWidth - oldWidth > cols) {\n // autowrap - DECAWM\n // automatically wraps to the beginning of the next line\n if (wraparoundMode) {\n const oldRow = bufferRow;\n let oldCol = this._activeBuffer.x - oldWidth;\n this._activeBuffer.x = oldWidth;\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData(), true);\n } else {\n if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n // The line already exists (eg. the initial viewport), mark it as a\n // wrapped line\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;\n }\n // row changed, get it again\n bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (!bufferRow) {\n return;\n }\n if (oldWidth > 0 && bufferRow instanceof BufferLine) {\n // Combining character widens 1 column to 2.\n // Move old character to next line.\n bufferRow.copyCellsFrom(oldRow as BufferLine,\n oldCol, 0, oldWidth, false);\n }\n // clear left over cells to the right\n while (oldCol < cols) {\n oldRow.setCellFromCodepoint(oldCol++, 0, 1, curAttr);\n }\n } else {\n this._activeBuffer.x = cols - 1;\n if (chWidth === 2) {\n // FIXME: check for xterm behavior\n // What to do here? We got a wide char that does not fit into last cell\n continue;\n }\n }\n }\n\n // insert combining char at last cursor position\n // this._activeBuffer.x should never be 0 for a combining char\n // since they always follow a cell consuming char\n // therefore we can test for this._activeBuffer.x to avoid overflow left\n if (shouldJoin && this._activeBuffer.x) {\n const offset = bufferRow.getWidth(this._activeBuffer.x - 1) ? 1 : 2;\n // if empty cell after fullwidth, need to go 2 cells back\n // it is save to step 2 cells back here\n // since an empty cell is only set by fullwidth chars\n bufferRow.addCodepointToCell(this._activeBuffer.x - offset,\n code, chWidth);\n for (let delta = chWidth - oldWidth; --delta >= 0;) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n continue;\n }\n\n // insert mode: move characters to right\n if (insertMode) {\n // right shift cells according to the width\n bufferRow.insertCells(this._activeBuffer.x, chWidth - oldWidth, this._activeBuffer.getNullCell(curAttr));\n // test last cell - since the last cell has only room for\n // a halfwidth char any fullwidth shifted there is lost\n // and will be set to empty cell\n if (bufferRow.getWidth(cols - 1) === 2) {\n bufferRow.setCellFromCodepoint(cols - 1, NULL_CELL_CODE, NULL_CELL_WIDTH, curAttr);\n }\n }\n\n // write current char to buffer and advance cursor\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, code, chWidth, curAttr);\n\n // fullwidth char - also set next cell to placeholder stub and advance cursor\n // for graphemes bigger than fullwidth we can simply loop to zero\n // we already made sure above, that this._activeBuffer.x + chWidth will not overflow right\n if (chWidth > 0) {\n while (--chWidth) {\n // other than a regular empty cell a cell following a wide char has no width\n bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);\n }\n }\n }\n\n this._parser.precedingJoinState = precedingJoinState;\n\n // handle wide chars: reset cell to the right if it is second cell of a wide char\n if (this._activeBuffer.x < cols && end - start > 0 && bufferRow.getWidth(this._activeBuffer.x) === 0 && !bufferRow.hasContent(this._activeBuffer.x)) {\n bufferRow.setCellFromCodepoint(this._activeBuffer.x, 0, 1, curAttr);\n }\n\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Forward registerCsiHandler from parser.\n */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n if (id.final === 't' && !id.prefix && !id.intermediates) {\n // security: always check whether window option is allowed\n return this._parser.registerCsiHandler(id, params => {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n return callback(params);\n });\n }\n return this._parser.registerCsiHandler(id, callback);\n }\n\n /**\n * Forward registerDcsHandler from parser.\n */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._parser.registerDcsHandler(id, new DcsHandler(callback));\n }\n\n /**\n * Forward registerEscHandler from parser.\n */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._parser.registerEscHandler(id, callback);\n }\n\n /**\n * Forward registerOscHandler from parser.\n */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerOscHandler(ident, new OscHandler(callback));\n }\n\n /**\n * Forward registerApcHandler from parser.\n */\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._parser.registerApcHandler(ident, new ApcHandler(callback));\n }\n\n /**\n * BEL\n * Bell (Ctrl-G).\n *\n * @vt: #Y C0 BEL \"Bell\" \"\\a, \\x07\" \"Ring the bell.\"\n * The behavior of the bell is further customizable with `ITerminalOptions.bellStyle`\n * and `ITerminalOptions.bellSound`.\n */\n public bell(): boolean {\n this._onRequestBell.fire();\n return true;\n }\n\n /**\n * LF\n * Line Feed or New Line (NL). (LF is Ctrl-J).\n *\n * @vt: #Y C0 LF \"Line Feed\" \"\\n, \\x0A\" \"Move the cursor one row down, scrolling if needed.\"\n * Scrolling is restricted to scroll margins and will only happen on the bottom line.\n *\n * @vt: #Y C0 VT \"Vertical Tabulation\" \"\\v, \\x0B\" \"Treated as LF.\"\n * @vt: #Y C0 FF \"Form Feed\" \"\\f, \\x0C\" \"Treated as LF.\"\n */\n public lineFeed(): boolean {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._optionsService.rawOptions.convertEol) {\n this._activeBuffer.x = 0;\n }\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n } else {\n // There was an explicit line feed (not just a carriage return), so clear the wrapped state of\n // the line. This is particularly important on conpty/Windows where revisiting lines to\n // reprint is common, especially on resize. Note that the windowsMode wrapped line heuristics\n // can mess with this so windowsMode should be disabled, which is recommended on Windows build\n // 21376 and above.\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n }\n // If the end of the line is hit, prevent this action from wrapping around to the next line.\n if (this._activeBuffer.x >= this._bufferService.cols) {\n this._activeBuffer.x--;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n\n this._onLineFeed.fire();\n return true;\n }\n\n /**\n * CR\n * Carriage Return (Ctrl-M).\n *\n * @vt: #Y C0 CR \"Carriage Return\" \"\\r, \\x0D\" \"Move the cursor to the beginning of the row.\"\n */\n public carriageReturn(): boolean {\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * BS\n * Backspace (Ctrl-H).\n *\n * @vt: #Y C0 BS \"Backspace\" \"\\b, \\x08\" \"Move the cursor one position to the left.\"\n * By default it is not possible to move the cursor past the leftmost position.\n * If `reverse wrap-around` (`CSI ? 45 h`) is set, a previous soft line wrap (DECAWM)\n * can be undone with BS within the scroll margins. In that case the cursor will wrap back\n * to the end of the previous row. Note that it is not possible to peek back into the scrollbuffer\n * with the cursor, thus at the home position (top-leftmost cell) this has no effect.\n */\n public backspace(): boolean {\n // reverse wrap-around is disabled\n if (!this._coreService.decPrivateModes.reverseWraparound) {\n this._restrictCursor();\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n }\n return true;\n }\n\n // reverse wrap-around is enabled\n // other than for normal operation mode, reverse wrap-around allows the cursor\n // to be at x=cols to be able to address the last cell of a row by BS\n this._restrictCursor(this._bufferService.cols);\n\n if (this._activeBuffer.x > 0) {\n this._activeBuffer.x--;\n } else {\n /**\n * reverse wrap-around handling:\n * Our implementation deviates from xterm on purpose. Details:\n * - only previous soft NLs can be reversed (isWrapped=true)\n * - only works within scrollborders (top/bottom, left/right not yet supported)\n * - cannot peek into scrollbuffer\n * - any cursor movement sequence keeps working as expected\n */\n if (this._activeBuffer.x === 0\n && this._activeBuffer.y > this._activeBuffer.scrollTop\n && this._activeBuffer.y <= this._activeBuffer.scrollBottom\n && this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)?.isWrapped) {\n this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = false;\n this._activeBuffer.y--;\n this._activeBuffer.x = this._bufferService.cols - 1;\n // find last taken cell - last cell can have 3 different states:\n // - hasContent(true) + hasWidth(1): narrow char - we are done\n // - hasWidth(0): second part of wide char - we are done\n // - hasContent(false) + hasWidth(1): empty cell due to early wrapping wide char, go one\n // cell further back\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n if (line.hasWidth(this._activeBuffer.x) && !line.hasContent(this._activeBuffer.x)) {\n this._activeBuffer.x--;\n // We do this only once, since width=1 + hasContent=false currently happens only once\n // before early wrapping of a wide char.\n // This needs to be fixed once we support graphemes taking more than 2 cells.\n }\n }\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * TAB\n * Horizontal Tab (HT) (Ctrl-I).\n *\n * @vt: #Y C0 HT \"Horizontal Tabulation\" \"\\t, \\x09\" \"Move the cursor to the next character tab stop.\"\n */\n public tab(): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n const originalX = this._activeBuffer.x;\n this._activeBuffer.x = this._activeBuffer.nextStop();\n if (this._optionsService.rawOptions.screenReaderMode) {\n this._onA11yTab.fire(this._activeBuffer.x - originalX);\n }\n return true;\n }\n\n /**\n * SO\n * Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This invokes the\n * G1 character set.\n *\n * @vt: #P[Only limited ISO-2022 charset support.] C0 SO \"Shift Out\" \"\\x0E\" \"Switch to an alternative character set.\"\n */\n public shiftOut(): boolean {\n this._charsetService.setgLevel(1);\n return true;\n }\n\n /**\n * SI\n * Shift In (Ctrl-O) -> Switch to Standard Character Set. This invokes the G0\n * character set (the default).\n *\n * @vt: #Y C0 SI \"Shift In\" \"\\x0F\" \"Return to regular character set after Shift Out.\"\n */\n public shiftIn(): boolean {\n this._charsetService.setgLevel(0);\n return true;\n }\n\n /**\n * Restrict cursor to viewport size / scroll margin (origin mode).\n */\n private _restrictCursor(maxCol: number = this._bufferService.cols - 1): void {\n this._activeBuffer.x = Math.min(maxCol, Math.max(0, this._activeBuffer.x));\n this._activeBuffer.y = this._coreService.decPrivateModes.origin\n ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y))\n : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y));\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set absolute cursor position.\n */\n private _setCursor(x: number, y: number): void {\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n if (this._coreService.decPrivateModes.origin) {\n this._activeBuffer.x = x;\n this._activeBuffer.y = this._activeBuffer.scrollTop + y;\n } else {\n this._activeBuffer.x = x;\n this._activeBuffer.y = y;\n }\n this._restrictCursor();\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n\n /**\n * Set relative cursor position.\n */\n private _moveCursor(x: number, y: number): void {\n // for relative changes we have to make sure we are within 0 .. cols/rows - 1\n // before calculating the new position\n this._restrictCursor();\n this._setCursor(this._activeBuffer.x + x, this._activeBuffer.y + y);\n }\n\n /**\n * CSI Ps A\n * Cursor Up Ps Times (default = 1) (CUU).\n *\n * @vt: #Y CSI CUU \"Cursor Up\" \"CSI Ps A\" \"Move cursor `Ps` times up (default=1).\"\n * If the cursor would pass the top scroll margin, it will stop there.\n */\n public cursorUp(params: IParams): boolean {\n // stop at scrollTop\n const diffToTop = this._activeBuffer.y - this._activeBuffer.scrollTop;\n if (diffToTop >= 0) {\n this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));\n } else {\n this._moveCursor(0, -(params.params[0] || 1));\n }\n return true;\n }\n\n /**\n * CSI Ps B\n * Cursor Down Ps Times (default = 1) (CUD).\n *\n * @vt: #Y CSI CUD \"Cursor Down\" \"CSI Ps B\" \"Move cursor `Ps` times down (default=1).\"\n * If the cursor would pass the bottom scroll margin, it will stop there.\n */\n public cursorDown(params: IParams): boolean {\n // stop at scrollBottom\n const diffToBottom = this._activeBuffer.scrollBottom - this._activeBuffer.y;\n if (diffToBottom >= 0) {\n this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));\n } else {\n this._moveCursor(0, params.params[0] || 1);\n }\n return true;\n }\n\n /**\n * CSI Ps C\n * Cursor Forward Ps Times (default = 1) (CUF).\n *\n * @vt: #Y CSI CUF \"Cursor Forward\" \"CSI Ps C\" \"Move cursor `Ps` times forward (default=1).\"\n */\n public cursorForward(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Ps D\n * Cursor Backward Ps Times (default = 1) (CUB).\n *\n * @vt: #Y CSI CUB \"Cursor Backward\" \"CSI Ps D\" \"Move cursor `Ps` times backward (default=1).\"\n */\n public cursorBackward(params: IParams): boolean {\n this._moveCursor(-(params.params[0] || 1), 0);\n return true;\n }\n\n /**\n * CSI Ps E\n * Cursor Next Line Ps Times (default = 1) (CNL).\n * Other than cursorDown (CUD) also set the cursor to first column.\n *\n * @vt: #Y CSI CNL \"Cursor Next Line\" \"CSI Ps E\" \"Move cursor `Ps` times down (default=1) and to the first column.\"\n * Same as CUD, additionally places the cursor at the first column.\n */\n public cursorNextLine(params: IParams): boolean {\n this.cursorDown(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps F\n * Cursor Previous Line Ps Times (default = 1) (CPL).\n * Other than cursorUp (CUU) also set the cursor to first column.\n *\n * @vt: #Y CSI CPL \"Cursor Backward\" \"CSI Ps F\" \"Move cursor `Ps` times up (default=1) and to the first column.\"\n * Same as CUU, additionally places the cursor at the first column.\n */\n public cursorPrecedingLine(params: IParams): boolean {\n this.cursorUp(params);\n this._activeBuffer.x = 0;\n return true;\n }\n\n /**\n * CSI Ps G\n * Cursor Character Absolute [column] (default = [row,1]) (CHA).\n *\n * @vt: #Y CSI CHA \"Cursor Horizontal Absolute\" \"CSI Ps G\" \"Move cursor to `Ps`-th column of the active row (default=1).\"\n */\n public cursorCharAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps ; Ps H\n * Cursor Position [row;column] (default = [1,1]) (CUP).\n *\n * @vt: #Y CSI CUP \"Cursor Position\" \"CSI Ps ; Ps H\" \"Set cursor to position [`Ps`, `Ps`] (default = [1, 1]).\"\n * If ORIGIN mode is set, places the cursor to the absolute position within the scroll margins.\n * If ORIGIN mode is not set, places the cursor to the absolute position within the viewport.\n * Note that the coordinates are 1-based, thus the top left position starts at `1 ; 1`.\n */\n public cursorPosition(params: IParams): boolean {\n this._setCursor(\n // col\n (params.length >= 2) ? (params.params[1] || 1) - 1 : 0,\n // row\n (params.params[0] || 1) - 1\n );\n return true;\n }\n\n /**\n * CSI Pm ` Character Position Absolute\n * [column] (default = [row,1]) (HPA).\n * Currently same functionality as CHA.\n *\n * @vt: #Y CSI HPA \"Horizontal Position Absolute\" \"CSI Ps ` \" \"Same as CHA.\"\n */\n public charPosAbsolute(params: IParams): boolean {\n this._setCursor((params.params[0] || 1) - 1, this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Pm a Character Position Relative\n * [columns] (default = [row,col+1]) (HPR)\n *\n * @vt: #Y CSI HPR \"Horizontal Position Relative\" \"CSI Ps a\" \"Same as CUF.\"\n */\n public hPositionRelative(params: IParams): boolean {\n this._moveCursor(params.params[0] || 1, 0);\n return true;\n }\n\n /**\n * CSI Pm d Vertical Position Absolute (VPA)\n * [row] (default = [1,column])\n *\n * @vt: #Y CSI VPA \"Vertical Position Absolute\" \"CSI Ps d\" \"Move cursor to `Ps`-th row (default=1).\"\n */\n public linePosAbsolute(params: IParams): boolean {\n this._setCursor(this._activeBuffer.x, (params.params[0] || 1) - 1);\n return true;\n }\n\n /**\n * CSI Pm e Vertical Position Relative (VPR)\n * [rows] (default = [row+1,column])\n * reuse CSI Ps B ?\n *\n * @vt: #Y CSI VPR \"Vertical Position Relative\" \"CSI Ps e\" \"Move cursor `Ps` times down (default=1).\"\n */\n public vPositionRelative(params: IParams): boolean {\n this._moveCursor(0, params.params[0] || 1);\n return true;\n }\n\n /**\n * CSI Ps ; Ps f\n * Horizontal and Vertical Position [row;column] (default =\n * [1,1]) (HVP).\n * Same as CUP.\n *\n * @vt: #Y CSI HVP \"Horizontal and Vertical Position\" \"CSI Ps ; Ps f\" \"Same as CUP.\"\n */\n public hVPosition(params: IParams): boolean {\n this.cursorPosition(params);\n return true;\n }\n\n /**\n * CSI Ps g Tab Clear (TBC).\n * Ps = 0 -> Clear Current Column (default).\n * Ps = 3 -> Clear All.\n * Potentially:\n * Ps = 2 -> Clear Stops on Line.\n * http://vt100.net/annarbor/aaa-ug/section6.html\n *\n * @vt: #Y CSI TBC \"Tab Clear\" \"CSI Ps g\" \"Clear tab stops at current position (0) or all (3) (default=0).\"\n * Clearing tabstops off the active row (Ps = 2, VT100) is currently not supported.\n */\n public tabClear(params: IParams): boolean {\n const param = params.params[0];\n if (param === 0) {\n delete this._activeBuffer.tabs[this._activeBuffer.x];\n } else if (param === 3) {\n this._activeBuffer.tabs = {};\n }\n return true;\n }\n\n /**\n * CSI Ps I\n * Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).\n *\n * @vt: #Y CSI CHT \"Cursor Horizontal Tabulation\" \"CSI Ps I\" \"Move cursor `Ps` times tabs forward (default=1).\"\n */\n public cursorForwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.nextStop();\n }\n return true;\n }\n\n /**\n * CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).\n *\n * @vt: #Y CSI CBT \"Cursor Backward Tabulation\" \"CSI Ps Z\" \"Move cursor `Ps` tabs backward (default=1).\"\n */\n public cursorBackwardTab(params: IParams): boolean {\n if (this._activeBuffer.x >= this._bufferService.cols) {\n return true;\n }\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.x = this._activeBuffer.prevStop();\n }\n return true;\n }\n\n /**\n * CSI Ps \" q Select Character Protection Attribute (DECSCA).\n *\n * @vt: #Y CSI DECSCA \"Select Character Protection Attribute\" \"CSI Ps \" q\" \"Whether DECSED and DECSEL can erase (0=default, 2) or not (1).\"\n */\n public selectProtected(params: IParams): boolean {\n const p = params.params[0];\n if (p === 1) this._curAttrData.bg |= BgFlags.PROTECTED;\n if (p === 2 || p === 0) this._curAttrData.bg &= ~BgFlags.PROTECTED;\n return true;\n }\n\n\n /**\n * Helper method to erase cells in a terminal row.\n * The cell gets replaced with the eraseChar of the terminal.\n * @param y The row index relative to the viewport.\n * @param start The start x index of the range to be erased.\n * @param end The end x index of the range to be erased (exclusive).\n * @param clearWrap clear the isWrapped flag\n * @param respectProtect Whether to respect the protection attribute (DECSCA).\n */\n private _eraseInBufferLine(y: number, start: number, end: number, clearWrap: boolean = false, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (!line) {\n return;\n }\n line.replaceCells(\n start,\n end,\n this._activeBuffer.getNullCell(this._eraseAttrData()),\n respectProtect\n );\n if (clearWrap) {\n line.isWrapped = false;\n }\n }\n\n /**\n * Helper method to reset cells in a terminal row. The cell gets replaced with the eraseChar of\n * the terminal and the isWrapped property is set to false.\n * @param y row index\n */\n private _resetBufferLine(y: number, respectProtect: boolean = false): void {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y);\n if (line) {\n line.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), respectProtect);\n this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + y);\n line.isWrapped = false;\n }\n }\n\n /**\n * CSI Ps J Erase in Display (ED).\n * Ps = 0 -> Erase Below (default).\n * Ps = 1 -> Erase Above.\n * Ps = 2 -> Erase All.\n * Ps = 3 -> Erase Saved Lines (xterm).\n * CSI ? Ps J\n * Erase in Display (DECSED).\n * Ps = 0 -> Selective Erase Below (default).\n * Ps = 1 -> Selective Erase Above.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI ED \"Erase In Display\" \"CSI Ps J\" \"Erase various parts of the viewport.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | ------------------------------------------------------------ |\n * | 0 | Erase from the cursor through the end of the viewport. |\n * | 1 | Erase from the beginning of the viewport through the cursor. |\n * | 2 | Erase complete viewport. |\n * | 3 | Erase scrollback. |\n *\n * @vt: #Y CSI DECSED \"Selective Erase In Display\" \"CSI ? Ps J\" \"Same as ED with respecting protection flag.\"\n */\n public eraseInDisplay(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n let j;\n switch (params.params[0]) {\n case 0:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n this._eraseInBufferLine(j++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n for (; j < this._bufferService.rows; j++) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(j);\n break;\n case 1:\n j = this._activeBuffer.y;\n this._dirtyRowTracker.markDirty(j);\n // Deleted front part of line and everything before. This line will no longer be wrapped.\n this._eraseInBufferLine(j, 0, this._activeBuffer.x + 1, true, respectProtect);\n if (this._activeBuffer.x + 1 >= this._bufferService.cols) {\n // Deleted entire previous line. This next line can no longer be wrapped.\n const nextLine = this._activeBuffer.lines.get(j + 1);\n if (nextLine) {\n nextLine.isWrapped = false;\n }\n }\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n break;\n case 2:\n if (this._optionsService.rawOptions.scrollOnEraseInDisplay) {\n j = this._bufferService.rows;\n this._dirtyRowTracker.markRangeDirty(0, j - 1);\n while (j--) {\n const currentLine = this._activeBuffer.lines.get(this._activeBuffer.ybase + j);\n if (currentLine?.getTrimmedLength()) {\n break;\n }\n }\n for (; j >= 0; j--) {\n this._bufferService.scroll(this._eraseAttrData());\n }\n }\n else {\n j = this._bufferService.rows;\n this._dirtyRowTracker.markDirty(j - 1);\n while (j--) {\n this._resetBufferLine(j, respectProtect);\n }\n this._dirtyRowTracker.markDirty(0);\n }\n break;\n case 3:\n // Clear scrollback (everything not in viewport)\n const scrollBackSize = this._activeBuffer.lines.length - this._bufferService.rows;\n if (scrollBackSize > 0) {\n this._activeBuffer.lines.trimStart(scrollBackSize);\n this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - scrollBackSize, 0);\n this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - scrollBackSize, 0);\n // Force a scroll event to refresh viewport\n this._onScroll.fire(0);\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI Ps K Erase in Line (EL).\n * Ps = 0 -> Erase to Right (default).\n * Ps = 1 -> Erase to Left.\n * Ps = 2 -> Erase All.\n * CSI ? Ps K\n * Erase in Line (DECSEL).\n * Ps = 0 -> Selective Erase to Right (default).\n * Ps = 1 -> Selective Erase to Left.\n * Ps = 2 -> Selective Erase All.\n *\n * @vt: #Y CSI EL \"Erase In Line\" \"CSI Ps K\" \"Erase various parts of the active row.\"\n * Supported param values:\n *\n * | Ps | Effect |\n * | -- | -------------------------------------------------------- |\n * | 0 | Erase from the cursor through the end of the row. |\n * | 1 | Erase from the beginning of the line through the cursor. |\n * | 2 | Erase complete line. |\n *\n * @vt: #Y CSI DECSEL \"Selective Erase In Line\" \"CSI ? Ps K\" \"Same as EL with respecting protecting flag.\"\n */\n public eraseInLine(params: IParams, respectProtect: boolean = false): boolean {\n this._restrictCursor(this._bufferService.cols);\n switch (params.params[0]) {\n case 0:\n this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, respectProtect);\n break;\n case 1:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect);\n break;\n case 2:\n this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);\n break;\n }\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n return true;\n }\n\n /**\n * CSI Ps L\n * Insert Ps Line(s) (default = 1) (IL).\n *\n * @vt: #Y CSI IL \"Insert Line\" \"CSI Ps L\" \"Insert `Ps` blank lines at active row (default=1).\"\n * For every inserted line at the scroll top one line at the scroll bottom gets removed.\n * The cursor is set to the first column.\n * IL has no effect if the cursor is outside the scroll margins.\n */\n public insertLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n const scrollBottomRowsOffset = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n const scrollBottomAbsolute = this._bufferService.rows - 1 + this._activeBuffer.ybase - scrollBottomRowsOffset + 1;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1L\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(scrollBottomAbsolute - 1, 1);\n this._activeBuffer.lines.splice(row, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps M\n * Delete Ps Line(s) (default = 1) (DL).\n *\n * @vt: #Y CSI DL \"Delete Line\" \"CSI Ps M\" \"Delete `Ps` lines at active row (default=1).\"\n * For every deleted line at the scroll top one blank line at the scroll bottom gets appended.\n * The cursor is set to the first column.\n * DL has no effect if the cursor is outside the scroll margins.\n */\n public deleteLines(params: IParams): boolean {\n this._restrictCursor();\n let param = params.params[0] || 1;\n\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n\n const row: number = this._activeBuffer.ybase + this._activeBuffer.y;\n\n let j: number;\n j = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom;\n j = this._bufferService.rows - 1 + this._activeBuffer.ybase - j;\n while (param--) {\n // test: echo -e '\\e[44m\\e[1M\\e[0m'\n // blankLine(true) - xterm/linux behavior\n this._activeBuffer.lines.splice(row, 1);\n this._activeBuffer.lines.splice(j, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom);\n this._activeBuffer.x = 0; // see https://vt100.net/docs/vt220-rm/chapter4.html - vt220 only?\n return true;\n }\n\n /**\n * CSI Ps @\n * Insert Ps (Blank) Character(s) (default = 1) (ICH).\n *\n * @vt: #Y CSI ICH \"Insert Characters\" \"CSI Ps @\" \"Insert `Ps` (blank) characters (default = 1).\"\n * The ICH sequence inserts `Ps` blank characters. The cursor remains at the beginning of the\n * blank characters. Text between the cursor and right margin moves to the right. Characters moved\n * past the right margin are lost.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public insertChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.insertCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps P\n * Delete Ps Character(s) (default = 1) (DCH).\n *\n * @vt: #Y CSI DCH \"Delete Character\" \"CSI Ps P\" \"Delete `Ps` characters (default=1).\"\n * As characters are deleted, the remaining characters between the cursor and right margin move to\n * the left. Character attributes move with the characters. The terminal adds blank characters at\n * the right margin.\n *\n *\n * FIXME: check against xterm - should not work outside of scroll margins (see VT520 manual)\n */\n public deleteChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.deleteCells(\n this._activeBuffer.x,\n params.params[0] || 1,\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps S Scroll up Ps lines (default = 1) (SU).\n *\n * @vt: #Y CSI SU \"Scroll Up\" \"CSI Ps S\" \"Scroll `Ps` lines up (default=1).\"\n *\n *\n * FIXME: scrolled out lines at top = 1 should add to scrollback (xterm)\n */\n public scrollUp(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps T Scroll down Ps lines (default = 1) (SD).\n *\n * @vt: #Y CSI SD \"Scroll Down\" \"CSI Ps T\" \"Scroll `Ps` lines down (default=1).\"\n */\n public scrollDown(params: IParams): boolean {\n let param = params.params[0] || 1;\n\n while (param--) {\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1);\n this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP @ Scroll left Ps columns (default = 1) (SL) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/00\n * Parameter default value: Pn = 1\n * SL causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the left; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always left shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SL \"Scroll Left\" \"CSI Ps SP @\" \"Scroll viewport `Ps` times to the left.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the left.\n * SL has no effect outside of the scroll margins.\n */\n public scrollLeft(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps SP A Scroll right Ps columns (default = 1) (SR) ECMA-48\n *\n * Notation: (Pn)\n * Representation: CSI Pn 02/00 04/01\n * Parameter default value: Pn = 1\n * SR causes the data in the presentation component to be moved by n character positions\n * if the line orientation is horizontal, or by n line positions if the line orientation\n * is vertical, such that the data appear to move to the right; where n equals the value of Pn.\n * The active presentation position is not affected by this control function.\n *\n * Supported:\n * - always right shift (no line orientation setting respected)\n *\n * @vt: #Y CSI SR \"Scroll Right\" \"CSI Ps SP A\" \"Scroll viewport `Ps` times to the right.\"\n * SL moves the content of all lines within the scroll margins `Ps` times to the right.\n * Content at the right margin is lost.\n * SL has no effect outside of the scroll margins.\n */\n public scrollRight(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(0, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' }\n * Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.\n *\n * @vt: #Y CSI DECIC \"Insert Columns\" \"CSI Ps ' }\" \"Insert `Ps` columns at cursor position.\"\n * DECIC inserts `Ps` times blank columns at the cursor position for all lines with the scroll\n * margins, moving content to the right. Content at the right margin is lost. DECIC has no effect\n * outside the scrolling margins.\n */\n public insertColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.insertCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Pm ' ~\n * Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.\n *\n * @vt: #Y CSI DECDC \"Delete Columns\" \"CSI Ps ' ~\" \"Delete `Ps` columns at cursor position.\"\n * DECDC deletes `Ps` times columns at the cursor position for all lines with the scroll margins,\n * moving content to the left. Blank columns are added at the right margin.\n * DECDC has no effect outside the scrolling margins.\n */\n public deleteColumns(params: IParams): boolean {\n if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) {\n return true;\n }\n const param = params.params[0] || 1;\n for (let y = this._activeBuffer.scrollTop; y <= this._activeBuffer.scrollBottom; ++y) {\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!;\n line.deleteCells(this._activeBuffer.x, param, this._activeBuffer.getNullCell(this._eraseAttrData()));\n line.isWrapped = false;\n }\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n return true;\n }\n\n /**\n * CSI Ps X\n * Erase Ps Character(s) (default = 1) (ECH).\n *\n * @vt: #Y CSI ECH \"Erase Character\" \"CSI Ps X\" \"Erase `Ps` characters from current cursor position to the right (default=1).\"\n * ED erases `Ps` characters from current cursor position to the right.\n * ED works inside or outside the scrolling margins.\n */\n public eraseChars(params: IParams): boolean {\n this._restrictCursor();\n const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);\n if (line) {\n line.replaceCells(\n this._activeBuffer.x,\n this._activeBuffer.x + (params.params[0] || 1),\n this._activeBuffer.getNullCell(this._eraseAttrData())\n );\n this._dirtyRowTracker.markDirty(this._activeBuffer.y);\n }\n return true;\n }\n\n /**\n * CSI Ps b Repeat the preceding graphic character Ps times (REP).\n * From ECMA 48 (@see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf)\n * Notation: (Pn)\n * Representation: CSI Pn 06/02\n * Parameter default value: Pn = 1\n * REP is used to indicate that the preceding character in the data stream,\n * if it is a graphic character (represented by one or more bit combinations) including SPACE,\n * is to be repeated n times, where n equals the value of Pn.\n * If the character preceding REP is a control function or part of a control function,\n * the effect of REP is not defined by this Standard.\n *\n * We extend xterm's behavior to allow repeating entire grapheme clusters.\n * This isn't 100% xterm-compatible, but it seems saner and more useful.\n * - text attrs are applied normally\n * - wrap around is respected\n * - any valid sequence resets the carried forward char\n *\n * Note: To get reset on a valid sequence working correctly without much runtime penalty, the\n * preceding codepoint is stored on the parser in `this.print` and reset during `parser.parse`.\n *\n * @vt: #Y CSI REP \"Repeat Preceding Character\" \"CSI Ps b\" \"Repeat preceding character `Ps` times (default=1).\"\n * REP repeats the previous character `Ps` times advancing the cursor, also wrapping if DECAWM is\n * set. REP has no effect if the sequence does not follow a printable ASCII character\n * (NOOP for any other sequence in between or NON ASCII characters).\n */\n public repeatPrecedingCharacter(params: IParams): boolean {\n const joinState = this._parser.precedingJoinState;\n if (!joinState) {\n return true;\n }\n // call print to insert the chars and handle correct wrapping\n const length = params.params[0] || 1;\n const chWidth = UnicodeService.extractWidth(joinState);\n const x = this._activeBuffer.x - chWidth;\n const bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!;\n const text = bufferRow.getString(x);\n const data = new Uint32Array(text.length * length);\n let idata = 0;\n for (let itext = 0; itext < text.length;) {\n const ch = text.codePointAt(itext) || 0;\n data[idata++] = ch;\n itext += ch > 0xffff ? 2 : 1;\n }\n let tlength = idata;\n for (let i = 1; i < length; ++i) {\n data.copyWithin(tlength, 0, idata);\n tlength += idata;\n }\n this.print(data, 0, tlength);\n return true;\n }\n\n /**\n * CSI Ps c Send Device Attributes (Primary DA).\n * Ps = 0 or omitted -> request attributes from terminal. The\n * response depends on the decTerminalID resource setting.\n * -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'')\n * -> CSI ? 1 ; 0 c (``VT101 with No Options'')\n * -> CSI ? 6 c (``VT102'')\n * -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')\n * The VT100-style response parameters do not mean anything by\n * themselves. VT220 parameters do, telling the host what fea-\n * tures the terminal supports:\n * Ps = 1 -> 132-columns.\n * Ps = 2 -> Printer.\n * Ps = 6 -> Selective erase.\n * Ps = 8 -> User-defined keys.\n * Ps = 9 -> National replacement character sets.\n * Ps = 1 5 -> Technical characters.\n * Ps = 2 2 -> ANSI color, e.g., VT525.\n * Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).\n *\n * @vt: #Y CSI DA1 \"Primary Device Attributes\" \"CSI c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesPrimary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n if (this._is('xterm') || this._is('rxvt-unicode') || this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?1;2c');\n } else if (this._is('linux')) {\n this._coreService.triggerDataEvent(C0.ESC + '[?6c');\n }\n return true;\n }\n\n /**\n * CSI > Ps c\n * Send Device Attributes (Secondary DA).\n * Ps = 0 or omitted -> request the terminal's identification\n * code. The response depends on the decTerminalID resource set-\n * ting. It should apply only to VT220 and up, but xterm extends\n * this to VT100.\n * -> CSI > Pp ; Pv ; Pc c\n * where Pp denotes the terminal type\n * Pp = 0 -> ``VT100''.\n * Pp = 1 -> ``VT220''.\n * and Pv is the firmware version (for xterm, this was originally\n * the XFree86 patch number, starting with 95). In a DEC termi-\n * nal, Pc indicates the ROM cartridge registration number and is\n * always zero.\n * More information:\n * xterm/charproc.c - line 2012, for more information.\n * vim responds with ^[[?0c or ^[[?1c after the terminal's response (?)\n *\n * @vt: #Y CSI DA2 \"Secondary Device Attributes\" \"CSI > c\" \"Send primary device attributes.\"\n *\n *\n * TODO: fix and cleanup response\n */\n public sendDeviceAttributesSecondary(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n // xterm and urxvt\n // seem to spit this\n // out around ~370 times (?).\n if (this._is('xterm')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>0;276;0c');\n } else if (this._is('rxvt-unicode')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>85;95;0c');\n } else if (this._is('linux')) {\n // not supported by linux console.\n // linux console echoes parameters.\n this._coreService.triggerDataEvent(params.params[0] + 'c');\n } else if (this._is('screen')) {\n this._coreService.triggerDataEvent(C0.ESC + '[>83;40003;0c');\n }\n return true;\n }\n\n /**\n * CSI > Ps q\n * Ps = 0 => Report xterm name and version (XTVERSION).\n *\n * The response is a DCS sequence identifying the version: DCS > | text ST\n *\n * @vt: #Y CSI XTVERSION \"Report Xterm Version\" \"CSI > q\" \"Report the terminal name and version.\"\n */\n public sendXtVersion(params: IParams): boolean {\n if (params.params[0] > 0) {\n return true;\n }\n this._coreService.triggerDataEvent(`${C0.ESC}P>|xterm.js(${XTERM_VERSION})${C0.ESC}\\\\`);\n return true;\n }\n\n /**\n * Evaluate if the current terminal is the given argument.\n * @param term The terminal name to evaluate\n */\n private _is(term: string): boolean {\n return (this._optionsService.rawOptions.termName + '').startsWith(term);\n }\n\n /**\n * CSI Pm h Set Mode (SM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Insert Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Automatic Newline (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI SM \"Set Mode\" \"CSI Pm h\" \"Set various terminal modes.\"\n * Supported param values by SM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Insert Mode (IRM). | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Automatic Newline (LNM). | #Y |\n */\n public setMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = true;\n break;\n case 20:\n this._optionsService.options.convertEol = true;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm h\n * DEC Private Mode Set (DECSET).\n * Ps = 1 -> Application Cursor Keys (DECCKM).\n * Ps = 2 -> Designate USASCII for character sets G0-G3\n * (DECANM), and set VT100 mode.\n * Ps = 3 -> 132 Column Mode (DECCOLM).\n * Ps = 4 -> Smooth (Slow) Scroll (DECSCLM).\n * Ps = 5 -> Reverse Video (DECSCNM).\n * Ps = 6 -> Origin Mode (DECOM).\n * Ps = 7 -> Wraparound Mode (DECAWM).\n * Ps = 8 -> Auto-repeat Keys (DECARM).\n * Ps = 9 -> Send Mouse X & Y on button press. See the sec-\n * tion Mouse Tracking.\n * Ps = 1 0 -> Show toolbar (rxvt).\n * Ps = 1 2 -> Start Blinking Cursor (att610).\n * Ps = 1 8 -> Print form feed (DECPFF).\n * Ps = 1 9 -> Set print extent to full screen (DECPEX).\n * Ps = 2 5 -> Show Cursor (DECTCEM).\n * Ps = 3 0 -> Show scrollbar (rxvt).\n * Ps = 3 5 -> Enable font-shifting functions (rxvt).\n * Ps = 3 8 -> Enter Tektronix Mode (DECTEK).\n * Ps = 4 0 -> Allow 80 -> 132 Mode.\n * Ps = 4 1 -> more(1) fix (see curses resource).\n * Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-\n * RCM).\n * Ps = 4 4 -> Turn On Margin Bell.\n * Ps = 4 5 -> Reverse-wraparound Mode.\n * Ps = 4 6 -> Start Logging. This is normally disabled by a\n * compile-time option.\n * Ps = 4 7 -> Use Alternate Screen Buffer. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 6 6 -> Application keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends backspace (DECBKM).\n * Ps = 1 0 0 0 -> Send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Enable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).\n * Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Interpret \"meta\" key, sets eighth bit.\n * (enables the eightBitInput resource).\n * Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-\n * Lock keys. (This enables the numLock resource).\n * Ps = 1 0 3 6 -> Send ESC when Meta modifies a key. (This\n * enables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete\n * key.\n * Ps = 1 0 3 9 -> Send ESC when Alt modifies a key. (This\n * enables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Keep selection even if not highlighted.\n * (This enables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Enable Urgency window manager hint when\n * Control-G is received. (This enables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Enable raising of the window when Control-G\n * is received. (enables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Alternate Screen Buffer. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 8 -> Save cursor as in DECSC. (This may be dis-\n * abled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate\n * Screen Buffer, clearing it first. (This may be disabled by\n * the titeInhibit resource). This combines the effects of the 1\n * 0 4 7 and 1 0 4 8 modes. Use this with terminfo-based\n * applications rather than the 4 7 mode.\n * Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Set Sun function-key mode.\n * Ps = 1 0 5 2 -> Set HP function-key mode.\n * Ps = 1 0 5 3 -> Set SCO function-key mode.\n * Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Set VT220 keyboard emulation.\n * Ps = 2 0 0 4 -> Set bracketed paste mode.\n * Modes:\n * http: *vt100.net/docs/vt220-rm/chapter4.html\n *\n * @vt: #P[See below for supported modes.] CSI DECSET \"DEC Private Set Mode\" \"CSI ? Pm h\" \"Set various terminal attributes.\"\n * Supported param values by DECSET:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | --------|\n * | 1 | Application Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate US-ASCII for character sets G0-G3 (DECANM). | #Y |\n * | 3 | 132 Column Mode (DECCOLM). | #Y |\n * | 6 | Origin Mode (DECOM). | #Y |\n * | 7 | Auto-wrap Mode (DECAWM). | #Y |\n * | 8 | Auto-repeat Keys (DECARM). Always on. | #N |\n * | 9 | X10 xterm mouse protocol. | #Y |\n * | 12 | Start Blinking Cursor. | #P[Requires the allowSetCursorBlink quirk option enabled.] |\n * | 25 | Show Cursor (DECTCEM). | #Y |\n * | 45 | Reverse wrap-around. | #Y |\n * | 47 | Use Alternate Screen Buffer. | #Y |\n * | 66 | Application keypad (DECNKM). | #Y |\n * | 1000 | X11 xterm mouse protocol. | #Y |\n * | 1002 | Use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Use All Motion Mouse Tracking. | #Y |\n * | 1004 | Send FocusIn/FocusOut events | #Y |\n * | 1005 | Enable UTF-8 Mouse Mode. | #N |\n * | 1006 | Enable SGR Mouse Mode. | #Y |\n * | 1015 | Enable urxvt Mouse Mode. | #N |\n * | 1016 | Enable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Alternate Screen Buffer. | #Y |\n * | 1048 | Save cursor as in DECSC. | #Y |\n * | 1049 | Save cursor and switch to alternate buffer clearing it. | #P[Does not clear the alternate buffer.] |\n * | 2004 | Set bracketed paste mode. | #Y |\n *\n *\n * FIXME: implement DECSCNM, 1049 should clear altbuffer\n */\n public setModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = true;\n break;\n case 2:\n this._charsetService.setgCharset(0, DEFAULT_CHARSET);\n this._charsetService.setgCharset(1, DEFAULT_CHARSET);\n this._charsetService.setgCharset(2, DEFAULT_CHARSET);\n this._charsetService.setgCharset(3, DEFAULT_CHARSET);\n // set VT100 mode here\n break;\n case 3:\n /**\n * DECCOLM - 132 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(132, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = true;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = true;\n break;\n case 12:\n if (this._optionsService.rawOptions.quirks?.allowSetCursorBlink) {\n this._optionsService.options.cursorBlink = true;\n }\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = true;\n break;\n case 66:\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n // no release, no motion, no wheel, no modifiers.\n this._coreMouseService.activeProtocol = 'X10';\n break;\n case 1000: // vt200 mouse\n // no motion.\n this._coreMouseService.activeProtocol = 'VT200';\n break;\n case 1002: // button event mouse\n this._coreMouseService.activeProtocol = 'DRAG';\n break;\n case 1003: // any event mouse\n // any event - sends motion events,\n // even if there is no button held down.\n this._coreMouseService.activeProtocol = 'ANY';\n break;\n case 1004: // send focusin/focusout events\n // focusin: ^[[I\n // focusout: ^[[O\n this._coreService.decPrivateModes.sendFocus = true;\n this._onRequestSendFocus.fire();\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'SGR';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECSET 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'SGR_PIXELS';\n break;\n case 25: // show cursor\n this._coreService.isCursorHidden = false;\n break;\n case 1048: // alt screen cursor\n this.saveCursor();\n break;\n case 1049: // alt screen buffer cursor\n this.saveCursor();\n // FALL-THROUGH\n case 47: // alt screen buffer\n case 1047: // alt screen buffer\n // Swap kitty keyboard flags: save main, restore alt\n if (this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n const state = this._coreService.kittyKeyboard;\n state.mainFlags = state.flags;\n state.flags = state.altFlags;\n }\n this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = true;\n break;\n case 2026: // synchronized output (https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md)\n this._coreService.decPrivateModes.synchronizedOutput = true;\n break;\n case 2031: // color scheme updates (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._coreService.decPrivateModes.colorSchemeUpdates = true;\n }\n break;\n case 9001: // win32-input-mode (https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md)\n if (this._optionsService.rawOptions.vtExtensions?.win32InputMode) {\n this._coreService.decPrivateModes.win32InputMode = true;\n }\n break;\n }\n }\n return true;\n }\n\n\n /**\n * CSI Pm l Reset Mode (RM).\n * Ps = 2 -> Keyboard Action Mode (AM).\n * Ps = 4 -> Replace Mode (IRM).\n * Ps = 1 2 -> Send/receive (SRM).\n * Ps = 2 0 -> Normal Linefeed (LNM).\n *\n * @vt: #P[Only IRM is supported.] CSI RM \"Reset Mode\" \"CSI Pm l\" \"Set various terminal attributes.\"\n * Supported param values by RM:\n *\n * | Param | Action | Support |\n * | ----- | -------------------------------------- | ------- |\n * | 2 | Keyboard Action Mode (KAM). Always on. | #N |\n * | 4 | Replace Mode (IRM). (default) | #Y |\n * | 12 | Send/receive (SRM). Always off. | #N |\n * | 20 | Normal Linefeed (LNM). | #Y |\n *\n *\n * FIXME: why is LNM commented out?\n */\n public resetMode(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 4:\n this._coreService.modes.insertMode = false;\n break;\n case 20:\n this._optionsService.options.convertEol = false;\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI ? Pm l\n * DEC Private Mode Reset (DECRST).\n * Ps = 1 -> Normal Cursor Keys (DECCKM).\n * Ps = 2 -> Designate VT52 mode (DECANM).\n * Ps = 3 -> 80 Column Mode (DECCOLM).\n * Ps = 4 -> Jump (Fast) Scroll (DECSCLM).\n * Ps = 5 -> Normal Video (DECSCNM).\n * Ps = 6 -> Normal Cursor Mode (DECOM).\n * Ps = 7 -> No Wraparound Mode (DECAWM).\n * Ps = 8 -> No Auto-repeat Keys (DECARM).\n * Ps = 9 -> Don't send Mouse X & Y on button press.\n * Ps = 1 0 -> Hide toolbar (rxvt).\n * Ps = 1 2 -> Stop Blinking Cursor (att610).\n * Ps = 1 8 -> Don't print form feed (DECPFF).\n * Ps = 1 9 -> Limit print to scrolling region (DECPEX).\n * Ps = 2 5 -> Hide Cursor (DECTCEM).\n * Ps = 3 0 -> Don't show scrollbar (rxvt).\n * Ps = 3 5 -> Disable font-shifting functions (rxvt).\n * Ps = 4 0 -> Disallow 80 -> 132 Mode.\n * Ps = 4 1 -> No more(1) fix (see curses resource).\n * Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-\n * NRCM).\n * Ps = 4 4 -> Turn Off Margin Bell.\n * Ps = 4 5 -> No Reverse-wraparound Mode.\n * Ps = 4 6 -> Stop Logging. (This is normally disabled by a\n * compile-time option).\n * Ps = 4 7 -> Use Normal Screen Buffer.\n * Ps = 6 6 -> Numeric keypad (DECNKM).\n * Ps = 6 7 -> Backarrow key sends delete (DECBKM).\n * Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and\n * release. See the section Mouse Tracking.\n * Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.\n * Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.\n * Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.\n * Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.\n * Ps = 1 0 0 5 -> Disable Extended Mouse Mode.\n * Ps = 1 0 1 0 -> Don't scroll to bottom on tty output\n * (rxvt).\n * Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).\n * Ps = 1 0 3 4 -> Don't interpret \"meta\" key. (This disables\n * the eightBitInput resource).\n * Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-\n * Lock keys. (This disables the numLock resource).\n * Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key.\n * (This disables the metaSendsEscape resource).\n * Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad\n * Delete key.\n * Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key.\n * (This disables the altSendsEscape resource).\n * Ps = 1 0 4 0 -> Do not keep selection when not highlighted.\n * (This disables the keepSelection resource).\n * Ps = 1 0 4 1 -> Use the PRIMARY selection. (This disables\n * the selectToClipboard resource).\n * Ps = 1 0 4 2 -> Disable Urgency window manager hint when\n * Control-G is received. (This disables the bellIsUrgent\n * resource).\n * Ps = 1 0 4 3 -> Disable raising of the window when Control-\n * G is received. (This disables the popOnBell resource).\n * Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen\n * first if in the Alternate Screen. (This may be disabled by\n * the titeInhibit resource).\n * Ps = 1 0 4 8 -> Restore cursor as in DECRC. (This may be\n * disabled by the titeInhibit resource).\n * Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor\n * as in DECRC. (This may be disabled by the titeInhibit\n * resource). This combines the effects of the 1 0 4 7 and 1 0\n * 4 8 modes. Use this with terminfo-based applications rather\n * than the 4 7 mode.\n * Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.\n * Ps = 1 0 5 1 -> Reset Sun function-key mode.\n * Ps = 1 0 5 2 -> Reset HP function-key mode.\n * Ps = 1 0 5 3 -> Reset SCO function-key mode.\n * Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).\n * Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.\n * Ps = 2 0 0 4 -> Reset bracketed paste mode.\n *\n * @vt: #P[See below for supported modes.] CSI DECRST \"DEC Private Reset Mode\" \"CSI ? Pm l\" \"Reset various terminal attributes.\"\n * Supported param values by DECRST:\n *\n * | param | Action | Support |\n * | ----- | ------------------------------------------------------- | ------- |\n * | 1 | Normal Cursor Keys (DECCKM). | #Y |\n * | 2 | Designate VT52 mode (DECANM). | #N |\n * | 3 | 80 Column Mode (DECCOLM). | #B[Switches to old column width instead of 80.] |\n * | 6 | Normal Cursor Mode (DECOM). | #Y |\n * | 7 | No Wraparound Mode (DECAWM). | #Y |\n * | 8 | No Auto-repeat Keys (DECARM). | #N |\n * | 9 | Don't send Mouse X & Y on button press. | #Y |\n * | 12 | Stop Blinking Cursor. | #P[Requires the allowSetCursorBlink quirk option enabled.] |\n * | 25 | Hide Cursor (DECTCEM). | #Y |\n * | 45 | No reverse wrap-around. | #Y |\n * | 47 | Use Normal Screen Buffer. | #Y |\n * | 66 | Numeric keypad (DECNKM). | #Y |\n * | 1000 | Don't send Mouse reports. | #Y |\n * | 1002 | Don't use Cell Motion Mouse Tracking. | #Y |\n * | 1003 | Don't use All Motion Mouse Tracking. | #Y |\n * | 1004 | Don't send FocusIn/FocusOut events. | #Y |\n * | 1005 | Disable UTF-8 Mouse Mode. | #N |\n * | 1006 | Disable SGR Mouse Mode. | #Y |\n * | 1015 | Disable urxvt Mouse Mode. | #N |\n * | 1016 | Disable SGR-Pixels Mouse Mode. | #Y |\n * | 1047 | Use Normal Screen Buffer (clearing screen if in alt). | #Y |\n * | 1048 | Restore cursor as in DECRC. | #Y |\n * | 1049 | Use Normal Screen Buffer and restore cursor. | #Y |\n * | 2004 | Reset bracketed paste mode. | #Y |\n *\n *\n * FIXME: DECCOLM is currently broken (already fixed in window options PR)\n */\n public resetModePrivate(params: IParams): boolean {\n for (let i = 0; i < params.length; i++) {\n switch (params.params[i]) {\n case 1:\n this._coreService.decPrivateModes.applicationCursorKeys = false;\n break;\n case 3:\n /**\n * DECCOLM - 80 column mode.\n * This is only active if 'SetWinLines' (24) is enabled\n * through `options.windowsOptions`.\n */\n if (this._optionsService.rawOptions.windowOptions.setWinLines) {\n this._bufferService.resize(80, this._bufferService.rows);\n this._onRequestReset.fire();\n }\n break;\n case 6:\n this._coreService.decPrivateModes.origin = false;\n this._setCursor(0, 0);\n break;\n case 7:\n this._coreService.decPrivateModes.wraparound = false;\n break;\n case 12:\n if (this._optionsService.rawOptions.quirks?.allowSetCursorBlink) {\n this._optionsService.options.cursorBlink = false;\n }\n break;\n case 45:\n this._coreService.decPrivateModes.reverseWraparound = false;\n break;\n case 66:\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n break;\n case 9: // X10 Mouse\n case 1000: // vt200 mouse\n case 1002: // button event mouse\n case 1003: // any event mouse\n this._coreMouseService.activeProtocol = 'NONE';\n break;\n case 1004: // send focusin/focusout events\n this._coreService.decPrivateModes.sendFocus = false;\n break;\n case 1005: // utf8 ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1005 not supported (see #2507)');\n break;\n case 1006: // sgr ext mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 1015: // urxvt ext mode mouse - removed in #2507\n this._logService.debug('DECRST 1015 not supported (see #2507)');\n break;\n case 1016: // sgr pixels mode mouse\n this._coreMouseService.activeEncoding = 'DEFAULT';\n break;\n case 25: // hide cursor\n this._coreService.isCursorHidden = true;\n break;\n case 1048: // alt screen cursor\n this.restoreCursor();\n break;\n case 1049: // alt screen buffer cursor\n // FALL-THROUGH\n case 47: // normal screen buffer\n case 1047: // normal screen buffer - clearing it first\n // Swap kitty keyboard flags: save alt, restore main\n if (this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n const state = this._coreService.kittyKeyboard;\n state.altFlags = state.flags;\n state.flags = state.mainFlags;\n }\n // Ensure the selection manager has the correct buffer\n this._bufferService.buffers.activateNormalBuffer();\n if (params.params[i] === 1049) {\n this.restoreCursor();\n }\n this._coreService.isCursorInitialized = true;\n this._onRequestRefreshRows.fire(undefined);\n this._onRequestSyncScrollBar.fire();\n break;\n case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)\n this._coreService.decPrivateModes.bracketedPasteMode = false;\n break;\n case 2026: // synchronized output (https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md)\n this._coreService.decPrivateModes.synchronizedOutput = false;\n this._onRequestRefreshRows.fire(undefined);\n break;\n case 2031: // color scheme updates (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._coreService.decPrivateModes.colorSchemeUpdates = false;\n }\n break;\n case 9001: // win32-input-mode\n if (this._optionsService.rawOptions.vtExtensions?.win32InputMode) {\n this._coreService.decPrivateModes.win32InputMode = false;\n }\n break;\n }\n }\n return true;\n }\n\n /**\n * CSI Ps $ p Request ANSI Mode (DECRQM).\n *\n * Reports CSI Ps; Pm $ y (DECRPM), where Ps is the mode number as in SM/RM,\n * and Pm is the mode value:\n * 0 - not recognized\n * 1 - set\n * 2 - reset\n * 3 - permanently set\n * 4 - permanently reset\n *\n * @vt: #Y CSI DECRQM \"Request Mode\" \"CSI Ps $p\" \"Request mode state.\"\n * Returns a report as `CSI Ps; Pm $ y` (DECRPM), where `Ps` is the mode number as in SM/RM\n * or DECSET/DECRST, and `Pm` is the mode value:\n * - 0: not recognized\n * - 1: set\n * - 2: reset\n * - 3: permanently set\n * - 4: permanently reset\n *\n * For modes not understood xterm.js always returns `notRecognized`. In general this means,\n * that a certain operation mode is not implemented and cannot be used.\n *\n * Modes changing the active terminal buffer (47, 1047, 1049) are not subqueried\n * and only report, whether the alternate buffer is set.\n *\n * Mouse encodings and mouse protocols are handled mutual exclusive,\n * thus only one of each of those can be set at a given time.\n *\n * There is a chance, that some mode reports are not fully in line with xterm.js' behavior,\n * e.g. if the default implementation already exposes a certain behavior. If you find\n * discrepancies in the mode reports, please file a bug.\n */\n public requestMode(params: IParams, ansi: boolean): boolean {\n // return value as in DECRPM\n const enum V {\n NOT_RECOGNIZED = 0,\n SET = 1,\n RESET = 2,\n PERMANENTLY_SET = 3,\n PERMANENTLY_RESET = 4\n }\n\n // access helpers\n const dm = this._coreService.decPrivateModes;\n const { activeProtocol: mouseProtocol, activeEncoding: mouseEncoding } = this._coreMouseService;\n const cs = this._coreService;\n const { buffers, cols } = this._bufferService;\n const { active, alt } = buffers;\n const opts = this._optionsService.rawOptions;\n\n const f = (m: number, v: V): boolean => {\n cs.triggerDataEvent(`${C0.ESC}[${ansi ? '' : '?'}${m};${v}$y`);\n return true;\n };\n const b2v = (value: boolean): V => value ? V.SET : V.RESET;\n\n const p = params.params[0];\n\n if (ansi) {\n if (p === 2) return f(p, V.PERMANENTLY_RESET);\n if (p === 4) return f(p, b2v(cs.modes.insertMode));\n if (p === 12) return f(p, V.PERMANENTLY_SET);\n if (p === 20) return f(p, b2v(opts.convertEol));\n return f(p, V.NOT_RECOGNIZED);\n }\n\n if (p === 1) return f(p, b2v(dm.applicationCursorKeys));\n if (p === 3) return f(p, opts.windowOptions.setWinLines ? (cols === 80 ? V.RESET : cols === 132 ? V.SET : V.NOT_RECOGNIZED) : V.NOT_RECOGNIZED);\n if (p === 6) return f(p, b2v(dm.origin));\n if (p === 7) return f(p, b2v(dm.wraparound));\n if (p === 8) return f(p, V.PERMANENTLY_SET);\n if (p === 9) return f(p, b2v(mouseProtocol === 'X10'));\n if (p === 12) return f(p, b2v(opts.cursorBlink));\n if (p === 25) return f(p, b2v(!cs.isCursorHidden));\n if (p === 45) return f(p, b2v(dm.reverseWraparound));\n if (p === 66) return f(p, b2v(dm.applicationKeypad));\n if (p === 67) return f(p, V.PERMANENTLY_RESET);\n if (p === 1000) return f(p, b2v(mouseProtocol === 'VT200'));\n if (p === 1002) return f(p, b2v(mouseProtocol === 'DRAG'));\n if (p === 1003) return f(p, b2v(mouseProtocol === 'ANY'));\n if (p === 1004) return f(p, b2v(dm.sendFocus));\n if (p === 1005) return f(p, V.PERMANENTLY_RESET);\n if (p === 1006) return f(p, b2v(mouseEncoding === 'SGR'));\n if (p === 1015) return f(p, V.PERMANENTLY_RESET);\n if (p === 1016) return f(p, b2v(mouseEncoding === 'SGR_PIXELS'));\n if (p === 1048) return f(p, V.SET); // xterm always returns SET here\n if (p === 47 || p === 1047 || p === 1049) return f(p, b2v(active === alt));\n if (p === 2004) return f(p, b2v(dm.bracketedPasteMode));\n if (p === 2026) return f(p, b2v(dm.synchronizedOutput));\n if (p === 9001) return this._optionsService.rawOptions.vtExtensions?.win32InputMode ? f(p, b2v(dm.win32InputMode)) : f(p, V.NOT_RECOGNIZED);\n return f(p, V.NOT_RECOGNIZED);\n }\n\n /**\n * Helper to write color information packed with color mode.\n */\n private _updateAttrColor(color: number, mode: number, c1: number, c2: number, c3: number): number {\n if (mode === 2) {\n color |= Attributes.CM_RGB;\n color &= ~Attributes.RGB_MASK;\n color |= AttributeData.fromColorRGB([c1, c2, c3]);\n } else if (mode === 5) {\n color &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n color |= Attributes.CM_P256 | (c1 & 0xff);\n }\n return color;\n }\n\n /**\n * Helper to extract and apply color params/subparams.\n * Returns advance for params index.\n */\n private _extractColor(params: IParams, pos: number, attr: IAttributeData): number {\n // normalize params\n // meaning: [target, CM, ign, val, val, val]\n // RGB : [ 38/48, 2, ign, r, g, b]\n // P256 : [ 38/48, 5, ign, v, ign, ign]\n const accu = [0, 0, -1, 0, 0, 0];\n\n // alignment placeholder for non color space sequences\n let cSpace = 0;\n\n // return advance we took in params\n let advance = 0;\n\n do {\n accu[advance + cSpace] = params.params[pos + advance];\n if (params.hasSubParams(pos + advance)) {\n const subparams = params.getSubParams(pos + advance)!;\n let i = 0;\n do {\n if (accu[1] === 5) {\n cSpace = 1;\n }\n accu[advance + i + 1 + cSpace] = subparams[i];\n } while (++i < subparams.length && i + advance + 1 + cSpace < accu.length);\n break;\n }\n // exit early if can decide color mode with semicolons\n if ((accu[1] === 5 && advance + cSpace >= 2)\n || (accu[1] === 2 && advance + cSpace >= 5)) {\n break;\n }\n // offset colorSpace slot for semicolon mode\n if (accu[1]) {\n cSpace = 1;\n }\n } while (++advance + pos < params.length && advance + cSpace < accu.length);\n\n // set default values to 0\n for (let i = 2; i < accu.length; ++i) {\n if (accu[i] === -1) {\n accu[i] = 0;\n }\n }\n\n // apply colors\n switch (accu[0]) {\n case 38:\n attr.fg = this._updateAttrColor(attr.fg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 48:\n attr.bg = this._updateAttrColor(attr.bg, accu[1], accu[3], accu[4], accu[5]);\n break;\n case 58:\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = this._updateAttrColor(attr.extended.underlineColor, accu[1], accu[3], accu[4], accu[5]);\n }\n\n return advance;\n }\n\n /**\n * SGR 4 subparams:\n * 4:0 - equal to SGR 24 (turn off all underline)\n * 4:1 - equal to SGR 4 (single underline)\n * 4:2 - equal to SGR 21 (double underline)\n * 4:3 - curly underline\n * 4:4 - dotted underline\n * 4:5 - dashed underline\n */\n private _processUnderline(style: number, attr: IAttributeData): void {\n // treat extended attrs as immutable, thus always clone from old one\n // this is needed since the buffer only holds references to it\n attr.extended = attr.extended.clone();\n\n // default to 1 == single underline\n if (!~style || style > 5) {\n style = 1;\n }\n attr.extended.underlineStyle = style;\n attr.fg |= FgFlags.UNDERLINE;\n\n // 0 deactivates underline\n if (style === 0) {\n attr.fg &= ~FgFlags.UNDERLINE;\n }\n\n // update HAS_EXTENDED in BG\n attr.updateExtended();\n }\n\n private _processSGR0(attr: IAttributeData): void {\n attr.fg = DEFAULT_ATTR_DATA.fg;\n attr.bg = DEFAULT_ATTR_DATA.bg;\n attr.extended = attr.extended.clone();\n // Reset underline style and color. Note that we don't want to reset other\n // fields such as the url id.\n attr.extended.underlineStyle = UnderlineStyle.NONE;\n attr.extended.underlineColor &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.updateExtended();\n }\n\n /**\n * CSI Pm m Character Attributes (SGR).\n *\n * @vt: #P[See below for supported attributes.] CSI SGR \"Select Graphic Rendition\" \"CSI Pm m\" \"Set/Reset various text attributes.\"\n * SGR selects one or more character attributes at the same time. Multiple params (up to 32)\n * are applied in order from left to right. The changed attributes are applied to all new\n * characters received. If you move characters in the viewport by scrolling or any other means,\n * then the attributes move with the characters.\n *\n * Supported param values by SGR:\n *\n * | Param | Meaning | Support |\n * | --------- | -------------------------------------------------------- | ------- |\n * | 0 | Normal (default). Resets any other preceding SGR. | #Y |\n * | 1 | Bold. (also see `options.drawBoldTextInBrightColors`) | #Y |\n * | 2 | Faint, decreased intensity. | #Y |\n * | 3 | Italic. | #Y |\n * | 4 | Underlined (see below for style support). | #Y |\n * | 5 | Slowly blinking. | #N |\n * | 6 | Rapidly blinking. | #N |\n * | 7 | Inverse. Flips foreground and background color. | #Y |\n * | 8 | Invisible (hidden). | #Y |\n * | 9 | Crossed-out characters (strikethrough). | #Y |\n * | 21 | Doubly underlined. | #Y |\n * | 22 | Normal (neither bold nor faint). | #Y |\n * | 23 | No italic. | #Y |\n * | 24 | Not underlined. | #Y |\n * | 25 | Steady (not blinking). | #Y |\n * | 27 | Positive (not inverse). | #Y |\n * | 28 | Visible (not hidden). | #Y |\n * | 29 | Not Crossed-out (strikethrough). | #Y |\n * | 30 | Foreground color: Black. | #Y |\n * | 31 | Foreground color: Red. | #Y |\n * | 32 | Foreground color: Green. | #Y |\n * | 33 | Foreground color: Yellow. | #Y |\n * | 34 | Foreground color: Blue. | #Y |\n * | 35 | Foreground color: Magenta. | #Y |\n * | 36 | Foreground color: Cyan. | #Y |\n * | 37 | Foreground color: White. | #Y |\n * | 38 | Foreground color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 39 | Foreground color: Default (original). | #Y |\n * | 40 | Background color: Black. | #Y |\n * | 41 | Background color: Red. | #Y |\n * | 42 | Background color: Green. | #Y |\n * | 43 | Background color: Yellow. | #Y |\n * | 44 | Background color: Blue. | #Y |\n * | 45 | Background color: Magenta. | #Y |\n * | 46 | Background color: Cyan. | #Y |\n * | 47 | Background color: White. | #Y |\n * | 48 | Background color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 49 | Background color: Default (original). | #Y |\n * | 53 | Overlined. | #Y |\n * | 55 | Not Overlined. | #Y |\n * | 58 | Underline color: Extended color. | #P[Support for RGB and indexed colors, see below.] |\n * | 221 | Not bold (kitty extension). | #Y |\n * | 222 | Not faint (kitty extension). | #Y |\n * | 90 - 97 | Bright foreground color (analogous to 30 - 37). | #Y |\n * | 100 - 107 | Bright background color (analogous to 40 - 47). | #Y |\n *\n * Underline supports subparams to denote the style in the form `4 : x`:\n *\n * | x | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | No underline. Same as `SGR 24 m`. | #Y |\n * | 1 | Single underline. Same as `SGR 4 m`. | #Y |\n * | 2 | Double underline. | #Y |\n * | 3 | Curly underline. | #Y |\n * | 4 | Dotted underline. | #Y |\n * | 5 | Dashed underline. | #Y |\n * | other | Single underline. Same as `SGR 4 m`. | #Y |\n *\n * Extended colors are supported for foreground (Ps=38), background (Ps=48) and underline (Ps=58)\n * as follows:\n *\n * | Ps + 1 | Meaning | Support |\n * | ------ | ------------------------------------------------------------- | ------- |\n * | 0 | Implementation defined. | #N |\n * | 1 | Transparent. | #N |\n * | 2 | RGB color as `Ps ; 2 ; R ; G ; B` or `Ps : 2 : : R : G : B`. | #Y |\n * | 3 | CMY color. | #N |\n * | 4 | CMYK color. | #N |\n * | 5 | Indexed (256 colors) as `Ps ; 5 ; INDEX` or `Ps : 5 : INDEX`. | #Y |\n *\n *\n * FIXME: blinking is implemented in attrs, but not working in renderers?\n * FIXME: remove dead branch for p=100\n */\n public charAttributes(params: IParams): boolean {\n // Optimize a single SGR0.\n if (params.length === 1 && params.params[0] === 0) {\n this._processSGR0(this._curAttrData);\n return true;\n }\n\n const l = params.length;\n let p;\n const attr = this._curAttrData;\n\n for (let i = 0; i < l; i++) {\n p = params.params[i];\n if (p >= 30 && p <= 37) {\n // fg color 8\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 30);\n } else if (p >= 40 && p <= 47) {\n // bg color 8\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 40);\n } else if (p >= 90 && p <= 97) {\n // fg color 16\n attr.fg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.fg |= Attributes.CM_P16 | (p - 90) | 8;\n } else if (p >= 100 && p <= 107) {\n // bg color 16\n attr.bg &= ~(Attributes.CM_MASK | Attributes.PCOLOR_MASK);\n attr.bg |= Attributes.CM_P16 | (p - 100) | 8;\n } else if (p === 0) {\n // default\n this._processSGR0(attr);\n } else if (p === 1) {\n // bold text\n attr.fg |= FgFlags.BOLD;\n } else if (p === 3) {\n // italic text\n attr.bg |= BgFlags.ITALIC;\n } else if (p === 4) {\n // underlined text\n attr.fg |= FgFlags.UNDERLINE;\n this._processUnderline(params.hasSubParams(i) ? params.getSubParams(i)![0] : UnderlineStyle.SINGLE, attr);\n } else if (p === 5) {\n // blink\n attr.fg |= FgFlags.BLINK;\n } else if (p === 7) {\n // inverse and positive\n // test with: echo -e '\\e[31m\\e[42mhello\\e[7mworld\\e[27mhi\\e[m'\n attr.fg |= FgFlags.INVERSE;\n } else if (p === 8) {\n // invisible\n attr.fg |= FgFlags.INVISIBLE;\n } else if (p === 9) {\n // strikethrough\n attr.fg |= FgFlags.STRIKETHROUGH;\n } else if (p === 2) {\n // dimmed text\n attr.bg |= BgFlags.DIM;\n } else if (p === 21) {\n // double underline\n this._processUnderline(UnderlineStyle.DOUBLE, attr);\n } else if (p === 22) {\n // not bold nor faint\n attr.fg &= ~FgFlags.BOLD;\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 23) {\n // not italic\n attr.bg &= ~BgFlags.ITALIC;\n } else if (p === 24) {\n // not underlined\n attr.fg &= ~FgFlags.UNDERLINE;\n this._processUnderline(UnderlineStyle.NONE, attr);\n } else if (p === 25) {\n // not blink\n attr.fg &= ~FgFlags.BLINK;\n } else if (p === 27) {\n // not inverse\n attr.fg &= ~FgFlags.INVERSE;\n } else if (p === 28) {\n // not invisible\n attr.fg &= ~FgFlags.INVISIBLE;\n } else if (p === 29) {\n // not strikethrough\n attr.fg &= ~FgFlags.STRIKETHROUGH;\n } else if (p === 39) {\n // reset fg\n attr.fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.fg |= DEFAULT_ATTR_DATA.fg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 49) {\n // reset bg\n attr.bg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);\n attr.bg |= DEFAULT_ATTR_DATA.bg & (Attributes.PCOLOR_MASK | Attributes.RGB_MASK);\n } else if (p === 38 || p === 48 || p === 58) {\n // fg color 256 and RGB\n i += this._extractColor(params, i, attr);\n } else if (p === 53) {\n // overline\n attr.bg |= BgFlags.OVERLINE;\n } else if (p === 55) {\n // not overline\n attr.bg &= ~BgFlags.OVERLINE;\n } else if (p === 221 && (this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl ?? true)) {\n // not bold (kitty extension)\n attr.fg &= ~FgFlags.BOLD;\n } else if (p === 222 && (this._optionsService.rawOptions.vtExtensions?.kittySgrBoldFaintControl ?? true)) {\n // not faint (kitty extension)\n attr.bg &= ~BgFlags.DIM;\n } else if (p === 59) {\n attr.extended = attr.extended.clone();\n attr.extended.underlineColor = -1;\n attr.updateExtended();\n } else {\n this._logService.debug('Unknown SGR attribute: %d.', p);\n }\n }\n return true;\n }\n\n /**\n * CSI Ps n Device Status Report (DSR).\n * Ps = 5 -> Status Report. Result (``OK'') is\n * CSI 0 n\n * Ps = 6 -> Report Cursor Position (CPR) [row;column].\n * Result is\n * CSI r ; c R\n * CSI ? Ps n\n * Device Status Report (DSR, DEC-specific).\n * Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI\n * ? r ; c R (assumes page is zero).\n * Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).\n * or CSI ? 1 1 n (not ready).\n * Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)\n * or CSI ? 2 1 n (locked).\n * Ps = 2 6 -> Report Keyboard status as\n * CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).\n * The last two parameters apply to VT400 & up, and denote key-\n * board ready and LK01 respectively.\n * Ps = 5 3 -> Report Locator status as\n * CSI ? 5 3 n Locator available, if compiled-in, or\n * CSI ? 5 0 n No Locator, if not.\n *\n * @vt: #Y CSI DSR \"Device Status Report\" \"CSI Ps n\" \"Request cursor position (CPR) with `Ps` = 6.\"\n */\n public deviceStatus(params: IParams): boolean {\n switch (params.params[0]) {\n case 5:\n // status report\n this._coreService.triggerDataEvent(`${C0.ESC}[0n`);\n break;\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[${y};${x}R`);\n break;\n }\n return true;\n }\n\n // @vt: #P[Only CPR is supported.] CSI DECDSR \"DEC Device Status Report\" \"CSI ? Ps n\" \"Only CPR is supported (same as DSR).\"\n public deviceStatusPrivate(params: IParams): boolean {\n // modern xterm doesnt seem to\n // respond to any of these except ?6, 6, and 5\n switch (params.params[0]) {\n case 6:\n // cursor position\n const y = this._activeBuffer.y + 1;\n const x = this._activeBuffer.x + 1;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${y};${x}R`);\n break;\n case 15:\n // no printer\n // this.handler(C0.ESC + '[?11n');\n break;\n case 25:\n // dont support user defined keys\n // this.handler(C0.ESC + '[?21n');\n break;\n case 26:\n // north american keyboard\n // this.handler(C0.ESC + '[?27;1;0;0n');\n break;\n case 53:\n // no dec locator/mouse\n // this.handler(C0.ESC + '[?50n');\n break;\n case 996:\n // color scheme query (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n if (this._optionsService.rawOptions.vtExtensions?.colorSchemeQuery ?? true) {\n this._onRequestColorSchemeQuery.fire();\n }\n break;\n }\n return true;\n }\n\n /**\n * CSI ! p Soft terminal reset (DECSTR).\n * http://vt100.net/docs/vt220-rm/table4-10.html\n *\n * @vt: #Y CSI DECSTR \"Soft Terminal Reset\" \"CSI ! p\" \"Reset several terminal attributes to initial state.\"\n * There are two terminal reset sequences - RIS and DECSTR. While RIS performs almost a full\n * terminal bootstrap, DECSTR only resets certain attributes. For most needs DECSTR should be\n * sufficient.\n *\n * The following terminal attributes are reset to default values:\n * - IRM is reset (dafault = false)\n * - scroll margins are reset (default = viewport size)\n * - erase attributes are reset to default\n * - charsets are reset\n * - DECSC data is reset to initial values\n * - DECOM is reset to absolute mode\n *\n *\n * FIXME: there are several more attributes missing (see VT520 manual)\n */\n public softReset(params: IParams): boolean {\n this._coreService.isCursorHidden = false;\n this._onRequestSyncScrollBar.fire();\n this._activeBuffer.scrollTop = 0;\n this._activeBuffer.scrollBottom = this._bufferService.rows - 1;\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._coreService.reset();\n this._charsetService.reset();\n\n // reset DECSC data\n this._activeBuffer.savedX = 0;\n this._activeBuffer.savedY = this._activeBuffer.ybase;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n\n // reset DECOM\n this._coreService.decPrivateModes.origin = false;\n return true;\n }\n\n /**\n * CSI Ps SP q Set cursor style (DECSCUSR, VT520).\n * Ps = 0 -> reset to option.\n * Ps = 1 -> blinking block (default).\n * Ps = 2 -> steady block.\n * Ps = 3 -> blinking underline.\n * Ps = 4 -> steady underline.\n * Ps = 5 -> blinking bar (xterm).\n * Ps = 6 -> steady bar (xterm).\n *\n * @vt: #Y CSI DECSCUSR \"Set Cursor Style\" \"CSI Ps SP q\" \"Set cursor style.\"\n * Supported cursor styles:\n * - 0: reset to option\n * - empty, 1: blinking block\n * - 2: steady block\n * - 3: blinking underline\n * - 4: steady underline\n * - 5: blinking bar\n * - 6: steady bar\n */\n public setCursorStyle(params: IParams): boolean {\n const param = params.length === 0 ? 1 : params.params[0];\n if (param === 0) {\n this._coreService.decPrivateModes.cursorStyle = undefined;\n this._coreService.decPrivateModes.cursorBlink = undefined;\n } else {\n switch (param) {\n case 1:\n case 2:\n this._coreService.decPrivateModes.cursorStyle = 'block';\n break;\n case 3:\n case 4:\n this._coreService.decPrivateModes.cursorStyle = 'underline';\n break;\n case 5:\n case 6:\n this._coreService.decPrivateModes.cursorStyle = 'bar';\n break;\n }\n const isBlinking = param % 2 === 1;\n this._coreService.decPrivateModes.cursorBlink = isBlinking;\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps r\n * Set Scrolling Region [top;bottom] (default = full size of win-\n * dow) (DECSTBM).\n *\n * @vt: #Y CSI DECSTBM \"Set Top and Bottom Margin\" \"CSI Ps ; Ps r\" \"Set top and bottom margins of the viewport [top;bottom] (default = viewport size).\"\n */\n public setScrollRegion(params: IParams): boolean {\n const top = params.params[0] || 1;\n let bottom: number;\n\n if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {\n bottom = this._bufferService.rows;\n }\n\n if (bottom > top) {\n this._activeBuffer.scrollTop = top - 1;\n this._activeBuffer.scrollBottom = bottom - 1;\n this._setCursor(0, 0);\n }\n return true;\n }\n\n /**\n * CSI Ps ; Ps ; Ps t - Various window manipulations and reports (xterm)\n *\n * Note: Only those listed below are supported. All others are left to integrators and\n * need special treatment based on the embedding environment.\n *\n * Ps = 1 4 supported\n * Report xterm text area size in pixels.\n * Result is CSI 4 ; height ; width t\n * Ps = 14 ; 2 not implemented\n * Ps = 16 supported\n * Report xterm character cell size in pixels.\n * Result is CSI 6 ; height ; width t\n * Ps = 18 supported\n * Report the size of the text area in characters.\n * Result is CSI 8 ; height ; width t\n * Ps = 20 supported\n * Report xterm window's icon label.\n * Result is OSC L label ST\n * Ps = 21 supported\n * Report xterm window's title.\n * Result is OSC l label ST\n * Ps = 22 ; 0 -> Save xterm icon and window title on stack. supported\n * Ps = 22 ; 1 -> Save xterm icon title on stack. supported\n * Ps = 22 ; 2 -> Save xterm window title on stack. supported\n * Ps = 23 ; 0 -> Restore xterm icon and window title from stack. supported\n * Ps = 23 ; 1 -> Restore xterm icon title from stack. supported\n * Ps = 23 ; 2 -> Restore xterm window title from stack. supported\n * Ps >= 24 not implemented\n */\n public windowOptions(params: IParams): boolean {\n if (!paramToWindowOption(params.params[0], this._optionsService.rawOptions.windowOptions)) {\n return true;\n }\n const second = (params.length > 1) ? params.params[1] : 0;\n switch (params.params[0]) {\n case 14: // GetWinSizePixels, returns CSI 4 ; height ; width t\n if (second !== 2) {\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_WIN_SIZE_PIXELS);\n }\n break;\n case 16: // GetCellSizePixels, returns CSI 6 ; height ; width t\n this._onRequestWindowsOptionsReport.fire(WindowsOptionsReportType.GET_CELL_SIZE_PIXELS);\n break;\n case 18: // GetWinSizeChars, returns CSI 8 ; height ; width t\n if (this._bufferService) {\n this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);\n }\n break;\n case 22: // PushTitle\n if (second === 0 || second === 2) {\n this._windowTitleStack.push(this._windowTitle);\n if (this._windowTitleStack.length > STACK_LIMIT) {\n this._windowTitleStack.shift();\n }\n }\n if (second === 0 || second === 1) {\n this._iconNameStack.push(this._iconName);\n if (this._iconNameStack.length > STACK_LIMIT) {\n this._iconNameStack.shift();\n }\n }\n break;\n case 23: // PopTitle\n if (second === 0 || second === 2) {\n if (this._windowTitleStack.length) {\n this.setTitle(this._windowTitleStack.pop()!);\n }\n }\n if (second === 0 || second === 1) {\n if (this._iconNameStack.length) {\n this.setIconName(this._iconNameStack.pop()!);\n }\n }\n break;\n }\n return true;\n }\n\n\n /**\n * CSI s\n * ESC 7\n * Save cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCOSC \"Save Cursor\" \"CSI s\" \"Save cursor position, charmap and text attributes.\"\n * @vt: #Y ESC SC \"Save Cursor\" \"ESC 7\" \"Save cursor position, charmap and text attributes.\"\n */\n public saveCursor(params?: IParams): boolean {\n this._activeBuffer.savedX = this._activeBuffer.x;\n this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y;\n this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg;\n this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg;\n this._activeBuffer.savedCharset = this._charsetService.charset;\n this._activeBuffer.savedCharsets = this._charsetService.charsets.slice();\n this._activeBuffer.savedGlevel = this._charsetService.glevel;\n this._activeBuffer.savedOriginMode = this._coreService.decPrivateModes.origin;\n this._activeBuffer.savedWraparoundMode = this._coreService.decPrivateModes.wraparound;\n return true;\n }\n\n\n /**\n * CSI u\n * ESC 8\n * Restore cursor (ANSI.SYS).\n *\n * @vt: #P[TODO...] CSI SCORC \"Restore Cursor\" \"CSI u\" \"Restore cursor position, charmap and text attributes.\"\n * @vt: #Y ESC RC \"Restore Cursor\" \"ESC 8\" \"Restore cursor position, charmap and text attributes.\"\n */\n public restoreCursor(params?: IParams): boolean {\n this._activeBuffer.x = this._activeBuffer.savedX || 0;\n this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0);\n this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg;\n this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg;\n for (let i = 0; i < this._activeBuffer.savedCharsets.length; i++) {\n this._charsetService.setgCharset(i, this._activeBuffer.savedCharsets[i]);\n }\n this._charsetService.setgLevel(this._activeBuffer.savedGlevel);\n this._coreService.decPrivateModes.origin = this._activeBuffer.savedOriginMode;\n this._coreService.decPrivateModes.wraparound = this._activeBuffer.savedWraparoundMode;\n this._restrictCursor();\n return true;\n }\n\n /**\n * OSC 2; ST (set window title)\n * Proxy to set window title.\n *\n * @vt: #P[Icon name is not exposed.] OSC 0 \"Set Windows Title and Icon Name\" \"OSC 0 ; Pt BEL\" \"Set window title and icon name.\"\n * Icon name is not supported. For Window Title see below.\n *\n * @vt: #Y OSC 2 \"Set Windows Title\" \"OSC 2 ; Pt BEL\" \"Set window title.\"\n * xterm.js does not manipulate the title directly, instead exposes changes via the event\n * `Terminal.onTitleChange`.\n */\n public setTitle(data: string): boolean {\n this._windowTitle = data;\n this._onTitleChange.fire(data);\n return true;\n }\n\n /**\n * OSC 1; ST\n * Note: Icon name is not exposed.\n */\n public setIconName(data: string): boolean {\n this._iconName = data;\n return true;\n }\n\n /**\n * OSC 4; ; ST (set ANSI color to )\n *\n * @vt: #Y OSC 4 \"Set ANSI color\" \"OSC 4 ; c ; spec BEL\" \"Change color number `c` to the color specified by `spec`.\"\n * `c` is the color index between 0 and 255. The color format of `spec` is derived from\n * `XParseColor` (see OSC 10 for supported formats). There may be multipe `c ; spec` pairs present\n * in the same instruction. If `spec` contains `?` the terminal returns a sequence with the\n * currently set color.\n */\n public setOrReportIndexedColor(data: string): boolean {\n const event: IColorEvent = [];\n const slots = data.split(';');\n while (slots.length > 1) {\n const idx = slots.shift() as string;\n const spec = slots.shift() as string;\n if (/^\\d+$/.exec(idx)) {\n const index = parseInt(idx);\n if (isValidColorIndex(index)) {\n if (spec === '?') {\n event.push({ type: ColorRequestType.REPORT, index });\n } else {\n const color = parseColor(spec);\n if (color) {\n event.push({ type: ColorRequestType.SET, index, color });\n }\n }\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 8 ; ; ST - create hyperlink\n * OSC 8 ; ; ST - finish hyperlink\n *\n * Test case:\n *\n * ```sh\n * printf '\\e]8;;http://example.com\\e\\\\This is a link\\e]8;;\\e\\\\\\n'\n * ```\n *\n * @vt: #Y OSC 8 \"Create hyperlink\" \"OSC 8 ; params ; uri BEL\" \"Create a hyperlink to `uri` using `params`.\"\n * `uri` is a hyperlink starting with `http://`, `https://`, `ftp://`, `file://` or `mailto://`. `params` is an\n * optional list of key=value assignments, separated by the : character.\n * Example: `id=xyz123:foo=bar:baz=quux`.\n * Currently only the id key is defined. Cells that share the same ID and URI share hover\n * feedback. Use `OSC 8 ; ; BEL` to finish the current hyperlink.\n */\n public setHyperlink(data: string): boolean {\n // Arg parsing is special cases to support unencoded semi-colons in the URIs (#4944)\n const idx = data.indexOf(';');\n if (idx === -1) {\n // malformed sequence, just return as handled\n return true;\n }\n const id = data.slice(0, idx).trim();\n const uri = data.slice(idx + 1);\n if (uri) {\n return this._createHyperlink(id, uri);\n }\n if (id.trim()) {\n return false;\n }\n return this._finishHyperlink();\n }\n\n private _createHyperlink(params: string, uri: string): boolean {\n // It's legal to open a new hyperlink without explicitly finishing the previous one\n if (this._getCurrentLinkId()) {\n this._finishHyperlink();\n }\n const parsedParams = params.split(':');\n let id: string | undefined;\n const idParamIndex = parsedParams.findIndex(e => e.startsWith('id='));\n if (idParamIndex !== -1) {\n id = parsedParams[idParamIndex].slice(3) || undefined;\n }\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id, uri });\n this._curAttrData.updateExtended();\n return true;\n }\n\n private _finishHyperlink(): boolean {\n this._curAttrData.extended = this._curAttrData.extended.clone();\n this._curAttrData.extended.urlId = 0;\n this._curAttrData.updateExtended();\n return true;\n }\n\n // special colors - OSC 10 | 11 | 12\n private _specialColors = [SpecialColorIndex.FOREGROUND, SpecialColorIndex.BACKGROUND, SpecialColorIndex.CURSOR];\n\n /**\n * Apply colors requests for special colors in OSC 10 | 11 | 12.\n * Since these commands are stacking from multiple parameters,\n * we handle them in a loop with an entry offset to `_specialColors`.\n */\n private _setOrReportSpecialColor(data: string, offset: number): boolean {\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i, ++offset) {\n if (offset >= this._specialColors.length) break;\n if (slots[i] === '?') {\n this._onColor.fire([{ type: ColorRequestType.REPORT, index: this._specialColors[offset] }]);\n } else {\n const color = parseColor(slots[i]);\n if (color) {\n this._onColor.fire([{ type: ColorRequestType.SET, index: this._specialColors[offset], color }]);\n }\n }\n }\n return true;\n }\n\n /**\n * OSC 10 ; | ST - set or query default foreground color\n *\n * @vt: #Y OSC 10 \"Set or query default foreground color\" \"OSC 10 ; Pt BEL\" \"Set or query default foreground color.\"\n * To set the color, the following color specification formats are supported:\n * - `rgb://` for `, , ` in `h | hh | hhh | hhhh`, where\n * `h` is a single hexadecimal digit (case insignificant). The different widths scale\n * from 4 bit (`h`) to 16 bit (`hhhh`) and get converted to 8 bit (`hh`).\n * - `#RGB` - 4 bits per channel, expanded to `#R0G0B0`\n * - `#RRGGBB` - 8 bits per channel\n * - `#RRRGGGBBB` - 12 bits per channel, truncated to `#RRGGBB`\n * - `#RRRRGGGGBBBB` - 16 bits per channel, truncated to `#RRGGBB`\n *\n * **Note:** X11 named colors are currently unsupported.\n *\n * If `Pt` contains `?` instead of a color specification, the terminal\n * returns a sequence with the current default foreground color\n * (use that sequence to restore the color after changes).\n *\n * **Note:** Other than xterm, xterm.js does not support OSC 12 - 19.\n * Therefore stacking multiple `Pt` separated by `;` only works for the first two entries.\n */\n public setOrReportFgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 0);\n }\n\n /**\n * OSC 11 ; | ST - set or query default background color\n *\n * @vt: #Y OSC 11 \"Set or query default background color\" \"OSC 11 ; Pt BEL\" \"Same as OSC 10, but for default background.\"\n */\n public setOrReportBgColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 1);\n }\n\n /**\n * OSC 12 ; | ST - set or query default cursor color\n *\n * @vt: #Y OSC 12 \"Set or query default cursor color\" \"OSC 12 ; Pt BEL\" \"Same as OSC 10, but for default cursor color.\"\n */\n public setOrReportCursorColor(data: string): boolean {\n return this._setOrReportSpecialColor(data, 2);\n }\n\n /**\n * OSC 104 ; ST - restore ANSI color \n *\n * @vt: #Y OSC 104 \"Reset ANSI color\" \"OSC 104 ; c BEL\" \"Reset color number `c` to themed color.\"\n * `c` is the color index between 0 and 255. This function restores the default color for `c` as\n * specified by the loaded theme. Any number of `c` parameters may be given.\n * If no parameters are given, the entire indexed color table will be reset.\n */\n public restoreIndexedColor(data: string): boolean {\n if (!data) {\n this._onColor.fire([{ type: ColorRequestType.RESTORE }]);\n return true;\n }\n const event: IColorEvent = [];\n const slots = data.split(';');\n for (let i = 0; i < slots.length; ++i) {\n if (/^\\d+$/.exec(slots[i])) {\n const index = parseInt(slots[i]);\n if (isValidColorIndex(index)) {\n event.push({ type: ColorRequestType.RESTORE, index });\n }\n }\n }\n if (event.length) {\n this._onColor.fire(event);\n }\n return true;\n }\n\n /**\n * OSC 110 ST - restore default foreground color\n *\n * @vt: #Y OSC 110 \"Restore default foreground color\" \"OSC 110 BEL\" \"Restore default foreground to themed color.\"\n */\n public restoreFgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.FOREGROUND }]);\n return true;\n }\n\n /**\n * OSC 111 ST - restore default background color\n *\n * @vt: #Y OSC 111 \"Restore default background color\" \"OSC 111 BEL\" \"Restore default background to themed color.\"\n */\n public restoreBgColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.BACKGROUND }]);\n return true;\n }\n\n /**\n * OSC 112 ST - restore default cursor color\n *\n * @vt: #Y OSC 112 \"Restore default cursor color\" \"OSC 112 BEL\" \"Restore default cursor to themed color.\"\n */\n public restoreCursorColor(data: string): boolean {\n this._onColor.fire([{ type: ColorRequestType.RESTORE, index: SpecialColorIndex.CURSOR }]);\n return true;\n }\n\n /**\n * ESC E\n * C1.NEL\n * DEC mnemonic: NEL (https://vt100.net/docs/vt510-rm/NEL)\n * Moves cursor to first position on next line.\n *\n * @vt: #Y C1 NEL \"Next Line\" \"\\x85\" \"Move the cursor to the beginning of the next row.\"\n * @vt: #Y ESC NEL \"Next Line\" \"ESC E\" \"Move the cursor to the beginning of the next row.\"\n */\n public nextLine(): boolean {\n this._activeBuffer.x = 0;\n this.index();\n return true;\n }\n\n /**\n * ESC =\n * DEC mnemonic: DECKPAM (https://vt100.net/docs/vt510-rm/DECKPAM.html)\n * Enables the numeric keypad to send application sequences to the host.\n */\n public keypadApplicationMode(): boolean {\n this._logService.debug('Serial port requested application keypad.');\n this._coreService.decPrivateModes.applicationKeypad = true;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC >\n * DEC mnemonic: DECKPNM (https://vt100.net/docs/vt510-rm/DECKPNM.html)\n * Enables the keypad to send numeric characters to the host.\n */\n public keypadNumericMode(): boolean {\n this._logService.debug('Switching back to normal keypad.');\n this._coreService.decPrivateModes.applicationKeypad = false;\n this._onRequestSyncScrollBar.fire();\n return true;\n }\n\n /**\n * ESC % @\n * ESC % G\n * Select default character set. UTF-8 is not supported (string are unicode anyways)\n * therefore ESC % G does the same.\n */\n public selectDefaultCharset(): boolean {\n this._charsetService.setgLevel(0);\n this._charsetService.setgCharset(0, DEFAULT_CHARSET); // US (default)\n return true;\n }\n\n /**\n * ESC ( C\n * Designate G0 Character Set, VT100, ISO 2022.\n * ESC ) C\n * Designate G1 Character Set (ISO 2022, VT100).\n * ESC * C\n * Designate G2 Character Set (ISO 2022, VT220).\n * ESC + C\n * Designate G3 Character Set (ISO 2022, VT220).\n * ESC - C\n * Designate G1 Character Set (VT300).\n * ESC . C\n * Designate G2 Character Set (VT300).\n * ESC / C\n * Designate G3 Character Set (VT300). C = A -> ISO Latin-1 Supplemental. - Supported?\n */\n public selectCharset(collectAndFlag: string): boolean {\n if (collectAndFlag.length !== 2) {\n this.selectDefaultCharset();\n return true;\n }\n if (collectAndFlag[0] === '/') {\n return true; // TODO: Is this supported?\n }\n this._charsetService.setgCharset(GLEVEL[collectAndFlag[0]], CHARSETS[collectAndFlag[1]] ?? DEFAULT_CHARSET);\n return true;\n }\n\n /**\n * ESC D\n * C1.IND\n * DEC mnemonic: IND (https://vt100.net/docs/vt510-rm/IND.html)\n * Moves the cursor down one line in the same column.\n *\n * @vt: #Y C1 IND \"Index\" \"\\x84\" \"Move the cursor one line down scrolling if needed.\"\n * @vt: #Y ESC IND \"Index\" \"ESC D\" \"Move the cursor one line down scrolling if needed.\"\n */\n public index(): boolean {\n this._restrictCursor();\n this._activeBuffer.y++;\n if (this._activeBuffer.y === this._activeBuffer.scrollBottom + 1) {\n this._activeBuffer.y--;\n this._bufferService.scroll(this._eraseAttrData());\n } else if (this._activeBuffer.y >= this._bufferService.rows) {\n this._activeBuffer.y = this._bufferService.rows - 1;\n }\n this._restrictCursor();\n return true;\n }\n\n /**\n * ESC H\n * C1.HTS\n * DEC mnemonic: HTS (https://vt100.net/docs/vt510-rm/HTS.html)\n * Sets a horizontal tab stop at the column position indicated by\n * the value of the active column when the terminal receives an HTS.\n *\n * @vt: #Y C1 HTS \"Horizontal Tabulation Set\" \"\\x88\" \"Places a tab stop at the current cursor position.\"\n * @vt: #Y ESC HTS \"Horizontal Tabulation Set\" \"ESC H\" \"Places a tab stop at the current cursor position.\"\n */\n public tabSet(): boolean {\n this._activeBuffer.tabs[this._activeBuffer.x] = true;\n return true;\n }\n\n /**\n * ESC M\n * C1.RI\n * DEC mnemonic: HTS\n * Moves the cursor up one line in the same column. If the cursor is at the top margin,\n * the page scrolls down.\n *\n * @vt: #Y ESC IR \"Reverse Index\" \"ESC M\" \"Move the cursor one line up scrolling if needed.\"\n */\n public reverseIndex(): boolean {\n this._restrictCursor();\n if (this._activeBuffer.y === this._activeBuffer.scrollTop) {\n // possibly move the code below to term.reverseScroll();\n // test: echo -ne '\\e[1;1H\\e[44m\\eM\\e[0m'\n // blankLine(true) is xterm/linux behavior\n const scrollRegionHeight = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;\n this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, scrollRegionHeight, 1);\n this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData()));\n this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);\n } else {\n this._activeBuffer.y--;\n this._restrictCursor(); // quickfix to not run out of bounds\n }\n return true;\n }\n\n /**\n * ESC c\n * DEC mnemonic: RIS (https://vt100.net/docs/vt510-rm/RIS.html)\n * Reset to initial state.\n *\n * @vt: #Y ESC RIS \"Full Reset\" \"ESC c\" \"Reset to initial state.\"\n */\n public fullReset(): boolean {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }\n\n public reset(): void {\n this._curAttrData = DEFAULT_ATTR_DATA.clone();\n this._eraseAttrDataInternal = DEFAULT_ATTR_DATA.clone();\n }\n\n /**\n * back_color_erase feature for xterm.\n */\n private _eraseAttrData(): IAttributeData {\n this._eraseAttrDataInternal.bg &= ~(Attributes.CM_MASK | 0xFFFFFF);\n this._eraseAttrDataInternal.bg |= this._curAttrData.bg & ~0xFC000000;\n return this._eraseAttrDataInternal;\n }\n\n /**\n * ESC n\n * ESC o\n * ESC |\n * ESC }\n * ESC ~\n * DEC mnemonic: LS (https://vt100.net/docs/vt510-rm/LS.html)\n * When you use a locking shift, the character set remains in GL or GR until\n * you use another locking shift. (partly supported)\n */\n public setgLevel(level: number): boolean {\n this._charsetService.setgLevel(level);\n return true;\n }\n\n /**\n * ESC # 8\n * DEC mnemonic: DECALN (https://vt100.net/docs/vt510-rm/DECALN.html)\n * This control function fills the complete screen area with\n * a test pattern (E) used for adjusting screen alignment.\n *\n * @vt: #Y ESC DECALN \"Screen Alignment Pattern\" \"ESC # 8\" \"Fill viewport with a test pattern (E).\"\n */\n public screenAlignmentPattern(): boolean {\n // prepare cell data\n const cell = new CellData();\n cell.content = 1 << Content.WIDTH_SHIFT | 'E'.charCodeAt(0);\n cell.fg = this._curAttrData.fg;\n cell.bg = this._curAttrData.bg;\n\n\n this._setCursor(0, 0);\n for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {\n const row = this._activeBuffer.ybase + this._activeBuffer.y + yOffset;\n const line = this._activeBuffer.lines.get(row);\n if (line) {\n line.fill(cell);\n line.isWrapped = false;\n }\n }\n this._dirtyRowTracker.markAllDirty();\n this._setCursor(0, 0);\n return true;\n }\n\n\n /**\n * DCS $ q Pt ST\n * DECRQSS (https://vt100.net/docs/vt510-rm/DECRQSS.html)\n * Request Status String (DECRQSS), VT420 and up.\n * Response: DECRPSS (https://vt100.net/docs/vt510-rm/DECRPSS.html)\n *\n * @vt: #P[Limited support, see below.] DCS DECRQSS \"Request Selection or Setting\" \"DCS $ q Pt ST\" \"Request several terminal settings.\"\n * Response is in the form `ESC P 1 $ r Pt ST` for valid requests, where `Pt` contains the\n * corresponding CSI string, `ESC P 0 ST` for invalid requests.\n *\n * Supported requests and responses:\n *\n * | Type | Request | Response (`Pt`) |\n * | -------------------------------- | ----------------- | ----------------------------------------------------- |\n * | Graphic Rendition (SGR) | `DCS $ q m ST` | always reporting `0m` (currently broken) |\n * | Top and Bottom Margins (DECSTBM) | `DCS $ q r ST` | `Ps ; Ps r` |\n * | Cursor Style (DECSCUSR) | `DCS $ q SP q ST` | `Ps SP q` |\n * | Protection Attribute (DECSCA) | `DCS $ q \" q ST` | `Ps \" q` (DECSCA 2 is reported as Ps = 0) |\n * | Conformance Level (DECSCL) | `DCS $ q \" p ST` | always reporting `61 ; 1 \" p` (DECSCL is unsupported) |\n *\n *\n * TODO:\n * - fix SGR report\n * - either check which conformance is better suited or remove the report completely\n * --> we are currently a mixture of all up to VT400 but dont follow anyone strictly\n */\n public requestStatusString(data: string, params: IParams): boolean {\n const f = (s: string): boolean => {\n this._coreService.triggerDataEvent(`${C0.ESC}${s}${C0.ESC}\\\\`);\n return true;\n };\n\n // access helpers\n const b = this._bufferService.buffer;\n const opts = this._optionsService.rawOptions;\n const STYLES: { [key: string]: number } = { 'block': 2, 'underline': 4, 'bar': 6 };\n\n if (data === '\"q') return f(`P1$r${this._curAttrData.isProtected() ? 1 : 0}\"q`);\n if (data === '\"p') return f(`P1$r61;1\"p`);\n if (data === 'r') return f(`P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r`);\n // FIXME: report real SGR settings instead of 0m\n if (data === 'm') return f(`P1$r0m`);\n if (data === ' q') return f(`P1$r${STYLES[opts.cursorStyle] - (opts.cursorBlink ? 1 : 0)} q`);\n return f(`P0$r`);\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n this._dirtyRowTracker.markRangeDirty(y1, y2);\n }\n\n // #region Kitty keyboard\n\n /**\n * CSI = flags ; mode u\n * Set Kitty keyboard protocol flags.\n * mode: 1=set, 2=set-only-specified, 3=reset-only-specified\n *\n * @vt: #Y CSI KKBDSET \"Kitty Keyboard Set\" \"CSI = Ps ; Pm u\" \"Set Kitty keyboard protocol flags.\"\n */\n public kittyKeyboardSet(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = params.params[0] || 0;\n const mode = params.params[1] || 1;\n const state = this._coreService.kittyKeyboard;\n\n switch (mode) {\n case 1: // Set all flags\n state.flags = flags;\n break;\n case 2: // Set only specified flags (OR)\n state.flags |= flags;\n break;\n case 3: // Reset only specified flags (AND NOT)\n state.flags &= ~flags;\n break;\n }\n return true;\n }\n\n /**\n * CSI ? u\n * Query Kitty keyboard protocol flags.\n * Terminal responds with CSI ? flags u\n *\n * @vt: #Y CSI KKBDQUERY \"Kitty Keyboard Query\" \"CSI ? u\" \"Query Kitty keyboard protocol flags.\"\n */\n public kittyKeyboardQuery(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = this._coreService.kittyKeyboard.flags;\n this._coreService.triggerDataEvent(`${C0.ESC}[?${flags}u`);\n return true;\n }\n\n /**\n * CSI > flags u\n * Push Kitty keyboard flags onto stack and set new flags.\n *\n * @vt: #Y CSI KKBDPUSH \"Kitty Keyboard Push\" \"CSI > Ps u\" \"Push keyboard flags to stack and set new flags.\"\n */\n public kittyKeyboardPush(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const flags = params.params[0] || 0;\n const state = this._coreService.kittyKeyboard;\n const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;\n const stack = isAlt ? state.altStack : state.mainStack;\n\n // Evict oldest entry if stack is full (DoS protection, limit of 16)\n if (stack.length >= 16) {\n stack.shift();\n }\n\n // Push current flags onto stack and set new flags\n stack.push(state.flags);\n state.flags = flags;\n return true;\n }\n\n /**\n * CSI < count u\n * Pop Kitty keyboard flags from stack.\n *\n * @vt: #Y CSI KKBDPOP \"Kitty Keyboard Pop\" \"CSI < Ps u\" \"Pop keyboard flags from stack.\"\n */\n public kittyKeyboardPop(params: IParams): boolean {\n if (!this._optionsService.rawOptions.vtExtensions?.kittyKeyboard) {\n return true;\n }\n const count = Math.max(1, params.params[0] || 1);\n const state = this._coreService.kittyKeyboard;\n const isAlt = this._bufferService.buffer === this._bufferService.buffers.alt;\n const stack = isAlt ? state.altStack : state.mainStack;\n\n // Pop specified number of entries from stack\n for (let i = 0; i < count && stack.length > 0; i++) {\n state.flags = stack.pop()!;\n }\n // If stack is empty after popping, reset to 0\n if (stack.length === 0 && count > 0) {\n state.flags = 0;\n }\n return true;\n }\n\n // #endregion\n}\n\nexport interface IDirtyRowTracker {\n readonly start: number;\n readonly end: number;\n\n clearRange(): void;\n markDirty(y: number): void;\n markRangeDirty(y1: number, y2: number): void;\n markAllDirty(): void;\n}\n\nclass DirtyRowTracker implements IDirtyRowTracker {\n public start!: number;\n public end!: number;\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n this.clearRange();\n }\n\n public clearRange(): void {\n this.start = this._bufferService.buffer.y;\n this.end = this._bufferService.buffer.y;\n }\n\n public markDirty(y: number): void {\n if (y < this.start) {\n this.start = y;\n } else if (y > this.end) {\n this.end = y;\n }\n }\n\n public markRangeDirty(y1: number, y2: number): void {\n if (y1 > y2) {\n $temp = y1;\n y1 = y2;\n y2 = $temp;\n }\n if (y1 < this.start) {\n this.start = y1;\n }\n if (y2 > this.end) {\n this.end = y2;\n }\n }\n\n public markAllDirty(): void {\n this.markRangeDirty(0, this._bufferService.rows - 1);\n }\n}\n\nexport function isValidColorIndex(value: number): value is ColorIndex {\n return 0 <= value && value < 256;\n}\n", "\n/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\ndeclare const setTimeout: (handler: () => void, timeout?: number) => void;\n\n/**\n * Safety watermark to avoid memory exhaustion and browser engine crash on fast data input.\n * Enable flow control to avoid this limit and make sure that your backend correctly\n * propagates this to the underlying pty. (see docs for further instructions)\n * Since this limit is meant as a safety parachute to prevent browser crashs,\n * it is set to a very high number. Typically xterm.js gets unresponsive with\n * a 100 times lower number (>500 kB).\n */\nconst DISCARD_WATERMARK = 50000000; // ~50 MB\n\n/**\n * The max number of ms to spend on writes before allowing the renderer to\n * catch up with a 0ms setTimeout. A value of < 33 to keep us close to\n * 30fps, and a value of < 16 to try to run at 60fps. Of course, the real FPS\n * depends on the time it takes for the renderer to draw the frame.\n */\nconst WRITE_TIMEOUT_MS = 12;\n\n/**\n * Threshold of max held chunks in the write buffer, that were already processed.\n * This is a tradeoff between extensive write buffer shifts (bad runtime) and high\n * memory consumption by data thats not used anymore.\n */\nconst WRITE_BUFFER_LENGTH_THRESHOLD = 50;\n\nexport class WriteBuffer extends Disposable {\n private _writeBuffer: (string | Uint8Array)[] = [];\n private _callbacks: ((() => void) | undefined)[] = [];\n private _pendingData = 0;\n private _bufferOffset = 0;\n private _isSyncWriting = false;\n private _syncCalls = 0;\n private _didUserInput = false;\n\n private readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise) {\n super();\n }\n\n public handleUserInput(): void {\n this._didUserInput = true;\n }\n\n /**\n * Flushes all pending writes synchronously. This is useful when you need to\n * ensure all queued data is processed before performing an operation that\n * depends upon everything being parsed like resize.\n *\n * Note: This is unreliable with async parser handlers as it does not wait for\n * promises to resolve.\n */\n public flushSync(): void {\n // exit early if another sync write loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // Process all pending chunks synchronously\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n\n // Reset buffer state\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n\n this._isSyncWriting = false;\n }\n\n /**\n * @deprecated Unreliable, to be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n // stop writeSync recursions with maxSubsequentCalls argument\n // This is dangerous to use as it will lose the current data chunk\n // and return immediately.\n if (maxSubsequentCalls !== undefined && this._syncCalls > maxSubsequentCalls) {\n // comment next line if a whole loop block should only contain x `writeSync` calls\n // (total flat vs. deep nested limit)\n this._syncCalls = 0;\n return;\n }\n // append chunk to buffer\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(undefined);\n\n // increase recursion counter\n this._syncCalls++;\n // exit early if another writeSync loop is active\n if (this._isSyncWriting) {\n return;\n }\n this._isSyncWriting = true;\n\n // force sync processing on pending data chunks to avoid in-band data scrambling\n // does the same as innerWrite but without event loop\n // we have to do it here as single loop steps to not corrupt loop subject\n // by another writeSync call triggered from _action\n let chunk: string | Uint8Array | undefined;\n while (chunk = this._writeBuffer.shift()) {\n this._action(chunk);\n const cb = this._callbacks.shift();\n if (cb) cb();\n }\n // reset to avoid reprocessing of chunks with scheduled innerWrite call\n // stopping scheduled innerWrite by offset > length condition\n this._pendingData = 0;\n this._bufferOffset = 0x7FFFFFFF;\n\n // allow another writeSync to loop\n this._isSyncWriting = false;\n this._syncCalls = 0;\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n if (this._pendingData > DISCARD_WATERMARK) {\n throw new Error('write data discarded, use flow control to avoid losing data');\n }\n\n // schedule chunk processing for next event loop run\n if (!this._writeBuffer.length) {\n this._bufferOffset = 0;\n\n // If this is the first write call after the user has done some input,\n // parse it immediately to minimize input latency,\n // otherwise schedule for the next event\n if (this._didUserInput) {\n this._didUserInput = false;\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n this._innerWrite();\n return;\n }\n\n setTimeout(() => this._innerWrite());\n }\n\n this._pendingData += data.length;\n this._writeBuffer.push(data);\n this._callbacks.push(callback);\n }\n\n /**\n * Inner write call, that enters the sliced chunk processing by timing.\n *\n * `lastTime` indicates, when the last _innerWrite call had started.\n * It is used to aggregate async handler execution under a timeout constraint\n * effectively lowering the redrawing needs, schematically:\n *\n * macroTask _innerWrite:\n * if (performance.now() - (lastTime | 0) < WRITE_TIMEOUT_MS):\n * schedule microTask _innerWrite(lastTime)\n * else:\n * schedule macroTask _innerWrite(0)\n *\n * overall execution order on task queues:\n *\n * macrotasks: [...] --> _innerWrite(0) --> [...] --> screenUpdate --> [...]\n * m t: |\n * i a: [...]\n * c s: |\n * r k: while < timeout:\n * o s: _innerWrite(timeout)\n *\n * `promiseResult` depicts the promise resolve value of an async handler.\n * This value gets carried forward through all saved stack states of the\n * paused parser for proper continuation.\n *\n * Note, for pure sync code `lastTime` and `promiseResult` have no meaning.\n */\n protected _innerWrite(lastTime: number = 0, promiseResult: boolean = true): void {\n const startTime = lastTime || performance.now();\n while (this._writeBuffer.length > this._bufferOffset) {\n const data = this._writeBuffer[this._bufferOffset];\n const result = this._action(data, promiseResult);\n if (result) {\n /**\n * If we get a promise as return value, we re-schedule the continuation\n * as thenable on the promise and exit right away.\n *\n * The exit here means, that we block input processing at the current active chunk,\n * the exact execution position within the chunk is preserved by the saved\n * stack content in InputHandler and EscapeSequenceParser.\n *\n * Resuming happens automatically from that saved stack state.\n * Also the resolved promise value is passed along the callstack to\n * `EscapeSequenceParser.parse` to correctly resume the stopped handler loop.\n *\n * Exceptions on async handlers will be logged to console async, but do not interrupt\n * the input processing (continues with next handler at the current input position).\n */\n\n /**\n * If a promise takes long to resolve, we should schedule continuation behind setTimeout.\n * This might already be too late, if our .then enters really late (executor + prev thens\n * took very long). This cannot be solved here for the handler itself (it is the handlers\n * responsibility to slice hard work), but we can at least schedule a screen update as we\n * gain control.\n */\n const continuation: (r: boolean) => void = (r: boolean) => performance.now() - startTime >= WRITE_TIMEOUT_MS\n ? setTimeout(() => this._innerWrite(0, r))\n : this._innerWrite(startTime, r);\n\n /**\n * Optimization considerations:\n * The continuation above favors FPS over throughput by eval'ing `startTime` on resolve.\n * This might schedule too many screen updates with bad throughput drops (in case a slow\n * resolving handler sliced its work properly behind setTimeout calls). We cannot spot\n * this condition here, also the renderer has no way to spot nonsense updates either.\n * FIXME: A proper fix for this would track the FPS at the renderer entry level separately.\n *\n * If favoring of FPS shows bad throughtput impact, use the following instead. It favors\n * throughput by eval'ing `startTime` upfront pulling at least one more chunk into the\n * current microtask queue (executed before setTimeout).\n */\n // const continuation: (r: boolean) => void = performance.now() - startTime >=\n // WRITE_TIMEOUT_MS\n // ? r => setTimeout(() => this._innerWrite(0, r))\n // : r => this._innerWrite(startTime, r);\n\n // Handle exceptions synchronously to current band position, idea:\n // 1. spawn a single microtask which we allow to throw hard\n // 2. spawn a promise immediately resolving to `true`\n // (executed on the same queue, thus properly aligned before continuation happens)\n result.catch(err => {\n queueMicrotask(() => {throw err;});\n return Promise.resolve(false);\n }).then(continuation);\n return;\n }\n\n const cb = this._callbacks[this._bufferOffset];\n if (cb) cb();\n this._bufferOffset++;\n this._pendingData -= data.length;\n\n if (performance.now() - startTime >= WRITE_TIMEOUT_MS) {\n break;\n }\n }\n if (this._writeBuffer.length > this._bufferOffset) {\n // Allow renderer to catch up before processing the next batch\n // trim already processed chunks if we are above threshold\n if (this._bufferOffset > WRITE_BUFFER_LENGTH_THRESHOLD) {\n this._writeBuffer = this._writeBuffer.slice(this._bufferOffset);\n this._callbacks = this._callbacks.slice(this._bufferOffset);\n this._bufferOffset = 0;\n }\n setTimeout(() => this._innerWrite());\n } else {\n this._writeBuffer.length = 0;\n this._callbacks.length = 0;\n this._pendingData = 0;\n this._bufferOffset = 0;\n }\n this._onWriteParsed.fire();\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\nimport { IBufferService, IOscLinkService } from 'common/services/Services';\nimport { IMarker, IOscLinkData } from 'common/Types';\n\nexport class OscLinkService implements IOscLinkService {\n public serviceBrand: any;\n\n private _nextId = 1;\n\n /**\n * A map of the link key to link entry. This is used to add additional lines to links with ids.\n */\n private _entriesWithId: Map = new Map();\n\n /**\n * A map of the link id to the link entry. The \"link id\" (number) which is the numberic\n * representation of a unique link should not be confused with \"id\" (string) which comes in with\n * `id=` in the OSC link's properties.\n */\n private _dataByLinkId: Map = new Map();\n\n constructor(\n @IBufferService private readonly _bufferService: IBufferService\n ) {\n }\n\n public registerLink(data: IOscLinkData): number {\n const buffer = this._bufferService.buffer;\n\n // Links with no id will only ever be registered a single time\n if (data.id === undefined) {\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryNoId = {\n data,\n id: this._nextId++,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n // Add the line to the link if it already exists\n const castData = data as Required;\n const key = this._getEntryIdKey(castData);\n const match = this._entriesWithId.get(key);\n if (match) {\n this.addLineToLink(match.id, buffer.ybase + buffer.y);\n return match.id;\n }\n\n // Create the link\n const marker = buffer.addMarker(buffer.ybase + buffer.y);\n const entry: IOscLinkEntryWithId = {\n id: this._nextId++,\n key: this._getEntryIdKey(castData),\n data: castData,\n lines: [marker]\n };\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n this._entriesWithId.set(entry.key, entry);\n this._dataByLinkId.set(entry.id, entry);\n return entry.id;\n }\n\n public addLineToLink(linkId: number, y: number): void {\n const entry = this._dataByLinkId.get(linkId);\n if (!entry) {\n return;\n }\n if (entry.lines.every(e => e.line !== y)) {\n const marker = this._bufferService.buffer.addMarker(y);\n entry.lines.push(marker);\n marker.onDispose(() => this._removeMarkerFromLink(entry, marker));\n }\n }\n\n public getLinkData(linkId: number): IOscLinkData | undefined {\n return this._dataByLinkId.get(linkId)?.data;\n }\n\n private _getEntryIdKey(linkData: Required): string {\n return `${linkData.id};;${linkData.uri}`;\n }\n\n private _removeMarkerFromLink(entry: IOscLinkEntryNoId | IOscLinkEntryWithId, marker: IMarker): void {\n const index = entry.lines.indexOf(marker);\n if (index === -1) {\n return;\n }\n entry.lines.splice(index, 1);\n if (entry.lines.length === 0) {\n if (entry.data.id !== undefined) {\n this._entriesWithId.delete((entry as IOscLinkEntryWithId).key);\n }\n this._dataByLinkId.delete(entry.id);\n }\n }\n}\n\ninterface IOscLinkEntry {\n data: T;\n id: number;\n lines: IMarker[];\n}\n\ninterface IOscLinkEntryNoId extends IOscLinkEntry {\n}\n\ninterface IOscLinkEntryWithId extends IOscLinkEntry> {\n key: string;\n}\n", "/**\n * Copyright (c) 2014-2020 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, LogLevelEnum, ITerminalOptions, IOscLinkService } from 'common/services/Services';\nimport { InstantiationService } from 'common/services/InstantiationService';\nimport { LogService } from 'common/services/LogService';\nimport { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';\nimport { OptionsService } from 'common/services/OptionsService';\nimport { IDisposable, IAttributeData, ICoreTerminal, IScrollEvent } from 'common/Types';\nimport { CoreService } from 'common/services/CoreService';\nimport { CoreMouseService } from 'common/services/CoreMouseService';\nimport { UnicodeService } from 'common/services/UnicodeService';\nimport { CharsetService } from 'common/services/CharsetService';\nimport { updateWindowsModeWrappedState } from 'common/WindowsMode';\nimport { IFunctionIdentifier, IParams } from 'common/parser/Types';\nimport { IBufferSet } from 'common/buffer/Types';\nimport { InputHandler } from 'common/InputHandler';\nimport { WriteBuffer } from 'common/input/WriteBuffer';\nimport { OscLinkService } from 'common/services/OscLinkService';\nimport { Emitter, EventUtils, type IEvent } from 'common/Event';\nimport { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';\n\n// Only trigger this warning a single time per session\nlet hasWriteSyncWarnHappened = false;\n\nexport abstract class CoreTerminal extends Disposable implements ICoreTerminal {\n protected readonly _instantiationService: IInstantiationService;\n protected readonly _bufferService: IBufferService;\n protected readonly _logService: ILogService;\n protected readonly _charsetService: ICharsetService;\n protected readonly _oscLinkService: IOscLinkService;\n\n public readonly coreMouseService: ICoreMouseService;\n public readonly coreService: ICoreService;\n public readonly unicodeService: IUnicodeService;\n public readonly optionsService: IOptionsService;\n\n protected _inputHandler: InputHandler;\n private _writeBuffer: WriteBuffer;\n private _windowsWrappingHeuristics = this._register(new MutableDisposable());\n\n private readonly _onBinary = this._register(new Emitter());\n public readonly onBinary = this._onBinary.event;\n private readonly _onData = this._register(new Emitter());\n public readonly onData = this._onData.event;\n protected _onLineFeed = this._register(new Emitter());\n public readonly onLineFeed = this._onLineFeed.event;\n protected readonly _onRender = this._register(new Emitter<{ start: number, end: number }>());\n public readonly onRender = this._onRender.event;\n private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());\n public readonly onResize = this._onResize.event;\n protected readonly _onWriteParsed = this._register(new Emitter());\n public readonly onWriteParsed = this._onWriteParsed.event;\n\n /**\n * Internally we track the source of the scroll but this is meaningless outside the library so\n * it's filtered out.\n */\n protected _onScrollApi?: Emitter;\n protected _onScroll = this._register(new Emitter());\n public get onScroll(): IEvent {\n if (!this._onScrollApi) {\n this._onScrollApi = this._register(new Emitter());\n this._onScroll.event(ev => {\n this._onScrollApi?.fire(ev.position);\n });\n }\n return this._onScrollApi.event;\n }\n\n public get cols(): number { return this._bufferService.cols; }\n public get rows(): number { return this._bufferService.rows; }\n public get buffers(): IBufferSet { return this._bufferService.buffers; }\n public get options(): Required { return this.optionsService.options; }\n public set options(options: ITerminalOptions) {\n for (const key in options) {\n this.optionsService.options[key] = options[key];\n }\n }\n\n constructor(\n options: Partial\n ) {\n super();\n\n // Setup and initialize services\n this._instantiationService = new InstantiationService();\n this.optionsService = this._register(new OptionsService(options));\n this._instantiationService.setService(IOptionsService, this.optionsService);\n this._bufferService = this._register(this._instantiationService.createInstance(BufferService));\n this._instantiationService.setService(IBufferService, this._bufferService);\n this._logService = this._register(this._instantiationService.createInstance(LogService));\n this._instantiationService.setService(ILogService, this._logService);\n this.coreService = this._register(this._instantiationService.createInstance(CoreService));\n this._instantiationService.setService(ICoreService, this.coreService);\n this.coreMouseService = this._register(this._instantiationService.createInstance(CoreMouseService));\n this._instantiationService.setService(ICoreMouseService, this.coreMouseService);\n this.unicodeService = this._register(this._instantiationService.createInstance(UnicodeService));\n this._instantiationService.setService(IUnicodeService, this.unicodeService);\n this._charsetService = this._instantiationService.createInstance(CharsetService);\n this._instantiationService.setService(ICharsetService, this._charsetService);\n this._oscLinkService = this._instantiationService.createInstance(OscLinkService);\n this._instantiationService.setService(IOscLinkService, this._oscLinkService);\n\n\n // Register input handler and handle/forward events\n this._inputHandler = this._register(new InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService));\n this._register(EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed));\n\n // Setup listeners\n this._register(EventUtils.forward(this._bufferService.onResize, this._onResize));\n this._register(EventUtils.forward(this.coreService.onData, this._onData));\n this._register(EventUtils.forward(this.coreService.onBinary, this._onBinary));\n this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true)));\n this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput()));\n this._register(this.optionsService.onMultipleOptionChange(['windowsPty'], () => this._handleWindowsPtyOptionChange()));\n this._register(this._bufferService.onScroll(() => {\n this._onScroll.fire({ position: this._bufferService.buffer.ydisp });\n this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);\n }));\n // Setup WriteBuffer\n this._writeBuffer = this._register(new WriteBuffer((data, promiseResult) => this._inputHandler.parse(data, promiseResult)));\n this._register(EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));\n }\n\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._writeBuffer.write(data, callback);\n }\n\n /**\n * Write data to terminal synchonously.\n *\n * This method is unreliable with async parser handlers, thus should not\n * be used anymore. If you need blocking semantics on data input consider\n * `write` with a callback instead.\n *\n * @deprecated Unreliable, will be removed soon.\n */\n public writeSync(data: string | Uint8Array, maxSubsequentCalls?: number): void {\n if (this._logService.logLevel <= LogLevelEnum.WARN && !hasWriteSyncWarnHappened) {\n this._logService.warn('writeSync is unreliable and will be removed soon.');\n hasWriteSyncWarnHappened = true;\n }\n this._writeBuffer.writeSync(data, maxSubsequentCalls);\n }\n\n public input(data: string, wasUserInput: boolean = true): void {\n this.coreService.triggerDataEvent(data, wasUserInput);\n }\n\n public resize(x: number, y: number): void {\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n x = Math.max(x, MINIMUM_COLS);\n y = Math.max(y, MINIMUM_ROWS);\n\n // Flush pending writes before resize to avoid race conditions where async\n // writes are processed with incorrect dimensions\n this._writeBuffer.flushSync();\n\n this._bufferService.resize(x, y);\n }\n\n /**\n * Scroll the terminal down 1 row, creating a blank line.\n * @param eraseAttr The attribute data to use the for blank line.\n * @param isWrapped Whether the new line is wrapped from the previous line.\n */\n public scroll(eraseAttr: IAttributeData, isWrapped: boolean = false): void {\n this._bufferService.scroll(eraseAttr, isWrapped);\n }\n\n /**\n * Scroll the display of the terminal\n * @param disp The number of lines to scroll down (negative scroll up).\n * @param suppressScrollEvent Don't emit the scroll event as scrollLines. This is used to avoid\n * unwanted events being handled by the viewport when the event was triggered from the viewport\n * originally.\n */\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n this._bufferService.scrollLines(disp, suppressScrollEvent);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n /** Add handler for ESC escape sequence. See xterm.d.ts for details. */\n public registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise): IDisposable {\n return this._inputHandler.registerEscHandler(id, callback);\n }\n\n /** Add handler for DCS escape sequence. See xterm.d.ts for details. */\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerDcsHandler(id, callback);\n }\n\n /** Add handler for CSI escape sequence. See xterm.d.ts for details. */\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise): IDisposable {\n return this._inputHandler.registerCsiHandler(id, callback);\n }\n\n /** Add handler for OSC escape sequence. See xterm.d.ts for details. */\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerOscHandler(ident, callback);\n }\n\n /** Add handler for APC escape sequence. See xterm.d.ts for details. */\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._inputHandler.registerApcHandler(ident, callback);\n }\n\n protected _setup(): void {\n this._handleWindowsPtyOptionChange();\n }\n\n public reset(): void {\n this._inputHandler.reset();\n this._bufferService.reset();\n this._charsetService.reset();\n this.coreService.reset();\n this.coreMouseService.reset();\n }\n\n\n private _handleWindowsPtyOptionChange(): void {\n let value = false;\n const windowsPty = this.optionsService.rawOptions.windowsPty;\n if (windowsPty && windowsPty.buildNumber !== undefined && windowsPty.buildNumber !== undefined) {\n value = !!(windowsPty.backend === 'conpty' && windowsPty.buildNumber < 21376);\n }\n if (value) {\n this._enableWindowsWrappingHeuristics();\n } else {\n this._windowsWrappingHeuristics.clear();\n }\n }\n\n protected _enableWindowsWrappingHeuristics(): void {\n if (!this._windowsWrappingHeuristics.value) {\n const disposables: IDisposable[] = [];\n disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));\n disposables.push(this.registerCsiHandler({ final: 'H' }, () => {\n updateWindowsModeWrappedState(this._bufferService);\n return false;\n }));\n this._windowsWrappingHeuristics.value = toDisposable(() => {\n for (const d of disposables) {\n d.dispose();\n }\n });\n }\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IdleTaskQueue } from 'common/TaskQueue';\n\n// Work variables to avoid garbage collection.\nlet i = 0;\n\n/**\n * A generic list that is maintained in sorted order and allows values with duplicate keys. Deferred\n * batch insertion and deletion is used to significantly reduce the time it takes to insert and\n * delete a large amount of items in succession. This list is based on binary search and as such\n * locating a key will take O(log n) amortized, this includes the by key iterator.\n */\nexport class SortedList {\n private _array: T[] = [];\n\n private readonly _insertedValues: T[] = [];\n private readonly _flushInsertedTask = new IdleTaskQueue();\n private _isFlushingInserted = false;\n\n private readonly _deletedIndices: number[] = [];\n private readonly _flushDeletedTask = new IdleTaskQueue();\n private _isFlushingDeleted = false;\n\n constructor(\n private readonly _getKey: (value: T) => number\n ) {\n }\n\n public clear(): void {\n this._array.length = 0;\n this._insertedValues.length = 0;\n this._flushInsertedTask.clear();\n this._isFlushingInserted = false;\n this._deletedIndices.length = 0;\n this._flushDeletedTask.clear();\n this._isFlushingDeleted = false;\n }\n\n public insert(value: T): void {\n this._flushCleanupDeleted();\n if (this._insertedValues.length === 0) {\n this._flushInsertedTask.enqueue(() => this._flushInserted());\n }\n this._insertedValues.push(value);\n }\n\n private _flushInserted(): void {\n const sortedAddedValues = this._insertedValues.sort((a, b) => this._getKey(a) - this._getKey(b));\n let sortedAddedValuesIndex = 0;\n let arrayIndex = 0;\n\n const newArray = new Array(this._array.length + this._insertedValues.length);\n\n for (let newArrayIndex = 0; newArrayIndex < newArray.length; newArrayIndex++) {\n if (arrayIndex >= this._array.length || this._getKey(sortedAddedValues[sortedAddedValuesIndex]) <= this._getKey(this._array[arrayIndex])) {\n newArray[newArrayIndex] = sortedAddedValues[sortedAddedValuesIndex];\n sortedAddedValuesIndex++;\n } else {\n newArray[newArrayIndex] = this._array[arrayIndex++];\n }\n }\n\n this._array = newArray;\n this._insertedValues.length = 0;\n }\n\n private _flushCleanupInserted(): void {\n if (!this._isFlushingInserted && this._insertedValues.length > 0) {\n this._flushInsertedTask.flush();\n }\n }\n\n public delete(value: T): boolean {\n this._flushCleanupInserted();\n if (this._array.length === 0) {\n return false;\n }\n const key = this._getKey(value);\n if (key === undefined) {\n return false;\n }\n i = this._search(key);\n if (i === -1) {\n return false;\n }\n if (this._getKey(this._array[i]) !== key) {\n return false;\n }\n do {\n if (this._array[i] === value) {\n if (this._deletedIndices.length === 0) {\n this._flushDeletedTask.enqueue(() => this._flushDeleted());\n }\n this._deletedIndices.push(i);\n return true;\n }\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n return false;\n }\n\n private _flushDeleted(): void {\n this._isFlushingDeleted = true;\n const sortedDeletedIndices = this._deletedIndices.sort((a, b) => a - b);\n let sortedDeletedIndicesIndex = 0;\n const newArray = new Array(this._array.length - sortedDeletedIndices.length);\n let newArrayIndex = 0;\n for (let i = 0; i < this._array.length; i++) {\n if (sortedDeletedIndices[sortedDeletedIndicesIndex] === i) {\n sortedDeletedIndicesIndex++;\n } else {\n newArray[newArrayIndex++] = this._array[i];\n }\n }\n this._array = newArray;\n this._deletedIndices.length = 0;\n this._isFlushingDeleted = false;\n }\n\n private _flushCleanupDeleted(): void {\n if (!this._isFlushingDeleted && this._deletedIndices.length > 0) {\n this._flushDeletedTask.flush();\n }\n }\n\n public *getKeyIterator(key: number): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n yield this._array[i];\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public forEachByKey(key: number, callback: (value: T) => void): void {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n if (this._array.length === 0) {\n return;\n }\n i = this._search(key);\n if (i < 0 || i >= this._array.length) {\n return;\n }\n if (this._getKey(this._array[i]) !== key) {\n return;\n }\n do {\n callback(this._array[i]);\n } while (++i < this._array.length && this._getKey(this._array[i]) === key);\n }\n\n public values(): IterableIterator {\n this._flushCleanupInserted();\n this._flushCleanupDeleted();\n // Duplicate the array to avoid issues when _array changes while iterating\n return [...this._array].values();\n }\n\n private _search(key: number): number {\n let min = 0;\n let max = this._array.length - 1;\n while (max >= min) {\n let mid = (min + max) >> 1;\n const midKey = this._getKey(this._array[mid]);\n if (midKey > key) {\n max = mid - 1;\n } else if (midKey < key) {\n min = mid + 1;\n } else {\n // key in list, walk to lowest duplicate\n while (mid > 0 && this._getKey(this._array[mid - 1]) === key) {\n mid--;\n }\n return mid;\n }\n }\n // key not in list\n // still return closest min (also used as insert position)\n return min;\n }\n}\n", "/**\n * Copyright (c) 2022 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { css } from 'common/Color';\nimport { Disposable, DisposableStore, toDisposable } from 'common/Lifecycle';\nimport { IDecorationService, IInternalDecoration } from 'common/services/Services';\nimport { SortedList } from 'common/SortedList';\nimport { IColor } from 'common/Types';\nimport { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';\nimport { Emitter } from 'common/Event';\n\n// Work variables to avoid garbage collection\nlet $xmin = 0;\nlet $xmax = 0;\nlet $ymin = 0;\nlet $ymax = 0;\n\nexport class DecorationService extends Disposable implements IDecorationService {\n public serviceBrand: any;\n\n /**\n * A list of all decorations, sorted by the marker's line value. This relies on the fact that\n * while marker line values do change, they should all change by the same amount so this should\n * never become out of order.\n */\n private readonly _decorations: SortedList = new SortedList(e => e?.marker.line);\n\n private readonly _onDecorationRegistered = this._register(new Emitter());\n public readonly onDecorationRegistered = this._onDecorationRegistered.event;\n private readonly _onDecorationRemoved = this._register(new Emitter());\n public readonly onDecorationRemoved = this._onDecorationRemoved.event;\n\n public get decorations(): IterableIterator { return this._decorations.values(); }\n\n constructor() {\n super();\n\n this._register(toDisposable(() => this.reset()));\n }\n\n public registerDecoration(options: IDecorationOptions): IDecoration | undefined {\n if (options.marker.isDisposed) {\n return undefined;\n }\n const decoration = new Decoration(options);\n if (decoration) {\n const markerDispose = decoration.marker.onDispose(() => decoration.dispose());\n const listener = decoration.onDispose(() => {\n listener.dispose();\n if (decoration) {\n if (this._decorations.delete(decoration)) {\n this._onDecorationRemoved.fire(decoration);\n }\n markerDispose.dispose();\n }\n });\n this._decorations.insert(decoration);\n this._onDecorationRegistered.fire(decoration);\n }\n return decoration;\n }\n\n public reset(): void {\n for (const d of this._decorations.values()) {\n d.dispose();\n }\n this._decorations.clear();\n }\n\n public *getDecorationsAtCell(x: number, line: number, layer?: 'bottom' | 'top'): IterableIterator {\n let xmin = 0;\n let xmax = 0;\n let ymin = 0;\n let ymax = 0;\n for (const d of this._decorations.values()) {\n ymin = d.marker.line;\n ymax = ymin + (d.options.height ?? 1);\n if (line < ymin || line >= ymax) {\n continue;\n }\n xmin = d.options.x ?? 0;\n xmax = xmin + (d.options.width ?? 1);\n if (x >= xmin && x < xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n yield d;\n }\n }\n }\n\n public forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void {\n for (const d of this._decorations.values()) {\n $ymin = d.marker.line;\n $ymax = $ymin + (d.options.height ?? 1);\n if (line < $ymin || line >= $ymax) {\n continue;\n }\n $xmin = d.options.x ?? 0;\n $xmax = $xmin + (d.options.width ?? 1);\n if (x >= $xmin && x < $xmax && (!layer || (d.options.layer ?? 'bottom') === layer)) {\n callback(d);\n }\n }\n }\n}\n\nclass Decoration extends DisposableStore implements IInternalDecoration {\n public readonly marker: IMarker;\n public element: HTMLElement | undefined;\n\n public readonly onRenderEmitter = this.add(new Emitter());\n public readonly onRender = this.onRenderEmitter.event;\n private readonly _onDispose = this.add(new Emitter());\n public readonly onDispose = this._onDispose.event;\n\n private _cachedBg: IColor | undefined | null = null;\n public get backgroundColorRGB(): IColor | undefined {\n if (this._cachedBg === null) {\n if (this.options.backgroundColor) {\n this._cachedBg = css.toColor(this.options.backgroundColor);\n } else {\n this._cachedBg = undefined;\n }\n }\n return this._cachedBg;\n }\n\n private _cachedFg: IColor | undefined | null = null;\n public get foregroundColorRGB(): IColor | undefined {\n if (this._cachedFg === null) {\n if (this.options.foregroundColor) {\n this._cachedFg = css.toColor(this.options.foregroundColor);\n } else {\n this._cachedFg = undefined;\n }\n }\n return this._cachedFg;\n }\n\n constructor(\n public readonly options: IDecorationOptions\n ) {\n super();\n this.marker = options.marker;\n if (this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position) {\n this.options.overviewRulerOptions.position = 'full';\n }\n }\n\n public override dispose(): void {\n this._onDispose.fire();\n super.dispose();\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nconst RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second\n\nimport { IRenderDebouncer } from 'browser/Types';\n\n/**\n * Debounces calls to update screen readers to update at most once configurable interval of time.\n */\nexport class TimeBasedDebouncer implements IRenderDebouncer {\n private _rowStart: number | undefined;\n private _rowEnd: number | undefined;\n private _rowCount: number | undefined;\n\n // The last moment that the Terminal was refreshed at\n private _lastRefreshMs = 0;\n // Whether a trailing refresh should be triggered due to a refresh request that was throttled\n private _additionalRefreshRequested = false;\n\n private _refreshTimeoutID: number | undefined;\n\n constructor(\n private _renderCallback: (start: number, end: number) => void,\n private readonly _debounceThresholdMS = RENDER_DEBOUNCE_THRESHOLD_MS\n ) {\n }\n\n public dispose(): void {\n if (this._refreshTimeoutID) {\n clearTimeout(this._refreshTimeoutID);\n }\n }\n\n public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {\n this._rowCount = rowCount;\n // Get the min/max row start/end for the arg values\n rowStart = rowStart ?? 0;\n rowEnd = rowEnd ?? this._rowCount - 1;\n // Set the properties to the updated values\n this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;\n this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;\n\n // Only refresh if the time since last refresh is above a threshold, otherwise wait for\n // enough time to pass before refreshing again.\n const refreshRequestTime: number = performance.now();\n if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {\n // Enough time has lapsed since the last refresh; refresh immediately\n this._lastRefreshMs = refreshRequestTime;\n this._innerRefresh();\n } else if (!this._additionalRefreshRequested) {\n // This is the first additional request throttled; set up trailing refresh\n const elapsed = refreshRequestTime - this._lastRefreshMs;\n const waitPeriodBeforeTrailingRefresh = this._debounceThresholdMS - elapsed;\n this._additionalRefreshRequested = true;\n\n this._refreshTimeoutID = window.setTimeout(() => {\n this._lastRefreshMs = performance.now();\n this._innerRefresh();\n this._additionalRefreshRequested = false;\n this._refreshTimeoutID = undefined; // No longer need to clear the timeout\n }, waitPeriodBeforeTrailingRefresh);\n }\n }\n\n private _innerRefresh(): void {\n // Make sure values are set\n if (this._rowStart === undefined || this._rowEnd === undefined || this._rowCount === undefined) {\n return;\n }\n\n // Clamp values\n const start = Math.max(this._rowStart, 0);\n const end = Math.min(this._rowEnd, this._rowCount - 1);\n\n // Reset debouncer (this happens before render callback as the render could trigger it again)\n this._rowStart = undefined;\n this._rowEnd = undefined;\n\n // Run render callback\n this._renderCallback(start, end);\n }\n}\n\n", "/**\n * Copyright (c) 2017 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { ITerminal, IRenderDebouncer } from 'browser/Types';\nimport { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';\nimport { Disposable, toDisposable } from 'common/Lifecycle';\nimport { ICoreBrowserService, IRenderService } from 'browser/services/Services';\nimport { IBuffer } from 'common/buffer/Types';\nimport { IInstantiationService } from 'common/services/Services';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nconst MAX_ROWS_TO_READ = 20;\n\nconst enum BoundaryPosition {\n TOP,\n BOTTOM\n}\n\n// Turn this on to unhide the accessibility tree and display it under\n// (instead of overlapping with) the terminal.\nconst DEBUG = false;\n\nexport class AccessibilityManager extends Disposable {\n private _debugRootContainer: HTMLElement | undefined;\n private _accessibilityContainer: HTMLElement;\n\n private _rowContainer: HTMLElement;\n private _rowElements: HTMLElement[];\n private _rowColumns: WeakMap = new WeakMap();\n\n private _liveRegion: HTMLElement;\n private _liveRegionLineCount: number = 0;\n private _liveRegionDebouncer: IRenderDebouncer;\n\n private _topBoundaryFocusListener: (e: FocusEvent) => void;\n private _bottomBoundaryFocusListener: (e: FocusEvent) => void;\n\n /**\n * This queue has a character pushed to it for keys that are pressed, if the\n * next character added to the terminal is equal to the key char then it is\n * not announced (added to live region) because it has already been announced\n * by the textarea event (which cannot be canceled). There are some race\n * condition cases if there is typing while data is streaming, but this covers\n * the main case of typing into the prompt and inputting the answer to a\n * question (Y/N, etc.).\n */\n private _charsToConsume: string[] = [];\n\n private _charsToAnnounce: string = '';\n\n constructor(\n private readonly _terminal: ITerminal,\n @IInstantiationService instantiationService: IInstantiationService,\n @ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,\n @IRenderService private readonly _renderService: IRenderService\n ) {\n super();\n const doc = this._coreBrowserService.mainDocument;\n this._accessibilityContainer = doc.createElement('div');\n this._accessibilityContainer.classList.add('xterm-accessibility');\n\n this._rowContainer = doc.createElement('div');\n this._rowContainer.setAttribute('role', 'list');\n this._rowContainer.classList.add('xterm-accessibility-tree');\n this._rowElements = [];\n for (let i = 0; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n\n this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);\n this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._accessibilityContainer.appendChild(this._rowContainer);\n\n this._liveRegion = doc.createElement('div');\n this._liveRegion.classList.add('live-region');\n this._liveRegion.setAttribute('aria-live', 'assertive');\n this._accessibilityContainer.appendChild(this._liveRegion);\n this._liveRegionDebouncer = this._register(new TimeBasedDebouncer(this._renderRows.bind(this)));\n\n if (!this._terminal.element) {\n throw new Error('Cannot enable accessibility before Terminal.open');\n }\n\n if (DEBUG) {\n this._accessibilityContainer.classList.add('debug');\n this._rowContainer.classList.add('debug');\n\n // Use a `
` container so that the css will still apply.\n this._debugRootContainer = doc.createElement('div');\n this._debugRootContainer.classList.add('xterm');\n\n this._debugRootContainer.appendChild(doc.createTextNode('------start a11y------'));\n this._debugRootContainer.appendChild(this._accessibilityContainer);\n this._debugRootContainer.appendChild(doc.createTextNode('------end a11y------'));\n\n this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);\n } else {\n this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);\n }\n\n this._register(this._terminal.onResize(e => this._handleResize(e.rows)));\n this._register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));\n this._register(this._terminal.onScroll(() => this._refreshRows()));\n // Line feed is an issue as the prompt won't be read out after a command is run\n this._register(this._terminal.onA11yChar(char => this._handleChar(char)));\n this._register(this._terminal.onLineFeed(() => this._handleChar('\\n')));\n this._register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));\n this._register(this._terminal.onKey(e => this._handleKey(e.key)));\n this._register(this._terminal.onBlur(() => this._clearLiveRegion()));\n this._register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));\n this._register(addDisposableListener(doc, 'selectionchange', () => this._handleSelectionChange()));\n this._register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));\n\n this._refreshRowsDimensions();\n this._refreshRows();\n this._register(toDisposable(() => {\n if (DEBUG) {\n this._debugRootContainer!.remove();\n } else {\n this._accessibilityContainer.remove();\n }\n this._rowElements.length = 0;\n }));\n }\n\n private _handleTab(spaceCount: number): void {\n for (let i = 0; i < spaceCount; i++) {\n this._handleChar(' ');\n }\n }\n\n private _handleChar(char: string): void {\n if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {\n if (this._charsToConsume.length > 0) {\n // Have the screen reader ignore the char if it was just input\n const shiftedChar = this._charsToConsume.shift();\n if (shiftedChar !== char) {\n this._charsToAnnounce += char;\n }\n } else {\n this._charsToAnnounce += char;\n }\n\n if (char === '\\n') {\n this._liveRegionLineCount++;\n if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {\n this._liveRegion.textContent = Strings.tooMuchOutput.get();\n }\n }\n }\n }\n\n private _clearLiveRegion(): void {\n this._liveRegion.textContent = '';\n this._liveRegionLineCount = 0;\n }\n\n private _handleKey(keyChar: string): void {\n this._clearLiveRegion();\n // Only add the char if there is no control character.\n if (!/\\p{Control}/u.test(keyChar)) {\n this._charsToConsume.push(keyChar);\n }\n }\n\n private _refreshRows(start?: number, end?: number): void {\n this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);\n }\n\n private _renderRows(start: number, end: number): void {\n const buffer: IBuffer = this._terminal.buffer;\n const setSize = buffer.lines.length.toString();\n for (let i = start; i <= end; i++) {\n const line = buffer.lines.get(buffer.ydisp + i);\n const columns: number[] = [];\n const lineData = line?.translateToString(true, undefined, undefined, columns) || '';\n const posInSet = (buffer.ydisp + i + 1).toString();\n const element = this._rowElements[i];\n if (element) {\n if (lineData.length === 0) {\n element.textContent = '\\u00a0';\n this._rowColumns.set(element, [0, 1]);\n } else {\n element.textContent = lineData;\n this._rowColumns.set(element, columns);\n }\n element.setAttribute('aria-posinset', posInSet);\n element.setAttribute('aria-setsize', setSize);\n this._alignRowWidth(element);\n }\n }\n this._announceCharacters();\n }\n\n private _announceCharacters(): void {\n if (this._charsToAnnounce.length === 0) {\n return;\n }\n if (this._liveRegion.textContent === Strings.tooMuchOutput.get()) {\n this._clearLiveRegion();\n }\n this._liveRegion.textContent += this._charsToAnnounce;\n this._charsToAnnounce = '';\n }\n\n private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {\n const boundaryElement = e.target as HTMLElement;\n const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];\n\n // Don't scroll if the buffer top has reached the end in that direction\n const posInSet = boundaryElement.getAttribute('aria-posinset');\n const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;\n if (posInSet === lastRowPos) {\n return;\n }\n\n // Don't scroll when the last focused item was not the second row (focus is going the other\n // direction)\n if (e.relatedTarget !== beforeBoundaryElement) {\n return;\n }\n\n // Remove old boundary element from array\n let topBoundaryElement: HTMLElement;\n let bottomBoundaryElement: HTMLElement;\n if (position === BoundaryPosition.TOP) {\n topBoundaryElement = boundaryElement;\n bottomBoundaryElement = this._rowElements.pop()!;\n this._rowContainer.removeChild(bottomBoundaryElement);\n } else {\n topBoundaryElement = this._rowElements.shift()!;\n bottomBoundaryElement = boundaryElement;\n this._rowContainer.removeChild(topBoundaryElement);\n }\n\n // Remove listeners from old boundary elements\n topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);\n bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Add new element to array/DOM\n if (position === BoundaryPosition.TOP) {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.unshift(newElement);\n this._rowContainer.insertAdjacentElement('afterbegin', newElement);\n } else {\n const newElement = this._createAccessibilityTreeNode();\n this._rowElements.push(newElement);\n this._rowContainer.appendChild(newElement);\n }\n\n // Add listeners to new boundary elements\n this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Scroll up\n this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);\n\n // Focus new boundary before element\n this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();\n\n // Prevent the standard behavior\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n private _handleSelectionChange(): void {\n if (this._rowElements.length === 0) {\n return;\n }\n\n const selection = this._coreBrowserService.mainDocument.getSelection();\n if (!selection) {\n return;\n }\n\n if (selection.isCollapsed) {\n // Only do something when the anchorNode is inside the row container. This\n // behavior mirrors what we do with mouse --- if the mouse clicks\n // somewhere outside of the terminal, we don't clear the selection.\n if (this._rowContainer.contains(selection.anchorNode)) {\n this._terminal.clearSelection();\n }\n return;\n }\n\n if (!selection.anchorNode || !selection.focusNode) {\n console.error('anchorNode and/or focusNode are null');\n return;\n }\n\n // Sort the two selection points in document order.\n let begin = { node: selection.anchorNode, offset: selection.anchorOffset };\n let end = { node: selection.focusNode, offset: selection.focusOffset };\n if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {\n [begin, end] = [end, begin];\n }\n\n // Clamp begin/end to the inside of the row container.\n if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {\n begin = { node: this._rowElements[0].childNodes[0], offset: 0 };\n }\n if (!this._rowContainer.contains(begin.node)) {\n // This happens when `begin` is below the last row.\n return;\n }\n const lastRowElement = this._rowElements.slice(-1)[0];\n if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {\n end = {\n node: lastRowElement,\n offset: lastRowElement.textContent?.length ?? 0\n };\n }\n if (!this._rowContainer.contains(end.node)) {\n // This happens when `end` is above the first row.\n return;\n }\n\n const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {\n // `node` is either the row element or the Text node inside it.\n const rowElement: any = node instanceof Text ? node.parentNode : node;\n let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;\n if (isNaN(row)) {\n console.warn('row is invalid. Race condition?');\n return null;\n }\n\n const columns = this._rowColumns.get(rowElement);\n if (!columns) {\n console.warn('columns is null. Race condition?');\n return null;\n }\n\n let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;\n if (column >= this._terminal.cols) {\n ++row;\n column = 0;\n }\n return {\n row,\n column\n };\n };\n\n const beginRowColumn = toRowColumn(begin);\n const endRowColumn = toRowColumn(end);\n\n if (!beginRowColumn || !endRowColumn) {\n return;\n }\n\n if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {\n // This should not happen unless we have some bugs.\n throw new Error('invalid range');\n }\n\n this._terminal.select(\n beginRowColumn.column,\n beginRowColumn.row,\n (endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column\n );\n }\n\n private _handleResize(rows: number): void {\n // Remove bottom boundary listener\n this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);\n\n // Grow rows as required\n for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {\n this._rowElements[i] = this._createAccessibilityTreeNode();\n this._rowContainer.appendChild(this._rowElements[i]);\n }\n // Shrink rows as required\n while (this._rowElements.length > rows) {\n this._rowContainer.removeChild(this._rowElements.pop()!);\n }\n\n // Add bottom boundary listener\n this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);\n\n this._refreshRowsDimensions();\n }\n\n private _createAccessibilityTreeNode(): HTMLElement {\n const element = this._coreBrowserService.mainDocument.createElement('div');\n element.setAttribute('role', 'listitem');\n element.tabIndex = -1;\n this._refreshRowDimensions(element);\n return element;\n }\n\n private _refreshRowsDimensions(): void {\n if (!this._renderService.dimensions.css.cell.height) {\n return;\n }\n Object.assign(this._accessibilityContainer.style, {\n width: `${this._renderService.dimensions.css.canvas.width}px`,\n fontSize: `${this._terminal.options.fontSize}px`\n });\n if (this._rowElements.length !== this._terminal.rows) {\n this._handleResize(this._terminal.rows);\n }\n for (let i = 0; i < this._terminal.rows; i++) {\n this._refreshRowDimensions(this._rowElements[i]);\n this._alignRowWidth(this._rowElements[i]);\n }\n }\n\n private _refreshRowDimensions(element: HTMLElement): void {\n element.style.height = `${this._renderService.dimensions.css.cell.height}px`;\n }\n\n /**\n * Scale the width of a row so that each of the character is (mostly) aligned\n * with the actual rendering. This will allow the screen reader to draw\n * selection outline at the correct position.\n *\n * On top of using the \"monospace\" font and correct font size, the scaling\n * here is necessary to handle characters that are not covered by the font\n * (e.g. CJK).\n */\n private _alignRowWidth(element: HTMLElement): void {\n element.style.transform = '';\n const width = element.getBoundingClientRect().width;\n const lastColumn = this._rowColumns.get(element)?.slice(-1)?.[0];\n if (!lastColumn) {\n return;\n }\n const targetWidth = lastColumn * this._renderService.dimensions.css.cell.width;\n element.style.transform = `scaleX(${targetWidth / width})`;\n }\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';\nimport { Disposable, dispose, toDisposable } from 'common/Lifecycle';\nimport { IDisposable } from 'common/Types';\nimport { IBufferService } from 'common/services/Services';\nimport { ILinkProviderService, IMouseService, IRenderService } from './services/Services';\nimport { Emitter } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\n\nexport class Linkifier extends Disposable implements ILinkifier2 {\n public get currentLink(): ILinkWithState | undefined { return this._currentLink; }\n protected _currentLink: ILinkWithState | undefined;\n private _mouseDownLink: ILinkWithState | undefined;\n private _lastMouseEvent: MouseEvent | undefined;\n private _linkCacheDisposables: IDisposable[] = [];\n private _lastBufferCell: IBufferCellPosition | undefined;\n private _isMouseOut: boolean = true;\n private _wasResized: boolean = false;\n private _activeProviderReplies: Map | undefined;\n private _activeLine: number = -1;\n\n private readonly _onShowLinkUnderline = this._register(new Emitter());\n public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;\n private readonly _onHideLinkUnderline = this._register(new Emitter());\n public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;\n\n constructor(\n private readonly _element: HTMLElement,\n @IMouseService private readonly _mouseService: IMouseService,\n @IRenderService private readonly _renderService: IRenderService,\n @IBufferService private readonly _bufferService: IBufferService,\n @ILinkProviderService private readonly _linkProviderService: ILinkProviderService\n ) {\n super();\n this._register(toDisposable(() => {\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n this._lastMouseEvent = undefined;\n // Clear out link providers as they could easily cause an embedder memory leak\n this._activeProviderReplies?.clear();\n }));\n // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.\n this._register(this._bufferService.onResize(() => {\n this._clearCurrentLink();\n this._wasResized = true;\n }));\n this._register(addDisposableListener(this._element, 'mouseleave', () => {\n this._isMouseOut = true;\n this._clearCurrentLink();\n }));\n this._register(addDisposableListener(this._element, 'mousemove', this._handleMouseMove.bind(this)));\n this._register(addDisposableListener(this._element, 'mousedown', this._handleMouseDown.bind(this)));\n this._register(addDisposableListener(this._element, 'mouseup', this._handleMouseUp.bind(this)));\n }\n\n private _handleMouseMove(event: MouseEvent): void {\n this._lastMouseEvent = event;\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n this._isMouseOut = false;\n\n // Ignore the event if it's an embedder created hover widget\n const composedPath = event.composedPath() as HTMLElement[];\n for (let i = 0; i < composedPath.length; i++) {\n const target = composedPath[i];\n // Hit Terminal.element, break and continue\n if (target.classList.contains('xterm')) {\n break;\n }\n // It's a hover, don't respect hover event\n if (target.classList.contains('xterm-hover')) {\n return;\n }\n }\n\n if (!this._lastBufferCell || (position.x !== this._lastBufferCell.x || position.y !== this._lastBufferCell.y)) {\n this._handleHover(position);\n this._lastBufferCell = position;\n }\n }\n\n private _handleHover(position: IBufferCellPosition): void {\n // TODO: This currently does not cache link provider results across wrapped lines, activeLine\n // should be something like `activeRange: {startY, endY}`\n // Check if we need to clear the link\n if (this._activeLine !== position.y || this._wasResized) {\n this._clearCurrentLink();\n this._askForLink(position, false);\n this._wasResized = false;\n return;\n }\n\n // Check the if the link is in the mouse position\n const isCurrentLinkInPosition = this._currentLink && this._linkAtPosition(this._currentLink.link, position);\n if (!isCurrentLinkInPosition) {\n this._clearCurrentLink();\n this._askForLink(position, true);\n }\n }\n\n private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {\n if (!this._activeProviderReplies || !useLineCache) {\n this._activeProviderReplies?.forEach(reply => {\n reply?.forEach(linkWithState => {\n if (linkWithState.link.dispose) {\n linkWithState.link.dispose();\n }\n });\n });\n this._activeProviderReplies = new Map();\n this._activeLine = position.y;\n }\n let linkProvided = false;\n\n // There is no link cached, so ask for one\n for (const [i, linkProvider] of this._linkProviderService.linkProviders.entries()) {\n if (useLineCache) {\n const existingReply = this._activeProviderReplies?.get(i);\n // If there isn't a reply, the provider hasn't responded yet.\n\n // TODO: If there isn't a reply yet it means that the provider is still resolving. Ensuring\n // provideLinks isn't triggered again saves ILink.hover firing twice though. This probably\n // needs promises to get fixed\n if (existingReply) {\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n }\n } else {\n linkProvider.provideLinks(position.y, (links: ILink[] | undefined) => {\n if (this._isMouseOut) {\n return;\n }\n const linksWithState: ILinkWithState[] | undefined = links?.map(link => ({ link }));\n this._activeProviderReplies?.set(i, linksWithState);\n linkProvided = this._checkLinkProviderResult(i, position, linkProvided);\n\n // If all providers have responded, remove lower priority links that intersect ranges of\n // higher priority links\n if (this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length) {\n this._removeIntersectingLinks(position.y, this._activeProviderReplies);\n }\n });\n }\n }\n }\n\n private _removeIntersectingLinks(y: number, replies: Map): void {\n const occupiedCells = new Set();\n for (let i = 0; i < replies.size; i++) {\n const providerReply = replies.get(i);\n if (!providerReply) {\n continue;\n }\n for (let i = 0; i < providerReply.length; i++) {\n const linkWithState = providerReply[i];\n const startX = linkWithState.link.range.start.y < y ? 0 : linkWithState.link.range.start.x;\n const endX = linkWithState.link.range.end.y > y ? this._bufferService.cols : linkWithState.link.range.end.x;\n for (let x = startX; x <= endX; x++) {\n if (occupiedCells.has(x)) {\n providerReply.splice(i--, 1);\n break;\n }\n occupiedCells.add(x);\n }\n }\n }\n }\n\n private _checkLinkProviderResult(index: number, position: IBufferCellPosition, linkProvided: boolean): boolean {\n if (!this._activeProviderReplies) {\n return linkProvided;\n }\n\n const links = this._activeProviderReplies.get(index);\n\n // Check if every provider before this one has come back undefined\n let hasLinkBefore = false;\n for (let j = 0; j < index; j++) {\n if (!this._activeProviderReplies.has(j) || this._activeProviderReplies.get(j)) {\n hasLinkBefore = true;\n }\n }\n\n // If all providers with higher priority came back undefined, then this provider's link for\n // the position should be used\n if (!hasLinkBefore && links) {\n const linkAtPosition = links.find(link => this._linkAtPosition(link.link, position));\n if (linkAtPosition) {\n linkProvided = true;\n this._handleNewLink(linkAtPosition);\n }\n }\n\n // Check if all the providers have responded\n if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !linkProvided) {\n // Respect the order of the link providers\n for (let j = 0; j < this._activeProviderReplies.size; j++) {\n const currentLink = this._activeProviderReplies.get(j)?.find(link => this._linkAtPosition(link.link, position));\n if (currentLink) {\n linkProvided = true;\n this._handleNewLink(currentLink);\n break;\n }\n }\n }\n\n return linkProvided;\n }\n\n private _handleMouseDown(): void {\n this._mouseDownLink = this._currentLink;\n }\n\n private _handleMouseUp(event: MouseEvent): void {\n if (!this._currentLink) {\n return;\n }\n\n const position = this._positionFromMouseEvent(event, this._element, this._mouseService);\n if (!position) {\n return;\n }\n\n if (this._mouseDownLink && linkEquals(this._mouseDownLink.link, this._currentLink.link) && this._linkAtPosition(this._currentLink.link, position)) {\n this._currentLink.link.activate(event, this._currentLink.link.text);\n }\n }\n\n private _clearCurrentLink(startRow?: number, endRow?: number): void {\n if (!this._currentLink || !this._lastMouseEvent) {\n return;\n }\n\n // If we have a start and end row, check that the link is within it\n if (!startRow || !endRow || (this._currentLink.link.range.start.y >= startRow && this._currentLink.link.range.end.y <= endRow)) {\n this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent);\n this._currentLink = undefined;\n dispose(this._linkCacheDisposables);\n this._linkCacheDisposables.length = 0;\n }\n }\n\n private _handleNewLink(linkWithState: ILinkWithState): void {\n if (!this._lastMouseEvent) {\n return;\n }\n\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);\n\n if (!position) {\n return;\n }\n\n // Trigger hover if the we have a link at the position\n if (this._linkAtPosition(linkWithState.link, position)) {\n this._currentLink = linkWithState;\n this._currentLink.state = {\n decorations: {\n underline: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.underline,\n pointerCursor: linkWithState.link.decorations === undefined ? true : linkWithState.link.decorations.pointerCursor\n },\n isHovered: true\n };\n this._linkHover(this._element, linkWithState.link, this._lastMouseEvent);\n\n // Add listener for tracking decorations changes\n linkWithState.link.decorations = {} as ILinkDecorations;\n Object.defineProperties(linkWithState.link.decorations, {\n pointerCursor: {\n get: () => this._currentLink?.state?.decorations.pointerCursor,\n set: v => {\n if (this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== v) {\n this._currentLink.state.decorations.pointerCursor = v;\n if (this._currentLink.state.isHovered) {\n this._element.classList.toggle('xterm-cursor-pointer', v);\n }\n }\n }\n },\n underline: {\n get: () => this._currentLink?.state?.decorations.underline,\n set: v => {\n if (this._currentLink?.state && this._currentLink?.state?.decorations.underline !== v) {\n this._currentLink.state.decorations.underline = v;\n if (this._currentLink.state.isHovered) {\n this._fireUnderlineEvent(linkWithState.link, v);\n }\n }\n }\n }\n });\n\n // Listen to viewport changes to re-render the link under the cursor (only when the line the\n // link is on changes)\n this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {\n // Sanity check, this shouldn't happen in practice as this listener would be disposed\n if (!this._currentLink) {\n return;\n }\n // When start is 0 a scroll most likely occurred, make sure links above the fold also get\n // cleared.\n const start = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;\n const end = this._bufferService.buffer.ydisp + 1 + e.end;\n // Only clear the link if the viewport change happened on this line\n if (this._currentLink.link.range.start.y >= start && this._currentLink.link.range.end.y <= end) {\n this._clearCurrentLink(start, end);\n if (this._lastMouseEvent) {\n // re-eval previously active link after changes\n const position = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService!);\n if (position) {\n this._askForLink(position, false);\n }\n }\n }\n }));\n }\n }\n\n protected _linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = true;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, true);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.add('xterm-cursor-pointer');\n }\n }\n\n if (link.hover) {\n link.hover(event, link.text);\n }\n }\n\n private _fireUnderlineEvent(link: ILink, showEvent: boolean): void {\n const range = link.range;\n const scrollOffset = this._bufferService.buffer.ydisp;\n const event = this._createLinkUnderlineEvent(range.start.x - 1, range.start.y - scrollOffset - 1, range.end.x, range.end.y - scrollOffset - 1, undefined);\n const emitter = showEvent ? this._onShowLinkUnderline : this._onHideLinkUnderline;\n emitter.fire(event);\n }\n\n protected _linkLeave(element: HTMLElement, link: ILink, event: MouseEvent): void {\n if (this._currentLink?.state) {\n this._currentLink.state.isHovered = false;\n if (this._currentLink.state.decorations.underline) {\n this._fireUnderlineEvent(link, false);\n }\n if (this._currentLink.state.decorations.pointerCursor) {\n element.classList.remove('xterm-cursor-pointer');\n }\n }\n\n if (link.leave) {\n link.leave(event, link.text);\n }\n }\n\n /**\n * Check if the buffer position is within the link\n * @param link\n * @param position\n */\n private _linkAtPosition(link: ILink, position: IBufferCellPosition): boolean {\n const lower = link.range.start.y * this._bufferService.cols + link.range.start.x;\n const upper = link.range.end.y * this._bufferService.cols + link.range.end.x;\n const current = position.y * this._bufferService.cols + position.x;\n return (lower <= current && current <= upper);\n }\n\n /**\n * Get the buffer position from a mouse event\n * @param event\n */\n private _positionFromMouseEvent(event: MouseEvent, element: HTMLElement, mouseService: IMouseService): IBufferCellPosition | undefined {\n const coords = mouseService.getCoords(event, element, this._bufferService.cols, this._bufferService.rows);\n if (!coords) {\n return;\n }\n\n return { x: coords[0], y: coords[1] + this._bufferService.buffer.ydisp };\n }\n\n private _createLinkUnderlineEvent(x1: number, y1: number, x2: number, y2: number, fg: number | undefined): ILinkifierEvent {\n return { x1, y1, x2, y2, cols: this._bufferService.cols, fg };\n }\n}\n\nfunction linkEquals(a: ILink, b: ILink): boolean {\n return (\n a.text === b.text &&\n a.range.start.x === b.range.start.x &&\n a.range.start.y === b.range.start.y &&\n a.range.end.x === b.range.end.x &&\n a.range.end.y === b.range.end.y\n );\n}\n", "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * @license MIT\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n *\n * Terminal Emulation References:\n * http://vt100.net/\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt\n * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n * http://invisible-island.net/vttest/\n * http://www.inwap.com/pdp10/ansicode.txt\n * http://linux.die.net/man/4/console_codes\n * http://linux.die.net/man/7/urxvt\n */\n\nimport { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';\nimport { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';\nimport * as Strings from 'browser/LocalizableStrings';\nimport { OscLinkProvider } from 'browser/OscLinkProvider';\nimport { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'browser/Types';\nimport { Viewport } from 'browser/Viewport';\nimport { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';\nimport { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';\nimport { CompositionHelper } from 'browser/input/CompositionHelper';\nimport { DomRenderer } from 'browser/renderer/dom/DomRenderer';\nimport { IRenderer } from 'browser/renderer/shared/Types';\nimport { CharSizeService } from 'browser/services/CharSizeService';\nimport { CharacterJoinerService } from 'browser/services/CharacterJoinerService';\nimport { CoreBrowserService } from 'browser/services/CoreBrowserService';\nimport { LinkProviderService } from 'browser/services/LinkProviderService';\nimport { MouseService } from 'browser/services/MouseService';\nimport { RenderService } from 'browser/services/RenderService';\nimport { SelectionService } from 'browser/services/SelectionService';\nimport { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';\nimport { ThemeService } from 'browser/services/ThemeService';\nimport { KeyboardService } from 'browser/services/KeyboardService';\nimport { channels, color, rgb } from 'common/Color';\nimport { CoreTerminal } from 'common/CoreTerminal';\nimport * as Browser from 'common/Platform';\nimport { ColorRequestType, CoreMouseAction, CoreMouseButton, CoreMouseEventType, IColorEvent, ITerminalOptions, KeyboardResultType, SpecialColorIndex } from 'common/Types';\nimport { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';\nimport { IBuffer } from 'common/buffer/Types';\nimport { C0, C1ESCAPED } from 'common/data/EscapeSequences';\nimport { toRgbString } from 'common/input/XParseColor';\nimport { DecorationService } from 'common/services/DecorationService';\nimport { IDecorationService } from 'common/services/Services';\nimport { WindowsOptionsReportType } from '../common/InputHandler';\nimport { AccessibilityManager } from './AccessibilityManager';\nimport { Linkifier } from './Linkifier';\nimport { Emitter, EventUtils, type IEvent } from 'common/Event';\nimport { addDisposableListener } from 'vs/base/browser/dom';\nimport { MutableDisposable, toDisposable } from 'common/Lifecycle';\n\nexport class CoreBrowserTerminal extends CoreTerminal implements ITerminal {\n public textarea: HTMLTextAreaElement | undefined;\n public element: HTMLElement | undefined;\n public screenElement: HTMLElement | undefined;\n\n private _document: Document | undefined;\n private _viewportElement: HTMLElement | undefined;\n private _helperContainer: HTMLElement | undefined;\n private _compositionView: HTMLElement | undefined;\n\n private readonly _linkifier: MutableDisposable = this._register(new MutableDisposable());\n public get linkifier(): ILinkifier2 | undefined { return this._linkifier.value; }\n private _overviewRulerRenderer: OverviewRulerRenderer | undefined;\n private _viewport: Viewport | undefined;\n\n public browser: IBrowser = Browser as any;\n\n private _customKeyEventHandler: CustomKeyEventHandler | undefined;\n private _customWheelEventHandler: CustomWheelEventHandler | undefined;\n\n // Browser services\n private readonly _decorationService: DecorationService;\n private readonly _keyboardService: IKeyboardService;\n private readonly _linkProviderService: ILinkProviderService;\n\n // Optional browser services\n private _charSizeService: ICharSizeService | undefined;\n private _coreBrowserService: ICoreBrowserService | undefined;\n private _mouseService: IMouseService | undefined;\n private _renderService: IRenderService | undefined;\n private _themeService: IThemeService | undefined;\n private _characterJoinerService: ICharacterJoinerService | undefined;\n private _selectionService: ISelectionService | undefined;\n\n /**\n * Records whether the keydown event has already been handled and triggered a data event, if so\n * the keypress event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyDownHandled: boolean = false;\n\n /**\n * Records whether a keydown event has occured since the last keyup event, i.e. whether a key\n * is currently \"pressed\".\n */\n private _keyDownSeen: boolean = false;\n\n /**\n * Records whether the keypress event has already been handled and triggered a data event, if so\n * the input event should not trigger a data event but should still print to the textarea so\n * screen readers will announce it.\n */\n private _keyPressHandled: boolean = false;\n\n /**\n * Records whether there has been a keydown event for a dead key without a corresponding keydown\n * event for the composed/alternative character. If we cancel the keydown event for the dead key,\n * no events will be emitted for the final character.\n */\n private _unprocessedDeadKey: boolean = false;\n\n private _compositionHelper: ICompositionHelper | undefined;\n private _accessibilityManager: MutableDisposable = this._register(new MutableDisposable());\n\n private readonly _onCursorMove = this._register(new Emitter());\n public readonly onCursorMove = this._onCursorMove.event;\n private readonly _onKey = this._register(new Emitter<{ key: string, domEvent: KeyboardEvent }>());\n public readonly onKey = this._onKey.event;\n private readonly _onSelectionChange = this._register(new Emitter());\n public readonly onSelectionChange = this._onSelectionChange.event;\n private readonly _onTitleChange = this._register(new Emitter());\n public readonly onTitleChange = this._onTitleChange.event;\n private readonly _onBell = this._register(new Emitter());\n public readonly onBell = this._onBell.event;\n\n private _onFocus = this._register(new Emitter());\n public get onFocus(): IEvent { return this._onFocus.event; }\n private _onBlur = this._register(new Emitter());\n public get onBlur(): IEvent { return this._onBlur.event; }\n private _onA11yCharEmitter = this._register(new Emitter());\n public get onA11yChar(): IEvent { return this._onA11yCharEmitter.event; }\n private _onA11yTabEmitter = this._register(new Emitter());\n public get onA11yTab(): IEvent { return this._onA11yTabEmitter.event; }\n private _onWillOpen = this._register(new Emitter());\n public get onWillOpen(): IEvent { return this._onWillOpen.event; }\n private readonly _onDimensionsChange = this._register(new Emitter());\n public readonly onDimensionsChange = this._onDimensionsChange.event;\n\n public get dimensions(): IRenderDimensionsApi | undefined {\n if (!this._renderService) {\n return undefined;\n }\n const dimensions = this._renderService.dimensions;\n return {\n css: {\n canvas: { ...dimensions.css.canvas },\n cell: { ...dimensions.css.cell }\n },\n device: {\n canvas: { ...dimensions.device.canvas },\n cell: { ...dimensions.device.cell },\n char: { ...dimensions.device.char }\n }\n };\n }\n\n constructor(\n options: Partial = {}\n ) {\n super(options);\n\n this._setup();\n\n this._decorationService = this._instantiationService.createInstance(DecorationService);\n this._instantiationService.setService(IDecorationService, this._decorationService);\n this._keyboardService = this._instantiationService.createInstance(KeyboardService);\n this._instantiationService.setService(IKeyboardService, this._keyboardService);\n this._linkProviderService = this._instantiationService.createInstance(LinkProviderService);\n this._instantiationService.setService(ILinkProviderService, this._linkProviderService);\n this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OscLinkProvider));\n\n // Setup InputHandler listeners\n this._register(this._inputHandler.onRequestBell(() => this._onBell.fire()));\n this._register(this._inputHandler.onRequestRefreshRows((e) => this.refresh(e?.start ?? 0, e?.end ?? (this.rows - 1))));\n this._register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));\n this._register(this._inputHandler.onRequestReset(() => this.reset()));\n this._register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));\n this._register(this._inputHandler.onColor((event) => this._handleColorEvent(event)));\n this._register(EventUtils.forward(this._inputHandler.onCursorMove, this._onCursorMove));\n this._register(EventUtils.forward(this._inputHandler.onTitleChange, this._onTitleChange));\n this._register(EventUtils.forward(this._inputHandler.onA11yChar, this._onA11yCharEmitter));\n this._register(EventUtils.forward(this._inputHandler.onA11yTab, this._onA11yTabEmitter));\n\n // Setup listeners\n this._register(this._bufferService.onResize(e => this._afterResize(e.cols, e.rows)));\n\n this._register(toDisposable(() => {\n this._customKeyEventHandler = undefined;\n this.element?.parentNode?.removeChild(this.element);\n }));\n }\n\n /**\n * Handle color event from inputhandler for OSC 4|104 | 10|110 | 11|111 | 12|112.\n * An event from OSC 4|104 may contain multiple set or report requests, and multiple\n * or none restore requests (resetting all),\n * while an event from OSC 10|110 | 11|111 | 12|112 always contains a single request.\n */\n private _handleColorEvent(event: IColorEvent): void {\n if (!this._themeService) return;\n for (const req of event) {\n let acc: 'foreground' | 'background' | 'cursor' | 'ansi';\n let ident = '';\n switch (req.index) {\n case SpecialColorIndex.FOREGROUND: // OSC 10 | 110\n acc = 'foreground';\n ident = '10';\n break;\n case SpecialColorIndex.BACKGROUND: // OSC 11 | 111\n acc = 'background';\n ident = '11';\n break;\n case SpecialColorIndex.CURSOR: // OSC 12 | 112\n acc = 'cursor';\n ident = '12';\n break;\n default: // OSC 4 | 104\n // we can skip the [0..255] range check here (already done in inputhandler)\n acc = 'ansi';\n ident = '4;' + req.index;\n }\n switch (req.type) {\n case ColorRequestType.REPORT:\n const colorRgb = color.toColorRGB(acc === 'ansi'\n ? this._themeService.colors.ansi[req.index]\n : this._themeService.colors[acc]);\n this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(colorRgb)}${C1ESCAPED.ST}`);\n break;\n case ColorRequestType.SET:\n if (acc === 'ansi') {\n this._themeService.modifyColors(colors => colors.ansi[req.index] = channels.toColor(...req.color));\n } else {\n const narrowedAcc = acc;\n this._themeService.modifyColors(colors => colors[narrowedAcc] = channels.toColor(...req.color));\n }\n break;\n case ColorRequestType.RESTORE:\n this._themeService.restoreColor(req.index);\n break;\n }\n }\n }\n\n /**\n * Reports the current color scheme (dark or light) based on the relative luminance\n * of the background and foreground theme colors.\n * Sends CSI ? 997 ; 1 n for dark mode or CSI ? 997 ; 2 n for light mode.\n */\n private _reportColorScheme(): void {\n if (!this._themeService) return;\n const bgLuminance = rgb.relativeLuminance(this._themeService.colors.background.rgba >> 8);\n const fgLuminance = rgb.relativeLuminance(this._themeService.colors.foreground.rgba >> 8);\n // Dark mode = background is darker than foreground (lower luminance)\n const colorSchemeMode = bgLuminance < fgLuminance ? 1 : 2;\n this.coreService.triggerDataEvent(`${C0.ESC}[?997;${colorSchemeMode}n`);\n }\n\n protected _setup(): void {\n super._setup();\n\n this._customKeyEventHandler = undefined;\n }\n\n /**\n * Convenience property to active buffer.\n */\n public get buffer(): IBuffer {\n return this.buffers.active;\n }\n\n /**\n * Focus the terminal. Delegates focus handling to the terminal's DOM element.\n */\n public focus(): void {\n if (this.textarea) {\n this.textarea.focus({ preventScroll: true });\n }\n }\n\n private _handleScreenReaderModeOptionChange(value: boolean): void {\n if (value) {\n if (!this._accessibilityManager.value && this._renderService) {\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n } else {\n this._accessibilityManager.clear();\n }\n }\n\n /**\n * Binds the desired focus behavior on a given terminal object.\n */\n private _handleTextAreaFocus(ev: FocusEvent): void {\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n }\n this.element!.classList.add('focus');\n this._showCursor();\n this._onFocus.fire();\n }\n\n /**\n * Blur the terminal, calling the blur function on the terminal's underlying\n * textarea.\n */\n public blur(): void {\n return this.textarea?.blur();\n }\n\n /**\n * Binds the desired blur behavior on a given terminal object.\n */\n private _handleTextAreaBlur(): void {\n // Text can safely be removed on blur. Doing it earlier could interfere with\n // screen readers reading it out.\n this.textarea!.value = '';\n this.refresh(this.buffer.y, this.buffer.y);\n if (this.coreService.decPrivateModes.sendFocus) {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n this.element!.classList.remove('focus');\n this._onBlur.fire();\n }\n\n private _syncTextArea(): void {\n if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper!.isComposing || !this._renderService) {\n return;\n }\n const cursorY = this.buffer.ybase + this.buffer.y;\n const bufferLine = this.buffer.lines.get(cursorY);\n if (!bufferLine) {\n return;\n }\n const cursorX = Math.min(this.buffer.x, this.cols - 1);\n const cellHeight = this._renderService.dimensions.css.cell.height;\n const width = bufferLine.getWidth(cursorX);\n const cellWidth = this._renderService.dimensions.css.cell.width * width;\n const cursorTop = this.buffer.y * this._renderService.dimensions.css.cell.height;\n const cursorLeft = cursorX * this._renderService.dimensions.css.cell.width;\n\n // Sync the textarea to the exact position of the composition view so the IME knows where the\n // text is.\n this.textarea.style.left = cursorLeft + 'px';\n this.textarea.style.top = cursorTop + 'px';\n this.textarea.style.width = cellWidth + 'px';\n this.textarea.style.height = cellHeight + 'px';\n this.textarea.style.lineHeight = cellHeight + 'px';\n this.textarea.style.zIndex = '-5';\n }\n\n /**\n * Initialize default behavior\n */\n private _initGlobal(): void {\n this._bindKeys();\n\n // Bind clipboard functionality\n this._register(addDisposableListener(this.element!, 'copy', (event: ClipboardEvent) => {\n // If mouse events are active it means the selection manager is disabled and\n // copy should be handled by the host program.\n if (!this.hasSelection()) {\n return;\n }\n copyHandler(event, this._selectionService!);\n }));\n const pasteHandlerWrapper = (event: ClipboardEvent): void => handlePasteEvent(event, this.textarea!, this.coreService, this.optionsService);\n this._register(addDisposableListener(this.textarea!, 'paste', pasteHandlerWrapper));\n this._register(addDisposableListener(this.element!, 'paste', pasteHandlerWrapper));\n\n // Handle right click context menus\n if (Browser.isFirefox) {\n // Firefox doesn't appear to fire the contextmenu event on right click\n this._register(addDisposableListener(this.element!, 'mousedown', (event: MouseEvent) => {\n if (event.button === 2) {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }\n }));\n } else {\n this._register(addDisposableListener(this.element!, 'contextmenu', (event: MouseEvent) => {\n rightClickHandler(event, this.textarea!, this.screenElement!, this._selectionService!, this.options.rightClickSelectsWord);\n }));\n }\n\n // Move the textarea under the cursor when middle clicking on Linux to ensure\n // middle click to paste selection works. This only appears to work in Chrome\n // at the time is writing.\n if (Browser.isLinux) {\n // Use auxclick event over mousedown the latter doesn't seem to work. Note\n // that the regular click event doesn't fire for the middle mouse button.\n this._register(addDisposableListener(this.element!, 'auxclick', (event: MouseEvent) => {\n if (event.button === 1) {\n moveTextAreaUnderMouseCursor(event, this.textarea!, this.screenElement!);\n }\n }));\n }\n }\n\n /**\n * Apply key handling to the terminal\n */\n private _bindKeys(): void {\n this._register(addDisposableListener(this.textarea!, 'keyup', (ev: KeyboardEvent) => this._keyUp(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));\n this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));\n this._register(addDisposableListener(this.textarea!, 'compositionstart', () => this._compositionHelper!.compositionstart()));\n this._register(addDisposableListener(this.textarea!, 'compositionupdate', (e: CompositionEvent) => this._compositionHelper!.compositionupdate(e)));\n this._register(addDisposableListener(this.textarea!, 'compositionend', () => this._compositionHelper!.compositionend()));\n this._register(addDisposableListener(this.textarea!, 'input', (ev: InputEvent) => this._inputEvent(ev), true));\n this._register(this.onRender(() => this._compositionHelper!.updateCompositionElements()));\n }\n\n /**\n * Opens the terminal within an element.\n *\n * @param parent The element to create the terminal within.\n */\n public open(parent: HTMLElement): void {\n if (!parent) {\n throw new Error('Terminal requires a parent element.');\n }\n\n if (!parent.isConnected) {\n this._logService.debug('Terminal.open was called on an element that was not attached to the DOM');\n }\n\n // If the terminal is already opened\n if (this.element?.ownerDocument.defaultView && this._coreBrowserService) {\n // Adjust the window if needed\n if (this.element.ownerDocument.defaultView !== this._coreBrowserService.window) {\n this._coreBrowserService.window = this.element.ownerDocument.defaultView;\n }\n return;\n }\n\n this._document = parent.ownerDocument;\n if (this.options.documentOverride && this.options.documentOverride instanceof Document) {\n this._document = this.optionsService.rawOptions.documentOverride as Document;\n }\n\n // Create main element container\n this.element = this._document.createElement('div');\n this.element.dir = 'ltr'; // xterm.css assumes LTR\n this.element.classList.add('terminal');\n this.element.classList.add('xterm');\n this.element.classList.toggle('allow-transparency', this.options.allowTransparency);\n this._register(this.optionsService.onSpecificOptionChange('allowTransparency', value => this.element!.classList.toggle('allow-transparency', value)));\n parent.appendChild(this.element);\n\n // Performance: Use a document fragment to build the terminal\n // viewport and helper elements detached from the DOM\n const fragment = this._document.createDocumentFragment();\n this._viewportElement = this._document.createElement('div');\n this._viewportElement.classList.add('xterm-viewport');\n fragment.appendChild(this._viewportElement);\n\n this.screenElement = this._document.createElement('div');\n this.screenElement.classList.add('xterm-screen');\n this._register(addDisposableListener(this.screenElement, 'mousemove', (ev: MouseEvent) => this.updateCursorStyle(ev)));\n // Create the container that will hold helpers like the textarea for\n // capturing DOM Events. Then produce the helpers.\n this._helperContainer = this._document.createElement('div');\n this._helperContainer.classList.add('xterm-helpers');\n this.screenElement.appendChild(this._helperContainer);\n fragment.appendChild(this.screenElement);\n\n const textarea = this.textarea = this._document.createElement('textarea');\n this.textarea.classList.add('xterm-helper-textarea');\n this.textarea.setAttribute('aria-label', Strings.promptLabel.get());\n if (!Browser.isChromeOS) {\n // ChromeVox on ChromeOS does not like this. See\n // https://issuetracker.google.com/issues/260170397\n this.textarea.setAttribute('aria-multiline', 'false');\n }\n this.textarea.setAttribute('autocorrect', 'off');\n this.textarea.setAttribute('autocapitalize', 'off');\n this.textarea.setAttribute('spellcheck', 'false');\n this.textarea.tabIndex = 0;\n this._register(this.optionsService.onSpecificOptionChange('disableStdin', () => textarea.readOnly = this.optionsService.rawOptions.disableStdin));\n this.textarea.readOnly = this.optionsService.rawOptions.disableStdin;\n\n // Register the core browser service before the generic textarea handlers are registered so it\n // handles them first. Otherwise the renderers may use the wrong focus state.\n this._coreBrowserService = this._register(this._instantiationService.createInstance(CoreBrowserService,\n this.textarea,\n parent.ownerDocument.defaultView ?? window,\n // Force unsafe null in node.js environment for tests\n this._document ?? (typeof window !== 'undefined') ? window.document : null as any\n ));\n this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);\n\n this._register(addDisposableListener(this.textarea, 'focus', (ev: FocusEvent) => this._handleTextAreaFocus(ev)));\n this._register(addDisposableListener(this.textarea, 'blur', () => this._handleTextAreaBlur()));\n this._helperContainer.appendChild(this.textarea);\n\n this._charSizeService = this._instantiationService.createInstance(CharSizeService, this._document, this._helperContainer);\n this._instantiationService.setService(ICharSizeService, this._charSizeService);\n\n this._themeService = this._instantiationService.createInstance(ThemeService);\n this._instantiationService.setService(IThemeService, this._themeService);\n\n // CSI ? 996 n - color scheme query (https://contour-terminal.org/vt-extensions/color-palette-update-notifications/)\n this._register(this._inputHandler.onRequestColorSchemeQuery(() => this._reportColorScheme()));\n\n // Emit unsolicited color scheme notification on theme change when DECSET 2031 is enabled\n this._register(this._themeService.onChangeColors(() => {\n if (this.coreService.decPrivateModes.colorSchemeUpdates) {\n this._reportColorScheme();\n }\n }));\n\n this._characterJoinerService = this._instantiationService.createInstance(CharacterJoinerService);\n this._instantiationService.setService(ICharacterJoinerService, this._characterJoinerService);\n\n this._renderService = this._register(this._instantiationService.createInstance(RenderService, this.rows, this.screenElement));\n this._instantiationService.setService(IRenderService, this._renderService);\n this._register(this._renderService.onRenderedViewportChange(e => this._onRender.fire(e)));\n this._register(this._renderService.onDimensionsChange(e => this._onDimensionsChange.fire({\n css: {\n canvas: { ...e.css.canvas },\n cell: { ...e.css.cell }\n },\n device: {\n canvas: { ...e.device.canvas },\n cell: { ...e.device.cell },\n char: { ...e.device.char }\n }\n })));\n this.onResize(e => this._renderService!.resize(e.cols, e.rows));\n\n this._compositionView = this._document.createElement('div');\n this._compositionView.classList.add('composition-view');\n this._compositionHelper = this._instantiationService.createInstance(CompositionHelper, this.textarea, this._compositionView);\n this._helperContainer.appendChild(this._compositionView);\n\n this._mouseService = this._instantiationService.createInstance(MouseService);\n this._instantiationService.setService(IMouseService, this._mouseService);\n\n const linkifier = this._linkifier.value = this._register(this._instantiationService.createInstance(Linkifier, this.screenElement));\n\n // Performance: Add viewport and helper elements from the fragment\n this.element.appendChild(fragment);\n\n try {\n this._onWillOpen.fire(this.element);\n }\n catch { /* fails to load addon for some reason */ }\n if (!this._renderService.hasRenderer()) {\n this._renderService.setRenderer(this._createRenderer());\n }\n\n this._register(this.onCursorMove(() => {\n this._renderService!.handleCursorMove();\n this._syncTextArea();\n }));\n this._register(this.onResize(() => this._renderService!.handleResize(this.cols, this.rows)));\n this._register(this.onBlur(() => this._renderService!.handleBlur()));\n this._register(this.onFocus(() => this._renderService!.handleFocus()));\n\n this._viewport = this._register(this._instantiationService.createInstance(Viewport, this.element, this.screenElement));\n this._register(this._viewport.onRequestScrollLines(e => {\n super.scrollLines(e, false);\n this.refresh(0, this.rows - 1);\n }));\n\n this._selectionService = this._register(this._instantiationService.createInstance(SelectionService,\n this.element,\n this.screenElement,\n linkifier\n ));\n this._instantiationService.setService(ISelectionService, this._selectionService);\n this._register(this._selectionService.onRequestScrollLines(e => this.scrollLines(e.amount, e.suppressScrollEvent)));\n this._register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire()));\n this._register(this._selectionService.onRequestRedraw(e => this._renderService!.handleSelectionChanged(e.start, e.end, e.columnSelectMode)));\n this._register(this._selectionService.onLinuxMouseSelection(text => {\n // If there's a new selection, put it into the textarea, focus and select it\n // in order to register it as a selection on the OS. This event is fired\n // only on Linux to enable middle click to paste selection.\n this.textarea!.value = text;\n this.textarea!.focus();\n this.textarea!.select();\n }));\n this._register(EventUtils.any(\n this._onScroll.event,\n this._inputHandler.onScroll\n )(() => {\n this._selectionService!.refresh();\n this._viewport?.queueSync();\n }));\n\n this._register(this._instantiationService.createInstance(BufferDecorationRenderer, this.screenElement));\n this._register(addDisposableListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.handleMouseDown(e)));\n\n // apply mouse event classes set by escape codes before terminal was attached\n if (this.coreMouseService.areMouseEventsActive) {\n this._selectionService.disable();\n this.element.classList.add('enable-mouse-events');\n } else {\n this._selectionService.enable();\n }\n\n if (this.options.screenReaderMode) {\n // Note that this must be done *after* the renderer is created in order to\n // ensure the correct order of the dprchange event\n this._accessibilityManager.value = this._instantiationService.createInstance(AccessibilityManager, this);\n }\n this._register(this.optionsService.onSpecificOptionChange('screenReaderMode', e => this._handleScreenReaderModeOptionChange(e)));\n\n if (this.options.overviewRuler.width) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n this.optionsService.onSpecificOptionChange('overviewRuler', value => {\n if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {\n this._overviewRulerRenderer = this._register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));\n }\n });\n // Measure the character size\n this._charSizeService.measure();\n\n // Setup loop that draws to screen\n this.refresh(0, this.rows - 1);\n\n // Initialize global actions that need to be taken on the document.\n this._initGlobal();\n\n // Listen for mouse events and translate\n // them into terminal mouse protocols.\n this.bindMouse();\n }\n\n private _createRenderer(): IRenderer {\n return this._instantiationService.createInstance(DomRenderer, this, this._document!, this.element!, this.screenElement!, this._viewportElement!, this._helperContainer!, this.linkifier!);\n }\n\n /**\n * Bind certain mouse events to the terminal.\n * By default only 3 button + wheel up/down is ativated. For higher buttons\n * no mouse report will be created. Typically the standard actions will be active.\n *\n * There are several reasons not to enable support for higher buttons/wheel:\n * - Button 4 and 5 are typically used for history back and forward navigation,\n * there is no straight forward way to supress/intercept those standard actions.\n * - Support for higher buttons does not work in some platform/browser combinations.\n * - Left/right wheel was not tested.\n * - Emulators vary in mouse button support, typically only 3 buttons and\n * wheel up/down work reliable.\n *\n * TODO: Move mouse event code into its own file.\n */\n public bindMouse(): void {\n const self = this;\n const el = this.element!;\n\n // send event to CoreMouseService\n function sendEvent(ev: MouseEvent | WheelEvent): boolean {\n // Get mouse coordinates\n const pos = self._mouseService?.getMouseReportCoords(ev, self.screenElement!);\n if (!pos) {\n return false;\n }\n\n let but: CoreMouseButton;\n let action: CoreMouseAction | undefined;\n switch ((ev as any).overrideType || ev.type) {\n case 'mousemove':\n action = CoreMouseAction.MOVE;\n if (ev.buttons === undefined) {\n // buttons is not supported on macOS, try to get a value from button instead\n but = CoreMouseButton.NONE;\n if (ev.button !== undefined) {\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n }\n } else {\n // according to MDN buttons only reports up to button 5 (AUX2)\n but = ev.buttons & 1 ? CoreMouseButton.LEFT :\n ev.buttons & 4 ? CoreMouseButton.MIDDLE :\n ev.buttons & 2 ? CoreMouseButton.RIGHT :\n CoreMouseButton.NONE; // fallback to NONE\n }\n break;\n case 'mouseup':\n action = CoreMouseAction.UP;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'mousedown':\n action = CoreMouseAction.DOWN;\n but = ev.button < 3 ? ev.button : CoreMouseButton.NONE;\n break;\n case 'wheel':\n if (self._customWheelEventHandler && self._customWheelEventHandler(ev as WheelEvent) === false) {\n return false;\n }\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n const lines = self.coreMouseService.consumeWheelEvent(\n ev as WheelEvent,\n self._renderService?.dimensions?.device?.cell?.height,\n self._coreBrowserService?.dpr\n );\n if (lines === 0) {\n return false;\n }\n action = deltaY < 0 ? CoreMouseAction.UP : CoreMouseAction.DOWN;\n but = CoreMouseButton.WHEEL;\n break;\n default:\n // dont handle other event types by accident\n return false;\n }\n\n // exit if we cannot determine valid button/action values\n // do nothing for higher buttons than wheel\n if (action === undefined || but === undefined || but > CoreMouseButton.WHEEL) {\n return false;\n }\n\n return self.coreMouseService.triggerMouseEvent({\n col: pos.col,\n row: pos.row,\n x: pos.x,\n y: pos.y,\n button: but,\n action,\n ctrl: ev.ctrlKey,\n alt: ev.altKey,\n shift: ev.shiftKey\n });\n }\n\n /**\n * Event listener state handling.\n * We listen to the onProtocolChange event of CoreMouseService and put\n * requested listeners in `requestedEvents`. With this the listeners\n * have all bits to do the event listener juggling.\n * Note: 'mousedown' currently is \"always on\" and not managed\n * by onProtocolChange.\n */\n const requestedEvents: { [key: string]: ((ev: MouseEvent | WheelEvent) => void) | null } = {\n mouseup: null,\n wheel: null,\n mousedrag: null,\n mousemove: null\n };\n const eventListeners: { [key: string]: (ev: any) => void | boolean } = {\n mouseup: (ev: MouseEvent) => {\n sendEvent(ev);\n if (!ev.buttons) {\n // if no other button is held remove global handlers\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }\n },\n wheel: (ev: WheelEvent) => {\n sendEvent(ev);\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n },\n mousedrag: (ev: MouseEvent) => {\n // deal only with move while a button is held\n if (ev.buttons) {\n sendEvent(ev);\n }\n },\n mousemove: (ev: MouseEvent) => {\n // deal only with move without any button\n if (!ev.buttons) {\n sendEvent(ev);\n }\n }\n };\n this._register(this.coreMouseService.onProtocolChange(events => {\n // apply global changes on events\n if (events) {\n if (this.optionsService.rawOptions.logLevel === 'debug') {\n this._logService.debug('Binding to mouse events:', this.coreMouseService.explainEvents(events));\n }\n this.element!.classList.add('enable-mouse-events');\n this._selectionService!.disable();\n } else {\n this._logService.debug('Unbinding from mouse events.');\n this.element!.classList.remove('enable-mouse-events');\n this._selectionService!.enable();\n }\n\n // add/remove handlers from requestedEvents\n\n if (!(events & CoreMouseEventType.MOVE)) {\n el.removeEventListener('mousemove', requestedEvents.mousemove!);\n requestedEvents.mousemove = null;\n } else if (!requestedEvents.mousemove) {\n el.addEventListener('mousemove', eventListeners.mousemove);\n requestedEvents.mousemove = eventListeners.mousemove;\n }\n\n if (!(events & CoreMouseEventType.WHEEL)) {\n el.removeEventListener('wheel', requestedEvents.wheel!);\n requestedEvents.wheel = null;\n } else if (!requestedEvents.wheel) {\n el.addEventListener('wheel', eventListeners.wheel, { passive: false });\n requestedEvents.wheel = eventListeners.wheel;\n }\n\n if (!(events & CoreMouseEventType.UP)) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup!);\n requestedEvents.mouseup = null;\n } else {\n requestedEvents.mouseup ??= eventListeners.mouseup;\n }\n\n if (!(events & CoreMouseEventType.DRAG)) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag!);\n requestedEvents.mousedrag = null;\n } else {\n requestedEvents.mousedrag ??= eventListeners.mousedrag;\n }\n }));\n // force initial onProtocolChange so we dont miss early mouse requests\n this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol;\n\n // Ensure document-level listeners are removed on dispose\n this._register(toDisposable(() => {\n if (requestedEvents.mouseup) {\n this._document!.removeEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.removeEventListener('mousemove', requestedEvents.mousedrag);\n }\n }));\n\n /**\n * \"Always on\" event listeners.\n */\n this._register(addDisposableListener(el, 'mousedown', (ev: MouseEvent) => {\n ev.preventDefault();\n this.focus();\n\n // Don't send the mouse button to the pty if mouse events are disabled or\n // if the selection manager is having selection forced (ie. a modifier is\n // held).\n if (!this.coreMouseService.areMouseEventsActive || this._selectionService!.shouldForceSelection(ev)) {\n return;\n }\n\n sendEvent(ev);\n\n // Register additional global handlers which should keep reporting outside\n // of the terminal element.\n // Note: Other emulators also do this for 'mousedown' while a button\n // is held, we currently limit 'mousedown' to the terminal only.\n if (requestedEvents.mouseup) {\n this._document!.addEventListener('mouseup', requestedEvents.mouseup);\n }\n if (requestedEvents.mousedrag) {\n this._document!.addEventListener('mousemove', requestedEvents.mousedrag);\n }\n }));\n\n this._register(addDisposableListener(el, 'wheel', (ev: WheelEvent) => {\n // do nothing, if app side handles wheel itself\n if (requestedEvents.wheel) return;\n\n if (this._customWheelEventHandler && this._customWheelEventHandler(ev) === false) {\n return false;\n }\n\n if (!this.buffer.hasScrollback) {\n // Convert wheel events into up/down events when the buffer does not have scrollback, this\n // enables scrolling in apps hosted in the alt buffer such as vim or tmux even when mouse\n // events are not enabled.\n // This used implementation used get the actual lines/partial lines scrolled from the\n // viewport but since moving to the new viewport implementation has been simplified to\n // simply send a single up or down sequence.\n\n // Do nothing if there's no vertical scroll\n const deltaY = (ev as WheelEvent).deltaY;\n if (deltaY === 0) {\n return false;\n }\n\n const lines = self.coreMouseService.consumeWheelEvent(\n ev as WheelEvent,\n self._renderService?.dimensions?.device?.cell?.height,\n self._coreBrowserService?.dpr\n );\n if (lines === 0) {\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n\n // Construct and send sequences\n const sequence = C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? 'O' : '[') + (ev.deltaY < 0 ? 'A' : 'B');\n this.coreService.triggerDataEvent(sequence, true);\n ev.preventDefault();\n ev.stopPropagation();\n return false;\n }\n }, { passive: false }));\n }\n\n\n /**\n * Tells the renderer to refresh terminal content between two rows (inclusive) at the next\n * opportunity.\n * @param start The row to start from (between 0 and this.rows - 1).\n * @param end The row to end at (between start and this.rows - 1).\n */\n public refresh(start: number, end: number, sync: boolean = false): void {\n this._renderService?.refreshRows(start, end, sync);\n }\n\n /**\n * Change the cursor style for different selection modes\n */\n public updateCursorStyle(ev: KeyboardEvent | MouseEvent): void {\n if (this._selectionService?.shouldColumnSelect(ev)) {\n this.element!.classList.add('column-select');\n } else {\n this.element!.classList.remove('column-select');\n }\n }\n\n /**\n * Display the cursor element\n */\n private _showCursor(): void {\n if (!this.coreService.isCursorInitialized) {\n this.coreService.isCursorInitialized = true;\n this.refresh(this.buffer.y, this.buffer.y);\n }\n }\n\n public scrollLines(disp: number, suppressScrollEvent?: boolean): void {\n // All scrollLines methods need to go via the viewport in order to support smooth scroll\n if (this._viewport) {\n this._viewport.scrollLines(disp);\n } else {\n super.scrollLines(disp, suppressScrollEvent);\n }\n this.refresh(0, this.rows - 1);\n }\n\n public scrollPages(pageCount: number): void {\n this.scrollLines(pageCount * (this.rows - 1));\n }\n\n public scrollToTop(): void {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }\n\n public scrollToBottom(disableSmoothScroll?: boolean): void {\n if (disableSmoothScroll && this._viewport) {\n this._viewport.scrollToLine(this.buffer.ybase, true);\n } else {\n this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);\n }\n }\n\n public scrollToLine(line: number): void {\n const scrollAmount = line - this._bufferService.buffer.ydisp;\n if (scrollAmount !== 0) {\n this.scrollLines(scrollAmount);\n }\n }\n\n public paste(data: string): void {\n paste(data, this.textarea!, this.coreService, this.optionsService);\n }\n\n public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {\n this._customKeyEventHandler = customKeyEventHandler;\n }\n\n public attachCustomWheelEventHandler(customWheelEventHandler: CustomWheelEventHandler): void {\n this._customWheelEventHandler = customWheelEventHandler;\n }\n\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._linkProviderService.registerLinkProvider(linkProvider);\n }\n\n public registerCharacterJoiner(handler: CharacterJoinerHandler): number {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n const joinerId = this._characterJoinerService.register(handler);\n this.refresh(0, this.rows - 1);\n return joinerId;\n }\n\n public deregisterCharacterJoiner(joinerId: number): void {\n if (!this._characterJoinerService) {\n throw new Error('Terminal must be opened first');\n }\n if (this._characterJoinerService.deregister(joinerId)) {\n this.refresh(0, this.rows - 1);\n }\n }\n\n public get markers(): IMarker[] {\n return this.buffer.markers;\n }\n\n public registerMarker(cursorYOffset: number): IMarker {\n return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + cursorYOffset);\n }\n\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n return this._decorationService.registerDecoration(decorationOptions);\n }\n\n /**\n * Gets whether the terminal has an active selection.\n */\n public hasSelection(): boolean {\n return this._selectionService ? this._selectionService.hasSelection : false;\n }\n\n /**\n * Selects text within the terminal.\n * @param column The column the selection starts at..\n * @param row The row the selection starts at.\n * @param length The length of the selection.\n */\n public select(column: number, row: number, length: number): void {\n this._selectionService!.setSelection(column, row, length);\n }\n\n /**\n * Gets the terminal's current selection, this is useful for implementing copy\n * behavior outside of xterm.js.\n */\n public getSelection(): string {\n return this._selectionService ? this._selectionService.selectionText : '';\n }\n\n public getSelectionPosition(): IBufferRange | undefined {\n if (!this._selectionService || !this._selectionService.hasSelection) {\n return undefined;\n }\n\n return {\n start: {\n x: this._selectionService.selectionStart![0],\n y: this._selectionService.selectionStart![1]\n },\n end: {\n x: this._selectionService.selectionEnd![0],\n y: this._selectionService.selectionEnd![1]\n }\n };\n }\n\n /**\n * Clears the current terminal selection.\n */\n public clearSelection(): void {\n this._selectionService?.clearSelection();\n }\n\n /**\n * Selects all text within the terminal.\n */\n public selectAll(): void {\n this._selectionService?.selectAll();\n }\n\n public selectLines(start: number, end: number): void {\n this._selectionService?.selectLines(start, end);\n }\n\n /**\n * Handle a keydown [KeyboardEvent].\n *\n * [KeyboardEvent]: https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n */\n protected _keyDown(event: KeyboardEvent): boolean | undefined {\n this._keyDownHandled = false;\n this._keyDownSeen = true;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {\n return false;\n }\n\n // Ignore composing with Alt key on Mac when macOptionIsMeta is enabled\n const shouldIgnoreComposition = this.browser.isMac && this.options.macOptionIsMeta && event.altKey;\n\n if (!shouldIgnoreComposition && !this._compositionHelper!.keydown(event)) {\n if (this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp) {\n this.scrollToBottom(true);\n }\n return false;\n }\n\n if (!shouldIgnoreComposition && (event.key === 'Dead' || event.key === 'AltGraph')) {\n this._unprocessedDeadKey = true;\n }\n\n const result = this._keyboardService.evaluateKeyDown(event);\n\n this.updateCursorStyle(event);\n\n if (result.type === KeyboardResultType.PAGE_DOWN || result.type === KeyboardResultType.PAGE_UP) {\n const scrollCount = this.rows - 1;\n this.scrollLines(result.type === KeyboardResultType.PAGE_UP ? -scrollCount : scrollCount);\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n\n if (result.type === KeyboardResultType.SELECT_ALL) {\n this.selectAll();\n }\n\n if (this._isThirdLevelShift(this.browser, event)) {\n return true;\n }\n\n if (result.cancel) {\n // The event is canceled at the end already, is this necessary?\n event.preventDefault();\n event.stopPropagation();\n }\n\n if (!result.key) {\n return true;\n }\n\n // HACK: Process A-Z in the keypress event to fix an issue with macOS IMEs where lower case\n // letters cannot be input while caps lock is on. Skip this hack when using kitty protocol\n // or Win32 input mode as they need to send proper sequences for all key events.\n if (!this._keyboardService.useKitty && !this._keyboardService.useWin32InputMode && event.key && !event.ctrlKey && !event.altKey && !event.metaKey && event.key.length === 1) {\n if (event.key.charCodeAt(0) >= 65 && event.key.charCodeAt(0) <= 90) {\n return true;\n }\n }\n\n if (this._unprocessedDeadKey) {\n this._unprocessedDeadKey = false;\n return true;\n }\n\n // If ctrl+c or enter is being sent, clear out the textarea. This is done so that screen readers\n // will announce deleted characters. This will not work 100% of the time but it should cover\n // most scenarios.\n if (result.key === C0.ETX || result.key === C0.CR) {\n this.textarea!.value = '';\n }\n\n const wasModifierOnly = this._keyboardService.useWin32InputMode && wasModifierKeyOnlyEvent(event);\n this._onKey.fire({ key: result.key, domEvent: event });\n this._showCursor();\n this.coreService.triggerDataEvent(result.key, !wasModifierOnly);\n\n // Cancel events when not in screen reader mode so events don't get bubbled up and handled by\n // other listeners. When screen reader mode is enabled, we don't cancel them (unless ctrl or alt\n // is also depressed) so that the cursor textarea can be updated, which triggers the screen\n // reader to read it.\n if (!this.optionsService.rawOptions.screenReaderMode || event.altKey || event.ctrlKey) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n\n this._keyDownHandled = true;\n }\n\n private _isThirdLevelShift(browser: IBrowser, ev: KeyboardEvent): boolean {\n const thirdLevelKey =\n (browser.isMac && !this.options.macOptionIsMeta && ev.altKey && !ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.altKey && ev.ctrlKey && !ev.metaKey) ||\n (browser.isWindows && ev.getModifierState('AltGraph'));\n\n if (ev.type === 'keypress') {\n return thirdLevelKey;\n }\n\n // Don't invoke for arrows, pageDown, home, backspace, etc. (on non-keypress events)\n return thirdLevelKey && (!ev.keyCode || ev.keyCode > 47);\n }\n\n protected _keyUp(ev: KeyboardEvent): void {\n this._keyDownSeen = false;\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return;\n }\n\n if (!wasModifierKeyOnlyEvent(ev)) {\n this.focus();\n }\n\n // Handle key release for Kitty keyboard protocol\n const result = this._keyboardService.evaluateKeyUp(ev);\n if (result?.key) {\n const wasModifierOnly = this._keyboardService.useWin32InputMode && wasModifierKeyOnlyEvent(ev);\n this.coreService.triggerDataEvent(result.key, !wasModifierOnly);\n }\n\n this.updateCursorStyle(ev);\n this._keyPressHandled = false;\n }\n\n /**\n * Handle a keypress event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent\n * @param ev The keypress event to be handled.\n */\n protected _keyPress(ev: KeyboardEvent): boolean {\n let key;\n\n this._keyPressHandled = false;\n\n if (this._keyDownHandled) {\n return false;\n }\n\n if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {\n return false;\n }\n\n if (ev.charCode) {\n key = ev.charCode;\n } else if (ev.which === null || ev.which === undefined) {\n key = ev.keyCode;\n } else if (ev.which !== 0 && ev.charCode !== 0) {\n key = ev.which;\n } else {\n return false;\n }\n\n if (!key || (\n (ev.altKey || ev.ctrlKey || ev.metaKey) && !this._isThirdLevelShift(this.browser, ev)\n )) {\n return false;\n }\n\n key = String.fromCharCode(key);\n\n this._onKey.fire({ key, domEvent: ev });\n this._showCursor();\n this.coreService.triggerDataEvent(key, true);\n\n this._keyPressHandled = true;\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n return true;\n }\n\n /**\n * Handle an input event.\n * Key Resources:\n * - https://developer.mozilla.org/en-US/docs/Web/API/InputEvent\n * @param ev The input event to be handled.\n */\n protected _inputEvent(ev: InputEvent): boolean {\n // Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to\n // support reading out character input which can doubling up input characters\n // Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679\n if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {\n if (this._keyPressHandled) {\n return false;\n }\n\n // The key was handled so clear the dead key state, otherwise certain keystrokes like arrow\n // keys could be ignored\n this._unprocessedDeadKey = false;\n\n const text = ev.data;\n this.coreService.triggerDataEvent(text, true);\n return true;\n }\n\n return false;\n }\n\n /**\n * Resizes the terminal.\n *\n * @param x The number of columns to resize to.\n * @param y The number of rows to resize to.\n */\n public resize(x: number, y: number): void {\n if (x === this.cols && y === this.rows) {\n // Check if we still need to measure the char size (fixes #785).\n if (this._charSizeService && !this._charSizeService.hasValidSize) {\n this._charSizeService.measure();\n }\n return;\n }\n\n super.resize(x, y);\n }\n\n private _afterResize(x: number, y: number): void {\n this._charSizeService?.measure();\n }\n\n /**\n * Clear the entire buffer, making the prompt line the new first line.\n */\n public clear(): void {\n if (this.buffer.ybase === 0 && this.buffer.y === 0) {\n // Don't clear if it's already clear\n return;\n }\n this.buffer.clearAllMarkers();\n this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!);\n this.buffer.lines.length = 1;\n this.buffer.ydisp = 0;\n this.buffer.ybase = 0;\n this.buffer.y = 0;\n for (let i = 1; i < this.rows; i++) {\n this.buffer.lines.push(this.buffer.getBlankLine(DEFAULT_ATTR_DATA));\n }\n // IMPORTANT: Fire scroll event before viewport is reset. This ensures embedders get the clear\n // scroll event and that the viewport's state will be valid for immediate writes.\n this._onScroll.fire({ position: this.buffer.ydisp });\n this.refresh(0, this.rows - 1);\n }\n\n /**\n * Reset terminal.\n * Note: Calling this directly from JS is synchronous but does not clear\n * input buffers and does not reset the parser, thus the terminal will\n * continue to apply pending input data.\n * If you need in band reset (synchronous with input data) consider\n * using DECSTR (soft reset, CSI ! p) or RIS instead (hard reset, ESC c).\n */\n public reset(): void {\n /**\n * Since _setup handles a full terminal creation, we have to carry forward\n * a few things that should not reset.\n */\n this.options.rows = this.rows;\n this.options.cols = this.cols;\n const customKeyEventHandler = this._customKeyEventHandler;\n\n this._setup();\n super.reset();\n this._selectionService?.reset();\n this._decorationService.reset();\n\n // reattach\n this._customKeyEventHandler = customKeyEventHandler;\n\n // do a full screen refresh\n this.refresh(0, this.rows - 1, true);\n }\n\n public clearTextureAtlas(): void {\n this._renderService?.clearTextureAtlas();\n }\n\n private _reportFocus(): void {\n if (this.element?.classList.contains('focus')) {\n this.coreService.triggerDataEvent(C0.ESC + '[I');\n } else {\n this.coreService.triggerDataEvent(C0.ESC + '[O');\n }\n }\n\n private _reportWindowsOptions(type: WindowsOptionsReportType): void {\n if (!this._renderService) {\n return;\n }\n\n switch (type) {\n case WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:\n const canvasWidth = this._renderService.dimensions.css.canvas.width.toFixed(0);\n const canvasHeight = this._renderService.dimensions.css.canvas.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[4;${canvasHeight};${canvasWidth}t`);\n break;\n case WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:\n const cellWidth = this._renderService.dimensions.css.cell.width.toFixed(0);\n const cellHeight = this._renderService.dimensions.css.cell.height.toFixed(0);\n this.coreService.triggerDataEvent(`${C0.ESC}[6;${cellHeight};${cellWidth}t`);\n break;\n }\n }\n\n}\n\n/**\n * Helpers\n */\n\nfunction wasModifierKeyOnlyEvent(ev: KeyboardEvent): boolean {\n return ev.keyCode === 16 || // Shift\n ev.keyCode === 17 || // Ctrl\n ev.keyCode === 18 || // Alt\n ev.keyCode === 91 || // Meta (Left)\n ev.keyCode === 92 || // Meta (Right)\n ev.keyCode === 93 || // Meta (Menu)\n ev.keyCode === 224 || // Meta (Firefox)\n ev.key === 'Meta';\n}\n", "/**\n * Copyright (c) 2019 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ITerminalAddon, IDisposable, Terminal } from '@xterm/xterm';\n\nexport interface ILoadedAddon {\n instance: ITerminalAddon;\n dispose: () => void;\n isDisposed: boolean;\n}\n\nexport class AddonManager implements IDisposable {\n protected _addons: ILoadedAddon[] = [];\n\n public dispose(): void {\n for (let i = this._addons.length - 1; i >= 0; i--) {\n this._addons[i].instance.dispose();\n }\n }\n\n public loadAddon(terminal: Terminal, instance: ITerminalAddon): void {\n const loadedAddon: ILoadedAddon = {\n instance,\n dispose: instance.dispose,\n isDisposed: false\n };\n this._addons.push(loadedAddon);\n instance.dispose = () => this._wrappedAddonDispose(loadedAddon);\n instance.activate(terminal as any);\n }\n\n private _wrappedAddonDispose(loadedAddon: ILoadedAddon): void {\n if (loadedAddon.isDisposed) {\n // Do nothing if already disposed\n return;\n }\n let index = -1;\n for (let i = 0; i < this._addons.length; i++) {\n if (this._addons[i] === loadedAddon) {\n index = i;\n break;\n }\n }\n if (index === -1) {\n throw new Error('Could not dispose an addon that has not been loaded');\n }\n loadedAddon.isDisposed = true;\n loadedAddon.dispose.apply(loadedAddon.instance);\n this._addons.splice(index, 1);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData());\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { ICoreTerminal } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = this._register(new Emitter());\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n super();\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerApcHandler(ident, callback);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport * as Strings from 'browser/LocalizableStrings';\nimport { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';\nimport { IBufferRange, ITerminal } from 'browser/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { ITerminalOptions } from 'common/Types';\nimport { AddonManager } from 'common/public/AddonManager';\nimport { BufferNamespaceApi } from 'common/public/BufferNamespaceApi';\nimport { ParserApi } from 'common/public/ParserApi';\nimport { UnicodeApi } from 'common/public/UnicodeApi';\nimport { IBufferNamespace as IBufferNamespaceApi, IDecoration, IDecorationOptions, IDisposable, ILinkProvider, ILocalizableStrings, IMarker, IModes, IParser, IRenderDimensions, ITerminalAddon, Terminal as ITerminalApi, ITerminalInitOnlyOptions, IUnicodeHandling } from '@xterm/xterm';\nimport type { IEvent } from 'common/Event';\n\n/**\n * The set of options that only have an effect when set in the Terminal constructor.\n */\nconst CONSTRUCTOR_ONLY_OPTIONS = ['cols', 'rows'];\n\nlet $value = 0;\n\nexport class Terminal extends Disposable implements ITerminalApi {\n private _core: ITerminal;\n private _addonManager: AddonManager;\n private _parser: IParser | undefined;\n private _buffer: BufferNamespaceApi | undefined;\n private _publicOptions: Required;\n\n constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions) {\n super();\n\n this._core = this._register(new TerminalCore(options));\n this._addonManager = this._register(new AddonManager());\n\n this._publicOptions = { ... this._core.options };\n const getter = (propName: string): any => {\n return this._core.options[propName];\n };\n const setter = (propName: string, value: any): void => {\n this._checkReadonlyOptions(propName);\n this._core.options[propName] = value;\n };\n\n for (const propName in this._core.options) {\n const desc = {\n get: getter.bind(this, propName),\n set: setter.bind(this, propName)\n };\n Object.defineProperty(this._publicOptions, propName, desc);\n }\n }\n\n private _checkReadonlyOptions(propName: string): void {\n // Throw an error if any constructor only option is modified\n // from terminal.options\n // Modifications from anywhere else are allowed\n if (CONSTRUCTOR_ONLY_OPTIONS.includes(propName)) {\n throw new Error(`Option \"${propName}\" can only be set in the constructor`);\n }\n }\n\n private _checkProposedApi(): void {\n if (!this._core.optionsService.rawOptions.allowProposedApi) {\n throw new Error('You must set the allowProposedApi option to true to use proposed API');\n }\n }\n\n public get onBell(): IEvent { return this._core.onBell; }\n public get onBinary(): IEvent { return this._core.onBinary; }\n public get onCursorMove(): IEvent { return this._core.onCursorMove; }\n public get onData(): IEvent { return this._core.onData; }\n public get onKey(): IEvent<{ key: string, domEvent: KeyboardEvent }> { return this._core.onKey; }\n public get onLineFeed(): IEvent { return this._core.onLineFeed; }\n public get onRender(): IEvent<{ start: number, end: number }> { return this._core.onRender; }\n public get onResize(): IEvent<{ cols: number, rows: number }> { return this._core.onResize; }\n public get onScroll(): IEvent { return this._core.onScroll; }\n public get onSelectionChange(): IEvent { return this._core.onSelectionChange; }\n public get onTitleChange(): IEvent { return this._core.onTitleChange; }\n public get onWriteParsed(): IEvent { return this._core.onWriteParsed; }\n public get onDimensionsChange(): IEvent { return this._core.onDimensionsChange; }\n\n public get element(): HTMLElement | undefined { return this._core.element; }\n public get parser(): IParser {\n return this._parser ??= new ParserApi(this._core);\n }\n public get unicode(): IUnicodeHandling {\n this._checkProposedApi();\n return new UnicodeApi(this._core);\n }\n public get textarea(): HTMLTextAreaElement | undefined { return this._core.textarea; }\n public get rows(): number { return this._core.rows; }\n public get cols(): number { return this._core.cols; }\n public get buffer(): IBufferNamespaceApi {\n return this._buffer ??= this._register(new BufferNamespaceApi(this._core));\n }\n public get markers(): ReadonlyArray {\n return this._core.markers;\n }\n public get modes(): IModes {\n const m = this._core.coreService.decPrivateModes;\n let mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any' = 'none';\n switch (this._core.coreMouseService.activeProtocol) {\n case 'X10': mouseTrackingMode = 'x10'; break;\n case 'VT200': mouseTrackingMode = 'vt200'; break;\n case 'DRAG': mouseTrackingMode = 'drag'; break;\n case 'ANY': mouseTrackingMode = 'any'; break;\n }\n return {\n applicationCursorKeysMode: m.applicationCursorKeys,\n applicationKeypadMode: m.applicationKeypad,\n bracketedPasteMode: m.bracketedPasteMode,\n insertMode: this._core.coreService.modes.insertMode,\n mouseTrackingMode: mouseTrackingMode,\n originMode: m.origin,\n reverseWraparoundMode: m.reverseWraparound,\n sendFocusMode: m.sendFocus,\n showCursor: !this._core.coreService.isCursorHidden,\n synchronizedOutputMode: m.synchronizedOutput,\n win32InputMode: m.win32InputMode,\n wraparoundMode: m.wraparound\n };\n }\n public get dimensions(): IRenderDimensions | undefined {\n return this._core.dimensions;\n }\n public get options(): Required {\n return this._publicOptions;\n }\n public set options(options: ITerminalOptions) {\n for (const propName in options) {\n this._publicOptions[propName] = options[propName];\n }\n }\n public blur(): void {\n this._core.blur();\n }\n public focus(): void {\n this._core.focus();\n }\n public input(data: string, wasUserInput: boolean = true): void {\n this._core.input(data, wasUserInput);\n }\n public resize(columns: number, rows: number): void {\n this._verifyIntegers(columns, rows);\n this._core.resize(columns, rows);\n }\n public open(parent: HTMLElement): void {\n this._core.open(parent);\n }\n public attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void {\n this._core.attachCustomKeyEventHandler(customKeyEventHandler);\n }\n public attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void {\n this._core.attachCustomWheelEventHandler(customWheelEventHandler);\n }\n public registerLinkProvider(linkProvider: ILinkProvider): IDisposable {\n return this._core.registerLinkProvider(linkProvider);\n }\n public registerCharacterJoiner(handler: (text: string) => [number, number][]): number {\n return this._core.registerCharacterJoiner(handler);\n }\n public deregisterCharacterJoiner(joinerId: number): void {\n this._core.deregisterCharacterJoiner(joinerId);\n }\n public registerMarker(cursorYOffset: number = 0): IMarker {\n this._verifyIntegers(cursorYOffset);\n return this._core.registerMarker(cursorYOffset);\n }\n public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {\n this._verifyPositiveIntegers(decorationOptions.x ?? 0, decorationOptions.width ?? 0, decorationOptions.height ?? 0);\n return this._core.registerDecoration(decorationOptions);\n }\n public hasSelection(): boolean {\n return this._core.hasSelection();\n }\n public select(column: number, row: number, length: number): void {\n this._verifyIntegers(column, row, length);\n this._core.select(column, row, length);\n }\n public getSelection(): string {\n return this._core.getSelection();\n }\n public getSelectionPosition(): IBufferRange | undefined {\n return this._core.getSelectionPosition();\n }\n public clearSelection(): void {\n this._core.clearSelection();\n }\n public selectAll(): void {\n this._core.selectAll();\n }\n public selectLines(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.selectLines(start, end);\n }\n public dispose(): void {\n super.dispose();\n }\n public scrollLines(amount: number): void {\n this._verifyIntegers(amount);\n this._core.scrollLines(amount);\n }\n public scrollPages(pageCount: number): void {\n this._verifyIntegers(pageCount);\n this._core.scrollPages(pageCount);\n }\n public scrollToTop(): void {\n this._core.scrollToTop();\n }\n public scrollToBottom(): void {\n this._core.scrollToBottom();\n }\n public scrollToLine(line: number): void {\n this._verifyIntegers(line);\n this._core.scrollToLine(line);\n }\n public clear(): void {\n this._core.clear();\n }\n public write(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data, callback);\n }\n public writeln(data: string | Uint8Array, callback?: () => void): void {\n this._core.write(data);\n this._core.write('\\r\\n', callback);\n }\n public paste(data: string): void {\n this._core.paste(data);\n }\n public refresh(start: number, end: number): void {\n this._verifyIntegers(start, end);\n this._core.refresh(start, end);\n }\n public reset(): void {\n this._core.reset();\n }\n public clearTextureAtlas(): void {\n this._core.clearTextureAtlas();\n }\n public loadAddon(addon: ITerminalAddon): void {\n this._addonManager.loadAddon(this, addon);\n }\n public static get strings(): ILocalizableStrings {\n // A wrapper is required here because esbuild prevents setting an `export let`\n return {\n get promptLabel(): string { return Strings.promptLabel.get(); },\n set promptLabel(value: string) { Strings.promptLabel.set(value); },\n get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },\n set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }\n };\n }\n\n private _verifyIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value === Infinity || isNaN($value) || $value % 1 !== 0) {\n throw new Error('This API only accepts integers');\n }\n }\n }\n\n private _verifyPositiveIntegers(...values: number[]): void {\n for ($value of values) {\n if ($value && ($value === Infinity || isNaN($value) || $value % 1 !== 0 || $value < 0)) {\n throw new Error('This API only accepts positive integers');\n }\n }\n }\n}\n"], ++ "mappings": ";;;;;;;;;;;;;;;;qSAOA,IAAIA,GAAsB,iBACpBC,GAAc,CAClB,IAAK,IAAMD,GACX,IAAME,GAAkBF,GAAsBE,CAChD,EAEI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C,KAAK,cAAc,UAAU,KAAMA,CAAK,CAC1C,CACA,WAAkB,SAA+B,CAE/C,MAAO,CACL,IAAI,aAAsB,CAAE,OAAeC,GAAY,IAAI,CAAG,EAC9D,IAAI,YAAY7B,EAAe,CAAU6B,GAAY,IAAI7B,CAAK,CAAG,EACjE,IAAI,eAAwB,CAAE,OAAe8B,GAAc,IAAI,CAAG,EAClE,IAAI,cAAc9B,EAAe,CAAU8B,GAAc,IAAI9B,CAAK,CAAG,CACvE,CACF,CAEQ,mBAAmB+B,EAAwB,CACjD,IAAKxC,MAAUwC,EACb,GAAIxC,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,EACzD,MAAM,IAAI,MAAM,gCAAgC,CAGtD,CAEQ,2BAA2BwC,EAAwB,CACzD,IAAKxC,MAAUwC,EACb,GAAIxC,KAAWA,KAAW,KAAY,MAAMA,EAAM,GAAKA,GAAS,IAAM,GAAKA,GAAS,GAClF,MAAM,IAAI,MAAM,yCAAyC,CAG/D,CACF", + "names": ["promptLabelInternal", "promptLabel", "value", "tooMuchOutputInternal", "tooMuchOutput", "prepareTextForTerminal", "text", "bracketTextForPaste", "bracketedPasteMode", "copyHandler", "ev", "selectionService", "handlePasteEvent", "textarea", "coreService", "optionsService", "paste", "moveTextAreaUnderMouseCursor", "screenElement", "pos", "left", "top", "rightClickHandler", "shouldSelectWord", "stringFromCodePoint", "codePoint", "utf32ToString", "data", "start", "end", "result", "i", "codepoint", "StringToUtf32", "input", "target", "length", "size", "startPos", "second", "code", "Utf8ToUtf32", "byte1", "byte2", "byte3", "byte4", "discardInterim", "cp", "pos", "tmp", "type", "missing", "fourStop", "AttributeData", "_AttributeData", "ExtendedAttrs", "value", "newObj", "_ExtendedAttrs", "ext", "urlId", "val", "CellData", "_CellData", "AttributeData", "ExtendedAttrs", "value", "obj", "stringFromCodePoint", "combined", "code", "second", "DI_TARGET", "DI_DEPENDENCIES", "serviceRegistry", "getServiceDependencies", "ctor", "createDecorator", "id", "decorator", "target", "key", "index", "storeServiceDependency", "IBufferService", "createDecorator", "ICoreMouseService", "ICoreService", "ICharsetService", "IInstantiationService", "ILogService", "createDecorator", "IOptionsService", "IOscLinkService", "IUnicodeService", "IDecorationService", "OscLinkProvider", "_bufferService", "_optionsService", "_oscLinkService", "CellData", "y", "callback", "line", "result", "linkHandler", "cell", "lineLength", "currentLinkId", "currentStart", "finishLink", "x", "text", "range", "ignoreLink", "parsed", "e", "defaultActivate", "__decorateClass", "__decorateParam", "IBufferService", "IOptionsService", "IOscLinkService", "uri", "newWindow", "ICharSizeService", "createDecorator", "ICoreBrowserService", "IMouseService", "IRenderService", "ISelectionService", "ICharacterJoinerService", "IThemeService", "ILinkProviderService", "IKeyboardService", "toDisposable", "fn", "dispose", "disposables", "d", "DisposableStore", "o", "d", "Disposable", "MutableDisposable", "value", "mainWindow", "ErrorHandler", "e", "ErrorNoTelemetry", "listener", "newUnexpectedErrorHandler", "errorHandler", "onUnexpectedError", "e", "isCancellationError", "errorHandler", "canceledName", "isCancellationError", "error", "CancellationError", "illegalArgument", "name", "ErrorNoTelemetry", "_ErrorNoTelemetry", "msg", "err", "result", "BugIndicatingError", "_BugIndicatingError", "message", "createSingleCallFunction", "fn", "fnDidRunCallback", "_this", "didCall", "result", "findLastIdxMonotonous", "array", "predicate", "startIdx", "endIdxEx", "i", "j", "k", "_MonotonousArray", "_array", "predicate", "item", "idx", "findLastIdxMonotonous", "MonotonousArray", "tail", "array", "n", "CompareResult", "isLessThan", "result", "isLessThanOrEqual", "isGreaterThan", "isNeitherLessOrGreaterThan", "compareBy", "selector", "comparator", "a", "b", "numberComparator", "a", "b", "_CallbackIterable", "iterate", "handler", "item", "result", "predicate", "cb", "mapFn", "comparator", "first", "CompareResult", "_callback", "CallbackIterable", "groupBy", "data", "groupFn", "result", "element", "key", "target", "_a", "_b", "SetWithKey", "values", "toKey", "value", "key", "entry", "callbackfn", "thisArg", "SetMap", "key", "value", "values", "fn", "Iterable", "is", "thing", "_empty", "empty", "single", "element", "wrap", "iterableOrElement", "from", "iterable", "reverse", "array", "i", "isEmpty", "first", "some", "predicate", "find", "filter", "map", "fn", "index", "flatMap", "concat", "iterables", "reduce", "reducer", "initialValue", "value", "slice", "arr", "to", "consume", "atMost", "consumed", "iterator", "next", "asyncToArray", "result", "item", "TRACK_DISPOSABLES", "disposableTracker", "_DisposableTracker", "d", "val", "data", "child", "parent", "x", "disposable", "cache", "cacheValue", "result", "rootParentCache", "v", "k", "maxReported", "preComputedLeaks", "uncoveredLeakingObjs", "leakingObjects", "info", "leakingObjsSet", "o", "l", "getStackTracePath", "leaking", "removePrefix", "array", "linesToRemove", "regexp", "lines", "p", "stackTraceStarts", "SetMap", "stackTracePath", "i", "compareBy", "numberComparator", "message", "stackTraceFormattedLines", "line", "prevStarts", "continuations", "groupBy", "cont", "set", "DisposableTracker", "setDisposableTracker", "tracker", "__is_disposable_tracked__", "stack", "Disposable", "trackDisposable", "markAsDisposed", "setParentOfDisposable", "setParentOfDisposables", "children", "markAsSingleton", "singleton", "dispose", "arg", "Iterable", "errors", "d", "e", "combinedDisposable", "disposables", "parent", "toDisposable", "dispose", "setParentOfDisposables", "fn", "self", "trackDisposable", "createSingleCallFunction", "markAsDisposed", "_DisposableStore", "o", "setParentOfDisposable", "DisposableStore", "Disposable", "_Node", "element", "Node", "LinkedList", "node", "next", "atTheEnd", "newNode", "oldLast", "oldFirst", "didRemove", "res", "anchor", "hasPerformanceNow", "StopWatch", "_StopWatch", "highResolution", "_enableListenerGCedWarning", "_enableDisposeWithListenerWarning", "_enableSnapshotPotentialLeakWarning", "Event", "Disposable", "_addLeakageTraceLogic", "options", "origListenerDidAdd", "stack", "Stacktrace", "count", "defer", "event", "disposable", "debounce", "once", "listener", "thisArgs", "disposables", "didFire", "result", "e", "map", "snapshot", "i", "forEach", "each", "filter", "signal", "any", "events", "combinedDisposable", "addAndReturnDisposable", "reduce", "merge", "initial", "output", "emitter", "Emitter", "d", "store", "delay", "leading", "flushOnListenerRemove", "leakWarningThreshold", "subscription", "handle", "numDebouncedCalls", "doFire", "cur", "_output", "accumulate", "last", "latch", "equals", "a", "b", "firstCall", "cache", "value", "shouldEmit", "split", "isT", "buffer", "flushAfterTimeout", "_buffer", "flush", "chain", "sythensize", "cs", "ChainableSynthesis", "HaltChainable", "fn", "v", "step", "fromNodeEventEmitter", "eventName", "id", "args", "onFirstListenerAdd", "onLastListenerRemove", "fromDOMEventEmitter", "toPromise", "resolve", "fromPromise", "promise", "res", "forward", "from", "to", "runAndSubscribe", "handler", "EmitterObserver", "_observable", "_change", "fromObservable", "obs", "fromObservableLight", "observable", "didChange", "observer", "DisposableStore", "_EventProfiling", "name", "listenerCount", "StopWatch", "elapsed", "EventProfiling", "_globalLeakWarningThreshold", "_LeakageMonitor", "_errorHandler", "threshold", "name", "stack", "listenerCount", "count", "topStack", "topCount", "message", "error", "ListenerLeakError", "LeakageMonitor", "Stacktrace", "_Stacktrace", "value", "err", "ListenerRefusalError", "id", "UniqueContainer", "compactionThreshold", "forEachListener", "listeners", "fn", "i", "l", "_listenerFinalizers", "_enableListenerGCedWarning", "leaks", "heldValue", "Emitter", "options", "_globalLeakWarningThreshold", "onUnexpectedError", "EventProfiling", "_enableDisposeWithListenerWarning", "callback", "thisArgs", "disposables", "tuple", "Disposable", "contained", "removeMonitor", "EventDeliveryQueuePrivate", "result", "toDisposable", "DisposableStore", "match", "listener", "index", "adjustDeliveryQueue", "errorHandler", "e", "dq", "event", "EventDeliveryQueuePrivate", "emitter", "value", "end", "_WindowManager", "Emitter", "targetWindow", "zoomLevel", "targetWindowId", "zoomFactor", "fullscreen", "windowId", "WindowManager", "addMatchMediaChangeListener", "query", "callback", "onDidChangeZoomLevel", "WindowManager", "getZoomFactor", "targetWindow", "onDidChangeFullscreen", "WindowManager", "userAgent", "isFirefox", "isWebKit", "isChrome", "isSafari", "isElectron", "userAgent", "isAndroid", "standalone", "mainWindow", "standaloneMatchMedia", "fullScreenMatchMedia", "addMatchMediaChangeListener", "matches", "isStandalone", "LANGUAGE_DEFAULT", "_isWindows", "_isMacintosh", "_isLinux", "_isLinuxSnap", "_isNative", "_isWeb", "_isElectron", "_isIOS", "_isCI", "_isMobile", "_locale", "_language", "_platformLocale", "_translationsConfigFile", "_userAgent", "$globalThis", "nodeProcess", "isElectronProcess", "isElectronRenderer", "rawNlsConfig", "nlsConfig", "_platform", "_isMacintosh", "_isWindows", "_isLinux", "isWindows", "isMacintosh", "isLinux", "isNative", "_isNative", "isWebWorker", "_isWeb", "$globalThis", "webWorkerOrigin", "userAgent", "_userAgent", "language", "_language", "Language", "value", "isDefaultVariant", "isDefault", "setTimeout0IsFaster", "$globalThis", "setTimeout0", "pending", "len", "candidate", "lastId", "callback", "myId", "isChrome", "userAgent", "isFirefox", "isSafari", "isEdge", "isAndroid", "safeNavigator", "BrowserFeatures", "isNative", "isStandalone", "isSafari", "mainWindow", "KeyCodeStrMap", "keyCode", "str", "uiMap", "userSettingsUSMap", "userSettingsGeneralMap", "EVENT_KEY_CODE_MAP", "KeyCodeUtils", "toString", "keyCode", "uiMap", "fromString", "key", "toUserSettingsUS", "userSettingsUSMap", "toUserSettingsGeneral", "userSettingsGeneralMap", "fromUserSettings", "toElectronAccelerator", "KeyCodeChord", "_KeyCodeChord", "ctrlKey", "shiftKey", "altKey", "metaKey", "keyCode", "other", "ctrl", "shift", "alt", "meta", "Keybinding", "Keybinding", "chords", "illegalArgument", "result", "i", "len", "other", "extractKeyCode", "e", "char", "KeyCodeUtils", "keyCode", "isFirefox", "isLinux", "isMacintosh", "isWebKit", "EVENT_KEY_CODE_MAP", "ctrlKeyMod", "altKeyMod", "shiftKeyMod", "metaKeyMod", "StandardKeyboardEvent", "source", "extractKeyCode", "other", "key", "result", "ctrlKeyMod", "altKeyMod", "shiftKeyMod", "metaKeyMod", "KeyCodeChord", "sameOriginWindowChainCache", "getParentWindowIfSameOrigin", "w", "location", "parentLocation", "IframeUtils", "targetWindow", "windowChainCache", "parent", "childWindow", "ancestorWindow", "top", "left", "windowChain", "windowChainEl", "windowInChain", "boundingRect", "StandardMouseEvent", "targetWindow", "iframeOffsets", "IframeUtils", "StandardWheelEvent", "e", "deltaX", "deltaY", "shouldFactorDPR", "isChrome", "chromeVersionMatch", "e1", "e2", "devicePixelRatio", "ev", "isFirefox", "isMacintosh", "isSafari", "isWindows", "shortcutEvent", "callback", "context", "handle", "CancellationToken", "isCancellationToken", "thing", "MutableToken", "Event", "Emitter", "MicrotaskDelay", "TimeoutTimer", "runner", "timeout", "BugIndicatingError", "IntervalTimer", "interval", "context", "handle", "toDisposable", "runWhenGlobalIdle", "_runWhenIdle", "_targetWindow", "runner", "setTimeout0", "disposed", "end", "targetWindow", "timeout", "handle", "Promises", "settled", "promises", "firstError", "result", "promise", "value", "error", "withAsyncBody", "bodyFn", "resolve", "reject", "_AsyncIterableObject", "items", "writer", "promise", "emitter", "promises", "p", "iterables", "iterable", "item", "executor", "onReturn", "Emitter", "error", "err", "i", "Event", "mapFn", "filterFn", "result", "value", "values", "AsyncIterableObject", "isHighSurrogate", "charCode", "isLowSurrogate", "computeCodePoint", "highSurrogate", "lowSurrogate", "hash", "obj", "doHash", "hashVal", "numberHash", "arrayHash", "objectHash", "stringHash", "booleanHash", "val", "initialHashVal", "b", "i", "length", "arr", "item", "key", "leftRotate", "value", "bits", "totalBits", "delta", "mask", "fill", "dest", "index", "count", "i", "leftPad", "length", "char", "toHexString", "bufferOrValue", "bitsize", "b", "_StringSHA1", "str", "strLen", "buff", "buffLen", "leftoverHighSurrogate", "charCode", "offset", "codePoint", "isHighSurrogate", "nextCharCode", "isLowSurrogate", "computeCodePoint", "ml", "bigBlock32", "data", "j", "a", "c", "d", "e", "f", "k", "temp", "StringSHA1", "registerWindow", "getWindow", "getDocument", "getWindows", "getWindowsCount", "getWindowId", "getWindowById", "hasWindow", "onDidRegisterWindow", "onWillUnregisterWindow", "onDidUnregisterWindow", "windows", "mainWindow", "mainWindowRegistration", "DisposableStore", "Emitter", "windowId", "fallbackToMain", "window", "Disposable", "disposables", "registeredWindow", "toDisposable", "addDisposableListener", "EventType", "targetWindow", "e", "candidateNode", "candidateEvent", "DomListener", "node", "type", "handler", "options", "addDisposableListener", "useCaptureOrOptions", "_wrapAsStandardMouseEvent", "targetWindow", "StandardMouseEvent", "_wrapAsStandardKeyboardEvent", "e", "StandardKeyboardEvent", "addStandardDisposableListener", "useCapture", "wrapHandler", "getWindow", "runAtThisOrScheduleAtNextAnimationFrame", "scheduleAtNextAnimationFrame", "WindowIntervalTimer", "IntervalTimer", "node", "getWindow", "runner", "interval", "targetWindow", "AnimationFrameQueueItem", "priority", "e", "onUnexpectedError", "a", "b", "NEXT_QUEUE", "CURRENT_QUEUE", "animFrameRequested", "inAnimationFrameRunner", "animationFrameRunner", "targetWindowId", "currentQueue", "scheduleAtNextAnimationFrame", "getWindowId", "item", "nextQueue", "runAtThisOrScheduleAtNextAnimationFrame", "_Dimension", "width", "height", "obj", "a", "b", "Dimension", "getDomNodePagePosition", "domNode", "bb", "window", "getWindow", "sharedMutationObserver", "target", "disposables", "options", "mutationObserversPerTarget", "optionsHash", "hash", "mutationObserverPerOptions", "onDidMutate", "Emitter", "observer", "mutations", "resolvedMutationObserverPerOptions", "toDisposable", "EventType", "isWebKit", "SELECTOR_REGEX", "_$", "namespace", "description", "attrs", "children", "match", "SELECTOR_REGEX", "tagName", "result", "name", "value", "$", "FastDomNode", "domNode", "_maxWidth", "maxWidth", "numberAsPixels", "_width", "width", "_height", "height", "_top", "top", "_left", "left", "_bottom", "bottom", "_right", "right", "_paddingTop", "paddingTop", "_paddingLeft", "paddingLeft", "_paddingBottom", "paddingBottom", "_paddingRight", "paddingRight", "fontFamily", "fontWeight", "_fontSize", "fontSize", "fontStyle", "fontFeatureSettings", "fontVariationSettings", "textDecoration", "_lineHeight", "lineHeight", "_letterSpacing", "letterSpacing", "className", "shouldHaveIt", "display", "position", "visibility", "color", "backgroundColor", "layerHint", "boxShadow", "contain", "name", "value", "child", "createFastDomNode", "GlobalPointerMoveMonitor", "DisposableStore", "invokeStopCallback", "browserEvent", "onStopCallback", "initialElement", "pointerId", "initialButtons", "pointerMoveCallback", "eventSource", "toDisposable", "getWindow", "addDisposableListener", "EventType", "e", "memoize", "_target", "key", "descriptor", "fnKey", "fn", "memoizeKey", "args", "EventType", "_Gesture", "Disposable", "LinkedList", "Event", "onDidRegisterWindow", "window", "disposables", "addDisposableListener", "e", "mainWindow", "element", "markAsSingleton", "remove", "toDisposable", "timestamp", "i", "len", "touch", "evt", "targetWindow", "activeTouchCount", "data", "holdTime", "tail", "finalX", "finalY", "deltaT", "deltaX", "deltaY", "dispatchTo", "t", "type", "initialTarget", "event", "currentTime", "setTapCount", "ignoreTarget", "targets", "target", "depth", "now", "a", "b", "_", "t1", "vX", "dirX", "x", "vY", "dirY", "y", "scheduleAtNextAnimationFrame", "delta_pos_x", "delta_pos_y", "stopped", "d", "__decorateClass", "memoize", "Gesture", "Widget", "Disposable", "domNode", "listener", "addDisposableListener", "EventType", "e", "StandardMouseEvent", "getWindow", "StandardKeyboardEvent", "Gesture", "ARROW_IMG_SIZE", "ScrollbarArrow", "Widget", "opts", "GlobalPointerMoveMonitor", "addStandardDisposableListener", "EventType", "WindowIntervalTimer", "TimeoutTimer", "e", "scheduleRepeater", "getWindow", "pointerMoveData", "ScrollState", "_ScrollState", "_forceIntegerValues", "width", "scrollWidth", "scrollLeft", "height", "scrollHeight", "scrollTop", "other", "update", "useRawScrollPositions", "previous", "inSmoothScrolling", "widthChanged", "scrollWidthChanged", "scrollLeftChanged", "heightChanged", "scrollHeightChanged", "scrollTopChanged", "Scrollable", "Disposable", "options", "Emitter", "smoothScrollDuration", "scrollPosition", "dimensions", "newState", "reuseAnimation", "validTarget", "newSmoothScrolling", "SmoothScrollingOperation", "oldState", "SmoothScrollingUpdate", "isDone", "createEaseOutCubic", "from", "to", "delta", "completion", "easeOutCubic", "createComposed", "a", "b", "cut", "_SmoothScrollingOperation", "startTime", "duration", "viewportSize", "stop1", "stop2", "state", "now", "newScrollLeft", "newScrollTop", "easeInCubic", "t", "ScrollbarVisibilityController", "Disposable", "visibility", "visibleClassName", "invisibleClassName", "TimeoutTimer", "rawShouldBeVisible", "shouldBeVisible", "isNeeded", "domNode", "withFadeAway", "POINTER_DRAG_RESET_DISTANCE", "AbstractScrollbar", "Widget", "opts", "ScrollbarVisibilityController", "GlobalPointerMoveMonitor", "createFastDomNode", "addDisposableListener", "EventType", "arrow", "ScrollbarArrow", "top", "left", "width", "height", "e", "visibleSize", "elementScrollSize", "elementScrollPosition", "domTop", "sliderStart", "sliderStop", "pointerPos", "offsetX", "offsetY", "domNodePosition", "getDomNodePagePosition", "offset", "initialPointerPosition", "initialPointerOrthogonalPosition", "initialScrollbarState", "pointerMoveData", "pointerOrthogonalPosition", "pointerOrthogonalDelta", "isWindows", "pointerDelta", "_desiredScrollPosition", "desiredScrollPosition", "scrollbarSize", "ScrollbarState", "_ScrollbarState", "arrowSize", "scrollbarSize", "oppositeScrollbarSize", "visibleSize", "scrollSize", "scrollPosition", "iVisibleSize", "iScrollSize", "iScrollPosition", "computedAvailableSize", "computedRepresentableSize", "computedIsNeeded", "computedSliderSize", "computedSliderRatio", "computedSliderPosition", "r", "offset", "desiredSliderPosition", "correctedOffset", "desiredScrollPosition", "delta", "HorizontalScrollbar", "AbstractScrollbar", "scrollable", "options", "host", "scrollDimensions", "scrollPosition", "ScrollbarState", "sliderSize", "sliderPosition", "largeSize", "smallSize", "e", "offsetX", "offsetY", "size", "target", "VerticalScrollbar", "AbstractScrollbar", "scrollable", "options", "host", "scrollDimensions", "scrollPosition", "ScrollbarState", "sliderSize", "sliderPosition", "largeSize", "smallSize", "e", "offsetX", "offsetY", "size", "target", "HIDE_TIMEOUT", "SCROLL_WHEEL_SENSITIVITY", "SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED", "MouseWheelClassifierItem", "timestamp", "deltaX", "deltaY", "_MouseWheelClassifier", "remainingInfluence", "score", "iteration", "index", "influence", "e", "isChrome", "targetWindow", "getWindow", "pageZoomFactor", "getZoomFactor", "previousItem", "item", "absDeltaX", "absDeltaY", "absPreviousDeltaX", "absPreviousDeltaY", "minDeltaX", "minDeltaY", "maxDeltaX", "maxDeltaY", "value", "MouseWheelClassifier", "AbstractScrollableElement", "Widget", "element", "options", "scrollable", "Emitter", "resolveOptions", "scrollbarHost", "mouseWheelEvent", "VerticalScrollbar", "HorizontalScrollbar", "createFastDomNode", "TimeoutTimer", "dispose", "browserEvent", "dimensions", "newClassName", "isMacintosh", "newOptions", "StandardWheelEvent", "shouldListen", "onMouseWheel", "addDisposableListener", "EventType", "classifier", "didScroll", "shiftConvert", "futureScrollPosition", "desiredScrollPosition", "deltaScrollTop", "desiredScrollTop", "deltaScrollLeft", "desiredScrollLeft", "consumeMouseWheel", "scrollState", "enableTop", "enableLeft", "leftClassName", "topClassName", "topLeftClassName", "SmoothScrollableElement", "AbstractScrollableElement", "element", "options", "scrollable", "update", "resolveOptions", "opts", "result", "isMacintosh", "Emitter", "listener", "thisArgs", "disposables", "toDisposable", "entry", "result", "idx", "event", "fn", "listeners", "EventUtils", "forward", "from", "to", "e", "map", "i", "any", "events", "store", "DisposableStore", "runAndSubscribe", "handler", "Viewport", "Disposable", "element", "screenElement", "_bufferService", "coreBrowserService", "coreMouseService", "themeService", "_optionsService", "_renderService", "Emitter", "scrollable", "Scrollable", "cb", "scheduleAtNextAnimationFrame", "SmoothScrollableElement", "type", "EventUtils", "toDisposable", "e", "Gesture", "addDisposableListener", "EventType", "disp", "pos", "line", "disableSmoothScroll", "ydisp", "newRow", "diff", "__decorateClass", "__decorateParam", "IBufferService", "ICoreBrowserService", "ICoreMouseService", "IThemeService", "IOptionsService", "IRenderService", "BufferDecorationRenderer", "Disposable", "_screenElement", "_bufferService", "_coreBrowserService", "_decorationService", "_renderService", "decoration", "toDisposable", "element", "x", "line", "__decorateClass", "__decorateParam", "IBufferService", "ICoreBrowserService", "IDecorationService", "IRenderService", "ColorZoneStore", "decoration", "z", "padding", "zone", "line", "position", "drawHeight", "drawWidth", "drawX", "OverviewRulerRenderer", "Disposable", "_viewportElement", "_screenElement", "_bufferService", "_decorationService", "_renderService", "_optionsService", "_themeService", "_coreBrowserService", "ColorZoneStore", "toDisposable", "ctx", "outerWidth", "innerWidth", "pixelsPerLine", "nonFullHeight", "decoration", "zones", "zone", "updateCanvasDimensions", "updateAnchor", "__decorateClass", "__decorateParam", "IBufferService", "IDecorationService", "IRenderService", "IOptionsService", "IThemeService", "ICoreBrowserService", "CompositionHelper", "_textarea", "_compositionView", "_bufferService", "_optionsService", "_coreService", "_renderService", "ev", "waitForPropagation", "currentCompositionPosition", "input", "oldValue", "newValue", "diff", "dontRecurse", "cursorX", "cellHeight", "cursorTop", "cursorLeft", "compositionViewBounds", "__decorateClass", "__decorateParam", "IBufferService", "IOptionsService", "ICoreService", "IRenderService", "$r", "$g", "$b", "$a", "NULL_COLOR", "channels", "toCss", "g", "b", "toPaddedHex", "toRgba", "toColor", "color", "blend", "bg", "fg", "fgR", "fgG", "fgB", "bgR", "bgG", "bgB", "css", "rgba", "isOpaque", "ensureContrastRatio", "ratio", "result", "opaque", "rgbaColor", "opacity", "multiplyOpacity", "factor", "toColorRGB", "$ctx", "$litmusColor", "canvas", "ctx", "rgbaMatch", "rgb", "relativeLuminance", "relativeLuminance2", "r", "rs", "gs", "bs", "rr", "rg", "rb", "bgRgba", "fgRgba", "bgL", "fgL", "contrastRatio", "resultA", "reduceLuminance", "resultARatio", "resultB", "increaseLuminance", "resultBRatio", "cr", "toChannels", "value", "c", "s", "l1", "l2", "JoinedCellData", "AttributeData", "firstCell", "chars", "width", "value", "CharacterJoinerService", "_bufferService", "CellData", "handler", "joiner", "joinerId", "i", "row", "line", "ranges", "lineStr", "rangeStartColumn", "currentStringIndex", "rangeStartStringIndex", "rangeAttrFG", "rangeAttrBG", "x", "joinedRanges", "startIndex", "endIndex", "lineData", "startCol", "text", "allJoinedRanges", "error", "joinerRanges", "j", "currentRangeIndex", "currentRangeStarted", "currentRange", "length", "newRange", "inRange", "range", "__decorateClass", "__decorateParam", "IBufferService", "throwIfFalsy", "value", "isPowerlineGlyph", "codepoint", "isBoxOrBlockGlyph", "codepoint", "treatGlyphAsBackgroundColor", "codepoint", "isPowerlineGlyph", "isBoxOrBlockGlyph", "createRenderDimensions", "createDimension", "DomRendererRowFactory", "_document", "_characterJoinerService", "_optionsService", "_coreBrowserService", "_coreService", "_decorationService", "_themeService", "CellData", "start", "end", "columnSelectMode", "lineData", "row", "isCursorRow", "cursorStyle", "cursorInactiveStyle", "cursorX", "cursorBlink", "cellWidth", "widthCache", "linkStart", "linkEnd", "elements", "joinedRanges", "colors", "lineLength", "charElement", "cellAmount", "text", "i", "oldBg", "oldFg", "oldExt", "oldLinkHover", "oldSpacing", "oldIsInSelection", "spacing", "skipJoinedCheckUntilX", "classes", "hasHover", "x", "width", "isJoined", "isValidJoinRange", "lastCharX", "cell", "range", "firstSelectionState", "JoinedCellData", "isInSelection", "isCursorCell", "isLinkHover", "isDecorated", "d", "chars", "AttributeData", "fg", "fgColorMode", "bg", "bgColorMode", "isInverse", "temp", "temp2", "bgOverride", "fgOverride", "isTop", "resolvedBg", "channels", "color", "element", "treatGlyphAsBackgroundColor", "cache", "adjustedColor", "ratio", "style", "y", "__decorateClass", "__decorateParam", "ICharacterJoinerService", "IOptionsService", "ICoreBrowserService", "ICoreService", "IDecorationService", "IThemeService", "WidthCache", "canvasFactory", "WidthCacheFontVariantCanvas", "font", "fontSize", "weight", "weightBold", "c", "bold", "italic", "cp", "width", "key", "variant", "throwIfFalsy", "fontFamily", "fontWeight", "fontStyle", "SelectionRenderModel", "terminal", "start", "end", "columnSelectMode", "viewportY", "viewportStartRow", "viewportEndRow", "viewportCappedStartRow", "viewportCappedEndRow", "x", "y", "createSelectionRenderModel", "TERMINAL_CLASS_PREFIX", "ROW_CONTAINER_CLASS", "FG_CLASS_PREFIX", "BG_CLASS_PREFIX", "FOCUS_CLASS", "SELECTION_CLASS", "CURSOR_BLINK_IDLE_CLASS", "nextTerminalId", "DomRenderer", "Disposable", "_terminal", "_document", "_element", "_screenElement", "_viewportElement", "_helperContainer", "_linkifier2", "instantiationService", "_charSizeService", "_optionsService", "_bufferService", "_coreService", "_coreBrowserService", "_themeService", "createSelectionRenderModel", "Emitter", "createRenderDimensions", "e", "DomRendererRowFactory", "CursorBlinkStateManager", "addDisposableListener", "toDisposable", "WidthCache", "dpr", "element", "styles", "colors", "color", "blinkAnimationUnderlineId", "blinkAnimationBarId", "blinkAnimationBlockId", "i", "c", "spacing", "cols", "rows", "row", "start", "end", "columnSelectMode", "viewportStartRow", "viewportEndRow", "viewportCappedStartRow", "viewportCappedEndRow", "documentFragment", "isXFlipped", "startCol", "endCol", "middleRowsCount", "colStart", "colEnd", "rowCount", "left", "width", "buffer", "cursorAbsoluteY", "cursorX", "cursorBlink", "cursorStyle", "cursorInactiveStyle", "y", "rowElement", "lineData", "x", "x2", "y2", "enabled", "maxY", "bufferline", "__decorateClass", "__decorateParam", "IInstantiationService", "ICharSizeService", "IOptionsService", "IBufferService", "ICoreService", "ICoreBrowserService", "IThemeService", "_rowContainer", "CharSizeService", "Disposable", "document", "parentElement", "_optionsService", "Emitter", "TextMetricsMeasureStrategy", "DomMeasureStrategy", "result", "__decorateClass", "__decorateParam", "IOptionsService", "BaseMeasureStategy", "Disposable", "width", "height", "DomMeasureStrategy", "_document", "_parentElement", "_optionsService", "TextMetricsMeasureStrategy", "a", "metrics", "CoreBrowserService", "Disposable", "_textarea", "_window", "mainDocument", "ScreenDprMonitor", "Emitter", "w", "EventUtils", "addDisposableListener", "value", "_parentWindow", "MutableDisposable", "toDisposable", "parentWindow", "LinkProviderService", "Disposable", "toDisposable", "linkProvider", "providerIndex", "getCoordsRelativeToElement", "window", "event", "element", "rect", "elementStyle", "leftPadding", "topPadding", "getCoords", "colCount", "rowCount", "hasValidCharSize", "cssCellWidth", "cssCellHeight", "isSelection", "coords", "MouseService", "_renderService", "_charSizeService", "event", "element", "colCount", "rowCount", "isSelection", "getCoords", "coords", "getCoordsRelativeToElement", "getWindow", "__decorateClass", "__decorateParam", "IRenderService", "ICharSizeService", "RenderDebouncer", "_renderCallback", "_coreBrowserService", "callback", "rowStart", "rowEnd", "rowCount", "start", "end", "Platform_exports", "__export", "getSafariVersion", "isChromeOS", "isFirefox", "isLegacyEdge", "isLinux", "isMac", "isNode", "isSafari", "isWindows", "userAgent", "platform", "majorVersion", "TaskQueue", "task", "deadline", "taskDuration", "longestTask", "lastDeadlineRemaining", "deadlineRemaining", "PriorityTaskQueue", "callback", "identifier", "duration", "end", "IdleTaskQueueInternal", "IdleTaskQueue", "isNode", "DebouncedIdleTask", "RenderService", "Disposable", "_rowCount", "screenElement", "_optionsService", "_charSizeService", "_coreService", "decorationService", "bufferService", "_coreBrowserService", "themeService", "MutableDisposable", "DebouncedIdleTask", "Emitter", "RenderDebouncer", "start", "end", "SynchronizedOutputHandler", "toDisposable", "w", "observer", "e", "entry", "sync", "isRedrawOnly", "buffered", "cols", "rows", "renderer", "callback", "columnSelectMode", "__decorateClass", "__decorateParam", "IOptionsService", "ICharSizeService", "ICoreService", "IDecorationService", "IBufferService", "ICoreBrowserService", "IThemeService", "_onTimeout", "result", "moveToCellSequence", "targetX", "targetY", "bufferService", "applicationCursor", "startX", "startY", "resetStartingRow", "moveToRequestedRow", "moveToRequestedCol", "direction", "repeat", "sequence", "rowDifference", "cellsToMove", "colsFromRowEnd", "colsFromRowBeginning", "currX", "bufferLine", "wrappedRowsForRow", "startRow", "endRow", "rowsToMove", "wrappedRowsCount", "verticalDirection", "horizontalDirection", "wrappedRows", "i", "currentRow", "rowCount", "line", "lineWraps", "startCol", "endCol", "forward", "currentCol", "bufferStr", "mod", "count", "str", "rpt", "SelectionModel", "_bufferService", "startPlusLength", "start", "end", "amount", "getRangeLength", "range", "bufferCols", "DRAG_SCROLL_MAX_THRESHOLD", "DRAG_SCROLL_MAX_SPEED", "DRAG_SCROLL_INTERVAL", "ALT_CLICK_MOVE_CURSOR_TIME", "NON_BREAKING_SPACE_CHAR", "ALL_NON_BREAKING_SPACE_REGEX", "SelectionService", "Disposable", "_element", "_screenElement", "_linkifier", "_bufferService", "_coreService", "_mouseService", "_optionsService", "_renderService", "_coreBrowserService", "CellData", "Emitter", "event", "amount", "e", "SelectionModel", "toDisposable", "start", "end", "buffer", "result", "startCol", "endCol", "i", "lineText", "startRowEndCol", "bufferLine", "line", "ALL_NON_BREAKING_SPACE_REGEX", "isWindows", "isLinuxMouseSelection", "isLinux", "coords", "x", "y", "allowWhitespaceOnlySelection", "range", "getRangeLength", "offset", "getCoordsRelativeToElement", "terminalHeight", "DRAG_SCROLL_MAX_THRESHOLD", "DRAG_SCROLL_MAX_SPEED", "isMac", "DRAG_SCROLL_INTERVAL", "hadSelection", "previousSelectionEnd", "timeElapsed", "ALT_CLICK_MOVE_CURSOR_TIME", "coordinates", "sequence", "moveToCellSequence", "hasSelection", "charIndex", "length", "col", "row", "ev", "followWrappedLinesAbove", "followWrappedLinesBelow", "startIndex", "endIndex", "charOffset", "leftWideCharCount", "rightWideCharCount", "leftLongCharOffset", "rightLongCharOffset", "previousBufferLine", "previousLineWordPosition", "nextBufferLine", "nextLineWordPosition", "wordPosition", "endRow", "cell", "wrappedRange", "__decorateClass", "__decorateParam", "IBufferService", "ICoreService", "IMouseService", "IOptionsService", "IRenderService", "ICoreBrowserService", "TwoKeyMap", "first", "second", "value", "ColorContrastCache", "TwoKeyMap", "bg", "fg", "value", "DEFAULT_ANSI_COLORS", "colors", "css", "v", "i", "r", "g", "b", "channels", "c", "DEFAULT_FOREGROUND", "css", "DEFAULT_BACKGROUND", "DEFAULT_CURSOR", "DEFAULT_CURSOR_ACCENT", "DEFAULT_SELECTION", "DEFAULT_OVERVIEW_RULER_BORDER", "ThemeService", "Disposable", "_optionsService", "ColorContrastCache", "Emitter", "color", "DEFAULT_ANSI_COLORS", "theme", "colors", "parseColor", "NULL_COLOR", "colorCount", "i", "slot", "callback", "__decorateClass", "__decorateParam", "IOptionsService", "cssString", "fallback", "KEYCODE_KEY_MAPPINGS", "evaluateKeyboardEvent", "ev", "applicationCursorMode", "isMac", "macOptionIsMeta", "result", "modifiers", "key", "keyCode", "keyString", "KittyKeyboard", "ev", "suffix", "mods", "numpadCode", "modifierCode", "funcCode", "digit", "code", "letter", "modifiers", "eventType", "reportEventTypes", "needsEventType", "seq", "number", "keyCode", "flags", "isFunc", "isMod", "reportAlternateKeys", "shiftedKey", "textCode", "result", "csiLetter", "ss3Letter", "tildeCode", "useCsiU", "Win32InputMode", "ev", "vk", "controlChar", "codePoint", "state", "isKeyDown", "sc", "uc", "kd", "cs", "KeyboardService", "_coreService", "_optionsService", "Win32InputMode", "KittyKeyboard", "event", "kittyFlags", "evaluateKeyboardEvent", "isMac", "__decorateClass", "__decorateParam", "ICoreService", "IOptionsService", "ServiceCollection", "entries", "id", "service", "instance", "result", "callback", "key", "value", "InstantiationService", "IInstantiationService", "ctor", "args", "serviceDependencies", "getServiceDependencies", "a", "b", "serviceArgs", "dependency", "firstServiceArgPos", "optionsKeyToLogLevel", "LOG_PREFIX", "LogService", "Disposable", "_optionsService", "optionalParams", "type", "message", "__decorateClass", "__decorateParam", "IOptionsService", "CircularList", "Disposable", "_maxLength", "Emitter", "newMaxLength", "newArray", "i", "newLength", "index", "value", "start", "deleteCount", "items", "countToTrim", "count", "offset", "expandListBy", "CELL_SIZE", "DEFAULT_ATTR_DATA", "AttributeData", "$startIndex", "$workCell", "CellData", "CLEANUP_THRESHOLD", "BufferLine", "_BufferLine", "cols", "fillCellData", "isWrapped", "CELL_SIZE", "cell", "i", "index", "content", "cp", "stringFromCodePoint", "value", "codePoint", "width", "attrs", "pos", "n", "start", "end", "respectProtect", "uint32Cells", "data", "keys", "key", "extKeys", "line", "el", "newLine", "src", "srcCol", "destCol", "length", "applyInReverse", "srcData", "srcCombinedKeys", "trimRight", "startCol", "endCol", "outColumns", "result", "chars", "reflowLargerGetLinesToRemove", "lines", "oldCols", "newCols", "bufferAbsoluteY", "nullCell", "reflowCursorLine", "toRemove", "y", "i", "nextLine", "wrappedLines", "destLineIndex", "destCol", "getWrappedLineTrimmedLength", "srcLineIndex", "srcCol", "srcTrimmedTineLength", "srcRemainingCells", "destRemainingCells", "cellsToCopy", "countToRemove", "reflowLargerCreateNewLayout", "layout", "nextToRemoveIndex", "nextToRemoveStart", "countRemovedSoFar", "reflowLargerApplyNewLayout", "newLayout", "newLayoutLines", "reflowSmallerGetNewLineLengths", "newLineLengths", "cellsNeeded", "p", "c", "srcLine", "cellsAvailable", "oldTrimmedLength", "endsWithWide", "lineLength", "cols", "endsInNull", "followingLineStartsWithWide", "_Marker", "line", "Emitter", "dispose", "disposable", "Marker", "CHARSETS", "DEFAULT_CHARSET", "MAX_BUFFER_SIZE", "Buffer", "_hasScrollback", "_optionsService", "_bufferService", "DEFAULT_ATTR_DATA", "DEFAULT_CHARSET", "CellData", "IdleTaskQueue", "CircularList", "attr", "ExtendedAttrs", "isWrapped", "BufferLine", "relativeY", "rows", "correctBufferLength", "fillAttr", "i", "newCols", "newRows", "nullCell", "dirtyMemoryLines", "newMaxLength", "addToY", "y", "amountToTrim", "maxY", "normalRun", "counted", "windowsPty", "reflowCursorLine", "toRemove", "reflowLargerGetLinesToRemove", "newLayoutResult", "reflowLargerCreateNewLayout", "reflowLargerApplyNewLayout", "countRemoved", "viewportAdjustments", "toInsert", "countToInsert", "nextLine", "wrappedLines", "absoluteY", "lastLineLength", "destLineLengths", "reflowSmallerGetNewLineLengths", "linesToAdd", "trimmedLines", "newLines", "newLine", "destLineIndex", "destCol", "srcLineIndex", "srcCol", "cellsToCopy", "wrappedLinesIndex", "getWrappedLineTrimmedLength", "insertEvents", "originalLines", "originalLinesLength", "originalLineIndex", "nextToInsertIndex", "nextToInsert", "countInsertedSoFar", "nextI", "insertCountEmitted", "lineIndex", "trimRight", "startCol", "endCol", "line", "first", "last", "x", "marker", "Marker", "amount", "event", "BufferSet", "Disposable", "_optionsService", "_bufferService", "Emitter", "Buffer", "fillAttr", "newCols", "newRows", "i", "MINIMUM_COLS", "MINIMUM_ROWS", "BufferService", "Disposable", "optionsService", "Emitter", "BufferSet", "e", "cols", "rows", "colsChanged", "rowsChanged", "eraseAttr", "isWrapped", "buffer", "newLine", "topRow", "bottomRow", "willBufferBeTrimmed", "scrollRegionHeight", "disp", "suppressScrollEvent", "oldYdisp", "__decorateClass", "__decorateParam", "IOptionsService", "DEFAULT_OPTIONS", "isMac", "FONT_WEIGHT_OPTIONS", "OptionsService", "Disposable", "options", "Emitter", "defaultOptions", "key", "newValue", "e", "toDisposable", "listener", "eventKey", "keys", "getter", "propName", "setter", "value", "desc", "isCursorStyle", "clone", "val", "depth", "clonedObject", "key", "DEFAULT_MODES", "DEFAULT_DEC_PRIVATE_MODES", "DEFAULT_KITTY_KEYBOARD_STATE", "CoreService", "Disposable", "_bufferService", "_logService", "_optionsService", "Emitter", "clone", "data", "wasUserInput", "buffer", "e", "__decorateClass", "__decorateParam", "IBufferService", "ILogService", "IOptionsService", "DEFAULT_PROTOCOLS", "e", "eventCode", "e", "isSGR", "code", "S", "DEFAULT_ENCODINGS", "params", "final", "CoreMouseService", "Disposable", "_bufferService", "_coreService", "_optionsService", "Emitter", "name", "DEFAULT_PROTOCOLS", "protocol", "encoding", "ev", "cellHeight", "dpr", "targetWheelEventPixels", "amount", "report", "events", "e1", "e2", "pixels", "__decorateClass", "__decorateParam", "IBufferService", "ICoreService", "IOptionsService", "BMP_COMBINING", "HIGH_COMBINING", "table", "bisearch", "ucs", "data", "min", "max", "mid", "UnicodeV6", "r", "num", "codepoint", "preceding", "width", "shouldJoin", "oldWidth", "UnicodeService", "UnicodeService", "_UnicodeService", "Emitter", "defaultProvider", "UnicodeV6", "value", "state", "width", "shouldJoin", "version", "provider", "num", "s", "result", "precedingInfo", "length", "i", "code", "second", "currentInfo", "chWidth", "codepoint", "preceding", "CharsetService", "g", "charset", "updateWindowsModeWrappedState", "bufferService", "lastChar", "nextLine", "MAX_VALUE", "MAX_SUBPARAMS", "Params", "_Params", "maxLength", "maxSubParamsLength", "values", "params", "value", "k", "newParams", "res", "i", "start", "end", "idx", "result", "length", "store", "cur", "EMPTY_HANDLERS", "OscParser", "ident", "handler", "handlerList", "handlerIndex", "j", "data", "start", "end", "utf32ToString", "code", "success", "promiseResult", "handlerResult", "fallThrough", "_OscHandler", "_handler", "ret", "res", "OscHandler", "EMPTY_HANDLERS", "DcsParser", "ident", "handler", "handlerList", "handlerIndex", "j", "params", "data", "start", "end", "utf32ToString", "success", "promiseResult", "handlerResult", "fallThrough", "EMPTY_PARAMS", "Params", "_DcsHandler", "_handler", "ret", "res", "DcsHandler", "EMPTY_HANDLERS", "ApcParser", "ident", "handler", "handlerList", "handlerIndex", "j", "data", "start", "end", "utf32ToString", "success", "promiseResult", "handlerResult", "fallThrough", "_ApcHandler", "_handler", "ret", "res", "ApcHandler", "TransitionTable", "length", "action", "next", "code", "state", "codes", "i", "NON_ASCII_PRINTABLE", "VT500_TRANSITION_TABLE", "table", "blueprint", "unused", "r", "start", "end", "PRINTABLES", "EXECUTABLES", "states", "EscapeSequenceParser", "Disposable", "_transitions", "Params", "data", "ident", "params", "toDisposable", "OscParser", "DcsParser", "ApcParser", "id", "finalRange", "res", "intermediate", "finalCode", "handler", "handlerList", "handlerIndex", "flag", "callback", "handlers", "handlerPos", "transition", "chunkPos", "promiseResult", "handlerResult", "j", "handlersEsc", "jj", "RGB_REX", "HASH_REX", "parseColor", "data", "low", "m", "base", "adv", "result", "i", "c", "pad", "n", "bits", "s", "s2", "toRgbString", "color", "r", "g", "b", "XTERM_VERSION", "GLEVEL", "MAX_PARSEBUFFER_LENGTH", "STACK_LIMIT", "paramToWindowOption", "n", "opts", "SLOW_ASYNC_LIMIT", "$temp", "InputHandler", "Disposable", "_bufferService", "_charsetService", "_coreService", "_logService", "_optionsService", "_oscLinkService", "_coreMouseService", "_unicodeService", "_parser", "EscapeSequenceParser", "StringToUtf32", "Utf8ToUtf32", "DEFAULT_ATTR_DATA", "Emitter", "DirtyRowTracker", "e", "ident", "params", "code", "identifier", "action", "data", "payload", "start", "end", "OscHandler", "flag", "CHARSETS", "state", "DcsHandler", "cursorStartX", "cursorStartY", "decodedLength", "position", "p", "slowTimeout", "slowPromise", "_res", "rej", "err", "promiseResult", "result", "wasPaused", "MAX_PARSEBUFFER_LENGTH", "i", "len", "viewportEnd", "viewportStart", "chWidth", "charset", "screenReaderMode", "cols", "wraparoundMode", "insertMode", "curAttr", "bufferRow", "precedingJoinState", "pos", "ch", "currentInfo", "UnicodeService", "shouldJoin", "oldWidth", "stringFromCodePoint", "oldRow", "oldCol", "BufferLine", "offset", "delta", "id", "callback", "paramToWindowOption", "ApcHandler", "line", "originalX", "maxCol", "x", "y", "diffToTop", "diffToBottom", "param", "clearWrap", "respectProtect", "j", "nextLine", "scrollBackSize", "row", "scrollBottomRowsOffset", "scrollBottomAbsolute", "joinState", "length", "text", "idata", "itext", "tlength", "XTERM_VERSION", "term", "DEFAULT_CHARSET", "ansi", "V", "dm", "mouseProtocol", "mouseEncoding", "cs", "buffers", "active", "alt", "opts", "f", "m", "v", "b2v", "value", "color", "mode", "c1", "c2", "c3", "AttributeData", "attr", "accu", "cSpace", "advance", "subparams", "style", "l", "isBlinking", "top", "bottom", "second", "STACK_LIMIT", "event", "slots", "idx", "spec", "index", "isValidColorIndex", "parseColor", "uri", "parsedParams", "idParamIndex", "collectAndFlag", "GLEVEL", "scrollRegionHeight", "level", "cell", "CellData", "yOffset", "s", "b", "STYLES", "y1", "y2", "flags", "stack", "count", "__decorateClass", "__decorateParam", "IBufferService", "DISCARD_WATERMARK", "WRITE_TIMEOUT_MS", "WRITE_BUFFER_LENGTH_THRESHOLD", "WriteBuffer", "Disposable", "_action", "Emitter", "chunk", "cb", "data", "maxSubsequentCalls", "callback", "lastTime", "promiseResult", "startTime", "result", "continuation", "r", "err", "OscLinkService", "_bufferService", "data", "buffer", "marker", "entry", "castData", "key", "match", "linkId", "y", "e", "linkData", "index", "__decorateClass", "__decorateParam", "IBufferService", "hasWriteSyncWarnHappened", "CoreTerminal", "Disposable", "options", "MutableDisposable", "Emitter", "InstantiationService", "OptionsService", "IOptionsService", "BufferService", "IBufferService", "LogService", "ILogService", "CoreService", "ICoreService", "CoreMouseService", "ICoreMouseService", "UnicodeService", "IUnicodeService", "CharsetService", "ICharsetService", "OscLinkService", "IOscLinkService", "InputHandler", "EventUtils", "WriteBuffer", "data", "promiseResult", "ev", "key", "callback", "maxSubsequentCalls", "wasUserInput", "x", "y", "MINIMUM_COLS", "MINIMUM_ROWS", "eraseAttr", "isWrapped", "disp", "suppressScrollEvent", "pageCount", "disableSmoothScroll", "line", "scrollAmount", "id", "ident", "value", "windowsPty", "disposables", "updateWindowsModeWrappedState", "toDisposable", "d", "i", "SortedList", "_getKey", "IdleTaskQueue", "value", "sortedAddedValues", "a", "b", "sortedAddedValuesIndex", "arrayIndex", "newArray", "newArrayIndex", "key", "sortedDeletedIndices", "sortedDeletedIndicesIndex", "callback", "min", "max", "mid", "midKey", "$xmin", "$xmax", "$ymin", "$ymax", "DecorationService", "Disposable", "SortedList", "Emitter", "toDisposable", "options", "decoration", "Decoration", "markerDispose", "listener", "d", "x", "line", "layer", "xmin", "xmax", "ymin", "ymax", "callback", "DisposableStore", "css", "RENDER_DEBOUNCE_THRESHOLD_MS", "TimeBasedDebouncer", "_renderCallback", "_debounceThresholdMS", "rowStart", "rowEnd", "rowCount", "refreshRequestTime", "elapsed", "waitPeriodBeforeTrailingRefresh", "start", "end", "MAX_ROWS_TO_READ", "DEBUG", "AccessibilityManager", "Disposable", "_terminal", "instantiationService", "_coreBrowserService", "_renderService", "doc", "i", "e", "TimeBasedDebouncer", "char", "spaceCount", "addDisposableListener", "toDisposable", "MAX_ROWS_TO_READ", "tooMuchOutput", "keyChar", "start", "end", "buffer", "setSize", "line", "columns", "lineData", "posInSet", "element", "position", "boundaryElement", "beforeBoundaryElement", "lastRowPos", "topBoundaryElement", "bottomBoundaryElement", "newElement", "selection", "begin", "lastRowElement", "toRowColumn", "node", "offset", "rowElement", "row", "column", "beginRowColumn", "endRowColumn", "rows", "width", "lastColumn", "targetWidth", "__decorateClass", "__decorateParam", "IInstantiationService", "ICoreBrowserService", "IRenderService", "Linkifier", "Disposable", "_element", "_mouseService", "_renderService", "_bufferService", "_linkProviderService", "Emitter", "toDisposable", "dispose", "addDisposableListener", "event", "position", "composedPath", "i", "target", "useLineCache", "reply", "linkWithState", "linkProvided", "linkProvider", "links", "linksWithState", "link", "y", "replies", "occupiedCells", "providerReply", "startX", "endX", "x", "index", "hasLinkBefore", "j", "linkAtPosition", "currentLink", "linkEquals", "startRow", "endRow", "v", "e", "start", "end", "element", "showEvent", "range", "scrollOffset", "lower", "upper", "current", "mouseService", "coords", "x1", "y1", "x2", "y2", "fg", "__decorateClass", "__decorateParam", "IMouseService", "IRenderService", "IBufferService", "ILinkProviderService", "a", "b", "CoreBrowserTerminal", "CoreTerminal", "options", "MutableDisposable", "Platform_exports", "Emitter", "DecorationService", "IDecorationService", "KeyboardService", "IKeyboardService", "LinkProviderService", "ILinkProviderService", "OscLinkProvider", "e", "type", "event", "EventUtils", "toDisposable", "dimensions", "req", "acc", "ident", "colorRgb", "color", "toRgbString", "colors", "channels", "narrowedAcc", "bgLuminance", "rgb", "fgLuminance", "colorSchemeMode", "value", "AccessibilityManager", "ev", "cursorY", "bufferLine", "cursorX", "cellHeight", "width", "cellWidth", "cursorTop", "cursorLeft", "addDisposableListener", "copyHandler", "pasteHandlerWrapper", "handlePasteEvent", "isFirefox", "rightClickHandler", "isLinux", "moveTextAreaUnderMouseCursor", "parent", "fragment", "textarea", "promptLabel", "isChromeOS", "CoreBrowserService", "ICoreBrowserService", "CharSizeService", "ICharSizeService", "ThemeService", "IThemeService", "CharacterJoinerService", "ICharacterJoinerService", "RenderService", "IRenderService", "CompositionHelper", "MouseService", "IMouseService", "linkifier", "Linkifier", "Viewport", "SelectionService", "ISelectionService", "text", "BufferDecorationRenderer", "OverviewRulerRenderer", "DomRenderer", "self", "el", "sendEvent", "pos", "but", "action", "deltaY", "requestedEvents", "eventListeners", "events", "sequence", "start", "end", "sync", "disp", "suppressScrollEvent", "pageCount", "disableSmoothScroll", "line", "scrollAmount", "data", "paste", "customKeyEventHandler", "customWheelEventHandler", "linkProvider", "handler", "joinerId", "cursorYOffset", "decorationOptions", "column", "row", "length", "shouldIgnoreComposition", "result", "scrollCount", "wasModifierOnly", "wasModifierKeyOnlyEvent", "browser", "thirdLevelKey", "key", "x", "y", "i", "DEFAULT_ATTR_DATA", "canvasWidth", "canvasHeight", "AddonManager", "i", "terminal", "instance", "loadedAddon", "index", "BufferLineApiView", "_line", "x", "cell", "CellData", "trimRight", "startColumn", "endColumn", "BufferApiView", "_buffer", "type", "buffer", "y", "line", "BufferLineApiView", "CellData", "BufferNamespaceApi", "Disposable", "_core", "Emitter", "BufferApiView", "ParserApi", "_core", "id", "callback", "params", "data", "handler", "ident", "UnicodeApi", "_core", "provider", "version", "CONSTRUCTOR_ONLY_OPTIONS", "$value", "Terminal", "Disposable", "options", "CoreBrowserTerminal", "AddonManager", "getter", "propName", "setter", "value", "desc", "ParserApi", "UnicodeApi", "BufferNamespaceApi", "m", "mouseTrackingMode", "data", "wasUserInput", "columns", "rows", "parent", "customKeyEventHandler", "customWheelEventHandler", "linkProvider", "handler", "joinerId", "cursorYOffset", "decorationOptions", "column", "row", "length", "start", "end", "amount", "pageCount", "line", "callback", "addon", "promptLabel", "tooMuchOutput", "values"] + } +diff --git a/src/browser/renderer/dom/DomRenderer.ts b/src/browser/renderer/dom/DomRenderer.ts +index c564ca4ae3eea55814fac1d6bb7bb58f5973c4c3..af4b27222d7d0a19257bc847403158a05dbd8e3d 100644 +--- a/src/browser/renderer/dom/DomRenderer.ts ++++ b/src/browser/renderer/dom/DomRenderer.ts +@@ -48,7 +48,8 @@ export class DomRenderer extends Disposable implements IRenderer { + + public dimensions: IRenderDimensions; + +- public readonly onRequestRedraw = this._register(new Emitter()).event; ++ private readonly _onRequestRedraw = this._register(new Emitter()); ++ public readonly onRequestRedraw = this._onRequestRedraw.event; + + constructor( + private readonly _terminal: ITerminal, +@@ -340,20 +341,25 @@ export class DomRenderer extends Disposable implements IRenderer { + public handleBlur(): void { + this._rowContainer.classList.remove(FOCUS_CLASS); + this._cursorBlinkStateManager.pause(); +- this.renderRows(0, this._bufferService.rows - 1); ++ this._requestRedraw(0, this._bufferService.rows - 1); + } + + public handleFocus(): void { + this._rowContainer.classList.add(FOCUS_CLASS); + this._cursorBlinkStateManager.resume(); +- this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y); ++ this._requestRedraw(this._bufferService.buffer.y, this._bufferService.buffer.y); ++ } ++ ++ /** Keep row drawing under RenderService's pause and synchronized-output gates. */ ++ private _requestRedraw(start: number, end: number): void { ++ this._onRequestRedraw.fire({ start, end }); + } + + public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void { + // Remove all selections + this._selectionContainer.replaceChildren(); + this._rowFactory.handleSelectionChanged(start, end, columnSelectMode); +- this.renderRows(0, this._bufferService.rows - 1); ++ this._requestRedraw(0, this._bufferService.rows - 1); + + // Selection does not exist + if (!start || !end) { +diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts +index 848eebcccc92bb9525dca24d1968a7fcef880967..aaf94e43bafdf0004beb2925195c92c045bc3e3c 100644 +--- a/src/browser/services/RenderService.ts ++++ b/src/browser/services/RenderService.ts +@@ -177,6 +177,12 @@ export class RenderService extends Disposable implements IRenderService { + return; + } + ++ // A frame requested before the terminal was paused may still arrive. ++ if (this._isPaused) { ++ this._needsFullRefresh = true; ++ return; ++ } ++ + // Skip rendering if synchronized output mode is enabled. This check must happen here + // (in addition to refreshRows) to handle renders that were queued before the mode was enabled. + if (this._coreService.decPrivateModes.synchronizedOutput) { +@@ -195,8 +201,9 @@ export class RenderService extends Disposable implements IRenderService { + + // Update selection if needed + if (this._needsSelectionRefresh) { +- this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode); ++ // The renderer may request another redraw while replaying the selection. + this._needsSelectionRefresh = false; ++ this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode); + } + + // Fire render event only if it was not a redraw diff --git a/patches/README.md b/patches/README.md new file mode 100644 index 0000000000..f497e41754 --- /dev/null +++ b/patches/README.md @@ -0,0 +1,53 @@ +# Dependency patches + +## xterm 6.1.0-beta.141: respect hidden rendering + +`@xterm__xterm@6.1.0-beta.141.patch` backports the render-pause routing from +[xterm PR #6283](https://github.com/xtermjs/xterm.js/pull/6283), reviewed at +`c279844f2a8cfcff9dd3466805d354b634c56223`. + +The pinned release's DOM renderer redraws rows directly for selection, blur and +focus changes. This bypasses RenderService's visibility and synchronized-output +gates after an inactive OpenBitFun terminal releases its WebGL renderer. The +patch routes those row redraws through the existing renderer event, checks +visibility again when a queued frame runs, and clears the selection replay flag +before replaying it. Parsing, buffer retention, selection state and overlays, +focus classes, cursor behavior and PTY lifetime retain their existing owners. +Visible DOM row redraws are scheduled through RenderService, as WebGL redraws +already are; this changes scheduling and requires native interaction coverage. + +This is not an xterm version upgrade. It does not include the newer upstream +selection-range algorithm from `5c2b19f2c89eef1fb9743746f093bf93264762a2`. +The beta release requires a named `_onRequestRedraw` emitter for the backport; +its prior anonymous emitter already exposed the same public event. + +Reproduction uses the npm release's source commit +`8f9045ed882aa663a63935e216501f43d757188d`: + +1. Check out that commit in a separate upstream directory and run + `npm ci --ignore-scripts` with its package lock, including esbuild 0.25.12. +2. Use `src/common/Version.ts` from the published beta package. This is the + only source difference between that checkout and the published sources. +3. Run `npm run package` before applying changes. Both `lib/xterm.js` and + `lib/xterm.mjs`, plus both source maps, must match the unpatched npm package + byte for byte. This control was verified when creating this patch. +4. Apply the two TypeScript source diffs from this patch and run + `npm run package` again. Remove the trailing `sourceMappingURL` comment from + the generated UMD bundle (`lib/xterm.js`). Its updated map would exceed the + repository's 5 MiB limit for the patch, and the original map has stale offsets. + Keep the generated ESM bundle and its updated map together. +5. Use `pnpm patch @xterm/xterm@6.1.0-beta.141 --edit-dir `. + Copy the two changed sources, both bundles, and the ESM map to staging, + then use `pnpm patch-commit `. Preserve the workspace's + existing patch entries. Never modify the shared pnpm store directly. + +Both package entry points carry the same source change. The Web UI consumes the +ESM entry point, which retains source-map support. + +Run `node --test tests/e2e/scripts/xterm-render-pause.test.mjs` against the +installed package. It checks the actual RenderService source with controlled +frames and observers, including selection replay and synchronized output. It +does not establish actual DOM rendering, OS input or performance. Native +selection and heavy-output verification are documented in +[`tests/e2e/AGENTS.md`](../tests/e2e/AGENTS.md); results and outstanding work are +tracked in the [workload report](../docs/performance/06-workload-residency-baseline-2026-11-05.md). diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 48f79d3c3d..944cff9ce1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false patchedDependencies: + '@xterm/xterm@6.1.0-beta.141': + hash: 8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23 + path: patches/@xterm__xterm@6.1.0-beta.141.patch mdast-util-gfm-autolink-literal@2.0.1: hash: 23ece47d024ddb26beb830db75c7075ea8820bc730565a8e59895957253e5707 path: patches/mdast-util-gfm-autolink-literal@2.0.1.patch @@ -227,10 +230,10 @@ importers: version: link:../../design-system/packages/ui '@xterm/addon-fit': specifier: ^0.12.0-beta.103 - version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141) + version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)) '@xterm/xterm': specifier: ^6.1.0-beta.101 - version: 6.1.0-beta.141 + version: 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) devDependencies: '@types/react': specifier: ^18.3.0 @@ -325,10 +328,10 @@ importers: version: link:../../design-system/packages/ui '@xterm/addon-fit': specifier: 0.12.0-beta.141 - version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141) + version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)) '@xterm/xterm': specifier: 6.1.0-beta.141 - version: 6.1.0-beta.141 + version: 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) katex: specifier: ^0.16.25 version: 0.16.28 @@ -510,19 +513,19 @@ importers: version: 3.20.4 '@xterm/addon-fit': specifier: ^0.12.0-beta.103 - version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141) + version: 0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)) '@xterm/addon-web-links': specifier: ^0.13.0-beta.103 - version: 0.13.0-beta.141(@xterm/xterm@6.1.0-beta.141) + version: 0.13.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)) '@xterm/addon-webgl': specifier: ^0.20.0-beta.100 - version: 0.20.0-beta.140(@xterm/xterm@6.1.0-beta.141) + version: 0.20.0-beta.140(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)) '@xterm/headless': specifier: 6.1.0-beta.141 version: 6.1.0-beta.141 '@xterm/xterm': specifier: ^6.1.0-beta.101 - version: 6.1.0-beta.141 + version: 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) decode-named-character-reference: specifier: 1.3.0 version: 1.3.0 @@ -8443,21 +8446,21 @@ snapshots: dependencies: '@wdio/logger': 9.18.0 - '@xterm/addon-fit@0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141)': + '@xterm/addon-fit@0.12.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23))': dependencies: - '@xterm/xterm': 6.1.0-beta.141 + '@xterm/xterm': 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) - '@xterm/addon-web-links@0.13.0-beta.141(@xterm/xterm@6.1.0-beta.141)': + '@xterm/addon-web-links@0.13.0-beta.141(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23))': dependencies: - '@xterm/xterm': 6.1.0-beta.141 + '@xterm/xterm': 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) - '@xterm/addon-webgl@0.20.0-beta.140(@xterm/xterm@6.1.0-beta.141)': + '@xterm/addon-webgl@0.20.0-beta.140(@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23))': dependencies: - '@xterm/xterm': 6.1.0-beta.141 + '@xterm/xterm': 6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23) '@xterm/headless@6.1.0-beta.141': {} - '@xterm/xterm@6.1.0-beta.141': {} + '@xterm/xterm@6.1.0-beta.141(patch_hash=8ab0d019d70c3dcedc9134feeaf1f6bf370e0ec7319f0e34acf19b183cbf0d23)': {} '@zip.js/zip.js@2.8.23': {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 0f11e7003f..3044c221ee 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -14,4 +14,5 @@ packages: - "tests/e2e" patchedDependencies: + "@xterm/xterm@6.1.0-beta.141": patches/@xterm__xterm@6.1.0-beta.141.patch mdast-util-gfm-autolink-literal@2.0.1: patches/mdast-util-gfm-autolink-literal@2.0.1.patch diff --git a/src/crates/adapters/webdriver/AGENTS.md b/src/crates/adapters/webdriver/AGENTS.md index 72e624200f..10f579555a 100644 --- a/src/crates/adapters/webdriver/AGENTS.md +++ b/src/crates/adapters/webdriver/AGENTS.md @@ -24,6 +24,13 @@ cargo check -p openbitfun-webdriver The crate selects Tauri's raw WebView access and the PNG/JPEG codecs it uses; focused checks must not depend on feature unification from the Desktop host. +For macOS screenshot encoding, also run +`cargo test -p openbitfun-webdriver --lib platform::capture::imp::tests`. +The tests cover lossless pixels/alpha, decode errors and the existing timeout +including the blocking queue. After rebuilding Desktop, use native screenshot +and Browser workloads for full callback, presentation and preview coverage; +bitmap tests alone do not establish UI latency or resource improvements. + For reveal/focus changes, build Desktop and use the real packaged UI regression documented in `tests/e2e/AGENTS.md` (`run-interaction-scroll.mjs`). @@ -31,4 +38,21 @@ For script result serialization and background browser automation, build Desktop and run `node tests/e2e/scripts/run-browser-session-isolation.mjs`. It checks numeric-length object fields, DOM collection references and actual article reads. +For native script transport changes, also run +`node tests/e2e/scripts/run-webdriver-evaluation.mjs` with frozen frontend/native +overrides and a fresh `OPENBITFUN_EVALUATION_FUNCTIONAL_EVIDENCE` directory. +It checks structured arguments, sync/callback/Promise execution, expression +side effects, errors, timeout recovery, selected frames and document replacement. +Cache only the native wrapper source; user expressions/functions must still be +evaluated on every call. Use the separate evaluation diagnostic documented in +`tests/e2e/AGENTS.md` to measure driver overhead, not product performance gains. + +For same-origin frame execution, build Desktop and run +`node tests/e2e/scripts/run-webdriver-frames.mjs` with completed frontend/native +snapshots and a new `OPENBITFUN_FRAME_EVIDENCE` directory. It checks frame-local +user scripts, element lookup/input/click/scroll/labels, nested frames, parent/top +restoration and index selection. Internal commands resolve the bridge and element +store on the native top-level document; DOM reads still use the selected frame. +This is native functional coverage, not performance or cross-origin support. + For documentation-only changes, run `git diff --check`. diff --git a/src/crates/adapters/webdriver/src/platform/capture.rs b/src/crates/adapters/webdriver/src/platform/capture.rs index 55326e81f7..03eee99bbf 100644 --- a/src/crates/adapters/webdriver/src/platform/capture.rs +++ b/src/crates/adapters/webdriver/src/platform/capture.rs @@ -41,6 +41,7 @@ mod imp { timeout_ms: u64, ) -> Result { let (tx, rx) = oneshot::channel(); + let runtime = tokio::runtime::Handle::current(); // SAFETY: Tauri runs this callback on the main thread with a live // platform webview, so the pointer is valid for the call and @@ -53,18 +54,34 @@ mod imp { let tx = Arc::new(std::sync::Mutex::new(Some(tx))); let block = RcBlock::new(move |image: *mut NSImage, error: *mut NSError| { - let response = if !error.is_null() { + let Some(sender) = tx.lock().ok().and_then(|mut guard| guard.take()) else { + return; + }; + if sender.is_closed() { + return; + } + + let tiff = if !error.is_null() { let error_ref = &*error; Err(error_ref.localizedDescription().to_string()) } else if image.is_null() { Err("No image returned".to_string()) } else { - image_to_png_base64(&*image) + // NSImage belongs to this callback's main thread. Only owned + // bytes cross threads; bitmap decoding and PNG compression + // must not block native window/presentation updates. + (&*image) + .TIFFRepresentation() + .map(|data| data.to_vec()) + .ok_or_else(|| "Failed to get TIFF representation".to_string()) }; - if let Ok(mut guard) = tx.lock() { - if let Some(sender) = guard.take() { - let _ = sender.send(response); + match tiff { + Ok(tiff) => { + let _encoding = spawn_png_response(&runtime, tiff, sender); + } + Err(error) => { + let _ = sender.send(Err(error)); } } }); @@ -183,9 +200,24 @@ mod imp { } } - unsafe fn image_to_png_base64(image: &NSImage) -> Result { - let tiff_data: Option> = image.TIFFRepresentation(); - let tiff_data = tiff_data.ok_or("Failed to get TIFF representation")?; + fn spawn_png_response( + runtime: &tokio::runtime::Handle, + tiff: Vec, + sender: oneshot::Sender>, + ) -> tokio::task::JoinHandle<()> { + runtime.spawn_blocking(move || { + if sender.is_closed() { + return; + } + // Blocking-pool threads do not have an AppKit event-loop pool. + let response = objc2::rc::autoreleasepool(|_| tiff_to_png_base64(tiff)); + let _ = sender.send(response); + }) + } + + fn tiff_to_png_base64(tiff: Vec) -> Result { + let tiff_data = NSData::with_bytes(&tiff); + drop(tiff); let bitmap_rep = NSBitmapImageRep::imageRepWithData(&tiff_data) .ok_or("Failed to create bitmap image rep")?; @@ -201,6 +233,93 @@ mod imp { Ok(BASE64_STANDARD.encode(png_data.to_vec())) } + + #[cfg(test)] + mod tests { + use super::*; + + fn screenshot_fixture() -> (Vec, image::RgbaImage) { + let pixels = image::RgbaImage::from_fn(19, 13, |x, y| { + let alpha = [0, 85, 170, 255][(x % 4) as usize]; + if alpha == 0 { + image::Rgba([0, 0, 0, 0]) + } else { + image::Rgba([(x * 13) as u8, (y * 19) as u8, ((x + y) * 7) as u8, alpha]) + } + }); + let mut png = std::io::Cursor::new(Vec::new()); + pixels.write_to(&mut png, image::ImageFormat::Png).unwrap(); + let tiff = objc2::rc::autoreleasepool(|_| { + let data = NSData::with_bytes(png.get_ref()); + let bitmap = NSBitmapImageRep::imageRepWithData(&data).unwrap(); + bitmap.TIFFRepresentation().unwrap().to_vec() + }); + (tiff, pixels) + } + + #[test] + fn background_png_preserves_dimensions_pixels_and_transparency() { + let (tiff, expected) = screenshot_fixture(); + let runtime = tokio::runtime::Builder::new_current_thread() + .enable_time() + .build() + .unwrap(); + runtime.block_on(async { + let (tx, rx) = oneshot::channel(); + let encoding = spawn_png_response(runtime.handle(), tiff, tx); + let encoded = await_base64_response(rx, 5000, "Screenshot").await.unwrap(); + encoding.await.unwrap(); + let png = BASE64_STANDARD.decode(encoded).unwrap(); + assert_eq!(image::guess_format(&png).unwrap(), image::ImageFormat::Png); + let actual = image::load_from_memory(&png).unwrap().to_rgba8(); + assert_eq!(actual.dimensions(), expected.dimensions()); + assert_eq!(actual.as_raw(), expected.as_raw()); + }); + } + + #[test] + fn background_png_reports_decode_failure() { + let runtime = tokio::runtime::Builder::new_current_thread() + .enable_time() + .build() + .unwrap(); + runtime.block_on(async { + let (tx, rx) = oneshot::channel(); + let encoding = spawn_png_response(runtime.handle(), vec![0, 1, 2, 3], tx); + let error = await_base64_response(rx, 5000, "Screenshot") + .await + .unwrap_err(); + encoding.await.unwrap(); + assert_eq!(error.error, "unknown error"); + assert_eq!(error.message, "Failed to create bitmap image rep"); + }); + } + + #[test] + fn screenshot_timeout_includes_queued_encoding() { + let (tiff, _) = screenshot_fixture(); + let runtime = tokio::runtime::Builder::new_current_thread() + .max_blocking_threads(1) + .enable_time() + .build() + .unwrap(); + let (release, wait) = std::sync::mpsc::channel(); + let blocker = runtime.spawn_blocking(move || { + let _ = wait.recv_timeout(Duration::from_secs(5)); + }); + runtime.block_on(async { + let (tx, rx) = oneshot::channel(); + let encoding = spawn_png_response(runtime.handle(), tiff, tx); + let response = await_base64_response(rx, 10, "Screenshot").await; + let _ = release.send(()); + blocker.await.unwrap(); + encoding.await.unwrap(); + let error = response.unwrap_err(); + assert_eq!(error.error, "timeout"); + assert_eq!(error.message, "Screenshot timed out after 10ms"); + }); + } + } } #[cfg(target_os = "windows")] diff --git a/src/crates/adapters/webdriver/src/platform/evaluator/macos.rs b/src/crates/adapters/webdriver/src/platform/evaluator/macos.rs index 33491bbb8f..9e34c471d1 100644 --- a/src/crates/adapters/webdriver/src/platform/evaluator/macos.rs +++ b/src/crates/adapters/webdriver/src/platform/evaluator/macos.rs @@ -5,7 +5,7 @@ use block2::RcBlock; use objc2::rc::Retained; use objc2::runtime::AnyObject; use objc2::MainThreadMarker; -use objc2_foundation::{NSDictionary, NSError, NSString}; +use objc2_foundation::{ns_string, NSDictionary, NSError, NSString}; use objc2_web_kit::{WKContentWorld, WKWebView}; use serde_json::Value; use tokio::sync::oneshot; @@ -22,7 +22,9 @@ pub(super) async fn evaluate_script( async_mode: bool, frame_context: &Value, ) -> Result { - let wrapped = script::build_native_eval_script(script, args, async_mode, frame_context); + let user_script = script.to_owned(); + let args_json = serde_json::to_string(args).unwrap_or_else(|_| "[]".into()); + let frame_context_json = serde_json::to_string(frame_context).unwrap_or_else(|_| "[]".into()); let (sender, receiver) = oneshot::channel::>(); // SAFETY: Tauri runs this callback on the main thread with a live platform @@ -31,9 +33,26 @@ pub(super) async fn evaluate_script( // macOS that webview is always WKWebView-backed, making the cast sound. let result = webview.with_webview(move |platform_webview| unsafe { let wk_webview: &WKWebView = &*platform_webview.inner().cast(); - let ns_script = NSString::from_str(&wrapped); + let ns_script = NSString::from_str(script::native_eval_script()); let mtm = MainThreadMarker::new_unchecked(); - let empty_dict: Retained> = NSDictionary::new(); + let arguments: Retained> = NSDictionary::from_slices( + &[ + ns_string!("openbitfunScript"), + ns_string!("openbitfunArguments"), + ns_string!("openbitfunAsync"), + ns_string!("openbitfunFrameContext"), + ], + &[ + &NSString::from_str(&user_script), + &NSString::from_str(&args_json), + if async_mode { + ns_string!("true") + } else { + ns_string!("false") + }, + &NSString::from_str(&frame_context_json), + ], + ); let content_world = WKContentWorld::pageWorld(mtm); let sender = Arc::new(std::sync::Mutex::new(Some(sender))); @@ -56,7 +75,7 @@ pub(super) async fn evaluate_script( wk_webview.callAsyncJavaScript_arguments_inFrame_inContentWorld_completionHandler( &ns_script, - Some(&empty_dict), + Some(&arguments), None, &content_world, Some(&block), diff --git a/src/crates/adapters/webdriver/src/runtime/api/element.rs b/src/crates/adapters/webdriver/src/runtime/api/element.rs index dca099d84f..070218afb6 100644 --- a/src/crates/adapters/webdriver/src/runtime/api/element.rs +++ b/src/crates/adapters/webdriver/src/runtime/api/element.rs @@ -6,8 +6,12 @@ use crate::runtime::run_script; use crate::server::response::WebDriverErrorResponse; use crate::server::AppState; +// The bridge and its element store belong to the native top-level document. +// Command scripts still execute in the selected frame, so unqualified window +// and document keep that frame's DOM semantics. + pub(crate) fn find_elements() -> &'static str { - "(rootId, using, value) => window.__openbitfunWd.findElements(rootId, using, value)" + "(rootId, using, value) => window.top.__openbitfunWd.findElements(rootId, using, value)" } pub(crate) fn active_element() -> &'static str { @@ -15,79 +19,79 @@ pub(crate) fn active_element() -> &'static str { } pub(crate) fn is_selected() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); return !!el && !!(el.selected || el.checked); }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); return !!el && !!(el.selected || el.checked); }" } pub(crate) fn is_displayed() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); return window.__openbitfunWd.isDisplayed(el); }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); return window.top.__openbitfunWd.isDisplayed(el); }" } pub(crate) fn get_attribute() -> &'static str { - "(id, name) => { const el = window.__openbitfunWd.getElement(id); if (!el) { return null; } const attrName = String(name || '').toLowerCase(); const tagName = String(el.tagName || '').toLowerCase(); if (attrName === 'value' && (tagName === 'input' || tagName === 'textarea')) { return el.value; } if (attrName === 'checked' && tagName === 'input' && (el.type === 'checkbox' || el.type === 'radio')) { return el.checked ? 'true' : null; } if (attrName === 'selected' && tagName === 'option') { return el.selected ? 'true' : null; } return el.getAttribute(name); }" + "(id, name) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { return null; } const attrName = String(name || '').toLowerCase(); const tagName = String(el.tagName || '').toLowerCase(); if (attrName === 'value' && (tagName === 'input' || tagName === 'textarea')) { return el.value; } if (attrName === 'checked' && tagName === 'input' && (el.type === 'checkbox' || el.type === 'radio')) { return el.checked ? 'true' : null; } if (attrName === 'selected' && tagName === 'option') { return el.selected ? 'true' : null; } return el.getAttribute(name); }" } pub(crate) fn get_property() -> &'static str { - "(id, name) => { const el = window.__openbitfunWd.getElement(id); return el ? el[name] : null; }" + "(id, name) => { const el = window.top.__openbitfunWd.getElement(id); return el ? el[name] : null; }" } pub(crate) fn get_css_value() -> &'static str { - "(id, propertyName) => { const el = window.__openbitfunWd.getElement(id); return el ? window.getComputedStyle(el).getPropertyValue(propertyName) : ''; }" + "(id, propertyName) => { const el = window.top.__openbitfunWd.getElement(id); return el ? window.getComputedStyle(el).getPropertyValue(propertyName) : ''; }" } pub(crate) fn get_text() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); return el ? (el.innerText ?? el.textContent ?? '') : ''; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); return el ? (el.innerText ?? el.textContent ?? '') : ''; }" } pub(crate) fn get_computed_role() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el) { return ''; } const explicitRole = el.getAttribute('role'); if (explicitRole) { return explicitRole; } const tag = String(el.tagName || '').toLowerCase(); if (tag === 'button') return 'button'; if (tag === 'a' && el.hasAttribute('href')) return 'link'; if (tag === 'input') { const type = String(el.getAttribute('type') || 'text').toLowerCase(); if (type === 'checkbox') return 'checkbox'; if (type === 'radio') return 'radio'; if (type === 'submit' || type === 'button' || type === 'reset') return 'button'; return 'textbox'; } if (tag === 'select') return 'combobox'; if (tag === 'textarea') return 'textbox'; return ''; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { return ''; } const explicitRole = el.getAttribute('role'); if (explicitRole) { return explicitRole; } const tag = String(el.tagName || '').toLowerCase(); if (tag === 'button') return 'button'; if (tag === 'a' && el.hasAttribute('href')) return 'link'; if (tag === 'input') { const type = String(el.getAttribute('type') || 'text').toLowerCase(); if (type === 'checkbox') return 'checkbox'; if (type === 'radio') return 'radio'; if (type === 'submit' || type === 'button' || type === 'reset') return 'button'; return 'textbox'; } if (tag === 'select') return 'combobox'; if (tag === 'textarea') return 'textbox'; return ''; }" } pub(crate) fn get_computed_label() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el) { return ''; } const labelledBy = el.getAttribute('aria-labelledby'); if (labelledBy) { return labelledBy.split(/\\s+/).map((labelId) => document.getElementById(labelId)?.innerText?.trim() || '').filter(Boolean).join(' ').trim(); } const ariaLabel = el.getAttribute('aria-label'); if (ariaLabel) { return ariaLabel; } const htmlFor = el.id ? document.querySelector(`label[for=\"${el.id}\"]`) : null; if (htmlFor) { return (htmlFor.innerText || htmlFor.textContent || '').trim(); } return (el.innerText || el.textContent || el.getAttribute('value') || '').trim(); }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { return ''; } const labelledBy = el.getAttribute('aria-labelledby'); if (labelledBy) { return labelledBy.split(/\\s+/).map((labelId) => document.getElementById(labelId)?.innerText?.trim() || '').filter(Boolean).join(' ').trim(); } const ariaLabel = el.getAttribute('aria-label'); if (ariaLabel) { return ariaLabel; } const htmlFor = el.id ? document.querySelector(`label[for=\"${el.id}\"]`) : null; if (htmlFor) { return (htmlFor.innerText || htmlFor.textContent || '').trim(); } return (el.innerText || el.textContent || el.getAttribute('value') || '').trim(); }" } pub(crate) fn get_name() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); return el ? String(el.tagName || '').toLowerCase() : ''; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); return el ? String(el.tagName || '').toLowerCase() : ''; }" } pub(crate) fn get_rect() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el) { return null; } const rect = el.getBoundingClientRect(); return { x: rect.x + window.scrollX, y: rect.y + window.scrollY, width: rect.width, height: rect.height, top: rect.top + window.scrollY, left: rect.left + window.scrollX, right: rect.right + window.scrollX, bottom: rect.bottom + window.scrollY }; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { return null; } const rect = el.getBoundingClientRect(); return { x: rect.x + window.scrollX, y: rect.y + window.scrollY, width: rect.width, height: rect.height, top: rect.top + window.scrollY, left: rect.left + window.scrollX, right: rect.right + window.scrollX, bottom: rect.bottom + window.scrollY }; }" } pub(crate) fn is_enabled() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); return !!el && !el.disabled; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); return !!el && !el.disabled; }" } pub(crate) fn click() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } window.__openbitfunWd.dispatchPointerClick(el, 0, false); return null; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } window.top.__openbitfunWd.dispatchPointerClick(el, 0, false); return null; }" } pub(crate) fn clear() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } window.__openbitfunWd.clearElement(el); return null; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } window.top.__openbitfunWd.clearElement(el); return null; }" } pub(crate) fn send_keys() -> &'static str { - "(id, text) => { const el = window.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } if ('value' in el || el.isContentEditable) { window.__openbitfunWd.scrollElementIntoView(el); window.__openbitfunWd.focusWithoutScroll(el); } window.__openbitfunWd.insertText(el, text); return null; }" + "(id, text) => { const el = window.top.__openbitfunWd.getElement(id); if (!el) { throw new Error('Element not found'); } if ('value' in el || el.isContentEditable) { window.top.__openbitfunWd.scrollElementIntoView(el); window.top.__openbitfunWd.focusWithoutScroll(el); } window.top.__openbitfunWd.insertText(el, text); return null; }" } pub(crate) fn screenshot_metadata() -> &'static str { - "(id) => { const el = window.__openbitfunWd.getElement(id); if (!el || !el.isConnected) { throw new Error('stale element reference'); } window.__openbitfunWd.scrollElementIntoView(el); const rect = el.getBoundingClientRect(); return { x: rect.x, y: rect.y, width: rect.width, height: rect.height, devicePixelRatio: window.devicePixelRatio || 1 }; }" + "(id) => { const el = window.top.__openbitfunWd.getElement(id); if (!el || !el.isConnected) { throw new Error('stale element reference'); } window.top.__openbitfunWd.scrollElementIntoView(el); const rect = el.getBoundingClientRect(); return { x: rect.x, y: rect.y, width: rect.width, height: rect.height, devicePixelRatio: window.devicePixelRatio || 1 }; }" } pub(crate) fn get_shadow_root() -> &'static str { - "(elementId) => window.__openbitfunWd.getShadowRoot(elementId)" + "(elementId) => window.top.__openbitfunWd.getShadowRoot(elementId)" } pub(crate) fn find_elements_from_shadow() -> &'static str { - "(shadowId, using, value) => window.__openbitfunWd.findElementsFromShadow(shadowId, using, value)" + "(shadowId, using, value) => window.top.__openbitfunWd.findElementsFromShadow(shadowId, using, value)" } pub(crate) fn validate_frame_index() -> &'static str { - "(index) => { if (!window.__openbitfunWd.validateFrameByIndex(index)) { throw new Error('Unable to locate frame'); } return true; }" + "(index) => { if (!window.top.__openbitfunWd.validateFrameByIndex(index)) { throw new Error('Unable to locate frame'); } return true; }" } pub(crate) fn validate_frame_element() -> &'static str { - "(elementId) => { if (!window.__openbitfunWd.validateFrameElement(elementId)) { throw new Error('Unable to locate frame'); } return true; }" + "(elementId) => { if (!window.top.__openbitfunWd.validateFrameElement(elementId)) { throw new Error('Unable to locate frame'); } return true; }" } pub(crate) async fn exec_find_elements( diff --git a/src/crates/adapters/webdriver/src/runtime/api/interaction.rs b/src/crates/adapters/webdriver/src/runtime/api/interaction.rs index e9ca1db5fd..701d38cdfc 100644 --- a/src/crates/adapters/webdriver/src/runtime/api/interaction.rs +++ b/src/crates/adapters/webdriver/src/runtime/api/interaction.rs @@ -6,32 +6,36 @@ use crate::runtime::run_script; use crate::server::response::WebDriverErrorResponse; use crate::server::AppState; +// The bridge and its element store belong to the native top-level document. +// Command scripts still execute in the selected frame, so unqualified window +// and document keep that frame's DOM semantics. + pub(crate) fn perform_actions() -> &'static str { - "async (actions) => { await window.__openbitfunWd.performActions(actions); return null; }" + "async (actions) => { await window.top.__openbitfunWd.performActions(actions); return null; }" } pub(crate) fn release_actions() -> &'static str { - "async (pressedKeys, pressedButtons) => { await window.__openbitfunWd.releaseActions(pressedKeys, pressedButtons); return null; }" + "async (pressedKeys, pressedButtons) => { await window.top.__openbitfunWd.releaseActions(pressedKeys, pressedButtons); return null; }" } pub(crate) fn dismiss_alert() -> &'static str { - "() => window.__openbitfunWd.closeAlert(false)" + "() => window.top.__openbitfunWd.closeAlert(false)" } pub(crate) fn accept_alert() -> &'static str { - "() => window.__openbitfunWd.closeAlert(true)" + "() => window.top.__openbitfunWd.closeAlert(true)" } pub(crate) fn alert_text() -> &'static str { - "() => window.__openbitfunWd.getAlertText()" + "() => window.top.__openbitfunWd.getAlertText()" } pub(crate) fn send_alert_text() -> &'static str { - "(text) => window.__openbitfunWd.sendAlertText(text)" + "(text) => window.top.__openbitfunWd.sendAlertText(text)" } pub(crate) fn take_logs() -> &'static str { - "() => window.__openbitfunWd.takeLogs()" + "() => window.top.__openbitfunWd.takeLogs()" } pub(crate) async fn exec_perform_actions( diff --git a/src/crates/adapters/webdriver/src/runtime/script.rs b/src/crates/adapters/webdriver/src/runtime/script.rs index 9d15283fd2..9297c3c80b 100644 --- a/src/crates/adapters/webdriver/src/runtime/script.rs +++ b/src/crates/adapters/webdriver/src/runtime/script.rs @@ -57,22 +57,22 @@ pub(crate) fn build_bridge_eval_script( } #[cfg(target_os = "macos")] -pub(crate) fn build_native_eval_script( - script: &str, - args: &[Value], - async_mode: bool, - frame_context: &Value, -) -> String { - let script_json = serde_json::to_string(script).unwrap_or_else(|_| "\"\"".into()); - let args_json = serde_json::to_string(args).unwrap_or_else(|_| "[]".into()); - let async_json = if async_mode { "true" } else { "false" }; - let frame_context_json = serde_json::to_string(frame_context).unwrap_or_else(|_| "[]".into()); - - format!( - r#" +pub(crate) fn native_eval_script() -> &'static str { + // Keep the wrapper source identical across calls. WebKit receives the user + // script and data as native arguments, so changing a value does not compile + // another copy of the entire bridge. User functions still execute afresh. + static SCRIPT: std::sync::OnceLock = std::sync::OnceLock::new(); + SCRIPT.get_or_init(|| { + format!( + r#" return (async () => {{ {helper} - const response = await window.__openbitfunWd.execute({script}, {args}, {async_mode}, {frame_context}); + const response = await window.__openbitfunWd.execute( + openbitfunScript, + JSON.parse(openbitfunArguments), + openbitfunAsync === "true", + JSON.parse(openbitfunFrameContext) + ); return JSON.stringify({{ requestId: "__native__", ok: response.ok, @@ -81,12 +81,9 @@ return (async () => {{ }}); }})(); "#, - helper = bridge_helper_script(), - script = script_json, - args = args_json, - async_mode = async_json, - frame_context = frame_context_json - ) + helper = bridge_helper_script() + ) + }) } fn bridge_helper_script() -> String { diff --git a/src/crates/services/terminal/AGENTS.md b/src/crates/services/terminal/AGENTS.md index 4ecf442301..b1e383bac2 100644 --- a/src/crates/services/terminal/AGENTS.md +++ b/src/crates/services/terminal/AGENTS.md @@ -29,6 +29,13 @@ node scripts/check-core-boundaries.mjs For documentation-only changes, run `git diff --check`. +For natural PTY exit, output draining, confirmed shutdown and Unix hangup +escalation, run `cargo test -p terminal-core --lib pty::process::tests` and +`cargo check -p terminal-core`. These local child-process tests do not establish +live SSH, Peer, relay, dispatch or other-platform behavior. The native terminal +workload in `tests/e2e/AGENTS.md` additionally checks UI input, native process +reaping and retained terminal buffers after exit. + For Windows App Execution Alias termination, install Python Install Manager and run this opt-in regression with its working alias (not the Store redirector): diff --git a/src/crates/services/terminal/src/pty/process.rs b/src/crates/services/terminal/src/pty/process.rs index c2a7b3a8e5..71b46c4a81 100644 --- a/src/crates/services/terminal/src/pty/process.rs +++ b/src/crates/services/terminal/src/pty/process.rs @@ -23,7 +23,7 @@ use std::thread; #[cfg(windows)] use log::debug; use log::{error, warn}; -use portable_pty::{native_pty_system, Child, CommandBuilder, PtySize}; +use portable_pty::{native_pty_system, ChildKiller, CommandBuilder, ExitStatus, PtySize}; use tokio::sync::{mpsc, oneshot}; use crate::config::ShellConfig; @@ -38,8 +38,9 @@ mod shutdown { pub(super) const DATA_FLUSH_TIMEOUT_MS: u64 = 250; /// Maximum time to wait for the managed child to report termination. pub(super) const EXIT_CONFIRM_TIMEOUT_MS: u64 = 5_000; - /// Poll interval while confirming termination after a kill request. - pub(super) const EXIT_CONFIRM_POLL_MS: u64 = 10; + /// Match portable-pty's Unix Child::kill grace before escalating SIGHUP. + #[cfg(unix)] + pub(super) const HANGUP_GRACE_MS: u64 = 200; } /// Resize constants for Windows ConPTY @@ -200,17 +201,30 @@ impl PtyController { /// Shutdown the process pub async fn shutdown(&self, immediate: bool) -> TerminalResult<()> { + if !self.is_running() { + return Ok(()); + } let (completion, completed) = oneshot::channel(); - self.command_tx + let sent = self + .command_tx .send(InternalCommand::Shutdown { immediate, completion, }) - .await - .map_err(|_| TerminalError::ProcessNotRunning)?; - completed - .await - .map_err(|_| TerminalError::ProcessNotRunning)? + .await; + if sent.is_err() { + return if self.is_running() { + Err(TerminalError::ProcessNotRunning) + } else { + Ok(()) + }; + } + match completed.await { + Ok(result) => result, + // Natural exit can win the race with an already queued close. + Err(_) if !self.is_running() => Ok(()), + Err(_) => Err(TerminalError::ProcessNotRunning), + } } /// Check if process is still running @@ -391,6 +405,7 @@ pub fn spawn_pty( let mut child = pty_pair.slave.spawn_command(cmd)?; let pid = child.process_id().unwrap_or(0); + let mut killer = child.clone_killer(); // Create channels for communication let (command_tx, mut command_rx) = mpsc::channel::(256); @@ -417,6 +432,7 @@ pub fn spawn_pty( // Clone for read thread let has_exited_read = has_exited.clone(); let event_tx_read = event_tx.clone(); + let (read_done_tx, mut read_done_rx) = oneshot::channel(); // Start the read thread (native thread, not tokio) thread::spawn(move || { @@ -456,6 +472,14 @@ pub fn spawn_pty( } } } + let _ = read_done_tx.send(()); + }); + + // Reap natural exits even while no commands arrive. A blocking waiter + // sleeps in the OS; it adds no per-terminal polling timer or idle wakeups. + let (exit_tx, mut exit_rx) = oneshot::channel(); + thread::spawn(move || { + let _ = exit_tx.send(child.wait()); }); // Send ready event @@ -482,7 +506,21 @@ pub fn spawn_pty( #[cfg(windows)] let mut delayed_resize_triggered = false; - while let Some(cmd) = command_rx.recv().await { + loop { + let cmd = tokio::select! { + biased; + exited = receive_child_exit(&mut exit_rx) => { + match exited { + Ok(exit_code) => publish_child_exit(exit_code, &has_exited_cmd, &event_tx, &mut read_done_rx).await, + Err(error) => error!("Failed to observe PTY process exit: {}", error), + } + break; + } + command = command_rx.recv() => match command { + Some(command) => command, + None => break, + } + }; match cmd { InternalCommand::Write(data) => { if let Ok(mut writer_guard) = writer.lock() { @@ -587,15 +625,28 @@ pub fn spawn_pty( InternalCommand::Shutdown { immediate, completion, - } => match confirm_child_shutdown(child.as_mut(), immediate).await { + } => match confirm_child_shutdown(killer.as_mut(), pid, &mut exit_rx, immediate) + .await + { Ok(exit_code) => { - has_exited_cmd.store(true, Ordering::Relaxed); - let _ = event_tx.try_send(PtyEvent::Exit { exit_code }); + publish_child_exit( + exit_code, + &has_exited_cmd, + &event_tx, + &mut read_done_rx, + ) + .await; let _ = completion.send(Ok(())); break; } Err(error) => { + let can_still_wait = matches!(error, TerminalError::Timeout(_)); let _ = completion.send(Err(error)); + if !can_still_wait { + // The exit result was consumed (or its sender + // failed); never poll that one-shot receiver again. + break; + } } }, } @@ -660,47 +711,92 @@ fn is_tauri_host_env(key: &OsStr) -> bool { || key.starts_with("TAURI_ANDROID_PACKAGE_NAME_") } +type ChildExitReceiver = oneshot::Receiver>; + +async fn receive_child_exit(exited: &mut ChildExitReceiver) -> TerminalResult> { + let status = exited + .await + .map_err(|_| TerminalError::ProcessNotRunning)??; + Ok(Some(status.exit_code())) +} + +async fn publish_child_exit( + exit_code: Option, + has_exited: &AtomicBool, + events: &mpsc::Sender, + read_done: &mut oneshot::Receiver<()>, +) { + // Normally EOF immediately follows child exit. Retain the existing bounded + // drain for a descendant that still holds a slave descriptor open. + let _ = tokio::time::timeout( + std::time::Duration::from_millis(shutdown::DATA_FLUSH_TIMEOUT_MS), + read_done, + ) + .await; + has_exited.store(true, Ordering::Relaxed); + // Exit is a lifecycle event: a temporarily full output queue must not drop it. + let _ = events.send(PtyEvent::Exit { exit_code }).await; +} + async fn confirm_child_shutdown( - child: &mut (dyn Child + Send), + killer: &mut (dyn ChildKiller + Send + Sync), + _pid: u32, + exited: &mut ChildExitReceiver, immediate: bool, ) -> TerminalResult> { if !immediate { - tokio::time::sleep(tokio::time::Duration::from_millis( - shutdown::DATA_FLUSH_TIMEOUT_MS, - )) - .await; + if let Ok(result) = tokio::time::timeout( + std::time::Duration::from_millis(shutdown::DATA_FLUSH_TIMEOUT_MS), + receive_child_exit(exited), + ) + .await + { + return result; + } } - match child.try_wait() { - Ok(Some(status)) => return Ok(Some(status.exit_code())), - Ok(None) => {} - Err(error) => return Err(TerminalError::Io(error)), + match exited.try_recv() { + Ok(status) => return Ok(Some(status?.exit_code())), + Err(oneshot::error::TryRecvError::Empty) => {} + Err(oneshot::error::TryRecvError::Closed) => return Err(TerminalError::ProcessNotRunning), } - let kill_error = child.kill().err().map(|error| error.to_string()); - let deadline = tokio::time::Instant::now() - + tokio::time::Duration::from_millis(shutdown::EXIT_CONFIRM_TIMEOUT_MS); - loop { - match child.try_wait() { - Ok(Some(status)) => return Ok(Some(status.exit_code())), - Ok(None) if tokio::time::Instant::now() < deadline => { - tokio::time::sleep(tokio::time::Duration::from_millis( - shutdown::EXIT_CONFIRM_POLL_MS, - )) - .await; - } - Ok(None) => { - let detail = kill_error - .as_deref() - .map(|error| format!("; kill request failed: {error}")) - .unwrap_or_default(); - return Err(TerminalError::Timeout(format!( - "PTY process did not exit after shutdown request{detail}" - ))); + let kill_error = killer.kill().err().map(|error| error.to_string()); + #[cfg(unix)] + { + // clone_killer sends only SIGHUP on Unix. Preserve Child::kill's + // escalation for shells that ignore it, while the waiter owns reaping. + if let Ok(result) = tokio::time::timeout( + std::time::Duration::from_millis(shutdown::HANGUP_GRACE_MS), + receive_child_exit(exited), + ) + .await + { + return result; + } + if let Ok(pid) = i32::try_from(_pid) { + if pid > 0 { + // SAFETY: signal only the child PID returned by portable-pty. + unsafe { + libc::kill(pid, libc::SIGKILL); + } } - Err(error) => return Err(TerminalError::Io(error)), } } + tokio::time::timeout( + std::time::Duration::from_millis(shutdown::EXIT_CONFIRM_TIMEOUT_MS), + receive_child_exit(exited), + ) + .await + .unwrap_or_else(|_| { + let detail = kill_error + .as_deref() + .map(|error| format!("; kill request failed: {error}")) + .unwrap_or_default(); + Err(TerminalError::Timeout(format!( + "PTY process did not exit after shutdown request{detail}" + ))) + }) } // ============================================================================ @@ -771,4 +867,137 @@ mod tests { assert!(std::iter::from_fn(|| spawned.events.try_recv()) .any(|event| matches!(event, PtyEvent::Exit { .. }))); } + + #[tokio::test(flavor = "current_thread")] + async fn natural_exit_is_reaped_and_reports_final_output_without_a_close_request() { + let (executable, args, shell_type) = if cfg!(windows) { + ( + "cmd.exe", + vec!["/d", "/c", "echo terminal-final-output & exit /b 7"], + ShellType::Cmd, + ) + } else { + ( + "/bin/sh", + vec!["-c", "printf 'terminal-final-output\\n'; exit 7"], + ShellType::Sh, + ) + }; + let mut spawned = spawn_pty( + 2, + &ShellConfig { + executable: executable.into(), + args: args.into_iter().map(str::to_string).collect(), + ..ShellConfig::default() + }, + shell_type, + 80, + 24, + ) + .expect("spawn naturally exiting PTY"); + let mut output = Vec::new(); + let result = tokio::time::timeout(std::time::Duration::from_secs(3), async { + while let Some(event) = spawned.events.recv().await { + match event { + PtyEvent::Data(data) => output.extend(data), + PtyEvent::Exit { exit_code } => return exit_code, + _ => {} + } + } + panic!("PTY event stream ended without an exit status"); + }) + .await; + if result.is_err() { + spawned + .controller + .shutdown(true) + .await + .expect("clean up failed fixture"); + } + assert_eq!(result.expect("natural exit notification"), Some(7)); + assert!(String::from_utf8_lossy(&output).contains("terminal-final-output")); + assert!(!spawned.controller.is_running()); + spawned + .controller + .shutdown(true) + .await + .expect("close already exited PTY"); + assert!(!std::iter::from_fn(|| spawned.events.try_recv()) + .any(|event| matches!(event, PtyEvent::Exit { .. }))); + } + + #[cfg(unix)] + #[tokio::test(flavor = "current_thread")] + async fn shutdown_still_terminates_a_shell_ignoring_hangup() { + let mut spawned = spawn_pty( + 3, + &ShellConfig { + executable: "/bin/sh".into(), + args: vec![ + "-c".into(), + "trap '' HUP; printf 'hangup-ignored\\n'; read value".into(), + ], + ..ShellConfig::default() + }, + ShellType::Sh, + 80, + 24, + ) + .expect("spawn hangup-ignoring PTY"); + let mut output = Vec::new(); + tokio::time::timeout(std::time::Duration::from_secs(3), async { + while !String::from_utf8_lossy(&output).contains("hangup-ignored") { + if let Some(PtyEvent::Data(data)) = spawned.events.recv().await { + output.extend(data); + } + } + }) + .await + .expect("shell installed hangup handler"); + tokio::time::timeout( + std::time::Duration::from_secs(3), + spawned.controller.shutdown(true), + ) + .await + .expect("shutdown deadline") + .expect("confirmed shutdown"); + assert!(!spawned.controller.is_running()); + let exits: Vec<_> = std::iter::from_fn(|| spawned.events.try_recv()) + .filter_map(|event| match event { + PtyEvent::Exit { exit_code } => Some(exit_code), + _ => None, + }) + .collect(); + assert_eq!(exits.len(), 1); + } + + #[cfg(unix)] + #[tokio::test(flavor = "current_thread")] + async fn closed_output_does_not_report_exit_before_the_child_finishes() { + let mut spawned = spawn_pty( + 4, + &ShellConfig { + executable: "/bin/sh".into(), + args: vec!["-c".into(), "exec 0<&- 1>&- 2>&-; sleep 0.2; exit 9".into()], + ..ShellConfig::default() + }, + ShellType::Sh, + 80, + 24, + ) + .expect("spawn early-EOF PTY"); + let started = std::time::Instant::now(); + let exit_code = tokio::time::timeout(std::time::Duration::from_secs(3), async { + loop { + if let Some(PtyEvent::Exit { exit_code }) = spawned.events.recv().await { + break exit_code; + } + } + }) + .await + .expect("child exit notification"); + assert_eq!(exit_code, Some(9)); + assert!(started.elapsed() >= std::time::Duration::from_millis(150)); + assert!(!spawned.controller.is_running()); + } } diff --git a/src/web-ui/AGENTS.md b/src/web-ui/AGENTS.md index fb8b39f73c..d62b9dd8ea 100644 --- a/src/web-ui/AGENTS.md +++ b/src/web-ui/AGENTS.md @@ -157,6 +157,28 @@ pnpm --dir src/web-ui run test:run src/app/layout/useNavResize.test.tsx src/app/ These local DOM fixtures cover gesture state and spring settling, not native WebView rendering or live remote scenarios. +For transcript focus/selection residency, disclosure takeover, crossing ranges, +and clearing or moving a selection outside the transcript: + +```bash +pnpm --dir src/web-ui run test:run src/flow_chat/timeline/useTimelineInteraction.test.tsx +``` + +These DOM fixtures cover interaction leases. Native row recycling checks live +in `tests/e2e/AGENTS.md`; neither establishes system clipboard or remote behavior. + +For scene-tab reveal coordinates, resize delivery, pointer/keyboard motion, +edge-control width changes and manual-scroll ownership: + +```bash +pnpm --dir src/web-ui run test:run src/app/components/SceneBar/useSceneTabNavigation.test.tsx src/app/components/SceneBar/SceneBar.test.tsx +``` + +TabGroup items sit inside positioned drag wrappers; their `offsetLeft` is not a +scroll-strip coordinate. Preserve reveal across edge-control layout changes, and +release automatic reveal when the user wheels or pages the strip. These fixtures +use supplied geometry; native overflow coverage is in `tests/e2e/AGENTS.md`. + For project creation entry points, work-location/environment selection, and local / SSH / WSL / Docker routing: ```bash @@ -418,6 +440,12 @@ pnpm --dir src/web-ui run test:run src/flow_chat/components/ChatInputWorkspaceSt These local DOM/store fixtures include simulated SSH report data, Peer surface switches, and the dispatch report source; they do not establish live remote behavior or visual fidelity. +For compact composer width measurement and pane-resize suspension, run +`pnpm --dir src/web-ui run test:run src/flow_chat/components/compactComposerInputWidth.test.ts src/app/scenes/session/ChatPane.composer-layout.test.tsx`. +Compact measurement may read the live compact track; expanded or unusable geometry +must retain the compact-layout probe. The native two-width geometry comparison is +documented in `tests/e2e/AGENTS.md`; DOM fixtures do not establish wrapping fidelity. + For canvas split tab placement, layout transitions, and lower-pane tab actions: ```bash @@ -454,3 +482,30 @@ pnpm --dir src/web-ui run test:run src/infrastructure/workspace-icons/workspaceI ``` These fixtures exercise DOM behavior and simulated device switching, not live remote hosts. + +For retained scene visibility, Todos display-clock suspension and immediate return +catch-up (including midnight and document visibility), run: + +```bash +pnpm --dir src/web-ui run test:run src/app/scenes/SceneViewport.test.tsx src/app/scenes/todos/useTodoClock.test.tsx src/app/scenes/personal-overview/usePersonalOverview.test.tsx +``` + +These local DOM fixtures do not establish native rendering or live remote behavior. +The Todos display clock must not gate job subscriptions or scheduler execution. +For scene-readiness-only changes, run the SceneViewport test file alone. Readiness +must follow the committed tree: a closed or Suspense-hidden tree cannot leave a +ready id that reveals a newly suspended reopening. Native non-editor close/reopen +coverage is in `run-scene-tabs.mjs`; its normal loading path does not replace the +deliberately suspended DOM regression. + +For companion sprite look/action restoration, SVG timer ownership, reduced +motion, hidden-window suspension and immediate hover polling recovery: + +```bash +pnpm --dir src/web-ui run test:run src/flow_chat/components/AgentCompanionPet.test.tsx src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.test.tsx +``` + +These DOM fixtures do not establish native CSS shorthand/longhand behavior or +live remote delivery. The native resource/cadence runner and its attribution +limits are documented in `tests/e2e/AGENTS.md`. Resource-loading compatibility +tests belong to `src/infrastructure/config/AGENTS.md`. diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.test.tsx b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.test.tsx index 9b0b3d98e4..92b87da952 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.test.tsx +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.test.tsx @@ -565,6 +565,28 @@ describe('AgentCompanionDesktopPet', () => { expect(bubbleShell!.classList).not.toContain('openbitfun-agent-companion-window__bubble-shell--hovered'); }); + it('removes the hidden pointer interval and refreshes immediately when visible', async () => { + const visibility = vi.spyOn(document, 'visibilityState', 'get'); + const clear = vi.spyOn(window, 'clearInterval'); + const schedule = vi.spyOn(window, 'setInterval'); + try { + cursorPositionMock.mockClear(); + await act(async () => { + visibility.mockReturnValue('hidden'); + document.dispatchEvent(new Event('visibilitychange')); + }); + expect(clear).toHaveBeenCalled(); + expect(schedule).not.toHaveBeenCalled(); + expect(cursorPositionMock).not.toHaveBeenCalled(); + await act(async () => { + visibility.mockReturnValue('visible'); + document.dispatchEvent(new Event('visibilitychange')); + }); + expect(cursorPositionMock).toHaveBeenCalledTimes(1); + expect(schedule).toHaveBeenCalledWith(expect.any(Function), 120); + } finally { visibility.mockRestore(); clear.mockRestore(); schedule.mockRestore(); } + }); + it('sends the composer message on Enter', () => { pushActivity({ mood: 'working', tasks: [task()], sequence: 1, emittedAt: 1 }); diff --git a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx index 4a15489238..ac62029043 100644 --- a/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx +++ b/src/web-ui/src/app/components/AgentCompanionDesktopPet/AgentCompanionDesktopPet.tsx @@ -682,18 +682,22 @@ export const AgentCompanionDesktopPet: React.FC = () => { } }; - const intervalId = window.setInterval(() => { - // Pause the IPC poll while the pet window is not visible. - if (document.visibilityState === 'hidden') { - return; - } + let intervalId: number | undefined; + const syncPointerPolling = () => { + window.clearInterval(intervalId); + intervalId = undefined; + if (document.visibilityState === 'hidden') return; + // Keep the same visible hover latency, and refresh immediately on return. void pollPointerHover(); - }, POINTER_HOVER_POLL_INTERVAL_MS); - void pollPointerHover(); + intervalId = window.setInterval(() => { void pollPointerHover(); }, POINTER_HOVER_POLL_INTERVAL_MS); + }; + document.addEventListener('visibilitychange', syncPointerPolling); + syncPointerPolling(); return () => { disposed = true; window.clearInterval(intervalId); + document.removeEventListener('visibilitychange', syncPointerPolling); window.removeEventListener('resize', invalidateRectCache); removeWindowMovedListener?.(); removeScaleChangedListener?.(); diff --git a/src/web-ui/src/app/components/SceneBar/SceneBar.test.tsx b/src/web-ui/src/app/components/SceneBar/SceneBar.test.tsx index be734ae524..b150293362 100644 --- a/src/web-ui/src/app/components/SceneBar/SceneBar.test.tsx +++ b/src/web-ui/src/app/components/SceneBar/SceneBar.test.tsx @@ -434,8 +434,11 @@ describe('SceneBar overflow navigation', () => { const gitTab = container.querySelector('[role="tab"][data-openbitfun-value="git"]')!; const gitItem = gitTab.closest('[data-openbitfun-part="item"]')!; setOverflowMetrics(tabs, region); - Object.defineProperty(gitItem, 'offsetLeft', { configurable: true, value: 420 }); - Object.defineProperty(gitItem, 'offsetWidth', { configurable: true, value: 100 }); + expect(gitItem.parentElement?.dataset.sceneTabId).toBe('git'); + // The real positioned wrapper owns offsetLeft; it is zero for the inner item. + Object.defineProperty(gitItem, 'offsetLeft', { configurable: true, value: 0 }); + vi.spyOn(tabs, 'getBoundingClientRect').mockReturnValue({ left: 100, width: 180 } as DOMRect); + vi.spyOn(gitItem, 'getBoundingClientRect').mockReturnValue({ left: 520, width: 100 } as DOMRect); const scrollTo = vi.fn(({ left }: ScrollToOptions) => { tabs.scrollLeft = left ?? tabs.scrollLeft; }); diff --git a/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.test.tsx b/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.test.tsx new file mode 100644 index 0000000000..cf93321d2b --- /dev/null +++ b/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.test.tsx @@ -0,0 +1,122 @@ +// @vitest-environment jsdom +import React, { act } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { afterEach, beforeEach, expect, it, vi } from 'vitest'; +import type { InteractionMotion } from '@/shared/utils/motionPreference'; +import type { SceneTabId } from './types'; +import { useSceneTabNavigation } from './useSceneTabNavigation'; + +globalThis.IS_REACT_ACT_ENVIRONMENT = true; +let container: HTMLDivElement, root: Root; +let observer: ControlledResizeObserver; +let tabs: HTMLDivElement, region: HTMLDivElement; +let scrollTo: ReturnType; +let left: number; + +class ControlledResizeObserver { + observe = vi.fn(); unobserve = vi.fn(); disconnect = vi.fn(); + constructor(private callback: ResizeObserverCallback) { observer = this; } + deliver() { act(() => this.callback([], this as unknown as ResizeObserver)); } +} + +function View({ active = 'session', motion = 'pointer' }: { active?: SceneTabId; motion?: InteractionMotion }) { + const navigation = useSceneTabNavigation({ activeTabId: active, navigationMotion: motion, + openTabIds: ['session', 'settings', 'git'] }); + return
+
+ {['session', 'settings', 'git'].map(id =>
+ +
)} +
+ +
; +} + +function render(active: SceneTabId = 'session', motion: InteractionMotion = 'pointer') { + act(() => root.render()); +} + +beforeEach(() => { + vi.stubGlobal('ResizeObserver', ControlledResizeObserver); + container = document.createElement('div'); document.body.append(container); root = createRoot(container); + render(); + tabs = container.querySelector('[data-tabs]')!; region = container.querySelector('[data-region]')!; + left = 0; + Object.defineProperties(tabs, { + clientWidth: { value: 180, configurable: true }, scrollWidth: { value: 620, configurable: true }, + scrollLeft: { get: () => left, set: value => { left = value; }, configurable: true }, + }); + Object.defineProperty(region, 'clientWidth', { value: 240 }); + const offsets = [0, 200, 420]; + vi.spyOn(tabs, 'getBoundingClientRect').mockImplementation(() => ({ left: 100, width: 180 } as DOMRect)); + [...tabs.children].forEach((item, index) => { + Object.defineProperties(item, { offsetLeft: { value: 0 }, offsetWidth: { value: 100 } }); + vi.spyOn(item, 'getBoundingClientRect').mockImplementation(() => ({ left: 100 + offsets[index] - left, width: 100 } as DOMRect)); + }); + scrollTo = vi.fn(({ left: value }: ScrollToOptions) => { left = value ?? left; }); + Object.defineProperty(tabs, 'scrollTo', { value: scrollTo }); + observer.deliver(); scrollTo.mockClear(); +}); + +afterEach(() => { + act(() => root.unmount()); container.remove(); vi.unstubAllGlobals(); vi.restoreAllMocks(); +}); + +it('reveals the activated tab in scroll coordinates and keeps pointer motion', () => { + render('git'); + expect(scrollTo).toHaveBeenCalledWith({ left: 340, behavior: 'smooth' }); + observer.deliver(); + scrollTo.mockClear(); left = 0; + observer.deliver(); + expect(scrollTo).not.toHaveBeenCalled(); // Later resizing does not override manual scroll position. +}); + +it('adjusts for an appearing edge control without restarting an unchanged smooth target', () => { + render('git'); + expect(scrollTo).toHaveBeenCalledTimes(1); + left = 50; // An intermediate smooth-scroll position. + act(() => tabs.dispatchEvent(new Event('scroll'))); + observer.deliver(); + expect(scrollTo).toHaveBeenCalledTimes(1); + Object.defineProperty(tabs, 'clientWidth', { value: 148, configurable: true }); + observer.deliver(); + expect(scrollTo).toHaveBeenLastCalledWith({ left: 372, behavior: 'smooth' }); + observer.deliver(); + scrollTo.mockClear(); left = 0; observer.deliver(); + expect(scrollTo).not.toHaveBeenCalled(); +}); + +it('does not alternate between edges when a tab is wider than its viewport', () => { + vi.spyOn(tabs.children[2], 'getBoundingClientRect').mockImplementation(() => ({ left: 520 - left, width: 300 } as DOMRect)); + render('git'); observer.deliver(); + expect(scrollTo).toHaveBeenCalledTimes(1); + act(() => tabs.dispatchEvent(new Event('scroll'))); observer.deliver(); + expect(scrollTo).toHaveBeenCalledTimes(1); +}); + +it('lets a newer keyboard activation replace an unfinished pointer reveal', () => { + render('git'); left = 50; render('settings', 'instant'); + observer.deliver(); + expect(scrollTo).toHaveBeenCalledTimes(2); + expect(scrollTo).toHaveBeenLastCalledWith({ left: 120, behavior: 'auto' }); +}); + +it('lets a wheel gesture supersede an unfinished activation reveal', () => { + render('git'); + left = 50; scrollTo.mockClear(); + act(() => tabs.dispatchEvent(new WheelEvent('wheel', { deltaY: 72, bubbles: true, cancelable: true }))); + expect(left).toBe(122); + observer.deliver(); + expect(scrollTo).not.toHaveBeenCalled(); + expect(left).toBe(122); +}); + +it('keeps reduced-motion activation instant and disconnects pending work on unmount', () => { + vi.stubGlobal('matchMedia', () => ({ matches: true })); + render('git'); observer.deliver(); + expect(scrollTo).toHaveBeenCalledWith({ left: 340, behavior: 'auto' }); + render('session'); scrollTo.mockClear(); + act(() => root.render(null)); + expect(observer.disconnect).toHaveBeenCalledTimes(1); + observer.deliver(); expect(scrollTo).not.toHaveBeenCalled(); +}); diff --git a/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.ts b/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.ts index fe873002c5..ed947140a0 100644 --- a/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.ts +++ b/src/web-ui/src/app/components/SceneBar/useSceneTabNavigation.ts @@ -47,6 +47,8 @@ export function useSceneTabNavigation({ const tabOrderKey = openTabIds.join('\u0000'); const tabRegionRef = useRef(null); const tabsRef = useRef(null); + const resizeObserverRef = useRef(null); + const pendingRevealRef = useRef<{ id: SceneTabId; behavior: ScrollBehavior; target?: number } | null>(null); const [scrollState, setScrollState] = useState(INITIAL_TAB_SCROLL_STATE); const getTabElements = useCallback((): HTMLElement[] => { @@ -85,7 +87,7 @@ export function useSceneTabNavigation({ const maxScrollLeft = Math.max(0, tabs.scrollWidth - tabs.clientWidth); const nextLeft = Math.max(0, Math.min(left, maxScrollLeft)); - if (Math.abs(nextLeft - tabs.scrollLeft) <= SCROLL_EDGE_EPSILON) return; + if (Math.abs(nextLeft - tabs.scrollLeft) <= SCROLL_EDGE_EPSILON) return nextLeft; if (typeof tabs.scrollTo === 'function') { tabs.scrollTo({ left: nextLeft, behavior }); @@ -93,8 +95,60 @@ export function useSceneTabNavigation({ tabs.scrollLeft = nextLeft; updateScrollState(); } + return nextLeft; }, [updateScrollState]); + const revealPendingTab = useCallback(() => { + const pending = pendingRevealRef.current; + if (!pending) return; + const tabs = tabsRef.current; + const activeTab = getTabElements().find(tab => tab.dataset.openbitfunValue === pending.id); + const activeItem = activeTab?.closest('[data-openbitfun-part="item"]') ?? activeTab; + if (!tabs || !activeItem) { pendingRevealRef.current = null; return; } + + const visibleStart = tabs.scrollLeft; + const visibleEnd = visibleStart + tabs.clientWidth; + // TabGroup's item is nested in a positioned, draggable SceneBar wrapper. + // Its offsetLeft belongs to that wrapper, not this scroll viewport. + const itemRect = activeItem.getBoundingClientRect(); + const tabStart = visibleStart + itemRect.left - tabs.getBoundingClientRect().left - tabs.clientLeft; + const tabEnd = tabStart + itemRect.width; + let nextLeft = visibleStart; + + if (tabStart < visibleStart) { + nextLeft = tabStart; + } else if (tabEnd > visibleEnd) { + nextLeft = tabEnd - tabs.clientWidth; + } + + const target = Math.max(0, Math.min(nextLeft, tabs.scrollWidth - tabs.clientWidth)); + if (Math.abs(target - visibleStart) <= SCROLL_EDGE_EPSILON) { + pendingRevealRef.current = null; + return; + } + // Showing an edge control changes the available width. Retarget only for + // changed geometry, not for each intermediate smooth-scroll position. + if (pending.target === undefined || Math.abs(target - pending.target) > SCROLL_EDGE_EPSILON) { + pending.target = scrollTo(target, pending.behavior); + } + // A tab wider than the viewport cannot show both edges; keep the original + // one-shot alignment instead of alternating between its edges. + if (itemRect.width > tabs.clientWidth) pendingRevealRef.current = null; + }, [getTabElements, scrollTo]); + + const observePendingReveal = useCallback(() => { + const pending = pendingRevealRef.current; + const observer = resizeObserverRef.current; + if (!pending || !observer) return false; + const tab = getTabElements().find(tab => tab.dataset.openbitfunValue === pending.id); + const item = tab?.closest('[data-openbitfun-part="item"]') ?? tab; + if (!item) return false; + // Re-observing delivers after layout even when the selected size is unchanged. + observer.unobserve(item); + observer.observe(item); + return true; + }, [getTabElements]); + useLayoutEffect(() => { updateScrollState(); @@ -103,47 +157,46 @@ export function useSceneTabNavigation({ const tabs = tabsRef.current; if (!region || !tabs) return; - const observer = new ResizeObserver(updateScrollState); + const observer = new ResizeObserver(() => { + revealPendingTab(); + updateScrollState(); + }); + resizeObserverRef.current = observer; observer.observe(region); observer.observe(tabs); getTabElements().forEach((tab) => { observer.observe(tab.closest('[data-openbitfun-part="item"]') ?? tab); }); - return () => observer.disconnect(); - }, [getTabElements, tabOrderKey, updateScrollState]); + return () => { + observer.disconnect(); + resizeObserverRef.current = null; + pendingRevealRef.current = null; + }; + }, [getTabElements, revealPendingTab, tabOrderKey, updateScrollState]); useLayoutEffect(() => { - const tabs = tabsRef.current; - const activeTab = getTabElements().find(tab => tab.dataset.openbitfunValue === activeTabId); - const activeItem = activeTab?.closest('[data-openbitfun-part="item"]') ?? activeTab; - if (!tabs || !activeItem) return; - - const visibleStart = tabs.scrollLeft; - const visibleEnd = visibleStart + tabs.clientWidth; - const tabStart = activeItem.offsetLeft; - const tabEnd = tabStart + activeItem.offsetWidth; - let nextLeft = visibleStart; - - if (tabStart < visibleStart) { - nextLeft = tabStart; - } else if (tabEnd > visibleEnd) { - nextLeft = tabEnd - tabs.clientWidth; - } - - const behavior: ScrollBehavior = navigationMotion === 'pointer' && !prefersReducedMotion() - ? 'smooth' - : 'auto'; - scrollTo(nextLeft, behavior); + pendingRevealRef.current = activeTabId ? { + id: activeTabId, + behavior: navigationMotion === 'pointer' && !prefersReducedMotion() ? 'smooth' : 'auto', + } : null; + // Preserve the immediate activation measurement. Resize delivery only + // finishes an in-flight reveal when edge controls change the viewport. + revealPendingTab(); + if (!resizeObserverRef.current) pendingRevealRef.current = null; updateScrollState(); - }, [activeTabId, getTabElements, navigationMotion, scrollTo, tabOrderKey, updateScrollState]); + }, [activeTabId, navigationMotion, revealPendingTab, tabOrderKey, updateScrollState]); const handleScroll = useCallback(() => { updateScrollState(); - }, [updateScrollState]); + // Finish a reveal after any edge-control layout update. Wheel/page commands + // release this request, so subsequent resizes cannot reclaim manual scroll. + observePendingReveal(); + }, [observePendingReveal, updateScrollState]); const handleWheel = useCallback((event: WheelEvent) => { const tabs = tabsRef.current; if (!tabs || !scrollState.hasOverflow) return; + if (event.deltaX || event.deltaY) pendingRevealRef.current = null; // Preserve native horizontal trackpad movement. A vertical mouse wheel is // translated only while the pointer is over the tab strip. @@ -158,6 +211,7 @@ export function useSceneTabNavigation({ }, [scrollState.hasOverflow, updateScrollState]); const scrollByPage = useCallback((direction: -1 | 1) => { + pendingRevealRef.current = null; const tabs = tabsRef.current; if (!tabs) return; const step = Math.max(MIN_SCROLL_STEP, tabs.clientWidth * 0.72); diff --git a/src/web-ui/src/app/global-search/GlobalSearchRoot.scss b/src/web-ui/src/app/global-search/GlobalSearchRoot.scss index 0b7a1e606e..13efb25c6c 100644 --- a/src/web-ui/src/app/global-search/GlobalSearchRoot.scss +++ b/src/web-ui/src/app/global-search/GlobalSearchRoot.scss @@ -22,11 +22,16 @@ $chevron-box-slack: 5px; isolation: isolate; // The material and content clip themselves; the elevation layer stays outside. overflow: visible; - // Keep ancestor opacity at 1 so the glass layer can sample the page backdrop. + // Keep entrance opacity at 1 so the glass layer can sample the page backdrop. animation-name: global-search-surface-enter; &[data-state='exiting'] { - animation-name: global-search-surface-exit; + // Finish fading before Dialog releases its retained exit surface. + animation: global-search-surface-exit var(--openbitfun-motion-duration-fast) var(--openbitfun-motion-easing-exit) both; + + @media (prefers-reduced-motion: reduce) { + animation-duration: 1ms; + } } // The results viewport absorbs short windows and longer result sets. @@ -46,8 +51,9 @@ $chevron-box-slack: 5px; } @keyframes global-search-surface-exit { - from { transform: none; } - to { transform: translateY(var(--openbitfun-motion-distance-sm)) scale(0.98); } + // Keep the query and results at their open size throughout dismissal. + from { opacity: 1; } + to { opacity: 0; } } .global-search-dialog__material { diff --git a/src/web-ui/src/app/layout/WorkspaceBody.scss b/src/web-ui/src/app/layout/WorkspaceBody.scss index 7ca4649816..d83be29439 100644 --- a/src/web-ui/src/app/layout/WorkspaceBody.scss +++ b/src/web-ui/src/app/layout/WorkspaceBody.scss @@ -56,6 +56,10 @@ $_resize-target-width: 12px; height: 100%; overflow: visible; + // The width is consumed here, not by the navigation contents. Keep each + // pointer update from invalidating the inherited style of every nav item. + > * { --nav-width: initial; } + // The shared material stays visible through every navigation mode. > .openbitfun-nav-bar, > .openbitfun-nav-panel, @@ -284,9 +288,14 @@ $_resize-target-width: 12px; min-width: 0; } -.openbitfun-is-dragging-nav-collapse, -.openbitfun-is-dragging-nav-collapse * { - cursor: ew-resize !important; +// Pointer capture still owns the gesture. A transparent cursor surface avoids +// changing the cursor style of every mounted element at pointer down/up. +body.openbitfun-is-dragging-nav-collapse::after { + content: ''; + position: fixed; + inset: 0; + z-index: var(--openbitfun-layer-fullscreen); + cursor: ew-resize; } @media (prefers-reduced-motion: reduce) { diff --git a/src/web-ui/src/app/layout/WorkspaceBody.tsx b/src/web-ui/src/app/layout/WorkspaceBody.tsx index 84a415b82a..a02d8a1291 100644 --- a/src/web-ui/src/app/layout/WorkspaceBody.tsx +++ b/src/web-ui/src/app/layout/WorkspaceBody.tsx @@ -59,6 +59,7 @@ const WorkspaceBody: React.FC = ({ const activeSceneId = useSceneStore(selectActiveSceneId); const isNavCollapsed = state.layout.leftPanelCollapsed; const [navWidth, setNavWidth] = useState(NAV_DEFAULT_WIDTH); + const [navResizing, setNavResizing] = useState(false); const navAreaRef = useRef(null); const navDividerRef = useRef(null); const navGripRef = useRef(null); @@ -73,6 +74,7 @@ const WorkspaceBody: React.FC = ({ collapsed: isNavCollapsed, onWidthChange: setNavWidth, onCollapse: toggleLeftPanel, + onResizeStateChange: setNavResizing, }); return ( @@ -149,6 +151,7 @@ const WorkspaceBody: React.FC = ({
{ let preferenceChanged: () => void; let committed: ReturnType; let collapse: ReturnType; + let resizeStateChanged: ReturnType; let captured: Set; function Harness({ collapsed = false }: { collapsed?: boolean }) { @@ -27,6 +28,7 @@ describe('navigation resize interaction', () => { areaRef, dividerRef, gripRef, width, minWidth: 216, maxWidth: 480, collapseThreshold: 64, collapsed, onWidthChange: value => { committed(value); setWidth(value); }, onCollapse: collapse, + onResizeStateChange: resizeStateChanged, }); return <>
@@ -72,7 +74,7 @@ describe('navigation resize interaction', () => { beforeEach(() => { frames = new Map(); nextFrame = 0; now = 0; reducedMotion = false; - committed = vi.fn(); collapse = vi.fn(); captured = new Set(); + committed = vi.fn(); collapse = vi.fn(); resizeStateChanged = vi.fn(); captured = new Set(); vi.spyOn(performance, 'now').mockImplementation(() => now); vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => { frames.set(++nextFrame, callback); return nextFrame; @@ -106,7 +108,9 @@ describe('navigation resize interaction', () => { expect(divider().style.getPropertyValue('--nav-width')).toBe('370px'); expect(shape().centerX).toBeGreaterThan(24); expect(committed).not.toHaveBeenCalled(); + expect(resizeStateChanged.mock.calls).toEqual([[true]]); pointer('pointerup', 382); + expect(resizeStateChanged.mock.calls).toEqual([[true], [false]]); expect(committed).toHaveBeenCalledExactlyOnceWith(382); expect(divider().getAttribute('data-resize-feedback')).toBe('settling'); paint(100); @@ -246,6 +250,7 @@ describe('navigation resize interaction', () => { expect(document.body.classList.contains('openbitfun-is-resizing-nav')).toBe(false); expect(document.body.classList.contains('openbitfun-is-dragging-nav-collapse')).toBe(false); expect(captured.size).toBe(0); + expect(resizeStateChanged.mock.calls).toEqual([[true], [false]]); expect(frames.size).toBe(0); pointer('pointerup', 400); expect(committed).not.toHaveBeenCalled(); diff --git a/src/web-ui/src/app/layout/useNavResize.ts b/src/web-ui/src/app/layout/useNavResize.ts index 64741a7575..8f382beba0 100644 --- a/src/web-ui/src/app/layout/useNavResize.ts +++ b/src/web-ui/src/app/layout/useNavResize.ts @@ -12,6 +12,7 @@ interface NavResizeOptions { collapsed: boolean; onWidthChange: (width: number) => void; onCollapse: () => void; + onResizeStateChange?: (resizing: boolean) => void; } const REST_LENGTH = 32; @@ -38,7 +39,7 @@ function advance(spring: Spring, target: number, dt: number, active: boolean) { /** The pane tracks directly; the grip stretches and bows in the pull direction. */ export function useNavResize({ areaRef, dividerRef, gripRef, width, minWidth, maxWidth, collapseThreshold, - collapsed, onWidthChange, onCollapse, + collapsed, onWidthChange, onCollapse, onResizeStateChange, }: NavResizeOptions) { const dragRef = useRef<((commit: boolean) => void) | null>(null); const animationRef = useRef(null); @@ -165,6 +166,7 @@ export function useNavResize({ if (divider.hasPointerCapture?.(pointerId)) divider.releasePointerCapture(pointerId); document.body.style.userSelect = previousUserSelect; document.body.classList.remove('openbitfun-is-dragging-nav-collapse', 'openbitfun-is-resizing-nav'); + onResizeStateChange?.(false); if (commit) { onWidthChange(latestWidth); pullVelocity.current = 0; @@ -213,6 +215,7 @@ export function useNavResize({ } dragRef.current = finish; divider.setPointerCapture?.(pointerId); + onResizeStateChange?.(true); divider.setAttribute('data-resize-feedback', 'dragging'); document.body.style.userSelect = 'none'; document.body.classList.add('openbitfun-is-dragging-nav-collapse', 'openbitfun-is-resizing-nav'); @@ -224,7 +227,7 @@ export function useNavResize({ window.addEventListener('resize', cancel); divider.addEventListener('lostpointercapture', lostCapture); animateFeedback(); - }, [animateFeedback, areaRef, collapsed, collapseThreshold, maxWidth, minWidth, onCollapse, onWidthChange, resetFeedback, width]); + }, [animateFeedback, areaRef, collapsed, collapseThreshold, maxWidth, minWidth, onCollapse, onWidthChange, onResizeStateChange, resetFeedback, width]); const onKeyDown = useCallback((event: KeyboardEvent) => { if (dragRef.current || collapsed) return; diff --git a/src/web-ui/src/app/scenes/SceneViewport.scss b/src/web-ui/src/app/scenes/SceneViewport.scss index 5050f9a8fc..2e94a6988b 100644 --- a/src/web-ui/src/app/scenes/SceneViewport.scss +++ b/src/web-ui/src/app/scenes/SceneViewport.scss @@ -88,8 +88,11 @@ &:not(.openbitfun-scene-viewport__scene--visible) { // Descendants can override inherited visibility. Hide the entire subtree - // immediately while keeping its mounted state and layout measurements. + // while retaining its DOM/state. Skip inactive layout work during pane + // resizing; revealing the scene restores rendering before its next paint. + // Visible incoming/outgoing scenes retain their existing crossfade. opacity: 0; + content-visibility: hidden; transition: none; } } diff --git a/src/web-ui/src/app/scenes/SceneViewport.test.tsx b/src/web-ui/src/app/scenes/SceneViewport.test.tsx index 3dd52ca32d..692ec3d1e3 100644 --- a/src/web-ui/src/app/scenes/SceneViewport.test.tsx +++ b/src/web-ui/src/app/scenes/SceneViewport.test.tsx @@ -25,6 +25,7 @@ const sceneHarness = vi.hoisted(() => { agentsReady, agentsAreReady: () => agentsAreReady, resolveAgents: () => resolveAgents?.(), + settingsSuspension: null as Promise | null, }; }); @@ -50,18 +51,23 @@ vi.mock('./session/SessionScene', () => ({ })); vi.mock('./settings/SettingsScene', () => ({ - default: ({ isActive }: { isActive?: boolean }) => ( -
{ + if (sceneHarness.settingsSuspension) throw sceneHarness.settingsSuspension; + return
- ), + />; + }, })); vi.mock('./assistant/AssistantScene', () => ({ default: () =>
, })); +vi.mock('./todos/TodosScene', () => ({ + default: ({ isActive }: { isActive: boolean }) =>
, +})); + vi.mock('./welcome/WelcomeScene', () => ({ default: () =>
, })); @@ -89,6 +95,7 @@ describe('SceneViewport transitions', () => { let root: Root; beforeEach(() => { + sceneHarness.settingsSuspension = null; sessionPaneLayoutStore.setState(sessionPaneLayoutStore.getInitialState()); vi.useFakeTimers(); vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => ( @@ -176,6 +183,21 @@ describe('SceneViewport transitions', () => { expect(visibleScenes().map(scene => scene.getAttribute('data-scene-id'))).toEqual(['settings']); }); + it('keeps a visible secondary Todos clock active even while another pane is focused', async () => { + sessionPaneLayoutStore.getState().showContent(); + sceneHarness.state = { + openTabs: [{ id: 'session', lastUsed: 1 }, { id: 'todos', lastUsed: 2, pane: 'secondary' }], + activeTabId: 'session', navigationMotion: 'instant', navigationSequence: 1, + paneSelections: { primary: sceneSelection('session'), secondary: sceneSelection('todos') }, + }; + await act(async () => root.render()); + const owner = container.querySelector('[data-testid="todos-clock-owner"]'); + expect(owner?.getAttribute('data-active')).toBe('true'); + act(() => sessionPaneLayoutStore.getState().hideContent()); + expect(container.querySelector('[data-testid="todos-clock-owner"]')).toBe(owner); + expect(owner?.getAttribute('data-active')).toBe('false'); + }); + it('keeps one scene visible while a lazy pointer target becomes ready', async () => { act(() => root.render()); expect(visibleScenes().map(scene => scene.getAttribute('data-scene-id'))).toEqual(['session']); @@ -244,6 +266,24 @@ describe('SceneViewport transitions', () => { expect(container.querySelector('[data-scene-id="agents"]')?.hasAttribute('hidden')).toBe(false); }); + it('waits for a closed scene to become ready again before revealing its new tree', async () => { + sceneHarness.state.openTabs.push({ id: 'settings', lastUsed: 1 }); + act(() => root.render()); + sceneHarness.state.openTabs = [{ id: 'session', lastUsed: 0 }]; + act(() => root.render()); + let resolveSettings!: () => void; + sceneHarness.settingsSuspension = new Promise(resolve => { resolveSettings = resolve; }); + sceneHarness.state = { openTabs: [{ id: 'session', lastUsed: 0 }, { id: 'settings', lastUsed: 1 }], + activeTabId: 'settings', navigationMotion: 'pointer', navigationSequence: 1 }; + await act(async () => { root.render(); await Promise.resolve(); }); + expect(visibleScenes().map(scene => scene.getAttribute('data-scene-id'))).toEqual(['session']); + expect(container.querySelector('[data-scene-id="settings"]')?.getAttribute('data-pane-motion-phase')).toBe('holding'); + await act(async () => { + sceneHarness.settingsSuspension = null; resolveSettings(); await Promise.resolve(); + }); + expect(visibleScenes().map(scene => scene.getAttribute('data-scene-id')).sort()).toEqual(['session', 'settings']); + }); + it('keeps an inactive open MiniApp scene mounted and hidden', async () => { sceneHarness.state = { openTabs: [ @@ -301,4 +341,5 @@ describe('SceneViewport transitions', () => { expect(container.querySelector('[data-testid="settings-scene-content"]')).toBe(settingsContent); expect(settingsContent?.getAttribute('data-scene-prop-active')).toBe('true'); }); + }); diff --git a/src/web-ui/src/app/scenes/SceneViewport.tsx b/src/web-ui/src/app/scenes/SceneViewport.tsx index 33b287e717..e8543e1243 100644 --- a/src/web-ui/src/app/scenes/SceneViewport.tsx +++ b/src/web-ui/src/app/scenes/SceneViewport.tsx @@ -108,7 +108,7 @@ interface SceneTransition { interface SceneReadyBoundaryProps { sceneId: SceneTabId; - onReady: (sceneId: SceneTabId) => void; + onReady: (sceneId: SceneTabId) => () => void; children: React.ReactNode; } @@ -123,7 +123,7 @@ const SceneReadyBoundary: React.FC = ({ children, }) => { useLayoutEffect(() => { - onReady(sceneId); + return onReady(sceneId); }, [onReady, sceneId]); return <>{children}; @@ -279,9 +279,12 @@ function useSceneTransition(activeRenderedSceneId: RenderedSceneId | null, const previousActiveTabIdRef = useRef(activeRenderedSceneId); const markSceneReady = useCallback((sceneId: SceneTabId) => { - if (readySceneIdsRef.current.has(sceneId)) return; - readySceneIdsRef.current.add(sceneId); - setReadyVersion(version => version + 1); + if (!readySceneIdsRef.current.has(sceneId)) { + readySceneIdsRef.current.add(sceneId); + setReadyVersion(version => version + 1); + } + // Readiness belongs to the mounted tree, not a tab id that may be reopened. + return () => { readySceneIdsRef.current.delete(sceneId); }; }, []); // Derive the outgoing id during render as well as from state. Pointer @@ -405,7 +408,7 @@ function renderScene( case 'assistant': return ; case 'todos': - return ; + return ; case 'insights': return ; case 'shell': diff --git a/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.navigation.test.tsx b/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.navigation.test.tsx index 53a87c0fc6..0678f643d5 100644 --- a/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.navigation.test.tsx +++ b/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.navigation.test.tsx @@ -14,6 +14,8 @@ const mocks = vi.hoisted(() => ({ getListing: vi.fn(), installedStatus: vi.fn(), browse: vi.fn(), install: vi.fn(), openApp: vi.fn(), deleteMiniApp: vi.fn(), error: vi.fn(), success: vi.fn(), systemInstall: vi.fn(), progress: vi.fn(), + listMiniApps: vi.fn(), workerListRunning: vi.fn(), installedOrigins: vi.fn(), + refetch: undefined as undefined | (() => Promise), })); vi.mock('@/infrastructure/i18n', () => ({ useI18n: () => ({ t: (key: string) => key, currentLanguage: 'en-US', formatNumber: String, @@ -24,7 +26,9 @@ vi.mock('@/shared/notification-system', () => ({ useNotification: () => mocks }) vi.mock('@/infrastructure/account-identity', () => ({ useAccountIdentity: () => ({ me: null }) })); vi.mock('@/features/market-account', () => ({ AccountIdentityControls: () => null })); vi.mock('@/app/hooks/useSceneManager', () => ({ useSceneManager: () => ({ openTabs: [], closeScene: vi.fn() }) })); -vi.mock('@/app/hooks/useGallerySceneAutoRefresh', () => ({ useGallerySceneAutoRefresh: () => undefined })); +vi.mock('@/app/hooks/useGallerySceneAutoRefresh', () => ({ + useGallerySceneAutoRefresh: ({ refetch }: { refetch: () => Promise }) => { mocks.refetch = refetch; }, +})); vi.mock('../hooks/useMiniAppActivity', () => ({ useMiniAppActivity: () => [] })); vi.mock('../hooks/useMiniAppCreation', () => ({ useMiniAppCreation: () => ({ creating: false, createMiniApp: vi.fn() }) })); vi.mock('../hooks/useMiniAppLaunch', () => ({ useMiniAppLaunch: () => ({ supported: !mocks.remote, busyAppIds: [], openApp: mocks.openApp }) })); @@ -76,6 +80,9 @@ beforeEach(() => { mocks.installedStatus.mockResolvedValue(null); mocks.deleteMiniApp.mockReset().mockResolvedValue(undefined); mocks.browse.mockResolvedValue({ items: [listing] }); + mocks.listMiniApps.mockResolvedValue([app]); + mocks.workerListRunning.mockResolvedValue([]); + mocks.installedOrigins.mockResolvedValue({}); mocks.install.mockResolvedValue({ app, origin: { listingId: listing.listingId, releaseId: 'r1', releaseNumber: 1, packageSha256: '' } }); mocks.systemInstall.mockResolvedValue({ path: '/Applications/Notes.app' }); mocks.progress.mockReturnValue({ complete: mocks.success, fail: mocks.error, cancel: vi.fn() }); @@ -87,9 +94,44 @@ beforeEach(() => { afterEach(() => { act(() => root.unmount()); container.remove(); + vi.useRealTimers(); }); describe('MiniApp detail page navigation', () => { + it.each([{ apps: [] }, { apps: [app] }])('finishes the installed refresh before the marketplace responds: $apps.length entries', async ({ apps }) => { + vi.useFakeTimers(); + mocks.listMiniApps.mockResolvedValue(apps); + useMiniAppStore.setState({ apps }); + let finishCatalog!: (page: { items: MarketListingDetail[] }) => void; + mocks.browse.mockReturnValue(new Promise(resolve => { finishCatalog = resolve; })); + await render(); + let refresh!: Promise; + await act(async () => { refresh = mocks.refetch!(); }); + expect(mocks.listMiniApps).toHaveBeenCalledOnce(); + expect(mocks.workerListRunning).toHaveBeenCalledOnce(); + expect(mocks.installedOrigins).toHaveBeenCalledOnce(); + expect(mocks.browse).toHaveBeenCalledOnce(); + expect(useMiniAppStore.getState().apps).toEqual(apps); + expect(useMiniAppStore.getState().loading).toBe(false); + expect(container.querySelector('.gallery-skeleton')).toBeNull(); + expect(container.querySelector('[role="list"][aria-busy="true"]')).toBeNull(); + if (apps.length) expect(container.querySelector('.miniapp-installed-card')?.textContent).toContain('Notes'); + else expect(container.textContent).toContain('market.library.empty'); + await act(async () => { finishCatalog({ items: [listing] }); await refresh; }); + expect(useMiniAppStore.getState().apps).toEqual(apps); + }); + + it('retains installed data when a refreshed marketplace request fails', async () => { + vi.useFakeTimers(); + mocks.browse.mockRejectedValue(new Error('Marketplace unavailable')); + await render(); + await act(async () => { await mocks.refetch!(); }); + expect(useMiniAppStore.getState().apps).toEqual([app]); + expect(useMiniAppStore.getState().loading).toBe(false); + expect(container.querySelector('.miniapp-installed-card')?.textContent).toContain('Notes'); + expect(mocks.browse).toHaveBeenCalledOnce(); + }); + it('uses notification-center feedback when adding a system app from the card menu', async () => { await render(); const more = container.querySelector('[aria-label="presentation.moreActions"]')!; diff --git a/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.tsx b/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.tsx index e67df38bdc..fecffd6282 100644 --- a/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.tsx +++ b/src/web-ui/src/app/scenes/miniapps/views/MiniAppLibraryView.tsx @@ -333,13 +333,16 @@ const MiniAppLibraryContent: React.FC = ({ setApps(refreshed); setRunningWorkerIds(running); setMarketOrigins(origins); - await fetchCatalog(undefined, false); } catch (error) { if (!surfaceScope.isCurrent()) return; log.error('Failed to refresh MiniApp library', error); + return; } finally { if (surfaceScope.isCurrent()) setLoading(false); } + // Installed entries are ready independently of the network catalog. Keep + // refreshing marketplace metadata without extending the local loading state. + await fetchCatalog(undefined, false); }, [fetchCatalog, setApps, setLoading, setMarketOrigins, setRunningWorkerIds, surfaceScope]); useGallerySceneAutoRefresh({ diff --git a/src/web-ui/src/app/scenes/personal-overview/PersonalOverviewScene.tsx b/src/web-ui/src/app/scenes/personal-overview/PersonalOverviewScene.tsx index df77dd4b42..cde3d9f860 100644 --- a/src/web-ui/src/app/scenes/personal-overview/PersonalOverviewScene.tsx +++ b/src/web-ui/src/app/scenes/personal-overview/PersonalOverviewScene.tsx @@ -100,7 +100,7 @@ const PersonalOverviewScene: React.FC<{ isActive?: boolean }> = ({ isActive = tr : null ); const avatarRef = useRef(null); - useSubagentAvatarMotion(avatarRef, 'running', isActive, 'personal-overview'); + useSubagentAvatarMotion(avatarRef, 'running', isActive, 'personal-overview', 'layers'); const summary = useMemo(() => usage.status === 'ready' ? summarizeOverviewUsage(usage.data.stats, resolvedTimeZone, usage.data.now) : null, [usage, resolvedTimeZone]); diff --git a/src/web-ui/src/app/scenes/settings/SettingsNav.test.tsx b/src/web-ui/src/app/scenes/settings/SettingsNav.test.tsx index 5b6ab16955..94e91b73a4 100644 --- a/src/web-ui/src/app/scenes/settings/SettingsNav.test.tsx +++ b/src/web-ui/src/app/scenes/settings/SettingsNav.test.tsx @@ -153,7 +153,7 @@ describe('SettingsNav shared component composition', () => { expect(container.querySelector('[role="status"]')).toBeNull(); }); - it('marks only pages that currently own an unsaved draft', () => { + it('keeps unsaved markers outside navigation and search-result text', async () => { act(() => { registerSettingsDraft({ id: 'model-proxy', @@ -167,8 +167,17 @@ describe('SettingsNav shared component composition', () => { const models = container.querySelector('[data-settings-page="ai.models"]'); const general = container.querySelector('[data-settings-page="application.general"]'); - expect(models?.querySelector('[data-openbitfun-part="dirtyMarker"]')).not.toBeNull(); + const marker = models?.querySelector('[data-openbitfun-part="dirtyMarker"]'); + expect(marker).not.toBeNull(); + expect(marker?.closest('[data-openbitfun-part="metadata"]')?.parentElement).toBe(models); + expect(models?.querySelector('[data-openbitfun-part="label"]')?.contains(marker!)).toBe(false); expect(general?.querySelector('[data-openbitfun-part="dirtyMarker"]')).toBeNull(); + + await search('models'); + const result = container.querySelector('[role="option"]')!; + const resultMarker = result.querySelector('[data-openbitfun-part="dirtyMarker"]')!; + expect(resultMarker.closest('[data-openbitfun-part="metadata"]')?.parentElement).toBe(result); + expect(result.querySelector('[data-openbitfun-part="label"]')?.contains(resultMarker)).toBe(false); }); it('opens a matching inline section without matching its siblings through the page description', async () => { @@ -189,12 +198,37 @@ describe('SettingsNav shared component composition', () => { it('marks a slow destination pending before showing its loading page', async () => { vi.mocked(preloadSettingsPage).mockReturnValue(new Promise(() => {})); const item = container.querySelector('[data-settings-page="application.appearance"]') as HTMLButtonElement; + const label = item.querySelector('[data-openbitfun-part="label"]')!; + const originalLabel = label.innerHTML; await act(async () => item.click()); expect(item.getAttribute('aria-busy')).toBe('true'); + const spinner = item.querySelector('[data-openbitfun-component="spinner"]')!; + expect(spinner).not.toBeNull(); + expect(spinner.closest('[data-openbitfun-part="metadata"]')?.parentElement).toBe(item); + expect(label.innerHTML).toBe(originalLabel); expect(useSettingsStore.getState().activePageId).toBe('application.general'); await act(async () => vi.advanceTimersByTimeAsync(180)); expect(useSettingsStore.getState().activePageId).toBe('application.appearance'); expect(item.hasAttribute('aria-busy')).toBe(false); + expect(item.querySelector('[data-openbitfun-component="spinner"]')).toBeNull(); + expect(label.innerHTML).toBe(originalLabel); + }); + + it('keeps pending search-result indicators outside the two-line copy', async () => { + vi.mocked(preloadSettingsPage).mockReturnValue(new Promise(() => {})); + await search('appearance'); + const item = container.querySelector('[role="option"]')!; + const label = item.querySelector('[data-openbitfun-part="label"]')!; + const originalLabel = label.innerHTML; + + await act(async () => item.click()); + + const spinner = item.querySelector('[data-openbitfun-component="spinner"]')!; + expect(item.getAttribute('aria-busy')).toBe('true'); + expect(spinner).not.toBeNull(); + expect(spinner.closest('[data-openbitfun-part="metadata"]')?.parentElement).toBe(item); + expect(label.innerHTML).toBe(originalLabel); + expect(useSettingsStore.getState().activePageId).toBe('application.general'); }); it('ignores an earlier click when its preload completes after the latest selection', async () => { diff --git a/src/web-ui/src/app/scenes/settings/SettingsNav.tsx b/src/web-ui/src/app/scenes/settings/SettingsNav.tsx index 8f626bd9ee..01c65d44a9 100644 --- a/src/web-ui/src/app/scenes/settings/SettingsNav.tsx +++ b/src/web-ui/src/app/scenes/settings/SettingsNav.tsx @@ -328,6 +328,7 @@ const SettingsNav: React.FC = () => { aria-selected={active} aria-busy={pendingPageId === row.destination.pageId || undefined} leading={} + metadata={pendingPageId === row.destination.pageId ? : dirtyMarker(row.destination.pageId)} selected={active} data-openbitfun-component="settings-nav" data-openbitfun-part="searchResult" @@ -352,7 +353,6 @@ const SettingsNav: React.FC = () => { {highlightFirstMatch(row.description, searchQuery)} - {pendingPageId === row.destination.pageId ? : dirtyMarker(row.destination.pageId)} ); })} @@ -389,6 +389,7 @@ const SettingsNav: React.FC = () => { data-openbitfun-state={activePageId === page.id ? 'active' : undefined} className="openbitfun-settings-nav__item" leading={} + metadata={pendingPageId === page.id ? : dirtyMarker(page.id)} selected={activePageId === page.id} aria-busy={pendingPageId === page.id || undefined} onClick={() => activate({ pageId: page.id })} @@ -396,7 +397,6 @@ const SettingsNav: React.FC = () => { onFocus={() => preload(page.id)} > {t(page.labelKey)} - {pendingPageId === page.id ? : dirtyMarker(page.id)} ))}
diff --git a/src/web-ui/src/app/scenes/todos/TodosScene.tsx b/src/web-ui/src/app/scenes/todos/TodosScene.tsx index 32bd63f9d9..a2f14ace02 100644 --- a/src/web-ui/src/app/scenes/todos/TodosScene.tsx +++ b/src/web-ui/src/app/scenes/todos/TodosScene.tsx @@ -64,19 +64,17 @@ import { type TodoOccurrence, } from './todoOccurrences'; import { buildWorkspaceOptions, formatDateTime } from './todoPresentation'; +import { useTodoClock } from './useTodoClock'; import './TodosScene.scss'; const log = createLogger('TodosScene'); -/** Keeps countdowns honest without re-rendering more than once a minute. */ -const CLOCK_TICK_MS = 30_000; - function startOfCurrentMonthMs(nowMs: number): number { const now = new Date(nowMs); return new Date(now.getFullYear(), now.getMonth(), 1).getTime(); } -const TodosScene: React.FC = () => { +const TodosScene: React.FC<{ isActive?: boolean }> = ({ isActive = true }) => { const { t, formatDate } = useI18n(['scenes/todos', 'common', 'shared']); const instanceIdRef = useRef(`todos-scene-${Math.random().toString(36).slice(2)}`); @@ -84,7 +82,7 @@ const TodosScene: React.FC = () => { const [jobs, setJobs] = useState([]); const [saving, setSaving] = useState(false); - const [nowMs, setNowMs] = useState(() => Date.now()); + const nowMs = useTodoClock(isActive); const [monthAnchorMs, setMonthAnchorMs] = useState(() => startOfCurrentMonthMs(Date.now())); const [selectedDayKey, setSelectedDayKey] = useState(null); @@ -148,11 +146,6 @@ const TodosScene: React.FC = () => { return workspaceOptions[0]?.value ?? ''; }, [currentWorkspace, primaryAssistantWorkspaceId, workspaceOptions]); - useEffect(() => { - const timer = window.setInterval(() => setNowMs(Date.now()), CLOCK_TICK_MS); - return () => window.clearInterval(timer); - }, []); - const loadJobs = useCallback(async () => { try { // No filters: the Todos panel is the cross-workspace view. diff --git a/src/web-ui/src/app/scenes/todos/useTodoClock.test.tsx b/src/web-ui/src/app/scenes/todos/useTodoClock.test.tsx new file mode 100644 index 0000000000..6514e4f5fc --- /dev/null +++ b/src/web-ui/src/app/scenes/todos/useTodoClock.test.tsx @@ -0,0 +1,77 @@ +// @vitest-environment jsdom +import React, { act } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { afterEach, beforeEach, expect, it, vi } from 'vitest'; +import { useTodoClock } from './useTodoClock'; + +let root: Root; +let container: HTMLDivElement; +let hidden: boolean; +function Clock({ active }: { active: boolean }) { + return {useTodoClock(active)}; +} +const render = (active: boolean) => act(() => root.render()); +const advance = (ms: number) => act(() => vi.advanceTimersByTime(ms)); +const read = () => Number(container.textContent); +beforeEach(() => { + Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true }); + vi.useFakeTimers(); + vi.setSystemTime(new Date('2026-11-05T23:59:50Z')); + hidden = false; + vi.spyOn(document, 'hidden', 'get').mockImplementation(() => hidden); + container = document.createElement('div'); + document.body.append(container); + root = createRoot(container); +}); +afterEach(() => { + act(() => root.unmount()); + container.remove(); + vi.restoreAllMocks(); + vi.useRealTimers(); +}); + +it('keeps the existing 30-second cadence while visible', () => { + render(true); + const start = read(); + advance(29_999); + expect(read()).toBe(start); + advance(1); + expect(read()).toBe(start + 30_000); +}); + +it('stops inactive ticks and catches up immediately on return across midnight', () => { + render(true); + const start = read(); + render(false); + expect(vi.getTimerCount()).toBe(0); + advance(120_000); + expect(read()).toBe(start); + render(true); + expect(read()).toBe(start + 120_000); + expect(vi.getTimerCount()).toBe(1); +}); + +it('suspends a hidden document and resumes without duplicate timers', () => { + render(true); + const start = read(); + hidden = true; + act(() => document.dispatchEvent(new Event('visibilitychange'))); + advance(90_000); + expect(read()).toBe(start); + expect(vi.getTimerCount()).toBe(0); + hidden = false; + act(() => document.dispatchEvent(new Event('visibilitychange'))); + act(() => document.dispatchEvent(new Event('visibilitychange'))); + expect(read()).toBe(start + 90_000); + expect(vi.getTimerCount()).toBe(1); +}); + +it('does not restart an inactive or unmounted scene when the document becomes visible', () => { + render(false); + act(() => document.dispatchEvent(new Event('visibilitychange'))); + expect(vi.getTimerCount()).toBe(0); + render(true); + act(() => root.render(null)); + act(() => document.dispatchEvent(new Event('visibilitychange'))); + expect(vi.getTimerCount()).toBe(0); +}); diff --git a/src/web-ui/src/app/scenes/todos/useTodoClock.ts b/src/web-ui/src/app/scenes/todos/useTodoClock.ts new file mode 100644 index 0000000000..74aed3142b --- /dev/null +++ b/src/web-ui/src/app/scenes/todos/useTodoClock.ts @@ -0,0 +1,27 @@ +import { useLayoutEffect, useState } from 'react'; + +const CLOCK_TICK_MS = 30_000; + +/** Only the displayed countdown needs ticks; job subscriptions remain live. */ +export function useTodoClock(isActive: boolean): number { + const [nowMs, setNowMs] = useState(() => Date.now()); + useLayoutEffect(() => { + if (!isActive) return; + let timer: ReturnType | undefined; + const sync = () => { + if (timer !== undefined) clearInterval(timer); + timer = undefined; + if (document.hidden) return; + // Catch up before a retained scene paints, including a day/month boundary. + setNowMs(Date.now()); + timer = setInterval(() => setNowMs(Date.now()), CLOCK_TICK_MS); + }; + sync(); + document.addEventListener('visibilitychange', sync); + return () => { + if (timer !== undefined) clearInterval(timer); + document.removeEventListener('visibilitychange', sync); + }; + }, [isActive]); + return nowMs; +} diff --git a/src/web-ui/src/app/styles/motion.test.ts b/src/web-ui/src/app/styles/motion.test.ts index 5cf566e453..7ca82af0ab 100644 --- a/src/web-ui/src/app/styles/motion.test.ts +++ b/src/web-ui/src/app/styles/motion.test.ts @@ -1,8 +1,13 @@ // @vitest-environment jsdom import { resolve } from 'node:path'; +import { act, createElement } from 'react'; +import { createRoot } from 'react-dom/client'; +import { Dialog, Sheet } from '@openbitfun/ui'; import { compile } from 'sass'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; + +globalThis.IS_REACT_ACT_ENVIRONMENT = true; const style = document.createElement('style'); style.textContent = compile(resolve(__dirname, 'motion.scss')).css; @@ -35,4 +40,38 @@ describe('global motion ownership', () => { expect(entranceRules(element)).toHaveLength(0); }, ); + + it.each([ + { name: 'Dialog', Surface: Dialog }, + { name: 'Sheet', Surface: Sheet }, + ])('keeps the production $name entrance and exit outside the fallback animation', ({ Surface }) => { + vi.useFakeTimers(); + vi.stubGlobal('matchMedia', () => ({ + matches: false, + addEventListener: vi.fn(), + removeEventListener: vi.fn(), + })); + const host = document.createElement('div'); + document.body.appendChild(host); + const root = createRoot(host); + const render = (open: boolean) => act(() => root.render(createElement( + Surface, + { open, onOpenChange: () => undefined, children: createElement('button', null, 'Content') }, + ))); + try { + render(true); + const surface = document.querySelector('[role="dialog"]')!; + expect(entranceRules(surface)).toHaveLength(0); + render(false); + expect(surface.dataset.state).toBe('exiting'); + expect(entranceRules(surface)).toHaveLength(0); + act(() => vi.runAllTimers()); + expect(surface.isConnected).toBe(false); + } finally { + act(() => root.unmount()); + host.remove(); + vi.useRealTimers(); + vi.unstubAllGlobals(); + } + }); }); diff --git a/src/web-ui/src/app/workbench/AGENTS.md b/src/web-ui/src/app/workbench/AGENTS.md index e1cf366747..5d05e8a542 100644 --- a/src/web-ui/src/app/workbench/AGENTS.md +++ b/src/web-ui/src/app/workbench/AGENTS.md @@ -41,3 +41,13 @@ pnpm --dir src/web-ui run test:run src/app/scenes/session/AuxPaneEmptyState.test ``` These fixtures verify routing and ownership; verify native presentation separately. + +For independent document find routing and platform/user shortcut bindings: + +```bash +pnpm --dir src/web-ui run test:run src/app/workbench/ContentResourceView.shortcuts.test.tsx src/infrastructure/services/ShortcutManager.test.ts src/app/browserShortcutPolicy.test.ts +``` + +Independent resources register editor find while active and focused, even when +no session canvas is mounted. The command delegates to the focused edit target; +document buffers and native browser-shortcut suppression retain their owners. diff --git a/src/web-ui/src/app/workbench/ContentResourceView.shortcuts.test.tsx b/src/web-ui/src/app/workbench/ContentResourceView.shortcuts.test.tsx new file mode 100644 index 0000000000..c628cbee95 --- /dev/null +++ b/src/web-ui/src/app/workbench/ContentResourceView.shortcuts.test.tsx @@ -0,0 +1,91 @@ +// @vitest-environment jsdom +import React, { act } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import ContentResourceView from './ContentResourceView'; +import { useContentResourceStore } from './contentResourceStore'; +import { resetSceneStoreForTest, useSceneStore } from '../stores/sceneStore'; +import { releaseEditorDocument } from '@/tools/editor/services/EditorDocument'; +import { shortcutManager } from '@/infrastructure/services/ShortcutManager'; +import { activeEditTargetService } from '@/tools/editor/services/ActiveEditTargetService'; +import { handleBrowserShortcut } from '../browserShortcutPolicy'; + +vi.mock('@/infrastructure/i18n', () => ({ useI18n: () => ({ t: (key: string) => key }) })); +vi.mock('@/tools/editor/services/ActiveEditTargetService', () => ({ + activeEditTargetService: { openMonacoFind: vi.fn() }, +})); +vi.mock('../components/panels/base/FlexiblePanel', () => ({ + default: () =>