From 81b115b825b5de39eaff542e050d33c35e457c08 Mon Sep 17 00:00:00 2001 From: FurryR Date: Wed, 3 Jul 2024 20:25:50 +0800 Subject: [PATCH 1/2] FurryR/xterm: add extension Signed-off-by: FurryR --- extensions/FurryR/xterm.js | 1012 ++++++++++++++++++++++++++++++++++++ extensions/extensions.json | 1 + images/FurryR/xterm.png | Bin 0 -> 11828 bytes images/README.md | 4 + 4 files changed, 1017 insertions(+) create mode 100644 extensions/FurryR/xterm.js create mode 100644 images/FurryR/xterm.png diff --git a/extensions/FurryR/xterm.js b/extensions/FurryR/xterm.js new file mode 100644 index 0000000000..78ee5970fd --- /dev/null +++ b/extensions/FurryR/xterm.js @@ -0,0 +1,1012 @@ +// Name: xterm +// ID: xterm +// Description: Create console applications & games with xterm. +// By: FurryR +// License: MPL-2.0 + +(async function (Scratch) { + "use strict"; + const xtermStyle = document.createElement("link"); + xtermStyle.rel = "stylesheet"; + xtermStyle.href = + "https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/css/xterm.min.css"; + document.head.appendChild(xtermStyle); + const { Terminal } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/+esm" + ); + const { WebglAddon } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-webgl@0.18.0/+esm" + ); + const { FitAddon } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.10.0/+esm" + ); + const { Unicode11Addon } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-unicode11@0.8.0/+esm" + ); + const { CanvasAddon } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-canvas@0.7.0/+esm" + ); + const { WebLinksAddon } = await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-web-links@0.11.0/+esm" + ); + // Special patch for ligature addon that uses fs module which rollup doesn't support + await import( + "https://cdn.jsdelivr.net/npm/@xterm/addon-ligatures@0.9.0/lib/addon-ligatures.min.js" + ); + const { + LigaturesAddon: { LigaturesAddon }, + } = globalThis; + delete globalThis.LigaturesAddon; + const runtime = Scratch.vm.runtime; + const themeColor = [ + "foreground", + "background", + "selection", + "black", + "brightBlack", + "red", + "brightRed", + "green", + "brightGreen", + "yellow", + "brightYellow", + "blue", + "brightBlue", + "magenta", + "brightMagenta", + "cyan", + "brightCyan", + "white", + "brightWhite", + "cursor", + "cursorAccent", + "selectionBackground", + "selectionForeground", + "selectionInactiveBackground", + ]; + + class ScratchXTerm { + /** @type {HTMLDivElement?} */ + element; + /** @type {Terminal} */ + terminal; + /** @type {FitAddon} */ + fitAddon; + /** @type {LigaturesAddon?} */ + ligaturesAddon; + /** @type {WebLinksAddon?} */ + webLinksAddon; + /** @type {((data: string) => void)[]} */ + dataCallbacks = []; + /** @type {string} */ + buffer; + /** @type {boolean} */ + bufferEnabled; + /** @type {object} */ + eventData; + + constructor() { + this.terminal = new Terminal({ + allowTransparency: true, + fontFamily: + '"Jetbrains Mono", "Fira Code", "Cascadia Code", "Noto Emoji", "Segoe UI Emoji", "Lucida Console", Menlo, courier-new, courier, monospace', + cursorBlink: true, + theme: { + foreground: "#F8F8F8", + background: "rgba(45,46,44,0.8)", + selection: "#5DA5D533", + black: "#1E1E1D", + brightBlack: "#262625", + red: "#CE5C5C", + brightRed: "#FF7272", + green: "#5BCC5B", + brightGreen: "#72FF72", + yellow: "#CCCC5B", + brightYellow: "#FFFF72", + blue: "#5D5DD3", + brightBlue: "#7279FF", + magenta: "#BC5ED1", + brightMagenta: "#E572FF", + cyan: "#5DA5D5", + brightCyan: "#72F0FF", + white: "#F8F8F8", + brightWhite: "#FFFFFF", + }, + allowProposedApi: true, + }); + this.terminal.onData((e) => { + if (this.dataCallbacks.length > 0) { + for (const callback of this.dataCallbacks) { + callback(this.buffer + e); + } + this.buffer = ""; + this.dataCallbacks = []; + } else if (this.bufferEnabled) { + this.buffer += e; + } + }); + this.terminal.onResize(() => { + if (this.justInitialized) this.justInitialized = false; + else runtime.startHats("xterm_whenTerminalResized"); + }); + // Mouse event report support + this.terminal._core.coreMouseService.addEncoding("cursorReport", (e) => { + const actionMap = { + 1: "down", + 0: "up", + 32: "drag", + }; + if (e.button >= 0 && e.button <= 2) { + const buttonMap = { + 0: "left", + 1: "middle", + 2: "right", + }; + if ( + runtime.startHats("xterm_whenMouseClicked", { + BUTTON: buttonMap[e.button], + }).length > 0 + ) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + type: actionMap[e.action], + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else if (e.button === 3) { + if (runtime.startHats("xterm_whenMouseOver").length > 0) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else if (e.button === 4) { + if (runtime.startHats("xterm_whenScrolled").length > 0) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + type: actionMap[e.action], + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else { + console.log(e); + } + }); + const style = document.createElement("style"); + style.textContent = ` +.xterm-viewport.xterm-viewport { + scrollbar-width: none; +} +.xterm-viewport::-webkit-scrollbar { + width: 0; +} +`; + document.head.appendChild(style); + this.fitAddon = new FitAddon(); + try { + this.terminal.loadAddon(new WebglAddon()); + } catch { + this.terminal.loadAddon(new CanvasAddon()); + } + this.terminal.loadAddon(new Unicode11Addon()); + this.terminal.unicode.activeVersion = "11"; + this.terminal.loadAddon(this.fitAddon); + this.element = null; + this.buffer = ""; + this.bufferEnabled = false; + this.ligaturesAddon = null; + this.webLinksAddon = null; + this.justInitialized = false; + this.eventData = {}; + } + getInfo() { + return { + id: "xterm", + name: "xterm", + color1: "#1c1628", + blocks: [ + { + blockType: Scratch.BlockType.LABEL, + text: "🎨 " + Scratch.translate("Appearance"), + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeVisibility", + text: Scratch.translate("[STATUS] terminal"), + arguments: { + STATUS: { + type: Scratch.ArgumentType.STRING, + menu: "VISIBILITY", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeTheme", + text: Scratch.translate("set [THEME] color to [COLOR]"), + arguments: { + THEME: { + type: Scratch.ArgumentType.STRING, + menu: "THEME", + }, + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#5DA5D5", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeOption", + text: Scratch.translate("set [OPTION] to [VALUE]"), + arguments: { + OPTION: { + type: Scratch.ArgumentType.STRING, + menu: "OPTION", + }, + VALUE: { + type: Scratch.ArgumentType.STRING, + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "adjustFeature", + text: Scratch.translate("[STATUS] [FEATURE]"), + arguments: { + STATUS: { + type: Scratch.ArgumentType.STRING, + menu: "STATUS", + }, + FEATURE: { + type: Scratch.ArgumentType.STRING, + menu: "FEATURE", + }, + }, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "🎮 " + Scratch.translate("Input"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "get", + text: Scratch.translate("received character"), + }, + { + blockType: Scratch.BlockType.LABEL, + text: "📄 " + Scratch.translate("Output"), + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "print", + text: Scratch.translate("print [INFO] with [NEWLINE]"), + arguments: { + INFO: { + type: Scratch.ArgumentType.STRING, + defaultValue: "Hello World", + }, + NEWLINE: { + type: Scratch.ArgumentType.STRING, + menu: "NEWLINE", + }, + }, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "🖥️ " + Scratch.translate("Cursor & Screen"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "screenOptions", + text: Scratch.translate("query [SCREENOPTION]"), + arguments: { + SCREENOPTION: { + type: Scratch.ArgumentType.STRING, + menu: "SCREENOPTION", + }, + }, + disableMonitor: true, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "moveCursorTo", + text: Scratch.translate("move cursor to x:[X]y:[Y]"), + arguments: { + X: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0, + }, + Y: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0, + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "moveCursor", + text: Scratch.translate("move cursor [N] character(s) [DIRECTION]"), + arguments: { + N: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1, + }, + DIRECTION: { + type: Scratch.ArgumentType.STRING, + menu: "DIRECTION", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "clear", + text: Scratch.translate("clear [CLEARTYPE]"), + arguments: { + CLEARTYPE: { + type: Scratch.ArgumentType.STRING, + menu: "CLEARTYPE", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "reset", + text: Scratch.translate("reset screen"), + }, + { + blockType: Scratch.BlockType.CONDITIONAL, + opcode: "saveCursor", + text: Scratch.translate("cursor wrapper"), + branchCount: 1, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "❗ " + Scratch.translate("Events"), + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenTerminalResized", + text: Scratch.translate("when terminal resized"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenMouseClicked", + text: Scratch.translate("when mouse [BUTTON] clicked"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + arguments: { + BUTTON: { + type: Scratch.ArgumentType.STRING, + menu: "BUTTON", + }, + }, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenMouseOver", + text: Scratch.translate("when mouse over terminal"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenScrolled", + text: Scratch.translate("when mouse scrolled"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "getEventData", + text: Scratch.translate("mouse event data"), + }, + { + blockType: Scratch.BlockType.LABEL, + text: "🛠️ " + Scratch.translate("Utilities"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "coloredText", + text: Scratch.translate("[TEXT] in [COLOR] [TYPE]"), + arguments: { + TEXT: { + type: Scratch.ArgumentType.STRING, + defaultValue: "Hello World", + }, + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#FFFFFF", + }, + TYPE: { + type: Scratch.ArgumentType.STRING, + menu: "COLORTYPE", + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "withOpacity", + text: Scratch.translate("[COLOR] with opacity [OPACITY]"), + arguments: { + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#808080", + }, + OPACITY: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0.5, + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "toCodePoint", + text: Scratch.translate("the code point of [CHAR]"), + arguments: { + CHAR: { + type: Scratch.ArgumentType.STRING, + defaultValue: "a", + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "fromCodePoint", + text: Scratch.translate("the character of code point [CODE]"), + arguments: { + CODE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 32, + }, + }, + }, + ], + menus: { + VISIBILITY: { + items: [ + { + text: Scratch.translate("show"), + value: "show", + }, + { + text: Scratch.translate("hide"), + value: "hide", + }, + ], + }, + THEME: { + items: [ + { + text: Scratch.translate("foreground"), + value: "foreground", + }, + { + text: Scratch.translate("background"), + value: "background", + }, + { + text: Scratch.translate("selection"), + value: "selection", + }, + { + text: Scratch.translate("black"), + value: "black", + }, + { + text: Scratch.translate("bright black"), + value: "brightBlack", + }, + { + text: Scratch.translate("red"), + value: "red", + }, + { + text: Scratch.translate("bright red"), + value: "brightRed", + }, + { + text: Scratch.translate("green"), + value: "green", + }, + { + text: Scratch.translate("bright green"), + value: "brightGreen", + }, + { + text: Scratch.translate("yellow"), + value: "yellow", + }, + { + text: Scratch.translate("bright yellow"), + value: "brightYellow", + }, + { + text: Scratch.translate("blue"), + value: "blue", + }, + { + text: Scratch.translate("bright blue"), + value: "brightBlue", + }, + { + text: Scratch.translate("magenta"), + value: "magenta", + }, + { + text: Scratch.translate("bright magenta"), + value: "brightMagenta", + }, + { + text: Scratch.translate("cyan"), + value: "cyan", + }, + { + text: Scratch.translate("bright cyan"), + value: "brightCyan", + }, + { + text: Scratch.translate("white"), + value: "white", + }, + { + text: Scratch.translate("bright white"), + value: "brightWhite", + }, + { + text: Scratch.translate("cursor"), + value: "cursor", + }, + { + text: Scratch.translate("accent cursor"), + value: "cursorAccent", + }, + { + text: Scratch.translate("selection background"), + value: "selectionBackground", + }, + { + text: Scratch.translate("selection foreground"), + value: "selectionForeground", + }, + { + text: Scratch.translate("selection background when inactive"), + value: "selectionInactiveBackground", + }, + ], + }, + OPTION: { + items: [ + { + text: Scratch.translate("font size"), + value: "fontsize", + }, + { + text: Scratch.translate("line height"), + value: "lineheight", + }, + { + text: Scratch.translate("font family"), + value: "fontfamily", + }, + { + text: Scratch.translate("scrollback size"), + value: "scrollback", + }, + ], + }, + COLORTYPE: { + items: [ + { + text: Scratch.translate("background"), + value: "background", + }, + { + text: Scratch.translate("foreground"), + value: "foreground", + }, + ], + }, + STATUS: { + items: [ + { + text: Scratch.translate("enable"), + value: "enable", + }, + { + text: Scratch.translate("disable"), + value: "disable", + }, + ], + }, + FEATURE: { + items: [ + { + text: Scratch.translate("cursor blinking"), + value: "cursorblink", + }, + { + text: Scratch.translate("ligatures"), + value: "ligatures", + }, + { + text: Scratch.translate("web link"), + value: "link", + }, + { + text: Scratch.translate( + "mouse event report (disables selection)" + ), + value: "mouse", + }, + { + text: Scratch.translate("input buffer"), + value: "buffer", + }, + ], + }, + DIRECTION: { + items: [ + { + text: Scratch.translate("up"), + value: "up", + }, + { + text: Scratch.translate("down"), + value: "down", + }, + { + text: Scratch.translate("left"), + value: "left", + }, + { + text: Scratch.translate("right"), + value: "right", + }, + ], + }, + BUTTON: { + items: [ + { + text: Scratch.translate("left"), + value: "left", + }, + { + text: Scratch.translate("middle"), + value: "middle", + }, + { + text: Scratch.translate("right"), + value: "right", + }, + ], + }, + CLEARTYPE: { + items: [ + { + text: Scratch.translate("entire screen"), + value: "screen", + }, + { + text: Scratch.translate("characters after cursor"), + value: "after", + }, + { + text: Scratch.translate("characters before cursor"), + value: "before", + }, + { + text: Scratch.translate("scrollback"), + value: "scrollback", + }, + ], + }, + SCREENOPTION: { + items: [ + { + text: Scratch.translate("terminal size"), + value: "size", + }, + { + text: Scratch.translate("cursor position"), + value: "cursor", + }, + ], + }, + NEWLINE: { + items: [ + { + text: Scratch.translate("newline"), + value: "newline", + }, + { + text: Scratch.translate("no newline"), + value: "none", + }, + ], + }, + }, + }; + } + _initalizeXterm() { + const parentElement = runtime.renderer.canvas.parentElement; + runtime.renderer.canvas.style.position = "relative"; + this.element = document.createElement("div"); + this.element.style.position = "absolute"; + this.element.style.top = "0"; + this.element.style.left = "0"; + this.element.style.width = "100%"; + this.element.style.height = "100%"; + this.element.style.margin = "0"; + this.element.style.display = "grid"; + const _resize = runtime.renderer.resize; + runtime.renderer.resize = (width, height) => { + _resize.call(runtime.renderer, width, height); + this.fitAddon.fit(); + }; + parentElement.appendChild(this.element); + this.terminal.open(this.element); + this.justInitialized = true; + this.terminal._core.viewport.scrollBarWidth = 0; + this.fitAddon.fit(); + } + changeVisibility({ STATUS }) { + STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); + switch (STATUS) { + case "show": { + if (this.element) { + this.element.style.display = "grid"; + } else { + // initialize the element lazily. + this._initalizeXterm(); + } + break; + } + case "hide": { + if (this.element) { + this.element.style.display = "none"; + } + break; + } + } + } + changeTheme({ THEME, COLOR }) { + THEME = Scratch.Cast.toString(THEME); + if (!themeColor.includes(THEME)) return; + this.terminal.options.theme = Object.assign( + {}, + this.terminal.options.theme, + { [THEME]: Scratch.Cast.toString(COLOR) } + ); + } + changeOption({ OPTION, VALUE }) { + OPTION = Scratch.Cast.toString(OPTION).toLowerCase(); + switch (OPTION) { + case "fontsize": { + VALUE = Scratch.Cast.toNumber(VALUE); + if (isFinite(VALUE) && Math.floor(VALUE) === VALUE && VALUE > 0) { + this.terminal.options.fontSize = VALUE; + this.fitAddon.fit(); + } + break; + } + case "lineheight": { + VALUE = Scratch.Cast.toNumber(VALUE); + if (isFinite(VALUE) && VALUE > 1) { + this.terminal.options.lineHeight = VALUE; + this.fitAddon.fit(); + } + break; + } + case "fontfamily": { + this.terminal.options.fontFamily = Scratch.Cast.toString(VALUE); + break; + } + case "scrollback": + { + VALUE = Scratch.Cast.toNumber(VALUE); + if (isFinite(VALUE) && Math.floor(VALUE) === VALUE && VALUE > 0) { + this.terminal.options.scrollback = VALUE; + this.fitAddon.fit(); + } + } + break; + } + } + adjustFeature({ STATUS, FEATURE }) { + FEATURE = Scratch.Cast.toString(FEATURE).toLowerCase(); + STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); + switch (FEATURE) { + case "cursorblink": { + this.terminal.options.cursorBlink = STATUS === "enable"; + break; + } + case "ligatures": { + if (STATUS === "enable") { + if (this.ligaturesAddon) break; + this.ligaturesAddon = new LigaturesAddon(); + this.terminal.loadAddon(this.ligaturesAddon); + } else { + if (!this.ligaturesAddon) break; + this.ligaturesAddon.dispose(); + this.ligaturesAddon = null; + } + break; + } + case "mouse": { + if (STATUS === "enable") { + this.terminal._core.coreMouseService.activeEncoding = + "cursorReport"; + this.terminal._core.coreMouseService.activeProtocol = "ANY"; + } else { + this.terminal._core.coreMouseService.activeEncoding = "DEFAULT"; + this.terminal._core.coreMouseService.activeProtocol = "NONE"; + } + break; + } + case "link": { + if (STATUS === "enable") { + if (this.webLinksAddon) break; + this.webLinksAddon = new WebLinksAddon(); + this.terminal.loadAddon(this.webLinksAddon); + } else { + if (!this.webLinksAddon) break; + this.webLinksAddon.dispose(); + this.webLinksAddon = null; + } + break; + } + case "buffer": { + if (STATUS === "enable") { + this.bufferEnabled = true; + } else { + this.bufferEnabled = false; + this.buffer = ""; + } + break; + } + } + } + get() { + return new Promise((resolve) => { + this.dataCallbacks.push(resolve); + }); + } + print({ INFO, NEWLINE }) { + NEWLINE = Scratch.Cast.toString(NEWLINE).toLowerCase(); + this.terminal[NEWLINE === "newline" ? "writeln" : "write"]( + Scratch.Cast.toString(INFO) + ); + } + screenOptions({ SCREENOPTION }) { + SCREENOPTION = Scratch.Cast.toString(SCREENOPTION).toLowerCase(); + switch (SCREENOPTION) { + case "size": + return JSON.stringify({ + x: this.terminal.options.cols, + y: this.terminal.options.rows, + }); + case "cursor": + return JSON.stringify({ + x: this.terminal._core._inputHandler._activeBuffer.x, + Y: this.terminal._core._inputHandler._activeBuffer.y, + }); + } + return "{}"; + } + moveCursorTo({ X, Y }) { + X = Scratch.Cast.toNumber(X); + Y = Scratch.Cast.toNumber(Y); + if ( + isFinite(X) && + isFinite(Y) && + Math.floor(X) === X && + Math.floor(Y) === Y && + X >= 0 && + Y >= 0 + ) { + this.terminal.write( + `\u001b[${Scratch.Cast.toNumber(Y + 1)};${Scratch.Cast.toNumber( + X + 1 + )}H` + ); + } + } + moveCursor({ N, DIRECTION }) { + const directionMap = { + up: "A", + down: "B", + right: "C", + left: "D", + }; + DIRECTION = Scratch.Cast.toString(DIRECTION).toLowerCase(); + N = Scratch.Cast.toNumber(N); + if ( + DIRECTION in directionMap && + isFinite(N) && + Math.floor(N) === N && + N > 0 + ) { + this.terminal.write(`\u001b[${N}${directionMap[DIRECTION]}`); + } + } + clear({ CLEARTYPE }) { + CLEARTYPE = Scratch.Cast.toString(CLEARTYPE).toLowerCase(); + let typeMap = { + after: 0, + before: 1, + screen: 2, + scrollback: 3, + }; + if (CLEARTYPE in typeMap) { + this.terminal.write(`\u001b[${typeMap[CLEARTYPE]}J`); + } + } + reset() { + this.terminal.reset(); + } + saveCursor(args, util) { + if (util.stackFrame.shouldRestoreCursor) { + this.moveCursorTo({ + X: util.stackFrame.cursorX, + Y: util.stackFrame.cursorY, + }); + } else { + util.stackFrame.shouldRestoreCursor = true; + util.stackFrame.cursorX = + this.terminal._core._inputHandler._activeBuffer.x; + util.stackFrame.cursorY = + this.terminal._core._inputHandler._activeBuffer.y; + util.startBranch(1, true); + } + } + whenTerminalResized() { + return true; + } + whenMouseClicked() { + return true; + } + whenMouseOver() { + return true; + } + whenScrolled() { + return true; + } + getEventData() { + return JSON.stringify(this.eventData); + } + coloredText({ TEXT, COLOR, TYPE }) { + TYPE = Scratch.Cast.toString(TYPE).toLowerCase(); + COLOR = Scratch.Cast.toRgbColorList(COLOR); + return `\u001b[${TYPE === "background" ? "48" : "38"};2;${COLOR[0]};${ + COLOR[1] + };${COLOR[2]}m${Scratch.Cast.toString(TEXT)}\u001b[0m`; + } + withOpacity({ COLOR, OPACITY }) { + COLOR = Scratch.Cast.toRgbColorList(COLOR); + return `rgba(${COLOR[0]},${COLOR[1]},${COLOR[2]},${Scratch.Cast.toNumber( + OPACITY + )})`; + } + toCodePoint({ CHAR }) { + CHAR = Scratch.Cast.toString(CHAR); + return CHAR.codePointAt(0) ?? -1; + } + fromCodePoint({ CODE }) { + CODE = Scratch.Cast.toNumber(CODE); + return String.fromCodePoint(CODE); + } + } + Scratch.extensions.register(new ScratchXTerm()); +})(Scratch); diff --git a/extensions/extensions.json b/extensions/extensions.json index 044cf1114f..95c4f1bca4 100644 --- a/extensions/extensions.json +++ b/extensions/extensions.json @@ -95,5 +95,6 @@ "itchio", "gamejolt", "obviousAlexC/newgroundsIO", + "FurryR/xterm", "Lily/McUtils" // McUtils should always be the last item. ] diff --git a/images/FurryR/xterm.png b/images/FurryR/xterm.png new file mode 100644 index 0000000000000000000000000000000000000000..db6fe130f88eb9bd215f234eb580c46c2d9eb81e GIT binary patch literal 11828 zcmd^lWmHt{`z{9ZN}05P1t<)lQqls_-QCU5FwD@P0xBs;mvl2IJv2y2_ecyll0!EV z1Lwitf1Tf2=hJyVoeyWZ)U{{rJ(N=T^4N=V#yc6G9{wYMZ7c=E~jldw$Nt9$Ln>N%MdM1t>MTI4Hv z41RnW$4c2EZp&7&V&aOU;O#w zb1g2SGZ^pbhAZ!^VhgO4NmY1yWLSQiaWt`BGrASPcqKtx!z?$g7h;9wZ`{Dnts1_w z_Dnx(=52~2uhL5!Bv5ws}anbm*NGRyJ9$Kq8}aE61P9x z@{^kVOcd-Cc*av*eITO57yyA)`dqnp@A4g{Zlgm4+!*e3o@RS^cxAP~75#41D;v1w znwh-xYl8EOKVKU1V!$WYon>_02naYHUHrX-$Px7b9}>CCDoPS96I~&_e6^5@Q3-rR z<1VS=F5%?hVCm>iAmM6h>TYRqA8zYzb6;9kQAInDoQiy_iA9mik z9iJLz+N;$6ZsM66gIoT*O10JdCreS?UtOO(d@Y$^=K91nze|RkKUSSzSwTrMqK)?s z7nk7q*>b7zhN0kBU%27a?lu*AzoGOH=36=dTZj1~2QpOb?Cc7`8%3EH+gt|!U#0~A zTp}SL2nZnjmzS@aFTUV^Kl|@5@0(oupL72{`|mGrmVp=e@3a5@@*j|M1b@%{`|SV4 zg~16TyL0ag{UD>`wV4()CqvfRV6Aud_jBU$J)BgI zwg+dc!RYk`Lp_Ij3Mf3oN;8B%a-;gW#&0iaHp#fXTA|*E;Wfn%wK8Z(D7|X-iS0(j!7H?v=9rS(YJ!IF|sQ3m>r43n9vyD|UxSsw?&o zpRur$(WmU`-8l&O-+Q66jSa!1G{C6Lt-^;&?z}X zAwL`lUL4}Kzc-=`{l0}JLr(cO%L~9aQrfGg+PmtKDhK}1yj?Gf8;q$mSgrw%j;mcA z$%_>DLqu(Ki21OoH=h>7Xa1YVX_KdIbsScu9WS-84D#@D98+0U)p*yZN17cCVHq%g z{C>?MX9Du%a8qAFznz77byWgQ!4Pj@gE8aPTA8hXQ(Thp*WkKg(M%{%UcK(?%1880bH`h_^r@_RuF}wCC6u&eRlQTX z+={TfyszLrz|Wye7eRPh2=3Kuv=733O7yE2 zCw6CGE5VI|(9^J%YP~q~NHGu}MfbP1kDvyhhor(83ZkNJwyg#mp-S32!;DS+Onj-v zAOqlMgWH;I@EXu?TK>r`6zBe?^>S}3$tO4u*Nv(coDN2nUFbh)Lh%xVf~li92I!37 z-JcKd($FNX!ZJ6$Lx=q4+BD6pAMPNvgUPRfSf_aH;o(6GvQkL6fwbhLXUKSOVk!M8 z2L}h*ZdzGpnC}6af)ctGCPw8A-M3LQs^WE*|N9=UuCBusH}YtJ3A&LK_v!`E8~*Ax z@5nDw6yYdGCo$un?@8N8E^7QG4YnLw-eOVsP2{l4s zCEHg0Uant}eEnKzZ{2D71A2)lY__@9HZk*9*$^&3P7s5&LzfzQmC7#>b)+~>H7fd^ z?5jFEm)*W|$M(t1GUCgEf`VlCo~g{tbT~G8{@F5RKQjBUf$2GG-m7`{xPg>5mp}2&^-)|zewzh8I^ZbZ~H65?Wml)RZ zPE}9crY-PAo0Iw1zfF#hQGX7yD@x1N^;-mkaN+WD7|Zm%mu1G=+uPjK|L735n@0-g za>hY;>NoZxb1k7(*bVhh#|LW;ZH!C#i7VTob)?0c4>vzD^{rG2_#Rh` z`plwiKbe+S(qq%}tKGjHDml z-p3ya1`CyzrsedyMz-|Cb3(@oV{aIYmx)OTJd4uyPq4Sw$Pf=wh%7QHL9MM(+Y#)3 zSAJIu`63bEwZGzkz~C4awGjwJZs!r&P20SB+W1$wr!Gk` zaBoj7hFQ_V!9meHFhKL>#MD%gQ+lJF$rjBgi4bx-+;Gmv@IC}VorEbJ%=T9S9D}2&pCMKMm4t44s(D=VuI80Uy zO*w^w5DEyy@1JZoS)ct`sVVRsyB%q;SxcKU+S(IDb%7DyJQwg-%lGp&eo?>Co5)qp zUB0Eu$ajPiJ?(AnWV@>_NRs#*aen42DJ3=h^dfKNwXDB^K>2?TH(!pTe8|JYqr4*0{rdg<{JfC&G{Fve z5BGe=%2?6r?f_-cIf1!9$Ei(+JHMddYNB=8kFA%H-`aUb(S~m1!PYpxSsN{_$Xbf> zeDr-05u?rs`pT}en9rZHSJBATwTW^8ztbA=$dHw;Pf`A*aCi67IremwvBJm#Km4^q zgW7L$pPzsrCQih=g@!j2?JfGh zCZEa}A=cQasFC^ldW$O)Gc&7@kPzl@W|o%Q=1IDMNTGUOM4>j4Lt9&$g2N!;8st84 z&dwO?fCC1lnI%Q%&kG%D9hhHTO~$#1p3)XrHc43`6wXl`UiG=2q;|?mO5<_t`tFdu zpI71m27>m)^>qYK;J8Lh4eRbT4CLoOS)Z&_-=%`6SXjKSa$H?PD_kKW*P!1N_*Plj z7rS(iiYl*pB2ce(XO(D0DfNYBj(mLo7Oc)0`)0gEKhLr!-s;3tG3lkOqod=5AJVt> zH=C!ow|w;N+qWwmrg#;T&#5!X7IizV)WU3*m$F_H*9mJ!TpLB0#O5C^`~`{eLg7LY6y9ltgL@{OP&9DqZZPr zB+^P@V2?LuHW@-hL{teq+!K8ON|rn=kJsn^6#i7K!=p!!xXr#h_od!>%*e7kB6dJ=8Xhd`XdXF9lW5NaKOMn)7U~ z@-j(XqR_;)*K%)uJOAq zJ$d->4Y}iDf2v^KEo5ZZ*Tb2nw+9z3T7t;m_hh}=enPTY+|k9^S!EziSaG8+cFLMk z%fi&k^tm@3taK???mS6Xr{rDg<(1k38&josi*ec6j~%9}6dSw_dv_Q&*AUjHFH7_) zOEJMKmOej1paw~o)tfsCG`ezG!j9U^89ye?>tDVMR#)`BzNh8_R3*US3xT8NC z`ujpRhq??)BM$1FYac&>V8Tr`-k?CTk$FA3uEX{52a&$v#Xa&ov{m@}V<*&^%HzHa zfTG(})T0NkE-tEr^|iJ}F`!K0K*AoobVl9?lRl}&czYD-mRq^HyJxp0Cnh9N1H>bX zGPXb4cvJ~RYZa*FC`1s3Mn<9mzIEUJP3SPyXb3`cq-4o(N^s=)yD|u=E1v|>4TjO? zctBO)lOZE}y+(q{A#{}$c6c&xLVZ&T?HvodsJh4O`X~d~>bR!8 zeK93OC(5yA1ydB6=6j&4S!!?;*lbhS54?N#_U%k^dI1YtDtu$E}v!=RA#QWvxo+1-$G#P;tMVD(_@q{%AVWM%`|=?hp~MM1_mhy>$6TfsKY$JFCOcY!lM&Lpi1#T#}(X`ddI%y^o)HGli(K+ zu$%tra)YAuRdcHZVlmO0+iv~|;Qc~2UqA_KBZ&%eoNX*YHW}Hv8mLY2I`Fvseyy3W zg3Z{dvl+_t!Uj=|Rx3Agqe1j2c1DIQPVUMn$&C+XNspY)<5pI3k9Mh+_tD1jb#>lp zmEN-=_=`riF?_wWwA5~YUY!}~=I#z^RKrLrlWsl2g~!3pYbltH?~K;s#_p{0z=*hLh^```&LFWic&#JI_b%c@^y zH-(bj;Bix~AC6<%_8n_%Q9d}`)!A9*FrhVwq)4x_5EsnF$%%A#f;u>q0Bo3Czj20t zspZATg=2qZ(AFl=9!fRvRR9pt3p}uc_p-SPNk|20TL9mjv70Fl%77h$h67sabBC8V zrW<|r0bPFKi2iL6S(($98~+I0 z$22g7KUzv3*ef=<0O4m3iq&dA>Qy_Y;viC5TU9&Hq!m``uXPId*8oyG+ zS!vZrYeeuC)YH~^$Z&sZy1HRHieIa9a#Amxmgfb3?(*8iteY<`ps7t$iLgT&K-6^w zB6)pX-NbvV3sc!23=Fx9NjO*reC|8l6LNm#e|E$|cImQ~9~Orz2qK}RHG(e|)8Nt+ z#ri=}QHGO_manJxZHo@}_xIb)o=tGa8>8H1KYaL5du-6zC_HZ8su?E=DJizFKHRd- za5dAvOP%%l!)<134dWVwSdmtVm&uP?KzP8uWJ^7ll$Kr{#J1UTI8FcL({6pAnwnau zU6i)CKq2HZ27*I&N-H43&Jm&Ce}U0Du#sqoZvgK<}8q zjpXqx$HtQ(Pk>4>1{yuE$tkcVGtoHjwnH=Zw};*wk?^<-e^)rX93B=n*eXd< z;XL%lpMzw1P?cS;A__Dk&->(rNwbC0K#zv7Jta=kNNT@iTd4vWK zK3bouRyOZ!0F?5^%(;pm&VFgzsVSu?r_H~NQo&C%$CaWZg5W$$B}2SW=WAy04aU-R z|H+~+Up#ReoQV`Yah#g3I?0oGpmD8jZMMIB-Yctex$Vr$Htek22SrZgcQ~YvT8N4v zYl5g$KDuLKDqpJhcD+sQ8tBha$${Q`vF?z9hms!$w_XWc&;`mq{d~z?%8OnP`k4F5 zsI0?mBhX$qyFCVvffW>~Ma7gwCO&fVU4_gCmz9-qdsotc0HqoQ{YxP-^nD|eQ{v&- z`CF`W%{8j8nz}4!)Jxy1&Aq)x*8dF4<29=t4Qa1GlaTy)S9PpV6I2n+qZ7D_np$*b zW~MuCm}z~s$rw6*El-eS+i7TM$jfa$If?$y*EGcM>j%ueEC`Ce@2P_Diuq6`0oTXh z2T|d4Cswu{CiXtj*{*YXzfQ*VT1kjbrolIWVCz-^tC9IC1MIRy1^eYEH7cpO(+ii1u%x)br{&MVor9Nf{cP<>ke*UI;t3e@GT^=Q!_$ zD9FmH7Pip6ihH6ePPW1)<977bT$;;p{^m0#01BJV&+4iiF@;R>lu*DwQ9v*PS!kOg zq=9m`-CvzjPD`_m|6c37{pR7rhc?+h0b(1T%illT@p9NI0!H)wzPfXG2q3;_tNGm; z(bYNsMFwK@&xgD_6<-pAa^zxPcpkOO$A3;puvzZzIXE~d)E?L~IbheXDpaCpjD_e% z^O1j>pRRRFdhQksesuC8io+1KvJlAGgK3^9Ktz?7mjjH@6QAc3#--yq4_a0d?>dn6 zMP@6LQ69b`BXbY4HlY*PHDuqndFPtanR@HzNQqAmB^Ayf@Pjp7OoKOit8;Eab7cNn zIUS$FUwjA&v6fWe$(k_V+0%*2sP@OeWSWu7vVF zET!bsEgqc90EG&0v*UyHBG3&j5z`Il{nYh0WAGD!=uM`le{9~FZL;WohpHCqJl6z_ zrEkG=zuW+Dsj=r@vVN>ywjLP%aHsc~c!!z!rrpGjW#YlC!&J2`{&@3qLKoy$g#&d_ zgZJU$iplQh&v)C~6C3@ZP^i(>%ajZq+Q$AlAXkCb9*&;XINDhNLA1IpgSR*9Fwvs_ z5HFMc99!Ls5HAOhj%PZZlb z>WXDE)lK_U56~kh{zEqBcYHiHrVF%g$Q zS1*xFTp-TARKd2veCg;sip%76vB;*ydPjJL~NF4^Qa z%TVm>R%%MhXpy!Pz-vjQx)LE|L&y88fTL#N? zgs~@JrNZxI9Wd}S^j0{d->DeAAmMV1vd9o%DsB*)_Kpra(3hA8UR2rbYoN>}fY$_o zP@8pqGlH*vWAv%|Sg~%oLZqPAc3j-MnXa!Wm?` zXq%lG|M>Caf}e!qG-$5-e+k~fYMO?cjAsP z-bAnCL=U|xp8~&Q&qxr!ogL**1|4VW3kF2bA$=$K-S%{x?)d?&s9!yhUm0oS@sk9)I#Q-jrY^6n>>0g?j}Du5iH3#6WH}{hQZbQ{ zk*pf|&2*H6ye635UkV$?WV5#T;LXRfm*@p91{*tDTT!8*p@1t|T3g32@;-g~^kaDV z7^t9o_`_M~#7+)w=KL2rIKcpQ=_(}q5d@;Z=(81wh1GfZ8e!_-pvH79pXj+hJFGI- z^?7OF^zvt+!qZ($c^Qx+X@V1hj|lsci-0Z4VNJ<={>XTu#+3B{CfTa0sudu?%f&$o zhRmgM&W|OfmSgxCMP2Dq_}%otEJ}OgnR2naOIeN1;YxU@_pWbD5)PG;8^_q{Uzdq#WsGkv>JG9&Iq&Xl)YjhoiQ%-YdH2Q zn3V^(yKAckX!E`&^6xk>eGM*Bw_IfPXj~0lt}oVo4=5=q0Rz}EKtAp@Z33JwvZw6C z%gbvwRaFwlsh@F;jCS!iqa|Noh2V8_0s_*%y8x+ovH@ARRSGdU+M!V3*#9&W|IB)6 zn0vD6rGP-8|M}Tu6|C;KiThVZQ?Uh$!G(K`yw@ugM3G|6txXX9DhS4jzt(m%e@J)Q z{F$0JvUBlxj^Aspar~VD*DAWZr9}+caFEo|m|D)Znl1#B1CsxZbLPr#(ZIorJ};zW zn3eqU%S~wriw>EUhbDQTW8W<08-gwu($>?$! z{eNZvam@myy4$w33(Z~V(aHz;9#+>K^5?@dDlmYM+7%%Kh_n8SayhrT^I-wq@d11; zcgd-aI%`<6ZC}A~*HCzJX2uB2mtv4eNXB_l^9aBj(}-0Lh-1{~5N%s#TmI z09(nv7~C`mUOD#JUb@ksrA>5B09&8bG%_;c-}z}GHJemYJX-JRrkH-9iV|fP6c7NN z+8&^lcp|BT!F|tiu-CKok{S7Py*k)tBT`@M8eaGPX>H zCVmgVlkLx~j9_%?&Wr{O=sWVAj)Dvs6f9xs3x{?R+C2MZVK5_5_E%1ic8RZFAHs22 zS6KE~#h4a)?k?^WW1n(za>jBR8!^ep_3o!n0)5Q=LN)>?vnZV=ZOrY08N=ISGL1YX zdQSu*-+tm7t6KIyPQyMNJUp7(NTV@OcJ>#vjags35Kl`pS~>9H6F&PhM_E2T46FxkCOC-0=pbAezy+&PCH4u0&(9k_$ zea+6!so%$o+k?i}br4tk87Dzp`m#!AS0rNm5F)^`YP#{Qw#^WdqRI9BFt1oxi?Xw)odh!ia&6^0N zFv{ccA+0dc2OlD?+@C5ganQ(Dc|dy^Ja4l7yM40Er2z|@rQMC|j$=O=tcJ7MBK^X9 zsLyI7vVQONVWIB#2yiGr%pR>TfGcLQx4@|F%~(rOr3u!jZS@*qpE`hTj7NS#-IVAk zDaT;ZGe!=~7&FNPHEqCGAXvHszBFP?ikY^#4;X75z^*F|hhdCx9?u0;C2AfYd{DA|FPvjs?`!-A^|hojrkujv?68+SXc--O>V>` zdbd-*siT_J#Llo;KIgMfGI)=Da(d!`?54N}{D`eDKuJniMCJPVvFd(%9DWrLSqcV* z(y!*Ty!DPt{R0Kkk<Ay8%$j+1uUDOMI=)t=(Qx-NIN-bEvr6v9`j-jUT-S@i! z)FxQR>6#4qtgkkpuR!-2ubz_w!vmn%b6YH%#1!T5Ij*sBB9pkE^)l!$2xWsFV7I%t z33w|Iy;#+m53NsYV=K_j%$9pI{cIh6&;}YL@`jOS`Xa@$ML>`ofUV2hD!z4&C5?vF zTEoUuZ9+%iV=hQiN@}X5rR9F}HdscvK=PID6T_s{0igfo$;Df}wF7?0(VQ(F2J{e| zhO1XzSXi*sX;`uR2(>YX_wie-L7EsjJG*f4&>f_4T>mwlFM{w5o1R6YY6oI+BT)Cp zBHf$XLc*ic(`T<>NuO!&4ckuw%`I0c)eM385ifvnoG+tJY3U9g$y0`Q4L%4))4xExzo7Ki19hp9$&NGf zgK;Dsj=Ik`o!`k(m8 z|Iipzo2+E2z}z~VhKpI7sM1=}Ks=gqqcQUlUl>NTtfnNExvB^ffBV2)yjeUuHTC4`HLPF1_csvhW46QXg5rjAop!9#sIzoBaoMLD^T8`HH}^6?zFc;krWy+kg6_}r4_ z{*U1h91fqDoE#3g3IUONu-(bH3a}9v??oA=!;;)=(R8=b`g;l`KNfn`D73Kx%J$ zMyJ`rjdq@TS(>)hjT%>NeThd1>%Yrgg3cyQ%=LmZe>pOeSuu$+!NYM&r$8uC_s_zQ zWC7Q-#J|2Uy~x{mq6PrGO(jBlW@nq4VP(8Cj>iM$9RrZlKd)*yq+XQYyf_{P2)G)0 zsgBmD+WZyEK2Q*vJ-#WCb>}x0ZR-;#{=t58?EIfwdB9jDiQ6+8P-@V?8uVafG%sEU z0d1%(wYaRL(uCi0($aR6by94M>+i+S=Y49T Date: Wed, 3 Jul 2024 22:13:19 +0800 Subject: [PATCH 2/2] FurryR/xterm: offline version For approvement (human-readable version) please check previous commit. Signed-off-by: FurryR --- extensions/FurryR/xterm.js | 43263 ++++++++++++++++++++++++++++++++++- 1 file changed, 42334 insertions(+), 929 deletions(-) diff --git a/extensions/FurryR/xterm.js b/extensions/FurryR/xterm.js index 78ee5970fd..39872d0e2e 100644 --- a/extensions/FurryR/xterm.js +++ b/extensions/FurryR/xterm.js @@ -4,1009 +4,42414 @@ // By: FurryR // License: MPL-2.0 -(async function (Scratch) { +/* Disable eslint rules for dependencies, not my code. */ +/* eslint-disable no-undef */ +/* eslint-disable strict */ +/* eslint-disable require-await */ +/* eslint-disable no-unreachable-loop */ +/* eslint-disable no-unused-vars */ +/* eslint-disable no-useless-escape */ +/* eslint-disable no-case-declarations */ +/* eslint-disable no-fallthrough */ +/* eslint-disable no-prototype-builtins */ +/* eslint-disable no-self-assign */ +/* eslint-disable getter-return */ +/* eslint-disable no-restricted-syntax */ +(function (Scratch) { "use strict"; - const xtermStyle = document.createElement("link"); - xtermStyle.rel = "stylesheet"; - xtermStyle.href = - "https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/css/xterm.min.css"; - document.head.appendChild(xtermStyle); - const { Terminal } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/+esm" - ); - const { WebglAddon } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-webgl@0.18.0/+esm" - ); - const { FitAddon } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.10.0/+esm" - ); - const { Unicode11Addon } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-unicode11@0.8.0/+esm" - ); - const { CanvasAddon } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-canvas@0.7.0/+esm" - ); - const { WebLinksAddon } = await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-web-links@0.11.0/+esm" - ); - // Special patch for ligature addon that uses fs module which rollup doesn't support - await import( - "https://cdn.jsdelivr.net/npm/@xterm/addon-ligatures@0.9.0/lib/addon-ligatures.min.js" - ); - const { - LigaturesAddon: { LigaturesAddon }, - } = globalThis; - delete globalThis.LigaturesAddon; - const runtime = Scratch.vm.runtime; - const themeColor = [ - "foreground", - "background", - "selection", - "black", - "brightBlack", - "red", - "brightRed", - "green", - "brightGreen", - "yellow", - "brightYellow", - "blue", - "brightBlue", - "magenta", - "brightMagenta", - "cyan", - "brightCyan", - "white", - "brightWhite", - "cursor", - "cursorAccent", - "selectionBackground", - "selectionForeground", - "selectionInactiveBackground", - ]; - - class ScratchXTerm { - /** @type {HTMLDivElement?} */ - element; - /** @type {Terminal} */ - terminal; - /** @type {FitAddon} */ - fitAddon; - /** @type {LigaturesAddon?} */ - ligaturesAddon; - /** @type {WebLinksAddon?} */ - webLinksAddon; - /** @type {((data: string) => void)[]} */ - dataCallbacks = []; - /** @type {string} */ - buffer; - /** @type {boolean} */ - bufferEnabled; - /** @type {object} */ - eventData; - - constructor() { - this.terminal = new Terminal({ - allowTransparency: true, - fontFamily: - '"Jetbrains Mono", "Fira Code", "Cascadia Code", "Noto Emoji", "Segoe UI Emoji", "Lucida Console", Menlo, courier-new, courier, monospace', - cursorBlink: true, - theme: { - foreground: "#F8F8F8", - background: "rgba(45,46,44,0.8)", - selection: "#5DA5D533", - black: "#1E1E1D", - brightBlack: "#262625", - red: "#CE5C5C", - brightRed: "#FF7272", - green: "#5BCC5B", - brightGreen: "#72FF72", - yellow: "#CCCC5B", - brightYellow: "#FFFF72", - blue: "#5D5DD3", - brightBlue: "#7279FF", - magenta: "#BC5ED1", - brightMagenta: "#E572FF", - cyan: "#5DA5D5", - brightCyan: "#72F0FF", - white: "#F8F8F8", - brightWhite: "#FFFFFF", - }, - allowProposedApi: true, - }); - this.terminal.onData((e) => { - if (this.dataCallbacks.length > 0) { - for (const callback of this.dataCallbacks) { - callback(this.buffer + e); - } - this.buffer = ""; - this.dataCallbacks = []; - } else if (this.bufferEnabled) { - this.buffer += e; - } - }); - this.terminal.onResize(() => { - if (this.justInitialized) this.justInitialized = false; - else runtime.startHats("xterm_whenTerminalResized"); - }); - // Mouse event report support - this.terminal._core.coreMouseService.addEncoding("cursorReport", (e) => { - const actionMap = { - 1: "down", - 0: "up", - 32: "drag", - }; - if (e.button >= 0 && e.button <= 2) { - const buttonMap = { - 0: "left", - 1: "middle", - 2: "right", - }; - if ( - runtime.startHats("xterm_whenMouseClicked", { - BUTTON: buttonMap[e.button], - }).length > 0 - ) { - this.eventData = { - x: e.col - 1, - y: e.row - 1, - type: actionMap[e.action], - ctrl: e.ctrl, - alt: e.alt, - shift: e.shift, + + /*! For license information please see addon-ligatures.js.LICENSE.txt */ + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t( + require("fs"), + require("path"), + require("util"), + require("stream") + )) + : "function" == typeof define && define.amd + ? define(["fs", "path", "util", "stream"], t) + : "object" == typeof exports + ? (exports.LigaturesAddon = t( + require("fs"), + require("path"), + require("util"), + require("stream") + )) + : (e.LigaturesAddon = t(e.fs, e.path, e.util, e.stream)); + })(self, (e, t, n, s) => + (() => { + var o = { + 185: (e, t) => { + "use strict"; + function n(e) { + const t = {}; + for (const [n, o] of Object.entries(e.individual)) t[n] = s(o); + for (const { range: n, entry: o } of e.range) { + const e = s(o); + for (let s = n[0]; s < n[1]; s++) t[s] = e; + } + return t; + } + function s(e) { + const t = {}; + return ( + e.forward && (t.forward = n(e.forward)), + e.reverse && (t.reverse = n(e.reverse)), + e.lookup && (t.lookup = e.lookup), + t + ); + } + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = n); + }, + 98: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(602), + o = n(593), + r = n(233), + a = n(694), + i = n(532), + l = n(595), + u = n(223), + c = n(439), + p = n(349), + f = n(185); + class h { + constructor(e, t) { + (this._lookupTrees = []), + (this._glyphLookups = {}), + (this._font = e), + t.cacheSize > 0 && + (this._cache = new o({ + max: t.cacheSize, + length: (e, t) => t.length, + })); + const n = ( + (this._font.tables.gsub && + this._font.tables.gsub.features.filter( + (e) => "calt" === e.tag + )) || + [] + ).reduce( + (e, t) => [...e, ...t.feature.lookupListIndexes], + [] + ), + s = + (this._font.tables.gsub && + this._font.tables.gsub.lookups) || + [], + a = s.filter((e, t) => n.some((e) => e === t)); + for (const [e, t] of a.entries()) { + const n = []; + switch (t.lookupType) { + case 6: + for (const [e, o] of t.subtables.entries()) + switch (o.substFormat) { + case 1: + n.push(l.default(o, s, e)); + break; + case 2: + n.push(u.default(o, s, e)); + break; + case 3: + n.push(c.default(o, s, e)); + } + break; + case 8: + for (const [e, s] of t.subtables.entries()) + n.push(p.default(s, e)); + } + const o = f.default(r.default(n)); + this._lookupTrees.push({ + tree: o, + processForward: 8 !== t.lookupType, + }); + for (const t of Object.keys(o)) + this._glyphLookups[t] || (this._glyphLookups[t] = []), + this._glyphLookups[t].push(e); + } + } + findLigatures(e) { + const t = this._cache && this._cache.get(e); + if (t && !Array.isArray(t)) return t; + const n = []; + for (const t of e) n.push(this._font.charToGlyphIndex(t)); + if (0 === this._lookupTrees.length) + return { inputGlyphs: n, outputGlyphs: n, contextRanges: [] }; + const s = this._findInternal(n.slice()), + o = { + inputGlyphs: n, + outputGlyphs: s.sequence, + contextRanges: s.ranges, + }; + return this._cache && this._cache.set(e, o), o; + } + findLigatureRanges(e) { + if (0 === this._lookupTrees.length) return []; + const t = this._cache && this._cache.get(e); + if (t) return Array.isArray(t) ? t : t.contextRanges; + const n = []; + for (const t of e) n.push(this._font.charToGlyphIndex(t)); + const s = this._findInternal(n); + return this._cache && this._cache.set(e, s.ranges), s.ranges; + } + _findInternal(e) { + const t = []; + let n = this._getNextLookup(e, 0); + for (; null !== n.index; ) { + const s = this._lookupTrees[n.index]; + if (s.processForward) { + let o = n.last; + for (let r = n.first; r < o; r++) { + const n = a.default(s.tree, e, r, r); + if (n) { + for (let t = 0; t < n.substitutions.length; t++) { + const s = n.substitutions[t]; + null !== s && (e[r + t] = s); + } + i.default( + t, + n.contextRange[0] + r, + n.contextRange[1] + r + ), + r + n.length >= o && (o = r + n.length + 1), + (r += n.length - 1); + } + } + } else + for (let o = n.last - 1; o >= n.first; o--) { + const n = a.default(s.tree, e, o, o); + if (n) { + for (let t = 0; t < n.substitutions.length; t++) { + const s = n.substitutions[t]; + null !== s && (e[o + t] = s); + } + i.default( + t, + n.contextRange[0] + o, + n.contextRange[1] + o + ), + (o -= n.length - 1); + } + } + n = this._getNextLookup(e, n.index + 1); + } + return { sequence: e, ranges: t }; + } + _getNextLookup(e, t) { + const n = { index: null, first: 1 / 0, last: -1 }; + for (let s = 0; s < e.length; s++) { + const o = this._glyphLookups[e[s]]; + if (o) + for (let e = 0; e < o.length; e++) { + const r = o[e]; + if (r >= t) { + (null === n.index || r <= n.index) && + ((n.index = r), + n.first > s && (n.first = s), + (n.last = s + 1)); + break; + } + } + } + return n; + } + } + async function d(e, t) { + const o = await Promise.resolve() + .then(() => n(269)) + .then((t) => t.promisify(s.load)(e)); + return new h(o, Object.assign({ cacheSize: 0 }, t)); + } + (t.load = async function (e, t) { + const [s] = await Promise.resolve() + .then(() => n(781)) + .then((t) => t.listVariants(e)); + if (!s) throw new Error(`Font ${e} not found`); + return d(s.path, t); + }), + (t.loadFile = d), + (t.loadBuffer = function (e, t) { + const n = s.parse(e); + return new h(n, Object.assign({ cacheSize: 0 }, t)); + }); + }, + 233: (e, t) => { + "use strict"; + function n(e, t) { + for (const [n, o] of Object.entries(t.individual)) + if (e.individual[n]) s(e.individual[n], o); + else { + let t = !1; + for (const [a, { range: l, entry: u }] of e.range.entries()) { + const c = r(Number(n), l); + if (null !== c.both) { + (t = !0), + (e.individual[n] = o), + s(e.individual[n], i(u)), + e.range.splice(a, 1); + for (const t of c.second) + Array.isArray(t) + ? e.range.push({ range: t, entry: i(u) }) + : (e.individual[t] = i(u)); + } + } + t || (e.individual[n] = o); + } + for (const { range: n, entry: a } of t.range) { + let t = [n]; + for (let n = 0; n < e.range.length; n++) { + const { range: l, entry: u } = e.range[n]; + for (const [c, p] of t.entries()) { + if (!Array.isArray(p)) { + const o = r(p, l); + if (null === o.both) continue; + (e.individual[p] = i(a)), + s(e.individual[p], i(u)), + e.range.splice(n, 1), + n--; + for (const t of o.second) + Array.isArray(t) + ? e.range.push({ range: t, entry: i(u) }) + : (e.individual[t] = i(u)); + t.splice(c, 1, ...o.first); + break; + } + { + const r = o(p, l); + if (null === r.both) continue; + e.range.splice(n, 1), n--; + const c = i(u); + Array.isArray(r.both) + ? e.range.push({ range: r.both, entry: c }) + : (e.individual[r.both] = c), + s(c, i(a)); + for (const t of r.second) + Array.isArray(t) + ? e.range.push({ range: t, entry: i(u) }) + : (e.individual[t] = i(u)); + t = r.first; + } + } + } + for (const n of Object.keys(e.individual)) + for (const [o, l] of t.entries()) { + if (Array.isArray(l)) { + const u = r(Number(n), l); + if (null === u.both) continue; + s(e.individual[n], i(a)), t.splice(o, 1, ...u.second); + break; + } + if (Number(n) === l) { + s(e.individual[n], i(a)); + break; + } + } + for (const n of t) + Array.isArray(n) + ? e.range.push({ range: n, entry: i(a) }) + : (e.individual[n] = i(a)); + } + } + function s(e, t) { + t.lookup && + (!e.lookup || + e.lookup.index > t.lookup.index || + (e.lookup.index === t.lookup.index && + e.lookup.subIndex > t.lookup.subIndex)) && + (e.lookup = t.lookup), + t.forward && + (e.forward + ? n(e.forward, t.forward) + : (e.forward = t.forward)), + t.reverse && + (e.reverse + ? n(e.reverse, t.reverse) + : (e.reverse = t.reverse)); + } + function o(e, t) { + const n = { first: [], second: [], both: null }; + if (e[0] < t[1] && t[0] < e[1]) { + const s = Math.max(e[0], t[0]), + o = Math.min(e[1], t[1]); + n.both = a(s, o); + } + if (e[0] < t[0]) { + const s = e[0], + o = Math.min(t[0], e[1]); + n.first.push(a(s, o)); + } else if (t[0] < e[0]) { + const s = t[0], + o = Math.min(t[1], e[0]); + n.second.push(a(s, o)); + } + if (e[1] > t[1]) { + const s = Math.max(e[0], t[1]), + o = e[1]; + n.first.push(a(s, o)); + } else if (t[1] > e[1]) { + const s = Math.max(e[1], t[0]), + o = t[1]; + n.second.push(a(s, o)); + } + return n; + } + function r(e, t) { + if (e < t[0] || e > t[1]) + return { first: [e], second: [t], both: null }; + const n = { first: [], second: [], both: e }; + return ( + t[0] < e && n.second.push(a(t[0], e)), + t[1] > e && n.second.push(a(e + 1, t[1])), + n + ); + } + function a(e, t) { + return t - e == 1 ? e : [e, t]; + } + function i(e) { + const t = {}; + return ( + e.forward && (t.forward = l(e.forward)), + e.reverse && (t.reverse = l(e.reverse)), + e.lookup && + (t.lookup = { + contextRange: e.lookup.contextRange.slice(), + index: e.lookup.index, + length: e.lookup.length, + subIndex: e.lookup.subIndex, + substitutions: e.lookup.substitutions.slice(), + }), + t + ); + } + function l(e) { + const t = {}; + for (const [n, s] of Object.entries(e.individual)) t[n] = i(s); + return { + individual: t, + range: e.range.map(({ range: e, entry: t }) => ({ + range: e.slice(), + entry: i(t), + })), + }; + } + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e) { + const t = { individual: {}, range: [] }; + for (const s of e) n(t, s); + return t; + }); + }, + 532: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e, t, n) { + let s = !1; + for (let o = 0; o < e.length; o++) { + const r = e[o]; + if (s) { + if (n <= r[0]) return (e[o - 1][1] = n), e; + if (n <= r[1]) + return ( + (e[o - 1][1] = Math.max(n, r[1])), + e.splice(o, 1), + (s = !1), + e + ); + e.splice(o, 1), o--; + } else { + if (n <= r[0]) return e.splice(o, 0, [t, n]), e; + if (n <= r[1]) return (r[0] = Math.min(t, r[0])), e; + if (!(t < r[1])) continue; + (r[0] = Math.min(t, r[0])), (s = !0); + } + } + return s ? (e[e.length - 1][1] = n) : e.push([t, n]), e; + }); + }, + 595: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(283), + o = n(267); + t.default = function (e, t, n) { + const r = { individual: {}, range: [] }, + a = s.listGlyphsByIndex(e.coverage); + for (const { glyphId: s, index: i } of a) { + const a = e.chainRuleSets[i]; + if (a) + for (const [e, i] of a.entries()) { + let a = o + .getInputTree(r, i.lookupRecords, t, 0, s) + .map(({ entry: e, substitution: t }) => ({ + entry: e, + substitutions: [t], + })); + for (const [e, n] of i.input.entries()) + a = o.processInputPosition( + [n], + e + 1, + a, + i.lookupRecords, + t + ); + for (const e of i.lookahead) + a = o.processLookaheadPosition([e], a); + for (const e of i.backtrack) + a = o.processBacktrackPosition([e], a); + for (const { entry: t, substitutions: s } of a) + t.lookup = { + substitutions: s, + length: i.input.length + 1, + index: n, + subIndex: e, + contextRange: [ + -1 * i.backtrack.length, + 1 + i.input.length + i.lookahead.length, + ], + }; + } + } + return r; }; - } - } else if (e.button === 3) { - if (runtime.startHats("xterm_whenMouseOver").length > 0) { - this.eventData = { - x: e.col - 1, - y: e.row - 1, - ctrl: e.ctrl, - alt: e.alt, - shift: e.shift, + }, + 223: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(233), + o = n(283), + r = n(91), + a = n(267); + t.default = function (e, t, n) { + const i = [], + l = o.listGlyphsByIndex(e.coverage); + for (const { glyphId: s } of l) { + const o = r.default(e.inputClassDef, s); + for (const [s, l] of o.entries()) { + if (null === l) continue; + const o = e.chainClassSet[l]; + if (o) + for (const [l, u] of o.entries()) { + const o = { individual: {}, range: [] }; + let c = a + .getInputTree(o, u.lookupRecords, t, 0, s) + .map(({ entry: e, substitution: t }) => ({ + entry: e, + substitutions: [t], + })); + for (const [n, s] of u.input.entries()) + c = a.processInputPosition( + r.listClassGlyphs(e.inputClassDef, s), + n + 1, + c, + u.lookupRecords, + t + ); + for (const t of u.lookahead) + c = a.processLookaheadPosition( + r.listClassGlyphs(e.lookaheadClassDef, t), + c + ); + for (const t of u.backtrack) + c = a.processBacktrackPosition( + r.listClassGlyphs(e.backtrackClassDef, t), + c + ); + for (const { entry: e, substitutions: t } of c) + e.lookup = { + substitutions: t, + index: n, + subIndex: l, + length: u.input.length + 1, + contextRange: [ + -1 * u.backtrack.length, + 1 + u.input.length + u.lookahead.length, + ], + }; + i.push(o); + } + } + } + return s.default(i); }; - } - } else if (e.button === 4) { - if (runtime.startHats("xterm_whenScrolled").length > 0) { - this.eventData = { - x: e.col - 1, - y: e.row - 1, - type: actionMap[e.action], - ctrl: e.ctrl, - alt: e.alt, - shift: e.shift, + }, + 439: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(283), + o = n(267); + t.default = function (e, t, n) { + const r = { individual: {}, range: [] }, + a = s.listGlyphsByIndex(e.inputCoverage[0]); + for (const { glyphId: i } of a) { + let a = o + .getInputTree(r, e.lookupRecords, t, 0, i) + .map(({ entry: e, substitution: t }) => ({ + entry: e, + substitutions: [t], + })); + for (const [n, r] of e.inputCoverage.slice(1).entries()) + a = o.processInputPosition( + s.listGlyphsByIndex(r).map((e) => e.glyphId), + n + 1, + a, + e.lookupRecords, + t + ); + for (const t of e.lookaheadCoverage) + a = o.processLookaheadPosition( + s.listGlyphsByIndex(t).map((e) => e.glyphId), + a + ); + for (const t of e.backtrackCoverage) + a = o.processBacktrackPosition( + s.listGlyphsByIndex(t).map((e) => e.glyphId), + a + ); + for (const { entry: t, substitutions: s } of a) + t.lookup = { + substitutions: s, + index: n, + subIndex: 0, + length: e.inputCoverage.length, + contextRange: [ + -1 * e.backtrackCoverage.length, + e.inputCoverage.length + e.lookaheadCoverage.length, + ], + }; + } + return r; }; - } - } else { - console.log(e); - } - }); - const style = document.createElement("style"); - style.textContent = ` -.xterm-viewport.xterm-viewport { - scrollbar-width: none; -} -.xterm-viewport::-webkit-scrollbar { - width: 0; -} -`; - document.head.appendChild(style); - this.fitAddon = new FitAddon(); - try { - this.terminal.loadAddon(new WebglAddon()); - } catch { - this.terminal.loadAddon(new CanvasAddon()); - } - this.terminal.loadAddon(new Unicode11Addon()); - this.terminal.unicode.activeVersion = "11"; - this.terminal.loadAddon(this.fitAddon); - this.element = null; - this.buffer = ""; - this.bufferEnabled = false; - this.ligaturesAddon = null; - this.webLinksAddon = null; - this.justInitialized = false; - this.eventData = {}; - } - getInfo() { - return { - id: "xterm", - name: "xterm", - color1: "#1c1628", - blocks: [ - { - blockType: Scratch.BlockType.LABEL, - text: "🎨 " + Scratch.translate("Appearance"), - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "changeVisibility", - text: Scratch.translate("[STATUS] terminal"), - arguments: { - STATUS: { - type: Scratch.ArgumentType.STRING, - menu: "VISIBILITY", - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "changeTheme", - text: Scratch.translate("set [THEME] color to [COLOR]"), - arguments: { - THEME: { - type: Scratch.ArgumentType.STRING, - menu: "THEME", - }, - COLOR: { - type: Scratch.ArgumentType.COLOR, - defaultValue: "#5DA5D5", - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "changeOption", - text: Scratch.translate("set [OPTION] to [VALUE]"), - arguments: { - OPTION: { - type: Scratch.ArgumentType.STRING, - menu: "OPTION", - }, - VALUE: { - type: Scratch.ArgumentType.STRING, - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "adjustFeature", - text: Scratch.translate("[STATUS] [FEATURE]"), - arguments: { - STATUS: { - type: Scratch.ArgumentType.STRING, - menu: "STATUS", - }, - FEATURE: { - type: Scratch.ArgumentType.STRING, - menu: "FEATURE", - }, - }, - }, - { - blockType: Scratch.BlockType.LABEL, - text: "🎮 " + Scratch.translate("Input"), - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "get", - text: Scratch.translate("received character"), - }, - { - blockType: Scratch.BlockType.LABEL, - text: "📄 " + Scratch.translate("Output"), - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "print", - text: Scratch.translate("print [INFO] with [NEWLINE]"), - arguments: { - INFO: { - type: Scratch.ArgumentType.STRING, - defaultValue: "Hello World", - }, - NEWLINE: { - type: Scratch.ArgumentType.STRING, - menu: "NEWLINE", - }, - }, - }, - { - blockType: Scratch.BlockType.LABEL, - text: "🖥️ " + Scratch.translate("Cursor & Screen"), - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "screenOptions", - text: Scratch.translate("query [SCREENOPTION]"), - arguments: { - SCREENOPTION: { - type: Scratch.ArgumentType.STRING, - menu: "SCREENOPTION", - }, - }, - disableMonitor: true, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "moveCursorTo", - text: Scratch.translate("move cursor to x:[X]y:[Y]"), - arguments: { - X: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 0, - }, - Y: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 0, - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "moveCursor", - text: Scratch.translate("move cursor [N] character(s) [DIRECTION]"), - arguments: { - N: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 1, - }, - DIRECTION: { - type: Scratch.ArgumentType.STRING, - menu: "DIRECTION", - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "clear", - text: Scratch.translate("clear [CLEARTYPE]"), - arguments: { - CLEARTYPE: { - type: Scratch.ArgumentType.STRING, - menu: "CLEARTYPE", - }, - }, - }, - { - blockType: Scratch.BlockType.COMMAND, - opcode: "reset", - text: Scratch.translate("reset screen"), - }, - { - blockType: Scratch.BlockType.CONDITIONAL, - opcode: "saveCursor", - text: Scratch.translate("cursor wrapper"), - branchCount: 1, - }, - { - blockType: Scratch.BlockType.LABEL, - text: "❗ " + Scratch.translate("Events"), - }, - { - blockType: Scratch.BlockType.HAT, - opcode: "whenTerminalResized", - text: Scratch.translate("when terminal resized"), - shouldRestartExistingThreads: false, - isEdgeActivated: false, - }, - { - blockType: Scratch.BlockType.HAT, - opcode: "whenMouseClicked", - text: Scratch.translate("when mouse [BUTTON] clicked"), - shouldRestartExistingThreads: false, - isEdgeActivated: false, - arguments: { - BUTTON: { - type: Scratch.ArgumentType.STRING, - menu: "BUTTON", - }, - }, - }, - { - blockType: Scratch.BlockType.HAT, - opcode: "whenMouseOver", - text: Scratch.translate("when mouse over terminal"), - shouldRestartExistingThreads: false, - isEdgeActivated: false, - }, - { - blockType: Scratch.BlockType.HAT, - opcode: "whenScrolled", - text: Scratch.translate("when mouse scrolled"), - shouldRestartExistingThreads: false, - isEdgeActivated: false, - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "getEventData", - text: Scratch.translate("mouse event data"), - }, - { - blockType: Scratch.BlockType.LABEL, - text: "🛠️ " + Scratch.translate("Utilities"), - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "coloredText", - text: Scratch.translate("[TEXT] in [COLOR] [TYPE]"), - arguments: { - TEXT: { - type: Scratch.ArgumentType.STRING, - defaultValue: "Hello World", - }, - COLOR: { - type: Scratch.ArgumentType.COLOR, - defaultValue: "#FFFFFF", - }, - TYPE: { - type: Scratch.ArgumentType.STRING, - menu: "COLORTYPE", - }, - }, - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "withOpacity", - text: Scratch.translate("[COLOR] with opacity [OPACITY]"), - arguments: { - COLOR: { - type: Scratch.ArgumentType.COLOR, - defaultValue: "#808080", - }, - OPACITY: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 0.5, - }, - }, - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "toCodePoint", - text: Scratch.translate("the code point of [CHAR]"), - arguments: { - CHAR: { - type: Scratch.ArgumentType.STRING, - defaultValue: "a", - }, - }, - }, - { - blockType: Scratch.BlockType.REPORTER, - opcode: "fromCodePoint", - text: Scratch.translate("the character of code point [CODE]"), - arguments: { - CODE: { - type: Scratch.ArgumentType.NUMBER, - defaultValue: 32, - }, - }, - }, - ], - menus: { - VISIBILITY: { - items: [ - { - text: Scratch.translate("show"), - value: "show", - }, - { - text: Scratch.translate("hide"), - value: "hide", - }, - ], }, - THEME: { - items: [ - { - text: Scratch.translate("foreground"), - value: "foreground", - }, - { - text: Scratch.translate("background"), - value: "background", - }, - { - text: Scratch.translate("selection"), - value: "selection", - }, - { - text: Scratch.translate("black"), - value: "black", + 349: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(283), + o = n(267); + t.default = function (e, t) { + const n = { individual: {}, range: [] }, + r = s.listGlyphsByIndex(e.coverage); + for (const { glyphId: a, index: i } of r) { + const r = {}; + Array.isArray(a) + ? n.range.push({ entry: r, range: a }) + : (n.individual[a] = r); + let l = [{ entry: r, substitutions: [e.substitutes[i]] }]; + for (const t of e.lookaheadCoverage) + l = o.processLookaheadPosition( + s.listGlyphsByIndex(t).map((e) => e.glyphId), + l + ); + for (const t of e.backtrackCoverage) + l = o.processBacktrackPosition( + s.listGlyphsByIndex(t).map((e) => e.glyphId), + l + ); + for (const { entry: n, substitutions: s } of l) + n.lookup = { + substitutions: s, + index: t, + subIndex: 0, + length: 1, + contextRange: [ + -1 * e.backtrackCoverage.length, + 1 + e.lookaheadCoverage.length, + ], + }; + } + return n; + }; + }, + 91: (e, t) => { + "use strict"; + function n(e, t) { + for (const n of e.ranges) + if (n.start <= t && n.end >= t) return n.classId; + return null; + } + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e, t) { + return 2 === e.format + ? Array.isArray(t) + ? (function (e, t) { + let s = t[0], + o = n(e, s), + r = t[0] + 1; + const a = new Map(); + for (; r < t[1]; ) + n(e, r) !== o && + (r - s <= 1 ? a.set(s, o) : a.set([s, r], o)), + r++; + return r - s <= 1 ? a.set(s, o) : a.set([s, r], o), a; + })(e, t) + : new Map([[t, n(e, t)]]) + : new Map([[t, null]]); + }), + (t.listClassGlyphs = function (e, t) { + if (2 === e.format) { + const n = []; + for (const s of e.ranges) + s.classId === t && + (s.end === s.start + ? n.push(s.start) + : n.push([s.start, s.end + 1])); + return n; + } + return []; + }); + }, + 283: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e, t) { + switch (e.format) { + case 1: + const n = e.glyphs.indexOf(t); + return -1 !== n ? n : null; + case 2: + const s = e.ranges.find((e) => e.start <= t && e.end >= t); + return s ? s.index : null; + } + }), + (t.listGlyphsByIndex = function (e) { + switch (e.format) { + case 1: + return e.glyphs.map((e, t) => ({ glyphId: e, index: t })); + case 2: + let t = []; + for (const [n, s] of e.ranges.entries()) + s.end === s.start + ? t.push({ glyphId: s.start, index: n }) + : t.push({ glyphId: [s.start, s.end + 1], index: n }); + return t; + } + }); + }, + 267: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(603); + function o(e, t, n, o, a) { + const i = []; + if (Array.isArray(a)) { + const r = (function (e, t, n, o) { + for (const r of e.filter((e) => e.sequenceIndex === n)) + for (const e of t[r.lookupListIndex].subtables) { + const t = s.getRangeSubstitutionGlyphs(e, o); + if (!Array.from(t.values()).every((e) => null !== e)) + return t; + } + return new Map([[o, null]]); + })(t, n, o, a); + for (const [t, n] of r) { + const s = {}; + Array.isArray(t) + ? e.range.push({ range: t, entry: s }) + : (e.individual[t] = {}), + i.push({ entry: s, substitution: n }); + } + } else + (e.individual[a] = {}), + i.push({ + entry: e.individual[a], + substitution: r(t, n, o, a), + }); + return i; + } + function r(e, t, n, o) { + for (const r of e.filter((e) => e.sequenceIndex === n)) + for (const e of t[r.lookupListIndex].subtables) { + const t = s.getIndividualSubstitutionGlyph(e, o); + if (null !== t) return t; + } + return null; + } + (t.processInputPosition = function (e, t, n, s, r) { + const a = []; + for (const i of n) { + i.entry.forward = { individual: {}, range: [] }; + for (const n of e) + a.push( + ...o(i.entry.forward, s, r, t, n).map( + ({ entry: e, substitution: t }) => ({ + entry: e, + substitutions: [...i.substitutions, t], + }) + ) + ); + } + return a; + }), + (t.processLookaheadPosition = function (e, t) { + const n = []; + for (const s of t) + for (const t of e) { + const e = {}; + s.entry.forward || + (s.entry.forward = { individual: {}, range: [] }), + n.push({ entry: e, substitutions: s.substitutions }), + Array.isArray(t) + ? s.entry.forward.range.push({ entry: e, range: t }) + : (s.entry.forward.individual[t] = e); + } + return n; + }), + (t.processBacktrackPosition = function (e, t) { + const n = []; + for (const s of t) + for (const t of e) { + const e = {}; + s.entry.reverse || + (s.entry.reverse = { individual: {}, range: [] }), + n.push({ entry: e, substitutions: s.substitutions }), + Array.isArray(t) + ? s.entry.reverse.range.push({ entry: e, range: t }) + : (s.entry.reverse.individual[t] = e); + } + return n; + }), + (t.getInputTree = o); + }, + 603: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(283); + function o(e, t) { + const n = s.default(e.coverage, t); + if (null === n) return null; + switch (e.substFormat) { + case 1: + return (t + e.deltaGlyphId) % 65536; + case 2: + return null != e.substitute[n] ? e.substitute[n] : null; + } + } + (t.getRangeSubstitutionGlyphs = function (e, t) { + let n = t[0], + s = o(e, n), + r = t[0] + 1; + const a = new Map(); + for (; r < t[1]; ) + o(e, r) !== s && (r - n <= 1 ? a.set(n, s) : a.set([n, r], s)), + r++; + return r - n <= 1 ? a.set(n, s) : a.set([n, r], s), a; + }), + (t.getIndividualSubstitutionGlyph = o); + }, + 694: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function e(t, n, s, o) { + let r = t[n[o]]; + if (!r) return; + let a = r.lookup; + if (r.reverse) { + const e = (function (e, t, n) { + let s = e[t[--n]], + o = s && s.lookup; + for ( + ; + s && + (((!o && s.lookup) || + (s.lookup && o && o.index > s.lookup.index)) && + (o = s.lookup), + !(--n < 0) && s.reverse); + + ) + s = s.reverse[t[n]]; + return o; + })(r.reverse, n, s); + ((!a && e) || + (e && + a && + (a.index > e.index || + (a.index === e.index && a.subIndex > e.subIndex)))) && + (a = e); + } + if (++o >= n.length || !r.forward) return a; + const i = e(r.forward, n, s, o); + return ( + ((!a && i) || + (i && + a && + (a.index > i.index || + (a.index === i.index && a.subIndex > i.subIndex)))) && + (a = i), + a + ); + }); + }, + 814: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(82); + var o, r; + !(function (e) { + (e.Serif = "serif"), + (e.SansSerif = "sansSerif"), + (e.Monospace = "monospace"), + (e.Cursive = "cursive"), + (e.Unknown = "unknown"); + })((o = t.Type || (t.Type = {}))), + (function (e) { + (e.Regular = "regular"), + (e.Italic = "italic"), + (e.Oblique = "oblique"), + (e.Bold = "bold"), + (e.BoldItalic = "boldItalic"), + (e.BoldOblique = "boldOblique"), + (e.Other = "other"); + })((r = t.Style || (t.Style = {}))); + const a = [ + " Regular", + " Bold", + " Bold Italic", + " Bold Oblique", + " Italic", + " Oblique", + ]; + function i(e) { + if (!e.os2 && !e.head) return r.Other; + const t = e.os2 ? 32 & e.os2.fsSelection : 1 & e.head.macStyle, + n = e.os2 + ? 1 & e.os2.fsSelection + : e.post + ? e.post.italicAngle < 0 + : 2 & e.head.macStyle, + s = e.os2 + ? 512 & e.os2.fsSelection + : e.post + ? e.post.italicAngle > 0 + : 0, + o = e.os2 ? 320 & e.os2.fsSelection : 1; + return t + ? s + ? r.BoldOblique + : n + ? r.BoldItalic + : r.Bold + : s + ? r.Oblique + : n + ? r.Italic + : o + ? r.Regular + : r.Other; + } + (t.name = function (e, t) { + const n = + e.names.preferredFamily && e.names.preferredFamily[t] + ? e.names.preferredFamily[t] + : e.names.fontFamily[t]; + if ("win32" === s.platform()) { + const s = `${n} ${e.names.preferredSubfamily && e.names.preferredSubfamily[t] ? e.names.preferredSubfamily[t] : e.names.fontSubfamily[t]}`; + let o = -1; + for (const e of a) { + const t = s.lastIndexOf(e); + if (-1 !== t) { + o = t; + break; + } + } + return -1 !== o ? s.substring(0, o) : s; + } + return n; + }), + (t.type = function (e) { + if (e.os2) + switch (e.os2.panose[0]) { + case 2: + return 9 === e.os2.panose[3] + ? o.Monospace + : (e.os2.panose[1] >= 11 && e.os2.panose[1] <= 15) || + 0 === e.os2.panose[1] + ? o.SansSerif + : o.Serif; + case 3: + return o.Cursive; + } + else if (e.post && e.post.isFixedPitch) return o.Monospace; + return o.Unknown; + }), + (t.style = i); + const l = [r.Bold, r.BoldItalic, r.BoldOblique]; + t.weight = function (e) { + return e.os2 ? e.os2.usWeightClass : l.includes(i(e)) ? 700 : 400; + }; + }, + 781: function (e, t, n) { + "use strict"; + var s = + (this && this.__rest) || + function (e, t) { + var n = {}; + for (var s in e) + Object.prototype.hasOwnProperty.call(e, s) && + t.indexOf(s) < 0 && + (n[s] = e[s]); + if ( + null != e && + "function" == typeof Object.getOwnPropertySymbols + ) { + var o = 0; + for (s = Object.getOwnPropertySymbols(e); o < s.length; o++) + t.indexOf(s[o]) < 0 && (n[s[o]] = e[s[o]]); + } + return n; + }; + Object.defineProperty(t, "__esModule", { value: !0 }); + const o = n(459), + r = n(934), + a = n(814); + var i = n(814); + async function l(e) { + const t = Object.assign({ concurrency: 4, language: "en" }, e), + n = await o.default({ extensions: ["ttf", "otf"] }), + a = await (async function (e, n, s) { + const o = []; + let a = 0; + const i = async (e) => { + o.push( + await (async (e) => { + try { + return u(e, await r.default(e), t.language); + } catch (e) { + if ( + [ + "TypeError", + "SyntaxError", + "ReferenceError", + "RangeError", + "AssertionError", + ].includes(e.name) + ) + throw e; + } + })(n[e]) + ), + a < n.length && (await i(a++)); + }, + l = []; + for (; a < n.length && a < s; a++) l.push(i(a)); + return await Promise.all(l), o; + })(0, n, t.concurrency), + i = {}; + for (let e of a.filter((e) => e)) { + const { name: t } = e, + n = s(e, ["name"]); + i[t] || (i[t] = []), i[t].push(n); + } + return i; + } + function u(e, t, n) { + return { + name: a.name(t, n), + path: e, + type: a.type(t), + weight: a.weight(t), + style: a.style(t), + }; + } + (t.Type = i.Type), + (t.Style = i.Style), + (t.list = l), + (t.listVariants = async function (e, t) { + return (await l(t))[e] || []; + }), + (t.get = async function (e, t) { + const n = Object.assign({ language: "en" }, t); + return u(e, await r.default(e), n.language); + }); + }, + 934: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(89), + o = n(896), + r = n(380), + a = n(879), + i = n(130), + l = n(731), + u = n(954); + var c; + !(function (e) { + (e[(e.TrueType = 0)] = "TrueType"), + (e[(e.CFF = 1)] = "CFF"), + (e[(e.Woff = 2)] = "Woff"); + })(c || (c = {})); + const p = { + name: { tag: Buffer.from("name"), parse: r.default }, + ltag: { tag: Buffer.from("ltag"), parse: a.default }, + os2: { tag: Buffer.from("OS/2"), parse: i.default }, + head: { tag: Buffer.from("head"), parse: l.default }, + post: { tag: Buffer.from("post"), parse: u.default }, + }; + t.default = async function (e) { + return new Promise((t, n) => { + (async () => { + const t = o.default(), + r = s.createReadStream(e); + let a = !1; + const i = () => { + a = !0; + }; + r.once("close", i), + r.once("end", i), + r.once("error", (e) => { + (a = !0), n(e); + }), + r.pipe(t); + try { + switch ( + (function (e) { + if ( + e.equals(f.one) || + e.equals(f.true) || + e.equals(f.typ1) + ) + return c.TrueType; + if (e.equals(f.otto)) return c.CFF; + if (e.equals(f.woff)) return c.Woff; + throw new Error(`Unsupported signature type: ${e}`); + })(await t.read(4)) + ) { + case c.TrueType: + case c.CFF: + const n = (await t.read(2)).readUInt16BE(0); + await t.skip(6); + const s = await (async function (e, t) { + const n = {}; + for (let s = 0; s < t; s++) { + const t = await e.read(4), + s = await e.read(12); + for (const [e, o] of Object.entries(p)) + if ( + t.equals(o.tag) && + ((n[e] = { + offset: s.readUInt32BE(4), + length: s.readUInt32BE(8), + }), + n.name && n.ltag && n.os2) + ) + return n; + } + return n; + })(t, n), + o = Object.entries(s).sort( + (e, t) => e[1].offset - t[1].offset + ), + r = {}; + for (const [e, n] of o) + await t.skip(n.offset - t.offset), + (r[e] = await t.read(n.length)); + let a = []; + if ((r.ltag && (a = p.ltag.parse(r.ltag)), !r.name)) + throw new Error( + `missing required OpenType table 'name' in font file: ${e}` + ); + return { + names: p.name.parse(r.name, a), + os2: r.os2 && p.os2.parse(r.os2), + head: r.head && p.head.parse(r.head), + post: r.post && p.post.parse(r.post), + }; + case c.Woff: + default: + throw new Error( + "provided font type is not supported yet" + ); + } + } finally { + r.unpipe(t), a || (r.destroy(), t.destroy()); + } + })().then(t, n); + }); + }; + const f = { + one: Buffer.from([0, 1, 0, 0]), + otto: Buffer.from("OTTO"), + true: Buffer.from("true"), + typ1: Buffer.from("typ1"), + woff: Buffer.from("wOFF"), + }; + }, + 731: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(980); + t.default = function (e) { + return { + version: s.formatFixed(e.readUInt16BE(0), e.readUInt16BE(2)), + fontRevision: s.formatFixed( + e.readUInt16BE(4), + e.readUInt16BE(6) + ), + checkSumAdjustment: e.readUInt32BE(8), + magicNumber: e.readUInt32BE(12), + flags: e.readUInt16BE(16), + unitsPerEm: e.readUInt16BE(18), + created: s.formatLongDateTime( + e.readUInt32BE(20), + e.readUInt32BE(24) + ), + modified: s.formatLongDateTime( + e.readUInt32BE(28), + e.readUInt32BE(32) + ), + xMin: e.readInt16BE(36), + yMin: e.readInt16BE(38), + xMax: e.readInt16BE(40), + yMax: e.readInt16BE(42), + macStyle: e.readUInt16BE(44), + lowestRecPPEM: e.readUInt16BE(46), + fontDirectionHint: e.readInt16BE(48), + indexToLocFormat: e.readInt16BE(50), + glyphDataFormat: e.readInt16BE(52), + }; + }; + }, + 879: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e) { + if (1 !== e.readUInt32BE(0)) + throw new Error("Unsupported ltag table version."); + const t = e.readUInt32BE(8), + n = []; + for (let s = 0; s < t; s++) { + let t = ""; + const o = e.readUInt16BE(12 + 4 * s), + r = e.readUInt16BE(14 + 4 * s); + for (let n = o; n < o + r; ++n) + t += String.fromCharCode(e.readInt8(n)); + n.push(t); + } + return n; + }); + }, + 380: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const n = [ + "copyright", + "fontFamily", + "fontSubfamily", + "uniqueID", + "fullName", + "version", + "postScriptName", + "trademark", + "manufacturer", + "designer", + "description", + "manufacturerURL", + "designerURL", + "license", + "licenseURL", + "reserved", + "preferredFamily", + "preferredSubfamily", + "compatibleFullName", + "sampleText", + "postScriptFindFontName", + "wwsFamily", + "wwsSubfamily", + ], + s = { + 0: "en", + 1: "fr", + 2: "de", + 3: "it", + 4: "nl", + 5: "sv", + 6: "es", + 7: "da", + 8: "pt", + 9: "no", + 10: "he", + 11: "ja", + 12: "ar", + 13: "fi", + 14: "el", + 15: "is", + 16: "mt", + 17: "tr", + 18: "hr", + 19: "zh-Hant", + 20: "ur", + 21: "hi", + 22: "th", + 23: "ko", + 24: "lt", + 25: "pl", + 26: "hu", + 27: "es", + 28: "lv", + 29: "se", + 30: "fo", + 31: "fa", + 32: "ru", + 33: "zh", + 34: "nl-BE", + 35: "ga", + 36: "sq", + 37: "ro", + 38: "cz", + 39: "sk", + 40: "si", + 41: "yi", + 42: "sr", + 43: "mk", + 44: "bg", + 45: "uk", + 46: "be", + 47: "uz", + 48: "kk", + 49: "az-Cyrl", + 50: "az-Arab", + 51: "hy", + 52: "ka", + 53: "mo", + 54: "ky", + 55: "tg", + 56: "tk", + 57: "mn-CN", + 58: "mn", + 59: "ps", + 60: "ks", + 61: "ku", + 62: "sd", + 63: "bo", + 64: "ne", + 65: "sa", + 66: "mr", + 67: "bn", + 68: "as", + 69: "gu", + 70: "pa", + 71: "or", + 72: "ml", + 73: "kn", + 74: "ta", + 75: "te", + 76: "si", + 77: "my", + 78: "km", + 79: "lo", + 80: "vi", + 81: "id", + 82: "tl", + 83: "ms", + 84: "ms-Arab", + 85: "am", + 86: "ti", + 87: "om", + 88: "so", + 89: "sw", + 90: "rw", + 91: "rn", + 92: "ny", + 93: "mg", + 94: "eo", + 128: "cy", + 129: "eu", + 130: "ca", + 131: "la", + 132: "qu", + 133: "gn", + 134: "ay", + 135: "tt", + 136: "ug", + 137: "dz", + 138: "jv", + 139: "su", + 140: "gl", + 141: "af", + 142: "br", + 143: "iu", + 144: "gd", + 145: "gv", + 146: "ga", + 147: "to", + 148: "el-polyton", + 149: "kl", + 150: "az", + 151: "nn", }, - { - text: Scratch.translate("bright black"), - value: "brightBlack", + o = { + 1078: "af", + 1052: "sq", + 1156: "gsw", + 1118: "am", + 5121: "ar-DZ", + 15361: "ar-BH", + 3073: "ar", + 2049: "ar-IQ", + 11265: "ar-JO", + 13313: "ar-KW", + 12289: "ar-LB", + 4097: "ar-LY", + 6145: "ary", + 8193: "ar-OM", + 16385: "ar-QA", + 1025: "ar-SA", + 10241: "ar-SY", + 7169: "aeb", + 14337: "ar-AE", + 9217: "ar-YE", + 1067: "hy", + 1101: "as", + 2092: "az-Cyrl", + 1068: "az", + 1133: "ba", + 1069: "eu", + 1059: "be", + 2117: "bn", + 1093: "bn-IN", + 8218: "bs-Cyrl", + 5146: "bs", + 1150: "br", + 1026: "bg", + 1027: "ca", + 3076: "zh-HK", + 5124: "zh-MO", + 2052: "zh", + 4100: "zh-SG", + 1028: "zh-TW", + 1155: "co", + 1050: "hr", + 4122: "hr-BA", + 1029: "cs", + 1030: "da", + 1164: "prs", + 1125: "dv", + 2067: "nl-BE", + 1043: "nl", + 3081: "en-AU", + 10249: "en-BZ", + 4105: "en-CA", + 9225: "en-029", + 16393: "en-IN", + 6153: "en-IE", + 8201: "en-JM", + 17417: "en-MY", + 5129: "en-NZ", + 13321: "en-PH", + 18441: "en-SG", + 7177: "en-ZA", + 11273: "en-TT", + 2057: "en-GB", + 1033: "en", + 12297: "en-ZW", + 1061: "et", + 1080: "fo", + 1124: "fil", + 1035: "fi", + 2060: "fr-BE", + 3084: "fr-CA", + 1036: "fr", + 5132: "fr-LU", + 6156: "fr-MC", + 4108: "fr-CH", + 1122: "fy", + 1110: "gl", + 1079: "ka", + 3079: "de-AT", + 1031: "de", + 5127: "de-LI", + 4103: "de-LU", + 2055: "de-CH", + 1032: "el", + 1135: "kl", + 1095: "gu", + 1128: "ha", + 1037: "he", + 1081: "hi", + 1038: "hu", + 1039: "is", + 1136: "ig", + 1057: "id", + 1117: "iu", + 2141: "iu-Latn", + 2108: "ga", + 1076: "xh", + 1077: "zu", + 1040: "it", + 2064: "it-CH", + 1041: "ja", + 1099: "kn", + 1087: "kk", + 1107: "km", + 1158: "quc", + 1159: "rw", + 1089: "sw", + 1111: "kok", + 1042: "ko", + 1088: "ky", + 1108: "lo", + 1062: "lv", + 1063: "lt", + 2094: "dsb", + 1134: "lb", + 1071: "mk", + 2110: "ms-BN", + 1086: "ms", + 1100: "ml", + 1082: "mt", + 1153: "mi", + 1146: "arn", + 1102: "mr", + 1148: "moh", + 1104: "mn", + 2128: "mn-CN", + 1121: "ne", + 1044: "nb", + 2068: "nn", + 1154: "oc", + 1096: "or", + 1123: "ps", + 1045: "pl", + 1046: "pt", + 2070: "pt-PT", + 1094: "pa", + 1131: "qu-BO", + 2155: "qu-EC", + 3179: "qu", + 1048: "ro", + 1047: "rm", + 1049: "ru", + 9275: "smn", + 4155: "smj-NO", + 5179: "smj", + 3131: "se-FI", + 1083: "se", + 2107: "se-SE", + 8251: "sms", + 6203: "sma-NO", + 7227: "sms", + 1103: "sa", + 7194: "sr-Cyrl-BA", + 3098: "sr", + 6170: "sr-Latn-BA", + 2074: "sr-Latn", + 1132: "nso", + 1074: "tn", + 1115: "si", + 1051: "sk", + 1060: "sl", + 11274: "es-AR", + 16394: "es-BO", + 13322: "es-CL", + 9226: "es-CO", + 5130: "es-CR", + 7178: "es-DO", + 12298: "es-EC", + 17418: "es-SV", + 4106: "es-GT", + 18442: "es-HN", + 2058: "es-MX", + 19466: "es-NI", + 6154: "es-PA", + 15370: "es-PY", + 10250: "es-PE", + 20490: "es-PR", + 3082: "es", + 1034: "es", + 21514: "es-US", + 14346: "es-UY", + 8202: "es-VE", + 2077: "sv-FI", + 1053: "sv", + 1114: "syr", + 1064: "tg", + 2143: "tzm", + 1097: "ta", + 1092: "tt", + 1098: "te", + 1054: "th", + 1105: "bo", + 1055: "tr", + 1090: "tk", + 1152: "ug", + 1058: "uk", + 1070: "hsb", + 1056: "ur", + 2115: "uz-Cyrl", + 1091: "uz", + 1066: "vi", + 1106: "cy", + 1160: "wo", + 1157: "sah", + 1144: "ii", + 1130: "yo", + }; + function r(e, t, n) { + switch (e) { + case 0: + if (65535 === t) return "und"; + if (n) return n[t]; + break; + case 1: + return s[t]; + case 3: + return o[t]; + } + } + const a = "utf-16", + i = { + 0: "macintosh", + 1: "x-mac-japanese", + 2: "x-mac-chinesetrad", + 3: "x-mac-korean", + 6: "x-mac-greek", + 7: "x-mac-cyrillic", + 9: "x-mac-devanagai", + 10: "x-mac-gurmukhi", + 11: "x-mac-gujarati", + 12: "x-mac-oriya", + 13: "x-mac-bengali", + 14: "x-mac-tamil", + 15: "x-mac-telugu", + 16: "x-mac-kannada", + 17: "x-mac-malayalam", + 18: "x-mac-sinhalese", + 19: "x-mac-burmese", + 20: "x-mac-khmer", + 21: "x-mac-thai", + 22: "x-mac-lao", + 23: "x-mac-georgian", + 24: "x-mac-armenian", + 25: "x-mac-chinesesimp", + 26: "x-mac-tibetan", + 27: "x-mac-mongolian", + 28: "x-mac-ethiopic", + 29: "x-mac-ce", + 30: "x-mac-vietnamese", + 31: "x-mac-extarabic", }, - { - text: Scratch.translate("red"), - value: "red", + l = { + 15: "x-mac-icelandic", + 17: "x-mac-turkish", + 18: "x-mac-croatian", + 24: "x-mac-ce", + 25: "x-mac-ce", + 26: "x-mac-ce", + 27: "x-mac-ce", + 28: "x-mac-ce", + 30: "x-mac-icelandic", + 37: "x-mac-romanian", + 38: "x-mac-ce", + 39: "x-mac-ce", + 40: "x-mac-ce", + 143: "x-mac-inuit", + 146: "x-mac-gaelic", + }; + function u(e, t, n) { + switch (e) { + case 0: + return a; + case 1: + return l[n] || i[t]; + case 3: + if (1 === t || 10 === t) return a; + } + } + t.default = function (e, t) { + const s = {}, + o = e.readUInt16BE(2), + i = e.readUInt16BE(4); + let l = 6; + for (let c = 0; c < o; c++) { + const o = e.readUInt16BE(l + 0), + c = e.readUInt16BE(l + 2), + f = e.readUInt16BE(l + 4), + h = e.readUInt16BE(l + 6), + d = n[h] || String(h), + g = e.readUInt16BE(l + 8), + m = e.readUInt16BE(l + 10), + y = r(o, f, t), + v = u(o, c, f); + if (((l += 12), void 0 !== v && void 0 !== y)) { + let t; + if (v === a) { + const n = g / 2, + s = Array(n); + for (let t = 0; t < n; t++) + s[t] = e.readUInt16BE(i + m + 2 * t); + t = String.fromCharCode(...s); + } else t = p(e, i + m, g, v); + if (t) { + let e = s[d]; + void 0 === e && (e = s[d] = {}), (e[y] = t); + } + } + } + return s; + }; + const c = { + "x-mac-croatian": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ", + "x-mac-cyrillic": + "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю", + "x-mac-gaelic": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ", + "x-mac-greek": + "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­", + "x-mac-icelandic": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-inuit": + "ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł", + "x-mac-ce": + "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ", + macintosh: + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-romanian": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-turkish": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ", + }; + function p(e, t, n, s) { + const o = c[s]; + if (void 0 === o) return; + let r = ""; + for (let s = 0; s < n; s++) { + const n = e.readUInt8(t + s); + r += n <= 127 ? String.fromCharCode(n) : o[127 & n]; + } + return r; + } + }, + 130: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e) { + const t = { + version: e.readUInt16BE(0), + xAvgCharWidth: e.readUInt16BE(2), + usWeightClass: e.readUInt16BE(4), + usWidthClass: e.readUInt16BE(6), + fsType: e.readUInt16BE(8), + ySubscriptXSize: e.readInt16BE(10), + ySubscriptYSize: e.readInt16BE(12), + ySubscriptXOffset: e.readInt16BE(14), + ySubscriptYOffset: e.readInt16BE(16), + ySuperscriptXSize: e.readInt16BE(18), + ySuperscriptYSize: e.readInt16BE(20), + ySuperscriptXOffset: e.readInt16BE(22), + ySuperscriptYOffset: e.readInt16BE(24), + yStrikeoutSize: e.readInt16BE(26), + yStrikeoutPosition: e.readInt16BE(28), + sFamilyClass: e.readInt16BE(30), + panose: [ + e.readUInt8(32), + e.readUInt8(33), + e.readUInt8(34), + e.readUInt8(35), + e.readUInt8(36), + e.readUInt8(37), + e.readUInt8(38), + e.readUInt8(39), + e.readUInt8(40), + e.readUInt8(41), + ], + ulUnicodeRange1: e.readUInt32BE(42), + ulUnicodeRange2: e.readUInt32BE(46), + ulUnicodeRange3: e.readUInt32BE(50), + ulUnicodeRange4: e.readUInt32BE(54), + achVendID: String.fromCharCode( + e.readUInt8(58), + e.readUInt8(59), + e.readUInt8(60), + e.readUInt8(61) + ), + fsSelection: e.readUInt16BE(62), + usFirstCharIndex: e.readUInt16BE(64), + usLastCharIndex: e.readUInt16BE(66), + sTypoAscender: e.readInt16BE(68), + sTypoDescender: e.readInt16BE(70), + sTypoLineGap: e.readInt16BE(72), + usWinAscent: e.readUInt16BE(74), + usWinDescent: e.readUInt16BE(76), + }; + return ( + t.version >= 1 && + ((t.ulCodePageRange1 = e.readUInt32BE(78)), + (t.ulCodePageRange2 = e.readUInt32BE(82))), + t.version >= 2 && + ((t.sxHeight = e.readInt16BE(86)), + (t.sCapHeight = e.readInt16BE(88)), + (t.usDefaultChar = e.readUInt16BE(90)), + (t.usBreakChar = e.readUInt16BE(92)), + (t.usMaxContent = e.readUInt16BE(94))), + t + ); + }); + }, + 954: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(980); + t.default = function (e) { + return { + version: s.formatFixed(e.readUInt16BE(0), e.readUInt16BE(2)), + italicAngle: s.formatFixed( + e.readUInt16BE(4), + e.readUInt16BE(6) + ), + underlinePosition: e.readInt16BE(8), + underlineThickness: e.readInt16BE(10), + isFixedPitch: e.readUInt32BE(12), + minMemType42: e.readUInt32BE(16), + maxMemType42: e.readUInt32BE(20), + minMemType1: e.readUInt32BE(24), + maxMemType1: e.readUInt32BE(28), + }; + }; + }, + 980: (e, t) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.formatFixed = function (e, t) { + return e + t / 65536; + }), + (t.formatLongDateTime = function (e, t) { + return 1e3 * (e * 2 ** 32 + t - 2082844800); + }); + }, + 459: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(56), + o = n(456), + r = n(49), + a = { + win32: () => + process.env.WINDIR + ? [s.join(process.env.WINDIR, "Fonts")] + : ["C:\\Windows\\Fonts"], + darwin: () => { + const e = o.homedir(); + return [ + ...(e ? [s.join(e, "/Library/Fonts")] : []), + "/Library/Fonts", + "/Network/Library/Fonts", + "/System/Library/Fonts", + "/System Folder/Fonts", + ]; + }, + linux: () => { + const e = o.homedir(); + return [ + "/usr/share/fonts", + "/usr/local/share/fonts", + ...(e + ? [s.join(e, ".fonts"), s.join(e, ".local/share/fonts")] + : []), + ]; + }, + }; + function i(e) { + const t = Object.assign( + { + extensions: ["ttf", "otf", "ttc", "woff", "woff2"], + additionalFolders: [], + }, + e + ), + n = o.platform(), + s = a[n]; + if (!s) throw new Error(`Unsupported platform: ${n}`); + const i = s(); + return r.default([...i, ...t.additionalFolders], t.extensions); + } + (e.exports = Object.assign(i, { default: i })), (t.default = i); + }, + 49: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(89), + o = n(269), + r = n(56), + a = o.promisify(s.readdir), + i = o.promisify(s.stat); + async function l(e, t, n = 10) { + if (n <= 0) return []; + let s; + try { + s = await a(e); + } catch (e) { + return []; + } + const o = []; + return ( + await Promise.all( + s.map(async (s) => { + const a = r.join(e, s); + let u; + try { + u = await i(a); + } catch (e) { + return; + } + u.isFile() && t.test(a) + ? o.push(a) + : u.isDirectory() && o.push(...(await l(a, t, n - 1))); + }) + ), + o + ); + } + t.default = async function (e, t) { + const n = new Set(); + return ( + await Promise.all( + e.map(async (e) => { + const s = await l( + r.resolve(e), + new RegExp(`\\.${t.map((e) => `(?:${e})`).join("|")}$`) + ); + for (const e of s) n.add(e); + }) + ), + [...n] + ); + }; + }, + 593: (e, t, n) => { + "use strict"; + const s = n(411), + o = Symbol("max"), + r = Symbol("length"), + a = Symbol("lengthCalculator"), + i = Symbol("allowStale"), + l = Symbol("maxAge"), + u = Symbol("dispose"), + c = Symbol("noDisposeOnSet"), + p = Symbol("lruList"), + f = Symbol("cache"), + h = Symbol("updateAgeOnGet"), + d = () => 1, + g = (e, t, n) => { + const s = e[f].get(t); + if (s) { + const t = s.value; + if (m(e, t)) { + if ((v(e, s), !e[i])) return; + } else + n && + (e[h] && (s.value.now = Date.now()), e[p].unshiftNode(s)); + return t.value; + } }, - { - text: Scratch.translate("bright red"), - value: "brightRed", + m = (e, t) => { + if (!t || (!t.maxAge && !e[l])) return !1; + const n = Date.now() - t.now; + return t.maxAge ? n > t.maxAge : e[l] && n > e[l]; }, - { - text: Scratch.translate("green"), - value: "green", + y = (e) => { + if (e[r] > e[o]) + for (let t = e[p].tail; e[r] > e[o] && null !== t; ) { + const n = t.prev; + v(e, t), (t = n); + } }, - { - text: Scratch.translate("bright green"), - value: "brightGreen", + v = (e, t) => { + if (t) { + const n = t.value; + e[u] && e[u](n.key, n.value), + (e[r] -= n.length), + e[f].delete(n.key), + e[p].removeNode(t); + } + }; + class b { + constructor(e, t, n, s, o) { + (this.key = e), + (this.value = t), + (this.length = n), + (this.now = s), + (this.maxAge = o || 0); + } + } + const x = (e, t, n, s) => { + let o = n.value; + m(e, o) && (v(e, n), e[i] || (o = void 0)), + o && t.call(s, o.value, o.key, e); + }; + e.exports = class { + constructor(e) { + if ( + ("number" == typeof e && (e = { max: e }), + e || (e = {}), + e.max && ("number" != typeof e.max || e.max < 0)) + ) + throw new TypeError("max must be a non-negative number"); + this[o] = e.max || 1 / 0; + const t = e.length || d; + if ( + ((this[a] = "function" != typeof t ? d : t), + (this[i] = e.stale || !1), + e.maxAge && "number" != typeof e.maxAge) + ) + throw new TypeError("maxAge must be a number"); + (this[l] = e.maxAge || 0), + (this[u] = e.dispose), + (this[c] = e.noDisposeOnSet || !1), + (this[h] = e.updateAgeOnGet || !1), + this.reset(); + } + set max(e) { + if ("number" != typeof e || e < 0) + throw new TypeError("max must be a non-negative number"); + (this[o] = e || 1 / 0), y(this); + } + get max() { + return this[o]; + } + set allowStale(e) { + this[i] = !!e; + } + get allowStale() { + return this[i]; + } + set maxAge(e) { + if ("number" != typeof e) + throw new TypeError("maxAge must be a non-negative number"); + (this[l] = e), y(this); + } + get maxAge() { + return this[l]; + } + set lengthCalculator(e) { + "function" != typeof e && (e = d), + e !== this[a] && + ((this[a] = e), + (this[r] = 0), + this[p].forEach((e) => { + (e.length = this[a](e.value, e.key)), + (this[r] += e.length); + })), + y(this); + } + get lengthCalculator() { + return this[a]; + } + get length() { + return this[r]; + } + get itemCount() { + return this[p].length; + } + rforEach(e, t) { + t = t || this; + for (let n = this[p].tail; null !== n; ) { + const s = n.prev; + x(this, e, n, t), (n = s); + } + } + forEach(e, t) { + t = t || this; + for (let n = this[p].head; null !== n; ) { + const s = n.next; + x(this, e, n, t), (n = s); + } + } + keys() { + return this[p].toArray().map((e) => e.key); + } + values() { + return this[p].toArray().map((e) => e.value); + } + reset() { + this[u] && + this[p] && + this[p].length && + this[p].forEach((e) => this[u](e.key, e.value)), + (this[f] = new Map()), + (this[p] = new s()), + (this[r] = 0); + } + dump() { + return this[p] + .map( + (e) => + !m(this, e) && { + k: e.key, + v: e.value, + e: e.now + (e.maxAge || 0), + } + ) + .toArray() + .filter((e) => e); + } + dumpLru() { + return this[p]; + } + set(e, t, n) { + if ((n = n || this[l]) && "number" != typeof n) + throw new TypeError("maxAge must be a number"); + const s = n ? Date.now() : 0, + i = this[a](t, e); + if (this[f].has(e)) { + if (i > this[o]) return v(this, this[f].get(e)), !1; + const a = this[f].get(e).value; + return ( + this[u] && (this[c] || this[u](e, a.value)), + (a.now = s), + (a.maxAge = n), + (a.value = t), + (this[r] += i - a.length), + (a.length = i), + this.get(e), + y(this), + !0 + ); + } + const h = new b(e, t, i, s, n); + return h.length > this[o] + ? (this[u] && this[u](e, t), !1) + : ((this[r] += h.length), + this[p].unshift(h), + this[f].set(e, this[p].head), + y(this), + !0); + } + has(e) { + if (!this[f].has(e)) return !1; + const t = this[f].get(e).value; + return !m(this, t); + } + get(e) { + return g(this, e, !0); + } + peek(e) { + return g(this, e, !1); + } + pop() { + const e = this[p].tail; + return e ? (v(this, e), e.value) : null; + } + del(e) { + v(this, this[f].get(e)); + } + load(e) { + this.reset(); + const t = Date.now(); + for (let n = e.length - 1; n >= 0; n--) { + const s = e[n], + o = s.e || 0; + if (0 === o) this.set(s.k, s.v); + else { + const e = o - t; + e > 0 && this.set(s.k, s.v, e); + } + } + } + prune() { + this[f].forEach((e, t) => g(this, t, !1)); + } + }; + }, + 602: (e, t, n) => { + "use strict"; + n.r(t), + n.d(t, { + BoundingBox: () => i, + Font: () => gn, + Glyph: () => ie, + Path: () => u, + _parse: () => z, + load: () => Cn, + loadSync: () => Dn, + parse: () => Bn, + }); + var s = n(311), + o = n.n(s); + function r(e, t, n, s, o) { + return ( + Math.pow(1 - o, 3) * e + + 3 * Math.pow(1 - o, 2) * o * t + + 3 * (1 - o) * Math.pow(o, 2) * n + + Math.pow(o, 3) * s + ); + } + function a() { + (this.x1 = Number.NaN), + (this.y1 = Number.NaN), + (this.x2 = Number.NaN), + (this.y2 = Number.NaN); + } + (a.prototype.isEmpty = function () { + return ( + isNaN(this.x1) || + isNaN(this.y1) || + isNaN(this.x2) || + isNaN(this.y2) + ); + }), + (a.prototype.addPoint = function (e, t) { + "number" == typeof e && + ((isNaN(this.x1) || isNaN(this.x2)) && + ((this.x1 = e), (this.x2 = e)), + e < this.x1 && (this.x1 = e), + e > this.x2 && (this.x2 = e)), + "number" == typeof t && + ((isNaN(this.y1) || isNaN(this.y2)) && + ((this.y1 = t), (this.y2 = t)), + t < this.y1 && (this.y1 = t), + t > this.y2 && (this.y2 = t)); + }), + (a.prototype.addX = function (e) { + this.addPoint(e, null); + }), + (a.prototype.addY = function (e) { + this.addPoint(null, e); + }), + (a.prototype.addBezier = function (e, t, n, s, o, a, i, l) { + const u = [e, t], + c = [n, s], + p = [o, a], + f = [i, l]; + this.addPoint(e, t), this.addPoint(i, l); + for (let e = 0; e <= 1; e++) { + const t = 6 * u[e] - 12 * c[e] + 6 * p[e], + n = -3 * u[e] + 9 * c[e] - 9 * p[e] + 3 * f[e], + s = 3 * c[e] - 3 * u[e]; + if (0 === n) { + if (0 === t) continue; + const n = -s / t; + 0 < n && + n < 1 && + (0 === e && this.addX(r(u[e], c[e], p[e], f[e], n)), + 1 === e && this.addY(r(u[e], c[e], p[e], f[e], n))); + continue; + } + const o = Math.pow(t, 2) - 4 * s * n; + if (o < 0) continue; + const a = (-t + Math.sqrt(o)) / (2 * n); + 0 < a && + a < 1 && + (0 === e && this.addX(r(u[e], c[e], p[e], f[e], a)), + 1 === e && this.addY(r(u[e], c[e], p[e], f[e], a))); + const i = (-t - Math.sqrt(o)) / (2 * n); + 0 < i && + i < 1 && + (0 === e && this.addX(r(u[e], c[e], p[e], f[e], i)), + 1 === e && this.addY(r(u[e], c[e], p[e], f[e], i))); + } + }), + (a.prototype.addQuad = function (e, t, n, s, o, r) { + const a = e + (2 / 3) * (n - e), + i = t + (2 / 3) * (s - t), + l = a + (1 / 3) * (o - e), + u = i + (1 / 3) * (r - t); + this.addBezier(e, t, a, i, l, u, o, r); + }); + const i = a; + function l() { + (this.commands = []), + (this.fill = "black"), + (this.stroke = null), + (this.strokeWidth = 1); + } + (l.prototype.moveTo = function (e, t) { + this.commands.push({ type: "M", x: e, y: t }); + }), + (l.prototype.lineTo = function (e, t) { + this.commands.push({ type: "L", x: e, y: t }); + }), + (l.prototype.curveTo = l.prototype.bezierCurveTo = + function (e, t, n, s, o, r) { + this.commands.push({ + type: "C", + x1: e, + y1: t, + x2: n, + y2: s, + x: o, + y: r, + }); + }), + (l.prototype.quadTo = l.prototype.quadraticCurveTo = + function (e, t, n, s) { + this.commands.push({ type: "Q", x1: e, y1: t, x: n, y: s }); + }), + (l.prototype.close = l.prototype.closePath = + function () { + this.commands.push({ type: "Z" }); + }), + (l.prototype.extend = function (e) { + if (e.commands) e = e.commands; + else if (e instanceof i) { + const t = e; + return ( + this.moveTo(t.x1, t.y1), + this.lineTo(t.x2, t.y1), + this.lineTo(t.x2, t.y2), + this.lineTo(t.x1, t.y2), + void this.close() + ); + } + Array.prototype.push.apply(this.commands, e); + }), + (l.prototype.getBoundingBox = function () { + const e = new i(); + let t = 0, + n = 0, + s = 0, + o = 0; + for (let r = 0; r < this.commands.length; r++) { + const a = this.commands[r]; + switch (a.type) { + case "M": + e.addPoint(a.x, a.y), (t = s = a.x), (n = o = a.y); + break; + case "L": + e.addPoint(a.x, a.y), (s = a.x), (o = a.y); + break; + case "Q": + e.addQuad(s, o, a.x1, a.y1, a.x, a.y), + (s = a.x), + (o = a.y); + break; + case "C": + e.addBezier(s, o, a.x1, a.y1, a.x2, a.y2, a.x, a.y), + (s = a.x), + (o = a.y); + break; + case "Z": + (s = t), (o = n); + break; + default: + throw new Error("Unexpected path command " + a.type); + } + } + return e.isEmpty() && e.addPoint(0, 0), e; + }), + (l.prototype.draw = function (e) { + e.beginPath(); + for (let t = 0; t < this.commands.length; t += 1) { + const n = this.commands[t]; + "M" === n.type + ? e.moveTo(n.x, n.y) + : "L" === n.type + ? e.lineTo(n.x, n.y) + : "C" === n.type + ? e.bezierCurveTo(n.x1, n.y1, n.x2, n.y2, n.x, n.y) + : "Q" === n.type + ? e.quadraticCurveTo(n.x1, n.y1, n.x, n.y) + : "Z" === n.type && e.closePath(); + } + this.fill && ((e.fillStyle = this.fill), e.fill()), + this.stroke && + ((e.strokeStyle = this.stroke), + (e.lineWidth = this.strokeWidth), + e.stroke()); + }), + (l.prototype.toPathData = function (e) { + function t(t) { + return Math.round(t) === t + ? "" + Math.round(t) + : t.toFixed(e); + } + function n() { + let e = ""; + for (let n = 0; n < arguments.length; n += 1) { + const s = arguments[n]; + s >= 0 && n > 0 && (e += " "), (e += t(s)); + } + return e; + } + e = void 0 !== e ? e : 2; + let s = ""; + for (let e = 0; e < this.commands.length; e += 1) { + const t = this.commands[e]; + "M" === t.type + ? (s += "M" + n(t.x, t.y)) + : "L" === t.type + ? (s += "L" + n(t.x, t.y)) + : "C" === t.type + ? (s += "C" + n(t.x1, t.y1, t.x2, t.y2, t.x, t.y)) + : "Q" === t.type + ? (s += "Q" + n(t.x1, t.y1, t.x, t.y)) + : "Z" === t.type && (s += "Z"); + } + return s; + }), + (l.prototype.toSVG = function (e) { + let t = '= 0 && e <= 255, + "Byte value should be between 0 and 255." + ), + [e] + ); + }), + (m.BYTE = y(1)), + (g.CHAR = function (e) { + return [e.charCodeAt(0)]; + }), + (m.CHAR = y(1)), + (g.CHARARRAY = function (e) { + const t = []; + for (let n = 0; n < e.length; n += 1) t[n] = e.charCodeAt(n); + return t; + }), + (m.CHARARRAY = function (e) { + return e.length; + }), + (g.USHORT = function (e) { + return [(e >> 8) & 255, 255 & e]; + }), + (m.USHORT = y(2)), + (g.SHORT = function (e) { + return ( + e >= 32768 && (e = -(65536 - e)), [(e >> 8) & 255, 255 & e] + ); + }), + (m.SHORT = y(2)), + (g.UINT24 = function (e) { + return [(e >> 16) & 255, (e >> 8) & 255, 255 & e]; + }), + (m.UINT24 = y(3)), + (g.ULONG = function (e) { + return [ + (e >> 24) & 255, + (e >> 16) & 255, + (e >> 8) & 255, + 255 & e, + ]; + }), + (m.ULONG = y(4)), + (g.LONG = function (e) { + return ( + e >= h && (e = -(2 * h - e)), + [(e >> 24) & 255, (e >> 16) & 255, (e >> 8) & 255, 255 & e] + ); + }), + (m.LONG = y(4)), + (g.FIXED = g.ULONG), + (m.FIXED = m.ULONG), + (g.FWORD = g.SHORT), + (m.FWORD = m.SHORT), + (g.UFWORD = g.USHORT), + (m.UFWORD = m.USHORT), + (g.LONGDATETIME = function (e) { + return [ + 0, + 0, + 0, + 0, + (e >> 24) & 255, + (e >> 16) & 255, + (e >> 8) & 255, + 255 & e, + ]; + }), + (m.LONGDATETIME = y(8)), + (g.TAG = function (e) { + return ( + f.argument( + 4 === e.length, + "Tag should be exactly 4 ASCII characters." + ), + [ + e.charCodeAt(0), + e.charCodeAt(1), + e.charCodeAt(2), + e.charCodeAt(3), + ] + ); + }), + (m.TAG = y(4)), + (g.Card8 = g.BYTE), + (m.Card8 = m.BYTE), + (g.Card16 = g.USHORT), + (m.Card16 = m.USHORT), + (g.OffSize = g.BYTE), + (m.OffSize = m.BYTE), + (g.SID = g.USHORT), + (m.SID = m.USHORT), + (g.NUMBER = function (e) { + return e >= -107 && e <= 107 + ? [e + 139] + : e >= 108 && e <= 1131 + ? [247 + ((e -= 108) >> 8), 255 & e] + : e >= -1131 && e <= -108 + ? [251 + ((e = -e - 108) >> 8), 255 & e] + : e >= -32768 && e <= 32767 + ? g.NUMBER16(e) + : g.NUMBER32(e); + }), + (m.NUMBER = function (e) { + return g.NUMBER(e).length; + }), + (g.NUMBER16 = function (e) { + return [28, (e >> 8) & 255, 255 & e]; + }), + (m.NUMBER16 = y(3)), + (g.NUMBER32 = function (e) { + return [ + 29, + (e >> 24) & 255, + (e >> 16) & 255, + (e >> 8) & 255, + 255 & e, + ]; + }), + (m.NUMBER32 = y(5)), + (g.REAL = function (e) { + let t = e.toString(); + const n = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec( + t + ); + if (n) { + const s = parseFloat( + "1e" + ((n[2] ? +n[2] : 0) + n[1].length) + ); + t = (Math.round(e * s) / s).toString(); + } + let s = ""; + for (let e = 0, n = t.length; e < n; e += 1) { + const n = t[e]; + s += + "e" === n + ? "-" === t[++e] + ? "c" + : "b" + : "." === n + ? "a" + : "-" === n + ? "e" + : n; + } + s += 1 & s.length ? "f" : "ff"; + const o = [30]; + for (let e = 0, t = s.length; e < t; e += 2) + o.push(parseInt(s.substr(e, 2), 16)); + return o; + }), + (m.REAL = function (e) { + return g.REAL(e).length; + }), + (g.NAME = g.CHARARRAY), + (m.NAME = m.CHARARRAY), + (g.STRING = g.CHARARRAY), + (m.STRING = m.CHARARRAY), + (d.UTF8 = function (e, t, n) { + const s = [], + o = n; + for (let n = 0; n < o; n++, t += 1) s[n] = e.getUint8(t); + return String.fromCharCode.apply(null, s); + }), + (d.UTF16 = function (e, t, n) { + const s = [], + o = n / 2; + for (let n = 0; n < o; n++, t += 2) s[n] = e.getUint16(t); + return String.fromCharCode.apply(null, s); + }), + (g.UTF16 = function (e) { + const t = []; + for (let n = 0; n < e.length; n += 1) { + const s = e.charCodeAt(n); + (t[t.length] = (s >> 8) & 255), (t[t.length] = 255 & s); + } + return t; + }), + (m.UTF16 = function (e) { + return 2 * e.length; + }); + const v = { + "x-mac-croatian": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ", + "x-mac-cyrillic": + "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю", + "x-mac-gaelic": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ", + "x-mac-greek": + "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­", + "x-mac-icelandic": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-inuit": + "ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł", + "x-mac-ce": + "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ", + macintosh: + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-romanian": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", + "x-mac-turkish": + "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ", + }; + d.MACSTRING = function (e, t, n, s) { + const o = v[s]; + if (void 0 === o) return; + let r = ""; + for (let s = 0; s < n; s++) { + const n = e.getUint8(t + s); + r += n <= 127 ? String.fromCharCode(n) : o[127 & n]; + } + return r; + }; + const b = "function" == typeof WeakMap && new WeakMap(); + let x; + function S(e) { + return e >= -128 && e <= 127; + } + function U(e, t, n) { + let s = 0; + const o = e.length; + for (; t < o && s < 64 && 0 === e[t]; ) ++t, ++s; + return n.push(128 | (s - 1)), t; + } + function k(e, t, n) { + let s = 0; + const o = e.length; + let r = t; + for (; r < o && s < 64; ) { + const t = e[r]; + if (!S(t)) break; + if (0 === t && r + 1 < o && 0 === e[r + 1]) break; + ++r, ++s; + } + n.push(s - 1); + for (let s = t; s < r; ++s) n.push((e[s] + 256) & 255); + return r; + } + function T(e, t, n) { + let s = 0; + const o = e.length; + let r = t; + for (; r < o && s < 64; ) { + const t = e[r]; + if (0 === t) break; + if (S(t) && r + 1 < o && S(e[r + 1])) break; + ++r, ++s; + } + n.push(64 | (s - 1)); + for (let s = t; s < r; ++s) { + const t = e[s]; + n.push(((t + 65536) >> 8) & 255, (t + 256) & 255); + } + return r; + } + (g.MACSTRING = function (e, t) { + const n = (function (e) { + if (!x) { + x = {}; + for (let e in v) x[e] = new String(e); + } + const t = x[e]; + if (void 0 === t) return; + if (b) { + const e = b.get(t); + if (void 0 !== e) return e; + } + const n = v[e]; + if (void 0 === n) return; + const s = {}; + for (let e = 0; e < n.length; e++) s[n.charCodeAt(e)] = e + 128; + return b && b.set(t, s), s; + })(t); + if (void 0 === n) return; + const s = []; + for (let t = 0; t < e.length; t++) { + let o = e.charCodeAt(t); + if (o >= 128 && ((o = n[o]), void 0 === o)) return; + s[t] = o; + } + return s; + }), + (m.MACSTRING = function (e, t) { + const n = g.MACSTRING(e, t); + return void 0 !== n ? n.length : 0; + }), + (g.VARDELTAS = function (e) { + let t = 0; + const n = []; + for (; t < e.length; ) { + const s = e[t]; + t = + 0 === s + ? U(e, t, n) + : s >= -128 && s <= 127 + ? k(e, t, n) + : T(e, t, n); + } + return n; + }), + (g.INDEX = function (e) { + let t = 1; + const n = [t], + s = []; + for (let o = 0; o < e.length; o += 1) { + const r = g.OBJECT(e[o]); + Array.prototype.push.apply(s, r), (t += r.length), n.push(t); + } + if (0 === s.length) return [0, 0]; + const o = [], + r = (1 + Math.floor(Math.log(t) / Math.log(2)) / 8) | 0, + a = [void 0, g.BYTE, g.USHORT, g.UINT24, g.ULONG][r]; + for (let e = 0; e < n.length; e += 1) { + const t = a(n[e]); + Array.prototype.push.apply(o, t); + } + return Array.prototype.concat( + g.Card16(e.length), + g.OffSize(r), + o, + s + ); + }), + (m.INDEX = function (e) { + return g.INDEX(e).length; + }), + (g.DICT = function (e) { + let t = []; + const n = Object.keys(e), + s = n.length; + for (let o = 0; o < s; o += 1) { + const s = parseInt(n[o], 0), + r = e[s]; + (t = t.concat(g.OPERAND(r.value, r.type))), + (t = t.concat(g.OPERATOR(s))); + } + return t; + }), + (m.DICT = function (e) { + return g.DICT(e).length; + }), + (g.OPERATOR = function (e) { + return e < 1200 ? [e] : [12, e - 1200]; + }), + (g.OPERAND = function (e, t) { + let n = []; + if (Array.isArray(t)) + for (let s = 0; s < t.length; s += 1) + f.argument( + e.length === t.length, + "Not enough arguments given for type" + t + ), + (n = n.concat(g.OPERAND(e[s], t[s]))); + else if ("SID" === t) n = n.concat(g.NUMBER(e)); + else if ("offset" === t) n = n.concat(g.NUMBER32(e)); + else if ("number" === t) n = n.concat(g.NUMBER(e)); + else { + if ("real" !== t) + throw new Error("Unknown operand type " + t); + n = n.concat(g.REAL(e)); + } + return n; + }), + (g.OP = g.BYTE), + (m.OP = m.BYTE); + const E = "function" == typeof WeakMap && new WeakMap(); + function w(e, t, n) { + for (let e = 0; e < t.length; e += 1) { + const n = t[e]; + this[n.name] = n.value; + } + if (((this.tableName = e), (this.fields = t), n)) { + const e = Object.keys(n); + for (let t = 0; t < e.length; t += 1) { + const s = e[t], + o = n[s]; + void 0 !== this[s] && (this[s] = o); + } + } + } + function O(e, t, n) { + void 0 === n && (n = t.length); + const s = new Array(t.length + 1); + s[0] = { name: e + "Count", type: "USHORT", value: n }; + for (let n = 0; n < t.length; n++) + s[n + 1] = { name: e + n, type: "USHORT", value: t[n] }; + return s; + } + function I(e, t, n) { + const s = t.length, + o = new Array(s + 1); + o[0] = { name: e + "Count", type: "USHORT", value: s }; + for (let r = 0; r < s; r++) + o[r + 1] = { name: e + r, type: "TABLE", value: n(t[r], r) }; + return o; + } + function R(e, t, n) { + const s = t.length; + let o = []; + o[0] = { name: e + "Count", type: "USHORT", value: s }; + for (let e = 0; e < s; e++) o = o.concat(n(t[e], e)); + return o; + } + function L(e) { + 1 === e.format + ? w.call( + this, + "coverageTable", + [ + { name: "coverageFormat", type: "USHORT", value: 1 }, + ].concat(O("glyph", e.glyphs)) + ) + : f.assert(!1, "Can't create coverage table format 2 yet."); + } + function B(e) { + w.call( + this, + "scriptListTable", + R("scriptRecord", e, function (e, t) { + const n = e.script; + let s = n.defaultLangSys; + return ( + f.assert( + !!s, + "Unable to write GSUB: script " + + e.tag + + " has no default language system." + ), + [ + { name: "scriptTag" + t, type: "TAG", value: e.tag }, + { + name: "script" + t, + type: "TABLE", + value: new w( + "scriptTable", + [ + { + name: "defaultLangSys", + type: "TABLE", + value: new w( + "defaultLangSys", + [ + { + name: "lookupOrder", + type: "USHORT", + value: 0, + }, + { + name: "reqFeatureIndex", + type: "USHORT", + value: s.reqFeatureIndex, + }, + ].concat(O("featureIndex", s.featureIndexes)) + ), + }, + ].concat( + R("langSys", n.langSysRecords, function (e, t) { + const n = e.langSys; + return [ + { + name: "langSysTag" + t, + type: "TAG", + value: e.tag, + }, + { + name: "langSys" + t, + type: "TABLE", + value: new w( + "langSys", + [ + { + name: "lookupOrder", + type: "USHORT", + value: 0, + }, + { + name: "reqFeatureIndex", + type: "USHORT", + value: n.reqFeatureIndex, + }, + ].concat( + O("featureIndex", n.featureIndexes) + ) + ), + }, + ]; + }) + ) + ), + }, + ] + ); + }) + ); + } + function C(e) { + w.call( + this, + "featureListTable", + R("featureRecord", e, function (e, t) { + const n = e.feature; + return [ + { name: "featureTag" + t, type: "TAG", value: e.tag }, + { + name: "feature" + t, + type: "TABLE", + value: new w( + "featureTable", + [ + { + name: "featureParams", + type: "USHORT", + value: n.featureParams, + }, + ].concat(O("lookupListIndex", n.lookupListIndexes)) + ), + }, + ]; + }) + ); + } + function D(e, t) { + w.call( + this, + "lookupListTable", + I("lookup", e, function (e) { + let n = t[e.lookupType]; + return ( + f.assert( + !!n, + "Unable to write GSUB lookup type " + + e.lookupType + + " tables." + ), + new w( + "lookupTable", + [ + { + name: "lookupType", + type: "USHORT", + value: e.lookupType, + }, + { + name: "lookupFlag", + type: "USHORT", + value: e.lookupFlag, + }, + ].concat(I("subtable", e.subtables, n)) + ) + ); + }) + ); + } + (g.CHARSTRING = function (e) { + if (E) { + const t = E.get(e); + if (void 0 !== t) return t; + } + let t = []; + const n = e.length; + for (let s = 0; s < n; s += 1) { + const n = e[s]; + t = t.concat(g[n.type](n.value)); + } + return E && E.set(e, t), t; + }), + (m.CHARSTRING = function (e) { + return g.CHARSTRING(e).length; + }), + (g.OBJECT = function (e) { + const t = g[e.type]; + return ( + f.argument( + void 0 !== t, + "No encoding function for type " + e.type + ), + t(e.value) + ); + }), + (m.OBJECT = function (e) { + const t = m[e.type]; + return ( + f.argument( + void 0 !== t, + "No sizeOf function for type " + e.type + ), + t(e.value) + ); + }), + (g.TABLE = function (e) { + let t = []; + const n = e.fields.length, + s = [], + o = []; + for (let r = 0; r < n; r += 1) { + const n = e.fields[r], + a = g[n.type]; + f.argument( + void 0 !== a, + "No encoding function for field type " + + n.type + + " (" + + n.name + + ")" + ); + let i = e[n.name]; + void 0 === i && (i = n.value); + const l = a(i); + "TABLE" === n.type + ? (o.push(t.length), (t = t.concat([0, 0])), s.push(l)) + : (t = t.concat(l)); + } + for (let n = 0; n < s.length; n += 1) { + const r = o[n], + a = t.length; + f.argument(a < 65536, "Table " + e.tableName + " too big."), + (t[r] = a >> 8), + (t[r + 1] = 255 & a), + (t = t.concat(s[n])); + } + return t; + }), + (m.TABLE = function (e) { + let t = 0; + const n = e.fields.length; + for (let s = 0; s < n; s += 1) { + const n = e.fields[s], + o = m[n.type]; + f.argument( + void 0 !== o, + "No sizeOf function for field type " + + n.type + + " (" + + n.name + + ")" + ); + let r = e[n.name]; + void 0 === r && (r = n.value), + (t += o(r)), + "TABLE" === n.type && (t += 2); + } + return t; + }), + (g.RECORD = g.TABLE), + (m.RECORD = m.TABLE), + (g.LITERAL = function (e) { + return e; + }), + (m.LITERAL = function (e) { + return e.length; + }), + (w.prototype.encode = function () { + return g.TABLE(this); + }), + (w.prototype.sizeOf = function () { + return m.TABLE(this); + }), + (L.prototype = Object.create(w.prototype)), + (L.prototype.constructor = L), + (B.prototype = Object.create(w.prototype)), + (B.prototype.constructor = B), + (C.prototype = Object.create(w.prototype)), + (C.prototype.constructor = C), + (D.prototype = Object.create(w.prototype)), + (D.prototype.constructor = D); + const M = { + Table: w, + Record: w, + Coverage: L, + ScriptList: B, + FeatureList: C, + LookupList: D, + ushortList: O, + tableList: I, + recordList: R, + }; + function A(e, t) { + return e.getUint8(t); + } + function P(e, t) { + return e.getUint16(t, !1); + } + function G(e, t) { + return e.getUint32(t, !1); + } + function N(e, t) { + return e.getInt16(t, !1) + e.getUint16(t + 2, !1) / 65535; + } + const F = { + byte: 1, + uShort: 2, + short: 2, + uLong: 4, + fixed: 4, + longDateTime: 8, + tag: 4, + }; + function _(e, t) { + (this.data = e), (this.offset = t), (this.relativeOffset = 0); + } + (_.prototype.parseByte = function () { + const e = this.data.getUint8(this.offset + this.relativeOffset); + return (this.relativeOffset += 1), e; + }), + (_.prototype.parseChar = function () { + const e = this.data.getInt8(this.offset + this.relativeOffset); + return (this.relativeOffset += 1), e; + }), + (_.prototype.parseCard8 = _.prototype.parseByte), + (_.prototype.parseUShort = function () { + const e = this.data.getUint16( + this.offset + this.relativeOffset + ); + return (this.relativeOffset += 2), e; + }), + (_.prototype.parseCard16 = _.prototype.parseUShort), + (_.prototype.parseSID = _.prototype.parseUShort), + (_.prototype.parseOffset16 = _.prototype.parseUShort), + (_.prototype.parseShort = function () { + const e = this.data.getInt16(this.offset + this.relativeOffset); + return (this.relativeOffset += 2), e; + }), + (_.prototype.parseF2Dot14 = function () { + const e = + this.data.getInt16(this.offset + this.relativeOffset) / 16384; + return (this.relativeOffset += 2), e; + }), + (_.prototype.parseULong = function () { + const e = G(this.data, this.offset + this.relativeOffset); + return (this.relativeOffset += 4), e; + }), + (_.prototype.parseOffset32 = _.prototype.parseULong), + (_.prototype.parseFixed = function () { + const e = N(this.data, this.offset + this.relativeOffset); + return (this.relativeOffset += 4), e; + }), + (_.prototype.parseString = function (e) { + const t = this.data, + n = this.offset + this.relativeOffset; + let s = ""; + this.relativeOffset += e; + for (let o = 0; o < e; o++) + s += String.fromCharCode(t.getUint8(n + o)); + return s; + }), + (_.prototype.parseTag = function () { + return this.parseString(4); + }), + (_.prototype.parseLongDateTime = function () { + let e = G(this.data, this.offset + this.relativeOffset + 4); + return (e -= 2082844800), (this.relativeOffset += 8), e; + }), + (_.prototype.parseVersion = function (e) { + const t = P(this.data, this.offset + this.relativeOffset), + n = P(this.data, this.offset + this.relativeOffset + 2); + return ( + (this.relativeOffset += 4), + void 0 === e && (e = 4096), + t + n / e / 10 + ); + }), + (_.prototype.skip = function (e, t) { + void 0 === t && (t = 1), (this.relativeOffset += F[e] * t); + }), + (_.prototype.parseULongList = function (e) { + void 0 === e && (e = this.parseULong()); + const t = new Array(e), + n = this.data; + let s = this.offset + this.relativeOffset; + for (let o = 0; o < e; o++) (t[o] = n.getUint32(s)), (s += 4); + return (this.relativeOffset += 4 * e), t; + }), + (_.prototype.parseOffset16List = _.prototype.parseUShortList = + function (e) { + void 0 === e && (e = this.parseUShort()); + const t = new Array(e), + n = this.data; + let s = this.offset + this.relativeOffset; + for (let o = 0; o < e; o++) (t[o] = n.getUint16(s)), (s += 2); + return (this.relativeOffset += 2 * e), t; + }), + (_.prototype.parseShortList = function (e) { + const t = new Array(e), + n = this.data; + let s = this.offset + this.relativeOffset; + for (let o = 0; o < e; o++) (t[o] = n.getInt16(s)), (s += 2); + return (this.relativeOffset += 2 * e), t; + }), + (_.prototype.parseByteList = function (e) { + const t = new Array(e), + n = this.data; + let s = this.offset + this.relativeOffset; + for (let o = 0; o < e; o++) t[o] = n.getUint8(s++); + return (this.relativeOffset += e), t; + }), + (_.prototype.parseList = function (e, t) { + t || ((t = e), (e = this.parseUShort())); + const n = new Array(e); + for (let s = 0; s < e; s++) n[s] = t.call(this); + return n; + }), + (_.prototype.parseList32 = function (e, t) { + t || ((t = e), (e = this.parseULong())); + const n = new Array(e); + for (let s = 0; s < e; s++) n[s] = t.call(this); + return n; + }), + (_.prototype.parseRecordList = function (e, t) { + t || ((t = e), (e = this.parseUShort())); + const n = new Array(e), + s = Object.keys(t); + for (let o = 0; o < e; o++) { + const e = {}; + for (let n = 0; n < s.length; n++) { + const o = s[n], + r = t[o]; + e[o] = r.call(this); + } + n[o] = e; + } + return n; + }), + (_.prototype.parseRecordList32 = function (e, t) { + t || ((t = e), (e = this.parseULong())); + const n = new Array(e), + s = Object.keys(t); + for (let o = 0; o < e; o++) { + const e = {}; + for (let n = 0; n < s.length; n++) { + const o = s[n], + r = t[o]; + e[o] = r.call(this); + } + n[o] = e; + } + return n; + }), + (_.prototype.parseStruct = function (e) { + if ("function" == typeof e) return e.call(this); + { + const t = Object.keys(e), + n = {}; + for (let s = 0; s < t.length; s++) { + const o = t[s], + r = e[o]; + n[o] = r.call(this); + } + return n; + } + }), + (_.prototype.parseValueRecord = function (e) { + if ((void 0 === e && (e = this.parseUShort()), 0 === e)) return; + const t = {}; + return ( + 1 & e && (t.xPlacement = this.parseShort()), + 2 & e && (t.yPlacement = this.parseShort()), + 4 & e && (t.xAdvance = this.parseShort()), + 8 & e && (t.yAdvance = this.parseShort()), + 16 & e && ((t.xPlaDevice = void 0), this.parseShort()), + 32 & e && ((t.yPlaDevice = void 0), this.parseShort()), + 64 & e && ((t.xAdvDevice = void 0), this.parseShort()), + 128 & e && ((t.yAdvDevice = void 0), this.parseShort()), + t + ); + }), + (_.prototype.parseValueRecordList = function () { + const e = this.parseUShort(), + t = this.parseUShort(), + n = new Array(t); + for (let s = 0; s < t; s++) n[s] = this.parseValueRecord(e); + return n; + }), + (_.prototype.parsePointer = function (e) { + const t = this.parseOffset16(); + if (t > 0) + return new _(this.data, this.offset + t).parseStruct(e); + }), + (_.prototype.parsePointer32 = function (e) { + const t = this.parseOffset32(); + if (t > 0) + return new _(this.data, this.offset + t).parseStruct(e); + }), + (_.prototype.parseListOfLists = function (e) { + const t = this.parseOffset16List(), + n = t.length, + s = this.relativeOffset, + o = new Array(n); + for (let s = 0; s < n; s++) { + const n = t[s]; + if (0 !== n) + if (((this.relativeOffset = n), e)) { + const t = this.parseOffset16List(), + r = new Array(t.length); + for (let s = 0; s < t.length; s++) + (this.relativeOffset = n + t[s]), (r[s] = e.call(this)); + o[s] = r; + } else o[s] = this.parseUShortList(); + else o[s] = void 0; + } + return (this.relativeOffset = s), o; + }), + (_.prototype.parseCoverage = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(), + n = this.parseUShort(); + if (1 === t) + return { format: 1, glyphs: this.parseUShortList(n) }; + if (2 === t) { + const e = new Array(n); + for (let t = 0; t < n; t++) + e[t] = { + start: this.parseUShort(), + end: this.parseUShort(), + index: this.parseUShort(), + }; + return { format: 2, ranges: e }; + } + throw new Error( + "0x" + e.toString(16) + ": Coverage format must be 1 or 2." + ); + }), + (_.prototype.parseClassDef = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(); + if (1 === t) + return { + format: 1, + startGlyph: this.parseUShort(), + classes: this.parseUShortList(), + }; + if (2 === t) + return { + format: 2, + ranges: this.parseRecordList({ + start: _.uShort, + end: _.uShort, + classId: _.uShort, + }), + }; + throw new Error( + "0x" + e.toString(16) + ": ClassDef format must be 1 or 2." + ); + }), + (_.list = function (e, t) { + return function () { + return this.parseList(e, t); + }; + }), + (_.list32 = function (e, t) { + return function () { + return this.parseList32(e, t); + }; + }), + (_.recordList = function (e, t) { + return function () { + return this.parseRecordList(e, t); + }; + }), + (_.recordList32 = function (e, t) { + return function () { + return this.parseRecordList32(e, t); + }; + }), + (_.pointer = function (e) { + return function () { + return this.parsePointer(e); + }; + }), + (_.pointer32 = function (e) { + return function () { + return this.parsePointer32(e); + }; + }), + (_.tag = _.prototype.parseTag), + (_.byte = _.prototype.parseByte), + (_.uShort = _.offset16 = _.prototype.parseUShort), + (_.uShortList = _.prototype.parseUShortList), + (_.uLong = _.offset32 = _.prototype.parseULong), + (_.uLongList = _.prototype.parseULongList), + (_.struct = _.prototype.parseStruct), + (_.coverage = _.prototype.parseCoverage), + (_.classDef = _.prototype.parseClassDef); + const H = { + reserved: _.uShort, + reqFeatureIndex: _.uShort, + featureIndexes: _.uShortList, + }; + (_.prototype.parseScriptList = function () { + return ( + this.parsePointer( + _.recordList({ + tag: _.tag, + script: _.pointer({ + defaultLangSys: _.pointer(H), + langSysRecords: _.recordList({ + tag: _.tag, + langSys: _.pointer(H), + }), + }), + }) + ) || [] + ); + }), + (_.prototype.parseFeatureList = function () { + return ( + this.parsePointer( + _.recordList({ + tag: _.tag, + feature: _.pointer({ + featureParams: _.offset16, + lookupListIndexes: _.uShortList, + }), + }) + ) || [] + ); + }), + (_.prototype.parseLookupList = function (e) { + return ( + this.parsePointer( + _.list( + _.pointer(function () { + const t = this.parseUShort(); + f.argument( + 1 <= t && t <= 9, + "GPOS/GSUB lookup type " + t + " unknown." + ); + const n = this.parseUShort(), + s = 16 & n; + return { + lookupType: t, + lookupFlag: n, + subtables: this.parseList(_.pointer(e[t])), + markFilteringSet: s ? this.parseUShort() : void 0, + }; + }) + ) + ) || [] + ); + }), + (_.prototype.parseFeatureVariationsList = function () { + return ( + this.parsePointer32(function () { + const e = this.parseUShort(), + t = this.parseUShort(); + return ( + f.argument( + 1 === e && t < 1, + "GPOS/GSUB feature variations table unknown." + ), + this.parseRecordList32({ + conditionSetOffset: _.offset32, + featureTableSubstitutionOffset: _.offset32, + }) + ); + }) || [] + ); + }); + const z = { + getByte: A, + getCard8: A, + getUShort: P, + getCard16: P, + getShort: function (e, t) { + return e.getInt16(t, !1); }, - { - text: Scratch.translate("yellow"), - value: "yellow", + getULong: G, + getFixed: N, + getTag: function (e, t) { + let n = ""; + for (let s = t; s < t + 4; s += 1) + n += String.fromCharCode(e.getInt8(s)); + return n; }, - { - text: Scratch.translate("bright yellow"), - value: "brightYellow", + getOffset: function (e, t, n) { + let s = 0; + for (let o = 0; o < n; o += 1) + (s <<= 8), (s += e.getUint8(t + o)); + return s; }, - { - text: Scratch.translate("blue"), - value: "blue", + getBytes: function (e, t, n) { + const s = []; + for (let o = t; o < n; o += 1) s.push(e.getUint8(o)); + return s; }, - { - text: Scratch.translate("bright blue"), - value: "brightBlue", + bytesToString: function (e) { + let t = ""; + for (let n = 0; n < e.length; n += 1) + t += String.fromCharCode(e[n]); + return t; }, - { - text: Scratch.translate("magenta"), - value: "magenta", + Parser: _, + }; + function W(e, t, n) { + e.segments.push({ + end: t, + start: t, + delta: -(t - n), + offset: 0, + glyphIndex: n, + }); + } + const q = { + parse: function (e, t) { + const n = {}; + (n.version = z.getUShort(e, t)), + f.argument( + 0 === n.version, + "cmap table version should be 0." + ), + (n.numTables = z.getUShort(e, t + 2)); + let s = -1; + for (let o = n.numTables - 1; o >= 0; o -= 1) { + const n = z.getUShort(e, t + 4 + 8 * o), + r = z.getUShort(e, t + 4 + 8 * o + 2); + if (3 === n && (0 === r || 1 === r || 10 === r)) { + s = z.getULong(e, t + 4 + 8 * o + 4); + break; + } + } + if (-1 === s) + throw new Error("No valid cmap sub-tables found."); + const o = new z.Parser(e, t + s); + if (((n.format = o.parseUShort()), 12 === n.format)) + !(function (e, t) { + let n; + t.parseUShort(), + (e.length = t.parseULong()), + (e.language = t.parseULong()), + (e.groupCount = n = t.parseULong()), + (e.glyphIndexMap = {}); + for (let s = 0; s < n; s += 1) { + const n = t.parseULong(), + s = t.parseULong(); + let o = t.parseULong(); + for (let t = n; t <= s; t += 1) + (e.glyphIndexMap[t] = o), o++; + } + })(n, o); + else { + if (4 !== n.format) + throw new Error( + "Only format 4 and 12 cmap tables are supported (found format " + + n.format + + ")." + ); + !(function (e, t, n, s, o) { + let r; + (e.length = t.parseUShort()), + (e.language = t.parseUShort()), + (e.segCount = r = t.parseUShort() >> 1), + t.skip("uShort", 3), + (e.glyphIndexMap = {}); + const a = new z.Parser(n, s + o + 14), + i = new z.Parser(n, s + o + 16 + 2 * r), + l = new z.Parser(n, s + o + 16 + 4 * r), + u = new z.Parser(n, s + o + 16 + 6 * r); + let c = s + o + 16 + 8 * r; + for (let t = 0; t < r - 1; t += 1) { + let t; + const s = a.parseUShort(), + o = i.parseUShort(), + r = l.parseShort(), + p = u.parseUShort(); + for (let a = o; a <= s; a += 1) + 0 !== p + ? ((c = u.offset + u.relativeOffset - 2), + (c += p), + (c += 2 * (a - o)), + (t = z.getUShort(n, c)), + 0 !== t && (t = (t + r) & 65535)) + : (t = (a + r) & 65535), + (e.glyphIndexMap[a] = t); + } + })(n, o, e, t, s); + } + return n; + }, + make: function (e) { + let t, + n = !0; + for (t = e.length - 1; t > 0; t -= 1) + if (e.get(t).unicode > 65535) { + console.log("Adding CMAP format 12 (needed!)"), (n = !1); + break; + } + let s = [ + { name: "version", type: "USHORT", value: 0 }, + { name: "numTables", type: "USHORT", value: n ? 1 : 2 }, + { name: "platformID", type: "USHORT", value: 3 }, + { name: "encodingID", type: "USHORT", value: 1 }, + { name: "offset", type: "ULONG", value: n ? 12 : 20 }, + ]; + n || + (s = s.concat([ + { name: "cmap12PlatformID", type: "USHORT", value: 3 }, + { name: "cmap12EncodingID", type: "USHORT", value: 10 }, + { name: "cmap12Offset", type: "ULONG", value: 0 }, + ])), + (s = s.concat([ + { name: "format", type: "USHORT", value: 4 }, + { name: "cmap4Length", type: "USHORT", value: 0 }, + { name: "language", type: "USHORT", value: 0 }, + { name: "segCountX2", type: "USHORT", value: 0 }, + { name: "searchRange", type: "USHORT", value: 0 }, + { name: "entrySelector", type: "USHORT", value: 0 }, + { name: "rangeShift", type: "USHORT", value: 0 }, + ])); + const o = new M.Table("cmap", s); + for (o.segments = [], t = 0; t < e.length; t += 1) { + const n = e.get(t); + for (let e = 0; e < n.unicodes.length; e += 1) + W(o, n.unicodes[e], t); + o.segments = o.segments.sort(function (e, t) { + return e.start - t.start; + }); + } + !(function (e) { + e.segments.push({ + end: 65535, + start: 65535, + delta: 1, + offset: 0, + }); + })(o); + const r = o.segments.length; + let a = 0, + i = [], + l = [], + u = [], + c = [], + p = [], + f = []; + for (t = 0; t < r; t += 1) { + const e = o.segments[t]; + e.end <= 65535 && e.start <= 65535 + ? ((i = i.concat({ + name: "end_" + t, + type: "USHORT", + value: e.end, + })), + (l = l.concat({ + name: "start_" + t, + type: "USHORT", + value: e.start, + })), + (u = u.concat({ + name: "idDelta_" + t, + type: "SHORT", + value: e.delta, + })), + (c = c.concat({ + name: "idRangeOffset_" + t, + type: "USHORT", + value: e.offset, + })), + void 0 !== e.glyphId && + (p = p.concat({ + name: "glyph_" + t, + type: "USHORT", + value: e.glyphId, + }))) + : (a += 1), + n || + void 0 === e.glyphIndex || + ((f = f.concat({ + name: "cmap12Start_" + t, + type: "ULONG", + value: e.start, + })), + (f = f.concat({ + name: "cmap12End_" + t, + type: "ULONG", + value: e.end, + })), + (f = f.concat({ + name: "cmap12Glyph_" + t, + type: "ULONG", + value: e.glyphIndex, + }))); + } + if ( + ((o.segCountX2 = 2 * (r - a)), + (o.searchRange = + 2 * + Math.pow(2, Math.floor(Math.log(r - a) / Math.log(2)))), + (o.entrySelector = + Math.log(o.searchRange / 2) / Math.log(2)), + (o.rangeShift = o.segCountX2 - o.searchRange), + (o.fields = o.fields.concat(i)), + o.fields.push({ + name: "reservedPad", + type: "USHORT", + value: 0, + }), + (o.fields = o.fields.concat(l)), + (o.fields = o.fields.concat(u)), + (o.fields = o.fields.concat(c)), + (o.fields = o.fields.concat(p)), + (o.cmap4Length = + 14 + + 2 * i.length + + 2 + + 2 * l.length + + 2 * u.length + + 2 * c.length + + 2 * p.length), + !n) + ) { + const e = 16 + 4 * f.length; + (o.cmap12Offset = 20 + o.cmap4Length), + (o.fields = o.fields.concat([ + { name: "cmap12Format", type: "USHORT", value: 12 }, + { name: "cmap12Reserved", type: "USHORT", value: 0 }, + { name: "cmap12Length", type: "ULONG", value: e }, + { name: "cmap12Language", type: "ULONG", value: 0 }, + { + name: "cmap12nGroups", + type: "ULONG", + value: f.length / 3, + }, + ])), + (o.fields = o.fields.concat(f)); + } + return o; + }, }, - { - text: Scratch.translate("bright magenta"), - value: "brightMagenta", + j = [ + ".notdef", + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + "exclamdown", + "cent", + "sterling", + "fraction", + "yen", + "florin", + "section", + "currency", + "quotesingle", + "quotedblleft", + "guillemotleft", + "guilsinglleft", + "guilsinglright", + "fi", + "fl", + "endash", + "dagger", + "daggerdbl", + "periodcentered", + "paragraph", + "bullet", + "quotesinglbase", + "quotedblbase", + "quotedblright", + "guillemotright", + "ellipsis", + "perthousand", + "questiondown", + "grave", + "acute", + "circumflex", + "tilde", + "macron", + "breve", + "dotaccent", + "dieresis", + "ring", + "cedilla", + "hungarumlaut", + "ogonek", + "caron", + "emdash", + "AE", + "ordfeminine", + "Lslash", + "Oslash", + "OE", + "ordmasculine", + "ae", + "dotlessi", + "lslash", + "oslash", + "oe", + "germandbls", + "onesuperior", + "logicalnot", + "mu", + "trademark", + "Eth", + "onehalf", + "plusminus", + "Thorn", + "onequarter", + "divide", + "brokenbar", + "degree", + "thorn", + "threequarters", + "twosuperior", + "registered", + "minus", + "eth", + "multiply", + "threesuperior", + "copyright", + "Aacute", + "Acircumflex", + "Adieresis", + "Agrave", + "Aring", + "Atilde", + "Ccedilla", + "Eacute", + "Ecircumflex", + "Edieresis", + "Egrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Igrave", + "Ntilde", + "Oacute", + "Ocircumflex", + "Odieresis", + "Ograve", + "Otilde", + "Scaron", + "Uacute", + "Ucircumflex", + "Udieresis", + "Ugrave", + "Yacute", + "Ydieresis", + "Zcaron", + "aacute", + "acircumflex", + "adieresis", + "agrave", + "aring", + "atilde", + "ccedilla", + "eacute", + "ecircumflex", + "edieresis", + "egrave", + "iacute", + "icircumflex", + "idieresis", + "igrave", + "ntilde", + "oacute", + "ocircumflex", + "odieresis", + "ograve", + "otilde", + "scaron", + "uacute", + "ucircumflex", + "udieresis", + "ugrave", + "yacute", + "ydieresis", + "zcaron", + "exclamsmall", + "Hungarumlautsmall", + "dollaroldstyle", + "dollarsuperior", + "ampersandsmall", + "Acutesmall", + "parenleftsuperior", + "parenrightsuperior", + "266 ff", + "onedotenleader", + "zerooldstyle", + "oneoldstyle", + "twooldstyle", + "threeoldstyle", + "fouroldstyle", + "fiveoldstyle", + "sixoldstyle", + "sevenoldstyle", + "eightoldstyle", + "nineoldstyle", + "commasuperior", + "threequartersemdash", + "periodsuperior", + "questionsmall", + "asuperior", + "bsuperior", + "centsuperior", + "dsuperior", + "esuperior", + "isuperior", + "lsuperior", + "msuperior", + "nsuperior", + "osuperior", + "rsuperior", + "ssuperior", + "tsuperior", + "ff", + "ffi", + "ffl", + "parenleftinferior", + "parenrightinferior", + "Circumflexsmall", + "hyphensuperior", + "Gravesmall", + "Asmall", + "Bsmall", + "Csmall", + "Dsmall", + "Esmall", + "Fsmall", + "Gsmall", + "Hsmall", + "Ismall", + "Jsmall", + "Ksmall", + "Lsmall", + "Msmall", + "Nsmall", + "Osmall", + "Psmall", + "Qsmall", + "Rsmall", + "Ssmall", + "Tsmall", + "Usmall", + "Vsmall", + "Wsmall", + "Xsmall", + "Ysmall", + "Zsmall", + "colonmonetary", + "onefitted", + "rupiah", + "Tildesmall", + "exclamdownsmall", + "centoldstyle", + "Lslashsmall", + "Scaronsmall", + "Zcaronsmall", + "Dieresissmall", + "Brevesmall", + "Caronsmall", + "Dotaccentsmall", + "Macronsmall", + "figuredash", + "hypheninferior", + "Ogoneksmall", + "Ringsmall", + "Cedillasmall", + "questiondownsmall", + "oneeighth", + "threeeighths", + "fiveeighths", + "seveneighths", + "onethird", + "twothirds", + "zerosuperior", + "foursuperior", + "fivesuperior", + "sixsuperior", + "sevensuperior", + "eightsuperior", + "ninesuperior", + "zeroinferior", + "oneinferior", + "twoinferior", + "threeinferior", + "fourinferior", + "fiveinferior", + "sixinferior", + "seveninferior", + "eightinferior", + "nineinferior", + "centinferior", + "dollarinferior", + "periodinferior", + "commainferior", + "Agravesmall", + "Aacutesmall", + "Acircumflexsmall", + "Atildesmall", + "Adieresissmall", + "Aringsmall", + "AEsmall", + "Ccedillasmall", + "Egravesmall", + "Eacutesmall", + "Ecircumflexsmall", + "Edieresissmall", + "Igravesmall", + "Iacutesmall", + "Icircumflexsmall", + "Idieresissmall", + "Ethsmall", + "Ntildesmall", + "Ogravesmall", + "Oacutesmall", + "Ocircumflexsmall", + "Otildesmall", + "Odieresissmall", + "OEsmall", + "Oslashsmall", + "Ugravesmall", + "Uacutesmall", + "Ucircumflexsmall", + "Udieresissmall", + "Yacutesmall", + "Thornsmall", + "Ydieresissmall", + "001.000", + "001.001", + "001.002", + "001.003", + "Black", + "Bold", + "Book", + "Light", + "Medium", + "Regular", + "Roman", + "Semibold", + ], + X = [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "exclamdown", + "cent", + "sterling", + "fraction", + "yen", + "florin", + "section", + "currency", + "quotesingle", + "quotedblleft", + "guillemotleft", + "guilsinglleft", + "guilsinglright", + "fi", + "fl", + "", + "endash", + "dagger", + "daggerdbl", + "periodcentered", + "", + "paragraph", + "bullet", + "quotesinglbase", + "quotedblbase", + "quotedblright", + "guillemotright", + "ellipsis", + "perthousand", + "", + "questiondown", + "", + "grave", + "acute", + "circumflex", + "tilde", + "macron", + "breve", + "dotaccent", + "dieresis", + "", + "ring", + "cedilla", + "", + "hungarumlaut", + "ogonek", + "caron", + "emdash", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "AE", + "", + "ordfeminine", + "", + "", + "", + "", + "Lslash", + "Oslash", + "OE", + "ordmasculine", + "", + "", + "", + "", + "", + "ae", + "", + "", + "", + "dotlessi", + "", + "", + "lslash", + "oslash", + "oe", + "germandbls", + ], + V = [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "space", + "exclamsmall", + "Hungarumlautsmall", + "", + "dollaroldstyle", + "dollarsuperior", + "ampersandsmall", + "Acutesmall", + "parenleftsuperior", + "parenrightsuperior", + "twodotenleader", + "onedotenleader", + "comma", + "hyphen", + "period", + "fraction", + "zerooldstyle", + "oneoldstyle", + "twooldstyle", + "threeoldstyle", + "fouroldstyle", + "fiveoldstyle", + "sixoldstyle", + "sevenoldstyle", + "eightoldstyle", + "nineoldstyle", + "colon", + "semicolon", + "commasuperior", + "threequartersemdash", + "periodsuperior", + "questionsmall", + "", + "asuperior", + "bsuperior", + "centsuperior", + "dsuperior", + "esuperior", + "", + "", + "isuperior", + "", + "", + "lsuperior", + "msuperior", + "nsuperior", + "osuperior", + "", + "", + "rsuperior", + "ssuperior", + "tsuperior", + "", + "ff", + "fi", + "fl", + "ffi", + "ffl", + "parenleftinferior", + "", + "parenrightinferior", + "Circumflexsmall", + "hyphensuperior", + "Gravesmall", + "Asmall", + "Bsmall", + "Csmall", + "Dsmall", + "Esmall", + "Fsmall", + "Gsmall", + "Hsmall", + "Ismall", + "Jsmall", + "Ksmall", + "Lsmall", + "Msmall", + "Nsmall", + "Osmall", + "Psmall", + "Qsmall", + "Rsmall", + "Ssmall", + "Tsmall", + "Usmall", + "Vsmall", + "Wsmall", + "Xsmall", + "Ysmall", + "Zsmall", + "colonmonetary", + "onefitted", + "rupiah", + "Tildesmall", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "exclamdownsmall", + "centoldstyle", + "Lslashsmall", + "", + "", + "Scaronsmall", + "Zcaronsmall", + "Dieresissmall", + "Brevesmall", + "Caronsmall", + "", + "Dotaccentsmall", + "", + "", + "Macronsmall", + "", + "", + "figuredash", + "hypheninferior", + "", + "", + "Ogoneksmall", + "Ringsmall", + "Cedillasmall", + "", + "", + "", + "onequarter", + "onehalf", + "threequarters", + "questiondownsmall", + "oneeighth", + "threeeighths", + "fiveeighths", + "seveneighths", + "onethird", + "twothirds", + "", + "", + "zerosuperior", + "onesuperior", + "twosuperior", + "threesuperior", + "foursuperior", + "fivesuperior", + "sixsuperior", + "sevensuperior", + "eightsuperior", + "ninesuperior", + "zeroinferior", + "oneinferior", + "twoinferior", + "threeinferior", + "fourinferior", + "fiveinferior", + "sixinferior", + "seveninferior", + "eightinferior", + "nineinferior", + "centinferior", + "dollarinferior", + "periodinferior", + "commainferior", + "Agravesmall", + "Aacutesmall", + "Acircumflexsmall", + "Atildesmall", + "Adieresissmall", + "Aringsmall", + "AEsmall", + "Ccedillasmall", + "Egravesmall", + "Eacutesmall", + "Ecircumflexsmall", + "Edieresissmall", + "Igravesmall", + "Iacutesmall", + "Icircumflexsmall", + "Idieresissmall", + "Ethsmall", + "Ntildesmall", + "Ogravesmall", + "Oacutesmall", + "Ocircumflexsmall", + "Otildesmall", + "Odieresissmall", + "OEsmall", + "Oslashsmall", + "Ugravesmall", + "Uacutesmall", + "Ucircumflexsmall", + "Udieresissmall", + "Yacutesmall", + "Thornsmall", + "Ydieresissmall", + ], + Y = [ + ".notdef", + ".null", + "nonmarkingreturn", + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quotesingle", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "grave", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + "Adieresis", + "Aring", + "Ccedilla", + "Eacute", + "Ntilde", + "Odieresis", + "Udieresis", + "aacute", + "agrave", + "acircumflex", + "adieresis", + "atilde", + "aring", + "ccedilla", + "eacute", + "egrave", + "ecircumflex", + "edieresis", + "iacute", + "igrave", + "icircumflex", + "idieresis", + "ntilde", + "oacute", + "ograve", + "ocircumflex", + "odieresis", + "otilde", + "uacute", + "ugrave", + "ucircumflex", + "udieresis", + "dagger", + "degree", + "cent", + "sterling", + "section", + "bullet", + "paragraph", + "germandbls", + "registered", + "copyright", + "trademark", + "acute", + "dieresis", + "notequal", + "AE", + "Oslash", + "infinity", + "plusminus", + "lessequal", + "greaterequal", + "yen", + "mu", + "partialdiff", + "summation", + "product", + "pi", + "integral", + "ordfeminine", + "ordmasculine", + "Omega", + "ae", + "oslash", + "questiondown", + "exclamdown", + "logicalnot", + "radical", + "florin", + "approxequal", + "Delta", + "guillemotleft", + "guillemotright", + "ellipsis", + "nonbreakingspace", + "Agrave", + "Atilde", + "Otilde", + "OE", + "oe", + "endash", + "emdash", + "quotedblleft", + "quotedblright", + "quoteleft", + "quoteright", + "divide", + "lozenge", + "ydieresis", + "Ydieresis", + "fraction", + "currency", + "guilsinglleft", + "guilsinglright", + "fi", + "fl", + "daggerdbl", + "periodcentered", + "quotesinglbase", + "quotedblbase", + "perthousand", + "Acircumflex", + "Ecircumflex", + "Aacute", + "Edieresis", + "Egrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Igrave", + "Oacute", + "Ocircumflex", + "apple", + "Ograve", + "Uacute", + "Ucircumflex", + "Ugrave", + "dotlessi", + "circumflex", + "tilde", + "macron", + "breve", + "dotaccent", + "ring", + "cedilla", + "hungarumlaut", + "ogonek", + "caron", + "Lslash", + "lslash", + "Scaron", + "scaron", + "Zcaron", + "zcaron", + "brokenbar", + "Eth", + "eth", + "Yacute", + "yacute", + "Thorn", + "thorn", + "minus", + "multiply", + "onesuperior", + "twosuperior", + "threesuperior", + "onehalf", + "onequarter", + "threequarters", + "franc", + "Gbreve", + "gbreve", + "Idotaccent", + "Scedilla", + "scedilla", + "Cacute", + "cacute", + "Ccaron", + "ccaron", + "dcroat", + ]; + function Z(e) { + this.font = e; + } + function Q(e) { + this.cmap = e; + } + function J(e, t) { + (this.encoding = e), (this.charset = t); + } + function K(e) { + switch (e.version) { + case 1: + this.names = Y.slice(); + break; + case 2: + this.names = new Array(e.numberOfGlyphs); + for (let t = 0; t < e.numberOfGlyphs; t++) + e.glyphNameIndex[t] < Y.length + ? (this.names[t] = Y[e.glyphNameIndex[t]]) + : (this.names[t] = + e.names[e.glyphNameIndex[t] - Y.length]); + break; + case 2.5: + this.names = new Array(e.numberOfGlyphs); + for (let t = 0; t < e.numberOfGlyphs; t++) + this.names[t] = Y[t + e.glyphNameIndex[t]]; + break; + default: + this.names = []; + } + } + (Z.prototype.charToGlyphIndex = function (e) { + const t = e.charCodeAt(0), + n = this.font.glyphs; + if (n) + for (let e = 0; e < n.length; e += 1) { + const s = n.get(e); + for (let n = 0; n < s.unicodes.length; n += 1) + if (s.unicodes[n] === t) return e; + } + return null; + }), + (Q.prototype.charToGlyphIndex = function (e) { + return this.cmap.glyphIndexMap[e.charCodeAt(0)] || 0; + }), + (J.prototype.charToGlyphIndex = function (e) { + const t = e.charCodeAt(0), + n = this.encoding[t]; + return this.charset.indexOf(n); + }), + (K.prototype.nameToGlyphIndex = function (e) { + return this.names.indexOf(e); + }), + (K.prototype.glyphIndexToName = function (e) { + return this.names[e]; + }); + const $ = function (e, t, n, s, o) { + e.beginPath(), e.moveTo(t, n), e.lineTo(s, o), e.stroke(); + }; + function ee(e, t, n, s, o) { + let r; + return ( + (t & s) > 0 + ? ((r = e.parseByte()), 0 == (t & o) && (r = -r), (r = n + r)) + : (r = (t & o) > 0 ? n : n + e.parseShort()), + r + ); + } + function te(e, t, n) { + const s = new z.Parser(t, n); + let o, r; + if ( + ((e.numberOfContours = s.parseShort()), + (e._xMin = s.parseShort()), + (e._yMin = s.parseShort()), + (e._xMax = s.parseShort()), + (e._yMax = s.parseShort()), + e.numberOfContours > 0) + ) { + const t = (e.endPointIndices = []); + for (let n = 0; n < e.numberOfContours; n += 1) + t.push(s.parseUShort()); + (e.instructionLength = s.parseUShort()), (e.instructions = []); + for (let t = 0; t < e.instructionLength; t += 1) + e.instructions.push(s.parseByte()); + const n = t[t.length - 1] + 1; + o = []; + for (let e = 0; e < n; e += 1) + if (((r = s.parseByte()), o.push(r), (8 & r) > 0)) { + const t = s.parseByte(); + for (let n = 0; n < t; n += 1) o.push(r), (e += 1); + } + if ((f.argument(o.length === n, "Bad flags."), t.length > 0)) { + const a = []; + let i; + if (n > 0) { + for (let e = 0; e < n; e += 1) + (r = o[e]), + (i = {}), + (i.onCurve = !!(1 & r)), + (i.lastPointOfContour = t.indexOf(e) >= 0), + a.push(i); + let e = 0; + for (let t = 0; t < n; t += 1) + (r = o[t]), + (i = a[t]), + (i.x = ee(s, r, e, 2, 16)), + (e = i.x); + let l = 0; + for (let e = 0; e < n; e += 1) + (r = o[e]), + (i = a[e]), + (i.y = ee(s, r, l, 4, 32)), + (l = i.y); + } + e.points = a; + } else e.points = []; + } else if (0 === e.numberOfContours) e.points = []; + else { + (e.isComposite = !0), (e.points = []), (e.components = []); + let t = !0; + for (; t; ) { + o = s.parseUShort(); + const n = { + glyphIndex: s.parseUShort(), + xScale: 1, + scale01: 0, + scale10: 0, + yScale: 1, + dx: 0, + dy: 0, + }; + (1 & o) > 0 + ? (2 & o) > 0 + ? ((n.dx = s.parseShort()), (n.dy = s.parseShort())) + : (n.matchedPoints = [s.parseUShort(), s.parseUShort()]) + : (2 & o) > 0 + ? ((n.dx = s.parseChar()), (n.dy = s.parseChar())) + : (n.matchedPoints = [s.parseByte(), s.parseByte()]), + (8 & o) > 0 + ? (n.xScale = n.yScale = s.parseF2Dot14()) + : (64 & o) > 0 + ? ((n.xScale = s.parseF2Dot14()), + (n.yScale = s.parseF2Dot14())) + : (128 & o) > 0 && + ((n.xScale = s.parseF2Dot14()), + (n.scale01 = s.parseF2Dot14()), + (n.scale10 = s.parseF2Dot14()), + (n.yScale = s.parseF2Dot14())), + e.components.push(n), + (t = !!(32 & o)); + } + if (256 & o) { + (e.instructionLength = s.parseUShort()), + (e.instructions = []); + for (let t = 0; t < e.instructionLength; t += 1) + e.instructions.push(s.parseByte()); + } + } + } + function ne(e, t) { + const n = []; + for (let s = 0; s < e.length; s += 1) { + const o = e[s], + r = { + x: t.xScale * o.x + t.scale01 * o.y + t.dx, + y: t.scale10 * o.x + t.yScale * o.y + t.dy, + onCurve: o.onCurve, + lastPointOfContour: o.lastPointOfContour, + }; + n.push(r); + } + return n; + } + function se(e) { + const t = new u(); + if (!e) return t; + const n = (function (e) { + const t = []; + let n = []; + for (let s = 0; s < e.length; s += 1) { + const o = e[s]; + n.push(o), o.lastPointOfContour && (t.push(n), (n = [])); + } + return ( + f.argument( + 0 === n.length, + "There are still points left in the current contour." + ), + t + ); + })(e); + for (let e = 0; e < n.length; ++e) { + const s = n[e]; + let o = null, + r = s[s.length - 1], + a = s[0]; + if (r.onCurve) t.moveTo(r.x, r.y); + else if (a.onCurve) t.moveTo(a.x, a.y); + else { + const e = { x: 0.5 * (r.x + a.x), y: 0.5 * (r.y + a.y) }; + t.moveTo(e.x, e.y); + } + for (let e = 0; e < s.length; ++e) + if ( + ((o = r), (r = a), (a = s[(e + 1) % s.length]), r.onCurve) + ) + t.lineTo(r.x, r.y); + else { + let e = o, + n = a; + o.onCurve || + ((e = { x: 0.5 * (r.x + o.x), y: 0.5 * (r.y + o.y) }), + t.lineTo(e.x, e.y)), + a.onCurve || + (n = { x: 0.5 * (r.x + a.x), y: 0.5 * (r.y + a.y) }), + t.lineTo(e.x, e.y), + t.quadraticCurveTo(r.x, r.y, n.x, n.y); + } + t.closePath(); + } + return t; + } + function oe(e, t) { + if (t.isComposite) + for (let n = 0; n < t.components.length; n += 1) { + const s = t.components[n], + o = e.get(s.glyphIndex); + if ((o.getPath(), o.points)) { + let e; + if (void 0 === s.matchedPoints) e = ne(o.points, s); + else { + if ( + s.matchedPoints[0] > t.points.length - 1 || + s.matchedPoints[1] > o.points.length - 1 + ) + throw Error("Matched points out of range in " + t.name); + const n = t.points[s.matchedPoints[0]]; + let r = o.points[s.matchedPoints[1]]; + const a = { + xScale: s.xScale, + scale01: s.scale01, + scale10: s.scale10, + yScale: s.yScale, + dx: 0, + dy: 0, + }; + (r = ne([r], a)[0]), + (a.dx = n.x - r.x), + (a.dy = n.y - r.y), + (e = ne(o.points, a)); + } + t.points = t.points.concat(e); + } + } + return se(t.points); + } + const re = { + getPath: se, + parse: function (e, t, n, s) { + const o = new ce.GlyphSet(s); + for (let r = 0; r < n.length - 1; r += 1) { + const a = n[r]; + a !== n[r + 1] + ? o.push(r, ce.ttfGlyphLoader(s, r, te, e, t + a, oe)) + : o.push(r, ce.glyphLoader(s, r)); + } + return o; }, - { - text: Scratch.translate("cyan"), - value: "cyan", - }, - { - text: Scratch.translate("bright cyan"), - value: "brightCyan", + }; + function ae(e) { + this.bindConstructorValues(e); + } + (ae.prototype.bindConstructorValues = function (e) { + (this.index = e.index || 0), + (this.name = e.name || null), + (this.unicode = e.unicode || void 0), + (this.unicodes = + e.unicodes || void 0 !== e.unicode ? [e.unicode] : []), + e.xMin && (this.xMin = e.xMin), + e.yMin && (this.yMin = e.yMin), + e.xMax && (this.xMax = e.xMax), + e.yMax && (this.yMax = e.yMax), + e.advanceWidth && (this.advanceWidth = e.advanceWidth), + Object.defineProperty( + this, + "path", + (function (e, t) { + let n = t || new u(); + return { + configurable: !0, + get: function () { + return "function" == typeof n && (n = n()), n; + }, + set: function (e) { + n = e; + }, + }; + })(0, e.path) + ); + }), + (ae.prototype.addUnicode = function (e) { + 0 === this.unicodes.length && (this.unicode = e), + this.unicodes.push(e); + }), + (ae.prototype.getBoundingBox = function () { + return this.path.getBoundingBox(); + }), + (ae.prototype.getPath = function (e, t, n, s, o) { + let r, a; + (e = void 0 !== e ? e : 0), + (t = void 0 !== t ? t : 0), + (n = void 0 !== n ? n : 72), + s || (s = {}); + let i = s.xScale, + l = s.yScale; + if ( + (s.hinting && + o && + o.hinting && + (a = this.path && o.hinting.exec(this, n)), + a) + ) + (r = re.getPath(a).commands), + (e = Math.round(e)), + (t = Math.round(t)), + (i = l = 1); + else { + r = this.path.commands; + const e = (1 / this.path.unitsPerEm) * n; + void 0 === i && (i = e), void 0 === l && (l = e); + } + const c = new u(); + for (let n = 0; n < r.length; n += 1) { + const s = r[n]; + "M" === s.type + ? c.moveTo(e + s.x * i, t + -s.y * l) + : "L" === s.type + ? c.lineTo(e + s.x * i, t + -s.y * l) + : "Q" === s.type + ? c.quadraticCurveTo( + e + s.x1 * i, + t + -s.y1 * l, + e + s.x * i, + t + -s.y * l + ) + : "C" === s.type + ? c.curveTo( + e + s.x1 * i, + t + -s.y1 * l, + e + s.x2 * i, + t + -s.y2 * l, + e + s.x * i, + t + -s.y * l + ) + : "Z" === s.type && c.closePath(); + } + return c; + }), + (ae.prototype.getContours = function () { + if (void 0 === this.points) return []; + const e = []; + let t = []; + for (let n = 0; n < this.points.length; n += 1) { + const s = this.points[n]; + t.push(s), s.lastPointOfContour && (e.push(t), (t = [])); + } + return ( + f.argument( + 0 === t.length, + "There are still points left in the current contour." + ), + e + ); + }), + (ae.prototype.getMetrics = function () { + const e = this.path.commands, + t = [], + n = []; + for (let s = 0; s < e.length; s += 1) { + const o = e[s]; + "Z" !== o.type && (t.push(o.x), n.push(o.y)), + ("Q" !== o.type && "C" !== o.type) || + (t.push(o.x1), n.push(o.y1)), + "C" === o.type && (t.push(o.x2), n.push(o.y2)); + } + const s = { + xMin: Math.min.apply(null, t), + yMin: Math.min.apply(null, n), + xMax: Math.max.apply(null, t), + yMax: Math.max.apply(null, n), + leftSideBearing: this.leftSideBearing, + }; + return ( + isFinite(s.xMin) || (s.xMin = 0), + isFinite(s.xMax) || (s.xMax = this.advanceWidth), + isFinite(s.yMin) || (s.yMin = 0), + isFinite(s.yMax) || (s.yMax = 0), + (s.rightSideBearing = + this.advanceWidth - s.leftSideBearing - (s.xMax - s.xMin)), + s + ); + }), + (ae.prototype.draw = function (e, t, n, s, o) { + this.getPath(t, n, s, o).draw(e); + }), + (ae.prototype.drawPoints = function (e, t, n, s) { + function o(t, n, s, o) { + const r = 2 * Math.PI; + e.beginPath(); + for (let a = 0; a < t.length; a += 1) + e.moveTo(n + t[a].x * o, s + t[a].y * o), + e.arc(n + t[a].x * o, s + t[a].y * o, 2, 0, r, !1); + e.closePath(), e.fill(); + } + (t = void 0 !== t ? t : 0), + (n = void 0 !== n ? n : 0), + (s = void 0 !== s ? s : 24); + const r = (1 / this.path.unitsPerEm) * s, + a = [], + i = [], + l = this.path; + for (let e = 0; e < l.commands.length; e += 1) { + const t = l.commands[e]; + void 0 !== t.x && a.push({ x: t.x, y: -t.y }), + void 0 !== t.x1 && i.push({ x: t.x1, y: -t.y1 }), + void 0 !== t.x2 && i.push({ x: t.x2, y: -t.y2 }); + } + (e.fillStyle = "blue"), + o(a, t, n, r), + (e.fillStyle = "red"), + o(i, t, n, r); + }), + (ae.prototype.drawMetrics = function (e, t, n, s) { + let o; + (t = void 0 !== t ? t : 0), + (n = void 0 !== n ? n : 0), + (s = void 0 !== s ? s : 24), + (o = (1 / this.path.unitsPerEm) * s), + (e.lineWidth = 1), + (e.strokeStyle = "black"), + $(e, t, -1e4, t, 1e4), + $(e, -1e4, n, 1e4, n); + const r = this.xMin || 0; + let a = this.yMin || 0; + const i = this.xMax || 0; + let l = this.yMax || 0; + const u = this.advanceWidth || 0; + (e.strokeStyle = "blue"), + $(e, t + r * o, -1e4, t + r * o, 1e4), + $(e, t + i * o, -1e4, t + i * o, 1e4), + $(e, -1e4, n + -a * o, 1e4, n + -a * o), + $(e, -1e4, n + -l * o, 1e4, n + -l * o), + (e.strokeStyle = "green"), + $(e, t + u * o, -1e4, t + u * o, 1e4); + }); + const ie = ae; + function le(e, t, n) { + Object.defineProperty(e, t, { + get: function () { + return e.path, e[n]; + }, + set: function (t) { + e[n] = t; + }, + enumerable: !0, + configurable: !0, + }); + } + function ue(e, t) { + if (((this.font = e), (this.glyphs = {}), Array.isArray(t))) + for (let e = 0; e < t.length; e++) this.glyphs[e] = t[e]; + this.length = (t && t.length) || 0; + } + (ue.prototype.get = function (e) { + return ( + "function" == typeof this.glyphs[e] && + (this.glyphs[e] = this.glyphs[e]()), + this.glyphs[e] + ); + }), + (ue.prototype.push = function (e, t) { + (this.glyphs[e] = t), this.length++; + }); + const ce = { + GlyphSet: ue, + glyphLoader: function (e, t) { + return new ie({ index: t, font: e }); }, - { - text: Scratch.translate("white"), - value: "white", + ttfGlyphLoader: function (e, t, n, s, o, r) { + return function () { + const a = new ie({ index: t, font: e }); + return ( + (a.path = function () { + n(a, s, o); + const t = r(e.glyphs, a); + return (t.unitsPerEm = e.unitsPerEm), t; + }), + le(a, "xMin", "_xMin"), + le(a, "xMax", "_xMax"), + le(a, "yMin", "_yMin"), + le(a, "yMax", "_yMax"), + a + ); + }; }, - { - text: Scratch.translate("bright white"), - value: "brightWhite", - }, - { - text: Scratch.translate("cursor"), - value: "cursor", + cffGlyphLoader: function (e, t, n, s) { + return function () { + const o = new ie({ index: t, font: e }); + return ( + (o.path = function () { + const t = n(e, o, s); + return (t.unitsPerEm = e.unitsPerEm), t; + }), + o + ); + }; }, - { - text: Scratch.translate("accent cursor"), - value: "cursorAccent", - }, - { - text: Scratch.translate("selection background"), - value: "selectionBackground", - }, - { - text: Scratch.translate("selection foreground"), - value: "selectionForeground", + }; + function pe(e, t) { + if (e === t) return !0; + if (Array.isArray(e) && Array.isArray(t)) { + if (e.length !== t.length) return !1; + for (let n = 0; n < e.length; n += 1) + if (!pe(e[n], t[n])) return !1; + return !0; + } + return !1; + } + function fe(e) { + let t; + return ( + (t = e.length < 1240 ? 107 : e.length < 33900 ? 1131 : 32768), t + ); + } + function he(e, t, n) { + const s = [], + o = [], + r = z.getCard16(e, t); + let a, i; + if (0 !== r) { + const n = z.getByte(e, t + 2); + a = t + (r + 1) * n + 2; + let o = t + 3; + for (let t = 0; t < r + 1; t += 1) + s.push(z.getOffset(e, o, n)), (o += n); + i = a + s[r]; + } else i = t + 2; + for (let t = 0; t < s.length - 1; t += 1) { + let r = z.getBytes(e, a + s[t], a + s[t + 1]); + n && (r = n(r)), o.push(r); + } + return { objects: o, startOffset: t, endOffset: i }; + } + function de(e, t) { + let n, s, o, r; + if (28 === t) + return (n = e.parseByte()), (s = e.parseByte()), (n << 8) | s; + if (29 === t) + return ( + (n = e.parseByte()), + (s = e.parseByte()), + (o = e.parseByte()), + (r = e.parseByte()), + (n << 24) | (s << 16) | (o << 8) | r + ); + if (30 === t) + return (function (e) { + let t = ""; + const n = [ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + ".", + "E", + "E-", + null, + "-", + ]; + for (;;) { + const s = e.parseByte(), + o = s >> 4, + r = 15 & s; + if (15 === o) break; + if (((t += n[o]), 15 === r)) break; + t += n[r]; + } + return parseFloat(t); + })(e); + if (t >= 32 && t <= 246) return t - 139; + if (t >= 247 && t <= 250) + return (n = e.parseByte()), 256 * (t - 247) + n + 108; + if (t >= 251 && t <= 254) + return (n = e.parseByte()), 256 * -(t - 251) - n - 108; + throw new Error("Invalid b0 " + t); + } + function ge(e, t, n) { + t = void 0 !== t ? t : 0; + const s = new z.Parser(e, t), + o = []; + let r = []; + for (n = void 0 !== n ? n : e.length; s.relativeOffset < n; ) { + let e = s.parseByte(); + e <= 21 + ? (12 === e && (e = 1200 + s.parseByte()), + o.push([e, r]), + (r = [])) + : r.push(de(s, e)); + } + return (function (e) { + const t = {}; + for (let n = 0; n < e.length; n += 1) { + const s = e[n][0], + o = e[n][1]; + let r; + if ( + ((r = 1 === o.length ? o[0] : o), + t.hasOwnProperty(s) && !isNaN(t[s])) + ) + throw new Error("Object " + t + " already has key " + s); + t[s] = r; + } + return t; + })(o); + } + function me(e, t) { + return t <= 390 ? j[t] : e[t - 391]; + } + function ye(e, t, n) { + const s = {}; + let o; + for (let r = 0; r < t.length; r += 1) { + const a = t[r]; + if (Array.isArray(a.type)) { + const t = []; + t.length = a.type.length; + for (let s = 0; s < a.type.length; s++) + (o = void 0 !== e[a.op] ? e[a.op][s] : void 0), + void 0 === o && + (o = + void 0 !== a.value && void 0 !== a.value[s] + ? a.value[s] + : null), + "SID" === a.type[s] && (o = me(n, o)), + (t[s] = o); + s[a.name] = t; + } else + (o = e[a.op]), + void 0 === o && (o = void 0 !== a.value ? a.value : null), + "SID" === a.type && (o = me(n, o)), + (s[a.name] = o); + } + return s; + } + const ve = [ + { name: "version", op: 0, type: "SID" }, + { name: "notice", op: 1, type: "SID" }, + { name: "copyright", op: 1200, type: "SID" }, + { name: "fullName", op: 2, type: "SID" }, + { name: "familyName", op: 3, type: "SID" }, + { name: "weight", op: 4, type: "SID" }, + { name: "isFixedPitch", op: 1201, type: "number", value: 0 }, + { name: "italicAngle", op: 1202, type: "number", value: 0 }, + { + name: "underlinePosition", + op: 1203, + type: "number", + value: -100, + }, + { + name: "underlineThickness", + op: 1204, + type: "number", + value: 50, + }, + { name: "paintType", op: 1205, type: "number", value: 0 }, + { name: "charstringType", op: 1206, type: "number", value: 2 }, + { + name: "fontMatrix", + op: 1207, + type: ["real", "real", "real", "real", "real", "real"], + value: [0.001, 0, 0, 0.001, 0, 0], + }, + { name: "uniqueId", op: 13, type: "number" }, + { + name: "fontBBox", + op: 5, + type: ["number", "number", "number", "number"], + value: [0, 0, 0, 0], + }, + { name: "strokeWidth", op: 1208, type: "number", value: 0 }, + { name: "xuid", op: 14, type: [], value: null }, + { name: "charset", op: 15, type: "offset", value: 0 }, + { name: "encoding", op: 16, type: "offset", value: 0 }, + { name: "charStrings", op: 17, type: "offset", value: 0 }, + { + name: "private", + op: 18, + type: ["number", "offset"], + value: [0, 0], + }, + { name: "ros", op: 1230, type: ["SID", "SID", "number"] }, + { name: "cidFontVersion", op: 1231, type: "number", value: 0 }, + { name: "cidFontRevision", op: 1232, type: "number", value: 0 }, + { name: "cidFontType", op: 1233, type: "number", value: 0 }, + { name: "cidCount", op: 1234, type: "number", value: 8720 }, + { name: "uidBase", op: 1235, type: "number" }, + { name: "fdArray", op: 1236, type: "offset" }, + { name: "fdSelect", op: 1237, type: "offset" }, + { name: "fontName", op: 1238, type: "SID" }, + ], + be = [ + { name: "subrs", op: 19, type: "offset", value: 0 }, + { name: "defaultWidthX", op: 20, type: "number", value: 0 }, + { name: "nominalWidthX", op: 21, type: "number", value: 0 }, + ]; + function xe(e, t) { + return ye(ge(e, 0, e.byteLength), ve, t); + } + function Se(e, t, n, s) { + return ye(ge(e, t, n), be, s); + } + function Ue(e, t, n, s) { + const o = []; + for (let r = 0; r < n.length; r += 1) { + const a = xe(new DataView(new Uint8Array(n[r]).buffer), s); + (a._subrs = []), (a._subrsBias = 0); + const i = a.private[0], + l = a.private[1]; + if (0 !== i && 0 !== l) { + const n = Se(e, l + t, i, s); + if ( + ((a._defaultWidthX = n.defaultWidthX), + (a._nominalWidthX = n.nominalWidthX), + 0 !== n.subrs) + ) { + const s = he(e, l + n.subrs + t); + (a._subrs = s.objects), (a._subrsBias = fe(a._subrs)); + } + a._privateDict = n; + } + o.push(a); + } + return o; + } + function ke(e, t, n) { + let s, o, r, a; + const i = new u(), + l = []; + let c, + p, + f, + h, + d = 0, + g = !1, + m = !1, + y = 0, + v = 0; + if (e.isCIDFont) { + const n = e.tables.cff.topDict._fdSelect[t.index], + s = e.tables.cff.topDict._fdArray[n]; + (c = s._subrs), + (p = s._subrsBias), + (f = s._defaultWidthX), + (h = s._nominalWidthX); + } else + (c = e.tables.cff.topDict._subrs), + (p = e.tables.cff.topDict._subrsBias), + (f = e.tables.cff.topDict._defaultWidthX), + (h = e.tables.cff.topDict._nominalWidthX); + let b = f; + function x(e, t) { + m && i.closePath(), i.moveTo(e, t), (m = !0); + } + function S() { + let e; + (e = l.length % 2 != 0), + e && !g && (b = l.shift() + h), + (d += l.length >> 1), + (l.length = 0), + (g = !0); + } + return ( + (function n(u) { + let f, + U, + k, + T, + E, + w, + O, + I, + R, + L, + B, + C, + D = 0; + for (; D < u.length; ) { + let M = u[D]; + switch (((D += 1), M)) { + case 1: + case 3: + case 18: + case 23: + S(); + break; + case 4: + l.length > 1 && !g && ((b = l.shift() + h), (g = !0)), + (v += l.pop()), + x(y, v); + break; + case 5: + for (; l.length > 0; ) + (y += l.shift()), (v += l.shift()), i.lineTo(y, v); + break; + case 6: + for ( + ; + l.length > 0 && + ((y += l.shift()), i.lineTo(y, v), 0 !== l.length); + + ) + (v += l.shift()), i.lineTo(y, v); + break; + case 7: + for ( + ; + l.length > 0 && + ((v += l.shift()), i.lineTo(y, v), 0 !== l.length); + + ) + (y += l.shift()), i.lineTo(y, v); + break; + case 8: + for (; l.length > 0; ) + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a + l.shift()), + i.curveTo(s, o, r, a, y, v); + break; + case 10: + (E = l.pop() + p), (w = c[E]), w && n(w); + break; + case 11: + return; + case 12: + switch (((M = u[D]), (D += 1), M)) { + case 35: + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (O = r + l.shift()), + (I = a + l.shift()), + (R = O + l.shift()), + (L = I + l.shift()), + (B = R + l.shift()), + (C = L + l.shift()), + (y = B + l.shift()), + (v = C + l.shift()), + l.shift(), + i.curveTo(s, o, r, a, O, I), + i.curveTo(R, L, B, C, y, v); + break; + case 34: + (s = y + l.shift()), + (o = v), + (r = s + l.shift()), + (a = o + l.shift()), + (O = r + l.shift()), + (I = a), + (R = O + l.shift()), + (L = a), + (B = R + l.shift()), + (C = v), + (y = B + l.shift()), + i.curveTo(s, o, r, a, O, I), + i.curveTo(R, L, B, C, y, v); + break; + case 36: + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (O = r + l.shift()), + (I = a), + (R = O + l.shift()), + (L = a), + (B = R + l.shift()), + (C = L + l.shift()), + (y = B + l.shift()), + i.curveTo(s, o, r, a, O, I), + i.curveTo(R, L, B, C, y, v); + break; + case 37: + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (O = r + l.shift()), + (I = a + l.shift()), + (R = O + l.shift()), + (L = I + l.shift()), + (B = R + l.shift()), + (C = L + l.shift()), + Math.abs(B - y) > Math.abs(C - v) + ? (y = B + l.shift()) + : (v = C + l.shift()), + i.curveTo(s, o, r, a, O, I), + i.curveTo(R, L, B, C, y, v); + break; + default: + console.log( + "Glyph " + t.index + ": unknown operator 1200" + M + ), + (l.length = 0); + } + break; + case 14: + l.length > 0 && !g && ((b = l.shift() + h), (g = !0)), + m && (i.closePath(), (m = !1)); + break; + case 19: + case 20: + S(), (D += (d + 7) >> 3); + break; + case 21: + l.length > 2 && !g && ((b = l.shift() + h), (g = !0)), + (v += l.pop()), + (y += l.pop()), + x(y, v); + break; + case 22: + l.length > 1 && !g && ((b = l.shift() + h), (g = !0)), + (y += l.pop()), + x(y, v); + break; + case 24: + for (; l.length > 2; ) + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a + l.shift()), + i.curveTo(s, o, r, a, y, v); + (y += l.shift()), (v += l.shift()), i.lineTo(y, v); + break; + case 25: + for (; l.length > 6; ) + (y += l.shift()), (v += l.shift()), i.lineTo(y, v); + (s = y + l.shift()), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a + l.shift()), + i.curveTo(s, o, r, a, y, v); + break; + case 26: + for (l.length % 2 && (y += l.shift()); l.length > 0; ) + (s = y), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r), + (v = a + l.shift()), + i.curveTo(s, o, r, a, y, v); + break; + case 27: + for (l.length % 2 && (v += l.shift()); l.length > 0; ) + (s = y + l.shift()), + (o = v), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a), + i.curveTo(s, o, r, a, y, v); + break; + case 28: + (f = u[D]), + (U = u[D + 1]), + l.push(((f << 24) | (U << 16)) >> 16), + (D += 2); + break; + case 29: + (E = l.pop() + e.gsubrsBias), + (w = e.gsubrs[E]), + w && n(w); + break; + case 30: + for ( + ; + l.length > 0 && + ((s = y), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a + (1 === l.length ? l.shift() : 0)), + i.curveTo(s, o, r, a, y, v), + 0 !== l.length); + + ) + (s = y + l.shift()), + (o = v), + (r = s + l.shift()), + (a = o + l.shift()), + (v = a + l.shift()), + (y = r + (1 === l.length ? l.shift() : 0)), + i.curveTo(s, o, r, a, y, v); + break; + case 31: + for ( + ; + l.length > 0 && + ((s = y + l.shift()), + (o = v), + (r = s + l.shift()), + (a = o + l.shift()), + (v = a + l.shift()), + (y = r + (1 === l.length ? l.shift() : 0)), + i.curveTo(s, o, r, a, y, v), + 0 !== l.length); + + ) + (s = y), + (o = v + l.shift()), + (r = s + l.shift()), + (a = o + l.shift()), + (y = r + l.shift()), + (v = a + (1 === l.length ? l.shift() : 0)), + i.curveTo(s, o, r, a, y, v); + break; + default: + M < 32 + ? console.log( + "Glyph " + t.index + ": unknown operator " + M + ) + : M < 247 + ? l.push(M - 139) + : M < 251 + ? ((f = u[D]), + (D += 1), + l.push(256 * (M - 247) + f + 108)) + : M < 255 + ? ((f = u[D]), + (D += 1), + l.push(256 * -(M - 251) - f - 108)) + : ((f = u[D]), + (U = u[D + 1]), + (k = u[D + 2]), + (T = u[D + 3]), + (D += 4), + l.push( + ((f << 24) | (U << 16) | (k << 8) | T) / + 65536 + )); + } + } + })(n), + (t.advanceWidth = b), + i + ); + } + function Te(e, t) { + let n, + s = j.indexOf(e); + return ( + s >= 0 && (n = s), + (s = t.indexOf(e)), + s >= 0 + ? (n = s + j.length) + : ((n = j.length + t.length), t.push(e)), + n + ); + } + function Ee(e, t, n) { + const s = {}; + for (let o = 0; o < e.length; o += 1) { + const r = e[o]; + let a = t[r.name]; + void 0 === a || + pe(a, r.value) || + ("SID" === r.type && (a = Te(a, n)), + (s[r.op] = { name: r.name, type: r.type, value: a })); + } + return s; + } + function we(e, t) { + const n = new M.Record("Top DICT", [ + { name: "dict", type: "DICT", value: {} }, + ]); + return (n.dict = Ee(ve, e, t)), n; + } + function Oe(e) { + const t = new M.Record("Top DICT INDEX", [ + { name: "topDicts", type: "INDEX", value: [] }, + ]); + return ( + (t.topDicts = [{ name: "topDict_0", type: "TABLE", value: e }]), + t + ); + } + function Ie(e) { + const t = [], + n = e.path; + t.push({ name: "width", type: "NUMBER", value: e.advanceWidth }); + let s = 0, + o = 0; + for (let e = 0; e < n.commands.length; e += 1) { + let r, + a, + i = n.commands[e]; + if ("Q" === i.type) { + const e = 1 / 3, + t = 2 / 3; + i = { + type: "C", + x: i.x, + y: i.y, + x1: e * s + t * i.x1, + y1: e * o + t * i.y1, + x2: e * i.x + t * i.x1, + y2: e * i.y + t * i.y1, + }; + } + if ("M" === i.type) + (r = Math.round(i.x - s)), + (a = Math.round(i.y - o)), + t.push({ name: "dx", type: "NUMBER", value: r }), + t.push({ name: "dy", type: "NUMBER", value: a }), + t.push({ name: "rmoveto", type: "OP", value: 21 }), + (s = Math.round(i.x)), + (o = Math.round(i.y)); + else if ("L" === i.type) + (r = Math.round(i.x - s)), + (a = Math.round(i.y - o)), + t.push({ name: "dx", type: "NUMBER", value: r }), + t.push({ name: "dy", type: "NUMBER", value: a }), + t.push({ name: "rlineto", type: "OP", value: 5 }), + (s = Math.round(i.x)), + (o = Math.round(i.y)); + else if ("C" === i.type) { + const e = Math.round(i.x1 - s), + n = Math.round(i.y1 - o), + l = Math.round(i.x2 - i.x1), + u = Math.round(i.y2 - i.y1); + (r = Math.round(i.x - i.x2)), + (a = Math.round(i.y - i.y2)), + t.push({ name: "dx1", type: "NUMBER", value: e }), + t.push({ name: "dy1", type: "NUMBER", value: n }), + t.push({ name: "dx2", type: "NUMBER", value: l }), + t.push({ name: "dy2", type: "NUMBER", value: u }), + t.push({ name: "dx", type: "NUMBER", value: r }), + t.push({ name: "dy", type: "NUMBER", value: a }), + t.push({ name: "rrcurveto", type: "OP", value: 8 }), + (s = Math.round(i.x)), + (o = Math.round(i.y)); + } + } + return t.push({ name: "endchar", type: "OP", value: 14 }), t; + } + const Re = { + parse: function (e, t, n) { + n.tables.cff = {}; + const s = (function (e, t) { + const n = {}; + return ( + (n.formatMajor = z.getCard8(e, t)), + (n.formatMinor = z.getCard8(e, t + 1)), + (n.size = z.getCard8(e, t + 2)), + (n.offsetSize = z.getCard8(e, t + 3)), + (n.startOffset = t), + (n.endOffset = t + 4), + n + ); + })(e, t), + o = he(e, s.endOffset, z.bytesToString), + r = he(e, o.endOffset), + a = he(e, r.endOffset, z.bytesToString), + i = he(e, a.endOffset); + (n.gsubrs = i.objects), (n.gsubrsBias = fe(n.gsubrs)); + const l = Ue(e, t, r.objects, a.objects); + if (1 !== l.length) + throw new Error( + "CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = " + + l.length + ); + const u = l[0]; + if ( + ((n.tables.cff.topDict = u), + u._privateDict && + ((n.defaultWidthX = u._privateDict.defaultWidthX), + (n.nominalWidthX = u._privateDict.nominalWidthX)), + void 0 !== u.ros[0] && + void 0 !== u.ros[1] && + (n.isCIDFont = !0), + n.isCIDFont) + ) { + let s = u.fdArray, + o = u.fdSelect; + if (0 === s || 0 === o) + throw new Error( + "Font is marked as a CID font, but FDArray and/or FDSelect information is missing" + ); + s += t; + const r = Ue(e, t, he(e, s).objects, a.objects); + (u._fdArray = r), + (o += t), + (u._fdSelect = (function (e, t, n, s) { + const o = []; + let r; + const a = new z.Parser(e, t), + i = a.parseCard8(); + if (0 === i) + for (let e = 0; e < n; e++) { + if (((r = a.parseCard8()), r >= s)) + throw new Error( + "CFF table CID Font FDSelect has bad FD index value " + + r + + " (FD count " + + s + + ")" + ); + o.push(r); + } + else { + if (3 !== i) + throw new Error( + "CFF Table CID Font FDSelect table has unsupported format " + + i + ); + { + const e = a.parseCard16(); + let t, + i = a.parseCard16(); + if (0 !== i) + throw new Error( + "CFF Table CID Font FDSelect format 3 range has bad initial GID " + + i + ); + for (let l = 0; l < e; l++) { + if ( + ((r = a.parseCard8()), + (t = a.parseCard16()), + r >= s) + ) + throw new Error( + "CFF table CID Font FDSelect has bad FD index value " + + r + + " (FD count " + + s + + ")" + ); + if (t > n) + throw new Error( + "CFF Table CID Font FDSelect format 3 range has bad GID " + + t + ); + for (; i < t; i++) o.push(r); + i = t; + } + if (t !== n) + throw new Error( + "CFF Table CID Font FDSelect format 3 range has bad final GID " + + t + ); + } + } + return o; + })(e, o, n.numGlyphs, r.length)); + } + const c = t + u.private[1], + p = Se(e, c, u.private[0], a.objects); + if ( + ((n.defaultWidthX = p.defaultWidthX), + (n.nominalWidthX = p.nominalWidthX), + 0 !== p.subrs) + ) { + const t = he(e, c + p.subrs); + (n.subrs = t.objects), (n.subrsBias = fe(n.subrs)); + } else (n.subrs = []), (n.subrsBias = 0); + const f = he(e, t + u.charStrings); + n.nGlyphs = f.objects.length; + const h = (function (e, t, n, s) { + let o, r; + const a = new z.Parser(e, t); + n -= 1; + const i = [".notdef"], + l = a.parseCard8(); + if (0 === l) + for (let e = 0; e < n; e += 1) + (o = a.parseSID()), i.push(me(s, o)); + else if (1 === l) + for (; i.length <= n; ) { + (o = a.parseSID()), (r = a.parseCard8()); + for (let e = 0; e <= r; e += 1) + i.push(me(s, o)), (o += 1); + } + else { + if (2 !== l) + throw new Error("Unknown charset format " + l); + for (; i.length <= n; ) { + (o = a.parseSID()), (r = a.parseCard16()); + for (let e = 0; e <= r; e += 1) + i.push(me(s, o)), (o += 1); + } + } + return i; + })(e, t + u.charset, n.nGlyphs, a.objects); + 0 === u.encoding + ? (n.cffEncoding = new J(X, h)) + : 1 === u.encoding + ? (n.cffEncoding = new J(V, h)) + : (n.cffEncoding = (function (e, t, n) { + let s; + const o = {}, + r = new z.Parser(e, t), + a = r.parseCard8(); + if (0 === a) { + const e = r.parseCard8(); + for (let t = 0; t < e; t += 1) + (s = r.parseCard8()), (o[s] = t); + } else { + if (1 !== a) + throw new Error("Unknown encoding format " + a); + { + const e = r.parseCard8(); + s = 1; + for (let t = 0; t < e; t += 1) { + const e = r.parseCard8(), + t = r.parseCard8(); + for (let n = e; n <= e + t; n += 1) + (o[n] = s), (s += 1); + } + } + } + return new J(o, n); + })(e, t + u.encoding, h)), + (n.encoding = n.encoding || n.cffEncoding), + (n.glyphs = new ce.GlyphSet(n)); + for (let e = 0; e < n.nGlyphs; e += 1) { + const t = f.objects[e]; + n.glyphs.push(e, ce.cffGlyphLoader(n, e, ke, t)); + } + }, + make: function (e, t) { + const n = new M.Table("CFF ", [ + { name: "header", type: "RECORD" }, + { name: "nameIndex", type: "RECORD" }, + { name: "topDictIndex", type: "RECORD" }, + { name: "stringIndex", type: "RECORD" }, + { name: "globalSubrIndex", type: "RECORD" }, + { name: "charsets", type: "RECORD" }, + { name: "charStringsIndex", type: "RECORD" }, + { name: "privateDict", type: "RECORD" }, + ]), + s = 1 / t.unitsPerEm, + o = { + version: t.version, + fullName: t.fullName, + familyName: t.familyName, + weight: t.weightName, + fontBBox: t.fontBBox || [0, 0, 0, 0], + fontMatrix: [s, 0, 0, s, 0, 0], + charset: 999, + encoding: 0, + charStrings: 999, + private: [0, 999], + }, + r = []; + let a; + for (let t = 1; t < e.length; t += 1) + (a = e.get(t)), r.push(a.name); + const i = []; + (n.header = new M.Record("Header", [ + { name: "major", type: "Card8", value: 1 }, + { name: "minor", type: "Card8", value: 0 }, + { name: "hdrSize", type: "Card8", value: 4 }, + { name: "major", type: "Card8", value: 1 }, + ])), + (n.nameIndex = (function (e) { + const t = new M.Record("Name INDEX", [ + { name: "names", type: "INDEX", value: [] }, + ]); + t.names = []; + for (let n = 0; n < e.length; n += 1) + t.names.push({ + name: "name_" + n, + type: "NAME", + value: e[n], + }); + return t; + })([t.postScriptName])); + let l = we(o, i); + (n.topDictIndex = Oe(l)), + (n.globalSubrIndex = new M.Record("Global Subr INDEX", [ + { name: "subrs", type: "INDEX", value: [] }, + ])), + (n.charsets = (function (e, t) { + const n = new M.Record("Charsets", [ + { name: "format", type: "Card8", value: 0 }, + ]); + for (let s = 0; s < e.length; s += 1) { + const o = Te(e[s], t); + n.fields.push({ + name: "glyph_" + s, + type: "SID", + value: o, + }); + } + return n; + })(r, i)), + (n.charStringsIndex = (function (e) { + const t = new M.Record("CharStrings INDEX", [ + { name: "charStrings", type: "INDEX", value: [] }, + ]); + for (let n = 0; n < e.length; n += 1) { + const s = e.get(n), + o = Ie(s); + t.charStrings.push({ + name: s.name, + type: "CHARSTRING", + value: o, + }); + } + return t; + })(e)), + (n.privateDict = (function (e, t) { + const n = new M.Record("Private DICT", [ + { name: "dict", type: "DICT", value: {} }, + ]); + return (n.dict = Ee(be, {}, t)), n; + })(0, i)), + (n.stringIndex = (function (e) { + const t = new M.Record("String INDEX", [ + { name: "strings", type: "INDEX", value: [] }, + ]); + t.strings = []; + for (let n = 0; n < e.length; n += 1) + t.strings.push({ + name: "string_" + n, + type: "STRING", + value: e[n], + }); + return t; + })(i)); + const u = + n.header.sizeOf() + + n.nameIndex.sizeOf() + + n.topDictIndex.sizeOf() + + n.stringIndex.sizeOf() + + n.globalSubrIndex.sizeOf(); + return ( + (o.charset = u), + (o.encoding = 0), + (o.charStrings = o.charset + n.charsets.sizeOf()), + (o.private[1] = + o.charStrings + n.charStringsIndex.sizeOf()), + (l = we(o, i)), + (n.topDictIndex = Oe(l)), + n + ); + }, }, - { - text: Scratch.translate("selection background when inactive"), - value: "selectionInactiveBackground", + Le = { + parse: function (e, t) { + const n = {}, + s = new z.Parser(e, t); + return ( + (n.version = s.parseVersion()), + (n.fontRevision = Math.round(1e3 * s.parseFixed()) / 1e3), + (n.checkSumAdjustment = s.parseULong()), + (n.magicNumber = s.parseULong()), + f.argument( + 1594834165 === n.magicNumber, + "Font header has wrong magic number." + ), + (n.flags = s.parseUShort()), + (n.unitsPerEm = s.parseUShort()), + (n.created = s.parseLongDateTime()), + (n.modified = s.parseLongDateTime()), + (n.xMin = s.parseShort()), + (n.yMin = s.parseShort()), + (n.xMax = s.parseShort()), + (n.yMax = s.parseShort()), + (n.macStyle = s.parseUShort()), + (n.lowestRecPPEM = s.parseUShort()), + (n.fontDirectionHint = s.parseShort()), + (n.indexToLocFormat = s.parseShort()), + (n.glyphDataFormat = s.parseShort()), + n + ); + }, + make: function (e) { + const t = Math.round(new Date().getTime() / 1e3) + 2082844800; + let n = t; + return ( + e.createdTimestamp && (n = e.createdTimestamp + 2082844800), + new M.Table( + "head", + [ + { name: "version", type: "FIXED", value: 65536 }, + { name: "fontRevision", type: "FIXED", value: 65536 }, + { name: "checkSumAdjustment", type: "ULONG", value: 0 }, + { + name: "magicNumber", + type: "ULONG", + value: 1594834165, + }, + { name: "flags", type: "USHORT", value: 0 }, + { name: "unitsPerEm", type: "USHORT", value: 1e3 }, + { name: "created", type: "LONGDATETIME", value: n }, + { name: "modified", type: "LONGDATETIME", value: t }, + { name: "xMin", type: "SHORT", value: 0 }, + { name: "yMin", type: "SHORT", value: 0 }, + { name: "xMax", type: "SHORT", value: 0 }, + { name: "yMax", type: "SHORT", value: 0 }, + { name: "macStyle", type: "USHORT", value: 0 }, + { name: "lowestRecPPEM", type: "USHORT", value: 0 }, + { name: "fontDirectionHint", type: "SHORT", value: 2 }, + { name: "indexToLocFormat", type: "SHORT", value: 0 }, + { name: "glyphDataFormat", type: "SHORT", value: 0 }, + ], + e + ) + ); + }, }, - ], - }, - OPTION: { - items: [ - { - text: Scratch.translate("font size"), - value: "fontsize", + Be = { + parse: function (e, t) { + const n = {}, + s = new z.Parser(e, t); + return ( + (n.version = s.parseVersion()), + (n.ascender = s.parseShort()), + (n.descender = s.parseShort()), + (n.lineGap = s.parseShort()), + (n.advanceWidthMax = s.parseUShort()), + (n.minLeftSideBearing = s.parseShort()), + (n.minRightSideBearing = s.parseShort()), + (n.xMaxExtent = s.parseShort()), + (n.caretSlopeRise = s.parseShort()), + (n.caretSlopeRun = s.parseShort()), + (n.caretOffset = s.parseShort()), + (s.relativeOffset += 8), + (n.metricDataFormat = s.parseShort()), + (n.numberOfHMetrics = s.parseUShort()), + n + ); + }, + make: function (e) { + return new M.Table( + "hhea", + [ + { name: "version", type: "FIXED", value: 65536 }, + { name: "ascender", type: "FWORD", value: 0 }, + { name: "descender", type: "FWORD", value: 0 }, + { name: "lineGap", type: "FWORD", value: 0 }, + { name: "advanceWidthMax", type: "UFWORD", value: 0 }, + { name: "minLeftSideBearing", type: "FWORD", value: 0 }, + { name: "minRightSideBearing", type: "FWORD", value: 0 }, + { name: "xMaxExtent", type: "FWORD", value: 0 }, + { name: "caretSlopeRise", type: "SHORT", value: 1 }, + { name: "caretSlopeRun", type: "SHORT", value: 0 }, + { name: "caretOffset", type: "SHORT", value: 0 }, + { name: "reserved1", type: "SHORT", value: 0 }, + { name: "reserved2", type: "SHORT", value: 0 }, + { name: "reserved3", type: "SHORT", value: 0 }, + { name: "reserved4", type: "SHORT", value: 0 }, + { name: "metricDataFormat", type: "SHORT", value: 0 }, + { name: "numberOfHMetrics", type: "USHORT", value: 0 }, + ], + e + ); + }, }, - { - text: Scratch.translate("line height"), - value: "lineheight", + Ce = { + parse: function (e, t, n, s, o) { + let r, a; + const i = new z.Parser(e, t); + for (let e = 0; e < s; e += 1) { + e < n && ((r = i.parseUShort()), (a = i.parseShort())); + const t = o.get(e); + (t.advanceWidth = r), (t.leftSideBearing = a); + } + }, + make: function (e) { + const t = new M.Table("hmtx", []); + for (let n = 0; n < e.length; n += 1) { + const s = e.get(n), + o = s.advanceWidth || 0, + r = s.leftSideBearing || 0; + t.fields.push({ + name: "advanceWidth_" + n, + type: "USHORT", + value: o, + }), + t.fields.push({ + name: "leftSideBearing_" + n, + type: "SHORT", + value: r, + }); + } + return t; + }, }, - { - text: Scratch.translate("font family"), - value: "fontfamily", + De = { + make: function (e) { + const t = new M.Table("ltag", [ + { name: "version", type: "ULONG", value: 1 }, + { name: "flags", type: "ULONG", value: 0 }, + { name: "numTags", type: "ULONG", value: e.length }, + ]); + let n = ""; + const s = 12 + 4 * e.length; + for (let o = 0; o < e.length; ++o) { + let r = n.indexOf(e[o]); + r < 0 && ((r = n.length), (n += e[o])), + t.fields.push({ + name: "offset " + o, + type: "USHORT", + value: s + r, + }), + t.fields.push({ + name: "length " + o, + type: "USHORT", + value: e[o].length, + }); + } + return ( + t.fields.push({ + name: "stringPool", + type: "CHARARRAY", + value: n, + }), + t + ); + }, + parse: function (e, t) { + const n = new z.Parser(e, t), + s = n.parseULong(); + f.argument(1 === s, "Unsupported ltag table version."), + n.skip("uLong", 1); + const o = n.parseULong(), + r = []; + for (let s = 0; s < o; s++) { + let s = ""; + const o = t + n.parseUShort(), + a = n.parseUShort(); + for (let t = o; t < o + a; ++t) + s += String.fromCharCode(e.getInt8(t)); + r.push(s); + } + return r; + }, }, - { - text: Scratch.translate("scrollback size"), - value: "scrollback", + Me = { + parse: function (e, t) { + const n = {}, + s = new z.Parser(e, t); + return ( + (n.version = s.parseVersion()), + (n.numGlyphs = s.parseUShort()), + 1 === n.version && + ((n.maxPoints = s.parseUShort()), + (n.maxContours = s.parseUShort()), + (n.maxCompositePoints = s.parseUShort()), + (n.maxCompositeContours = s.parseUShort()), + (n.maxZones = s.parseUShort()), + (n.maxTwilightPoints = s.parseUShort()), + (n.maxStorage = s.parseUShort()), + (n.maxFunctionDefs = s.parseUShort()), + (n.maxInstructionDefs = s.parseUShort()), + (n.maxStackElements = s.parseUShort()), + (n.maxSizeOfInstructions = s.parseUShort()), + (n.maxComponentElements = s.parseUShort()), + (n.maxComponentDepth = s.parseUShort())), + n + ); + }, + make: function (e) { + return new M.Table("maxp", [ + { name: "version", type: "FIXED", value: 20480 }, + { name: "numGlyphs", type: "USHORT", value: e }, + ]); + }, }, - ], - }, - COLORTYPE: { - items: [ - { - text: Scratch.translate("background"), - value: "background", + Ae = [ + "copyright", + "fontFamily", + "fontSubfamily", + "uniqueID", + "fullName", + "version", + "postScriptName", + "trademark", + "manufacturer", + "designer", + "description", + "manufacturerURL", + "designerURL", + "license", + "licenseURL", + "reserved", + "preferredFamily", + "preferredSubfamily", + "compatibleFullName", + "sampleText", + "postScriptFindFontName", + "wwsFamily", + "wwsSubfamily", + ], + Pe = { + 0: "en", + 1: "fr", + 2: "de", + 3: "it", + 4: "nl", + 5: "sv", + 6: "es", + 7: "da", + 8: "pt", + 9: "no", + 10: "he", + 11: "ja", + 12: "ar", + 13: "fi", + 14: "el", + 15: "is", + 16: "mt", + 17: "tr", + 18: "hr", + 19: "zh-Hant", + 20: "ur", + 21: "hi", + 22: "th", + 23: "ko", + 24: "lt", + 25: "pl", + 26: "hu", + 27: "es", + 28: "lv", + 29: "se", + 30: "fo", + 31: "fa", + 32: "ru", + 33: "zh", + 34: "nl-BE", + 35: "ga", + 36: "sq", + 37: "ro", + 38: "cz", + 39: "sk", + 40: "si", + 41: "yi", + 42: "sr", + 43: "mk", + 44: "bg", + 45: "uk", + 46: "be", + 47: "uz", + 48: "kk", + 49: "az-Cyrl", + 50: "az-Arab", + 51: "hy", + 52: "ka", + 53: "mo", + 54: "ky", + 55: "tg", + 56: "tk", + 57: "mn-CN", + 58: "mn", + 59: "ps", + 60: "ks", + 61: "ku", + 62: "sd", + 63: "bo", + 64: "ne", + 65: "sa", + 66: "mr", + 67: "bn", + 68: "as", + 69: "gu", + 70: "pa", + 71: "or", + 72: "ml", + 73: "kn", + 74: "ta", + 75: "te", + 76: "si", + 77: "my", + 78: "km", + 79: "lo", + 80: "vi", + 81: "id", + 82: "tl", + 83: "ms", + 84: "ms-Arab", + 85: "am", + 86: "ti", + 87: "om", + 88: "so", + 89: "sw", + 90: "rw", + 91: "rn", + 92: "ny", + 93: "mg", + 94: "eo", + 128: "cy", + 129: "eu", + 130: "ca", + 131: "la", + 132: "qu", + 133: "gn", + 134: "ay", + 135: "tt", + 136: "ug", + 137: "dz", + 138: "jv", + 139: "su", + 140: "gl", + 141: "af", + 142: "br", + 143: "iu", + 144: "gd", + 145: "gv", + 146: "ga", + 147: "to", + 148: "el-polyton", + 149: "kl", + 150: "az", + 151: "nn", }, - { - text: Scratch.translate("foreground"), - value: "foreground", + Ge = { + 0: 0, + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + 6: 0, + 7: 0, + 8: 0, + 9: 0, + 10: 5, + 11: 1, + 12: 4, + 13: 0, + 14: 6, + 15: 0, + 16: 0, + 17: 0, + 18: 0, + 19: 2, + 20: 4, + 21: 9, + 22: 21, + 23: 3, + 24: 29, + 25: 29, + 26: 29, + 27: 29, + 28: 29, + 29: 0, + 30: 0, + 31: 4, + 32: 7, + 33: 25, + 34: 0, + 35: 0, + 36: 0, + 37: 0, + 38: 29, + 39: 29, + 40: 0, + 41: 5, + 42: 7, + 43: 7, + 44: 7, + 45: 7, + 46: 7, + 47: 7, + 48: 7, + 49: 7, + 50: 4, + 51: 24, + 52: 23, + 53: 7, + 54: 7, + 55: 7, + 56: 7, + 57: 27, + 58: 7, + 59: 4, + 60: 4, + 61: 4, + 62: 4, + 63: 26, + 64: 9, + 65: 9, + 66: 9, + 67: 13, + 68: 13, + 69: 11, + 70: 10, + 71: 12, + 72: 17, + 73: 16, + 74: 14, + 75: 15, + 76: 18, + 77: 19, + 78: 20, + 79: 22, + 80: 30, + 81: 0, + 82: 0, + 83: 0, + 84: 4, + 85: 28, + 86: 28, + 87: 28, + 88: 0, + 89: 0, + 90: 0, + 91: 0, + 92: 0, + 93: 0, + 94: 0, + 128: 0, + 129: 0, + 130: 0, + 131: 0, + 132: 0, + 133: 0, + 134: 0, + 135: 7, + 136: 4, + 137: 26, + 138: 0, + 139: 0, + 140: 0, + 141: 0, + 142: 0, + 143: 28, + 144: 0, + 145: 0, + 146: 0, + 147: 0, + 148: 6, + 149: 0, + 150: 0, + 151: 0, }, - ], - }, - STATUS: { - items: [ - { - text: Scratch.translate("enable"), - value: "enable", + Ne = { + 1078: "af", + 1052: "sq", + 1156: "gsw", + 1118: "am", + 5121: "ar-DZ", + 15361: "ar-BH", + 3073: "ar", + 2049: "ar-IQ", + 11265: "ar-JO", + 13313: "ar-KW", + 12289: "ar-LB", + 4097: "ar-LY", + 6145: "ary", + 8193: "ar-OM", + 16385: "ar-QA", + 1025: "ar-SA", + 10241: "ar-SY", + 7169: "aeb", + 14337: "ar-AE", + 9217: "ar-YE", + 1067: "hy", + 1101: "as", + 2092: "az-Cyrl", + 1068: "az", + 1133: "ba", + 1069: "eu", + 1059: "be", + 2117: "bn", + 1093: "bn-IN", + 8218: "bs-Cyrl", + 5146: "bs", + 1150: "br", + 1026: "bg", + 1027: "ca", + 3076: "zh-HK", + 5124: "zh-MO", + 2052: "zh", + 4100: "zh-SG", + 1028: "zh-TW", + 1155: "co", + 1050: "hr", + 4122: "hr-BA", + 1029: "cs", + 1030: "da", + 1164: "prs", + 1125: "dv", + 2067: "nl-BE", + 1043: "nl", + 3081: "en-AU", + 10249: "en-BZ", + 4105: "en-CA", + 9225: "en-029", + 16393: "en-IN", + 6153: "en-IE", + 8201: "en-JM", + 17417: "en-MY", + 5129: "en-NZ", + 13321: "en-PH", + 18441: "en-SG", + 7177: "en-ZA", + 11273: "en-TT", + 2057: "en-GB", + 1033: "en", + 12297: "en-ZW", + 1061: "et", + 1080: "fo", + 1124: "fil", + 1035: "fi", + 2060: "fr-BE", + 3084: "fr-CA", + 1036: "fr", + 5132: "fr-LU", + 6156: "fr-MC", + 4108: "fr-CH", + 1122: "fy", + 1110: "gl", + 1079: "ka", + 3079: "de-AT", + 1031: "de", + 5127: "de-LI", + 4103: "de-LU", + 2055: "de-CH", + 1032: "el", + 1135: "kl", + 1095: "gu", + 1128: "ha", + 1037: "he", + 1081: "hi", + 1038: "hu", + 1039: "is", + 1136: "ig", + 1057: "id", + 1117: "iu", + 2141: "iu-Latn", + 2108: "ga", + 1076: "xh", + 1077: "zu", + 1040: "it", + 2064: "it-CH", + 1041: "ja", + 1099: "kn", + 1087: "kk", + 1107: "km", + 1158: "quc", + 1159: "rw", + 1089: "sw", + 1111: "kok", + 1042: "ko", + 1088: "ky", + 1108: "lo", + 1062: "lv", + 1063: "lt", + 2094: "dsb", + 1134: "lb", + 1071: "mk", + 2110: "ms-BN", + 1086: "ms", + 1100: "ml", + 1082: "mt", + 1153: "mi", + 1146: "arn", + 1102: "mr", + 1148: "moh", + 1104: "mn", + 2128: "mn-CN", + 1121: "ne", + 1044: "nb", + 2068: "nn", + 1154: "oc", + 1096: "or", + 1123: "ps", + 1045: "pl", + 1046: "pt", + 2070: "pt-PT", + 1094: "pa", + 1131: "qu-BO", + 2155: "qu-EC", + 3179: "qu", + 1048: "ro", + 1047: "rm", + 1049: "ru", + 9275: "smn", + 4155: "smj-NO", + 5179: "smj", + 3131: "se-FI", + 1083: "se", + 2107: "se-SE", + 8251: "sms", + 6203: "sma-NO", + 7227: "sms", + 1103: "sa", + 7194: "sr-Cyrl-BA", + 3098: "sr", + 6170: "sr-Latn-BA", + 2074: "sr-Latn", + 1132: "nso", + 1074: "tn", + 1115: "si", + 1051: "sk", + 1060: "sl", + 11274: "es-AR", + 16394: "es-BO", + 13322: "es-CL", + 9226: "es-CO", + 5130: "es-CR", + 7178: "es-DO", + 12298: "es-EC", + 17418: "es-SV", + 4106: "es-GT", + 18442: "es-HN", + 2058: "es-MX", + 19466: "es-NI", + 6154: "es-PA", + 15370: "es-PY", + 10250: "es-PE", + 20490: "es-PR", + 3082: "es", + 1034: "es", + 21514: "es-US", + 14346: "es-UY", + 8202: "es-VE", + 2077: "sv-FI", + 1053: "sv", + 1114: "syr", + 1064: "tg", + 2143: "tzm", + 1097: "ta", + 1092: "tt", + 1098: "te", + 1054: "th", + 1105: "bo", + 1055: "tr", + 1090: "tk", + 1152: "ug", + 1058: "uk", + 1070: "hsb", + 1056: "ur", + 2115: "uz-Cyrl", + 1091: "uz", + 1066: "vi", + 1106: "cy", + 1160: "wo", + 1157: "sah", + 1144: "ii", + 1130: "yo", + }; + function Fe(e, t, n) { + switch (e) { + case 0: + if (65535 === t) return "und"; + if (n) return n[t]; + break; + case 1: + return Pe[t]; + case 3: + return Ne[t]; + } + } + const _e = "utf-16", + He = { + 0: "macintosh", + 1: "x-mac-japanese", + 2: "x-mac-chinesetrad", + 3: "x-mac-korean", + 6: "x-mac-greek", + 7: "x-mac-cyrillic", + 9: "x-mac-devanagai", + 10: "x-mac-gurmukhi", + 11: "x-mac-gujarati", + 12: "x-mac-oriya", + 13: "x-mac-bengali", + 14: "x-mac-tamil", + 15: "x-mac-telugu", + 16: "x-mac-kannada", + 17: "x-mac-malayalam", + 18: "x-mac-sinhalese", + 19: "x-mac-burmese", + 20: "x-mac-khmer", + 21: "x-mac-thai", + 22: "x-mac-lao", + 23: "x-mac-georgian", + 24: "x-mac-armenian", + 25: "x-mac-chinesesimp", + 26: "x-mac-tibetan", + 27: "x-mac-mongolian", + 28: "x-mac-ethiopic", + 29: "x-mac-ce", + 30: "x-mac-vietnamese", + 31: "x-mac-extarabic", }, - { - text: Scratch.translate("disable"), - value: "disable", + ze = { + 15: "x-mac-icelandic", + 17: "x-mac-turkish", + 18: "x-mac-croatian", + 24: "x-mac-ce", + 25: "x-mac-ce", + 26: "x-mac-ce", + 27: "x-mac-ce", + 28: "x-mac-ce", + 30: "x-mac-icelandic", + 37: "x-mac-romanian", + 38: "x-mac-ce", + 39: "x-mac-ce", + 40: "x-mac-ce", + 143: "x-mac-inuit", + 146: "x-mac-gaelic", + }; + function We(e, t, n) { + switch (e) { + case 0: + return _e; + case 1: + return ze[n] || He[t]; + case 3: + if (1 === t || 10 === t) return _e; + } + } + function qe(e) { + const t = {}; + for (let n in e) t[e[n]] = parseInt(n); + return t; + } + function je(e, t, n, s, o, r) { + return new M.Record("NameRecord", [ + { name: "platformID", type: "USHORT", value: e }, + { name: "encodingID", type: "USHORT", value: t }, + { name: "languageID", type: "USHORT", value: n }, + { name: "nameID", type: "USHORT", value: s }, + { name: "length", type: "USHORT", value: o }, + { name: "offset", type: "USHORT", value: r }, + ]); + } + function Xe(e, t) { + let n = (function (e, t) { + const n = e.length, + s = t.length - n + 1; + e: for (let o = 0; o < s; o++) + for (; o < s; o++) { + for (let s = 0; s < n; s++) + if (t[o + s] !== e[s]) continue e; + return o; + } + return -1; + })(e, t); + if (n < 0) { + n = t.length; + let s = 0; + const o = e.length; + for (; s < o; ++s) t.push(e[s]); + } + return n; + } + const Ve = { + parse: function (e, t, n) { + const s = {}, + o = new z.Parser(e, t), + r = o.parseUShort(), + a = o.parseUShort(), + i = o.offset + o.parseUShort(); + for (let t = 0; t < a; t++) { + const t = o.parseUShort(), + r = o.parseUShort(), + a = o.parseUShort(), + l = o.parseUShort(), + u = Ae[l] || l, + c = o.parseUShort(), + p = o.parseUShort(), + f = Fe(t, a, n), + h = We(t, r, a); + if (void 0 !== h && void 0 !== f) { + let t; + if ( + ((t = + h === _e + ? d.UTF16(e, i + p, c) + : d.MACSTRING(e, i + p, c, h)), + t) + ) { + let e = s[u]; + void 0 === e && (e = s[u] = {}), (e[f] = t); + } + } + } + let l = 0; + return 1 === r && o.parseUShort(), s; + }, + make: function (e, t) { + let n; + const s = [], + o = {}, + r = qe(Ae); + for (let t in e) { + let a = r[t]; + if ((void 0 === a && (a = t), (n = parseInt(a)), isNaN(n))) + throw new Error( + 'Name table entry "' + + t + + '" does not exist, see nameTableNames for complete list.' + ); + (o[n] = e[t]), s.push(n); + } + const a = qe(Pe), + i = qe(Ne), + l = [], + u = []; + for (let e = 0; e < s.length; e++) { + n = s[e]; + const r = o[n]; + for (let e in r) { + const s = r[e]; + let o = 1, + c = a[e], + p = Ge[c]; + const f = We(o, p, c); + let h = g.MACSTRING(s, f); + void 0 === h && + ((o = 0), + (c = t.indexOf(e)), + c < 0 && ((c = t.length), t.push(e)), + (p = 4), + (h = g.UTF16(s))); + const d = Xe(h, u); + l.push(je(o, p, c, n, h.length, d)); + const m = i[e]; + if (void 0 !== m) { + const e = g.UTF16(s), + t = Xe(e, u); + l.push(je(3, 1, m, n, e.length, t)); + } + } + } + l.sort(function (e, t) { + return ( + e.platformID - t.platformID || + e.encodingID - t.encodingID || + e.languageID - t.languageID || + e.nameID - t.nameID + ); + }); + const c = new M.Table("name", [ + { name: "format", type: "USHORT", value: 0 }, + { name: "count", type: "USHORT", value: l.length }, + { + name: "stringOffset", + type: "USHORT", + value: 6 + 12 * l.length, + }, + ]); + for (let e = 0; e < l.length; e++) + c.fields.push({ + name: "record_" + e, + type: "RECORD", + value: l[e], + }); + return ( + c.fields.push({ + name: "strings", + type: "LITERAL", + value: u, + }), + c + ); + }, }, - ], - }, - FEATURE: { - items: [ - { - text: Scratch.translate("cursor blinking"), - value: "cursorblink", + Ye = [ + { begin: 0, end: 127 }, + { begin: 128, end: 255 }, + { begin: 256, end: 383 }, + { begin: 384, end: 591 }, + { begin: 592, end: 687 }, + { begin: 688, end: 767 }, + { begin: 768, end: 879 }, + { begin: 880, end: 1023 }, + { begin: 11392, end: 11519 }, + { begin: 1024, end: 1279 }, + { begin: 1328, end: 1423 }, + { begin: 1424, end: 1535 }, + { begin: 42240, end: 42559 }, + { begin: 1536, end: 1791 }, + { begin: 1984, end: 2047 }, + { begin: 2304, end: 2431 }, + { begin: 2432, end: 2559 }, + { begin: 2560, end: 2687 }, + { begin: 2688, end: 2815 }, + { begin: 2816, end: 2943 }, + { begin: 2944, end: 3071 }, + { begin: 3072, end: 3199 }, + { begin: 3200, end: 3327 }, + { begin: 3328, end: 3455 }, + { begin: 3584, end: 3711 }, + { begin: 3712, end: 3839 }, + { begin: 4256, end: 4351 }, + { begin: 6912, end: 7039 }, + { begin: 4352, end: 4607 }, + { begin: 7680, end: 7935 }, + { begin: 7936, end: 8191 }, + { begin: 8192, end: 8303 }, + { begin: 8304, end: 8351 }, + { begin: 8352, end: 8399 }, + { begin: 8400, end: 8447 }, + { begin: 8448, end: 8527 }, + { begin: 8528, end: 8591 }, + { begin: 8592, end: 8703 }, + { begin: 8704, end: 8959 }, + { begin: 8960, end: 9215 }, + { begin: 9216, end: 9279 }, + { begin: 9280, end: 9311 }, + { begin: 9312, end: 9471 }, + { begin: 9472, end: 9599 }, + { begin: 9600, end: 9631 }, + { begin: 9632, end: 9727 }, + { begin: 9728, end: 9983 }, + { begin: 9984, end: 10175 }, + { begin: 12288, end: 12351 }, + { begin: 12352, end: 12447 }, + { begin: 12448, end: 12543 }, + { begin: 12544, end: 12591 }, + { begin: 12592, end: 12687 }, + { begin: 43072, end: 43135 }, + { begin: 12800, end: 13055 }, + { begin: 13056, end: 13311 }, + { begin: 44032, end: 55215 }, + { begin: 55296, end: 57343 }, + { begin: 67840, end: 67871 }, + { begin: 19968, end: 40959 }, + { begin: 57344, end: 63743 }, + { begin: 12736, end: 12783 }, + { begin: 64256, end: 64335 }, + { begin: 64336, end: 65023 }, + { begin: 65056, end: 65071 }, + { begin: 65040, end: 65055 }, + { begin: 65104, end: 65135 }, + { begin: 65136, end: 65279 }, + { begin: 65280, end: 65519 }, + { begin: 65520, end: 65535 }, + { begin: 3840, end: 4095 }, + { begin: 1792, end: 1871 }, + { begin: 1920, end: 1983 }, + { begin: 3456, end: 3583 }, + { begin: 4096, end: 4255 }, + { begin: 4608, end: 4991 }, + { begin: 5024, end: 5119 }, + { begin: 5120, end: 5759 }, + { begin: 5760, end: 5791 }, + { begin: 5792, end: 5887 }, + { begin: 6016, end: 6143 }, + { begin: 6144, end: 6319 }, + { begin: 10240, end: 10495 }, + { begin: 40960, end: 42127 }, + { begin: 5888, end: 5919 }, + { begin: 66304, end: 66351 }, + { begin: 66352, end: 66383 }, + { begin: 66560, end: 66639 }, + { begin: 118784, end: 119039 }, + { begin: 119808, end: 120831 }, + { begin: 1044480, end: 1048573 }, + { begin: 65024, end: 65039 }, + { begin: 917504, end: 917631 }, + { begin: 6400, end: 6479 }, + { begin: 6480, end: 6527 }, + { begin: 6528, end: 6623 }, + { begin: 6656, end: 6687 }, + { begin: 11264, end: 11359 }, + { begin: 11568, end: 11647 }, + { begin: 19904, end: 19967 }, + { begin: 43008, end: 43055 }, + { begin: 65536, end: 65663 }, + { begin: 65856, end: 65935 }, + { begin: 66432, end: 66463 }, + { begin: 66464, end: 66527 }, + { begin: 66640, end: 66687 }, + { begin: 66688, end: 66735 }, + { begin: 67584, end: 67647 }, + { begin: 68096, end: 68191 }, + { begin: 119552, end: 119647 }, + { begin: 73728, end: 74751 }, + { begin: 119648, end: 119679 }, + { begin: 7040, end: 7103 }, + { begin: 7168, end: 7247 }, + { begin: 7248, end: 7295 }, + { begin: 43136, end: 43231 }, + { begin: 43264, end: 43311 }, + { begin: 43312, end: 43359 }, + { begin: 43520, end: 43615 }, + { begin: 65936, end: 65999 }, + { begin: 66e3, end: 66047 }, + { begin: 66208, end: 66271 }, + { begin: 127024, end: 127135 }, + ], + Ze = { + parse: function (e, t) { + const n = {}, + s = new z.Parser(e, t); + (n.version = s.parseUShort()), + (n.xAvgCharWidth = s.parseShort()), + (n.usWeightClass = s.parseUShort()), + (n.usWidthClass = s.parseUShort()), + (n.fsType = s.parseUShort()), + (n.ySubscriptXSize = s.parseShort()), + (n.ySubscriptYSize = s.parseShort()), + (n.ySubscriptXOffset = s.parseShort()), + (n.ySubscriptYOffset = s.parseShort()), + (n.ySuperscriptXSize = s.parseShort()), + (n.ySuperscriptYSize = s.parseShort()), + (n.ySuperscriptXOffset = s.parseShort()), + (n.ySuperscriptYOffset = s.parseShort()), + (n.yStrikeoutSize = s.parseShort()), + (n.yStrikeoutPosition = s.parseShort()), + (n.sFamilyClass = s.parseShort()), + (n.panose = []); + for (let e = 0; e < 10; e++) n.panose[e] = s.parseByte(); + return ( + (n.ulUnicodeRange1 = s.parseULong()), + (n.ulUnicodeRange2 = s.parseULong()), + (n.ulUnicodeRange3 = s.parseULong()), + (n.ulUnicodeRange4 = s.parseULong()), + (n.achVendID = String.fromCharCode( + s.parseByte(), + s.parseByte(), + s.parseByte(), + s.parseByte() + )), + (n.fsSelection = s.parseUShort()), + (n.usFirstCharIndex = s.parseUShort()), + (n.usLastCharIndex = s.parseUShort()), + (n.sTypoAscender = s.parseShort()), + (n.sTypoDescender = s.parseShort()), + (n.sTypoLineGap = s.parseShort()), + (n.usWinAscent = s.parseUShort()), + (n.usWinDescent = s.parseUShort()), + n.version >= 1 && + ((n.ulCodePageRange1 = s.parseULong()), + (n.ulCodePageRange2 = s.parseULong())), + n.version >= 2 && + ((n.sxHeight = s.parseShort()), + (n.sCapHeight = s.parseShort()), + (n.usDefaultChar = s.parseUShort()), + (n.usBreakChar = s.parseUShort()), + (n.usMaxContent = s.parseUShort())), + n + ); + }, + make: function (e) { + return new M.Table( + "OS/2", + [ + { name: "version", type: "USHORT", value: 3 }, + { name: "xAvgCharWidth", type: "SHORT", value: 0 }, + { name: "usWeightClass", type: "USHORT", value: 0 }, + { name: "usWidthClass", type: "USHORT", value: 0 }, + { name: "fsType", type: "USHORT", value: 0 }, + { name: "ySubscriptXSize", type: "SHORT", value: 650 }, + { name: "ySubscriptYSize", type: "SHORT", value: 699 }, + { name: "ySubscriptXOffset", type: "SHORT", value: 0 }, + { name: "ySubscriptYOffset", type: "SHORT", value: 140 }, + { name: "ySuperscriptXSize", type: "SHORT", value: 650 }, + { name: "ySuperscriptYSize", type: "SHORT", value: 699 }, + { name: "ySuperscriptXOffset", type: "SHORT", value: 0 }, + { + name: "ySuperscriptYOffset", + type: "SHORT", + value: 479, + }, + { name: "yStrikeoutSize", type: "SHORT", value: 49 }, + { name: "yStrikeoutPosition", type: "SHORT", value: 258 }, + { name: "sFamilyClass", type: "SHORT", value: 0 }, + { name: "bFamilyType", type: "BYTE", value: 0 }, + { name: "bSerifStyle", type: "BYTE", value: 0 }, + { name: "bWeight", type: "BYTE", value: 0 }, + { name: "bProportion", type: "BYTE", value: 0 }, + { name: "bContrast", type: "BYTE", value: 0 }, + { name: "bStrokeVariation", type: "BYTE", value: 0 }, + { name: "bArmStyle", type: "BYTE", value: 0 }, + { name: "bLetterform", type: "BYTE", value: 0 }, + { name: "bMidline", type: "BYTE", value: 0 }, + { name: "bXHeight", type: "BYTE", value: 0 }, + { name: "ulUnicodeRange1", type: "ULONG", value: 0 }, + { name: "ulUnicodeRange2", type: "ULONG", value: 0 }, + { name: "ulUnicodeRange3", type: "ULONG", value: 0 }, + { name: "ulUnicodeRange4", type: "ULONG", value: 0 }, + { name: "achVendID", type: "CHARARRAY", value: "XXXX" }, + { name: "fsSelection", type: "USHORT", value: 0 }, + { name: "usFirstCharIndex", type: "USHORT", value: 0 }, + { name: "usLastCharIndex", type: "USHORT", value: 0 }, + { name: "sTypoAscender", type: "SHORT", value: 0 }, + { name: "sTypoDescender", type: "SHORT", value: 0 }, + { name: "sTypoLineGap", type: "SHORT", value: 0 }, + { name: "usWinAscent", type: "USHORT", value: 0 }, + { name: "usWinDescent", type: "USHORT", value: 0 }, + { name: "ulCodePageRange1", type: "ULONG", value: 0 }, + { name: "ulCodePageRange2", type: "ULONG", value: 0 }, + { name: "sxHeight", type: "SHORT", value: 0 }, + { name: "sCapHeight", type: "SHORT", value: 0 }, + { name: "usDefaultChar", type: "USHORT", value: 0 }, + { name: "usBreakChar", type: "USHORT", value: 0 }, + { name: "usMaxContext", type: "USHORT", value: 0 }, + ], + e + ); + }, + unicodeRanges: Ye, + getUnicodeRange: function (e) { + for (let t = 0; t < Ye.length; t += 1) { + const n = Ye[t]; + if (e >= n.begin && e < n.end) return t; + } + return -1; + }, }, - { - text: Scratch.translate("ligatures"), - value: "ligatures", + Qe = { + parse: function (e, t) { + const n = {}, + s = new z.Parser(e, t); + switch ( + ((n.version = s.parseVersion()), + (n.italicAngle = s.parseFixed()), + (n.underlinePosition = s.parseShort()), + (n.underlineThickness = s.parseShort()), + (n.isFixedPitch = s.parseULong()), + (n.minMemType42 = s.parseULong()), + (n.maxMemType42 = s.parseULong()), + (n.minMemType1 = s.parseULong()), + (n.maxMemType1 = s.parseULong()), + n.version) + ) { + case 1: + n.names = Y.slice(); + break; + case 2: + (n.numberOfGlyphs = s.parseUShort()), + (n.glyphNameIndex = new Array(n.numberOfGlyphs)); + for (let e = 0; e < n.numberOfGlyphs; e++) + n.glyphNameIndex[e] = s.parseUShort(); + n.names = []; + for (let e = 0; e < n.numberOfGlyphs; e++) + if (n.glyphNameIndex[e] >= Y.length) { + const e = s.parseChar(); + n.names.push(s.parseString(e)); + } + break; + case 2.5: + (n.numberOfGlyphs = s.parseUShort()), + (n.offset = new Array(n.numberOfGlyphs)); + for (let e = 0; e < n.numberOfGlyphs; e++) + n.offset[e] = s.parseChar(); + } + return n; + }, + make: function () { + return new M.Table("post", [ + { name: "version", type: "FIXED", value: 196608 }, + { name: "italicAngle", type: "FIXED", value: 0 }, + { name: "underlinePosition", type: "FWORD", value: 0 }, + { name: "underlineThickness", type: "FWORD", value: 0 }, + { name: "isFixedPitch", type: "ULONG", value: 0 }, + { name: "minMemType42", type: "ULONG", value: 0 }, + { name: "maxMemType42", type: "ULONG", value: 0 }, + { name: "minMemType1", type: "ULONG", value: 0 }, + { name: "maxMemType1", type: "ULONG", value: 0 }, + ]); + }, }, - { - text: Scratch.translate("web link"), - value: "link", + Je = new Array(9); + (Je[1] = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(); + return 1 === t + ? { + substFormat: 1, + coverage: this.parsePointer(_.coverage), + deltaGlyphId: this.parseUShort(), + } + : 2 === t + ? { + substFormat: 2, + coverage: this.parsePointer(_.coverage), + substitute: this.parseOffset16List(), + } + : void f.assert( + !1, + "0x" + + e.toString(16) + + ": lookup type 1 format must be 1 or 2." + ); + }), + (Je[2] = function () { + const e = this.parseUShort(); + return ( + f.argument( + 1 === e, + "GSUB Multiple Substitution Subtable identifier-format must be 1" + ), + { + substFormat: e, + coverage: this.parsePointer(_.coverage), + sequences: this.parseListOfLists(), + } + ); + }), + (Je[3] = function () { + const e = this.parseUShort(); + return ( + f.argument( + 1 === e, + "GSUB Alternate Substitution Subtable identifier-format must be 1" + ), + { + substFormat: e, + coverage: this.parsePointer(_.coverage), + alternateSets: this.parseListOfLists(), + } + ); + }), + (Je[4] = function () { + const e = this.parseUShort(); + return ( + f.argument( + 1 === e, + "GSUB ligature table identifier-format must be 1" + ), + { + substFormat: e, + coverage: this.parsePointer(_.coverage), + ligatureSets: this.parseListOfLists(function () { + return { + ligGlyph: this.parseUShort(), + components: this.parseUShortList( + this.parseUShort() - 1 + ), + }; + }), + } + ); + }); + const Ke = { sequenceIndex: _.uShort, lookupListIndex: _.uShort }; + (Je[5] = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(); + if (1 === t) + return { + substFormat: t, + coverage: this.parsePointer(_.coverage), + ruleSets: this.parseListOfLists(function () { + const e = this.parseUShort(), + t = this.parseUShort(); + return { + input: this.parseUShortList(e - 1), + lookupRecords: this.parseRecordList(t, Ke), + }; + }), + }; + if (2 === t) + return { + substFormat: t, + coverage: this.parsePointer(_.coverage), + classDef: this.parsePointer(_.classDef), + classSets: this.parseListOfLists(function () { + const e = this.parseUShort(), + t = this.parseUShort(); + return { + classes: this.parseUShortList(e - 1), + lookupRecords: this.parseRecordList(t, Ke), + }; + }), + }; + if (3 === t) { + const e = this.parseUShort(), + n = this.parseUShort(); + return { + substFormat: t, + coverages: this.parseList(e, _.pointer(_.coverage)), + lookupRecords: this.parseRecordList(n, Ke), + }; + } + f.assert( + !1, + "0x" + + e.toString(16) + + ": lookup type 5 format must be 1, 2 or 3." + ); + }), + (Je[6] = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(); + return 1 === t + ? { + substFormat: 1, + coverage: this.parsePointer(_.coverage), + chainRuleSets: this.parseListOfLists(function () { + return { + backtrack: this.parseUShortList(), + input: this.parseUShortList(this.parseShort() - 1), + lookahead: this.parseUShortList(), + lookupRecords: this.parseRecordList(Ke), + }; + }), + } + : 2 === t + ? { + substFormat: 2, + coverage: this.parsePointer(_.coverage), + backtrackClassDef: this.parsePointer(_.classDef), + inputClassDef: this.parsePointer(_.classDef), + lookaheadClassDef: this.parsePointer(_.classDef), + chainClassSet: this.parseListOfLists(function () { + return { + backtrack: this.parseUShortList(), + input: this.parseUShortList(this.parseShort() - 1), + lookahead: this.parseUShortList(), + lookupRecords: this.parseRecordList(Ke), + }; + }), + } + : 3 === t + ? { + substFormat: 3, + backtrackCoverage: this.parseList( + _.pointer(_.coverage) + ), + inputCoverage: this.parseList(_.pointer(_.coverage)), + lookaheadCoverage: this.parseList( + _.pointer(_.coverage) + ), + lookupRecords: this.parseRecordList(Ke), + } + : void f.assert( + !1, + "0x" + + e.toString(16) + + ": lookup type 6 format must be 1, 2 or 3." + ); + }), + (Je[7] = function () { + const e = this.parseUShort(); + f.argument( + 1 === e, + "GSUB Extension Substitution subtable identifier-format must be 1" + ); + const t = this.parseUShort(), + n = new _(this.data, this.offset + this.parseULong()); + return { + substFormat: 1, + lookupType: t, + extension: Je[t].call(n), + }; + }), + (Je[8] = function () { + const e = this.parseUShort(); + return ( + f.argument( + 1 === e, + "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1" + ), + { + substFormat: e, + coverage: this.parsePointer(_.coverage), + backtrackCoverage: this.parseList(_.pointer(_.coverage)), + lookaheadCoverage: this.parseList(_.pointer(_.coverage)), + substitutes: this.parseUShortList(), + } + ); + }); + const $e = new Array(9); + ($e[1] = function (e) { + return 1 === e.substFormat + ? new M.Table("substitutionTable", [ + { name: "substFormat", type: "USHORT", value: 1 }, + { + name: "coverage", + type: "TABLE", + value: new M.Coverage(e.coverage), + }, + { + name: "deltaGlyphID", + type: "USHORT", + value: e.deltaGlyphId, + }, + ]) + : new M.Table( + "substitutionTable", + [ + { name: "substFormat", type: "USHORT", value: 2 }, + { + name: "coverage", + type: "TABLE", + value: new M.Coverage(e.coverage), + }, + ].concat(M.ushortList("substitute", e.substitute)) + ); + }), + ($e[3] = function (e) { + return ( + f.assert( + 1 === e.substFormat, + "Lookup type 3 substFormat must be 1." + ), + new M.Table( + "substitutionTable", + [ + { name: "substFormat", type: "USHORT", value: 1 }, + { + name: "coverage", + type: "TABLE", + value: new M.Coverage(e.coverage), + }, + ].concat( + M.tableList("altSet", e.alternateSets, function (e) { + return new M.Table( + "alternateSetTable", + M.ushortList("alternate", e) + ); + }) + ) + ) + ); + }), + ($e[4] = function (e) { + return ( + f.assert( + 1 === e.substFormat, + "Lookup type 4 substFormat must be 1." + ), + new M.Table( + "substitutionTable", + [ + { name: "substFormat", type: "USHORT", value: 1 }, + { + name: "coverage", + type: "TABLE", + value: new M.Coverage(e.coverage), + }, + ].concat( + M.tableList("ligSet", e.ligatureSets, function (e) { + return new M.Table( + "ligatureSetTable", + M.tableList("ligature", e, function (e) { + return new M.Table( + "ligatureTable", + [ + { + name: "ligGlyph", + type: "USHORT", + value: e.ligGlyph, + }, + ].concat( + M.ushortList( + "component", + e.components, + e.components.length + 1 + ) + ) + ); + }) + ); + }) + ) + ) + ); + }); + const et = { + parse: function (e, t) { + const n = new _(e, (t = t || 0)), + s = n.parseVersion(1); + return ( + f.argument( + 1 === s || 1.1 === s, + "Unsupported GSUB table version." + ), + 1 === s + ? { + version: s, + scripts: n.parseScriptList(), + features: n.parseFeatureList(), + lookups: n.parseLookupList(Je), + } + : { + version: s, + scripts: n.parseScriptList(), + features: n.parseFeatureList(), + lookups: n.parseLookupList(Je), + variations: n.parseFeatureVariationsList(), + } + ); + }, + make: function (e) { + return new M.Table("GSUB", [ + { name: "version", type: "ULONG", value: 65536 }, + { + name: "scripts", + type: "TABLE", + value: new M.ScriptList(e.scripts), + }, + { + name: "features", + type: "TABLE", + value: new M.FeatureList(e.features), + }, + { + name: "lookups", + type: "TABLE", + value: new M.LookupList(e.lookups, $e), + }, + ]); + }, }, - { - text: Scratch.translate( - "mouse event report (disables selection)" - ), - value: "mouse", + tt = { + parse: function (e, t) { + const n = new z.Parser(e, t), + s = n.parseULong(); + f.argument(1 === s, "Unsupported META table version."), + n.parseULong(), + n.parseULong(); + const o = n.parseULong(), + r = {}; + for (let s = 0; s < o; s++) { + const s = n.parseTag(), + o = n.parseULong(), + a = n.parseULong(), + i = d.UTF8(e, t + o, a); + r[s] = i; + } + return r; + }, + make: function (e) { + const t = Object.keys(e).length; + let n = ""; + const s = 16 + 12 * t, + o = new M.Table("meta", [ + { name: "version", type: "ULONG", value: 1 }, + { name: "flags", type: "ULONG", value: 0 }, + { name: "offset", type: "ULONG", value: s }, + { name: "numTags", type: "ULONG", value: t }, + ]); + for (let t in e) { + const r = n.length; + (n += e[t]), + o.fields.push({ + name: "tag " + t, + type: "TAG", + value: t, + }), + o.fields.push({ + name: "offset " + t, + type: "ULONG", + value: s + r, + }), + o.fields.push({ + name: "length " + t, + type: "ULONG", + value: e[t].length, + }); + } + return ( + o.fields.push({ + name: "stringPool", + type: "CHARARRAY", + value: n, + }), + o + ); + }, + }; + function nt(e) { + return (Math.log(e) / Math.log(2)) | 0; + } + function st(e) { + for (; e.length % 4 != 0; ) e.push(0); + let t = 0; + for (let n = 0; n < e.length; n += 4) + t += + (e[n] << 24) + (e[n + 1] << 16) + (e[n + 2] << 8) + e[n + 3]; + return (t %= Math.pow(2, 32)), t; + } + function ot(e, t, n, s) { + return new M.Record("Table Record", [ + { name: "tag", type: "TAG", value: void 0 !== e ? e : "" }, + { + name: "checkSum", + type: "ULONG", + value: void 0 !== t ? t : 0, + }, + { name: "offset", type: "ULONG", value: void 0 !== n ? n : 0 }, + { name: "length", type: "ULONG", value: void 0 !== s ? s : 0 }, + ]); + } + function rt(e) { + const t = new M.Table("sfnt", [ + { name: "version", type: "TAG", value: "OTTO" }, + { name: "numTables", type: "USHORT", value: 0 }, + { name: "searchRange", type: "USHORT", value: 0 }, + { name: "entrySelector", type: "USHORT", value: 0 }, + { name: "rangeShift", type: "USHORT", value: 0 }, + ]); + (t.tables = e), (t.numTables = e.length); + const n = Math.pow(2, nt(t.numTables)); + (t.searchRange = 16 * n), + (t.entrySelector = nt(n)), + (t.rangeShift = 16 * t.numTables - t.searchRange); + const s = [], + o = []; + let r = t.sizeOf() + ot().sizeOf() * t.numTables; + for (; r % 4 != 0; ) + (r += 1), o.push({ name: "padding", type: "BYTE", value: 0 }); + for (let t = 0; t < e.length; t += 1) { + const n = e[t]; + f.argument( + 4 === n.tableName.length, + "Table name" + n.tableName + " is invalid." + ); + const a = n.sizeOf(), + i = ot(n.tableName, st(n.encode()), r, a); + for ( + s.push({ + name: i.tag + " Table Record", + type: "RECORD", + value: i, + }), + o.push({ + name: n.tableName + " table", + type: "RECORD", + value: n, + }), + r += a, + f.argument( + !isNaN(r), + "Something went wrong calculating the offset." + ); + r % 4 != 0; + + ) + (r += 1), o.push({ name: "padding", type: "BYTE", value: 0 }); + } + return ( + s.sort(function (e, t) { + return e.value.tag > t.value.tag ? 1 : -1; + }), + (t.fields = t.fields.concat(s)), + (t.fields = t.fields.concat(o)), + t + ); + } + function at(e, t, n) { + for (let n = 0; n < t.length; n += 1) { + const s = e.charToGlyphIndex(t[n]); + if (s > 0) return e.glyphs.get(s).getMetrics(); + } + return n; + } + function it(e) { + let t = 0; + for (let n = 0; n < e.length; n += 1) t += e[n]; + return t / e.length; + } + const lt = function (e) { + const t = [], + n = [], + s = [], + o = [], + r = [], + a = [], + i = []; + let l, + u = 0, + c = 0, + p = 0, + f = 0, + h = 0; + for (let d = 0; d < e.glyphs.length; d += 1) { + const g = e.glyphs.get(d), + m = 0 | g.unicode; + if (isNaN(g.advanceWidth)) + throw new Error( + "Glyph " + + g.name + + " (" + + d + + "): advanceWidth is not a number." + ); + (l > m || void 0 === l) && m > 0 && (l = m), u < m && (u = m); + const y = Ze.getUnicodeRange(m); + if (y < 32) c |= 1 << y; + else if (y < 64) p |= 1 << (y - 32); + else if (y < 96) f |= 1 << (y - 64); + else { + if (!(y < 123)) + throw new Error( + "Unicode ranges bits > 123 are reserved for internal usage" + ); + h |= 1 << (y - 96); + } + if (".notdef" === g.name) continue; + const v = g.getMetrics(); + t.push(v.xMin), + n.push(v.yMin), + s.push(v.xMax), + o.push(v.yMax), + a.push(v.leftSideBearing), + i.push(v.rightSideBearing), + r.push(g.advanceWidth); + } + const d = { + xMin: Math.min.apply(null, t), + yMin: Math.min.apply(null, n), + xMax: Math.max.apply(null, s), + yMax: Math.max.apply(null, o), + advanceWidthMax: Math.max.apply(null, r), + advanceWidthAvg: it(r), + minLeftSideBearing: Math.min.apply(null, a), + maxLeftSideBearing: Math.max.apply(null, a), + minRightSideBearing: Math.min.apply(null, i), + }; + (d.ascender = e.ascender), (d.descender = e.descender); + const g = Le.make({ + flags: 3, + unitsPerEm: e.unitsPerEm, + xMin: d.xMin, + yMin: d.yMin, + xMax: d.xMax, + yMax: d.yMax, + lowestRecPPEM: 3, + createdTimestamp: e.createdTimestamp, + }), + m = Be.make({ + ascender: d.ascender, + descender: d.descender, + advanceWidthMax: d.advanceWidthMax, + minLeftSideBearing: d.minLeftSideBearing, + minRightSideBearing: d.minRightSideBearing, + xMaxExtent: d.maxLeftSideBearing + (d.xMax - d.xMin), + numberOfHMetrics: e.glyphs.length, + }), + y = Me.make(e.glyphs.length), + v = Ze.make({ + xAvgCharWidth: Math.round(d.advanceWidthAvg), + usWeightClass: e.tables.os2.usWeightClass, + usWidthClass: e.tables.os2.usWidthClass, + usFirstCharIndex: l, + usLastCharIndex: u, + ulUnicodeRange1: c, + ulUnicodeRange2: p, + ulUnicodeRange3: f, + ulUnicodeRange4: h, + fsSelection: e.tables.os2.fsSelection, + sTypoAscender: d.ascender, + sTypoDescender: d.descender, + sTypoLineGap: 0, + usWinAscent: d.yMax, + usWinDescent: Math.abs(d.yMin), + ulCodePageRange1: 1, + sxHeight: at(e, "xyvw", { yMax: Math.round(d.ascender / 2) }) + .yMax, + sCapHeight: at(e, "HIKLEFJMNTZBDPRAGOQSUVWXY", d).yMax, + usDefaultChar: e.hasChar(" ") ? 32 : 0, + usBreakChar: e.hasChar(" ") ? 32 : 0, + }), + b = Ce.make(e.glyphs), + x = q.make(e.glyphs), + S = e.getEnglishName("fontFamily"), + U = e.getEnglishName("fontSubfamily"), + k = S + " " + U; + let T = e.getEnglishName("postScriptName"); + T || (T = S.replace(/\s/g, "") + "-" + U); + const E = {}; + for (let t in e.names) E[t] = e.names[t]; + E.uniqueID || + (E.uniqueID = { + en: e.getEnglishName("manufacturer") + ":" + k, + }), + E.postScriptName || (E.postScriptName = { en: T }), + E.preferredFamily || (E.preferredFamily = e.names.fontFamily), + E.preferredSubfamily || + (E.preferredSubfamily = e.names.fontSubfamily); + const w = [], + O = Ve.make(E, w), + I = w.length > 0 ? De.make(w) : void 0, + R = Qe.make(), + L = Re.make(e.glyphs, { + version: e.getEnglishName("version"), + fullName: k, + familyName: S, + weightName: U, + postScriptName: T, + unitsPerEm: e.unitsPerEm, + fontBBox: [0, d.yMin, d.ascender, d.advanceWidthMax], + }), + B = + e.metas && Object.keys(e.metas).length > 0 + ? tt.make(e.metas) + : void 0, + C = [g, m, y, v, O, x, R, L, b]; + I && C.push(I), + e.tables.gsub && C.push(et.make(e.tables.gsub)), + B && C.push(B); + const D = rt(C), + M = st(D.encode()), + A = D.fields; + let P = !1; + for (let e = 0; e < A.length; e += 1) + if ("head table" === A[e].name) { + (A[e].value.checkSumAdjustment = 2981146554 - M), (P = !0); + break; + } + if (!P) + throw new Error( + "Could not find head table with checkSum to adjust." + ); + return D; + }; + function ut(e, t) { + let n = 0, + s = e.length - 1; + for (; n <= s; ) { + const o = (n + s) >>> 1, + r = e[o].tag; + if (r === t) return o; + r < t ? (n = o + 1) : (s = o - 1); + } + return -n - 1; + } + function ct(e, t) { + let n = 0, + s = e.length - 1; + for (; n <= s; ) { + const o = (n + s) >>> 1, + r = e[o]; + if (r === t) return o; + r < t ? (n = o + 1) : (s = o - 1); + } + return -n - 1; + } + function pt(e, t) { + let n, + s = 0, + o = e.length - 1; + for (; s <= o; ) { + const r = (s + o) >>> 1; + n = e[r]; + const a = n.start; + if (a === t) return n; + a < t ? (s = r + 1) : (o = r - 1); + } + if (s > 0) return (n = e[s - 1]), t > n.end ? 0 : n; + } + function ft(e, t) { + (this.font = e), (this.tableName = t); + } + ft.prototype = { + searchTag: ut, + binSearch: ct, + getTable: function (e) { + let t = this.font.tables[this.tableName]; + return ( + !t && + e && + (t = this.font.tables[this.tableName] = + this.createDefaultTable()), + t + ); }, - { - text: Scratch.translate("input buffer"), - value: "buffer", + getScriptNames: function () { + let e = this.getTable(); + return e + ? e.scripts.map(function (e) { + return e.tag; + }) + : []; }, - ], - }, - DIRECTION: { - items: [ - { - text: Scratch.translate("up"), - value: "up", + getDefaultScriptName: function () { + let e = this.getTable(); + if (!e) return; + let t = !1; + for (let n = 0; n < e.scripts.length; n++) { + const s = e.scripts[n].tag; + if ("DFLT" === s) return s; + "latn" === s && (t = !0); + } + return t ? "latn" : void 0; }, - { - text: Scratch.translate("down"), - value: "down", + getScriptTable: function (e, t) { + const n = this.getTable(t); + if (n) { + e = e || "DFLT"; + const s = n.scripts, + o = ut(n.scripts, e); + if (o >= 0) return s[o].script; + if (t) { + const t = { + tag: e, + script: { + defaultLangSys: { + reserved: 0, + reqFeatureIndex: 65535, + featureIndexes: [], + }, + langSysRecords: [], + }, + }; + return s.splice(-1 - o, 0, t), t.script; + } + } }, - { - text: Scratch.translate("left"), - value: "left", + getLangSysTable: function (e, t, n) { + const s = this.getScriptTable(e, n); + if (s) { + if (!t || "dflt" === t || "DFLT" === t) + return s.defaultLangSys; + const e = ut(s.langSysRecords, t); + if (e >= 0) return s.langSysRecords[e].langSys; + if (n) { + const n = { + tag: t, + langSys: { + reserved: 0, + reqFeatureIndex: 65535, + featureIndexes: [], + }, + }; + return s.langSysRecords.splice(-1 - e, 0, n), n.langSys; + } + } }, - { - text: Scratch.translate("right"), - value: "right", + getFeatureTable: function (e, t, n, s) { + const o = this.getLangSysTable(e, t, s); + if (o) { + let e; + const t = o.featureIndexes, + r = this.font.tables[this.tableName].features; + for (let s = 0; s < t.length; s++) + if (((e = r[t[s]]), e.tag === n)) return e.feature; + if (s) { + const s = r.length; + return ( + f.assert( + 0 === s || n >= r[s - 1].tag, + "Features must be added in alphabetical order." + ), + (e = { + tag: n, + feature: { params: 0, lookupListIndexes: [] }, + }), + r.push(e), + t.push(s), + e.feature + ); + } + } }, - ], - }, - BUTTON: { - items: [ - { - text: Scratch.translate("left"), - value: "left", + getLookupTables: function (e, t, n, s, o) { + const r = this.getFeatureTable(e, t, n, o), + a = []; + if (r) { + let e; + const t = r.lookupListIndexes, + n = this.font.tables[this.tableName].lookups; + for (let o = 0; o < t.length; o++) + (e = n[t[o]]), e.lookupType === s && a.push(e); + if (0 === a.length && o) { + e = { + lookupType: s, + lookupFlag: 0, + subtables: [], + markFilteringSet: void 0, + }; + const o = n.length; + return n.push(e), t.push(o), [e]; + } + } + return a; }, - { - text: Scratch.translate("middle"), - value: "middle", + getGlyphClass: function (e, t) { + switch (e.format) { + case 1: + return e.startGlyph <= t && + t < e.startGlyph + e.classes.length + ? e.classes[t - e.startGlyph] + : 0; + case 2: + const n = pt(e.ranges, t); + return n ? n.classId : 0; + } }, - { - text: Scratch.translate("right"), - value: "right", + getCoverageIndex: function (e, t) { + switch (e.format) { + case 1: + const n = ct(e.glyphs, t); + return n >= 0 ? n : -1; + case 2: + const s = pt(e.ranges, t); + return s ? s.index + t - s.start : -1; + } }, - ], - }, - CLEARTYPE: { - items: [ - { - text: Scratch.translate("entire screen"), - value: "screen", + expandCoverage: function (e) { + if (1 === e.format) return e.glyphs; + { + const t = [], + n = e.ranges; + for (let e = 0; e < n.length; e++) { + const s = n[e], + o = s.start, + r = s.end; + for (let e = o; e <= r; e++) t.push(e); + } + return t; + } }, - { - text: Scratch.translate("characters after cursor"), - value: "after", + }; + const ht = ft; + function dt(e) { + ht.call(this, e, "gpos"); + } + (dt.prototype = ht.prototype), + (dt.prototype.getKerningValue = function (e, t, n) { + for (let s = 0; s < e.length; s++) { + const o = e[s].subtables; + for (let e = 0; e < o.length; e++) { + const s = o[e], + r = this.getCoverageIndex(s.coverage, t); + if (!(r < 0)) + switch (s.posFormat) { + case 1: + let e = s.pairSets[r]; + for (let t = 0; t < e.length; t++) { + let s = e[t]; + if (s.secondGlyph === n) + return (s.value1 && s.value1.xAdvance) || 0; + } + break; + case 2: + const o = this.getGlyphClass(s.classDef1, t), + a = this.getGlyphClass(s.classDef2, n), + i = s.classRecords[o][a]; + return (i.value1 && i.value1.xAdvance) || 0; + } + } + } + return 0; + }), + (dt.prototype.getKerningTables = function (e, t) { + if (this.font.tables.gpos) + return this.getLookupTables(e, t, "kern", 2); + }); + const gt = dt; + function mt(e) { + ht.call(this, e, "gsub"); + } + function yt(e, t) { + const n = e.length; + if (n !== t.length) return !1; + for (let s = 0; s < n; s++) if (e[s] !== t[s]) return !1; + return !0; + } + function vt(e, t, n) { + const s = e.subtables; + for (let e = 0; e < s.length; e++) { + const n = s[e]; + if (n.substFormat === t) return n; + } + if (n) return s.push(n), n; + } + (mt.prototype = ht.prototype), + (mt.prototype.createDefaultTable = function () { + return { + version: 1, + scripts: [ + { + tag: "DFLT", + script: { + defaultLangSys: { + reserved: 0, + reqFeatureIndex: 65535, + featureIndexes: [], + }, + langSysRecords: [], + }, + }, + ], + features: [], + lookups: [], + }; + }), + (mt.prototype.getSingle = function (e, t, n) { + const s = [], + o = this.getLookupTables(t, n, e, 1); + for (let e = 0; e < o.length; e++) { + const t = o[e].subtables; + for (let e = 0; e < t.length; e++) { + const n = t[e], + o = this.expandCoverage(n.coverage); + let r; + if (1 === n.substFormat) { + const e = n.deltaGlyphId; + for (r = 0; r < o.length; r++) { + const t = o[r]; + s.push({ sub: t, by: t + e }); + } + } else { + const e = n.substitute; + for (r = 0; r < o.length; r++) + s.push({ sub: o[r], by: e[r] }); + } + } + } + return s; + }), + (mt.prototype.getAlternates = function (e, t, n) { + const s = [], + o = this.getLookupTables(t, n, e, 3); + for (let e = 0; e < o.length; e++) { + const t = o[e].subtables; + for (let e = 0; e < t.length; e++) { + const n = t[e], + o = this.expandCoverage(n.coverage), + r = n.alternateSets; + for (let e = 0; e < o.length; e++) + s.push({ sub: o[e], by: r[e] }); + } + } + return s; + }), + (mt.prototype.getLigatures = function (e, t, n) { + const s = [], + o = this.getLookupTables(t, n, e, 4); + for (let e = 0; e < o.length; e++) { + const t = o[e].subtables; + for (let e = 0; e < t.length; e++) { + const n = t[e], + o = this.expandCoverage(n.coverage), + r = n.ligatureSets; + for (let e = 0; e < o.length; e++) { + const t = o[e], + n = r[e]; + for (let e = 0; e < n.length; e++) { + const o = n[e]; + s.push({ + sub: [t].concat(o.components), + by: o.ligGlyph, + }); + } + } + } + } + return s; + }), + (mt.prototype.addSingle = function (e, t, n, s) { + const o = vt(this.getLookupTables(n, s, e, 1, !0)[0], 2, { + substFormat: 2, + coverage: { format: 1, glyphs: [] }, + substitute: [], + }); + f.assert( + 1 === o.coverage.format, + "Ligature: unable to modify coverage table format " + + o.coverage.format + ); + const r = t.sub; + let a = this.binSearch(o.coverage.glyphs, r); + a < 0 && + ((a = -1 - a), + o.coverage.glyphs.splice(a, 0, r), + o.substitute.splice(a, 0, 0)), + (o.substitute[a] = t.by); + }), + (mt.prototype.addAlternate = function (e, t, n, s) { + const o = vt(this.getLookupTables(n, s, e, 3, !0)[0], 1, { + substFormat: 1, + coverage: { format: 1, glyphs: [] }, + alternateSets: [], + }); + f.assert( + 1 === o.coverage.format, + "Ligature: unable to modify coverage table format " + + o.coverage.format + ); + const r = t.sub; + let a = this.binSearch(o.coverage.glyphs, r); + a < 0 && + ((a = -1 - a), + o.coverage.glyphs.splice(a, 0, r), + o.alternateSets.splice(a, 0, 0)), + (o.alternateSets[a] = t.by); + }), + (mt.prototype.addLigature = function (e, t, n, s) { + const o = this.getLookupTables(n, s, e, 4, !0)[0]; + let r = o.subtables[0]; + r || + ((r = { + substFormat: 1, + coverage: { format: 1, glyphs: [] }, + ligatureSets: [], + }), + (o.subtables[0] = r)), + f.assert( + 1 === r.coverage.format, + "Ligature: unable to modify coverage table format " + + r.coverage.format + ); + const a = t.sub[0], + i = t.sub.slice(1), + l = { ligGlyph: t.by, components: i }; + let u = this.binSearch(r.coverage.glyphs, a); + if (u >= 0) { + const e = r.ligatureSets[u]; + for (let t = 0; t < e.length; t++) + if (yt(e[t].components, i)) return; + e.push(l); + } else + (u = -1 - u), + r.coverage.glyphs.splice(u, 0, a), + r.ligatureSets.splice(u, 0, [l]); + }), + (mt.prototype.getFeature = function (e, t, n) { + if (/ss\d\d/.test(e)) return this.getSingle(e, t, n); + switch (e) { + case "aalt": + case "salt": + return this.getSingle(e, t, n).concat( + this.getAlternates(e, t, n) + ); + case "dlig": + case "liga": + case "rlig": + return this.getLigatures(e, t, n); + } + }), + (mt.prototype.add = function (e, t, n, s) { + if (/ss\d\d/.test(e)) return this.addSingle(e, t, n, s); + switch (e) { + case "aalt": + case "salt": + return "number" == typeof t.by + ? this.addSingle(e, t, n, s) + : this.addAlternate(e, t, n, s); + case "dlig": + case "liga": + case "rlig": + return this.addLigature(e, t, n, s); + } + }); + const bt = mt; + function xt(e) { + const t = new ArrayBuffer(e.length), + n = new Uint8Array(t); + for (let t = 0; t < e.length; ++t) n[t] = e[t]; + return t; + } + function St(e, t) { + if (!e) throw t; + } + let Ut, kt, Tt, Et; + function wt(e) { + (this.font = e), + (this._fpgmState = this._prepState = void 0), + (this._errorState = 0); + } + function Ot(e) { + return e; + } + function It(e) { + return Math.sign(e) * Math.round(Math.abs(e)); + } + function Rt(e) { + return (Math.sign(e) * Math.round(Math.abs(2 * e))) / 2; + } + function Lt(e) { + return Math.sign(e) * (Math.round(Math.abs(e) + 0.5) - 0.5); + } + function Bt(e) { + return Math.sign(e) * Math.ceil(Math.abs(e)); + } + function Ct(e) { + return Math.sign(e) * Math.floor(Math.abs(e)); + } + const Dt = function (e) { + const t = this.srPeriod; + let n = this.srPhase, + s = 1; + return ( + e < 0 && ((e = -e), (s = -1)), + (e += this.srThreshold - n), + (e = Math.trunc(e / t) * t), + (e += n) < 0 ? n * s : e * s + ); }, - { - text: Scratch.translate("characters before cursor"), - value: "before", + Mt = { + x: 1, + y: 0, + axis: "x", + distance: function (e, t, n, s) { + return (n ? e.xo : e.x) - (s ? t.xo : t.x); + }, + interpolate: function (e, t, n, s) { + let o, r, a, i, l, u, c; + if (!s || s === this) + return ( + (o = e.xo - t.xo), + (r = e.xo - n.xo), + (l = t.x - t.xo), + (u = n.x - n.xo), + (a = Math.abs(o)), + (i = Math.abs(r)), + (c = a + i), + 0 === c + ? void (e.x = e.xo + (l + u) / 2) + : void (e.x = e.xo + (l * i + u * a) / c) + ); + (o = s.distance(e, t, !0, !0)), + (r = s.distance(e, n, !0, !0)), + (l = s.distance(t, t, !1, !0)), + (u = s.distance(n, n, !1, !0)), + (a = Math.abs(o)), + (i = Math.abs(r)), + (c = a + i), + 0 !== c + ? Mt.setRelative(e, e, (l * i + u * a) / c, s, !0) + : Mt.setRelative(e, e, (l + u) / 2, s, !0); + }, + normalSlope: Number.NEGATIVE_INFINITY, + setRelative: function (e, t, n, s, o) { + if (!s || s === this) + return void (e.x = (o ? t.xo : t.x) + n); + const r = o ? t.xo : t.x, + a = o ? t.yo : t.y, + i = r + n * s.x, + l = a + n * s.y; + e.x = i + (e.y - l) / s.normalSlope; + }, + slope: 0, + touch: function (e) { + e.xTouched = !0; + }, + touched: function (e) { + return e.xTouched; + }, + untouch: function (e) { + e.xTouched = !1; + }, }, - { - text: Scratch.translate("scrollback"), - value: "scrollback", + At = { + x: 0, + y: 1, + axis: "y", + distance: function (e, t, n, s) { + return (n ? e.yo : e.y) - (s ? t.yo : t.y); + }, + interpolate: function (e, t, n, s) { + let o, r, a, i, l, u, c; + if (!s || s === this) + return ( + (o = e.yo - t.yo), + (r = e.yo - n.yo), + (l = t.y - t.yo), + (u = n.y - n.yo), + (a = Math.abs(o)), + (i = Math.abs(r)), + (c = a + i), + 0 === c + ? void (e.y = e.yo + (l + u) / 2) + : void (e.y = e.yo + (l * i + u * a) / c) + ); + (o = s.distance(e, t, !0, !0)), + (r = s.distance(e, n, !0, !0)), + (l = s.distance(t, t, !1, !0)), + (u = s.distance(n, n, !1, !0)), + (a = Math.abs(o)), + (i = Math.abs(r)), + (c = a + i), + 0 !== c + ? At.setRelative(e, e, (l * i + u * a) / c, s, !0) + : At.setRelative(e, e, (l + u) / 2, s, !0); + }, + normalSlope: 0, + setRelative: function (e, t, n, s, o) { + if (!s || s === this) + return void (e.y = (o ? t.yo : t.y) + n); + const r = o ? t.xo : t.x, + a = o ? t.yo : t.y, + i = r + n * s.x, + l = a + n * s.y; + e.y = l + s.normalSlope * (e.x - i); + }, + slope: Number.POSITIVE_INFINITY, + touch: function (e) { + e.yTouched = !0; + }, + touched: function (e) { + return e.yTouched; + }, + untouch: function (e) { + e.yTouched = !1; + }, + }; + function Pt(e, t) { + (this.x = e), + (this.y = t), + (this.axis = void 0), + (this.slope = t / e), + (this.normalSlope = -e / t), + Object.freeze(this); + } + function Gt(e, t) { + const n = Math.sqrt(e * e + t * t); + return ( + (t /= n), + 1 == (e /= n) && 0 === t + ? Mt + : 0 === e && 1 === t + ? At + : new Pt(e, t) + ); + } + function Nt(e, t, n, s) { + (this.x = this.xo = Math.round(64 * e) / 64), + (this.y = this.yo = Math.round(64 * t) / 64), + (this.lastPointOfContour = n), + (this.onCurve = s), + (this.prevPointOnContour = void 0), + (this.nextPointOnContour = void 0), + (this.xTouched = !1), + (this.yTouched = !1), + Object.preventExtensions(this); + } + Object.freeze(Mt), + Object.freeze(At), + (Pt.prototype.distance = function (e, t, n, s) { + return ( + this.x * Mt.distance(e, t, n, s) + + this.y * At.distance(e, t, n, s) + ); + }), + (Pt.prototype.interpolate = function (e, t, n, s) { + let o, r, a, i, l, u, c; + (a = s.distance(e, t, !0, !0)), + (i = s.distance(e, n, !0, !0)), + (o = s.distance(t, t, !1, !0)), + (r = s.distance(n, n, !1, !0)), + (l = Math.abs(a)), + (u = Math.abs(i)), + (c = l + u), + 0 !== c + ? this.setRelative(e, e, (o * u + r * l) / c, s, !0) + : this.setRelative(e, e, (o + r) / 2, s, !0); + }), + (Pt.prototype.setRelative = function (e, t, n, s, o) { + s = s || this; + const r = o ? t.xo : t.x, + a = o ? t.yo : t.y, + i = r + n * s.x, + l = a + n * s.y, + u = s.normalSlope, + c = this.slope, + p = e.x, + f = e.y; + (e.x = (c * p - u * i + l - f) / (c - u)), + (e.y = c * (e.x - p) + f); + }), + (Pt.prototype.touch = function (e) { + (e.xTouched = !0), (e.yTouched = !0); + }), + (Nt.prototype.nextTouched = function (e) { + let t = this.nextPointOnContour; + for (; !e.touched(t) && t !== this; ) t = t.nextPointOnContour; + return t; + }), + (Nt.prototype.prevTouched = function (e) { + let t = this.prevPointOnContour; + for (; !e.touched(t) && t !== this; ) t = t.prevPointOnContour; + return t; + }); + const Ft = Object.freeze(new Nt(0, 0)), + _t = { + cvCutIn: 17 / 16, + deltaBase: 9, + deltaShift: 0.125, + loop: 1, + minDis: 1, + autoFlip: !0, + }; + function Ht(e, t) { + switch (((this.env = e), (this.stack = []), (this.prog = t), e)) { + case "glyf": + (this.zp0 = this.zp1 = this.zp2 = 1), + (this.rp0 = this.rp1 = this.rp2 = 0); + case "prep": + (this.fv = this.pv = this.dpv = Mt), (this.round = It); + } + } + function zt(e) { + const t = (e.tZone = new Array(e.gZone.length)); + for (let e = 0; e < t.length; e++) t[e] = new Nt(0, 0); + } + function Wt(e, t) { + const n = e.prog; + let s, + o = e.ip, + r = 1; + do { + if (((s = n[++o]), 88 === s)) r++; + else if (89 === s) r--; + else if (64 === s) o += n[o + 1] + 1; + else if (65 === s) o += 2 * n[o + 1] + 1; + else if (s >= 176 && s <= 183) o += s - 176 + 1; + else if (s >= 184 && s <= 191) o += 2 * (s - 184 + 1); + else if (t && 1 === r && 27 === s) break; + } while (r > 0); + e.ip = o; + } + function qt(e, t) { + exports.DEBUG && console.log(t.step, "SVTCA[" + e.axis + "]"), + (t.fv = t.pv = t.dpv = e); + } + function jt(e, t) { + exports.DEBUG && console.log(t.step, "SPVTCA[" + e.axis + "]"), + (t.pv = t.dpv = e); + } + function Xt(e, t) { + exports.DEBUG && console.log(t.step, "SFVTCA[" + e.axis + "]"), + (t.fv = e); + } + function Vt(e, t) { + const n = t.stack, + s = n.pop(), + o = n.pop(), + r = t.z2[s], + a = t.z1[o]; + let i, l; + exports.DEBUG && console.log("SPVTL[" + e + "]", s, o), + e + ? ((i = r.y - a.y), (l = a.x - r.x)) + : ((i = a.x - r.x), (l = a.y - r.y)), + (t.pv = t.dpv = Gt(i, l)); + } + function Yt(e, t) { + const n = t.stack, + s = n.pop(), + o = n.pop(), + r = t.z2[s], + a = t.z1[o]; + let i, l; + exports.DEBUG && console.log("SFVTL[" + e + "]", s, o), + e + ? ((i = r.y - a.y), (l = a.x - r.x)) + : ((i = a.x - r.x), (l = a.y - r.y)), + (t.fv = Gt(i, l)); + } + function Zt(e) { + exports.DEBUG && console.log(e.step, "POP[]"), e.stack.pop(); + } + function Qt(e, t) { + const n = t.stack.pop(), + s = t.z0[n], + o = t.fv, + r = t.pv; + exports.DEBUG && console.log(t.step, "MDAP[" + e + "]", n); + let a = r.distance(s, Ft); + e && (a = t.round(a)), + o.setRelative(s, Ft, a, r), + o.touch(s), + (t.rp0 = t.rp1 = n); + } + function Jt(e, t) { + const n = t.z2, + s = n.length - 2; + let o, r, a; + exports.DEBUG && console.log(t.step, "IUP[" + e.axis + "]"); + for (let t = 0; t < s; t++) + (o = n[t]), + e.touched(o) || + ((r = o.prevTouched(e)), + r !== o && + ((a = o.nextTouched(e)), + r === a && + e.setRelative(o, o, e.distance(r, r, !1, !0), e, !0), + e.interpolate(o, r, a, e))); + } + function Kt(e, t) { + const n = t.stack, + s = e ? t.rp1 : t.rp2, + o = (e ? t.z0 : t.z1)[s], + r = t.fv, + a = t.pv; + let i = t.loop; + const l = t.z2; + for (; i--; ) { + const s = n.pop(), + u = l[s], + c = a.distance(o, o, !1, !0); + r.setRelative(u, u, c, a), + r.touch(u), + exports.DEBUG && + console.log( + t.step, + (t.loop > 1 ? "loop " + (t.loop - i) + ": " : "") + + "SHP[" + + (e ? "rp1" : "rp2") + + "]", + s + ); + } + t.loop = 1; + } + function $t(e, t) { + const n = t.stack, + s = e ? t.rp1 : t.rp2, + o = (e ? t.z0 : t.z1)[s], + r = t.fv, + a = t.pv, + i = n.pop(), + l = t.z2[t.contours[i]]; + let u = l; + exports.DEBUG && console.log(t.step, "SHC[" + e + "]", i); + const c = a.distance(o, o, !1, !0); + do { + u !== o && r.setRelative(u, u, c, a), + (u = u.nextPointOnContour); + } while (u !== l); + } + function en(e, t) { + const n = t.stack, + s = e ? t.rp1 : t.rp2, + o = (e ? t.z0 : t.z1)[s], + r = t.fv, + a = t.pv, + i = n.pop(); + let l, u; + switch ( + (exports.DEBUG && console.log(t.step, "SHZ[" + e + "]", i), i) + ) { + case 0: + l = t.tZone; + break; + case 1: + l = t.gZone; + break; + default: + throw new Error("Invalid zone"); + } + const c = a.distance(o, o, !1, !0), + p = l.length - 2; + for (let e = 0; e < p; e++) (u = l[e]), r.setRelative(u, u, c, a); + } + function tn(e, t) { + const n = t.stack, + s = n.pop() / 64, + o = n.pop(), + r = t.z1[o], + a = t.z0[t.rp0], + i = t.fv, + l = t.pv; + i.setRelative(r, a, s, l), + i.touch(r), + exports.DEBUG && console.log(t.step, "MSIRP[" + e + "]", s, o), + (t.rp1 = t.rp0), + (t.rp2 = o), + e && (t.rp0 = o); + } + function nn(e, t) { + const n = t.stack, + s = n.pop(), + o = n.pop(), + r = t.z0[o], + a = t.fv, + i = t.pv; + let l = t.cvt[s]; + exports.DEBUG && + console.log(t.step, "MIAP[" + e + "]", s, "(", l, ")", o); + let u = i.distance(r, Ft); + e && (Math.abs(u - l) < t.cvCutIn && (u = l), (u = t.round(u))), + a.setRelative(r, Ft, u, i), + 0 === t.zp0 && ((r.xo = r.x), (r.yo = r.y)), + a.touch(r), + (t.rp0 = t.rp1 = o); + } + function sn(e, t) { + const n = t.stack, + s = n.pop(), + o = t.z2[s]; + exports.DEBUG && console.log(t.step, "GC[" + e + "]", s), + n.push(64 * t.dpv.distance(o, Ft, e, !1)); + } + function on(e, t) { + const n = t.stack, + s = n.pop(), + o = n.pop(), + r = t.z1[s], + a = t.z0[o], + i = t.dpv.distance(a, r, e, e); + exports.DEBUG && + console.log(t.step, "MD[" + e + "]", s, o, "->", i), + t.stack.push(Math.round(64 * i)); + } + function rn(e, t) { + const n = t.stack, + s = n.pop(), + o = t.fv, + r = t.pv, + a = t.ppem, + i = t.deltaBase + 16 * (e - 1), + l = t.deltaShift, + u = t.z0; + exports.DEBUG && console.log(t.step, "DELTAP[" + e + "]", s, n); + for (let e = 0; e < s; e++) { + const e = n.pop(), + s = n.pop(); + if (i + ((240 & s) >> 4) !== a) continue; + let c = (15 & s) - 8; + c >= 0 && c++, + exports.DEBUG && + console.log(t.step, "DELTAPFIX", e, "by", c * l); + const p = u[e]; + o.setRelative(p, p, c * l, r); + } + } + function an(e, t) { + const n = t.stack, + s = n.pop(); + exports.DEBUG && console.log(t.step, "ROUND[]"), + n.push(64 * t.round(s / 64)); + } + function ln(e, t) { + const n = t.stack, + s = n.pop(), + o = t.ppem, + r = t.deltaBase + 16 * (e - 1), + a = t.deltaShift; + exports.DEBUG && console.log(t.step, "DELTAC[" + e + "]", s, n); + for (let e = 0; e < s; e++) { + const e = n.pop(), + s = n.pop(); + if (r + ((240 & s) >> 4) !== o) continue; + let i = (15 & s) - 8; + i >= 0 && i++; + const l = i * a; + exports.DEBUG && console.log(t.step, "DELTACFIX", e, "by", l), + (t.cvt[e] += l); + } + } + function un(e, t) { + const n = t.stack, + s = n.pop(), + o = n.pop(), + r = t.z2[s], + a = t.z1[o]; + let i, l; + exports.DEBUG && console.log(t.step, "SDPVTL[" + e + "]", s, o), + e + ? ((i = r.y - a.y), (l = a.x - r.x)) + : ((i = a.x - r.x), (l = a.y - r.y)), + (t.dpv = Gt(i, l)); + } + function cn(e, t) { + const n = t.stack, + s = t.prog; + let o = t.ip; + exports.DEBUG && console.log(t.step, "PUSHB[" + e + "]"); + for (let t = 0; t < e; t++) n.push(s[++o]); + t.ip = o; + } + function pn(e, t) { + let n = t.ip; + const s = t.prog, + o = t.stack; + exports.DEBUG && console.log(t.ip, "PUSHW[" + e + "]"); + for (let t = 0; t < e; t++) { + let e = (s[++n] << 8) | s[++n]; + 32768 & e && (e = -(1 + (65535 ^ e))), o.push(e); + } + t.ip = n; + } + function fn(e, t, n, s, o, r) { + const a = r.stack, + i = e && a.pop(), + l = a.pop(), + u = r.rp0, + c = r.z0[u], + p = r.z1[l], + f = r.minDis, + h = r.fv, + d = r.dpv; + let g, m, y, v; + (m = g = d.distance(p, c, !0, !0)), + (y = m >= 0 ? 1 : -1), + (m = Math.abs(m)), + e && + ((v = r.cvt[i]), s && Math.abs(m - v) < r.cvCutIn && (m = v)), + n && m < f && (m = f), + s && (m = r.round(m)), + h.setRelative(p, c, y * m, d), + h.touch(p), + exports.DEBUG && + console.log( + r.step, + (e ? "MIRP[" : "MDRP[") + + (t ? "M" : "m") + + (n ? ">" : "_") + + (s ? "R" : "_") + + (0 === o ? "Gr" : 1 === o ? "Bl" : 2 === o ? "Wh" : "") + + "]", + e ? i + "(" + r.cvt[i] + "," + v + ")" : "", + l, + "(d =", + g, + "->", + y * m, + ")" + ), + (r.rp1 = r.rp0), + (r.rp2 = l), + t && (r.rp0 = l); + } + (wt.prototype.exec = function (e, t) { + if ("number" != typeof t) + throw new Error("Point size is not a number!"); + if (this._errorState > 2) return; + const n = this.font; + let s = this._prepState; + if (!s || s.ppem !== t) { + let e = this._fpgmState; + if (!e) { + (Ht.prototype = _t), + (e = this._fpgmState = new Ht("fpgm", n.tables.fpgm)), + (e.funcs = []), + (e.font = n), + exports.DEBUG && + (console.log("---EXEC FPGM---"), (e.step = -1)); + try { + kt(e); + } catch (e) { + return ( + console.log("Hinting error in FPGM:" + e), + void (this._errorState = 3) + ); + } + } + (Ht.prototype = e), + (s = this._prepState = new Ht("prep", n.tables.prep)), + (s.ppem = t); + const o = n.tables.cvt; + if (o) { + const e = (s.cvt = new Array(o.length)), + r = t / n.unitsPerEm; + for (let t = 0; t < o.length; t++) e[t] = o[t] * r; + } else s.cvt = []; + exports.DEBUG && + (console.log("---EXEC PREP---"), (s.step = -1)); + try { + kt(s); + } catch (e) { + this._errorState < 2 && + console.log("Hinting error in PREP:" + e), + (this._errorState = 2); + } + } + if (!(this._errorState > 1)) + try { + return Tt(e, s); + } catch (e) { + return ( + this._errorState < 1 && + (console.log("Hinting error:" + e), + console.log("Note: further hinting errors are silenced")), + void (this._errorState = 1) + ); + } + }), + (Tt = function (e, t) { + const n = t.ppem / t.font.unitsPerEm, + s = n; + let o, + r, + a, + i = e.components; + if (((Ht.prototype = t), i)) { + const l = t.font; + (r = []), (o = []); + for (let e = 0; e < i.length; e++) { + const t = i[e], + u = l.glyphs.get(t.glyphIndex); + (a = new Ht("glyf", u.instructions)), + exports.DEBUG && + (console.log("---EXEC COMP " + e + "---"), + (a.step = -1)), + Et(u, a, n, s); + const c = Math.round(t.dx * n), + p = Math.round(t.dy * s), + f = a.gZone, + h = a.contours; + for (let e = 0; e < f.length; e++) { + const t = f[e]; + (t.xTouched = t.yTouched = !1), + (t.xo = t.x = t.x + c), + (t.yo = t.y = t.y + p); + } + const d = r.length; + r.push.apply(r, f); + for (let e = 0; e < h.length; e++) o.push(h[e] + d); + } + e.instructions && + !a.inhibitGridFit && + ((a = new Ht("glyf", e.instructions)), + (a.gZone = a.z0 = a.z1 = a.z2 = r), + (a.contours = o), + r.push( + new Nt(0, 0), + new Nt(Math.round(e.advanceWidth * n), 0) + ), + exports.DEBUG && + (console.log("---EXEC COMPOSITE---"), (a.step = -1)), + kt(a), + (r.length -= 2)); + } else + (a = new Ht("glyf", e.instructions)), + exports.DEBUG && + (console.log("---EXEC GLYPH---"), (a.step = -1)), + Et(e, a, n, s), + (r = a.gZone); + return r; + }), + (Et = function (e, t, n, s) { + const o = e.points || [], + r = o.length, + a = (t.gZone = t.z0 = t.z1 = t.z2 = []), + i = (t.contours = []); + let l, u, c; + for (let e = 0; e < r; e++) + (l = o[e]), + (a[e] = new Nt( + l.x * n, + l.y * s, + l.lastPointOfContour, + l.onCurve + )); + for (let e = 0; e < r; e++) + (l = a[e]), + u || ((u = l), i.push(e)), + l.lastPointOfContour + ? ((l.nextPointOnContour = u), + (u.prevPointOnContour = l), + (u = void 0)) + : ((c = a[e + 1]), + (l.nextPointOnContour = c), + (c.prevPointOnContour = l)); + if (!t.inhibitGridFit) { + if (exports.DEBUG) { + console.log("PROCESSING GLYPH", t.stack); + for (let e = 0; e < r; e++) console.log(e, a[e].x, a[e].y); + } + if ( + (a.push( + new Nt(0, 0), + new Nt(Math.round(e.advanceWidth * n), 0) + ), + kt(t), + (a.length -= 2), + exports.DEBUG) + ) { + console.log("FINISHED GLYPH", t.stack); + for (let e = 0; e < r; e++) console.log(e, a[e].x, a[e].y); + } + } + }), + (kt = function (e) { + let t = e.prog; + if (!t) return; + const n = t.length; + let s; + for (e.ip = 0; e.ip < n; e.ip++) { + if ((exports.DEBUG && e.step++, (s = Ut[t[e.ip]]), !s)) + throw new Error( + "unknown instruction: 0x" + Number(t[e.ip]).toString(16) + ); + s(e); + } + }), + (Ut = [ + qt.bind(void 0, At), + qt.bind(void 0, Mt), + jt.bind(void 0, At), + jt.bind(void 0, Mt), + Xt.bind(void 0, At), + Xt.bind(void 0, Mt), + Vt.bind(void 0, 0), + Vt.bind(void 0, 1), + Yt.bind(void 0, 0), + Yt.bind(void 0, 1), + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "SPVFS[]", n, s), + (e.pv = e.dpv = Gt(s, n)); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "SPVFS[]", n, s), + (e.fv = Gt(s, n)); + }, + function (e) { + const t = e.stack, + n = e.pv; + exports.DEBUG && console.log(e.step, "GPV[]"), + t.push(16384 * n.x), + t.push(16384 * n.y); + }, + function (e) { + const t = e.stack, + n = e.fv; + exports.DEBUG && console.log(e.step, "GFV[]"), + t.push(16384 * n.x), + t.push(16384 * n.y); + }, + function (e) { + (e.fv = e.pv), + exports.DEBUG && console.log(e.step, "SFVTPV[]"); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(), + o = t.pop(), + r = t.pop(), + a = t.pop(), + i = e.z0, + l = e.z1, + u = i[n], + c = i[s], + p = l[o], + f = l[r], + h = e.z2[a]; + exports.DEBUG && console.log("ISECT[], ", n, s, o, r, a); + const d = u.x, + g = u.y, + m = c.x, + y = c.y, + v = p.x, + b = p.y, + x = f.x, + S = f.y, + U = (d - m) * (b - S) - (g - y) * (v - x), + k = d * y - g * m, + T = v * S - b * x; + (h.x = (k * (v - x) - T * (d - m)) / U), + (h.y = (k * (b - S) - T * (g - y)) / U); + }, + function (e) { + (e.rp0 = e.stack.pop()), + exports.DEBUG && console.log(e.step, "SRP0[]", e.rp0); + }, + function (e) { + (e.rp1 = e.stack.pop()), + exports.DEBUG && console.log(e.step, "SRP1[]", e.rp1); + }, + function (e) { + (e.rp2 = e.stack.pop()), + exports.DEBUG && console.log(e.step, "SRP2[]", e.rp2); + }, + function (e) { + const t = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "SZP0[]", t), + (e.zp0 = t), + t) + ) { + case 0: + e.tZone || zt(e), (e.z0 = e.tZone); + break; + case 1: + e.z0 = e.gZone; + break; + default: + throw new Error("Invalid zone pointer"); + } + }, + function (e) { + const t = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "SZP1[]", t), + (e.zp1 = t), + t) + ) { + case 0: + e.tZone || zt(e), (e.z1 = e.tZone); + break; + case 1: + e.z1 = e.gZone; + break; + default: + throw new Error("Invalid zone pointer"); + } + }, + function (e) { + const t = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "SZP2[]", t), + (e.zp2 = t), + t) + ) { + case 0: + e.tZone || zt(e), (e.z2 = e.tZone); + break; + case 1: + e.z2 = e.gZone; + break; + default: + throw new Error("Invalid zone pointer"); + } + }, + function (e) { + const t = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "SZPS[]", t), + (e.zp0 = e.zp1 = e.zp2 = t), + t) + ) { + case 0: + e.tZone || zt(e), (e.z0 = e.z1 = e.z2 = e.tZone); + break; + case 1: + e.z0 = e.z1 = e.z2 = e.gZone; + break; + default: + throw new Error("Invalid zone pointer"); + } + }, + function (e) { + (e.loop = e.stack.pop()), + exports.DEBUG && console.log(e.step, "SLOOP[]", e.loop); + }, + function (e) { + exports.DEBUG && console.log(e.step, "RTG[]"), (e.round = It); + }, + function (e) { + exports.DEBUG && console.log(e.step, "RTHG[]"), + (e.round = Lt); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SMD[]", t), + (e.minDis = t / 64); + }, + function (e) { + exports.DEBUG && console.log(e.step, "ELSE[]"), Wt(e, !1); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "JMPR[]", t), + (e.ip += t - 1); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SCVTCI[]", t), + (e.cvCutIn = t / 64); + }, + void 0, + void 0, + function (e) { + const t = e.stack; + exports.DEBUG && console.log(e.step, "DUP[]"), + t.push(t[t.length - 1]); + }, + Zt, + function (e) { + exports.DEBUG && console.log(e.step, "CLEAR[]"), + (e.stack.length = 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "SWAP[]"), + t.push(n), + t.push(s); + }, + function (e) { + const t = e.stack; + exports.DEBUG && console.log(e.step, "DEPTH[]"), + t.push(t.length); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "CINDEX[]", n), + t.push(t[t.length - n]); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "MINDEX[]", n), + t.push(t.splice(t.length - n, 1)[0]); + }, + void 0, + void 0, + void 0, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "LOOPCALL[]", n, s); + const o = e.ip, + r = e.prog; + e.prog = e.funcs[n]; + for (let t = 0; t < s; t++) + kt(e), + exports.DEBUG && + console.log( + ++e.step, + t + 1 < s ? "next loopcall" : "done loopcall", + t + ); + (e.ip = o), (e.prog = r); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "CALL[]", t); + const n = e.ip, + s = e.prog; + (e.prog = e.funcs[t]), + kt(e), + (e.ip = n), + (e.prog = s), + exports.DEBUG && console.log(++e.step, "returning from", t); + }, + function (e) { + if ("fpgm" !== e.env) + throw new Error("FDEF not allowed here"); + const t = e.stack, + n = e.prog; + let s = e.ip; + const o = t.pop(), + r = s; + for ( + exports.DEBUG && console.log(e.step, "FDEF[]", o); + 45 !== n[++s]; + + ); + (e.ip = s), (e.funcs[o] = n.slice(r + 1, s)); + }, + void 0, + Qt.bind(void 0, 0), + Qt.bind(void 0, 1), + Jt.bind(void 0, At), + Jt.bind(void 0, Mt), + Kt.bind(void 0, 0), + Kt.bind(void 0, 1), + $t.bind(void 0, 0), + $t.bind(void 0, 1), + en.bind(void 0, 0), + en.bind(void 0, 1), + function (e) { + const t = e.stack; + let n = e.loop; + const s = e.fv, + o = t.pop() / 64, + r = e.z2; + for (; n--; ) { + const a = t.pop(), + i = r[a]; + exports.DEBUG && + console.log( + e.step, + (e.loop > 1 ? "loop " + (e.loop - n) + ": " : "") + + "SHPIX[]", + a, + o + ), + s.setRelative(i, i, o), + s.touch(i); + } + e.loop = 1; + }, + function (e) { + const t = e.stack, + n = e.rp1, + s = e.rp2; + let o = e.loop; + const r = e.z0[n], + a = e.z1[s], + i = e.fv, + l = e.dpv, + u = e.z2; + for (; o--; ) { + const c = t.pop(), + p = u[c]; + exports.DEBUG && + console.log( + e.step, + (e.loop > 1 ? "loop " + (e.loop - o) + ": " : "") + + "IP[]", + c, + n, + "<->", + s + ), + i.interpolate(p, r, a, l), + i.touch(p); + } + e.loop = 1; + }, + tn.bind(void 0, 0), + tn.bind(void 0, 1), + function (e) { + const t = e.stack, + n = e.rp0, + s = e.z0[n]; + let o = e.loop; + const r = e.fv, + a = e.pv, + i = e.z1; + for (; o--; ) { + const n = t.pop(), + l = i[n]; + exports.DEBUG && + console.log( + e.step, + (e.loop > 1 ? "loop " + (e.loop - o) + ": " : "") + + "ALIGNRP[]", + n + ), + r.setRelative(l, s, 0, a), + r.touch(l); + } + e.loop = 1; + }, + function (e) { + exports.DEBUG && console.log(e.step, "RTDG[]"), + (e.round = Rt); + }, + nn.bind(void 0, 0), + nn.bind(void 0, 1), + function (e) { + const t = e.prog; + let n = e.ip; + const s = e.stack, + o = t[++n]; + exports.DEBUG && console.log(e.step, "NPUSHB[]", o); + for (let e = 0; e < o; e++) s.push(t[++n]); + e.ip = n; + }, + function (e) { + let t = e.ip; + const n = e.prog, + s = e.stack, + o = n[++t]; + exports.DEBUG && console.log(e.step, "NPUSHW[]", o); + for (let e = 0; e < o; e++) { + let e = (n[++t] << 8) | n[++t]; + 32768 & e && (e = -(1 + (65535 ^ e))), s.push(e); + } + e.ip = t; + }, + function (e) { + const t = e.stack; + let n = e.store; + n || (n = e.store = []); + const s = t.pop(), + o = t.pop(); + exports.DEBUG && console.log(e.step, "WS", s, o), (n[o] = s); + }, + function (e) { + const t = e.stack, + n = e.store, + s = t.pop(); + exports.DEBUG && console.log(e.step, "RS", s); + const o = (n && n[s]) || 0; + t.push(o); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "WCVTP", n, s), + (e.cvt[s] = n / 64); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "RCVT", n), + t.push(64 * e.cvt[n]); + }, + sn.bind(void 0, 0), + sn.bind(void 0, 1), + void 0, + on.bind(void 0, 0), + on.bind(void 0, 1), + function (e) { + exports.DEBUG && console.log(e.step, "MPPEM[]"), + e.stack.push(e.ppem); + }, + void 0, + function (e) { + exports.DEBUG && console.log(e.step, "FLIPON[]"), + (e.autoFlip = !0); + }, + void 0, + void 0, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "LT[]", n, s), + t.push(s < n ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "LTEQ[]", n, s), + t.push(s <= n ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "GT[]", n, s), + t.push(s > n ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "GTEQ[]", n, s), + t.push(s >= n ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "EQ[]", n, s), + t.push(n === s ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "NEQ[]", n, s), + t.push(n !== s ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "ODD[]", n), + t.push(Math.trunc(n) % 2 ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "EVEN[]", n), + t.push(Math.trunc(n) % 2 ? 0 : 1); + }, + function (e) { + let t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "IF[]", t), + t || + (Wt(e, !0), + exports.DEBUG && console.log(e.step, "EIF[]")); + }, + function (e) { + exports.DEBUG && console.log(e.step, "EIF[]"); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "AND[]", n, s), + t.push(n && s ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "OR[]", n, s), + t.push(n || s ? 1 : 0); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "NOT[]", n), + t.push(n ? 0 : 1); + }, + rn.bind(void 0, 1), + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SDB[]", t), + (e.deltaBase = t); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SDS[]", t), + (e.deltaShift = Math.pow(0.5, t)); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "ADD[]", n, s), + t.push(s + n); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "SUB[]", n, s), + t.push(s - n); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "DIV[]", n, s), + t.push((64 * s) / n); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "MUL[]", n, s), + t.push((s * n) / 64); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "ABS[]", n), + t.push(Math.abs(n)); + }, + function (e) { + const t = e.stack; + let n = t.pop(); + exports.DEBUG && console.log(e.step, "NEG[]", n), t.push(-n); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "FLOOR[]", n), + t.push(64 * Math.floor(n / 64)); + }, + function (e) { + const t = e.stack, + n = t.pop(); + exports.DEBUG && console.log(e.step, "CEILING[]", n), + t.push(64 * Math.ceil(n / 64)); + }, + an.bind(void 0, 0), + an.bind(void 0, 1), + an.bind(void 0, 2), + an.bind(void 0, 3), + void 0, + void 0, + void 0, + void 0, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "WCVTF[]", n, s), + (e.cvt[s] = (n * e.ppem) / e.font.unitsPerEm); + }, + rn.bind(void 0, 2), + rn.bind(void 0, 3), + ln.bind(void 0, 1), + ln.bind(void 0, 2), + ln.bind(void 0, 3), + function (e) { + let t, + n = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "SROUND[]", n), + (e.round = Dt), + 192 & n) + ) { + case 0: + t = 0.5; + break; + case 64: + t = 1; + break; + case 128: + t = 2; + break; + default: + throw new Error("invalid SROUND value"); + } + switch (((e.srPeriod = t), 48 & n)) { + case 0: + e.srPhase = 0; + break; + case 16: + e.srPhase = 0.25 * t; + break; + case 32: + e.srPhase = 0.5 * t; + break; + case 48: + e.srPhase = 0.75 * t; + break; + default: + throw new Error("invalid SROUND value"); + } + (n &= 15), (e.srThreshold = 0 === n ? 0 : (n / 8 - 0.5) * t); + }, + function (e) { + let t, + n = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "S45ROUND[]", n), + (e.round = Dt), + 192 & n) + ) { + case 0: + t = Math.sqrt(2) / 2; + break; + case 64: + t = Math.sqrt(2); + break; + case 128: + t = 2 * Math.sqrt(2); + break; + default: + throw new Error("invalid S45ROUND value"); + } + switch (((e.srPeriod = t), 48 & n)) { + case 0: + e.srPhase = 0; + break; + case 16: + e.srPhase = 0.25 * t; + break; + case 32: + e.srPhase = 0.5 * t; + break; + case 48: + e.srPhase = 0.75 * t; + break; + default: + throw new Error("invalid S45ROUND value"); + } + (n &= 15), (e.srThreshold = 0 === n ? 0 : (n / 8 - 0.5) * t); + }, + void 0, + void 0, + function (e) { + exports.DEBUG && console.log(e.step, "ROFF[]"), + (e.round = Ot); + }, + void 0, + function (e) { + exports.DEBUG && console.log(e.step, "RUTG[]"), + (e.round = Bt); + }, + function (e) { + exports.DEBUG && console.log(e.step, "RDTG[]"), + (e.round = Ct); + }, + Zt, + Zt, + void 0, + void 0, + void 0, + void 0, + void 0, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SCANCTRL[]", t); + }, + un.bind(void 0, 0), + un.bind(void 0, 1), + function (e) { + const t = e.stack, + n = t.pop(); + let s = 0; + exports.DEBUG && console.log(e.step, "GETINFO[]", n), + 1 & n && (s = 35), + 32 & n && (s |= 4096), + t.push(s); + }, + void 0, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(), + o = t.pop(); + exports.DEBUG && console.log(e.step, "ROLL[]"), + t.push(s), + t.push(n), + t.push(o); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "MAX[]", n, s), + t.push(Math.max(s, n)); + }, + function (e) { + const t = e.stack, + n = t.pop(), + s = t.pop(); + exports.DEBUG && console.log(e.step, "MIN[]", n, s), + t.push(Math.min(s, n)); + }, + function (e) { + const t = e.stack.pop(); + exports.DEBUG && console.log(e.step, "SCANTYPE[]", t); + }, + function (e) { + const t = e.stack.pop(); + let n = e.stack.pop(); + switch ( + (exports.DEBUG && console.log(e.step, "INSTCTRL[]", t, n), + t) + ) { + case 1: + return void (e.inhibitGridFit = !!n); + case 2: + return void (e.ignoreCvt = !!n); + default: + throw new Error("invalid INSTCTRL[] selector"); + } + }, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + void 0, + cn.bind(void 0, 1), + cn.bind(void 0, 2), + cn.bind(void 0, 3), + cn.bind(void 0, 4), + cn.bind(void 0, 5), + cn.bind(void 0, 6), + cn.bind(void 0, 7), + cn.bind(void 0, 8), + pn.bind(void 0, 1), + pn.bind(void 0, 2), + pn.bind(void 0, 3), + pn.bind(void 0, 4), + pn.bind(void 0, 5), + pn.bind(void 0, 6), + pn.bind(void 0, 7), + pn.bind(void 0, 8), + fn.bind(void 0, 0, 0, 0, 0, 0), + fn.bind(void 0, 0, 0, 0, 0, 1), + fn.bind(void 0, 0, 0, 0, 0, 2), + fn.bind(void 0, 0, 0, 0, 0, 3), + fn.bind(void 0, 0, 0, 0, 1, 0), + fn.bind(void 0, 0, 0, 0, 1, 1), + fn.bind(void 0, 0, 0, 0, 1, 2), + fn.bind(void 0, 0, 0, 0, 1, 3), + fn.bind(void 0, 0, 0, 1, 0, 0), + fn.bind(void 0, 0, 0, 1, 0, 1), + fn.bind(void 0, 0, 0, 1, 0, 2), + fn.bind(void 0, 0, 0, 1, 0, 3), + fn.bind(void 0, 0, 0, 1, 1, 0), + fn.bind(void 0, 0, 0, 1, 1, 1), + fn.bind(void 0, 0, 0, 1, 1, 2), + fn.bind(void 0, 0, 0, 1, 1, 3), + fn.bind(void 0, 0, 1, 0, 0, 0), + fn.bind(void 0, 0, 1, 0, 0, 1), + fn.bind(void 0, 0, 1, 0, 0, 2), + fn.bind(void 0, 0, 1, 0, 0, 3), + fn.bind(void 0, 0, 1, 0, 1, 0), + fn.bind(void 0, 0, 1, 0, 1, 1), + fn.bind(void 0, 0, 1, 0, 1, 2), + fn.bind(void 0, 0, 1, 0, 1, 3), + fn.bind(void 0, 0, 1, 1, 0, 0), + fn.bind(void 0, 0, 1, 1, 0, 1), + fn.bind(void 0, 0, 1, 1, 0, 2), + fn.bind(void 0, 0, 1, 1, 0, 3), + fn.bind(void 0, 0, 1, 1, 1, 0), + fn.bind(void 0, 0, 1, 1, 1, 1), + fn.bind(void 0, 0, 1, 1, 1, 2), + fn.bind(void 0, 0, 1, 1, 1, 3), + fn.bind(void 0, 1, 0, 0, 0, 0), + fn.bind(void 0, 1, 0, 0, 0, 1), + fn.bind(void 0, 1, 0, 0, 0, 2), + fn.bind(void 0, 1, 0, 0, 0, 3), + fn.bind(void 0, 1, 0, 0, 1, 0), + fn.bind(void 0, 1, 0, 0, 1, 1), + fn.bind(void 0, 1, 0, 0, 1, 2), + fn.bind(void 0, 1, 0, 0, 1, 3), + fn.bind(void 0, 1, 0, 1, 0, 0), + fn.bind(void 0, 1, 0, 1, 0, 1), + fn.bind(void 0, 1, 0, 1, 0, 2), + fn.bind(void 0, 1, 0, 1, 0, 3), + fn.bind(void 0, 1, 0, 1, 1, 0), + fn.bind(void 0, 1, 0, 1, 1, 1), + fn.bind(void 0, 1, 0, 1, 1, 2), + fn.bind(void 0, 1, 0, 1, 1, 3), + fn.bind(void 0, 1, 1, 0, 0, 0), + fn.bind(void 0, 1, 1, 0, 0, 1), + fn.bind(void 0, 1, 1, 0, 0, 2), + fn.bind(void 0, 1, 1, 0, 0, 3), + fn.bind(void 0, 1, 1, 0, 1, 0), + fn.bind(void 0, 1, 1, 0, 1, 1), + fn.bind(void 0, 1, 1, 0, 1, 2), + fn.bind(void 0, 1, 1, 0, 1, 3), + fn.bind(void 0, 1, 1, 1, 0, 0), + fn.bind(void 0, 1, 1, 1, 0, 1), + fn.bind(void 0, 1, 1, 1, 0, 2), + fn.bind(void 0, 1, 1, 1, 0, 3), + fn.bind(void 0, 1, 1, 1, 1, 0), + fn.bind(void 0, 1, 1, 1, 1, 1), + fn.bind(void 0, 1, 1, 1, 1, 2), + fn.bind(void 0, 1, 1, 1, 1, 3), + ]); + const hn = wt; + function dn(e) { + (e = e || {}).empty || + (St( + e.familyName, + "When creating a new Font object, familyName is required." + ), + St( + e.styleName, + "When creating a new Font object, styleName is required." + ), + St( + e.unitsPerEm, + "When creating a new Font object, unitsPerEm is required." + ), + St( + e.ascender, + "When creating a new Font object, ascender is required." + ), + St( + e.descender, + "When creating a new Font object, descender is required." + ), + St( + e.descender < 0, + "Descender should be negative (e.g. -512)." + ), + (this.names = { + fontFamily: { en: e.familyName || " " }, + fontSubfamily: { en: e.styleName || " " }, + fullName: { + en: e.fullName || e.familyName + " " + e.styleName, + }, + postScriptName: { + en: e.postScriptName || e.familyName + e.styleName, + }, + designer: { en: e.designer || " " }, + designerURL: { en: e.designerURL || " " }, + manufacturer: { en: e.manufacturer || " " }, + manufacturerURL: { en: e.manufacturerURL || " " }, + license: { en: e.license || " " }, + licenseURL: { en: e.licenseURL || " " }, + version: { en: e.version || "Version 0.1" }, + description: { en: e.description || " " }, + copyright: { en: e.copyright || " " }, + trademark: { en: e.trademark || " " }, + }), + (this.unitsPerEm = e.unitsPerEm || 1e3), + (this.ascender = e.ascender), + (this.descender = e.descender), + (this.createdTimestamp = e.createdTimestamp), + (this.tables = { + os2: { + usWeightClass: e.weightClass || this.usWeightClasses.MEDIUM, + usWidthClass: e.widthClass || this.usWidthClasses.MEDIUM, + fsSelection: + e.fsSelection || this.fsSelectionValues.REGULAR, + }, + })), + (this.supported = !0), + (this.glyphs = new ce.GlyphSet(this, e.glyphs || [])), + (this.encoding = new Z(this)), + (this.position = new gt(this)), + (this.substitution = new bt(this)), + (this.tables = this.tables || {}), + Object.defineProperty(this, "hinting", { + get: function () { + return this._hinting + ? this._hinting + : "truetype" === this.outlinesFormat + ? (this._hinting = new hn(this)) + : void 0; + }, + }); + } + (dn.prototype.hasChar = function (e) { + return null !== this.encoding.charToGlyphIndex(e); + }), + (dn.prototype.charToGlyphIndex = function (e) { + return this.encoding.charToGlyphIndex(e); + }), + (dn.prototype.charToGlyph = function (e) { + const t = this.charToGlyphIndex(e); + let n = this.glyphs.get(t); + return n || (n = this.glyphs.get(0)), n; + }), + (dn.prototype.stringToGlyphs = function (e, t) { + t = t || this.defaultRenderOptions; + const n = []; + for (let t = 0; t < e.length; t += 1) { + const s = e[t]; + n.push(this.charToGlyphIndex(s)); + } + let s = n.length; + if (t.features) { + const e = + t.script || this.substitution.getDefaultScriptName(); + let o = []; + t.features.liga && + (o = o.concat( + this.substitution.getFeature("liga", e, t.language) + )), + t.features.rlig && + (o = o.concat( + this.substitution.getFeature("rlig", e, t.language) + )); + for (let e = 0; e < s; e += 1) + for (let t = 0; t < o.length; t++) { + const r = o[t], + a = r.sub, + i = a.length; + let l = 0; + for (; l < i && a[l] === n[e + l]; ) l++; + l === i && (n.splice(e, i, r.by), (s = s - i + 1)); + } + } + const o = new Array(s), + r = this.glyphs.get(0); + for (let e = 0; e < s; e += 1) + o[e] = this.glyphs.get(n[e]) || r; + return o; + }), + (dn.prototype.nameToGlyphIndex = function (e) { + return this.glyphNames.nameToGlyphIndex(e); + }), + (dn.prototype.nameToGlyph = function (e) { + const t = this.nameToGlyphIndex(e); + let n = this.glyphs.get(t); + return n || (n = this.glyphs.get(0)), n; + }), + (dn.prototype.glyphIndexToName = function (e) { + return this.glyphNames.glyphIndexToName + ? this.glyphNames.glyphIndexToName(e) + : ""; + }), + (dn.prototype.getKerningValue = function (e, t) { + return ( + (e = e.index || e), + (t = t.index || t), + this.kerningPairs[e + "," + t] || 0 + ); + }), + (dn.prototype.defaultRenderOptions = { + kerning: !0, + features: { liga: !0, rlig: !0 }, + }), + (dn.prototype.forEachGlyph = function (e, t, n, s, o, r) { + (t = void 0 !== t ? t : 0), + (n = void 0 !== n ? n : 0), + (s = void 0 !== s ? s : 72), + (o = o || this.defaultRenderOptions); + const a = (1 / this.unitsPerEm) * s, + i = this.stringToGlyphs(e, o); + let l; + if (o.kerning) { + const e = o.script || this.position.getDefaultScriptName(); + l = this.position.getKerningTables(e, o.language); + } + for (let e = 0; e < i.length; e += 1) { + const u = i[e]; + r.call(this, u, t, n, s, o), + u.advanceWidth && (t += u.advanceWidth * a), + o.kerning && + e < i.length - 1 && + (t += + (l + ? this.position.getKerningValue( + l, + u.index, + i[e + 1].index + ) + : this.getKerningValue(u, i[e + 1])) * a), + o.letterSpacing + ? (t += o.letterSpacing * s) + : o.tracking && (t += (o.tracking / 1e3) * s); + } + return t; + }), + (dn.prototype.getPath = function (e, t, n, s, o) { + const r = new u(); + return ( + this.forEachGlyph(e, t, n, s, o, function (e, t, n, s) { + const a = e.getPath(t, n, s, o, this); + r.extend(a); + }), + r + ); + }), + (dn.prototype.getPaths = function (e, t, n, s, o) { + const r = []; + return ( + this.forEachGlyph(e, t, n, s, o, function (e, t, n, s) { + const a = e.getPath(t, n, s, o, this); + r.push(a); + }), + r + ); + }), + (dn.prototype.getAdvanceWidth = function (e, t, n) { + return this.forEachGlyph(e, 0, 0, t, n, function () {}); + }), + (dn.prototype.draw = function (e, t, n, s, o, r) { + this.getPath(t, n, s, o, r).draw(e); + }), + (dn.prototype.drawPoints = function (e, t, n, s, o, r) { + this.forEachGlyph(t, n, s, o, r, function (t, n, s, o) { + t.drawPoints(e, n, s, o); + }); + }), + (dn.prototype.drawMetrics = function (e, t, n, s, o, r) { + this.forEachGlyph(t, n, s, o, r, function (t, n, s, o) { + t.drawMetrics(e, n, s, o); + }); + }), + (dn.prototype.getEnglishName = function (e) { + const t = this.names[e]; + if (t) return t.en; + }), + (dn.prototype.validate = function () { + const e = [], + t = this; + function n(t, n) { + t || e.push(n); + } + function s(e) { + const s = t.getEnglishName(e); + n( + s && s.trim().length > 0, + "No English " + e + " specified." + ); + } + s("fontFamily"), + s("weightName"), + s("manufacturer"), + s("copyright"), + s("version"), + n(this.unitsPerEm > 0, "No unitsPerEm specified."); + }), + (dn.prototype.toTables = function () { + return lt(this); + }), + (dn.prototype.toBuffer = function () { + return ( + console.warn( + "Font.toBuffer is deprecated. Use Font.toArrayBuffer instead." + ), + this.toArrayBuffer() + ); + }), + (dn.prototype.toArrayBuffer = function () { + const e = this.toTables().encode(), + t = new ArrayBuffer(e.length), + n = new Uint8Array(t); + for (let t = 0; t < e.length; t++) n[t] = e[t]; + return t; + }), + (dn.prototype.download = function (e) { + const t = this.getEnglishName("fontFamily"), + s = this.getEnglishName("fontSubfamily"); + e = e || t.replace(/\s/g, "") + "-" + s + ".otf"; + const o = this.toArrayBuffer(); + if ("undefined" != typeof window) + (window.requestFileSystem = + window.requestFileSystem || window.webkitRequestFileSystem), + window.requestFileSystem( + window.TEMPORARY, + o.byteLength, + function (t) { + t.root.getFile(e, { create: !0 }, function (e) { + e.createWriter(function (t) { + const n = new DataView(o), + s = new Blob([n], { type: "font/opentype" }); + t.write(s), + t.addEventListener( + "writeend", + function () { + location.href = e.toURL(); + }, + !1 + ); + }); + }); + }, + function (e) { + throw new Error(e.name + ": " + e.message); + } + ); + else { + const t = n(89), + s = (function (e) { + const t = new Buffer(e.byteLength), + n = new Uint8Array(e); + for (let e = 0; e < t.length; ++e) t[e] = n[e]; + return t; + })(o); + t.writeFileSync(e, s); + } + }), + (dn.prototype.fsSelectionValues = { + ITALIC: 1, + UNDERSCORE: 2, + NEGATIVE: 4, + OUTLINED: 8, + STRIKEOUT: 16, + BOLD: 32, + REGULAR: 64, + USER_TYPO_METRICS: 128, + WWS: 256, + OBLIQUE: 512, + }), + (dn.prototype.usWidthClasses = { + ULTRA_CONDENSED: 1, + EXTRA_CONDENSED: 2, + CONDENSED: 3, + SEMI_CONDENSED: 4, + MEDIUM: 5, + SEMI_EXPANDED: 6, + EXPANDED: 7, + EXTRA_EXPANDED: 8, + ULTRA_EXPANDED: 9, + }), + (dn.prototype.usWeightClasses = { + THIN: 100, + EXTRA_LIGHT: 200, + LIGHT: 300, + NORMAL: 400, + MEDIUM: 500, + SEMI_BOLD: 600, + BOLD: 700, + EXTRA_BOLD: 800, + BLACK: 900, + }); + const gn = dn; + function mn(e, t) { + const n = JSON.stringify(e); + let s = 256; + for (let e in t) { + let o = parseInt(e); + if (o && !(o < 256)) { + if (JSON.stringify(t[e]) === n) return o; + s <= o && (s = o + 1); + } + } + return (t[s] = e), s; + } + function yn(e, t, n) { + const s = mn(t.name, n); + return [ + { name: "tag_" + e, type: "TAG", value: t.tag }, + { + name: "minValue_" + e, + type: "FIXED", + value: t.minValue << 16, + }, + { + name: "defaultValue_" + e, + type: "FIXED", + value: t.defaultValue << 16, + }, + { + name: "maxValue_" + e, + type: "FIXED", + value: t.maxValue << 16, + }, + { name: "flags_" + e, type: "USHORT", value: 0 }, + { name: "nameID_" + e, type: "USHORT", value: s }, + ]; + } + function vn(e, t, n) { + const s = {}, + o = new z.Parser(e, t); + return ( + (s.tag = o.parseTag()), + (s.minValue = o.parseFixed()), + (s.defaultValue = o.parseFixed()), + (s.maxValue = o.parseFixed()), + o.skip("uShort", 1), + (s.name = n[o.parseUShort()] || {}), + s + ); + } + function bn(e, t, n, s) { + const o = [ + { name: "nameID_" + e, type: "USHORT", value: mn(t.name, s) }, + { name: "flags_" + e, type: "USHORT", value: 0 }, + ]; + for (let s = 0; s < n.length; ++s) { + const r = n[s].tag; + o.push({ + name: "axis_" + e + " " + r, + type: "FIXED", + value: t.coordinates[r] << 16, + }); + } + return o; + } + function xn(e, t, n, s) { + const o = {}, + r = new z.Parser(e, t); + (o.name = s[r.parseUShort()] || {}), + r.skip("uShort", 1), + (o.coordinates = {}); + for (let e = 0; e < n.length; ++e) + o.coordinates[n[e].tag] = r.parseFixed(); + return o; + } + const Sn = { + make: function (e, t) { + const n = new M.Table("fvar", [ + { name: "version", type: "ULONG", value: 65536 }, + { name: "offsetToData", type: "USHORT", value: 0 }, + { name: "countSizePairs", type: "USHORT", value: 2 }, + { name: "axisCount", type: "USHORT", value: e.axes.length }, + { name: "axisSize", type: "USHORT", value: 20 }, + { + name: "instanceCount", + type: "USHORT", + value: e.instances.length, + }, + { + name: "instanceSize", + type: "USHORT", + value: 4 + 4 * e.axes.length, + }, + ]); + n.offsetToData = n.sizeOf(); + for (let s = 0; s < e.axes.length; s++) + n.fields = n.fields.concat(yn(s, e.axes[s], t)); + for (let s = 0; s < e.instances.length; s++) + n.fields = n.fields.concat( + bn(s, e.instances[s], e.axes, t) + ); + return n; + }, + parse: function (e, t, n) { + const s = new z.Parser(e, t), + o = s.parseULong(); + f.argument(65536 === o, "Unsupported fvar table version."); + const r = s.parseOffset16(); + s.skip("uShort", 1); + const a = s.parseUShort(), + i = s.parseUShort(), + l = s.parseUShort(), + u = s.parseUShort(), + c = []; + for (let s = 0; s < a; s++) c.push(vn(e, t + r + s * i, n)); + const p = [], + h = t + r + a * i; + for (let t = 0; t < l; t++) p.push(xn(e, h + t * u, c, n)); + return { axes: c, instances: p }; + }, }, - ], - }, - SCREENOPTION: { - items: [ - { - text: Scratch.translate("terminal size"), - value: "size", + Un = new Array(10); + (Un[1] = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(); + return 1 === t + ? { + posFormat: 1, + coverage: this.parsePointer(_.coverage), + value: this.parseValueRecord(), + } + : 2 === t + ? { + posFormat: 2, + coverage: this.parsePointer(_.coverage), + values: this.parseValueRecordList(), + } + : void f.assert( + !1, + "0x" + + e.toString(16) + + ": GPOS lookup type 1 format must be 1 or 2." + ); + }), + (Un[2] = function () { + const e = this.offset + this.relativeOffset, + t = this.parseUShort(), + n = this.parsePointer(_.coverage), + s = this.parseUShort(), + o = this.parseUShort(); + if (1 === t) + return { + posFormat: t, + coverage: n, + valueFormat1: s, + valueFormat2: o, + pairSets: this.parseList( + _.pointer( + _.list(function () { + return { + secondGlyph: this.parseUShort(), + value1: this.parseValueRecord(s), + value2: this.parseValueRecord(o), + }; + }) + ) + ), + }; + if (2 === t) { + const e = this.parsePointer(_.classDef), + r = this.parsePointer(_.classDef), + a = this.parseUShort(), + i = this.parseUShort(); + return { + posFormat: t, + coverage: n, + valueFormat1: s, + valueFormat2: o, + classDef1: e, + classDef2: r, + class1Count: a, + class2Count: i, + classRecords: this.parseList( + a, + _.list(i, function () { + return { + value1: this.parseValueRecord(s), + value2: this.parseValueRecord(o), + }; + }) + ), + }; + } + f.assert( + !1, + "0x" + + e.toString(16) + + ": GPOS lookup type 2 format must be 1 or 2." + ); + }), + (Un[3] = function () { + return { error: "GPOS Lookup 3 not supported" }; + }), + (Un[4] = function () { + return { error: "GPOS Lookup 4 not supported" }; + }), + (Un[5] = function () { + return { error: "GPOS Lookup 5 not supported" }; + }), + (Un[6] = function () { + return { error: "GPOS Lookup 6 not supported" }; + }), + (Un[7] = function () { + return { error: "GPOS Lookup 7 not supported" }; + }), + (Un[8] = function () { + return { error: "GPOS Lookup 8 not supported" }; + }), + (Un[9] = function () { + return { error: "GPOS Lookup 9 not supported" }; + }); + const kn = new Array(10), + Tn = { + parse: function (e, t) { + const n = new _(e, (t = t || 0)), + s = n.parseVersion(1); + return ( + f.argument( + 1 === s || 1.1 === s, + "Unsupported GPOS table version " + s + ), + 1 === s + ? { + version: s, + scripts: n.parseScriptList(), + features: n.parseFeatureList(), + lookups: n.parseLookupList(Un), + } + : { + version: s, + scripts: n.parseScriptList(), + features: n.parseFeatureList(), + lookups: n.parseLookupList(Un), + variations: n.parseFeatureVariationsList(), + } + ); + }, + make: function (e) { + return new M.Table("GPOS", [ + { name: "version", type: "ULONG", value: 65536 }, + { + name: "scripts", + type: "TABLE", + value: new M.ScriptList(e.scripts), + }, + { + name: "features", + type: "TABLE", + value: new M.FeatureList(e.features), + }, + { + name: "lookups", + type: "TABLE", + value: new M.LookupList(e.lookups, kn), + }, + ]); + }, }, - { - text: Scratch.translate("cursor position"), - value: "cursor", + En = { + parse: function (e, t) { + const n = new z.Parser(e, t), + s = n.parseUShort(); + if (0 === s) + return (function (e) { + const t = {}; + e.skip("uShort"); + const n = e.parseUShort(); + f.argument( + 0 === n, + "Unsupported kern sub-table version." + ), + e.skip("uShort", 2); + const s = e.parseUShort(); + e.skip("uShort", 3); + for (let n = 0; n < s; n += 1) { + const n = e.parseUShort(), + s = e.parseUShort(), + o = e.parseShort(); + t[n + "," + s] = o; + } + return t; + })(n); + if (1 === s) + return (function (e) { + const t = {}; + e.skip("uShort"), + e.parseULong() > 1 && + console.warn( + "Only the first kern subtable is supported." + ), + e.skip("uLong"); + const n = 255 & e.parseUShort(); + if ((e.skip("uShort"), 0 === n)) { + const n = e.parseUShort(); + e.skip("uShort", 3); + for (let s = 0; s < n; s += 1) { + const n = e.parseUShort(), + s = e.parseUShort(), + o = e.parseShort(); + t[n + "," + s] = o; + } + } + return t; + })(n); + throw new Error( + "Unsupported kern table version (" + s + ")." + ); + }, }, - ], + wn = { + parse: function (e, t, n, s) { + const o = new z.Parser(e, t), + r = s ? o.parseUShort : o.parseULong, + a = []; + for (let e = 0; e < n + 1; e += 1) { + let e = r.call(o); + s && (e *= 2), a.push(e); + } + return a; + }, + }; + function On(e, t) { + n(89).readFile(e, function (e, n) { + if (e) return t(e.message); + t(null, xt(n)); + }); + } + function In(e, t) { + const n = new XMLHttpRequest(); + n.open("get", e, !0), + (n.responseType = "arraybuffer"), + (n.onload = function () { + return n.response + ? t(null, n.response) + : t("Font could not be loaded: " + n.statusText); + }), + (n.onerror = function () { + t("Font could not be loaded"); + }), + n.send(); + } + function Rn(e, t) { + const n = []; + let s = 12; + for (let o = 0; o < t; o += 1) { + const t = z.getTag(e, s), + o = z.getULong(e, s + 4), + r = z.getULong(e, s + 8), + a = z.getULong(e, s + 12); + n.push({ + tag: t, + checksum: o, + offset: r, + length: a, + compression: !1, + }), + (s += 16); + } + return n; + } + function Ln(e, t) { + if ("WOFF" === t.compression) { + const n = new Uint8Array( + e.buffer, + t.offset + 2, + t.compressedLength - 2 + ), + s = new Uint8Array(t.length); + if ((o()(n, s), s.byteLength !== t.length)) + throw new Error( + "Decompression error: " + + t.tag + + " decompressed length doesn't match recorded length" + ); + return { data: new DataView(s.buffer, 0), offset: 0 }; + } + return { data: e, offset: t.offset }; + } + function Bn(e) { + let t, n; + const s = new gn({ empty: !0 }), + o = new DataView(e, 0); + let r, + a = []; + const i = z.getTag(o, 0); + if ( + i === String.fromCharCode(0, 1, 0, 0) || + "true" === i || + "typ1" === i + ) + (s.outlinesFormat = "truetype"), + (r = z.getUShort(o, 4)), + (a = Rn(o, r)); + else if ("OTTO" === i) + (s.outlinesFormat = "cff"), + (r = z.getUShort(o, 4)), + (a = Rn(o, r)); + else { + if ("wOFF" !== i) + throw new Error("Unsupported OpenType signature " + i); + { + const e = z.getTag(o, 4); + if (e === String.fromCharCode(0, 1, 0, 0)) + s.outlinesFormat = "truetype"; + else { + if ("OTTO" !== e) + throw new Error("Unsupported OpenType flavor " + i); + s.outlinesFormat = "cff"; + } + (r = z.getUShort(o, 12)), + (a = (function (e, t) { + const n = []; + let s = 44; + for (let o = 0; o < t; o += 1) { + const t = z.getTag(e, s), + o = z.getULong(e, s + 4), + r = z.getULong(e, s + 8), + a = z.getULong(e, s + 12); + let i; + (i = r < a && "WOFF"), + n.push({ + tag: t, + offset: o, + compression: i, + compressedLength: r, + length: a, + }), + (s += 20); + } + return n; + })(o, r)); + } + } + let l, u, c, p, f, h, d, g, m, y, v; + for (let e = 0; e < r; e += 1) { + const r = a[e]; + let i; + switch (r.tag) { + case "cmap": + (i = Ln(o, r)), + (s.tables.cmap = q.parse(i.data, i.offset)), + (s.encoding = new Q(s.tables.cmap)); + break; + case "cvt ": + (i = Ln(o, r)), + (v = new z.Parser(i.data, i.offset)), + (s.tables.cvt = v.parseShortList(r.length / 2)); + break; + case "fvar": + u = r; + break; + case "fpgm": + (i = Ln(o, r)), + (v = new z.Parser(i.data, i.offset)), + (s.tables.fpgm = v.parseByteList(r.length)); + break; + case "head": + (i = Ln(o, r)), + (s.tables.head = Le.parse(i.data, i.offset)), + (s.unitsPerEm = s.tables.head.unitsPerEm), + (t = s.tables.head.indexToLocFormat); + break; + case "hhea": + (i = Ln(o, r)), + (s.tables.hhea = Be.parse(i.data, i.offset)), + (s.ascender = s.tables.hhea.ascender), + (s.descender = s.tables.hhea.descender), + (s.numberOfHMetrics = s.tables.hhea.numberOfHMetrics); + break; + case "hmtx": + h = r; + break; + case "ltag": + (i = Ln(o, r)), (n = De.parse(i.data, i.offset)); + break; + case "maxp": + (i = Ln(o, r)), + (s.tables.maxp = Me.parse(i.data, i.offset)), + (s.numGlyphs = s.tables.maxp.numGlyphs); + break; + case "name": + m = r; + break; + case "OS/2": + (i = Ln(o, r)), (s.tables.os2 = Ze.parse(i.data, i.offset)); + break; + case "post": + (i = Ln(o, r)), + (s.tables.post = Qe.parse(i.data, i.offset)), + (s.glyphNames = new K(s.tables.post)); + break; + case "prep": + (i = Ln(o, r)), + (v = new z.Parser(i.data, i.offset)), + (s.tables.prep = v.parseByteList(r.length)); + break; + case "glyf": + c = r; + break; + case "loca": + g = r; + break; + case "CFF ": + l = r; + break; + case "kern": + d = r; + break; + case "GPOS": + p = r; + break; + case "GSUB": + f = r; + break; + case "meta": + y = r; + } + } + const b = Ln(o, m); + if ( + ((s.tables.name = Ve.parse(b.data, b.offset, n)), + (s.names = s.tables.name), + c && g) + ) { + const e = 0 === t, + n = Ln(o, g), + r = wn.parse(n.data, n.offset, s.numGlyphs, e), + a = Ln(o, c); + s.glyphs = re.parse(a.data, a.offset, r, s); + } else { + if (!l) + throw new Error( + "Font doesn't contain TrueType or CFF outlines." + ); + { + const e = Ln(o, l); + Re.parse(e.data, e.offset, s); + } + } + const x = Ln(o, h); + if ( + (Ce.parse( + x.data, + x.offset, + s.numberOfHMetrics, + s.numGlyphs, + s.glyphs + ), + (function (e) { + let t; + const n = e.tables.cmap.glyphIndexMap, + s = Object.keys(n); + for (let o = 0; o < s.length; o += 1) { + const r = s[o], + a = n[r]; + (t = e.glyphs.get(a)), t.addUnicode(parseInt(r)); + } + for (let n = 0; n < e.glyphs.length; n += 1) + (t = e.glyphs.get(n)), + e.cffEncoding + ? e.isCIDFont + ? (t.name = "gid" + n) + : (t.name = e.cffEncoding.charset[n]) + : e.glyphNames.names && + (t.name = e.glyphNames.glyphIndexToName(n)); + })(s), + d) + ) { + const e = Ln(o, d); + s.kerningPairs = En.parse(e.data, e.offset); + } else s.kerningPairs = {}; + if (p) { + const e = Ln(o, p); + s.tables.gpos = Tn.parse(e.data, e.offset); + } + if (f) { + const e = Ln(o, f); + s.tables.gsub = et.parse(e.data, e.offset); + } + if (u) { + const e = Ln(o, u); + s.tables.fvar = Sn.parse(e.data, e.offset, s.names); + } + if (y) { + const e = Ln(o, y); + (s.tables.meta = tt.parse(e.data, e.offset)), + (s.metas = s.tables.meta); + } + return s; + } + function Cn(e, t) { + ("undefined" == typeof window ? On : In)(e, function (e, n) { + if (e) return t(e); + let s; + try { + s = Bn(n); + } catch (e) { + return t(e, null); + } + return t(null, s); + }); + } + function Dn(e) { + return Bn(xt(n(89).readFileSync(e))); + } }, - NEWLINE: { - items: [ - { - text: Scratch.translate("newline"), - value: "newline", - }, - { - text: Scratch.translate("no newline"), - value: "none", - }, - ], + 896: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(978); + class o extends s.Writable { + constructor() { + super(...arguments), + (this.offset = 0), + (this._waiters = []), + (this._closed = !1); + } + _write(e, t, n) { + let s = 0; + const o = () => { + for (; this._waiters.length > 0; ) { + const t = this._waiters[0]; + if (this._buffer) { + const o = this._buffer.size - this._buffer.offset; + if (!(o + e.length >= t.size)) { + if (!t.skip) { + const t = Buffer.alloc(o + e.length); + this._buffer.buf.copy( + t, + 0, + this._buffer.offset, + this._buffer.size + ), + e.copy(t, o, 0, e.length), + (this._buffer.buf = t); + } + (this._buffer.offset = 0), + (this._buffer.size = o + e.length), + n(); + break; + } + if (t.skip) (this._buffer = void 0), t.resolve(); + else { + const n = Math.min(o, t.size), + s = Buffer.alloc(t.size); + this._buffer.buf.copy( + s, + 0, + this._buffer.offset, + this._buffer.offset + n + ), + e.copy(s, n, 0, t.size - n), + t.resolve(s); + } + if ( + ((this.offset += t.size), + this._waiters.shift(), + (this._buffer = void 0), + o + e.length === t.size) + ) { + n(); + break; + } + s += t.size - o; + } else { + if (!(e.length - s >= t.size)) { + (this._buffer = { + buf: t.skip ? void 0 : e.slice(s), + offset: 0, + size: e.length - s, + }), + (s = e.length), + n(); + break; + } + if ( + (t.skip + ? t.resolve() + : t.resolve(e.slice(s, s + t.size)), + (this.offset += t.size), + this._waiters.shift(), + (s += t.size), + e.length === s) + ) { + n(); + break; + } + } + } + this._processTrigger = e.length - s > 0 ? o : void 0; + }; + o(); + } + _destroy(e, t) { + this._processTrigger = void 0; + for (const t of this._waiters) + t.reject(e || new Error("stream destroyed")); + (this._waiters = []), (this._closed = !0); + } + _final(e) { + this._processTrigger = void 0; + for (const e of this._waiters) + e.reject(new Error("not enough data in stream")); + (this._waiters = []), (this._closed = !0); + } + read(e) { + return new Promise((t, n) => { + this._closed && n(new Error("stream is closed")), + this._waiters.push({ + resolve: t, + reject: n, + size: e, + skip: !1, + }), + this._processTrigger && this._processTrigger(); + }); + } + skip(e) { + return new Promise((t, n) => { + this._closed && n(new Error("stream is closed")), + this._waiters.push({ + resolve: t, + reject: n, + size: e, + skip: !0, + }), + this._processTrigger && this._processTrigger(); + }); + } + } + function r() { + return new o(); + } + (e.exports = Object.assign(r, { default: r })), (t.default = r); }, - }, - }; - } - _initalizeXterm() { - const parentElement = runtime.renderer.canvas.parentElement; - runtime.renderer.canvas.style.position = "relative"; - this.element = document.createElement("div"); - this.element.style.position = "absolute"; - this.element.style.top = "0"; - this.element.style.left = "0"; - this.element.style.width = "100%"; - this.element.style.height = "100%"; - this.element.style.margin = "0"; - this.element.style.display = "grid"; - const _resize = runtime.renderer.resize; - runtime.renderer.resize = (width, height) => { - _resize.call(runtime.renderer, width, height); - this.fitAddon.fit(); + 311: (e) => { + function t() { + (this.table = new Uint16Array(16)), + (this.trans = new Uint16Array(288)); + } + function n(e, n) { + (this.source = e), + (this.sourceIndex = 0), + (this.tag = 0), + (this.bitcount = 0), + (this.dest = n), + (this.destLen = 0), + (this.ltree = new t()), + (this.dtree = new t()); + } + var s = new t(), + o = new t(), + r = new Uint8Array(30), + a = new Uint16Array(30), + i = new Uint8Array(30), + l = new Uint16Array(30), + u = new Uint8Array([ + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, + 15, + ]), + c = new t(), + p = new Uint8Array(320); + function f(e, t, n, s) { + var o, r; + for (o = 0; o < n; ++o) e[o] = 0; + for (o = 0; o < 30 - n; ++o) e[o + n] = (o / n) | 0; + for (r = s, o = 0; o < 30; ++o) (t[o] = r), (r += 1 << e[o]); + } + var h = new Uint16Array(16); + function d(e, t, n, s) { + var o, r; + for (o = 0; o < 16; ++o) e.table[o] = 0; + for (o = 0; o < s; ++o) e.table[t[n + o]]++; + for (e.table[0] = 0, r = 0, o = 0; o < 16; ++o) + (h[o] = r), (r += e.table[o]); + for (o = 0; o < s; ++o) t[n + o] && (e.trans[h[t[n + o]]++] = o); + } + function g(e) { + e.bitcount-- || + ((e.tag = e.source[e.sourceIndex++]), (e.bitcount = 7)); + var t = 1 & e.tag; + return (e.tag >>>= 1), t; + } + function m(e, t, n) { + if (!t) return n; + for (; e.bitcount < 24; ) + (e.tag |= e.source[e.sourceIndex++] << e.bitcount), + (e.bitcount += 8); + var s = e.tag & (65535 >>> (16 - t)); + return (e.tag >>>= t), (e.bitcount -= t), s + n; + } + function y(e, t) { + for (; e.bitcount < 24; ) + (e.tag |= e.source[e.sourceIndex++] << e.bitcount), + (e.bitcount += 8); + var n = 0, + s = 0, + o = 0, + r = e.tag; + do { + (s = 2 * s + (1 & r)), + (r >>>= 1), + ++o, + (n += t.table[o]), + (s -= t.table[o]); + } while (s >= 0); + return (e.tag = r), (e.bitcount -= o), t.trans[n + s]; + } + function v(e, t, n) { + var s, o, r, a, i, l; + for ( + s = m(e, 5, 257), o = m(e, 5, 1), r = m(e, 4, 4), a = 0; + a < 19; + ++a + ) + p[a] = 0; + for (a = 0; a < r; ++a) { + var f = m(e, 3, 0); + p[u[a]] = f; + } + for (d(c, p, 0, 19), i = 0; i < s + o; ) { + var h = y(e, c); + switch (h) { + case 16: + var g = p[i - 1]; + for (l = m(e, 2, 3); l; --l) p[i++] = g; + break; + case 17: + for (l = m(e, 3, 3); l; --l) p[i++] = 0; + break; + case 18: + for (l = m(e, 7, 11); l; --l) p[i++] = 0; + break; + default: + p[i++] = h; + } + } + d(t, p, 0, s), d(n, p, s, o); + } + function b(e, t, n) { + for (;;) { + var s, + o, + u, + c, + p = y(e, t); + if (256 === p) return 0; + if (p < 256) e.dest[e.destLen++] = p; + else + for ( + s = m(e, r[(p -= 257)], a[p]), + o = y(e, n), + c = u = e.destLen - m(e, i[o], l[o]); + c < u + s; + ++c + ) + e.dest[e.destLen++] = e.dest[c]; + } + } + function x(e) { + for (var t, n; e.bitcount > 8; ) + e.sourceIndex--, (e.bitcount -= 8); + if ( + (t = + 256 * (t = e.source[e.sourceIndex + 1]) + + e.source[e.sourceIndex]) !== + (65535 & + ~( + 256 * e.source[e.sourceIndex + 3] + + e.source[e.sourceIndex + 2] + )) + ) + return -3; + for (e.sourceIndex += 4, n = t; n; --n) + e.dest[e.destLen++] = e.source[e.sourceIndex++]; + return (e.bitcount = 0), 0; + } + !(function (e, t) { + var n; + for (n = 0; n < 7; ++n) e.table[n] = 0; + for ( + e.table[7] = 24, e.table[8] = 152, e.table[9] = 112, n = 0; + n < 24; + ++n + ) + e.trans[n] = 256 + n; + for (n = 0; n < 144; ++n) e.trans[24 + n] = n; + for (n = 0; n < 8; ++n) e.trans[168 + n] = 280 + n; + for (n = 0; n < 112; ++n) e.trans[176 + n] = 144 + n; + for (n = 0; n < 5; ++n) t.table[n] = 0; + for (t.table[5] = 32, n = 0; n < 32; ++n) t.trans[n] = n; + })(s, o), + f(r, a, 4, 3), + f(i, l, 2, 1), + (r[28] = 0), + (a[28] = 258), + (e.exports = function (e, t) { + var r, + a, + i = new n(e, t); + do { + switch (((r = g(i)), m(i, 2, 0))) { + case 0: + a = x(i); + break; + case 1: + a = b(i, s, o); + break; + case 2: + v(i, i.ltree, i.dtree), (a = b(i, i.ltree, i.dtree)); + break; + default: + a = -3; + } + if (0 !== a) throw new Error("Data error"); + } while (!r); + return i.destLen < i.dest.length + ? "function" == typeof i.dest.slice + ? i.dest.slice(0, i.destLen) + : i.dest.subarray(0, i.destLen) + : i.dest; + }); + }, + 371: (e) => { + "use strict"; + e.exports = function (e) { + e.prototype[Symbol.iterator] = function* () { + for (let e = this.head; e; e = e.next) yield e.value; + }; + }; + }, + 411: (e, t, n) => { + "use strict"; + function s(e) { + var t = this; + if ( + (t instanceof s || (t = new s()), + (t.tail = null), + (t.head = null), + (t.length = 0), + e && "function" == typeof e.forEach) + ) + e.forEach(function (e) { + t.push(e); + }); + else if (arguments.length > 0) + for (var n = 0, o = arguments.length; n < o; n++) + t.push(arguments[n]); + return t; + } + function o(e, t, n) { + var s = + t === e.head ? new i(n, null, t, e) : new i(n, t, t.next, e); + return ( + null === s.next && (e.tail = s), + null === s.prev && (e.head = s), + e.length++, + s + ); + } + function r(e, t) { + (e.tail = new i(t, e.tail, null, e)), + e.head || (e.head = e.tail), + e.length++; + } + function a(e, t) { + (e.head = new i(t, null, e.head, e)), + e.tail || (e.tail = e.head), + e.length++; + } + function i(e, t, n, s) { + if (!(this instanceof i)) return new i(e, t, n, s); + (this.list = s), + (this.value = e), + t ? ((t.next = this), (this.prev = t)) : (this.prev = null), + n ? ((n.prev = this), (this.next = n)) : (this.next = null); + } + (e.exports = s), + (s.Node = i), + (s.create = s), + (s.prototype.removeNode = function (e) { + if (e.list !== this) + throw new Error( + "removing node which does not belong to this list" + ); + var t = e.next, + n = e.prev; + return ( + t && (t.prev = n), + n && (n.next = t), + e === this.head && (this.head = t), + e === this.tail && (this.tail = n), + e.list.length--, + (e.next = null), + (e.prev = null), + (e.list = null), + t + ); + }), + (s.prototype.unshiftNode = function (e) { + if (e !== this.head) { + e.list && e.list.removeNode(e); + var t = this.head; + (e.list = this), + (e.next = t), + t && (t.prev = e), + (this.head = e), + this.tail || (this.tail = e), + this.length++; + } + }), + (s.prototype.pushNode = function (e) { + if (e !== this.tail) { + e.list && e.list.removeNode(e); + var t = this.tail; + (e.list = this), + (e.prev = t), + t && (t.next = e), + (this.tail = e), + this.head || (this.head = e), + this.length++; + } + }), + (s.prototype.push = function () { + for (var e = 0, t = arguments.length; e < t; e++) + r(this, arguments[e]); + return this.length; + }), + (s.prototype.unshift = function () { + for (var e = 0, t = arguments.length; e < t; e++) + a(this, arguments[e]); + return this.length; + }), + (s.prototype.pop = function () { + if (this.tail) { + var e = this.tail.value; + return ( + (this.tail = this.tail.prev), + this.tail ? (this.tail.next = null) : (this.head = null), + this.length--, + e + ); + } + }), + (s.prototype.shift = function () { + if (this.head) { + var e = this.head.value; + return ( + (this.head = this.head.next), + this.head ? (this.head.prev = null) : (this.tail = null), + this.length--, + e + ); + } + }), + (s.prototype.forEach = function (e, t) { + t = t || this; + for (var n = this.head, s = 0; null !== n; s++) + e.call(t, n.value, s, this), (n = n.next); + }), + (s.prototype.forEachReverse = function (e, t) { + t = t || this; + for (var n = this.tail, s = this.length - 1; null !== n; s--) + e.call(t, n.value, s, this), (n = n.prev); + }), + (s.prototype.get = function (e) { + for (var t = 0, n = this.head; null !== n && t < e; t++) + n = n.next; + if (t === e && null !== n) return n.value; + }), + (s.prototype.getReverse = function (e) { + for (var t = 0, n = this.tail; null !== n && t < e; t++) + n = n.prev; + if (t === e && null !== n) return n.value; + }), + (s.prototype.map = function (e, t) { + t = t || this; + for (var n = new s(), o = this.head; null !== o; ) + n.push(e.call(t, o.value, this)), (o = o.next); + return n; + }), + (s.prototype.mapReverse = function (e, t) { + t = t || this; + for (var n = new s(), o = this.tail; null !== o; ) + n.push(e.call(t, o.value, this)), (o = o.prev); + return n; + }), + (s.prototype.reduce = function (e, t) { + var n, + s = this.head; + if (arguments.length > 1) n = t; + else { + if (!this.head) + throw new TypeError( + "Reduce of empty list with no initial value" + ); + (s = this.head.next), (n = this.head.value); + } + for (var o = 0; null !== s; o++) + (n = e(n, s.value, o)), (s = s.next); + return n; + }), + (s.prototype.reduceReverse = function (e, t) { + var n, + s = this.tail; + if (arguments.length > 1) n = t; + else { + if (!this.tail) + throw new TypeError( + "Reduce of empty list with no initial value" + ); + (s = this.tail.prev), (n = this.tail.value); + } + for (var o = this.length - 1; null !== s; o--) + (n = e(n, s.value, o)), (s = s.prev); + return n; + }), + (s.prototype.toArray = function () { + for ( + var e = new Array(this.length), t = 0, n = this.head; + null !== n; + t++ + ) + (e[t] = n.value), (n = n.next); + return e; + }), + (s.prototype.toArrayReverse = function () { + for ( + var e = new Array(this.length), t = 0, n = this.tail; + null !== n; + t++ + ) + (e[t] = n.value), (n = n.prev); + return e; + }), + (s.prototype.slice = function (e, t) { + (t = t || this.length) < 0 && (t += this.length), + (e = e || 0) < 0 && (e += this.length); + var n = new s(); + if (t < e || t < 0) return n; + e < 0 && (e = 0), t > this.length && (t = this.length); + for (var o = 0, r = this.head; null !== r && o < e; o++) + r = r.next; + for (; null !== r && o < t; o++, r = r.next) n.push(r.value); + return n; + }), + (s.prototype.sliceReverse = function (e, t) { + (t = t || this.length) < 0 && (t += this.length), + (e = e || 0) < 0 && (e += this.length); + var n = new s(); + if (t < e || t < 0) return n; + e < 0 && (e = 0), t > this.length && (t = this.length); + for ( + var o = this.length, r = this.tail; + null !== r && o > t; + o-- + ) + r = r.prev; + for (; null !== r && o > e; o--, r = r.prev) n.push(r.value); + return n; + }), + (s.prototype.splice = function (e, t, ...n) { + e > this.length && (e = this.length - 1), + e < 0 && (e = this.length + e); + for (var s = 0, r = this.head; null !== r && s < e; s++) + r = r.next; + var a = []; + for (s = 0; r && s < t; s++) + a.push(r.value), (r = this.removeNode(r)); + for ( + null === r && (r = this.tail), + r !== this.head && r !== this.tail && (r = r.prev), + s = 0; + s < n.length; + s++ + ) + r = o(this, r, n[s]); + return a; + }), + (s.prototype.reverse = function () { + for ( + var e = this.head, t = this.tail, n = e; + null !== n; + n = n.prev + ) { + var s = n.prev; + (n.prev = n.next), (n.next = s); + } + return (this.head = t), (this.tail = e), this; + }); + try { + n(371)(s); + } catch (e) {} + }, + 109: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }); + const s = n(98), + o = n(104); + let r; + t.default = async function (e, t) { + var n, i; + if (!r) { + if ("undefined" != typeof navigator && "fonts" in navigator) { + try { + const e = await (null === + (i = (n = navigator.permissions).request) || void 0 === i + ? void 0 + : i.call(n, { name: "local-fonts" })); + if (e && "granted" !== e.state) + throw new Error( + "Permission to access local fonts not granted." + ); + } catch (e) { + if ("TypeError" !== e.name) throw e; + } + const e = {}; + try { + const t = await navigator.fonts.query(); + for (const n of t) + e.hasOwnProperty(n.family) || (e[n.family] = []), + e[n.family].push(n); + r = Promise.resolve(e); + } catch (e) { + console.error(e.name, e.message); + } + } else if ( + "undefined" != typeof window && + "queryLocalFonts" in window + ) { + const e = {}; + try { + const t = await window.queryLocalFonts(); + for (const n of t) + e.hasOwnProperty(n.family) || (e[n.family] = []), + e[n.family].push(n); + r = Promise.resolve(e); + } catch (e) { + console.error(e.name, e.message); + } + } + r || (r = Promise.resolve({})); + } + const l = await r; + for (const n of (0, o.default)(e)) { + if (a.includes(n)) return; + if (l.hasOwnProperty(n) && l[n].length > 0) { + const e = l[n][0]; + if ("blob" in e) { + const n = await e.blob(), + o = await n.arrayBuffer(); + return (0, s.loadBuffer)(o, { cacheSize: t }); + } + return; + } + } + }; + const a = [ + "serif", + "sans-serif", + "cursive", + "fantasy", + "monospace", + "system-ui", + "emoji", + "math", + "fangsong", + ]; + }, + 833: (e, t, n) => { + "use strict"; + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.enableLigatures = void 0); + const s = n(109); + t.enableLigatures = function (e, t = []) { + let n, + o, + r, + a = 0; + return e.registerCharacterJoiner((i) => { + const l = e.options.fontFamily; + if (l && (0 === a || n !== l)) { + (o = void 0), (a = 1), (n = l); + const t = n; + (0, s.default)(t, 1e5) + .then((n) => { + t === e.options.fontFamily && + ((a = 2), (o = n), n && e.refresh(0, e.rows - 1)); + }) + .catch((n) => { + t === e.options.fontFamily && + ((a = 3), + "debug" === e.options.logLevel && + console.debug( + r, + new Error("Failure while loading font") + ), + (o = void 0), + (r = n)); + }); + } + return o && 2 === a + ? o.findLigatureRanges(i).map((e) => [e[0], e[1]]) + : (function (e, t) { + const n = []; + for (let s = 0; s < e.length; s++) + for (let o = 0; o < t.length; o++) + if (e.startsWith(t[o], s)) { + n.push([s, s + t[o].length]), + (s += t[o].length - 1); + break; + } + return n; + })(i, t); + }); + }; + }, + 104: (e, t) => { + "use strict"; + function n(e, t) { + let n = "", + s = !1; + for (; e.offset < e.input.length; ) { + const r = e.input[e.offset++]; + if (s) + /[\dA-Fa-f]/.test(r) + ? (e.offset--, (n += o(e))) + : "\n" !== r && (n += r), + (s = !1); + else + switch (r) { + case t: + return n; + case "\\": + s = !0; + break; + default: + n += r; + } + } + throw new Error("Unterminated string"); + } + function s(e) { + let t = "", + n = !1; + for (; e.offset < e.input.length; ) { + const s = e.input[e.offset++]; + if (n) + /[\dA-Fa-f]/.test(s) ? (e.offset--, (t += o(e))) : (t += s), + (n = !1); + else + switch (s) { + case "\\": + n = !0; + break; + case ",": + return t; + default: + /\s/.test(s) ? t.endsWith(" ") || (t += " ") : (t += s); + } + } + return t; + } + function o(e) { + let t = ""; + for (; e.offset < e.input.length; ) { + const n = e.input[e.offset++]; + if (/\s/.test(n)) return r(t); + if (t.length >= 6 || !/[\dA-Fa-f]/.test(n)) + return e.offset--, r(t); + t += n; + } + return r(t); + } + function r(e) { + return String.fromCodePoint(parseInt(e, 16)); + } + Object.defineProperty(t, "__esModule", { value: !0 }), + (t.default = function (e) { + if ("string" != typeof e) + throw new Error("Font family must be a string"); + const t = { input: e, offset: 0 }, + o = []; + let r = ""; + for (; t.offset < t.input.length; ) { + const e = t.input[t.offset++]; + switch (e) { + case "'": + case '"': + r += n(t, e); + break; + case ",": + o.push(r), (r = ""); + break; + default: + /\s/.test(e) || + (t.offset--, (r += s(t)), o.push(r), (r = "")); + } + } + return o; + }); + }, + 89: (t) => { + "use strict"; + t.exports = e; + }, + 56: (e) => { + "use strict"; + e.exports = t; + }, + 978: (e) => { + "use strict"; + e.exports = s; + }, + 269: (e) => { + "use strict"; + e.exports = n; + }, + 82: () => {}, + 456: () => {}, + }, + r = {}; + function a(e) { + var t = r[e]; + if (void 0 !== t) return t.exports; + var n = (r[e] = { exports: {} }); + return o[e].call(n.exports, n, n.exports, a), n.exports; + } + (a.n = (e) => { + var t = e && e.__esModule ? () => e.default : () => e; + return a.d(t, { a: t }), t; + }), + (a.d = (e, t) => { + for (var n in t) + a.o(t, n) && + !a.o(e, n) && + Object.defineProperty(e, n, { enumerable: !0, get: t[n] }); + }), + (a.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)), + (a.r = (e) => { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), + Object.defineProperty(e, "__esModule", { value: !0 }); + }); + var i = {}; + return ( + (() => { + "use strict"; + var e = i; + Object.defineProperty(e, "__esModule", { value: !0 }), + (e.LigaturesAddon = void 0); + const t = a(833); + e.LigaturesAddon = class { + constructor(e) { + this._fallbackLigatures = ( + (null == e ? void 0 : e.fallbackLigatures) || [ + "<--", + "<---", + "<<-", + "<-", + "->", + "->>", + "--\x3e", + "---\x3e", + "<==", + "<===", + "<<=", + "<=", + "=>", + "=>>", + "==>", + "===>", + ">=", + ">>=", + "<->", + "<--\x3e", + "<---\x3e", + "<----\x3e", + "<=>", + "<==>", + "<===>", + "<====>", + "--------\x3e", + "<~~", + "<~", + "~>", + "~~>", + "::", + ":::", + "==", + "!=", + "===", + "!==", + ":=", + ":-", + ":+", + "<*", + "<*>", + "*>", + "<|", + "<|>", + "|>", + "+:", + "-:", + "=:", + ":>", + "++", + "+++", + "\x3c!--", + "\x3c!---", + "<***>", + ] + ).sort((e, t) => t.length - e.length); + } + activate(e) { + (this._terminal = e), + (this._characterJoinerId = (0, t.enableLigatures)( + e, + this._fallbackLigatures + )); + } + dispose() { + var e; + void 0 !== this._characterJoinerId && + (null === (e = this._terminal) || + void 0 === e || + e.deregisterCharacterJoiner(this._characterJoinerId), + (this._characterJoinerId = void 0)); + } + }; + })(), + i + ); + })() + ); + //# sourceMappingURL=addon-ligatures.js.map + (() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __commonJS = (cb, mod) => + function __require() { + return ( + mod || + (0, cb[__getOwnPropNames(cb)[0]])( + (mod = { exports: {} }).exports, + mod + ), + mod.exports + ); }; - parentElement.appendChild(this.element); - this.terminal.open(this.element); - this.justInitialized = true; - this.terminal._core.viewport.scrollBarWidth = 0; - this.fitAddon.fit(); - } - changeVisibility({ STATUS }) { - STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); - switch (STATUS) { - case "show": { - if (this.element) { - this.element.style.display = "grid"; - } else { - // initialize the element lazily. - this._initalizeXterm(); + var __copyProps = (to, from, except, desc) => { + if ((from && typeof from === "object") || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { + get: () => from[key], + enumerable: + !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, + }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => ( + (target = mod != null ? __create(__getProtoOf(mod)) : {}), + __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule + ? __defProp(target, "default", { value: mod, enumerable: true }) + : target, + mod + ) + ); + + // node_modules/@xterm/xterm/lib/xterm.js + var require_xterm = __commonJS({ + "node_modules/@xterm/xterm/lib/xterm.js"(exports, module) { + !(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]; } - break; - } - case "hide": { - if (this.element) { - this.element.style.display = "none"; + })(globalThis, () => + (() => { + "use strict"; + var e = { + 4567: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.AccessibilityManager = void 0); + const n = i2(9042), + o = i2(9924), + a = i2(844), + h = i2(4725), + c = i2(2585), + l = i2(3656); + let d = (t2.AccessibilityManager = class extends ( + a.Disposable + ) { + constructor(e3, t3, i3, s3) { + super(), + (this._terminal = e3), + (this._coreBrowserService = i3), + (this._renderService = s3), + (this._rowColumns = /* @__PURE__ */ new WeakMap()), + (this._liveRegionLineCount = 0), + (this._charsToConsume = []), + (this._charsToAnnounce = ""), + (this._accessibilityContainer = + this._coreBrowserService.mainDocument.createElement( + "div" + )), + this._accessibilityContainer.classList.add( + "xterm-accessibility" + ), + (this._rowContainer = + this._coreBrowserService.mainDocument.createElement( + "div" + )), + this._rowContainer.setAttribute("role", "list"), + this._rowContainer.classList.add( + "xterm-accessibility-tree" + ), + (this._rowElements = []); + for (let e4 = 0; e4 < this._terminal.rows; e4++) + (this._rowElements[e4] = + this._createAccessibilityTreeNode()), + this._rowContainer.appendChild(this._rowElements[e4]); + if ( + ((this._topBoundaryFocusListener = (e4) => + this._handleBoundaryFocus(e4, 0)), + (this._bottomBoundaryFocusListener = (e4) => + this._handleBoundaryFocus(e4, 1)), + this._rowElements[0].addEventListener( + "focus", + this._topBoundaryFocusListener + ), + this._rowElements[ + this._rowElements.length - 1 + ].addEventListener( + "focus", + this._bottomBoundaryFocusListener + ), + this._refreshRowsDimensions(), + this._accessibilityContainer.appendChild( + this._rowContainer + ), + (this._liveRegion = + this._coreBrowserService.mainDocument.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((e4) => + this._handleResize(e4.rows) + ) + ), + this.register( + this._terminal.onRender((e4) => + this._refreshRows(e4.start, e4.end) + ) + ), + this.register( + this._terminal.onScroll(() => this._refreshRows()) + ), + this.register( + this._terminal.onA11yChar((e4) => + this._handleChar(e4) + ) + ), + this.register( + this._terminal.onLineFeed(() => + this._handleChar("\n") + ) + ), + this.register( + this._terminal.onA11yTab((e4) => this._handleTab(e4)) + ), + this.register( + this._terminal.onKey((e4) => this._handleKey(e4.key)) + ), + this.register( + this._terminal.onBlur(() => this._clearLiveRegion()) + ), + this.register( + this._renderService.onDimensionsChange(() => + this._refreshRowsDimensions() + ) + ), + this.register( + (0, l.addDisposableDomListener)( + document, + "selectionchange", + () => this._handleSelectionChange() + ) + ), + this.register( + this._coreBrowserService.onDprChange(() => + this._refreshRowsDimensions() + ) + ), + this._refreshRows(), + this.register( + (0, a.toDisposable)(() => { + this._accessibilityContainer.remove(), + (this._rowElements.length = 0); + }) + ); + } + _handleTab(e3) { + for (let t3 = 0; t3 < e3; t3++) this._handleChar(" "); + } + _handleChar(e3) { + this._liveRegionLineCount < 21 && + (this._charsToConsume.length > 0 + ? this._charsToConsume.shift() !== e3 && + (this._charsToAnnounce += e3) + : (this._charsToAnnounce += e3), + "\n" === e3 && + (this._liveRegionLineCount++, + 21 === this._liveRegionLineCount && + (this._liveRegion.textContent += n.tooMuchOutput))); + } + _clearLiveRegion() { + (this._liveRegion.textContent = ""), + (this._liveRegionLineCount = 0); + } + _handleKey(e3) { + this._clearLiveRegion(), + /\p{Control}/u.test(e3) || + this._charsToConsume.push(e3); + } + _refreshRows(e3, t3) { + this._liveRegionDebouncer.refresh( + e3, + t3, + this._terminal.rows + ); + } + _renderRows(e3, t3) { + const i3 = this._terminal.buffer, + s3 = i3.lines.length.toString(); + for (let r2 = e3; r2 <= t3; r2++) { + const e4 = i3.lines.get(i3.ydisp + r2), + t4 = [], + n2 = + e4?.translateToString(true, void 0, void 0, t4) || + "", + o2 = (i3.ydisp + r2 + 1).toString(), + a2 = this._rowElements[r2]; + a2 && + (0 === n2.length + ? ((a2.innerText = "\xA0"), + this._rowColumns.set(a2, [0, 1])) + : ((a2.textContent = n2), + this._rowColumns.set(a2, t4)), + a2.setAttribute("aria-posinset", o2), + a2.setAttribute("aria-setsize", s3)); + } + this._announceCharacters(); + } + _announceCharacters() { + 0 !== this._charsToAnnounce.length && + ((this._liveRegion.textContent += + this._charsToAnnounce), + (this._charsToAnnounce = "")); + } + _handleBoundaryFocus(e3, t3) { + const i3 = e3.target, + s3 = + this._rowElements[ + 0 === t3 ? 1 : this._rowElements.length - 2 + ]; + if ( + i3.getAttribute("aria-posinset") === + (0 === t3 + ? "1" + : `${this._terminal.buffer.lines.length}`) + ) + return; + if (e3.relatedTarget !== s3) return; + let r2, n2; + if ( + (0 === t3 + ? ((r2 = i3), + (n2 = this._rowElements.pop()), + this._rowContainer.removeChild(n2)) + : ((r2 = this._rowElements.shift()), + (n2 = i3), + this._rowContainer.removeChild(r2)), + r2.removeEventListener( + "focus", + this._topBoundaryFocusListener + ), + n2.removeEventListener( + "focus", + this._bottomBoundaryFocusListener + ), + 0 === t3) + ) { + const e4 = this._createAccessibilityTreeNode(); + this._rowElements.unshift(e4), + this._rowContainer.insertAdjacentElement( + "afterbegin", + e4 + ); + } else { + const e4 = this._createAccessibilityTreeNode(); + this._rowElements.push(e4), + this._rowContainer.appendChild(e4); + } + this._rowElements[0].addEventListener( + "focus", + this._topBoundaryFocusListener + ), + this._rowElements[ + this._rowElements.length - 1 + ].addEventListener( + "focus", + this._bottomBoundaryFocusListener + ), + this._terminal.scrollLines(0 === t3 ? -1 : 1), + this._rowElements[ + 0 === t3 ? 1 : this._rowElements.length - 2 + ].focus(), + e3.preventDefault(), + e3.stopImmediatePropagation(); + } + _handleSelectionChange() { + if (0 === this._rowElements.length) return; + const e3 = document.getSelection(); + if (!e3) return; + if (e3.isCollapsed) + return void ( + this._rowContainer.contains(e3.anchorNode) && + this._terminal.clearSelection() + ); + if (!e3.anchorNode || !e3.focusNode) + return void console.error( + "anchorNode and/or focusNode are null" + ); + let t3 = { node: e3.anchorNode, offset: e3.anchorOffset }, + i3 = { node: e3.focusNode, offset: e3.focusOffset }; + if ( + ((t3.node.compareDocumentPosition(i3.node) & + Node.DOCUMENT_POSITION_PRECEDING || + (t3.node === i3.node && t3.offset > i3.offset)) && + ([t3, i3] = [i3, t3]), + t3.node.compareDocumentPosition(this._rowElements[0]) & + (Node.DOCUMENT_POSITION_CONTAINED_BY | + Node.DOCUMENT_POSITION_FOLLOWING) && + (t3 = { + node: this._rowElements[0].childNodes[0], + offset: 0, + }), + !this._rowContainer.contains(t3.node)) + ) + return; + const s3 = this._rowElements.slice(-1)[0]; + if ( + (i3.node.compareDocumentPosition(s3) & + (Node.DOCUMENT_POSITION_CONTAINED_BY | + Node.DOCUMENT_POSITION_PRECEDING) && + (i3 = { + node: s3, + offset: s3.textContent?.length ?? 0, + }), + !this._rowContainer.contains(i3.node)) + ) + return; + const r2 = ({ node: e4, offset: t4 }) => { + const i4 = e4 instanceof Text ? e4.parentNode : e4; + let s4 = + parseInt(i4?.getAttribute("aria-posinset"), 10) - 1; + if (isNaN(s4)) + return ( + console.warn("row is invalid. Race condition?"), + null + ); + const r3 = this._rowColumns.get(i4); + if (!r3) + return ( + console.warn("columns is null. Race condition?"), + null + ); + let n3 = + t4 < r3.length ? r3[t4] : r3.slice(-1)[0] + 1; + return ( + n3 >= this._terminal.cols && (++s4, (n3 = 0)), + { row: s4, column: n3 } + ); + }, + n2 = r2(t3), + o2 = r2(i3); + if (n2 && o2) { + if ( + n2.row > o2.row || + (n2.row === o2.row && n2.column >= o2.column) + ) + throw new Error("invalid range"); + this._terminal.select( + n2.column, + n2.row, + (o2.row - n2.row) * this._terminal.cols - + n2.column + + o2.column + ); + } + } + _handleResize(e3) { + this._rowElements[ + this._rowElements.length - 1 + ].removeEventListener( + "focus", + this._bottomBoundaryFocusListener + ); + for ( + let e4 = this._rowContainer.children.length; + e4 < this._terminal.rows; + e4++ + ) + (this._rowElements[e4] = + this._createAccessibilityTreeNode()), + this._rowContainer.appendChild(this._rowElements[e4]); + for (; this._rowElements.length > e3; ) + this._rowContainer.removeChild(this._rowElements.pop()); + this._rowElements[ + this._rowElements.length - 1 + ].addEventListener( + "focus", + this._bottomBoundaryFocusListener + ), + this._refreshRowsDimensions(); + } + _createAccessibilityTreeNode() { + const e3 = + this._coreBrowserService.mainDocument.createElement( + "div" + ); + return ( + e3.setAttribute("role", "listitem"), + (e3.tabIndex = -1), + this._refreshRowDimensions(e3), + e3 + ); + } + _refreshRowsDimensions() { + if (this._renderService.dimensions.css.cell.height) { + (this._accessibilityContainer.style.width = `${this._renderService.dimensions.css.canvas.width}px`), + this._rowElements.length !== this._terminal.rows && + this._handleResize(this._terminal.rows); + for (let e3 = 0; e3 < this._terminal.rows; e3++) + this._refreshRowDimensions(this._rowElements[e3]); + } + } + _refreshRowDimensions(e3) { + e3.style.height = `${this._renderService.dimensions.css.cell.height}px`; + } + }); + t2.AccessibilityManager = d = s2( + [ + r(1, c.IInstantiationService), + r(2, h.ICoreBrowserService), + r(3, h.IRenderService), + ], + d + ); + }, + 3614: (e2, t2) => { + function i2(e3) { + return e3.replace(/\r?\n/g, "\r"); + } + function s2(e3, t3) { + return t3 ? "\x1B[200~" + e3 + "\x1B[201~" : e3; + } + function r(e3, t3, r2, n2) { + (e3 = s2( + (e3 = i2(e3)), + r2.decPrivateModes.bracketedPasteMode && + true !== n2.rawOptions.ignoreBracketedPasteMode + )), + r2.triggerDataEvent(e3, true), + (t3.value = ""); + } + function n(e3, t3, i3) { + const s3 = i3.getBoundingClientRect(), + r2 = e3.clientX - s3.left - 10, + n2 = e3.clientY - s3.top - 10; + (t3.style.width = "20px"), + (t3.style.height = "20px"), + (t3.style.left = `${r2}px`), + (t3.style.top = `${n2}px`), + (t3.style.zIndex = "1000"), + t3.focus(); + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.rightClickHandler = + t2.moveTextAreaUnderMouseCursor = + t2.paste = + t2.handlePasteEvent = + t2.copyHandler = + t2.bracketTextForPaste = + t2.prepareTextForTerminal = + void 0), + (t2.prepareTextForTerminal = i2), + (t2.bracketTextForPaste = s2), + (t2.copyHandler = function (e3, t3) { + e3.clipboardData && + e3.clipboardData.setData( + "text/plain", + t3.selectionText + ), + e3.preventDefault(); + }), + (t2.handlePasteEvent = function (e3, t3, i3, s3) { + e3.stopPropagation(), + e3.clipboardData && + r(e3.clipboardData.getData("text/plain"), t3, i3, s3); + }), + (t2.paste = r), + (t2.moveTextAreaUnderMouseCursor = n), + (t2.rightClickHandler = function (e3, t3, i3, s3, r2) { + n(e3, t3, i3), + r2 && s3.rightClickSelect(e3), + (t3.value = s3.selectionText), + t3.select(); + }); + }, + 7239: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ColorContrastCache = void 0); + const s2 = i2(1505); + t2.ColorContrastCache = class { + constructor() { + (this._color = new s2.TwoKeyMap()), + (this._css = new s2.TwoKeyMap()); + } + setCss(e3, t3, i3) { + this._css.set(e3, t3, i3); + } + getCss(e3, t3) { + return this._css.get(e3, t3); + } + setColor(e3, t3, i3) { + this._color.set(e3, t3, i3); + } + getColor(e3, t3) { + return this._color.get(e3, t3); + } + clear() { + this._color.clear(), this._css.clear(); + } + }; + }, + 3656: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.addDisposableDomListener = void 0), + (t2.addDisposableDomListener = function (e3, t3, i2, s2) { + e3.addEventListener(t3, i2, s2); + let r = false; + return { + dispose: () => { + r || ((r = true), e3.removeEventListener(t3, i2, s2)); + }, + }; + }); + }, + 3551: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Linkifier = void 0); + const n = i2(3656), + o = i2(8460), + a = i2(844), + h = i2(2585), + c = i2(4725); + let l = (t2.Linkifier = class extends a.Disposable { + get currentLink() { + return this._currentLink; + } + constructor(e3, t3, i3, s3, r2) { + super(), + (this._element = e3), + (this._mouseService = t3), + (this._renderService = i3), + (this._bufferService = s3), + (this._linkProviderService = r2), + (this._linkCacheDisposables = []), + (this._isMouseOut = true), + (this._wasResized = false), + (this._activeLine = -1), + (this._onShowLinkUnderline = this.register( + new o.EventEmitter() + )), + (this.onShowLinkUnderline = + this._onShowLinkUnderline.event), + (this._onHideLinkUnderline = this.register( + new o.EventEmitter() + )), + (this.onHideLinkUnderline = + this._onHideLinkUnderline.event), + this.register( + (0, a.getDisposeArrayDisposable)( + this._linkCacheDisposables + ) + ), + this.register( + (0, a.toDisposable)(() => { + (this._lastMouseEvent = void 0), + this._activeProviderReplies?.clear(); + }) + ), + this.register( + this._bufferService.onResize(() => { + this._clearCurrentLink(), (this._wasResized = true); + }) + ), + this.register( + (0, n.addDisposableDomListener)( + this._element, + "mouseleave", + () => { + (this._isMouseOut = true), + this._clearCurrentLink(); + } + ) + ), + this.register( + (0, n.addDisposableDomListener)( + this._element, + "mousemove", + this._handleMouseMove.bind(this) + ) + ), + this.register( + (0, n.addDisposableDomListener)( + this._element, + "mousedown", + this._handleMouseDown.bind(this) + ) + ), + this.register( + (0, n.addDisposableDomListener)( + this._element, + "mouseup", + this._handleMouseUp.bind(this) + ) + ); + } + _handleMouseMove(e3) { + this._lastMouseEvent = e3; + const t3 = this._positionFromMouseEvent( + e3, + this._element, + this._mouseService + ); + if (!t3) return; + this._isMouseOut = false; + const i3 = e3.composedPath(); + for (let e4 = 0; e4 < i3.length; e4++) { + const t4 = i3[e4]; + if (t4.classList.contains("xterm")) break; + if (t4.classList.contains("xterm-hover")) return; + } + (this._lastBufferCell && + t3.x === this._lastBufferCell.x && + t3.y === this._lastBufferCell.y) || + (this._handleHover(t3), (this._lastBufferCell = t3)); + } + _handleHover(e3) { + if (this._activeLine !== e3.y || this._wasResized) + return ( + this._clearCurrentLink(), + this._askForLink(e3, false), + void (this._wasResized = false) + ); + (this._currentLink && + this._linkAtPosition(this._currentLink.link, e3)) || + (this._clearCurrentLink(), this._askForLink(e3, true)); + } + _askForLink(e3, t3) { + (this._activeProviderReplies && t3) || + (this._activeProviderReplies?.forEach((e4) => { + e4?.forEach((e5) => { + e5.link.dispose && e5.link.dispose(); + }); + }), + (this._activeProviderReplies = + /* @__PURE__ */ new Map()), + (this._activeLine = e3.y)); + let i3 = false; + for (const [ + s3, + r2, + ] of this._linkProviderService.linkProviders.entries()) + if (t3) { + const t4 = this._activeProviderReplies?.get(s3); + t4 && + (i3 = this._checkLinkProviderResult(s3, e3, i3)); + } else + r2.provideLinks(e3.y, (t4) => { + if (this._isMouseOut) return; + const r3 = t4?.map((e4) => ({ link: e4 })); + this._activeProviderReplies?.set(s3, r3), + (i3 = this._checkLinkProviderResult(s3, e3, i3)), + this._activeProviderReplies?.size === + this._linkProviderService.linkProviders + .length && + this._removeIntersectingLinks( + e3.y, + this._activeProviderReplies + ); + }); + } + _removeIntersectingLinks(e3, t3) { + const i3 = /* @__PURE__ */ new Set(); + for (let s3 = 0; s3 < t3.size; s3++) { + const r2 = t3.get(s3); + if (r2) + for (let t4 = 0; t4 < r2.length; t4++) { + const s4 = r2[t4], + n2 = + s4.link.range.start.y < e3 + ? 0 + : s4.link.range.start.x, + o2 = + s4.link.range.end.y > e3 + ? this._bufferService.cols + : s4.link.range.end.x; + for (let e4 = n2; e4 <= o2; e4++) { + if (i3.has(e4)) { + r2.splice(t4--, 1); + break; + } + i3.add(e4); + } + } + } + } + _checkLinkProviderResult(e3, t3, i3) { + if (!this._activeProviderReplies) return i3; + const s3 = this._activeProviderReplies.get(e3); + let r2 = false; + for (let t4 = 0; t4 < e3; t4++) + (this._activeProviderReplies.has(t4) && + !this._activeProviderReplies.get(t4)) || + (r2 = true); + if (!r2 && s3) { + const e4 = s3.find((e5) => + this._linkAtPosition(e5.link, t3) + ); + e4 && ((i3 = true), this._handleNewLink(e4)); + } + if ( + this._activeProviderReplies.size === + this._linkProviderService.linkProviders.length && + !i3 + ) + for ( + let e4 = 0; + e4 < this._activeProviderReplies.size; + e4++ + ) { + const s4 = this._activeProviderReplies + .get(e4) + ?.find((e5) => this._linkAtPosition(e5.link, t3)); + if (s4) { + (i3 = true), this._handleNewLink(s4); + break; + } + } + return i3; + } + _handleMouseDown() { + this._mouseDownLink = this._currentLink; + } + _handleMouseUp(e3) { + if (!this._currentLink) return; + const t3 = this._positionFromMouseEvent( + e3, + this._element, + this._mouseService + ); + t3 && + this._mouseDownLink === this._currentLink && + this._linkAtPosition(this._currentLink.link, t3) && + this._currentLink.link.activate( + e3, + this._currentLink.link.text + ); + } + _clearCurrentLink(e3, t3) { + this._currentLink && + this._lastMouseEvent && + (!e3 || + !t3 || + (this._currentLink.link.range.start.y >= e3 && + this._currentLink.link.range.end.y <= t3)) && + (this._linkLeave( + this._element, + this._currentLink.link, + this._lastMouseEvent + ), + (this._currentLink = void 0), + (0, a.disposeArray)(this._linkCacheDisposables)); + } + _handleNewLink(e3) { + if (!this._lastMouseEvent) return; + const t3 = this._positionFromMouseEvent( + this._lastMouseEvent, + this._element, + this._mouseService + ); + t3 && + this._linkAtPosition(e3.link, t3) && + ((this._currentLink = e3), + (this._currentLink.state = { + decorations: { + underline: + void 0 === e3.link.decorations || + e3.link.decorations.underline, + pointerCursor: + void 0 === e3.link.decorations || + e3.link.decorations.pointerCursor, + }, + isHovered: true, + }), + this._linkHover( + this._element, + e3.link, + this._lastMouseEvent + ), + (e3.link.decorations = {}), + Object.defineProperties(e3.link.decorations, { + pointerCursor: { + get: () => + this._currentLink?.state?.decorations + .pointerCursor, + set: (e4) => { + this._currentLink?.state && + this._currentLink.state.decorations + .pointerCursor !== e4 && + ((this._currentLink.state.decorations.pointerCursor = + e4), + this._currentLink.state.isHovered && + this._element.classList.toggle( + "xterm-cursor-pointer", + e4 + )); + }, + }, + underline: { + get: () => + this._currentLink?.state?.decorations.underline, + set: (t4) => { + this._currentLink?.state && + this._currentLink?.state?.decorations + .underline !== t4 && + ((this._currentLink.state.decorations.underline = + t4), + this._currentLink.state.isHovered && + this._fireUnderlineEvent(e3.link, t4)); + }, + }, + }), + this._linkCacheDisposables.push( + this._renderService.onRenderedViewportChange((e4) => { + if (!this._currentLink) return; + const t4 = + 0 === e4.start + ? 0 + : e4.start + + 1 + + this._bufferService.buffer.ydisp, + i3 = + this._bufferService.buffer.ydisp + 1 + e4.end; + if ( + this._currentLink.link.range.start.y >= t4 && + this._currentLink.link.range.end.y <= i3 && + (this._clearCurrentLink(t4, i3), + this._lastMouseEvent) + ) { + const e5 = this._positionFromMouseEvent( + this._lastMouseEvent, + this._element, + this._mouseService + ); + e5 && this._askForLink(e5, false); + } + }) + )); + } + _linkHover(e3, t3, i3) { + this._currentLink?.state && + ((this._currentLink.state.isHovered = true), + this._currentLink.state.decorations.underline && + this._fireUnderlineEvent(t3, true), + this._currentLink.state.decorations.pointerCursor && + e3.classList.add("xterm-cursor-pointer")), + t3.hover && t3.hover(i3, t3.text); + } + _fireUnderlineEvent(e3, t3) { + const i3 = e3.range, + s3 = this._bufferService.buffer.ydisp, + r2 = this._createLinkUnderlineEvent( + i3.start.x - 1, + i3.start.y - s3 - 1, + i3.end.x, + i3.end.y - s3 - 1, + void 0 + ); + (t3 + ? this._onShowLinkUnderline + : this._onHideLinkUnderline + ).fire(r2); + } + _linkLeave(e3, t3, i3) { + this._currentLink?.state && + ((this._currentLink.state.isHovered = false), + this._currentLink.state.decorations.underline && + this._fireUnderlineEvent(t3, false), + this._currentLink.state.decorations.pointerCursor && + e3.classList.remove("xterm-cursor-pointer")), + t3.leave && t3.leave(i3, t3.text); + } + _linkAtPosition(e3, t3) { + const i3 = + e3.range.start.y * this._bufferService.cols + + e3.range.start.x, + s3 = + e3.range.end.y * this._bufferService.cols + + e3.range.end.x, + r2 = t3.y * this._bufferService.cols + t3.x; + return i3 <= r2 && r2 <= s3; + } + _positionFromMouseEvent(e3, t3, i3) { + const s3 = i3.getCoords( + e3, + t3, + this._bufferService.cols, + this._bufferService.rows + ); + if (s3) + return { + x: s3[0], + y: s3[1] + this._bufferService.buffer.ydisp, + }; + } + _createLinkUnderlineEvent(e3, t3, i3, s3, r2) { + return { + x1: e3, + y1: t3, + x2: i3, + y2: s3, + cols: this._bufferService.cols, + fg: r2, + }; + } + }); + t2.Linkifier = l = s2( + [ + r(1, c.IMouseService), + r(2, c.IRenderService), + r(3, h.IBufferService), + r(4, c.ILinkProviderService), + ], + l + ); + }, + 9042: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.tooMuchOutput = t2.promptLabel = void 0), + (t2.promptLabel = "Terminal input"), + (t2.tooMuchOutput = + "Too much output to announce, navigate to rows manually to read"); + }, + 3730: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.OscLinkProvider = void 0); + const n = i2(511), + o = i2(2585); + let a = (t2.OscLinkProvider = class { + constructor(e3, t3, i3) { + (this._bufferService = e3), + (this._optionsService = t3), + (this._oscLinkService = i3); + } + provideLinks(e3, t3) { + const i3 = this._bufferService.buffer.lines.get(e3 - 1); + if (!i3) return void t3(void 0); + const s3 = [], + r2 = this._optionsService.rawOptions.linkHandler, + o2 = new n.CellData(), + a2 = i3.getTrimmedLength(); + let c = -1, + l = -1, + d = false; + for (let t4 = 0; t4 < a2; t4++) + if (-1 !== l || i3.hasContent(t4)) { + if ( + (i3.loadCell(t4, o2), + o2.hasExtendedAttrs() && o2.extended.urlId) + ) { + if (-1 === l) { + (l = t4), (c = o2.extended.urlId); + continue; + } + d = o2.extended.urlId !== c; + } else -1 !== l && (d = true); + if (d || (-1 !== l && t4 === a2 - 1)) { + const i4 = this._oscLinkService.getLinkData(c)?.uri; + if (i4) { + const n2 = { + start: { x: l + 1, y: e3 }, + end: { + x: t4 + (d || t4 !== a2 - 1 ? 0 : 1), + y: e3, + }, + }; + let o3 = false; + if (!r2?.allowNonHttpProtocols) + try { + const e4 = new URL(i4); + ["http:", "https:"].includes(e4.protocol) || + (o3 = true); + } catch (e4) { + o3 = true; + } + o3 || + s3.push({ + text: i4, + range: n2, + activate: (e4, t5) => + r2 ? r2.activate(e4, t5, n2) : h(0, t5), + hover: (e4, t5) => r2?.hover?.(e4, t5, n2), + leave: (e4, t5) => r2?.leave?.(e4, t5, n2), + }); + } + (d = false), + o2.hasExtendedAttrs() && o2.extended.urlId + ? ((l = t4), (c = o2.extended.urlId)) + : ((l = -1), (c = -1)); + } + } + t3(s3); + } + }); + function h(e3, t3) { + if ( + confirm(`Do you want to navigate to ${t3}? + +WARNING: This link could potentially be dangerous`) + ) { + const e4 = window.open(); + if (e4) { + try { + e4.opener = null; + } catch {} + e4.location.href = t3; + } else + console.warn( + "Opening link blocked as opener could not be cleared" + ); + } + } + t2.OscLinkProvider = a = s2( + [ + r(0, o.IBufferService), + r(1, o.IOptionsService), + r(2, o.IOscLinkService), + ], + a + ); + }, + 6193: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.RenderDebouncer = void 0), + (t2.RenderDebouncer = class { + constructor(e3, t3) { + (this._renderCallback = e3), + (this._coreBrowserService = t3), + (this._refreshCallbacks = []); + } + dispose() { + this._animationFrame && + (this._coreBrowserService.window.cancelAnimationFrame( + this._animationFrame + ), + (this._animationFrame = void 0)); + } + addRefreshCallback(e3) { + return ( + this._refreshCallbacks.push(e3), + this._animationFrame || + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => this._innerRefresh() + )), + this._animationFrame + ); + } + refresh(e3, t3, i2) { + (this._rowCount = i2), + (e3 = void 0 !== e3 ? e3 : 0), + (t3 = void 0 !== t3 ? t3 : this._rowCount - 1), + (this._rowStart = + void 0 !== this._rowStart + ? Math.min(this._rowStart, e3) + : e3), + (this._rowEnd = + void 0 !== this._rowEnd + ? Math.max(this._rowEnd, t3) + : t3), + 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 e3 = Math.max(this._rowStart, 0), + t3 = Math.min(this._rowEnd, this._rowCount - 1); + (this._rowStart = void 0), + (this._rowEnd = void 0), + this._renderCallback(e3, t3), + this._runRefreshCallbacks(); + } + _runRefreshCallbacks() { + for (const e3 of this._refreshCallbacks) e3(0); + this._refreshCallbacks = []; + } + }); + }, + 3236: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Terminal = void 0); + const s2 = i2(3614), + r = i2(3656), + n = i2(3551), + o = i2(9042), + a = i2(3730), + h = i2(1680), + c = i2(3107), + l = i2(5744), + d = i2(2950), + _ = i2(1296), + u = i2(428), + f = i2(4269), + v = i2(5114), + p = i2(8934), + g = i2(3230), + m = i2(9312), + S = i2(4725), + C = i2(6731), + b = i2(8055), + w = i2(8969), + y = i2(8460), + E = i2(844), + k = i2(6114), + L = i2(8437), + D = i2(2584), + R = i2(7399), + x = i2(5941), + A = i2(9074), + B = i2(2585), + T = i2(5435), + M = i2(4567), + O = i2(779); + class P extends w.CoreTerminal { + 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; + } + constructor(e3 = {}) { + super(e3), + (this.browser = k), + (this._keyDownHandled = false), + (this._keyDownSeen = false), + (this._keyPressHandled = false), + (this._unprocessedDeadKey = false), + (this._accessibilityManager = this.register( + new E.MutableDisposable() + )), + (this._onCursorMove = this.register( + new y.EventEmitter() + )), + (this.onCursorMove = this._onCursorMove.event), + (this._onKey = this.register(new y.EventEmitter())), + (this.onKey = this._onKey.event), + (this._onRender = this.register(new y.EventEmitter())), + (this.onRender = this._onRender.event), + (this._onSelectionChange = this.register( + new y.EventEmitter() + )), + (this.onSelectionChange = + this._onSelectionChange.event), + (this._onTitleChange = this.register( + new y.EventEmitter() + )), + (this.onTitleChange = this._onTitleChange.event), + (this._onBell = this.register(new y.EventEmitter())), + (this.onBell = this._onBell.event), + (this._onFocus = this.register(new y.EventEmitter())), + (this._onBlur = this.register(new y.EventEmitter())), + (this._onA11yCharEmitter = this.register( + new y.EventEmitter() + )), + (this._onA11yTabEmitter = this.register( + new y.EventEmitter() + )), + (this._onWillOpen = this.register( + new y.EventEmitter() + )), + this._setup(), + (this._decorationService = + this._instantiationService.createInstance( + A.DecorationService + )), + this._instantiationService.setService( + B.IDecorationService, + this._decorationService + ), + (this._linkProviderService = + this._instantiationService.createInstance( + O.LinkProviderService + )), + this._instantiationService.setService( + S.ILinkProviderService, + this._linkProviderService + ), + this._linkProviderService.registerLinkProvider( + this._instantiationService.createInstance( + a.OscLinkProvider + ) + ), + this.register( + this._inputHandler.onRequestBell(() => + this._onBell.fire() + ) + ), + this.register( + this._inputHandler.onRequestRefreshRows((e4, t3) => + this.refresh(e4, t3) + ) + ), + this.register( + this._inputHandler.onRequestSendFocus(() => + this._reportFocus() + ) + ), + this.register( + this._inputHandler.onRequestReset(() => this.reset()) + ), + this.register( + this._inputHandler.onRequestWindowsOptionsReport( + (e4) => this._reportWindowsOptions(e4) + ) + ), + this.register( + this._inputHandler.onColor((e4) => + this._handleColorEvent(e4) + ) + ), + this.register( + (0, y.forwardEvent)( + this._inputHandler.onCursorMove, + this._onCursorMove + ) + ), + this.register( + (0, y.forwardEvent)( + this._inputHandler.onTitleChange, + this._onTitleChange + ) + ), + this.register( + (0, y.forwardEvent)( + this._inputHandler.onA11yChar, + this._onA11yCharEmitter + ) + ), + this.register( + (0, y.forwardEvent)( + this._inputHandler.onA11yTab, + this._onA11yTabEmitter + ) + ), + this.register( + this._bufferService.onResize((e4) => + this._afterResize(e4.cols, e4.rows) + ) + ), + this.register( + (0, E.toDisposable)(() => { + (this._customKeyEventHandler = void 0), + this.element?.parentNode?.removeChild( + this.element + ); + }) + ); + } + _handleColorEvent(e3) { + if (this._themeService) + for (const t3 of e3) { + let e4, + i3 = ""; + switch (t3.index) { + case 256: + (e4 = "foreground"), (i3 = "10"); + break; + case 257: + (e4 = "background"), (i3 = "11"); + break; + case 258: + (e4 = "cursor"), (i3 = "12"); + break; + default: + (e4 = "ansi"), (i3 = "4;" + t3.index); + } + switch (t3.type) { + case 0: + const s3 = b.color.toColorRGB( + "ansi" === e4 + ? this._themeService.colors.ansi[t3.index] + : this._themeService.colors[e4] + ); + this.coreService.triggerDataEvent( + `${D.C0.ESC}]${i3};${(0, x.toRgbString)(s3)}${D.C1_ESCAPED.ST}` + ); + break; + case 1: + if ("ansi" === e4) + this._themeService.modifyColors( + (e5) => + (e5.ansi[t3.index] = b.channels.toColor( + ...t3.color + )) + ); + else { + const i4 = e4; + this._themeService.modifyColors( + (e5) => + (e5[i4] = b.channels.toColor(...t3.color)) + ); + } + break; + case 2: + this._themeService.restoreColor(t3.index); + } + } + } + _setup() { + super._setup(), (this._customKeyEventHandler = void 0); + } + get buffer() { + return this.buffers.active; + } + focus() { + this.textarea && + this.textarea.focus({ preventScroll: true }); + } + _handleScreenReaderModeOptionChange(e3) { + e3 + ? !this._accessibilityManager.value && + this._renderService && + (this._accessibilityManager.value = + this._instantiationService.createInstance( + M.AccessibilityManager, + this + )) + : this._accessibilityManager.clear(); + } + _handleTextAreaFocus(e3) { + this.coreService.decPrivateModes.sendFocus && + this.coreService.triggerDataEvent(D.C0.ESC + "[I"), + 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(D.C0.ESC + "[O"), + this.element.classList.remove("focus"), + this._onBlur.fire(); + } + _syncTextArea() { + if ( + !this.textarea || + !this.buffer.isCursorInViewport || + this._compositionHelper.isComposing || + !this._renderService + ) + return; + const e3 = this.buffer.ybase + this.buffer.y, + t3 = this.buffer.lines.get(e3); + if (!t3) return; + const i3 = Math.min(this.buffer.x, this.cols - 1), + s3 = this._renderService.dimensions.css.cell.height, + r2 = t3.getWidth(i3), + n2 = this._renderService.dimensions.css.cell.width * r2, + o2 = + this.buffer.y * + this._renderService.dimensions.css.cell.height, + a2 = i3 * this._renderService.dimensions.css.cell.width; + (this.textarea.style.left = a2 + "px"), + (this.textarea.style.top = o2 + "px"), + (this.textarea.style.width = n2 + "px"), + (this.textarea.style.height = s3 + "px"), + (this.textarea.style.lineHeight = s3 + "px"), + (this.textarea.style.zIndex = "-5"); + } + _initGlobal() { + this._bindKeys(), + this.register( + (0, r.addDisposableDomListener)( + this.element, + "copy", + (e4) => { + this.hasSelection() && + (0, s2.copyHandler)(e4, this._selectionService); + } + ) + ); + const e3 = (e4) => + (0, s2.handlePasteEvent)( + e4, + this.textarea, + this.coreService, + this.optionsService + ); + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "paste", + e3 + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.element, + "paste", + e3 + ) + ), + k.isFirefox + ? this.register( + (0, r.addDisposableDomListener)( + this.element, + "mousedown", + (e4) => { + 2 === e4.button && + (0, s2.rightClickHandler)( + e4, + this.textarea, + this.screenElement, + this._selectionService, + this.options.rightClickSelectsWord + ); + } + ) + ) + : this.register( + (0, r.addDisposableDomListener)( + this.element, + "contextmenu", + (e4) => { + (0, s2.rightClickHandler)( + e4, + this.textarea, + this.screenElement, + this._selectionService, + this.options.rightClickSelectsWord + ); + } + ) + ), + k.isLinux && + this.register( + (0, r.addDisposableDomListener)( + this.element, + "auxclick", + (e4) => { + 1 === e4.button && + (0, s2.moveTextAreaUnderMouseCursor)( + e4, + this.textarea, + this.screenElement + ); + } + ) + ); + } + _bindKeys() { + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "keyup", + (e3) => this._keyUp(e3), + true + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "keydown", + (e3) => this._keyDown(e3), + true + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "keypress", + (e3) => this._keyPress(e3), + true + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "compositionstart", + () => this._compositionHelper.compositionstart() + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "compositionupdate", + (e3) => + this._compositionHelper.compositionupdate(e3) + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "compositionend", + () => this._compositionHelper.compositionend() + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "input", + (e3) => this._inputEvent(e3), + true + ) + ), + this.register( + this.onRender(() => + this._compositionHelper.updateCompositionElements() + ) + ); + } + open(e3) { + if (!e3) + throw new Error("Terminal requires a parent element."); + if ( + (e3.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 = e3.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"), + e3.appendChild(this.element); + const t3 = this._document.createDocumentFragment(); + (this._viewportElement = + this._document.createElement("div")), + this._viewportElement.classList.add("xterm-viewport"), + t3.appendChild(this._viewportElement), + (this._viewportScrollArea = + this._document.createElement("div")), + this._viewportScrollArea.classList.add( + "xterm-scroll-area" + ), + this._viewportElement.appendChild( + this._viewportScrollArea + ), + (this.screenElement = + this._document.createElement("div")), + this.screenElement.classList.add("xterm-screen"), + this.register( + (0, r.addDisposableDomListener)( + this.screenElement, + "mousemove", + (e4) => this.updateCursorStyle(e4) + ) + ), + (this._helperContainer = + this._document.createElement("div")), + this._helperContainer.classList.add("xterm-helpers"), + this.screenElement.appendChild(this._helperContainer), + t3.appendChild(this.screenElement), + (this.textarea = + this._document.createElement("textarea")), + this.textarea.classList.add("xterm-helper-textarea"), + this.textarea.setAttribute("aria-label", o.promptLabel), + k.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._coreBrowserService = this.register( + this._instantiationService.createInstance( + v.CoreBrowserService, + this.textarea, + e3.ownerDocument.defaultView ?? window, + this._document ?? "undefined" != typeof window + ? window.document + : null + ) + )), + this._instantiationService.setService( + S.ICoreBrowserService, + this._coreBrowserService + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "focus", + (e4) => this._handleTextAreaFocus(e4) + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.textarea, + "blur", + () => this._handleTextAreaBlur() + ) + ), + this._helperContainer.appendChild(this.textarea), + (this._charSizeService = + this._instantiationService.createInstance( + u.CharSizeService, + this._document, + this._helperContainer + )), + this._instantiationService.setService( + S.ICharSizeService, + this._charSizeService + ), + (this._themeService = + this._instantiationService.createInstance( + C.ThemeService + )), + this._instantiationService.setService( + S.IThemeService, + this._themeService + ), + (this._characterJoinerService = + this._instantiationService.createInstance( + f.CharacterJoinerService + )), + this._instantiationService.setService( + S.ICharacterJoinerService, + this._characterJoinerService + ), + (this._renderService = this.register( + this._instantiationService.createInstance( + g.RenderService, + this.rows, + this.screenElement + ) + )), + this._instantiationService.setService( + S.IRenderService, + this._renderService + ), + this.register( + this._renderService.onRenderedViewportChange((e4) => + this._onRender.fire(e4) + ) + ), + this.onResize((e4) => + this._renderService.resize(e4.cols, e4.rows) + ), + (this._compositionView = + this._document.createElement("div")), + this._compositionView.classList.add("composition-view"), + (this._compositionHelper = + this._instantiationService.createInstance( + d.CompositionHelper, + this.textarea, + this._compositionView + )), + this._helperContainer.appendChild( + this._compositionView + ), + (this._mouseService = + this._instantiationService.createInstance( + p.MouseService + )), + this._instantiationService.setService( + S.IMouseService, + this._mouseService + ), + (this.linkifier = this.register( + this._instantiationService.createInstance( + n.Linkifier, + this.screenElement + ) + )), + this.element.appendChild(t3); + try { + this._onWillOpen.fire(this.element); + } catch {} + this._renderService.hasRenderer() || + this._renderService.setRenderer(this._createRenderer()), + (this.viewport = + this._instantiationService.createInstance( + h.Viewport, + this._viewportElement, + this._viewportScrollArea + )), + this.viewport.onRequestScrollLines((e4) => + this.scrollLines(e4.amount, e4.suppressScrollEvent, 1) + ), + this.register( + this._inputHandler.onRequestSyncScrollBar(() => + this.viewport.syncScrollArea() + ) + ), + this.register(this.viewport), + 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.register( + this._renderService.onDimensionsChange(() => + this.viewport.syncScrollArea() + ) + ), + (this._selectionService = this.register( + this._instantiationService.createInstance( + m.SelectionService, + this.element, + this.screenElement, + this.linkifier + ) + )), + this._instantiationService.setService( + S.ISelectionService, + this._selectionService + ), + this.register( + this._selectionService.onRequestScrollLines((e4) => + this.scrollLines(e4.amount, e4.suppressScrollEvent) + ) + ), + this.register( + this._selectionService.onSelectionChange(() => + this._onSelectionChange.fire() + ) + ), + this.register( + this._selectionService.onRequestRedraw((e4) => + this._renderService.handleSelectionChanged( + e4.start, + e4.end, + e4.columnSelectMode + ) + ) + ), + this.register( + this._selectionService.onLinuxMouseSelection((e4) => { + (this.textarea.value = e4), + this.textarea.focus(), + this.textarea.select(); + }) + ), + this.register( + this._onScroll.event((e4) => { + this.viewport.syncScrollArea(), + this._selectionService.refresh(); + }) + ), + this.register( + (0, r.addDisposableDomListener)( + this._viewportElement, + "scroll", + () => this._selectionService.refresh() + ) + ), + this.register( + this._instantiationService.createInstance( + c.BufferDecorationRenderer, + this.screenElement + ) + ), + this.register( + (0, r.addDisposableDomListener)( + this.element, + "mousedown", + (e4) => this._selectionService.handleMouseDown(e4) + ) + ), + 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( + M.AccessibilityManager, + this + )), + this.register( + this.optionsService.onSpecificOptionChange( + "screenReaderMode", + (e4) => this._handleScreenReaderModeOptionChange(e4) + ) + ), + this.options.overviewRulerWidth && + (this._overviewRulerRenderer = this.register( + this._instantiationService.createInstance( + l.OverviewRulerRenderer, + this._viewportElement, + this.screenElement + ) + )), + this.optionsService.onSpecificOptionChange( + "overviewRulerWidth", + (e4) => { + !this._overviewRulerRenderer && + e4 && + 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( + _.DomRenderer, + this, + this._document, + this.element, + this.screenElement, + this._viewportElement, + this._helperContainer, + this.linkifier + ); + } + bindMouse() { + const e3 = this, + t3 = this.element; + function i3(t4) { + const i4 = e3._mouseService.getMouseReportCoords( + t4, + e3.screenElement + ); + if (!i4) return false; + let s4, r2; + switch (t4.overrideType || t4.type) { + case "mousemove": + (r2 = 32), + void 0 === t4.buttons + ? ((s4 = 3), + void 0 !== t4.button && + (s4 = t4.button < 3 ? t4.button : 3)) + : (s4 = + 1 & t4.buttons + ? 0 + : 4 & t4.buttons + ? 1 + : 2 & t4.buttons + ? 2 + : 3); + break; + case "mouseup": + (r2 = 0), (s4 = t4.button < 3 ? t4.button : 3); + break; + case "mousedown": + (r2 = 1), (s4 = t4.button < 3 ? t4.button : 3); + break; + case "wheel": + if ( + e3._customWheelEventHandler && + false === e3._customWheelEventHandler(t4) + ) + return false; + if (0 === e3.viewport.getLinesScrolled(t4)) + return false; + (r2 = t4.deltaY < 0 ? 0 : 1), (s4 = 4); + break; + default: + return false; + } + return ( + !(void 0 === r2 || void 0 === s4 || s4 > 4) && + e3.coreMouseService.triggerMouseEvent({ + col: i4.col, + row: i4.row, + x: i4.x, + y: i4.y, + button: s4, + action: r2, + ctrl: t4.ctrlKey, + alt: t4.altKey, + shift: t4.shiftKey, + }) + ); + } + const s3 = { + mouseup: null, + wheel: null, + mousedrag: null, + mousemove: null, + }, + n2 = { + mouseup: (e4) => ( + i3(e4), + e4.buttons || + (this._document.removeEventListener( + "mouseup", + s3.mouseup + ), + s3.mousedrag && + this._document.removeEventListener( + "mousemove", + s3.mousedrag + )), + this.cancel(e4) + ), + wheel: (e4) => (i3(e4), this.cancel(e4, true)), + mousedrag: (e4) => { + e4.buttons && i3(e4); + }, + mousemove: (e4) => { + e4.buttons || i3(e4); + }, + }; + this.register( + this.coreMouseService.onProtocolChange((e4) => { + e4 + ? ("debug" === + this.optionsService.rawOptions.logLevel && + this._logService.debug( + "Binding to mouse events:", + this.coreMouseService.explainEvents(e4) + ), + 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 & e4 + ? s3.mousemove || + (t3.addEventListener("mousemove", n2.mousemove), + (s3.mousemove = n2.mousemove)) + : (t3.removeEventListener( + "mousemove", + s3.mousemove + ), + (s3.mousemove = null)), + 16 & e4 + ? s3.wheel || + (t3.addEventListener("wheel", n2.wheel, { + passive: false, + }), + (s3.wheel = n2.wheel)) + : (t3.removeEventListener("wheel", s3.wheel), + (s3.wheel = null)), + 2 & e4 + ? s3.mouseup || (s3.mouseup = n2.mouseup) + : (this._document.removeEventListener( + "mouseup", + s3.mouseup + ), + (s3.mouseup = null)), + 4 & e4 + ? s3.mousedrag || (s3.mousedrag = n2.mousedrag) + : (this._document.removeEventListener( + "mousemove", + s3.mousedrag + ), + (s3.mousedrag = null)); + }) + ), + (this.coreMouseService.activeProtocol = + this.coreMouseService.activeProtocol), + this.register( + (0, r.addDisposableDomListener)( + t3, + "mousedown", + (e4) => { + if ( + (e4.preventDefault(), + this.focus(), + this.coreMouseService.areMouseEventsActive && + !this._selectionService.shouldForceSelection( + e4 + )) + ) + return ( + i3(e4), + s3.mouseup && + this._document.addEventListener( + "mouseup", + s3.mouseup + ), + s3.mousedrag && + this._document.addEventListener( + "mousemove", + s3.mousedrag + ), + this.cancel(e4) + ); + } + ) + ), + this.register( + (0, r.addDisposableDomListener)( + t3, + "wheel", + (e4) => { + if (!s3.wheel) { + if ( + this._customWheelEventHandler && + false === this._customWheelEventHandler(e4) + ) + return false; + if (!this.buffer.hasScrollback) { + const t4 = this.viewport.getLinesScrolled(e4); + if (0 === t4) return; + const i4 = + D.C0.ESC + + (this.coreService.decPrivateModes + .applicationCursorKeys + ? "O" + : "[") + + (e4.deltaY < 0 ? "A" : "B"); + let s4 = ""; + for (let e5 = 0; e5 < Math.abs(t4); e5++) + s4 += i4; + return ( + this.coreService.triggerDataEvent(s4, true), + this.cancel(e4, true) + ); + } + return this.viewport.handleWheel(e4) + ? this.cancel(e4) + : void 0; + } + }, + { passive: false } + ) + ), + this.register( + (0, r.addDisposableDomListener)( + t3, + "touchstart", + (e4) => { + if (!this.coreMouseService.areMouseEventsActive) + return ( + this.viewport.handleTouchStart(e4), + this.cancel(e4) + ); + }, + { passive: true } + ) + ), + this.register( + (0, r.addDisposableDomListener)( + t3, + "touchmove", + (e4) => { + if (!this.coreMouseService.areMouseEventsActive) + return this.viewport.handleTouchMove(e4) + ? void 0 + : this.cancel(e4); + }, + { passive: false } + ) + ); + } + refresh(e3, t3) { + this._renderService?.refreshRows(e3, t3); + } + updateCursorStyle(e3) { + this._selectionService?.shouldColumnSelect(e3) + ? this.element.classList.add("column-select") + : this.element.classList.remove("column-select"); + } + _showCursor() { + this.coreService.isCursorInitialized || + ((this.coreService.isCursorInitialized = true), + this.refresh(this.buffer.y, this.buffer.y)); + } + scrollLines(e3, t3, i3 = 0) { + 1 === i3 + ? (super.scrollLines(e3, t3, i3), + this.refresh(0, this.rows - 1)) + : this.viewport?.scrollLines(e3); + } + paste(e3) { + (0, s2.paste)( + e3, + this.textarea, + this.coreService, + this.optionsService + ); + } + attachCustomKeyEventHandler(e3) { + this._customKeyEventHandler = e3; + } + attachCustomWheelEventHandler(e3) { + this._customWheelEventHandler = e3; + } + registerLinkProvider(e3) { + return this._linkProviderService.registerLinkProvider(e3); + } + registerCharacterJoiner(e3) { + if (!this._characterJoinerService) + throw new Error("Terminal must be opened first"); + const t3 = this._characterJoinerService.register(e3); + return this.refresh(0, this.rows - 1), t3; + } + deregisterCharacterJoiner(e3) { + if (!this._characterJoinerService) + throw new Error("Terminal must be opened first"); + this._characterJoinerService.deregister(e3) && + this.refresh(0, this.rows - 1); + } + get markers() { + return this.buffer.markers; + } + registerMarker(e3) { + return this.buffer.addMarker( + this.buffer.ybase + this.buffer.y + e3 + ); + } + registerDecoration(e3) { + return this._decorationService.registerDecoration(e3); + } + hasSelection() { + return ( + !!this._selectionService && + this._selectionService.hasSelection + ); + } + select(e3, t3, i3) { + this._selectionService.setSelection(e3, t3, i3); + } + 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(e3, t3) { + this._selectionService?.selectLines(e3, t3); + } + _keyDown(e3) { + if ( + ((this._keyDownHandled = false), + (this._keyDownSeen = true), + this._customKeyEventHandler && + false === this._customKeyEventHandler(e3)) + ) + return false; + const t3 = + this.browser.isMac && + this.options.macOptionIsMeta && + e3.altKey; + if (!t3 && !this._compositionHelper.keydown(e3)) + return ( + this.options.scrollOnUserInput && + this.buffer.ybase !== this.buffer.ydisp && + this.scrollToBottom(), + false + ); + t3 || + ("Dead" !== e3.key && "AltGraph" !== e3.key) || + (this._unprocessedDeadKey = true); + const i3 = (0, R.evaluateKeyboardEvent)( + e3, + this.coreService.decPrivateModes.applicationCursorKeys, + this.browser.isMac, + this.options.macOptionIsMeta + ); + if ( + (this.updateCursorStyle(e3), + 3 === i3.type || 2 === i3.type) + ) { + const t4 = this.rows - 1; + return ( + this.scrollLines(2 === i3.type ? -t4 : t4), + this.cancel(e3, true) + ); + } + return ( + 1 === i3.type && this.selectAll(), + !!this._isThirdLevelShift(this.browser, e3) || + (i3.cancel && this.cancel(e3, true), + !i3.key || + !!( + e3.key && + !e3.ctrlKey && + !e3.altKey && + !e3.metaKey && + 1 === e3.key.length && + e3.key.charCodeAt(0) >= 65 && + e3.key.charCodeAt(0) <= 90 + ) || + (this._unprocessedDeadKey + ? ((this._unprocessedDeadKey = false), true) + : ((i3.key !== D.C0.ETX && i3.key !== D.C0.CR) || + (this.textarea.value = ""), + this._onKey.fire({ key: i3.key, domEvent: e3 }), + this._showCursor(), + this.coreService.triggerDataEvent(i3.key, true), + !this.optionsService.rawOptions + .screenReaderMode || + e3.altKey || + e3.ctrlKey + ? this.cancel(e3, true) + : void (this._keyDownHandled = true)))) + ); + } + _isThirdLevelShift(e3, t3) { + const i3 = + (e3.isMac && + !this.options.macOptionIsMeta && + t3.altKey && + !t3.ctrlKey && + !t3.metaKey) || + (e3.isWindows && + t3.altKey && + t3.ctrlKey && + !t3.metaKey) || + (e3.isWindows && t3.getModifierState("AltGraph")); + return "keypress" === t3.type + ? i3 + : i3 && (!t3.keyCode || t3.keyCode > 47); + } + _keyUp(e3) { + (this._keyDownSeen = false), + (this._customKeyEventHandler && + false === this._customKeyEventHandler(e3)) || + ((function (e4) { + return ( + 16 === e4.keyCode || + 17 === e4.keyCode || + 18 === e4.keyCode + ); + })(e3) || this.focus(), + this.updateCursorStyle(e3), + (this._keyPressHandled = false)); + } + _keyPress(e3) { + let t3; + if ( + ((this._keyPressHandled = false), this._keyDownHandled) + ) + return false; + if ( + this._customKeyEventHandler && + false === this._customKeyEventHandler(e3) + ) + return false; + if ((this.cancel(e3), e3.charCode)) t3 = e3.charCode; + else if (null === e3.which || void 0 === e3.which) + t3 = e3.keyCode; + else { + if (0 === e3.which || 0 === e3.charCode) return false; + t3 = e3.which; + } + return !( + !t3 || + ((e3.altKey || e3.ctrlKey || e3.metaKey) && + !this._isThirdLevelShift(this.browser, e3)) || + ((t3 = String.fromCharCode(t3)), + this._onKey.fire({ key: t3, domEvent: e3 }), + this._showCursor(), + this.coreService.triggerDataEvent(t3, true), + (this._keyPressHandled = true), + (this._unprocessedDeadKey = false), + 0) + ); + } + _inputEvent(e3) { + if ( + e3.data && + "insertText" === e3.inputType && + (!e3.composed || !this._keyDownSeen) && + !this.optionsService.rawOptions.screenReaderMode + ) { + if (this._keyPressHandled) return false; + this._unprocessedDeadKey = false; + const t3 = e3.data; + return ( + this.coreService.triggerDataEvent(t3, true), + this.cancel(e3), + true + ); + } + return false; + } + resize(e3, t3) { + e3 !== this.cols || t3 !== this.rows + ? super.resize(e3, t3) + : this._charSizeService && + !this._charSizeService.hasValidSize && + this._charSizeService.measure(); + } + _afterResize(e3, t3) { + this._charSizeService?.measure(), + this.viewport?.syncScrollArea(true); + } + 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 e3 = 1; e3 < this.rows; e3++) + this.buffer.lines.push( + this.buffer.getBlankLine(L.DEFAULT_ATTR_DATA) + ); + this._onScroll.fire({ + position: this.buffer.ydisp, + source: 0, + }), + this.viewport?.reset(), + this.refresh(0, this.rows - 1); + } + } + reset() { + (this.options.rows = this.rows), + (this.options.cols = this.cols); + const e3 = this._customKeyEventHandler; + this._setup(), + super.reset(), + this._selectionService?.reset(), + this._decorationService.reset(), + this.viewport?.reset(), + (this._customKeyEventHandler = e3), + this.refresh(0, this.rows - 1); + } + clearTextureAtlas() { + this._renderService?.clearTextureAtlas(); + } + _reportFocus() { + this.element?.classList.contains("focus") + ? this.coreService.triggerDataEvent(D.C0.ESC + "[I") + : this.coreService.triggerDataEvent(D.C0.ESC + "[O"); + } + _reportWindowsOptions(e3) { + if (this._renderService) + switch (e3) { + case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS: + const e4 = + this._renderService.dimensions.css.canvas.width.toFixed( + 0 + ), + t3 = + this._renderService.dimensions.css.canvas.height.toFixed( + 0 + ); + this.coreService.triggerDataEvent( + `${D.C0.ESC}[4;${t3};${e4}t` + ); + break; + case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS: + const i3 = + this._renderService.dimensions.css.cell.width.toFixed( + 0 + ), + s3 = + this._renderService.dimensions.css.cell.height.toFixed( + 0 + ); + this.coreService.triggerDataEvent( + `${D.C0.ESC}[6;${s3};${i3}t` + ); + } + } + cancel(e3, t3) { + if (this.options.cancelEvents || t3) + return e3.preventDefault(), e3.stopPropagation(), false; + } + } + t2.Terminal = P; + }, + 9924: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TimeBasedDebouncer = void 0), + (t2.TimeBasedDebouncer = class { + constructor(e3, t3 = 1e3) { + (this._renderCallback = e3), + (this._debounceThresholdMS = t3), + (this._lastRefreshMs = 0), + (this._additionalRefreshRequested = false); + } + dispose() { + this._refreshTimeoutID && + clearTimeout(this._refreshTimeoutID); + } + refresh(e3, t3, i2) { + (this._rowCount = i2), + (e3 = void 0 !== e3 ? e3 : 0), + (t3 = void 0 !== t3 ? t3 : this._rowCount - 1), + (this._rowStart = + void 0 !== this._rowStart + ? Math.min(this._rowStart, e3) + : e3), + (this._rowEnd = + void 0 !== this._rowEnd + ? Math.max(this._rowEnd, t3) + : t3); + const s2 = Date.now(); + if ( + s2 - this._lastRefreshMs >= + this._debounceThresholdMS + ) + (this._lastRefreshMs = s2), this._innerRefresh(); + else if (!this._additionalRefreshRequested) { + const e4 = s2 - this._lastRefreshMs, + t4 = this._debounceThresholdMS - e4; + (this._additionalRefreshRequested = true), + (this._refreshTimeoutID = window.setTimeout(() => { + (this._lastRefreshMs = Date.now()), + this._innerRefresh(), + (this._additionalRefreshRequested = false), + (this._refreshTimeoutID = void 0); + }, t4)); + } + } + _innerRefresh() { + if ( + void 0 === this._rowStart || + void 0 === this._rowEnd || + void 0 === this._rowCount + ) + return; + const e3 = Math.max(this._rowStart, 0), + t3 = Math.min(this._rowEnd, this._rowCount - 1); + (this._rowStart = void 0), + (this._rowEnd = void 0), + this._renderCallback(e3, t3); + } + }); + }, + 1680: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Viewport = void 0); + const n = i2(3656), + o = i2(4725), + a = i2(8460), + h = i2(844), + c = i2(2585); + let l = (t2.Viewport = class extends h.Disposable { + constructor(e3, t3, i3, s3, r2, o2, h2, c2) { + super(), + (this._viewportElement = e3), + (this._scrollArea = t3), + (this._bufferService = i3), + (this._optionsService = s3), + (this._charSizeService = r2), + (this._renderService = o2), + (this._coreBrowserService = h2), + (this.scrollBarWidth = 0), + (this._currentRowHeight = 0), + (this._currentDeviceCellHeight = 0), + (this._lastRecordedBufferLength = 0), + (this._lastRecordedViewportHeight = 0), + (this._lastRecordedBufferHeight = 0), + (this._lastTouchY = 0), + (this._lastScrollTop = 0), + (this._wheelPartialScroll = 0), + (this._refreshAnimationFrame = null), + (this._ignoreNextScrollEvent = false), + (this._smoothScrollState = { + startTime: 0, + origin: -1, + target: -1, + }), + (this._onRequestScrollLines = this.register( + new a.EventEmitter() + )), + (this.onRequestScrollLines = + this._onRequestScrollLines.event), + (this.scrollBarWidth = + this._viewportElement.offsetWidth - + this._scrollArea.offsetWidth || 15), + this.register( + (0, n.addDisposableDomListener)( + this._viewportElement, + "scroll", + this._handleScroll.bind(this) + ) + ), + (this._activeBuffer = this._bufferService.buffer), + this.register( + this._bufferService.buffers.onBufferActivate( + (e4) => (this._activeBuffer = e4.activeBuffer) + ) + ), + (this._renderDimensions = + this._renderService.dimensions), + this.register( + this._renderService.onDimensionsChange( + (e4) => (this._renderDimensions = e4) + ) + ), + this._handleThemeChange(c2.colors), + this.register( + c2.onChangeColors((e4) => this._handleThemeChange(e4)) + ), + this.register( + this._optionsService.onSpecificOptionChange( + "scrollback", + () => this.syncScrollArea() + ) + ), + setTimeout(() => this.syncScrollArea()); + } + _handleThemeChange(e3) { + this._viewportElement.style.backgroundColor = + e3.background.css; + } + reset() { + (this._currentRowHeight = 0), + (this._currentDeviceCellHeight = 0), + (this._lastRecordedBufferLength = 0), + (this._lastRecordedViewportHeight = 0), + (this._lastRecordedBufferHeight = 0), + (this._lastTouchY = 0), + (this._lastScrollTop = 0), + this._coreBrowserService.window.requestAnimationFrame( + () => this.syncScrollArea() + ); + } + _refresh(e3) { + if (e3) + return ( + this._innerRefresh(), + void ( + null !== this._refreshAnimationFrame && + this._coreBrowserService.window.cancelAnimationFrame( + this._refreshAnimationFrame + ) + ) + ); + null === this._refreshAnimationFrame && + (this._refreshAnimationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => this._innerRefresh() + )); + } + _innerRefresh() { + if (this._charSizeService.height > 0) { + (this._currentRowHeight = + this._renderDimensions.device.cell.height / + this._coreBrowserService.dpr), + (this._currentDeviceCellHeight = + this._renderDimensions.device.cell.height), + (this._lastRecordedViewportHeight = + this._viewportElement.offsetHeight); + const e4 = + Math.round( + this._currentRowHeight * + this._lastRecordedBufferLength + ) + + (this._lastRecordedViewportHeight - + this._renderDimensions.css.canvas.height); + this._lastRecordedBufferHeight !== e4 && + ((this._lastRecordedBufferHeight = e4), + (this._scrollArea.style.height = + this._lastRecordedBufferHeight + "px")); + } + const e3 = + this._bufferService.buffer.ydisp * + this._currentRowHeight; + this._viewportElement.scrollTop !== e3 && + ((this._ignoreNextScrollEvent = true), + (this._viewportElement.scrollTop = e3)), + (this._refreshAnimationFrame = null); + } + syncScrollArea(e3 = false) { + if ( + this._lastRecordedBufferLength !== + this._bufferService.buffer.lines.length + ) + return ( + (this._lastRecordedBufferLength = + this._bufferService.buffer.lines.length), + void this._refresh(e3) + ); + (this._lastRecordedViewportHeight === + this._renderService.dimensions.css.canvas.height && + this._lastScrollTop === + this._activeBuffer.ydisp * this._currentRowHeight && + this._renderDimensions.device.cell.height === + this._currentDeviceCellHeight) || + this._refresh(e3); + } + _handleScroll(e3) { + if ( + ((this._lastScrollTop = + this._viewportElement.scrollTop), + !this._viewportElement.offsetParent) + ) + return; + if (this._ignoreNextScrollEvent) + return ( + (this._ignoreNextScrollEvent = false), + void this._onRequestScrollLines.fire({ + amount: 0, + suppressScrollEvent: true, + }) + ); + const t3 = + Math.round( + this._lastScrollTop / this._currentRowHeight + ) - this._bufferService.buffer.ydisp; + this._onRequestScrollLines.fire({ + amount: t3, + suppressScrollEvent: true, + }); + } + _smoothScroll() { + if ( + this._isDisposed || + -1 === this._smoothScrollState.origin || + -1 === this._smoothScrollState.target + ) + return; + const e3 = this._smoothScrollPercent(); + (this._viewportElement.scrollTop = + this._smoothScrollState.origin + + Math.round( + e3 * + (this._smoothScrollState.target - + this._smoothScrollState.origin) + )), + e3 < 1 + ? this._coreBrowserService.window.requestAnimationFrame( + () => this._smoothScroll() + ) + : this._clearSmoothScrollState(); + } + _smoothScrollPercent() { + return this._optionsService.rawOptions + .smoothScrollDuration && + this._smoothScrollState.startTime + ? Math.max( + Math.min( + (Date.now() - this._smoothScrollState.startTime) / + this._optionsService.rawOptions + .smoothScrollDuration, + 1 + ), + 0 + ) + : 1; + } + _clearSmoothScrollState() { + (this._smoothScrollState.startTime = 0), + (this._smoothScrollState.origin = -1), + (this._smoothScrollState.target = -1); + } + _bubbleScroll(e3, t3) { + const i3 = + this._viewportElement.scrollTop + + this._lastRecordedViewportHeight; + return ( + !( + (t3 < 0 && 0 !== this._viewportElement.scrollTop) || + (t3 > 0 && i3 < this._lastRecordedBufferHeight) + ) || (e3.cancelable && e3.preventDefault(), false) + ); + } + handleWheel(e3) { + const t3 = this._getPixelsScrolled(e3); + return ( + 0 !== t3 && + (this._optionsService.rawOptions.smoothScrollDuration + ? ((this._smoothScrollState.startTime = Date.now()), + this._smoothScrollPercent() < 1 + ? ((this._smoothScrollState.origin = + this._viewportElement.scrollTop), + -1 === this._smoothScrollState.target + ? (this._smoothScrollState.target = + this._viewportElement.scrollTop + t3) + : (this._smoothScrollState.target += t3), + (this._smoothScrollState.target = Math.max( + Math.min( + this._smoothScrollState.target, + this._viewportElement.scrollHeight + ), + 0 + )), + this._smoothScroll()) + : this._clearSmoothScrollState()) + : (this._viewportElement.scrollTop += t3), + this._bubbleScroll(e3, t3)) + ); + } + scrollLines(e3) { + if (0 !== e3) + if ( + this._optionsService.rawOptions.smoothScrollDuration + ) { + const t3 = e3 * this._currentRowHeight; + (this._smoothScrollState.startTime = Date.now()), + this._smoothScrollPercent() < 1 + ? ((this._smoothScrollState.origin = + this._viewportElement.scrollTop), + (this._smoothScrollState.target = + this._smoothScrollState.origin + t3), + (this._smoothScrollState.target = Math.max( + Math.min( + this._smoothScrollState.target, + this._viewportElement.scrollHeight + ), + 0 + )), + this._smoothScroll()) + : this._clearSmoothScrollState(); + } else + this._onRequestScrollLines.fire({ + amount: e3, + suppressScrollEvent: false, + }); + } + _getPixelsScrolled(e3) { + if (0 === e3.deltaY || e3.shiftKey) return 0; + let t3 = this._applyScrollModifier(e3.deltaY, e3); + return ( + e3.deltaMode === WheelEvent.DOM_DELTA_LINE + ? (t3 *= this._currentRowHeight) + : e3.deltaMode === WheelEvent.DOM_DELTA_PAGE && + (t3 *= + this._currentRowHeight * + this._bufferService.rows), + t3 + ); + } + getBufferElements(e3, t3) { + let i3, + s3 = ""; + const r2 = [], + n2 = t3 ?? this._bufferService.buffer.lines.length, + o2 = this._bufferService.buffer.lines; + for (let t4 = e3; t4 < n2; t4++) { + const e4 = o2.get(t4); + if (!e4) continue; + const n3 = o2.get(t4 + 1)?.isWrapped; + if ( + ((s3 += e4.translateToString(!n3)), + !n3 || t4 === o2.length - 1) + ) { + const e5 = document.createElement("div"); + (e5.textContent = s3), + r2.push(e5), + s3.length > 0 && (i3 = e5), + (s3 = ""); + } + } + return { bufferElements: r2, cursorElement: i3 }; + } + getLinesScrolled(e3) { + if (0 === e3.deltaY || e3.shiftKey) return 0; + let t3 = this._applyScrollModifier(e3.deltaY, e3); + return ( + e3.deltaMode === WheelEvent.DOM_DELTA_PIXEL + ? ((t3 /= this._currentRowHeight + 0), + (this._wheelPartialScroll += t3), + (t3 = + Math.floor(Math.abs(this._wheelPartialScroll)) * + (this._wheelPartialScroll > 0 ? 1 : -1)), + (this._wheelPartialScroll %= 1)) + : e3.deltaMode === WheelEvent.DOM_DELTA_PAGE && + (t3 *= this._bufferService.rows), + t3 + ); + } + _applyScrollModifier(e3, t3) { + const i3 = + this._optionsService.rawOptions.fastScrollModifier; + return ("alt" === i3 && t3.altKey) || + ("ctrl" === i3 && t3.ctrlKey) || + ("shift" === i3 && t3.shiftKey) + ? e3 * + this._optionsService.rawOptions + .fastScrollSensitivity * + this._optionsService.rawOptions.scrollSensitivity + : e3 * + this._optionsService.rawOptions.scrollSensitivity; + } + handleTouchStart(e3) { + this._lastTouchY = e3.touches[0].pageY; + } + handleTouchMove(e3) { + const t3 = this._lastTouchY - e3.touches[0].pageY; + return ( + (this._lastTouchY = e3.touches[0].pageY), + 0 !== t3 && + ((this._viewportElement.scrollTop += t3), + this._bubbleScroll(e3, t3)) + ); + } + }); + t2.Viewport = l = s2( + [ + r(2, c.IBufferService), + r(3, c.IOptionsService), + r(4, o.ICharSizeService), + r(5, o.IRenderService), + r(6, o.ICoreBrowserService), + r(7, o.IThemeService), + ], + l + ); + }, + 3107: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferDecorationRenderer = void 0); + const n = i2(4725), + o = i2(844), + a = i2(2585); + let h = (t2.BufferDecorationRenderer = class extends ( + o.Disposable + ) { + constructor(e3, t3, i3, s3, r2) { + super(), + (this._screenElement = e3), + (this._bufferService = t3), + (this._coreBrowserService = i3), + (this._decorationService = s3), + (this._renderService = r2), + (this._decorationElements = /* @__PURE__ */ new Map()), + (this._altBufferIsActive = false), + (this._dimensionsChanged = false), + (this._container = document.createElement("div")), + this._container.classList.add( + "xterm-decoration-container" + ), + this._screenElement.appendChild(this._container), + this.register( + this._renderService.onRenderedViewportChange(() => + this._doRefreshDecorations() + ) + ), + this.register( + this._renderService.onDimensionsChange(() => { + (this._dimensionsChanged = true), + this._queueRefresh(); + }) + ), + this.register( + this._coreBrowserService.onDprChange(() => + this._queueRefresh() + ) + ), + this.register( + this._bufferService.buffers.onBufferActivate(() => { + this._altBufferIsActive = + this._bufferService.buffer === + this._bufferService.buffers.alt; + }) + ), + this.register( + this._decorationService.onDecorationRegistered(() => + this._queueRefresh() + ) + ), + this.register( + this._decorationService.onDecorationRemoved((e4) => + this._removeDecoration(e4) + ) + ), + 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 e3 of this._decorationService.decorations) + this._renderDecoration(e3); + this._dimensionsChanged = false; + } + _renderDecoration(e3) { + this._refreshStyle(e3), + this._dimensionsChanged && this._refreshXPosition(e3); + } + _createElement(e3) { + const t3 = + this._coreBrowserService.mainDocument.createElement( + "div" + ); + t3.classList.add("xterm-decoration"), + t3.classList.toggle( + "xterm-decoration-top-layer", + "top" === e3?.options?.layer + ), + (t3.style.width = `${Math.round((e3.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`), + (t3.style.height = + (e3.options.height || 1) * + this._renderService.dimensions.css.cell.height + + "px"), + (t3.style.top = + (e3.marker.line - + this._bufferService.buffers.active.ydisp) * + this._renderService.dimensions.css.cell.height + + "px"), + (t3.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`); + const i3 = e3.options.x ?? 0; + return ( + i3 && + i3 > this._bufferService.cols && + (t3.style.display = "none"), + this._refreshXPosition(e3, t3), + t3 + ); + } + _refreshStyle(e3) { + const t3 = + e3.marker.line - + this._bufferService.buffers.active.ydisp; + if (t3 < 0 || t3 >= this._bufferService.rows) + e3.element && + ((e3.element.style.display = "none"), + e3.onRenderEmitter.fire(e3.element)); + else { + let i3 = this._decorationElements.get(e3); + i3 || + ((i3 = this._createElement(e3)), + (e3.element = i3), + this._decorationElements.set(e3, i3), + this._container.appendChild(i3), + e3.onDispose(() => { + this._decorationElements.delete(e3), i3.remove(); + })), + (i3.style.top = + t3 * + this._renderService.dimensions.css.cell.height + + "px"), + (i3.style.display = this._altBufferIsActive + ? "none" + : "block"), + e3.onRenderEmitter.fire(i3); + } + } + _refreshXPosition(e3, t3 = e3.element) { + if (!t3) return; + const i3 = e3.options.x ?? 0; + "right" === (e3.options.anchor || "left") + ? (t3.style.right = i3 + ? i3 * + this._renderService.dimensions.css.cell.width + + "px" + : "") + : (t3.style.left = i3 + ? i3 * + this._renderService.dimensions.css.cell.width + + "px" + : ""); + } + _removeDecoration(e3) { + this._decorationElements.get(e3)?.remove(), + this._decorationElements.delete(e3), + e3.dispose(); + } + }); + t2.BufferDecorationRenderer = h = s2( + [ + r(1, a.IBufferService), + r(2, n.ICoreBrowserService), + r(3, a.IDecorationService), + r(4, n.IRenderService), + ], + h + ); + }, + 5871: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ColorZoneStore = void 0), + (t2.ColorZoneStore = 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(e3) { + if (e3.options.overviewRulerOptions) { + for (const t3 of this._zones) + if ( + t3.color === + e3.options.overviewRulerOptions.color && + t3.position === + e3.options.overviewRulerOptions.position + ) { + if (this._lineIntersectsZone(t3, e3.marker.line)) + return; + if ( + this._lineAdjacentToZone( + t3, + e3.marker.line, + e3.options.overviewRulerOptions.position + ) + ) + return void this._addLineToZone( + t3, + e3.marker.line + ); + } + if (this._zonePoolIndex < this._zonePool.length) + return ( + (this._zonePool[this._zonePoolIndex].color = + e3.options.overviewRulerOptions.color), + (this._zonePool[this._zonePoolIndex].position = + e3.options.overviewRulerOptions.position), + (this._zonePool[ + this._zonePoolIndex + ].startBufferLine = e3.marker.line), + (this._zonePool[ + this._zonePoolIndex + ].endBufferLine = e3.marker.line), + void this._zones.push( + this._zonePool[this._zonePoolIndex++] + ) + ); + this._zones.push({ + color: e3.options.overviewRulerOptions.color, + position: e3.options.overviewRulerOptions.position, + startBufferLine: e3.marker.line, + endBufferLine: e3.marker.line, + }), + this._zonePool.push( + this._zones[this._zones.length - 1] + ), + this._zonePoolIndex++; + } + } + setPadding(e3) { + this._linePadding = e3; + } + _lineIntersectsZone(e3, t3) { + return ( + t3 >= e3.startBufferLine && t3 <= e3.endBufferLine + ); + } + _lineAdjacentToZone(e3, t3, i2) { + return ( + t3 >= + e3.startBufferLine - + this._linePadding[i2 || "full"] && + t3 <= + e3.endBufferLine + this._linePadding[i2 || "full"] + ); + } + _addLineToZone(e3, t3) { + (e3.startBufferLine = Math.min(e3.startBufferLine, t3)), + (e3.endBufferLine = Math.max(e3.endBufferLine, t3)); + } + }); + }, + 5744: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.OverviewRulerRenderer = void 0); + const n = i2(5871), + o = i2(4725), + a = i2(844), + h = i2(2585), + c = { full: 0, left: 0, center: 0, right: 0 }, + l = { full: 0, left: 0, center: 0, right: 0 }, + d = { full: 0, left: 0, center: 0, right: 0 }; + let _ = (t2.OverviewRulerRenderer = class extends ( + a.Disposable + ) { + get _width() { + return ( + this._optionsService.options.overviewRulerWidth || 0 + ); + } + constructor(e3, t3, i3, s3, r2, o2, h2) { + super(), + (this._viewportElement = e3), + (this._screenElement = t3), + (this._bufferService = i3), + (this._decorationService = s3), + (this._renderService = r2), + (this._optionsService = o2), + (this._coreBrowserService = h2), + (this._colorZoneStore = new n.ColorZoneStore()), + (this._shouldUpdateDimensions = true), + (this._shouldUpdateAnchor = true), + (this._lastKnownBufferLength = 0), + (this._canvas = + this._coreBrowserService.mainDocument.createElement( + "canvas" + )), + this._canvas.classList.add( + "xterm-decoration-overview-ruler" + ), + this._refreshCanvasDimensions(), + this._viewportElement.parentElement?.insertBefore( + this._canvas, + this._viewportElement + ); + const c2 = this._canvas.getContext("2d"); + if (!c2) throw new Error("Ctx cannot be null"); + (this._ctx = c2), + this._registerDecorationListeners(), + this._registerBufferChangeListeners(), + this._registerDimensionChangeListeners(), + this.register( + (0, a.toDisposable)(() => { + this._canvas?.remove(); + }) + ); + } + _registerDecorationListeners() { + this.register( + this._decorationService.onDecorationRegistered(() => + this._queueRefresh(void 0, true) + ) + ), + this.register( + this._decorationService.onDecorationRemoved(() => + this._queueRefresh(void 0, true) + ) + ); + } + _registerBufferChangeListeners() { + 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()); + }) + ); + } + _registerDimensionChangeListeners() { + this.register( + this._renderService.onRender(() => { + (this._containerHeight && + this._containerHeight === + this._screenElement.clientHeight) || + (this._queueRefresh(true), + (this._containerHeight = + this._screenElement.clientHeight)); + }) + ), + this.register( + this._optionsService.onSpecificOptionChange( + "overviewRulerWidth", + () => this._queueRefresh(true) + ) + ), + this.register( + this._coreBrowserService.onDprChange(() => + this._queueRefresh(true) + ) + ), + this._queueRefresh(true); + } + _refreshDrawConstants() { + const e3 = Math.floor(this._canvas.width / 3), + t3 = Math.ceil(this._canvas.width / 3); + (l.full = this._canvas.width), + (l.left = e3), + (l.center = t3), + (l.right = e3), + this._refreshDrawHeightConstants(), + (d.full = 0), + (d.left = 0), + (d.center = l.left), + (d.right = l.left + l.center); + } + _refreshDrawHeightConstants() { + c.full = Math.round(2 * this._coreBrowserService.dpr); + const e3 = + this._canvas.height / + this._bufferService.buffer.lines.length, + t3 = Math.round( + Math.max(Math.min(e3, 12), 6) * + this._coreBrowserService.dpr + ); + (c.left = t3), (c.center = t3), (c.right = t3); + } + _refreshColorZonePadding() { + this._colorZoneStore.setPadding({ + full: Math.floor( + (this._bufferService.buffers.active.lines.length / + (this._canvas.height - 1)) * + c.full + ), + left: Math.floor( + (this._bufferService.buffers.active.lines.length / + (this._canvas.height - 1)) * + c.left + ), + center: Math.floor( + (this._bufferService.buffers.active.lines.length / + (this._canvas.height - 1)) * + c.center + ), + right: Math.floor( + (this._bufferService.buffers.active.lines.length / + (this._canvas.height - 1)) * + c.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 e4 of this._decorationService.decorations) + this._colorZoneStore.addDecoration(e4); + this._ctx.lineWidth = 1; + const e3 = this._colorZoneStore.zones; + for (const t3 of e3) + "full" !== t3.position && this._renderColorZone(t3); + for (const t3 of e3) + "full" === t3.position && this._renderColorZone(t3); + (this._shouldUpdateDimensions = false), + (this._shouldUpdateAnchor = false); + } + _renderColorZone(e3) { + (this._ctx.fillStyle = e3.color), + this._ctx.fillRect( + d[e3.position || "full"], + Math.round( + (this._canvas.height - 1) * + (e3.startBufferLine / + this._bufferService.buffers.active.lines + .length) - + c[e3.position || "full"] / 2 + ), + l[e3.position || "full"], + Math.round( + (this._canvas.height - 1) * + ((e3.endBufferLine - e3.startBufferLine) / + this._bufferService.buffers.active.lines + .length) + + c[e3.position || "full"] + ) + ); + } + _queueRefresh(e3, t3) { + (this._shouldUpdateDimensions = + e3 || this._shouldUpdateDimensions), + (this._shouldUpdateAnchor = + t3 || this._shouldUpdateAnchor), + void 0 === this._animationFrame && + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._refreshDecorations(), + (this._animationFrame = void 0); + } + )); + } + }); + t2.OverviewRulerRenderer = _ = s2( + [ + r(2, h.IBufferService), + r(3, h.IDecorationService), + r(4, o.IRenderService), + r(5, h.IOptionsService), + r(6, o.ICoreBrowserService), + ], + _ + ); + }, + 2950: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CompositionHelper = void 0); + const n = i2(4725), + o = i2(2585), + a = i2(2584); + let h = (t2.CompositionHelper = class { + get isComposing() { + return this._isComposing; + } + constructor(e3, t3, i3, s3, r2, n2) { + (this._textarea = e3), + (this._compositionView = t3), + (this._bufferService = i3), + (this._optionsService = s3), + (this._coreService = r2), + (this._renderService = n2), + (this._isComposing = false), + (this._isSendingComposition = false), + (this._compositionPosition = { start: 0, end: 0 }), + (this._dataAlreadySent = ""); + } + compositionstart() { + (this._isComposing = true), + (this._compositionPosition.start = + this._textarea.value.length), + (this._compositionView.textContent = ""), + (this._dataAlreadySent = ""), + this._compositionView.classList.add("active"); + } + compositionupdate(e3) { + (this._compositionView.textContent = e3.data), + this.updateCompositionElements(), + setTimeout(() => { + this._compositionPosition.end = + this._textarea.value.length; + }, 0); + } + compositionend() { + this._finalizeComposition(true); + } + keydown(e3) { + if (this._isComposing || this._isSendingComposition) { + if (229 === e3.keyCode) return false; + if ( + 16 === e3.keyCode || + 17 === e3.keyCode || + 18 === e3.keyCode + ) + return false; + this._finalizeComposition(false); + } + return ( + 229 !== e3.keyCode || + (this._handleAnyTextareaChanges(), false) + ); + } + _finalizeComposition(e3) { + if ( + (this._compositionView.classList.remove("active"), + (this._isComposing = false), + e3) + ) { + const e4 = { + start: this._compositionPosition.start, + end: this._compositionPosition.end, + }; + (this._isSendingComposition = true), + setTimeout(() => { + if (this._isSendingComposition) { + let t3; + (this._isSendingComposition = false), + (e4.start += this._dataAlreadySent.length), + (t3 = this._isComposing + ? this._textarea.value.substring( + e4.start, + e4.end + ) + : this._textarea.value.substring(e4.start)), + t3.length > 0 && + this._coreService.triggerDataEvent(t3, true); + } + }, 0); + } else { + this._isSendingComposition = false; + const e4 = this._textarea.value.substring( + this._compositionPosition.start, + this._compositionPosition.end + ); + this._coreService.triggerDataEvent(e4, true); + } + } + _handleAnyTextareaChanges() { + const e3 = this._textarea.value; + setTimeout(() => { + if (!this._isComposing) { + const t3 = this._textarea.value, + i3 = t3.replace(e3, ""); + (this._dataAlreadySent = i3), + t3.length > e3.length + ? this._coreService.triggerDataEvent(i3, true) + : t3.length < e3.length + ? this._coreService.triggerDataEvent( + `${a.C0.DEL}`, + true + ) + : t3.length === e3.length && + t3 !== e3 && + this._coreService.triggerDataEvent(t3, true); + } + }, 0); + } + updateCompositionElements(e3) { + if (this._isComposing) { + if (this._bufferService.buffer.isCursorInViewport) { + const e4 = Math.min( + this._bufferService.buffer.x, + this._bufferService.cols - 1 + ), + t3 = this._renderService.dimensions.css.cell.height, + i3 = + this._bufferService.buffer.y * + this._renderService.dimensions.css.cell.height, + s3 = + e4 * + this._renderService.dimensions.css.cell.width; + (this._compositionView.style.left = s3 + "px"), + (this._compositionView.style.top = i3 + "px"), + (this._compositionView.style.height = t3 + "px"), + (this._compositionView.style.lineHeight = + t3 + "px"), + (this._compositionView.style.fontFamily = + this._optionsService.rawOptions.fontFamily), + (this._compositionView.style.fontSize = + this._optionsService.rawOptions.fontSize + "px"); + const r2 = + this._compositionView.getBoundingClientRect(); + (this._textarea.style.left = s3 + "px"), + (this._textarea.style.top = i3 + "px"), + (this._textarea.style.width = + Math.max(r2.width, 1) + "px"), + (this._textarea.style.height = + Math.max(r2.height, 1) + "px"), + (this._textarea.style.lineHeight = + r2.height + "px"); + } + e3 || + setTimeout( + () => this.updateCompositionElements(true), + 0 + ); + } + } + }); + t2.CompositionHelper = h = s2( + [ + r(2, o.IBufferService), + r(3, o.IOptionsService), + r(4, o.ICoreService), + r(5, n.IRenderService), + ], + h + ); + }, + 9806: (e2, t2) => { + function i2(e3, t3, i3) { + const s2 = i3.getBoundingClientRect(), + r = e3.getComputedStyle(i3), + n = parseInt(r.getPropertyValue("padding-left")), + o = parseInt(r.getPropertyValue("padding-top")); + return [t3.clientX - s2.left - n, t3.clientY - s2.top - o]; + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getCoords = t2.getCoordsRelativeToElement = void 0), + (t2.getCoordsRelativeToElement = i2), + (t2.getCoords = function (e3, t3, s2, r, n, o, a, h, c) { + if (!o) return; + const l = i2(e3, t3, s2); + return l + ? ((l[0] = Math.ceil((l[0] + (c ? a / 2 : 0)) / a)), + (l[1] = Math.ceil(l[1] / h)), + (l[0] = Math.min(Math.max(l[0], 1), r + (c ? 1 : 0))), + (l[1] = Math.min(Math.max(l[1], 1), n)), + l) + : void 0; + }); + }, + 9504: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.moveToCellSequence = void 0); + const s2 = i2(2584); + function r(e3, t3, i3, s3) { + const r2 = e3 - n(e3, i3), + a2 = t3 - n(t3, i3), + l = + Math.abs(r2 - a2) - + (function (e4, t4, i4) { + let s4 = 0; + const r3 = e4 - n(e4, i4), + a3 = t4 - n(t4, i4); + for (let n2 = 0; n2 < Math.abs(r3 - a3); n2++) { + const a4 = "A" === o(e4, t4) ? -1 : 1, + h2 = i4.buffer.lines.get(r3 + a4 * n2); + h2?.isWrapped && s4++; + } + return s4; + })(e3, t3, i3); + return c(l, h(o(e3, t3), s3)); + } + function n(e3, t3) { + let i3 = 0, + s3 = t3.buffer.lines.get(e3), + r2 = s3?.isWrapped; + for (; r2 && e3 >= 0 && e3 < t3.rows; ) + i3++, + (s3 = t3.buffer.lines.get(--e3)), + (r2 = s3?.isWrapped); + return i3; + } + function o(e3, t3) { + return e3 > t3 ? "A" : "B"; + } + function a(e3, t3, i3, s3, r2, n2) { + let o2 = e3, + a2 = t3, + h2 = ""; + for (; o2 !== i3 || a2 !== s3; ) + (o2 += r2 ? 1 : -1), + r2 && o2 > n2.cols - 1 + ? ((h2 += n2.buffer.translateBufferLineToString( + a2, + false, + e3, + o2 + )), + (o2 = 0), + (e3 = 0), + a2++) + : !r2 && + o2 < 0 && + ((h2 += n2.buffer.translateBufferLineToString( + a2, + false, + 0, + e3 + 1 + )), + (o2 = n2.cols - 1), + (e3 = o2), + a2--); + return ( + h2 + + n2.buffer.translateBufferLineToString(a2, false, e3, o2) + ); + } + function h(e3, t3) { + const i3 = t3 ? "O" : "["; + return s2.C0.ESC + i3 + e3; + } + function c(e3, t3) { + e3 = Math.floor(e3); + let i3 = ""; + for (let s3 = 0; s3 < e3; s3++) i3 += t3; + return i3; + } + t2.moveToCellSequence = function (e3, t3, i3, s3) { + const o2 = i3.buffer.x, + l = i3.buffer.y; + if (!i3.buffer.hasScrollback) + return ( + (function (e4, t4, i4, s4, o3, l2) { + return 0 === r(t4, s4, o3, l2).length + ? "" + : c( + a(e4, t4, e4, t4 - n(t4, o3), false, o3).length, + h("D", l2) + ); + })(o2, l, 0, t3, i3, s3) + + r(l, t3, i3, s3) + + (function (e4, t4, i4, s4, o3, l2) { + let d2; + d2 = + r(t4, s4, o3, l2).length > 0 ? s4 - n(s4, o3) : t4; + const _2 = s4, + u = (function (e5, t5, i5, s5, o4, a2) { + let h2; + return ( + (h2 = + r(i5, s5, o4, a2).length > 0 + ? s5 - n(s5, o4) + : t5), + (e5 < i5 && h2 <= s5) || (e5 >= i5 && h2 < s5) + ? "C" + : "D" + ); + })(e4, t4, i4, s4, o3, l2); + return c( + a(e4, d2, i4, _2, "C" === u, o3).length, + h(u, l2) + ); + })(o2, l, e3, t3, i3, s3) + ); + let d; + if (l === t3) + return ( + (d = o2 > e3 ? "D" : "C"), + c(Math.abs(o2 - e3), h(d, s3)) + ); + d = l > t3 ? "D" : "C"; + const _ = Math.abs(l - t3); + return c( + (function (e4, t4) { + return t4.cols - e4; + })(l > t3 ? e3 : o2, i3) + + (_ - 1) * i3.cols + + 1 + + ((l > t3 ? o2 : e3) - 1), + h(d, s3) + ); + }; + }, + 1296: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DomRenderer = void 0); + const n = i2(3787), + o = i2(2550), + a = i2(2223), + h = i2(6171), + c = i2(6052), + l = i2(4725), + d = i2(8055), + _ = i2(8460), + u = i2(844), + f = i2(2585), + v = "xterm-dom-renderer-owner-", + p = "xterm-rows", + g = "xterm-fg-", + m = "xterm-bg-", + S = "xterm-focus", + C = "xterm-selection"; + let b = 1, + w = (t2.DomRenderer = class extends u.Disposable { + constructor( + e3, + t3, + i3, + s3, + r2, + a2, + l2, + d2, + f2, + g2, + m2, + S2, + w2 + ) { + super(), + (this._terminal = e3), + (this._document = t3), + (this._element = i3), + (this._screenElement = s3), + (this._viewportElement = r2), + (this._helperContainer = a2), + (this._linkifier2 = l2), + (this._charSizeService = f2), + (this._optionsService = g2), + (this._bufferService = m2), + (this._coreBrowserService = S2), + (this._themeService = w2), + (this._terminalClass = b++), + (this._rowElements = []), + (this._selectionRenderModel = (0, + c.createSelectionRenderModel)()), + (this.onRequestRedraw = this.register( + new _.EventEmitter() + ).event), + (this._rowContainer = + this._document.createElement("div")), + this._rowContainer.classList.add(p), + (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(C), + this._selectionContainer.setAttribute( + "aria-hidden", + "true" + ), + (this.dimensions = (0, h.createRenderDimensions)()), + this._updateDimensions(), + this.register( + this._optionsService.onOptionChange(() => + this._handleOptionsChanged() + ) + ), + this.register( + this._themeService.onChangeColors((e4) => + this._injectCss(e4) + ) + ), + this._injectCss(this._themeService.colors), + (this._rowFactory = d2.createInstance( + n.DomRendererRowFactory, + document + )), + this._element.classList.add(v + this._terminalClass), + this._screenElement.appendChild(this._rowContainer), + this._screenElement.appendChild( + this._selectionContainer + ), + this.register( + this._linkifier2.onShowLinkUnderline((e4) => + this._handleLinkHover(e4) + ) + ), + this.register( + this._linkifier2.onHideLinkUnderline((e4) => + this._handleLinkLeave(e4) + ) + ), + this.register( + (0, u.toDisposable)(() => { + this._element.classList.remove( + v + this._terminalClass + ), + this._rowContainer.remove(), + this._selectionContainer.remove(), + this._widthCache.dispose(), + this._themeStyleElement.remove(), + this._dimensionsStyleElement.remove(); + }) + ), + (this._widthCache = new o.WidthCache( + this._document, + this._helperContainer + )), + this._widthCache.setFont( + this._optionsService.rawOptions.fontFamily, + this._optionsService.rawOptions.fontSize, + this._optionsService.rawOptions.fontWeight, + this._optionsService.rawOptions.fontWeightBold + ), + this._setDefaultSpacing(); + } + _updateDimensions() { + const e3 = this._coreBrowserService.dpr; + (this.dimensions.device.char.width = + this._charSizeService.width * e3), + (this.dimensions.device.char.height = Math.ceil( + this._charSizeService.height * e3 + )), + (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 / e3 + )), + (this.dimensions.css.canvas.height = Math.round( + this.dimensions.device.canvas.height / e3 + )), + (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 e4 of this._rowElements) + (e4.style.width = `${this.dimensions.css.canvas.width}px`), + (e4.style.height = `${this.dimensions.css.cell.height}px`), + (e4.style.lineHeight = `${this.dimensions.css.cell.height}px`), + (e4.style.overflow = "hidden"); + this._dimensionsStyleElement || + ((this._dimensionsStyleElement = + this._document.createElement("style")), + this._screenElement.appendChild( + this._dimensionsStyleElement + )); + const t3 = `${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`; + (this._dimensionsStyleElement.textContent = t3), + (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(e3) { + this._themeStyleElement || + ((this._themeStyleElement = + this._document.createElement("style")), + this._screenElement.appendChild( + this._themeStyleElement + )); + let t3 = `${this._terminalSelector} .${p} { color: ${e3.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`; + (t3 += `${this._terminalSelector} .${p} .xterm-dim { color: ${d.color.multiplyOpacity(e3.foreground, 0.5).css};}`), + (t3 += `${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 i3 = `blink_underline_${this._terminalClass}`, + s3 = `blink_bar_${this._terminalClass}`, + r2 = `blink_block_${this._terminalClass}`; + (t3 += `@keyframes ${i3} { 50% { border-bottom-style: hidden; }}`), + (t3 += `@keyframes ${s3} { 50% { box-shadow: none; }}`), + (t3 += `@keyframes ${r2} { 0% { background-color: ${e3.cursor.css}; color: ${e3.cursorAccent.css}; } 50% { background-color: inherit; color: ${e3.cursor.css}; }}`), + (t3 += `${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i3} 1s step-end infinite;}${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s3} 1s step-end infinite;}${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r2} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${e3.cursor.css}; color: ${e3.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e3.cursor.css} !important; color: ${e3.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e3.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e3.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e3.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`), + (t3 += `${this._terminalSelector} .${C} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C} div { position: absolute; background-color: ${e3.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C} div { position: absolute; background-color: ${e3.selectionInactiveBackgroundOpaque.css};}`); + for (const [i4, s4] of e3.ansi.entries()) + t3 += `${this._terminalSelector} .${g}${i4} { color: ${s4.css}; }${this._terminalSelector} .${g}${i4}.xterm-dim { color: ${d.color.multiplyOpacity(s4, 0.5).css}; }${this._terminalSelector} .${m}${i4} { background-color: ${s4.css}; }`; + (t3 += `${this._terminalSelector} .${g}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e3.background).css}; }${this._terminalSelector} .${g}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e3.background), 0.5).css}; }${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e3.foreground.css}; }`), + (this._themeStyleElement.textContent = t3); + } + _setDefaultSpacing() { + const e3 = + this.dimensions.css.cell.width - + this._widthCache.get("W", false, false); + (this._rowContainer.style.letterSpacing = `${e3}px`), + (this._rowFactory.defaultSpacing = e3); + } + handleDevicePixelRatioChange() { + this._updateDimensions(), + this._widthCache.clear(), + this._setDefaultSpacing(); + } + _refreshRowElements(e3, t3) { + for ( + let e4 = this._rowElements.length; + e4 <= t3; + e4++ + ) { + const e5 = this._document.createElement("div"); + this._rowContainer.appendChild(e5), + this._rowElements.push(e5); + } + for (; this._rowElements.length > t3; ) + this._rowContainer.removeChild( + this._rowElements.pop() + ); + } + handleResize(e3, t3) { + this._refreshRowElements(e3, t3), + 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(S), + this.renderRows(0, this._bufferService.rows - 1); + } + handleFocus() { + this._rowContainer.classList.add(S), + this.renderRows( + this._bufferService.buffer.y, + this._bufferService.buffer.y + ); + } + handleSelectionChanged(e3, t3, i3) { + if ( + (this._selectionContainer.replaceChildren(), + this._rowFactory.handleSelectionChanged(e3, t3, i3), + this.renderRows(0, this._bufferService.rows - 1), + !e3 || !t3) + ) + return; + this._selectionRenderModel.update( + this._terminal, + e3, + t3, + i3 + ); + const s3 = this._selectionRenderModel.viewportStartRow, + r2 = this._selectionRenderModel.viewportEndRow, + n2 = + this._selectionRenderModel.viewportCappedStartRow, + o2 = this._selectionRenderModel.viewportCappedEndRow; + if (n2 >= this._bufferService.rows || o2 < 0) return; + const a2 = this._document.createDocumentFragment(); + if (i3) { + const i4 = e3[0] > t3[0]; + a2.appendChild( + this._createSelectionElement( + n2, + i4 ? t3[0] : e3[0], + i4 ? e3[0] : t3[0], + o2 - n2 + 1 + ) + ); + } else { + const i4 = s3 === n2 ? e3[0] : 0, + h2 = n2 === r2 ? t3[0] : this._bufferService.cols; + a2.appendChild( + this._createSelectionElement(n2, i4, h2) + ); + const c2 = o2 - n2 - 1; + if ( + (a2.appendChild( + this._createSelectionElement( + n2 + 1, + 0, + this._bufferService.cols, + c2 + ) + ), + n2 !== o2) + ) { + const e4 = + r2 === o2 ? t3[0] : this._bufferService.cols; + a2.appendChild( + this._createSelectionElement(o2, 0, e4) + ); + } + } + this._selectionContainer.appendChild(a2); + } + _createSelectionElement(e3, t3, i3, s3 = 1) { + const r2 = this._document.createElement("div"), + n2 = t3 * this.dimensions.css.cell.width; + let o2 = this.dimensions.css.cell.width * (i3 - t3); + return ( + n2 + o2 > this.dimensions.css.canvas.width && + (o2 = this.dimensions.css.canvas.width - n2), + (r2.style.height = + s3 * this.dimensions.css.cell.height + "px"), + (r2.style.top = + e3 * this.dimensions.css.cell.height + "px"), + (r2.style.left = `${n2}px`), + (r2.style.width = `${o2}px`), + r2 + ); + } + handleCursorMove() {} + _handleOptionsChanged() { + this._updateDimensions(), + this._injectCss(this._themeService.colors), + this._widthCache.setFont( + this._optionsService.rawOptions.fontFamily, + this._optionsService.rawOptions.fontSize, + this._optionsService.rawOptions.fontWeight, + this._optionsService.rawOptions.fontWeightBold + ), + this._setDefaultSpacing(); + } + clear() { + for (const e3 of this._rowElements) + e3.replaceChildren(); + } + renderRows(e3, t3) { + const i3 = this._bufferService.buffer, + s3 = i3.ybase + i3.y, + r2 = Math.min(i3.x, this._bufferService.cols - 1), + n2 = this._optionsService.rawOptions.cursorBlink, + o2 = this._optionsService.rawOptions.cursorStyle, + a2 = + this._optionsService.rawOptions.cursorInactiveStyle; + for (let h2 = e3; h2 <= t3; h2++) { + const e4 = h2 + i3.ydisp, + t4 = this._rowElements[h2], + c2 = i3.lines.get(e4); + if (!t4 || !c2) break; + t4.replaceChildren( + ...this._rowFactory.createRow( + c2, + e4, + e4 === s3, + o2, + a2, + r2, + n2, + this.dimensions.css.cell.width, + this._widthCache, + -1, + -1 + ) + ); + } + } + get _terminalSelector() { + return `.${v}${this._terminalClass}`; + } + _handleLinkHover(e3) { + this._setCellUnderline( + e3.x1, + e3.x2, + e3.y1, + e3.y2, + e3.cols, + true + ); + } + _handleLinkLeave(e3) { + this._setCellUnderline( + e3.x1, + e3.x2, + e3.y1, + e3.y2, + e3.cols, + false + ); + } + _setCellUnderline(e3, t3, i3, s3, r2, n2) { + i3 < 0 && (e3 = 0), s3 < 0 && (t3 = 0); + const o2 = this._bufferService.rows - 1; + (i3 = Math.max(Math.min(i3, o2), 0)), + (s3 = Math.max(Math.min(s3, o2), 0)), + (r2 = Math.min(r2, this._bufferService.cols)); + const a2 = this._bufferService.buffer, + h2 = a2.ybase + a2.y, + c2 = Math.min(a2.x, r2 - 1), + l2 = this._optionsService.rawOptions.cursorBlink, + d2 = this._optionsService.rawOptions.cursorStyle, + _2 = + this._optionsService.rawOptions.cursorInactiveStyle; + for (let o3 = i3; o3 <= s3; ++o3) { + const u2 = o3 + a2.ydisp, + f2 = this._rowElements[o3], + v2 = a2.lines.get(u2); + if (!f2 || !v2) break; + f2.replaceChildren( + ...this._rowFactory.createRow( + v2, + u2, + u2 === h2, + d2, + _2, + c2, + l2, + this.dimensions.css.cell.width, + this._widthCache, + n2 ? (o3 === i3 ? e3 : 0) : -1, + n2 ? (o3 === s3 ? t3 : r2) - 1 : -1 + ) + ); + } + } + }); + t2.DomRenderer = w = s2( + [ + r(7, f.IInstantiationService), + r(8, l.ICharSizeService), + r(9, f.IOptionsService), + r(10, f.IBufferService), + r(11, l.ICoreBrowserService), + r(12, l.IThemeService), + ], + w + ); + }, + 3787: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DomRendererRowFactory = void 0); + const n = i2(2223), + o = i2(643), + a = i2(511), + h = i2(2585), + c = i2(8055), + l = i2(4725), + d = i2(4269), + _ = i2(6171), + u = i2(3734); + let f = (t2.DomRendererRowFactory = class { + constructor(e3, t3, i3, s3, r2, n2, o2) { + (this._document = e3), + (this._characterJoinerService = t3), + (this._optionsService = i3), + (this._coreBrowserService = s3), + (this._coreService = r2), + (this._decorationService = n2), + (this._themeService = o2), + (this._workCell = new a.CellData()), + (this._columnSelectMode = false), + (this.defaultSpacing = 0); + } + handleSelectionChanged(e3, t3, i3) { + (this._selectionStart = e3), + (this._selectionEnd = t3), + (this._columnSelectMode = i3); + } + createRow(e3, t3, i3, s3, r2, a2, h2, l2, _2, f2, p) { + const g = [], + m = + this._characterJoinerService.getJoinedCharacters(t3), + S = this._themeService.colors; + let C, + b = e3.getNoBgTrimmedLength(); + i3 && b < a2 + 1 && (b = a2 + 1); + let w = 0, + y = "", + E = 0, + k = 0, + L = 0, + D = false, + R = 0, + x = false, + A = 0; + const B = [], + T = -1 !== f2 && -1 !== p; + for (let M = 0; M < b; M++) { + e3.loadCell(M, this._workCell); + let b2 = this._workCell.getWidth(); + if (0 === b2) continue; + let O = false, + P = M, + I = this._workCell; + if (m.length > 0 && M === m[0][0]) { + O = true; + const t4 = m.shift(); + (I = new d.JoinedCellData( + this._workCell, + e3.translateToString(true, t4[0], t4[1]), + t4[1] - t4[0] + )), + (P = t4[1] - 1), + (b2 = I.getWidth()); + } + const H = this._isCellInSelection(M, t3), + F = i3 && M === a2, + W = T && M >= f2 && M <= p; + let U = false; + this._decorationService.forEachDecorationAtCell( + M, + t3, + void 0, + (e4) => { + U = true; + } + ); + let N = I.getChars() || o.WHITESPACE_CELL_CHAR; + if ( + (" " === N && + (I.isUnderline() || I.isOverline()) && + (N = "\xA0"), + (A = b2 * l2 - _2.get(N, I.isBold(), I.isItalic())), + C) + ) { + if ( + w && + ((H && x) || (!H && !x && I.bg === E)) && + ((H && x && S.selectionForeground) || I.fg === k) && + I.extended.ext === L && + W === D && + A === R && + !F && + !O && + !U + ) { + I.isInvisible() + ? (y += o.WHITESPACE_CELL_CHAR) + : (y += N), + w++; + continue; + } + w && (C.textContent = y), + (C = this._document.createElement("span")), + (w = 0), + (y = ""); + } else C = this._document.createElement("span"); + if ( + ((E = I.bg), + (k = I.fg), + (L = I.extended.ext), + (D = W), + (R = A), + (x = H), + O && a2 >= M && a2 <= P && (a2 = M), + !this._coreService.isCursorHidden && + F && + this._coreService.isCursorInitialized) + ) { + if ( + (B.push("xterm-cursor"), + this._coreBrowserService.isFocused) + ) + h2 && B.push("xterm-cursor-blink"), + B.push( + "bar" === s3 + ? "xterm-cursor-bar" + : "underline" === s3 + ? "xterm-cursor-underline" + : "xterm-cursor-block" + ); + else if (r2) + switch (r2) { + case "outline": + B.push("xterm-cursor-outline"); + break; + case "block": + B.push("xterm-cursor-block"); + break; + case "bar": + B.push("xterm-cursor-bar"); + break; + case "underline": + B.push("xterm-cursor-underline"); + } + } + if ( + (I.isBold() && B.push("xterm-bold"), + I.isItalic() && B.push("xterm-italic"), + I.isDim() && B.push("xterm-dim"), + (y = I.isInvisible() + ? o.WHITESPACE_CELL_CHAR + : I.getChars() || o.WHITESPACE_CELL_CHAR), + I.isUnderline() && + (B.push( + `xterm-underline-${I.extended.underlineStyle}` + ), + " " === y && (y = "\xA0"), + !I.isUnderlineColorDefault())) + ) + if (I.isUnderlineColorRGB()) + C.style.textDecorationColor = `rgb(${u.AttributeData.toColorRGB(I.getUnderlineColor()).join(",")})`; + else { + let e4 = I.getUnderlineColor(); + this._optionsService.rawOptions + .drawBoldTextInBrightColors && + I.isBold() && + e4 < 8 && + (e4 += 8), + (C.style.textDecorationColor = S.ansi[e4].css); + } + I.isOverline() && + (B.push("xterm-overline"), " " === y && (y = "\xA0")), + I.isStrikethrough() && B.push("xterm-strikethrough"), + W && (C.style.textDecoration = "underline"); + let $ = I.getFgColor(), + j = I.getFgColorMode(), + z = I.getBgColor(), + K = I.getBgColorMode(); + const q = !!I.isInverse(); + if (q) { + const e4 = $; + ($ = z), (z = e4); + const t4 = j; + (j = K), (K = t4); + } + let V, + G, + X, + J = false; + switch ( + (this._decorationService.forEachDecorationAtCell( + M, + t3, + void 0, + (e4) => { + ("top" !== e4.options.layer && J) || + (e4.backgroundColorRGB && + ((K = 50331648), + (z = + (e4.backgroundColorRGB.rgba >> 8) & + 16777215), + (V = e4.backgroundColorRGB)), + e4.foregroundColorRGB && + ((j = 50331648), + ($ = + (e4.foregroundColorRGB.rgba >> 8) & + 16777215), + (G = e4.foregroundColorRGB)), + (J = "top" === e4.options.layer)); + } + ), + !J && + H && + ((V = this._coreBrowserService.isFocused + ? S.selectionBackgroundOpaque + : S.selectionInactiveBackgroundOpaque), + (z = (V.rgba >> 8) & 16777215), + (K = 50331648), + (J = true), + S.selectionForeground && + ((j = 50331648), + ($ = + (S.selectionForeground.rgba >> 8) & 16777215), + (G = S.selectionForeground))), + J && B.push("xterm-decoration-top"), + K) + ) { + case 16777216: + case 33554432: + (X = S.ansi[z]), B.push(`xterm-bg-${z}`); + break; + case 50331648: + (X = c.channels.toColor( + z >> 16, + (z >> 8) & 255, + 255 & z + )), + this._addStyle( + C, + `background-color:#${v((z >>> 0).toString(16), "0", 6)}` + ); + break; + default: + q + ? ((X = S.foreground), + B.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)) + : (X = S.background); + } + switch ( + (V || + (I.isDim() && + (V = c.color.multiplyOpacity(X, 0.5))), + j) + ) { + case 16777216: + case 33554432: + I.isBold() && + $ < 8 && + this._optionsService.rawOptions + .drawBoldTextInBrightColors && + ($ += 8), + this._applyMinimumContrast( + C, + X, + S.ansi[$], + I, + V, + void 0 + ) || B.push(`xterm-fg-${$}`); + break; + case 50331648: + const e4 = c.channels.toColor( + ($ >> 16) & 255, + ($ >> 8) & 255, + 255 & $ + ); + this._applyMinimumContrast(C, X, e4, I, V, G) || + this._addStyle( + C, + `color:#${v($.toString(16), "0", 6)}` + ); + break; + default: + this._applyMinimumContrast( + C, + X, + S.foreground, + I, + V, + G + ) || + (q && + B.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)); + } + B.length && + ((C.className = B.join(" ")), (B.length = 0)), + F || O || U ? (C.textContent = y) : w++, + A !== this.defaultSpacing && + (C.style.letterSpacing = `${A}px`), + g.push(C), + (M = P); + } + return C && w && (C.textContent = y), g; + } + _applyMinimumContrast(e3, t3, i3, s3, r2, n2) { + if ( + 1 === + this._optionsService.rawOptions + .minimumContrastRatio || + (0, _.treatGlyphAsBackgroundColor)(s3.getCode()) + ) + return false; + const o2 = this._getContrastCache(s3); + let a2; + if ( + (r2 || n2 || (a2 = o2.getColor(t3.rgba, i3.rgba)), + void 0 === a2) + ) { + const e4 = + this._optionsService.rawOptions.minimumContrastRatio / + (s3.isDim() ? 2 : 1); + (a2 = c.color.ensureContrastRatio( + r2 || t3, + n2 || i3, + e4 + )), + o2.setColor( + (r2 || t3).rgba, + (n2 || i3).rgba, + a2 ?? null + ); + } + return ( + !!a2 && (this._addStyle(e3, `color:${a2.css}`), true) + ); + } + _getContrastCache(e3) { + return e3.isDim() + ? this._themeService.colors.halfContrastCache + : this._themeService.colors.contrastCache; + } + _addStyle(e3, t3) { + e3.setAttribute( + "style", + `${e3.getAttribute("style") || ""}${t3};` + ); + } + _isCellInSelection(e3, t3) { + const i3 = this._selectionStart, + s3 = this._selectionEnd; + return ( + !(!i3 || !s3) && + (this._columnSelectMode + ? i3[0] <= s3[0] + ? e3 >= i3[0] && + t3 >= i3[1] && + e3 < s3[0] && + t3 <= s3[1] + : e3 < i3[0] && + t3 >= i3[1] && + e3 >= s3[0] && + t3 <= s3[1] + : (t3 > i3[1] && t3 < s3[1]) || + (i3[1] === s3[1] && + t3 === i3[1] && + e3 >= i3[0] && + e3 < s3[0]) || + (i3[1] < s3[1] && t3 === s3[1] && e3 < s3[0]) || + (i3[1] < s3[1] && t3 === i3[1] && e3 >= i3[0])) + ); + } + }); + function v(e3, t3, i3) { + for (; e3.length < i3; ) e3 = t3 + e3; + return e3; + } + t2.DomRendererRowFactory = f = s2( + [ + r(1, l.ICharacterJoinerService), + r(2, h.IOptionsService), + r(3, l.ICoreBrowserService), + r(4, h.ICoreService), + r(5, h.IDecorationService), + r(6, l.IThemeService), + ], + f + ); + }, + 2550: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.WidthCache = void 0), + (t2.WidthCache = class { + constructor(e3, t3) { + (this._flat = new Float32Array(256)), + (this._font = ""), + (this._fontSize = 0), + (this._weight = "normal"), + (this._weightBold = "bold"), + (this._measureElements = []), + (this._container = e3.createElement("div")), + this._container.classList.add( + "xterm-width-cache-measure-container" + ), + this._container.setAttribute("aria-hidden", "true"), + (this._container.style.whiteSpace = "pre"), + (this._container.style.fontKerning = "none"); + const i2 = e3.createElement("span"); + i2.classList.add("xterm-char-measure-element"); + const s2 = e3.createElement("span"); + s2.classList.add("xterm-char-measure-element"), + (s2.style.fontWeight = "bold"); + const r = e3.createElement("span"); + r.classList.add("xterm-char-measure-element"), + (r.style.fontStyle = "italic"); + const n = e3.createElement("span"); + n.classList.add("xterm-char-measure-element"), + (n.style.fontWeight = "bold"), + (n.style.fontStyle = "italic"), + (this._measureElements = [i2, s2, r, n]), + this._container.appendChild(i2), + this._container.appendChild(s2), + this._container.appendChild(r), + this._container.appendChild(n), + t3.appendChild(this._container), + this.clear(); + } + dispose() { + this._container.remove(), + (this._measureElements.length = 0), + (this._holey = void 0); + } + clear() { + this._flat.fill(-9999), + (this._holey = /* @__PURE__ */ new Map()); + } + setFont(e3, t3, i2, s2) { + (e3 === this._font && + t3 === this._fontSize && + i2 === this._weight && + s2 === this._weightBold) || + ((this._font = e3), + (this._fontSize = t3), + (this._weight = i2), + (this._weightBold = s2), + (this._container.style.fontFamily = this._font), + (this._container.style.fontSize = `${this._fontSize}px`), + (this._measureElements[0].style.fontWeight = `${i2}`), + (this._measureElements[1].style.fontWeight = `${s2}`), + (this._measureElements[2].style.fontWeight = `${i2}`), + (this._measureElements[3].style.fontWeight = `${s2}`), + this.clear()); + } + get(e3, t3, i2) { + let s2 = 0; + if ( + !t3 && + !i2 && + 1 === e3.length && + (s2 = e3.charCodeAt(0)) < 256 + ) { + if (-9999 !== this._flat[s2]) return this._flat[s2]; + const t4 = this._measure(e3, 0); + return t4 > 0 && (this._flat[s2] = t4), t4; + } + let r = e3; + t3 && (r += "B"), i2 && (r += "I"); + let n = this._holey.get(r); + if (void 0 === n) { + let s3 = 0; + t3 && (s3 |= 1), + i2 && (s3 |= 2), + (n = this._measure(e3, s3)), + n > 0 && this._holey.set(r, n); + } + return n; + } + _measure(e3, t3) { + const i2 = this._measureElements[t3]; + return ( + (i2.textContent = e3.repeat(32)), i2.offsetWidth / 32 + ); + } + }); + }, + 2223: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TEXT_BASELINE = + t2.DIM_OPACITY = + t2.INVERTED_DEFAULT_COLOR = + void 0); + const s2 = i2(6114); + (t2.INVERTED_DEFAULT_COLOR = 257), + (t2.DIM_OPACITY = 0.5), + (t2.TEXT_BASELINE = + s2.isFirefox || s2.isLegacyEdge + ? "bottom" + : "ideographic"); + }, + 6171: (e2, t2) => { + function i2(e3) { + return 57508 <= e3 && e3 <= 57558; + } + function s2(e3) { + return ( + (e3 >= 128512 && e3 <= 128591) || + (e3 >= 127744 && e3 <= 128511) || + (e3 >= 128640 && e3 <= 128767) || + (e3 >= 9728 && e3 <= 9983) || + (e3 >= 9984 && e3 <= 10175) || + (e3 >= 65024 && e3 <= 65039) || + (e3 >= 129280 && e3 <= 129535) || + (e3 >= 127462 && e3 <= 127487) + ); + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.computeNextVariantOffset = + t2.createRenderDimensions = + t2.treatGlyphAsBackgroundColor = + t2.allowRescaling = + t2.isEmoji = + t2.isRestrictedPowerlineGlyph = + t2.isPowerlineGlyph = + t2.throwIfFalsy = + void 0), + (t2.throwIfFalsy = function (e3) { + if (!e3) throw new Error("value must not be falsy"); + return e3; + }), + (t2.isPowerlineGlyph = i2), + (t2.isRestrictedPowerlineGlyph = function (e3) { + return 57520 <= e3 && e3 <= 57527; + }), + (t2.isEmoji = s2), + (t2.allowRescaling = function (e3, t3, r, n) { + return ( + 1 === t3 && + r > Math.ceil(1.5 * n) && + void 0 !== e3 && + e3 > 255 && + !s2(e3) && + !i2(e3) && + !(function (e4) { + return 57344 <= e4 && e4 <= 63743; + })(e3) + ); + }), + (t2.treatGlyphAsBackgroundColor = function (e3) { + return ( + i2(e3) || + (function (e4) { + return 9472 <= e4 && e4 <= 9631; + })(e3) + ); + }), + (t2.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 }, + }, + }; + }), + (t2.computeNextVariantOffset = function (e3, t3, i3 = 0) { + return ( + (e3 - (2 * Math.round(t3) - i3)) % (2 * Math.round(t3)) + ); + }); + }, + 6052: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createSelectionRenderModel = void 0); + class i2 { + constructor() { + this.clear(); + } + clear() { + (this.hasSelection = false), + (this.columnSelectMode = false), + (this.viewportStartRow = 0), + (this.viewportEndRow = 0), + (this.viewportCappedStartRow = 0), + (this.viewportCappedEndRow = 0), + (this.startCol = 0), + (this.endCol = 0), + (this.selectionStart = void 0), + (this.selectionEnd = void 0); + } + update(e3, t3, i3, s2 = false) { + if ( + ((this.selectionStart = t3), + (this.selectionEnd = i3), + !t3 || !i3 || (t3[0] === i3[0] && t3[1] === i3[1])) + ) + return void this.clear(); + const r = e3.buffers.active.ydisp, + n = t3[1] - r, + o = i3[1] - r, + a = Math.max(n, 0), + h = Math.min(o, e3.rows - 1); + a >= e3.rows || h < 0 + ? this.clear() + : ((this.hasSelection = true), + (this.columnSelectMode = s2), + (this.viewportStartRow = n), + (this.viewportEndRow = o), + (this.viewportCappedStartRow = a), + (this.viewportCappedEndRow = h), + (this.startCol = t3[0]), + (this.endCol = i3[0])); + } + isCellSelected(e3, t3, i3) { + return ( + !!this.hasSelection && + ((i3 -= e3.buffer.active.viewportY), + this.columnSelectMode + ? this.startCol <= this.endCol + ? t3 >= this.startCol && + i3 >= this.viewportCappedStartRow && + t3 < this.endCol && + i3 <= this.viewportCappedEndRow + : t3 < this.startCol && + i3 >= this.viewportCappedStartRow && + t3 >= this.endCol && + i3 <= this.viewportCappedEndRow + : (i3 > this.viewportStartRow && + i3 < this.viewportEndRow) || + (this.viewportStartRow === this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportEndRow && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol)) + ); + } + } + t2.createSelectionRenderModel = function () { + return new i2(); + }; + }, + 456: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.SelectionModel = void 0), + (t2.SelectionModel = class { + constructor(e3) { + (this._bufferService = e3), + (this.isSelectAllActive = false), + (this.selectionStartLength = 0); + } + clearSelection() { + (this.selectionStart = void 0), + (this.selectionEnd = void 0), + (this.isSelectAllActive = false), + (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 e3 = + this.selectionStart[0] + + this.selectionStartLength; + return e3 > this._bufferService.cols + ? e3 % this._bufferService.cols == 0 + ? [ + this._bufferService.cols, + this.selectionStart[1] + + Math.floor( + e3 / this._bufferService.cols + ) - + 1, + ] + : [ + e3 % this._bufferService.cols, + this.selectionStart[1] + + Math.floor(e3 / this._bufferService.cols), + ] + : [e3, this.selectionStart[1]]; + } + if ( + this.selectionStartLength && + this.selectionEnd[1] === this.selectionStart[1] + ) { + const e3 = + this.selectionStart[0] + + this.selectionStartLength; + return e3 > this._bufferService.cols + ? [ + e3 % this._bufferService.cols, + this.selectionStart[1] + + Math.floor(e3 / this._bufferService.cols), + ] + : [ + Math.max(e3, this.selectionEnd[0]), + this.selectionEnd[1], + ]; + } + return this.selectionEnd; + } + } + areSelectionValuesReversed() { + const e3 = this.selectionStart, + t3 = this.selectionEnd; + return ( + !(!e3 || !t3) && + (e3[1] > t3[1] || (e3[1] === t3[1] && e3[0] > t3[0])) + ); + } + handleTrim(e3) { + return ( + this.selectionStart && (this.selectionStart[1] -= e3), + this.selectionEnd && (this.selectionEnd[1] -= e3), + this.selectionEnd && this.selectionEnd[1] < 0 + ? (this.clearSelection(), true) + : (this.selectionStart && + this.selectionStart[1] < 0 && + (this.selectionStart[1] = 0), + false) + ); + } + }); + }, + 428: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CharSizeService = void 0); + const n = i2(2585), + o = i2(8460), + a = i2(844); + let h = (t2.CharSizeService = class extends a.Disposable { + get hasValidSize() { + return this.width > 0 && this.height > 0; + } + constructor(e3, t3, i3) { + super(), + (this._optionsService = i3), + (this.width = 0), + (this.height = 0), + (this._onCharSizeChange = this.register( + new o.EventEmitter() + )), + (this.onCharSizeChange = this._onCharSizeChange.event); + try { + this._measureStrategy = this.register( + new d(this._optionsService) + ); + } catch { + this._measureStrategy = this.register( + new l(e3, t3, this._optionsService) + ); + } + this.register( + this._optionsService.onMultipleOptionChange( + ["fontFamily", "fontSize"], + () => this.measure() + ) + ); + } + measure() { + const e3 = this._measureStrategy.measure(); + (e3.width === this.width && e3.height === this.height) || + ((this.width = e3.width), + (this.height = e3.height), + this._onCharSizeChange.fire()); + } + }); + t2.CharSizeService = h = s2([r(2, n.IOptionsService)], h); + class c extends a.Disposable { + constructor() { + super(...arguments), + (this._result = { width: 0, height: 0 }); + } + _validateAndSet(e3, t3) { + void 0 !== e3 && + e3 > 0 && + void 0 !== t3 && + t3 > 0 && + ((this._result.width = e3), (this._result.height = t3)); + } + } + class l extends c { + constructor(e3, t3, i3) { + super(), + (this._document = e3), + (this._parentElement = t3), + (this._optionsService = i3), + (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 c { + constructor(e3) { + super(), + (this._optionsService = e3), + (this._canvas = new OffscreenCanvas(100, 100)), + (this._ctx = this._canvas.getContext("2d")); + const t3 = this._ctx.measureText("W"); + if ( + !( + "width" in t3 && + "fontBoundingBoxAscent" in t3 && + "fontBoundingBoxDescent" in t3 + ) + ) + throw new Error("Required font metrics not supported"); + } + measure() { + this._ctx.font = `${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`; + const e3 = this._ctx.measureText("W"); + return ( + this._validateAndSet( + e3.width, + e3.fontBoundingBoxAscent + e3.fontBoundingBoxDescent + ), + this._result + ); + } + } + }, + 4269: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CharacterJoinerService = t2.JoinedCellData = void 0); + const n = i2(3734), + o = i2(643), + a = i2(511), + h = i2(2585); + class c extends n.AttributeData { + constructor(e3, t3, i3) { + super(), + (this.content = 0), + (this.combinedData = ""), + (this.fg = e3.fg), + (this.bg = e3.bg), + (this.combinedData = t3), + (this._width = i3); + } + isCombined() { + return 2097152; + } + getWidth() { + return this._width; + } + getChars() { + return this.combinedData; + } + getCode() { + return 2097151; + } + setFromCharData(e3) { + throw new Error("not implemented"); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + t2.JoinedCellData = c; + let l = (t2.CharacterJoinerService = class e3 { + constructor(e4) { + (this._bufferService = e4), + (this._characterJoiners = []), + (this._nextCharacterJoinerId = 0), + (this._workCell = new a.CellData()); + } + register(e4) { + const t3 = { + id: this._nextCharacterJoinerId++, + handler: e4, + }; + return this._characterJoiners.push(t3), t3.id; + } + deregister(e4) { + for (let t3 = 0; t3 < this._characterJoiners.length; t3++) + if (this._characterJoiners[t3].id === e4) + return this._characterJoiners.splice(t3, 1), true; + return false; + } + getJoinedCharacters(e4) { + if (0 === this._characterJoiners.length) return []; + const t3 = this._bufferService.buffer.lines.get(e4); + if (!t3 || 0 === t3.length) return []; + const i3 = [], + s3 = t3.translateToString(true); + let r2 = 0, + n2 = 0, + a2 = 0, + h2 = t3.getFg(0), + c2 = t3.getBg(0); + for (let e5 = 0; e5 < t3.getTrimmedLength(); e5++) + if ( + (t3.loadCell(e5, this._workCell), + 0 !== this._workCell.getWidth()) + ) { + if ( + this._workCell.fg !== h2 || + this._workCell.bg !== c2 + ) { + if (e5 - r2 > 1) { + const e6 = this._getJoinedRanges( + s3, + a2, + n2, + t3, + r2 + ); + for (let t4 = 0; t4 < e6.length; t4++) + i3.push(e6[t4]); + } + (r2 = e5), + (a2 = n2), + (h2 = this._workCell.fg), + (c2 = this._workCell.bg); + } + n2 += + this._workCell.getChars().length || + o.WHITESPACE_CELL_CHAR.length; + } + if (this._bufferService.cols - r2 > 1) { + const e5 = this._getJoinedRanges(s3, a2, n2, t3, r2); + for (let t4 = 0; t4 < e5.length; t4++) i3.push(e5[t4]); + } + return i3; + } + _getJoinedRanges(t3, i3, s3, r2, n2) { + const o2 = t3.substring(i3, s3); + let a2 = []; + try { + a2 = this._characterJoiners[0].handler(o2); + } catch (e4) { + console.error(e4); + } + for (let t4 = 1; t4 < this._characterJoiners.length; t4++) + try { + const i4 = this._characterJoiners[t4].handler(o2); + for (let t5 = 0; t5 < i4.length; t5++) + e3._mergeRanges(a2, i4[t5]); + } catch (e4) { + console.error(e4); + } + return this._stringRangesToCellRanges(a2, r2, n2), a2; + } + _stringRangesToCellRanges(e4, t3, i3) { + let s3 = 0, + r2 = false, + n2 = 0, + a2 = e4[s3]; + if (a2) { + for (let h2 = i3; h2 < this._bufferService.cols; h2++) { + const i4 = t3.getWidth(h2), + c2 = + t3.getString(h2).length || + o.WHITESPACE_CELL_CHAR.length; + if (0 !== i4) { + if ( + (!r2 && + a2[0] <= n2 && + ((a2[0] = h2), (r2 = true)), + a2[1] <= n2) + ) { + if (((a2[1] = h2), (a2 = e4[++s3]), !a2)) break; + a2[0] <= n2 + ? ((a2[0] = h2), (r2 = true)) + : (r2 = false); + } + n2 += c2; + } + } + a2 && (a2[1] = this._bufferService.cols); + } + } + static _mergeRanges(e4, t3) { + let i3 = false; + for (let s3 = 0; s3 < e4.length; s3++) { + const r2 = e4[s3]; + if (i3) { + if (t3[1] <= r2[0]) + return (e4[s3 - 1][1] = t3[1]), e4; + if (t3[1] <= r2[1]) + return ( + (e4[s3 - 1][1] = Math.max(t3[1], r2[1])), + e4.splice(s3, 1), + e4 + ); + e4.splice(s3, 1), s3--; + } else { + if (t3[1] <= r2[0]) return e4.splice(s3, 0, t3), e4; + if (t3[1] <= r2[1]) + return (r2[0] = Math.min(t3[0], r2[0])), e4; + t3[0] < r2[1] && + ((r2[0] = Math.min(t3[0], r2[0])), (i3 = true)); + } + } + return ( + i3 ? (e4[e4.length - 1][1] = t3[1]) : e4.push(t3), e4 + ); + } + }); + t2.CharacterJoinerService = l = s2( + [r(0, h.IBufferService)], + l + ); + }, + 5114: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CoreBrowserService = void 0); + const s2 = i2(844), + r = i2(8460), + n = i2(3656); + class o extends s2.Disposable { + constructor(e3, t3, i3) { + super(), + (this._textarea = e3), + (this._window = t3), + (this.mainDocument = i3), + (this._isFocused = false), + (this._cachedIsFocused = void 0), + (this._screenDprMonitor = new a(this._window)), + (this._onDprChange = this.register( + new r.EventEmitter() + )), + (this.onDprChange = this._onDprChange.event), + (this._onWindowChange = this.register( + new r.EventEmitter() + )), + (this.onWindowChange = this._onWindowChange.event), + this.register( + this.onWindowChange((e4) => + this._screenDprMonitor.setWindow(e4) + ) + ), + this.register( + (0, r.forwardEvent)( + this._screenDprMonitor.onDprChange, + this._onDprChange + ) + ), + this._textarea.addEventListener( + "focus", + () => (this._isFocused = true) + ), + this._textarea.addEventListener( + "blur", + () => (this._isFocused = false) + ); + } + get window() { + return this._window; + } + set window(e3) { + this._window !== e3 && + ((this._window = e3), + 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 + ); + } + } + t2.CoreBrowserService = o; + class a extends s2.Disposable { + constructor(e3) { + super(), + (this._parentWindow = e3), + (this._windowResizeListener = this.register( + new s2.MutableDisposable() + )), + (this._onDprChange = this.register( + new r.EventEmitter() + )), + (this.onDprChange = this._onDprChange.event), + (this._outerListener = () => + this._setDprAndFireIfDiffers()), + (this._currentDevicePixelRatio = + this._parentWindow.devicePixelRatio), + this._updateDpr(), + this._setWindowResizeListener(), + this.register( + (0, s2.toDisposable)(() => this.clearListener()) + ); + } + setWindow(e3) { + (this._parentWindow = e3), + this._setWindowResizeListener(), + this._setDprAndFireIfDiffers(); + } + _setWindowResizeListener() { + this._windowResizeListener.value = (0, + n.addDisposableDomListener)( + 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)); + } + } + }, + 779: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.LinkProviderService = void 0); + const s2 = i2(844); + class r extends s2.Disposable { + constructor() { + super(), + (this.linkProviders = []), + this.register( + (0, s2.toDisposable)( + () => (this.linkProviders.length = 0) + ) + ); + } + registerLinkProvider(e3) { + return ( + this.linkProviders.push(e3), + { + dispose: () => { + const t3 = this.linkProviders.indexOf(e3); + -1 !== t3 && this.linkProviders.splice(t3, 1); + }, + } + ); + } + } + t2.LinkProviderService = r; + }, + 8934: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.MouseService = void 0); + const n = i2(4725), + o = i2(9806); + let a = (t2.MouseService = class { + constructor(e3, t3) { + (this._renderService = e3), (this._charSizeService = t3); + } + getCoords(e3, t3, i3, s3, r2) { + return (0, o.getCoords)( + window, + e3, + t3, + i3, + s3, + this._charSizeService.hasValidSize, + this._renderService.dimensions.css.cell.width, + this._renderService.dimensions.css.cell.height, + r2 + ); + } + getMouseReportCoords(e3, t3) { + const i3 = (0, o.getCoordsRelativeToElement)( + window, + e3, + t3 + ); + if (this._charSizeService.hasValidSize) + return ( + (i3[0] = Math.min( + Math.max(i3[0], 0), + this._renderService.dimensions.css.canvas.width - 1 + )), + (i3[1] = Math.min( + Math.max(i3[1], 0), + this._renderService.dimensions.css.canvas.height - 1 + )), + { + col: Math.floor( + i3[0] / + this._renderService.dimensions.css.cell.width + ), + row: Math.floor( + i3[1] / + this._renderService.dimensions.css.cell.height + ), + x: Math.floor(i3[0]), + y: Math.floor(i3[1]), + } + ); + } + }); + t2.MouseService = a = s2( + [r(0, n.IRenderService), r(1, n.ICharSizeService)], + a + ); + }, + 3230: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.RenderService = void 0); + const n = i2(6193), + o = i2(4725), + a = i2(8460), + h = i2(844), + c = i2(7226), + l = i2(2585); + let d = (t2.RenderService = class extends h.Disposable { + get dimensions() { + return this._renderer.value.dimensions; + } + constructor(e3, t3, i3, s3, r2, o2, l2, d2) { + super(), + (this._rowCount = e3), + (this._charSizeService = s3), + (this._renderer = this.register( + new h.MutableDisposable() + )), + (this._pausedResizeTask = new c.DebouncedIdleTask()), + (this._observerDisposable = this.register( + new h.MutableDisposable() + )), + (this._isPaused = false), + (this._needsFullRefresh = false), + (this._isNextRenderRedrawOnly = true), + (this._needsSelectionRefresh = false), + (this._canvasWidth = 0), + (this._canvasHeight = 0), + (this._selectionState = { + start: void 0, + end: void 0, + columnSelectMode: false, + }), + (this._onDimensionsChange = this.register( + new a.EventEmitter() + )), + (this.onDimensionsChange = + this._onDimensionsChange.event), + (this._onRenderedViewportChange = this.register( + new a.EventEmitter() + )), + (this.onRenderedViewportChange = + this._onRenderedViewportChange.event), + (this._onRender = this.register(new a.EventEmitter())), + (this.onRender = this._onRender.event), + (this._onRefreshRequest = this.register( + new a.EventEmitter() + )), + (this.onRefreshRequest = this._onRefreshRequest.event), + (this._renderDebouncer = new n.RenderDebouncer( + (e4, t4) => this._renderRows(e4, t4), + l2 + )), + this.register(this._renderDebouncer), + this.register( + l2.onDprChange(() => + this.handleDevicePixelRatioChange() + ) + ), + this.register(o2.onResize(() => this._fullRefresh())), + this.register( + o2.buffers.onBufferActivate(() => + this._renderer.value?.clear() + ) + ), + this.register( + i3.onOptionChange(() => this._handleOptionsChanged()) + ), + this.register( + this._charSizeService.onCharSizeChange(() => + this.handleCharSizeChanged() + ) + ), + this.register( + r2.onDecorationRegistered(() => this._fullRefresh()) + ), + this.register( + r2.onDecorationRemoved(() => this._fullRefresh()) + ), + this.register( + i3.onMultipleOptionChange( + [ + "customGlyphs", + "drawBoldTextInBrightColors", + "letterSpacing", + "lineHeight", + "fontFamily", + "fontSize", + "fontWeight", + "fontWeightBold", + "minimumContrastRatio", + "rescaleOverlappingGlyphs", + ], + () => { + this.clear(), + this.handleResize(o2.cols, o2.rows), + this._fullRefresh(); + } + ) + ), + this.register( + i3.onMultipleOptionChange( + ["cursorBlink", "cursorStyle"], + () => + this.refreshRows(o2.buffer.y, o2.buffer.y, true) + ) + ), + this.register( + d2.onChangeColors(() => this._fullRefresh()) + ), + this._registerIntersectionObserver(l2.window, t3), + this.register( + l2.onWindowChange((e4) => + this._registerIntersectionObserver(e4, t3) + ) + ); + } + _registerIntersectionObserver(e3, t3) { + if ("IntersectionObserver" in e3) { + const i3 = new e3.IntersectionObserver( + (e4) => + this._handleIntersectionChange(e4[e4.length - 1]), + { threshold: 0 } + ); + i3.observe(t3), + (this._observerDisposable.value = (0, h.toDisposable)( + () => i3.disconnect() + )); + } + } + _handleIntersectionChange(e3) { + (this._isPaused = + void 0 === e3.isIntersecting + ? 0 === e3.intersectionRatio + : !e3.isIntersecting), + this._isPaused || + this._charSizeService.hasValidSize || + this._charSizeService.measure(), + !this._isPaused && + this._needsFullRefresh && + (this._pausedResizeTask.flush(), + this.refreshRows(0, this._rowCount - 1), + (this._needsFullRefresh = false)); + } + refreshRows(e3, t3, i3 = false) { + this._isPaused + ? (this._needsFullRefresh = true) + : (i3 || (this._isNextRenderRedrawOnly = false), + this._renderDebouncer.refresh( + e3, + t3, + this._rowCount + )); + } + _renderRows(e3, t3) { + this._renderer.value && + ((e3 = Math.min(e3, this._rowCount - 1)), + (t3 = Math.min(t3, this._rowCount - 1)), + this._renderer.value.renderRows(e3, t3), + this._needsSelectionRefresh && + (this._renderer.value.handleSelectionChanged( + this._selectionState.start, + this._selectionState.end, + this._selectionState.columnSelectMode + ), + (this._needsSelectionRefresh = false)), + this._isNextRenderRedrawOnly || + this._onRenderedViewportChange.fire({ + start: e3, + end: t3, + }), + this._onRender.fire({ start: e3, end: t3 }), + (this._isNextRenderRedrawOnly = true)); + } + resize(e3, t3) { + (this._rowCount = t3), 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(e3) { + (this._renderer.value = e3), + this._renderer.value && + (this._renderer.value.onRequestRedraw((e4) => + this.refreshRows(e4.start, e4.end, true) + ), + (this._needsSelectionRefresh = true), + this._fullRefresh()); + } + addRefreshCallback(e3) { + return this._renderDebouncer.addRefreshCallback(e3); + } + _fullRefresh() { + this._isPaused + ? (this._needsFullRefresh = true) + : 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(e3, t3) { + this._renderer.value && + (this._isPaused + ? this._pausedResizeTask.set(() => + this._renderer.value?.handleResize(e3, t3) + ) + : this._renderer.value.handleResize(e3, t3), + this._fullRefresh()); + } + handleCharSizeChanged() { + this._renderer.value?.handleCharSizeChanged(); + } + handleBlur() { + this._renderer.value?.handleBlur(); + } + handleFocus() { + this._renderer.value?.handleFocus(); + } + handleSelectionChanged(e3, t3, i3) { + (this._selectionState.start = e3), + (this._selectionState.end = t3), + (this._selectionState.columnSelectMode = i3), + this._renderer.value?.handleSelectionChanged( + e3, + t3, + i3 + ); + } + handleCursorMove() { + this._renderer.value?.handleCursorMove(); + } + clear() { + this._renderer.value?.clear(); + } + }); + t2.RenderService = d = s2( + [ + r(2, l.IOptionsService), + r(3, o.ICharSizeService), + r(4, l.IDecorationService), + r(5, l.IBufferService), + r(6, o.ICoreBrowserService), + r(7, o.IThemeService), + ], + d + ); + }, + 9312: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.SelectionService = void 0); + const n = i2(9806), + o = i2(9504), + a = i2(456), + h = i2(4725), + c = i2(8460), + l = i2(844), + d = i2(6114), + _ = i2(4841), + u = i2(511), + f = i2(2585), + v = String.fromCharCode(160), + p = new RegExp(v, "g"); + let g = (t2.SelectionService = class extends l.Disposable { + constructor(e3, t3, i3, s3, r2, n2, o2, h2, d2) { + super(), + (this._element = e3), + (this._screenElement = t3), + (this._linkifier = i3), + (this._bufferService = s3), + (this._coreService = r2), + (this._mouseService = n2), + (this._optionsService = o2), + (this._renderService = h2), + (this._coreBrowserService = d2), + (this._dragScrollAmount = 0), + (this._enabled = true), + (this._workCell = new u.CellData()), + (this._mouseDownTimeStamp = 0), + (this._oldHasSelection = false), + (this._oldSelectionStart = void 0), + (this._oldSelectionEnd = void 0), + (this._onLinuxMouseSelection = this.register( + new c.EventEmitter() + )), + (this.onLinuxMouseSelection = + this._onLinuxMouseSelection.event), + (this._onRedrawRequest = this.register( + new c.EventEmitter() + )), + (this.onRequestRedraw = this._onRedrawRequest.event), + (this._onSelectionChange = this.register( + new c.EventEmitter() + )), + (this.onSelectionChange = + this._onSelectionChange.event), + (this._onRequestScrollLines = this.register( + new c.EventEmitter() + )), + (this.onRequestScrollLines = + this._onRequestScrollLines.event), + (this._mouseMoveListener = (e4) => + this._handleMouseMove(e4)), + (this._mouseUpListener = (e4) => + this._handleMouseUp(e4)), + this._coreService.onUserInput(() => { + this.hasSelection && this.clearSelection(); + }), + (this._trimListener = + this._bufferService.buffer.lines.onTrim((e4) => + this._handleTrim(e4) + )), + this.register( + this._bufferService.buffers.onBufferActivate((e4) => + this._handleBufferActivate(e4) + ) + ), + this.enable(), + (this._model = new a.SelectionModel( + this._bufferService + )), + (this._activeSelectionMode = 0), + this.register( + (0, l.toDisposable)(() => { + this._removeMouseDownListeners(); + }) + ); + } + reset() { + this.clearSelection(); + } + disable() { + this.clearSelection(), (this._enabled = false); + } + enable() { + this._enabled = true; + } + get selectionStart() { + return this._model.finalSelectionStart; + } + get selectionEnd() { + return this._model.finalSelectionEnd; + } + get hasSelection() { + const e3 = this._model.finalSelectionStart, + t3 = this._model.finalSelectionEnd; + return !( + !e3 || + !t3 || + (e3[0] === t3[0] && e3[1] === t3[1]) + ); + } + get selectionText() { + const e3 = this._model.finalSelectionStart, + t3 = this._model.finalSelectionEnd; + if (!e3 || !t3) return ""; + const i3 = this._bufferService.buffer, + s3 = []; + if (3 === this._activeSelectionMode) { + if (e3[0] === t3[0]) return ""; + const r2 = e3[0] < t3[0] ? e3[0] : t3[0], + n2 = e3[0] < t3[0] ? t3[0] : e3[0]; + for (let o2 = e3[1]; o2 <= t3[1]; o2++) { + const e4 = i3.translateBufferLineToString( + o2, + true, + r2, + n2 + ); + s3.push(e4); + } + } else { + const r2 = e3[1] === t3[1] ? t3[0] : void 0; + s3.push( + i3.translateBufferLineToString(e3[1], true, e3[0], r2) + ); + for (let r3 = e3[1] + 1; r3 <= t3[1] - 1; r3++) { + const e4 = i3.lines.get(r3), + t4 = i3.translateBufferLineToString(r3, true); + e4?.isWrapped + ? (s3[s3.length - 1] += t4) + : s3.push(t4); + } + if (e3[1] !== t3[1]) { + const e4 = i3.lines.get(t3[1]), + r3 = i3.translateBufferLineToString( + t3[1], + true, + 0, + t3[0] + ); + e4 && e4.isWrapped + ? (s3[s3.length - 1] += r3) + : s3.push(r3); + } + } + return s3 + .map((e4) => e4.replace(p, " ")) + .join(d.isWindows ? "\r\n" : "\n"); + } + clearSelection() { + this._model.clearSelection(), + this._removeMouseDownListeners(), + this.refresh(), + this._onSelectionChange.fire(); + } + refresh(e3) { + this._refreshAnimationFrame || + (this._refreshAnimationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => this._refresh() + )), + d.isLinux && + e3 && + 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(e3) { + const t3 = this._getMouseBufferCoords(e3), + i3 = this._model.finalSelectionStart, + s3 = this._model.finalSelectionEnd; + return ( + !!(i3 && s3 && t3) && + this._areCoordsInSelection(t3, i3, s3) + ); + } + isCellInSelection(e3, t3) { + const i3 = this._model.finalSelectionStart, + s3 = this._model.finalSelectionEnd; + return ( + !(!i3 || !s3) && + this._areCoordsInSelection([e3, t3], i3, s3) + ); + } + _areCoordsInSelection(e3, t3, i3) { + return ( + (e3[1] > t3[1] && e3[1] < i3[1]) || + (t3[1] === i3[1] && + e3[1] === t3[1] && + e3[0] >= t3[0] && + e3[0] < i3[0]) || + (t3[1] < i3[1] && e3[1] === i3[1] && e3[0] < i3[0]) || + (t3[1] < i3[1] && e3[1] === t3[1] && e3[0] >= t3[0]) + ); + } + _selectWordAtCursor(e3, t3) { + const i3 = this._linkifier.currentLink?.link?.range; + if (i3) + return ( + (this._model.selectionStart = [ + i3.start.x - 1, + i3.start.y - 1, + ]), + (this._model.selectionStartLength = (0, + _.getRangeLength)(i3, this._bufferService.cols)), + (this._model.selectionEnd = void 0), + true + ); + const s3 = this._getMouseBufferCoords(e3); + return ( + !!s3 && + (this._selectWordAt(s3, t3), + (this._model.selectionEnd = void 0), + true) + ); + } + selectAll() { + (this._model.isSelectAllActive = true), + this.refresh(), + this._onSelectionChange.fire(); + } + selectLines(e3, t3) { + this._model.clearSelection(), + (e3 = Math.max(e3, 0)), + (t3 = Math.min( + t3, + this._bufferService.buffer.lines.length - 1 + )), + (this._model.selectionStart = [0, e3]), + (this._model.selectionEnd = [ + this._bufferService.cols, + t3, + ]), + this.refresh(), + this._onSelectionChange.fire(); + } + _handleTrim(e3) { + this._model.handleTrim(e3) && this.refresh(); + } + _getMouseBufferCoords(e3) { + const t3 = this._mouseService.getCoords( + e3, + this._screenElement, + this._bufferService.cols, + this._bufferService.rows, + true + ); + if (t3) + return ( + t3[0]--, + t3[1]--, + (t3[1] += this._bufferService.buffer.ydisp), + t3 + ); + } + _getMouseEventScrollAmount(e3) { + let t3 = (0, n.getCoordsRelativeToElement)( + this._coreBrowserService.window, + e3, + this._screenElement + )[1]; + const i3 = + this._renderService.dimensions.css.canvas.height; + return t3 >= 0 && t3 <= i3 + ? 0 + : (t3 > i3 && (t3 -= i3), + (t3 = Math.min(Math.max(t3, -50), 50)), + (t3 /= 50), + t3 / Math.abs(t3) + Math.round(14 * t3)); + } + shouldForceSelection(e3) { + return d.isMac + ? e3.altKey && + this._optionsService.rawOptions + .macOptionClickForcesSelection + : e3.shiftKey; + } + handleMouseDown(e3) { + if ( + ((this._mouseDownTimeStamp = e3.timeStamp), + (2 !== e3.button || !this.hasSelection) && + 0 === e3.button) + ) { + if (!this._enabled) { + if (!this.shouldForceSelection(e3)) return; + e3.stopPropagation(); + } + e3.preventDefault(), + (this._dragScrollAmount = 0), + this._enabled && e3.shiftKey + ? this._handleIncrementalClick(e3) + : 1 === e3.detail + ? this._handleSingleClick(e3) + : 2 === e3.detail + ? this._handleDoubleClick(e3) + : 3 === e3.detail && + this._handleTripleClick(e3), + this._addMouseDownListeners(), + this.refresh(true); + } + } + _addMouseDownListeners() { + this._screenElement.ownerDocument && + (this._screenElement.ownerDocument.addEventListener( + "mousemove", + this._mouseMoveListener + ), + this._screenElement.ownerDocument.addEventListener( + "mouseup", + this._mouseUpListener + )), + (this._dragScrollIntervalTimer = + this._coreBrowserService.window.setInterval( + () => this._dragScroll(), + 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(e3) { + this._model.selectionStart && + (this._model.selectionEnd = + this._getMouseBufferCoords(e3)); + } + _handleSingleClick(e3) { + if ( + ((this._model.selectionStartLength = 0), + (this._model.isSelectAllActive = false), + (this._activeSelectionMode = this.shouldColumnSelect(e3) + ? 3 + : 0), + (this._model.selectionStart = + this._getMouseBufferCoords(e3)), + !this._model.selectionStart) + ) + return; + this._model.selectionEnd = void 0; + const t3 = this._bufferService.buffer.lines.get( + this._model.selectionStart[1] + ); + t3 && + t3.length !== this._model.selectionStart[0] && + 0 === t3.hasWidth(this._model.selectionStart[0]) && + this._model.selectionStart[0]++; + } + _handleDoubleClick(e3) { + this._selectWordAtCursor(e3, true) && + (this._activeSelectionMode = 1); + } + _handleTripleClick(e3) { + const t3 = this._getMouseBufferCoords(e3); + t3 && + ((this._activeSelectionMode = 2), + this._selectLineAt(t3[1])); + } + shouldColumnSelect(e3) { + return ( + e3.altKey && + !( + d.isMac && + this._optionsService.rawOptions + .macOptionClickForcesSelection + ) + ); + } + _handleMouseMove(e3) { + if ( + (e3.stopImmediatePropagation(), + !this._model.selectionStart) + ) + return; + const t3 = this._model.selectionEnd + ? [ + this._model.selectionEnd[0], + this._model.selectionEnd[1], + ] + : null; + if ( + ((this._model.selectionEnd = + this._getMouseBufferCoords(e3)), + !this._model.selectionEnd) + ) + return void this.refresh(true); + 2 === this._activeSelectionMode + ? this._model.selectionEnd[1] < + this._model.selectionStart[1] + ? (this._model.selectionEnd[0] = 0) + : (this._model.selectionEnd[0] = + this._bufferService.cols) + : 1 === this._activeSelectionMode && + this._selectToWordAt(this._model.selectionEnd), + (this._dragScrollAmount = + this._getMouseEventScrollAmount(e3)), + 3 !== this._activeSelectionMode && + (this._dragScrollAmount > 0 + ? (this._model.selectionEnd[0] = + this._bufferService.cols) + : this._dragScrollAmount < 0 && + (this._model.selectionEnd[0] = 0)); + const i3 = this._bufferService.buffer; + if (this._model.selectionEnd[1] < i3.lines.length) { + const e4 = i3.lines.get(this._model.selectionEnd[1]); + e4 && + 0 === e4.hasWidth(this._model.selectionEnd[0]) && + this._model.selectionEnd[0] < + this._bufferService.cols && + this._model.selectionEnd[0]++; + } + (t3 && + t3[0] === this._model.selectionEnd[0] && + t3[1] === this._model.selectionEnd[1]) || + this.refresh(true); + } + _dragScroll() { + if ( + this._model.selectionEnd && + this._model.selectionStart && + this._dragScrollAmount + ) { + this._onRequestScrollLines.fire({ + amount: this._dragScrollAmount, + suppressScrollEvent: false, + }); + const e3 = this._bufferService.buffer; + this._dragScrollAmount > 0 + ? (3 !== this._activeSelectionMode && + (this._model.selectionEnd[0] = + this._bufferService.cols), + (this._model.selectionEnd[1] = Math.min( + e3.ydisp + this._bufferService.rows, + e3.lines.length - 1 + ))) + : (3 !== this._activeSelectionMode && + (this._model.selectionEnd[0] = 0), + (this._model.selectionEnd[1] = e3.ydisp)), + this.refresh(); + } + } + _handleMouseUp(e3) { + const t3 = e3.timeStamp - this._mouseDownTimeStamp; + if ( + (this._removeMouseDownListeners(), + this.selectionText.length <= 1 && + t3 < 500 && + e3.altKey && + this._optionsService.rawOptions.altClickMovesCursor) + ) { + if ( + this._bufferService.buffer.ybase === + this._bufferService.buffer.ydisp + ) { + const t4 = this._mouseService.getCoords( + e3, + this._element, + this._bufferService.cols, + this._bufferService.rows, + false + ); + if (t4 && void 0 !== t4[0] && void 0 !== t4[1]) { + const e4 = (0, o.moveToCellSequence)( + t4[0] - 1, + t4[1] - 1, + this._bufferService, + this._coreService.decPrivateModes + .applicationCursorKeys + ); + this._coreService.triggerDataEvent(e4, true); + } + } + } else this._fireEventIfSelectionChanged(); + } + _fireEventIfSelectionChanged() { + const e3 = this._model.finalSelectionStart, + t3 = this._model.finalSelectionEnd, + i3 = !( + !e3 || + !t3 || + (e3[0] === t3[0] && e3[1] === t3[1]) + ); + i3 + ? e3 && + t3 && + ((this._oldSelectionStart && + this._oldSelectionEnd && + e3[0] === this._oldSelectionStart[0] && + e3[1] === this._oldSelectionStart[1] && + t3[0] === this._oldSelectionEnd[0] && + t3[1] === this._oldSelectionEnd[1]) || + this._fireOnSelectionChange(e3, t3, i3)) + : this._oldHasSelection && + this._fireOnSelectionChange(e3, t3, i3); + } + _fireOnSelectionChange(e3, t3, i3) { + (this._oldSelectionStart = e3), + (this._oldSelectionEnd = t3), + (this._oldHasSelection = i3), + this._onSelectionChange.fire(); + } + _handleBufferActivate(e3) { + this.clearSelection(), + this._trimListener.dispose(), + (this._trimListener = e3.activeBuffer.lines.onTrim( + (e4) => this._handleTrim(e4) + )); + } + _convertViewportColToCharacterIndex(e3, t3) { + let i3 = t3; + for (let s3 = 0; t3 >= s3; s3++) { + const r2 = e3 + .loadCell(s3, this._workCell) + .getChars().length; + 0 === this._workCell.getWidth() + ? i3-- + : r2 > 1 && t3 !== s3 && (i3 += r2 - 1); + } + return i3; + } + setSelection(e3, t3, i3) { + this._model.clearSelection(), + this._removeMouseDownListeners(), + (this._model.selectionStart = [e3, t3]), + (this._model.selectionStartLength = i3), + this.refresh(), + this._fireEventIfSelectionChanged(); + } + rightClickSelect(e3) { + this._isClickInSelection(e3) || + (this._selectWordAtCursor(e3, false) && + this.refresh(true), + this._fireEventIfSelectionChanged()); + } + _getWordAt(e3, t3, i3 = true, s3 = true) { + if (e3[0] >= this._bufferService.cols) return; + const r2 = this._bufferService.buffer, + n2 = r2.lines.get(e3[1]); + if (!n2) return; + const o2 = r2.translateBufferLineToString(e3[1], false); + let a2 = this._convertViewportColToCharacterIndex( + n2, + e3[0] + ), + h2 = a2; + const c2 = e3[0] - a2; + let l2 = 0, + d2 = 0, + _2 = 0, + u2 = 0; + if (" " === o2.charAt(a2)) { + for (; a2 > 0 && " " === o2.charAt(a2 - 1); ) a2--; + for (; h2 < o2.length && " " === o2.charAt(h2 + 1); ) + h2++; + } else { + let t4 = e3[0], + i4 = e3[0]; + 0 === n2.getWidth(t4) && (l2++, t4--), + 2 === n2.getWidth(i4) && (d2++, i4++); + const s4 = n2.getString(i4).length; + for ( + s4 > 1 && ((u2 += s4 - 1), (h2 += s4 - 1)); + t4 > 0 && + a2 > 0 && + !this._isCharWordSeparator( + n2.loadCell(t4 - 1, this._workCell) + ); + + ) { + n2.loadCell(t4 - 1, this._workCell); + const e4 = this._workCell.getChars().length; + 0 === this._workCell.getWidth() + ? (l2++, t4--) + : e4 > 1 && ((_2 += e4 - 1), (a2 -= e4 - 1)), + a2--, + t4--; + } + for ( + ; + i4 < n2.length && + h2 + 1 < o2.length && + !this._isCharWordSeparator( + n2.loadCell(i4 + 1, this._workCell) + ); + + ) { + n2.loadCell(i4 + 1, this._workCell); + const e4 = this._workCell.getChars().length; + 2 === this._workCell.getWidth() + ? (d2++, i4++) + : e4 > 1 && ((u2 += e4 - 1), (h2 += e4 - 1)), + h2++, + i4++; + } + } + h2++; + let f2 = a2 + c2 - l2 + _2, + v2 = Math.min( + this._bufferService.cols, + h2 - a2 + l2 + d2 - _2 - u2 + ); + if (t3 || "" !== o2.slice(a2, h2).trim()) { + if (i3 && 0 === f2 && 32 !== n2.getCodePoint(0)) { + const t4 = r2.lines.get(e3[1] - 1); + if ( + t4 && + n2.isWrapped && + 32 !== t4.getCodePoint(this._bufferService.cols - 1) + ) { + const t5 = this._getWordAt( + [this._bufferService.cols - 1, e3[1] - 1], + false, + true, + false + ); + if (t5) { + const e4 = this._bufferService.cols - t5.start; + (f2 -= e4), (v2 += e4); + } + } + } + if ( + s3 && + f2 + v2 === this._bufferService.cols && + 32 !== n2.getCodePoint(this._bufferService.cols - 1) + ) { + const t4 = r2.lines.get(e3[1] + 1); + if (t4?.isWrapped && 32 !== t4.getCodePoint(0)) { + const t5 = this._getWordAt( + [0, e3[1] + 1], + false, + false, + true + ); + t5 && (v2 += t5.length); + } + } + return { start: f2, length: v2 }; + } + } + _selectWordAt(e3, t3) { + const i3 = this._getWordAt(e3, t3); + if (i3) { + for (; i3.start < 0; ) + (i3.start += this._bufferService.cols), e3[1]--; + (this._model.selectionStart = [i3.start, e3[1]]), + (this._model.selectionStartLength = i3.length); + } + } + _selectToWordAt(e3) { + const t3 = this._getWordAt(e3, true); + if (t3) { + let i3 = e3[1]; + for (; t3.start < 0; ) + (t3.start += this._bufferService.cols), i3--; + if (!this._model.areSelectionValuesReversed()) + for ( + ; + t3.start + t3.length > this._bufferService.cols; + + ) + (t3.length -= this._bufferService.cols), i3++; + this._model.selectionEnd = [ + this._model.areSelectionValuesReversed() + ? t3.start + : t3.start + t3.length, + i3, + ]; + } + } + _isCharWordSeparator(e3) { + return ( + 0 !== e3.getWidth() && + this._optionsService.rawOptions.wordSeparator.indexOf( + e3.getChars() + ) >= 0 + ); + } + _selectLineAt(e3) { + const t3 = + this._bufferService.buffer.getWrappedRangeForLine(e3), + i3 = { + start: { x: 0, y: t3.first }, + end: { x: this._bufferService.cols - 1, y: t3.last }, + }; + (this._model.selectionStart = [0, t3.first]), + (this._model.selectionEnd = void 0), + (this._model.selectionStartLength = (0, + _.getRangeLength)(i3, this._bufferService.cols)); + } + }); + t2.SelectionService = g = s2( + [ + r(3, f.IBufferService), + r(4, f.ICoreService), + r(5, h.IMouseService), + r(6, f.IOptionsService), + r(7, h.IRenderService), + r(8, h.ICoreBrowserService), + ], + g + ); + }, + 4725: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ILinkProviderService = + t2.IThemeService = + t2.ICharacterJoinerService = + t2.ISelectionService = + t2.IRenderService = + t2.IMouseService = + t2.ICoreBrowserService = + t2.ICharSizeService = + void 0); + const s2 = i2(8343); + (t2.ICharSizeService = (0, s2.createDecorator)( + "CharSizeService" + )), + (t2.ICoreBrowserService = (0, s2.createDecorator)( + "CoreBrowserService" + )), + (t2.IMouseService = (0, s2.createDecorator)( + "MouseService" + )), + (t2.IRenderService = (0, s2.createDecorator)( + "RenderService" + )), + (t2.ISelectionService = (0, s2.createDecorator)( + "SelectionService" + )), + (t2.ICharacterJoinerService = (0, s2.createDecorator)( + "CharacterJoinerService" + )), + (t2.IThemeService = (0, s2.createDecorator)( + "ThemeService" + )), + (t2.ILinkProviderService = (0, s2.createDecorator)( + "LinkProviderService" + )); + }, + 6731: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ThemeService = t2.DEFAULT_ANSI_COLORS = void 0); + const n = i2(7239), + o = i2(8055), + a = i2(8460), + h = i2(844), + c = i2(2585), + l = o.css.toColor("#ffffff"), + d = o.css.toColor("#000000"), + _ = o.css.toColor("#ffffff"), + u = o.css.toColor("#000000"), + f = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 }; + t2.DEFAULT_ANSI_COLORS = Object.freeze( + (() => { + const e3 = [ + o.css.toColor("#2e3436"), + o.css.toColor("#cc0000"), + o.css.toColor("#4e9a06"), + o.css.toColor("#c4a000"), + o.css.toColor("#3465a4"), + o.css.toColor("#75507b"), + o.css.toColor("#06989a"), + o.css.toColor("#d3d7cf"), + o.css.toColor("#555753"), + o.css.toColor("#ef2929"), + o.css.toColor("#8ae234"), + o.css.toColor("#fce94f"), + o.css.toColor("#729fcf"), + o.css.toColor("#ad7fa8"), + o.css.toColor("#34e2e2"), + o.css.toColor("#eeeeec"), + ], + t3 = [0, 95, 135, 175, 215, 255]; + for (let i3 = 0; i3 < 216; i3++) { + const s3 = t3[(i3 / 36) % 6 | 0], + r2 = t3[(i3 / 6) % 6 | 0], + n2 = t3[i3 % 6]; + e3.push({ + css: o.channels.toCss(s3, r2, n2), + rgba: o.channels.toRgba(s3, r2, n2), + }); + } + for (let t4 = 0; t4 < 24; t4++) { + const i3 = 8 + 10 * t4; + e3.push({ + css: o.channels.toCss(i3, i3, i3), + rgba: o.channels.toRgba(i3, i3, i3), + }); + } + return e3; + })() + ); + let v = (t2.ThemeService = class extends h.Disposable { + get colors() { + return this._colors; + } + constructor(e3) { + super(), + (this._optionsService = e3), + (this._contrastCache = new n.ColorContrastCache()), + (this._halfContrastCache = new n.ColorContrastCache()), + (this._onChangeColors = this.register( + new a.EventEmitter() + )), + (this.onChangeColors = this._onChangeColors.event), + (this._colors = { + foreground: l, + background: d, + cursor: _, + cursorAccent: u, + selectionForeground: void 0, + selectionBackgroundTransparent: f, + selectionBackgroundOpaque: o.color.blend(d, f), + selectionInactiveBackgroundTransparent: f, + selectionInactiveBackgroundOpaque: o.color.blend( + d, + f + ), + ansi: t2.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(e3 = {}) { + const i3 = this._colors; + if ( + ((i3.foreground = p(e3.foreground, l)), + (i3.background = p(e3.background, d)), + (i3.cursor = p(e3.cursor, _)), + (i3.cursorAccent = p(e3.cursorAccent, u)), + (i3.selectionBackgroundTransparent = p( + e3.selectionBackground, + f + )), + (i3.selectionBackgroundOpaque = o.color.blend( + i3.background, + i3.selectionBackgroundTransparent + )), + (i3.selectionInactiveBackgroundTransparent = p( + e3.selectionInactiveBackground, + i3.selectionBackgroundTransparent + )), + (i3.selectionInactiveBackgroundOpaque = o.color.blend( + i3.background, + i3.selectionInactiveBackgroundTransparent + )), + (i3.selectionForeground = e3.selectionForeground + ? p(e3.selectionForeground, o.NULL_COLOR) + : void 0), + i3.selectionForeground === o.NULL_COLOR && + (i3.selectionForeground = void 0), + o.color.isOpaque(i3.selectionBackgroundTransparent)) + ) { + const e4 = 0.3; + i3.selectionBackgroundTransparent = o.color.opacity( + i3.selectionBackgroundTransparent, + e4 + ); + } + if ( + o.color.isOpaque( + i3.selectionInactiveBackgroundTransparent + ) + ) { + const e4 = 0.3; + i3.selectionInactiveBackgroundTransparent = + o.color.opacity( + i3.selectionInactiveBackgroundTransparent, + e4 + ); + } + if ( + ((i3.ansi = t2.DEFAULT_ANSI_COLORS.slice()), + (i3.ansi[0] = p(e3.black, t2.DEFAULT_ANSI_COLORS[0])), + (i3.ansi[1] = p(e3.red, t2.DEFAULT_ANSI_COLORS[1])), + (i3.ansi[2] = p(e3.green, t2.DEFAULT_ANSI_COLORS[2])), + (i3.ansi[3] = p(e3.yellow, t2.DEFAULT_ANSI_COLORS[3])), + (i3.ansi[4] = p(e3.blue, t2.DEFAULT_ANSI_COLORS[4])), + (i3.ansi[5] = p(e3.magenta, t2.DEFAULT_ANSI_COLORS[5])), + (i3.ansi[6] = p(e3.cyan, t2.DEFAULT_ANSI_COLORS[6])), + (i3.ansi[7] = p(e3.white, t2.DEFAULT_ANSI_COLORS[7])), + (i3.ansi[8] = p( + e3.brightBlack, + t2.DEFAULT_ANSI_COLORS[8] + )), + (i3.ansi[9] = p( + e3.brightRed, + t2.DEFAULT_ANSI_COLORS[9] + )), + (i3.ansi[10] = p( + e3.brightGreen, + t2.DEFAULT_ANSI_COLORS[10] + )), + (i3.ansi[11] = p( + e3.brightYellow, + t2.DEFAULT_ANSI_COLORS[11] + )), + (i3.ansi[12] = p( + e3.brightBlue, + t2.DEFAULT_ANSI_COLORS[12] + )), + (i3.ansi[13] = p( + e3.brightMagenta, + t2.DEFAULT_ANSI_COLORS[13] + )), + (i3.ansi[14] = p( + e3.brightCyan, + t2.DEFAULT_ANSI_COLORS[14] + )), + (i3.ansi[15] = p( + e3.brightWhite, + t2.DEFAULT_ANSI_COLORS[15] + )), + e3.extendedAnsi) + ) { + const s3 = Math.min( + i3.ansi.length - 16, + e3.extendedAnsi.length + ); + for (let r2 = 0; r2 < s3; r2++) + i3.ansi[r2 + 16] = p( + e3.extendedAnsi[r2], + t2.DEFAULT_ANSI_COLORS[r2 + 16] + ); + } + this._contrastCache.clear(), + this._halfContrastCache.clear(), + this._updateRestoreColors(), + this._onChangeColors.fire(this.colors); + } + restoreColor(e3) { + this._restoreColor(e3), + this._onChangeColors.fire(this.colors); + } + _restoreColor(e3) { + if (void 0 !== e3) + switch (e3) { + case 256: + this._colors.foreground = + this._restoreColors.foreground; + break; + case 257: + this._colors.background = + this._restoreColors.background; + break; + case 258: + this._colors.cursor = this._restoreColors.cursor; + break; + default: + this._colors.ansi[e3] = + this._restoreColors.ansi[e3]; + } + else + for ( + let e4 = 0; + e4 < this._restoreColors.ansi.length; + ++e4 + ) + this._colors.ansi[e4] = this._restoreColors.ansi[e4]; + } + modifyColors(e3) { + e3(this._colors), this._onChangeColors.fire(this.colors); + } + _updateRestoreColors() { + this._restoreColors = { + foreground: this._colors.foreground, + background: this._colors.background, + cursor: this._colors.cursor, + ansi: this._colors.ansi.slice(), + }; + } + }); + function p(e3, t3) { + if (void 0 !== e3) + try { + return o.css.toColor(e3); + } catch {} + return t3; + } + t2.ThemeService = v = s2([r(0, c.IOptionsService)], v); + }, + 6349: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CircularList = void 0); + const s2 = i2(8460), + r = i2(844); + class n extends r.Disposable { + constructor(e3) { + super(), + (this._maxLength = e3), + (this.onDeleteEmitter = this.register( + new s2.EventEmitter() + )), + (this.onDelete = this.onDeleteEmitter.event), + (this.onInsertEmitter = this.register( + new s2.EventEmitter() + )), + (this.onInsert = this.onInsertEmitter.event), + (this.onTrimEmitter = this.register( + new s2.EventEmitter() + )), + (this.onTrim = this.onTrimEmitter.event), + (this._array = new Array(this._maxLength)), + (this._startIndex = 0), + (this._length = 0); + } + get maxLength() { + return this._maxLength; + } + set maxLength(e3) { + if (this._maxLength === e3) return; + const t3 = new Array(e3); + for (let i3 = 0; i3 < Math.min(e3, this.length); i3++) + t3[i3] = this._array[this._getCyclicIndex(i3)]; + (this._array = t3), + (this._maxLength = e3), + (this._startIndex = 0); + } + get length() { + return this._length; + } + set length(e3) { + if (e3 > this._length) + for (let t3 = this._length; t3 < e3; t3++) + this._array[t3] = void 0; + this._length = e3; + } + get(e3) { + return this._array[this._getCyclicIndex(e3)]; + } + set(e3, t3) { + this._array[this._getCyclicIndex(e3)] = t3; + } + push(e3) { + (this._array[this._getCyclicIndex(this._length)] = e3), + this._length === this._maxLength + ? ((this._startIndex = + ++this._startIndex % this._maxLength), + this.onTrimEmitter.fire(1)) + : this._length++; + } + recycle() { + if (this._length !== this._maxLength) + throw new Error( + "Can only recycle when the buffer is full" + ); + return ( + (this._startIndex = + ++this._startIndex % this._maxLength), + this.onTrimEmitter.fire(1), + this._array[this._getCyclicIndex(this._length - 1)] + ); + } + get isFull() { + return this._length === this._maxLength; + } + pop() { + return this._array[ + this._getCyclicIndex(this._length-- - 1) + ]; + } + splice(e3, t3, ...i3) { + if (t3) { + for (let i4 = e3; i4 < this._length - t3; i4++) + this._array[this._getCyclicIndex(i4)] = + this._array[this._getCyclicIndex(i4 + t3)]; + (this._length -= t3), + this.onDeleteEmitter.fire({ index: e3, amount: t3 }); + } + for (let t4 = this._length - 1; t4 >= e3; t4--) + this._array[this._getCyclicIndex(t4 + i3.length)] = + this._array[this._getCyclicIndex(t4)]; + for (let t4 = 0; t4 < i3.length; t4++) + this._array[this._getCyclicIndex(e3 + t4)] = i3[t4]; + if ( + (i3.length && + this.onInsertEmitter.fire({ + index: e3, + amount: i3.length, + }), + this._length + i3.length > this._maxLength) + ) { + const e4 = this._length + i3.length - this._maxLength; + (this._startIndex += e4), + (this._length = this._maxLength), + this.onTrimEmitter.fire(e4); + } else this._length += i3.length; + } + trimStart(e3) { + e3 > this._length && (e3 = this._length), + (this._startIndex += e3), + (this._length -= e3), + this.onTrimEmitter.fire(e3); + } + shiftElements(e3, t3, i3) { + if (!(t3 <= 0)) { + if (e3 < 0 || e3 >= this._length) + throw new Error("start argument out of range"); + if (e3 + i3 < 0) + throw new Error( + "Cannot shift elements in list beyond index 0" + ); + if (i3 > 0) { + for (let s4 = t3 - 1; s4 >= 0; s4--) + this.set(e3 + s4 + i3, this.get(e3 + s4)); + const s3 = e3 + t3 + i3 - this._length; + if (s3 > 0) + for ( + this._length += s3; + this._length > this._maxLength; + + ) + this._length--, + this._startIndex++, + this.onTrimEmitter.fire(1); + } else + for (let s3 = 0; s3 < t3; s3++) + this.set(e3 + s3 + i3, this.get(e3 + s3)); + } + } + _getCyclicIndex(e3) { + return (this._startIndex + e3) % this._maxLength; + } + } + t2.CircularList = n; + }, + 1439: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.clone = void 0), + (t2.clone = function e3(t3, i2 = 5) { + if ("object" != typeof t3) return t3; + const s2 = Array.isArray(t3) ? [] : {}; + for (const r in t3) + s2[r] = i2 <= 1 ? t3[r] : t3[r] && e3(t3[r], i2 - 1); + return s2; + }); + }, + 8055: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.contrastRatio = + t2.toPaddedHex = + t2.rgba = + t2.rgb = + t2.css = + t2.color = + t2.channels = + t2.NULL_COLOR = + void 0); + let i2 = 0, + s2 = 0, + r = 0, + n = 0; + var o, a, h, c, l; + function d(e3) { + const t3 = e3.toString(16); + return t3.length < 2 ? "0" + t3 : t3; + } + function _(e3, t3) { + return e3 < t3 + ? (t3 + 0.05) / (e3 + 0.05) + : (e3 + 0.05) / (t3 + 0.05); + } + (t2.NULL_COLOR = { css: "#00000000", rgba: 0 }), + (function (e3) { + (e3.toCss = function (e4, t3, i3, s3) { + return void 0 !== s3 + ? `#${d(e4)}${d(t3)}${d(i3)}${d(s3)}` + : `#${d(e4)}${d(t3)}${d(i3)}`; + }), + (e3.toRgba = function (e4, t3, i3, s3 = 255) { + return ( + ((e4 << 24) | (t3 << 16) | (i3 << 8) | s3) >>> 0 + ); + }), + (e3.toColor = function (t3, i3, s3, r2) { + return { + css: e3.toCss(t3, i3, s3, r2), + rgba: e3.toRgba(t3, i3, s3, r2), + }; + }); + })(o || (t2.channels = o = {})), + (function (e3) { + function t3(e4, t4) { + return ( + (n = Math.round(255 * t4)), + ([i2, s2, r] = l.toChannels(e4.rgba)), + { + css: o.toCss(i2, s2, r, n), + rgba: o.toRgba(i2, s2, r, n), + } + ); + } + (e3.blend = function (e4, t4) { + if (((n = (255 & t4.rgba) / 255), 1 === n)) + return { css: t4.css, rgba: t4.rgba }; + const a2 = (t4.rgba >> 24) & 255, + h2 = (t4.rgba >> 16) & 255, + c2 = (t4.rgba >> 8) & 255, + l2 = (e4.rgba >> 24) & 255, + d2 = (e4.rgba >> 16) & 255, + _2 = (e4.rgba >> 8) & 255; + return ( + (i2 = l2 + Math.round((a2 - l2) * n)), + (s2 = d2 + Math.round((h2 - d2) * n)), + (r = _2 + Math.round((c2 - _2) * n)), + { css: o.toCss(i2, s2, r), rgba: o.toRgba(i2, s2, r) } + ); + }), + (e3.isOpaque = function (e4) { + return 255 == (255 & e4.rgba); + }), + (e3.ensureContrastRatio = function (e4, t4, i3) { + const s3 = l.ensureContrastRatio( + e4.rgba, + t4.rgba, + i3 + ); + if (s3) + return o.toColor( + (s3 >> 24) & 255, + (s3 >> 16) & 255, + (s3 >> 8) & 255 + ); + }), + (e3.opaque = function (e4) { + const t4 = (255 | e4.rgba) >>> 0; + return ( + ([i2, s2, r] = l.toChannels(t4)), + { css: o.toCss(i2, s2, r), rgba: t4 } + ); + }), + (e3.opacity = t3), + (e3.multiplyOpacity = function (e4, i3) { + return (n = 255 & e4.rgba), t3(e4, (n * i3) / 255); + }), + (e3.toColorRGB = function (e4) { + return [ + (e4.rgba >> 24) & 255, + (e4.rgba >> 16) & 255, + (e4.rgba >> 8) & 255, + ]; + }); + })(a || (t2.color = a = {})), + (function (e3) { + let t3, a2; + try { + const e4 = document.createElement("canvas"); + (e4.width = 1), (e4.height = 1); + const i3 = e4.getContext("2d", { + willReadFrequently: true, + }); + i3 && + ((t3 = i3), + (t3.globalCompositeOperation = "copy"), + (a2 = t3.createLinearGradient(0, 0, 1, 1))); + } catch {} + e3.toColor = function (e4) { + if (e4.match(/#[\da-f]{3,8}/i)) + switch (e4.length) { + case 4: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + o.toColor(i2, s2, r) + ); + case 5: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + (n = parseInt(e4.slice(4, 5).repeat(2), 16)), + o.toColor(i2, s2, r, n) + ); + case 7: + return { + css: e4, + rgba: + ((parseInt(e4.slice(1), 16) << 8) | 255) >>> + 0, + }; + case 9: + return { + css: e4, + rgba: parseInt(e4.slice(1), 16) >>> 0, + }; + } + const h2 = e4.match( + /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/ + ); + if (h2) + return ( + (i2 = parseInt(h2[1])), + (s2 = parseInt(h2[2])), + (r = parseInt(h2[3])), + (n = Math.round( + 255 * (void 0 === h2[5] ? 1 : parseFloat(h2[5])) + )), + o.toColor(i2, s2, r, n) + ); + if (!t3 || !a2) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + ((t3.fillStyle = a2), + (t3.fillStyle = e4), + "string" != typeof t3.fillStyle) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + (t3.fillRect(0, 0, 1, 1), + ([i2, s2, r, n] = t3.getImageData(0, 0, 1, 1).data), + 255 !== n) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + return { rgba: o.toRgba(i2, s2, r, n), css: e4 }; + }; + })(h || (t2.css = h = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = e4 / 255, + r2 = t4 / 255, + n2 = i3 / 255; + return ( + 0.2126 * + (s3 <= 0.03928 + ? s3 / 12.92 + : Math.pow((s3 + 0.055) / 1.055, 2.4)) + + 0.7152 * + (r2 <= 0.03928 + ? r2 / 12.92 + : Math.pow((r2 + 0.055) / 1.055, 2.4)) + + 0.0722 * + (n2 <= 0.03928 + ? n2 / 12.92 + : Math.pow((n2 + 0.055) / 1.055, 2.4)) + ); + } + (e3.relativeLuminance = function (e4) { + return t3((e4 >> 16) & 255, (e4 >> 8) & 255, 255 & e4); + }), + (e3.relativeLuminance2 = t3); + })(c || (t2.rgb = c = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + n2 = (e4 >> 8) & 255; + let o2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + l2 = _( + c.relativeLuminance2(o2, a3, h2), + c.relativeLuminance2(s3, r2, n2) + ); + for (; l2 < i3 && (o2 > 0 || a3 > 0 || h2 > 0); ) + (o2 -= Math.max(0, Math.ceil(0.1 * o2))), + (a3 -= Math.max(0, Math.ceil(0.1 * a3))), + (h2 -= Math.max(0, Math.ceil(0.1 * h2))), + (l2 = _( + c.relativeLuminance2(o2, a3, h2), + c.relativeLuminance2(s3, r2, n2) + )); + return ( + ((o2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + function a2(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + n2 = (e4 >> 8) & 255; + let o2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + l2 = _( + c.relativeLuminance2(o2, a3, h2), + c.relativeLuminance2(s3, r2, n2) + ); + for (; l2 < i3 && (o2 < 255 || a3 < 255 || h2 < 255); ) + (o2 = Math.min( + 255, + o2 + Math.ceil(0.1 * (255 - o2)) + )), + (a3 = Math.min( + 255, + a3 + Math.ceil(0.1 * (255 - a3)) + )), + (h2 = Math.min( + 255, + h2 + Math.ceil(0.1 * (255 - h2)) + )), + (l2 = _( + c.relativeLuminance2(o2, a3, h2), + c.relativeLuminance2(s3, r2, n2) + )); + return ( + ((o2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + (e3.blend = function (e4, t4) { + if (((n = (255 & t4) / 255), 1 === n)) return t4; + const a3 = (t4 >> 24) & 255, + h2 = (t4 >> 16) & 255, + c2 = (t4 >> 8) & 255, + l2 = (e4 >> 24) & 255, + d2 = (e4 >> 16) & 255, + _2 = (e4 >> 8) & 255; + return ( + (i2 = l2 + Math.round((a3 - l2) * n)), + (s2 = d2 + Math.round((h2 - d2) * n)), + (r = _2 + Math.round((c2 - _2) * n)), + o.toRgba(i2, s2, r) + ); + }), + (e3.ensureContrastRatio = function (e4, i3, s3) { + const r2 = c.relativeLuminance(e4 >> 8), + n2 = c.relativeLuminance(i3 >> 8); + if (_(r2, n2) < s3) { + if (n2 < r2) { + const n3 = t3(e4, i3, s3), + o3 = _(r2, c.relativeLuminance(n3 >> 8)); + if (o3 < s3) { + const t4 = a2(e4, i3, s3); + return o3 > _(r2, c.relativeLuminance(t4 >> 8)) + ? n3 + : t4; + } + return n3; + } + const o2 = a2(e4, i3, s3), + h2 = _(r2, c.relativeLuminance(o2 >> 8)); + if (h2 < s3) { + const n3 = t3(e4, i3, s3); + return h2 > _(r2, c.relativeLuminance(n3 >> 8)) + ? o2 + : n3; + } + return o2; + } + }), + (e3.reduceLuminance = t3), + (e3.increaseLuminance = a2), + (e3.toChannels = function (e4) { + return [ + (e4 >> 24) & 255, + (e4 >> 16) & 255, + (e4 >> 8) & 255, + 255 & e4, + ]; + }); + })(l || (t2.rgba = l = {})), + (t2.toPaddedHex = d), + (t2.contrastRatio = _); + }, + 8969: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CoreTerminal = void 0); + const s2 = i2(844), + r = i2(2585), + n = i2(4348), + o = i2(7866), + a = i2(744), + h = i2(7302), + c = i2(6975), + l = i2(8460), + d = i2(1753), + _ = i2(1480), + u = i2(7994), + f = i2(9282), + v = i2(5435), + p = i2(5981), + g = i2(2660); + let m = false; + class S extends s2.Disposable { + get onScroll() { + return ( + this._onScrollApi || + ((this._onScrollApi = this.register( + new l.EventEmitter() + )), + this._onScroll.event((e3) => { + this._onScrollApi?.fire(e3.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(e3) { + for (const t3 in e3) + this.optionsService.options[t3] = e3[t3]; + } + constructor(e3) { + super(), + (this._windowsWrappingHeuristics = this.register( + new s2.MutableDisposable() + )), + (this._onBinary = this.register(new l.EventEmitter())), + (this.onBinary = this._onBinary.event), + (this._onData = this.register(new l.EventEmitter())), + (this.onData = this._onData.event), + (this._onLineFeed = this.register( + new l.EventEmitter() + )), + (this.onLineFeed = this._onLineFeed.event), + (this._onResize = this.register(new l.EventEmitter())), + (this.onResize = this._onResize.event), + (this._onWriteParsed = this.register( + new l.EventEmitter() + )), + (this.onWriteParsed = this._onWriteParsed.event), + (this._onScroll = this.register(new l.EventEmitter())), + (this._instantiationService = + new n.InstantiationService()), + (this.optionsService = this.register( + new h.OptionsService(e3) + )), + this._instantiationService.setService( + r.IOptionsService, + this.optionsService + ), + (this._bufferService = this.register( + this._instantiationService.createInstance( + a.BufferService + ) + )), + this._instantiationService.setService( + r.IBufferService, + this._bufferService + ), + (this._logService = this.register( + this._instantiationService.createInstance( + o.LogService + ) + )), + this._instantiationService.setService( + r.ILogService, + this._logService + ), + (this.coreService = this.register( + this._instantiationService.createInstance( + c.CoreService + ) + )), + this._instantiationService.setService( + r.ICoreService, + this.coreService + ), + (this.coreMouseService = this.register( + this._instantiationService.createInstance( + d.CoreMouseService + ) + )), + this._instantiationService.setService( + r.ICoreMouseService, + this.coreMouseService + ), + (this.unicodeService = this.register( + this._instantiationService.createInstance( + _.UnicodeService + ) + )), + this._instantiationService.setService( + r.IUnicodeService, + this.unicodeService + ), + (this._charsetService = + this._instantiationService.createInstance( + u.CharsetService + )), + this._instantiationService.setService( + r.ICharsetService, + this._charsetService + ), + (this._oscLinkService = + this._instantiationService.createInstance( + g.OscLinkService + )), + this._instantiationService.setService( + r.IOscLinkService, + this._oscLinkService + ), + (this._inputHandler = this.register( + new v.InputHandler( + this._bufferService, + this._charsetService, + this.coreService, + this._logService, + this.optionsService, + this._oscLinkService, + this.coreMouseService, + this.unicodeService + ) + )), + this.register( + (0, l.forwardEvent)( + this._inputHandler.onLineFeed, + this._onLineFeed + ) + ), + this.register(this._inputHandler), + this.register( + (0, l.forwardEvent)( + this._bufferService.onResize, + this._onResize + ) + ), + this.register( + (0, l.forwardEvent)( + this.coreService.onData, + this._onData + ) + ), + this.register( + (0, l.forwardEvent)( + this.coreService.onBinary, + this._onBinary + ) + ), + this.register( + this.coreService.onRequestScrollToBottom(() => + this.scrollToBottom() + ) + ), + this.register( + this.coreService.onUserInput(() => + this._writeBuffer.handleUserInput() + ) + ), + this.register( + this.optionsService.onMultipleOptionChange( + ["windowsMode", "windowsPty"], + () => this._handleWindowsPtyOptionChange() + ) + ), + this.register( + this._bufferService.onScroll((e4) => { + this._onScroll.fire({ + position: this._bufferService.buffer.ydisp, + source: 0, + }), + this._inputHandler.markRangeDirty( + this._bufferService.buffer.scrollTop, + this._bufferService.buffer.scrollBottom + ); + }) + ), + this.register( + this._inputHandler.onScroll((e4) => { + this._onScroll.fire({ + position: this._bufferService.buffer.ydisp, + source: 0, + }), + this._inputHandler.markRangeDirty( + this._bufferService.buffer.scrollTop, + this._bufferService.buffer.scrollBottom + ); + }) + ), + (this._writeBuffer = this.register( + new p.WriteBuffer((e4, t3) => + this._inputHandler.parse(e4, t3) + ) + )), + this.register( + (0, l.forwardEvent)( + this._writeBuffer.onWriteParsed, + this._onWriteParsed + ) + ); + } + write(e3, t3) { + this._writeBuffer.write(e3, t3); + } + writeSync(e3, t3) { + this._logService.logLevel <= r.LogLevelEnum.WARN && + !m && + (this._logService.warn( + "writeSync is unreliable and will be removed soon." + ), + (m = true)), + this._writeBuffer.writeSync(e3, t3); + } + input(e3, t3 = true) { + this.coreService.triggerDataEvent(e3, t3); + } + resize(e3, t3) { + isNaN(e3) || + isNaN(t3) || + ((e3 = Math.max(e3, a.MINIMUM_COLS)), + (t3 = Math.max(t3, a.MINIMUM_ROWS)), + this._bufferService.resize(e3, t3)); + } + scroll(e3, t3 = false) { + this._bufferService.scroll(e3, t3); + } + scrollLines(e3, t3, i3) { + this._bufferService.scrollLines(e3, t3, i3); + } + scrollPages(e3) { + this.scrollLines(e3 * (this.rows - 1)); + } + scrollToTop() { + this.scrollLines(-this._bufferService.buffer.ydisp); + } + scrollToBottom() { + this.scrollLines( + this._bufferService.buffer.ybase - + this._bufferService.buffer.ydisp + ); + } + scrollToLine(e3) { + const t3 = e3 - this._bufferService.buffer.ydisp; + 0 !== t3 && this.scrollLines(t3); + } + registerEscHandler(e3, t3) { + return this._inputHandler.registerEscHandler(e3, t3); + } + registerDcsHandler(e3, t3) { + return this._inputHandler.registerDcsHandler(e3, t3); + } + registerCsiHandler(e3, t3) { + return this._inputHandler.registerCsiHandler(e3, t3); + } + registerOscHandler(e3, t3) { + return this._inputHandler.registerOscHandler(e3, t3); + } + _setup() { + this._handleWindowsPtyOptionChange(); + } + reset() { + this._inputHandler.reset(), + this._bufferService.reset(), + this._charsetService.reset(), + this.coreService.reset(), + this.coreMouseService.reset(); + } + _handleWindowsPtyOptionChange() { + let e3 = false; + const t3 = this.optionsService.rawOptions.windowsPty; + t3 && + void 0 !== t3.buildNumber && + void 0 !== t3.buildNumber + ? (e3 = !!( + "conpty" === t3.backend && t3.buildNumber < 21376 + )) + : this.optionsService.rawOptions.windowsMode && + (e3 = true), + e3 + ? this._enableWindowsWrappingHeuristics() + : this._windowsWrappingHeuristics.clear(); + } + _enableWindowsWrappingHeuristics() { + if (!this._windowsWrappingHeuristics.value) { + const e3 = []; + e3.push( + this.onLineFeed( + f.updateWindowsModeWrappedState.bind( + null, + this._bufferService + ) + ) + ), + e3.push( + this.registerCsiHandler( + { final: "H" }, + () => ( + (0, f.updateWindowsModeWrappedState)( + this._bufferService + ), + false + ) + ) + ), + (this._windowsWrappingHeuristics.value = (0, + s2.toDisposable)(() => { + for (const t3 of e3) t3.dispose(); + })); + } + } + } + t2.CoreTerminal = S; + }, + 8460: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.runAndSubscribe = + t2.forwardEvent = + t2.EventEmitter = + void 0), + (t2.EventEmitter = class { + constructor() { + (this._listeners = []), (this._disposed = false); + } + get event() { + return ( + this._event || + (this._event = (e3) => ( + this._listeners.push(e3), + { + dispose: () => { + if (!this._disposed) { + for ( + let t3 = 0; + t3 < this._listeners.length; + t3++ + ) + if (this._listeners[t3] === e3) + return void this._listeners.splice( + t3, + 1 + ); + } + }, + } + )), + this._event + ); + } + fire(e3, t3) { + const i2 = []; + for (let e4 = 0; e4 < this._listeners.length; e4++) + i2.push(this._listeners[e4]); + for (let s2 = 0; s2 < i2.length; s2++) + i2[s2].call(void 0, e3, t3); + } + dispose() { + this.clearListeners(), (this._disposed = true); + } + clearListeners() { + this._listeners && (this._listeners.length = 0); + } + }), + (t2.forwardEvent = function (e3, t3) { + return e3((e4) => t3.fire(e4)); + }), + (t2.runAndSubscribe = function (e3, t3) { + return t3(void 0), e3((e4) => t3(e4)); + }); + }, + 5435: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.InputHandler = t2.WindowsOptionsReportType = void 0); + const n = i2(2584), + o = i2(7116), + a = i2(2015), + h = i2(844), + c = i2(482), + l = i2(8437), + d = i2(8460), + _ = i2(643), + u = i2(511), + f = i2(3734), + v = i2(2585), + p = i2(1480), + g = i2(6242), + m = i2(6351), + S = i2(5941), + C = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, + b = 131072; + function w(e3, t3) { + if (e3 > 24) return t3.setWinLines || false; + switch (e3) { + case 1: + return !!t3.restoreWin; + case 2: + return !!t3.minimizeWin; + case 3: + return !!t3.setWinPosition; + case 4: + return !!t3.setWinSizePixels; + case 5: + return !!t3.raiseWin; + case 6: + return !!t3.lowerWin; + case 7: + return !!t3.refreshWin; + case 8: + return !!t3.setWinSizeChars; + case 9: + return !!t3.maximizeWin; + case 10: + return !!t3.fullscreenWin; + case 11: + return !!t3.getWinState; + case 13: + return !!t3.getWinPosition; + case 14: + return !!t3.getWinSizePixels; + case 15: + return !!t3.getScreenSizePixels; + case 16: + return !!t3.getCellSizePixels; + case 18: + return !!t3.getWinSizeChars; + case 19: + return !!t3.getScreenSizeChars; + case 20: + return !!t3.getIconTitle; + case 21: + return !!t3.getWinTitle; + case 22: + return !!t3.pushTitle; + case 23: + return !!t3.popTitle; + case 24: + return !!t3.setWinLines; + } + return false; + } + var y; + !(function (e3) { + (e3[(e3.GET_WIN_SIZE_PIXELS = 0)] = "GET_WIN_SIZE_PIXELS"), + (e3[(e3.GET_CELL_SIZE_PIXELS = 1)] = + "GET_CELL_SIZE_PIXELS"); + })(y || (t2.WindowsOptionsReportType = y = {})); + let E = 0; + class k extends h.Disposable { + getAttrData() { + return this._curAttrData; + } + constructor( + e3, + t3, + i3, + s3, + r2, + h2, + _2, + f2, + v2 = new a.EscapeSequenceParser() + ) { + super(), + (this._bufferService = e3), + (this._charsetService = t3), + (this._coreService = i3), + (this._logService = s3), + (this._optionsService = r2), + (this._oscLinkService = h2), + (this._coreMouseService = _2), + (this._unicodeService = f2), + (this._parser = v2), + (this._parseBuffer = new Uint32Array(4096)), + (this._stringDecoder = new c.StringToUtf32()), + (this._utf8Decoder = new c.Utf8ToUtf32()), + (this._workCell = new u.CellData()), + (this._windowTitle = ""), + (this._iconName = ""), + (this._windowTitleStack = []), + (this._iconNameStack = []), + (this._curAttrData = l.DEFAULT_ATTR_DATA.clone()), + (this._eraseAttrDataInternal = + l.DEFAULT_ATTR_DATA.clone()), + (this._onRequestBell = this.register( + new d.EventEmitter() + )), + (this.onRequestBell = this._onRequestBell.event), + (this._onRequestRefreshRows = this.register( + new d.EventEmitter() + )), + (this.onRequestRefreshRows = + this._onRequestRefreshRows.event), + (this._onRequestReset = this.register( + new d.EventEmitter() + )), + (this.onRequestReset = this._onRequestReset.event), + (this._onRequestSendFocus = this.register( + new d.EventEmitter() + )), + (this.onRequestSendFocus = + this._onRequestSendFocus.event), + (this._onRequestSyncScrollBar = this.register( + new d.EventEmitter() + )), + (this.onRequestSyncScrollBar = + this._onRequestSyncScrollBar.event), + (this._onRequestWindowsOptionsReport = this.register( + new d.EventEmitter() + )), + (this.onRequestWindowsOptionsReport = + this._onRequestWindowsOptionsReport.event), + (this._onA11yChar = this.register( + new d.EventEmitter() + )), + (this.onA11yChar = this._onA11yChar.event), + (this._onA11yTab = this.register(new d.EventEmitter())), + (this.onA11yTab = this._onA11yTab.event), + (this._onCursorMove = this.register( + new d.EventEmitter() + )), + (this.onCursorMove = this._onCursorMove.event), + (this._onLineFeed = this.register( + new d.EventEmitter() + )), + (this.onLineFeed = this._onLineFeed.event), + (this._onScroll = this.register(new d.EventEmitter())), + (this.onScroll = this._onScroll.event), + (this._onTitleChange = this.register( + new d.EventEmitter() + )), + (this.onTitleChange = this._onTitleChange.event), + (this._onColor = this.register(new d.EventEmitter())), + (this.onColor = this._onColor.event), + (this._parseStack = { + paused: false, + cursorStartX: 0, + cursorStartY: 0, + decodedLength: 0, + position: 0, + }), + (this._specialColors = [256, 257, 258]), + this.register(this._parser), + (this._dirtyRowTracker = new L(this._bufferService)), + (this._activeBuffer = this._bufferService.buffer), + this.register( + this._bufferService.buffers.onBufferActivate( + (e4) => (this._activeBuffer = e4.activeBuffer) + ) + ), + this._parser.setCsiHandlerFallback((e4, t4) => { + this._logService.debug("Unknown CSI code: ", { + identifier: this._parser.identToString(e4), + params: t4.toArray(), + }); + }), + this._parser.setEscHandlerFallback((e4) => { + this._logService.debug("Unknown ESC code: ", { + identifier: this._parser.identToString(e4), + }); + }), + this._parser.setExecuteHandlerFallback((e4) => { + this._logService.debug("Unknown EXECUTE code: ", { + code: e4, + }); + }), + this._parser.setOscHandlerFallback((e4, t4, i4) => { + this._logService.debug("Unknown OSC code: ", { + identifier: e4, + action: t4, + data: i4, + }); + }), + this._parser.setDcsHandlerFallback((e4, t4, i4) => { + "HOOK" === t4 && (i4 = i4.toArray()), + this._logService.debug("Unknown DCS code: ", { + identifier: this._parser.identToString(e4), + action: t4, + payload: i4, + }); + }), + this._parser.setPrintHandler((e4, t4, i4) => + this.print(e4, t4, i4) + ), + this._parser.registerCsiHandler({ final: "@" }, (e4) => + this.insertChars(e4) + ), + this._parser.registerCsiHandler( + { intermediates: " ", final: "@" }, + (e4) => this.scrollLeft(e4) + ), + this._parser.registerCsiHandler({ final: "A" }, (e4) => + this.cursorUp(e4) + ), + this._parser.registerCsiHandler( + { intermediates: " ", final: "A" }, + (e4) => this.scrollRight(e4) + ), + this._parser.registerCsiHandler({ final: "B" }, (e4) => + this.cursorDown(e4) + ), + this._parser.registerCsiHandler({ final: "C" }, (e4) => + this.cursorForward(e4) + ), + this._parser.registerCsiHandler({ final: "D" }, (e4) => + this.cursorBackward(e4) + ), + this._parser.registerCsiHandler({ final: "E" }, (e4) => + this.cursorNextLine(e4) + ), + this._parser.registerCsiHandler({ final: "F" }, (e4) => + this.cursorPrecedingLine(e4) + ), + this._parser.registerCsiHandler({ final: "G" }, (e4) => + this.cursorCharAbsolute(e4) + ), + this._parser.registerCsiHandler({ final: "H" }, (e4) => + this.cursorPosition(e4) + ), + this._parser.registerCsiHandler({ final: "I" }, (e4) => + this.cursorForwardTab(e4) + ), + this._parser.registerCsiHandler({ final: "J" }, (e4) => + this.eraseInDisplay(e4, false) + ), + this._parser.registerCsiHandler( + { prefix: "?", final: "J" }, + (e4) => this.eraseInDisplay(e4, true) + ), + this._parser.registerCsiHandler({ final: "K" }, (e4) => + this.eraseInLine(e4, false) + ), + this._parser.registerCsiHandler( + { prefix: "?", final: "K" }, + (e4) => this.eraseInLine(e4, true) + ), + this._parser.registerCsiHandler({ final: "L" }, (e4) => + this.insertLines(e4) + ), + this._parser.registerCsiHandler({ final: "M" }, (e4) => + this.deleteLines(e4) + ), + this._parser.registerCsiHandler({ final: "P" }, (e4) => + this.deleteChars(e4) + ), + this._parser.registerCsiHandler({ final: "S" }, (e4) => + this.scrollUp(e4) + ), + this._parser.registerCsiHandler({ final: "T" }, (e4) => + this.scrollDown(e4) + ), + this._parser.registerCsiHandler({ final: "X" }, (e4) => + this.eraseChars(e4) + ), + this._parser.registerCsiHandler({ final: "Z" }, (e4) => + this.cursorBackwardTab(e4) + ), + this._parser.registerCsiHandler({ final: "`" }, (e4) => + this.charPosAbsolute(e4) + ), + this._parser.registerCsiHandler({ final: "a" }, (e4) => + this.hPositionRelative(e4) + ), + this._parser.registerCsiHandler({ final: "b" }, (e4) => + this.repeatPrecedingCharacter(e4) + ), + this._parser.registerCsiHandler({ final: "c" }, (e4) => + this.sendDeviceAttributesPrimary(e4) + ), + this._parser.registerCsiHandler( + { prefix: ">", final: "c" }, + (e4) => this.sendDeviceAttributesSecondary(e4) + ), + this._parser.registerCsiHandler({ final: "d" }, (e4) => + this.linePosAbsolute(e4) + ), + this._parser.registerCsiHandler({ final: "e" }, (e4) => + this.vPositionRelative(e4) + ), + this._parser.registerCsiHandler({ final: "f" }, (e4) => + this.hVPosition(e4) + ), + this._parser.registerCsiHandler({ final: "g" }, (e4) => + this.tabClear(e4) + ), + this._parser.registerCsiHandler({ final: "h" }, (e4) => + this.setMode(e4) + ), + this._parser.registerCsiHandler( + { prefix: "?", final: "h" }, + (e4) => this.setModePrivate(e4) + ), + this._parser.registerCsiHandler({ final: "l" }, (e4) => + this.resetMode(e4) + ), + this._parser.registerCsiHandler( + { prefix: "?", final: "l" }, + (e4) => this.resetModePrivate(e4) + ), + this._parser.registerCsiHandler({ final: "m" }, (e4) => + this.charAttributes(e4) + ), + this._parser.registerCsiHandler({ final: "n" }, (e4) => + this.deviceStatus(e4) + ), + this._parser.registerCsiHandler( + { prefix: "?", final: "n" }, + (e4) => this.deviceStatusPrivate(e4) + ), + this._parser.registerCsiHandler( + { intermediates: "!", final: "p" }, + (e4) => this.softReset(e4) + ), + this._parser.registerCsiHandler( + { intermediates: " ", final: "q" }, + (e4) => this.setCursorStyle(e4) + ), + this._parser.registerCsiHandler({ final: "r" }, (e4) => + this.setScrollRegion(e4) + ), + this._parser.registerCsiHandler({ final: "s" }, (e4) => + this.saveCursor(e4) + ), + this._parser.registerCsiHandler({ final: "t" }, (e4) => + this.windowOptions(e4) + ), + this._parser.registerCsiHandler({ final: "u" }, (e4) => + this.restoreCursor(e4) + ), + this._parser.registerCsiHandler( + { intermediates: "'", final: "}" }, + (e4) => this.insertColumns(e4) + ), + this._parser.registerCsiHandler( + { intermediates: "'", final: "~" }, + (e4) => this.deleteColumns(e4) + ), + this._parser.registerCsiHandler( + { intermediates: '"', final: "q" }, + (e4) => this.selectProtected(e4) + ), + this._parser.registerCsiHandler( + { intermediates: "$", final: "p" }, + (e4) => this.requestMode(e4, true) + ), + this._parser.registerCsiHandler( + { prefix: "?", intermediates: "$", final: "p" }, + (e4) => this.requestMode(e4, false) + ), + this._parser.setExecuteHandler(n.C0.BEL, () => + this.bell() + ), + this._parser.setExecuteHandler(n.C0.LF, () => + this.lineFeed() + ), + this._parser.setExecuteHandler(n.C0.VT, () => + this.lineFeed() + ), + this._parser.setExecuteHandler(n.C0.FF, () => + this.lineFeed() + ), + this._parser.setExecuteHandler(n.C0.CR, () => + this.carriageReturn() + ), + this._parser.setExecuteHandler(n.C0.BS, () => + this.backspace() + ), + this._parser.setExecuteHandler(n.C0.HT, () => + this.tab() + ), + this._parser.setExecuteHandler(n.C0.SO, () => + this.shiftOut() + ), + this._parser.setExecuteHandler(n.C0.SI, () => + this.shiftIn() + ), + this._parser.setExecuteHandler(n.C1.IND, () => + this.index() + ), + this._parser.setExecuteHandler(n.C1.NEL, () => + this.nextLine() + ), + this._parser.setExecuteHandler(n.C1.HTS, () => + this.tabSet() + ), + this._parser.registerOscHandler( + 0, + new g.OscHandler( + (e4) => ( + this.setTitle(e4), this.setIconName(e4), true + ) + ) + ), + this._parser.registerOscHandler( + 1, + new g.OscHandler((e4) => this.setIconName(e4)) + ), + this._parser.registerOscHandler( + 2, + new g.OscHandler((e4) => this.setTitle(e4)) + ), + this._parser.registerOscHandler( + 4, + new g.OscHandler((e4) => + this.setOrReportIndexedColor(e4) + ) + ), + this._parser.registerOscHandler( + 8, + new g.OscHandler((e4) => this.setHyperlink(e4)) + ), + this._parser.registerOscHandler( + 10, + new g.OscHandler((e4) => this.setOrReportFgColor(e4)) + ), + this._parser.registerOscHandler( + 11, + new g.OscHandler((e4) => this.setOrReportBgColor(e4)) + ), + this._parser.registerOscHandler( + 12, + new g.OscHandler((e4) => + this.setOrReportCursorColor(e4) + ) + ), + this._parser.registerOscHandler( + 104, + new g.OscHandler((e4) => this.restoreIndexedColor(e4)) + ), + this._parser.registerOscHandler( + 110, + new g.OscHandler((e4) => this.restoreFgColor(e4)) + ), + this._parser.registerOscHandler( + 111, + new g.OscHandler((e4) => this.restoreBgColor(e4)) + ), + this._parser.registerOscHandler( + 112, + new g.OscHandler((e4) => this.restoreCursorColor(e4)) + ), + 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 e4 in o.CHARSETS) + this._parser.registerEscHandler( + { intermediates: "(", final: e4 }, + () => this.selectCharset("(" + e4) + ), + this._parser.registerEscHandler( + { intermediates: ")", final: e4 }, + () => this.selectCharset(")" + e4) + ), + this._parser.registerEscHandler( + { intermediates: "*", final: e4 }, + () => this.selectCharset("*" + e4) + ), + this._parser.registerEscHandler( + { intermediates: "+", final: e4 }, + () => this.selectCharset("+" + e4) + ), + this._parser.registerEscHandler( + { intermediates: "-", final: e4 }, + () => this.selectCharset("-" + e4) + ), + this._parser.registerEscHandler( + { intermediates: ".", final: e4 }, + () => this.selectCharset("." + e4) + ), + this._parser.registerEscHandler( + { intermediates: "/", final: e4 }, + () => this.selectCharset("/" + e4) + ); + this._parser.registerEscHandler( + { intermediates: "#", final: "8" }, + () => this.screenAlignmentPattern() + ), + this._parser.setErrorHandler( + (e4) => ( + this._logService.error("Parsing error: ", e4), e4 + ) + ), + this._parser.registerDcsHandler( + { intermediates: "$", final: "q" }, + new m.DcsHandler((e4, t4) => + this.requestStatusString(e4, t4) + ) + ); + } + _preserveStack(e3, t3, i3, s3) { + (this._parseStack.paused = true), + (this._parseStack.cursorStartX = e3), + (this._parseStack.cursorStartY = t3), + (this._parseStack.decodedLength = i3), + (this._parseStack.position = s3); + } + _logSlowResolvingAsync(e3) { + this._logService.logLevel <= v.LogLevelEnum.WARN && + Promise.race([ + e3, + new Promise((e4, t3) => + setTimeout(() => t3("#SLOW_TIMEOUT"), 5e3) + ), + ]).catch((e4) => { + if ("#SLOW_TIMEOUT" !== e4) throw e4; + console.warn( + "async parser handler taking longer than 5000 ms" + ); + }); + } + _getCurrentLinkId() { + return this._curAttrData.extended.urlId; + } + parse(e3, t3) { + let i3, + s3 = this._activeBuffer.x, + r2 = this._activeBuffer.y, + n2 = 0; + const o2 = this._parseStack.paused; + if (o2) { + if ( + (i3 = this._parser.parse( + this._parseBuffer, + this._parseStack.decodedLength, + t3 + )) + ) + return this._logSlowResolvingAsync(i3), i3; + (s3 = this._parseStack.cursorStartX), + (r2 = this._parseStack.cursorStartY), + (this._parseStack.paused = false), + e3.length > b && (n2 = this._parseStack.position + b); + } + if ( + (this._logService.logLevel <= v.LogLevelEnum.DEBUG && + this._logService.debug( + "parsing data" + + ("string" == typeof e3 + ? ` "${e3}"` + : ` "${Array.prototype.map.call(e3, (e4) => String.fromCharCode(e4)).join("")}"`), + "string" == typeof e3 + ? e3.split("").map((e4) => e4.charCodeAt(0)) + : e3 + ), + this._parseBuffer.length < e3.length && + this._parseBuffer.length < b && + (this._parseBuffer = new Uint32Array( + Math.min(e3.length, b) + )), + o2 || this._dirtyRowTracker.clearRange(), + e3.length > b) + ) + for (let t4 = n2; t4 < e3.length; t4 += b) { + const n3 = t4 + b < e3.length ? t4 + b : e3.length, + o3 = + "string" == typeof e3 + ? this._stringDecoder.decode( + e3.substring(t4, n3), + this._parseBuffer + ) + : this._utf8Decoder.decode( + e3.subarray(t4, n3), + this._parseBuffer + ); + if ((i3 = this._parser.parse(this._parseBuffer, o3))) + return ( + this._preserveStack(s3, r2, o3, t4), + this._logSlowResolvingAsync(i3), + i3 + ); + } + else if (!o2) { + const t4 = + "string" == typeof e3 + ? this._stringDecoder.decode(e3, this._parseBuffer) + : this._utf8Decoder.decode(e3, this._parseBuffer); + if ((i3 = this._parser.parse(this._parseBuffer, t4))) + return ( + this._preserveStack(s3, r2, t4, 0), + this._logSlowResolvingAsync(i3), + i3 + ); + } + (this._activeBuffer.x === s3 && + this._activeBuffer.y === r2) || + this._onCursorMove.fire(); + const a2 = + this._dirtyRowTracker.end + + (this._bufferService.buffer.ybase - + this._bufferService.buffer.ydisp), + h2 = + this._dirtyRowTracker.start + + (this._bufferService.buffer.ybase - + this._bufferService.buffer.ydisp); + h2 < this._bufferService.rows && + this._onRequestRefreshRows.fire( + Math.min(h2, this._bufferService.rows - 1), + Math.min(a2, this._bufferService.rows - 1) + ); + } + print(e3, t3, i3) { + let s3, r2; + const n2 = this._charsetService.charset, + o2 = this._optionsService.rawOptions.screenReaderMode, + a2 = this._bufferService.cols, + h2 = this._coreService.decPrivateModes.wraparound, + d2 = this._coreService.modes.insertMode, + u2 = this._curAttrData; + let f2 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ); + this._dirtyRowTracker.markDirty(this._activeBuffer.y), + this._activeBuffer.x && + i3 - t3 > 0 && + 2 === f2.getWidth(this._activeBuffer.x - 1) && + f2.setCellFromCodepoint( + this._activeBuffer.x - 1, + 0, + 1, + u2 + ); + let v2 = this._parser.precedingJoinState; + for (let g2 = t3; g2 < i3; ++g2) { + if (((s3 = e3[g2]), s3 < 127 && n2)) { + const e4 = n2[String.fromCharCode(s3)]; + e4 && (s3 = e4.charCodeAt(0)); + } + const t4 = this._unicodeService.charProperties(s3, v2); + r2 = p.UnicodeService.extractWidth(t4); + const i4 = p.UnicodeService.extractShouldJoin(t4), + m2 = i4 ? p.UnicodeService.extractWidth(v2) : 0; + if ( + ((v2 = t4), + o2 && + this._onA11yChar.fire( + (0, c.stringFromCodePoint)(s3) + ), + this._getCurrentLinkId() && + this._oscLinkService.addLineToLink( + this._getCurrentLinkId(), + this._activeBuffer.ybase + this._activeBuffer.y + ), + this._activeBuffer.x + r2 - m2 > a2) + ) { + if (h2) { + const e4 = f2; + let t5 = this._activeBuffer.x - m2; + for ( + this._activeBuffer.x = m2, + this._activeBuffer.y++, + this._activeBuffer.y === + this._activeBuffer.scrollBottom + 1 + ? (this._activeBuffer.y--, + this._bufferService.scroll( + this._eraseAttrData(), + true + )) + : (this._activeBuffer.y >= + this._bufferService.rows && + (this._activeBuffer.y = + this._bufferService.rows - 1), + (this._activeBuffer.lines.get( + this._activeBuffer.ybase + + this._activeBuffer.y + ).isWrapped = true)), + f2 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + + this._activeBuffer.y + ), + m2 > 0 && + f2 instanceof l.BufferLine && + f2.copyCellsFrom(e4, t5, 0, m2, false); + t5 < a2; + + ) + e4.setCellFromCodepoint(t5++, 0, 1, u2); + } else if ( + ((this._activeBuffer.x = a2 - 1), 2 === r2) + ) + continue; + } + if (i4 && this._activeBuffer.x) { + const e4 = f2.getWidth(this._activeBuffer.x - 1) + ? 1 + : 2; + f2.addCodepointToCell( + this._activeBuffer.x - e4, + s3, + r2 + ); + for (let e5 = r2 - m2; --e5 >= 0; ) + f2.setCellFromCodepoint( + this._activeBuffer.x++, + 0, + 0, + u2 + ); + } else if ( + (d2 && + (f2.insertCells( + this._activeBuffer.x, + r2 - m2, + this._activeBuffer.getNullCell(u2) + ), + 2 === f2.getWidth(a2 - 1) && + f2.setCellFromCodepoint( + a2 - 1, + _.NULL_CELL_CODE, + _.NULL_CELL_WIDTH, + u2 + )), + f2.setCellFromCodepoint( + this._activeBuffer.x++, + s3, + r2, + u2 + ), + r2 > 0) + ) + for (; --r2; ) + f2.setCellFromCodepoint( + this._activeBuffer.x++, + 0, + 0, + u2 + ); + } + (this._parser.precedingJoinState = v2), + this._activeBuffer.x < a2 && + i3 - t3 > 0 && + 0 === f2.getWidth(this._activeBuffer.x) && + !f2.hasContent(this._activeBuffer.x) && + f2.setCellFromCodepoint( + this._activeBuffer.x, + 0, + 1, + u2 + ), + this._dirtyRowTracker.markDirty(this._activeBuffer.y); + } + registerCsiHandler(e3, t3) { + return "t" !== e3.final || e3.prefix || e3.intermediates + ? this._parser.registerCsiHandler(e3, t3) + : this._parser.registerCsiHandler( + e3, + (e4) => + !w( + e4.params[0], + this._optionsService.rawOptions.windowOptions + ) || t3(e4) + ); + } + registerDcsHandler(e3, t3) { + return this._parser.registerDcsHandler( + e3, + new m.DcsHandler(t3) + ); + } + registerEscHandler(e3, t3) { + return this._parser.registerEscHandler(e3, t3); + } + registerOscHandler(e3, t3) { + return this._parser.registerOscHandler( + e3, + new g.OscHandler(t3) + ); + } + bell() { + return this._onRequestBell.fire(), true; + } + lineFeed() { + return ( + this._dirtyRowTracker.markDirty(this._activeBuffer.y), + this._optionsService.rawOptions.convertEol && + (this._activeBuffer.x = 0), + this._activeBuffer.y++, + this._activeBuffer.y === + this._activeBuffer.scrollBottom + 1 + ? (this._activeBuffer.y--, + this._bufferService.scroll(this._eraseAttrData())) + : this._activeBuffer.y >= this._bufferService.rows + ? (this._activeBuffer.y = + this._bufferService.rows - 1) + : (this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ).isWrapped = false), + this._activeBuffer.x >= this._bufferService.cols && + this._activeBuffer.x--, + this._dirtyRowTracker.markDirty(this._activeBuffer.y), + this._onLineFeed.fire(), + true + ); + } + carriageReturn() { + return (this._activeBuffer.x = 0), true; + } + backspace() { + if (!this._coreService.decPrivateModes.reverseWraparound) + return ( + this._restrictCursor(), + this._activeBuffer.x > 0 && this._activeBuffer.x--, + true + ); + if ( + (this._restrictCursor(this._bufferService.cols), + this._activeBuffer.x > 0) + ) + this._activeBuffer.x--; + else if ( + 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 = false), + this._activeBuffer.y--, + (this._activeBuffer.x = this._bufferService.cols - 1); + const e3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ); + e3.hasWidth(this._activeBuffer.x) && + !e3.hasContent(this._activeBuffer.x) && + this._activeBuffer.x--; + } + return this._restrictCursor(), true; + } + tab() { + if (this._activeBuffer.x >= this._bufferService.cols) + return true; + const e3 = this._activeBuffer.x; + return ( + (this._activeBuffer.x = this._activeBuffer.nextStop()), + this._optionsService.rawOptions.screenReaderMode && + this._onA11yTab.fire(this._activeBuffer.x - e3), + true + ); + } + shiftOut() { + return this._charsetService.setgLevel(1), true; + } + shiftIn() { + return this._charsetService.setgLevel(0), true; + } + _restrictCursor(e3 = this._bufferService.cols - 1) { + (this._activeBuffer.x = Math.min( + e3, + 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(e3, t3) { + this._dirtyRowTracker.markDirty(this._activeBuffer.y), + this._coreService.decPrivateModes.origin + ? ((this._activeBuffer.x = e3), + (this._activeBuffer.y = + this._activeBuffer.scrollTop + t3)) + : ((this._activeBuffer.x = e3), + (this._activeBuffer.y = t3)), + this._restrictCursor(), + this._dirtyRowTracker.markDirty(this._activeBuffer.y); + } + _moveCursor(e3, t3) { + this._restrictCursor(), + this._setCursor( + this._activeBuffer.x + e3, + this._activeBuffer.y + t3 + ); + } + cursorUp(e3) { + const t3 = + this._activeBuffer.y - this._activeBuffer.scrollTop; + return ( + t3 >= 0 + ? this._moveCursor( + 0, + -Math.min(t3, e3.params[0] || 1) + ) + : this._moveCursor(0, -(e3.params[0] || 1)), + true + ); + } + cursorDown(e3) { + const t3 = + this._activeBuffer.scrollBottom - this._activeBuffer.y; + return ( + t3 >= 0 + ? this._moveCursor(0, Math.min(t3, e3.params[0] || 1)) + : this._moveCursor(0, e3.params[0] || 1), + true + ); + } + cursorForward(e3) { + return this._moveCursor(e3.params[0] || 1, 0), true; + } + cursorBackward(e3) { + return this._moveCursor(-(e3.params[0] || 1), 0), true; + } + cursorNextLine(e3) { + return ( + this.cursorDown(e3), (this._activeBuffer.x = 0), true + ); + } + cursorPrecedingLine(e3) { + return ( + this.cursorUp(e3), (this._activeBuffer.x = 0), true + ); + } + cursorCharAbsolute(e3) { + return ( + this._setCursor( + (e3.params[0] || 1) - 1, + this._activeBuffer.y + ), + true + ); + } + cursorPosition(e3) { + return ( + this._setCursor( + e3.length >= 2 ? (e3.params[1] || 1) - 1 : 0, + (e3.params[0] || 1) - 1 + ), + true + ); + } + charPosAbsolute(e3) { + return ( + this._setCursor( + (e3.params[0] || 1) - 1, + this._activeBuffer.y + ), + true + ); + } + hPositionRelative(e3) { + return this._moveCursor(e3.params[0] || 1, 0), true; + } + linePosAbsolute(e3) { + return ( + this._setCursor( + this._activeBuffer.x, + (e3.params[0] || 1) - 1 + ), + true + ); + } + vPositionRelative(e3) { + return this._moveCursor(0, e3.params[0] || 1), true; + } + hVPosition(e3) { + return this.cursorPosition(e3), true; + } + tabClear(e3) { + const t3 = e3.params[0]; + return ( + 0 === t3 + ? delete this._activeBuffer.tabs[this._activeBuffer.x] + : 3 === t3 && (this._activeBuffer.tabs = {}), + true + ); + } + cursorForwardTab(e3) { + if (this._activeBuffer.x >= this._bufferService.cols) + return true; + let t3 = e3.params[0] || 1; + for (; t3--; ) + this._activeBuffer.x = this._activeBuffer.nextStop(); + return true; + } + cursorBackwardTab(e3) { + if (this._activeBuffer.x >= this._bufferService.cols) + return true; + let t3 = e3.params[0] || 1; + for (; t3--; ) + this._activeBuffer.x = this._activeBuffer.prevStop(); + return true; + } + selectProtected(e3) { + const t3 = e3.params[0]; + return ( + 1 === t3 && (this._curAttrData.bg |= 536870912), + (2 !== t3 && 0 !== t3) || + (this._curAttrData.bg &= -536870913), + true + ); + } + _eraseInBufferLine(e3, t3, i3, s3 = false, r2 = false) { + const n2 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e3 + ); + n2.replaceCells( + t3, + i3, + this._activeBuffer.getNullCell(this._eraseAttrData()), + r2 + ), + s3 && (n2.isWrapped = false); + } + _resetBufferLine(e3, t3 = false) { + const i3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e3 + ); + i3 && + (i3.fill( + this._activeBuffer.getNullCell(this._eraseAttrData()), + t3 + ), + this._bufferService.buffer.clearMarkers( + this._activeBuffer.ybase + e3 + ), + (i3.isWrapped = false)); + } + eraseInDisplay(e3, t3 = false) { + let i3; + switch ( + (this._restrictCursor(this._bufferService.cols), + e3.params[0]) + ) { + case 0: + for ( + i3 = this._activeBuffer.y, + this._dirtyRowTracker.markDirty(i3), + this._eraseInBufferLine( + i3++, + this._activeBuffer.x, + this._bufferService.cols, + 0 === this._activeBuffer.x, + t3 + ); + i3 < this._bufferService.rows; + i3++ + ) + this._resetBufferLine(i3, t3); + this._dirtyRowTracker.markDirty(i3); + break; + case 1: + for ( + i3 = this._activeBuffer.y, + this._dirtyRowTracker.markDirty(i3), + this._eraseInBufferLine( + i3, + 0, + this._activeBuffer.x + 1, + true, + t3 + ), + this._activeBuffer.x + 1 >= + this._bufferService.cols && + (this._activeBuffer.lines.get( + i3 + 1 + ).isWrapped = false); + i3--; + + ) + this._resetBufferLine(i3, t3); + this._dirtyRowTracker.markDirty(0); + break; + case 2: + for ( + i3 = this._bufferService.rows, + this._dirtyRowTracker.markDirty(i3 - 1); + i3--; + + ) + this._resetBufferLine(i3, t3); + this._dirtyRowTracker.markDirty(0); + break; + case 3: + const e4 = + this._activeBuffer.lines.length - + this._bufferService.rows; + e4 > 0 && + (this._activeBuffer.lines.trimStart(e4), + (this._activeBuffer.ybase = Math.max( + this._activeBuffer.ybase - e4, + 0 + )), + (this._activeBuffer.ydisp = Math.max( + this._activeBuffer.ydisp - e4, + 0 + )), + this._onScroll.fire(0)); + } + return true; + } + eraseInLine(e3, t3 = false) { + switch ( + (this._restrictCursor(this._bufferService.cols), + e3.params[0]) + ) { + case 0: + this._eraseInBufferLine( + this._activeBuffer.y, + this._activeBuffer.x, + this._bufferService.cols, + 0 === this._activeBuffer.x, + t3 + ); + break; + case 1: + this._eraseInBufferLine( + this._activeBuffer.y, + 0, + this._activeBuffer.x + 1, + false, + t3 + ); + break; + case 2: + this._eraseInBufferLine( + this._activeBuffer.y, + 0, + this._bufferService.cols, + true, + t3 + ); + } + return ( + this._dirtyRowTracker.markDirty(this._activeBuffer.y), + true + ); + } + insertLines(e3) { + this._restrictCursor(); + let t3 = e3.params[0] || 1; + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const i3 = + this._activeBuffer.ybase + this._activeBuffer.y, + s3 = + this._bufferService.rows - + 1 - + this._activeBuffer.scrollBottom, + r2 = + this._bufferService.rows - + 1 + + this._activeBuffer.ybase - + s3 + + 1; + for (; t3--; ) + this._activeBuffer.lines.splice(r2 - 1, 1), + this._activeBuffer.lines.splice( + i3, + 0, + this._activeBuffer.getBlankLine( + this._eraseAttrData() + ) + ); + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.y, + this._activeBuffer.scrollBottom + ), + (this._activeBuffer.x = 0), + true + ); + } + deleteLines(e3) { + this._restrictCursor(); + let t3 = e3.params[0] || 1; + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const i3 = + this._activeBuffer.ybase + this._activeBuffer.y; + let s3; + for ( + s3 = + this._bufferService.rows - + 1 - + this._activeBuffer.scrollBottom, + s3 = + this._bufferService.rows - + 1 + + this._activeBuffer.ybase - + s3; + t3--; + + ) + this._activeBuffer.lines.splice(i3, 1), + this._activeBuffer.lines.splice( + s3, + 0, + this._activeBuffer.getBlankLine( + this._eraseAttrData() + ) + ); + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.y, + this._activeBuffer.scrollBottom + ), + (this._activeBuffer.x = 0), + true + ); + } + insertChars(e3) { + this._restrictCursor(); + const t3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ); + return ( + t3 && + (t3.insertCells( + this._activeBuffer.x, + e3.params[0] || 1, + this._activeBuffer.getNullCell( + this._eraseAttrData() + ) + ), + this._dirtyRowTracker.markDirty( + this._activeBuffer.y + )), + true + ); + } + deleteChars(e3) { + this._restrictCursor(); + const t3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ); + return ( + t3 && + (t3.deleteCells( + this._activeBuffer.x, + e3.params[0] || 1, + this._activeBuffer.getNullCell( + this._eraseAttrData() + ) + ), + this._dirtyRowTracker.markDirty( + this._activeBuffer.y + )), + true + ); + } + scrollUp(e3) { + let t3 = e3.params[0] || 1; + for (; t3--; ) + this._activeBuffer.lines.splice( + this._activeBuffer.ybase + + this._activeBuffer.scrollTop, + 1 + ), + this._activeBuffer.lines.splice( + this._activeBuffer.ybase + + this._activeBuffer.scrollBottom, + 0, + this._activeBuffer.getBlankLine( + this._eraseAttrData() + ) + ); + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + scrollDown(e3) { + let t3 = e3.params[0] || 1; + for (; t3--; ) + this._activeBuffer.lines.splice( + this._activeBuffer.ybase + + this._activeBuffer.scrollBottom, + 1 + ), + this._activeBuffer.lines.splice( + this._activeBuffer.ybase + + this._activeBuffer.scrollTop, + 0, + this._activeBuffer.getBlankLine(l.DEFAULT_ATTR_DATA) + ); + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + scrollLeft(e3) { + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const t3 = e3.params[0] || 1; + for ( + let e4 = this._activeBuffer.scrollTop; + e4 <= this._activeBuffer.scrollBottom; + ++e4 + ) { + const i3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e4 + ); + i3.deleteCells( + 0, + t3, + this._activeBuffer.getNullCell(this._eraseAttrData()) + ), + (i3.isWrapped = false); + } + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + scrollRight(e3) { + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const t3 = e3.params[0] || 1; + for ( + let e4 = this._activeBuffer.scrollTop; + e4 <= this._activeBuffer.scrollBottom; + ++e4 + ) { + const i3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e4 + ); + i3.insertCells( + 0, + t3, + this._activeBuffer.getNullCell(this._eraseAttrData()) + ), + (i3.isWrapped = false); + } + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + insertColumns(e3) { + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const t3 = e3.params[0] || 1; + for ( + let e4 = this._activeBuffer.scrollTop; + e4 <= this._activeBuffer.scrollBottom; + ++e4 + ) { + const i3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e4 + ); + i3.insertCells( + this._activeBuffer.x, + t3, + this._activeBuffer.getNullCell(this._eraseAttrData()) + ), + (i3.isWrapped = false); + } + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + deleteColumns(e3) { + if ( + this._activeBuffer.y > + this._activeBuffer.scrollBottom || + this._activeBuffer.y < this._activeBuffer.scrollTop + ) + return true; + const t3 = e3.params[0] || 1; + for ( + let e4 = this._activeBuffer.scrollTop; + e4 <= this._activeBuffer.scrollBottom; + ++e4 + ) { + const i3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + e4 + ); + i3.deleteCells( + this._activeBuffer.x, + t3, + this._activeBuffer.getNullCell(this._eraseAttrData()) + ), + (i3.isWrapped = false); + } + return ( + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ), + true + ); + } + eraseChars(e3) { + this._restrictCursor(); + const t3 = this._activeBuffer.lines.get( + this._activeBuffer.ybase + this._activeBuffer.y + ); + return ( + t3 && + (t3.replaceCells( + this._activeBuffer.x, + this._activeBuffer.x + (e3.params[0] || 1), + this._activeBuffer.getNullCell( + this._eraseAttrData() + ) + ), + this._dirtyRowTracker.markDirty( + this._activeBuffer.y + )), + true + ); + } + repeatPrecedingCharacter(e3) { + const t3 = this._parser.precedingJoinState; + if (!t3) return true; + const i3 = e3.params[0] || 1, + s3 = p.UnicodeService.extractWidth(t3), + r2 = this._activeBuffer.x - s3, + n2 = this._activeBuffer.lines + .get(this._activeBuffer.ybase + this._activeBuffer.y) + .getString(r2), + o2 = new Uint32Array(n2.length * i3); + let a2 = 0; + for (let e4 = 0; e4 < n2.length; ) { + const t4 = n2.codePointAt(e4) || 0; + (o2[a2++] = t4), (e4 += t4 > 65535 ? 2 : 1); + } + let h2 = a2; + for (let e4 = 1; e4 < i3; ++e4) + o2.copyWithin(h2, 0, a2), (h2 += a2); + return this.print(o2, 0, h2), true; + } + sendDeviceAttributesPrimary(e3) { + return ( + e3.params[0] > 0 || + (this._is("xterm") || + this._is("rxvt-unicode") || + this._is("screen") + ? this._coreService.triggerDataEvent( + n.C0.ESC + "[?1;2c" + ) + : this._is("linux") && + this._coreService.triggerDataEvent( + n.C0.ESC + "[?6c" + )), + true + ); + } + sendDeviceAttributesSecondary(e3) { + return ( + e3.params[0] > 0 || + (this._is("xterm") + ? this._coreService.triggerDataEvent( + n.C0.ESC + "[>0;276;0c" + ) + : this._is("rxvt-unicode") + ? this._coreService.triggerDataEvent( + n.C0.ESC + "[>85;95;0c" + ) + : this._is("linux") + ? this._coreService.triggerDataEvent( + e3.params[0] + "c" + ) + : this._is("screen") && + this._coreService.triggerDataEvent( + n.C0.ESC + "[>83;40003;0c" + )), + true + ); + } + _is(e3) { + return ( + 0 === + (this._optionsService.rawOptions.termName + "").indexOf( + e3 + ) + ); + } + setMode(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + switch (e3.params[t3]) { + case 4: + this._coreService.modes.insertMode = true; + break; + case 20: + this._optionsService.options.convertEol = true; + } + return true; + } + setModePrivate(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + switch (e3.params[t3]) { + case 1: + this._coreService.decPrivateModes.applicationCursorKeys = true; + break; + case 2: + this._charsetService.setgCharset( + 0, + o.DEFAULT_CHARSET + ), + this._charsetService.setgCharset( + 1, + o.DEFAULT_CHARSET + ), + this._charsetService.setgCharset( + 2, + o.DEFAULT_CHARSET + ), + this._charsetService.setgCharset( + 3, + o.DEFAULT_CHARSET + ); + break; + case 3: + this._optionsService.rawOptions.windowOptions + .setWinLines && + (this._bufferService.resize( + 132, + this._bufferService.rows + ), + this._onRequestReset.fire()); + break; + case 6: + (this._coreService.decPrivateModes.origin = true), + this._setCursor(0, 0); + break; + case 7: + this._coreService.decPrivateModes.wraparound = true; + break; + case 12: + this._optionsService.options.cursorBlink = true; + break; + case 45: + this._coreService.decPrivateModes.reverseWraparound = true; + break; + case 66: + this._logService.debug( + "Serial port requested application keypad." + ), + (this._coreService.decPrivateModes.applicationKeypad = true), + this._onRequestSyncScrollBar.fire(); + break; + case 9: + this._coreMouseService.activeProtocol = "X10"; + break; + case 1e3: + this._coreMouseService.activeProtocol = "VT200"; + break; + case 1002: + this._coreMouseService.activeProtocol = "DRAG"; + break; + case 1003: + this._coreMouseService.activeProtocol = "ANY"; + break; + case 1004: + (this._coreService.decPrivateModes.sendFocus = true), + this._onRequestSendFocus.fire(); + break; + case 1005: + this._logService.debug( + "DECSET 1005 not supported (see #2507)" + ); + break; + case 1006: + this._coreMouseService.activeEncoding = "SGR"; + break; + case 1015: + this._logService.debug( + "DECSET 1015 not supported (see #2507)" + ); + break; + case 1016: + this._coreMouseService.activeEncoding = + "SGR_PIXELS"; + break; + case 25: + this._coreService.isCursorHidden = false; + break; + case 1048: + this.saveCursor(); + break; + case 1049: + this.saveCursor(); + case 47: + case 1047: + this._bufferService.buffers.activateAltBuffer( + this._eraseAttrData() + ), + (this._coreService.isCursorInitialized = true), + this._onRequestRefreshRows.fire( + 0, + this._bufferService.rows - 1 + ), + this._onRequestSyncScrollBar.fire(); + break; + case 2004: + this._coreService.decPrivateModes.bracketedPasteMode = true; + } + return true; + } + resetMode(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + switch (e3.params[t3]) { + case 4: + this._coreService.modes.insertMode = false; + break; + case 20: + this._optionsService.options.convertEol = false; + } + return true; + } + resetModePrivate(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + switch (e3.params[t3]) { + case 1: + this._coreService.decPrivateModes.applicationCursorKeys = false; + break; + case 3: + this._optionsService.rawOptions.windowOptions + .setWinLines && + (this._bufferService.resize( + 80, + this._bufferService.rows + ), + this._onRequestReset.fire()); + break; + case 6: + (this._coreService.decPrivateModes.origin = false), + this._setCursor(0, 0); + break; + case 7: + this._coreService.decPrivateModes.wraparound = false; + break; + case 12: + this._optionsService.options.cursorBlink = false; + break; + case 45: + this._coreService.decPrivateModes.reverseWraparound = false; + break; + case 66: + this._logService.debug( + "Switching back to normal keypad." + ), + (this._coreService.decPrivateModes.applicationKeypad = false), + this._onRequestSyncScrollBar.fire(); + break; + case 9: + case 1e3: + case 1002: + case 1003: + this._coreMouseService.activeProtocol = "NONE"; + break; + case 1004: + this._coreService.decPrivateModes.sendFocus = false; + break; + case 1005: + this._logService.debug( + "DECRST 1005 not supported (see #2507)" + ); + break; + case 1006: + case 1016: + this._coreMouseService.activeEncoding = "DEFAULT"; + break; + case 1015: + this._logService.debug( + "DECRST 1015 not supported (see #2507)" + ); + break; + case 25: + this._coreService.isCursorHidden = true; + break; + case 1048: + this.restoreCursor(); + break; + case 1049: + case 47: + case 1047: + this._bufferService.buffers.activateNormalBuffer(), + 1049 === e3.params[t3] && this.restoreCursor(), + (this._coreService.isCursorInitialized = true), + this._onRequestRefreshRows.fire( + 0, + this._bufferService.rows - 1 + ), + this._onRequestSyncScrollBar.fire(); + break; + case 2004: + this._coreService.decPrivateModes.bracketedPasteMode = false; + } + return true; + } + requestMode(e3, t3) { + const i3 = this._coreService.decPrivateModes, + { activeProtocol: s3, activeEncoding: r2 } = + this._coreMouseService, + o2 = this._coreService, + { buffers: a2, cols: h2 } = this._bufferService, + { active: c2, alt: l2 } = a2, + d2 = this._optionsService.rawOptions, + _2 = (e4) => (e4 ? 1 : 2), + u2 = e3.params[0]; + return ( + (f2 = u2), + (v2 = t3 + ? 2 === u2 + ? 4 + : 4 === u2 + ? _2(o2.modes.insertMode) + : 12 === u2 + ? 3 + : 20 === u2 + ? _2(d2.convertEol) + : 0 + : 1 === u2 + ? _2(i3.applicationCursorKeys) + : 3 === u2 + ? d2.windowOptions.setWinLines + ? 80 === h2 + ? 2 + : 132 === h2 + ? 1 + : 0 + : 0 + : 6 === u2 + ? _2(i3.origin) + : 7 === u2 + ? _2(i3.wraparound) + : 8 === u2 + ? 3 + : 9 === u2 + ? _2("X10" === s3) + : 12 === u2 + ? _2(d2.cursorBlink) + : 25 === u2 + ? _2(!o2.isCursorHidden) + : 45 === u2 + ? _2(i3.reverseWraparound) + : 66 === u2 + ? _2(i3.applicationKeypad) + : 67 === u2 + ? 4 + : 1e3 === u2 + ? _2("VT200" === s3) + : 1002 === u2 + ? _2("DRAG" === s3) + : 1003 === u2 + ? _2("ANY" === s3) + : 1004 === u2 + ? _2(i3.sendFocus) + : 1005 === u2 + ? 4 + : 1006 === u2 + ? _2("SGR" === r2) + : 1015 === u2 + ? 4 + : 1016 === u2 + ? _2( + "SGR_PIXELS" === + r2 + ) + : 1048 === u2 + ? 1 + : 47 === u2 || + 1047 === + u2 || + 1049 === + u2 + ? _2( + c2 === + l2 + ) + : 2004 === + u2 + ? _2( + i3.bracketedPasteMode + ) + : 0), + o2.triggerDataEvent( + `${n.C0.ESC}[${t3 ? "" : "?"}${f2};${v2}$y` + ), + true + ); + var f2, v2; + } + _updateAttrColor(e3, t3, i3, s3, r2) { + return ( + 2 === t3 + ? ((e3 |= 50331648), + (e3 &= -16777216), + (e3 |= f.AttributeData.fromColorRGB([i3, s3, r2]))) + : 5 === t3 && + ((e3 &= -50331904), (e3 |= 33554432 | (255 & i3))), + e3 + ); + } + _extractColor(e3, t3, i3) { + const s3 = [0, 0, -1, 0, 0, 0]; + let r2 = 0, + n2 = 0; + do { + if ( + ((s3[n2 + r2] = e3.params[t3 + n2]), + e3.hasSubParams(t3 + n2)) + ) { + const i4 = e3.getSubParams(t3 + n2); + let o2 = 0; + do { + 5 === s3[1] && (r2 = 1), + (s3[n2 + o2 + 1 + r2] = i4[o2]); + } while ( + ++o2 < i4.length && + o2 + n2 + 1 + r2 < s3.length + ); + break; + } + if ( + (5 === s3[1] && n2 + r2 >= 2) || + (2 === s3[1] && n2 + r2 >= 5) + ) + break; + s3[1] && (r2 = 1); + } while (++n2 + t3 < e3.length && n2 + r2 < s3.length); + for (let e4 = 2; e4 < s3.length; ++e4) + -1 === s3[e4] && (s3[e4] = 0); + switch (s3[0]) { + case 38: + i3.fg = this._updateAttrColor( + i3.fg, + s3[1], + s3[3], + s3[4], + s3[5] + ); + break; + case 48: + i3.bg = this._updateAttrColor( + i3.bg, + s3[1], + s3[3], + s3[4], + s3[5] + ); + break; + case 58: + (i3.extended = i3.extended.clone()), + (i3.extended.underlineColor = this._updateAttrColor( + i3.extended.underlineColor, + s3[1], + s3[3], + s3[4], + s3[5] + )); + } + return n2; + } + _processUnderline(e3, t3) { + (t3.extended = t3.extended.clone()), + (!~e3 || e3 > 5) && (e3 = 1), + (t3.extended.underlineStyle = e3), + (t3.fg |= 268435456), + 0 === e3 && (t3.fg &= -268435457), + t3.updateExtended(); + } + _processSGR0(e3) { + (e3.fg = l.DEFAULT_ATTR_DATA.fg), + (e3.bg = l.DEFAULT_ATTR_DATA.bg), + (e3.extended = e3.extended.clone()), + (e3.extended.underlineStyle = 0), + (e3.extended.underlineColor &= -67108864), + e3.updateExtended(); + } + charAttributes(e3) { + if (1 === e3.length && 0 === e3.params[0]) + return this._processSGR0(this._curAttrData), true; + const t3 = e3.length; + let i3; + const s3 = this._curAttrData; + for (let r2 = 0; r2 < t3; r2++) + (i3 = e3.params[r2]), + i3 >= 30 && i3 <= 37 + ? ((s3.fg &= -50331904), + (s3.fg |= 16777216 | (i3 - 30))) + : i3 >= 40 && i3 <= 47 + ? ((s3.bg &= -50331904), + (s3.bg |= 16777216 | (i3 - 40))) + : i3 >= 90 && i3 <= 97 + ? ((s3.fg &= -50331904), + (s3.fg |= 16777224 | (i3 - 90))) + : i3 >= 100 && i3 <= 107 + ? ((s3.bg &= -50331904), + (s3.bg |= 16777224 | (i3 - 100))) + : 0 === i3 + ? this._processSGR0(s3) + : 1 === i3 + ? (s3.fg |= 134217728) + : 3 === i3 + ? (s3.bg |= 67108864) + : 4 === i3 + ? ((s3.fg |= 268435456), + this._processUnderline( + e3.hasSubParams(r2) + ? e3.getSubParams(r2)[0] + : 1, + s3 + )) + : 5 === i3 + ? (s3.fg |= 536870912) + : 7 === i3 + ? (s3.fg |= 67108864) + : 8 === i3 + ? (s3.fg |= 1073741824) + : 9 === i3 + ? (s3.fg |= 2147483648) + : 2 === i3 + ? (s3.bg |= 134217728) + : 21 === i3 + ? this._processUnderline( + 2, + s3 + ) + : 22 === i3 + ? ((s3.fg &= + -134217729), + (s3.bg &= -134217729)) + : 23 === i3 + ? (s3.bg &= -67108865) + : 24 === i3 + ? ((s3.fg &= + -268435457), + this._processUnderline( + 0, + s3 + )) + : 25 === i3 + ? (s3.fg &= + -536870913) + : 27 === i3 + ? (s3.fg &= + -67108865) + : 28 === i3 + ? (s3.fg &= + -1073741825) + : 29 === i3 + ? (s3.fg &= 2147483647) + : 39 === i3 + ? ((s3.fg &= + -67108864), + (s3.fg |= + 16777215 & + l + .DEFAULT_ATTR_DATA + .fg)) + : 49 === + i3 + ? ((s3.bg &= + -67108864), + (s3.bg |= + 16777215 & + l + .DEFAULT_ATTR_DATA + .bg)) + : 38 === + i3 || + 48 === + i3 || + 58 === + i3 + ? (r2 += + this._extractColor( + e3, + r2, + s3 + )) + : 53 === + i3 + ? (s3.bg |= 1073741824) + : 55 === + i3 + ? (s3.bg &= + -1073741825) + : 59 === + i3 + ? ((s3.extended = + s3.extended.clone()), + (s3.extended.underlineColor = + -1), + s3.updateExtended()) + : 100 === + i3 + ? ((s3.fg &= + -67108864), + (s3.fg |= + 16777215 & + l + .DEFAULT_ATTR_DATA + .fg), + (s3.bg &= + -67108864), + (s3.bg |= + 16777215 & + l + .DEFAULT_ATTR_DATA + .bg)) + : this._logService.debug( + "Unknown SGR attribute: %d.", + i3 + ); + return true; + } + deviceStatus(e3) { + switch (e3.params[0]) { + case 5: + this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`); + break; + case 6: + const e4 = this._activeBuffer.y + 1, + t3 = this._activeBuffer.x + 1; + this._coreService.triggerDataEvent( + `${n.C0.ESC}[${e4};${t3}R` + ); + } + return true; + } + deviceStatusPrivate(e3) { + if (6 === e3.params[0]) { + const e4 = this._activeBuffer.y + 1, + t3 = this._activeBuffer.x + 1; + this._coreService.triggerDataEvent( + `${n.C0.ESC}[?${e4};${t3}R` + ); + } + return true; + } + softReset(e3) { + return ( + (this._coreService.isCursorHidden = false), + this._onRequestSyncScrollBar.fire(), + (this._activeBuffer.scrollTop = 0), + (this._activeBuffer.scrollBottom = + this._bufferService.rows - 1), + (this._curAttrData = l.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 = false), + true + ); + } + setCursorStyle(e3) { + const t3 = e3.params[0] || 1; + switch (t3) { + case 1: + case 2: + this._optionsService.options.cursorStyle = "block"; + break; + case 3: + case 4: + this._optionsService.options.cursorStyle = + "underline"; + break; + case 5: + case 6: + this._optionsService.options.cursorStyle = "bar"; + } + const i3 = t3 % 2 == 1; + return ( + (this._optionsService.options.cursorBlink = i3), true + ); + } + setScrollRegion(e3) { + const t3 = e3.params[0] || 1; + let i3; + return ( + (e3.length < 2 || + (i3 = e3.params[1]) > this._bufferService.rows || + 0 === i3) && + (i3 = this._bufferService.rows), + i3 > t3 && + ((this._activeBuffer.scrollTop = t3 - 1), + (this._activeBuffer.scrollBottom = i3 - 1), + this._setCursor(0, 0)), + true + ); + } + windowOptions(e3) { + if ( + !w( + e3.params[0], + this._optionsService.rawOptions.windowOptions + ) + ) + return true; + const t3 = e3.length > 1 ? e3.params[1] : 0; + switch (e3.params[0]) { + case 14: + 2 !== t3 && + this._onRequestWindowsOptionsReport.fire( + y.GET_WIN_SIZE_PIXELS + ); + break; + case 16: + this._onRequestWindowsOptionsReport.fire( + y.GET_CELL_SIZE_PIXELS + ); + break; + case 18: + this._bufferService && + this._coreService.triggerDataEvent( + `${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t` + ); + break; + case 22: + (0 !== t3 && 2 !== t3) || + (this._windowTitleStack.push(this._windowTitle), + this._windowTitleStack.length > 10 && + this._windowTitleStack.shift()), + (0 !== t3 && 1 !== t3) || + (this._iconNameStack.push(this._iconName), + this._iconNameStack.length > 10 && + this._iconNameStack.shift()); + break; + case 23: + (0 !== t3 && 2 !== t3) || + (this._windowTitleStack.length && + this.setTitle(this._windowTitleStack.pop())), + (0 !== t3 && 1 !== t3) || + (this._iconNameStack.length && + this.setIconName(this._iconNameStack.pop())); + } + return true; + } + saveCursor(e3) { + return ( + (this._activeBuffer.savedX = this._activeBuffer.x), + (this._activeBuffer.savedY = + this._activeBuffer.ybase + this._activeBuffer.y), + (this._activeBuffer.savedCurAttrData.fg = + this._curAttrData.fg), + (this._activeBuffer.savedCurAttrData.bg = + this._curAttrData.bg), + (this._activeBuffer.savedCharset = + this._charsetService.charset), + true + ); + } + restoreCursor(e3) { + return ( + (this._activeBuffer.x = this._activeBuffer.savedX || 0), + (this._activeBuffer.y = Math.max( + this._activeBuffer.savedY - this._activeBuffer.ybase, + 0 + )), + (this._curAttrData.fg = + this._activeBuffer.savedCurAttrData.fg), + (this._curAttrData.bg = + this._activeBuffer.savedCurAttrData.bg), + (this._charsetService.charset = this._savedCharset), + this._activeBuffer.savedCharset && + (this._charsetService.charset = + this._activeBuffer.savedCharset), + this._restrictCursor(), + true + ); + } + setTitle(e3) { + return ( + (this._windowTitle = e3), + this._onTitleChange.fire(e3), + true + ); + } + setIconName(e3) { + return (this._iconName = e3), true; + } + setOrReportIndexedColor(e3) { + const t3 = [], + i3 = e3.split(";"); + for (; i3.length > 1; ) { + const e4 = i3.shift(), + s3 = i3.shift(); + if (/^\d+$/.exec(e4)) { + const i4 = parseInt(e4); + if (D(i4)) + if ("?" === s3) t3.push({ type: 0, index: i4 }); + else { + const e5 = (0, S.parseColor)(s3); + e5 && t3.push({ type: 1, index: i4, color: e5 }); + } + } + } + return t3.length && this._onColor.fire(t3), true; + } + setHyperlink(e3) { + const t3 = e3.split(";"); + return ( + !(t3.length < 2) && + (t3[1] + ? this._createHyperlink(t3[0], t3[1]) + : !t3[0] && this._finishHyperlink()) + ); + } + _createHyperlink(e3, t3) { + this._getCurrentLinkId() && this._finishHyperlink(); + const i3 = e3.split(":"); + let s3; + const r2 = i3.findIndex((e4) => e4.startsWith("id=")); + return ( + -1 !== r2 && (s3 = i3[r2].slice(3) || void 0), + (this._curAttrData.extended = + this._curAttrData.extended.clone()), + (this._curAttrData.extended.urlId = + this._oscLinkService.registerLink({ + id: s3, + uri: t3, + })), + this._curAttrData.updateExtended(), + true + ); + } + _finishHyperlink() { + return ( + (this._curAttrData.extended = + this._curAttrData.extended.clone()), + (this._curAttrData.extended.urlId = 0), + this._curAttrData.updateExtended(), + true + ); + } + _setOrReportSpecialColor(e3, t3) { + const i3 = e3.split(";"); + for ( + let e4 = 0; + e4 < i3.length && !(t3 >= this._specialColors.length); + ++e4, ++t3 + ) + if ("?" === i3[e4]) + this._onColor.fire([ + { type: 0, index: this._specialColors[t3] }, + ]); + else { + const s3 = (0, S.parseColor)(i3[e4]); + s3 && + this._onColor.fire([ + { + type: 1, + index: this._specialColors[t3], + color: s3, + }, + ]); + } + return true; + } + setOrReportFgColor(e3) { + return this._setOrReportSpecialColor(e3, 0); + } + setOrReportBgColor(e3) { + return this._setOrReportSpecialColor(e3, 1); + } + setOrReportCursorColor(e3) { + return this._setOrReportSpecialColor(e3, 2); + } + restoreIndexedColor(e3) { + if (!e3) return this._onColor.fire([{ type: 2 }]), true; + const t3 = [], + i3 = e3.split(";"); + for (let e4 = 0; e4 < i3.length; ++e4) + if (/^\d+$/.exec(i3[e4])) { + const s3 = parseInt(i3[e4]); + D(s3) && t3.push({ type: 2, index: s3 }); + } + return t3.length && this._onColor.fire(t3), true; + } + restoreFgColor(e3) { + return ( + this._onColor.fire([{ type: 2, index: 256 }]), true + ); + } + restoreBgColor(e3) { + return ( + this._onColor.fire([{ type: 2, index: 257 }]), true + ); + } + restoreCursorColor(e3) { + return ( + this._onColor.fire([{ type: 2, index: 258 }]), true + ); + } + nextLine() { + return (this._activeBuffer.x = 0), this.index(), true; + } + keypadApplicationMode() { + return ( + this._logService.debug( + "Serial port requested application keypad." + ), + (this._coreService.decPrivateModes.applicationKeypad = true), + this._onRequestSyncScrollBar.fire(), + true + ); + } + keypadNumericMode() { + return ( + this._logService.debug( + "Switching back to normal keypad." + ), + (this._coreService.decPrivateModes.applicationKeypad = false), + this._onRequestSyncScrollBar.fire(), + true + ); + } + selectDefaultCharset() { + return ( + this._charsetService.setgLevel(0), + this._charsetService.setgCharset(0, o.DEFAULT_CHARSET), + true + ); + } + selectCharset(e3) { + return 2 !== e3.length + ? (this.selectDefaultCharset(), true) + : ("/" === e3[0] || + this._charsetService.setgCharset( + C[e3[0]], + o.CHARSETS[e3[1]] || o.DEFAULT_CHARSET + ), + true); + } + index() { + return ( + this._restrictCursor(), + 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._restrictCursor(), + true + ); + } + tabSet() { + return ( + (this._activeBuffer.tabs[this._activeBuffer.x] = true), + true + ); + } + reverseIndex() { + if ( + (this._restrictCursor(), + this._activeBuffer.y === this._activeBuffer.scrollTop) + ) { + const e3 = + this._activeBuffer.scrollBottom - + this._activeBuffer.scrollTop; + this._activeBuffer.lines.shiftElements( + this._activeBuffer.ybase + this._activeBuffer.y, + e3, + 1 + ), + this._activeBuffer.lines.set( + this._activeBuffer.ybase + this._activeBuffer.y, + this._activeBuffer.getBlankLine( + this._eraseAttrData() + ) + ), + this._dirtyRowTracker.markRangeDirty( + this._activeBuffer.scrollTop, + this._activeBuffer.scrollBottom + ); + } else this._activeBuffer.y--, this._restrictCursor(); + return true; + } + fullReset() { + return ( + this._parser.reset(), this._onRequestReset.fire(), true + ); + } + reset() { + (this._curAttrData = l.DEFAULT_ATTR_DATA.clone()), + (this._eraseAttrDataInternal = + l.DEFAULT_ATTR_DATA.clone()); + } + _eraseAttrData() { + return ( + (this._eraseAttrDataInternal.bg &= -67108864), + (this._eraseAttrDataInternal.bg |= + 67108863 & this._curAttrData.bg), + this._eraseAttrDataInternal + ); + } + setgLevel(e3) { + return this._charsetService.setgLevel(e3), true; + } + screenAlignmentPattern() { + const e3 = new u.CellData(); + (e3.content = (1 << 22) | "E".charCodeAt(0)), + (e3.fg = this._curAttrData.fg), + (e3.bg = this._curAttrData.bg), + this._setCursor(0, 0); + for (let t3 = 0; t3 < this._bufferService.rows; ++t3) { + const i3 = + this._activeBuffer.ybase + + this._activeBuffer.y + + t3, + s3 = this._activeBuffer.lines.get(i3); + s3 && (s3.fill(e3), (s3.isWrapped = false)); + } + return ( + this._dirtyRowTracker.markAllDirty(), + this._setCursor(0, 0), + true + ); + } + requestStatusString(e3, t3) { + const i3 = this._bufferService.buffer, + s3 = this._optionsService.rawOptions; + return ((e4) => ( + this._coreService.triggerDataEvent( + `${n.C0.ESC}${e4}${n.C0.ESC}\\` + ), + true + ))( + '"q' === e3 + ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` + : '"p' === e3 + ? 'P1$r61;1"p' + : "r" === e3 + ? `P1$r${i3.scrollTop + 1};${i3.scrollBottom + 1}r` + : "m" === e3 + ? "P1$r0m" + : " q" === e3 + ? `P1$r${{ block: 2, underline: 4, bar: 6 }[s3.cursorStyle] - (s3.cursorBlink ? 1 : 0)} q` + : "P0$r" + ); + } + markRangeDirty(e3, t3) { + this._dirtyRowTracker.markRangeDirty(e3, t3); + } + } + t2.InputHandler = k; + let L = class { + constructor(e3) { + (this._bufferService = e3), this.clearRange(); + } + clearRange() { + (this.start = this._bufferService.buffer.y), + (this.end = this._bufferService.buffer.y); + } + markDirty(e3) { + e3 < this.start + ? (this.start = e3) + : e3 > this.end && (this.end = e3); + } + markRangeDirty(e3, t3) { + e3 > t3 && ((E = e3), (e3 = t3), (t3 = E)), + e3 < this.start && (this.start = e3), + t3 > this.end && (this.end = t3); + } + markAllDirty() { + this.markRangeDirty(0, this._bufferService.rows - 1); + } + }; + function D(e3) { + return 0 <= e3 && e3 < 256; + } + L = s2([r(0, v.IBufferService)], L); + }, + 844: (e2, t2) => { + function i2(e3) { + for (const t3 of e3) t3.dispose(); + e3.length = 0; + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getDisposeArrayDisposable = + t2.disposeArray = + t2.toDisposable = + t2.MutableDisposable = + t2.Disposable = + void 0), + (t2.Disposable = class { + constructor() { + (this._disposables = []), (this._isDisposed = false); + } + dispose() { + this._isDisposed = true; + for (const e3 of this._disposables) e3.dispose(); + this._disposables.length = 0; + } + register(e3) { + return this._disposables.push(e3), e3; + } + unregister(e3) { + const t3 = this._disposables.indexOf(e3); + -1 !== t3 && this._disposables.splice(t3, 1); + } + }), + (t2.MutableDisposable = class { + constructor() { + this._isDisposed = false; + } + get value() { + return this._isDisposed ? void 0 : this._value; + } + set value(e3) { + this._isDisposed || + e3 === this._value || + (this._value?.dispose(), (this._value = e3)); + } + clear() { + this.value = void 0; + } + dispose() { + (this._isDisposed = true), + this._value?.dispose(), + (this._value = void 0); + } + }), + (t2.toDisposable = function (e3) { + return { dispose: e3 }; + }), + (t2.disposeArray = i2), + (t2.getDisposeArrayDisposable = function (e3) { + return { dispose: () => i2(e3) }; + }); + }, + 1505: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.FourKeyMap = t2.TwoKeyMap = void 0); + class i2 { + constructor() { + this._data = {}; + } + set(e3, t3, i3) { + this._data[e3] || (this._data[e3] = {}), + (this._data[e3][t3] = i3); + } + get(e3, t3) { + return this._data[e3] ? this._data[e3][t3] : void 0; + } + clear() { + this._data = {}; + } + } + (t2.TwoKeyMap = i2), + (t2.FourKeyMap = class { + constructor() { + this._data = new i2(); + } + set(e3, t3, s2, r, n) { + this._data.get(e3, t3) || + this._data.set(e3, t3, new i2()), + this._data.get(e3, t3).set(s2, r, n); + } + get(e3, t3, i3, s2) { + return this._data.get(e3, t3)?.get(i3, s2); + } + clear() { + this._data.clear(); + } + }); + }, + 6114: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.isChromeOS = + t2.isLinux = + t2.isWindows = + t2.isIphone = + t2.isIpad = + t2.isMac = + t2.getSafariVersion = + t2.isSafari = + t2.isLegacyEdge = + t2.isFirefox = + t2.isNode = + void 0), + (t2.isNode = + "undefined" != typeof process && "title" in process); + const i2 = t2.isNode ? "node" : navigator.userAgent, + s2 = t2.isNode ? "node" : navigator.platform; + (t2.isFirefox = i2.includes("Firefox")), + (t2.isLegacyEdge = i2.includes("Edge")), + (t2.isSafari = /^((?!chrome|android).)*safari/i.test(i2)), + (t2.getSafariVersion = function () { + if (!t2.isSafari) return 0; + const e3 = i2.match(/Version\/(\d+)/); + return null === e3 || e3.length < 2 ? 0 : parseInt(e3[1]); + }), + (t2.isMac = [ + "Macintosh", + "MacIntel", + "MacPPC", + "Mac68K", + ].includes(s2)), + (t2.isIpad = "iPad" === s2), + (t2.isIphone = "iPhone" === s2), + (t2.isWindows = [ + "Windows", + "Win16", + "Win32", + "WinCE", + ].includes(s2)), + (t2.isLinux = s2.indexOf("Linux") >= 0), + (t2.isChromeOS = /\bCrOS\b/.test(i2)); + }, + 6106: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.SortedList = void 0); + let i2 = 0; + t2.SortedList = class { + constructor(e3) { + (this._getKey = e3), (this._array = []); + } + clear() { + this._array.length = 0; + } + insert(e3) { + 0 !== this._array.length + ? ((i2 = this._search(this._getKey(e3))), + this._array.splice(i2, 0, e3)) + : this._array.push(e3); + } + delete(e3) { + if (0 === this._array.length) return false; + const t3 = this._getKey(e3); + if (void 0 === t3) return false; + if (((i2 = this._search(t3)), -1 === i2)) return false; + if (this._getKey(this._array[i2]) !== t3) return false; + do { + if (this._array[i2] === e3) + return this._array.splice(i2, 1), true; + } while ( + ++i2 < this._array.length && + this._getKey(this._array[i2]) === t3 + ); + return false; + } + *getKeyIterator(e3) { + if ( + 0 !== this._array.length && + ((i2 = this._search(e3)), + !(i2 < 0 || i2 >= this._array.length) && + this._getKey(this._array[i2]) === e3) + ) + do { + yield this._array[i2]; + } while ( + ++i2 < this._array.length && + this._getKey(this._array[i2]) === e3 + ); + } + forEachByKey(e3, t3) { + if ( + 0 !== this._array.length && + ((i2 = this._search(e3)), + !(i2 < 0 || i2 >= this._array.length) && + this._getKey(this._array[i2]) === e3) + ) + do { + t3(this._array[i2]); + } while ( + ++i2 < this._array.length && + this._getKey(this._array[i2]) === e3 + ); + } + values() { + return [...this._array].values(); + } + _search(e3) { + let t3 = 0, + i3 = this._array.length - 1; + for (; i3 >= t3; ) { + let s2 = (t3 + i3) >> 1; + const r = this._getKey(this._array[s2]); + if (r > e3) i3 = s2 - 1; + else { + if (!(r < e3)) { + for ( + ; + s2 > 0 && + this._getKey(this._array[s2 - 1]) === e3; + + ) + s2--; + return s2; + } + t3 = s2 + 1; + } + } + return t3; + } + }; + }, + 7226: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DebouncedIdleTask = + t2.IdleTaskQueue = + t2.PriorityTaskQueue = + void 0); + const s2 = i2(6114); + class r { + constructor() { + (this._tasks = []), (this._i = 0); + } + enqueue(e3) { + this._tasks.push(e3), this._start(); + } + flush() { + for (; this._i < this._tasks.length; ) + this._tasks[this._i]() || this._i++; + this.clear(); + } + clear() { + this._idleCallback && + (this._cancelCallback(this._idleCallback), + (this._idleCallback = void 0)), + (this._i = 0), + (this._tasks.length = 0); + } + _start() { + this._idleCallback || + (this._idleCallback = this._requestCallback( + this._process.bind(this) + )); + } + _process(e3) { + this._idleCallback = void 0; + let t3 = 0, + i3 = 0, + s3 = e3.timeRemaining(), + r2 = 0; + for (; this._i < this._tasks.length; ) { + if ( + ((t3 = Date.now()), + this._tasks[this._i]() || this._i++, + (t3 = Math.max(1, Date.now() - t3)), + (i3 = Math.max(t3, i3)), + (r2 = e3.timeRemaining()), + 1.5 * i3 > r2) + ) + return ( + s3 - t3 < -20 && + console.warn( + `task queue exceeded allotted deadline by ${Math.abs(Math.round(s3 - t3))}ms` + ), + void this._start() + ); + s3 = r2; + } + this.clear(); + } + } + class n extends r { + _requestCallback(e3) { + return setTimeout(() => e3(this._createDeadline(16))); + } + _cancelCallback(e3) { + clearTimeout(e3); + } + _createDeadline(e3) { + const t3 = Date.now() + e3; + return { + timeRemaining: () => Math.max(0, t3 - Date.now()), + }; + } + } + (t2.PriorityTaskQueue = n), + (t2.IdleTaskQueue = + !s2.isNode && "requestIdleCallback" in window + ? class extends r { + _requestCallback(e3) { + return requestIdleCallback(e3); + } + _cancelCallback(e3) { + cancelIdleCallback(e3); + } + } + : n), + (t2.DebouncedIdleTask = class { + constructor() { + this._queue = new t2.IdleTaskQueue(); + } + set(e3) { + this._queue.clear(), this._queue.enqueue(e3); + } + flush() { + this._queue.flush(); + } + }); + }, + 9282: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.updateWindowsModeWrappedState = void 0); + const s2 = i2(643); + t2.updateWindowsModeWrappedState = function (e3) { + const t3 = e3.buffer.lines.get( + e3.buffer.ybase + e3.buffer.y - 1 + ), + i3 = t3?.get(e3.cols - 1), + r = e3.buffer.lines.get(e3.buffer.ybase + e3.buffer.y); + r && + i3 && + (r.isWrapped = + i3[s2.CHAR_DATA_CODE_INDEX] !== s2.NULL_CELL_CODE && + i3[s2.CHAR_DATA_CODE_INDEX] !== + s2.WHITESPACE_CELL_CODE); + }; + }, + 3734: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ExtendedAttrs = t2.AttributeData = void 0); + class i2 { + constructor() { + (this.fg = 0), (this.bg = 0), (this.extended = new s2()); + } + static toColorRGB(e3) { + return [(e3 >>> 16) & 255, (e3 >>> 8) & 255, 255 & e3]; + } + static fromColorRGB(e3) { + return ( + ((255 & e3[0]) << 16) | + ((255 & e3[1]) << 8) | + (255 & e3[2]) + ); + } + clone() { + const e3 = new i2(); + return ( + (e3.fg = this.fg), + (e3.bg = this.bg), + (e3.extended = this.extended.clone()), + e3 + ); + } + 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 == (50331648 & this.fg); + } + isBgRGB() { + return 50331648 == (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 0 == (50331648 & this.fg); + } + isBgDefault() { + return 0 == (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 == (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 + ? 0 == (50331648 & this.extended.underlineColor) + : this.isFgDefault(); + } + getUnderlineStyle() { + return 268435456 & this.fg + ? 268435456 & this.bg + ? this.extended.underlineStyle + : 1 + : 0; + } + getUnderlineVariantOffset() { + return this.extended.underlineVariantOffset; + } + } + t2.AttributeData = i2; + class s2 { + get ext() { + return this._urlId + ? (-469762049 & this._ext) | (this.underlineStyle << 26) + : this._ext; + } + set ext(e3) { + this._ext = e3; + } + get underlineStyle() { + return this._urlId ? 5 : (469762048 & this._ext) >> 26; + } + set underlineStyle(e3) { + (this._ext &= -469762049), + (this._ext |= (e3 << 26) & 469762048); + } + get underlineColor() { + return 67108863 & this._ext; + } + set underlineColor(e3) { + (this._ext &= -67108864), (this._ext |= 67108863 & e3); + } + get urlId() { + return this._urlId; + } + set urlId(e3) { + this._urlId = e3; + } + get underlineVariantOffset() { + const e3 = (3758096384 & this._ext) >> 29; + return e3 < 0 ? 4294967288 ^ e3 : e3; + } + set underlineVariantOffset(e3) { + (this._ext &= 536870911), + (this._ext |= (e3 << 29) & 3758096384); + } + constructor(e3 = 0, t3 = 0) { + (this._ext = 0), + (this._urlId = 0), + (this._ext = e3), + (this._urlId = t3); + } + clone() { + return new s2(this._ext, this._urlId); + } + isEmpty() { + return 0 === this.underlineStyle && 0 === this._urlId; + } + } + t2.ExtendedAttrs = s2; + }, + 9092: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Buffer = t2.MAX_BUFFER_SIZE = void 0); + const s2 = i2(6349), + r = i2(7226), + n = i2(3734), + o = i2(8437), + a = i2(4634), + h = i2(511), + c = i2(643), + l = i2(4863), + d = i2(7116); + (t2.MAX_BUFFER_SIZE = 4294967295), + (t2.Buffer = class { + constructor(e3, t3, i3) { + (this._hasScrollback = e3), + (this._optionsService = t3), + (this._bufferService = i3), + (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.markers = []), + (this._nullCell = h.CellData.fromCharData([ + 0, + c.NULL_CELL_CHAR, + c.NULL_CELL_WIDTH, + c.NULL_CELL_CODE, + ])), + (this._whitespaceCell = h.CellData.fromCharData([ + 0, + c.WHITESPACE_CELL_CHAR, + c.WHITESPACE_CELL_WIDTH, + c.WHITESPACE_CELL_CODE, + ])), + (this._isClearing = false), + (this._memoryCleanupQueue = new r.IdleTaskQueue()), + (this._memoryCleanupPosition = 0), + (this._cols = this._bufferService.cols), + (this._rows = this._bufferService.rows), + (this.lines = new s2.CircularList( + this._getCorrectBufferLength(this._rows) + )), + (this.scrollTop = 0), + (this.scrollBottom = this._rows - 1), + this.setupTabStops(); + } + getNullCell(e3) { + return ( + e3 + ? ((this._nullCell.fg = e3.fg), + (this._nullCell.bg = e3.bg), + (this._nullCell.extended = e3.extended)) + : ((this._nullCell.fg = 0), + (this._nullCell.bg = 0), + (this._nullCell.extended = + new n.ExtendedAttrs())), + this._nullCell + ); + } + getWhitespaceCell(e3) { + return ( + e3 + ? ((this._whitespaceCell.fg = e3.fg), + (this._whitespaceCell.bg = e3.bg), + (this._whitespaceCell.extended = e3.extended)) + : ((this._whitespaceCell.fg = 0), + (this._whitespaceCell.bg = 0), + (this._whitespaceCell.extended = + new n.ExtendedAttrs())), + this._whitespaceCell + ); + } + getBlankLine(e3, t3) { + return new o.BufferLine( + this._bufferService.cols, + this.getNullCell(e3), + t3 + ); + } + get hasScrollback() { + return ( + this._hasScrollback && + this.lines.maxLength > this._rows + ); + } + get isCursorInViewport() { + const e3 = this.ybase + this.y - this.ydisp; + return e3 >= 0 && e3 < this._rows; + } + _getCorrectBufferLength(e3) { + if (!this._hasScrollback) return e3; + const i3 = + e3 + this._optionsService.rawOptions.scrollback; + return i3 > t2.MAX_BUFFER_SIZE + ? t2.MAX_BUFFER_SIZE + : i3; + } + fillViewportRows(e3) { + if (0 === this.lines.length) { + void 0 === e3 && (e3 = o.DEFAULT_ATTR_DATA); + let t3 = this._rows; + for (; t3--; ) this.lines.push(this.getBlankLine(e3)); + } + } + clear() { + (this.ydisp = 0), + (this.ybase = 0), + (this.y = 0), + (this.x = 0), + (this.lines = new s2.CircularList( + this._getCorrectBufferLength(this._rows) + )), + (this.scrollTop = 0), + (this.scrollBottom = this._rows - 1), + this.setupTabStops(); + } + resize(e3, t3) { + const i3 = this.getNullCell(o.DEFAULT_ATTR_DATA); + let s3 = 0; + const r2 = this._getCorrectBufferLength(t3); + if ( + (r2 > this.lines.maxLength && + (this.lines.maxLength = r2), + this.lines.length > 0) + ) { + if (this._cols < e3) + for (let t4 = 0; t4 < this.lines.length; t4++) + s3 += +this.lines.get(t4).resize(e3, i3); + let n2 = 0; + if (this._rows < t3) + for (let s4 = this._rows; s4 < t3; s4++) + this.lines.length < t3 + this.ybase && + (this._optionsService.rawOptions.windowsMode || + void 0 !== + this._optionsService.rawOptions.windowsPty + .backend || + void 0 !== + this._optionsService.rawOptions.windowsPty + .buildNumber + ? this.lines.push(new o.BufferLine(e3, i3)) + : this.ybase > 0 && + this.lines.length <= + this.ybase + this.y + n2 + 1 + ? (this.ybase--, + n2++, + this.ydisp > 0 && this.ydisp--) + : this.lines.push( + new o.BufferLine(e3, i3) + )); + else + for (let e4 = this._rows; e4 > t3; e4--) + this.lines.length > t3 + this.ybase && + (this.lines.length > this.ybase + this.y + 1 + ? this.lines.pop() + : (this.ybase++, this.ydisp++)); + if (r2 < this.lines.maxLength) { + const e4 = this.lines.length - r2; + e4 > 0 && + (this.lines.trimStart(e4), + (this.ybase = Math.max(this.ybase - e4, 0)), + (this.ydisp = Math.max(this.ydisp - e4, 0)), + (this.savedY = Math.max(this.savedY - e4, 0))), + (this.lines.maxLength = r2); + } + (this.x = Math.min(this.x, e3 - 1)), + (this.y = Math.min(this.y, t3 - 1)), + n2 && (this.y += n2), + (this.savedX = Math.min(this.savedX, e3 - 1)), + (this.scrollTop = 0); + } + if ( + ((this.scrollBottom = t3 - 1), + this._isReflowEnabled && + (this._reflow(e3, t3), this._cols > e3)) + ) + for (let t4 = 0; t4 < this.lines.length; t4++) + s3 += +this.lines.get(t4).resize(e3, i3); + (this._cols = e3), + (this._rows = t3), + this._memoryCleanupQueue.clear(), + s3 > 0.1 * this.lines.length && + ((this._memoryCleanupPosition = 0), + this._memoryCleanupQueue.enqueue(() => + this._batchedMemoryCleanup() + )); + } + _batchedMemoryCleanup() { + let e3 = true; + this._memoryCleanupPosition >= this.lines.length && + ((this._memoryCleanupPosition = 0), (e3 = false)); + let t3 = 0; + for ( + ; + this._memoryCleanupPosition < this.lines.length; + + ) + if ( + ((t3 += this.lines + .get(this._memoryCleanupPosition++) + .cleanupMemory()), + t3 > 100) + ) + return true; + return e3; + } + get _isReflowEnabled() { + const e3 = this._optionsService.rawOptions.windowsPty; + return e3 && e3.buildNumber + ? this._hasScrollback && + "conpty" === e3.backend && + e3.buildNumber >= 21376 + : this._hasScrollback && + !this._optionsService.rawOptions.windowsMode; + } + _reflow(e3, t3) { + this._cols !== e3 && + (e3 > this._cols + ? this._reflowLarger(e3, t3) + : this._reflowSmaller(e3, t3)); + } + _reflowLarger(e3, t3) { + const i3 = (0, a.reflowLargerGetLinesToRemove)( + this.lines, + this._cols, + e3, + this.ybase + this.y, + this.getNullCell(o.DEFAULT_ATTR_DATA) + ); + if (i3.length > 0) { + const s3 = (0, a.reflowLargerCreateNewLayout)( + this.lines, + i3 + ); + (0, a.reflowLargerApplyNewLayout)( + this.lines, + s3.layout + ), + this._reflowLargerAdjustViewport( + e3, + t3, + s3.countRemoved + ); + } + } + _reflowLargerAdjustViewport(e3, t3, i3) { + const s3 = this.getNullCell(o.DEFAULT_ATTR_DATA); + let r2 = i3; + for (; r2-- > 0; ) + 0 === this.ybase + ? (this.y > 0 && this.y--, + this.lines.length < t3 && + this.lines.push(new o.BufferLine(e3, s3))) + : (this.ydisp === this.ybase && this.ydisp--, + this.ybase--); + this.savedY = Math.max(this.savedY - i3, 0); + } + _reflowSmaller(e3, t3) { + const i3 = this.getNullCell(o.DEFAULT_ATTR_DATA), + s3 = []; + let r2 = 0; + for (let n2 = this.lines.length - 1; n2 >= 0; n2--) { + let h2 = this.lines.get(n2); + if ( + !h2 || + (!h2.isWrapped && h2.getTrimmedLength() <= e3) + ) + continue; + const c2 = [h2]; + for (; h2.isWrapped && n2 > 0; ) + (h2 = this.lines.get(--n2)), c2.unshift(h2); + const l2 = this.ybase + this.y; + if (l2 >= n2 && l2 < n2 + c2.length) continue; + const d2 = c2[c2.length - 1].getTrimmedLength(), + _ = (0, a.reflowSmallerGetNewLineLengths)( + c2, + this._cols, + e3 + ), + u = _.length - c2.length; + let f; + f = + 0 === this.ybase && this.y !== this.lines.length - 1 + ? Math.max(0, this.y - this.lines.maxLength + u) + : Math.max( + 0, + this.lines.length - this.lines.maxLength + u + ); + const v = []; + for (let e4 = 0; e4 < u; e4++) { + const e5 = this.getBlankLine( + o.DEFAULT_ATTR_DATA, + true + ); + v.push(e5); + } + v.length > 0 && + (s3.push({ + start: n2 + c2.length + r2, + newLines: v, + }), + (r2 += v.length)), + c2.push(...v); + let p = _.length - 1, + g = _[p]; + 0 === g && (p--, (g = _[p])); + let m = c2.length - u - 1, + S = d2; + for (; m >= 0; ) { + const e4 = Math.min(S, g); + if (void 0 === c2[p]) break; + if ( + (c2[p].copyCellsFrom( + c2[m], + S - e4, + g - e4, + e4, + true + ), + (g -= e4), + 0 === g && (p--, (g = _[p])), + (S -= e4), + 0 === S) + ) { + m--; + const e5 = Math.max(m, 0); + S = (0, a.getWrappedLineTrimmedLength)( + c2, + e5, + this._cols + ); + } + } + for (let t4 = 0; t4 < c2.length; t4++) + _[t4] < e3 && c2[t4].setCell(_[t4], i3); + let C = u - f; + for (; C-- > 0; ) + 0 === this.ybase + ? this.y < t3 - 1 + ? (this.y++, this.lines.pop()) + : (this.ybase++, this.ydisp++) + : this.ybase < + Math.min( + this.lines.maxLength, + this.lines.length + r2 + ) - + t3 && + (this.ybase === this.ydisp && this.ydisp++, + this.ybase++); + this.savedY = Math.min( + this.savedY + u, + this.ybase + t3 - 1 + ); + } + if (s3.length > 0) { + const e4 = [], + t4 = []; + for (let e5 = 0; e5 < this.lines.length; e5++) + t4.push(this.lines.get(e5)); + const i4 = this.lines.length; + let n2 = i4 - 1, + o2 = 0, + a2 = s3[o2]; + this.lines.length = Math.min( + this.lines.maxLength, + this.lines.length + r2 + ); + let h2 = 0; + for ( + let c3 = Math.min( + this.lines.maxLength - 1, + i4 + r2 - 1 + ); + c3 >= 0; + c3-- + ) + if (a2 && a2.start > n2 + h2) { + for ( + let e5 = a2.newLines.length - 1; + e5 >= 0; + e5-- + ) + this.lines.set(c3--, a2.newLines[e5]); + c3++, + e4.push({ + index: n2 + 1, + amount: a2.newLines.length, + }), + (h2 += a2.newLines.length), + (a2 = s3[++o2]); + } else this.lines.set(c3, t4[n2--]); + let c2 = 0; + for (let t5 = e4.length - 1; t5 >= 0; t5--) + (e4[t5].index += c2), + this.lines.onInsertEmitter.fire(e4[t5]), + (c2 += e4[t5].amount); + const l2 = Math.max( + 0, + i4 + r2 - this.lines.maxLength + ); + l2 > 0 && this.lines.onTrimEmitter.fire(l2); + } + } + translateBufferLineToString(e3, t3, i3 = 0, s3) { + const r2 = this.lines.get(e3); + return r2 ? r2.translateToString(t3, i3, s3) : ""; + } + getWrappedRangeForLine(e3) { + let t3 = e3, + i3 = e3; + for (; t3 > 0 && this.lines.get(t3).isWrapped; ) t3--; + for ( + ; + i3 + 1 < this.lines.length && + this.lines.get(i3 + 1).isWrapped; + + ) + i3++; + return { first: t3, last: i3 }; + } + setupTabStops(e3) { + for ( + null != e3 + ? this.tabs[e3] || (e3 = this.prevStop(e3)) + : ((this.tabs = {}), (e3 = 0)); + e3 < this._cols; + e3 += this._optionsService.rawOptions.tabStopWidth + ) + this.tabs[e3] = true; + } + prevStop(e3) { + for ( + null == e3 && (e3 = this.x); + !this.tabs[--e3] && e3 > 0; + + ); + return e3 >= this._cols + ? this._cols - 1 + : e3 < 0 + ? 0 + : e3; + } + nextStop(e3) { + for ( + null == e3 && (e3 = this.x); + !this.tabs[++e3] && e3 < this._cols; + + ); + return e3 >= this._cols + ? this._cols - 1 + : e3 < 0 + ? 0 + : e3; + } + clearMarkers(e3) { + this._isClearing = true; + for (let t3 = 0; t3 < this.markers.length; t3++) + this.markers[t3].line === e3 && + (this.markers[t3].dispose(), + this.markers.splice(t3--, 1)); + this._isClearing = false; + } + clearAllMarkers() { + this._isClearing = true; + for (let e3 = 0; e3 < this.markers.length; e3++) + this.markers[e3].dispose(), + this.markers.splice(e3--, 1); + this._isClearing = false; + } + addMarker(e3) { + const t3 = new l.Marker(e3); + return ( + this.markers.push(t3), + t3.register( + this.lines.onTrim((e4) => { + (t3.line -= e4), t3.line < 0 && t3.dispose(); + }) + ), + t3.register( + this.lines.onInsert((e4) => { + t3.line >= e4.index && (t3.line += e4.amount); + }) + ), + t3.register( + this.lines.onDelete((e4) => { + t3.line >= e4.index && + t3.line < e4.index + e4.amount && + t3.dispose(), + t3.line > e4.index && (t3.line -= e4.amount); + }) + ), + t3.register( + t3.onDispose(() => this._removeMarker(t3)) + ), + t3 + ); + } + _removeMarker(e3) { + this._isClearing || + this.markers.splice(this.markers.indexOf(e3), 1); + } + }); + }, + 8437: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferLine = t2.DEFAULT_ATTR_DATA = void 0); + const s2 = i2(3734), + r = i2(511), + n = i2(643), + o = i2(482); + t2.DEFAULT_ATTR_DATA = Object.freeze(new s2.AttributeData()); + let a = 0; + class h { + constructor(e3, t3, i3 = false) { + (this.isWrapped = i3), + (this._combined = {}), + (this._extendedAttrs = {}), + (this._data = new Uint32Array(3 * e3)); + const s3 = + t3 || + r.CellData.fromCharData([ + 0, + n.NULL_CELL_CHAR, + n.NULL_CELL_WIDTH, + n.NULL_CELL_CODE, + ]); + for (let t4 = 0; t4 < e3; ++t4) this.setCell(t4, s3); + this.length = e3; + } + get(e3) { + const t3 = this._data[3 * e3 + 0], + i3 = 2097151 & t3; + return [ + this._data[3 * e3 + 1], + 2097152 & t3 + ? this._combined[e3] + : i3 + ? (0, o.stringFromCodePoint)(i3) + : "", + t3 >> 22, + 2097152 & t3 + ? this._combined[e3].charCodeAt( + this._combined[e3].length - 1 + ) + : i3, + ]; + } + set(e3, t3) { + (this._data[3 * e3 + 1] = t3[n.CHAR_DATA_ATTR_INDEX]), + t3[n.CHAR_DATA_CHAR_INDEX].length > 1 + ? ((this._combined[e3] = t3[1]), + (this._data[3 * e3 + 0] = + 2097152 | + e3 | + (t3[n.CHAR_DATA_WIDTH_INDEX] << 22))) + : (this._data[3 * e3 + 0] = + t3[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | + (t3[n.CHAR_DATA_WIDTH_INDEX] << 22)); + } + getWidth(e3) { + return this._data[3 * e3 + 0] >> 22; + } + hasWidth(e3) { + return 12582912 & this._data[3 * e3 + 0]; + } + getFg(e3) { + return this._data[3 * e3 + 1]; + } + getBg(e3) { + return this._data[3 * e3 + 2]; + } + hasContent(e3) { + return 4194303 & this._data[3 * e3 + 0]; + } + getCodePoint(e3) { + const t3 = this._data[3 * e3 + 0]; + return 2097152 & t3 + ? this._combined[e3].charCodeAt( + this._combined[e3].length - 1 + ) + : 2097151 & t3; + } + isCombined(e3) { + return 2097152 & this._data[3 * e3 + 0]; + } + getString(e3) { + const t3 = this._data[3 * e3 + 0]; + return 2097152 & t3 + ? this._combined[e3] + : 2097151 & t3 + ? (0, o.stringFromCodePoint)(2097151 & t3) + : ""; + } + isProtected(e3) { + return 536870912 & this._data[3 * e3 + 2]; + } + loadCell(e3, t3) { + return ( + (a = 3 * e3), + (t3.content = this._data[a + 0]), + (t3.fg = this._data[a + 1]), + (t3.bg = this._data[a + 2]), + 2097152 & t3.content && + (t3.combinedData = this._combined[e3]), + 268435456 & t3.bg && + (t3.extended = this._extendedAttrs[e3]), + t3 + ); + } + setCell(e3, t3) { + 2097152 & t3.content && + (this._combined[e3] = t3.combinedData), + 268435456 & t3.bg && + (this._extendedAttrs[e3] = t3.extended), + (this._data[3 * e3 + 0] = t3.content), + (this._data[3 * e3 + 1] = t3.fg), + (this._data[3 * e3 + 2] = t3.bg); + } + setCellFromCodepoint(e3, t3, i3, s3) { + 268435456 & s3.bg && + (this._extendedAttrs[e3] = s3.extended), + (this._data[3 * e3 + 0] = t3 | (i3 << 22)), + (this._data[3 * e3 + 1] = s3.fg), + (this._data[3 * e3 + 2] = s3.bg); + } + addCodepointToCell(e3, t3, i3) { + let s3 = this._data[3 * e3 + 0]; + 2097152 & s3 + ? (this._combined[e3] += (0, o.stringFromCodePoint)(t3)) + : 2097151 & s3 + ? ((this._combined[e3] = + (0, o.stringFromCodePoint)(2097151 & s3) + + (0, o.stringFromCodePoint)(t3)), + (s3 &= -2097152), + (s3 |= 2097152)) + : (s3 = t3 | (1 << 22)), + i3 && ((s3 &= -12582913), (s3 |= i3 << 22)), + (this._data[3 * e3 + 0] = s3); + } + insertCells(e3, t3, i3) { + if ( + ((e3 %= this.length) && + 2 === this.getWidth(e3 - 1) && + this.setCellFromCodepoint(e3 - 1, 0, 1, i3), + t3 < this.length - e3) + ) { + const s3 = new r.CellData(); + for (let i4 = this.length - e3 - t3 - 1; i4 >= 0; --i4) + this.setCell( + e3 + t3 + i4, + this.loadCell(e3 + i4, s3) + ); + for (let s4 = 0; s4 < t3; ++s4) + this.setCell(e3 + s4, i3); + } else + for (let t4 = e3; t4 < this.length; ++t4) + this.setCell(t4, i3); + 2 === this.getWidth(this.length - 1) && + this.setCellFromCodepoint(this.length - 1, 0, 1, i3); + } + deleteCells(e3, t3, i3) { + if (((e3 %= this.length), t3 < this.length - e3)) { + const s3 = new r.CellData(); + for (let i4 = 0; i4 < this.length - e3 - t3; ++i4) + this.setCell( + e3 + i4, + this.loadCell(e3 + t3 + i4, s3) + ); + for (let e4 = this.length - t3; e4 < this.length; ++e4) + this.setCell(e4, i3); + } else + for (let t4 = e3; t4 < this.length; ++t4) + this.setCell(t4, i3); + e3 && + 2 === this.getWidth(e3 - 1) && + this.setCellFromCodepoint(e3 - 1, 0, 1, i3), + 0 !== this.getWidth(e3) || + this.hasContent(e3) || + this.setCellFromCodepoint(e3, 0, 1, i3); + } + replaceCells(e3, t3, i3, s3 = false) { + if (s3) + for ( + e3 && + 2 === this.getWidth(e3 - 1) && + !this.isProtected(e3 - 1) && + this.setCellFromCodepoint(e3 - 1, 0, 1, i3), + t3 < this.length && + 2 === this.getWidth(t3 - 1) && + !this.isProtected(t3) && + this.setCellFromCodepoint(t3, 0, 1, i3); + e3 < t3 && e3 < this.length; + + ) + this.isProtected(e3) || this.setCell(e3, i3), e3++; + else + for ( + e3 && + 2 === this.getWidth(e3 - 1) && + this.setCellFromCodepoint(e3 - 1, 0, 1, i3), + t3 < this.length && + 2 === this.getWidth(t3 - 1) && + this.setCellFromCodepoint(t3, 0, 1, i3); + e3 < t3 && e3 < this.length; + + ) + this.setCell(e3++, i3); + } + resize(e3, t3) { + if (e3 === this.length) + return ( + 4 * this._data.length * 2 < + this._data.buffer.byteLength + ); + const i3 = 3 * e3; + if (e3 > this.length) { + if (this._data.buffer.byteLength >= 4 * i3) + this._data = new Uint32Array( + this._data.buffer, + 0, + i3 + ); + else { + const e4 = new Uint32Array(i3); + e4.set(this._data), (this._data = e4); + } + for (let i4 = this.length; i4 < e3; ++i4) + this.setCell(i4, t3); + } else { + this._data = this._data.subarray(0, i3); + const t4 = Object.keys(this._combined); + for (let i4 = 0; i4 < t4.length; i4++) { + const s4 = parseInt(t4[i4], 10); + s4 >= e3 && delete this._combined[s4]; + } + const s3 = Object.keys(this._extendedAttrs); + for (let t5 = 0; t5 < s3.length; t5++) { + const i4 = parseInt(s3[t5], 10); + i4 >= e3 && delete this._extendedAttrs[i4]; + } + } + return ( + (this.length = e3), + 4 * i3 * 2 < this._data.buffer.byteLength + ); + } + cleanupMemory() { + if ( + 4 * this._data.length * 2 < + this._data.buffer.byteLength + ) { + const e3 = new Uint32Array(this._data.length); + return e3.set(this._data), (this._data = e3), 1; + } + return 0; + } + fill(e3, t3 = false) { + if (t3) + for (let t4 = 0; t4 < this.length; ++t4) + this.isProtected(t4) || this.setCell(t4, e3); + else { + (this._combined = {}), (this._extendedAttrs = {}); + for (let t4 = 0; t4 < this.length; ++t4) + this.setCell(t4, e3); + } + } + copyFrom(e3) { + this.length !== e3.length + ? (this._data = new Uint32Array(e3._data)) + : this._data.set(e3._data), + (this.length = e3.length), + (this._combined = {}); + for (const t3 in e3._combined) + this._combined[t3] = e3._combined[t3]; + this._extendedAttrs = {}; + for (const t3 in e3._extendedAttrs) + this._extendedAttrs[t3] = e3._extendedAttrs[t3]; + this.isWrapped = e3.isWrapped; + } + clone() { + const e3 = new h(0); + (e3._data = new Uint32Array(this._data)), + (e3.length = this.length); + for (const t3 in this._combined) + e3._combined[t3] = this._combined[t3]; + for (const t3 in this._extendedAttrs) + e3._extendedAttrs[t3] = this._extendedAttrs[t3]; + return (e3.isWrapped = this.isWrapped), e3; + } + getTrimmedLength() { + for (let e3 = this.length - 1; e3 >= 0; --e3) + if (4194303 & this._data[3 * e3 + 0]) + return e3 + (this._data[3 * e3 + 0] >> 22); + return 0; + } + getNoBgTrimmedLength() { + for (let e3 = this.length - 1; e3 >= 0; --e3) + if ( + 4194303 & this._data[3 * e3 + 0] || + 50331648 & this._data[3 * e3 + 2] + ) + return e3 + (this._data[3 * e3 + 0] >> 22); + return 0; + } + copyCellsFrom(e3, t3, i3, s3, r2) { + const n2 = e3._data; + if (r2) + for (let r3 = s3 - 1; r3 >= 0; r3--) { + for (let e4 = 0; e4 < 3; e4++) + this._data[3 * (i3 + r3) + e4] = + n2[3 * (t3 + r3) + e4]; + 268435456 & n2[3 * (t3 + r3) + 2] && + (this._extendedAttrs[i3 + r3] = + e3._extendedAttrs[t3 + r3]); + } + else + for (let r3 = 0; r3 < s3; r3++) { + for (let e4 = 0; e4 < 3; e4++) + this._data[3 * (i3 + r3) + e4] = + n2[3 * (t3 + r3) + e4]; + 268435456 & n2[3 * (t3 + r3) + 2] && + (this._extendedAttrs[i3 + r3] = + e3._extendedAttrs[t3 + r3]); + } + const o2 = Object.keys(e3._combined); + for (let s4 = 0; s4 < o2.length; s4++) { + const r3 = parseInt(o2[s4], 10); + r3 >= t3 && + (this._combined[r3 - t3 + i3] = e3._combined[r3]); + } + } + translateToString(e3, t3, i3, s3) { + (t3 = t3 ?? 0), + (i3 = i3 ?? this.length), + e3 && (i3 = Math.min(i3, this.getTrimmedLength())), + s3 && (s3.length = 0); + let r2 = ""; + for (; t3 < i3; ) { + const e4 = this._data[3 * t3 + 0], + i4 = 2097151 & e4, + a2 = + 2097152 & e4 + ? this._combined[t3] + : i4 + ? (0, o.stringFromCodePoint)(i4) + : n.WHITESPACE_CELL_CHAR; + if (((r2 += a2), s3)) + for (let e5 = 0; e5 < a2.length; ++e5) s3.push(t3); + t3 += e4 >> 22 || 1; + } + return s3 && s3.push(t3), r2; + } + } + t2.BufferLine = h; + }, + 4841: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getRangeLength = void 0), + (t2.getRangeLength = function (e3, t3) { + if (e3.start.y > e3.end.y) + throw new Error( + `Buffer range end (${e3.end.x}, ${e3.end.y}) cannot be before start (${e3.start.x}, ${e3.start.y})` + ); + return ( + t3 * (e3.end.y - e3.start.y) + + (e3.end.x - e3.start.x + 1) + ); + }); + }, + 4634: (e2, t2) => { + function i2(e3, t3, i3) { + if (t3 === e3.length - 1) return e3[t3].getTrimmedLength(); + const s2 = + !e3[t3].hasContent(i3 - 1) && + 1 === e3[t3].getWidth(i3 - 1), + r = 2 === e3[t3 + 1].getWidth(0); + return s2 && r ? i3 - 1 : i3; + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getWrappedLineTrimmedLength = + t2.reflowSmallerGetNewLineLengths = + t2.reflowLargerApplyNewLayout = + t2.reflowLargerCreateNewLayout = + t2.reflowLargerGetLinesToRemove = + void 0), + (t2.reflowLargerGetLinesToRemove = function ( + e3, + t3, + s2, + r, + n + ) { + const o = []; + for (let a = 0; a < e3.length - 1; a++) { + let h = a, + c = e3.get(++h); + if (!c.isWrapped) continue; + const l = [e3.get(a)]; + for (; h < e3.length && c.isWrapped; ) + l.push(c), (c = e3.get(++h)); + if (r >= a && r < h) { + a += l.length - 1; + continue; + } + let d = 0, + _ = i2(l, d, t3), + u = 1, + f = 0; + for (; u < l.length; ) { + const e4 = i2(l, u, t3), + r2 = e4 - f, + o2 = s2 - _, + a2 = Math.min(r2, o2); + l[d].copyCellsFrom(l[u], f, _, a2, false), + (_ += a2), + _ === s2 && (d++, (_ = 0)), + (f += a2), + f === e4 && (u++, (f = 0)), + 0 === _ && + 0 !== d && + 2 === l[d - 1].getWidth(s2 - 1) && + (l[d].copyCellsFrom( + l[d - 1], + s2 - 1, + _++, + 1, + false + ), + l[d - 1].setCell(s2 - 1, n)); + } + l[d].replaceCells(_, s2, n); + let v = 0; + for ( + let e4 = l.length - 1; + e4 > 0 && (e4 > d || 0 === l[e4].getTrimmedLength()); + e4-- + ) + v++; + v > 0 && (o.push(a + l.length - v), o.push(v)), + (a += l.length - 1); + } + return o; + }), + (t2.reflowLargerCreateNewLayout = function (e3, t3) { + const i3 = []; + let s2 = 0, + r = t3[s2], + n = 0; + for (let o = 0; o < e3.length; o++) + if (r === o) { + const i4 = t3[++s2]; + e3.onDeleteEmitter.fire({ index: o - n, amount: i4 }), + (o += i4 - 1), + (n += i4), + (r = t3[++s2]); + } else i3.push(o); + return { layout: i3, countRemoved: n }; + }), + (t2.reflowLargerApplyNewLayout = function (e3, t3) { + const i3 = []; + for (let s2 = 0; s2 < t3.length; s2++) + i3.push(e3.get(t3[s2])); + for (let t4 = 0; t4 < i3.length; t4++) e3.set(t4, i3[t4]); + e3.length = t3.length; + }), + (t2.reflowSmallerGetNewLineLengths = function (e3, t3, s2) { + const r = [], + n = e3 + .map((s3, r2) => i2(e3, r2, t3)) + .reduce((e4, t4) => e4 + t4); + let o = 0, + a = 0, + h = 0; + for (; h < n; ) { + if (n - h < s2) { + r.push(n - h); + break; + } + o += s2; + const c = i2(e3, a, t3); + o > c && ((o -= c), a++); + const l = 2 === e3[a].getWidth(o - 1); + l && o--; + const d = l ? s2 - 1 : s2; + r.push(d), (h += d); + } + return r; + }), + (t2.getWrappedLineTrimmedLength = i2); + }, + 5295: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferSet = void 0); + const s2 = i2(8460), + r = i2(844), + n = i2(9092); + class o extends r.Disposable { + constructor(e3, t3) { + super(), + (this._optionsService = e3), + (this._bufferService = t3), + (this._onBufferActivate = this.register( + new s2.EventEmitter() + )), + (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 n.Buffer( + true, + this._optionsService, + this._bufferService + )), + this._normal.fillViewportRows(), + (this._alt = new n.Buffer( + false, + this._optionsService, + this._bufferService + )), + (this._activeBuffer = this._normal), + this._onBufferActivate.fire({ + activeBuffer: this._normal, + inactiveBuffer: this._alt, + }), + this.setupTabStops(); + } + get alt() { + return this._alt; + } + get active() { + return this._activeBuffer; + } + get normal() { + return this._normal; + } + activateNormalBuffer() { + this._activeBuffer !== this._normal && + ((this._normal.x = this._alt.x), + (this._normal.y = this._alt.y), + this._alt.clearAllMarkers(), + this._alt.clear(), + (this._activeBuffer = this._normal), + this._onBufferActivate.fire({ + activeBuffer: this._normal, + inactiveBuffer: this._alt, + })); + } + activateAltBuffer(e3) { + this._activeBuffer !== this._alt && + (this._alt.fillViewportRows(e3), + (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(e3, t3) { + this._normal.resize(e3, t3), + this._alt.resize(e3, t3), + this.setupTabStops(e3); + } + setupTabStops(e3) { + this._normal.setupTabStops(e3), + this._alt.setupTabStops(e3); + } + } + t2.BufferSet = o; + }, + 511: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CellData = void 0); + const s2 = i2(482), + r = i2(643), + n = i2(3734); + class o extends n.AttributeData { + constructor() { + super(...arguments), + (this.content = 0), + (this.fg = 0), + (this.bg = 0), + (this.extended = new n.ExtendedAttrs()), + (this.combinedData = ""); + } + static fromCharData(e3) { + const t3 = new o(); + return t3.setFromCharData(e3), t3; + } + isCombined() { + return 2097152 & this.content; + } + getWidth() { + return this.content >> 22; + } + getChars() { + return 2097152 & this.content + ? this.combinedData + : 2097151 & this.content + ? (0, s2.stringFromCodePoint)(2097151 & this.content) + : ""; + } + getCode() { + return this.isCombined() + ? this.combinedData.charCodeAt( + this.combinedData.length - 1 + ) + : 2097151 & this.content; + } + setFromCharData(e3) { + (this.fg = e3[r.CHAR_DATA_ATTR_INDEX]), (this.bg = 0); + let t3 = false; + if (e3[r.CHAR_DATA_CHAR_INDEX].length > 2) t3 = true; + else if (2 === e3[r.CHAR_DATA_CHAR_INDEX].length) { + const i3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0); + if (55296 <= i3 && i3 <= 56319) { + const s3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1); + 56320 <= s3 && s3 <= 57343 + ? (this.content = + (1024 * (i3 - 55296) + s3 - 56320 + 65536) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22)) + : (t3 = true); + } else t3 = true; + } else + this.content = + e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22); + t3 && + ((this.combinedData = e3[r.CHAR_DATA_CHAR_INDEX]), + (this.content = + 2097152 | (e3[r.CHAR_DATA_WIDTH_INDEX] << 22))); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + t2.CellData = o; + }, + 643: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.WHITESPACE_CELL_CODE = + t2.WHITESPACE_CELL_WIDTH = + t2.WHITESPACE_CELL_CHAR = + t2.NULL_CELL_CODE = + t2.NULL_CELL_WIDTH = + t2.NULL_CELL_CHAR = + t2.CHAR_DATA_CODE_INDEX = + t2.CHAR_DATA_WIDTH_INDEX = + t2.CHAR_DATA_CHAR_INDEX = + t2.CHAR_DATA_ATTR_INDEX = + t2.DEFAULT_EXT = + t2.DEFAULT_ATTR = + t2.DEFAULT_COLOR = + void 0), + (t2.DEFAULT_COLOR = 0), + (t2.DEFAULT_ATTR = 256 | (t2.DEFAULT_COLOR << 9)), + (t2.DEFAULT_EXT = 0), + (t2.CHAR_DATA_ATTR_INDEX = 0), + (t2.CHAR_DATA_CHAR_INDEX = 1), + (t2.CHAR_DATA_WIDTH_INDEX = 2), + (t2.CHAR_DATA_CODE_INDEX = 3), + (t2.NULL_CELL_CHAR = ""), + (t2.NULL_CELL_WIDTH = 1), + (t2.NULL_CELL_CODE = 0), + (t2.WHITESPACE_CELL_CHAR = " "), + (t2.WHITESPACE_CELL_WIDTH = 1), + (t2.WHITESPACE_CELL_CODE = 32); + }, + 4863: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Marker = void 0); + const s2 = i2(8460), + r = i2(844); + class n { + get id() { + return this._id; + } + constructor(e3) { + (this.line = e3), + (this.isDisposed = false), + (this._disposables = []), + (this._id = n._nextId++), + (this._onDispose = this.register( + new s2.EventEmitter() + )), + (this.onDispose = this._onDispose.event); + } + dispose() { + this.isDisposed || + ((this.isDisposed = true), + (this.line = -1), + this._onDispose.fire(), + (0, r.disposeArray)(this._disposables), + (this._disposables.length = 0)); + } + register(e3) { + return this._disposables.push(e3), e3; + } + } + (t2.Marker = n), (n._nextId = 1); + }, + 7116: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DEFAULT_CHARSET = t2.CHARSETS = void 0), + (t2.CHARSETS = {}), + (t2.DEFAULT_CHARSET = t2.CHARSETS.B), + (t2.CHARSETS[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", + }), + (t2.CHARSETS.A = { "#": "\xA3" }), + (t2.CHARSETS.B = void 0), + (t2.CHARSETS[4] = { + "#": "\xA3", + "@": "\xBE", + "[": "ij", + "\\": "\xBD", + "]": "|", + "{": "\xA8", + "|": "f", + "}": "\xBC", + "~": "\xB4", + }), + (t2.CHARSETS.C = t2.CHARSETS[5] = + { + "[": "\xC4", + "\\": "\xD6", + "]": "\xC5", + "^": "\xDC", + "`": "\xE9", + "{": "\xE4", + "|": "\xF6", + "}": "\xE5", + "~": "\xFC", + }), + (t2.CHARSETS.R = { + "#": "\xA3", + "@": "\xE0", + "[": "\xB0", + "\\": "\xE7", + "]": "\xA7", + "{": "\xE9", + "|": "\xF9", + "}": "\xE8", + "~": "\xA8", + }), + (t2.CHARSETS.Q = { + "@": "\xE0", + "[": "\xE2", + "\\": "\xE7", + "]": "\xEA", + "^": "\xEE", + "`": "\xF4", + "{": "\xE9", + "|": "\xF9", + "}": "\xE8", + "~": "\xFB", + }), + (t2.CHARSETS.K = { + "@": "\xA7", + "[": "\xC4", + "\\": "\xD6", + "]": "\xDC", + "{": "\xE4", + "|": "\xF6", + "}": "\xFC", + "~": "\xDF", + }), + (t2.CHARSETS.Y = { + "#": "\xA3", + "@": "\xA7", + "[": "\xB0", + "\\": "\xE7", + "]": "\xE9", + "`": "\xF9", + "{": "\xE0", + "|": "\xF2", + "}": "\xE8", + "~": "\xEC", + }), + (t2.CHARSETS.E = t2.CHARSETS[6] = + { + "@": "\xC4", + "[": "\xC6", + "\\": "\xD8", + "]": "\xC5", + "^": "\xDC", + "`": "\xE4", + "{": "\xE6", + "|": "\xF8", + "}": "\xE5", + "~": "\xFC", + }), + (t2.CHARSETS.Z = { + "#": "\xA3", + "@": "\xA7", + "[": "\xA1", + "\\": "\xD1", + "]": "\xBF", + "{": "\xB0", + "|": "\xF1", + "}": "\xE7", + }), + (t2.CHARSETS.H = t2.CHARSETS[7] = + { + "@": "\xC9", + "[": "\xC4", + "\\": "\xD6", + "]": "\xC5", + "^": "\xDC", + "`": "\xE9", + "{": "\xE4", + "|": "\xF6", + "}": "\xE5", + "~": "\xFC", + }), + (t2.CHARSETS["="] = { + "#": "\xF9", + "@": "\xE0", + "[": "\xE9", + "\\": "\xE7", + "]": "\xEA", + "^": "\xEE", + _: "\xE8", + "`": "\xF4", + "{": "\xE4", + "|": "\xF6", + "}": "\xFC", + "~": "\xFB", + }); + }, + 2584: (e2, t2) => { + var i2, s2, r; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.C1_ESCAPED = t2.C1 = t2.C0 = void 0), + (function (e3) { + (e3.NUL = "\0"), + (e3.SOH = ""), + (e3.STX = ""), + (e3.ETX = ""), + (e3.EOT = ""), + (e3.ENQ = ""), + (e3.ACK = ""), + (e3.BEL = "\x07"), + (e3.BS = "\b"), + (e3.HT = " "), + (e3.LF = "\n"), + (e3.VT = "\v"), + (e3.FF = "\f"), + (e3.CR = "\r"), + (e3.SO = ""), + (e3.SI = ""), + (e3.DLE = ""), + (e3.DC1 = ""), + (e3.DC2 = ""), + (e3.DC3 = ""), + (e3.DC4 = ""), + (e3.NAK = ""), + (e3.SYN = ""), + (e3.ETB = ""), + (e3.CAN = ""), + (e3.EM = ""), + (e3.SUB = ""), + (e3.ESC = "\x1B"), + (e3.FS = ""), + (e3.GS = ""), + (e3.RS = ""), + (e3.US = ""), + (e3.SP = " "), + (e3.DEL = "\x7F"); + })(i2 || (t2.C0 = i2 = {})), + (function (e3) { + (e3.PAD = "\x80"), + (e3.HOP = "\x81"), + (e3.BPH = "\x82"), + (e3.NBH = "\x83"), + (e3.IND = "\x84"), + (e3.NEL = "\x85"), + (e3.SSA = "\x86"), + (e3.ESA = "\x87"), + (e3.HTS = "\x88"), + (e3.HTJ = "\x89"), + (e3.VTS = "\x8A"), + (e3.PLD = "\x8B"), + (e3.PLU = "\x8C"), + (e3.RI = "\x8D"), + (e3.SS2 = "\x8E"), + (e3.SS3 = "\x8F"), + (e3.DCS = "\x90"), + (e3.PU1 = "\x91"), + (e3.PU2 = "\x92"), + (e3.STS = "\x93"), + (e3.CCH = "\x94"), + (e3.MW = "\x95"), + (e3.SPA = "\x96"), + (e3.EPA = "\x97"), + (e3.SOS = "\x98"), + (e3.SGCI = "\x99"), + (e3.SCI = "\x9A"), + (e3.CSI = "\x9B"), + (e3.ST = "\x9C"), + (e3.OSC = "\x9D"), + (e3.PM = "\x9E"), + (e3.APC = "\x9F"); + })(s2 || (t2.C1 = s2 = {})), + (function (e3) { + e3.ST = `${i2.ESC}\\`; + })(r || (t2.C1_ESCAPED = r = {})); + }, + 7399: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.evaluateKeyboardEvent = void 0); + const s2 = i2(2584), + r = { + 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: ["'", '"'], + }; + t2.evaluateKeyboardEvent = function (e3, t3, i3, n) { + const o = { type: 0, cancel: false, key: void 0 }, + a = + (e3.shiftKey ? 1 : 0) | + (e3.altKey ? 2 : 0) | + (e3.ctrlKey ? 4 : 0) | + (e3.metaKey ? 8 : 0); + switch (e3.keyCode) { + case 0: + "UIKeyInputUpArrow" === e3.key + ? (o.key = t3 ? s2.C0.ESC + "OA" : s2.C0.ESC + "[A") + : "UIKeyInputLeftArrow" === e3.key + ? (o.key = t3 ? s2.C0.ESC + "OD" : s2.C0.ESC + "[D") + : "UIKeyInputRightArrow" === e3.key + ? (o.key = t3 + ? s2.C0.ESC + "OC" + : s2.C0.ESC + "[C") + : "UIKeyInputDownArrow" === e3.key && + (o.key = t3 + ? s2.C0.ESC + "OB" + : s2.C0.ESC + "[B"); + break; + case 8: + (o.key = e3.ctrlKey ? "\b" : s2.C0.DEL), + e3.altKey && (o.key = s2.C0.ESC + o.key); + break; + case 9: + if (e3.shiftKey) { + o.key = s2.C0.ESC + "[Z"; + break; + } + (o.key = s2.C0.HT), (o.cancel = true); + break; + case 13: + (o.key = e3.altKey ? s2.C0.ESC + s2.C0.CR : s2.C0.CR), + (o.cancel = true); + break; + case 27: + (o.key = s2.C0.ESC), + e3.altKey && (o.key = s2.C0.ESC + s2.C0.ESC), + (o.cancel = true); + break; + case 37: + if (e3.metaKey) break; + a + ? ((o.key = s2.C0.ESC + "[1;" + (a + 1) + "D"), + o.key === s2.C0.ESC + "[1;3D" && + (o.key = s2.C0.ESC + (i3 ? "b" : "[1;5D"))) + : (o.key = t3 ? s2.C0.ESC + "OD" : s2.C0.ESC + "[D"); + break; + case 39: + if (e3.metaKey) break; + a + ? ((o.key = s2.C0.ESC + "[1;" + (a + 1) + "C"), + o.key === s2.C0.ESC + "[1;3C" && + (o.key = s2.C0.ESC + (i3 ? "f" : "[1;5C"))) + : (o.key = t3 ? s2.C0.ESC + "OC" : s2.C0.ESC + "[C"); + break; + case 38: + if (e3.metaKey) break; + a + ? ((o.key = s2.C0.ESC + "[1;" + (a + 1) + "A"), + i3 || + o.key !== s2.C0.ESC + "[1;3A" || + (o.key = s2.C0.ESC + "[1;5A")) + : (o.key = t3 ? s2.C0.ESC + "OA" : s2.C0.ESC + "[A"); + break; + case 40: + if (e3.metaKey) break; + a + ? ((o.key = s2.C0.ESC + "[1;" + (a + 1) + "B"), + i3 || + o.key !== s2.C0.ESC + "[1;3B" || + (o.key = s2.C0.ESC + "[1;5B")) + : (o.key = t3 ? s2.C0.ESC + "OB" : s2.C0.ESC + "[B"); + break; + case 45: + e3.shiftKey || + e3.ctrlKey || + (o.key = s2.C0.ESC + "[2~"); + break; + case 46: + o.key = a + ? s2.C0.ESC + "[3;" + (a + 1) + "~" + : s2.C0.ESC + "[3~"; + break; + case 36: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "H" + : t3 + ? s2.C0.ESC + "OH" + : s2.C0.ESC + "[H"; + break; + case 35: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "F" + : t3 + ? s2.C0.ESC + "OF" + : s2.C0.ESC + "[F"; + break; + case 33: + e3.shiftKey + ? (o.type = 2) + : e3.ctrlKey + ? (o.key = s2.C0.ESC + "[5;" + (a + 1) + "~") + : (o.key = s2.C0.ESC + "[5~"); + break; + case 34: + e3.shiftKey + ? (o.type = 3) + : e3.ctrlKey + ? (o.key = s2.C0.ESC + "[6;" + (a + 1) + "~") + : (o.key = s2.C0.ESC + "[6~"); + break; + case 112: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "P" + : s2.C0.ESC + "OP"; + break; + case 113: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "Q" + : s2.C0.ESC + "OQ"; + break; + case 114: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "R" + : s2.C0.ESC + "OR"; + break; + case 115: + o.key = a + ? s2.C0.ESC + "[1;" + (a + 1) + "S" + : s2.C0.ESC + "OS"; + break; + case 116: + o.key = a + ? s2.C0.ESC + "[15;" + (a + 1) + "~" + : s2.C0.ESC + "[15~"; + break; + case 117: + o.key = a + ? s2.C0.ESC + "[17;" + (a + 1) + "~" + : s2.C0.ESC + "[17~"; + break; + case 118: + o.key = a + ? s2.C0.ESC + "[18;" + (a + 1) + "~" + : s2.C0.ESC + "[18~"; + break; + case 119: + o.key = a + ? s2.C0.ESC + "[19;" + (a + 1) + "~" + : s2.C0.ESC + "[19~"; + break; + case 120: + o.key = a + ? s2.C0.ESC + "[20;" + (a + 1) + "~" + : s2.C0.ESC + "[20~"; + break; + case 121: + o.key = a + ? s2.C0.ESC + "[21;" + (a + 1) + "~" + : s2.C0.ESC + "[21~"; + break; + case 122: + o.key = a + ? s2.C0.ESC + "[23;" + (a + 1) + "~" + : s2.C0.ESC + "[23~"; + break; + case 123: + o.key = a + ? s2.C0.ESC + "[24;" + (a + 1) + "~" + : s2.C0.ESC + "[24~"; + break; + default: + if ( + !e3.ctrlKey || + e3.shiftKey || + e3.altKey || + e3.metaKey + ) + if ((i3 && !n) || !e3.altKey || e3.metaKey) + !i3 || + e3.altKey || + e3.ctrlKey || + e3.shiftKey || + !e3.metaKey + ? e3.key && + !e3.ctrlKey && + !e3.altKey && + !e3.metaKey && + e3.keyCode >= 48 && + 1 === e3.key.length + ? (o.key = e3.key) + : e3.key && + e3.ctrlKey && + ("_" === e3.key && (o.key = s2.C0.US), + "@" === e3.key && (o.key = s2.C0.NUL)) + : 65 === e3.keyCode && (o.type = 1); + else { + const t4 = r[e3.keyCode], + i4 = t4?.[e3.shiftKey ? 1 : 0]; + if (i4) o.key = s2.C0.ESC + i4; + else if (e3.keyCode >= 65 && e3.keyCode <= 90) { + const t5 = e3.ctrlKey + ? e3.keyCode - 64 + : e3.keyCode + 32; + let i5 = String.fromCharCode(t5); + e3.shiftKey && (i5 = i5.toUpperCase()), + (o.key = s2.C0.ESC + i5); + } else if (32 === e3.keyCode) + o.key = + s2.C0.ESC + (e3.ctrlKey ? s2.C0.NUL : " "); + else if ( + "Dead" === e3.key && + e3.code.startsWith("Key") + ) { + let t5 = e3.code.slice(3, 4); + e3.shiftKey || (t5 = t5.toLowerCase()), + (o.key = s2.C0.ESC + t5), + (o.cancel = true); + } + } + else + e3.keyCode >= 65 && e3.keyCode <= 90 + ? (o.key = String.fromCharCode(e3.keyCode - 64)) + : 32 === e3.keyCode + ? (o.key = s2.C0.NUL) + : e3.keyCode >= 51 && e3.keyCode <= 55 + ? (o.key = String.fromCharCode( + e3.keyCode - 51 + 27 + )) + : 56 === e3.keyCode + ? (o.key = s2.C0.DEL) + : 219 === e3.keyCode + ? (o.key = s2.C0.ESC) + : 220 === e3.keyCode + ? (o.key = s2.C0.FS) + : 221 === e3.keyCode && + (o.key = s2.C0.GS); + } + return o; + }; + }, + 482: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Utf8ToUtf32 = + t2.StringToUtf32 = + t2.utf32ToString = + t2.stringFromCodePoint = + void 0), + (t2.stringFromCodePoint = function (e3) { + return e3 > 65535 + ? ((e3 -= 65536), + String.fromCharCode(55296 + (e3 >> 10)) + + String.fromCharCode((e3 % 1024) + 56320)) + : String.fromCharCode(e3); + }), + (t2.utf32ToString = function (e3, t3 = 0, i2 = e3.length) { + let s2 = ""; + for (let r = t3; r < i2; ++r) { + let t4 = e3[r]; + t4 > 65535 + ? ((t4 -= 65536), + (s2 += + String.fromCharCode(55296 + (t4 >> 10)) + + String.fromCharCode((t4 % 1024) + 56320))) + : (s2 += String.fromCharCode(t4)); + } + return s2; + }), + (t2.StringToUtf32 = class { + constructor() { + this._interim = 0; + } + clear() { + this._interim = 0; + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2 = 0, + r = 0; + if (this._interim) { + const i3 = e3.charCodeAt(r++); + 56320 <= i3 && i3 <= 57343 + ? (t3[s2++] = + 1024 * (this._interim - 55296) + + i3 - + 56320 + + 65536) + : ((t3[s2++] = this._interim), (t3[s2++] = i3)), + (this._interim = 0); + } + for (let n = r; n < i2; ++n) { + const r2 = e3.charCodeAt(n); + if (55296 <= r2 && r2 <= 56319) { + if (++n >= i2) return (this._interim = r2), s2; + const o = e3.charCodeAt(n); + 56320 <= o && o <= 57343 + ? (t3[s2++] = + 1024 * (r2 - 55296) + o - 56320 + 65536) + : ((t3[s2++] = r2), (t3[s2++] = o)); + } else 65279 !== r2 && (t3[s2++] = r2); + } + return s2; + } + }), + (t2.Utf8ToUtf32 = class { + constructor() { + this.interim = new Uint8Array(3); + } + clear() { + this.interim.fill(0); + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2, + r, + n, + o, + a = 0, + h = 0, + c = 0; + if (this.interim[0]) { + let s3 = false, + r2 = this.interim[0]; + r2 &= + 192 == (224 & r2) ? 31 : 224 == (240 & r2) ? 15 : 7; + let n2, + o2 = 0; + for (; (n2 = 63 & this.interim[++o2]) && o2 < 4; ) + (r2 <<= 6), (r2 |= n2); + const h2 = + 192 == (224 & this.interim[0]) + ? 2 + : 224 == (240 & this.interim[0]) + ? 3 + : 4, + l2 = h2 - o2; + for (; c < l2; ) { + if (c >= i2) return 0; + if (((n2 = e3[c++]), 128 != (192 & n2))) { + c--, (s3 = true); + break; + } + (this.interim[o2++] = n2), + (r2 <<= 6), + (r2 |= 63 & n2); + } + s3 || + (2 === h2 + ? r2 < 128 + ? c-- + : (t3[a++] = r2) + : 3 === h2 + ? r2 < 2048 || + (r2 >= 55296 && r2 <= 57343) || + 65279 === r2 || + (t3[a++] = r2) + : r2 < 65536 || r2 > 1114111 || (t3[a++] = r2)), + this.interim.fill(0); + } + const l = i2 - 4; + let d = c; + for (; d < i2; ) { + for ( + ; + !( + !(d < l) || + 128 & (s2 = e3[d]) || + 128 & (r = e3[d + 1]) || + 128 & (n = e3[d + 2]) || + 128 & (o = e3[d + 3]) + ); + + ) + (t3[a++] = s2), + (t3[a++] = r), + (t3[a++] = n), + (t3[a++] = o), + (d += 4); + if (((s2 = e3[d++]), s2 < 128)) t3[a++] = s2; + else if (192 == (224 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (((h = ((31 & s2) << 6) | (63 & r)), h < 128)) { + d--; + continue; + } + t3[a++] = h; + } else if (224 == (240 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((n = e3[d++]), 128 != (192 & n))) { + d--; + continue; + } + if ( + ((h = + ((15 & s2) << 12) | ((63 & r) << 6) | (63 & n)), + h < 2048 || + (h >= 55296 && h <= 57343) || + 65279 === h) + ) + continue; + t3[a++] = h; + } else if (240 == (248 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((n = e3[d++]), 128 != (192 & n))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), + (this.interim[1] = r), + (this.interim[2] = n), + a + ); + if (((o = e3[d++]), 128 != (192 & o))) { + d--; + continue; + } + if ( + ((h = + ((7 & s2) << 18) | + ((63 & r) << 12) | + ((63 & n) << 6) | + (63 & o)), + h < 65536 || h > 1114111) + ) + continue; + t3[a++] = h; + } + } + return a; + } + }); + }, + 225: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeV6 = void 0); + const s2 = i2(1480), + r = [ + [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], + ], + n = [ + [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], + ]; + let o; + t2.UnicodeV6 = class { + constructor() { + if (((this.version = "6"), !o)) { + (o = new Uint8Array(65536)), + o.fill(1), + (o[0] = 0), + o.fill(0, 1, 32), + o.fill(0, 127, 160), + o.fill(2, 4352, 4448), + (o[9001] = 2), + (o[9002] = 2), + o.fill(2, 11904, 42192), + (o[12351] = 1), + o.fill(2, 44032, 55204), + o.fill(2, 63744, 64256), + o.fill(2, 65040, 65050), + o.fill(2, 65072, 65136), + o.fill(2, 65280, 65377), + o.fill(2, 65504, 65511); + for (let e3 = 0; e3 < r.length; ++e3) + o.fill(0, r[e3][0], r[e3][1] + 1); + } + } + wcwidth(e3) { + return e3 < 32 + ? 0 + : e3 < 127 + ? 1 + : e3 < 65536 + ? o[e3] + : (function (e4, t3) { + let i3, + s3 = 0, + r2 = t3.length - 1; + if (e4 < t3[0][0] || e4 > t3[r2][1]) + return false; + for (; r2 >= s3; ) + if (((i3 = (s3 + r2) >> 1), e4 > t3[i3][1])) + s3 = i3 + 1; + else { + if (!(e4 < t3[i3][0])) return true; + r2 = i3 - 1; + } + return false; + })(e3, n) + ? 0 + : (e3 >= 131072 && e3 <= 196605) || + (e3 >= 196608 && e3 <= 262141) + ? 2 + : 1; + } + charProperties(e3, t3) { + let i3 = this.wcwidth(e3), + r2 = 0 === i3 && 0 !== t3; + if (r2) { + const e4 = s2.UnicodeService.extractWidth(t3); + 0 === e4 ? (r2 = false) : e4 > i3 && (i3 = e4); + } + return s2.UnicodeService.createPropertyValue(0, i3, r2); + } + }; + }, + 5981: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.WriteBuffer = void 0); + const s2 = i2(8460), + r = i2(844); + class n extends r.Disposable { + constructor(e3) { + super(), + (this._action = e3), + (this._writeBuffer = []), + (this._callbacks = []), + (this._pendingData = 0), + (this._bufferOffset = 0), + (this._isSyncWriting = false), + (this._syncCalls = 0), + (this._didUserInput = false), + (this._onWriteParsed = this.register( + new s2.EventEmitter() + )), + (this.onWriteParsed = this._onWriteParsed.event); + } + handleUserInput() { + this._didUserInput = true; + } + writeSync(e3, t3) { + if (void 0 !== t3 && this._syncCalls > t3) + return void (this._syncCalls = 0); + if ( + ((this._pendingData += e3.length), + this._writeBuffer.push(e3), + this._callbacks.push(void 0), + this._syncCalls++, + this._isSyncWriting) + ) + return; + let i3; + for ( + this._isSyncWriting = true; + (i3 = this._writeBuffer.shift()); + + ) { + this._action(i3); + const e4 = this._callbacks.shift(); + e4 && e4(); + } + (this._pendingData = 0), + (this._bufferOffset = 2147483647), + (this._isSyncWriting = false), + (this._syncCalls = 0); + } + write(e3, t3) { + 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 = false), + (this._pendingData += e3.length), + this._writeBuffer.push(e3), + this._callbacks.push(t3), + void this._innerWrite() + ); + setTimeout(() => this._innerWrite()); + } + (this._pendingData += e3.length), + this._writeBuffer.push(e3), + this._callbacks.push(t3); + } + _innerWrite(e3 = 0, t3 = true) { + const i3 = e3 || Date.now(); + for (; this._writeBuffer.length > this._bufferOffset; ) { + const e4 = this._writeBuffer[this._bufferOffset], + s3 = this._action(e4, t3); + if (s3) { + const e5 = (e6) => + Date.now() - i3 >= 12 + ? setTimeout(() => this._innerWrite(0, e6)) + : this._innerWrite(i3, e6); + return void s3 + .catch( + (e6) => ( + queueMicrotask(() => { + throw e6; + }), + Promise.resolve(false) + ) + ) + .then(e5); + } + const r2 = this._callbacks[this._bufferOffset]; + if ( + (r2 && r2(), + this._bufferOffset++, + (this._pendingData -= e4.length), + Date.now() - i3 >= 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(); + } + } + t2.WriteBuffer = n; + }, + 5941: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.toRgbString = t2.parseColor = void 0); + const i2 = + /^([\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})$/, + s2 = /^[\da-f]+$/; + function r(e3, t3) { + const i3 = e3.toString(16), + s3 = i3.length < 2 ? "0" + i3 : i3; + switch (t3) { + case 4: + return i3[0]; + case 8: + return s3; + case 12: + return (s3 + s3).slice(0, 3); + default: + return s3 + s3; + } + } + (t2.parseColor = function (e3) { + if (!e3) return; + let t3 = e3.toLowerCase(); + if (0 === t3.indexOf("rgb:")) { + t3 = t3.slice(4); + const e4 = i2.exec(t3); + if (e4) { + const t4 = e4[1] + ? 15 + : e4[4] + ? 255 + : e4[7] + ? 4095 + : 65535; + return [ + Math.round( + (parseInt(e4[1] || e4[4] || e4[7] || e4[10], 16) / + t4) * + 255 + ), + Math.round( + (parseInt(e4[2] || e4[5] || e4[8] || e4[11], 16) / + t4) * + 255 + ), + Math.round( + (parseInt(e4[3] || e4[6] || e4[9] || e4[12], 16) / + t4) * + 255 + ), + ]; + } + } else if ( + 0 === t3.indexOf("#") && + ((t3 = t3.slice(1)), + s2.exec(t3) && [3, 6, 9, 12].includes(t3.length)) + ) { + const e4 = t3.length / 3, + i3 = [0, 0, 0]; + for (let s3 = 0; s3 < 3; ++s3) { + const r2 = parseInt( + t3.slice(e4 * s3, e4 * s3 + e4), + 16 + ); + i3[s3] = + 1 === e4 + ? r2 << 4 + : 2 === e4 + ? r2 + : 3 === e4 + ? r2 >> 4 + : r2 >> 8; + } + return i3; + } + }), + (t2.toRgbString = function (e3, t3 = 16) { + const [i3, s3, n] = e3; + return `rgb:${r(i3, t3)}/${r(s3, t3)}/${r(n, t3)}`; + }); + }, + 5770: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.PAYLOAD_LIMIT = void 0), + (t2.PAYLOAD_LIMIT = 1e7); + }, + 6351: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DcsHandler = t2.DcsParser = void 0); + const s2 = i2(482), + r = i2(8742), + n = i2(5770), + o = []; + t2.DcsParser = class { + constructor() { + (this._handlers = /* @__PURE__ */ Object.create(null)), + (this._active = o), + (this._ident = 0), + (this._handlerFb = () => {}), + (this._stack = { + paused: false, + loopPosition: 0, + fallThrough: false, + }); + } + dispose() { + (this._handlers = /* @__PURE__ */ Object.create(null)), + (this._handlerFb = () => {}), + (this._active = o); + } + registerHandler(e3, t3) { + void 0 === this._handlers[e3] && + (this._handlers[e3] = []); + const i3 = this._handlers[e3]; + return ( + i3.push(t3), + { + dispose: () => { + const e4 = i3.indexOf(t3); + -1 !== e4 && i3.splice(e4, 1); + }, + } + ); + } + clearHandler(e3) { + this._handlers[e3] && delete this._handlers[e3]; + } + setHandlerFallback(e3) { + this._handlerFb = e3; + } + reset() { + if (this._active.length) + for ( + let e3 = this._stack.paused + ? this._stack.loopPosition - 1 + : this._active.length - 1; + e3 >= 0; + --e3 + ) + this._active[e3].unhook(false); + (this._stack.paused = false), + (this._active = o), + (this._ident = 0); + } + hook(e3, t3) { + if ( + (this.reset(), + (this._ident = e3), + (this._active = this._handlers[e3] || o), + this._active.length) + ) + for (let e4 = this._active.length - 1; e4 >= 0; e4--) + this._active[e4].hook(t3); + else this._handlerFb(this._ident, "HOOK", t3); + } + put(e3, t3, i3) { + if (this._active.length) + for (let s3 = this._active.length - 1; s3 >= 0; s3--) + this._active[s3].put(e3, t3, i3); + else + this._handlerFb( + this._ident, + "PUT", + (0, s2.utf32ToString)(e3, t3, i3) + ); + } + unhook(e3, t3 = true) { + if (this._active.length) { + let i3 = false, + s3 = this._active.length - 1, + r2 = false; + if ( + (this._stack.paused && + ((s3 = this._stack.loopPosition - 1), + (i3 = t3), + (r2 = this._stack.fallThrough), + (this._stack.paused = false)), + !r2 && false === i3) + ) { + for ( + ; + s3 >= 0 && + ((i3 = this._active[s3].unhook(e3)), true !== i3); + s3-- + ) + if (i3 instanceof Promise) + return ( + (this._stack.paused = true), + (this._stack.loopPosition = s3), + (this._stack.fallThrough = false), + i3 + ); + s3--; + } + for (; s3 >= 0; s3--) + if ( + ((i3 = this._active[s3].unhook(false)), + i3 instanceof Promise) + ) + return ( + (this._stack.paused = true), + (this._stack.loopPosition = s3), + (this._stack.fallThrough = true), + i3 + ); + } else this._handlerFb(this._ident, "UNHOOK", e3); + (this._active = o), (this._ident = 0); + } + }; + const a = new r.Params(); + a.addParam(0), + (t2.DcsHandler = class { + constructor(e3) { + (this._handler = e3), + (this._data = ""), + (this._params = a), + (this._hitLimit = false); + } + hook(e3) { + (this._params = + e3.length > 1 || e3.params[0] ? e3.clone() : a), + (this._data = ""), + (this._hitLimit = false); + } + put(e3, t3, i3) { + this._hitLimit || + ((this._data += (0, s2.utf32ToString)(e3, t3, i3)), + this._data.length > n.PAYLOAD_LIMIT && + ((this._data = ""), (this._hitLimit = true))); + } + unhook(e3) { + let t3 = false; + if (this._hitLimit) t3 = false; + else if ( + e3 && + ((t3 = this._handler(this._data, this._params)), + t3 instanceof Promise) + ) + return t3.then( + (e4) => ( + (this._params = a), + (this._data = ""), + (this._hitLimit = false), + e4 + ) + ); + return ( + (this._params = a), + (this._data = ""), + (this._hitLimit = false), + t3 + ); + } + }); + }, + 2015: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.EscapeSequenceParser = + t2.VT500_TRANSITION_TABLE = + t2.TransitionTable = + void 0); + const s2 = i2(844), + r = i2(8742), + n = i2(6242), + o = i2(6351); + class a { + constructor(e3) { + this.table = new Uint8Array(e3); + } + setDefault(e3, t3) { + this.table.fill((e3 << 4) | t3); + } + add(e3, t3, i3, s3) { + this.table[(t3 << 8) | e3] = (i3 << 4) | s3; + } + addMany(e3, t3, i3, s3) { + for (let r2 = 0; r2 < e3.length; r2++) + this.table[(t3 << 8) | e3[r2]] = (i3 << 4) | s3; + } + } + t2.TransitionTable = a; + const h = 160; + t2.VT500_TRANSITION_TABLE = (function () { + const e3 = new a(4095), + t3 = Array.apply(null, Array(256)).map((e4, t4) => t4), + i3 = (e4, i4) => t3.slice(e4, i4), + s3 = i3(32, 127), + r2 = i3(0, 24); + r2.push(25), r2.push.apply(r2, i3(28, 32)); + const n2 = i3(0, 14); + let o2; + for (o2 in (e3.setDefault(1, 0), + e3.addMany(s3, 0, 2, 0), + n2)) + e3.addMany([24, 26, 153, 154], o2, 3, 0), + e3.addMany(i3(128, 144), o2, 3, 0), + e3.addMany(i3(144, 152), o2, 3, 0), + e3.add(156, o2, 0, 0), + e3.add(27, o2, 11, 1), + e3.add(157, o2, 4, 8), + e3.addMany([152, 158, 159], o2, 0, 7), + e3.add(155, o2, 11, 3), + e3.add(144, o2, 11, 9); + return ( + e3.addMany(r2, 0, 3, 0), + e3.addMany(r2, 1, 3, 1), + e3.add(127, 1, 0, 1), + e3.addMany(r2, 8, 0, 8), + e3.addMany(r2, 3, 3, 3), + e3.add(127, 3, 0, 3), + e3.addMany(r2, 4, 3, 4), + e3.add(127, 4, 0, 4), + e3.addMany(r2, 6, 3, 6), + e3.addMany(r2, 5, 3, 5), + e3.add(127, 5, 0, 5), + e3.addMany(r2, 2, 3, 2), + e3.add(127, 2, 0, 2), + e3.add(93, 1, 4, 8), + e3.addMany(s3, 8, 5, 8), + e3.add(127, 8, 5, 8), + e3.addMany([156, 27, 24, 26, 7], 8, 6, 0), + e3.addMany(i3(28, 32), 8, 0, 8), + e3.addMany([88, 94, 95], 1, 0, 7), + e3.addMany(s3, 7, 0, 7), + e3.addMany(r2, 7, 0, 7), + e3.add(156, 7, 0, 0), + e3.add(127, 7, 0, 7), + e3.add(91, 1, 11, 3), + e3.addMany(i3(64, 127), 3, 7, 0), + e3.addMany(i3(48, 60), 3, 8, 4), + e3.addMany([60, 61, 62, 63], 3, 9, 4), + e3.addMany(i3(48, 60), 4, 8, 4), + e3.addMany(i3(64, 127), 4, 7, 0), + e3.addMany([60, 61, 62, 63], 4, 0, 6), + e3.addMany(i3(32, 64), 6, 0, 6), + e3.add(127, 6, 0, 6), + e3.addMany(i3(64, 127), 6, 0, 0), + e3.addMany(i3(32, 48), 3, 9, 5), + e3.addMany(i3(32, 48), 5, 9, 5), + e3.addMany(i3(48, 64), 5, 0, 6), + e3.addMany(i3(64, 127), 5, 7, 0), + e3.addMany(i3(32, 48), 4, 9, 5), + e3.addMany(i3(32, 48), 1, 9, 2), + e3.addMany(i3(32, 48), 2, 9, 2), + e3.addMany(i3(48, 127), 2, 10, 0), + e3.addMany(i3(48, 80), 1, 10, 0), + e3.addMany(i3(81, 88), 1, 10, 0), + e3.addMany([89, 90, 92], 1, 10, 0), + e3.addMany(i3(96, 127), 1, 10, 0), + e3.add(80, 1, 11, 9), + e3.addMany(r2, 9, 0, 9), + e3.add(127, 9, 0, 9), + e3.addMany(i3(28, 32), 9, 0, 9), + e3.addMany(i3(32, 48), 9, 9, 12), + e3.addMany(i3(48, 60), 9, 8, 10), + e3.addMany([60, 61, 62, 63], 9, 9, 10), + e3.addMany(r2, 11, 0, 11), + e3.addMany(i3(32, 128), 11, 0, 11), + e3.addMany(i3(28, 32), 11, 0, 11), + e3.addMany(r2, 10, 0, 10), + e3.add(127, 10, 0, 10), + e3.addMany(i3(28, 32), 10, 0, 10), + e3.addMany(i3(48, 60), 10, 8, 10), + e3.addMany([60, 61, 62, 63], 10, 0, 11), + e3.addMany(i3(32, 48), 10, 9, 12), + e3.addMany(r2, 12, 0, 12), + e3.add(127, 12, 0, 12), + e3.addMany(i3(28, 32), 12, 0, 12), + e3.addMany(i3(32, 48), 12, 9, 12), + e3.addMany(i3(48, 64), 12, 0, 11), + e3.addMany(i3(64, 127), 12, 12, 13), + e3.addMany(i3(64, 127), 10, 12, 13), + e3.addMany(i3(64, 127), 9, 12, 13), + e3.addMany(r2, 13, 13, 13), + e3.addMany(s3, 13, 13, 13), + e3.add(127, 13, 0, 13), + e3.addMany([27, 156, 24, 26], 13, 14, 0), + e3.add(h, 0, 2, 0), + e3.add(h, 8, 5, 8), + e3.add(h, 6, 0, 6), + e3.add(h, 11, 0, 11), + e3.add(h, 13, 13, 13), + e3 + ); + })(); + class c extends s2.Disposable { + constructor(e3 = t2.VT500_TRANSITION_TABLE) { + super(), + (this._transitions = e3), + (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 = (e4, t3, i3) => {}), + (this._executeHandlerFb = (e4) => {}), + (this._csiHandlerFb = (e4, t3) => {}), + (this._escHandlerFb = (e4) => {}), + (this._errorHandlerFb = (e4) => e4), + (this._printHandler = this._printHandlerFb), + (this._executeHandlers = + /* @__PURE__ */ Object.create(null)), + (this._csiHandlers = + /* @__PURE__ */ Object.create(null)), + (this._escHandlers = + /* @__PURE__ */ Object.create(null)), + this.register( + (0, s2.toDisposable)(() => { + (this._csiHandlers = + /* @__PURE__ */ Object.create(null)), + (this._executeHandlers = + /* @__PURE__ */ Object.create(null)), + (this._escHandlers = + /* @__PURE__ */ Object.create(null)); + }) + ), + (this._oscParser = this.register(new n.OscParser())), + (this._dcsParser = this.register(new o.DcsParser())), + (this._errorHandler = this._errorHandlerFb), + this.registerEscHandler({ final: "\\" }, () => true); + } + _identifier(e3, t3 = [64, 126]) { + let i3 = 0; + if (e3.prefix) { + if (e3.prefix.length > 1) + throw new Error("only one byte as prefix supported"); + if ( + ((i3 = e3.prefix.charCodeAt(0)), + (i3 && 60 > i3) || i3 > 63) + ) + throw new Error( + "prefix must be in range 0x3c .. 0x3f" + ); + } + if (e3.intermediates) { + if (e3.intermediates.length > 2) + throw new Error( + "only two bytes as intermediates are supported" + ); + for (let t4 = 0; t4 < e3.intermediates.length; ++t4) { + const s4 = e3.intermediates.charCodeAt(t4); + if (32 > s4 || s4 > 47) + throw new Error( + "intermediate must be in range 0x20 .. 0x2f" + ); + (i3 <<= 8), (i3 |= s4); + } + } + if (1 !== e3.final.length) + throw new Error("final must be a single byte"); + const s3 = e3.final.charCodeAt(0); + if (t3[0] > s3 || s3 > t3[1]) + throw new Error( + `final must be in range ${t3[0]} .. ${t3[1]}` + ); + return (i3 <<= 8), (i3 |= s3), i3; + } + identToString(e3) { + const t3 = []; + for (; e3; ) + t3.push(String.fromCharCode(255 & e3)), (e3 >>= 8); + return t3.reverse().join(""); + } + setPrintHandler(e3) { + this._printHandler = e3; + } + clearPrintHandler() { + this._printHandler = this._printHandlerFb; + } + registerEscHandler(e3, t3) { + const i3 = this._identifier(e3, [48, 126]); + void 0 === this._escHandlers[i3] && + (this._escHandlers[i3] = []); + const s3 = this._escHandlers[i3]; + return ( + s3.push(t3), + { + dispose: () => { + const e4 = s3.indexOf(t3); + -1 !== e4 && s3.splice(e4, 1); + }, + } + ); + } + clearEscHandler(e3) { + this._escHandlers[this._identifier(e3, [48, 126])] && + delete this._escHandlers[ + this._identifier(e3, [48, 126]) + ]; + } + setEscHandlerFallback(e3) { + this._escHandlerFb = e3; + } + setExecuteHandler(e3, t3) { + this._executeHandlers[e3.charCodeAt(0)] = t3; + } + clearExecuteHandler(e3) { + this._executeHandlers[e3.charCodeAt(0)] && + delete this._executeHandlers[e3.charCodeAt(0)]; + } + setExecuteHandlerFallback(e3) { + this._executeHandlerFb = e3; + } + registerCsiHandler(e3, t3) { + const i3 = this._identifier(e3); + void 0 === this._csiHandlers[i3] && + (this._csiHandlers[i3] = []); + const s3 = this._csiHandlers[i3]; + return ( + s3.push(t3), + { + dispose: () => { + const e4 = s3.indexOf(t3); + -1 !== e4 && s3.splice(e4, 1); + }, + } + ); + } + clearCsiHandler(e3) { + this._csiHandlers[this._identifier(e3)] && + delete this._csiHandlers[this._identifier(e3)]; + } + setCsiHandlerFallback(e3) { + this._csiHandlerFb = e3; + } + registerDcsHandler(e3, t3) { + return this._dcsParser.registerHandler( + this._identifier(e3), + t3 + ); + } + clearDcsHandler(e3) { + this._dcsParser.clearHandler(this._identifier(e3)); + } + setDcsHandlerFallback(e3) { + this._dcsParser.setHandlerFallback(e3); + } + registerOscHandler(e3, t3) { + return this._oscParser.registerHandler(e3, t3); + } + clearOscHandler(e3) { + this._oscParser.clearHandler(e3); + } + setOscHandlerFallback(e3) { + this._oscParser.setHandlerFallback(e3); + } + setErrorHandler(e3) { + this._errorHandler = e3; + } + clearErrorHandler() { + this._errorHandler = this._errorHandlerFb; + } + reset() { + (this.currentState = this.initialState), + this._oscParser.reset(), + this._dcsParser.reset(), + this._params.reset(), + this._params.addParam(0), + (this._collect = 0), + (this.precedingJoinState = 0), + 0 !== this._parseStack.state && + ((this._parseStack.state = 2), + (this._parseStack.handlers = [])); + } + _preserveStack(e3, t3, i3, s3, r2) { + (this._parseStack.state = e3), + (this._parseStack.handlers = t3), + (this._parseStack.handlerPos = i3), + (this._parseStack.transition = s3), + (this._parseStack.chunkPos = r2); + } + parse(e3, t3, i3) { + let s3, + r2 = 0, + n2 = 0, + o2 = 0; + if (this._parseStack.state) + if (2 === this._parseStack.state) + (this._parseStack.state = 0), + (o2 = this._parseStack.chunkPos + 1); + else { + if (void 0 === i3 || 1 === this._parseStack.state) + throw ( + ((this._parseStack.state = 1), + new Error( + "improper continuation due to previous async handler, giving up parsing" + )) + ); + const t4 = this._parseStack.handlers; + let n3 = this._parseStack.handlerPos - 1; + switch (this._parseStack.state) { + case 3: + if (false === i3 && n3 > -1) { + for ( + ; + n3 >= 0 && + ((s3 = t4[n3](this._params)), true !== s3); + n3-- + ) + if (s3 instanceof Promise) + return ( + (this._parseStack.handlerPos = n3), s3 + ); + } + this._parseStack.handlers = []; + break; + case 4: + if (false === i3 && n3 > -1) { + for ( + ; + n3 >= 0 && ((s3 = t4[n3]()), true !== s3); + n3-- + ) + if (s3 instanceof Promise) + return ( + (this._parseStack.handlerPos = n3), s3 + ); + } + this._parseStack.handlers = []; + break; + case 6: + if ( + ((r2 = e3[this._parseStack.chunkPos]), + (s3 = this._dcsParser.unhook( + 24 !== r2 && 26 !== r2, + i3 + )), + s3) + ) + return s3; + 27 === r2 && (this._parseStack.transition |= 1), + this._params.reset(), + this._params.addParam(0), + (this._collect = 0); + break; + case 5: + if ( + ((r2 = e3[this._parseStack.chunkPos]), + (s3 = this._oscParser.end( + 24 !== r2 && 26 !== r2, + i3 + )), + s3) + ) + return s3; + 27 === r2 && (this._parseStack.transition |= 1), + this._params.reset(), + this._params.addParam(0), + (this._collect = 0); + } + (this._parseStack.state = 0), + (o2 = this._parseStack.chunkPos + 1), + (this.precedingJoinState = 0), + (this.currentState = + 15 & this._parseStack.transition); + } + for (let i4 = o2; i4 < t3; ++i4) { + switch ( + ((r2 = e3[i4]), + (n2 = + this._transitions.table[ + (this.currentState << 8) | (r2 < 160 ? r2 : h) + ]), + n2 >> 4) + ) { + case 2: + for (let s4 = i4 + 1; ; ++s4) { + if ( + s4 >= t3 || + (r2 = e3[s4]) < 32 || + (r2 > 126 && r2 < h) + ) { + this._printHandler(e3, i4, s4), (i4 = s4 - 1); + break; + } + if ( + ++s4 >= t3 || + (r2 = e3[s4]) < 32 || + (r2 > 126 && r2 < h) + ) { + this._printHandler(e3, i4, s4), (i4 = s4 - 1); + break; + } + if ( + ++s4 >= t3 || + (r2 = e3[s4]) < 32 || + (r2 > 126 && r2 < h) + ) { + this._printHandler(e3, i4, s4), (i4 = s4 - 1); + break; + } + if ( + ++s4 >= t3 || + (r2 = e3[s4]) < 32 || + (r2 > 126 && r2 < h) + ) { + this._printHandler(e3, i4, s4), (i4 = s4 - 1); + break; + } + } + break; + case 3: + this._executeHandlers[r2] + ? this._executeHandlers[r2]() + : this._executeHandlerFb(r2), + (this.precedingJoinState = 0); + break; + case 0: + break; + case 1: + if ( + this._errorHandler({ + position: i4, + code: r2, + currentState: this.currentState, + collect: this._collect, + params: this._params, + abort: false, + }).abort + ) + return; + break; + case 7: + const o3 = + this._csiHandlers[(this._collect << 8) | r2]; + let a2 = o3 ? o3.length - 1 : -1; + for ( + ; + a2 >= 0 && + ((s3 = o3[a2](this._params)), true !== s3); + a2-- + ) + if (s3 instanceof Promise) + return ( + this._preserveStack(3, o3, a2, n2, i4), s3 + ); + a2 < 0 && + this._csiHandlerFb( + (this._collect << 8) | r2, + this._params + ), + (this.precedingJoinState = 0); + break; + case 8: + do { + switch (r2) { + case 59: + this._params.addParam(0); + break; + case 58: + this._params.addSubParam(-1); + break; + default: + this._params.addDigit(r2 - 48); + } + } while ( + ++i4 < t3 && + (r2 = e3[i4]) > 47 && + r2 < 60 + ); + i4--; + break; + case 9: + (this._collect <<= 8), (this._collect |= r2); + break; + case 10: + const c2 = + this._escHandlers[(this._collect << 8) | r2]; + let l = c2 ? c2.length - 1 : -1; + for (; l >= 0 && ((s3 = c2[l]()), true !== s3); l--) + if (s3 instanceof Promise) + return ( + this._preserveStack(4, c2, l, n2, i4), s3 + ); + l < 0 && + this._escHandlerFb((this._collect << 8) | r2), + (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) | r2, + this._params + ); + break; + case 13: + for (let s4 = i4 + 1; ; ++s4) + if ( + s4 >= t3 || + 24 === (r2 = e3[s4]) || + 26 === r2 || + 27 === r2 || + (r2 > 127 && r2 < h) + ) { + this._dcsParser.put(e3, i4, s4), (i4 = s4 - 1); + break; + } + break; + case 14: + if ( + ((s3 = this._dcsParser.unhook( + 24 !== r2 && 26 !== r2 + )), + s3) + ) + return this._preserveStack(6, [], 0, n2, i4), s3; + 27 === r2 && (n2 |= 1), + this._params.reset(), + this._params.addParam(0), + (this._collect = 0), + (this.precedingJoinState = 0); + break; + case 4: + this._oscParser.start(); + break; + case 5: + for (let s4 = i4 + 1; ; s4++) + if ( + s4 >= t3 || + (r2 = e3[s4]) < 32 || + (r2 > 127 && r2 < h) + ) { + this._oscParser.put(e3, i4, s4), (i4 = s4 - 1); + break; + } + break; + case 6: + if ( + ((s3 = this._oscParser.end( + 24 !== r2 && 26 !== r2 + )), + s3) + ) + return this._preserveStack(5, [], 0, n2, i4), s3; + 27 === r2 && (n2 |= 1), + this._params.reset(), + this._params.addParam(0), + (this._collect = 0), + (this.precedingJoinState = 0); + } + this.currentState = 15 & n2; + } + } + } + t2.EscapeSequenceParser = c; + }, + 6242: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.OscHandler = t2.OscParser = void 0); + const s2 = i2(5770), + r = i2(482), + n = []; + (t2.OscParser = class { + constructor() { + (this._state = 0), + (this._active = n), + (this._id = -1), + (this._handlers = /* @__PURE__ */ Object.create(null)), + (this._handlerFb = () => {}), + (this._stack = { + paused: false, + loopPosition: 0, + fallThrough: false, + }); + } + registerHandler(e3, t3) { + void 0 === this._handlers[e3] && + (this._handlers[e3] = []); + const i3 = this._handlers[e3]; + return ( + i3.push(t3), + { + dispose: () => { + const e4 = i3.indexOf(t3); + -1 !== e4 && i3.splice(e4, 1); + }, + } + ); + } + clearHandler(e3) { + this._handlers[e3] && delete this._handlers[e3]; + } + setHandlerFallback(e3) { + this._handlerFb = e3; + } + dispose() { + (this._handlers = /* @__PURE__ */ Object.create(null)), + (this._handlerFb = () => {}), + (this._active = n); + } + reset() { + if (2 === this._state) + for ( + let e3 = this._stack.paused + ? this._stack.loopPosition - 1 + : this._active.length - 1; + e3 >= 0; + --e3 + ) + this._active[e3].end(false); + (this._stack.paused = false), + (this._active = n), + (this._id = -1), + (this._state = 0); + } + _start() { + if ( + ((this._active = this._handlers[this._id] || n), + this._active.length) + ) + for (let e3 = this._active.length - 1; e3 >= 0; e3--) + this._active[e3].start(); + else this._handlerFb(this._id, "START"); + } + _put(e3, t3, i3) { + if (this._active.length) + for (let s3 = this._active.length - 1; s3 >= 0; s3--) + this._active[s3].put(e3, t3, i3); + else + this._handlerFb( + this._id, + "PUT", + (0, r.utf32ToString)(e3, t3, i3) + ); + } + start() { + this.reset(), (this._state = 1); + } + put(e3, t3, i3) { + if (3 !== this._state) { + if (1 === this._state) + for (; t3 < i3; ) { + const i4 = e3[t3++]; + if (59 === i4) { + (this._state = 2), this._start(); + break; + } + if (i4 < 48 || 57 < i4) + return void (this._state = 3); + -1 === this._id && (this._id = 0), + (this._id = 10 * this._id + i4 - 48); + } + 2 === this._state && + i3 - t3 > 0 && + this._put(e3, t3, i3); + } + } + end(e3, t3 = true) { + if (0 !== this._state) { + if (3 !== this._state) + if ( + (1 === this._state && this._start(), + this._active.length) + ) { + let i3 = false, + s3 = this._active.length - 1, + r2 = false; + if ( + (this._stack.paused && + ((s3 = this._stack.loopPosition - 1), + (i3 = t3), + (r2 = this._stack.fallThrough), + (this._stack.paused = false)), + !r2 && false === i3) + ) { + for ( + ; + s3 >= 0 && + ((i3 = this._active[s3].end(e3)), true !== i3); + s3-- + ) + if (i3 instanceof Promise) + return ( + (this._stack.paused = true), + (this._stack.loopPosition = s3), + (this._stack.fallThrough = false), + i3 + ); + s3--; + } + for (; s3 >= 0; s3--) + if ( + ((i3 = this._active[s3].end(false)), + i3 instanceof Promise) + ) + return ( + (this._stack.paused = true), + (this._stack.loopPosition = s3), + (this._stack.fallThrough = true), + i3 + ); + } else this._handlerFb(this._id, "END", e3); + (this._active = n), (this._id = -1), (this._state = 0); + } + } + }), + (t2.OscHandler = class { + constructor(e3) { + (this._handler = e3), + (this._data = ""), + (this._hitLimit = false); + } + start() { + (this._data = ""), (this._hitLimit = false); + } + put(e3, t3, i3) { + this._hitLimit || + ((this._data += (0, r.utf32ToString)(e3, t3, i3)), + this._data.length > s2.PAYLOAD_LIMIT && + ((this._data = ""), (this._hitLimit = true))); + } + end(e3) { + let t3 = false; + if (this._hitLimit) t3 = false; + else if ( + e3 && + ((t3 = this._handler(this._data)), + t3 instanceof Promise) + ) + return t3.then( + (e4) => ( + (this._data = ""), (this._hitLimit = false), e4 + ) + ); + return (this._data = ""), (this._hitLimit = false), t3; + } + }); + }, + 8742: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Params = void 0); + const i2 = 2147483647; + class s2 { + static fromArray(e3) { + const t3 = new s2(); + if (!e3.length) return t3; + for ( + let i3 = Array.isArray(e3[0]) ? 1 : 0; + i3 < e3.length; + ++i3 + ) { + const s3 = e3[i3]; + if (Array.isArray(s3)) + for (let e4 = 0; e4 < s3.length; ++e4) + t3.addSubParam(s3[e4]); + else t3.addParam(s3); + } + return t3; + } + constructor(e3 = 32, t3 = 32) { + if ( + ((this.maxLength = e3), + (this.maxSubParamsLength = t3), + t3 > 256) + ) + throw new Error( + "maxSubParamsLength must not be greater than 256" + ); + (this.params = new Int32Array(e3)), + (this.length = 0), + (this._subParams = new Int32Array(t3)), + (this._subParamsLength = 0), + (this._subParamsIdx = new Uint16Array(e3)), + (this._rejectDigits = false), + (this._rejectSubDigits = false), + (this._digitIsSub = false); + } + clone() { + const e3 = new s2( + this.maxLength, + this.maxSubParamsLength + ); + return ( + e3.params.set(this.params), + (e3.length = this.length), + e3._subParams.set(this._subParams), + (e3._subParamsLength = this._subParamsLength), + e3._subParamsIdx.set(this._subParamsIdx), + (e3._rejectDigits = this._rejectDigits), + (e3._rejectSubDigits = this._rejectSubDigits), + (e3._digitIsSub = this._digitIsSub), + e3 + ); + } + toArray() { + const e3 = []; + for (let t3 = 0; t3 < this.length; ++t3) { + e3.push(this.params[t3]); + const i3 = this._subParamsIdx[t3] >> 8, + s3 = 255 & this._subParamsIdx[t3]; + s3 - i3 > 0 && + e3.push( + Array.prototype.slice.call(this._subParams, i3, s3) + ); + } + return e3; + } + reset() { + (this.length = 0), + (this._subParamsLength = 0), + (this._rejectDigits = false), + (this._rejectSubDigits = false), + (this._digitIsSub = false); + } + addParam(e3) { + if ( + ((this._digitIsSub = false), + this.length >= this.maxLength) + ) + this._rejectDigits = true; + else { + if (e3 < -1) + throw new Error( + "values lesser than -1 are not allowed" + ); + (this._subParamsIdx[this.length] = + (this._subParamsLength << 8) | this._subParamsLength), + (this.params[this.length++] = e3 > i2 ? i2 : e3); + } + } + addSubParam(e3) { + if (((this._digitIsSub = true), this.length)) + if ( + this._rejectDigits || + this._subParamsLength >= this.maxSubParamsLength + ) + this._rejectSubDigits = true; + else { + if (e3 < -1) + throw new Error( + "values lesser than -1 are not allowed" + ); + (this._subParams[this._subParamsLength++] = + e3 > i2 ? i2 : e3), + this._subParamsIdx[this.length - 1]++; + } + } + hasSubParams(e3) { + return ( + (255 & this._subParamsIdx[e3]) - + (this._subParamsIdx[e3] >> 8) > + 0 + ); + } + getSubParams(e3) { + const t3 = this._subParamsIdx[e3] >> 8, + i3 = 255 & this._subParamsIdx[e3]; + return i3 - t3 > 0 + ? this._subParams.subarray(t3, i3) + : null; + } + getSubParamsAll() { + const e3 = {}; + for (let t3 = 0; t3 < this.length; ++t3) { + const i3 = this._subParamsIdx[t3] >> 8, + s3 = 255 & this._subParamsIdx[t3]; + s3 - i3 > 0 && (e3[t3] = this._subParams.slice(i3, s3)); + } + return e3; + } + addDigit(e3) { + let t3; + if ( + this._rejectDigits || + !(t3 = this._digitIsSub + ? this._subParamsLength + : this.length) || + (this._digitIsSub && this._rejectSubDigits) + ) + return; + const s3 = this._digitIsSub + ? this._subParams + : this.params, + r = s3[t3 - 1]; + s3[t3 - 1] = ~r ? Math.min(10 * r + e3, i2) : e3; + } + } + t2.Params = s2; + }, + 5741: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.AddonManager = void 0), + (t2.AddonManager = class { + constructor() { + this._addons = []; + } + dispose() { + for (let e3 = this._addons.length - 1; e3 >= 0; e3--) + this._addons[e3].instance.dispose(); + } + loadAddon(e3, t3) { + const i2 = { + instance: t3, + dispose: t3.dispose, + isDisposed: false, + }; + this._addons.push(i2), + (t3.dispose = () => this._wrappedAddonDispose(i2)), + t3.activate(e3); + } + _wrappedAddonDispose(e3) { + if (e3.isDisposed) return; + let t3 = -1; + for (let i2 = 0; i2 < this._addons.length; i2++) + if (this._addons[i2] === e3) { + t3 = i2; + break; + } + if (-1 === t3) + throw new Error( + "Could not dispose an addon that has not been loaded" + ); + (e3.isDisposed = true), + e3.dispose.apply(e3.instance), + this._addons.splice(t3, 1); + } + }); + }, + 8771: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferApiView = void 0); + const s2 = i2(3785), + r = i2(511); + t2.BufferApiView = class { + constructor(e3, t3) { + (this._buffer = e3), (this.type = t3); + } + init(e3) { + return (this._buffer = e3), 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(e3) { + const t3 = this._buffer.lines.get(e3); + if (t3) return new s2.BufferLineApiView(t3); + } + getNullCell() { + return new r.CellData(); + } + }; + }, + 3785: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferLineApiView = void 0); + const s2 = i2(511); + t2.BufferLineApiView = class { + constructor(e3) { + this._line = e3; + } + get isWrapped() { + return this._line.isWrapped; + } + get length() { + return this._line.length; + } + getCell(e3, t3) { + if (!(e3 < 0 || e3 >= this._line.length)) + return t3 + ? (this._line.loadCell(e3, t3), t3) + : this._line.loadCell(e3, new s2.CellData()); + } + translateToString(e3, t3, i3) { + return this._line.translateToString(e3, t3, i3); + } + }; + }, + 8285: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferNamespaceApi = void 0); + const s2 = i2(8771), + r = i2(8460), + n = i2(844); + class o extends n.Disposable { + constructor(e3) { + super(), + (this._core = e3), + (this._onBufferChange = this.register( + new r.EventEmitter() + )), + (this.onBufferChange = this._onBufferChange.event), + (this._normal = new s2.BufferApiView( + this._core.buffers.normal, + "normal" + )), + (this._alternate = new s2.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); + } + } + t2.BufferNamespaceApi = o; + }, + 7975: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ParserApi = void 0), + (t2.ParserApi = class { + constructor(e3) { + this._core = e3; + } + registerCsiHandler(e3, t3) { + return this._core.registerCsiHandler(e3, (e4) => + t3(e4.toArray()) + ); + } + addCsiHandler(e3, t3) { + return this.registerCsiHandler(e3, t3); + } + registerDcsHandler(e3, t3) { + return this._core.registerDcsHandler(e3, (e4, i2) => + t3(e4, i2.toArray()) + ); + } + addDcsHandler(e3, t3) { + return this.registerDcsHandler(e3, t3); + } + registerEscHandler(e3, t3) { + return this._core.registerEscHandler(e3, t3); + } + addEscHandler(e3, t3) { + return this.registerEscHandler(e3, t3); + } + registerOscHandler(e3, t3) { + return this._core.registerOscHandler(e3, t3); + } + addOscHandler(e3, t3) { + return this.registerOscHandler(e3, t3); + } + }); + }, + 7090: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeApi = void 0), + (t2.UnicodeApi = class { + constructor(e3) { + this._core = e3; + } + register(e3) { + this._core.unicodeService.register(e3); + } + get versions() { + return this._core.unicodeService.versions; + } + get activeVersion() { + return this._core.unicodeService.activeVersion; + } + set activeVersion(e3) { + this._core.unicodeService.activeVersion = e3; + } + }); + }, + 744: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BufferService = + t2.MINIMUM_ROWS = + t2.MINIMUM_COLS = + void 0); + const n = i2(8460), + o = i2(844), + a = i2(5295), + h = i2(2585); + (t2.MINIMUM_COLS = 2), (t2.MINIMUM_ROWS = 1); + let c = (t2.BufferService = class extends o.Disposable { + get buffer() { + return this.buffers.active; + } + constructor(e3) { + super(), + (this.isUserScrolling = false), + (this._onResize = this.register(new n.EventEmitter())), + (this.onResize = this._onResize.event), + (this._onScroll = this.register(new n.EventEmitter())), + (this.onScroll = this._onScroll.event), + (this.cols = Math.max( + e3.rawOptions.cols || 0, + t2.MINIMUM_COLS + )), + (this.rows = Math.max( + e3.rawOptions.rows || 0, + t2.MINIMUM_ROWS + )), + (this.buffers = this.register( + new a.BufferSet(e3, this) + )); + } + resize(e3, t3) { + (this.cols = e3), + (this.rows = t3), + this.buffers.resize(e3, t3), + this._onResize.fire({ cols: e3, rows: t3 }); + } + reset() { + this.buffers.reset(), (this.isUserScrolling = false); + } + scroll(e3, t3 = false) { + const i3 = this.buffer; + let s3; + (s3 = this._cachedBlankLine), + (s3 && + s3.length === this.cols && + s3.getFg(0) === e3.fg && + s3.getBg(0) === e3.bg) || + ((s3 = i3.getBlankLine(e3, t3)), + (this._cachedBlankLine = s3)), + (s3.isWrapped = t3); + const r2 = i3.ybase + i3.scrollTop, + n2 = i3.ybase + i3.scrollBottom; + if (0 === i3.scrollTop) { + const e4 = i3.lines.isFull; + n2 === i3.lines.length - 1 + ? e4 + ? i3.lines.recycle().copyFrom(s3) + : i3.lines.push(s3.clone()) + : i3.lines.splice(n2 + 1, 0, s3.clone()), + e4 + ? this.isUserScrolling && + (i3.ydisp = Math.max(i3.ydisp - 1, 0)) + : (i3.ybase++, this.isUserScrolling || i3.ydisp++); + } else { + const e4 = n2 - r2 + 1; + i3.lines.shiftElements(r2 + 1, e4 - 1, -1), + i3.lines.set(n2, s3.clone()); + } + this.isUserScrolling || (i3.ydisp = i3.ybase), + this._onScroll.fire(i3.ydisp); + } + scrollLines(e3, t3, i3) { + const s3 = this.buffer; + if (e3 < 0) { + if (0 === s3.ydisp) return; + this.isUserScrolling = true; + } else + e3 + s3.ydisp >= s3.ybase && + (this.isUserScrolling = false); + const r2 = s3.ydisp; + (s3.ydisp = Math.max( + Math.min(s3.ydisp + e3, s3.ybase), + 0 + )), + r2 !== s3.ydisp && + (t3 || this._onScroll.fire(s3.ydisp)); + } + }); + t2.BufferService = c = s2([r(0, h.IOptionsService)], c); + }, + 7994: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CharsetService = void 0), + (t2.CharsetService = class { + constructor() { + (this.glevel = 0), (this._charsets = []); + } + reset() { + (this.charset = void 0), + (this._charsets = []), + (this.glevel = 0); + } + setgLevel(e3) { + (this.glevel = e3), (this.charset = this._charsets[e3]); + } + setgCharset(e3, t3) { + (this._charsets[e3] = t3), + this.glevel === e3 && (this.charset = t3); + } + }); + }, + 1753: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CoreMouseService = void 0); + const n = i2(2585), + o = i2(8460), + a = i2(844), + h = { + NONE: { events: 0, restrict: () => false }, + X10: { + events: 1, + restrict: (e3) => + 4 !== e3.button && + 1 === e3.action && + ((e3.ctrl = false), + (e3.alt = false), + (e3.shift = false), + true), + }, + VT200: { events: 19, restrict: (e3) => 32 !== e3.action }, + DRAG: { + events: 23, + restrict: (e3) => 32 !== e3.action || 3 !== e3.button, + }, + ANY: { events: 31, restrict: (e3) => true }, + }; + function c(e3, t3) { + let i3 = + (e3.ctrl ? 16 : 0) | + (e3.shift ? 4 : 0) | + (e3.alt ? 8 : 0); + return ( + 4 === e3.button + ? ((i3 |= 64), (i3 |= e3.action)) + : ((i3 |= 3 & e3.button), + 4 & e3.button && (i3 |= 64), + 8 & e3.button && (i3 |= 128), + 32 === e3.action + ? (i3 |= 32) + : 0 !== e3.action || t3 || (i3 |= 3)), + i3 + ); + } + const l = String.fromCharCode, + d = { + DEFAULT: (e3) => { + const t3 = [ + c(e3, false) + 32, + e3.col + 32, + e3.row + 32, + ]; + return t3[0] > 255 || t3[1] > 255 || t3[2] > 255 + ? "" + : `\x1B[M${l(t3[0])}${l(t3[1])}${l(t3[2])}`; + }, + SGR: (e3) => { + const t3 = + 0 === e3.action && 4 !== e3.button ? "m" : "M"; + return `\x1B[<${c(e3, true)};${e3.col};${e3.row}${t3}`; + }, + SGR_PIXELS: (e3) => { + const t3 = + 0 === e3.action && 4 !== e3.button ? "m" : "M"; + return `\x1B[<${c(e3, true)};${e3.x};${e3.y}${t3}`; + }, + }; + let _ = (t2.CoreMouseService = class extends a.Disposable { + constructor(e3, t3) { + super(), + (this._bufferService = e3), + (this._coreService = t3), + (this._protocols = {}), + (this._encodings = {}), + (this._activeProtocol = ""), + (this._activeEncoding = ""), + (this._lastEvent = null), + (this._onProtocolChange = this.register( + new o.EventEmitter() + )), + (this.onProtocolChange = this._onProtocolChange.event); + for (const e4 of Object.keys(h)) + this.addProtocol(e4, h[e4]); + for (const e4 of Object.keys(d)) + this.addEncoding(e4, d[e4]); + this.reset(); + } + addProtocol(e3, t3) { + this._protocols[e3] = t3; + } + addEncoding(e3, t3) { + this._encodings[e3] = t3; + } + get activeProtocol() { + return this._activeProtocol; + } + get areMouseEventsActive() { + return 0 !== this._protocols[this._activeProtocol].events; + } + set activeProtocol(e3) { + if (!this._protocols[e3]) + throw new Error(`unknown protocol "${e3}"`); + (this._activeProtocol = e3), + this._onProtocolChange.fire(this._protocols[e3].events); + } + get activeEncoding() { + return this._activeEncoding; + } + set activeEncoding(e3) { + if (!this._encodings[e3]) + throw new Error(`unknown encoding "${e3}"`); + this._activeEncoding = e3; + } + reset() { + (this.activeProtocol = "NONE"), + (this.activeEncoding = "DEFAULT"), + (this._lastEvent = null); + } + triggerMouseEvent(e3) { + if ( + e3.col < 0 || + e3.col >= this._bufferService.cols || + e3.row < 0 || + e3.row >= this._bufferService.rows + ) + return false; + if (4 === e3.button && 32 === e3.action) return false; + if (3 === e3.button && 32 !== e3.action) return false; + if ( + 4 !== e3.button && + (2 === e3.action || 3 === e3.action) + ) + return false; + if ( + (e3.col++, + e3.row++, + 32 === e3.action && + this._lastEvent && + this._equalEvents( + this._lastEvent, + e3, + "SGR_PIXELS" === this._activeEncoding + )) + ) + return false; + if (!this._protocols[this._activeProtocol].restrict(e3)) + return false; + const t3 = this._encodings[this._activeEncoding](e3); + return ( + t3 && + ("DEFAULT" === this._activeEncoding + ? this._coreService.triggerBinaryEvent(t3) + : this._coreService.triggerDataEvent(t3, true)), + (this._lastEvent = e3), + true + ); + } + explainEvents(e3) { + return { + down: !!(1 & e3), + up: !!(2 & e3), + drag: !!(4 & e3), + move: !!(8 & e3), + wheel: !!(16 & e3), + }; + } + _equalEvents(e3, t3, i3) { + if (i3) { + if (e3.x !== t3.x) return false; + if (e3.y !== t3.y) return false; + } else { + if (e3.col !== t3.col) return false; + if (e3.row !== t3.row) return false; + } + return ( + e3.button === t3.button && + e3.action === t3.action && + e3.ctrl === t3.ctrl && + e3.alt === t3.alt && + e3.shift === t3.shift + ); + } + }); + t2.CoreMouseService = _ = s2( + [r(0, n.IBufferService), r(1, n.ICoreService)], + _ + ); + }, + 6975: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CoreService = void 0); + const n = i2(1439), + o = i2(8460), + a = i2(844), + h = i2(2585), + c = Object.freeze({ insertMode: false }), + l = Object.freeze({ + applicationCursorKeys: false, + applicationKeypad: false, + bracketedPasteMode: false, + origin: false, + reverseWraparound: false, + sendFocus: false, + wraparound: true, + }); + let d = (t2.CoreService = class extends a.Disposable { + constructor(e3, t3, i3) { + super(), + (this._bufferService = e3), + (this._logService = t3), + (this._optionsService = i3), + (this.isCursorInitialized = false), + (this.isCursorHidden = false), + (this._onData = this.register(new o.EventEmitter())), + (this.onData = this._onData.event), + (this._onUserInput = this.register( + new o.EventEmitter() + )), + (this.onUserInput = this._onUserInput.event), + (this._onBinary = this.register(new o.EventEmitter())), + (this.onBinary = this._onBinary.event), + (this._onRequestScrollToBottom = this.register( + new o.EventEmitter() + )), + (this.onRequestScrollToBottom = + this._onRequestScrollToBottom.event), + (this.modes = (0, n.clone)(c)), + (this.decPrivateModes = (0, n.clone)(l)); + } + reset() { + (this.modes = (0, n.clone)(c)), + (this.decPrivateModes = (0, n.clone)(l)); + } + triggerDataEvent(e3, t3 = false) { + if (this._optionsService.rawOptions.disableStdin) return; + const i3 = this._bufferService.buffer; + t3 && + this._optionsService.rawOptions.scrollOnUserInput && + i3.ybase !== i3.ydisp && + this._onRequestScrollToBottom.fire(), + t3 && this._onUserInput.fire(), + this._logService.debug(`sending data "${e3}"`, () => + e3.split("").map((e4) => e4.charCodeAt(0)) + ), + this._onData.fire(e3); + } + triggerBinaryEvent(e3) { + this._optionsService.rawOptions.disableStdin || + (this._logService.debug(`sending binary "${e3}"`, () => + e3.split("").map((e4) => e4.charCodeAt(0)) + ), + this._onBinary.fire(e3)); + } + }); + t2.CoreService = d = s2( + [ + r(0, h.IBufferService), + r(1, h.ILogService), + r(2, h.IOptionsService), + ], + d + ); + }, + 9074: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DecorationService = void 0); + const s2 = i2(8055), + r = i2(8460), + n = i2(844), + o = i2(6106); + let a = 0, + h = 0; + class c extends n.Disposable { + get decorations() { + return this._decorations.values(); + } + constructor() { + super(), + (this._decorations = new o.SortedList( + (e3) => e3?.marker.line + )), + (this._onDecorationRegistered = this.register( + new r.EventEmitter() + )), + (this.onDecorationRegistered = + this._onDecorationRegistered.event), + (this._onDecorationRemoved = this.register( + new r.EventEmitter() + )), + (this.onDecorationRemoved = + this._onDecorationRemoved.event), + this.register((0, n.toDisposable)(() => this.reset())); + } + registerDecoration(e3) { + if (e3.marker.isDisposed) return; + const t3 = new l(e3); + if (t3) { + const e4 = t3.marker.onDispose(() => t3.dispose()); + t3.onDispose(() => { + t3 && + (this._decorations.delete(t3) && + this._onDecorationRemoved.fire(t3), + e4.dispose()); + }), + this._decorations.insert(t3), + this._onDecorationRegistered.fire(t3); + } + return t3; + } + reset() { + for (const e3 of this._decorations.values()) e3.dispose(); + this._decorations.clear(); + } + *getDecorationsAtCell(e3, t3, i3) { + let s3 = 0, + r2 = 0; + for (const n2 of this._decorations.getKeyIterator(t3)) + (s3 = n2.options.x ?? 0), + (r2 = s3 + (n2.options.width ?? 1)), + e3 >= s3 && + e3 < r2 && + (!i3 || (n2.options.layer ?? "bottom") === i3) && + (yield n2); + } + forEachDecorationAtCell(e3, t3, i3, s3) { + this._decorations.forEachByKey(t3, (t4) => { + (a = t4.options.x ?? 0), + (h = a + (t4.options.width ?? 1)), + e3 >= a && + e3 < h && + (!i3 || (t4.options.layer ?? "bottom") === i3) && + s3(t4); + }); + } + } + t2.DecorationService = c; + class l extends n.Disposable { + get isDisposed() { + return this._isDisposed; + } + get backgroundColorRGB() { + return ( + null === this._cachedBg && + (this.options.backgroundColor + ? (this._cachedBg = s2.css.toColor( + this.options.backgroundColor + )) + : (this._cachedBg = void 0)), + this._cachedBg + ); + } + get foregroundColorRGB() { + return ( + null === this._cachedFg && + (this.options.foregroundColor + ? (this._cachedFg = s2.css.toColor( + this.options.foregroundColor + )) + : (this._cachedFg = void 0)), + this._cachedFg + ); + } + constructor(e3) { + super(), + (this.options = e3), + (this.onRenderEmitter = this.register( + new r.EventEmitter() + )), + (this.onRender = this.onRenderEmitter.event), + (this._onDispose = this.register(new r.EventEmitter())), + (this.onDispose = this._onDispose.event), + (this._cachedBg = null), + (this._cachedFg = null), + (this.marker = e3.marker), + this.options.overviewRulerOptions && + !this.options.overviewRulerOptions.position && + (this.options.overviewRulerOptions.position = "full"); + } + dispose() { + this._onDispose.fire(), super.dispose(); + } + } + }, + 4348: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.InstantiationService = t2.ServiceCollection = void 0); + const s2 = i2(2585), + r = i2(8343); + class n { + constructor(...e3) { + this._entries = /* @__PURE__ */ new Map(); + for (const [t3, i3] of e3) this.set(t3, i3); + } + set(e3, t3) { + const i3 = this._entries.get(e3); + return this._entries.set(e3, t3), i3; + } + forEach(e3) { + for (const [t3, i3] of this._entries.entries()) + e3(t3, i3); + } + has(e3) { + return this._entries.has(e3); + } + get(e3) { + return this._entries.get(e3); + } + } + (t2.ServiceCollection = n), + (t2.InstantiationService = class { + constructor() { + (this._services = new n()), + this._services.set(s2.IInstantiationService, this); + } + setService(e3, t3) { + this._services.set(e3, t3); + } + getService(e3) { + return this._services.get(e3); + } + createInstance(e3, ...t3) { + const i3 = (0, r.getServiceDependencies)(e3).sort( + (e4, t4) => e4.index - t4.index + ), + s3 = []; + for (const t4 of i3) { + const i4 = this._services.get(t4.id); + if (!i4) + throw new Error( + `[createInstance] ${e3.name} depends on UNKNOWN service ${t4.id}.` + ); + s3.push(i4); + } + const n2 = i3.length > 0 ? i3[0].index : t3.length; + if (t3.length !== n2) + throw new Error( + `[createInstance] First service dependency of ${e3.name} at position ${n2 + 1} conflicts with ${t3.length} static arguments` + ); + return new e3(...[...t3, ...s3]); + } + }); + }, + 7866: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.traceCall = t2.setTraceLogger = t2.LogService = void 0); + const n = i2(844), + o = i2(2585), + 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 h, + c = (t2.LogService = class extends n.Disposable { + get logLevel() { + return this._logLevel; + } + constructor(e3) { + super(), + (this._optionsService = e3), + (this._logLevel = o.LogLevelEnum.OFF), + this._updateLogLevel(), + this.register( + this._optionsService.onSpecificOptionChange( + "logLevel", + () => this._updateLogLevel() + ) + ), + (h = this); + } + _updateLogLevel() { + this._logLevel = + a[this._optionsService.rawOptions.logLevel]; + } + _evalLazyOptionalParams(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + "function" == typeof e3[t3] && (e3[t3] = e3[t3]()); + } + _log(e3, t3, i3) { + this._evalLazyOptionalParams(i3), + e3.call( + console, + (this._optionsService.options.logger + ? "" + : "xterm.js: ") + t3, + ...i3 + ); + } + trace(e3, ...t3) { + this._logLevel <= o.LogLevelEnum.TRACE && + this._log( + this._optionsService.options.logger?.trace.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + debug(e3, ...t3) { + this._logLevel <= o.LogLevelEnum.DEBUG && + this._log( + this._optionsService.options.logger?.debug.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + info(e3, ...t3) { + this._logLevel <= o.LogLevelEnum.INFO && + this._log( + this._optionsService.options.logger?.info.bind( + this._optionsService.options.logger + ) ?? console.info, + e3, + t3 + ); + } + warn(e3, ...t3) { + this._logLevel <= o.LogLevelEnum.WARN && + this._log( + this._optionsService.options.logger?.warn.bind( + this._optionsService.options.logger + ) ?? console.warn, + e3, + t3 + ); + } + error(e3, ...t3) { + this._logLevel <= o.LogLevelEnum.ERROR && + this._log( + this._optionsService.options.logger?.error.bind( + this._optionsService.options.logger + ) ?? console.error, + e3, + t3 + ); + } + }); + (t2.LogService = c = s2([r(0, o.IOptionsService)], c)), + (t2.setTraceLogger = function (e3) { + h = e3; + }), + (t2.traceCall = function (e3, t3, i3) { + if ("function" != typeof i3.value) + throw new Error("not supported"); + const s3 = i3.value; + i3.value = function (...e4) { + if (h.logLevel !== o.LogLevelEnum.TRACE) + return s3.apply(this, e4); + h.trace( + `GlyphRenderer#${s3.name}(${e4.map((e5) => JSON.stringify(e5)).join(", ")})` + ); + const t4 = s3.apply(this, e4); + return ( + h.trace(`GlyphRenderer#${s3.name} return`, t4), t4 + ); + }; + }); + }, + 7302: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.OptionsService = t2.DEFAULT_OPTIONS = void 0); + const s2 = i2(8460), + r = i2(844), + n = i2(6114); + t2.DEFAULT_OPTIONS = { + cols: 80, + rows: 24, + cursorBlink: false, + cursorStyle: "block", + cursorWidth: 1, + cursorInactiveStyle: "outline", + customGlyphs: true, + drawBoldTextInBrightColors: true, + documentOverride: null, + fastScrollModifier: "alt", + fastScrollSensitivity: 5, + fontFamily: "courier-new, courier, monospace", + fontSize: 15, + fontWeight: "normal", + fontWeightBold: "bold", + ignoreBracketedPasteMode: false, + lineHeight: 1, + letterSpacing: 0, + linkHandler: null, + logLevel: "info", + logger: null, + scrollback: 1e3, + scrollOnUserInput: true, + scrollSensitivity: 1, + screenReaderMode: false, + smoothScrollDuration: 0, + macOptionIsMeta: false, + macOptionClickForcesSelection: false, + minimumContrastRatio: 1, + disableStdin: false, + allowProposedApi: false, + allowTransparency: false, + tabStopWidth: 8, + theme: {}, + rescaleOverlappingGlyphs: false, + rightClickSelectsWord: n.isMac, + windowOptions: {}, + windowsMode: false, + windowsPty: {}, + wordSeparator: " ()[]{}',\"`", + altClickMovesCursor: true, + convertEol: false, + termName: "xterm", + cancelEvents: false, + overviewRulerWidth: 0, + }; + const o = [ + "normal", + "bold", + "100", + "200", + "300", + "400", + "500", + "600", + "700", + "800", + "900", + ]; + class a extends r.Disposable { + constructor(e3) { + super(), + (this._onOptionChange = this.register( + new s2.EventEmitter() + )), + (this.onOptionChange = this._onOptionChange.event); + const i3 = { ...t2.DEFAULT_OPTIONS }; + for (const t3 in e3) + if (t3 in i3) + try { + const s3 = e3[t3]; + i3[t3] = this._sanitizeAndValidateOption(t3, s3); + } catch (e4) { + console.error(e4); + } + (this.rawOptions = i3), + (this.options = { ...i3 }), + this._setupOptions(), + this.register( + (0, r.toDisposable)(() => { + (this.rawOptions.linkHandler = null), + (this.rawOptions.documentOverride = null); + }) + ); + } + onSpecificOptionChange(e3, t3) { + return this.onOptionChange((i3) => { + i3 === e3 && t3(this.rawOptions[e3]); + }); + } + onMultipleOptionChange(e3, t3) { + return this.onOptionChange((i3) => { + -1 !== e3.indexOf(i3) && t3(); + }); + } + _setupOptions() { + const e3 = (e4) => { + if (!(e4 in t2.DEFAULT_OPTIONS)) + throw new Error(`No option with key "${e4}"`); + return this.rawOptions[e4]; + }, + i3 = (e4, i4) => { + if (!(e4 in t2.DEFAULT_OPTIONS)) + throw new Error(`No option with key "${e4}"`); + (i4 = this._sanitizeAndValidateOption(e4, i4)), + this.rawOptions[e4] !== i4 && + ((this.rawOptions[e4] = i4), + this._onOptionChange.fire(e4)); + }; + for (const t3 in this.rawOptions) { + const s3 = { + get: e3.bind(this, t3), + set: i3.bind(this, t3), + }; + Object.defineProperty(this.options, t3, s3); + } + } + _sanitizeAndValidateOption(e3, i3) { + switch (e3) { + case "cursorStyle": + if ( + (i3 || (i3 = t2.DEFAULT_OPTIONS[e3]), + !( + /* @__PURE__ */ (function (e4) { + return ( + "block" === e4 || + "underline" === e4 || + "bar" === e4 + ); + })(i3) + )) + ) + throw new Error( + `"${i3}" is not a valid value for ${e3}` + ); + break; + case "wordSeparator": + i3 || (i3 = t2.DEFAULT_OPTIONS[e3]); + break; + case "fontWeight": + case "fontWeightBold": + if ("number" == typeof i3 && 1 <= i3 && i3 <= 1e3) + break; + i3 = o.includes(i3) ? i3 : t2.DEFAULT_OPTIONS[e3]; + break; + case "cursorWidth": + i3 = Math.floor(i3); + case "lineHeight": + case "tabStopWidth": + if (i3 < 1) + throw new Error( + `${e3} cannot be less than 1, value: ${i3}` + ); + break; + case "minimumContrastRatio": + i3 = Math.max( + 1, + Math.min(21, Math.round(10 * i3) / 10) + ); + break; + case "scrollback": + if ((i3 = Math.min(i3, 4294967295)) < 0) + throw new Error( + `${e3} cannot be less than 0, value: ${i3}` + ); + break; + case "fastScrollSensitivity": + case "scrollSensitivity": + if (i3 <= 0) + throw new Error( + `${e3} cannot be less than or equal to 0, value: ${i3}` + ); + break; + case "rows": + case "cols": + if (!i3 && 0 !== i3) + throw new Error( + `${e3} must be numeric, value: ${i3}` + ); + break; + case "windowsPty": + i3 = i3 ?? {}; + } + return i3; + } + } + t2.OptionsService = a; + }, + 2660: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + n2 = arguments.length, + o2 = + n2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + o2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a = e3.length - 1; a >= 0; a--) + (r2 = e3[a]) && + (o2 = + (n2 < 3 + ? r2(o2) + : n2 > 3 + ? r2(t3, i3, o2) + : r2(t3, i3)) || o2); + return ( + n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.OscLinkService = void 0); + const n = i2(2585); + let o = (t2.OscLinkService = class { + constructor(e3) { + (this._bufferService = e3), + (this._nextId = 1), + (this._entriesWithId = /* @__PURE__ */ new Map()), + (this._dataByLinkId = /* @__PURE__ */ new Map()); + } + registerLink(e3) { + const t3 = this._bufferService.buffer; + if (void 0 === e3.id) { + const i4 = t3.addMarker(t3.ybase + t3.y), + s4 = { data: e3, id: this._nextId++, lines: [i4] }; + return ( + i4.onDispose(() => + this._removeMarkerFromLink(s4, i4) + ), + this._dataByLinkId.set(s4.id, s4), + s4.id + ); + } + const i3 = e3, + s3 = this._getEntryIdKey(i3), + r2 = this._entriesWithId.get(s3); + if (r2) + return ( + this.addLineToLink(r2.id, t3.ybase + t3.y), r2.id + ); + const n2 = t3.addMarker(t3.ybase + t3.y), + o2 = { + id: this._nextId++, + key: this._getEntryIdKey(i3), + data: i3, + lines: [n2], + }; + return ( + n2.onDispose(() => this._removeMarkerFromLink(o2, n2)), + this._entriesWithId.set(o2.key, o2), + this._dataByLinkId.set(o2.id, o2), + o2.id + ); + } + addLineToLink(e3, t3) { + const i3 = this._dataByLinkId.get(e3); + if (i3 && i3.lines.every((e4) => e4.line !== t3)) { + const e4 = this._bufferService.buffer.addMarker(t3); + i3.lines.push(e4), + e4.onDispose(() => + this._removeMarkerFromLink(i3, e4) + ); + } + } + getLinkData(e3) { + return this._dataByLinkId.get(e3)?.data; + } + _getEntryIdKey(e3) { + return `${e3.id};;${e3.uri}`; + } + _removeMarkerFromLink(e3, t3) { + const i3 = e3.lines.indexOf(t3); + -1 !== i3 && + (e3.lines.splice(i3, 1), + 0 === e3.lines.length && + (void 0 !== e3.data.id && + this._entriesWithId.delete(e3.key), + this._dataByLinkId.delete(e3.id))); + } + }); + t2.OscLinkService = o = s2([r(0, n.IBufferService)], o); + }, + 8343: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createDecorator = + t2.getServiceDependencies = + t2.serviceRegistry = + void 0); + const i2 = "di$target", + s2 = "di$dependencies"; + (t2.serviceRegistry = /* @__PURE__ */ new Map()), + (t2.getServiceDependencies = function (e3) { + return e3[s2] || []; + }), + (t2.createDecorator = function (e3) { + if (t2.serviceRegistry.has(e3)) + return t2.serviceRegistry.get(e3); + const r = function (e4, t3, n) { + if (3 !== arguments.length) + throw new Error( + "@IServiceName-decorator can only be used to decorate a parameter" + ); + !(function (e5, t4, r2) { + t4[i2] === t4 + ? t4[s2].push({ id: e5, index: r2 }) + : ((t4[s2] = [{ id: e5, index: r2 }]), + (t4[i2] = t4)); + })(r, e4, n); + }; + return ( + (r.toString = () => e3), + t2.serviceRegistry.set(e3, r), + r + ); + }); + }, + 2585: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.IDecorationService = + t2.IUnicodeService = + t2.IOscLinkService = + t2.IOptionsService = + t2.ILogService = + t2.LogLevelEnum = + t2.IInstantiationService = + t2.ICharsetService = + t2.ICoreService = + t2.ICoreMouseService = + t2.IBufferService = + void 0); + const s2 = i2(8343); + var r; + (t2.IBufferService = (0, s2.createDecorator)( + "BufferService" + )), + (t2.ICoreMouseService = (0, s2.createDecorator)( + "CoreMouseService" + )), + (t2.ICoreService = (0, s2.createDecorator)("CoreService")), + (t2.ICharsetService = (0, s2.createDecorator)( + "CharsetService" + )), + (t2.IInstantiationService = (0, s2.createDecorator)( + "InstantiationService" + )), + (function (e3) { + (e3[(e3.TRACE = 0)] = "TRACE"), + (e3[(e3.DEBUG = 1)] = "DEBUG"), + (e3[(e3.INFO = 2)] = "INFO"), + (e3[(e3.WARN = 3)] = "WARN"), + (e3[(e3.ERROR = 4)] = "ERROR"), + (e3[(e3.OFF = 5)] = "OFF"); + })(r || (t2.LogLevelEnum = r = {})), + (t2.ILogService = (0, s2.createDecorator)("LogService")), + (t2.IOptionsService = (0, s2.createDecorator)( + "OptionsService" + )), + (t2.IOscLinkService = (0, s2.createDecorator)( + "OscLinkService" + )), + (t2.IUnicodeService = (0, s2.createDecorator)( + "UnicodeService" + )), + (t2.IDecorationService = (0, s2.createDecorator)( + "DecorationService" + )); + }, + 1480: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeService = void 0); + const s2 = i2(8460), + r = i2(225); + class n { + static extractShouldJoin(e3) { + return 0 != (1 & e3); + } + static extractWidth(e3) { + return (e3 >> 1) & 3; + } + static extractCharKind(e3) { + return e3 >> 3; + } + static createPropertyValue(e3, t3, i3 = false) { + return ( + ((16777215 & e3) << 3) | ((3 & t3) << 1) | (i3 ? 1 : 0) + ); + } + constructor() { + (this._providers = /* @__PURE__ */ Object.create(null)), + (this._active = ""), + (this._onChange = new s2.EventEmitter()), + (this.onChange = this._onChange.event); + const e3 = new r.UnicodeV6(); + this.register(e3), + (this._active = e3.version), + (this._activeProvider = e3); + } + dispose() { + this._onChange.dispose(); + } + get versions() { + return Object.keys(this._providers); + } + get activeVersion() { + return this._active; + } + set activeVersion(e3) { + if (!this._providers[e3]) + throw new Error(`unknown Unicode version "${e3}"`); + (this._active = e3), + (this._activeProvider = this._providers[e3]), + this._onChange.fire(e3); + } + register(e3) { + this._providers[e3.version] = e3; + } + wcwidth(e3) { + return this._activeProvider.wcwidth(e3); + } + getStringCellWidth(e3) { + let t3 = 0, + i3 = 0; + const s3 = e3.length; + for (let r2 = 0; r2 < s3; ++r2) { + let o = e3.charCodeAt(r2); + if (55296 <= o && o <= 56319) { + if (++r2 >= s3) return t3 + this.wcwidth(o); + const i4 = e3.charCodeAt(r2); + 56320 <= i4 && i4 <= 57343 + ? (o = 1024 * (o - 55296) + i4 - 56320 + 65536) + : (t3 += this.wcwidth(i4)); + } + const a = this.charProperties(o, i3); + let h = n.extractWidth(a); + n.extractShouldJoin(a) && (h -= n.extractWidth(i3)), + (t3 += h), + (i3 = a); + } + return t3; + } + charProperties(e3, t3) { + return this._activeProvider.charProperties(e3, t3); + } + } + t2.UnicodeService = n; + }, + }, + t = {}; + function i(s2) { + var r = t[s2]; + if (void 0 !== r) return r.exports; + var n = (t[s2] = { exports: {} }); + return e[s2].call(n.exports, n, n.exports, i), n.exports; + } + var s = {}; + return ( + (() => { + var e2 = s; + Object.defineProperty(e2, "__esModule", { value: true }), + (e2.Terminal = void 0); + const t2 = i(9042), + r = i(3236), + n = i(844), + o = i(5741), + a = i(8285), + h = i(7975), + c = i(7090), + l = ["cols", "rows"]; + class d extends n.Disposable { + constructor(e3) { + super(), + (this._core = this.register(new r.Terminal(e3))), + (this._addonManager = this.register( + new o.AddonManager() + )), + (this._publicOptions = { ...this._core.options }); + const t3 = (e4) => this._core.options[e4], + i2 = (e4, t4) => { + this._checkReadonlyOptions(e4), + (this._core.options[e4] = t4); + }; + for (const e4 in this._core.options) { + const s2 = { + get: t3.bind(this, e4), + set: i2.bind(this, e4), + }; + Object.defineProperty(this._publicOptions, e4, s2); + } + } + _checkReadonlyOptions(e3) { + if (l.includes(e3)) + throw new Error( + `Option "${e3}" 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 element() { + return this._core.element; + } + get parser() { + return ( + this._parser || + (this._parser = new h.ParserApi(this._core)), + this._parser + ); + } + get unicode() { + return ( + this._checkProposedApi(), new c.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._buffer = this.register( + new a.BufferNamespaceApi(this._core) + )), + this._buffer + ); + } + get markers() { + return this._checkProposedApi(), this._core.markers; + } + get modes() { + const e3 = this._core.coreService.decPrivateModes; + let t3 = "none"; + switch (this._core.coreMouseService.activeProtocol) { + case "X10": + t3 = "x10"; + break; + case "VT200": + t3 = "vt200"; + break; + case "DRAG": + t3 = "drag"; + break; + case "ANY": + t3 = "any"; + } + return { + applicationCursorKeysMode: e3.applicationCursorKeys, + applicationKeypadMode: e3.applicationKeypad, + bracketedPasteMode: e3.bracketedPasteMode, + insertMode: this._core.coreService.modes.insertMode, + mouseTrackingMode: t3, + originMode: e3.origin, + reverseWraparoundMode: e3.reverseWraparound, + sendFocusMode: e3.sendFocus, + wraparoundMode: e3.wraparound, + }; + } + get options() { + return this._publicOptions; + } + set options(e3) { + for (const t3 in e3) this._publicOptions[t3] = e3[t3]; + } + blur() { + this._core.blur(); + } + focus() { + this._core.focus(); + } + input(e3, t3 = true) { + this._core.input(e3, t3); + } + resize(e3, t3) { + this._verifyIntegers(e3, t3), this._core.resize(e3, t3); + } + open(e3) { + this._core.open(e3); + } + attachCustomKeyEventHandler(e3) { + this._core.attachCustomKeyEventHandler(e3); + } + attachCustomWheelEventHandler(e3) { + this._core.attachCustomWheelEventHandler(e3); + } + registerLinkProvider(e3) { + return this._core.registerLinkProvider(e3); + } + registerCharacterJoiner(e3) { + return ( + this._checkProposedApi(), + this._core.registerCharacterJoiner(e3) + ); + } + deregisterCharacterJoiner(e3) { + this._checkProposedApi(), + this._core.deregisterCharacterJoiner(e3); + } + registerMarker(e3 = 0) { + return ( + this._verifyIntegers(e3), this._core.registerMarker(e3) + ); + } + registerDecoration(e3) { + return ( + this._checkProposedApi(), + this._verifyPositiveIntegers( + e3.x ?? 0, + e3.width ?? 0, + e3.height ?? 0 + ), + this._core.registerDecoration(e3) + ); + } + hasSelection() { + return this._core.hasSelection(); + } + select(e3, t3, i2) { + this._verifyIntegers(e3, t3, i2), + this._core.select(e3, t3, i2); + } + getSelection() { + return this._core.getSelection(); + } + getSelectionPosition() { + return this._core.getSelectionPosition(); + } + clearSelection() { + this._core.clearSelection(); + } + selectAll() { + this._core.selectAll(); + } + selectLines(e3, t3) { + this._verifyIntegers(e3, t3), + this._core.selectLines(e3, t3); + } + dispose() { + super.dispose(); + } + scrollLines(e3) { + this._verifyIntegers(e3), this._core.scrollLines(e3); + } + scrollPages(e3) { + this._verifyIntegers(e3), this._core.scrollPages(e3); + } + scrollToTop() { + this._core.scrollToTop(); + } + scrollToBottom() { + this._core.scrollToBottom(); + } + scrollToLine(e3) { + this._verifyIntegers(e3), this._core.scrollToLine(e3); + } + clear() { + this._core.clear(); + } + write(e3, t3) { + this._core.write(e3, t3); + } + writeln(e3, t3) { + this._core.write(e3), this._core.write("\r\n", t3); + } + paste(e3) { + this._core.paste(e3); + } + refresh(e3, t3) { + this._verifyIntegers(e3, t3), this._core.refresh(e3, t3); + } + reset() { + this._core.reset(); + } + clearTextureAtlas() { + this._core.clearTextureAtlas(); + } + loadAddon(e3) { + this._addonManager.loadAddon(this, e3); + } + static get strings() { + return t2; + } + _verifyIntegers(...e3) { + for (const t3 of e3) + if (t3 === 1 / 0 || isNaN(t3) || t3 % 1 != 0) + throw new Error("This API only accepts integers"); + } + _verifyPositiveIntegers(...e3) { + for (const t3 of e3) + if ( + t3 && + (t3 === 1 / 0 || isNaN(t3) || t3 % 1 != 0 || t3 < 0) + ) + throw new Error( + "This API only accepts positive integers" + ); + } + } + e2.Terminal = d; + })(), + s + ); + })() + ); + }, + }); + + // node_modules/@xterm/addon-webgl/lib/addon-webgl.js + var require_addon_webgl = __commonJS({ + "node_modules/@xterm/addon-webgl/lib/addon-webgl.js"(exports, module) { + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t()) + : "function" == typeof define && define.amd + ? define([], t) + : "object" == typeof exports + ? (exports.WebglAddon = t()) + : (e.WebglAddon = t()); + })(self, () => + (() => { + "use strict"; + var e = { + 965: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.GlyphRenderer = void 0); + const s2 = i2(374), + r = i2(509), + o = i2(855), + n = i2(859), + a = i2(381), + h = 11, + l = h * Float32Array.BYTES_PER_ELEMENT; + let c, + d = 0, + _ = 0, + u = 0; + class g extends n.Disposable { + constructor(e3, t3, i3, o2) { + super(), + (this._terminal = e3), + (this._gl = t3), + (this._dimensions = i3), + (this._optionsService = o2), + (this._activeBuffer = 0), + (this._vertices = { + count: 0, + attributes: new Float32Array(0), + attributesBuffers: [ + new Float32Array(0), + new Float32Array(0), + ], + }); + const h2 = this._gl; + void 0 === r.TextureAtlas.maxAtlasPages && + ((r.TextureAtlas.maxAtlasPages = Math.min( + 32, + (0, s2.throwIfFalsy)( + h2.getParameter(h2.MAX_TEXTURE_IMAGE_UNITS) + ) + )), + (r.TextureAtlas.maxTextureSize = (0, s2.throwIfFalsy)( + h2.getParameter(h2.MAX_TEXTURE_SIZE) + ))), + (this._program = (0, s2.throwIfFalsy)( + (0, a.createProgram)( + h2, + "#version 300 es\nlayout (location = 0) in vec2 a_unitquad;\nlayout (location = 1) in vec2 a_cellpos;\nlayout (location = 2) in vec2 a_offset;\nlayout (location = 3) in vec2 a_size;\nlayout (location = 4) in float a_texpage;\nlayout (location = 5) in vec2 a_texcoord;\nlayout (location = 6) in vec2 a_texsize;\n\nuniform mat4 u_projection;\nuniform vec2 u_resolution;\n\nout vec2 v_texcoord;\nflat out int v_texpage;\n\nvoid main() {\n vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_texpage = int(a_texpage);\n v_texcoord = a_texcoord + a_unitquad * a_texsize;\n}", + (function (e4) { + let t4 = ""; + for (let i4 = 1; i4 < e4; i4++) + t4 += ` else if (v_texpage == ${i4}) { outColor = texture(u_texture[${i4}], v_texcoord); }`; + return `#version 300 es +precision lowp float; + +in vec2 v_texcoord; +flat in int v_texpage; + +uniform sampler2D u_texture[${e4}]; + +out vec4 outColor; + +void main() { + if (v_texpage == 0) { + outColor = texture(u_texture[0], v_texcoord); + } ${t4} +}`; + })(r.TextureAtlas.maxAtlasPages) + ) + )), + this.register( + (0, n.toDisposable)(() => + h2.deleteProgram(this._program) + ) + ), + (this._projectionLocation = (0, s2.throwIfFalsy)( + h2.getUniformLocation(this._program, "u_projection") + )), + (this._resolutionLocation = (0, s2.throwIfFalsy)( + h2.getUniformLocation(this._program, "u_resolution") + )), + (this._textureLocation = (0, s2.throwIfFalsy)( + h2.getUniformLocation(this._program, "u_texture") + )), + (this._vertexArrayObject = h2.createVertexArray()), + h2.bindVertexArray(this._vertexArrayObject); + const c2 = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), + d2 = h2.createBuffer(); + this.register( + (0, n.toDisposable)(() => h2.deleteBuffer(d2)) + ), + h2.bindBuffer(h2.ARRAY_BUFFER, d2), + h2.bufferData(h2.ARRAY_BUFFER, c2, h2.STATIC_DRAW), + h2.enableVertexAttribArray(0), + h2.vertexAttribPointer( + 0, + 2, + this._gl.FLOAT, + false, + 0, + 0 + ); + const _2 = new Uint8Array([0, 1, 2, 3]), + u2 = h2.createBuffer(); + this.register( + (0, n.toDisposable)(() => h2.deleteBuffer(u2)) + ), + h2.bindBuffer(h2.ELEMENT_ARRAY_BUFFER, u2), + h2.bufferData( + h2.ELEMENT_ARRAY_BUFFER, + _2, + h2.STATIC_DRAW + ), + (this._attributesBuffer = (0, s2.throwIfFalsy)( + h2.createBuffer() + )), + this.register( + (0, n.toDisposable)(() => + h2.deleteBuffer(this._attributesBuffer) + ) + ), + h2.bindBuffer(h2.ARRAY_BUFFER, this._attributesBuffer), + h2.enableVertexAttribArray(2), + h2.vertexAttribPointer(2, 2, h2.FLOAT, false, l, 0), + h2.vertexAttribDivisor(2, 1), + h2.enableVertexAttribArray(3), + h2.vertexAttribPointer( + 3, + 2, + h2.FLOAT, + false, + l, + 2 * Float32Array.BYTES_PER_ELEMENT + ), + h2.vertexAttribDivisor(3, 1), + h2.enableVertexAttribArray(4), + h2.vertexAttribPointer( + 4, + 1, + h2.FLOAT, + false, + l, + 4 * Float32Array.BYTES_PER_ELEMENT + ), + h2.vertexAttribDivisor(4, 1), + h2.enableVertexAttribArray(5), + h2.vertexAttribPointer( + 5, + 2, + h2.FLOAT, + false, + l, + 5 * Float32Array.BYTES_PER_ELEMENT + ), + h2.vertexAttribDivisor(5, 1), + h2.enableVertexAttribArray(6), + h2.vertexAttribPointer( + 6, + 2, + h2.FLOAT, + false, + l, + 7 * Float32Array.BYTES_PER_ELEMENT + ), + h2.vertexAttribDivisor(6, 1), + h2.enableVertexAttribArray(1), + h2.vertexAttribPointer( + 1, + 2, + h2.FLOAT, + false, + l, + 9 * Float32Array.BYTES_PER_ELEMENT + ), + h2.vertexAttribDivisor(1, 1), + h2.useProgram(this._program); + const g2 = new Int32Array(r.TextureAtlas.maxAtlasPages); + for (let e4 = 0; e4 < r.TextureAtlas.maxAtlasPages; e4++) + g2[e4] = e4; + h2.uniform1iv(this._textureLocation, g2), + h2.uniformMatrix4fv( + this._projectionLocation, + false, + a.PROJECTION_MATRIX + ), + (this._atlasTextures = []); + for ( + let e4 = 0; + e4 < r.TextureAtlas.maxAtlasPages; + e4++ + ) { + const t4 = new a.GLTexture( + (0, s2.throwIfFalsy)(h2.createTexture()) + ); + this.register( + (0, n.toDisposable)(() => + h2.deleteTexture(t4.texture) + ) + ), + h2.activeTexture(h2.TEXTURE0 + e4), + h2.bindTexture(h2.TEXTURE_2D, t4.texture), + h2.texParameteri( + h2.TEXTURE_2D, + h2.TEXTURE_WRAP_S, + h2.CLAMP_TO_EDGE + ), + h2.texParameteri( + h2.TEXTURE_2D, + h2.TEXTURE_WRAP_T, + h2.CLAMP_TO_EDGE + ), + h2.texImage2D( + h2.TEXTURE_2D, + 0, + h2.RGBA, + 1, + 1, + 0, + h2.RGBA, + h2.UNSIGNED_BYTE, + new Uint8Array([255, 0, 0, 255]) + ), + (this._atlasTextures[e4] = t4); + } + h2.enable(h2.BLEND), + h2.blendFunc(h2.SRC_ALPHA, h2.ONE_MINUS_SRC_ALPHA), + this.handleResize(); + } + beginFrame() { + return !this._atlas || this._atlas.beginFrame(); + } + updateCell(e3, t3, i3, s3, r2, o2, n2, a2, h2) { + this._updateCell( + this._vertices.attributes, + e3, + t3, + i3, + s3, + r2, + o2, + n2, + a2, + h2 + ); + } + _updateCell(e3, t3, i3, r2, n2, a2, l2, g2, v, f) { + (d = (i3 * this._terminal.cols + t3) * h), + r2 !== o.NULL_CELL_CODE && void 0 !== r2 + ? this._atlas && + ((c = + g2 && g2.length > 1 + ? this._atlas.getRasterizedGlyphCombinedChar( + g2, + n2, + a2, + l2, + false + ) + : this._atlas.getRasterizedGlyph( + r2, + n2, + a2, + l2, + false + )), + (_ = Math.floor( + (this._dimensions.device.cell.width - + this._dimensions.device.char.width) / + 2 + )), + n2 !== f && c.offset.x > _ + ? ((u = c.offset.x - _), + (e3[d] = + -(c.offset.x - u) + + this._dimensions.device.char.left), + (e3[d + 1] = + -c.offset.y + + this._dimensions.device.char.top), + (e3[d + 2] = + (c.size.x - u) / + this._dimensions.device.canvas.width), + (e3[d + 3] = + c.size.y / + this._dimensions.device.canvas.height), + (e3[d + 4] = c.texturePage), + (e3[d + 5] = + c.texturePositionClipSpace.x + + u / + this._atlas.pages[c.texturePage].canvas + .width), + (e3[d + 6] = c.texturePositionClipSpace.y), + (e3[d + 7] = + c.sizeClipSpace.x - + u / + this._atlas.pages[c.texturePage].canvas + .width), + (e3[d + 8] = c.sizeClipSpace.y)) + : ((e3[d] = + -c.offset.x + + this._dimensions.device.char.left), + (e3[d + 1] = + -c.offset.y + + this._dimensions.device.char.top), + (e3[d + 2] = + c.size.x / + this._dimensions.device.canvas.width), + (e3[d + 3] = + c.size.y / + this._dimensions.device.canvas.height), + (e3[d + 4] = c.texturePage), + (e3[d + 5] = c.texturePositionClipSpace.x), + (e3[d + 6] = c.texturePositionClipSpace.y), + (e3[d + 7] = c.sizeClipSpace.x), + (e3[d + 8] = c.sizeClipSpace.y)), + this._optionsService.rawOptions + .rescaleOverlappingGlyphs && + (0, s2.allowRescaling)( + r2, + v, + c.size.x, + this._dimensions.device.cell.width + ) && + (e3[d + 2] = + (this._dimensions.device.cell.width - 1) / + this._dimensions.device.canvas.width)) + : e3.fill(0, d, d + h - 1 - 2); + } + clear() { + const e3 = this._terminal, + t3 = e3.cols * e3.rows * h; + this._vertices.count !== t3 + ? (this._vertices.attributes = new Float32Array(t3)) + : this._vertices.attributes.fill(0); + let i3 = 0; + for (; i3 < this._vertices.attributesBuffers.length; i3++) + this._vertices.count !== t3 + ? (this._vertices.attributesBuffers[i3] = + new Float32Array(t3)) + : this._vertices.attributesBuffers[i3].fill(0); + (this._vertices.count = t3), (i3 = 0); + for (let t4 = 0; t4 < e3.rows; t4++) + for (let s3 = 0; s3 < e3.cols; s3++) + (this._vertices.attributes[i3 + 9] = s3 / e3.cols), + (this._vertices.attributes[i3 + 10] = t4 / e3.rows), + (i3 += h); + } + handleResize() { + const e3 = this._gl; + e3.useProgram(this._program), + e3.viewport(0, 0, e3.canvas.width, e3.canvas.height), + e3.uniform2f( + this._resolutionLocation, + e3.canvas.width, + e3.canvas.height + ), + this.clear(); + } + render(e3) { + if (!this._atlas) return; + const t3 = this._gl; + t3.useProgram(this._program), + t3.bindVertexArray(this._vertexArrayObject), + (this._activeBuffer = (this._activeBuffer + 1) % 2); + const i3 = + this._vertices.attributesBuffers[this._activeBuffer]; + let s3 = 0; + for (let t4 = 0; t4 < e3.lineLengths.length; t4++) { + const r2 = t4 * this._terminal.cols * h, + o2 = this._vertices.attributes.subarray( + r2, + r2 + e3.lineLengths[t4] * h + ); + i3.set(o2, s3), (s3 += o2.length); + } + t3.bindBuffer(t3.ARRAY_BUFFER, this._attributesBuffer), + t3.bufferData( + t3.ARRAY_BUFFER, + i3.subarray(0, s3), + t3.STREAM_DRAW + ); + for (let e4 = 0; e4 < this._atlas.pages.length; e4++) + this._atlas.pages[e4].version !== + this._atlasTextures[e4].version && + this._bindAtlasPageTexture(t3, this._atlas, e4); + t3.drawElementsInstanced( + t3.TRIANGLE_STRIP, + 4, + t3.UNSIGNED_BYTE, + 0, + s3 / h + ); + } + setAtlas(e3) { + this._atlas = e3; + for (const e4 of this._atlasTextures) e4.version = -1; + } + _bindAtlasPageTexture(e3, t3, i3) { + e3.activeTexture(e3.TEXTURE0 + i3), + e3.bindTexture( + e3.TEXTURE_2D, + this._atlasTextures[i3].texture + ), + e3.texParameteri( + e3.TEXTURE_2D, + e3.TEXTURE_WRAP_S, + e3.CLAMP_TO_EDGE + ), + e3.texParameteri( + e3.TEXTURE_2D, + e3.TEXTURE_WRAP_T, + e3.CLAMP_TO_EDGE + ), + e3.texImage2D( + e3.TEXTURE_2D, + 0, + e3.RGBA, + e3.RGBA, + e3.UNSIGNED_BYTE, + t3.pages[i3].canvas + ), + e3.generateMipmap(e3.TEXTURE_2D), + (this._atlasTextures[i3].version = + t3.pages[i3].version); + } + setDimensions(e3) { + this._dimensions = e3; + } + } + t2.GlyphRenderer = g; + }, + 742: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.RectangleRenderer = void 0); + const s2 = i2(374), + r = i2(859), + o = i2(310), + n = i2(381), + a = 8 * Float32Array.BYTES_PER_ELEMENT; + class h { + constructor() { + (this.attributes = new Float32Array(160)), + (this.count = 0); + } + } + let l = 0, + c = 0, + d = 0, + _ = 0, + u = 0, + g = 0, + v = 0; + class f extends r.Disposable { + constructor(e3, t3, i3, o2) { + super(), + (this._terminal = e3), + (this._gl = t3), + (this._dimensions = i3), + (this._themeService = o2), + (this._vertices = new h()), + (this._verticesCursor = new h()); + const l2 = this._gl; + (this._program = (0, s2.throwIfFalsy)( + (0, n.createProgram)( + l2, + "#version 300 es\nlayout (location = 0) in vec2 a_position;\nlayout (location = 1) in vec2 a_size;\nlayout (location = 2) in vec4 a_color;\nlayout (location = 3) in vec2 a_unitquad;\n\nuniform mat4 u_projection;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 zeroToOne = a_position + (a_unitquad * a_size);\n gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n v_color = a_color;\n}", + "#version 300 es\nprecision lowp float;\n\nin vec4 v_color;\n\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n}" + ) + )), + this.register( + (0, r.toDisposable)(() => + l2.deleteProgram(this._program) + ) + ), + (this._projectionLocation = (0, s2.throwIfFalsy)( + l2.getUniformLocation(this._program, "u_projection") + )), + (this._vertexArrayObject = l2.createVertexArray()), + l2.bindVertexArray(this._vertexArrayObject); + const c2 = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), + d2 = l2.createBuffer(); + this.register( + (0, r.toDisposable)(() => l2.deleteBuffer(d2)) + ), + l2.bindBuffer(l2.ARRAY_BUFFER, d2), + l2.bufferData(l2.ARRAY_BUFFER, c2, l2.STATIC_DRAW), + l2.enableVertexAttribArray(3), + l2.vertexAttribPointer( + 3, + 2, + this._gl.FLOAT, + false, + 0, + 0 + ); + const _2 = new Uint8Array([0, 1, 2, 3]), + u2 = l2.createBuffer(); + this.register( + (0, r.toDisposable)(() => l2.deleteBuffer(u2)) + ), + l2.bindBuffer(l2.ELEMENT_ARRAY_BUFFER, u2), + l2.bufferData( + l2.ELEMENT_ARRAY_BUFFER, + _2, + l2.STATIC_DRAW + ), + (this._attributesBuffer = (0, s2.throwIfFalsy)( + l2.createBuffer() + )), + this.register( + (0, r.toDisposable)(() => + l2.deleteBuffer(this._attributesBuffer) + ) + ), + l2.bindBuffer(l2.ARRAY_BUFFER, this._attributesBuffer), + l2.enableVertexAttribArray(0), + l2.vertexAttribPointer(0, 2, l2.FLOAT, false, a, 0), + l2.vertexAttribDivisor(0, 1), + l2.enableVertexAttribArray(1), + l2.vertexAttribPointer( + 1, + 2, + l2.FLOAT, + false, + a, + 2 * Float32Array.BYTES_PER_ELEMENT + ), + l2.vertexAttribDivisor(1, 1), + l2.enableVertexAttribArray(2), + l2.vertexAttribPointer( + 2, + 4, + l2.FLOAT, + false, + a, + 4 * Float32Array.BYTES_PER_ELEMENT + ), + l2.vertexAttribDivisor(2, 1), + this._updateCachedColors(o2.colors), + this.register( + this._themeService.onChangeColors((e4) => { + this._updateCachedColors(e4), + this._updateViewportRectangle(); + }) + ); + } + renderBackgrounds() { + this._renderVertices(this._vertices); + } + renderCursor() { + this._renderVertices(this._verticesCursor); + } + _renderVertices(e3) { + const t3 = this._gl; + t3.useProgram(this._program), + t3.bindVertexArray(this._vertexArrayObject), + t3.uniformMatrix4fv( + this._projectionLocation, + false, + n.PROJECTION_MATRIX + ), + t3.bindBuffer(t3.ARRAY_BUFFER, this._attributesBuffer), + t3.bufferData( + t3.ARRAY_BUFFER, + e3.attributes, + t3.DYNAMIC_DRAW + ), + t3.drawElementsInstanced( + this._gl.TRIANGLE_STRIP, + 4, + t3.UNSIGNED_BYTE, + 0, + e3.count + ); + } + handleResize() { + this._updateViewportRectangle(); + } + setDimensions(e3) { + this._dimensions = e3; + } + _updateCachedColors(e3) { + (this._bgFloat = this._colorToFloat32Array( + e3.background + )), + (this._cursorFloat = this._colorToFloat32Array( + e3.cursor + )); + } + _updateViewportRectangle() { + this._addRectangleFloat( + this._vertices.attributes, + 0, + 0, + 0, + this._terminal.cols * + this._dimensions.device.cell.width, + this._terminal.rows * + this._dimensions.device.cell.height, + this._bgFloat + ); + } + updateBackgrounds(e3) { + const t3 = this._terminal, + i3 = this._vertices; + let s3, + r2, + n2, + a2, + h2, + l2, + c2, + d2, + _2, + u2, + g2, + v2 = 1; + for (s3 = 0; s3 < t3.rows; s3++) { + for ( + n2 = -1, a2 = 0, h2 = 0, l2 = false, r2 = 0; + r2 < t3.cols; + r2++ + ) + (c2 = + (s3 * t3.cols + r2) * + o.RENDER_MODEL_INDICIES_PER_CELL), + (d2 = e3.cells[c2 + o.RENDER_MODEL_BG_OFFSET]), + (_2 = e3.cells[c2 + o.RENDER_MODEL_FG_OFFSET]), + (u2 = !!(67108864 & _2)), + (d2 !== a2 || (_2 !== h2 && (l2 || u2))) && + ((0 !== a2 || (l2 && 0 !== h2)) && + ((g2 = 8 * v2++), + this._updateRectangle( + i3, + g2, + h2, + a2, + n2, + r2, + s3 + )), + (n2 = r2), + (a2 = d2), + (h2 = _2), + (l2 = u2)); + (0 !== a2 || (l2 && 0 !== h2)) && + ((g2 = 8 * v2++), + this._updateRectangle( + i3, + g2, + h2, + a2, + n2, + t3.cols, + s3 + )); + } + i3.count = v2; + } + updateCursor(e3) { + const t3 = this._verticesCursor, + i3 = e3.cursor; + if (!i3 || "block" === i3.style) + return void (t3.count = 0); + let s3, + r2 = 0; + ("bar" !== i3.style && "outline" !== i3.style) || + ((s3 = 8 * r2++), + this._addRectangleFloat( + t3.attributes, + s3, + i3.x * this._dimensions.device.cell.width, + i3.y * this._dimensions.device.cell.height, + "bar" === i3.style ? i3.dpr * i3.cursorWidth : i3.dpr, + this._dimensions.device.cell.height, + this._cursorFloat + )), + ("underline" !== i3.style && "outline" !== i3.style) || + ((s3 = 8 * r2++), + this._addRectangleFloat( + t3.attributes, + s3, + i3.x * this._dimensions.device.cell.width, + (i3.y + 1) * this._dimensions.device.cell.height - + i3.dpr, + i3.width * this._dimensions.device.cell.width, + i3.dpr, + this._cursorFloat + )), + "outline" === i3.style && + ((s3 = 8 * r2++), + this._addRectangleFloat( + t3.attributes, + s3, + i3.x * this._dimensions.device.cell.width, + i3.y * this._dimensions.device.cell.height, + i3.width * this._dimensions.device.cell.width, + i3.dpr, + this._cursorFloat + ), + (s3 = 8 * r2++), + this._addRectangleFloat( + t3.attributes, + s3, + (i3.x + i3.width) * + this._dimensions.device.cell.width - + i3.dpr, + i3.y * this._dimensions.device.cell.height, + i3.dpr, + this._dimensions.device.cell.height, + this._cursorFloat + )), + (t3.count = r2); + } + _updateRectangle(e3, t3, i3, s3, r2, o2, a2) { + if (67108864 & i3) + switch (50331648 & i3) { + case 16777216: + case 33554432: + l = this._themeService.colors.ansi[255 & i3].rgba; + break; + case 50331648: + l = (16777215 & i3) << 8; + break; + default: + l = this._themeService.colors.foreground.rgba; + } + else + switch (50331648 & s3) { + case 16777216: + case 33554432: + l = this._themeService.colors.ansi[255 & s3].rgba; + break; + case 50331648: + l = (16777215 & s3) << 8; + break; + default: + l = this._themeService.colors.background.rgba; + } + e3.attributes.length < t3 + 4 && + (e3.attributes = (0, n.expandFloat32Array)( + e3.attributes, + this._terminal.rows * this._terminal.cols * 8 + )), + (c = r2 * this._dimensions.device.cell.width), + (d = a2 * this._dimensions.device.cell.height), + (_ = ((l >> 24) & 255) / 255), + (u = ((l >> 16) & 255) / 255), + (g = ((l >> 8) & 255) / 255), + (v = 1), + this._addRectangle( + e3.attributes, + t3, + c, + d, + (o2 - r2) * this._dimensions.device.cell.width, + this._dimensions.device.cell.height, + _, + u, + g, + v + ); + } + _addRectangle(e3, t3, i3, s3, r2, o2, n2, a2, h2, l2) { + (e3[t3] = i3 / this._dimensions.device.canvas.width), + (e3[t3 + 1] = + s3 / this._dimensions.device.canvas.height), + (e3[t3 + 2] = + r2 / this._dimensions.device.canvas.width), + (e3[t3 + 3] = + o2 / this._dimensions.device.canvas.height), + (e3[t3 + 4] = n2), + (e3[t3 + 5] = a2), + (e3[t3 + 6] = h2), + (e3[t3 + 7] = l2); + } + _addRectangleFloat(e3, t3, i3, s3, r2, o2, n2) { + (e3[t3] = i3 / this._dimensions.device.canvas.width), + (e3[t3 + 1] = + s3 / this._dimensions.device.canvas.height), + (e3[t3 + 2] = + r2 / this._dimensions.device.canvas.width), + (e3[t3 + 3] = + o2 / this._dimensions.device.canvas.height), + (e3[t3 + 4] = n2[0]), + (e3[t3 + 5] = n2[1]), + (e3[t3 + 6] = n2[2]), + (e3[t3 + 7] = n2[3]); + } + _colorToFloat32Array(e3) { + return new Float32Array([ + ((e3.rgba >> 24) & 255) / 255, + ((e3.rgba >> 16) & 255) / 255, + ((e3.rgba >> 8) & 255) / 255, + (255 & e3.rgba) / 255, + ]); + } + } + t2.RectangleRenderer = f; + }, + 310: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.RenderModel = + t2.COMBINED_CHAR_BIT_MASK = + t2.RENDER_MODEL_EXT_OFFSET = + t2.RENDER_MODEL_FG_OFFSET = + t2.RENDER_MODEL_BG_OFFSET = + t2.RENDER_MODEL_INDICIES_PER_CELL = + void 0); + const s2 = i2(296); + (t2.RENDER_MODEL_INDICIES_PER_CELL = 4), + (t2.RENDER_MODEL_BG_OFFSET = 1), + (t2.RENDER_MODEL_FG_OFFSET = 2), + (t2.RENDER_MODEL_EXT_OFFSET = 3), + (t2.COMBINED_CHAR_BIT_MASK = 2147483648), + (t2.RenderModel = class { + constructor() { + (this.cells = new Uint32Array(0)), + (this.lineLengths = new Uint32Array(0)), + (this.selection = (0, + s2.createSelectionRenderModel)()); + } + resize(e3, i3) { + const s3 = e3 * i3 * t2.RENDER_MODEL_INDICIES_PER_CELL; + s3 !== this.cells.length && + ((this.cells = new Uint32Array(s3)), + (this.lineLengths = new Uint32Array(i3))); + } + clear() { + this.cells.fill(0, 0), this.lineLengths.fill(0, 0); + } + }); + }, + 666: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.JoinedCellData = t2.WebglRenderer = void 0); + const s2 = i2(820), + r = i2(274), + o = i2(627), + n = i2(457), + a = i2(56), + h = i2(374), + l = i2(345), + c = i2(859), + d = i2(147), + _ = i2(782), + u = i2(855), + g = i2(965), + v = i2(742), + f = i2(310), + p = i2(733); + class C extends c.Disposable { + constructor(e3, t3, i3, n2, d2, u2, g2, v2, C2) { + super(), + (this._terminal = e3), + (this._characterJoinerService = t3), + (this._charSizeService = i3), + (this._coreBrowserService = n2), + (this._coreService = d2), + (this._decorationService = u2), + (this._optionsService = g2), + (this._themeService = v2), + (this._cursorBlinkStateManager = + new c.MutableDisposable()), + (this._charAtlasDisposable = this.register( + new c.MutableDisposable() + )), + (this._observerDisposable = this.register( + new c.MutableDisposable() + )), + (this._model = new f.RenderModel()), + (this._workCell = new _.CellData()), + (this._workCell2 = new _.CellData()), + (this._rectangleRenderer = this.register( + new c.MutableDisposable() + )), + (this._glyphRenderer = this.register( + new c.MutableDisposable() + )), + (this._onChangeTextureAtlas = this.register( + new l.EventEmitter() + )), + (this.onChangeTextureAtlas = + this._onChangeTextureAtlas.event), + (this._onAddTextureAtlasCanvas = this.register( + new l.EventEmitter() + )), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event), + (this._onRemoveTextureAtlasCanvas = this.register( + new l.EventEmitter() + )), + (this.onRemoveTextureAtlasCanvas = + this._onRemoveTextureAtlasCanvas.event), + (this._onRequestRedraw = this.register( + new l.EventEmitter() + )), + (this.onRequestRedraw = this._onRequestRedraw.event), + (this._onContextLoss = this.register( + new l.EventEmitter() + )), + (this.onContextLoss = this._onContextLoss.event), + this.register( + this._themeService.onChangeColors(() => + this._handleColorChange() + ) + ), + (this._cellColorResolver = new r.CellColorResolver( + this._terminal, + this._optionsService, + this._model.selection, + this._decorationService, + this._coreBrowserService, + this._themeService + )), + (this._core = this._terminal._core), + (this._renderLayers = [ + new p.LinkRenderLayer( + this._core.screenElement, + 2, + this._terminal, + this._core.linkifier, + this._coreBrowserService, + g2, + this._themeService + ), + ]), + (this.dimensions = (0, h.createRenderDimensions)()), + (this._devicePixelRatio = this._coreBrowserService.dpr), + this._updateDimensions(), + this._updateCursorBlink(), + this.register( + g2.onOptionChange(() => this._handleOptionsChanged()) + ), + (this._canvas = + this._coreBrowserService.mainDocument.createElement( + "canvas" + )); + const m2 = { + antialias: false, + depth: false, + preserveDrawingBuffer: C2, + }; + if ( + ((this._gl = this._canvas.getContext("webgl2", m2)), + !this._gl) + ) + throw new Error("WebGL2 not supported " + this._gl); + this.register( + (0, s2.addDisposableDomListener)( + this._canvas, + "webglcontextlost", + (e4) => { + console.log("webglcontextlost event received"), + e4.preventDefault(), + (this._contextRestorationTimeout = setTimeout( + () => { + (this._contextRestorationTimeout = void 0), + console.warn( + "webgl context not restored; firing onContextLoss" + ), + this._onContextLoss.fire(e4); + }, + 3e3 + )); + } + ) + ), + this.register( + (0, s2.addDisposableDomListener)( + this._canvas, + "webglcontextrestored", + (e4) => { + console.warn( + "webglcontextrestored event received" + ), + clearTimeout(this._contextRestorationTimeout), + (this._contextRestorationTimeout = void 0), + (0, o.removeTerminalFromCache)(this._terminal), + this._initializeWebGLState(), + this._requestRedrawViewport(); + } + ) + ), + (this._observerDisposable.value = (0, + a.observeDevicePixelDimensions)( + this._canvas, + this._coreBrowserService.window, + (e4, t4) => + this._setCanvasDevicePixelDimensions(e4, t4) + )), + this.register( + this._coreBrowserService.onWindowChange((e4) => { + this._observerDisposable.value = (0, + a.observeDevicePixelDimensions)( + this._canvas, + e4, + (e5, t4) => + this._setCanvasDevicePixelDimensions(e5, t4) + ); + }) + ), + this._core.screenElement.appendChild(this._canvas), + ([ + this._rectangleRenderer.value, + this._glyphRenderer.value, + ] = this._initializeWebGLState()), + (this._isAttached = + this._coreBrowserService.window.document.body.contains( + this._core.screenElement + )), + this.register( + (0, c.toDisposable)(() => { + for (const e4 of this._renderLayers) e4.dispose(); + this._canvas.parentElement?.removeChild( + this._canvas + ), + (0, o.removeTerminalFromCache)(this._terminal); + }) + ); + } + get textureAtlas() { + return this._charAtlas?.pages[0].canvas; + } + _handleColorChange() { + this._refreshCharAtlas(), this._clearModel(true); + } + handleDevicePixelRatioChange() { + this._devicePixelRatio !== this._coreBrowserService.dpr && + ((this._devicePixelRatio = + this._coreBrowserService.dpr), + this.handleResize( + this._terminal.cols, + this._terminal.rows + )); + } + handleResize(e3, t3) { + this._updateDimensions(), + this._model.resize( + this._terminal.cols, + this._terminal.rows + ); + for (const e4 of this._renderLayers) + e4.resize(this._terminal, this.dimensions); + (this._canvas.width = + this.dimensions.device.canvas.width), + (this._canvas.height = + this.dimensions.device.canvas.height), + (this._canvas.style.width = `${this.dimensions.css.canvas.width}px`), + (this._canvas.style.height = `${this.dimensions.css.canvas.height}px`), + (this._core.screenElement.style.width = `${this.dimensions.css.canvas.width}px`), + (this._core.screenElement.style.height = `${this.dimensions.css.canvas.height}px`), + this._rectangleRenderer.value?.setDimensions( + this.dimensions + ), + this._rectangleRenderer.value?.handleResize(), + this._glyphRenderer.value?.setDimensions( + this.dimensions + ), + this._glyphRenderer.value?.handleResize(), + this._refreshCharAtlas(), + this._clearModel(false); + } + handleCharSizeChanged() { + this.handleResize( + this._terminal.cols, + this._terminal.rows + ); + } + handleBlur() { + for (const e3 of this._renderLayers) + e3.handleBlur(this._terminal); + this._cursorBlinkStateManager.value?.pause(), + this._requestRedrawViewport(); + } + handleFocus() { + for (const e3 of this._renderLayers) + e3.handleFocus(this._terminal); + this._cursorBlinkStateManager.value?.resume(), + this._requestRedrawViewport(); + } + handleSelectionChanged(e3, t3, i3) { + for (const s3 of this._renderLayers) + s3.handleSelectionChanged(this._terminal, e3, t3, i3); + this._model.selection.update(this._core, e3, t3, i3), + this._requestRedrawViewport(); + } + handleCursorMove() { + for (const e3 of this._renderLayers) + e3.handleCursorMove(this._terminal); + this._cursorBlinkStateManager.value?.restartBlinkAnimation(); + } + _handleOptionsChanged() { + this._updateDimensions(), + this._refreshCharAtlas(), + this._updateCursorBlink(); + } + _initializeWebGLState() { + return ( + (this._rectangleRenderer.value = + new v.RectangleRenderer( + this._terminal, + this._gl, + this.dimensions, + this._themeService + )), + (this._glyphRenderer.value = new g.GlyphRenderer( + this._terminal, + this._gl, + this.dimensions, + this._optionsService + )), + this.handleCharSizeChanged(), + [ + this._rectangleRenderer.value, + this._glyphRenderer.value, + ] + ); + } + _refreshCharAtlas() { + if ( + this.dimensions.device.char.width <= 0 && + this.dimensions.device.char.height <= 0 + ) + return void (this._isAttached = false); + const e3 = (0, o.acquireTextureAtlas)( + this._terminal, + this._optionsService.rawOptions, + this._themeService.colors, + this.dimensions.device.cell.width, + this.dimensions.device.cell.height, + this.dimensions.device.char.width, + this.dimensions.device.char.height, + this._coreBrowserService.dpr + ); + this._charAtlas !== e3 && + (this._onChangeTextureAtlas.fire(e3.pages[0].canvas), + (this._charAtlasDisposable.value = (0, + c.getDisposeArrayDisposable)([ + (0, l.forwardEvent)( + e3.onAddTextureAtlasCanvas, + this._onAddTextureAtlasCanvas + ), + (0, l.forwardEvent)( + e3.onRemoveTextureAtlasCanvas, + this._onRemoveTextureAtlasCanvas + ), + ]))), + (this._charAtlas = e3), + this._charAtlas.warmUp(), + this._glyphRenderer.value?.setAtlas(this._charAtlas); + } + _clearModel(e3) { + this._model.clear(), + e3 && this._glyphRenderer.value?.clear(); + } + clearTextureAtlas() { + this._charAtlas?.clearTexture(), + this._clearModel(true), + this._requestRedrawViewport(); + } + clear() { + this._clearModel(true); + for (const e3 of this._renderLayers) + e3.reset(this._terminal); + this._cursorBlinkStateManager.value?.restartBlinkAnimation(), + this._updateCursorBlink(); + } + registerCharacterJoiner(e3) { + return -1; + } + deregisterCharacterJoiner(e3) { + return false; + } + renderRows(e3, t3) { + if (!this._isAttached) { + if ( + !( + this._coreBrowserService.window.document.body.contains( + this._core.screenElement + ) && + this._charSizeService.width && + this._charSizeService.height + ) + ) + return; + this._updateDimensions(), + this._refreshCharAtlas(), + (this._isAttached = true); + } + for (const i3 of this._renderLayers) + i3.handleGridChanged(this._terminal, e3, t3); + this._glyphRenderer.value && + this._rectangleRenderer.value && + (this._glyphRenderer.value.beginFrame() + ? (this._clearModel(true), + this._updateModel(0, this._terminal.rows - 1)) + : this._updateModel(e3, t3), + this._rectangleRenderer.value.renderBackgrounds(), + this._glyphRenderer.value.render(this._model), + (this._cursorBlinkStateManager.value && + !this._cursorBlinkStateManager.value + .isCursorVisible) || + this._rectangleRenderer.value.renderCursor()); + } + _updateCursorBlink() { + this._terminal.options.cursorBlink + ? (this._cursorBlinkStateManager.value = + new n.CursorBlinkStateManager(() => { + this._requestRedrawCursor(); + }, this._coreBrowserService)) + : this._cursorBlinkStateManager.clear(), + this._requestRedrawCursor(); + } + _updateModel(e3, t3) { + const i3 = this._core; + let s3, + r2, + o2, + n2, + a2, + h2, + l2, + c2, + d2, + _2, + g2, + v2, + p2, + C2, + x = this._workCell; + (e3 = L(e3, i3.rows - 1, 0)), + (t3 = L(t3, i3.rows - 1, 0)); + const w = + this._terminal.buffer.active.baseY + + this._terminal.buffer.active.cursorY, + b = w - i3.buffer.ydisp, + M = Math.min( + this._terminal.buffer.active.cursorX, + i3.cols - 1 + ); + let R = -1; + const y = + this._coreService.isCursorInitialized && + !this._coreService.isCursorHidden && + (!this._cursorBlinkStateManager.value || + this._cursorBlinkStateManager.value.isCursorVisible); + this._model.cursor = void 0; + let A = false; + for (r2 = e3; r2 <= t3; r2++) + for ( + o2 = r2 + i3.buffer.ydisp, + n2 = i3.buffer.lines.get(o2), + this._model.lineLengths[r2] = 0, + a2 = + this._characterJoinerService.getJoinedCharacters( + o2 + ), + p2 = 0; + p2 < i3.cols; + p2++ + ) + if ( + ((s3 = this._cellColorResolver.result.bg), + n2.loadCell(p2, x), + 0 === p2 && + (s3 = this._cellColorResolver.result.bg), + (h2 = false), + (l2 = p2), + a2.length > 0 && + p2 === a2[0][0] && + ((h2 = true), + (c2 = a2.shift()), + (x = new m( + x, + n2.translateToString(true, c2[0], c2[1]), + c2[1] - c2[0] + )), + (l2 = c2[1] - 1)), + (d2 = x.getChars()), + (_2 = x.getCode()), + (v2 = + (r2 * i3.cols + p2) * + f.RENDER_MODEL_INDICIES_PER_CELL), + this._cellColorResolver.resolve( + x, + p2, + o2, + this.dimensions.device.cell.width + ), + y && + o2 === w && + (p2 === M && + ((this._model.cursor = { + x: M, + y: b, + width: x.getWidth(), + style: this._coreBrowserService.isFocused + ? i3.options.cursorStyle || "block" + : i3.options.cursorInactiveStyle, + cursorWidth: i3.options.cursorWidth, + dpr: this._devicePixelRatio, + }), + (R = M + x.getWidth() - 1)), + p2 >= M && + p2 <= R && + ((this._coreBrowserService.isFocused && + "block" === + (i3.options.cursorStyle || "block")) || + (false === + this._coreBrowserService.isFocused && + "block" === + i3.options.cursorInactiveStyle)) && + ((this._cellColorResolver.result.fg = + 50331648 | + ((this._themeService.colors.cursorAccent + .rgba >> + 8) & + 16777215)), + (this._cellColorResolver.result.bg = + 50331648 | + ((this._themeService.colors.cursor.rgba >> + 8) & + 16777215)))), + _2 !== u.NULL_CELL_CODE && + (this._model.lineLengths[r2] = p2 + 1), + (this._model.cells[v2] !== _2 || + this._model.cells[ + v2 + f.RENDER_MODEL_BG_OFFSET + ] !== this._cellColorResolver.result.bg || + this._model.cells[ + v2 + f.RENDER_MODEL_FG_OFFSET + ] !== this._cellColorResolver.result.fg || + this._model.cells[ + v2 + f.RENDER_MODEL_EXT_OFFSET + ] !== this._cellColorResolver.result.ext) && + ((A = true), + d2.length > 1 && (_2 |= f.COMBINED_CHAR_BIT_MASK), + (this._model.cells[v2] = _2), + (this._model.cells[ + v2 + f.RENDER_MODEL_BG_OFFSET + ] = this._cellColorResolver.result.bg), + (this._model.cells[ + v2 + f.RENDER_MODEL_FG_OFFSET + ] = this._cellColorResolver.result.fg), + (this._model.cells[ + v2 + f.RENDER_MODEL_EXT_OFFSET + ] = this._cellColorResolver.result.ext), + (g2 = x.getWidth()), + this._glyphRenderer.value.updateCell( + p2, + r2, + _2, + this._cellColorResolver.result.bg, + this._cellColorResolver.result.fg, + this._cellColorResolver.result.ext, + d2, + g2, + s3 + ), + h2)) + ) + for (x = this._workCell, p2++; p2 < l2; p2++) + (C2 = + (r2 * i3.cols + p2) * + f.RENDER_MODEL_INDICIES_PER_CELL), + this._glyphRenderer.value.updateCell( + p2, + r2, + u.NULL_CELL_CODE, + 0, + 0, + 0, + u.NULL_CELL_CHAR, + 0, + 0 + ), + (this._model.cells[C2] = u.NULL_CELL_CODE), + (this._model.cells[ + C2 + f.RENDER_MODEL_BG_OFFSET + ] = this._cellColorResolver.result.bg), + (this._model.cells[ + C2 + f.RENDER_MODEL_FG_OFFSET + ] = this._cellColorResolver.result.fg), + (this._model.cells[ + C2 + f.RENDER_MODEL_EXT_OFFSET + ] = this._cellColorResolver.result.ext); + A && + this._rectangleRenderer.value.updateBackgrounds( + this._model + ), + this._rectangleRenderer.value.updateCursor(this._model); + } + _updateDimensions() { + this._charSizeService.width && + this._charSizeService.height && + ((this.dimensions.device.char.width = Math.floor( + this._charSizeService.width * this._devicePixelRatio + )), + (this.dimensions.device.char.height = Math.ceil( + this._charSizeService.height * this._devicePixelRatio + )), + (this.dimensions.device.cell.height = Math.floor( + this.dimensions.device.char.height * + this._optionsService.rawOptions.lineHeight + )), + (this.dimensions.device.char.top = + 1 === this._optionsService.rawOptions.lineHeight + ? 0 + : Math.round( + (this.dimensions.device.cell.height - + this.dimensions.device.char.height) / + 2 + )), + (this.dimensions.device.cell.width = + this.dimensions.device.char.width + + Math.round( + this._optionsService.rawOptions.letterSpacing + )), + (this.dimensions.device.char.left = Math.floor( + this._optionsService.rawOptions.letterSpacing / 2 + )), + (this.dimensions.device.canvas.height = + this._terminal.rows * + this.dimensions.device.cell.height), + (this.dimensions.device.canvas.width = + this._terminal.cols * + this.dimensions.device.cell.width), + (this.dimensions.css.canvas.height = Math.round( + this.dimensions.device.canvas.height / + this._devicePixelRatio + )), + (this.dimensions.css.canvas.width = Math.round( + this.dimensions.device.canvas.width / + this._devicePixelRatio + )), + (this.dimensions.css.cell.height = + this.dimensions.device.cell.height / + this._devicePixelRatio), + (this.dimensions.css.cell.width = + this.dimensions.device.cell.width / + this._devicePixelRatio)); + } + _setCanvasDevicePixelDimensions(e3, t3) { + (this._canvas.width === e3 && + this._canvas.height === t3) || + ((this._canvas.width = e3), + (this._canvas.height = t3), + this._requestRedrawViewport()); + } + _requestRedrawViewport() { + this._onRequestRedraw.fire({ + start: 0, + end: this._terminal.rows - 1, + }); + } + _requestRedrawCursor() { + const e3 = this._terminal.buffer.active.cursorY; + this._onRequestRedraw.fire({ start: e3, end: e3 }); + } + } + t2.WebglRenderer = C; + class m extends d.AttributeData { + constructor(e3, t3, i3) { + super(), + (this.content = 0), + (this.combinedData = ""), + (this.fg = e3.fg), + (this.bg = e3.bg), + (this.combinedData = t3), + (this._width = i3); + } + isCombined() { + return 2097152; + } + getWidth() { + return this._width; + } + getChars() { + return this.combinedData; + } + getCode() { + return 2097151; + } + setFromCharData(e3) { + throw new Error("not implemented"); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + function L(e3, t3, i3 = 0) { + return Math.max(Math.min(e3, t3), i3); + } + t2.JoinedCellData = m; + }, + 381: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.GLTexture = + t2.expandFloat32Array = + t2.createShader = + t2.createProgram = + t2.PROJECTION_MATRIX = + void 0); + const s2 = i2(374); + function r(e3, t3, i3) { + const r2 = (0, s2.throwIfFalsy)(e3.createShader(t3)); + if ( + (e3.shaderSource(r2, i3), + e3.compileShader(r2), + e3.getShaderParameter(r2, e3.COMPILE_STATUS)) + ) + return r2; + console.error(e3.getShaderInfoLog(r2)), e3.deleteShader(r2); + } + (t2.PROJECTION_MATRIX = new Float32Array([ + 2, 0, 0, 0, 0, -2, 0, 0, 0, 0, 1, 0, -1, 1, 0, 1, + ])), + (t2.createProgram = function (e3, t3, i3) { + const o = (0, s2.throwIfFalsy)(e3.createProgram()); + if ( + (e3.attachShader( + o, + (0, s2.throwIfFalsy)(r(e3, e3.VERTEX_SHADER, t3)) + ), + e3.attachShader( + o, + (0, s2.throwIfFalsy)(r(e3, e3.FRAGMENT_SHADER, i3)) + ), + e3.linkProgram(o), + e3.getProgramParameter(o, e3.LINK_STATUS)) + ) + return o; + console.error(e3.getProgramInfoLog(o)), + e3.deleteProgram(o); + }), + (t2.createShader = r), + (t2.expandFloat32Array = function (e3, t3) { + const i3 = Math.min(2 * e3.length, t3), + s3 = new Float32Array(i3); + for (let t4 = 0; t4 < e3.length; t4++) s3[t4] = e3[t4]; + return s3; + }), + (t2.GLTexture = class { + constructor(e3) { + (this.texture = e3), (this.version = -1); + } + }); + }, + 592: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BaseRenderLayer = void 0); + const s2 = i2(627), + r = i2(237), + o = i2(374), + n = i2(859); + class a extends n.Disposable { + constructor(e3, t3, i3, s3, r2, o2, a2, h) { + super(), + (this._container = t3), + (this._alpha = r2), + (this._coreBrowserService = o2), + (this._optionsService = a2), + (this._themeService = h), + (this._deviceCharWidth = 0), + (this._deviceCharHeight = 0), + (this._deviceCellWidth = 0), + (this._deviceCellHeight = 0), + (this._deviceCharLeft = 0), + (this._deviceCharTop = 0), + (this._canvas = + this._coreBrowserService.mainDocument.createElement( + "canvas" + )), + this._canvas.classList.add(`xterm-${i3}-layer`), + (this._canvas.style.zIndex = s3.toString()), + this._initCanvas(), + this._container.appendChild(this._canvas), + this.register( + this._themeService.onChangeColors((t4) => { + this._refreshCharAtlas(e3, t4), this.reset(e3); + }) + ), + this.register( + (0, n.toDisposable)(() => { + this._canvas.remove(); + }) + ); + } + _initCanvas() { + (this._ctx = (0, o.throwIfFalsy)( + this._canvas.getContext("2d", { alpha: this._alpha }) + )), + this._alpha || this._clearAll(); + } + handleBlur(e3) {} + handleFocus(e3) {} + handleCursorMove(e3) {} + handleGridChanged(e3, t3, i3) {} + handleSelectionChanged(e3, t3, i3, s3 = false) {} + _setTransparency(e3, t3) { + if (t3 === this._alpha) return; + const i3 = this._canvas; + (this._alpha = t3), + (this._canvas = this._canvas.cloneNode()), + this._initCanvas(), + this._container.replaceChild(this._canvas, i3), + this._refreshCharAtlas(e3, this._themeService.colors), + this.handleGridChanged(e3, 0, e3.rows - 1); + } + _refreshCharAtlas(e3, t3) { + (this._deviceCharWidth <= 0 && + this._deviceCharHeight <= 0) || + ((this._charAtlas = (0, s2.acquireTextureAtlas)( + e3, + this._optionsService.rawOptions, + t3, + this._deviceCellWidth, + this._deviceCellHeight, + this._deviceCharWidth, + this._deviceCharHeight, + this._coreBrowserService.dpr + )), + this._charAtlas.warmUp()); + } + resize(e3, t3) { + (this._deviceCellWidth = t3.device.cell.width), + (this._deviceCellHeight = t3.device.cell.height), + (this._deviceCharWidth = t3.device.char.width), + (this._deviceCharHeight = t3.device.char.height), + (this._deviceCharLeft = t3.device.char.left), + (this._deviceCharTop = t3.device.char.top), + (this._canvas.width = t3.device.canvas.width), + (this._canvas.height = t3.device.canvas.height), + (this._canvas.style.width = `${t3.css.canvas.width}px`), + (this._canvas.style.height = `${t3.css.canvas.height}px`), + this._alpha || this._clearAll(), + this._refreshCharAtlas(e3, this._themeService.colors); + } + _fillBottomLineAtCells(e3, t3, i3 = 1) { + this._ctx.fillRect( + e3 * this._deviceCellWidth, + (t3 + 1) * this._deviceCellHeight - + this._coreBrowserService.dpr - + 1, + i3 * this._deviceCellWidth, + this._coreBrowserService.dpr + ); + } + _clearAll() { + this._alpha + ? this._ctx.clearRect( + 0, + 0, + this._canvas.width, + this._canvas.height + ) + : ((this._ctx.fillStyle = + this._themeService.colors.background.css), + this._ctx.fillRect( + 0, + 0, + this._canvas.width, + this._canvas.height + )); + } + _clearCells(e3, t3, i3, s3) { + this._alpha + ? this._ctx.clearRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + s3 * this._deviceCellHeight + ) + : ((this._ctx.fillStyle = + this._themeService.colors.background.css), + this._ctx.fillRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + s3 * this._deviceCellHeight + )); + } + _fillCharTrueColor(e3, t3, i3, s3) { + (this._ctx.font = this._getFont(e3, false, false)), + (this._ctx.textBaseline = r.TEXT_BASELINE), + this._clipCell(i3, s3, t3.getWidth()), + this._ctx.fillText( + t3.getChars(), + i3 * this._deviceCellWidth + this._deviceCharLeft, + s3 * this._deviceCellHeight + + this._deviceCharTop + + this._deviceCharHeight + ); + } + _clipCell(e3, t3, i3) { + this._ctx.beginPath(), + this._ctx.rect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + this._deviceCellHeight + ), + this._ctx.clip(); + } + _getFont(e3, t3, i3) { + return `${i3 ? "italic" : ""} ${t3 ? e3.options.fontWeightBold : e3.options.fontWeight} ${e3.options.fontSize * this._coreBrowserService.dpr}px ${e3.options.fontFamily}`; + } + } + t2.BaseRenderLayer = a; + }, + 733: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.LinkRenderLayer = void 0); + const s2 = i2(197), + r = i2(237), + o = i2(592); + class n extends o.BaseRenderLayer { + constructor(e3, t3, i3, s3, r2, o2, n2) { + super(i3, e3, "link", t3, true, r2, o2, n2), + this.register( + s3.onShowLinkUnderline((e4) => + this._handleShowLinkUnderline(e4) + ) + ), + this.register( + s3.onHideLinkUnderline((e4) => + this._handleHideLinkUnderline(e4) + ) + ); + } + resize(e3, t3) { + super.resize(e3, t3), (this._state = void 0); + } + reset(e3) { + this._clearCurrentLink(); + } + _clearCurrentLink() { + if (this._state) { + this._clearCells( + this._state.x1, + this._state.y1, + this._state.cols - this._state.x1, + 1 + ); + const e3 = this._state.y2 - this._state.y1 - 1; + e3 > 0 && + this._clearCells( + 0, + this._state.y1 + 1, + this._state.cols, + e3 + ), + this._clearCells( + 0, + this._state.y2, + this._state.x2, + 1 + ), + (this._state = void 0); + } + } + _handleShowLinkUnderline(e3) { + if ( + (e3.fg === r.INVERTED_DEFAULT_COLOR + ? (this._ctx.fillStyle = + this._themeService.colors.background.css) + : void 0 !== e3.fg && (0, s2.is256Color)(e3.fg) + ? (this._ctx.fillStyle = + this._themeService.colors.ansi[e3.fg].css) + : (this._ctx.fillStyle = + this._themeService.colors.foreground.css), + e3.y1 === e3.y2) + ) + this._fillBottomLineAtCells( + e3.x1, + e3.y1, + e3.x2 - e3.x1 + ); + else { + this._fillBottomLineAtCells( + e3.x1, + e3.y1, + e3.cols - e3.x1 + ); + for (let t3 = e3.y1 + 1; t3 < e3.y2; t3++) + this._fillBottomLineAtCells(0, t3, e3.cols); + this._fillBottomLineAtCells(0, e3.y2, e3.x2); + } + this._state = e3; + } + _handleHideLinkUnderline(e3) { + this._clearCurrentLink(); + } + } + t2.LinkRenderLayer = n; + }, + 820: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.addDisposableDomListener = void 0), + (t2.addDisposableDomListener = function (e3, t3, i2, s2) { + e3.addEventListener(t3, i2, s2); + let r = false; + return { + dispose: () => { + r || ((r = true), e3.removeEventListener(t3, i2, s2)); + }, + }; + }); + }, + 274: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CellColorResolver = void 0); + const s2 = i2(855), + r = i2(160), + o = i2(374); + let n, + a = 0, + h = 0, + l = false, + c = false, + d = false, + _ = 0; + t2.CellColorResolver = class { + constructor(e3, t3, i3, s3, r2, o2) { + (this._terminal = e3), + (this._optionService = t3), + (this._selectionRenderModel = i3), + (this._decorationService = s3), + (this._coreBrowserService = r2), + (this._themeService = o2), + (this.result = { fg: 0, bg: 0, ext: 0 }); + } + resolve(e3, t3, i3, u) { + if ( + ((this.result.bg = e3.bg), + (this.result.fg = e3.fg), + (this.result.ext = + 268435456 & e3.bg ? e3.extended.ext : 0), + (h = 0), + (a = 0), + (c = false), + (l = false), + (d = false), + (n = this._themeService.colors), + (_ = 0), + e3.getCode() !== s2.NULL_CELL_CODE && + 4 === e3.extended.underlineStyle) + ) { + const e4 = Math.max( + 1, + Math.floor( + (this._optionService.rawOptions.fontSize * + this._coreBrowserService.dpr) / + 15 + ) + ); + _ = (t3 * u) % (2 * Math.round(e4)); + } + if ( + (this._decorationService.forEachDecorationAtCell( + t3, + i3, + "bottom", + (e4) => { + e4.backgroundColorRGB && + ((h = + (e4.backgroundColorRGB.rgba >> 8) & 16777215), + (c = true)), + e4.foregroundColorRGB && + ((a = + (e4.foregroundColorRGB.rgba >> 8) & 16777215), + (l = true)); + } + ), + (d = this._selectionRenderModel.isCellSelected( + this._terminal, + t3, + i3 + )), + d) + ) { + if ( + 67108864 & this.result.fg || + 0 != (50331648 & this.result.bg) + ) { + if (67108864 & this.result.fg) + switch (50331648 & this.result.fg) { + case 16777216: + case 33554432: + h = + this._themeService.colors.ansi[ + 255 & this.result.fg + ].rgba; + break; + case 50331648: + h = ((16777215 & this.result.fg) << 8) | 255; + break; + default: + h = this._themeService.colors.foreground.rgba; + } + else + switch (50331648 & this.result.bg) { + case 16777216: + case 33554432: + h = + this._themeService.colors.ansi[ + 255 & this.result.bg + ].rgba; + break; + case 50331648: + h = ((16777215 & this.result.bg) << 8) | 255; + } + h = + (r.rgba.blend( + h, + (4294967040 & + (this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba) | + 128 + ) >> + 8) & + 16777215; + } else + h = + ((this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba >> + 8) & + 16777215; + if ( + ((c = true), + n.selectionForeground && + ((a = (n.selectionForeground.rgba >> 8) & 16777215), + (l = true)), + (0, o.treatGlyphAsBackgroundColor)(e3.getCode())) + ) { + if ( + 67108864 & this.result.fg && + 0 == (50331648 & this.result.bg) + ) + a = + ((this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba >> + 8) & + 16777215; + else { + if (67108864 & this.result.fg) + switch (50331648 & this.result.bg) { + case 16777216: + case 33554432: + a = + this._themeService.colors.ansi[ + 255 & this.result.bg + ].rgba; + break; + case 50331648: + a = ((16777215 & this.result.bg) << 8) | 255; + } + else + switch (50331648 & this.result.fg) { + case 16777216: + case 33554432: + a = + this._themeService.colors.ansi[ + 255 & this.result.fg + ].rgba; + break; + case 50331648: + a = ((16777215 & this.result.fg) << 8) | 255; + break; + default: + a = this._themeService.colors.foreground.rgba; + } + a = + (r.rgba.blend( + a, + (4294967040 & + (this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba) | + 128 + ) >> + 8) & + 16777215; + } + l = true; + } + } + this._decorationService.forEachDecorationAtCell( + t3, + i3, + "top", + (e4) => { + e4.backgroundColorRGB && + ((h = (e4.backgroundColorRGB.rgba >> 8) & 16777215), + (c = true)), + e4.foregroundColorRGB && + ((a = + (e4.foregroundColorRGB.rgba >> 8) & 16777215), + (l = true)); + } + ), + c && + (h = d + ? (-16777216 & e3.bg & -134217729) | h | 50331648 + : (-16777216 & e3.bg) | h | 50331648), + l && + (a = (-16777216 & e3.fg & -67108865) | a | 50331648), + 67108864 & this.result.fg && + (c && + !l && + ((a = + 0 == (50331648 & this.result.bg) + ? (-134217728 & this.result.fg) | + (16777215 & (n.background.rgba >> 8)) | + 50331648 + : (-134217728 & this.result.fg) | + (67108863 & this.result.bg)), + (l = true)), + !c && + l && + ((h = + 0 == (50331648 & this.result.fg) + ? (-67108864 & this.result.bg) | + (16777215 & (n.foreground.rgba >> 8)) | + 50331648 + : (-67108864 & this.result.bg) | + (67108863 & this.result.fg)), + (c = true))), + (n = void 0), + (this.result.bg = c ? h : this.result.bg), + (this.result.fg = l ? a : this.result.fg), + (this.result.ext &= 536870911), + (this.result.ext |= (_ << 29) & 3758096384); + } + }; + }, + 627: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.removeTerminalFromCache = t2.acquireTextureAtlas = + void 0); + const s2 = i2(509), + r = i2(197), + o = []; + (t2.acquireTextureAtlas = function ( + e3, + t3, + i3, + n, + a, + h, + l, + c + ) { + const d = (0, r.generateConfig)(n, a, h, l, t3, i3, c); + for (let t4 = 0; t4 < o.length; t4++) { + const i4 = o[t4], + s3 = i4.ownedBy.indexOf(e3); + if (s3 >= 0) { + if ((0, r.configEquals)(i4.config, d)) return i4.atlas; + 1 === i4.ownedBy.length + ? (i4.atlas.dispose(), o.splice(t4, 1)) + : i4.ownedBy.splice(s3, 1); + break; + } + } + for (let t4 = 0; t4 < o.length; t4++) { + const i4 = o[t4]; + if ((0, r.configEquals)(i4.config, d)) + return i4.ownedBy.push(e3), i4.atlas; + } + const _ = e3._core, + u = { + atlas: new s2.TextureAtlas( + document, + d, + _.unicodeService + ), + config: d, + ownedBy: [e3], + }; + return o.push(u), u.atlas; + }), + (t2.removeTerminalFromCache = function (e3) { + for (let t3 = 0; t3 < o.length; t3++) { + const i3 = o[t3].ownedBy.indexOf(e3); + if (-1 !== i3) { + 1 === o[t3].ownedBy.length + ? (o[t3].atlas.dispose(), o.splice(t3, 1)) + : o[t3].ownedBy.splice(i3, 1); + break; + } + } + }); + }, + 197: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.is256Color = + t2.configEquals = + t2.generateConfig = + void 0); + const s2 = i2(160); + (t2.generateConfig = function (e3, t3, i3, r, o, n, a) { + const h = { + foreground: n.foreground, + background: n.background, + cursor: s2.NULL_COLOR, + cursorAccent: s2.NULL_COLOR, + selectionForeground: s2.NULL_COLOR, + selectionBackgroundTransparent: s2.NULL_COLOR, + selectionBackgroundOpaque: s2.NULL_COLOR, + selectionInactiveBackgroundTransparent: s2.NULL_COLOR, + selectionInactiveBackgroundOpaque: s2.NULL_COLOR, + ansi: n.ansi.slice(), + contrastCache: n.contrastCache, + halfContrastCache: n.halfContrastCache, + }; + return { + customGlyphs: o.customGlyphs, + devicePixelRatio: a, + letterSpacing: o.letterSpacing, + lineHeight: o.lineHeight, + deviceCellWidth: e3, + deviceCellHeight: t3, + deviceCharWidth: i3, + deviceCharHeight: r, + fontFamily: o.fontFamily, + fontSize: o.fontSize, + fontWeight: o.fontWeight, + fontWeightBold: o.fontWeightBold, + allowTransparency: o.allowTransparency, + drawBoldTextInBrightColors: o.drawBoldTextInBrightColors, + minimumContrastRatio: o.minimumContrastRatio, + colors: h, + }; + }), + (t2.configEquals = function (e3, t3) { + for (let i3 = 0; i3 < e3.colors.ansi.length; i3++) + if (e3.colors.ansi[i3].rgba !== t3.colors.ansi[i3].rgba) + return false; + return ( + e3.devicePixelRatio === t3.devicePixelRatio && + e3.customGlyphs === t3.customGlyphs && + e3.lineHeight === t3.lineHeight && + e3.letterSpacing === t3.letterSpacing && + e3.fontFamily === t3.fontFamily && + e3.fontSize === t3.fontSize && + e3.fontWeight === t3.fontWeight && + e3.fontWeightBold === t3.fontWeightBold && + e3.allowTransparency === t3.allowTransparency && + e3.deviceCharWidth === t3.deviceCharWidth && + e3.deviceCharHeight === t3.deviceCharHeight && + e3.drawBoldTextInBrightColors === + t3.drawBoldTextInBrightColors && + e3.minimumContrastRatio === t3.minimumContrastRatio && + e3.colors.foreground.rgba === + t3.colors.foreground.rgba && + e3.colors.background.rgba === t3.colors.background.rgba + ); + }), + (t2.is256Color = function (e3) { + return ( + 16777216 == (50331648 & e3) || + 33554432 == (50331648 & e3) + ); + }); + }, + 237: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TEXT_BASELINE = + t2.DIM_OPACITY = + t2.INVERTED_DEFAULT_COLOR = + void 0); + const s2 = i2(399); + (t2.INVERTED_DEFAULT_COLOR = 257), + (t2.DIM_OPACITY = 0.5), + (t2.TEXT_BASELINE = + s2.isFirefox || s2.isLegacyEdge + ? "bottom" + : "ideographic"); + }, + 457: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CursorBlinkStateManager = void 0); + t2.CursorBlinkStateManager = class { + constructor(e3, t3) { + (this._renderCallback = e3), + (this._coreBrowserService = t3), + (this.isCursorVisible = true), + this._coreBrowserService.isFocused && + this._restartInterval(); + } + get isPaused() { + return !(this._blinkStartTimeout || this._blinkInterval); + } + dispose() { + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + this._blinkStartTimeout && + (this._coreBrowserService.window.clearTimeout( + this._blinkStartTimeout + ), + (this._blinkStartTimeout = void 0)), + this._animationFrame && + (this._coreBrowserService.window.cancelAnimationFrame( + this._animationFrame + ), + (this._animationFrame = void 0)); + } + restartBlinkAnimation() { + this.isPaused || + ((this._animationTimeRestarted = Date.now()), + (this.isCursorVisible = true), + this._animationFrame || + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + ))); + } + _restartInterval(e3 = 600) { + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + (this._blinkStartTimeout = + this._coreBrowserService.window.setTimeout(() => { + if (this._animationTimeRestarted) { + const e4 = + 600 - + (Date.now() - this._animationTimeRestarted); + if ( + ((this._animationTimeRestarted = void 0), + e4 > 0) + ) + return void this._restartInterval(e4); + } + (this.isCursorVisible = false), + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + )), + (this._blinkInterval = + this._coreBrowserService.window.setInterval( + () => { + if (this._animationTimeRestarted) { + const e4 = + 600 - + (Date.now() - + this._animationTimeRestarted); + return ( + (this._animationTimeRestarted = void 0), + void this._restartInterval(e4) + ); + } + (this.isCursorVisible = + !this.isCursorVisible), + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + )); + }, + 600 + )); + }, e3)); + } + pause() { + (this.isCursorVisible = true), + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + this._blinkStartTimeout && + (this._coreBrowserService.window.clearTimeout( + this._blinkStartTimeout + ), + (this._blinkStartTimeout = void 0)), + this._animationFrame && + (this._coreBrowserService.window.cancelAnimationFrame( + this._animationFrame + ), + (this._animationFrame = void 0)); + } + resume() { + this.pause(), + (this._animationTimeRestarted = void 0), + this._restartInterval(), + this.restartBlinkAnimation(); + } + }; + }, + 860: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.tryDrawCustomChar = + t2.powerlineDefinitions = + t2.boxDrawingDefinitions = + t2.blockElementDefinitions = + void 0); + const s2 = i2(374); + t2.blockElementDefinitions = { + "\u2580": [{ x: 0, y: 0, w: 8, h: 4 }], + "\u2581": [{ x: 0, y: 7, w: 8, h: 1 }], + "\u2582": [{ x: 0, y: 6, w: 8, h: 2 }], + "\u2583": [{ x: 0, y: 5, w: 8, h: 3 }], + "\u2584": [{ x: 0, y: 4, w: 8, h: 4 }], + "\u2585": [{ x: 0, y: 3, w: 8, h: 5 }], + "\u2586": [{ x: 0, y: 2, w: 8, h: 6 }], + "\u2587": [{ x: 0, y: 1, w: 8, h: 7 }], + "\u2588": [{ x: 0, y: 0, w: 8, h: 8 }], + "\u2589": [{ x: 0, y: 0, w: 7, h: 8 }], + "\u258A": [{ x: 0, y: 0, w: 6, h: 8 }], + "\u258B": [{ x: 0, y: 0, w: 5, h: 8 }], + "\u258C": [{ x: 0, y: 0, w: 4, h: 8 }], + "\u258D": [{ x: 0, y: 0, w: 3, h: 8 }], + "\u258E": [{ x: 0, y: 0, w: 2, h: 8 }], + "\u258F": [{ x: 0, y: 0, w: 1, h: 8 }], + "\u2590": [{ x: 4, y: 0, w: 4, h: 8 }], + "\u2594": [{ x: 0, y: 0, w: 8, h: 1 }], + "\u2595": [{ x: 7, y: 0, w: 1, h: 8 }], + "\u2596": [{ x: 0, y: 4, w: 4, h: 4 }], + "\u2597": [{ x: 4, y: 4, w: 4, h: 4 }], + "\u2598": [{ x: 0, y: 0, w: 4, h: 4 }], + "\u2599": [ + { x: 0, y: 0, w: 4, h: 8 }, + { x: 0, y: 4, w: 8, h: 4 }, + ], + "\u259A": [ + { x: 0, y: 0, w: 4, h: 4 }, + { x: 4, y: 4, w: 4, h: 4 }, + ], + "\u259B": [ + { x: 0, y: 0, w: 4, h: 8 }, + { x: 4, y: 0, w: 4, h: 4 }, + ], + "\u259C": [ + { x: 0, y: 0, w: 8, h: 4 }, + { x: 4, y: 0, w: 4, h: 8 }, + ], + "\u259D": [{ x: 4, y: 0, w: 4, h: 4 }], + "\u259E": [ + { x: 4, y: 0, w: 4, h: 4 }, + { x: 0, y: 4, w: 4, h: 4 }, + ], + "\u259F": [ + { x: 4, y: 0, w: 4, h: 8 }, + { x: 0, y: 4, w: 8, h: 4 }, + ], + "\u{1FB70}": [{ x: 1, y: 0, w: 1, h: 8 }], + "\u{1FB71}": [{ x: 2, y: 0, w: 1, h: 8 }], + "\u{1FB72}": [{ x: 3, y: 0, w: 1, h: 8 }], + "\u{1FB73}": [{ x: 4, y: 0, w: 1, h: 8 }], + "\u{1FB74}": [{ x: 5, y: 0, w: 1, h: 8 }], + "\u{1FB75}": [{ x: 6, y: 0, w: 1, h: 8 }], + "\u{1FB76}": [{ x: 0, y: 1, w: 8, h: 1 }], + "\u{1FB77}": [{ x: 0, y: 2, w: 8, h: 1 }], + "\u{1FB78}": [{ x: 0, y: 3, w: 8, h: 1 }], + "\u{1FB79}": [{ x: 0, y: 4, w: 8, h: 1 }], + "\u{1FB7A}": [{ x: 0, y: 5, w: 8, h: 1 }], + "\u{1FB7B}": [{ x: 0, y: 6, w: 8, h: 1 }], + "\u{1FB7C}": [ + { x: 0, y: 0, w: 1, h: 8 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB7D}": [ + { x: 0, y: 0, w: 1, h: 8 }, + { x: 0, y: 0, w: 8, h: 1 }, + ], + "\u{1FB7E}": [ + { x: 7, y: 0, w: 1, h: 8 }, + { x: 0, y: 0, w: 8, h: 1 }, + ], + "\u{1FB7F}": [ + { x: 7, y: 0, w: 1, h: 8 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB80}": [ + { x: 0, y: 0, w: 8, h: 1 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB81}": [ + { x: 0, y: 0, w: 8, h: 1 }, + { x: 0, y: 2, w: 8, h: 1 }, + { x: 0, y: 4, w: 8, h: 1 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB82}": [{ x: 0, y: 0, w: 8, h: 2 }], + "\u{1FB83}": [{ x: 0, y: 0, w: 8, h: 3 }], + "\u{1FB84}": [{ x: 0, y: 0, w: 8, h: 5 }], + "\u{1FB85}": [{ x: 0, y: 0, w: 8, h: 6 }], + "\u{1FB86}": [{ x: 0, y: 0, w: 8, h: 7 }], + "\u{1FB87}": [{ x: 6, y: 0, w: 2, h: 8 }], + "\u{1FB88}": [{ x: 5, y: 0, w: 3, h: 8 }], + "\u{1FB89}": [{ x: 3, y: 0, w: 5, h: 8 }], + "\u{1FB8A}": [{ x: 2, y: 0, w: 6, h: 8 }], + "\u{1FB8B}": [{ x: 1, y: 0, w: 7, h: 8 }], + "\u{1FB95}": [ + { x: 0, y: 0, w: 2, h: 2 }, + { x: 4, y: 0, w: 2, h: 2 }, + { x: 2, y: 2, w: 2, h: 2 }, + { x: 6, y: 2, w: 2, h: 2 }, + { x: 0, y: 4, w: 2, h: 2 }, + { x: 4, y: 4, w: 2, h: 2 }, + { x: 2, y: 6, w: 2, h: 2 }, + { x: 6, y: 6, w: 2, h: 2 }, + ], + "\u{1FB96}": [ + { x: 2, y: 0, w: 2, h: 2 }, + { x: 6, y: 0, w: 2, h: 2 }, + { x: 0, y: 2, w: 2, h: 2 }, + { x: 4, y: 2, w: 2, h: 2 }, + { x: 2, y: 4, w: 2, h: 2 }, + { x: 6, y: 4, w: 2, h: 2 }, + { x: 0, y: 6, w: 2, h: 2 }, + { x: 4, y: 6, w: 2, h: 2 }, + ], + "\u{1FB97}": [ + { x: 0, y: 2, w: 8, h: 2 }, + { x: 0, y: 6, w: 8, h: 2 }, + ], + }; + const r = { + "\u2591": [ + [1, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 1, 0], + [0, 0, 0, 0], + ], + "\u2592": [ + [1, 0], + [0, 0], + [0, 1], + [0, 0], + ], + "\u2593": [ + [0, 1], + [1, 1], + [1, 0], + [1, 1], + ], + }; + (t2.boxDrawingDefinitions = { + "\u2500": { 1: "M0,.5 L1,.5" }, + "\u2501": { 3: "M0,.5 L1,.5" }, + "\u2502": { 1: "M.5,0 L.5,1" }, + "\u2503": { 3: "M.5,0 L.5,1" }, + "\u250C": { 1: "M0.5,1 L.5,.5 L1,.5" }, + "\u250F": { 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2510": { 1: "M0,.5 L.5,.5 L.5,1" }, + "\u2513": { 3: "M0,.5 L.5,.5 L.5,1" }, + "\u2514": { 1: "M.5,0 L.5,.5 L1,.5" }, + "\u2517": { 3: "M.5,0 L.5,.5 L1,.5" }, + "\u2518": { 1: "M.5,0 L.5,.5 L0,.5" }, + "\u251B": { 3: "M.5,0 L.5,.5 L0,.5" }, + "\u251C": { 1: "M.5,0 L.5,1 M.5,.5 L1,.5" }, + "\u2523": { 3: "M.5,0 L.5,1 M.5,.5 L1,.5" }, + "\u2524": { 1: "M.5,0 L.5,1 M.5,.5 L0,.5" }, + "\u252B": { 3: "M.5,0 L.5,1 M.5,.5 L0,.5" }, + "\u252C": { 1: "M0,.5 L1,.5 M.5,.5 L.5,1" }, + "\u2533": { 3: "M0,.5 L1,.5 M.5,.5 L.5,1" }, + "\u2534": { 1: "M0,.5 L1,.5 M.5,.5 L.5,0" }, + "\u253B": { 3: "M0,.5 L1,.5 M.5,.5 L.5,0" }, + "\u253C": { 1: "M0,.5 L1,.5 M.5,0 L.5,1" }, + "\u254B": { 3: "M0,.5 L1,.5 M.5,0 L.5,1" }, + "\u2574": { 1: "M.5,.5 L0,.5" }, + "\u2578": { 3: "M.5,.5 L0,.5" }, + "\u2575": { 1: "M.5,.5 L.5,0" }, + "\u2579": { 3: "M.5,.5 L.5,0" }, + "\u2576": { 1: "M.5,.5 L1,.5" }, + "\u257A": { 3: "M.5,.5 L1,.5" }, + "\u2577": { 1: "M.5,.5 L.5,1" }, + "\u257B": { 3: "M.5,.5 L.5,1" }, + "\u2550": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2551": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u2552": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 - t3} L1,${0.5 - t3} M.5,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2553": { + 1: (e3, t3) => + `M${0.5 - e3},1 L${0.5 - e3},.5 L1,.5 M${0.5 + e3},.5 L${0.5 + e3},1`, + }, + "\u2554": { + 1: (e3, t3) => + `M1,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1`, + }, + "\u2555": { + 1: (e3, t3) => + `M0,${0.5 - t3} L.5,${0.5 - t3} L.5,1 M0,${0.5 + t3} L.5,${0.5 + t3}`, + }, + "\u2556": { + 1: (e3, t3) => + `M${0.5 + e3},1 L${0.5 + e3},.5 L0,.5 M${0.5 - e3},.5 L${0.5 - e3},1`, + }, + "\u2557": { + 1: (e3, t3) => + `M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M0,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},1`, + }, + "\u2558": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 + t3} L1,${0.5 + t3} M.5,${0.5 - t3} L1,${0.5 - t3}`, + }, + "\u2559": { + 1: (e3, t3) => + `M1,.5 L${0.5 - e3},.5 L${0.5 - e3},0 M${0.5 + e3},.5 L${0.5 + e3},0`, + }, + "\u255A": { + 1: (e3, t3) => + `M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0 M1,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},0`, + }, + "\u255B": { + 1: (e3, t3) => + `M0,${0.5 + t3} L.5,${0.5 + t3} L.5,0 M0,${0.5 - t3} L.5,${0.5 - t3}`, + }, + "\u255C": { + 1: (e3, t3) => + `M0,.5 L${0.5 + e3},.5 L${0.5 + e3},0 M${0.5 - e3},.5 L${0.5 - e3},0`, + }, + "\u255D": { + 1: (e3, t3) => + `M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M0,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},0`, + }, + "\u255E": { + 1: (e3, t3) => + `M.5,0 L.5,1 M.5,${0.5 - t3} L1,${0.5 - t3} M.5,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u255F": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1 M${0.5 + e3},.5 L1,.5`, + }, + "\u2560": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u2561": { + 1: (e3, t3) => + `M.5,0 L.5,1 M0,${0.5 - t3} L.5,${0.5 - t3} M0,${0.5 + t3} L.5,${0.5 + t3}`, + }, + "\u2562": { + 1: (e3, t3) => + `M0,.5 L${0.5 - e3},.5 M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u2563": { + 1: (e3, t3) => + `M${0.5 + e3},0 L${0.5 + e3},1 M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0`, + }, + "\u2564": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3} M.5,${0.5 + t3} L.5,1`, + }, + "\u2565": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},.5 L${0.5 - e3},1 M${0.5 + e3},.5 L${0.5 + e3},1`, + }, + "\u2566": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1`, + }, + "\u2567": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - t3} M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2568": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},.5 L${0.5 - e3},0 M${0.5 + e3},.5 L${0.5 + e3},0`, + }, + "\u2569": { + 1: (e3, t3) => + `M0,${0.5 + t3} L1,${0.5 + t3} M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u256A": { + 1: (e3, t3) => + `M.5,0 L.5,1 M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u256B": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u256C": { + 1: (e3, t3) => + `M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1 M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u2571": { 1: "M1,0 L0,1" }, + "\u2572": { 1: "M0,0 L1,1" }, + "\u2573": { 1: "M1,0 L0,1 M0,0 L1,1" }, + "\u257C": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L1,.5" }, + "\u257D": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L.5,1" }, + "\u257E": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u257F": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L.5,0" }, + "\u250D": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u250E": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2511": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L0,.5" }, + "\u2512": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L.5,1" }, + "\u2515": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L1,.5" }, + "\u2516": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u2519": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L0,.5" }, + "\u251A": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L.5,0" }, + "\u251D": { 1: "M.5,0 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u251E": { 1: "M0.5,1 L.5,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u251F": { 1: "M.5,0 L.5,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2520": { 1: "M.5,.5 L1,.5", 3: "M.5,0 L.5,1" }, + "\u2521": { 1: "M.5,.5 L.5,1", 3: "M.5,0 L.5,.5 L1,.5" }, + "\u2522": { 1: "M.5,.5 L.5,0", 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2525": { 1: "M.5,0 L.5,1", 3: "M.5,.5 L0,.5" }, + "\u2526": { 1: "M0,.5 L.5,.5 L.5,1", 3: "M.5,.5 L.5,0" }, + "\u2527": { 1: "M.5,0 L.5,.5 L0,.5", 3: "M.5,.5 L.5,1" }, + "\u2528": { 1: "M.5,.5 L0,.5", 3: "M.5,0 L.5,1" }, + "\u2529": { 1: "M.5,.5 L.5,1", 3: "M.5,0 L.5,.5 L0,.5" }, + "\u252A": { 1: "M.5,.5 L.5,0", 3: "M0,.5 L.5,.5 L.5,1" }, + "\u252D": { 1: "M0.5,1 L.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u252E": { 1: "M0,.5 L.5,.5 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u252F": { 1: "M.5,.5 L.5,1", 3: "M0,.5 L1,.5" }, + "\u2530": { 1: "M0,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2531": { 1: "M.5,.5 L1,.5", 3: "M0,.5 L.5,.5 L.5,1" }, + "\u2532": { 1: "M.5,.5 L0,.5", 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2535": { 1: "M.5,0 L.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u2536": { 1: "M.5,0 L.5,.5 L0,.5", 3: "M.5,.5 L1,.5" }, + "\u2537": { 1: "M.5,.5 L.5,0", 3: "M0,.5 L1,.5" }, + "\u2538": { 1: "M0,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u2539": { 1: "M.5,.5 L1,.5", 3: "M.5,0 L.5,.5 L0,.5" }, + "\u253A": { 1: "M.5,.5 L0,.5", 3: "M.5,0 L.5,.5 L1,.5" }, + "\u253D": { + 1: "M.5,0 L.5,1 M.5,.5 L1,.5", + 3: "M.5,.5 L0,.5", + }, + "\u253E": { + 1: "M.5,0 L.5,1 M.5,.5 L0,.5", + 3: "M.5,.5 L1,.5", + }, + "\u253F": { 1: "M.5,0 L.5,1", 3: "M0,.5 L1,.5" }, + "\u2540": { + 1: "M0,.5 L1,.5 M.5,.5 L.5,1", + 3: "M.5,.5 L.5,0", + }, + "\u2541": { + 1: "M.5,.5 L.5,0 M0,.5 L1,.5", + 3: "M.5,.5 L.5,1", + }, + "\u2542": { 1: "M0,.5 L1,.5", 3: "M.5,0 L.5,1" }, + "\u2543": { + 1: "M0.5,1 L.5,.5 L1,.5", + 3: "M.5,0 L.5,.5 L0,.5", + }, + "\u2544": { + 1: "M0,.5 L.5,.5 L.5,1", + 3: "M.5,0 L.5,.5 L1,.5", + }, + "\u2545": { + 1: "M.5,0 L.5,.5 L1,.5", + 3: "M0,.5 L.5,.5 L.5,1", + }, + "\u2546": { + 1: "M.5,0 L.5,.5 L0,.5", + 3: "M0.5,1 L.5,.5 L1,.5", + }, + "\u2547": { + 1: "M.5,.5 L.5,1", + 3: "M.5,.5 L.5,0 M0,.5 L1,.5", + }, + "\u2548": { + 1: "M.5,.5 L.5,0", + 3: "M0,.5 L1,.5 M.5,.5 L.5,1", + }, + "\u2549": { + 1: "M.5,.5 L1,.5", + 3: "M.5,0 L.5,1 M.5,.5 L0,.5", + }, + "\u254A": { + 1: "M.5,.5 L0,.5", + 3: "M.5,0 L.5,1 M.5,.5 L1,.5", + }, + "\u254C": { 1: "M.1,.5 L.4,.5 M.6,.5 L.9,.5" }, + "\u254D": { 3: "M.1,.5 L.4,.5 M.6,.5 L.9,.5" }, + "\u2504": { + 1: "M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5", + }, + "\u2505": { + 3: "M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5", + }, + "\u2508": { + 1: "M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5", + }, + "\u2509": { + 3: "M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5", + }, + "\u254E": { 1: "M.5,.1 L.5,.4 M.5,.6 L.5,.9" }, + "\u254F": { 3: "M.5,.1 L.5,.4 M.5,.6 L.5,.9" }, + "\u2506": { + 1: "M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333", + }, + "\u2507": { + 3: "M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333", + }, + "\u250A": { + 1: "M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95", + }, + "\u250B": { + 3: "M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95", + }, + "\u256D": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 + (t3 / 0.15) * 0.5} C.5,${0.5 + (t3 / 0.15) * 0.5},.5,.5,1,.5`, + }, + "\u256E": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 + (t3 / 0.15) * 0.5} C.5,${0.5 + (t3 / 0.15) * 0.5},.5,.5,0,.5`, + }, + "\u256F": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - (t3 / 0.15) * 0.5} C.5,${0.5 - (t3 / 0.15) * 0.5},.5,.5,0,.5`, + }, + "\u2570": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - (t3 / 0.15) * 0.5} C.5,${0.5 - (t3 / 0.15) * 0.5},.5,.5,1,.5`, + }, + }), + (t2.powerlineDefinitions = { + "\uE0B0": { + d: "M0,0 L1,.5 L0,1", + type: 0, + rightPadding: 2, + }, + "\uE0B1": { + d: "M-1,-.5 L1,.5 L-1,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0B2": { + d: "M1,0 L0,.5 L1,1", + type: 0, + leftPadding: 2, + }, + "\uE0B3": { + d: "M2,-.5 L0,.5 L2,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0B4": { + d: "M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0", + type: 0, + rightPadding: 1, + }, + "\uE0B5": { + d: "M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0", + type: 1, + rightPadding: 1, + }, + "\uE0B6": { + d: "M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0", + type: 0, + leftPadding: 1, + }, + "\uE0B7": { + d: "M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0", + type: 1, + leftPadding: 1, + }, + "\uE0B8": { d: "M-.5,-.5 L1.5,1.5 L-.5,1.5", type: 0 }, + "\uE0B9": { + d: "M-.5,-.5 L1.5,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0BA": { d: "M1.5,-.5 L-.5,1.5 L1.5,1.5", type: 0 }, + "\uE0BC": { d: "M1.5,-.5 L-.5,1.5 L-.5,-.5", type: 0 }, + "\uE0BD": { + d: "M1.5,-.5 L-.5,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0BE": { d: "M-.5,-.5 L1.5,1.5 L1.5,-.5", type: 0 }, + }), + (t2.powerlineDefinitions["\uE0BB"] = + t2.powerlineDefinitions["\uE0BD"]), + (t2.powerlineDefinitions["\uE0BF"] = + t2.powerlineDefinitions["\uE0B9"]), + (t2.tryDrawCustomChar = function ( + e3, + i3, + n2, + l, + c, + d, + _, + u + ) { + const g = t2.blockElementDefinitions[i3]; + if (g) + return ( + (function (e4, t3, i4, s3, r2, o2) { + for (let n3 = 0; n3 < t3.length; n3++) { + const a2 = t3[n3], + h2 = r2 / 8, + l2 = o2 / 8; + e4.fillRect( + i4 + a2.x * h2, + s3 + a2.y * l2, + a2.w * h2, + a2.h * l2 + ); + } + })(e3, g, n2, l, c, d), + true + ); + const v = r[i3]; + if (v) + return ( + (function (e4, t3, i4, r2, n3, a2) { + let h2 = o.get(t3); + h2 || + ((h2 = /* @__PURE__ */ new Map()), o.set(t3, h2)); + const l2 = e4.fillStyle; + if ("string" != typeof l2) + throw new Error( + `Unexpected fillStyle type "${l2}"` + ); + let c2 = h2.get(l2); + if (!c2) { + const i5 = t3[0].length, + r3 = t3.length, + o2 = + e4.canvas.ownerDocument.createElement( + "canvas" + ); + (o2.width = i5), (o2.height = r3); + const n4 = (0, s2.throwIfFalsy)( + o2.getContext("2d") + ), + a3 = new ImageData(i5, r3); + let d2, _2, u2, g2; + if (l2.startsWith("#")) + (d2 = parseInt(l2.slice(1, 3), 16)), + (_2 = parseInt(l2.slice(3, 5), 16)), + (u2 = parseInt(l2.slice(5, 7), 16)), + (g2 = + (l2.length > 7 && + parseInt(l2.slice(7, 9), 16)) || + 1); + else { + if (!l2.startsWith("rgba")) + throw new Error( + `Unexpected fillStyle color format "${l2}" when drawing pattern glyph` + ); + [d2, _2, u2, g2] = l2 + .substring(5, l2.length - 1) + .split(",") + .map((e5) => parseFloat(e5)); + } + for (let e5 = 0; e5 < r3; e5++) + for (let s3 = 0; s3 < i5; s3++) + (a3.data[4 * (e5 * i5 + s3)] = d2), + (a3.data[4 * (e5 * i5 + s3) + 1] = _2), + (a3.data[4 * (e5 * i5 + s3) + 2] = u2), + (a3.data[4 * (e5 * i5 + s3) + 3] = + t3[e5][s3] * (255 * g2)); + n4.putImageData(a3, 0, 0), + (c2 = (0, s2.throwIfFalsy)( + e4.createPattern(o2, null) + )), + h2.set(l2, c2); + } + (e4.fillStyle = c2), e4.fillRect(i4, r2, n3, a2); + })(e3, v, n2, l, c, d), + true + ); + const f = t2.boxDrawingDefinitions[i3]; + if (f) + return ( + (function (e4, t3, i4, s3, r2, o2, n3) { + e4.strokeStyle = e4.fillStyle; + for (const [l2, c2] of Object.entries(t3)) { + let t4; + e4.beginPath(), + (e4.lineWidth = n3 * Number.parseInt(l2)), + (t4 = + "function" == typeof c2 + ? c2(0.15, (0.15 / o2) * r2) + : c2); + for (const l3 of t4.split(" ")) { + const t5 = l3[0], + c3 = a[t5]; + if (!c3) { + console.error( + `Could not find drawing instructions for "${t5}"` + ); + continue; + } + const d2 = l3.substring(1).split(","); + d2[0] && + d2[1] && + c3(e4, h(d2, r2, o2, i4, s3, true, n3)); + } + e4.stroke(), e4.closePath(); + } + })(e3, f, n2, l, c, d, u), + true + ); + const p = t2.powerlineDefinitions[i3]; + return ( + !!p && + ((function (e4, t3, i4, s3, r2, o2, n3, l2) { + const c2 = new Path2D(); + c2.rect(i4, s3, r2, o2), e4.clip(c2), e4.beginPath(); + const d2 = n3 / 12; + e4.lineWidth = l2 * d2; + for (const n4 of t3.d.split(" ")) { + const c3 = n4[0], + _2 = a[c3]; + if (!_2) { + console.error( + `Could not find drawing instructions for "${c3}"` + ); + continue; + } + const u2 = n4.substring(1).split(","); + u2[0] && + u2[1] && + _2( + e4, + h( + u2, + r2, + o2, + i4, + s3, + false, + l2, + (t3.leftPadding ?? 0) * (d2 / 2), + (t3.rightPadding ?? 0) * (d2 / 2) + ) + ); + } + 1 === t3.type + ? ((e4.strokeStyle = e4.fillStyle), e4.stroke()) + : e4.fill(), + e4.closePath(); + })(e3, p, n2, l, c, d, _, u), + true) + ); + }); + const o = /* @__PURE__ */ new Map(); + function n(e3, t3, i3 = 0) { + return Math.max(Math.min(e3, t3), i3); + } + const a = { + C: (e3, t3) => + e3.bezierCurveTo( + t3[0], + t3[1], + t3[2], + t3[3], + t3[4], + t3[5] + ), + L: (e3, t3) => e3.lineTo(t3[0], t3[1]), + M: (e3, t3) => e3.moveTo(t3[0], t3[1]), + }; + function h(e3, t3, i3, s3, r2, o2, a2, h2 = 0, l = 0) { + const c = e3.map((e4) => parseFloat(e4) || parseInt(e4)); + if (c.length < 2) + throw new Error("Too few arguments for instruction"); + for (let e4 = 0; e4 < c.length; e4 += 2) + (c[e4] *= t3 - h2 * a2 - l * a2), + o2 && + 0 !== c[e4] && + (c[e4] = n(Math.round(c[e4] + 0.5) - 0.5, t3, 0)), + (c[e4] += s3 + h2 * a2); + for (let e4 = 1; e4 < c.length; e4 += 2) + (c[e4] *= i3), + o2 && + 0 !== c[e4] && + (c[e4] = n(Math.round(c[e4] + 0.5) - 0.5, i3, 0)), + (c[e4] += r2); + return c; + } + }, + 56: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.observeDevicePixelDimensions = void 0); + const s2 = i2(859); + t2.observeDevicePixelDimensions = function (e3, t3, i3) { + let r = new t3.ResizeObserver((t4) => { + const s3 = t4.find((t5) => t5.target === e3); + if (!s3) return; + if (!("devicePixelContentBoxSize" in s3)) + return r?.disconnect(), void (r = void 0); + const o = s3.devicePixelContentBoxSize[0].inlineSize, + n = s3.devicePixelContentBoxSize[0].blockSize; + o > 0 && n > 0 && i3(o, n); + }); + try { + r.observe(e3, { box: ["device-pixel-content-box"] }); + } catch { + r.disconnect(), (r = void 0); + } + return (0, s2.toDisposable)(() => r?.disconnect()); + }; + }, + 374: (e2, t2) => { + function i2(e3) { + return 57508 <= e3 && e3 <= 57558; + } + function s2(e3) { + return ( + (e3 >= 128512 && e3 <= 128591) || + (e3 >= 127744 && e3 <= 128511) || + (e3 >= 128640 && e3 <= 128767) || + (e3 >= 9728 && e3 <= 9983) || + (e3 >= 9984 && e3 <= 10175) || + (e3 >= 65024 && e3 <= 65039) || + (e3 >= 129280 && e3 <= 129535) || + (e3 >= 127462 && e3 <= 127487) + ); + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.computeNextVariantOffset = + t2.createRenderDimensions = + t2.treatGlyphAsBackgroundColor = + t2.allowRescaling = + t2.isEmoji = + t2.isRestrictedPowerlineGlyph = + t2.isPowerlineGlyph = + t2.throwIfFalsy = + void 0), + (t2.throwIfFalsy = function (e3) { + if (!e3) throw new Error("value must not be falsy"); + return e3; + }), + (t2.isPowerlineGlyph = i2), + (t2.isRestrictedPowerlineGlyph = function (e3) { + return 57520 <= e3 && e3 <= 57527; + }), + (t2.isEmoji = s2), + (t2.allowRescaling = function (e3, t3, r, o) { + return ( + 1 === t3 && + r > Math.ceil(1.5 * o) && + void 0 !== e3 && + e3 > 255 && + !s2(e3) && + !i2(e3) && + !(function (e4) { + return 57344 <= e4 && e4 <= 63743; + })(e3) + ); + }), + (t2.treatGlyphAsBackgroundColor = function (e3) { + return ( + i2(e3) || + (function (e4) { + return 9472 <= e4 && e4 <= 9631; + })(e3) + ); + }), + (t2.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 }, + }, + }; + }), + (t2.computeNextVariantOffset = function (e3, t3, i3 = 0) { + return ( + (e3 - (2 * Math.round(t3) - i3)) % (2 * Math.round(t3)) + ); + }); + }, + 296: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createSelectionRenderModel = void 0); + class i2 { + constructor() { + this.clear(); + } + clear() { + (this.hasSelection = false), + (this.columnSelectMode = false), + (this.viewportStartRow = 0), + (this.viewportEndRow = 0), + (this.viewportCappedStartRow = 0), + (this.viewportCappedEndRow = 0), + (this.startCol = 0), + (this.endCol = 0), + (this.selectionStart = void 0), + (this.selectionEnd = void 0); + } + update(e3, t3, i3, s2 = false) { + if ( + ((this.selectionStart = t3), + (this.selectionEnd = i3), + !t3 || !i3 || (t3[0] === i3[0] && t3[1] === i3[1])) + ) + return void this.clear(); + const r = e3.buffers.active.ydisp, + o = t3[1] - r, + n = i3[1] - r, + a = Math.max(o, 0), + h = Math.min(n, e3.rows - 1); + a >= e3.rows || h < 0 + ? this.clear() + : ((this.hasSelection = true), + (this.columnSelectMode = s2), + (this.viewportStartRow = o), + (this.viewportEndRow = n), + (this.viewportCappedStartRow = a), + (this.viewportCappedEndRow = h), + (this.startCol = t3[0]), + (this.endCol = i3[0])); + } + isCellSelected(e3, t3, i3) { + return ( + !!this.hasSelection && + ((i3 -= e3.buffer.active.viewportY), + this.columnSelectMode + ? this.startCol <= this.endCol + ? t3 >= this.startCol && + i3 >= this.viewportCappedStartRow && + t3 < this.endCol && + i3 <= this.viewportCappedEndRow + : t3 < this.startCol && + i3 >= this.viewportCappedStartRow && + t3 >= this.endCol && + i3 <= this.viewportCappedEndRow + : (i3 > this.viewportStartRow && + i3 < this.viewportEndRow) || + (this.viewportStartRow === this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportEndRow && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol)) + ); + } + } + t2.createSelectionRenderModel = function () { + return new i2(); + }; + }, + 509: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TextureAtlas = void 0); + const s2 = i2(237), + r = i2(860), + o = i2(374), + n = i2(160), + a = i2(345), + h = i2(485), + l = i2(385), + c = i2(147), + d = i2(855), + _ = { + texturePage: 0, + texturePosition: { x: 0, y: 0 }, + texturePositionClipSpace: { x: 0, y: 0 }, + offset: { x: 0, y: 0 }, + size: { x: 0, y: 0 }, + sizeClipSpace: { x: 0, y: 0 }, + }; + let u; + class g { + get pages() { + return this._pages; + } + constructor(e3, t3, i3) { + (this._document = e3), + (this._config = t3), + (this._unicodeService = i3), + (this._didWarmUp = false), + (this._cacheMap = new h.FourKeyMap()), + (this._cacheMapCombined = new h.FourKeyMap()), + (this._pages = []), + (this._activePages = []), + (this._workBoundingBox = { + top: 0, + left: 0, + bottom: 0, + right: 0, + }), + (this._workAttributeData = new c.AttributeData()), + (this._textureSize = 512), + (this._onAddTextureAtlasCanvas = new a.EventEmitter()), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event), + (this._onRemoveTextureAtlasCanvas = + new a.EventEmitter()), + (this.onRemoveTextureAtlasCanvas = + this._onRemoveTextureAtlasCanvas.event), + (this._requestClearModel = false), + this._createNewPage(), + (this._tmpCanvas = p( + e3, + 4 * this._config.deviceCellWidth + 4, + this._config.deviceCellHeight + 4 + )), + (this._tmpCtx = (0, o.throwIfFalsy)( + this._tmpCanvas.getContext("2d", { + alpha: this._config.allowTransparency, + willReadFrequently: true, + }) + )); + } + dispose() { + for (const e3 of this.pages) e3.canvas.remove(); + this._onAddTextureAtlasCanvas.dispose(); + } + warmUp() { + this._didWarmUp || + (this._doWarmUp(), (this._didWarmUp = true)); + } + _doWarmUp() { + const e3 = new l.IdleTaskQueue(); + for (let t3 = 33; t3 < 126; t3++) + e3.enqueue(() => { + if ( + !this._cacheMap.get( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT + ) + ) { + const e4 = this._drawToCache( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT + ); + this._cacheMap.set( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT, + e4 + ); + } + }); + } + beginFrame() { + return this._requestClearModel; + } + clearTexture() { + if ( + 0 !== this._pages[0].currentRow.x || + 0 !== this._pages[0].currentRow.y + ) { + for (const e3 of this._pages) e3.clear(); + this._cacheMap.clear(), + this._cacheMapCombined.clear(), + (this._didWarmUp = false); + } + } + _createNewPage() { + if ( + g.maxAtlasPages && + this._pages.length >= Math.max(4, g.maxAtlasPages) + ) { + const e4 = this._pages + .filter( + (e5) => + 2 * e5.canvas.width <= (g.maxTextureSize || 4096) + ) + .sort((e5, t4) => + t4.canvas.width !== e5.canvas.width + ? t4.canvas.width - e5.canvas.width + : t4.percentageUsed - e5.percentageUsed + ); + let t3 = -1, + i3 = 0; + for (let s4 = 0; s4 < e4.length; s4++) + if (e4[s4].canvas.width !== i3) + (t3 = s4), (i3 = e4[s4].canvas.width); + else if (s4 - t3 == 3) break; + const s3 = e4.slice(t3, t3 + 4), + r2 = s3 + .map((e5) => e5.glyphs[0].texturePage) + .sort((e5, t4) => (e5 > t4 ? 1 : -1)), + o2 = this.pages.length - s3.length, + n2 = this._mergePages(s3, o2); + n2.version++; + for (let e5 = r2.length - 1; e5 >= 0; e5--) + this._deletePage(r2[e5]); + this.pages.push(n2), + (this._requestClearModel = true), + this._onAddTextureAtlasCanvas.fire(n2.canvas); + } + const e3 = new v(this._document, this._textureSize); + return ( + this._pages.push(e3), + this._activePages.push(e3), + this._onAddTextureAtlasCanvas.fire(e3.canvas), + e3 + ); + } + _mergePages(e3, t3) { + const i3 = 2 * e3[0].canvas.width, + s3 = new v(this._document, i3, e3); + for (const [r2, o2] of e3.entries()) { + const e4 = (r2 * o2.canvas.width) % i3, + n2 = Math.floor(r2 / 2) * o2.canvas.height; + s3.ctx.drawImage(o2.canvas, e4, n2); + for (const s4 of o2.glyphs) + (s4.texturePage = t3), + (s4.sizeClipSpace.x = s4.size.x / i3), + (s4.sizeClipSpace.y = s4.size.y / i3), + (s4.texturePosition.x += e4), + (s4.texturePosition.y += n2), + (s4.texturePositionClipSpace.x = + s4.texturePosition.x / i3), + (s4.texturePositionClipSpace.y = + s4.texturePosition.y / i3); + this._onRemoveTextureAtlasCanvas.fire(o2.canvas); + const a2 = this._activePages.indexOf(o2); + -1 !== a2 && this._activePages.splice(a2, 1); + } + return s3; + } + _deletePage(e3) { + this._pages.splice(e3, 1); + for (let t3 = e3; t3 < this._pages.length; t3++) { + const e4 = this._pages[t3]; + for (const t4 of e4.glyphs) t4.texturePage--; + e4.version++; + } + } + getRasterizedGlyphCombinedChar(e3, t3, i3, s3, r2) { + return this._getFromCacheMap( + this._cacheMapCombined, + e3, + t3, + i3, + s3, + r2 + ); + } + getRasterizedGlyph(e3, t3, i3, s3, r2) { + return this._getFromCacheMap( + this._cacheMap, + e3, + t3, + i3, + s3, + r2 + ); + } + _getFromCacheMap(e3, t3, i3, s3, r2, o2 = false) { + return ( + (u = e3.get(t3, i3, s3, r2)), + u || + ((u = this._drawToCache(t3, i3, s3, r2, o2)), + e3.set(t3, i3, s3, r2, u)), + u + ); + } + _getColorFromAnsiIndex(e3) { + if (e3 >= this._config.colors.ansi.length) + throw new Error("No color found for idx " + e3); + return this._config.colors.ansi[e3]; + } + _getBackgroundColor(e3, t3, i3, s3) { + if (this._config.allowTransparency) return n.NULL_COLOR; + let r2; + switch (e3) { + case 16777216: + case 33554432: + r2 = this._getColorFromAnsiIndex(t3); + break; + case 50331648: + const e4 = c.AttributeData.toColorRGB(t3); + r2 = n.channels.toColor(e4[0], e4[1], e4[2]); + break; + default: + r2 = i3 + ? n.color.opaque(this._config.colors.foreground) + : this._config.colors.background; + } + return r2; + } + _getForegroundColor( + e3, + t3, + i3, + r2, + o2, + a2, + h2, + l2, + d2, + _2 + ) { + const u2 = this._getMinimumContrastColor( + e3, + t3, + i3, + r2, + o2, + a2, + h2, + d2, + l2, + _2 + ); + if (u2) return u2; + let g2; + switch (o2) { + case 16777216: + case 33554432: + this._config.drawBoldTextInBrightColors && + d2 && + a2 < 8 && + (a2 += 8), + (g2 = this._getColorFromAnsiIndex(a2)); + break; + case 50331648: + const e4 = c.AttributeData.toColorRGB(a2); + g2 = n.channels.toColor(e4[0], e4[1], e4[2]); + break; + default: + g2 = h2 + ? this._config.colors.background + : this._config.colors.foreground; + } + return ( + this._config.allowTransparency && + (g2 = n.color.opaque(g2)), + l2 && + (g2 = n.color.multiplyOpacity(g2, s2.DIM_OPACITY)), + g2 + ); + } + _resolveBackgroundRgba(e3, t3, i3) { + switch (e3) { + case 16777216: + case 33554432: + return this._getColorFromAnsiIndex(t3).rgba; + case 50331648: + return t3 << 8; + default: + return i3 + ? this._config.colors.foreground.rgba + : this._config.colors.background.rgba; + } + } + _resolveForegroundRgba(e3, t3, i3, s3) { + switch (e3) { + case 16777216: + case 33554432: + return ( + this._config.drawBoldTextInBrightColors && + s3 && + t3 < 8 && + (t3 += 8), + this._getColorFromAnsiIndex(t3).rgba + ); + case 50331648: + return t3 << 8; + default: + return i3 + ? this._config.colors.background.rgba + : this._config.colors.foreground.rgba; + } + } + _getMinimumContrastColor( + e3, + t3, + i3, + s3, + r2, + o2, + a2, + h2, + l2, + c2 + ) { + if (1 === this._config.minimumContrastRatio || c2) return; + const d2 = this._getContrastCache(l2), + _2 = d2.getColor(e3, s3); + if (void 0 !== _2) return _2 || void 0; + const u2 = this._resolveBackgroundRgba(t3, i3, a2), + g2 = this._resolveForegroundRgba(r2, o2, a2, h2), + v2 = n.rgba.ensureContrastRatio( + u2, + g2, + this._config.minimumContrastRatio / (l2 ? 2 : 1) + ); + if (!v2) return void d2.setColor(e3, s3, null); + const f2 = n.channels.toColor( + (v2 >> 24) & 255, + (v2 >> 16) & 255, + (v2 >> 8) & 255 + ); + return d2.setColor(e3, s3, f2), f2; + } + _getContrastCache(e3) { + return e3 + ? this._config.colors.halfContrastCache + : this._config.colors.contrastCache; + } + _drawToCache(e3, t3, i3, n2, a2 = false) { + const h2 = + "number" == typeof e3 ? String.fromCharCode(e3) : e3, + l2 = Math.min( + this._config.deviceCellWidth * + Math.max(h2.length, 2) + + 4, + this._textureSize + ); + this._tmpCanvas.width < l2 && + (this._tmpCanvas.width = l2); + const d2 = Math.min( + this._config.deviceCellHeight + 8, + this._textureSize + ); + if ( + (this._tmpCanvas.height < d2 && + (this._tmpCanvas.height = d2), + this._tmpCtx.save(), + (this._workAttributeData.fg = i3), + (this._workAttributeData.bg = t3), + (this._workAttributeData.extended.ext = n2), + this._workAttributeData.isInvisible()) + ) + return _; + const u2 = !!this._workAttributeData.isBold(), + v2 = !!this._workAttributeData.isInverse(), + p2 = !!this._workAttributeData.isDim(), + C = !!this._workAttributeData.isItalic(), + m = !!this._workAttributeData.isUnderline(), + L = !!this._workAttributeData.isStrikethrough(), + x = !!this._workAttributeData.isOverline(); + let w = this._workAttributeData.getFgColor(), + b = this._workAttributeData.getFgColorMode(), + M = this._workAttributeData.getBgColor(), + R = this._workAttributeData.getBgColorMode(); + if (v2) { + const e4 = w; + (w = M), (M = e4); + const t4 = b; + (b = R), (R = t4); + } + const y = this._getBackgroundColor(R, M, v2, p2); + (this._tmpCtx.globalCompositeOperation = "copy"), + (this._tmpCtx.fillStyle = y.css), + this._tmpCtx.fillRect( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ), + (this._tmpCtx.globalCompositeOperation = "source-over"); + const A = u2 + ? this._config.fontWeightBold + : this._config.fontWeight, + E = C ? "italic" : ""; + (this._tmpCtx.font = `${E} ${A} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`), + (this._tmpCtx.textBaseline = s2.TEXT_BASELINE); + const S = + 1 === h2.length && + (0, o.isPowerlineGlyph)(h2.charCodeAt(0)), + T = + 1 === h2.length && + (0, o.isRestrictedPowerlineGlyph)(h2.charCodeAt(0)), + D = this._getForegroundColor( + t3, + R, + M, + i3, + b, + w, + v2, + p2, + u2, + (0, o.treatGlyphAsBackgroundColor)(h2.charCodeAt(0)) + ); + this._tmpCtx.fillStyle = D.css; + const B = T ? 0 : 4; + let F = false; + false !== this._config.customGlyphs && + (F = (0, r.tryDrawCustomChar)( + this._tmpCtx, + h2, + B, + B, + this._config.deviceCellWidth, + this._config.deviceCellHeight, + this._config.fontSize, + this._config.devicePixelRatio + )); + let P, + I = !S; + if ( + ((P = + "number" == typeof e3 + ? this._unicodeService.wcwidth(e3) + : this._unicodeService.getStringCellWidth(e3)), + m) + ) { + this._tmpCtx.save(); + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 15 + ) + ), + t4 = e4 % 2 == 1 ? 0.5 : 0; + if ( + ((this._tmpCtx.lineWidth = e4), + this._workAttributeData.isUnderlineColorDefault()) + ) + this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; + else if (this._workAttributeData.isUnderlineColorRGB()) + (I = false), + (this._tmpCtx.strokeStyle = `rgb(${c.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`); + else { + I = false; + let e5 = this._workAttributeData.getUnderlineColor(); + this._config.drawBoldTextInBrightColors && + this._workAttributeData.isBold() && + e5 < 8 && + (e5 += 8), + (this._tmpCtx.strokeStyle = + this._getColorFromAnsiIndex(e5).css); + } + this._tmpCtx.beginPath(); + const i4 = B, + s3 = + Math.ceil(B + this._config.deviceCharHeight) - + t4 - + (a2 ? 2 * e4 : 0), + r2 = s3 + e4, + n3 = s3 + 2 * e4; + let l3 = + this._workAttributeData.getUnderlineVariantOffset(); + for (let a3 = 0; a3 < P; a3++) { + this._tmpCtx.save(); + const h3 = i4 + a3 * this._config.deviceCellWidth, + c2 = i4 + (a3 + 1) * this._config.deviceCellWidth, + d3 = h3 + this._config.deviceCellWidth / 2; + switch ( + this._workAttributeData.extended.underlineStyle + ) { + case 2: + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3), + this._tmpCtx.moveTo(h3, n3), + this._tmpCtx.lineTo(c2, n3); + break; + case 3: + const i5 = + e4 <= 1 + ? n3 + : Math.ceil( + B + + this._config.deviceCharHeight - + e4 / 2 + ) - t4, + a4 = + e4 <= 1 + ? s3 + : Math.ceil( + B + + this._config.deviceCharHeight + + e4 / 2 + ) - t4, + _2 = new Path2D(); + _2.rect( + h3, + s3, + this._config.deviceCellWidth, + n3 - s3 + ), + this._tmpCtx.clip(_2), + this._tmpCtx.moveTo( + h3 - this._config.deviceCellWidth / 2, + r2 + ), + this._tmpCtx.bezierCurveTo( + h3 - this._config.deviceCellWidth / 2, + a4, + h3, + a4, + h3, + r2 + ), + this._tmpCtx.bezierCurveTo( + h3, + i5, + d3, + i5, + d3, + r2 + ), + this._tmpCtx.bezierCurveTo( + d3, + a4, + c2, + a4, + c2, + r2 + ), + this._tmpCtx.bezierCurveTo( + c2, + i5, + c2 + this._config.deviceCellWidth / 2, + i5, + c2 + this._config.deviceCellWidth / 2, + r2 + ); + break; + case 4: + const u3 = + 0 === l3 ? 0 : l3 >= e4 ? 2 * e4 - l3 : e4 - l3; + false == !(l3 >= e4) || 0 === u3 + ? (this._tmpCtx.setLineDash([ + Math.round(e4), + Math.round(e4), + ]), + this._tmpCtx.moveTo(h3 + u3, s3), + this._tmpCtx.lineTo(c2, s3)) + : (this._tmpCtx.setLineDash([ + Math.round(e4), + Math.round(e4), + ]), + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(h3 + u3, s3), + this._tmpCtx.moveTo(h3 + u3 + e4, s3), + this._tmpCtx.lineTo(c2, s3)), + (l3 = (0, o.computeNextVariantOffset)( + c2 - h3, + e4, + l3 + )); + break; + case 5: + const g2 = 0.6, + v3 = 0.3, + f2 = c2 - h3, + p3 = Math.floor(g2 * f2), + C2 = Math.floor(v3 * f2), + m2 = f2 - p3 - C2; + this._tmpCtx.setLineDash([p3, C2, m2]), + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3); + break; + default: + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3); + } + this._tmpCtx.stroke(), this._tmpCtx.restore(); + } + if ( + (this._tmpCtx.restore(), + !F && + this._config.fontSize >= 12 && + !this._config.allowTransparency && + " " !== h2) + ) { + this._tmpCtx.save(), + (this._tmpCtx.textBaseline = "alphabetic"); + const t5 = this._tmpCtx.measureText(h2); + if ( + (this._tmpCtx.restore(), + "actualBoundingBoxDescent" in t5 && + t5.actualBoundingBoxDescent > 0) + ) { + this._tmpCtx.save(); + const t6 = new Path2D(); + t6.rect( + i4, + s3 - Math.ceil(e4 / 2), + this._config.deviceCellWidth * P, + n3 - s3 + Math.ceil(e4 / 2) + ), + this._tmpCtx.clip(t6), + (this._tmpCtx.lineWidth = + 3 * this._config.devicePixelRatio), + (this._tmpCtx.strokeStyle = y.css), + this._tmpCtx.strokeText( + h2, + B, + B + this._config.deviceCharHeight + ), + this._tmpCtx.restore(); + } + } + } + if (x) { + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 15 + ) + ), + t4 = e4 % 2 == 1 ? 0.5 : 0; + (this._tmpCtx.lineWidth = e4), + (this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle), + this._tmpCtx.beginPath(), + this._tmpCtx.moveTo(B, B + t4), + this._tmpCtx.lineTo( + B + this._config.deviceCharWidth * P, + B + t4 + ), + this._tmpCtx.stroke(); + } + if ( + (F || + this._tmpCtx.fillText( + h2, + B, + B + this._config.deviceCharHeight + ), + "_" === h2 && !this._config.allowTransparency) + ) { + let e4 = f( + this._tmpCtx.getImageData( + B, + B, + this._config.deviceCellWidth, + this._config.deviceCellHeight + ), + y, + D, + I + ); + if (e4) + for ( + let t4 = 1; + t4 <= 5 && + (this._tmpCtx.save(), + (this._tmpCtx.fillStyle = y.css), + this._tmpCtx.fillRect( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ), + this._tmpCtx.restore(), + this._tmpCtx.fillText( + h2, + B, + B + this._config.deviceCharHeight - t4 + ), + (e4 = f( + this._tmpCtx.getImageData( + B, + B, + this._config.deviceCellWidth, + this._config.deviceCellHeight + ), + y, + D, + I + )), + e4); + t4++ + ); + } + if (L) { + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 10 + ) + ), + t4 = this._tmpCtx.lineWidth % 2 == 1 ? 0.5 : 0; + (this._tmpCtx.lineWidth = e4), + (this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle), + this._tmpCtx.beginPath(), + this._tmpCtx.moveTo( + B, + B + + Math.floor(this._config.deviceCharHeight / 2) - + t4 + ), + this._tmpCtx.lineTo( + B + this._config.deviceCharWidth * P, + B + + Math.floor(this._config.deviceCharHeight / 2) - + t4 + ), + this._tmpCtx.stroke(); + } + this._tmpCtx.restore(); + const O = this._tmpCtx.getImageData( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ); + let k; + if ( + ((k = this._config.allowTransparency + ? (function (e4) { + for (let t4 = 0; t4 < e4.data.length; t4 += 4) + if (e4.data[t4 + 3] > 0) return false; + return true; + })(O) + : f(O, y, D, I)), + k) + ) + return _; + const $ = this._findGlyphBoundingBox( + O, + this._workBoundingBox, + l2, + T, + F, + B + ); + let U, N; + for (;;) { + if (0 === this._activePages.length) { + const e4 = this._createNewPage(); + (U = e4), (N = e4.currentRow), (N.height = $.size.y); + break; + } + (U = this._activePages[this._activePages.length - 1]), + (N = U.currentRow); + for (const e4 of this._activePages) + $.size.y <= e4.currentRow.height && + ((U = e4), (N = e4.currentRow)); + for ( + let e4 = this._activePages.length - 1; + e4 >= 0; + e4-- + ) + for (const t4 of this._activePages[e4].fixedRows) + t4.height <= N.height && + $.size.y <= t4.height && + ((U = this._activePages[e4]), (N = t4)); + if ( + N.y + $.size.y >= U.canvas.height || + N.height > $.size.y + 2 + ) { + let e4 = false; + if ( + U.currentRow.y + U.currentRow.height + $.size.y >= + U.canvas.height + ) { + let t4; + for (const e5 of this._activePages) + if ( + e5.currentRow.y + + e5.currentRow.height + + $.size.y < + e5.canvas.height + ) { + t4 = e5; + break; + } + if (t4) U = t4; + else if ( + g.maxAtlasPages && + this._pages.length >= g.maxAtlasPages && + N.y + $.size.y <= U.canvas.height && + N.height >= $.size.y && + N.x + $.size.x <= U.canvas.width + ) + e4 = true; + else { + const t5 = this._createNewPage(); + (U = t5), + (N = t5.currentRow), + (N.height = $.size.y), + (e4 = true); + } + } + e4 || + (U.currentRow.height > 0 && + U.fixedRows.push(U.currentRow), + (N = { + x: 0, + y: U.currentRow.y + U.currentRow.height, + height: $.size.y, + }), + U.fixedRows.push(N), + (U.currentRow = { + x: 0, + y: N.y + N.height, + height: 0, + })); + } + if (N.x + $.size.x <= U.canvas.width) break; + N === U.currentRow + ? ((N.x = 0), (N.y += N.height), (N.height = 0)) + : U.fixedRows.splice(U.fixedRows.indexOf(N), 1); + } + return ( + ($.texturePage = this._pages.indexOf(U)), + ($.texturePosition.x = N.x), + ($.texturePosition.y = N.y), + ($.texturePositionClipSpace.x = N.x / U.canvas.width), + ($.texturePositionClipSpace.y = N.y / U.canvas.height), + ($.sizeClipSpace.x /= U.canvas.width), + ($.sizeClipSpace.y /= U.canvas.height), + (N.height = Math.max(N.height, $.size.y)), + (N.x += $.size.x), + U.ctx.putImageData( + O, + $.texturePosition.x - this._workBoundingBox.left, + $.texturePosition.y - this._workBoundingBox.top, + this._workBoundingBox.left, + this._workBoundingBox.top, + $.size.x, + $.size.y + ), + U.addGlyph($), + U.version++, + $ + ); + } + _findGlyphBoundingBox(e3, t3, i3, s3, r2, o2) { + t3.top = 0; + const n2 = s3 + ? this._config.deviceCellHeight + : this._tmpCanvas.height, + a2 = s3 ? this._config.deviceCellWidth : i3; + let h2 = false; + for (let i4 = 0; i4 < n2; i4++) { + for (let s4 = 0; s4 < a2; s4++) { + const r3 = + i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3; + if (0 !== e3.data[r3]) { + (t3.top = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.left = 0), (h2 = false); + for (let i4 = 0; i4 < o2 + a2; i4++) { + for (let s4 = 0; s4 < n2; s4++) { + const r3 = + s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3; + if (0 !== e3.data[r3]) { + (t3.left = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.right = a2), (h2 = false); + for (let i4 = o2 + a2 - 1; i4 >= o2; i4--) { + for (let s4 = 0; s4 < n2; s4++) { + const r3 = + s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3; + if (0 !== e3.data[r3]) { + (t3.right = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.bottom = n2), (h2 = false); + for (let i4 = n2 - 1; i4 >= 0; i4--) { + for (let s4 = 0; s4 < a2; s4++) { + const r3 = + i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3; + if (0 !== e3.data[r3]) { + (t3.bottom = i4), (h2 = true); + break; + } + } + if (h2) break; + } + return { + texturePage: 0, + texturePosition: { x: 0, y: 0 }, + texturePositionClipSpace: { x: 0, y: 0 }, + size: { + x: t3.right - t3.left + 1, + y: t3.bottom - t3.top + 1, + }, + sizeClipSpace: { + x: t3.right - t3.left + 1, + y: t3.bottom - t3.top + 1, + }, + offset: { + x: + -t3.left + + o2 + + (s3 || r2 + ? Math.floor( + (this._config.deviceCellWidth - + this._config.deviceCharWidth) / + 2 + ) + : 0), + y: + -t3.top + + o2 + + (s3 || r2 + ? 1 === this._config.lineHeight + ? 0 + : Math.round( + (this._config.deviceCellHeight - + this._config.deviceCharHeight) / + 2 + ) + : 0), + }, + }; + } + } + t2.TextureAtlas = g; + class v { + get percentageUsed() { + return ( + this._usedPixels / + (this.canvas.width * this.canvas.height) + ); + } + get glyphs() { + return this._glyphs; + } + addGlyph(e3) { + this._glyphs.push(e3), + (this._usedPixels += e3.size.x * e3.size.y); + } + constructor(e3, t3, i3) { + if ( + ((this._usedPixels = 0), + (this._glyphs = []), + (this.version = 0), + (this.currentRow = { x: 0, y: 0, height: 0 }), + (this.fixedRows = []), + i3) + ) + for (const e4 of i3) + this._glyphs.push(...e4.glyphs), + (this._usedPixels += e4._usedPixels); + (this.canvas = p(e3, t3, t3)), + (this.ctx = (0, o.throwIfFalsy)( + this.canvas.getContext("2d", { alpha: true }) + )); + } + clear() { + this.ctx.clearRect( + 0, + 0, + this.canvas.width, + this.canvas.height + ), + (this.currentRow.x = 0), + (this.currentRow.y = 0), + (this.currentRow.height = 0), + (this.fixedRows.length = 0), + this.version++; + } + } + function f(e3, t3, i3, s3) { + const r2 = t3.rgba >>> 24, + o2 = (t3.rgba >>> 16) & 255, + n2 = (t3.rgba >>> 8) & 255, + a2 = i3.rgba >>> 24, + h2 = (i3.rgba >>> 16) & 255, + l2 = (i3.rgba >>> 8) & 255, + c2 = Math.floor( + (Math.abs(r2 - a2) + + Math.abs(o2 - h2) + + Math.abs(n2 - l2)) / + 12 + ); + let d2 = true; + for (let t4 = 0; t4 < e3.data.length; t4 += 4) + (e3.data[t4] === r2 && + e3.data[t4 + 1] === o2 && + e3.data[t4 + 2] === n2) || + (s3 && + Math.abs(e3.data[t4] - r2) + + Math.abs(e3.data[t4 + 1] - o2) + + Math.abs(e3.data[t4 + 2] - n2) < + c2) + ? (e3.data[t4 + 3] = 0) + : (d2 = false); + return d2; + } + function p(e3, t3, i3) { + const s3 = e3.createElement("canvas"); + return (s3.width = t3), (s3.height = i3), s3; + } + }, + 160: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.contrastRatio = + t2.toPaddedHex = + t2.rgba = + t2.rgb = + t2.css = + t2.color = + t2.channels = + t2.NULL_COLOR = + void 0); + let i2 = 0, + s2 = 0, + r = 0, + o = 0; + var n, a, h, l, c; + function d(e3) { + const t3 = e3.toString(16); + return t3.length < 2 ? "0" + t3 : t3; + } + function _(e3, t3) { + return e3 < t3 + ? (t3 + 0.05) / (e3 + 0.05) + : (e3 + 0.05) / (t3 + 0.05); + } + (t2.NULL_COLOR = { css: "#00000000", rgba: 0 }), + (function (e3) { + (e3.toCss = function (e4, t3, i3, s3) { + return void 0 !== s3 + ? `#${d(e4)}${d(t3)}${d(i3)}${d(s3)}` + : `#${d(e4)}${d(t3)}${d(i3)}`; + }), + (e3.toRgba = function (e4, t3, i3, s3 = 255) { + return ( + ((e4 << 24) | (t3 << 16) | (i3 << 8) | s3) >>> 0 + ); + }), + (e3.toColor = function (t3, i3, s3, r2) { + return { + css: e3.toCss(t3, i3, s3, r2), + rgba: e3.toRgba(t3, i3, s3, r2), + }; + }); + })(n || (t2.channels = n = {})), + (function (e3) { + function t3(e4, t4) { + return ( + (o = Math.round(255 * t4)), + ([i2, s2, r] = c.toChannels(e4.rgba)), + { + css: n.toCss(i2, s2, r, o), + rgba: n.toRgba(i2, s2, r, o), + } + ); + } + (e3.blend = function (e4, t4) { + if (((o = (255 & t4.rgba) / 255), 1 === o)) + return { css: t4.css, rgba: t4.rgba }; + const a2 = (t4.rgba >> 24) & 255, + h2 = (t4.rgba >> 16) & 255, + l2 = (t4.rgba >> 8) & 255, + c2 = (e4.rgba >> 24) & 255, + d2 = (e4.rgba >> 16) & 255, + _2 = (e4.rgba >> 8) & 255; + return ( + (i2 = c2 + Math.round((a2 - c2) * o)), + (s2 = d2 + Math.round((h2 - d2) * o)), + (r = _2 + Math.round((l2 - _2) * o)), + { css: n.toCss(i2, s2, r), rgba: n.toRgba(i2, s2, r) } + ); + }), + (e3.isOpaque = function (e4) { + return 255 == (255 & e4.rgba); + }), + (e3.ensureContrastRatio = function (e4, t4, i3) { + const s3 = c.ensureContrastRatio( + e4.rgba, + t4.rgba, + i3 + ); + if (s3) + return n.toColor( + (s3 >> 24) & 255, + (s3 >> 16) & 255, + (s3 >> 8) & 255 + ); + }), + (e3.opaque = function (e4) { + const t4 = (255 | e4.rgba) >>> 0; + return ( + ([i2, s2, r] = c.toChannels(t4)), + { css: n.toCss(i2, s2, r), rgba: t4 } + ); + }), + (e3.opacity = t3), + (e3.multiplyOpacity = function (e4, i3) { + return (o = 255 & e4.rgba), t3(e4, (o * i3) / 255); + }), + (e3.toColorRGB = function (e4) { + return [ + (e4.rgba >> 24) & 255, + (e4.rgba >> 16) & 255, + (e4.rgba >> 8) & 255, + ]; + }); + })(a || (t2.color = a = {})), + (function (e3) { + let t3, a2; + try { + const e4 = document.createElement("canvas"); + (e4.width = 1), (e4.height = 1); + const i3 = e4.getContext("2d", { + willReadFrequently: true, + }); + i3 && + ((t3 = i3), + (t3.globalCompositeOperation = "copy"), + (a2 = t3.createLinearGradient(0, 0, 1, 1))); + } catch {} + e3.toColor = function (e4) { + if (e4.match(/#[\da-f]{3,8}/i)) + switch (e4.length) { + case 4: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + n.toColor(i2, s2, r) + ); + case 5: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + (o = parseInt(e4.slice(4, 5).repeat(2), 16)), + n.toColor(i2, s2, r, o) + ); + case 7: + return { + css: e4, + rgba: + ((parseInt(e4.slice(1), 16) << 8) | 255) >>> + 0, + }; + case 9: + return { + css: e4, + rgba: parseInt(e4.slice(1), 16) >>> 0, + }; + } + const h2 = e4.match( + /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/ + ); + if (h2) + return ( + (i2 = parseInt(h2[1])), + (s2 = parseInt(h2[2])), + (r = parseInt(h2[3])), + (o = Math.round( + 255 * (void 0 === h2[5] ? 1 : parseFloat(h2[5])) + )), + n.toColor(i2, s2, r, o) + ); + if (!t3 || !a2) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + ((t3.fillStyle = a2), + (t3.fillStyle = e4), + "string" != typeof t3.fillStyle) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + (t3.fillRect(0, 0, 1, 1), + ([i2, s2, r, o] = t3.getImageData(0, 0, 1, 1).data), + 255 !== o) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + return { rgba: n.toRgba(i2, s2, r, o), css: e4 }; + }; + })(h || (t2.css = h = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = e4 / 255, + r2 = t4 / 255, + o2 = i3 / 255; + return ( + 0.2126 * + (s3 <= 0.03928 + ? s3 / 12.92 + : Math.pow((s3 + 0.055) / 1.055, 2.4)) + + 0.7152 * + (r2 <= 0.03928 + ? r2 / 12.92 + : Math.pow((r2 + 0.055) / 1.055, 2.4)) + + 0.0722 * + (o2 <= 0.03928 + ? o2 / 12.92 + : Math.pow((o2 + 0.055) / 1.055, 2.4)) + ); + } + (e3.relativeLuminance = function (e4) { + return t3((e4 >> 16) & 255, (e4 >> 8) & 255, 255 & e4); + }), + (e3.relativeLuminance2 = t3); + })(l || (t2.rgb = l = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + o2 = (e4 >> 8) & 255; + let n2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + ); + for (; c2 < i3 && (n2 > 0 || a3 > 0 || h2 > 0); ) + (n2 -= Math.max(0, Math.ceil(0.1 * n2))), + (a3 -= Math.max(0, Math.ceil(0.1 * a3))), + (h2 -= Math.max(0, Math.ceil(0.1 * h2))), + (c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + )); + return ( + ((n2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + function a2(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + o2 = (e4 >> 8) & 255; + let n2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + ); + for (; c2 < i3 && (n2 < 255 || a3 < 255 || h2 < 255); ) + (n2 = Math.min( + 255, + n2 + Math.ceil(0.1 * (255 - n2)) + )), + (a3 = Math.min( + 255, + a3 + Math.ceil(0.1 * (255 - a3)) + )), + (h2 = Math.min( + 255, + h2 + Math.ceil(0.1 * (255 - h2)) + )), + (c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + )); + return ( + ((n2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + (e3.blend = function (e4, t4) { + if (((o = (255 & t4) / 255), 1 === o)) return t4; + const a3 = (t4 >> 24) & 255, + h2 = (t4 >> 16) & 255, + l2 = (t4 >> 8) & 255, + c2 = (e4 >> 24) & 255, + d2 = (e4 >> 16) & 255, + _2 = (e4 >> 8) & 255; + return ( + (i2 = c2 + Math.round((a3 - c2) * o)), + (s2 = d2 + Math.round((h2 - d2) * o)), + (r = _2 + Math.round((l2 - _2) * o)), + n.toRgba(i2, s2, r) + ); + }), + (e3.ensureContrastRatio = function (e4, i3, s3) { + const r2 = l.relativeLuminance(e4 >> 8), + o2 = l.relativeLuminance(i3 >> 8); + if (_(r2, o2) < s3) { + if (o2 < r2) { + const o3 = t3(e4, i3, s3), + n3 = _(r2, l.relativeLuminance(o3 >> 8)); + if (n3 < s3) { + const t4 = a2(e4, i3, s3); + return n3 > _(r2, l.relativeLuminance(t4 >> 8)) + ? o3 + : t4; + } + return o3; + } + const n2 = a2(e4, i3, s3), + h2 = _(r2, l.relativeLuminance(n2 >> 8)); + if (h2 < s3) { + const o3 = t3(e4, i3, s3); + return h2 > _(r2, l.relativeLuminance(o3 >> 8)) + ? n2 + : o3; + } + return n2; + } + }), + (e3.reduceLuminance = t3), + (e3.increaseLuminance = a2), + (e3.toChannels = function (e4) { + return [ + (e4 >> 24) & 255, + (e4 >> 16) & 255, + (e4 >> 8) & 255, + 255 & e4, + ]; + }); + })(c || (t2.rgba = c = {})), + (t2.toPaddedHex = d), + (t2.contrastRatio = _); + }, + 345: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.runAndSubscribe = + t2.forwardEvent = + t2.EventEmitter = + void 0), + (t2.EventEmitter = class { + constructor() { + (this._listeners = []), (this._disposed = false); + } + get event() { + return ( + this._event || + (this._event = (e3) => ( + this._listeners.push(e3), + { + dispose: () => { + if (!this._disposed) { + for ( + let t3 = 0; + t3 < this._listeners.length; + t3++ + ) + if (this._listeners[t3] === e3) + return void this._listeners.splice( + t3, + 1 + ); + } + }, + } + )), + this._event + ); + } + fire(e3, t3) { + const i2 = []; + for (let e4 = 0; e4 < this._listeners.length; e4++) + i2.push(this._listeners[e4]); + for (let s2 = 0; s2 < i2.length; s2++) + i2[s2].call(void 0, e3, t3); + } + dispose() { + this.clearListeners(), (this._disposed = true); + } + clearListeners() { + this._listeners && (this._listeners.length = 0); + } + }), + (t2.forwardEvent = function (e3, t3) { + return e3((e4) => t3.fire(e4)); + }), + (t2.runAndSubscribe = function (e3, t3) { + return t3(void 0), e3((e4) => t3(e4)); + }); + }, + 859: (e2, t2) => { + function i2(e3) { + for (const t3 of e3) t3.dispose(); + e3.length = 0; + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getDisposeArrayDisposable = + t2.disposeArray = + t2.toDisposable = + t2.MutableDisposable = + t2.Disposable = + void 0), + (t2.Disposable = class { + constructor() { + (this._disposables = []), (this._isDisposed = false); + } + dispose() { + this._isDisposed = true; + for (const e3 of this._disposables) e3.dispose(); + this._disposables.length = 0; + } + register(e3) { + return this._disposables.push(e3), e3; + } + unregister(e3) { + const t3 = this._disposables.indexOf(e3); + -1 !== t3 && this._disposables.splice(t3, 1); + } + }), + (t2.MutableDisposable = class { + constructor() { + this._isDisposed = false; + } + get value() { + return this._isDisposed ? void 0 : this._value; + } + set value(e3) { + this._isDisposed || + e3 === this._value || + (this._value?.dispose(), (this._value = e3)); + } + clear() { + this.value = void 0; + } + dispose() { + (this._isDisposed = true), + this._value?.dispose(), + (this._value = void 0); + } + }), + (t2.toDisposable = function (e3) { + return { dispose: e3 }; + }), + (t2.disposeArray = i2), + (t2.getDisposeArrayDisposable = function (e3) { + return { dispose: () => i2(e3) }; + }); + }, + 485: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.FourKeyMap = t2.TwoKeyMap = void 0); + class i2 { + constructor() { + this._data = {}; + } + set(e3, t3, i3) { + this._data[e3] || (this._data[e3] = {}), + (this._data[e3][t3] = i3); + } + get(e3, t3) { + return this._data[e3] ? this._data[e3][t3] : void 0; + } + clear() { + this._data = {}; + } + } + (t2.TwoKeyMap = i2), + (t2.FourKeyMap = class { + constructor() { + this._data = new i2(); + } + set(e3, t3, s2, r, o) { + this._data.get(e3, t3) || + this._data.set(e3, t3, new i2()), + this._data.get(e3, t3).set(s2, r, o); + } + get(e3, t3, i3, s2) { + return this._data.get(e3, t3)?.get(i3, s2); + } + clear() { + this._data.clear(); + } + }); + }, + 399: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.isChromeOS = + t2.isLinux = + t2.isWindows = + t2.isIphone = + t2.isIpad = + t2.isMac = + t2.getSafariVersion = + t2.isSafari = + t2.isLegacyEdge = + t2.isFirefox = + t2.isNode = + void 0), + (t2.isNode = + "undefined" != typeof process && "title" in process); + const i2 = t2.isNode ? "node" : navigator.userAgent, + s2 = t2.isNode ? "node" : navigator.platform; + (t2.isFirefox = i2.includes("Firefox")), + (t2.isLegacyEdge = i2.includes("Edge")), + (t2.isSafari = /^((?!chrome|android).)*safari/i.test(i2)), + (t2.getSafariVersion = function () { + if (!t2.isSafari) return 0; + const e3 = i2.match(/Version\/(\d+)/); + return null === e3 || e3.length < 2 ? 0 : parseInt(e3[1]); + }), + (t2.isMac = [ + "Macintosh", + "MacIntel", + "MacPPC", + "Mac68K", + ].includes(s2)), + (t2.isIpad = "iPad" === s2), + (t2.isIphone = "iPhone" === s2), + (t2.isWindows = [ + "Windows", + "Win16", + "Win32", + "WinCE", + ].includes(s2)), + (t2.isLinux = s2.indexOf("Linux") >= 0), + (t2.isChromeOS = /\bCrOS\b/.test(i2)); + }, + 385: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DebouncedIdleTask = + t2.IdleTaskQueue = + t2.PriorityTaskQueue = + void 0); + const s2 = i2(399); + class r { + constructor() { + (this._tasks = []), (this._i = 0); + } + enqueue(e3) { + this._tasks.push(e3), this._start(); + } + flush() { + for (; this._i < this._tasks.length; ) + this._tasks[this._i]() || this._i++; + this.clear(); + } + clear() { + this._idleCallback && + (this._cancelCallback(this._idleCallback), + (this._idleCallback = void 0)), + (this._i = 0), + (this._tasks.length = 0); + } + _start() { + this._idleCallback || + (this._idleCallback = this._requestCallback( + this._process.bind(this) + )); + } + _process(e3) { + this._idleCallback = void 0; + let t3 = 0, + i3 = 0, + s3 = e3.timeRemaining(), + r2 = 0; + for (; this._i < this._tasks.length; ) { + if ( + ((t3 = Date.now()), + this._tasks[this._i]() || this._i++, + (t3 = Math.max(1, Date.now() - t3)), + (i3 = Math.max(t3, i3)), + (r2 = e3.timeRemaining()), + 1.5 * i3 > r2) + ) + return ( + s3 - t3 < -20 && + console.warn( + `task queue exceeded allotted deadline by ${Math.abs(Math.round(s3 - t3))}ms` + ), + void this._start() + ); + s3 = r2; + } + this.clear(); + } + } + class o extends r { + _requestCallback(e3) { + return setTimeout(() => e3(this._createDeadline(16))); + } + _cancelCallback(e3) { + clearTimeout(e3); + } + _createDeadline(e3) { + const t3 = Date.now() + e3; + return { + timeRemaining: () => Math.max(0, t3 - Date.now()), + }; + } + } + (t2.PriorityTaskQueue = o), + (t2.IdleTaskQueue = + !s2.isNode && "requestIdleCallback" in window + ? class extends r { + _requestCallback(e3) { + return requestIdleCallback(e3); + } + _cancelCallback(e3) { + cancelIdleCallback(e3); + } + } + : o), + (t2.DebouncedIdleTask = class { + constructor() { + this._queue = new t2.IdleTaskQueue(); + } + set(e3) { + this._queue.clear(), this._queue.enqueue(e3); + } + flush() { + this._queue.flush(); + } + }); + }, + 147: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ExtendedAttrs = t2.AttributeData = void 0); + class i2 { + constructor() { + (this.fg = 0), (this.bg = 0), (this.extended = new s2()); + } + static toColorRGB(e3) { + return [(e3 >>> 16) & 255, (e3 >>> 8) & 255, 255 & e3]; + } + static fromColorRGB(e3) { + return ( + ((255 & e3[0]) << 16) | + ((255 & e3[1]) << 8) | + (255 & e3[2]) + ); + } + clone() { + const e3 = new i2(); + return ( + (e3.fg = this.fg), + (e3.bg = this.bg), + (e3.extended = this.extended.clone()), + e3 + ); + } + 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 == (50331648 & this.fg); + } + isBgRGB() { + return 50331648 == (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 0 == (50331648 & this.fg); + } + isBgDefault() { + return 0 == (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 == (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 + ? 0 == (50331648 & this.extended.underlineColor) + : this.isFgDefault(); + } + getUnderlineStyle() { + return 268435456 & this.fg + ? 268435456 & this.bg + ? this.extended.underlineStyle + : 1 + : 0; + } + getUnderlineVariantOffset() { + return this.extended.underlineVariantOffset; + } + } + t2.AttributeData = i2; + class s2 { + get ext() { + return this._urlId + ? (-469762049 & this._ext) | (this.underlineStyle << 26) + : this._ext; + } + set ext(e3) { + this._ext = e3; + } + get underlineStyle() { + return this._urlId ? 5 : (469762048 & this._ext) >> 26; + } + set underlineStyle(e3) { + (this._ext &= -469762049), + (this._ext |= (e3 << 26) & 469762048); + } + get underlineColor() { + return 67108863 & this._ext; + } + set underlineColor(e3) { + (this._ext &= -67108864), (this._ext |= 67108863 & e3); + } + get urlId() { + return this._urlId; + } + set urlId(e3) { + this._urlId = e3; + } + get underlineVariantOffset() { + const e3 = (3758096384 & this._ext) >> 29; + return e3 < 0 ? 4294967288 ^ e3 : e3; + } + set underlineVariantOffset(e3) { + (this._ext &= 536870911), + (this._ext |= (e3 << 29) & 3758096384); + } + constructor(e3 = 0, t3 = 0) { + (this._ext = 0), + (this._urlId = 0), + (this._ext = e3), + (this._urlId = t3); + } + clone() { + return new s2(this._ext, this._urlId); + } + isEmpty() { + return 0 === this.underlineStyle && 0 === this._urlId; + } + } + t2.ExtendedAttrs = s2; + }, + 782: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CellData = void 0); + const s2 = i2(133), + r = i2(855), + o = i2(147); + class n extends o.AttributeData { + constructor() { + super(...arguments), + (this.content = 0), + (this.fg = 0), + (this.bg = 0), + (this.extended = new o.ExtendedAttrs()), + (this.combinedData = ""); + } + static fromCharData(e3) { + const t3 = new n(); + return t3.setFromCharData(e3), t3; + } + isCombined() { + return 2097152 & this.content; + } + getWidth() { + return this.content >> 22; + } + getChars() { + return 2097152 & this.content + ? this.combinedData + : 2097151 & this.content + ? (0, s2.stringFromCodePoint)(2097151 & this.content) + : ""; + } + getCode() { + return this.isCombined() + ? this.combinedData.charCodeAt( + this.combinedData.length - 1 + ) + : 2097151 & this.content; + } + setFromCharData(e3) { + (this.fg = e3[r.CHAR_DATA_ATTR_INDEX]), (this.bg = 0); + let t3 = false; + if (e3[r.CHAR_DATA_CHAR_INDEX].length > 2) t3 = true; + else if (2 === e3[r.CHAR_DATA_CHAR_INDEX].length) { + const i3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0); + if (55296 <= i3 && i3 <= 56319) { + const s3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1); + 56320 <= s3 && s3 <= 57343 + ? (this.content = + (1024 * (i3 - 55296) + s3 - 56320 + 65536) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22)) + : (t3 = true); + } else t3 = true; + } else + this.content = + e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22); + t3 && + ((this.combinedData = e3[r.CHAR_DATA_CHAR_INDEX]), + (this.content = + 2097152 | (e3[r.CHAR_DATA_WIDTH_INDEX] << 22))); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + t2.CellData = n; + }, + 855: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.WHITESPACE_CELL_CODE = + t2.WHITESPACE_CELL_WIDTH = + t2.WHITESPACE_CELL_CHAR = + t2.NULL_CELL_CODE = + t2.NULL_CELL_WIDTH = + t2.NULL_CELL_CHAR = + t2.CHAR_DATA_CODE_INDEX = + t2.CHAR_DATA_WIDTH_INDEX = + t2.CHAR_DATA_CHAR_INDEX = + t2.CHAR_DATA_ATTR_INDEX = + t2.DEFAULT_EXT = + t2.DEFAULT_ATTR = + t2.DEFAULT_COLOR = + void 0), + (t2.DEFAULT_COLOR = 0), + (t2.DEFAULT_ATTR = 256 | (t2.DEFAULT_COLOR << 9)), + (t2.DEFAULT_EXT = 0), + (t2.CHAR_DATA_ATTR_INDEX = 0), + (t2.CHAR_DATA_CHAR_INDEX = 1), + (t2.CHAR_DATA_WIDTH_INDEX = 2), + (t2.CHAR_DATA_CODE_INDEX = 3), + (t2.NULL_CELL_CHAR = ""), + (t2.NULL_CELL_WIDTH = 1), + (t2.NULL_CELL_CODE = 0), + (t2.WHITESPACE_CELL_CHAR = " "), + (t2.WHITESPACE_CELL_WIDTH = 1), + (t2.WHITESPACE_CELL_CODE = 32); + }, + 133: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Utf8ToUtf32 = + t2.StringToUtf32 = + t2.utf32ToString = + t2.stringFromCodePoint = + void 0), + (t2.stringFromCodePoint = function (e3) { + return e3 > 65535 + ? ((e3 -= 65536), + String.fromCharCode(55296 + (e3 >> 10)) + + String.fromCharCode((e3 % 1024) + 56320)) + : String.fromCharCode(e3); + }), + (t2.utf32ToString = function (e3, t3 = 0, i2 = e3.length) { + let s2 = ""; + for (let r = t3; r < i2; ++r) { + let t4 = e3[r]; + t4 > 65535 + ? ((t4 -= 65536), + (s2 += + String.fromCharCode(55296 + (t4 >> 10)) + + String.fromCharCode((t4 % 1024) + 56320))) + : (s2 += String.fromCharCode(t4)); + } + return s2; + }), + (t2.StringToUtf32 = class { + constructor() { + this._interim = 0; + } + clear() { + this._interim = 0; + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2 = 0, + r = 0; + if (this._interim) { + const i3 = e3.charCodeAt(r++); + 56320 <= i3 && i3 <= 57343 + ? (t3[s2++] = + 1024 * (this._interim - 55296) + + i3 - + 56320 + + 65536) + : ((t3[s2++] = this._interim), (t3[s2++] = i3)), + (this._interim = 0); + } + for (let o = r; o < i2; ++o) { + const r2 = e3.charCodeAt(o); + if (55296 <= r2 && r2 <= 56319) { + if (++o >= i2) return (this._interim = r2), s2; + const n = e3.charCodeAt(o); + 56320 <= n && n <= 57343 + ? (t3[s2++] = + 1024 * (r2 - 55296) + n - 56320 + 65536) + : ((t3[s2++] = r2), (t3[s2++] = n)); + } else 65279 !== r2 && (t3[s2++] = r2); + } + return s2; + } + }), + (t2.Utf8ToUtf32 = class { + constructor() { + this.interim = new Uint8Array(3); + } + clear() { + this.interim.fill(0); + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2, + r, + o, + n, + a = 0, + h = 0, + l = 0; + if (this.interim[0]) { + let s3 = false, + r2 = this.interim[0]; + r2 &= + 192 == (224 & r2) ? 31 : 224 == (240 & r2) ? 15 : 7; + let o2, + n2 = 0; + for (; (o2 = 63 & this.interim[++n2]) && n2 < 4; ) + (r2 <<= 6), (r2 |= o2); + const h2 = + 192 == (224 & this.interim[0]) + ? 2 + : 224 == (240 & this.interim[0]) + ? 3 + : 4, + c2 = h2 - n2; + for (; l < c2; ) { + if (l >= i2) return 0; + if (((o2 = e3[l++]), 128 != (192 & o2))) { + l--, (s3 = true); + break; + } + (this.interim[n2++] = o2), + (r2 <<= 6), + (r2 |= 63 & o2); + } + s3 || + (2 === h2 + ? r2 < 128 + ? l-- + : (t3[a++] = r2) + : 3 === h2 + ? r2 < 2048 || + (r2 >= 55296 && r2 <= 57343) || + 65279 === r2 || + (t3[a++] = r2) + : r2 < 65536 || r2 > 1114111 || (t3[a++] = r2)), + this.interim.fill(0); + } + const c = i2 - 4; + let d = l; + for (; d < i2; ) { + for ( + ; + !( + !(d < c) || + 128 & (s2 = e3[d]) || + 128 & (r = e3[d + 1]) || + 128 & (o = e3[d + 2]) || + 128 & (n = e3[d + 3]) + ); + + ) + (t3[a++] = s2), + (t3[a++] = r), + (t3[a++] = o), + (t3[a++] = n), + (d += 4); + if (((s2 = e3[d++]), s2 < 128)) t3[a++] = s2; + else if (192 == (224 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (((h = ((31 & s2) << 6) | (63 & r)), h < 128)) { + d--; + continue; + } + t3[a++] = h; + } else if (224 == (240 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((o = e3[d++]), 128 != (192 & o))) { + d--; + continue; + } + if ( + ((h = + ((15 & s2) << 12) | ((63 & r) << 6) | (63 & o)), + h < 2048 || + (h >= 55296 && h <= 57343) || + 65279 === h) + ) + continue; + t3[a++] = h; + } else if (240 == (248 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((o = e3[d++]), 128 != (192 & o))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), + (this.interim[1] = r), + (this.interim[2] = o), + a + ); + if (((n = e3[d++]), 128 != (192 & n))) { + d--; + continue; + } + if ( + ((h = + ((7 & s2) << 18) | + ((63 & r) << 12) | + ((63 & o) << 6) | + (63 & n)), + h < 65536 || h > 1114111) + ) + continue; + t3[a++] = h; + } + } + return a; + } + }); + }, + 776: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + o2 = arguments.length, + n2 = + o2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + n2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (n2 = + (o2 < 3 + ? r2(n2) + : o2 > 3 + ? r2(t3, i3, n2) + : r2(t3, i3)) || n2); + return ( + o2 > 3 && n2 && Object.defineProperty(t3, i3, n2), n2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.traceCall = t2.setTraceLogger = t2.LogService = void 0); + const o = i2(859), + n = i2(97), + a = { + trace: n.LogLevelEnum.TRACE, + debug: n.LogLevelEnum.DEBUG, + info: n.LogLevelEnum.INFO, + warn: n.LogLevelEnum.WARN, + error: n.LogLevelEnum.ERROR, + off: n.LogLevelEnum.OFF, + }; + let h, + l = (t2.LogService = class extends o.Disposable { + get logLevel() { + return this._logLevel; + } + constructor(e3) { + super(), + (this._optionsService = e3), + (this._logLevel = n.LogLevelEnum.OFF), + this._updateLogLevel(), + this.register( + this._optionsService.onSpecificOptionChange( + "logLevel", + () => this._updateLogLevel() + ) + ), + (h = this); + } + _updateLogLevel() { + this._logLevel = + a[this._optionsService.rawOptions.logLevel]; + } + _evalLazyOptionalParams(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + "function" == typeof e3[t3] && (e3[t3] = e3[t3]()); + } + _log(e3, t3, i3) { + this._evalLazyOptionalParams(i3), + e3.call( + console, + (this._optionsService.options.logger + ? "" + : "xterm.js: ") + t3, + ...i3 + ); + } + trace(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.TRACE && + this._log( + this._optionsService.options.logger?.trace.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + debug(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.DEBUG && + this._log( + this._optionsService.options.logger?.debug.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + info(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.INFO && + this._log( + this._optionsService.options.logger?.info.bind( + this._optionsService.options.logger + ) ?? console.info, + e3, + t3 + ); + } + warn(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.WARN && + this._log( + this._optionsService.options.logger?.warn.bind( + this._optionsService.options.logger + ) ?? console.warn, + e3, + t3 + ); + } + error(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.ERROR && + this._log( + this._optionsService.options.logger?.error.bind( + this._optionsService.options.logger + ) ?? console.error, + e3, + t3 + ); + } + }); + (t2.LogService = l = s2([r(0, n.IOptionsService)], l)), + (t2.setTraceLogger = function (e3) { + h = e3; + }), + (t2.traceCall = function (e3, t3, i3) { + if ("function" != typeof i3.value) + throw new Error("not supported"); + const s3 = i3.value; + i3.value = function (...e4) { + if (h.logLevel !== n.LogLevelEnum.TRACE) + return s3.apply(this, e4); + h.trace( + `GlyphRenderer#${s3.name}(${e4.map((e5) => JSON.stringify(e5)).join(", ")})` + ); + const t4 = s3.apply(this, e4); + return ( + h.trace(`GlyphRenderer#${s3.name} return`, t4), t4 + ); + }; + }); + }, + 726: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createDecorator = + t2.getServiceDependencies = + t2.serviceRegistry = + void 0); + const i2 = "di$target", + s2 = "di$dependencies"; + (t2.serviceRegistry = /* @__PURE__ */ new Map()), + (t2.getServiceDependencies = function (e3) { + return e3[s2] || []; + }), + (t2.createDecorator = function (e3) { + if (t2.serviceRegistry.has(e3)) + return t2.serviceRegistry.get(e3); + const r = function (e4, t3, o) { + if (3 !== arguments.length) + throw new Error( + "@IServiceName-decorator can only be used to decorate a parameter" + ); + !(function (e5, t4, r2) { + t4[i2] === t4 + ? t4[s2].push({ id: e5, index: r2 }) + : ((t4[s2] = [{ id: e5, index: r2 }]), + (t4[i2] = t4)); + })(r, e4, o); + }; + return ( + (r.toString = () => e3), + t2.serviceRegistry.set(e3, r), + r + ); + }); + }, + 97: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.IDecorationService = + t2.IUnicodeService = + t2.IOscLinkService = + t2.IOptionsService = + t2.ILogService = + t2.LogLevelEnum = + t2.IInstantiationService = + t2.ICharsetService = + t2.ICoreService = + t2.ICoreMouseService = + t2.IBufferService = + void 0); + const s2 = i2(726); + var r; + (t2.IBufferService = (0, s2.createDecorator)( + "BufferService" + )), + (t2.ICoreMouseService = (0, s2.createDecorator)( + "CoreMouseService" + )), + (t2.ICoreService = (0, s2.createDecorator)("CoreService")), + (t2.ICharsetService = (0, s2.createDecorator)( + "CharsetService" + )), + (t2.IInstantiationService = (0, s2.createDecorator)( + "InstantiationService" + )), + (function (e3) { + (e3[(e3.TRACE = 0)] = "TRACE"), + (e3[(e3.DEBUG = 1)] = "DEBUG"), + (e3[(e3.INFO = 2)] = "INFO"), + (e3[(e3.WARN = 3)] = "WARN"), + (e3[(e3.ERROR = 4)] = "ERROR"), + (e3[(e3.OFF = 5)] = "OFF"); + })(r || (t2.LogLevelEnum = r = {})), + (t2.ILogService = (0, s2.createDecorator)("LogService")), + (t2.IOptionsService = (0, s2.createDecorator)( + "OptionsService" + )), + (t2.IOscLinkService = (0, s2.createDecorator)( + "OscLinkService" + )), + (t2.IUnicodeService = (0, s2.createDecorator)( + "UnicodeService" + )), + (t2.IDecorationService = (0, s2.createDecorator)( + "DecorationService" + )); + }, + }, + t = {}; + function i(s2) { + var r = t[s2]; + if (void 0 !== r) return r.exports; + var o = (t[s2] = { exports: {} }); + return e[s2].call(o.exports, o, o.exports, i), o.exports; + } + var s = {}; + return ( + (() => { + var e2 = s; + Object.defineProperty(e2, "__esModule", { value: true }), + (e2.WebglAddon = void 0); + const t2 = i(345), + r = i(859), + o = i(399), + n = i(666), + a = i(776); + class h extends r.Disposable { + constructor(e3) { + if (o.isSafari && (0, o.getSafariVersion)() < 16) { + const e4 = { + antialias: false, + depth: false, + preserveDrawingBuffer: true, + }; + if ( + !document + .createElement("canvas") + .getContext("webgl2", e4) + ) + throw new Error( + "Webgl2 is only supported on Safari 16 and above" + ); + } + super(), + (this._preserveDrawingBuffer = e3), + (this._onChangeTextureAtlas = this.register( + new t2.EventEmitter() + )), + (this.onChangeTextureAtlas = + this._onChangeTextureAtlas.event), + (this._onAddTextureAtlasCanvas = this.register( + new t2.EventEmitter() + )), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event), + (this._onRemoveTextureAtlasCanvas = this.register( + new t2.EventEmitter() + )), + (this.onRemoveTextureAtlasCanvas = + this._onRemoveTextureAtlasCanvas.event), + (this._onContextLoss = this.register( + new t2.EventEmitter() + )), + (this.onContextLoss = this._onContextLoss.event); + } + activate(e3) { + const i2 = e3._core; + if (!e3.element) + return void this.register( + i2.onWillOpen(() => this.activate(e3)) + ); + this._terminal = e3; + const s2 = i2.coreService, + o2 = i2.optionsService, + h2 = i2, + l = h2._renderService, + c = h2._characterJoinerService, + d = h2._charSizeService, + _ = h2._coreBrowserService, + u = h2._decorationService, + g = h2._logService, + v = h2._themeService; + (0, a.setTraceLogger)(g), + (this._renderer = this.register( + new n.WebglRenderer( + e3, + c, + d, + _, + s2, + u, + o2, + v, + this._preserveDrawingBuffer + ) + )), + this.register( + (0, t2.forwardEvent)( + this._renderer.onContextLoss, + this._onContextLoss + ) + ), + this.register( + (0, t2.forwardEvent)( + this._renderer.onChangeTextureAtlas, + this._onChangeTextureAtlas + ) + ), + this.register( + (0, t2.forwardEvent)( + this._renderer.onAddTextureAtlasCanvas, + this._onAddTextureAtlasCanvas + ) + ), + this.register( + (0, t2.forwardEvent)( + this._renderer.onRemoveTextureAtlasCanvas, + this._onRemoveTextureAtlasCanvas + ) + ), + l.setRenderer(this._renderer), + this.register( + (0, r.toDisposable)(() => { + const t3 = this._terminal._core._renderService; + t3.setRenderer( + this._terminal._core._createRenderer() + ), + t3.handleResize(e3.cols, e3.rows); + }) + ); + } + get textureAtlas() { + return this._renderer?.textureAtlas; + } + clearTextureAtlas() { + this._renderer?.clearTextureAtlas(); + } + } + e2.WebglAddon = h; + })(), + s + ); + })() + ); + }, + }); + + // node_modules/@xterm/addon-fit/lib/addon-fit.js + var require_addon_fit = __commonJS({ + "node_modules/@xterm/addon-fit/lib/addon-fit.js"(exports, module) { + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t()) + : "function" == typeof define && define.amd + ? define([], t) + : "object" == typeof exports + ? (exports.FitAddon = t()) + : (e.FitAddon = t()); + })(self, () => + (() => { + "use strict"; + var e = {}; + return ( + (() => { + var t = e; + Object.defineProperty(t, "__esModule", { value: true }), + (t.FitAddon = void 0), + (t.FitAddon = class { + activate(e2) { + this._terminal = e2; + } + dispose() {} + fit() { + const e2 = this.proposeDimensions(); + if ( + !e2 || + !this._terminal || + isNaN(e2.cols) || + isNaN(e2.rows) + ) + return; + const t2 = this._terminal._core; + (this._terminal.rows === e2.rows && + this._terminal.cols === e2.cols) || + (t2._renderService.clear(), + this._terminal.resize(e2.cols, e2.rows)); + } + proposeDimensions() { + if (!this._terminal) return; + if ( + !this._terminal.element || + !this._terminal.element.parentElement + ) + return; + const e2 = this._terminal._core, + t2 = e2._renderService.dimensions; + if (0 === t2.css.cell.width || 0 === t2.css.cell.height) + return; + const r = + 0 === this._terminal.options.scrollback + ? 0 + : e2.viewport.scrollBarWidth, + i = window.getComputedStyle( + this._terminal.element.parentElement + ), + o = parseInt(i.getPropertyValue("height")), + s = Math.max(0, parseInt(i.getPropertyValue("width"))), + n = window.getComputedStyle(this._terminal.element), + l = + o - + (parseInt(n.getPropertyValue("padding-top")) + + parseInt(n.getPropertyValue("padding-bottom"))), + a = + s - + (parseInt(n.getPropertyValue("padding-right")) + + parseInt(n.getPropertyValue("padding-left"))) - + r; + return { + cols: Math.max(2, Math.floor(a / t2.css.cell.width)), + rows: Math.max(1, Math.floor(l / t2.css.cell.height)), + }; + } + }); + })(), + e + ); + })() + ); + }, + }); + + // node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js + var require_addon_unicode11 = __commonJS({ + "node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js"( + exports, + module + ) { + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t()) + : "function" == typeof define && define.amd + ? define([], t) + : "object" == typeof exports + ? (exports.Unicode11Addon = t()) + : (e.Unicode11Addon = t()); + })(exports, () => + (() => { + "use strict"; + var e = { + 433: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeV11 = void 0); + const r2 = i2(938), + s = [ + [768, 879], + [1155, 1161], + [1425, 1469], + [1471, 1471], + [1473, 1474], + [1476, 1477], + [1479, 1479], + [1536, 1541], + [1552, 1562], + [1564, 1564], + [1611, 1631], + [1648, 1648], + [1750, 1757], + [1759, 1764], + [1767, 1768], + [1770, 1773], + [1807, 1807], + [1809, 1809], + [1840, 1866], + [1958, 1968], + [2027, 2035], + [2045, 2045], + [2070, 2073], + [2075, 2083], + [2085, 2087], + [2089, 2093], + [2137, 2139], + [2259, 2306], + [2362, 2362], + [2364, 2364], + [2369, 2376], + [2381, 2381], + [2385, 2391], + [2402, 2403], + [2433, 2433], + [2492, 2492], + [2497, 2500], + [2509, 2509], + [2530, 2531], + [2558, 2558], + [2561, 2562], + [2620, 2620], + [2625, 2626], + [2631, 2632], + [2635, 2637], + [2641, 2641], + [2672, 2673], + [2677, 2677], + [2689, 2690], + [2748, 2748], + [2753, 2757], + [2759, 2760], + [2765, 2765], + [2786, 2787], + [2810, 2815], + [2817, 2817], + [2876, 2876], + [2879, 2879], + [2881, 2884], + [2893, 2893], + [2902, 2902], + [2914, 2915], + [2946, 2946], + [3008, 3008], + [3021, 3021], + [3072, 3072], + [3076, 3076], + [3134, 3136], + [3142, 3144], + [3146, 3149], + [3157, 3158], + [3170, 3171], + [3201, 3201], + [3260, 3260], + [3263, 3263], + [3270, 3270], + [3276, 3277], + [3298, 3299], + [3328, 3329], + [3387, 3388], + [3393, 3396], + [3405, 3405], + [3426, 3427], + [3530, 3530], + [3538, 3540], + [3542, 3542], + [3633, 3633], + [3636, 3642], + [3655, 3662], + [3761, 3761], + [3764, 3772], + [3784, 3789], + [3864, 3865], + [3893, 3893], + [3895, 3895], + [3897, 3897], + [3953, 3966], + [3968, 3972], + [3974, 3975], + [3981, 3991], + [3993, 4028], + [4038, 4038], + [4141, 4144], + [4146, 4151], + [4153, 4154], + [4157, 4158], + [4184, 4185], + [4190, 4192], + [4209, 4212], + [4226, 4226], + [4229, 4230], + [4237, 4237], + [4253, 4253], + [4448, 4607], + [4957, 4959], + [5906, 5908], + [5938, 5940], + [5970, 5971], + [6002, 6003], + [6068, 6069], + [6071, 6077], + [6086, 6086], + [6089, 6099], + [6109, 6109], + [6155, 6158], + [6277, 6278], + [6313, 6313], + [6432, 6434], + [6439, 6440], + [6450, 6450], + [6457, 6459], + [6679, 6680], + [6683, 6683], + [6742, 6742], + [6744, 6750], + [6752, 6752], + [6754, 6754], + [6757, 6764], + [6771, 6780], + [6783, 6783], + [6832, 6846], + [6912, 6915], + [6964, 6964], + [6966, 6970], + [6972, 6972], + [6978, 6978], + [7019, 7027], + [7040, 7041], + [7074, 7077], + [7080, 7081], + [7083, 7085], + [7142, 7142], + [7144, 7145], + [7149, 7149], + [7151, 7153], + [7212, 7219], + [7222, 7223], + [7376, 7378], + [7380, 7392], + [7394, 7400], + [7405, 7405], + [7412, 7412], + [7416, 7417], + [7616, 7673], + [7675, 7679], + [8203, 8207], + [8234, 8238], + [8288, 8292], + [8294, 8303], + [8400, 8432], + [11503, 11505], + [11647, 11647], + [11744, 11775], + [12330, 12333], + [12441, 12442], + [42607, 42610], + [42612, 42621], + [42654, 42655], + [42736, 42737], + [43010, 43010], + [43014, 43014], + [43019, 43019], + [43045, 43046], + [43204, 43205], + [43232, 43249], + [43263, 43263], + [43302, 43309], + [43335, 43345], + [43392, 43394], + [43443, 43443], + [43446, 43449], + [43452, 43453], + [43493, 43493], + [43561, 43566], + [43569, 43570], + [43573, 43574], + [43587, 43587], + [43596, 43596], + [43644, 43644], + [43696, 43696], + [43698, 43700], + [43703, 43704], + [43710, 43711], + [43713, 43713], + [43756, 43757], + [43766, 43766], + [44005, 44005], + [44008, 44008], + [44013, 44013], + [64286, 64286], + [65024, 65039], + [65056, 65071], + [65279, 65279], + [65529, 65531], + ], + n = [ + [66045, 66045], + [66272, 66272], + [66422, 66426], + [68097, 68099], + [68101, 68102], + [68108, 68111], + [68152, 68154], + [68159, 68159], + [68325, 68326], + [68900, 68903], + [69446, 69456], + [69633, 69633], + [69688, 69702], + [69759, 69761], + [69811, 69814], + [69817, 69818], + [69821, 69821], + [69837, 69837], + [69888, 69890], + [69927, 69931], + [69933, 69940], + [70003, 70003], + [70016, 70017], + [70070, 70078], + [70089, 70092], + [70191, 70193], + [70196, 70196], + [70198, 70199], + [70206, 70206], + [70367, 70367], + [70371, 70378], + [70400, 70401], + [70459, 70460], + [70464, 70464], + [70502, 70508], + [70512, 70516], + [70712, 70719], + [70722, 70724], + [70726, 70726], + [70750, 70750], + [70835, 70840], + [70842, 70842], + [70847, 70848], + [70850, 70851], + [71090, 71093], + [71100, 71101], + [71103, 71104], + [71132, 71133], + [71219, 71226], + [71229, 71229], + [71231, 71232], + [71339, 71339], + [71341, 71341], + [71344, 71349], + [71351, 71351], + [71453, 71455], + [71458, 71461], + [71463, 71467], + [71727, 71735], + [71737, 71738], + [72148, 72151], + [72154, 72155], + [72160, 72160], + [72193, 72202], + [72243, 72248], + [72251, 72254], + [72263, 72263], + [72273, 72278], + [72281, 72283], + [72330, 72342], + [72344, 72345], + [72752, 72758], + [72760, 72765], + [72767, 72767], + [72850, 72871], + [72874, 72880], + [72882, 72883], + [72885, 72886], + [73009, 73014], + [73018, 73018], + [73020, 73021], + [73023, 73029], + [73031, 73031], + [73104, 73105], + [73109, 73109], + [73111, 73111], + [73459, 73460], + [78896, 78904], + [92912, 92916], + [92976, 92982], + [94031, 94031], + [94095, 94098], + [113821, 113822], + [113824, 113827], + [119143, 119145], + [119155, 119170], + [119173, 119179], + [119210, 119213], + [119362, 119364], + [121344, 121398], + [121403, 121452], + [121461, 121461], + [121476, 121476], + [121499, 121503], + [121505, 121519], + [122880, 122886], + [122888, 122904], + [122907, 122913], + [122915, 122916], + [122918, 122922], + [123184, 123190], + [123628, 123631], + [125136, 125142], + [125252, 125258], + [917505, 917505], + [917536, 917631], + [917760, 917999], + ], + o = [ + [4352, 4447], + [8986, 8987], + [9001, 9002], + [9193, 9196], + [9200, 9200], + [9203, 9203], + [9725, 9726], + [9748, 9749], + [9800, 9811], + [9855, 9855], + [9875, 9875], + [9889, 9889], + [9898, 9899], + [9917, 9918], + [9924, 9925], + [9934, 9934], + [9940, 9940], + [9962, 9962], + [9970, 9971], + [9973, 9973], + [9978, 9978], + [9981, 9981], + [9989, 9989], + [9994, 9995], + [10024, 10024], + [10060, 10060], + [10062, 10062], + [10067, 10069], + [10071, 10071], + [10133, 10135], + [10160, 10160], + [10175, 10175], + [11035, 11036], + [11088, 11088], + [11093, 11093], + [11904, 11929], + [11931, 12019], + [12032, 12245], + [12272, 12283], + [12288, 12329], + [12334, 12350], + [12353, 12438], + [12443, 12543], + [12549, 12591], + [12593, 12686], + [12688, 12730], + [12736, 12771], + [12784, 12830], + [12832, 12871], + [12880, 19903], + [19968, 42124], + [42128, 42182], + [43360, 43388], + [44032, 55203], + [63744, 64255], + [65040, 65049], + [65072, 65106], + [65108, 65126], + [65128, 65131], + [65281, 65376], + [65504, 65510], + ], + c = [ + [94176, 94179], + [94208, 100343], + [100352, 101106], + [110592, 110878], + [110928, 110930], + [110948, 110951], + [110960, 111355], + [126980, 126980], + [127183, 127183], + [127374, 127374], + [127377, 127386], + [127488, 127490], + [127504, 127547], + [127552, 127560], + [127568, 127569], + [127584, 127589], + [127744, 127776], + [127789, 127797], + [127799, 127868], + [127870, 127891], + [127904, 127946], + [127951, 127955], + [127968, 127984], + [127988, 127988], + [127992, 128062], + [128064, 128064], + [128066, 128252], + [128255, 128317], + [128331, 128334], + [128336, 128359], + [128378, 128378], + [128405, 128406], + [128420, 128420], + [128507, 128591], + [128640, 128709], + [128716, 128716], + [128720, 128722], + [128725, 128725], + [128747, 128748], + [128756, 128762], + [128992, 129003], + [129293, 129393], + [129395, 129398], + [129402, 129442], + [129445, 129450], + [129454, 129482], + [129485, 129535], + [129648, 129651], + [129656, 129658], + [129664, 129666], + [129680, 129685], + [131072, 196605], + [196608, 262141], + ]; + let l; + function d(e3, t3) { + let i3, + r3 = 0, + s2 = t3.length - 1; + if (e3 < t3[0][0] || e3 > t3[s2][1]) return false; + for (; s2 >= r3; ) + if (((i3 = (r3 + s2) >> 1), e3 > t3[i3][1])) r3 = i3 + 1; + else { + if (!(e3 < t3[i3][0])) return true; + s2 = i3 - 1; + } + return false; + } + t2.UnicodeV11 = class { + constructor() { + if (((this.version = "11"), !l)) { + (l = new Uint8Array(65536)), + l.fill(1), + (l[0] = 0), + l.fill(0, 1, 32), + l.fill(0, 127, 160); + for (let e3 = 0; e3 < s.length; ++e3) + l.fill(0, s[e3][0], s[e3][1] + 1); + for (let e3 = 0; e3 < o.length; ++e3) + l.fill(2, o[e3][0], o[e3][1] + 1); + } + } + wcwidth(e3) { + return e3 < 32 + ? 0 + : e3 < 127 + ? 1 + : e3 < 65536 + ? l[e3] + : d(e3, n) + ? 0 + : d(e3, c) + ? 2 + : 1; + } + charProperties(e3, t3) { + let i3 = this.wcwidth(e3), + s2 = 0 === i3 && 0 !== t3; + if (s2) { + const e4 = r2.UnicodeService.extractWidth(t3); + 0 === e4 ? (s2 = false) : e4 > i3 && (i3 = e4); + } + return r2.UnicodeService.createPropertyValue(0, i3, s2); + } + }; + }, + 345: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.runAndSubscribe = + t2.forwardEvent = + t2.EventEmitter = + void 0), + (t2.EventEmitter = class { + constructor() { + (this._listeners = []), (this._disposed = false); + } + get event() { + return ( + this._event || + (this._event = (e3) => ( + this._listeners.push(e3), + { + dispose: () => { + if (!this._disposed) { + for ( + let t3 = 0; + t3 < this._listeners.length; + t3++ + ) + if (this._listeners[t3] === e3) + return void this._listeners.splice( + t3, + 1 + ); + } + }, + } + )), + this._event + ); + } + fire(e3, t3) { + const i2 = []; + for (let e4 = 0; e4 < this._listeners.length; e4++) + i2.push(this._listeners[e4]); + for (let r2 = 0; r2 < i2.length; r2++) + i2[r2].call(void 0, e3, t3); + } + dispose() { + this.clearListeners(), (this._disposed = true); + } + clearListeners() { + this._listeners && (this._listeners.length = 0); + } + }), + (t2.forwardEvent = function (e3, t3) { + return e3((e4) => t3.fire(e4)); + }), + (t2.runAndSubscribe = function (e3, t3) { + return t3(void 0), e3((e4) => t3(e4)); + }); + }, + 490: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeV6 = void 0); + const r2 = i2(938), + s = [ + [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], + ], + n = [ + [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], + ]; + let o; + t2.UnicodeV6 = class { + constructor() { + if (((this.version = "6"), !o)) { + (o = new Uint8Array(65536)), + o.fill(1), + (o[0] = 0), + o.fill(0, 1, 32), + o.fill(0, 127, 160), + o.fill(2, 4352, 4448), + (o[9001] = 2), + (o[9002] = 2), + o.fill(2, 11904, 42192), + (o[12351] = 1), + o.fill(2, 44032, 55204), + o.fill(2, 63744, 64256), + o.fill(2, 65040, 65050), + o.fill(2, 65072, 65136), + o.fill(2, 65280, 65377), + o.fill(2, 65504, 65511); + for (let e3 = 0; e3 < s.length; ++e3) + o.fill(0, s[e3][0], s[e3][1] + 1); + } + } + wcwidth(e3) { + return e3 < 32 + ? 0 + : e3 < 127 + ? 1 + : e3 < 65536 + ? o[e3] + : (function (e4, t3) { + let i3, + r3 = 0, + s2 = t3.length - 1; + if (e4 < t3[0][0] || e4 > t3[s2][1]) + return false; + for (; s2 >= r3; ) + if (((i3 = (r3 + s2) >> 1), e4 > t3[i3][1])) + r3 = i3 + 1; + else { + if (!(e4 < t3[i3][0])) return true; + s2 = i3 - 1; + } + return false; + })(e3, n) + ? 0 + : (e3 >= 131072 && e3 <= 196605) || + (e3 >= 196608 && e3 <= 262141) + ? 2 + : 1; + } + charProperties(e3, t3) { + let i3 = this.wcwidth(e3), + s2 = 0 === i3 && 0 !== t3; + if (s2) { + const e4 = r2.UnicodeService.extractWidth(t3); + 0 === e4 ? (s2 = false) : e4 > i3 && (i3 = e4); + } + return r2.UnicodeService.createPropertyValue(0, i3, s2); + } + }; + }, + 938: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.UnicodeService = void 0); + const r2 = i2(345), + s = i2(490); + class n { + static extractShouldJoin(e3) { + return 0 != (1 & e3); + } + static extractWidth(e3) { + return (e3 >> 1) & 3; + } + static extractCharKind(e3) { + return e3 >> 3; + } + static createPropertyValue(e3, t3, i3 = false) { + return ( + ((16777215 & e3) << 3) | ((3 & t3) << 1) | (i3 ? 1 : 0) + ); + } + constructor() { + (this._providers = /* @__PURE__ */ Object.create(null)), + (this._active = ""), + (this._onChange = new r2.EventEmitter()), + (this.onChange = this._onChange.event); + const e3 = new s.UnicodeV6(); + this.register(e3), + (this._active = e3.version), + (this._activeProvider = e3); + } + dispose() { + this._onChange.dispose(); + } + get versions() { + return Object.keys(this._providers); + } + get activeVersion() { + return this._active; + } + set activeVersion(e3) { + if (!this._providers[e3]) + throw new Error(`unknown Unicode version "${e3}"`); + (this._active = e3), + (this._activeProvider = this._providers[e3]), + this._onChange.fire(e3); + } + register(e3) { + this._providers[e3.version] = e3; + } + wcwidth(e3) { + return this._activeProvider.wcwidth(e3); + } + getStringCellWidth(e3) { + let t3 = 0, + i3 = 0; + const r3 = e3.length; + for (let s2 = 0; s2 < r3; ++s2) { + let o = e3.charCodeAt(s2); + if (55296 <= o && o <= 56319) { + if (++s2 >= r3) return t3 + this.wcwidth(o); + const i4 = e3.charCodeAt(s2); + 56320 <= i4 && i4 <= 57343 + ? (o = 1024 * (o - 55296) + i4 - 56320 + 65536) + : (t3 += this.wcwidth(i4)); + } + const c = this.charProperties(o, i3); + let l = n.extractWidth(c); + n.extractShouldJoin(c) && (l -= n.extractWidth(i3)), + (t3 += l), + (i3 = c); + } + return t3; + } + charProperties(e3, t3) { + return this._activeProvider.charProperties(e3, t3); + } + } + t2.UnicodeService = n; + }, + }, + t = {}; + function i(r2) { + var s = t[r2]; + if (void 0 !== s) return s.exports; + var n = (t[r2] = { exports: {} }); + return e[r2](n, n.exports, i), n.exports; + } + var r = {}; + return ( + (() => { + var e2 = r; + Object.defineProperty(e2, "__esModule", { value: true }), + (e2.Unicode11Addon = void 0); + const t2 = i(433); + e2.Unicode11Addon = class { + activate(e3) { + e3.unicode.register(new t2.UnicodeV11()); + } + dispose() {} + }; + })(), + r + ); + })() + ); + }, + }); + + // node_modules/@xterm/addon-canvas/lib/addon-canvas.js + var require_addon_canvas = __commonJS({ + "node_modules/@xterm/addon-canvas/lib/addon-canvas.js"(exports, module) { + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t()) + : "function" == typeof define && define.amd + ? define([], t) + : "object" == typeof exports + ? (exports.CanvasAddon = t()) + : (e.CanvasAddon = t()); + })(self, () => + (() => { + "use strict"; + var e = { + 903: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.BaseRenderLayer = void 0); + const s2 = i2(274), + r = i2(627), + o = i2(237), + n = i2(860), + a = i2(374), + h = i2(296), + l = i2(345), + c = i2(859), + d = i2(399), + _ = i2(855); + class u extends c.Disposable { + get canvas() { + return this._canvas; + } + get cacheCanvas() { + return this._charAtlas?.pages[0].canvas; + } + constructor(e3, t3, i3, r2, o2, n2, a2, d2, _2, u2) { + super(), + (this._terminal = e3), + (this._container = t3), + (this._alpha = o2), + (this._themeService = n2), + (this._bufferService = a2), + (this._optionsService = d2), + (this._decorationService = _2), + (this._coreBrowserService = u2), + (this._deviceCharWidth = 0), + (this._deviceCharHeight = 0), + (this._deviceCellWidth = 0), + (this._deviceCellHeight = 0), + (this._deviceCharLeft = 0), + (this._deviceCharTop = 0), + (this._selectionModel = (0, + h.createSelectionRenderModel)()), + (this._bitmapGenerator = []), + (this._charAtlasDisposable = this.register( + new c.MutableDisposable() + )), + (this._onAddTextureAtlasCanvas = this.register( + new l.EventEmitter() + )), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event), + (this._cellColorResolver = new s2.CellColorResolver( + this._terminal, + this._optionsService, + this._selectionModel, + this._decorationService, + this._coreBrowserService, + this._themeService + )), + (this._canvas = + this._coreBrowserService.mainDocument.createElement( + "canvas" + )), + this._canvas.classList.add(`xterm-${i3}-layer`), + (this._canvas.style.zIndex = r2.toString()), + this._initCanvas(), + this._container.appendChild(this._canvas), + this._refreshCharAtlas(this._themeService.colors), + this.register( + this._themeService.onChangeColors((e4) => { + this._refreshCharAtlas(e4), + this.reset(), + this.handleSelectionChanged( + this._selectionModel.selectionStart, + this._selectionModel.selectionEnd, + this._selectionModel.columnSelectMode + ); + }) + ), + this.register( + (0, c.toDisposable)(() => { + this._canvas.remove(); + }) + ); + } + _initCanvas() { + (this._ctx = (0, a.throwIfFalsy)( + this._canvas.getContext("2d", { alpha: this._alpha }) + )), + this._alpha || this._clearAll(); + } + handleBlur() {} + handleFocus() {} + handleCursorMove() {} + handleGridChanged(e3, t3) {} + handleSelectionChanged(e3, t3, i3 = false) { + this._selectionModel.update( + this._terminal._core, + e3, + t3, + i3 + ); + } + _setTransparency(e3) { + if (e3 === this._alpha) return; + const t3 = this._canvas; + (this._alpha = e3), + (this._canvas = this._canvas.cloneNode()), + this._initCanvas(), + this._container.replaceChild(this._canvas, t3), + this._refreshCharAtlas(this._themeService.colors), + this.handleGridChanged(0, this._bufferService.rows - 1); + } + _refreshCharAtlas(e3) { + if ( + !( + this._deviceCharWidth <= 0 && + this._deviceCharHeight <= 0 + ) + ) { + (this._charAtlas = (0, r.acquireTextureAtlas)( + this._terminal, + this._optionsService.rawOptions, + e3, + this._deviceCellWidth, + this._deviceCellHeight, + this._deviceCharWidth, + this._deviceCharHeight, + this._coreBrowserService.dpr + )), + (this._charAtlasDisposable.value = (0, + l.forwardEvent)( + this._charAtlas.onAddTextureAtlasCanvas, + this._onAddTextureAtlasCanvas + )), + this._charAtlas.warmUp(); + for ( + let e4 = 0; + e4 < this._charAtlas.pages.length; + e4++ + ) + this._bitmapGenerator[e4] = new g( + this._charAtlas.pages[e4].canvas + ); + } + } + resize(e3) { + (this._deviceCellWidth = e3.device.cell.width), + (this._deviceCellHeight = e3.device.cell.height), + (this._deviceCharWidth = e3.device.char.width), + (this._deviceCharHeight = e3.device.char.height), + (this._deviceCharLeft = e3.device.char.left), + (this._deviceCharTop = e3.device.char.top), + (this._canvas.width = e3.device.canvas.width), + (this._canvas.height = e3.device.canvas.height), + (this._canvas.style.width = `${e3.css.canvas.width}px`), + (this._canvas.style.height = `${e3.css.canvas.height}px`), + this._alpha || this._clearAll(), + this._refreshCharAtlas(this._themeService.colors); + } + clearTextureAtlas() { + this._charAtlas?.clearTexture(); + } + _fillCells(e3, t3, i3, s3) { + this._ctx.fillRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + s3 * this._deviceCellHeight + ); + } + _fillMiddleLineAtCells(e3, t3, i3 = 1) { + const s3 = Math.ceil(0.5 * this._deviceCellHeight); + this._ctx.fillRect( + e3 * this._deviceCellWidth, + (t3 + 1) * this._deviceCellHeight - + s3 - + this._coreBrowserService.dpr, + i3 * this._deviceCellWidth, + this._coreBrowserService.dpr + ); + } + _fillBottomLineAtCells(e3, t3, i3 = 1, s3 = 0) { + this._ctx.fillRect( + e3 * this._deviceCellWidth, + (t3 + 1) * this._deviceCellHeight + + s3 - + this._coreBrowserService.dpr - + 1, + i3 * this._deviceCellWidth, + this._coreBrowserService.dpr + ); + } + _curlyUnderlineAtCell(e3, t3, i3 = 1) { + this._ctx.save(), + this._ctx.beginPath(), + (this._ctx.strokeStyle = this._ctx.fillStyle); + const s3 = this._coreBrowserService.dpr; + this._ctx.lineWidth = s3; + for (let r2 = 0; r2 < i3; r2++) { + const i4 = (e3 + r2) * this._deviceCellWidth, + o2 = (e3 + r2 + 0.5) * this._deviceCellWidth, + n2 = (e3 + r2 + 1) * this._deviceCellWidth, + a2 = (t3 + 1) * this._deviceCellHeight - s3 - 1, + h2 = a2 - s3, + l2 = a2 + s3; + this._ctx.moveTo(i4, a2), + this._ctx.bezierCurveTo(i4, h2, o2, h2, o2, a2), + this._ctx.bezierCurveTo(o2, l2, n2, l2, n2, a2); + } + this._ctx.stroke(), this._ctx.restore(); + } + _dottedUnderlineAtCell(e3, t3, i3 = 1) { + this._ctx.save(), + this._ctx.beginPath(), + (this._ctx.strokeStyle = this._ctx.fillStyle); + const s3 = this._coreBrowserService.dpr; + (this._ctx.lineWidth = s3), + this._ctx.setLineDash([2 * s3, s3]); + const r2 = e3 * this._deviceCellWidth, + o2 = (t3 + 1) * this._deviceCellHeight - s3 - 1; + this._ctx.moveTo(r2, o2); + for (let t4 = 0; t4 < i3; t4++) { + const s4 = (e3 + i3 + t4) * this._deviceCellWidth; + this._ctx.lineTo(s4, o2); + } + this._ctx.stroke(), + this._ctx.closePath(), + this._ctx.restore(); + } + _dashedUnderlineAtCell(e3, t3, i3 = 1) { + this._ctx.save(), + this._ctx.beginPath(), + (this._ctx.strokeStyle = this._ctx.fillStyle); + const s3 = this._coreBrowserService.dpr; + (this._ctx.lineWidth = s3), + this._ctx.setLineDash([4 * s3, 3 * s3]); + const r2 = e3 * this._deviceCellWidth, + o2 = (e3 + i3) * this._deviceCellWidth, + n2 = (t3 + 1) * this._deviceCellHeight - s3 - 1; + this._ctx.moveTo(r2, n2), + this._ctx.lineTo(o2, n2), + this._ctx.stroke(), + this._ctx.closePath(), + this._ctx.restore(); + } + _fillLeftLineAtCell(e3, t3, i3) { + this._ctx.fillRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + this._coreBrowserService.dpr * i3, + this._deviceCellHeight + ); + } + _strokeRectAtCell(e3, t3, i3, s3) { + const r2 = this._coreBrowserService.dpr; + (this._ctx.lineWidth = r2), + this._ctx.strokeRect( + e3 * this._deviceCellWidth + r2 / 2, + t3 * this._deviceCellHeight + r2 / 2, + i3 * this._deviceCellWidth - r2, + s3 * this._deviceCellHeight - r2 + ); + } + _clearAll() { + this._alpha + ? this._ctx.clearRect( + 0, + 0, + this._canvas.width, + this._canvas.height + ) + : ((this._ctx.fillStyle = + this._themeService.colors.background.css), + this._ctx.fillRect( + 0, + 0, + this._canvas.width, + this._canvas.height + )); + } + _clearCells(e3, t3, i3, s3) { + this._alpha + ? this._ctx.clearRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + s3 * this._deviceCellHeight + ) + : ((this._ctx.fillStyle = + this._themeService.colors.background.css), + this._ctx.fillRect( + e3 * this._deviceCellWidth, + t3 * this._deviceCellHeight, + i3 * this._deviceCellWidth, + s3 * this._deviceCellHeight + )); + } + _fillCharTrueColor(e3, t3, i3) { + (this._ctx.font = this._getFont(false, false)), + (this._ctx.textBaseline = o.TEXT_BASELINE), + this._clipRow(i3); + let s3 = false; + false !== this._optionsService.rawOptions.customGlyphs && + (s3 = (0, n.tryDrawCustomChar)( + this._ctx, + e3.getChars(), + t3 * this._deviceCellWidth, + i3 * this._deviceCellHeight, + this._deviceCellWidth, + this._deviceCellHeight, + this._optionsService.rawOptions.fontSize, + this._coreBrowserService.dpr + )), + s3 || + this._ctx.fillText( + e3.getChars(), + t3 * this._deviceCellWidth + this._deviceCharLeft, + i3 * this._deviceCellHeight + + this._deviceCharTop + + this._deviceCharHeight + ); + } + _drawChars(e3, t3, i3) { + const s3 = e3.getChars(), + r2 = e3.getCode(), + o2 = e3.getWidth(); + if ( + (this._cellColorResolver.resolve( + e3, + t3, + this._bufferService.buffer.ydisp + i3, + this._deviceCellWidth + ), + !this._charAtlas) + ) + return; + let n2; + if ( + ((n2 = + s3 && s3.length > 1 + ? this._charAtlas.getRasterizedGlyphCombinedChar( + s3, + this._cellColorResolver.result.bg, + this._cellColorResolver.result.fg, + this._cellColorResolver.result.ext, + true + ) + : this._charAtlas.getRasterizedGlyph( + e3.getCode() || _.WHITESPACE_CELL_CODE, + this._cellColorResolver.result.bg, + this._cellColorResolver.result.fg, + this._cellColorResolver.result.ext, + true + )), + !n2.size.x || !n2.size.y) + ) + return; + this._ctx.save(), + this._clipRow(i3), + this._bitmapGenerator[n2.texturePage] && + this._charAtlas.pages[n2.texturePage].canvas !== + this._bitmapGenerator[n2.texturePage].canvas && + (this._bitmapGenerator[ + n2.texturePage + ]?.bitmap?.close(), + delete this._bitmapGenerator[n2.texturePage]), + this._charAtlas.pages[n2.texturePage].version !== + this._bitmapGenerator[n2.texturePage]?.version && + (this._bitmapGenerator[n2.texturePage] || + (this._bitmapGenerator[n2.texturePage] = new g( + this._charAtlas.pages[n2.texturePage].canvas + )), + this._bitmapGenerator[n2.texturePage].refresh(), + (this._bitmapGenerator[n2.texturePage].version = + this._charAtlas.pages[n2.texturePage].version)); + let h2 = n2.size.x; + this._optionsService.rawOptions + .rescaleOverlappingGlyphs && + (0, a.allowRescaling)( + r2, + o2, + n2.size.x, + this._deviceCellWidth + ) && + (h2 = this._deviceCellWidth - 1), + this._ctx.drawImage( + this._bitmapGenerator[n2.texturePage]?.bitmap || + this._charAtlas.pages[n2.texturePage].canvas, + n2.texturePosition.x, + n2.texturePosition.y, + n2.size.x, + n2.size.y, + t3 * this._deviceCellWidth + + this._deviceCharLeft - + n2.offset.x, + i3 * this._deviceCellHeight + + this._deviceCharTop - + n2.offset.y, + h2, + n2.size.y + ), + this._ctx.restore(); + } + _clipRow(e3) { + this._ctx.beginPath(), + this._ctx.rect( + 0, + e3 * this._deviceCellHeight, + this._bufferService.cols * this._deviceCellWidth, + this._deviceCellHeight + ), + this._ctx.clip(); + } + _getFont(e3, t3) { + return `${t3 ? "italic" : ""} ${e3 ? this._optionsService.rawOptions.fontWeightBold : this._optionsService.rawOptions.fontWeight} ${this._optionsService.rawOptions.fontSize * this._coreBrowserService.dpr}px ${this._optionsService.rawOptions.fontFamily}`; + } + } + t2.BaseRenderLayer = u; + class g { + get bitmap() { + return this._bitmap; + } + constructor(e3) { + (this.canvas = e3), + (this._state = 0), + (this._commitTimeout = void 0), + (this._bitmap = void 0), + (this.version = -1); + } + refresh() { + this._bitmap?.close(), + (this._bitmap = void 0), + d.isSafari || + (void 0 === this._commitTimeout && + (this._commitTimeout = window.setTimeout( + () => this._generate(), + 100 + )), + 1 === this._state && (this._state = 2)); + } + _generate() { + 0 === this._state && + (this._bitmap?.close(), + (this._bitmap = void 0), + (this._state = 1), + window.createImageBitmap(this.canvas).then((e3) => { + 2 === this._state + ? this.refresh() + : (this._bitmap = e3), + (this._state = 0); + }), + this._commitTimeout && (this._commitTimeout = void 0)); + } + } + }, + 949: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CanvasRenderer = void 0); + const s2 = i2(627), + r = i2(56), + o = i2(374), + n = i2(345), + a = i2(859), + h = i2(873), + l = i2(43), + c = i2(630), + d = i2(744); + class _ extends a.Disposable { + constructor(e3, t3, i3, _2, u, g, f, v, C, p, m) { + super(), + (this._terminal = e3), + (this._screenElement = t3), + (this._bufferService = _2), + (this._charSizeService = u), + (this._optionsService = g), + (this._coreBrowserService = C), + (this._themeService = m), + (this._observerDisposable = this.register( + new a.MutableDisposable() + )), + (this._onRequestRedraw = this.register( + new n.EventEmitter() + )), + (this.onRequestRedraw = this._onRequestRedraw.event), + (this._onChangeTextureAtlas = this.register( + new n.EventEmitter() + )), + (this.onChangeTextureAtlas = + this._onChangeTextureAtlas.event), + (this._onAddTextureAtlasCanvas = this.register( + new n.EventEmitter() + )), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event); + const x = + this._optionsService.rawOptions.allowTransparency; + this._renderLayers = [ + new d.TextRenderLayer( + this._terminal, + this._screenElement, + 0, + x, + this._bufferService, + this._optionsService, + f, + p, + this._coreBrowserService, + m + ), + new c.SelectionRenderLayer( + this._terminal, + this._screenElement, + 1, + this._bufferService, + this._coreBrowserService, + p, + this._optionsService, + m + ), + new l.LinkRenderLayer( + this._terminal, + this._screenElement, + 2, + i3, + this._bufferService, + this._optionsService, + p, + this._coreBrowserService, + m + ), + new h.CursorRenderLayer( + this._terminal, + this._screenElement, + 3, + this._onRequestRedraw, + this._bufferService, + this._optionsService, + v, + this._coreBrowserService, + p, + m + ), + ]; + for (const e4 of this._renderLayers) + (0, n.forwardEvent)( + e4.onAddTextureAtlasCanvas, + this._onAddTextureAtlasCanvas + ); + (this.dimensions = (0, o.createRenderDimensions)()), + (this._devicePixelRatio = this._coreBrowserService.dpr), + this._updateDimensions(), + (this._observerDisposable.value = (0, + r.observeDevicePixelDimensions)( + this._renderLayers[0].canvas, + this._coreBrowserService.window, + (e4, t4) => + this._setCanvasDevicePixelDimensions(e4, t4) + )), + this.register( + this._coreBrowserService.onWindowChange((e4) => { + this._observerDisposable.value = (0, + r.observeDevicePixelDimensions)( + this._renderLayers[0].canvas, + e4, + (e5, t4) => + this._setCanvasDevicePixelDimensions(e5, t4) + ); + }) + ), + this.register( + (0, a.toDisposable)(() => { + for (const e4 of this._renderLayers) e4.dispose(); + (0, s2.removeTerminalFromCache)(this._terminal); + }) + ); + } + get textureAtlas() { + return this._renderLayers[0].cacheCanvas; + } + handleDevicePixelRatioChange() { + this._devicePixelRatio !== this._coreBrowserService.dpr && + ((this._devicePixelRatio = + this._coreBrowserService.dpr), + this.handleResize( + this._bufferService.cols, + this._bufferService.rows + )); + } + handleResize(e3, t3) { + this._updateDimensions(); + for (const e4 of this._renderLayers) + e4.resize(this.dimensions); + (this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`), + (this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`); + } + handleCharSizeChanged() { + this.handleResize( + this._bufferService.cols, + this._bufferService.rows + ); + } + handleBlur() { + this._runOperation((e3) => e3.handleBlur()); + } + handleFocus() { + this._runOperation((e3) => e3.handleFocus()); + } + handleSelectionChanged(e3, t3, i3 = false) { + this._runOperation((s3) => + s3.handleSelectionChanged(e3, t3, i3) + ), + this._themeService.colors.selectionForeground && + this._onRequestRedraw.fire({ + start: 0, + end: this._bufferService.rows - 1, + }); + } + handleCursorMove() { + this._runOperation((e3) => e3.handleCursorMove()); + } + clear() { + this._runOperation((e3) => e3.reset()); + } + _runOperation(e3) { + for (const t3 of this._renderLayers) e3(t3); + } + renderRows(e3, t3) { + for (const i3 of this._renderLayers) + i3.handleGridChanged(e3, t3); + } + clearTextureAtlas() { + for (const e3 of this._renderLayers) + e3.clearTextureAtlas(); + } + _updateDimensions() { + if (!this._charSizeService.hasValidSize) return; + const e3 = this._coreBrowserService.dpr; + (this.dimensions.device.char.width = Math.floor( + this._charSizeService.width * e3 + )), + (this.dimensions.device.char.height = Math.ceil( + this._charSizeService.height * e3 + )), + (this.dimensions.device.cell.height = Math.floor( + this.dimensions.device.char.height * + this._optionsService.rawOptions.lineHeight + )), + (this.dimensions.device.char.top = + 1 === this._optionsService.rawOptions.lineHeight + ? 0 + : Math.round( + (this.dimensions.device.cell.height - + this.dimensions.device.char.height) / + 2 + )), + (this.dimensions.device.cell.width = + this.dimensions.device.char.width + + Math.round( + this._optionsService.rawOptions.letterSpacing + )), + (this.dimensions.device.char.left = Math.floor( + this._optionsService.rawOptions.letterSpacing / 2 + )), + (this.dimensions.device.canvas.height = + this._bufferService.rows * + this.dimensions.device.cell.height), + (this.dimensions.device.canvas.width = + this._bufferService.cols * + this.dimensions.device.cell.width), + (this.dimensions.css.canvas.height = Math.round( + this.dimensions.device.canvas.height / e3 + )), + (this.dimensions.css.canvas.width = Math.round( + this.dimensions.device.canvas.width / e3 + )), + (this.dimensions.css.cell.height = + this.dimensions.css.canvas.height / + this._bufferService.rows), + (this.dimensions.css.cell.width = + this.dimensions.css.canvas.width / + this._bufferService.cols); + } + _setCanvasDevicePixelDimensions(e3, t3) { + (this.dimensions.device.canvas.height = t3), + (this.dimensions.device.canvas.width = e3); + for (const e4 of this._renderLayers) + e4.resize(this.dimensions); + this._requestRedrawViewport(); + } + _requestRedrawViewport() { + this._onRequestRedraw.fire({ + start: 0, + end: this._bufferService.rows - 1, + }); + } + } + t2.CanvasRenderer = _; + }, + 873: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CursorRenderLayer = void 0); + const s2 = i2(457), + r = i2(859), + o = i2(399), + n = i2(782), + a = i2(903); + class h extends a.BaseRenderLayer { + constructor(e3, t3, i3, s3, o2, a2, h2, l, c, d) { + super(e3, t3, "cursor", i3, true, d, o2, a2, c, l), + (this._onRequestRedraw = s3), + (this._coreService = h2), + (this._cursorBlinkStateManager = this.register( + new r.MutableDisposable() + )), + (this._cell = new n.CellData()), + (this._state = { + x: 0, + y: 0, + isFocused: false, + style: "", + width: 0, + }), + (this._cursorRenderers = { + bar: this._renderBarCursor.bind(this), + block: this._renderBlockCursor.bind(this), + underline: this._renderUnderlineCursor.bind(this), + outline: this._renderOutlineCursor.bind(this), + }), + this.register( + a2.onOptionChange(() => this._handleOptionsChanged()) + ), + this._handleOptionsChanged(); + } + resize(e3) { + super.resize(e3), + (this._state = { + x: 0, + y: 0, + isFocused: false, + style: "", + width: 0, + }); + } + reset() { + this._clearCursor(), + this._cursorBlinkStateManager.value?.restartBlinkAnimation(), + this._handleOptionsChanged(); + } + handleBlur() { + this._cursorBlinkStateManager.value?.pause(), + this._onRequestRedraw.fire({ + start: this._bufferService.buffer.y, + end: this._bufferService.buffer.y, + }); + } + handleFocus() { + this._cursorBlinkStateManager.value?.resume(), + this._onRequestRedraw.fire({ + start: this._bufferService.buffer.y, + end: this._bufferService.buffer.y, + }); + } + _handleOptionsChanged() { + this._optionsService.rawOptions.cursorBlink + ? this._cursorBlinkStateManager.value || + (this._cursorBlinkStateManager.value = + new s2.CursorBlinkStateManager( + () => this._render(true), + this._coreBrowserService + )) + : this._cursorBlinkStateManager.clear(), + this._onRequestRedraw.fire({ + start: this._bufferService.buffer.y, + end: this._bufferService.buffer.y, + }); + } + handleCursorMove() { + this._cursorBlinkStateManager.value?.restartBlinkAnimation(); + } + handleGridChanged(e3, t3) { + !this._cursorBlinkStateManager.value || + this._cursorBlinkStateManager.value.isPaused + ? this._render(false) + : this._cursorBlinkStateManager.value.restartBlinkAnimation(); + } + _render(e3) { + if ( + !this._coreService.isCursorInitialized || + this._coreService.isCursorHidden + ) + return void this._clearCursor(); + const t3 = + this._bufferService.buffer.ybase + + this._bufferService.buffer.y, + i3 = t3 - this._bufferService.buffer.ydisp; + if (i3 < 0 || i3 >= this._bufferService.rows) + return void this._clearCursor(); + const s3 = Math.min( + this._bufferService.buffer.x, + this._bufferService.cols - 1 + ); + if ( + (this._bufferService.buffer.lines + .get(t3) + .loadCell(s3, this._cell), + void 0 !== this._cell.content) + ) { + if (!this._coreBrowserService.isFocused) { + this._clearCursor(), + this._ctx.save(), + (this._ctx.fillStyle = + this._themeService.colors.cursor.css); + const e4 = + this._optionsService.rawOptions.cursorStyle, + t4 = + this._optionsService.rawOptions + .cursorInactiveStyle; + return ( + t4 && + "none" !== t4 && + this._cursorRenderers[t4](s3, i3, this._cell), + this._ctx.restore(), + (this._state.x = s3), + (this._state.y = i3), + (this._state.isFocused = false), + (this._state.style = e4), + void (this._state.width = this._cell.getWidth()) + ); + } + if ( + !this._cursorBlinkStateManager.value || + this._cursorBlinkStateManager.value.isCursorVisible + ) { + if (this._state) { + if ( + this._state.x === s3 && + this._state.y === i3 && + this._state.isFocused === + this._coreBrowserService.isFocused && + this._state.style === + this._optionsService.rawOptions.cursorStyle && + this._state.width === this._cell.getWidth() + ) + return; + this._clearCursor(); + } + this._ctx.save(), + this._cursorRenderers[ + this._optionsService.rawOptions.cursorStyle || + "block" + ](s3, i3, this._cell), + this._ctx.restore(), + (this._state.x = s3), + (this._state.y = i3), + (this._state.isFocused = false), + (this._state.style = + this._optionsService.rawOptions.cursorStyle), + (this._state.width = this._cell.getWidth()); + } else this._clearCursor(); + } + } + _clearCursor() { + this._state && + (o.isFirefox || this._coreBrowserService.dpr < 1 + ? this._clearAll() + : this._clearCells( + this._state.x, + this._state.y, + this._state.width, + 1 + ), + (this._state = { + x: 0, + y: 0, + isFocused: false, + style: "", + width: 0, + })); + } + _renderBarCursor(e3, t3, i3) { + this._ctx.save(), + (this._ctx.fillStyle = + this._themeService.colors.cursor.css), + this._fillLeftLineAtCell( + e3, + t3, + this._optionsService.rawOptions.cursorWidth + ), + this._ctx.restore(); + } + _renderBlockCursor(e3, t3, i3) { + this._ctx.save(), + (this._ctx.fillStyle = + this._themeService.colors.cursor.css), + this._fillCells(e3, t3, i3.getWidth(), 1), + (this._ctx.fillStyle = + this._themeService.colors.cursorAccent.css), + this._fillCharTrueColor(i3, e3, t3), + this._ctx.restore(); + } + _renderUnderlineCursor(e3, t3, i3) { + this._ctx.save(), + (this._ctx.fillStyle = + this._themeService.colors.cursor.css), + this._fillBottomLineAtCells(e3, t3), + this._ctx.restore(); + } + _renderOutlineCursor(e3, t3, i3) { + this._ctx.save(), + (this._ctx.strokeStyle = + this._themeService.colors.cursor.css), + this._strokeRectAtCell(e3, t3, i3.getWidth(), 1), + this._ctx.restore(); + } + } + t2.CursorRenderLayer = h; + }, + 574: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.GridCache = void 0), + (t2.GridCache = class { + constructor() { + this.cache = []; + } + resize(e3, t3) { + for (let i2 = 0; i2 < e3; i2++) { + this.cache.length <= i2 && this.cache.push([]); + for (let e4 = this.cache[i2].length; e4 < t3; e4++) + this.cache[i2].push(void 0); + this.cache[i2].length = t3; + } + this.cache.length = e3; + } + clear() { + for (let e3 = 0; e3 < this.cache.length; e3++) + for (let t3 = 0; t3 < this.cache[e3].length; t3++) + this.cache[e3][t3] = void 0; + } + }); + }, + 43: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.LinkRenderLayer = void 0); + const s2 = i2(197), + r = i2(237), + o = i2(903); + class n extends o.BaseRenderLayer { + constructor(e3, t3, i3, s3, r2, o2, n2, a, h) { + super(e3, t3, "link", i3, true, h, r2, o2, n2, a), + this.register( + s3.onShowLinkUnderline((e4) => + this._handleShowLinkUnderline(e4) + ) + ), + this.register( + s3.onHideLinkUnderline((e4) => + this._handleHideLinkUnderline(e4) + ) + ); + } + resize(e3) { + super.resize(e3), (this._state = void 0); + } + reset() { + this._clearCurrentLink(); + } + _clearCurrentLink() { + if (this._state) { + this._clearCells( + this._state.x1, + this._state.y1, + this._state.cols - this._state.x1, + 1 + ); + const e3 = this._state.y2 - this._state.y1 - 1; + e3 > 0 && + this._clearCells( + 0, + this._state.y1 + 1, + this._state.cols, + e3 + ), + this._clearCells( + 0, + this._state.y2, + this._state.x2, + 1 + ), + (this._state = void 0); + } + } + _handleShowLinkUnderline(e3) { + if ( + (e3.fg === r.INVERTED_DEFAULT_COLOR + ? (this._ctx.fillStyle = + this._themeService.colors.background.css) + : e3.fg && (0, s2.is256Color)(e3.fg) + ? (this._ctx.fillStyle = + this._themeService.colors.ansi[e3.fg].css) + : (this._ctx.fillStyle = + this._themeService.colors.foreground.css), + e3.y1 === e3.y2) + ) + this._fillBottomLineAtCells( + e3.x1, + e3.y1, + e3.x2 - e3.x1 + ); + else { + this._fillBottomLineAtCells( + e3.x1, + e3.y1, + e3.cols - e3.x1 + ); + for (let t3 = e3.y1 + 1; t3 < e3.y2; t3++) + this._fillBottomLineAtCells(0, t3, e3.cols); + this._fillBottomLineAtCells(0, e3.y2, e3.x2); + } + this._state = e3; + } + _handleHideLinkUnderline(e3) { + this._clearCurrentLink(); + } + } + t2.LinkRenderLayer = n; + }, + 630: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.SelectionRenderLayer = void 0); + const s2 = i2(903); + class r extends s2.BaseRenderLayer { + constructor(e3, t3, i3, s3, r2, o, n, a) { + super(e3, t3, "selection", i3, true, a, s3, n, o, r2), + this._clearState(); + } + _clearState() { + this._state = { + start: void 0, + end: void 0, + columnSelectMode: void 0, + ydisp: void 0, + }; + } + resize(e3) { + super.resize(e3), + this._selectionModel.selectionStart && + this._selectionModel.selectionEnd && + (this._clearState(), + this._redrawSelection( + this._selectionModel.selectionStart, + this._selectionModel.selectionEnd, + this._selectionModel.columnSelectMode + )); + } + reset() { + this._state.start && + this._state.end && + (this._clearState(), this._clearAll()); + } + handleBlur() { + this.reset(), + this._redrawSelection( + this._selectionModel.selectionStart, + this._selectionModel.selectionEnd, + this._selectionModel.columnSelectMode + ); + } + handleFocus() { + this.reset(), + this._redrawSelection( + this._selectionModel.selectionStart, + this._selectionModel.selectionEnd, + this._selectionModel.columnSelectMode + ); + } + handleSelectionChanged(e3, t3, i3) { + super.handleSelectionChanged(e3, t3, i3), + this._redrawSelection(e3, t3, i3); + } + _redrawSelection(e3, t3, i3) { + if ( + !this._didStateChange( + e3, + t3, + i3, + this._bufferService.buffer.ydisp + ) + ) + return; + if ((this._clearAll(), !e3 || !t3)) + return void this._clearState(); + const s3 = e3[1] - this._bufferService.buffer.ydisp, + r2 = t3[1] - this._bufferService.buffer.ydisp, + o = Math.max(s3, 0), + n = Math.min(r2, this._bufferService.rows - 1); + if (o >= this._bufferService.rows || n < 0) + this._state.ydisp = this._bufferService.buffer.ydisp; + else { + if ( + ((this._ctx.fillStyle = ( + this._coreBrowserService.isFocused + ? this._themeService.colors + .selectionBackgroundTransparent + : this._themeService.colors + .selectionInactiveBackgroundTransparent + ).css), + i3) + ) { + const i4 = e3[0], + s4 = t3[0] - i4, + r3 = n - o + 1; + this._fillCells(i4, o, s4, r3); + } else { + const i4 = s3 === o ? e3[0] : 0, + a = o === r2 ? t3[0] : this._bufferService.cols; + this._fillCells(i4, o, a - i4, 1); + const h = Math.max(n - o - 1, 0); + if ( + (this._fillCells( + 0, + o + 1, + this._bufferService.cols, + h + ), + o !== n) + ) { + const e4 = + r2 === n ? t3[0] : this._bufferService.cols; + this._fillCells(0, n, e4, 1); + } + } + (this._state.start = [e3[0], e3[1]]), + (this._state.end = [t3[0], t3[1]]), + (this._state.columnSelectMode = i3), + (this._state.ydisp = + this._bufferService.buffer.ydisp); + } + } + _didStateChange(e3, t3, i3, s3) { + return ( + !this._areCoordinatesEqual(e3, this._state.start) || + !this._areCoordinatesEqual(t3, this._state.end) || + i3 !== this._state.columnSelectMode || + s3 !== this._state.ydisp + ); + } + _areCoordinatesEqual(e3, t3) { + return ( + !(!e3 || !t3) && e3[0] === t3[0] && e3[1] === t3[1] + ); + } + } + t2.SelectionRenderLayer = r; + }, + 744: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TextRenderLayer = void 0); + const s2 = i2(577), + r = i2(147), + o = i2(782), + n = i2(855), + a = i2(903), + h = i2(574); + class l extends a.BaseRenderLayer { + constructor(e3, t3, i3, s3, r2, n2, a2, l2, c, d) { + super(e3, t3, "text", i3, s3, d, r2, n2, l2, c), + (this._characterJoinerService = a2), + (this._characterWidth = 0), + (this._characterFont = ""), + (this._characterOverlapCache = {}), + (this._workCell = new o.CellData()), + (this._state = new h.GridCache()), + this.register( + n2.onSpecificOptionChange("allowTransparency", (e4) => + this._setTransparency(e4) + ) + ); + } + resize(e3) { + super.resize(e3); + const t3 = this._getFont(false, false); + (this._characterWidth === e3.device.char.width && + this._characterFont === t3) || + ((this._characterWidth = e3.device.char.width), + (this._characterFont = t3), + (this._characterOverlapCache = {})), + this._state.clear(), + this._state.resize( + this._bufferService.cols, + this._bufferService.rows + ); + } + reset() { + this._state.clear(), this._clearAll(); + } + _forEachCell(e3, t3, i3) { + for (let r2 = e3; r2 <= t3; r2++) { + const e4 = r2 + this._bufferService.buffer.ydisp, + t4 = this._bufferService.buffer.lines.get(e4), + o2 = + this._characterJoinerService.getJoinedCharacters( + e4 + ); + for (let e5 = 0; e5 < this._bufferService.cols; e5++) { + t4.loadCell(e5, this._workCell); + let a2 = this._workCell, + h2 = false, + l2 = e5; + if (0 !== a2.getWidth()) { + if (o2.length > 0 && e5 === o2[0][0]) { + h2 = true; + const e6 = o2.shift(); + (a2 = new s2.JoinedCellData( + this._workCell, + t4.translateToString(true, e6[0], e6[1]), + e6[1] - e6[0] + )), + (l2 = e6[1] - 1); + } + !h2 && + this._isOverlapping(a2) && + l2 < t4.length - 1 && + t4.getCodePoint(l2 + 1) === n.NULL_CELL_CODE && + ((a2.content &= -12582913), + (a2.content |= 2 << 22)), + i3(a2, e5, r2), + (e5 = l2); + } + } + } + } + _drawBackground(e3, t3) { + const i3 = this._ctx, + s3 = this._bufferService.cols; + let o2 = 0, + n2 = 0, + a2 = null; + i3.save(), + this._forEachCell(e3, t3, (e4, t4, h2) => { + let l2 = null; + e4.isInverse() + ? (l2 = e4.isFgDefault() + ? this._themeService.colors.foreground.css + : e4.isFgRGB() + ? `rgb(${r.AttributeData.toColorRGB(e4.getFgColor()).join(",")})` + : this._themeService.colors.ansi[ + e4.getFgColor() + ].css) + : e4.isBgRGB() + ? (l2 = `rgb(${r.AttributeData.toColorRGB(e4.getBgColor()).join(",")})`) + : e4.isBgPalette() && + (l2 = + this._themeService.colors.ansi[ + e4.getBgColor() + ].css); + let c = false; + this._decorationService.forEachDecorationAtCell( + t4, + this._bufferService.buffer.ydisp + h2, + void 0, + (e5) => { + ("top" !== e5.options.layer && c) || + (e5.backgroundColorRGB && + (l2 = e5.backgroundColorRGB.css), + (c = "top" === e5.options.layer)); + } + ), + null === a2 && ((o2 = t4), (n2 = h2)), + h2 !== n2 + ? ((i3.fillStyle = a2 || ""), + this._fillCells(o2, n2, s3 - o2, 1), + (o2 = t4), + (n2 = h2)) + : a2 !== l2 && + ((i3.fillStyle = a2 || ""), + this._fillCells(o2, n2, t4 - o2, 1), + (o2 = t4), + (n2 = h2)), + (a2 = l2); + }), + null !== a2 && + ((i3.fillStyle = a2), + this._fillCells(o2, n2, s3 - o2, 1)), + i3.restore(); + } + _drawForeground(e3, t3) { + this._forEachCell(e3, t3, (e4, t4, i3) => + this._drawChars(e4, t4, i3) + ); + } + handleGridChanged(e3, t3) { + 0 !== this._state.cache.length && + (this._charAtlas && this._charAtlas.beginFrame(), + this._clearCells( + 0, + e3, + this._bufferService.cols, + t3 - e3 + 1 + ), + this._drawBackground(e3, t3), + this._drawForeground(e3, t3)); + } + _isOverlapping(e3) { + if (1 !== e3.getWidth()) return false; + if (e3.getCode() < 256) return false; + const t3 = e3.getChars(); + if (this._characterOverlapCache.hasOwnProperty(t3)) + return this._characterOverlapCache[t3]; + this._ctx.save(), (this._ctx.font = this._characterFont); + const i3 = + Math.floor(this._ctx.measureText(t3).width) > + this._characterWidth; + return ( + this._ctx.restore(), + (this._characterOverlapCache[t3] = i3), + i3 + ); + } + } + t2.TextRenderLayer = l; + }, + 274: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CellColorResolver = void 0); + const s2 = i2(855), + r = i2(160), + o = i2(374); + let n, + a = 0, + h = 0, + l = false, + c = false, + d = false, + _ = 0; + t2.CellColorResolver = class { + constructor(e3, t3, i3, s3, r2, o2) { + (this._terminal = e3), + (this._optionService = t3), + (this._selectionRenderModel = i3), + (this._decorationService = s3), + (this._coreBrowserService = r2), + (this._themeService = o2), + (this.result = { fg: 0, bg: 0, ext: 0 }); + } + resolve(e3, t3, i3, u) { + if ( + ((this.result.bg = e3.bg), + (this.result.fg = e3.fg), + (this.result.ext = + 268435456 & e3.bg ? e3.extended.ext : 0), + (h = 0), + (a = 0), + (c = false), + (l = false), + (d = false), + (n = this._themeService.colors), + (_ = 0), + e3.getCode() !== s2.NULL_CELL_CODE && + 4 === e3.extended.underlineStyle) + ) { + const e4 = Math.max( + 1, + Math.floor( + (this._optionService.rawOptions.fontSize * + this._coreBrowserService.dpr) / + 15 + ) + ); + _ = (t3 * u) % (2 * Math.round(e4)); + } + if ( + (this._decorationService.forEachDecorationAtCell( + t3, + i3, + "bottom", + (e4) => { + e4.backgroundColorRGB && + ((h = + (e4.backgroundColorRGB.rgba >> 8) & 16777215), + (c = true)), + e4.foregroundColorRGB && + ((a = + (e4.foregroundColorRGB.rgba >> 8) & 16777215), + (l = true)); + } + ), + (d = this._selectionRenderModel.isCellSelected( + this._terminal, + t3, + i3 + )), + d) + ) { + if ( + 67108864 & this.result.fg || + 0 != (50331648 & this.result.bg) + ) { + if (67108864 & this.result.fg) + switch (50331648 & this.result.fg) { + case 16777216: + case 33554432: + h = + this._themeService.colors.ansi[ + 255 & this.result.fg + ].rgba; + break; + case 50331648: + h = ((16777215 & this.result.fg) << 8) | 255; + break; + default: + h = this._themeService.colors.foreground.rgba; + } + else + switch (50331648 & this.result.bg) { + case 16777216: + case 33554432: + h = + this._themeService.colors.ansi[ + 255 & this.result.bg + ].rgba; + break; + case 50331648: + h = ((16777215 & this.result.bg) << 8) | 255; + } + h = + (r.rgba.blend( + h, + (4294967040 & + (this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba) | + 128 + ) >> + 8) & + 16777215; + } else + h = + ((this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba >> + 8) & + 16777215; + if ( + ((c = true), + n.selectionForeground && + ((a = (n.selectionForeground.rgba >> 8) & 16777215), + (l = true)), + (0, o.treatGlyphAsBackgroundColor)(e3.getCode())) + ) { + if ( + 67108864 & this.result.fg && + 0 == (50331648 & this.result.bg) + ) + a = + ((this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba >> + 8) & + 16777215; + else { + if (67108864 & this.result.fg) + switch (50331648 & this.result.bg) { + case 16777216: + case 33554432: + a = + this._themeService.colors.ansi[ + 255 & this.result.bg + ].rgba; + break; + case 50331648: + a = ((16777215 & this.result.bg) << 8) | 255; + } + else + switch (50331648 & this.result.fg) { + case 16777216: + case 33554432: + a = + this._themeService.colors.ansi[ + 255 & this.result.fg + ].rgba; + break; + case 50331648: + a = ((16777215 & this.result.fg) << 8) | 255; + break; + default: + a = this._themeService.colors.foreground.rgba; + } + a = + (r.rgba.blend( + a, + (4294967040 & + (this._coreBrowserService.isFocused + ? n.selectionBackgroundOpaque + : n.selectionInactiveBackgroundOpaque + ).rgba) | + 128 + ) >> + 8) & + 16777215; + } + l = true; + } + } + this._decorationService.forEachDecorationAtCell( + t3, + i3, + "top", + (e4) => { + e4.backgroundColorRGB && + ((h = (e4.backgroundColorRGB.rgba >> 8) & 16777215), + (c = true)), + e4.foregroundColorRGB && + ((a = + (e4.foregroundColorRGB.rgba >> 8) & 16777215), + (l = true)); + } + ), + c && + (h = d + ? (-16777216 & e3.bg & -134217729) | h | 50331648 + : (-16777216 & e3.bg) | h | 50331648), + l && + (a = (-16777216 & e3.fg & -67108865) | a | 50331648), + 67108864 & this.result.fg && + (c && + !l && + ((a = + 0 == (50331648 & this.result.bg) + ? (-134217728 & this.result.fg) | + (16777215 & (n.background.rgba >> 8)) | + 50331648 + : (-134217728 & this.result.fg) | + (67108863 & this.result.bg)), + (l = true)), + !c && + l && + ((h = + 0 == (50331648 & this.result.fg) + ? (-67108864 & this.result.bg) | + (16777215 & (n.foreground.rgba >> 8)) | + 50331648 + : (-67108864 & this.result.bg) | + (67108863 & this.result.fg)), + (c = true))), + (n = void 0), + (this.result.bg = c ? h : this.result.bg), + (this.result.fg = l ? a : this.result.fg), + (this.result.ext &= 536870911), + (this.result.ext |= (_ << 29) & 3758096384); + } + }; + }, + 627: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.removeTerminalFromCache = t2.acquireTextureAtlas = + void 0); + const s2 = i2(509), + r = i2(197), + o = []; + (t2.acquireTextureAtlas = function ( + e3, + t3, + i3, + n, + a, + h, + l, + c + ) { + const d = (0, r.generateConfig)(n, a, h, l, t3, i3, c); + for (let t4 = 0; t4 < o.length; t4++) { + const i4 = o[t4], + s3 = i4.ownedBy.indexOf(e3); + if (s3 >= 0) { + if ((0, r.configEquals)(i4.config, d)) return i4.atlas; + 1 === i4.ownedBy.length + ? (i4.atlas.dispose(), o.splice(t4, 1)) + : i4.ownedBy.splice(s3, 1); + break; + } + } + for (let t4 = 0; t4 < o.length; t4++) { + const i4 = o[t4]; + if ((0, r.configEquals)(i4.config, d)) + return i4.ownedBy.push(e3), i4.atlas; + } + const _ = e3._core, + u = { + atlas: new s2.TextureAtlas( + document, + d, + _.unicodeService + ), + config: d, + ownedBy: [e3], + }; + return o.push(u), u.atlas; + }), + (t2.removeTerminalFromCache = function (e3) { + for (let t3 = 0; t3 < o.length; t3++) { + const i3 = o[t3].ownedBy.indexOf(e3); + if (-1 !== i3) { + 1 === o[t3].ownedBy.length + ? (o[t3].atlas.dispose(), o.splice(t3, 1)) + : o[t3].ownedBy.splice(i3, 1); + break; + } + } + }); + }, + 197: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.is256Color = + t2.configEquals = + t2.generateConfig = + void 0); + const s2 = i2(160); + (t2.generateConfig = function (e3, t3, i3, r, o, n, a) { + const h = { + foreground: n.foreground, + background: n.background, + cursor: s2.NULL_COLOR, + cursorAccent: s2.NULL_COLOR, + selectionForeground: s2.NULL_COLOR, + selectionBackgroundTransparent: s2.NULL_COLOR, + selectionBackgroundOpaque: s2.NULL_COLOR, + selectionInactiveBackgroundTransparent: s2.NULL_COLOR, + selectionInactiveBackgroundOpaque: s2.NULL_COLOR, + ansi: n.ansi.slice(), + contrastCache: n.contrastCache, + halfContrastCache: n.halfContrastCache, + }; + return { + customGlyphs: o.customGlyphs, + devicePixelRatio: a, + letterSpacing: o.letterSpacing, + lineHeight: o.lineHeight, + deviceCellWidth: e3, + deviceCellHeight: t3, + deviceCharWidth: i3, + deviceCharHeight: r, + fontFamily: o.fontFamily, + fontSize: o.fontSize, + fontWeight: o.fontWeight, + fontWeightBold: o.fontWeightBold, + allowTransparency: o.allowTransparency, + drawBoldTextInBrightColors: o.drawBoldTextInBrightColors, + minimumContrastRatio: o.minimumContrastRatio, + colors: h, + }; + }), + (t2.configEquals = function (e3, t3) { + for (let i3 = 0; i3 < e3.colors.ansi.length; i3++) + if (e3.colors.ansi[i3].rgba !== t3.colors.ansi[i3].rgba) + return false; + return ( + e3.devicePixelRatio === t3.devicePixelRatio && + e3.customGlyphs === t3.customGlyphs && + e3.lineHeight === t3.lineHeight && + e3.letterSpacing === t3.letterSpacing && + e3.fontFamily === t3.fontFamily && + e3.fontSize === t3.fontSize && + e3.fontWeight === t3.fontWeight && + e3.fontWeightBold === t3.fontWeightBold && + e3.allowTransparency === t3.allowTransparency && + e3.deviceCharWidth === t3.deviceCharWidth && + e3.deviceCharHeight === t3.deviceCharHeight && + e3.drawBoldTextInBrightColors === + t3.drawBoldTextInBrightColors && + e3.minimumContrastRatio === t3.minimumContrastRatio && + e3.colors.foreground.rgba === + t3.colors.foreground.rgba && + e3.colors.background.rgba === t3.colors.background.rgba + ); + }), + (t2.is256Color = function (e3) { + return ( + 16777216 == (50331648 & e3) || + 33554432 == (50331648 & e3) + ); + }); + }, + 237: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TEXT_BASELINE = + t2.DIM_OPACITY = + t2.INVERTED_DEFAULT_COLOR = + void 0); + const s2 = i2(399); + (t2.INVERTED_DEFAULT_COLOR = 257), + (t2.DIM_OPACITY = 0.5), + (t2.TEXT_BASELINE = + s2.isFirefox || s2.isLegacyEdge + ? "bottom" + : "ideographic"); + }, + 457: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CursorBlinkStateManager = void 0); + t2.CursorBlinkStateManager = class { + constructor(e3, t3) { + (this._renderCallback = e3), + (this._coreBrowserService = t3), + (this.isCursorVisible = true), + this._coreBrowserService.isFocused && + this._restartInterval(); + } + get isPaused() { + return !(this._blinkStartTimeout || this._blinkInterval); + } + dispose() { + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + this._blinkStartTimeout && + (this._coreBrowserService.window.clearTimeout( + this._blinkStartTimeout + ), + (this._blinkStartTimeout = void 0)), + this._animationFrame && + (this._coreBrowserService.window.cancelAnimationFrame( + this._animationFrame + ), + (this._animationFrame = void 0)); + } + restartBlinkAnimation() { + this.isPaused || + ((this._animationTimeRestarted = Date.now()), + (this.isCursorVisible = true), + this._animationFrame || + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + ))); + } + _restartInterval(e3 = 600) { + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + (this._blinkStartTimeout = + this._coreBrowserService.window.setTimeout(() => { + if (this._animationTimeRestarted) { + const e4 = + 600 - + (Date.now() - this._animationTimeRestarted); + if ( + ((this._animationTimeRestarted = void 0), + e4 > 0) + ) + return void this._restartInterval(e4); + } + (this.isCursorVisible = false), + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + )), + (this._blinkInterval = + this._coreBrowserService.window.setInterval( + () => { + if (this._animationTimeRestarted) { + const e4 = + 600 - + (Date.now() - + this._animationTimeRestarted); + return ( + (this._animationTimeRestarted = void 0), + void this._restartInterval(e4) + ); + } + (this.isCursorVisible = + !this.isCursorVisible), + (this._animationFrame = + this._coreBrowserService.window.requestAnimationFrame( + () => { + this._renderCallback(), + (this._animationFrame = void 0); + } + )); + }, + 600 + )); + }, e3)); + } + pause() { + (this.isCursorVisible = true), + this._blinkInterval && + (this._coreBrowserService.window.clearInterval( + this._blinkInterval + ), + (this._blinkInterval = void 0)), + this._blinkStartTimeout && + (this._coreBrowserService.window.clearTimeout( + this._blinkStartTimeout + ), + (this._blinkStartTimeout = void 0)), + this._animationFrame && + (this._coreBrowserService.window.cancelAnimationFrame( + this._animationFrame + ), + (this._animationFrame = void 0)); + } + resume() { + this.pause(), + (this._animationTimeRestarted = void 0), + this._restartInterval(), + this.restartBlinkAnimation(); + } + }; + }, + 860: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.tryDrawCustomChar = + t2.powerlineDefinitions = + t2.boxDrawingDefinitions = + t2.blockElementDefinitions = + void 0); + const s2 = i2(374); + t2.blockElementDefinitions = { + "\u2580": [{ x: 0, y: 0, w: 8, h: 4 }], + "\u2581": [{ x: 0, y: 7, w: 8, h: 1 }], + "\u2582": [{ x: 0, y: 6, w: 8, h: 2 }], + "\u2583": [{ x: 0, y: 5, w: 8, h: 3 }], + "\u2584": [{ x: 0, y: 4, w: 8, h: 4 }], + "\u2585": [{ x: 0, y: 3, w: 8, h: 5 }], + "\u2586": [{ x: 0, y: 2, w: 8, h: 6 }], + "\u2587": [{ x: 0, y: 1, w: 8, h: 7 }], + "\u2588": [{ x: 0, y: 0, w: 8, h: 8 }], + "\u2589": [{ x: 0, y: 0, w: 7, h: 8 }], + "\u258A": [{ x: 0, y: 0, w: 6, h: 8 }], + "\u258B": [{ x: 0, y: 0, w: 5, h: 8 }], + "\u258C": [{ x: 0, y: 0, w: 4, h: 8 }], + "\u258D": [{ x: 0, y: 0, w: 3, h: 8 }], + "\u258E": [{ x: 0, y: 0, w: 2, h: 8 }], + "\u258F": [{ x: 0, y: 0, w: 1, h: 8 }], + "\u2590": [{ x: 4, y: 0, w: 4, h: 8 }], + "\u2594": [{ x: 0, y: 0, w: 8, h: 1 }], + "\u2595": [{ x: 7, y: 0, w: 1, h: 8 }], + "\u2596": [{ x: 0, y: 4, w: 4, h: 4 }], + "\u2597": [{ x: 4, y: 4, w: 4, h: 4 }], + "\u2598": [{ x: 0, y: 0, w: 4, h: 4 }], + "\u2599": [ + { x: 0, y: 0, w: 4, h: 8 }, + { x: 0, y: 4, w: 8, h: 4 }, + ], + "\u259A": [ + { x: 0, y: 0, w: 4, h: 4 }, + { x: 4, y: 4, w: 4, h: 4 }, + ], + "\u259B": [ + { x: 0, y: 0, w: 4, h: 8 }, + { x: 4, y: 0, w: 4, h: 4 }, + ], + "\u259C": [ + { x: 0, y: 0, w: 8, h: 4 }, + { x: 4, y: 0, w: 4, h: 8 }, + ], + "\u259D": [{ x: 4, y: 0, w: 4, h: 4 }], + "\u259E": [ + { x: 4, y: 0, w: 4, h: 4 }, + { x: 0, y: 4, w: 4, h: 4 }, + ], + "\u259F": [ + { x: 4, y: 0, w: 4, h: 8 }, + { x: 0, y: 4, w: 8, h: 4 }, + ], + "\u{1FB70}": [{ x: 1, y: 0, w: 1, h: 8 }], + "\u{1FB71}": [{ x: 2, y: 0, w: 1, h: 8 }], + "\u{1FB72}": [{ x: 3, y: 0, w: 1, h: 8 }], + "\u{1FB73}": [{ x: 4, y: 0, w: 1, h: 8 }], + "\u{1FB74}": [{ x: 5, y: 0, w: 1, h: 8 }], + "\u{1FB75}": [{ x: 6, y: 0, w: 1, h: 8 }], + "\u{1FB76}": [{ x: 0, y: 1, w: 8, h: 1 }], + "\u{1FB77}": [{ x: 0, y: 2, w: 8, h: 1 }], + "\u{1FB78}": [{ x: 0, y: 3, w: 8, h: 1 }], + "\u{1FB79}": [{ x: 0, y: 4, w: 8, h: 1 }], + "\u{1FB7A}": [{ x: 0, y: 5, w: 8, h: 1 }], + "\u{1FB7B}": [{ x: 0, y: 6, w: 8, h: 1 }], + "\u{1FB7C}": [ + { x: 0, y: 0, w: 1, h: 8 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB7D}": [ + { x: 0, y: 0, w: 1, h: 8 }, + { x: 0, y: 0, w: 8, h: 1 }, + ], + "\u{1FB7E}": [ + { x: 7, y: 0, w: 1, h: 8 }, + { x: 0, y: 0, w: 8, h: 1 }, + ], + "\u{1FB7F}": [ + { x: 7, y: 0, w: 1, h: 8 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB80}": [ + { x: 0, y: 0, w: 8, h: 1 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB81}": [ + { x: 0, y: 0, w: 8, h: 1 }, + { x: 0, y: 2, w: 8, h: 1 }, + { x: 0, y: 4, w: 8, h: 1 }, + { x: 0, y: 7, w: 8, h: 1 }, + ], + "\u{1FB82}": [{ x: 0, y: 0, w: 8, h: 2 }], + "\u{1FB83}": [{ x: 0, y: 0, w: 8, h: 3 }], + "\u{1FB84}": [{ x: 0, y: 0, w: 8, h: 5 }], + "\u{1FB85}": [{ x: 0, y: 0, w: 8, h: 6 }], + "\u{1FB86}": [{ x: 0, y: 0, w: 8, h: 7 }], + "\u{1FB87}": [{ x: 6, y: 0, w: 2, h: 8 }], + "\u{1FB88}": [{ x: 5, y: 0, w: 3, h: 8 }], + "\u{1FB89}": [{ x: 3, y: 0, w: 5, h: 8 }], + "\u{1FB8A}": [{ x: 2, y: 0, w: 6, h: 8 }], + "\u{1FB8B}": [{ x: 1, y: 0, w: 7, h: 8 }], + "\u{1FB95}": [ + { x: 0, y: 0, w: 2, h: 2 }, + { x: 4, y: 0, w: 2, h: 2 }, + { x: 2, y: 2, w: 2, h: 2 }, + { x: 6, y: 2, w: 2, h: 2 }, + { x: 0, y: 4, w: 2, h: 2 }, + { x: 4, y: 4, w: 2, h: 2 }, + { x: 2, y: 6, w: 2, h: 2 }, + { x: 6, y: 6, w: 2, h: 2 }, + ], + "\u{1FB96}": [ + { x: 2, y: 0, w: 2, h: 2 }, + { x: 6, y: 0, w: 2, h: 2 }, + { x: 0, y: 2, w: 2, h: 2 }, + { x: 4, y: 2, w: 2, h: 2 }, + { x: 2, y: 4, w: 2, h: 2 }, + { x: 6, y: 4, w: 2, h: 2 }, + { x: 0, y: 6, w: 2, h: 2 }, + { x: 4, y: 6, w: 2, h: 2 }, + ], + "\u{1FB97}": [ + { x: 0, y: 2, w: 8, h: 2 }, + { x: 0, y: 6, w: 8, h: 2 }, + ], + }; + const r = { + "\u2591": [ + [1, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 1, 0], + [0, 0, 0, 0], + ], + "\u2592": [ + [1, 0], + [0, 0], + [0, 1], + [0, 0], + ], + "\u2593": [ + [0, 1], + [1, 1], + [1, 0], + [1, 1], + ], + }; + (t2.boxDrawingDefinitions = { + "\u2500": { 1: "M0,.5 L1,.5" }, + "\u2501": { 3: "M0,.5 L1,.5" }, + "\u2502": { 1: "M.5,0 L.5,1" }, + "\u2503": { 3: "M.5,0 L.5,1" }, + "\u250C": { 1: "M0.5,1 L.5,.5 L1,.5" }, + "\u250F": { 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2510": { 1: "M0,.5 L.5,.5 L.5,1" }, + "\u2513": { 3: "M0,.5 L.5,.5 L.5,1" }, + "\u2514": { 1: "M.5,0 L.5,.5 L1,.5" }, + "\u2517": { 3: "M.5,0 L.5,.5 L1,.5" }, + "\u2518": { 1: "M.5,0 L.5,.5 L0,.5" }, + "\u251B": { 3: "M.5,0 L.5,.5 L0,.5" }, + "\u251C": { 1: "M.5,0 L.5,1 M.5,.5 L1,.5" }, + "\u2523": { 3: "M.5,0 L.5,1 M.5,.5 L1,.5" }, + "\u2524": { 1: "M.5,0 L.5,1 M.5,.5 L0,.5" }, + "\u252B": { 3: "M.5,0 L.5,1 M.5,.5 L0,.5" }, + "\u252C": { 1: "M0,.5 L1,.5 M.5,.5 L.5,1" }, + "\u2533": { 3: "M0,.5 L1,.5 M.5,.5 L.5,1" }, + "\u2534": { 1: "M0,.5 L1,.5 M.5,.5 L.5,0" }, + "\u253B": { 3: "M0,.5 L1,.5 M.5,.5 L.5,0" }, + "\u253C": { 1: "M0,.5 L1,.5 M.5,0 L.5,1" }, + "\u254B": { 3: "M0,.5 L1,.5 M.5,0 L.5,1" }, + "\u2574": { 1: "M.5,.5 L0,.5" }, + "\u2578": { 3: "M.5,.5 L0,.5" }, + "\u2575": { 1: "M.5,.5 L.5,0" }, + "\u2579": { 3: "M.5,.5 L.5,0" }, + "\u2576": { 1: "M.5,.5 L1,.5" }, + "\u257A": { 3: "M.5,.5 L1,.5" }, + "\u2577": { 1: "M.5,.5 L.5,1" }, + "\u257B": { 3: "M.5,.5 L.5,1" }, + "\u2550": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2551": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u2552": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 - t3} L1,${0.5 - t3} M.5,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2553": { + 1: (e3, t3) => + `M${0.5 - e3},1 L${0.5 - e3},.5 L1,.5 M${0.5 + e3},.5 L${0.5 + e3},1`, + }, + "\u2554": { + 1: (e3, t3) => + `M1,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1`, + }, + "\u2555": { + 1: (e3, t3) => + `M0,${0.5 - t3} L.5,${0.5 - t3} L.5,1 M0,${0.5 + t3} L.5,${0.5 + t3}`, + }, + "\u2556": { + 1: (e3, t3) => + `M${0.5 + e3},1 L${0.5 + e3},.5 L0,.5 M${0.5 - e3},.5 L${0.5 - e3},1`, + }, + "\u2557": { + 1: (e3, t3) => + `M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M0,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},1`, + }, + "\u2558": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 + t3} L1,${0.5 + t3} M.5,${0.5 - t3} L1,${0.5 - t3}`, + }, + "\u2559": { + 1: (e3, t3) => + `M1,.5 L${0.5 - e3},.5 L${0.5 - e3},0 M${0.5 + e3},.5 L${0.5 + e3},0`, + }, + "\u255A": { + 1: (e3, t3) => + `M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0 M1,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},0`, + }, + "\u255B": { + 1: (e3, t3) => + `M0,${0.5 + t3} L.5,${0.5 + t3} L.5,0 M0,${0.5 - t3} L.5,${0.5 - t3}`, + }, + "\u255C": { + 1: (e3, t3) => + `M0,.5 L${0.5 + e3},.5 L${0.5 + e3},0 M${0.5 - e3},.5 L${0.5 - e3},0`, + }, + "\u255D": { + 1: (e3, t3) => + `M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M0,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},0`, + }, + "\u255E": { + 1: (e3, t3) => + `M.5,0 L.5,1 M.5,${0.5 - t3} L1,${0.5 - t3} M.5,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u255F": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1 M${0.5 + e3},.5 L1,.5`, + }, + "\u2560": { + 1: (e3, t3) => + `M${0.5 - e3},0 L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u2561": { + 1: (e3, t3) => + `M.5,0 L.5,1 M0,${0.5 - t3} L.5,${0.5 - t3} M0,${0.5 + t3} L.5,${0.5 + t3}`, + }, + "\u2562": { + 1: (e3, t3) => + `M0,.5 L${0.5 - e3},.5 M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u2563": { + 1: (e3, t3) => + `M${0.5 + e3},0 L${0.5 + e3},1 M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0`, + }, + "\u2564": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3} M.5,${0.5 + t3} L.5,1`, + }, + "\u2565": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},.5 L${0.5 - e3},1 M${0.5 + e3},.5 L${0.5 + e3},1`, + }, + "\u2566": { + 1: (e3, t3) => + `M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1`, + }, + "\u2567": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - t3} M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u2568": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},.5 L${0.5 - e3},0 M${0.5 + e3},.5 L${0.5 + e3},0`, + }, + "\u2569": { + 1: (e3, t3) => + `M0,${0.5 + t3} L1,${0.5 + t3} M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u256A": { + 1: (e3, t3) => + `M.5,0 L.5,1 M0,${0.5 - t3} L1,${0.5 - t3} M0,${0.5 + t3} L1,${0.5 + t3}`, + }, + "\u256B": { + 1: (e3, t3) => + `M0,.5 L1,.5 M${0.5 - e3},0 L${0.5 - e3},1 M${0.5 + e3},0 L${0.5 + e3},1`, + }, + "\u256C": { + 1: (e3, t3) => + `M0,${0.5 + t3} L${0.5 - e3},${0.5 + t3} L${0.5 - e3},1 M1,${0.5 + t3} L${0.5 + e3},${0.5 + t3} L${0.5 + e3},1 M0,${0.5 - t3} L${0.5 - e3},${0.5 - t3} L${0.5 - e3},0 M1,${0.5 - t3} L${0.5 + e3},${0.5 - t3} L${0.5 + e3},0`, + }, + "\u2571": { 1: "M1,0 L0,1" }, + "\u2572": { 1: "M0,0 L1,1" }, + "\u2573": { 1: "M1,0 L0,1 M0,0 L1,1" }, + "\u257C": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L1,.5" }, + "\u257D": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L.5,1" }, + "\u257E": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u257F": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L.5,0" }, + "\u250D": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u250E": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2511": { 1: "M.5,.5 L.5,1", 3: "M.5,.5 L0,.5" }, + "\u2512": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L.5,1" }, + "\u2515": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L1,.5" }, + "\u2516": { 1: "M.5,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u2519": { 1: "M.5,.5 L.5,0", 3: "M.5,.5 L0,.5" }, + "\u251A": { 1: "M.5,.5 L0,.5", 3: "M.5,.5 L.5,0" }, + "\u251D": { 1: "M.5,0 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u251E": { 1: "M0.5,1 L.5,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u251F": { 1: "M.5,0 L.5,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2520": { 1: "M.5,.5 L1,.5", 3: "M.5,0 L.5,1" }, + "\u2521": { 1: "M.5,.5 L.5,1", 3: "M.5,0 L.5,.5 L1,.5" }, + "\u2522": { 1: "M.5,.5 L.5,0", 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2525": { 1: "M.5,0 L.5,1", 3: "M.5,.5 L0,.5" }, + "\u2526": { 1: "M0,.5 L.5,.5 L.5,1", 3: "M.5,.5 L.5,0" }, + "\u2527": { 1: "M.5,0 L.5,.5 L0,.5", 3: "M.5,.5 L.5,1" }, + "\u2528": { 1: "M.5,.5 L0,.5", 3: "M.5,0 L.5,1" }, + "\u2529": { 1: "M.5,.5 L.5,1", 3: "M.5,0 L.5,.5 L0,.5" }, + "\u252A": { 1: "M.5,.5 L.5,0", 3: "M0,.5 L.5,.5 L.5,1" }, + "\u252D": { 1: "M0.5,1 L.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u252E": { 1: "M0,.5 L.5,.5 L.5,1", 3: "M.5,.5 L1,.5" }, + "\u252F": { 1: "M.5,.5 L.5,1", 3: "M0,.5 L1,.5" }, + "\u2530": { 1: "M0,.5 L1,.5", 3: "M.5,.5 L.5,1" }, + "\u2531": { 1: "M.5,.5 L1,.5", 3: "M0,.5 L.5,.5 L.5,1" }, + "\u2532": { 1: "M.5,.5 L0,.5", 3: "M0.5,1 L.5,.5 L1,.5" }, + "\u2535": { 1: "M.5,0 L.5,.5 L1,.5", 3: "M.5,.5 L0,.5" }, + "\u2536": { 1: "M.5,0 L.5,.5 L0,.5", 3: "M.5,.5 L1,.5" }, + "\u2537": { 1: "M.5,.5 L.5,0", 3: "M0,.5 L1,.5" }, + "\u2538": { 1: "M0,.5 L1,.5", 3: "M.5,.5 L.5,0" }, + "\u2539": { 1: "M.5,.5 L1,.5", 3: "M.5,0 L.5,.5 L0,.5" }, + "\u253A": { 1: "M.5,.5 L0,.5", 3: "M.5,0 L.5,.5 L1,.5" }, + "\u253D": { + 1: "M.5,0 L.5,1 M.5,.5 L1,.5", + 3: "M.5,.5 L0,.5", + }, + "\u253E": { + 1: "M.5,0 L.5,1 M.5,.5 L0,.5", + 3: "M.5,.5 L1,.5", + }, + "\u253F": { 1: "M.5,0 L.5,1", 3: "M0,.5 L1,.5" }, + "\u2540": { + 1: "M0,.5 L1,.5 M.5,.5 L.5,1", + 3: "M.5,.5 L.5,0", + }, + "\u2541": { + 1: "M.5,.5 L.5,0 M0,.5 L1,.5", + 3: "M.5,.5 L.5,1", + }, + "\u2542": { 1: "M0,.5 L1,.5", 3: "M.5,0 L.5,1" }, + "\u2543": { + 1: "M0.5,1 L.5,.5 L1,.5", + 3: "M.5,0 L.5,.5 L0,.5", + }, + "\u2544": { + 1: "M0,.5 L.5,.5 L.5,1", + 3: "M.5,0 L.5,.5 L1,.5", + }, + "\u2545": { + 1: "M.5,0 L.5,.5 L1,.5", + 3: "M0,.5 L.5,.5 L.5,1", + }, + "\u2546": { + 1: "M.5,0 L.5,.5 L0,.5", + 3: "M0.5,1 L.5,.5 L1,.5", + }, + "\u2547": { + 1: "M.5,.5 L.5,1", + 3: "M.5,.5 L.5,0 M0,.5 L1,.5", + }, + "\u2548": { + 1: "M.5,.5 L.5,0", + 3: "M0,.5 L1,.5 M.5,.5 L.5,1", + }, + "\u2549": { + 1: "M.5,.5 L1,.5", + 3: "M.5,0 L.5,1 M.5,.5 L0,.5", + }, + "\u254A": { + 1: "M.5,.5 L0,.5", + 3: "M.5,0 L.5,1 M.5,.5 L1,.5", + }, + "\u254C": { 1: "M.1,.5 L.4,.5 M.6,.5 L.9,.5" }, + "\u254D": { 3: "M.1,.5 L.4,.5 M.6,.5 L.9,.5" }, + "\u2504": { + 1: "M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5", + }, + "\u2505": { + 3: "M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5", + }, + "\u2508": { + 1: "M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5", + }, + "\u2509": { + 3: "M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5", + }, + "\u254E": { 1: "M.5,.1 L.5,.4 M.5,.6 L.5,.9" }, + "\u254F": { 3: "M.5,.1 L.5,.4 M.5,.6 L.5,.9" }, + "\u2506": { + 1: "M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333", + }, + "\u2507": { + 3: "M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333", + }, + "\u250A": { + 1: "M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95", + }, + "\u250B": { + 3: "M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95", + }, + "\u256D": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 + (t3 / 0.15) * 0.5} C.5,${0.5 + (t3 / 0.15) * 0.5},.5,.5,1,.5`, + }, + "\u256E": { + 1: (e3, t3) => + `M.5,1 L.5,${0.5 + (t3 / 0.15) * 0.5} C.5,${0.5 + (t3 / 0.15) * 0.5},.5,.5,0,.5`, + }, + "\u256F": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - (t3 / 0.15) * 0.5} C.5,${0.5 - (t3 / 0.15) * 0.5},.5,.5,0,.5`, + }, + "\u2570": { + 1: (e3, t3) => + `M.5,0 L.5,${0.5 - (t3 / 0.15) * 0.5} C.5,${0.5 - (t3 / 0.15) * 0.5},.5,.5,1,.5`, + }, + }), + (t2.powerlineDefinitions = { + "\uE0B0": { + d: "M0,0 L1,.5 L0,1", + type: 0, + rightPadding: 2, + }, + "\uE0B1": { + d: "M-1,-.5 L1,.5 L-1,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0B2": { + d: "M1,0 L0,.5 L1,1", + type: 0, + leftPadding: 2, + }, + "\uE0B3": { + d: "M2,-.5 L0,.5 L2,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0B4": { + d: "M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0", + type: 0, + rightPadding: 1, + }, + "\uE0B5": { + d: "M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0", + type: 1, + rightPadding: 1, + }, + "\uE0B6": { + d: "M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0", + type: 0, + leftPadding: 1, + }, + "\uE0B7": { + d: "M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0", + type: 1, + leftPadding: 1, + }, + "\uE0B8": { d: "M-.5,-.5 L1.5,1.5 L-.5,1.5", type: 0 }, + "\uE0B9": { + d: "M-.5,-.5 L1.5,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0BA": { d: "M1.5,-.5 L-.5,1.5 L1.5,1.5", type: 0 }, + "\uE0BC": { d: "M1.5,-.5 L-.5,1.5 L-.5,-.5", type: 0 }, + "\uE0BD": { + d: "M1.5,-.5 L-.5,1.5", + type: 1, + leftPadding: 1, + rightPadding: 1, + }, + "\uE0BE": { d: "M-.5,-.5 L1.5,1.5 L1.5,-.5", type: 0 }, + }), + (t2.powerlineDefinitions["\uE0BB"] = + t2.powerlineDefinitions["\uE0BD"]), + (t2.powerlineDefinitions["\uE0BF"] = + t2.powerlineDefinitions["\uE0B9"]), + (t2.tryDrawCustomChar = function ( + e3, + i3, + n2, + l, + c, + d, + _, + u + ) { + const g = t2.blockElementDefinitions[i3]; + if (g) + return ( + (function (e4, t3, i4, s3, r2, o2) { + for (let n3 = 0; n3 < t3.length; n3++) { + const a2 = t3[n3], + h2 = r2 / 8, + l2 = o2 / 8; + e4.fillRect( + i4 + a2.x * h2, + s3 + a2.y * l2, + a2.w * h2, + a2.h * l2 + ); + } + })(e3, g, n2, l, c, d), + true + ); + const f = r[i3]; + if (f) + return ( + (function (e4, t3, i4, r2, n3, a2) { + let h2 = o.get(t3); + h2 || + ((h2 = /* @__PURE__ */ new Map()), o.set(t3, h2)); + const l2 = e4.fillStyle; + if ("string" != typeof l2) + throw new Error( + `Unexpected fillStyle type "${l2}"` + ); + let c2 = h2.get(l2); + if (!c2) { + const i5 = t3[0].length, + r3 = t3.length, + o2 = + e4.canvas.ownerDocument.createElement( + "canvas" + ); + (o2.width = i5), (o2.height = r3); + const n4 = (0, s2.throwIfFalsy)( + o2.getContext("2d") + ), + a3 = new ImageData(i5, r3); + let d2, _2, u2, g2; + if (l2.startsWith("#")) + (d2 = parseInt(l2.slice(1, 3), 16)), + (_2 = parseInt(l2.slice(3, 5), 16)), + (u2 = parseInt(l2.slice(5, 7), 16)), + (g2 = + (l2.length > 7 && + parseInt(l2.slice(7, 9), 16)) || + 1); + else { + if (!l2.startsWith("rgba")) + throw new Error( + `Unexpected fillStyle color format "${l2}" when drawing pattern glyph` + ); + [d2, _2, u2, g2] = l2 + .substring(5, l2.length - 1) + .split(",") + .map((e5) => parseFloat(e5)); + } + for (let e5 = 0; e5 < r3; e5++) + for (let s3 = 0; s3 < i5; s3++) + (a3.data[4 * (e5 * i5 + s3)] = d2), + (a3.data[4 * (e5 * i5 + s3) + 1] = _2), + (a3.data[4 * (e5 * i5 + s3) + 2] = u2), + (a3.data[4 * (e5 * i5 + s3) + 3] = + t3[e5][s3] * (255 * g2)); + n4.putImageData(a3, 0, 0), + (c2 = (0, s2.throwIfFalsy)( + e4.createPattern(o2, null) + )), + h2.set(l2, c2); + } + (e4.fillStyle = c2), e4.fillRect(i4, r2, n3, a2); + })(e3, f, n2, l, c, d), + true + ); + const v = t2.boxDrawingDefinitions[i3]; + if (v) + return ( + (function (e4, t3, i4, s3, r2, o2, n3) { + e4.strokeStyle = e4.fillStyle; + for (const [l2, c2] of Object.entries(t3)) { + let t4; + e4.beginPath(), + (e4.lineWidth = n3 * Number.parseInt(l2)), + (t4 = + "function" == typeof c2 + ? c2(0.15, (0.15 / o2) * r2) + : c2); + for (const l3 of t4.split(" ")) { + const t5 = l3[0], + c3 = a[t5]; + if (!c3) { + console.error( + `Could not find drawing instructions for "${t5}"` + ); + continue; + } + const d2 = l3.substring(1).split(","); + d2[0] && + d2[1] && + c3(e4, h(d2, r2, o2, i4, s3, true, n3)); + } + e4.stroke(), e4.closePath(); + } + })(e3, v, n2, l, c, d, u), + true + ); + const C = t2.powerlineDefinitions[i3]; + return ( + !!C && + ((function (e4, t3, i4, s3, r2, o2, n3, l2) { + const c2 = new Path2D(); + c2.rect(i4, s3, r2, o2), e4.clip(c2), e4.beginPath(); + const d2 = n3 / 12; + e4.lineWidth = l2 * d2; + for (const n4 of t3.d.split(" ")) { + const c3 = n4[0], + _2 = a[c3]; + if (!_2) { + console.error( + `Could not find drawing instructions for "${c3}"` + ); + continue; + } + const u2 = n4.substring(1).split(","); + u2[0] && + u2[1] && + _2( + e4, + h( + u2, + r2, + o2, + i4, + s3, + false, + l2, + (t3.leftPadding ?? 0) * (d2 / 2), + (t3.rightPadding ?? 0) * (d2 / 2) + ) + ); + } + 1 === t3.type + ? ((e4.strokeStyle = e4.fillStyle), e4.stroke()) + : e4.fill(), + e4.closePath(); + })(e3, C, n2, l, c, d, _, u), + true) + ); + }); + const o = /* @__PURE__ */ new Map(); + function n(e3, t3, i3 = 0) { + return Math.max(Math.min(e3, t3), i3); + } + const a = { + C: (e3, t3) => + e3.bezierCurveTo( + t3[0], + t3[1], + t3[2], + t3[3], + t3[4], + t3[5] + ), + L: (e3, t3) => e3.lineTo(t3[0], t3[1]), + M: (e3, t3) => e3.moveTo(t3[0], t3[1]), + }; + function h(e3, t3, i3, s3, r2, o2, a2, h2 = 0, l = 0) { + const c = e3.map((e4) => parseFloat(e4) || parseInt(e4)); + if (c.length < 2) + throw new Error("Too few arguments for instruction"); + for (let e4 = 0; e4 < c.length; e4 += 2) + (c[e4] *= t3 - h2 * a2 - l * a2), + o2 && + 0 !== c[e4] && + (c[e4] = n(Math.round(c[e4] + 0.5) - 0.5, t3, 0)), + (c[e4] += s3 + h2 * a2); + for (let e4 = 1; e4 < c.length; e4 += 2) + (c[e4] *= i3), + o2 && + 0 !== c[e4] && + (c[e4] = n(Math.round(c[e4] + 0.5) - 0.5, i3, 0)), + (c[e4] += r2); + return c; + } + }, + 56: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.observeDevicePixelDimensions = void 0); + const s2 = i2(859); + t2.observeDevicePixelDimensions = function (e3, t3, i3) { + let r = new t3.ResizeObserver((t4) => { + const s3 = t4.find((t5) => t5.target === e3); + if (!s3) return; + if (!("devicePixelContentBoxSize" in s3)) + return r?.disconnect(), void (r = void 0); + const o = s3.devicePixelContentBoxSize[0].inlineSize, + n = s3.devicePixelContentBoxSize[0].blockSize; + o > 0 && n > 0 && i3(o, n); + }); + try { + r.observe(e3, { box: ["device-pixel-content-box"] }); + } catch { + r.disconnect(), (r = void 0); + } + return (0, s2.toDisposable)(() => r?.disconnect()); + }; + }, + 374: (e2, t2) => { + function i2(e3) { + return 57508 <= e3 && e3 <= 57558; + } + function s2(e3) { + return ( + (e3 >= 128512 && e3 <= 128591) || + (e3 >= 127744 && e3 <= 128511) || + (e3 >= 128640 && e3 <= 128767) || + (e3 >= 9728 && e3 <= 9983) || + (e3 >= 9984 && e3 <= 10175) || + (e3 >= 65024 && e3 <= 65039) || + (e3 >= 129280 && e3 <= 129535) || + (e3 >= 127462 && e3 <= 127487) + ); + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.computeNextVariantOffset = + t2.createRenderDimensions = + t2.treatGlyphAsBackgroundColor = + t2.allowRescaling = + t2.isEmoji = + t2.isRestrictedPowerlineGlyph = + t2.isPowerlineGlyph = + t2.throwIfFalsy = + void 0), + (t2.throwIfFalsy = function (e3) { + if (!e3) throw new Error("value must not be falsy"); + return e3; + }), + (t2.isPowerlineGlyph = i2), + (t2.isRestrictedPowerlineGlyph = function (e3) { + return 57520 <= e3 && e3 <= 57527; + }), + (t2.isEmoji = s2), + (t2.allowRescaling = function (e3, t3, r, o) { + return ( + 1 === t3 && + r > Math.ceil(1.5 * o) && + void 0 !== e3 && + e3 > 255 && + !s2(e3) && + !i2(e3) && + !(function (e4) { + return 57344 <= e4 && e4 <= 63743; + })(e3) + ); + }), + (t2.treatGlyphAsBackgroundColor = function (e3) { + return ( + i2(e3) || + (function (e4) { + return 9472 <= e4 && e4 <= 9631; + })(e3) + ); + }), + (t2.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 }, + }, + }; + }), + (t2.computeNextVariantOffset = function (e3, t3, i3 = 0) { + return ( + (e3 - (2 * Math.round(t3) - i3)) % (2 * Math.round(t3)) + ); + }); + }, + 296: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createSelectionRenderModel = void 0); + class i2 { + constructor() { + this.clear(); + } + clear() { + (this.hasSelection = false), + (this.columnSelectMode = false), + (this.viewportStartRow = 0), + (this.viewportEndRow = 0), + (this.viewportCappedStartRow = 0), + (this.viewportCappedEndRow = 0), + (this.startCol = 0), + (this.endCol = 0), + (this.selectionStart = void 0), + (this.selectionEnd = void 0); + } + update(e3, t3, i3, s2 = false) { + if ( + ((this.selectionStart = t3), + (this.selectionEnd = i3), + !t3 || !i3 || (t3[0] === i3[0] && t3[1] === i3[1])) + ) + return void this.clear(); + const r = e3.buffers.active.ydisp, + o = t3[1] - r, + n = i3[1] - r, + a = Math.max(o, 0), + h = Math.min(n, e3.rows - 1); + a >= e3.rows || h < 0 + ? this.clear() + : ((this.hasSelection = true), + (this.columnSelectMode = s2), + (this.viewportStartRow = o), + (this.viewportEndRow = n), + (this.viewportCappedStartRow = a), + (this.viewportCappedEndRow = h), + (this.startCol = t3[0]), + (this.endCol = i3[0])); + } + isCellSelected(e3, t3, i3) { + return ( + !!this.hasSelection && + ((i3 -= e3.buffer.active.viewportY), + this.columnSelectMode + ? this.startCol <= this.endCol + ? t3 >= this.startCol && + i3 >= this.viewportCappedStartRow && + t3 < this.endCol && + i3 <= this.viewportCappedEndRow + : t3 < this.startCol && + i3 >= this.viewportCappedStartRow && + t3 >= this.endCol && + i3 <= this.viewportCappedEndRow + : (i3 > this.viewportStartRow && + i3 < this.viewportEndRow) || + (this.viewportStartRow === this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportEndRow && + t3 < this.endCol) || + (this.viewportStartRow < this.viewportEndRow && + i3 === this.viewportStartRow && + t3 >= this.startCol)) + ); + } + } + t2.createSelectionRenderModel = function () { + return new i2(); + }; + }, + 509: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.TextureAtlas = void 0); + const s2 = i2(237), + r = i2(860), + o = i2(374), + n = i2(160), + a = i2(345), + h = i2(485), + l = i2(385), + c = i2(147), + d = i2(855), + _ = { + texturePage: 0, + texturePosition: { x: 0, y: 0 }, + texturePositionClipSpace: { x: 0, y: 0 }, + offset: { x: 0, y: 0 }, + size: { x: 0, y: 0 }, + sizeClipSpace: { x: 0, y: 0 }, + }; + let u; + class g { + get pages() { + return this._pages; + } + constructor(e3, t3, i3) { + (this._document = e3), + (this._config = t3), + (this._unicodeService = i3), + (this._didWarmUp = false), + (this._cacheMap = new h.FourKeyMap()), + (this._cacheMapCombined = new h.FourKeyMap()), + (this._pages = []), + (this._activePages = []), + (this._workBoundingBox = { + top: 0, + left: 0, + bottom: 0, + right: 0, + }), + (this._workAttributeData = new c.AttributeData()), + (this._textureSize = 512), + (this._onAddTextureAtlasCanvas = new a.EventEmitter()), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event), + (this._onRemoveTextureAtlasCanvas = + new a.EventEmitter()), + (this.onRemoveTextureAtlasCanvas = + this._onRemoveTextureAtlasCanvas.event), + (this._requestClearModel = false), + this._createNewPage(), + (this._tmpCanvas = C( + e3, + 4 * this._config.deviceCellWidth + 4, + this._config.deviceCellHeight + 4 + )), + (this._tmpCtx = (0, o.throwIfFalsy)( + this._tmpCanvas.getContext("2d", { + alpha: this._config.allowTransparency, + willReadFrequently: true, + }) + )); + } + dispose() { + for (const e3 of this.pages) e3.canvas.remove(); + this._onAddTextureAtlasCanvas.dispose(); + } + warmUp() { + this._didWarmUp || + (this._doWarmUp(), (this._didWarmUp = true)); + } + _doWarmUp() { + const e3 = new l.IdleTaskQueue(); + for (let t3 = 33; t3 < 126; t3++) + e3.enqueue(() => { + if ( + !this._cacheMap.get( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT + ) + ) { + const e4 = this._drawToCache( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT + ); + this._cacheMap.set( + t3, + d.DEFAULT_COLOR, + d.DEFAULT_COLOR, + d.DEFAULT_EXT, + e4 + ); + } + }); + } + beginFrame() { + return this._requestClearModel; + } + clearTexture() { + if ( + 0 !== this._pages[0].currentRow.x || + 0 !== this._pages[0].currentRow.y + ) { + for (const e3 of this._pages) e3.clear(); + this._cacheMap.clear(), + this._cacheMapCombined.clear(), + (this._didWarmUp = false); + } + } + _createNewPage() { + if ( + g.maxAtlasPages && + this._pages.length >= Math.max(4, g.maxAtlasPages) + ) { + const e4 = this._pages + .filter( + (e5) => + 2 * e5.canvas.width <= (g.maxTextureSize || 4096) + ) + .sort((e5, t4) => + t4.canvas.width !== e5.canvas.width + ? t4.canvas.width - e5.canvas.width + : t4.percentageUsed - e5.percentageUsed + ); + let t3 = -1, + i3 = 0; + for (let s4 = 0; s4 < e4.length; s4++) + if (e4[s4].canvas.width !== i3) + (t3 = s4), (i3 = e4[s4].canvas.width); + else if (s4 - t3 == 3) break; + const s3 = e4.slice(t3, t3 + 4), + r2 = s3 + .map((e5) => e5.glyphs[0].texturePage) + .sort((e5, t4) => (e5 > t4 ? 1 : -1)), + o2 = this.pages.length - s3.length, + n2 = this._mergePages(s3, o2); + n2.version++; + for (let e5 = r2.length - 1; e5 >= 0; e5--) + this._deletePage(r2[e5]); + this.pages.push(n2), + (this._requestClearModel = true), + this._onAddTextureAtlasCanvas.fire(n2.canvas); + } + const e3 = new f(this._document, this._textureSize); + return ( + this._pages.push(e3), + this._activePages.push(e3), + this._onAddTextureAtlasCanvas.fire(e3.canvas), + e3 + ); + } + _mergePages(e3, t3) { + const i3 = 2 * e3[0].canvas.width, + s3 = new f(this._document, i3, e3); + for (const [r2, o2] of e3.entries()) { + const e4 = (r2 * o2.canvas.width) % i3, + n2 = Math.floor(r2 / 2) * o2.canvas.height; + s3.ctx.drawImage(o2.canvas, e4, n2); + for (const s4 of o2.glyphs) + (s4.texturePage = t3), + (s4.sizeClipSpace.x = s4.size.x / i3), + (s4.sizeClipSpace.y = s4.size.y / i3), + (s4.texturePosition.x += e4), + (s4.texturePosition.y += n2), + (s4.texturePositionClipSpace.x = + s4.texturePosition.x / i3), + (s4.texturePositionClipSpace.y = + s4.texturePosition.y / i3); + this._onRemoveTextureAtlasCanvas.fire(o2.canvas); + const a2 = this._activePages.indexOf(o2); + -1 !== a2 && this._activePages.splice(a2, 1); + } + return s3; + } + _deletePage(e3) { + this._pages.splice(e3, 1); + for (let t3 = e3; t3 < this._pages.length; t3++) { + const e4 = this._pages[t3]; + for (const t4 of e4.glyphs) t4.texturePage--; + e4.version++; + } + } + getRasterizedGlyphCombinedChar(e3, t3, i3, s3, r2) { + return this._getFromCacheMap( + this._cacheMapCombined, + e3, + t3, + i3, + s3, + r2 + ); + } + getRasterizedGlyph(e3, t3, i3, s3, r2) { + return this._getFromCacheMap( + this._cacheMap, + e3, + t3, + i3, + s3, + r2 + ); + } + _getFromCacheMap(e3, t3, i3, s3, r2, o2 = false) { + return ( + (u = e3.get(t3, i3, s3, r2)), + u || + ((u = this._drawToCache(t3, i3, s3, r2, o2)), + e3.set(t3, i3, s3, r2, u)), + u + ); + } + _getColorFromAnsiIndex(e3) { + if (e3 >= this._config.colors.ansi.length) + throw new Error("No color found for idx " + e3); + return this._config.colors.ansi[e3]; + } + _getBackgroundColor(e3, t3, i3, s3) { + if (this._config.allowTransparency) return n.NULL_COLOR; + let r2; + switch (e3) { + case 16777216: + case 33554432: + r2 = this._getColorFromAnsiIndex(t3); + break; + case 50331648: + const e4 = c.AttributeData.toColorRGB(t3); + r2 = n.channels.toColor(e4[0], e4[1], e4[2]); + break; + default: + r2 = i3 + ? n.color.opaque(this._config.colors.foreground) + : this._config.colors.background; + } + return r2; + } + _getForegroundColor( + e3, + t3, + i3, + r2, + o2, + a2, + h2, + l2, + d2, + _2 + ) { + const u2 = this._getMinimumContrastColor( + e3, + t3, + i3, + r2, + o2, + a2, + h2, + d2, + l2, + _2 + ); + if (u2) return u2; + let g2; + switch (o2) { + case 16777216: + case 33554432: + this._config.drawBoldTextInBrightColors && + d2 && + a2 < 8 && + (a2 += 8), + (g2 = this._getColorFromAnsiIndex(a2)); + break; + case 50331648: + const e4 = c.AttributeData.toColorRGB(a2); + g2 = n.channels.toColor(e4[0], e4[1], e4[2]); + break; + default: + g2 = h2 + ? this._config.colors.background + : this._config.colors.foreground; + } + return ( + this._config.allowTransparency && + (g2 = n.color.opaque(g2)), + l2 && + (g2 = n.color.multiplyOpacity(g2, s2.DIM_OPACITY)), + g2 + ); + } + _resolveBackgroundRgba(e3, t3, i3) { + switch (e3) { + case 16777216: + case 33554432: + return this._getColorFromAnsiIndex(t3).rgba; + case 50331648: + return t3 << 8; + default: + return i3 + ? this._config.colors.foreground.rgba + : this._config.colors.background.rgba; + } + } + _resolveForegroundRgba(e3, t3, i3, s3) { + switch (e3) { + case 16777216: + case 33554432: + return ( + this._config.drawBoldTextInBrightColors && + s3 && + t3 < 8 && + (t3 += 8), + this._getColorFromAnsiIndex(t3).rgba + ); + case 50331648: + return t3 << 8; + default: + return i3 + ? this._config.colors.background.rgba + : this._config.colors.foreground.rgba; + } + } + _getMinimumContrastColor( + e3, + t3, + i3, + s3, + r2, + o2, + a2, + h2, + l2, + c2 + ) { + if (1 === this._config.minimumContrastRatio || c2) return; + const d2 = this._getContrastCache(l2), + _2 = d2.getColor(e3, s3); + if (void 0 !== _2) return _2 || void 0; + const u2 = this._resolveBackgroundRgba(t3, i3, a2), + g2 = this._resolveForegroundRgba(r2, o2, a2, h2), + f2 = n.rgba.ensureContrastRatio( + u2, + g2, + this._config.minimumContrastRatio / (l2 ? 2 : 1) + ); + if (!f2) return void d2.setColor(e3, s3, null); + const v2 = n.channels.toColor( + (f2 >> 24) & 255, + (f2 >> 16) & 255, + (f2 >> 8) & 255 + ); + return d2.setColor(e3, s3, v2), v2; + } + _getContrastCache(e3) { + return e3 + ? this._config.colors.halfContrastCache + : this._config.colors.contrastCache; + } + _drawToCache(e3, t3, i3, n2, a2 = false) { + const h2 = + "number" == typeof e3 ? String.fromCharCode(e3) : e3, + l2 = Math.min( + this._config.deviceCellWidth * + Math.max(h2.length, 2) + + 4, + this._textureSize + ); + this._tmpCanvas.width < l2 && + (this._tmpCanvas.width = l2); + const d2 = Math.min( + this._config.deviceCellHeight + 8, + this._textureSize + ); + if ( + (this._tmpCanvas.height < d2 && + (this._tmpCanvas.height = d2), + this._tmpCtx.save(), + (this._workAttributeData.fg = i3), + (this._workAttributeData.bg = t3), + (this._workAttributeData.extended.ext = n2), + this._workAttributeData.isInvisible()) + ) + return _; + const u2 = !!this._workAttributeData.isBold(), + f2 = !!this._workAttributeData.isInverse(), + C2 = !!this._workAttributeData.isDim(), + p = !!this._workAttributeData.isItalic(), + m = !!this._workAttributeData.isUnderline(), + x = !!this._workAttributeData.isStrikethrough(), + w = !!this._workAttributeData.isOverline(); + let L = this._workAttributeData.getFgColor(), + b = this._workAttributeData.getFgColorMode(), + M = this._workAttributeData.getBgColor(), + S = this._workAttributeData.getBgColorMode(); + if (f2) { + const e4 = L; + (L = M), (M = e4); + const t4 = b; + (b = S), (S = t4); + } + const y = this._getBackgroundColor(S, M, f2, C2); + (this._tmpCtx.globalCompositeOperation = "copy"), + (this._tmpCtx.fillStyle = y.css), + this._tmpCtx.fillRect( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ), + (this._tmpCtx.globalCompositeOperation = "source-over"); + const R = u2 + ? this._config.fontWeightBold + : this._config.fontWeight, + A = p ? "italic" : ""; + (this._tmpCtx.font = `${A} ${R} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`), + (this._tmpCtx.textBaseline = s2.TEXT_BASELINE); + const D = + 1 === h2.length && + (0, o.isPowerlineGlyph)(h2.charCodeAt(0)), + T = + 1 === h2.length && + (0, o.isRestrictedPowerlineGlyph)(h2.charCodeAt(0)), + k = this._getForegroundColor( + t3, + S, + M, + i3, + b, + L, + f2, + C2, + u2, + (0, o.treatGlyphAsBackgroundColor)(h2.charCodeAt(0)) + ); + this._tmpCtx.fillStyle = k.css; + const E = T ? 0 : 4; + let B = false; + false !== this._config.customGlyphs && + (B = (0, r.tryDrawCustomChar)( + this._tmpCtx, + h2, + E, + E, + this._config.deviceCellWidth, + this._config.deviceCellHeight, + this._config.fontSize, + this._config.devicePixelRatio + )); + let $, + P = !D; + if ( + (($ = + "number" == typeof e3 + ? this._unicodeService.wcwidth(e3) + : this._unicodeService.getStringCellWidth(e3)), + m) + ) { + this._tmpCtx.save(); + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 15 + ) + ), + t4 = e4 % 2 == 1 ? 0.5 : 0; + if ( + ((this._tmpCtx.lineWidth = e4), + this._workAttributeData.isUnderlineColorDefault()) + ) + this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; + else if (this._workAttributeData.isUnderlineColorRGB()) + (P = false), + (this._tmpCtx.strokeStyle = `rgb(${c.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`); + else { + P = false; + let e5 = this._workAttributeData.getUnderlineColor(); + this._config.drawBoldTextInBrightColors && + this._workAttributeData.isBold() && + e5 < 8 && + (e5 += 8), + (this._tmpCtx.strokeStyle = + this._getColorFromAnsiIndex(e5).css); + } + this._tmpCtx.beginPath(); + const i4 = E, + s3 = + Math.ceil(E + this._config.deviceCharHeight) - + t4 - + (a2 ? 2 * e4 : 0), + r2 = s3 + e4, + n3 = s3 + 2 * e4; + let l3 = + this._workAttributeData.getUnderlineVariantOffset(); + for (let a3 = 0; a3 < $; a3++) { + this._tmpCtx.save(); + const h3 = i4 + a3 * this._config.deviceCellWidth, + c2 = i4 + (a3 + 1) * this._config.deviceCellWidth, + d3 = h3 + this._config.deviceCellWidth / 2; + switch ( + this._workAttributeData.extended.underlineStyle + ) { + case 2: + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3), + this._tmpCtx.moveTo(h3, n3), + this._tmpCtx.lineTo(c2, n3); + break; + case 3: + const i5 = + e4 <= 1 + ? n3 + : Math.ceil( + E + + this._config.deviceCharHeight - + e4 / 2 + ) - t4, + a4 = + e4 <= 1 + ? s3 + : Math.ceil( + E + + this._config.deviceCharHeight + + e4 / 2 + ) - t4, + _2 = new Path2D(); + _2.rect( + h3, + s3, + this._config.deviceCellWidth, + n3 - s3 + ), + this._tmpCtx.clip(_2), + this._tmpCtx.moveTo( + h3 - this._config.deviceCellWidth / 2, + r2 + ), + this._tmpCtx.bezierCurveTo( + h3 - this._config.deviceCellWidth / 2, + a4, + h3, + a4, + h3, + r2 + ), + this._tmpCtx.bezierCurveTo( + h3, + i5, + d3, + i5, + d3, + r2 + ), + this._tmpCtx.bezierCurveTo( + d3, + a4, + c2, + a4, + c2, + r2 + ), + this._tmpCtx.bezierCurveTo( + c2, + i5, + c2 + this._config.deviceCellWidth / 2, + i5, + c2 + this._config.deviceCellWidth / 2, + r2 + ); + break; + case 4: + const u3 = + 0 === l3 ? 0 : l3 >= e4 ? 2 * e4 - l3 : e4 - l3; + false == !(l3 >= e4) || 0 === u3 + ? (this._tmpCtx.setLineDash([ + Math.round(e4), + Math.round(e4), + ]), + this._tmpCtx.moveTo(h3 + u3, s3), + this._tmpCtx.lineTo(c2, s3)) + : (this._tmpCtx.setLineDash([ + Math.round(e4), + Math.round(e4), + ]), + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(h3 + u3, s3), + this._tmpCtx.moveTo(h3 + u3 + e4, s3), + this._tmpCtx.lineTo(c2, s3)), + (l3 = (0, o.computeNextVariantOffset)( + c2 - h3, + e4, + l3 + )); + break; + case 5: + const g2 = 0.6, + f3 = 0.3, + v2 = c2 - h3, + C3 = Math.floor(g2 * v2), + p2 = Math.floor(f3 * v2), + m2 = v2 - C3 - p2; + this._tmpCtx.setLineDash([C3, p2, m2]), + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3); + break; + default: + this._tmpCtx.moveTo(h3, s3), + this._tmpCtx.lineTo(c2, s3); + } + this._tmpCtx.stroke(), this._tmpCtx.restore(); + } + if ( + (this._tmpCtx.restore(), + !B && + this._config.fontSize >= 12 && + !this._config.allowTransparency && + " " !== h2) + ) { + this._tmpCtx.save(), + (this._tmpCtx.textBaseline = "alphabetic"); + const t5 = this._tmpCtx.measureText(h2); + if ( + (this._tmpCtx.restore(), + "actualBoundingBoxDescent" in t5 && + t5.actualBoundingBoxDescent > 0) + ) { + this._tmpCtx.save(); + const t6 = new Path2D(); + t6.rect( + i4, + s3 - Math.ceil(e4 / 2), + this._config.deviceCellWidth * $, + n3 - s3 + Math.ceil(e4 / 2) + ), + this._tmpCtx.clip(t6), + (this._tmpCtx.lineWidth = + 3 * this._config.devicePixelRatio), + (this._tmpCtx.strokeStyle = y.css), + this._tmpCtx.strokeText( + h2, + E, + E + this._config.deviceCharHeight + ), + this._tmpCtx.restore(); + } + } + } + if (w) { + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 15 + ) + ), + t4 = e4 % 2 == 1 ? 0.5 : 0; + (this._tmpCtx.lineWidth = e4), + (this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle), + this._tmpCtx.beginPath(), + this._tmpCtx.moveTo(E, E + t4), + this._tmpCtx.lineTo( + E + this._config.deviceCharWidth * $, + E + t4 + ), + this._tmpCtx.stroke(); + } + if ( + (B || + this._tmpCtx.fillText( + h2, + E, + E + this._config.deviceCharHeight + ), + "_" === h2 && !this._config.allowTransparency) + ) { + let e4 = v( + this._tmpCtx.getImageData( + E, + E, + this._config.deviceCellWidth, + this._config.deviceCellHeight + ), + y, + k, + P + ); + if (e4) + for ( + let t4 = 1; + t4 <= 5 && + (this._tmpCtx.save(), + (this._tmpCtx.fillStyle = y.css), + this._tmpCtx.fillRect( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ), + this._tmpCtx.restore(), + this._tmpCtx.fillText( + h2, + E, + E + this._config.deviceCharHeight - t4 + ), + (e4 = v( + this._tmpCtx.getImageData( + E, + E, + this._config.deviceCellWidth, + this._config.deviceCellHeight + ), + y, + k, + P + )), + e4); + t4++ + ); + } + if (x) { + const e4 = Math.max( + 1, + Math.floor( + (this._config.fontSize * + this._config.devicePixelRatio) / + 10 + ) + ), + t4 = this._tmpCtx.lineWidth % 2 == 1 ? 0.5 : 0; + (this._tmpCtx.lineWidth = e4), + (this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle), + this._tmpCtx.beginPath(), + this._tmpCtx.moveTo( + E, + E + + Math.floor(this._config.deviceCharHeight / 2) - + t4 + ), + this._tmpCtx.lineTo( + E + this._config.deviceCharWidth * $, + E + + Math.floor(this._config.deviceCharHeight / 2) - + t4 + ), + this._tmpCtx.stroke(); + } + this._tmpCtx.restore(); + const O = this._tmpCtx.getImageData( + 0, + 0, + this._tmpCanvas.width, + this._tmpCanvas.height + ); + let I; + if ( + ((I = this._config.allowTransparency + ? (function (e4) { + for (let t4 = 0; t4 < e4.data.length; t4 += 4) + if (e4.data[t4 + 3] > 0) return false; + return true; + })(O) + : v(O, y, k, P)), + I) + ) + return _; + const F = this._findGlyphBoundingBox( + O, + this._workBoundingBox, + l2, + T, + B, + E + ); + let W, H; + for (;;) { + if (0 === this._activePages.length) { + const e4 = this._createNewPage(); + (W = e4), (H = e4.currentRow), (H.height = F.size.y); + break; + } + (W = this._activePages[this._activePages.length - 1]), + (H = W.currentRow); + for (const e4 of this._activePages) + F.size.y <= e4.currentRow.height && + ((W = e4), (H = e4.currentRow)); + for ( + let e4 = this._activePages.length - 1; + e4 >= 0; + e4-- + ) + for (const t4 of this._activePages[e4].fixedRows) + t4.height <= H.height && + F.size.y <= t4.height && + ((W = this._activePages[e4]), (H = t4)); + if ( + H.y + F.size.y >= W.canvas.height || + H.height > F.size.y + 2 + ) { + let e4 = false; + if ( + W.currentRow.y + W.currentRow.height + F.size.y >= + W.canvas.height + ) { + let t4; + for (const e5 of this._activePages) + if ( + e5.currentRow.y + + e5.currentRow.height + + F.size.y < + e5.canvas.height + ) { + t4 = e5; + break; + } + if (t4) W = t4; + else if ( + g.maxAtlasPages && + this._pages.length >= g.maxAtlasPages && + H.y + F.size.y <= W.canvas.height && + H.height >= F.size.y && + H.x + F.size.x <= W.canvas.width + ) + e4 = true; + else { + const t5 = this._createNewPage(); + (W = t5), + (H = t5.currentRow), + (H.height = F.size.y), + (e4 = true); + } + } + e4 || + (W.currentRow.height > 0 && + W.fixedRows.push(W.currentRow), + (H = { + x: 0, + y: W.currentRow.y + W.currentRow.height, + height: F.size.y, + }), + W.fixedRows.push(H), + (W.currentRow = { + x: 0, + y: H.y + H.height, + height: 0, + })); + } + if (H.x + F.size.x <= W.canvas.width) break; + H === W.currentRow + ? ((H.x = 0), (H.y += H.height), (H.height = 0)) + : W.fixedRows.splice(W.fixedRows.indexOf(H), 1); + } + return ( + (F.texturePage = this._pages.indexOf(W)), + (F.texturePosition.x = H.x), + (F.texturePosition.y = H.y), + (F.texturePositionClipSpace.x = H.x / W.canvas.width), + (F.texturePositionClipSpace.y = H.y / W.canvas.height), + (F.sizeClipSpace.x /= W.canvas.width), + (F.sizeClipSpace.y /= W.canvas.height), + (H.height = Math.max(H.height, F.size.y)), + (H.x += F.size.x), + W.ctx.putImageData( + O, + F.texturePosition.x - this._workBoundingBox.left, + F.texturePosition.y - this._workBoundingBox.top, + this._workBoundingBox.left, + this._workBoundingBox.top, + F.size.x, + F.size.y + ), + W.addGlyph(F), + W.version++, + F + ); + } + _findGlyphBoundingBox(e3, t3, i3, s3, r2, o2) { + t3.top = 0; + const n2 = s3 + ? this._config.deviceCellHeight + : this._tmpCanvas.height, + a2 = s3 ? this._config.deviceCellWidth : i3; + let h2 = false; + for (let i4 = 0; i4 < n2; i4++) { + for (let s4 = 0; s4 < a2; s4++) { + const r3 = + i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3; + if (0 !== e3.data[r3]) { + (t3.top = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.left = 0), (h2 = false); + for (let i4 = 0; i4 < o2 + a2; i4++) { + for (let s4 = 0; s4 < n2; s4++) { + const r3 = + s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3; + if (0 !== e3.data[r3]) { + (t3.left = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.right = a2), (h2 = false); + for (let i4 = o2 + a2 - 1; i4 >= o2; i4--) { + for (let s4 = 0; s4 < n2; s4++) { + const r3 = + s4 * this._tmpCanvas.width * 4 + 4 * i4 + 3; + if (0 !== e3.data[r3]) { + (t3.right = i4), (h2 = true); + break; + } + } + if (h2) break; + } + (t3.bottom = n2), (h2 = false); + for (let i4 = n2 - 1; i4 >= 0; i4--) { + for (let s4 = 0; s4 < a2; s4++) { + const r3 = + i4 * this._tmpCanvas.width * 4 + 4 * s4 + 3; + if (0 !== e3.data[r3]) { + (t3.bottom = i4), (h2 = true); + break; + } + } + if (h2) break; + } + return { + texturePage: 0, + texturePosition: { x: 0, y: 0 }, + texturePositionClipSpace: { x: 0, y: 0 }, + size: { + x: t3.right - t3.left + 1, + y: t3.bottom - t3.top + 1, + }, + sizeClipSpace: { + x: t3.right - t3.left + 1, + y: t3.bottom - t3.top + 1, + }, + offset: { + x: + -t3.left + + o2 + + (s3 || r2 + ? Math.floor( + (this._config.deviceCellWidth - + this._config.deviceCharWidth) / + 2 + ) + : 0), + y: + -t3.top + + o2 + + (s3 || r2 + ? 1 === this._config.lineHeight + ? 0 + : Math.round( + (this._config.deviceCellHeight - + this._config.deviceCharHeight) / + 2 + ) + : 0), + }, + }; + } + } + t2.TextureAtlas = g; + class f { + get percentageUsed() { + return ( + this._usedPixels / + (this.canvas.width * this.canvas.height) + ); + } + get glyphs() { + return this._glyphs; + } + addGlyph(e3) { + this._glyphs.push(e3), + (this._usedPixels += e3.size.x * e3.size.y); + } + constructor(e3, t3, i3) { + if ( + ((this._usedPixels = 0), + (this._glyphs = []), + (this.version = 0), + (this.currentRow = { x: 0, y: 0, height: 0 }), + (this.fixedRows = []), + i3) + ) + for (const e4 of i3) + this._glyphs.push(...e4.glyphs), + (this._usedPixels += e4._usedPixels); + (this.canvas = C(e3, t3, t3)), + (this.ctx = (0, o.throwIfFalsy)( + this.canvas.getContext("2d", { alpha: true }) + )); + } + clear() { + this.ctx.clearRect( + 0, + 0, + this.canvas.width, + this.canvas.height + ), + (this.currentRow.x = 0), + (this.currentRow.y = 0), + (this.currentRow.height = 0), + (this.fixedRows.length = 0), + this.version++; + } + } + function v(e3, t3, i3, s3) { + const r2 = t3.rgba >>> 24, + o2 = (t3.rgba >>> 16) & 255, + n2 = (t3.rgba >>> 8) & 255, + a2 = i3.rgba >>> 24, + h2 = (i3.rgba >>> 16) & 255, + l2 = (i3.rgba >>> 8) & 255, + c2 = Math.floor( + (Math.abs(r2 - a2) + + Math.abs(o2 - h2) + + Math.abs(n2 - l2)) / + 12 + ); + let d2 = true; + for (let t4 = 0; t4 < e3.data.length; t4 += 4) + (e3.data[t4] === r2 && + e3.data[t4 + 1] === o2 && + e3.data[t4 + 2] === n2) || + (s3 && + Math.abs(e3.data[t4] - r2) + + Math.abs(e3.data[t4 + 1] - o2) + + Math.abs(e3.data[t4 + 2] - n2) < + c2) + ? (e3.data[t4 + 3] = 0) + : (d2 = false); + return d2; + } + function C(e3, t3, i3) { + const s3 = e3.createElement("canvas"); + return (s3.width = t3), (s3.height = i3), s3; + } + }, + 577: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + o2 = arguments.length, + n2 = + o2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + n2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (n2 = + (o2 < 3 + ? r2(n2) + : o2 > 3 + ? r2(t3, i3, n2) + : r2(t3, i3)) || n2); + return ( + o2 > 3 && n2 && Object.defineProperty(t3, i3, n2), n2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CharacterJoinerService = t2.JoinedCellData = void 0); + const o = i2(147), + n = i2(855), + a = i2(782), + h = i2(97); + class l extends o.AttributeData { + constructor(e3, t3, i3) { + super(), + (this.content = 0), + (this.combinedData = ""), + (this.fg = e3.fg), + (this.bg = e3.bg), + (this.combinedData = t3), + (this._width = i3); + } + isCombined() { + return 2097152; + } + getWidth() { + return this._width; + } + getChars() { + return this.combinedData; + } + getCode() { + return 2097151; + } + setFromCharData(e3) { + throw new Error("not implemented"); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + t2.JoinedCellData = l; + let c = (t2.CharacterJoinerService = class e3 { + constructor(e4) { + (this._bufferService = e4), + (this._characterJoiners = []), + (this._nextCharacterJoinerId = 0), + (this._workCell = new a.CellData()); + } + register(e4) { + const t3 = { + id: this._nextCharacterJoinerId++, + handler: e4, + }; + return this._characterJoiners.push(t3), t3.id; + } + deregister(e4) { + for (let t3 = 0; t3 < this._characterJoiners.length; t3++) + if (this._characterJoiners[t3].id === e4) + return this._characterJoiners.splice(t3, 1), true; + return false; + } + getJoinedCharacters(e4) { + if (0 === this._characterJoiners.length) return []; + const t3 = this._bufferService.buffer.lines.get(e4); + if (!t3 || 0 === t3.length) return []; + const i3 = [], + s3 = t3.translateToString(true); + let r2 = 0, + o2 = 0, + a2 = 0, + h2 = t3.getFg(0), + l2 = t3.getBg(0); + for (let e5 = 0; e5 < t3.getTrimmedLength(); e5++) + if ( + (t3.loadCell(e5, this._workCell), + 0 !== this._workCell.getWidth()) + ) { + if ( + this._workCell.fg !== h2 || + this._workCell.bg !== l2 + ) { + if (e5 - r2 > 1) { + const e6 = this._getJoinedRanges( + s3, + a2, + o2, + t3, + r2 + ); + for (let t4 = 0; t4 < e6.length; t4++) + i3.push(e6[t4]); + } + (r2 = e5), + (a2 = o2), + (h2 = this._workCell.fg), + (l2 = this._workCell.bg); + } + o2 += + this._workCell.getChars().length || + n.WHITESPACE_CELL_CHAR.length; + } + if (this._bufferService.cols - r2 > 1) { + const e5 = this._getJoinedRanges(s3, a2, o2, t3, r2); + for (let t4 = 0; t4 < e5.length; t4++) i3.push(e5[t4]); + } + return i3; + } + _getJoinedRanges(t3, i3, s3, r2, o2) { + const n2 = t3.substring(i3, s3); + let a2 = []; + try { + a2 = this._characterJoiners[0].handler(n2); + } catch (e4) { + console.error(e4); + } + for (let t4 = 1; t4 < this._characterJoiners.length; t4++) + try { + const i4 = this._characterJoiners[t4].handler(n2); + for (let t5 = 0; t5 < i4.length; t5++) + e3._mergeRanges(a2, i4[t5]); + } catch (e4) { + console.error(e4); + } + return this._stringRangesToCellRanges(a2, r2, o2), a2; + } + _stringRangesToCellRanges(e4, t3, i3) { + let s3 = 0, + r2 = false, + o2 = 0, + a2 = e4[s3]; + if (a2) { + for (let h2 = i3; h2 < this._bufferService.cols; h2++) { + const i4 = t3.getWidth(h2), + l2 = + t3.getString(h2).length || + n.WHITESPACE_CELL_CHAR.length; + if (0 !== i4) { + if ( + (!r2 && + a2[0] <= o2 && + ((a2[0] = h2), (r2 = true)), + a2[1] <= o2) + ) { + if (((a2[1] = h2), (a2 = e4[++s3]), !a2)) break; + a2[0] <= o2 + ? ((a2[0] = h2), (r2 = true)) + : (r2 = false); + } + o2 += l2; + } + } + a2 && (a2[1] = this._bufferService.cols); + } + } + static _mergeRanges(e4, t3) { + let i3 = false; + for (let s3 = 0; s3 < e4.length; s3++) { + const r2 = e4[s3]; + if (i3) { + if (t3[1] <= r2[0]) + return (e4[s3 - 1][1] = t3[1]), e4; + if (t3[1] <= r2[1]) + return ( + (e4[s3 - 1][1] = Math.max(t3[1], r2[1])), + e4.splice(s3, 1), + e4 + ); + e4.splice(s3, 1), s3--; + } else { + if (t3[1] <= r2[0]) return e4.splice(s3, 0, t3), e4; + if (t3[1] <= r2[1]) + return (r2[0] = Math.min(t3[0], r2[0])), e4; + t3[0] < r2[1] && + ((r2[0] = Math.min(t3[0], r2[0])), (i3 = true)); + } + } + return ( + i3 ? (e4[e4.length - 1][1] = t3[1]) : e4.push(t3), e4 + ); + } + }); + t2.CharacterJoinerService = c = s2( + [r(0, h.IBufferService)], + c + ); + }, + 160: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.contrastRatio = + t2.toPaddedHex = + t2.rgba = + t2.rgb = + t2.css = + t2.color = + t2.channels = + t2.NULL_COLOR = + void 0); + let i2 = 0, + s2 = 0, + r = 0, + o = 0; + var n, a, h, l, c; + function d(e3) { + const t3 = e3.toString(16); + return t3.length < 2 ? "0" + t3 : t3; + } + function _(e3, t3) { + return e3 < t3 + ? (t3 + 0.05) / (e3 + 0.05) + : (e3 + 0.05) / (t3 + 0.05); + } + (t2.NULL_COLOR = { css: "#00000000", rgba: 0 }), + (function (e3) { + (e3.toCss = function (e4, t3, i3, s3) { + return void 0 !== s3 + ? `#${d(e4)}${d(t3)}${d(i3)}${d(s3)}` + : `#${d(e4)}${d(t3)}${d(i3)}`; + }), + (e3.toRgba = function (e4, t3, i3, s3 = 255) { + return ( + ((e4 << 24) | (t3 << 16) | (i3 << 8) | s3) >>> 0 + ); + }), + (e3.toColor = function (t3, i3, s3, r2) { + return { + css: e3.toCss(t3, i3, s3, r2), + rgba: e3.toRgba(t3, i3, s3, r2), + }; + }); + })(n || (t2.channels = n = {})), + (function (e3) { + function t3(e4, t4) { + return ( + (o = Math.round(255 * t4)), + ([i2, s2, r] = c.toChannels(e4.rgba)), + { + css: n.toCss(i2, s2, r, o), + rgba: n.toRgba(i2, s2, r, o), + } + ); + } + (e3.blend = function (e4, t4) { + if (((o = (255 & t4.rgba) / 255), 1 === o)) + return { css: t4.css, rgba: t4.rgba }; + const a2 = (t4.rgba >> 24) & 255, + h2 = (t4.rgba >> 16) & 255, + l2 = (t4.rgba >> 8) & 255, + c2 = (e4.rgba >> 24) & 255, + d2 = (e4.rgba >> 16) & 255, + _2 = (e4.rgba >> 8) & 255; + return ( + (i2 = c2 + Math.round((a2 - c2) * o)), + (s2 = d2 + Math.round((h2 - d2) * o)), + (r = _2 + Math.round((l2 - _2) * o)), + { css: n.toCss(i2, s2, r), rgba: n.toRgba(i2, s2, r) } + ); + }), + (e3.isOpaque = function (e4) { + return 255 == (255 & e4.rgba); + }), + (e3.ensureContrastRatio = function (e4, t4, i3) { + const s3 = c.ensureContrastRatio( + e4.rgba, + t4.rgba, + i3 + ); + if (s3) + return n.toColor( + (s3 >> 24) & 255, + (s3 >> 16) & 255, + (s3 >> 8) & 255 + ); + }), + (e3.opaque = function (e4) { + const t4 = (255 | e4.rgba) >>> 0; + return ( + ([i2, s2, r] = c.toChannels(t4)), + { css: n.toCss(i2, s2, r), rgba: t4 } + ); + }), + (e3.opacity = t3), + (e3.multiplyOpacity = function (e4, i3) { + return (o = 255 & e4.rgba), t3(e4, (o * i3) / 255); + }), + (e3.toColorRGB = function (e4) { + return [ + (e4.rgba >> 24) & 255, + (e4.rgba >> 16) & 255, + (e4.rgba >> 8) & 255, + ]; + }); + })(a || (t2.color = a = {})), + (function (e3) { + let t3, a2; + try { + const e4 = document.createElement("canvas"); + (e4.width = 1), (e4.height = 1); + const i3 = e4.getContext("2d", { + willReadFrequently: true, + }); + i3 && + ((t3 = i3), + (t3.globalCompositeOperation = "copy"), + (a2 = t3.createLinearGradient(0, 0, 1, 1))); + } catch {} + e3.toColor = function (e4) { + if (e4.match(/#[\da-f]{3,8}/i)) + switch (e4.length) { + case 4: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + n.toColor(i2, s2, r) + ); + case 5: + return ( + (i2 = parseInt(e4.slice(1, 2).repeat(2), 16)), + (s2 = parseInt(e4.slice(2, 3).repeat(2), 16)), + (r = parseInt(e4.slice(3, 4).repeat(2), 16)), + (o = parseInt(e4.slice(4, 5).repeat(2), 16)), + n.toColor(i2, s2, r, o) + ); + case 7: + return { + css: e4, + rgba: + ((parseInt(e4.slice(1), 16) << 8) | 255) >>> + 0, + }; + case 9: + return { + css: e4, + rgba: parseInt(e4.slice(1), 16) >>> 0, + }; + } + const h2 = e4.match( + /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/ + ); + if (h2) + return ( + (i2 = parseInt(h2[1])), + (s2 = parseInt(h2[2])), + (r = parseInt(h2[3])), + (o = Math.round( + 255 * (void 0 === h2[5] ? 1 : parseFloat(h2[5])) + )), + n.toColor(i2, s2, r, o) + ); + if (!t3 || !a2) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + ((t3.fillStyle = a2), + (t3.fillStyle = e4), + "string" != typeof t3.fillStyle) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + if ( + (t3.fillRect(0, 0, 1, 1), + ([i2, s2, r, o] = t3.getImageData(0, 0, 1, 1).data), + 255 !== o) + ) + throw new Error( + "css.toColor: Unsupported css format" + ); + return { rgba: n.toRgba(i2, s2, r, o), css: e4 }; + }; + })(h || (t2.css = h = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = e4 / 255, + r2 = t4 / 255, + o2 = i3 / 255; + return ( + 0.2126 * + (s3 <= 0.03928 + ? s3 / 12.92 + : Math.pow((s3 + 0.055) / 1.055, 2.4)) + + 0.7152 * + (r2 <= 0.03928 + ? r2 / 12.92 + : Math.pow((r2 + 0.055) / 1.055, 2.4)) + + 0.0722 * + (o2 <= 0.03928 + ? o2 / 12.92 + : Math.pow((o2 + 0.055) / 1.055, 2.4)) + ); + } + (e3.relativeLuminance = function (e4) { + return t3((e4 >> 16) & 255, (e4 >> 8) & 255, 255 & e4); + }), + (e3.relativeLuminance2 = t3); + })(l || (t2.rgb = l = {})), + (function (e3) { + function t3(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + o2 = (e4 >> 8) & 255; + let n2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + ); + for (; c2 < i3 && (n2 > 0 || a3 > 0 || h2 > 0); ) + (n2 -= Math.max(0, Math.ceil(0.1 * n2))), + (a3 -= Math.max(0, Math.ceil(0.1 * a3))), + (h2 -= Math.max(0, Math.ceil(0.1 * h2))), + (c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + )); + return ( + ((n2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + function a2(e4, t4, i3) { + const s3 = (e4 >> 24) & 255, + r2 = (e4 >> 16) & 255, + o2 = (e4 >> 8) & 255; + let n2 = (t4 >> 24) & 255, + a3 = (t4 >> 16) & 255, + h2 = (t4 >> 8) & 255, + c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + ); + for (; c2 < i3 && (n2 < 255 || a3 < 255 || h2 < 255); ) + (n2 = Math.min( + 255, + n2 + Math.ceil(0.1 * (255 - n2)) + )), + (a3 = Math.min( + 255, + a3 + Math.ceil(0.1 * (255 - a3)) + )), + (h2 = Math.min( + 255, + h2 + Math.ceil(0.1 * (255 - h2)) + )), + (c2 = _( + l.relativeLuminance2(n2, a3, h2), + l.relativeLuminance2(s3, r2, o2) + )); + return ( + ((n2 << 24) | (a3 << 16) | (h2 << 8) | 255) >>> 0 + ); + } + (e3.blend = function (e4, t4) { + if (((o = (255 & t4) / 255), 1 === o)) return t4; + const a3 = (t4 >> 24) & 255, + h2 = (t4 >> 16) & 255, + l2 = (t4 >> 8) & 255, + c2 = (e4 >> 24) & 255, + d2 = (e4 >> 16) & 255, + _2 = (e4 >> 8) & 255; + return ( + (i2 = c2 + Math.round((a3 - c2) * o)), + (s2 = d2 + Math.round((h2 - d2) * o)), + (r = _2 + Math.round((l2 - _2) * o)), + n.toRgba(i2, s2, r) + ); + }), + (e3.ensureContrastRatio = function (e4, i3, s3) { + const r2 = l.relativeLuminance(e4 >> 8), + o2 = l.relativeLuminance(i3 >> 8); + if (_(r2, o2) < s3) { + if (o2 < r2) { + const o3 = t3(e4, i3, s3), + n3 = _(r2, l.relativeLuminance(o3 >> 8)); + if (n3 < s3) { + const t4 = a2(e4, i3, s3); + return n3 > _(r2, l.relativeLuminance(t4 >> 8)) + ? o3 + : t4; + } + return o3; + } + const n2 = a2(e4, i3, s3), + h2 = _(r2, l.relativeLuminance(n2 >> 8)); + if (h2 < s3) { + const o3 = t3(e4, i3, s3); + return h2 > _(r2, l.relativeLuminance(o3 >> 8)) + ? n2 + : o3; + } + return n2; + } + }), + (e3.reduceLuminance = t3), + (e3.increaseLuminance = a2), + (e3.toChannels = function (e4) { + return [ + (e4 >> 24) & 255, + (e4 >> 16) & 255, + (e4 >> 8) & 255, + 255 & e4, + ]; + }); + })(c || (t2.rgba = c = {})), + (t2.toPaddedHex = d), + (t2.contrastRatio = _); + }, + 345: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.runAndSubscribe = + t2.forwardEvent = + t2.EventEmitter = + void 0), + (t2.EventEmitter = class { + constructor() { + (this._listeners = []), (this._disposed = false); + } + get event() { + return ( + this._event || + (this._event = (e3) => ( + this._listeners.push(e3), + { + dispose: () => { + if (!this._disposed) { + for ( + let t3 = 0; + t3 < this._listeners.length; + t3++ + ) + if (this._listeners[t3] === e3) + return void this._listeners.splice( + t3, + 1 + ); + } + }, + } + )), + this._event + ); + } + fire(e3, t3) { + const i2 = []; + for (let e4 = 0; e4 < this._listeners.length; e4++) + i2.push(this._listeners[e4]); + for (let s2 = 0; s2 < i2.length; s2++) + i2[s2].call(void 0, e3, t3); + } + dispose() { + this.clearListeners(), (this._disposed = true); + } + clearListeners() { + this._listeners && (this._listeners.length = 0); + } + }), + (t2.forwardEvent = function (e3, t3) { + return e3((e4) => t3.fire(e4)); + }), + (t2.runAndSubscribe = function (e3, t3) { + return t3(void 0), e3((e4) => t3(e4)); + }); + }, + 859: (e2, t2) => { + function i2(e3) { + for (const t3 of e3) t3.dispose(); + e3.length = 0; + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.getDisposeArrayDisposable = + t2.disposeArray = + t2.toDisposable = + t2.MutableDisposable = + t2.Disposable = + void 0), + (t2.Disposable = class { + constructor() { + (this._disposables = []), (this._isDisposed = false); + } + dispose() { + this._isDisposed = true; + for (const e3 of this._disposables) e3.dispose(); + this._disposables.length = 0; + } + register(e3) { + return this._disposables.push(e3), e3; + } + unregister(e3) { + const t3 = this._disposables.indexOf(e3); + -1 !== t3 && this._disposables.splice(t3, 1); + } + }), + (t2.MutableDisposable = class { + constructor() { + this._isDisposed = false; + } + get value() { + return this._isDisposed ? void 0 : this._value; + } + set value(e3) { + this._isDisposed || + e3 === this._value || + (this._value?.dispose(), (this._value = e3)); + } + clear() { + this.value = void 0; + } + dispose() { + (this._isDisposed = true), + this._value?.dispose(), + (this._value = void 0); + } + }), + (t2.toDisposable = function (e3) { + return { dispose: e3 }; + }), + (t2.disposeArray = i2), + (t2.getDisposeArrayDisposable = function (e3) { + return { dispose: () => i2(e3) }; + }); + }, + 485: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.FourKeyMap = t2.TwoKeyMap = void 0); + class i2 { + constructor() { + this._data = {}; + } + set(e3, t3, i3) { + this._data[e3] || (this._data[e3] = {}), + (this._data[e3][t3] = i3); + } + get(e3, t3) { + return this._data[e3] ? this._data[e3][t3] : void 0; + } + clear() { + this._data = {}; + } + } + (t2.TwoKeyMap = i2), + (t2.FourKeyMap = class { + constructor() { + this._data = new i2(); + } + set(e3, t3, s2, r, o) { + this._data.get(e3, t3) || + this._data.set(e3, t3, new i2()), + this._data.get(e3, t3).set(s2, r, o); + } + get(e3, t3, i3, s2) { + return this._data.get(e3, t3)?.get(i3, s2); + } + clear() { + this._data.clear(); + } + }); + }, + 399: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.isChromeOS = + t2.isLinux = + t2.isWindows = + t2.isIphone = + t2.isIpad = + t2.isMac = + t2.getSafariVersion = + t2.isSafari = + t2.isLegacyEdge = + t2.isFirefox = + t2.isNode = + void 0), + (t2.isNode = + "undefined" != typeof process && "title" in process); + const i2 = t2.isNode ? "node" : navigator.userAgent, + s2 = t2.isNode ? "node" : navigator.platform; + (t2.isFirefox = i2.includes("Firefox")), + (t2.isLegacyEdge = i2.includes("Edge")), + (t2.isSafari = /^((?!chrome|android).)*safari/i.test(i2)), + (t2.getSafariVersion = function () { + if (!t2.isSafari) return 0; + const e3 = i2.match(/Version\/(\d+)/); + return null === e3 || e3.length < 2 ? 0 : parseInt(e3[1]); + }), + (t2.isMac = [ + "Macintosh", + "MacIntel", + "MacPPC", + "Mac68K", + ].includes(s2)), + (t2.isIpad = "iPad" === s2), + (t2.isIphone = "iPhone" === s2), + (t2.isWindows = [ + "Windows", + "Win16", + "Win32", + "WinCE", + ].includes(s2)), + (t2.isLinux = s2.indexOf("Linux") >= 0), + (t2.isChromeOS = /\bCrOS\b/.test(i2)); + }, + 385: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.DebouncedIdleTask = + t2.IdleTaskQueue = + t2.PriorityTaskQueue = + void 0); + const s2 = i2(399); + class r { + constructor() { + (this._tasks = []), (this._i = 0); + } + enqueue(e3) { + this._tasks.push(e3), this._start(); + } + flush() { + for (; this._i < this._tasks.length; ) + this._tasks[this._i]() || this._i++; + this.clear(); + } + clear() { + this._idleCallback && + (this._cancelCallback(this._idleCallback), + (this._idleCallback = void 0)), + (this._i = 0), + (this._tasks.length = 0); + } + _start() { + this._idleCallback || + (this._idleCallback = this._requestCallback( + this._process.bind(this) + )); + } + _process(e3) { + this._idleCallback = void 0; + let t3 = 0, + i3 = 0, + s3 = e3.timeRemaining(), + r2 = 0; + for (; this._i < this._tasks.length; ) { + if ( + ((t3 = Date.now()), + this._tasks[this._i]() || this._i++, + (t3 = Math.max(1, Date.now() - t3)), + (i3 = Math.max(t3, i3)), + (r2 = e3.timeRemaining()), + 1.5 * i3 > r2) + ) + return ( + s3 - t3 < -20 && + console.warn( + `task queue exceeded allotted deadline by ${Math.abs(Math.round(s3 - t3))}ms` + ), + void this._start() + ); + s3 = r2; + } + this.clear(); + } + } + class o extends r { + _requestCallback(e3) { + return setTimeout(() => e3(this._createDeadline(16))); + } + _cancelCallback(e3) { + clearTimeout(e3); + } + _createDeadline(e3) { + const t3 = Date.now() + e3; + return { + timeRemaining: () => Math.max(0, t3 - Date.now()), + }; + } + } + (t2.PriorityTaskQueue = o), + (t2.IdleTaskQueue = + !s2.isNode && "requestIdleCallback" in window + ? class extends r { + _requestCallback(e3) { + return requestIdleCallback(e3); + } + _cancelCallback(e3) { + cancelIdleCallback(e3); + } + } + : o), + (t2.DebouncedIdleTask = class { + constructor() { + this._queue = new t2.IdleTaskQueue(); + } + set(e3) { + this._queue.clear(), this._queue.enqueue(e3); + } + flush() { + this._queue.flush(); + } + }); + }, + 147: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.ExtendedAttrs = t2.AttributeData = void 0); + class i2 { + constructor() { + (this.fg = 0), (this.bg = 0), (this.extended = new s2()); + } + static toColorRGB(e3) { + return [(e3 >>> 16) & 255, (e3 >>> 8) & 255, 255 & e3]; + } + static fromColorRGB(e3) { + return ( + ((255 & e3[0]) << 16) | + ((255 & e3[1]) << 8) | + (255 & e3[2]) + ); + } + clone() { + const e3 = new i2(); + return ( + (e3.fg = this.fg), + (e3.bg = this.bg), + (e3.extended = this.extended.clone()), + e3 + ); + } + 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 == (50331648 & this.fg); + } + isBgRGB() { + return 50331648 == (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 0 == (50331648 & this.fg); + } + isBgDefault() { + return 0 == (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 == (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 + ? 0 == (50331648 & this.extended.underlineColor) + : this.isFgDefault(); + } + getUnderlineStyle() { + return 268435456 & this.fg + ? 268435456 & this.bg + ? this.extended.underlineStyle + : 1 + : 0; + } + getUnderlineVariantOffset() { + return this.extended.underlineVariantOffset; + } + } + t2.AttributeData = i2; + class s2 { + get ext() { + return this._urlId + ? (-469762049 & this._ext) | (this.underlineStyle << 26) + : this._ext; + } + set ext(e3) { + this._ext = e3; + } + get underlineStyle() { + return this._urlId ? 5 : (469762048 & this._ext) >> 26; + } + set underlineStyle(e3) { + (this._ext &= -469762049), + (this._ext |= (e3 << 26) & 469762048); + } + get underlineColor() { + return 67108863 & this._ext; + } + set underlineColor(e3) { + (this._ext &= -67108864), (this._ext |= 67108863 & e3); + } + get urlId() { + return this._urlId; + } + set urlId(e3) { + this._urlId = e3; + } + get underlineVariantOffset() { + const e3 = (3758096384 & this._ext) >> 29; + return e3 < 0 ? 4294967288 ^ e3 : e3; + } + set underlineVariantOffset(e3) { + (this._ext &= 536870911), + (this._ext |= (e3 << 29) & 3758096384); + } + constructor(e3 = 0, t3 = 0) { + (this._ext = 0), + (this._urlId = 0), + (this._ext = e3), + (this._urlId = t3); + } + clone() { + return new s2(this._ext, this._urlId); + } + isEmpty() { + return 0 === this.underlineStyle && 0 === this._urlId; + } + } + t2.ExtendedAttrs = s2; + }, + 782: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.CellData = void 0); + const s2 = i2(133), + r = i2(855), + o = i2(147); + class n extends o.AttributeData { + constructor() { + super(...arguments), + (this.content = 0), + (this.fg = 0), + (this.bg = 0), + (this.extended = new o.ExtendedAttrs()), + (this.combinedData = ""); + } + static fromCharData(e3) { + const t3 = new n(); + return t3.setFromCharData(e3), t3; + } + isCombined() { + return 2097152 & this.content; + } + getWidth() { + return this.content >> 22; + } + getChars() { + return 2097152 & this.content + ? this.combinedData + : 2097151 & this.content + ? (0, s2.stringFromCodePoint)(2097151 & this.content) + : ""; + } + getCode() { + return this.isCombined() + ? this.combinedData.charCodeAt( + this.combinedData.length - 1 + ) + : 2097151 & this.content; + } + setFromCharData(e3) { + (this.fg = e3[r.CHAR_DATA_ATTR_INDEX]), (this.bg = 0); + let t3 = false; + if (e3[r.CHAR_DATA_CHAR_INDEX].length > 2) t3 = true; + else if (2 === e3[r.CHAR_DATA_CHAR_INDEX].length) { + const i3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0); + if (55296 <= i3 && i3 <= 56319) { + const s3 = e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1); + 56320 <= s3 && s3 <= 57343 + ? (this.content = + (1024 * (i3 - 55296) + s3 - 56320 + 65536) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22)) + : (t3 = true); + } else t3 = true; + } else + this.content = + e3[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | + (e3[r.CHAR_DATA_WIDTH_INDEX] << 22); + t3 && + ((this.combinedData = e3[r.CHAR_DATA_CHAR_INDEX]), + (this.content = + 2097152 | (e3[r.CHAR_DATA_WIDTH_INDEX] << 22))); + } + getAsCharData() { + return [ + this.fg, + this.getChars(), + this.getWidth(), + this.getCode(), + ]; + } + } + t2.CellData = n; + }, + 855: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.WHITESPACE_CELL_CODE = + t2.WHITESPACE_CELL_WIDTH = + t2.WHITESPACE_CELL_CHAR = + t2.NULL_CELL_CODE = + t2.NULL_CELL_WIDTH = + t2.NULL_CELL_CHAR = + t2.CHAR_DATA_CODE_INDEX = + t2.CHAR_DATA_WIDTH_INDEX = + t2.CHAR_DATA_CHAR_INDEX = + t2.CHAR_DATA_ATTR_INDEX = + t2.DEFAULT_EXT = + t2.DEFAULT_ATTR = + t2.DEFAULT_COLOR = + void 0), + (t2.DEFAULT_COLOR = 0), + (t2.DEFAULT_ATTR = 256 | (t2.DEFAULT_COLOR << 9)), + (t2.DEFAULT_EXT = 0), + (t2.CHAR_DATA_ATTR_INDEX = 0), + (t2.CHAR_DATA_CHAR_INDEX = 1), + (t2.CHAR_DATA_WIDTH_INDEX = 2), + (t2.CHAR_DATA_CODE_INDEX = 3), + (t2.NULL_CELL_CHAR = ""), + (t2.NULL_CELL_WIDTH = 1), + (t2.NULL_CELL_CODE = 0), + (t2.WHITESPACE_CELL_CHAR = " "), + (t2.WHITESPACE_CELL_WIDTH = 1), + (t2.WHITESPACE_CELL_CODE = 32); + }, + 133: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.Utf8ToUtf32 = + t2.StringToUtf32 = + t2.utf32ToString = + t2.stringFromCodePoint = + void 0), + (t2.stringFromCodePoint = function (e3) { + return e3 > 65535 + ? ((e3 -= 65536), + String.fromCharCode(55296 + (e3 >> 10)) + + String.fromCharCode((e3 % 1024) + 56320)) + : String.fromCharCode(e3); + }), + (t2.utf32ToString = function (e3, t3 = 0, i2 = e3.length) { + let s2 = ""; + for (let r = t3; r < i2; ++r) { + let t4 = e3[r]; + t4 > 65535 + ? ((t4 -= 65536), + (s2 += + String.fromCharCode(55296 + (t4 >> 10)) + + String.fromCharCode((t4 % 1024) + 56320))) + : (s2 += String.fromCharCode(t4)); + } + return s2; + }), + (t2.StringToUtf32 = class { + constructor() { + this._interim = 0; + } + clear() { + this._interim = 0; + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2 = 0, + r = 0; + if (this._interim) { + const i3 = e3.charCodeAt(r++); + 56320 <= i3 && i3 <= 57343 + ? (t3[s2++] = + 1024 * (this._interim - 55296) + + i3 - + 56320 + + 65536) + : ((t3[s2++] = this._interim), (t3[s2++] = i3)), + (this._interim = 0); + } + for (let o = r; o < i2; ++o) { + const r2 = e3.charCodeAt(o); + if (55296 <= r2 && r2 <= 56319) { + if (++o >= i2) return (this._interim = r2), s2; + const n = e3.charCodeAt(o); + 56320 <= n && n <= 57343 + ? (t3[s2++] = + 1024 * (r2 - 55296) + n - 56320 + 65536) + : ((t3[s2++] = r2), (t3[s2++] = n)); + } else 65279 !== r2 && (t3[s2++] = r2); + } + return s2; + } + }), + (t2.Utf8ToUtf32 = class { + constructor() { + this.interim = new Uint8Array(3); + } + clear() { + this.interim.fill(0); + } + decode(e3, t3) { + const i2 = e3.length; + if (!i2) return 0; + let s2, + r, + o, + n, + a = 0, + h = 0, + l = 0; + if (this.interim[0]) { + let s3 = false, + r2 = this.interim[0]; + r2 &= + 192 == (224 & r2) ? 31 : 224 == (240 & r2) ? 15 : 7; + let o2, + n2 = 0; + for (; (o2 = 63 & this.interim[++n2]) && n2 < 4; ) + (r2 <<= 6), (r2 |= o2); + const h2 = + 192 == (224 & this.interim[0]) + ? 2 + : 224 == (240 & this.interim[0]) + ? 3 + : 4, + c2 = h2 - n2; + for (; l < c2; ) { + if (l >= i2) return 0; + if (((o2 = e3[l++]), 128 != (192 & o2))) { + l--, (s3 = true); + break; + } + (this.interim[n2++] = o2), + (r2 <<= 6), + (r2 |= 63 & o2); + } + s3 || + (2 === h2 + ? r2 < 128 + ? l-- + : (t3[a++] = r2) + : 3 === h2 + ? r2 < 2048 || + (r2 >= 55296 && r2 <= 57343) || + 65279 === r2 || + (t3[a++] = r2) + : r2 < 65536 || r2 > 1114111 || (t3[a++] = r2)), + this.interim.fill(0); + } + const c = i2 - 4; + let d = l; + for (; d < i2; ) { + for ( + ; + !( + !(d < c) || + 128 & (s2 = e3[d]) || + 128 & (r = e3[d + 1]) || + 128 & (o = e3[d + 2]) || + 128 & (n = e3[d + 3]) + ); + + ) + (t3[a++] = s2), + (t3[a++] = r), + (t3[a++] = o), + (t3[a++] = n), + (d += 4); + if (((s2 = e3[d++]), s2 < 128)) t3[a++] = s2; + else if (192 == (224 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (((h = ((31 & s2) << 6) | (63 & r)), h < 128)) { + d--; + continue; + } + t3[a++] = h; + } else if (224 == (240 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((o = e3[d++]), 128 != (192 & o))) { + d--; + continue; + } + if ( + ((h = + ((15 & s2) << 12) | ((63 & r) << 6) | (63 & o)), + h < 2048 || + (h >= 55296 && h <= 57343) || + 65279 === h) + ) + continue; + t3[a++] = h; + } else if (240 == (248 & s2)) { + if (d >= i2) return (this.interim[0] = s2), a; + if (((r = e3[d++]), 128 != (192 & r))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), (this.interim[1] = r), a + ); + if (((o = e3[d++]), 128 != (192 & o))) { + d--; + continue; + } + if (d >= i2) + return ( + (this.interim[0] = s2), + (this.interim[1] = r), + (this.interim[2] = o), + a + ); + if (((n = e3[d++]), 128 != (192 & n))) { + d--; + continue; + } + if ( + ((h = + ((7 & s2) << 18) | + ((63 & r) << 12) | + ((63 & o) << 6) | + (63 & n)), + h < 65536 || h > 1114111) + ) + continue; + t3[a++] = h; + } + } + return a; + } + }); + }, + 776: function (e2, t2, i2) { + var s2 = + (this && this.__decorate) || + function (e3, t3, i3, s3) { + var r2, + o2 = arguments.length, + n2 = + o2 < 3 + ? t3 + : null === s3 + ? (s3 = Object.getOwnPropertyDescriptor(t3, i3)) + : s3; + if ( + "object" == typeof Reflect && + "function" == typeof Reflect.decorate + ) + n2 = Reflect.decorate(e3, t3, i3, s3); + else + for (var a2 = e3.length - 1; a2 >= 0; a2--) + (r2 = e3[a2]) && + (n2 = + (o2 < 3 + ? r2(n2) + : o2 > 3 + ? r2(t3, i3, n2) + : r2(t3, i3)) || n2); + return ( + o2 > 3 && n2 && Object.defineProperty(t3, i3, n2), n2 + ); + }, + r = + (this && this.__param) || + function (e3, t3) { + return function (i3, s3) { + t3(i3, s3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.traceCall = t2.setTraceLogger = t2.LogService = void 0); + const o = i2(859), + n = i2(97), + a = { + trace: n.LogLevelEnum.TRACE, + debug: n.LogLevelEnum.DEBUG, + info: n.LogLevelEnum.INFO, + warn: n.LogLevelEnum.WARN, + error: n.LogLevelEnum.ERROR, + off: n.LogLevelEnum.OFF, + }; + let h, + l = (t2.LogService = class extends o.Disposable { + get logLevel() { + return this._logLevel; + } + constructor(e3) { + super(), + (this._optionsService = e3), + (this._logLevel = n.LogLevelEnum.OFF), + this._updateLogLevel(), + this.register( + this._optionsService.onSpecificOptionChange( + "logLevel", + () => this._updateLogLevel() + ) + ), + (h = this); + } + _updateLogLevel() { + this._logLevel = + a[this._optionsService.rawOptions.logLevel]; + } + _evalLazyOptionalParams(e3) { + for (let t3 = 0; t3 < e3.length; t3++) + "function" == typeof e3[t3] && (e3[t3] = e3[t3]()); + } + _log(e3, t3, i3) { + this._evalLazyOptionalParams(i3), + e3.call( + console, + (this._optionsService.options.logger + ? "" + : "xterm.js: ") + t3, + ...i3 + ); + } + trace(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.TRACE && + this._log( + this._optionsService.options.logger?.trace.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + debug(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.DEBUG && + this._log( + this._optionsService.options.logger?.debug.bind( + this._optionsService.options.logger + ) ?? console.log, + e3, + t3 + ); + } + info(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.INFO && + this._log( + this._optionsService.options.logger?.info.bind( + this._optionsService.options.logger + ) ?? console.info, + e3, + t3 + ); + } + warn(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.WARN && + this._log( + this._optionsService.options.logger?.warn.bind( + this._optionsService.options.logger + ) ?? console.warn, + e3, + t3 + ); + } + error(e3, ...t3) { + this._logLevel <= n.LogLevelEnum.ERROR && + this._log( + this._optionsService.options.logger?.error.bind( + this._optionsService.options.logger + ) ?? console.error, + e3, + t3 + ); + } + }); + (t2.LogService = l = s2([r(0, n.IOptionsService)], l)), + (t2.setTraceLogger = function (e3) { + h = e3; + }), + (t2.traceCall = function (e3, t3, i3) { + if ("function" != typeof i3.value) + throw new Error("not supported"); + const s3 = i3.value; + i3.value = function (...e4) { + if (h.logLevel !== n.LogLevelEnum.TRACE) + return s3.apply(this, e4); + h.trace( + `GlyphRenderer#${s3.name}(${e4.map((e5) => JSON.stringify(e5)).join(", ")})` + ); + const t4 = s3.apply(this, e4); + return ( + h.trace(`GlyphRenderer#${s3.name} return`, t4), t4 + ); + }; + }); + }, + 726: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.createDecorator = + t2.getServiceDependencies = + t2.serviceRegistry = + void 0); + const i2 = "di$target", + s2 = "di$dependencies"; + (t2.serviceRegistry = /* @__PURE__ */ new Map()), + (t2.getServiceDependencies = function (e3) { + return e3[s2] || []; + }), + (t2.createDecorator = function (e3) { + if (t2.serviceRegistry.has(e3)) + return t2.serviceRegistry.get(e3); + const r = function (e4, t3, o) { + if (3 !== arguments.length) + throw new Error( + "@IServiceName-decorator can only be used to decorate a parameter" + ); + !(function (e5, t4, r2) { + t4[i2] === t4 + ? t4[s2].push({ id: e5, index: r2 }) + : ((t4[s2] = [{ id: e5, index: r2 }]), + (t4[i2] = t4)); + })(r, e4, o); + }; + return ( + (r.toString = () => e3), + t2.serviceRegistry.set(e3, r), + r + ); + }); + }, + 97: (e2, t2, i2) => { + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.IDecorationService = + t2.IUnicodeService = + t2.IOscLinkService = + t2.IOptionsService = + t2.ILogService = + t2.LogLevelEnum = + t2.IInstantiationService = + t2.ICharsetService = + t2.ICoreService = + t2.ICoreMouseService = + t2.IBufferService = + void 0); + const s2 = i2(726); + var r; + (t2.IBufferService = (0, s2.createDecorator)( + "BufferService" + )), + (t2.ICoreMouseService = (0, s2.createDecorator)( + "CoreMouseService" + )), + (t2.ICoreService = (0, s2.createDecorator)("CoreService")), + (t2.ICharsetService = (0, s2.createDecorator)( + "CharsetService" + )), + (t2.IInstantiationService = (0, s2.createDecorator)( + "InstantiationService" + )), + (function (e3) { + (e3[(e3.TRACE = 0)] = "TRACE"), + (e3[(e3.DEBUG = 1)] = "DEBUG"), + (e3[(e3.INFO = 2)] = "INFO"), + (e3[(e3.WARN = 3)] = "WARN"), + (e3[(e3.ERROR = 4)] = "ERROR"), + (e3[(e3.OFF = 5)] = "OFF"); + })(r || (t2.LogLevelEnum = r = {})), + (t2.ILogService = (0, s2.createDecorator)("LogService")), + (t2.IOptionsService = (0, s2.createDecorator)( + "OptionsService" + )), + (t2.IOscLinkService = (0, s2.createDecorator)( + "OscLinkService" + )), + (t2.IUnicodeService = (0, s2.createDecorator)( + "UnicodeService" + )), + (t2.IDecorationService = (0, s2.createDecorator)( + "DecorationService" + )); + }, + }, + t = {}; + function i(s2) { + var r = t[s2]; + if (void 0 !== r) return r.exports; + var o = (t[s2] = { exports: {} }); + return e[s2].call(o.exports, o, o.exports, i), o.exports; + } + var s = {}; + return ( + (() => { + var e2 = s; + Object.defineProperty(e2, "__esModule", { value: true }), + (e2.CanvasAddon = void 0); + const t2 = i(345), + r = i(859), + o = i(776), + n = i(949); + class a extends r.Disposable { + constructor() { + super(...arguments), + (this._onChangeTextureAtlas = this.register( + new t2.EventEmitter() + )), + (this.onChangeTextureAtlas = + this._onChangeTextureAtlas.event), + (this._onAddTextureAtlasCanvas = this.register( + new t2.EventEmitter() + )), + (this.onAddTextureAtlasCanvas = + this._onAddTextureAtlasCanvas.event); + } + get textureAtlas() { + return this._renderer?.textureAtlas; + } + activate(e3) { + const i2 = e3._core; + if (!e3.element) + return void this.register( + i2.onWillOpen(() => this.activate(e3)) + ); + this._terminal = e3; + const s2 = i2.coreService, + a2 = i2.optionsService, + h = i2.screenElement, + l = i2.linkifier, + c = i2, + d = c._bufferService, + _ = c._renderService, + u = c._characterJoinerService, + g = c._charSizeService, + f = c._coreBrowserService, + v = c._decorationService, + C = c._logService, + p = c._themeService; + (0, o.setTraceLogger)(C), + (this._renderer = new n.CanvasRenderer( + e3, + h, + l, + d, + g, + a2, + u, + s2, + f, + v, + p + )), + this.register( + (0, t2.forwardEvent)( + this._renderer.onChangeTextureAtlas, + this._onChangeTextureAtlas + ) + ), + this.register( + (0, t2.forwardEvent)( + this._renderer.onAddTextureAtlasCanvas, + this._onAddTextureAtlasCanvas + ) + ), + _.setRenderer(this._renderer), + _.handleResize(d.cols, d.rows), + this.register( + (0, r.toDisposable)(() => { + _.setRenderer(this._terminal._core._createRenderer()), + _.handleResize(e3.cols, e3.rows), + this._renderer?.dispose(), + (this._renderer = void 0); + }) + ); + } + clearTextureAtlas() { + this._renderer?.clearTextureAtlas(); + } + } + e2.CanvasAddon = a; + })(), + s + ); + })() + ); + }, + }); + + // node_modules/@xterm/addon-web-links/lib/addon-web-links.js + var require_addon_web_links = __commonJS({ + "node_modules/@xterm/addon-web-links/lib/addon-web-links.js"( + exports, + module + ) { + !(function (e, t) { + "object" == typeof exports && "object" == typeof module + ? (module.exports = t()) + : "function" == typeof define && define.amd + ? define([], t) + : "object" == typeof exports + ? (exports.WebLinksAddon = t()) + : (e.WebLinksAddon = t()); + })(self, () => + (() => { + "use strict"; + var e = { + 6: (e2, t2) => { + function n2(e3) { + try { + const t3 = new URL(e3), + n3 = + t3.password && t3.username + ? `${t3.protocol}//${t3.username}:${t3.password}@${t3.host}` + : t3.username + ? `${t3.protocol}//${t3.username}@${t3.host}` + : `${t3.protocol}//${t3.host}`; + return e3 + .toLocaleLowerCase() + .startsWith(n3.toLocaleLowerCase()); + } catch (e4) { + return false; + } + } + Object.defineProperty(t2, "__esModule", { value: true }), + (t2.LinkComputer = t2.WebLinkProvider = void 0), + (t2.WebLinkProvider = class { + constructor(e3, t3, n3, o3 = {}) { + (this._terminal = e3), + (this._regex = t3), + (this._handler = n3), + (this._options = o3); + } + provideLinks(e3, t3) { + const n3 = o2.computeLink( + e3, + this._regex, + this._terminal, + this._handler + ); + t3(this._addCallbacks(n3)); + } + _addCallbacks(e3) { + return e3.map( + (e4) => ( + (e4.leave = this._options.leave), + (e4.hover = (t3, n3) => { + if (this._options.hover) { + const { range: o3 } = e4; + this._options.hover(t3, n3, o3); + } + }), + e4 + ) + ); + } + }); + class o2 { + static computeLink(e3, t3, r, i) { + const s = new RegExp(t3.source, (t3.flags || "") + "g"), + [a, c] = o2._getWindowedLineStrings(e3 - 1, r), + l = a.join(""); + let d; + const p = []; + for (; (d = s.exec(l)); ) { + const e4 = d[0]; + if (!n2(e4)) continue; + const [t4, s2] = o2._mapStrIdx(r, c, 0, d.index), + [a2, l2] = o2._mapStrIdx(r, t4, s2, e4.length); + if (-1 === t4 || -1 === s2 || -1 === a2 || -1 === l2) + continue; + const h = { + start: { x: s2 + 1, y: t4 + 1 }, + end: { x: l2, y: a2 + 1 }, + }; + p.push({ range: h, text: e4, activate: i }); + } + return p; + } + static _getWindowedLineStrings(e3, t3) { + let n3, + o3 = e3, + r = e3, + i = 0, + s = ""; + const a = []; + if ((n3 = t3.buffer.active.getLine(e3))) { + const e4 = n3.translateToString(true); + if (n3.isWrapped && " " !== e4[0]) { + for ( + i = 0; + (n3 = t3.buffer.active.getLine(--o3)) && + i < 2048 && + ((s = n3.translateToString(true)), + (i += s.length), + a.push(s), + n3.isWrapped && -1 === s.indexOf(" ")); + + ); + a.reverse(); + } + for ( + a.push(e4), i = 0; + (n3 = t3.buffer.active.getLine(++r)) && + n3.isWrapped && + i < 2048 && + ((s = n3.translateToString(true)), + (i += s.length), + a.push(s), + -1 === s.indexOf(" ")); + + ); + } + return [a, o3]; + } + static _mapStrIdx(e3, t3, n3, o3) { + const r = e3.buffer.active, + i = r.getNullCell(); + let s = n3; + for (; o3; ) { + const e4 = r.getLine(t3); + if (!e4) return [-1, -1]; + for (let n4 = s; n4 < e4.length; ++n4) { + e4.getCell(n4, i); + const s2 = i.getChars(); + if ( + i.getWidth() && + ((o3 -= s2.length || 1), + n4 === e4.length - 1 && "" === s2) + ) { + const e5 = r.getLine(t3 + 1); + e5 && + e5.isWrapped && + (e5.getCell(0, i), + 2 === i.getWidth() && (o3 += 1)); + } + if (o3 < 0) return [t3, n4]; + } + t3++, (s = 0); + } + return [t3, s]; + } + } + t2.LinkComputer = o2; + }, + }, + t = {}; + function n(o2) { + var r = t[o2]; + if (void 0 !== r) return r.exports; + var i = (t[o2] = { exports: {} }); + return e[o2](i, i.exports, n), i.exports; + } + var o = {}; + return ( + (() => { + var e2 = o; + Object.defineProperty(e2, "__esModule", { value: true }), + (e2.WebLinksAddon = void 0); + const t2 = n(6), + r = + /(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/; + function i(e3, t3) { + const n2 = window.open(); + if (n2) { + try { + n2.opener = null; + } catch {} + n2.location.href = t3; + } else + console.warn( + "Opening link blocked as opener could not be cleared" + ); + } + e2.WebLinksAddon = class { + constructor(e3 = i, t3 = {}) { + (this._handler = e3), (this._options = t3); + } + activate(e3) { + this._terminal = e3; + const n2 = this._options, + o2 = n2.urlRegex || r; + this._linkProvider = this._terminal.registerLinkProvider( + new t2.WebLinkProvider( + this._terminal, + o2, + this._handler, + n2 + ) + ); + } + dispose() { + this._linkProvider?.dispose(); + } + }; + })(), + o + ); + })() + ); + }, + }); + + // src/index.js + var import_xterm = __toESM(require_xterm()); + + // node_modules/@xterm/xterm/css/xterm.css + var xterm_default = `/** + * Copyright (c) 2014 The xterm.js authors. All rights reserved. + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * https://github.com/chjj/term.js + * @license MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + * The original design remains. The terminal itself + * has been extended to include xterm CSI codes, among + * other features. + */ + +/** + * Default styles for xterm.js + */ + +.xterm { + cursor: text; + position: relative; + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; +} + +.xterm.focus, +.xterm:focus { + outline: none; +} + +.xterm .xterm-helpers { + position: absolute; + top: 0; + /** + * The z-index of the helpers must be higher than the canvases in order for + * IMEs to appear on top. + */ + z-index: 5; +} + +.xterm .xterm-helper-textarea { + padding: 0; + border: 0; + margin: 0; + /* Move textarea out of the screen to the far left, so that the cursor is not visible */ + position: absolute; + opacity: 0; + left: -9999em; + top: 0; + width: 0; + height: 0; + z-index: -5; + /** Prevent wrapping so the IME appears against the textarea at the correct position */ + white-space: nowrap; + overflow: hidden; + resize: none; +} + +.xterm .composition-view { + /* TODO: Composition position got messed up somewhere */ + background: #000; + color: #FFF; + display: none; + position: absolute; + white-space: nowrap; + z-index: 1; +} + +.xterm .composition-view.active { + display: block; +} + +.xterm .xterm-viewport { + /* On OS X this is required in order for the scroll bar to appear fully opaque */ + background-color: #000; + overflow-y: scroll; + cursor: default; + position: absolute; + right: 0; + left: 0; + top: 0; + bottom: 0; +} + +.xterm .xterm-screen { + position: relative; +} + +.xterm .xterm-screen canvas { + position: absolute; + left: 0; + top: 0; +} + +.xterm .xterm-scroll-area { + visibility: hidden; +} + +.xterm-char-measure-element { + display: inline-block; + visibility: hidden; + position: absolute; + top: 0; + left: -9999em; + line-height: normal; +} + +.xterm.enable-mouse-events { + /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */ + cursor: default; +} + +.xterm.xterm-cursor-pointer, +.xterm .xterm-cursor-pointer { + cursor: pointer; +} + +.xterm.column-select.focus { + /* Column selection mode */ + cursor: crosshair; +} + +.xterm .xterm-accessibility:not(.debug), +.xterm .xterm-message { + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + z-index: 10; + color: transparent; + pointer-events: none; +} + +.xterm .xterm-accessibility-tree:not(.debug) *::selection { + color: transparent; +} + +.xterm .xterm-accessibility-tree { + user-select: text; + white-space: pre; +} + +.xterm .live-region { + position: absolute; + left: -9999px; + width: 1px; + height: 1px; + overflow: hidden; +} + +.xterm-dim { + /* Dim should not apply to background, so the opacity of the foreground color is applied + * explicitly in the generated class and reset to 1 here */ + opacity: 1 !important; +} + +.xterm-underline-1 { text-decoration: underline; } +.xterm-underline-2 { text-decoration: double underline; } +.xterm-underline-3 { text-decoration: wavy underline; } +.xterm-underline-4 { text-decoration: dotted underline; } +.xterm-underline-5 { text-decoration: dashed underline; } + +.xterm-overline { + text-decoration: overline; +} + +.xterm-overline.xterm-underline-1 { text-decoration: overline underline; } +.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; } +.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; } +.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; } +.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; } + +.xterm-strikethrough { + text-decoration: line-through; +} + +.xterm-screen .xterm-decoration-container .xterm-decoration { + z-index: 6; + position: absolute; +} + +.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { + z-index: 7; +} + +.xterm-decoration-overview-ruler { + z-index: 8; + position: absolute; + top: 0; + right: 0; + pointer-events: none; +} + +.xterm-decoration-top { + z-index: 2; + position: relative; +} +`; + + // src/index.js + var import_addon_webgl = __toESM(require_addon_webgl()); + var import_addon_fit = __toESM(require_addon_fit()); + var import_addon_unicode11 = __toESM(require_addon_unicode11()); + var import_addon_canvas = __toESM(require_addon_canvas()); + var import_addon_web_links = __toESM(require_addon_web_links()); + var styleElem = document.createElement("style"); + styleElem.textContent = xterm_default; + document.head.appendChild(styleElem); + var { LigaturesAddon } = globalThis.LigaturesAddon; + delete globalThis.LigaturesAddon; + var runtime = Scratch.vm.runtime; + var themeColor = [ + "foreground", + "background", + "selection", + "black", + "brightBlack", + "red", + "brightRed", + "green", + "brightGreen", + "yellow", + "brightYellow", + "blue", + "brightBlue", + "magenta", + "brightMagenta", + "cyan", + "brightCyan", + "white", + "brightWhite", + "cursor", + "cursorAccent", + "selectionBackground", + "selectionForeground", + "selectionInactiveBackground", + ]; + var ScratchXTerm = class { + /** @type {HTMLDivElement?} */ + element; + /** @type {Terminal} */ + terminal; + /** @type {FitAddon} */ + fitAddon; + /** @type {LigaturesAddon?} */ + ligaturesAddon; + /** @type {WebLinksAddon?} */ + webLinksAddon; + /** @type {((data: string) => void)[]} */ + dataCallbacks = []; + /** @type {string} */ + buffer; + /** @type {boolean} */ + bufferEnabled; + /** @type {object} */ + eventData; + constructor() { + this.terminal = new import_xterm.Terminal({ + allowTransparency: true, + fontFamily: + '"Jetbrains Mono", "Fira Code", "Cascadia Code", "Noto Emoji", "Segoe UI Emoji", "Lucida Console", Menlo, courier-new, courier, monospace', + cursorBlink: true, + theme: { + foreground: "#F8F8F8", + background: "rgba(45,46,44,0.8)", + selection: "#5DA5D533", + black: "#1E1E1D", + brightBlack: "#262625", + red: "#CE5C5C", + brightRed: "#FF7272", + green: "#5BCC5B", + brightGreen: "#72FF72", + yellow: "#CCCC5B", + brightYellow: "#FFFF72", + blue: "#5D5DD3", + brightBlue: "#7279FF", + magenta: "#BC5ED1", + brightMagenta: "#E572FF", + cyan: "#5DA5D5", + brightCyan: "#72F0FF", + white: "#F8F8F8", + brightWhite: "#FFFFFF", + }, + allowProposedApi: true, + }); + this.terminal.onData((e) => { + if (this.dataCallbacks.length > 0) { + for (const callback of this.dataCallbacks) { + callback(this.buffer + e); + } + this.buffer = ""; + this.dataCallbacks = []; + } else if (this.bufferEnabled) { + this.buffer += e; + } + }); + this.terminal.onResize(() => { + if (this.justInitialized) this.justInitialized = false; + else runtime.startHats("xterm_whenTerminalResized"); + }); + this.terminal._core.coreMouseService.addEncoding( + "cursorReport", + (e) => { + const actionMap = { + 1: "down", + 0: "up", + 32: "drag", + }; + if (e.button >= 0 && e.button <= 2) { + const buttonMap = { + 0: "left", + 1: "middle", + 2: "right", + }; + if ( + runtime.startHats("xterm_whenMouseClicked", { + BUTTON: buttonMap[e.button], + }).length > 0 + ) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + type: actionMap[e.action], + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else if (e.button === 3) { + if (runtime.startHats("xterm_whenMouseOver").length > 0) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else if (e.button === 4) { + if (runtime.startHats("xterm_whenScrolled").length > 0) { + this.eventData = { + x: e.col - 1, + y: e.row - 1, + type: actionMap[e.action], + ctrl: e.ctrl, + alt: e.alt, + shift: e.shift, + }; + } + } else { + console.log(e); + } } - break; + ); + const style = document.createElement("style"); + style.textContent = ` +.xterm-viewport.xterm-viewport { + scrollbar-width: none; +} +.xterm-viewport::-webkit-scrollbar { + width: 0; +} +`; + document.head.appendChild(style); + this.fitAddon = new import_addon_fit.FitAddon(); + try { + this.terminal.loadAddon(new import_addon_webgl.WebglAddon()); + } catch { + this.terminal.loadAddon(new import_addon_canvas.CanvasAddon()); } + this.terminal.loadAddon(new import_addon_unicode11.Unicode11Addon()); + this.terminal.unicode.activeVersion = "11"; + this.terminal.loadAddon(this.fitAddon); + this.element = null; + this.buffer = ""; + this.bufferEnabled = false; + this.ligaturesAddon = null; + this.webLinksAddon = null; + this.justInitialized = false; + this.eventData = {}; } - } - changeTheme({ THEME, COLOR }) { - THEME = Scratch.Cast.toString(THEME); - if (!themeColor.includes(THEME)) return; - this.terminal.options.theme = Object.assign( - {}, - this.terminal.options.theme, - { [THEME]: Scratch.Cast.toString(COLOR) } - ); - } - changeOption({ OPTION, VALUE }) { - OPTION = Scratch.Cast.toString(OPTION).toLowerCase(); - switch (OPTION) { - case "fontsize": { - VALUE = Scratch.Cast.toNumber(VALUE); - if (isFinite(VALUE) && Math.floor(VALUE) === VALUE && VALUE > 0) { - this.terminal.options.fontSize = VALUE; - this.fitAddon.fit(); + getInfo() { + return { + id: "xterm", + name: "xterm", + color1: "#1c1628", + blocks: [ + { + blockType: Scratch.BlockType.LABEL, + text: "\u{1F3A8} " + Scratch.translate("Appearance"), + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeVisibility", + text: Scratch.translate("[STATUS] terminal"), + arguments: { + STATUS: { + type: Scratch.ArgumentType.STRING, + menu: "VISIBILITY", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeTheme", + text: Scratch.translate("set [THEME] color to [COLOR]"), + arguments: { + THEME: { + type: Scratch.ArgumentType.STRING, + menu: "THEME", + }, + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#5DA5D5", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "changeOption", + text: Scratch.translate("set [OPTION] to [VALUE]"), + arguments: { + OPTION: { + type: Scratch.ArgumentType.STRING, + menu: "OPTION", + }, + VALUE: { + type: Scratch.ArgumentType.STRING, + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "adjustFeature", + text: Scratch.translate("[STATUS] [FEATURE]"), + arguments: { + STATUS: { + type: Scratch.ArgumentType.STRING, + menu: "STATUS", + }, + FEATURE: { + type: Scratch.ArgumentType.STRING, + menu: "FEATURE", + }, + }, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "\u{1F3AE} " + Scratch.translate("Input"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "get", + text: Scratch.translate("received character"), + }, + { + blockType: Scratch.BlockType.LABEL, + text: "\u{1F4C4} " + Scratch.translate("Output"), + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "print", + text: Scratch.translate("print [INFO] with [NEWLINE]"), + arguments: { + INFO: { + type: Scratch.ArgumentType.STRING, + defaultValue: "Hello World", + }, + NEWLINE: { + type: Scratch.ArgumentType.STRING, + menu: "NEWLINE", + }, + }, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "\u{1F5A5}\uFE0F " + Scratch.translate("Cursor & Screen"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "screenOptions", + text: Scratch.translate("query [SCREENOPTION]"), + arguments: { + SCREENOPTION: { + type: Scratch.ArgumentType.STRING, + menu: "SCREENOPTION", + }, + }, + disableMonitor: true, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "moveCursorTo", + text: Scratch.translate("move cursor to x:[X]y:[Y]"), + arguments: { + X: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0, + }, + Y: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0, + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "moveCursor", + text: Scratch.translate( + "move cursor [N] character(s) [DIRECTION]" + ), + arguments: { + N: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 1, + }, + DIRECTION: { + type: Scratch.ArgumentType.STRING, + menu: "DIRECTION", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "clear", + text: Scratch.translate("clear [CLEARTYPE]"), + arguments: { + CLEARTYPE: { + type: Scratch.ArgumentType.STRING, + menu: "CLEARTYPE", + }, + }, + }, + { + blockType: Scratch.BlockType.COMMAND, + opcode: "reset", + text: Scratch.translate("reset screen"), + }, + { + blockType: Scratch.BlockType.CONDITIONAL, + opcode: "saveCursor", + text: Scratch.translate("cursor wrapper"), + branchCount: 1, + }, + { + blockType: Scratch.BlockType.LABEL, + text: "\u2757 " + Scratch.translate("Events"), + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenTerminalResized", + text: Scratch.translate("when terminal resized"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenMouseClicked", + text: Scratch.translate("when mouse [BUTTON] clicked"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + arguments: { + BUTTON: { + type: Scratch.ArgumentType.STRING, + menu: "BUTTON", + }, + }, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenMouseOver", + text: Scratch.translate("when mouse over terminal"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.HAT, + opcode: "whenScrolled", + text: Scratch.translate("when mouse scrolled"), + shouldRestartExistingThreads: false, + isEdgeActivated: false, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "getEventData", + text: Scratch.translate("mouse event data"), + }, + { + blockType: Scratch.BlockType.LABEL, + text: "\u{1F6E0}\uFE0F " + Scratch.translate("Utilities"), + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "coloredText", + text: Scratch.translate("[TEXT] in [COLOR] [TYPE]"), + arguments: { + TEXT: { + type: Scratch.ArgumentType.STRING, + defaultValue: "Hello World", + }, + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#FFFFFF", + }, + TYPE: { + type: Scratch.ArgumentType.STRING, + menu: "COLORTYPE", + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "withOpacity", + text: Scratch.translate("[COLOR] with opacity [OPACITY]"), + arguments: { + COLOR: { + type: Scratch.ArgumentType.COLOR, + defaultValue: "#808080", + }, + OPACITY: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 0.5, + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "toCodePoint", + text: Scratch.translate("the code point of [CHAR]"), + arguments: { + CHAR: { + type: Scratch.ArgumentType.STRING, + defaultValue: "a", + }, + }, + }, + { + blockType: Scratch.BlockType.REPORTER, + opcode: "fromCodePoint", + text: Scratch.translate("the character of code point [CODE]"), + arguments: { + CODE: { + type: Scratch.ArgumentType.NUMBER, + defaultValue: 32, + }, + }, + }, + ], + menus: { + VISIBILITY: { + items: [ + { + text: Scratch.translate("show"), + value: "show", + }, + { + text: Scratch.translate("hide"), + value: "hide", + }, + ], + }, + THEME: { + items: [ + { + text: Scratch.translate("foreground"), + value: "foreground", + }, + { + text: Scratch.translate("background"), + value: "background", + }, + { + text: Scratch.translate("selection"), + value: "selection", + }, + { + text: Scratch.translate("black"), + value: "black", + }, + { + text: Scratch.translate("bright black"), + value: "brightBlack", + }, + { + text: Scratch.translate("red"), + value: "red", + }, + { + text: Scratch.translate("bright red"), + value: "brightRed", + }, + { + text: Scratch.translate("green"), + value: "green", + }, + { + text: Scratch.translate("bright green"), + value: "brightGreen", + }, + { + text: Scratch.translate("yellow"), + value: "yellow", + }, + { + text: Scratch.translate("bright yellow"), + value: "brightYellow", + }, + { + text: Scratch.translate("blue"), + value: "blue", + }, + { + text: Scratch.translate("bright blue"), + value: "brightBlue", + }, + { + text: Scratch.translate("magenta"), + value: "magenta", + }, + { + text: Scratch.translate("bright magenta"), + value: "brightMagenta", + }, + { + text: Scratch.translate("cyan"), + value: "cyan", + }, + { + text: Scratch.translate("bright cyan"), + value: "brightCyan", + }, + { + text: Scratch.translate("white"), + value: "white", + }, + { + text: Scratch.translate("bright white"), + value: "brightWhite", + }, + { + text: Scratch.translate("cursor"), + value: "cursor", + }, + { + text: Scratch.translate("accent cursor"), + value: "cursorAccent", + }, + { + text: Scratch.translate("selection background"), + value: "selectionBackground", + }, + { + text: Scratch.translate("selection foreground"), + value: "selectionForeground", + }, + { + text: Scratch.translate("selection background when inactive"), + value: "selectionInactiveBackground", + }, + ], + }, + OPTION: { + items: [ + { + text: Scratch.translate("font size"), + value: "fontsize", + }, + { + text: Scratch.translate("line height"), + value: "lineheight", + }, + { + text: Scratch.translate("font family"), + value: "fontfamily", + }, + { + text: Scratch.translate("scrollback size"), + value: "scrollback", + }, + ], + }, + COLORTYPE: { + items: [ + { + text: Scratch.translate("background"), + value: "background", + }, + { + text: Scratch.translate("foreground"), + value: "foreground", + }, + ], + }, + STATUS: { + items: [ + { + text: Scratch.translate("enable"), + value: "enable", + }, + { + text: Scratch.translate("disable"), + value: "disable", + }, + ], + }, + FEATURE: { + items: [ + { + text: Scratch.translate("cursor blinking"), + value: "cursorblink", + }, + { + text: Scratch.translate("ligatures"), + value: "ligatures", + }, + { + text: Scratch.translate("web link"), + value: "link", + }, + { + text: Scratch.translate( + "mouse event report (disables selection)" + ), + value: "mouse", + }, + { + text: Scratch.translate("input buffer"), + value: "buffer", + }, + ], + }, + DIRECTION: { + items: [ + { + text: Scratch.translate("up"), + value: "up", + }, + { + text: Scratch.translate("down"), + value: "down", + }, + { + text: Scratch.translate("left"), + value: "left", + }, + { + text: Scratch.translate("right"), + value: "right", + }, + ], + }, + BUTTON: { + items: [ + { + text: Scratch.translate("left"), + value: "left", + }, + { + text: Scratch.translate("middle"), + value: "middle", + }, + { + text: Scratch.translate("right"), + value: "right", + }, + ], + }, + CLEARTYPE: { + items: [ + { + text: Scratch.translate("entire screen"), + value: "screen", + }, + { + text: Scratch.translate("characters after cursor"), + value: "after", + }, + { + text: Scratch.translate("characters before cursor"), + value: "before", + }, + { + text: Scratch.translate("scrollback"), + value: "scrollback", + }, + ], + }, + SCREENOPTION: { + items: [ + { + text: Scratch.translate("terminal size"), + value: "size", + }, + { + text: Scratch.translate("cursor position"), + value: "cursor", + }, + ], + }, + NEWLINE: { + items: [ + { + text: Scratch.translate("newline"), + value: "newline", + }, + { + text: Scratch.translate("no newline"), + value: "none", + }, + ], + }, + }, + }; + } + _initalizeXterm() { + const parentElement = runtime.renderer.canvas.parentElement; + runtime.renderer.canvas.style.position = "relative"; + this.element = document.createElement("div"); + this.element.style.position = "absolute"; + this.element.style.top = "0"; + this.element.style.left = "0"; + this.element.style.width = "100%"; + this.element.style.height = "100%"; + this.element.style.margin = "0"; + this.element.style.display = "grid"; + const _resize = runtime.renderer.resize; + runtime.renderer.resize = (width, height) => { + _resize.call(runtime.renderer, width, height); + this.fitAddon.fit(); + }; + parentElement.appendChild(this.element); + this.terminal.open(this.element); + this.justInitialized = true; + this.terminal._core.viewport.scrollBarWidth = 0; + this.fitAddon.fit(); + } + changeVisibility({ STATUS }) { + STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); + switch (STATUS) { + case "show": { + if (this.element) { + this.element.style.display = "grid"; + } else { + this._initalizeXterm(); + } + break; } - break; - } - case "lineheight": { - VALUE = Scratch.Cast.toNumber(VALUE); - if (isFinite(VALUE) && VALUE > 1) { - this.terminal.options.lineHeight = VALUE; - this.fitAddon.fit(); + case "hide": { + if (this.element) { + this.element.style.display = "none"; + } + break; } - break; - } - case "fontfamily": { - this.terminal.options.fontFamily = Scratch.Cast.toString(VALUE); - break; } - case "scrollback": - { + } + changeTheme({ THEME, COLOR }) { + THEME = Scratch.Cast.toString(THEME); + if (!themeColor.includes(THEME)) return; + this.terminal.options.theme = Object.assign( + {}, + this.terminal.options.theme, + { [THEME]: Scratch.Cast.toString(COLOR) } + ); + } + changeOption({ OPTION, VALUE }) { + OPTION = Scratch.Cast.toString(OPTION).toLowerCase(); + switch (OPTION) { + case "fontsize": { VALUE = Scratch.Cast.toNumber(VALUE); if (isFinite(VALUE) && Math.floor(VALUE) === VALUE && VALUE > 0) { - this.terminal.options.scrollback = VALUE; + this.terminal.options.fontSize = VALUE; this.fitAddon.fit(); } + break; } - break; - } - } - adjustFeature({ STATUS, FEATURE }) { - FEATURE = Scratch.Cast.toString(FEATURE).toLowerCase(); - STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); - switch (FEATURE) { - case "cursorblink": { - this.terminal.options.cursorBlink = STATUS === "enable"; - break; - } - case "ligatures": { - if (STATUS === "enable") { - if (this.ligaturesAddon) break; - this.ligaturesAddon = new LigaturesAddon(); - this.terminal.loadAddon(this.ligaturesAddon); - } else { - if (!this.ligaturesAddon) break; - this.ligaturesAddon.dispose(); - this.ligaturesAddon = null; + case "lineheight": { + VALUE = Scratch.Cast.toNumber(VALUE); + if (isFinite(VALUE) && VALUE > 1) { + this.terminal.options.lineHeight = VALUE; + this.fitAddon.fit(); + } + break; } - break; - } - case "mouse": { - if (STATUS === "enable") { - this.terminal._core.coreMouseService.activeEncoding = - "cursorReport"; - this.terminal._core.coreMouseService.activeProtocol = "ANY"; - } else { - this.terminal._core.coreMouseService.activeEncoding = "DEFAULT"; - this.terminal._core.coreMouseService.activeProtocol = "NONE"; + case "fontfamily": { + this.terminal.options.fontFamily = Scratch.Cast.toString(VALUE); + break; } - break; + case "scrollback": + { + VALUE = Scratch.Cast.toNumber(VALUE); + if (isFinite(VALUE) && Math.floor(VALUE) === VALUE && VALUE > 0) { + this.terminal.options.scrollback = VALUE; + this.fitAddon.fit(); + } + } + break; } - case "link": { - if (STATUS === "enable") { - if (this.webLinksAddon) break; - this.webLinksAddon = new WebLinksAddon(); - this.terminal.loadAddon(this.webLinksAddon); - } else { - if (!this.webLinksAddon) break; - this.webLinksAddon.dispose(); - this.webLinksAddon = null; + } + adjustFeature({ STATUS, FEATURE }) { + FEATURE = Scratch.Cast.toString(FEATURE).toLowerCase(); + STATUS = Scratch.Cast.toString(STATUS).toLowerCase(); + switch (FEATURE) { + case "cursorblink": { + this.terminal.options.cursorBlink = STATUS === "enable"; + break; } - break; - } - case "buffer": { - if (STATUS === "enable") { - this.bufferEnabled = true; - } else { - this.bufferEnabled = false; - this.buffer = ""; + case "ligatures": { + if (STATUS === "enable") { + if (this.ligaturesAddon) break; + this.ligaturesAddon = new LigaturesAddon(); + this.terminal.loadAddon(this.ligaturesAddon); + } else { + if (!this.ligaturesAddon) break; + this.ligaturesAddon.dispose(); + this.ligaturesAddon = null; + } + break; + } + case "mouse": { + if (STATUS === "enable") { + this.terminal._core.coreMouseService.activeEncoding = + "cursorReport"; + this.terminal._core.coreMouseService.activeProtocol = "ANY"; + } else { + this.terminal._core.coreMouseService.activeEncoding = "DEFAULT"; + this.terminal._core.coreMouseService.activeProtocol = "NONE"; + } + break; + } + case "link": { + if (STATUS === "enable") { + if (this.webLinksAddon) break; + this.webLinksAddon = new import_addon_web_links.WebLinksAddon(); + this.terminal.loadAddon(this.webLinksAddon); + } else { + if (!this.webLinksAddon) break; + this.webLinksAddon.dispose(); + this.webLinksAddon = null; + } + break; + } + case "buffer": { + if (STATUS === "enable") { + this.bufferEnabled = true; + } else { + this.bufferEnabled = false; + this.buffer = ""; + } + break; } - break; } } - } - get() { - return new Promise((resolve) => { - this.dataCallbacks.push(resolve); - }); - } - print({ INFO, NEWLINE }) { - NEWLINE = Scratch.Cast.toString(NEWLINE).toLowerCase(); - this.terminal[NEWLINE === "newline" ? "writeln" : "write"]( - Scratch.Cast.toString(INFO) - ); - } - screenOptions({ SCREENOPTION }) { - SCREENOPTION = Scratch.Cast.toString(SCREENOPTION).toLowerCase(); - switch (SCREENOPTION) { - case "size": - return JSON.stringify({ - x: this.terminal.options.cols, - y: this.terminal.options.rows, - }); - case "cursor": - return JSON.stringify({ - x: this.terminal._core._inputHandler._activeBuffer.x, - Y: this.terminal._core._inputHandler._activeBuffer.y, - }); + get() { + return new Promise((resolve) => { + this.dataCallbacks.push(resolve); + }); } - return "{}"; - } - moveCursorTo({ X, Y }) { - X = Scratch.Cast.toNumber(X); - Y = Scratch.Cast.toNumber(Y); - if ( - isFinite(X) && - isFinite(Y) && - Math.floor(X) === X && - Math.floor(Y) === Y && - X >= 0 && - Y >= 0 - ) { - this.terminal.write( - `\u001b[${Scratch.Cast.toNumber(Y + 1)};${Scratch.Cast.toNumber( - X + 1 - )}H` + print({ INFO, NEWLINE }) { + NEWLINE = Scratch.Cast.toString(NEWLINE).toLowerCase(); + this.terminal[NEWLINE === "newline" ? "writeln" : "write"]( + Scratch.Cast.toString(INFO) ); } - } - moveCursor({ N, DIRECTION }) { - const directionMap = { - up: "A", - down: "B", - right: "C", - left: "D", - }; - DIRECTION = Scratch.Cast.toString(DIRECTION).toLowerCase(); - N = Scratch.Cast.toNumber(N); - if ( - DIRECTION in directionMap && - isFinite(N) && - Math.floor(N) === N && - N > 0 - ) { - this.terminal.write(`\u001b[${N}${directionMap[DIRECTION]}`); + screenOptions({ SCREENOPTION }) { + SCREENOPTION = Scratch.Cast.toString(SCREENOPTION).toLowerCase(); + switch (SCREENOPTION) { + case "size": + return JSON.stringify({ + x: this.terminal.options.cols, + y: this.terminal.options.rows, + }); + case "cursor": + return JSON.stringify({ + x: this.terminal._core._inputHandler._activeBuffer.x, + Y: this.terminal._core._inputHandler._activeBuffer.y, + }); + } + return "{}"; } - } - clear({ CLEARTYPE }) { - CLEARTYPE = Scratch.Cast.toString(CLEARTYPE).toLowerCase(); - let typeMap = { - after: 0, - before: 1, - screen: 2, - scrollback: 3, - }; - if (CLEARTYPE in typeMap) { - this.terminal.write(`\u001b[${typeMap[CLEARTYPE]}J`); + moveCursorTo({ X, Y }) { + X = Scratch.Cast.toNumber(X); + Y = Scratch.Cast.toNumber(Y); + if ( + isFinite(X) && + isFinite(Y) && + Math.floor(X) === X && + Math.floor(Y) === Y && + X >= 0 && + Y >= 0 + ) { + this.terminal.write( + `\x1B[${Scratch.Cast.toNumber(Y + 1)};${Scratch.Cast.toNumber( + X + 1 + )}H` + ); + } } - } - reset() { - this.terminal.reset(); - } - saveCursor(args, util) { - if (util.stackFrame.shouldRestoreCursor) { - this.moveCursorTo({ - X: util.stackFrame.cursorX, - Y: util.stackFrame.cursorY, - }); - } else { - util.stackFrame.shouldRestoreCursor = true; - util.stackFrame.cursorX = - this.terminal._core._inputHandler._activeBuffer.x; - util.stackFrame.cursorY = - this.terminal._core._inputHandler._activeBuffer.y; - util.startBranch(1, true); + moveCursor({ N, DIRECTION }) { + const directionMap = { + up: "A", + down: "B", + right: "C", + left: "D", + }; + DIRECTION = Scratch.Cast.toString(DIRECTION).toLowerCase(); + N = Scratch.Cast.toNumber(N); + if ( + DIRECTION in directionMap && + isFinite(N) && + Math.floor(N) === N && + N > 0 + ) { + this.terminal.write(`\x1B[${N}${directionMap[DIRECTION]}`); + } + } + clear({ CLEARTYPE }) { + CLEARTYPE = Scratch.Cast.toString(CLEARTYPE).toLowerCase(); + let typeMap = { + after: 0, + before: 1, + screen: 2, + scrollback: 3, + }; + if (CLEARTYPE in typeMap) { + this.terminal.write(`\x1B[${typeMap[CLEARTYPE]}J`); + } + } + reset() { + this.terminal.reset(); + } + saveCursor(args, util) { + if (util.stackFrame.shouldRestoreCursor) { + this.moveCursorTo({ + X: util.stackFrame.cursorX, + Y: util.stackFrame.cursorY, + }); + } else { + util.stackFrame.shouldRestoreCursor = true; + util.stackFrame.cursorX = + this.terminal._core._inputHandler._activeBuffer.x; + util.stackFrame.cursorY = + this.terminal._core._inputHandler._activeBuffer.y; + util.startBranch(1, true); + } + } + whenTerminalResized() { + return true; + } + whenMouseClicked() { + return true; + } + whenMouseOver() { + return true; + } + whenScrolled() { + return true; + } + getEventData() { + return JSON.stringify(this.eventData); + } + coloredText({ TEXT, COLOR, TYPE }) { + TYPE = Scratch.Cast.toString(TYPE).toLowerCase(); + COLOR = Scratch.Cast.toRgbColorList(COLOR); + return `\x1B[${TYPE === "background" ? "48" : "38"};2;${COLOR[0]};${COLOR[1]};${COLOR[2]}m${Scratch.Cast.toString(TEXT)}\x1B[0m`; + } + withOpacity({ COLOR, OPACITY }) { + COLOR = Scratch.Cast.toRgbColorList(COLOR); + return `rgba(${COLOR[0]},${COLOR[1]},${COLOR[2]},${Scratch.Cast.toNumber( + OPACITY + )})`; + } + toCodePoint({ CHAR }) { + CHAR = Scratch.Cast.toString(CHAR); + return CHAR.codePointAt(0) ?? -1; + } + fromCodePoint({ CODE }) { + CODE = Scratch.Cast.toNumber(CODE); + return String.fromCodePoint(CODE); } - } - whenTerminalResized() { - return true; - } - whenMouseClicked() { - return true; - } - whenMouseOver() { - return true; - } - whenScrolled() { - return true; - } - getEventData() { - return JSON.stringify(this.eventData); - } - coloredText({ TEXT, COLOR, TYPE }) { - TYPE = Scratch.Cast.toString(TYPE).toLowerCase(); - COLOR = Scratch.Cast.toRgbColorList(COLOR); - return `\u001b[${TYPE === "background" ? "48" : "38"};2;${COLOR[0]};${ - COLOR[1] - };${COLOR[2]}m${Scratch.Cast.toString(TEXT)}\u001b[0m`; - } - withOpacity({ COLOR, OPACITY }) { - COLOR = Scratch.Cast.toRgbColorList(COLOR); - return `rgba(${COLOR[0]},${COLOR[1]},${COLOR[2]},${Scratch.Cast.toNumber( - OPACITY - )})`; - } - toCodePoint({ CHAR }) { - CHAR = Scratch.Cast.toString(CHAR); - return CHAR.codePointAt(0) ?? -1; - } - fromCodePoint({ CODE }) { - CODE = Scratch.Cast.toNumber(CODE); - return String.fromCodePoint(CODE); - } - } - Scratch.extensions.register(new ScratchXTerm()); + }; + Scratch.extensions.register(new ScratchXTerm()); + })(); })(Scratch);