@phenx-inc/ctlsurf 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
3
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
4
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
5
  }) : x)(function(x) {
@@ -14,3413 +9,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
14
9
  var __commonJS = (cb, mod) => function __require2() {
15
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
11
  };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
33
-
34
- // node_modules/@xterm/headless/lib-headless/xterm-headless.js
35
- var require_xterm_headless = __commonJS({
36
- "node_modules/@xterm/headless/lib-headless/xterm-headless.js"(exports) {
37
- (() => {
38
- "use strict";
39
- var e = { 349: (e2, t2, i2) => {
40
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CircularList = void 0;
41
- const s2 = i2(460), r2 = i2(844);
42
- class n2 extends r2.Disposable {
43
- constructor(e3) {
44
- 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;
45
- }
46
- get maxLength() {
47
- return this._maxLength;
48
- }
49
- set maxLength(e3) {
50
- if (this._maxLength === e3) return;
51
- const t3 = new Array(e3);
52
- for (let i3 = 0; i3 < Math.min(e3, this.length); i3++) t3[i3] = this._array[this._getCyclicIndex(i3)];
53
- this._array = t3, this._maxLength = e3, this._startIndex = 0;
54
- }
55
- get length() {
56
- return this._length;
57
- }
58
- set length(e3) {
59
- if (e3 > this._length) for (let t3 = this._length; t3 < e3; t3++) this._array[t3] = void 0;
60
- this._length = e3;
61
- }
62
- get(e3) {
63
- return this._array[this._getCyclicIndex(e3)];
64
- }
65
- set(e3, t3) {
66
- this._array[this._getCyclicIndex(e3)] = t3;
67
- }
68
- push(e3) {
69
- this._array[this._getCyclicIndex(this._length)] = e3, this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1)) : this._length++;
70
- }
71
- recycle() {
72
- if (this._length !== this._maxLength) throw new Error("Can only recycle when the buffer is full");
73
- return this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1), this._array[this._getCyclicIndex(this._length - 1)];
74
- }
75
- get isFull() {
76
- return this._length === this._maxLength;
77
- }
78
- pop() {
79
- return this._array[this._getCyclicIndex(this._length-- - 1)];
80
- }
81
- splice(e3, t3, ...i3) {
82
- if (t3) {
83
- for (let i4 = e3; i4 < this._length - t3; i4++) this._array[this._getCyclicIndex(i4)] = this._array[this._getCyclicIndex(i4 + t3)];
84
- this._length -= t3, this.onDeleteEmitter.fire({ index: e3, amount: t3 });
85
- }
86
- for (let t4 = this._length - 1; t4 >= e3; t4--) this._array[this._getCyclicIndex(t4 + i3.length)] = this._array[this._getCyclicIndex(t4)];
87
- for (let t4 = 0; t4 < i3.length; t4++) this._array[this._getCyclicIndex(e3 + t4)] = i3[t4];
88
- if (i3.length && this.onInsertEmitter.fire({ index: e3, amount: i3.length }), this._length + i3.length > this._maxLength) {
89
- const e4 = this._length + i3.length - this._maxLength;
90
- this._startIndex += e4, this._length = this._maxLength, this.onTrimEmitter.fire(e4);
91
- } else this._length += i3.length;
92
- }
93
- trimStart(e3) {
94
- e3 > this._length && (e3 = this._length), this._startIndex += e3, this._length -= e3, this.onTrimEmitter.fire(e3);
95
- }
96
- shiftElements(e3, t3, i3) {
97
- if (!(t3 <= 0)) {
98
- if (e3 < 0 || e3 >= this._length) throw new Error("start argument out of range");
99
- if (e3 + i3 < 0) throw new Error("Cannot shift elements in list beyond index 0");
100
- if (i3 > 0) {
101
- for (let s4 = t3 - 1; s4 >= 0; s4--) this.set(e3 + s4 + i3, this.get(e3 + s4));
102
- const s3 = e3 + t3 + i3 - this._length;
103
- if (s3 > 0) for (this._length += s3; this._length > this._maxLength; ) this._length--, this._startIndex++, this.onTrimEmitter.fire(1);
104
- } else for (let s3 = 0; s3 < t3; s3++) this.set(e3 + s3 + i3, this.get(e3 + s3));
105
- }
106
- }
107
- _getCyclicIndex(e3) {
108
- return (this._startIndex + e3) % this._maxLength;
109
- }
110
- }
111
- t2.CircularList = n2;
112
- }, 439: (e2, t2) => {
113
- Object.defineProperty(t2, "__esModule", { value: true }), t2.clone = void 0, t2.clone = function e3(t3, i2 = 5) {
114
- if ("object" != typeof t3) return t3;
115
- const s2 = Array.isArray(t3) ? [] : {};
116
- for (const r2 in t3) s2[r2] = i2 <= 1 ? t3[r2] : t3[r2] && e3(t3[r2], i2 - 1);
117
- return s2;
118
- };
119
- }, 969: (e2, t2, i2) => {
120
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = void 0;
121
- const s2 = i2(844), r2 = i2(585), n2 = i2(348), a = i2(866), o = i2(744), h = i2(302), c = i2(83), l = i2(460), _ = i2(753), d = i2(480), f = i2(994), u = i2(282), p = i2(435), g = i2(981), v = i2(660);
122
- let b = false;
123
- class S extends s2.Disposable {
124
- get onScroll() {
125
- return this._onScrollApi || (this._onScrollApi = this.register(new l.EventEmitter()), this._onScroll.event(((e3) => {
126
- this._onScrollApi?.fire(e3.position);
127
- }))), this._onScrollApi.event;
128
- }
129
- get cols() {
130
- return this._bufferService.cols;
131
- }
132
- get rows() {
133
- return this._bufferService.rows;
134
- }
135
- get buffers() {
136
- return this._bufferService.buffers;
137
- }
138
- get options() {
139
- return this.optionsService.options;
140
- }
141
- set options(e3) {
142
- for (const t3 in e3) this.optionsService.options[t3] = e3[t3];
143
- }
144
- constructor(e3) {
145
- 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 n2.InstantiationService(), this.optionsService = this.register(new h.OptionsService(e3)), this._instantiationService.setService(r2.IOptionsService, this.optionsService), this._bufferService = this.register(this._instantiationService.createInstance(o.BufferService)), this._instantiationService.setService(r2.IBufferService, this._bufferService), this._logService = this.register(this._instantiationService.createInstance(a.LogService)), this._instantiationService.setService(r2.ILogService, this._logService), this.coreService = this.register(this._instantiationService.createInstance(c.CoreService)), this._instantiationService.setService(r2.ICoreService, this.coreService), this.coreMouseService = this.register(this._instantiationService.createInstance(_.CoreMouseService)), this._instantiationService.setService(r2.ICoreMouseService, this.coreMouseService), this.unicodeService = this.register(this._instantiationService.createInstance(d.UnicodeService)), this._instantiationService.setService(r2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(f.CharsetService), this._instantiationService.setService(r2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(v.OscLinkService), this._instantiationService.setService(r2.IOscLinkService, this._oscLinkService), this._inputHandler = this.register(new p.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) => {
146
- this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
147
- }))), this.register(this._inputHandler.onScroll(((e4) => {
148
- this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
149
- }))), this._writeBuffer = this.register(new g.WriteBuffer(((e4, t3) => this._inputHandler.parse(e4, t3)))), this.register((0, l.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed));
150
- }
151
- write(e3, t3) {
152
- this._writeBuffer.write(e3, t3);
153
- }
154
- writeSync(e3, t3) {
155
- this._logService.logLevel <= r2.LogLevelEnum.WARN && !b && (this._logService.warn("writeSync is unreliable and will be removed soon."), b = true), this._writeBuffer.writeSync(e3, t3);
156
- }
157
- input(e3, t3 = true) {
158
- this.coreService.triggerDataEvent(e3, t3);
159
- }
160
- resize(e3, t3) {
161
- isNaN(e3) || isNaN(t3) || (e3 = Math.max(e3, o.MINIMUM_COLS), t3 = Math.max(t3, o.MINIMUM_ROWS), this._bufferService.resize(e3, t3));
162
- }
163
- scroll(e3, t3 = false) {
164
- this._bufferService.scroll(e3, t3);
165
- }
166
- scrollLines(e3, t3, i3) {
167
- this._bufferService.scrollLines(e3, t3, i3);
168
- }
169
- scrollPages(e3) {
170
- this.scrollLines(e3 * (this.rows - 1));
171
- }
172
- scrollToTop() {
173
- this.scrollLines(-this._bufferService.buffer.ydisp);
174
- }
175
- scrollToBottom() {
176
- this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
177
- }
178
- scrollToLine(e3) {
179
- const t3 = e3 - this._bufferService.buffer.ydisp;
180
- 0 !== t3 && this.scrollLines(t3);
181
- }
182
- registerEscHandler(e3, t3) {
183
- return this._inputHandler.registerEscHandler(e3, t3);
184
- }
185
- registerDcsHandler(e3, t3) {
186
- return this._inputHandler.registerDcsHandler(e3, t3);
187
- }
188
- registerCsiHandler(e3, t3) {
189
- return this._inputHandler.registerCsiHandler(e3, t3);
190
- }
191
- registerOscHandler(e3, t3) {
192
- return this._inputHandler.registerOscHandler(e3, t3);
193
- }
194
- _setup() {
195
- this._handleWindowsPtyOptionChange();
196
- }
197
- reset() {
198
- this._inputHandler.reset(), this._bufferService.reset(), this._charsetService.reset(), this.coreService.reset(), this.coreMouseService.reset();
199
- }
200
- _handleWindowsPtyOptionChange() {
201
- let e3 = false;
202
- const t3 = this.optionsService.rawOptions.windowsPty;
203
- 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();
204
- }
205
- _enableWindowsWrappingHeuristics() {
206
- if (!this._windowsWrappingHeuristics.value) {
207
- const e3 = [];
208
- e3.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, (() => ((0, u.updateWindowsModeWrappedState)(this._bufferService), false)))), this._windowsWrappingHeuristics.value = (0, s2.toDisposable)((() => {
209
- for (const t3 of e3) t3.dispose();
210
- }));
211
- }
212
- }
213
- }
214
- t2.CoreTerminal = S;
215
- }, 460: (e2, t2) => {
216
- Object.defineProperty(t2, "__esModule", { value: true }), t2.runAndSubscribe = t2.forwardEvent = t2.EventEmitter = void 0, t2.EventEmitter = class {
217
- constructor() {
218
- this._listeners = [], this._disposed = false;
219
- }
220
- get event() {
221
- return this._event || (this._event = (e3) => {
222
- this._listeners.push(e3);
223
- const t3 = { dispose: () => {
224
- if (!this._disposed) {
225
- for (let t4 = 0; t4 < this._listeners.length; t4++) if (this._listeners[t4] === e3) return void this._listeners.splice(t4, 1);
226
- }
227
- } };
228
- return t3;
229
- }), this._event;
230
- }
231
- fire(e3, t3) {
232
- const i2 = [];
233
- for (let e4 = 0; e4 < this._listeners.length; e4++) i2.push(this._listeners[e4]);
234
- for (let s2 = 0; s2 < i2.length; s2++) i2[s2].call(void 0, e3, t3);
235
- }
236
- dispose() {
237
- this.clearListeners(), this._disposed = true;
238
- }
239
- clearListeners() {
240
- this._listeners && (this._listeners.length = 0);
241
- }
242
- }, t2.forwardEvent = function(e3, t3) {
243
- return e3(((e4) => t3.fire(e4)));
244
- }, t2.runAndSubscribe = function(e3, t3) {
245
- return t3(void 0), e3(((e4) => t3(e4)));
246
- };
247
- }, 435: function(e2, t2, i2) {
248
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
249
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
250
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
251
- else for (var o2 = e3.length - 1; o2 >= 0; o2--) (r3 = e3[o2]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
252
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
253
- }, r2 = this && this.__param || function(e3, t3) {
254
- return function(i3, s3) {
255
- t3(i3, s3, e3);
256
- };
257
- };
258
- Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0;
259
- const n2 = i2(584), a = i2(116), o = i2(15), h = i2(844), c = i2(482), l = i2(437), _ = i2(460), d = i2(643), f = i2(511), u = i2(734), p = i2(585), g = i2(480), v = i2(242), b = i2(351), S = i2(941), m = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, C = 131072;
260
- function y(e3, t3) {
261
- if (e3 > 24) return t3.setWinLines || false;
262
- switch (e3) {
263
- case 1:
264
- return !!t3.restoreWin;
265
- case 2:
266
- return !!t3.minimizeWin;
267
- case 3:
268
- return !!t3.setWinPosition;
269
- case 4:
270
- return !!t3.setWinSizePixels;
271
- case 5:
272
- return !!t3.raiseWin;
273
- case 6:
274
- return !!t3.lowerWin;
275
- case 7:
276
- return !!t3.refreshWin;
277
- case 8:
278
- return !!t3.setWinSizeChars;
279
- case 9:
280
- return !!t3.maximizeWin;
281
- case 10:
282
- return !!t3.fullscreenWin;
283
- case 11:
284
- return !!t3.getWinState;
285
- case 13:
286
- return !!t3.getWinPosition;
287
- case 14:
288
- return !!t3.getWinSizePixels;
289
- case 15:
290
- return !!t3.getScreenSizePixels;
291
- case 16:
292
- return !!t3.getCellSizePixels;
293
- case 18:
294
- return !!t3.getWinSizeChars;
295
- case 19:
296
- return !!t3.getScreenSizeChars;
297
- case 20:
298
- return !!t3.getIconTitle;
299
- case 21:
300
- return !!t3.getWinTitle;
301
- case 22:
302
- return !!t3.pushTitle;
303
- case 23:
304
- return !!t3.popTitle;
305
- case 24:
306
- return !!t3.setWinLines;
307
- }
308
- return false;
309
- }
310
- var w;
311
- !(function(e3) {
312
- e3[e3.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", e3[e3.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
313
- })(w || (t2.WindowsOptionsReportType = w = {}));
314
- let B = 0;
315
- class E extends h.Disposable {
316
- getAttrData() {
317
- return this._curAttrData;
318
- }
319
- constructor(e3, t3, i3, s3, r3, h2, d2, u2, p2 = new o.EscapeSequenceParser()) {
320
- super(), this._bufferService = e3, this._charsetService = t3, this._coreService = i3, this._logService = s3, this._optionsService = r3, this._oscLinkService = h2, this._coreMouseService = d2, this._unicodeService = u2, this._parser = p2, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new c.StringToUtf32(), this._utf8Decoder = new c.Utf8ToUtf32(), this._workCell = new f.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 _.EventEmitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this.register(new _.EventEmitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this.register(new _.EventEmitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this.register(new _.EventEmitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this.register(new _.EventEmitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this.register(new _.EventEmitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this.register(new _.EventEmitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this.register(new _.EventEmitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this.register(new _.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this.register(new _.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this.register(new _.EventEmitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this.register(new _.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this.register(new _.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 A(this._bufferService), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate(((e4) => this._activeBuffer = e4.activeBuffer))), this._parser.setCsiHandlerFallback(((e4, t4) => {
321
- this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(e4), params: t4.toArray() });
322
- })), this._parser.setEscHandlerFallback(((e4) => {
323
- this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(e4) });
324
- })), this._parser.setExecuteHandlerFallback(((e4) => {
325
- this._logService.debug("Unknown EXECUTE code: ", { code: e4 });
326
- })), this._parser.setOscHandlerFallback(((e4, t4, i4) => {
327
- this._logService.debug("Unknown OSC code: ", { identifier: e4, action: t4, data: i4 });
328
- })), this._parser.setDcsHandlerFallback(((e4, t4, i4) => {
329
- "HOOK" === t4 && (i4 = i4.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(e4), action: t4, payload: i4 });
330
- })), 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(n2.C0.BEL, (() => this.bell())), this._parser.setExecuteHandler(n2.C0.LF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.VT, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.FF, (() => this.lineFeed())), this._parser.setExecuteHandler(n2.C0.CR, (() => this.carriageReturn())), this._parser.setExecuteHandler(n2.C0.BS, (() => this.backspace())), this._parser.setExecuteHandler(n2.C0.HT, (() => this.tab())), this._parser.setExecuteHandler(n2.C0.SO, (() => this.shiftOut())), this._parser.setExecuteHandler(n2.C0.SI, (() => this.shiftIn())), this._parser.setExecuteHandler(n2.C1.IND, (() => this.index())), this._parser.setExecuteHandler(n2.C1.NEL, (() => this.nextLine())), this._parser.setExecuteHandler(n2.C1.HTS, (() => this.tabSet())), this._parser.registerOscHandler(0, new v.OscHandler(((e4) => (this.setTitle(e4), this.setIconName(e4), true)))), this._parser.registerOscHandler(1, new v.OscHandler(((e4) => this.setIconName(e4)))), this._parser.registerOscHandler(2, new v.OscHandler(((e4) => this.setTitle(e4)))), this._parser.registerOscHandler(4, new v.OscHandler(((e4) => this.setOrReportIndexedColor(e4)))), this._parser.registerOscHandler(8, new v.OscHandler(((e4) => this.setHyperlink(e4)))), this._parser.registerOscHandler(10, new v.OscHandler(((e4) => this.setOrReportFgColor(e4)))), this._parser.registerOscHandler(11, new v.OscHandler(((e4) => this.setOrReportBgColor(e4)))), this._parser.registerOscHandler(12, new v.OscHandler(((e4) => this.setOrReportCursorColor(e4)))), this._parser.registerOscHandler(104, new v.OscHandler(((e4) => this.restoreIndexedColor(e4)))), this._parser.registerOscHandler(110, new v.OscHandler(((e4) => this.restoreFgColor(e4)))), this._parser.registerOscHandler(111, new v.OscHandler(((e4) => this.restoreBgColor(e4)))), this._parser.registerOscHandler(112, new v.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()));
331
- for (const e4 in a.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)));
332
- 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 b.DcsHandler(((e4, t4) => this.requestStatusString(e4, t4))));
333
- }
334
- _preserveStack(e3, t3, i3, s3) {
335
- this._parseStack.paused = true, this._parseStack.cursorStartX = e3, this._parseStack.cursorStartY = t3, this._parseStack.decodedLength = i3, this._parseStack.position = s3;
336
- }
337
- _logSlowResolvingAsync(e3) {
338
- this._logService.logLevel <= p.LogLevelEnum.WARN && Promise.race([e3, new Promise(((e4, t3) => setTimeout((() => t3("#SLOW_TIMEOUT")), 5e3)))]).catch(((e4) => {
339
- if ("#SLOW_TIMEOUT" !== e4) throw e4;
340
- console.warn("async parser handler taking longer than 5000 ms");
341
- }));
342
- }
343
- _getCurrentLinkId() {
344
- return this._curAttrData.extended.urlId;
345
- }
346
- parse(e3, t3) {
347
- let i3, s3 = this._activeBuffer.x, r3 = this._activeBuffer.y, n3 = 0;
348
- const a2 = this._parseStack.paused;
349
- if (a2) {
350
- if (i3 = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, t3)) return this._logSlowResolvingAsync(i3), i3;
351
- s3 = this._parseStack.cursorStartX, r3 = this._parseStack.cursorStartY, this._parseStack.paused = false, e3.length > C && (n3 = this._parseStack.position + C);
352
- }
353
- if (this._logService.logLevel <= p.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 < C && (this._parseBuffer = new Uint32Array(Math.min(e3.length, C))), a2 || this._dirtyRowTracker.clearRange(), e3.length > C) for (let t4 = n3; t4 < e3.length; t4 += C) {
354
- const n4 = t4 + C < e3.length ? t4 + C : e3.length, a3 = "string" == typeof e3 ? this._stringDecoder.decode(e3.substring(t4, n4), this._parseBuffer) : this._utf8Decoder.decode(e3.subarray(t4, n4), this._parseBuffer);
355
- if (i3 = this._parser.parse(this._parseBuffer, a3)) return this._preserveStack(s3, r3, a3, t4), this._logSlowResolvingAsync(i3), i3;
356
- }
357
- else if (!a2) {
358
- const t4 = "string" == typeof e3 ? this._stringDecoder.decode(e3, this._parseBuffer) : this._utf8Decoder.decode(e3, this._parseBuffer);
359
- if (i3 = this._parser.parse(this._parseBuffer, t4)) return this._preserveStack(s3, r3, t4, 0), this._logSlowResolvingAsync(i3), i3;
360
- }
361
- this._activeBuffer.x === s3 && this._activeBuffer.y === r3 || this._onCursorMove.fire();
362
- const o2 = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp), h2 = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
363
- h2 < this._bufferService.rows && this._onRequestRefreshRows.fire(Math.min(h2, this._bufferService.rows - 1), Math.min(o2, this._bufferService.rows - 1));
364
- }
365
- print(e3, t3, i3) {
366
- let s3, r3;
367
- const n3 = this._charsetService.charset, a2 = this._optionsService.rawOptions.screenReaderMode, o2 = this._bufferService.cols, h2 = this._coreService.decPrivateModes.wraparound, _2 = this._coreService.modes.insertMode, f2 = this._curAttrData;
368
- let u2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
369
- this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && i3 - t3 > 0 && 2 === u2.getWidth(this._activeBuffer.x - 1) && u2.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, f2);
370
- let p2 = this._parser.precedingJoinState;
371
- for (let v2 = t3; v2 < i3; ++v2) {
372
- if (s3 = e3[v2], s3 < 127 && n3) {
373
- const e4 = n3[String.fromCharCode(s3)];
374
- e4 && (s3 = e4.charCodeAt(0));
375
- }
376
- const t4 = this._unicodeService.charProperties(s3, p2);
377
- r3 = g.UnicodeService.extractWidth(t4);
378
- const i4 = g.UnicodeService.extractShouldJoin(t4), b2 = i4 ? g.UnicodeService.extractWidth(p2) : 0;
379
- if (p2 = t4, a2 && this._onA11yChar.fire((0, c.stringFromCodePoint)(s3)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - b2 > o2) {
380
- if (h2) {
381
- const e4 = u2;
382
- let t5 = this._activeBuffer.x - b2;
383
- for (this._activeBuffer.x = b2, 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), u2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), b2 > 0 && u2 instanceof l.BufferLine && u2.copyCellsFrom(e4, t5, 0, b2, false); t5 < o2; ) e4.setCellFromCodepoint(t5++, 0, 1, f2);
384
- } else if (this._activeBuffer.x = o2 - 1, 2 === r3) continue;
385
- }
386
- if (i4 && this._activeBuffer.x) {
387
- const e4 = u2.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
388
- u2.addCodepointToCell(this._activeBuffer.x - e4, s3, r3);
389
- for (let e5 = r3 - b2; --e5 >= 0; ) u2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
390
- } else if (_2 && (u2.insertCells(this._activeBuffer.x, r3 - b2, this._activeBuffer.getNullCell(f2)), 2 === u2.getWidth(o2 - 1) && u2.setCellFromCodepoint(o2 - 1, d.NULL_CELL_CODE, d.NULL_CELL_WIDTH, f2)), u2.setCellFromCodepoint(this._activeBuffer.x++, s3, r3, f2), r3 > 0) for (; --r3; ) u2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, f2);
391
- }
392
- this._parser.precedingJoinState = p2, this._activeBuffer.x < o2 && i3 - t3 > 0 && 0 === u2.getWidth(this._activeBuffer.x) && !u2.hasContent(this._activeBuffer.x) && u2.setCellFromCodepoint(this._activeBuffer.x, 0, 1, f2), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
393
- }
394
- registerCsiHandler(e3, t3) {
395
- return "t" !== e3.final || e3.prefix || e3.intermediates ? this._parser.registerCsiHandler(e3, t3) : this._parser.registerCsiHandler(e3, ((e4) => !y(e4.params[0], this._optionsService.rawOptions.windowOptions) || t3(e4)));
396
- }
397
- registerDcsHandler(e3, t3) {
398
- return this._parser.registerDcsHandler(e3, new b.DcsHandler(t3));
399
- }
400
- registerEscHandler(e3, t3) {
401
- return this._parser.registerEscHandler(e3, t3);
402
- }
403
- registerOscHandler(e3, t3) {
404
- return this._parser.registerOscHandler(e3, new v.OscHandler(t3));
405
- }
406
- bell() {
407
- return this._onRequestBell.fire(), true;
408
- }
409
- lineFeed() {
410
- 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;
411
- }
412
- carriageReturn() {
413
- return this._activeBuffer.x = 0, true;
414
- }
415
- backspace() {
416
- if (!this._coreService.decPrivateModes.reverseWraparound) return this._restrictCursor(), this._activeBuffer.x > 0 && this._activeBuffer.x--, true;
417
- if (this._restrictCursor(this._bufferService.cols), this._activeBuffer.x > 0) this._activeBuffer.x--;
418
- 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) {
419
- this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = false, this._activeBuffer.y--, this._activeBuffer.x = this._bufferService.cols - 1;
420
- const e3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
421
- e3.hasWidth(this._activeBuffer.x) && !e3.hasContent(this._activeBuffer.x) && this._activeBuffer.x--;
422
- }
423
- return this._restrictCursor(), true;
424
- }
425
- tab() {
426
- if (this._activeBuffer.x >= this._bufferService.cols) return true;
427
- const e3 = this._activeBuffer.x;
428
- return this._activeBuffer.x = this._activeBuffer.nextStop(), this._optionsService.rawOptions.screenReaderMode && this._onA11yTab.fire(this._activeBuffer.x - e3), true;
429
- }
430
- shiftOut() {
431
- return this._charsetService.setgLevel(1), true;
432
- }
433
- shiftIn() {
434
- return this._charsetService.setgLevel(0), true;
435
- }
436
- _restrictCursor(e3 = this._bufferService.cols - 1) {
437
- 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);
438
- }
439
- _setCursor(e3, t3) {
440
- 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);
441
- }
442
- _moveCursor(e3, t3) {
443
- this._restrictCursor(), this._setCursor(this._activeBuffer.x + e3, this._activeBuffer.y + t3);
444
- }
445
- cursorUp(e3) {
446
- const t3 = this._activeBuffer.y - this._activeBuffer.scrollTop;
447
- return t3 >= 0 ? this._moveCursor(0, -Math.min(t3, e3.params[0] || 1)) : this._moveCursor(0, -(e3.params[0] || 1)), true;
448
- }
449
- cursorDown(e3) {
450
- const t3 = this._activeBuffer.scrollBottom - this._activeBuffer.y;
451
- return t3 >= 0 ? this._moveCursor(0, Math.min(t3, e3.params[0] || 1)) : this._moveCursor(0, e3.params[0] || 1), true;
452
- }
453
- cursorForward(e3) {
454
- return this._moveCursor(e3.params[0] || 1, 0), true;
455
- }
456
- cursorBackward(e3) {
457
- return this._moveCursor(-(e3.params[0] || 1), 0), true;
458
- }
459
- cursorNextLine(e3) {
460
- return this.cursorDown(e3), this._activeBuffer.x = 0, true;
461
- }
462
- cursorPrecedingLine(e3) {
463
- return this.cursorUp(e3), this._activeBuffer.x = 0, true;
464
- }
465
- cursorCharAbsolute(e3) {
466
- return this._setCursor((e3.params[0] || 1) - 1, this._activeBuffer.y), true;
467
- }
468
- cursorPosition(e3) {
469
- return this._setCursor(e3.length >= 2 ? (e3.params[1] || 1) - 1 : 0, (e3.params[0] || 1) - 1), true;
470
- }
471
- charPosAbsolute(e3) {
472
- return this._setCursor((e3.params[0] || 1) - 1, this._activeBuffer.y), true;
473
- }
474
- hPositionRelative(e3) {
475
- return this._moveCursor(e3.params[0] || 1, 0), true;
476
- }
477
- linePosAbsolute(e3) {
478
- return this._setCursor(this._activeBuffer.x, (e3.params[0] || 1) - 1), true;
479
- }
480
- vPositionRelative(e3) {
481
- return this._moveCursor(0, e3.params[0] || 1), true;
482
- }
483
- hVPosition(e3) {
484
- return this.cursorPosition(e3), true;
485
- }
486
- tabClear(e3) {
487
- const t3 = e3.params[0];
488
- return 0 === t3 ? delete this._activeBuffer.tabs[this._activeBuffer.x] : 3 === t3 && (this._activeBuffer.tabs = {}), true;
489
- }
490
- cursorForwardTab(e3) {
491
- if (this._activeBuffer.x >= this._bufferService.cols) return true;
492
- let t3 = e3.params[0] || 1;
493
- for (; t3--; ) this._activeBuffer.x = this._activeBuffer.nextStop();
494
- return true;
495
- }
496
- cursorBackwardTab(e3) {
497
- if (this._activeBuffer.x >= this._bufferService.cols) return true;
498
- let t3 = e3.params[0] || 1;
499
- for (; t3--; ) this._activeBuffer.x = this._activeBuffer.prevStop();
500
- return true;
501
- }
502
- selectProtected(e3) {
503
- const t3 = e3.params[0];
504
- return 1 === t3 && (this._curAttrData.bg |= 536870912), 2 !== t3 && 0 !== t3 || (this._curAttrData.bg &= -536870913), true;
505
- }
506
- _eraseInBufferLine(e3, t3, i3, s3 = false, r3 = false) {
507
- const n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e3);
508
- n3.replaceCells(t3, i3, this._activeBuffer.getNullCell(this._eraseAttrData()), r3), s3 && (n3.isWrapped = false);
509
- }
510
- _resetBufferLine(e3, t3 = false) {
511
- const i3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e3);
512
- i3 && (i3.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), t3), this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + e3), i3.isWrapped = false);
513
- }
514
- eraseInDisplay(e3, t3 = false) {
515
- let i3;
516
- switch (this._restrictCursor(this._bufferService.cols), e3.params[0]) {
517
- case 0:
518
- 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);
519
- this._dirtyRowTracker.markDirty(i3);
520
- break;
521
- case 1:
522
- 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);
523
- this._dirtyRowTracker.markDirty(0);
524
- break;
525
- case 2:
526
- for (i3 = this._bufferService.rows, this._dirtyRowTracker.markDirty(i3 - 1); i3--; ) this._resetBufferLine(i3, t3);
527
- this._dirtyRowTracker.markDirty(0);
528
- break;
529
- case 3:
530
- const e4 = this._activeBuffer.lines.length - this._bufferService.rows;
531
- 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));
532
- }
533
- return true;
534
- }
535
- eraseInLine(e3, t3 = false) {
536
- switch (this._restrictCursor(this._bufferService.cols), e3.params[0]) {
537
- case 0:
538
- this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, 0 === this._activeBuffer.x, t3);
539
- break;
540
- case 1:
541
- this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, t3);
542
- break;
543
- case 2:
544
- this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, t3);
545
- }
546
- return this._dirtyRowTracker.markDirty(this._activeBuffer.y), true;
547
- }
548
- insertLines(e3) {
549
- this._restrictCursor();
550
- let t3 = e3.params[0] || 1;
551
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
552
- const i3 = this._activeBuffer.ybase + this._activeBuffer.y, s3 = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, r3 = this._bufferService.rows - 1 + this._activeBuffer.ybase - s3 + 1;
553
- for (; t3--; ) this._activeBuffer.lines.splice(r3 - 1, 1), this._activeBuffer.lines.splice(i3, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
554
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, true;
555
- }
556
- deleteLines(e3) {
557
- this._restrictCursor();
558
- let t3 = e3.params[0] || 1;
559
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
560
- const i3 = this._activeBuffer.ybase + this._activeBuffer.y;
561
- let s3;
562
- 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()));
563
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, true;
564
- }
565
- insertChars(e3) {
566
- this._restrictCursor();
567
- const t3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
568
- return t3 && (t3.insertCells(this._activeBuffer.x, e3.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData())), this._dirtyRowTracker.markDirty(this._activeBuffer.y)), true;
569
- }
570
- deleteChars(e3) {
571
- this._restrictCursor();
572
- const t3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
573
- return t3 && (t3.deleteCells(this._activeBuffer.x, e3.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData())), this._dirtyRowTracker.markDirty(this._activeBuffer.y)), true;
574
- }
575
- scrollUp(e3) {
576
- let t3 = e3.params[0] || 1;
577
- 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()));
578
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
579
- }
580
- scrollDown(e3) {
581
- let t3 = e3.params[0] || 1;
582
- 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));
583
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
584
- }
585
- scrollLeft(e3) {
586
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
587
- const t3 = e3.params[0] || 1;
588
- for (let e4 = this._activeBuffer.scrollTop; e4 <= this._activeBuffer.scrollBottom; ++e4) {
589
- const i3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4);
590
- i3.deleteCells(0, t3, this._activeBuffer.getNullCell(this._eraseAttrData())), i3.isWrapped = false;
591
- }
592
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
593
- }
594
- scrollRight(e3) {
595
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
596
- const t3 = e3.params[0] || 1;
597
- for (let e4 = this._activeBuffer.scrollTop; e4 <= this._activeBuffer.scrollBottom; ++e4) {
598
- const i3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4);
599
- i3.insertCells(0, t3, this._activeBuffer.getNullCell(this._eraseAttrData())), i3.isWrapped = false;
600
- }
601
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
602
- }
603
- insertColumns(e3) {
604
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
605
- const t3 = e3.params[0] || 1;
606
- for (let e4 = this._activeBuffer.scrollTop; e4 <= this._activeBuffer.scrollBottom; ++e4) {
607
- const i3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4);
608
- i3.insertCells(this._activeBuffer.x, t3, this._activeBuffer.getNullCell(this._eraseAttrData())), i3.isWrapped = false;
609
- }
610
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
611
- }
612
- deleteColumns(e3) {
613
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop) return true;
614
- const t3 = e3.params[0] || 1;
615
- for (let e4 = this._activeBuffer.scrollTop; e4 <= this._activeBuffer.scrollBottom; ++e4) {
616
- const i3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + e4);
617
- i3.deleteCells(this._activeBuffer.x, t3, this._activeBuffer.getNullCell(this._eraseAttrData())), i3.isWrapped = false;
618
- }
619
- return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), true;
620
- }
621
- eraseChars(e3) {
622
- this._restrictCursor();
623
- const t3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
624
- 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;
625
- }
626
- repeatPrecedingCharacter(e3) {
627
- const t3 = this._parser.precedingJoinState;
628
- if (!t3) return true;
629
- const i3 = e3.params[0] || 1, s3 = g.UnicodeService.extractWidth(t3), r3 = this._activeBuffer.x - s3, n3 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).getString(r3), a2 = new Uint32Array(n3.length * i3);
630
- let o2 = 0;
631
- for (let e4 = 0; e4 < n3.length; ) {
632
- const t4 = n3.codePointAt(e4) || 0;
633
- a2[o2++] = t4, e4 += t4 > 65535 ? 2 : 1;
634
- }
635
- let h2 = o2;
636
- for (let e4 = 1; e4 < i3; ++e4) a2.copyWithin(h2, 0, o2), h2 += o2;
637
- return this.print(a2, 0, h2), true;
638
- }
639
- sendDeviceAttributesPrimary(e3) {
640
- return e3.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n2.C0.ESC + "[?6c")), true;
641
- }
642
- sendDeviceAttributesSecondary(e3) {
643
- return e3.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n2.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(e3.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n2.C0.ESC + "[>83;40003;0c")), true;
644
- }
645
- _is(e3) {
646
- return 0 === (this._optionsService.rawOptions.termName + "").indexOf(e3);
647
- }
648
- setMode(e3) {
649
- for (let t3 = 0; t3 < e3.length; t3++) switch (e3.params[t3]) {
650
- case 4:
651
- this._coreService.modes.insertMode = true;
652
- break;
653
- case 20:
654
- this._optionsService.options.convertEol = true;
655
- }
656
- return true;
657
- }
658
- setModePrivate(e3) {
659
- for (let t3 = 0; t3 < e3.length; t3++) switch (e3.params[t3]) {
660
- case 1:
661
- this._coreService.decPrivateModes.applicationCursorKeys = true;
662
- break;
663
- case 2:
664
- this._charsetService.setgCharset(0, a.DEFAULT_CHARSET), this._charsetService.setgCharset(1, a.DEFAULT_CHARSET), this._charsetService.setgCharset(2, a.DEFAULT_CHARSET), this._charsetService.setgCharset(3, a.DEFAULT_CHARSET);
665
- break;
666
- case 3:
667
- this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(132, this._bufferService.rows), this._onRequestReset.fire());
668
- break;
669
- case 6:
670
- this._coreService.decPrivateModes.origin = true, this._setCursor(0, 0);
671
- break;
672
- case 7:
673
- this._coreService.decPrivateModes.wraparound = true;
674
- break;
675
- case 12:
676
- this._optionsService.options.cursorBlink = true;
677
- break;
678
- case 45:
679
- this._coreService.decPrivateModes.reverseWraparound = true;
680
- break;
681
- case 66:
682
- this._logService.debug("Serial port requested application keypad."), this._coreService.decPrivateModes.applicationKeypad = true, this._onRequestSyncScrollBar.fire();
683
- break;
684
- case 9:
685
- this._coreMouseService.activeProtocol = "X10";
686
- break;
687
- case 1e3:
688
- this._coreMouseService.activeProtocol = "VT200";
689
- break;
690
- case 1002:
691
- this._coreMouseService.activeProtocol = "DRAG";
692
- break;
693
- case 1003:
694
- this._coreMouseService.activeProtocol = "ANY";
695
- break;
696
- case 1004:
697
- this._coreService.decPrivateModes.sendFocus = true, this._onRequestSendFocus.fire();
698
- break;
699
- case 1005:
700
- this._logService.debug("DECSET 1005 not supported (see #2507)");
701
- break;
702
- case 1006:
703
- this._coreMouseService.activeEncoding = "SGR";
704
- break;
705
- case 1015:
706
- this._logService.debug("DECSET 1015 not supported (see #2507)");
707
- break;
708
- case 1016:
709
- this._coreMouseService.activeEncoding = "SGR_PIXELS";
710
- break;
711
- case 25:
712
- this._coreService.isCursorHidden = false;
713
- break;
714
- case 1048:
715
- this.saveCursor();
716
- break;
717
- case 1049:
718
- this.saveCursor();
719
- case 47:
720
- case 1047:
721
- this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()), this._coreService.isCursorInitialized = true, this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1), this._onRequestSyncScrollBar.fire();
722
- break;
723
- case 2004:
724
- this._coreService.decPrivateModes.bracketedPasteMode = true;
725
- }
726
- return true;
727
- }
728
- resetMode(e3) {
729
- for (let t3 = 0; t3 < e3.length; t3++) switch (e3.params[t3]) {
730
- case 4:
731
- this._coreService.modes.insertMode = false;
732
- break;
733
- case 20:
734
- this._optionsService.options.convertEol = false;
735
- }
736
- return true;
737
- }
738
- resetModePrivate(e3) {
739
- for (let t3 = 0; t3 < e3.length; t3++) switch (e3.params[t3]) {
740
- case 1:
741
- this._coreService.decPrivateModes.applicationCursorKeys = false;
742
- break;
743
- case 3:
744
- this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(80, this._bufferService.rows), this._onRequestReset.fire());
745
- break;
746
- case 6:
747
- this._coreService.decPrivateModes.origin = false, this._setCursor(0, 0);
748
- break;
749
- case 7:
750
- this._coreService.decPrivateModes.wraparound = false;
751
- break;
752
- case 12:
753
- this._optionsService.options.cursorBlink = false;
754
- break;
755
- case 45:
756
- this._coreService.decPrivateModes.reverseWraparound = false;
757
- break;
758
- case 66:
759
- this._logService.debug("Switching back to normal keypad."), this._coreService.decPrivateModes.applicationKeypad = false, this._onRequestSyncScrollBar.fire();
760
- break;
761
- case 9:
762
- case 1e3:
763
- case 1002:
764
- case 1003:
765
- this._coreMouseService.activeProtocol = "NONE";
766
- break;
767
- case 1004:
768
- this._coreService.decPrivateModes.sendFocus = false;
769
- break;
770
- case 1005:
771
- this._logService.debug("DECRST 1005 not supported (see #2507)");
772
- break;
773
- case 1006:
774
- case 1016:
775
- this._coreMouseService.activeEncoding = "DEFAULT";
776
- break;
777
- case 1015:
778
- this._logService.debug("DECRST 1015 not supported (see #2507)");
779
- break;
780
- case 25:
781
- this._coreService.isCursorHidden = true;
782
- break;
783
- case 1048:
784
- this.restoreCursor();
785
- break;
786
- case 1049:
787
- case 47:
788
- case 1047:
789
- 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();
790
- break;
791
- case 2004:
792
- this._coreService.decPrivateModes.bracketedPasteMode = false;
793
- }
794
- return true;
795
- }
796
- requestMode(e3, t3) {
797
- const i3 = this._coreService.decPrivateModes, { activeProtocol: s3, activeEncoding: r3 } = this._coreMouseService, a2 = this._coreService, { buffers: o2, cols: h2 } = this._bufferService, { active: c2, alt: l2 } = o2, _2 = this._optionsService.rawOptions, d2 = (e4) => e4 ? 1 : 2, f2 = e3.params[0];
798
- return u2 = f2, p2 = t3 ? 2 === f2 ? 4 : 4 === f2 ? d2(a2.modes.insertMode) : 12 === f2 ? 3 : 20 === f2 ? d2(_2.convertEol) : 0 : 1 === f2 ? d2(i3.applicationCursorKeys) : 3 === f2 ? _2.windowOptions.setWinLines ? 80 === h2 ? 2 : 132 === h2 ? 1 : 0 : 0 : 6 === f2 ? d2(i3.origin) : 7 === f2 ? d2(i3.wraparound) : 8 === f2 ? 3 : 9 === f2 ? d2("X10" === s3) : 12 === f2 ? d2(_2.cursorBlink) : 25 === f2 ? d2(!a2.isCursorHidden) : 45 === f2 ? d2(i3.reverseWraparound) : 66 === f2 ? d2(i3.applicationKeypad) : 67 === f2 ? 4 : 1e3 === f2 ? d2("VT200" === s3) : 1002 === f2 ? d2("DRAG" === s3) : 1003 === f2 ? d2("ANY" === s3) : 1004 === f2 ? d2(i3.sendFocus) : 1005 === f2 ? 4 : 1006 === f2 ? d2("SGR" === r3) : 1015 === f2 ? 4 : 1016 === f2 ? d2("SGR_PIXELS" === r3) : 1048 === f2 ? 1 : 47 === f2 || 1047 === f2 || 1049 === f2 ? d2(c2 === l2) : 2004 === f2 ? d2(i3.bracketedPasteMode) : 0, a2.triggerDataEvent(`${n2.C0.ESC}[${t3 ? "" : "?"}${u2};${p2}$y`), true;
799
- var u2, p2;
800
- }
801
- _updateAttrColor(e3, t3, i3, s3, r3) {
802
- return 2 === t3 ? (e3 |= 50331648, e3 &= -16777216, e3 |= u.AttributeData.fromColorRGB([i3, s3, r3])) : 5 === t3 && (e3 &= -50331904, e3 |= 33554432 | 255 & i3), e3;
803
- }
804
- _extractColor(e3, t3, i3) {
805
- const s3 = [0, 0, -1, 0, 0, 0];
806
- let r3 = 0, n3 = 0;
807
- do {
808
- if (s3[n3 + r3] = e3.params[t3 + n3], e3.hasSubParams(t3 + n3)) {
809
- const i4 = e3.getSubParams(t3 + n3);
810
- let a2 = 0;
811
- do {
812
- 5 === s3[1] && (r3 = 1), s3[n3 + a2 + 1 + r3] = i4[a2];
813
- } while (++a2 < i4.length && a2 + n3 + 1 + r3 < s3.length);
814
- break;
815
- }
816
- if (5 === s3[1] && n3 + r3 >= 2 || 2 === s3[1] && n3 + r3 >= 5) break;
817
- s3[1] && (r3 = 1);
818
- } while (++n3 + t3 < e3.length && n3 + r3 < s3.length);
819
- for (let e4 = 2; e4 < s3.length; ++e4) -1 === s3[e4] && (s3[e4] = 0);
820
- switch (s3[0]) {
821
- case 38:
822
- i3.fg = this._updateAttrColor(i3.fg, s3[1], s3[3], s3[4], s3[5]);
823
- break;
824
- case 48:
825
- i3.bg = this._updateAttrColor(i3.bg, s3[1], s3[3], s3[4], s3[5]);
826
- break;
827
- case 58:
828
- i3.extended = i3.extended.clone(), i3.extended.underlineColor = this._updateAttrColor(i3.extended.underlineColor, s3[1], s3[3], s3[4], s3[5]);
829
- }
830
- return n3;
831
- }
832
- _processUnderline(e3, t3) {
833
- t3.extended = t3.extended.clone(), (!~e3 || e3 > 5) && (e3 = 1), t3.extended.underlineStyle = e3, t3.fg |= 268435456, 0 === e3 && (t3.fg &= -268435457), t3.updateExtended();
834
- }
835
- _processSGR0(e3) {
836
- 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();
837
- }
838
- charAttributes(e3) {
839
- if (1 === e3.length && 0 === e3.params[0]) return this._processSGR0(this._curAttrData), true;
840
- const t3 = e3.length;
841
- let i3;
842
- const s3 = this._curAttrData;
843
- for (let r3 = 0; r3 < t3; r3++) i3 = e3.params[r3], 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(r3) ? e3.getSubParams(r3)[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 ? r3 += this._extractColor(e3, r3, 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);
844
- return true;
845
- }
846
- deviceStatus(e3) {
847
- switch (e3.params[0]) {
848
- case 5:
849
- this._coreService.triggerDataEvent(`${n2.C0.ESC}[0n`);
850
- break;
851
- case 6:
852
- const e4 = this._activeBuffer.y + 1, t3 = this._activeBuffer.x + 1;
853
- this._coreService.triggerDataEvent(`${n2.C0.ESC}[${e4};${t3}R`);
854
- }
855
- return true;
856
- }
857
- deviceStatusPrivate(e3) {
858
- if (6 === e3.params[0]) {
859
- const e4 = this._activeBuffer.y + 1, t3 = this._activeBuffer.x + 1;
860
- this._coreService.triggerDataEvent(`${n2.C0.ESC}[?${e4};${t3}R`);
861
- }
862
- return true;
863
- }
864
- softReset(e3) {
865
- 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;
866
- }
867
- setCursorStyle(e3) {
868
- const t3 = e3.params[0] || 1;
869
- switch (t3) {
870
- case 1:
871
- case 2:
872
- this._optionsService.options.cursorStyle = "block";
873
- break;
874
- case 3:
875
- case 4:
876
- this._optionsService.options.cursorStyle = "underline";
877
- break;
878
- case 5:
879
- case 6:
880
- this._optionsService.options.cursorStyle = "bar";
881
- }
882
- const i3 = t3 % 2 == 1;
883
- return this._optionsService.options.cursorBlink = i3, true;
884
- }
885
- setScrollRegion(e3) {
886
- const t3 = e3.params[0] || 1;
887
- let i3;
888
- 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;
889
- }
890
- windowOptions(e3) {
891
- if (!y(e3.params[0], this._optionsService.rawOptions.windowOptions)) return true;
892
- const t3 = e3.length > 1 ? e3.params[1] : 0;
893
- switch (e3.params[0]) {
894
- case 14:
895
- 2 !== t3 && this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);
896
- break;
897
- case 16:
898
- this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);
899
- break;
900
- case 18:
901
- this._bufferService && this._coreService.triggerDataEvent(`${n2.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
902
- break;
903
- case 22:
904
- 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());
905
- break;
906
- case 23:
907
- 0 !== t3 && 2 !== t3 || this._windowTitleStack.length && this.setTitle(this._windowTitleStack.pop()), 0 !== t3 && 1 !== t3 || this._iconNameStack.length && this.setIconName(this._iconNameStack.pop());
908
- }
909
- return true;
910
- }
911
- saveCursor(e3) {
912
- 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;
913
- }
914
- restoreCursor(e3) {
915
- 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;
916
- }
917
- setTitle(e3) {
918
- return this._windowTitle = e3, this._onTitleChange.fire(e3), true;
919
- }
920
- setIconName(e3) {
921
- return this._iconName = e3, true;
922
- }
923
- setOrReportIndexedColor(e3) {
924
- const t3 = [], i3 = e3.split(";");
925
- for (; i3.length > 1; ) {
926
- const e4 = i3.shift(), s3 = i3.shift();
927
- if (/^\d+$/.exec(e4)) {
928
- const i4 = parseInt(e4);
929
- if (L(i4)) if ("?" === s3) t3.push({ type: 0, index: i4 });
930
- else {
931
- const e5 = (0, S.parseColor)(s3);
932
- e5 && t3.push({ type: 1, index: i4, color: e5 });
933
- }
934
- }
935
- }
936
- return t3.length && this._onColor.fire(t3), true;
937
- }
938
- setHyperlink(e3) {
939
- const t3 = e3.split(";");
940
- return !(t3.length < 2) && (t3[1] ? this._createHyperlink(t3[0], t3[1]) : !t3[0] && this._finishHyperlink());
941
- }
942
- _createHyperlink(e3, t3) {
943
- this._getCurrentLinkId() && this._finishHyperlink();
944
- const i3 = e3.split(":");
945
- let s3;
946
- const r3 = i3.findIndex(((e4) => e4.startsWith("id=")));
947
- return -1 !== r3 && (s3 = i3[r3].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;
948
- }
949
- _finishHyperlink() {
950
- return this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = 0, this._curAttrData.updateExtended(), true;
951
- }
952
- _setOrReportSpecialColor(e3, t3) {
953
- const i3 = e3.split(";");
954
- 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] }]);
955
- else {
956
- const s3 = (0, S.parseColor)(i3[e4]);
957
- s3 && this._onColor.fire([{ type: 1, index: this._specialColors[t3], color: s3 }]);
958
- }
959
- return true;
960
- }
961
- setOrReportFgColor(e3) {
962
- return this._setOrReportSpecialColor(e3, 0);
963
- }
964
- setOrReportBgColor(e3) {
965
- return this._setOrReportSpecialColor(e3, 1);
966
- }
967
- setOrReportCursorColor(e3) {
968
- return this._setOrReportSpecialColor(e3, 2);
969
- }
970
- restoreIndexedColor(e3) {
971
- if (!e3) return this._onColor.fire([{ type: 2 }]), true;
972
- const t3 = [], i3 = e3.split(";");
973
- for (let e4 = 0; e4 < i3.length; ++e4) if (/^\d+$/.exec(i3[e4])) {
974
- const s3 = parseInt(i3[e4]);
975
- L(s3) && t3.push({ type: 2, index: s3 });
976
- }
977
- return t3.length && this._onColor.fire(t3), true;
978
- }
979
- restoreFgColor(e3) {
980
- return this._onColor.fire([{ type: 2, index: 256 }]), true;
981
- }
982
- restoreBgColor(e3) {
983
- return this._onColor.fire([{ type: 2, index: 257 }]), true;
984
- }
985
- restoreCursorColor(e3) {
986
- return this._onColor.fire([{ type: 2, index: 258 }]), true;
987
- }
988
- nextLine() {
989
- return this._activeBuffer.x = 0, this.index(), true;
990
- }
991
- keypadApplicationMode() {
992
- return this._logService.debug("Serial port requested application keypad."), this._coreService.decPrivateModes.applicationKeypad = true, this._onRequestSyncScrollBar.fire(), true;
993
- }
994
- keypadNumericMode() {
995
- return this._logService.debug("Switching back to normal keypad."), this._coreService.decPrivateModes.applicationKeypad = false, this._onRequestSyncScrollBar.fire(), true;
996
- }
997
- selectDefaultCharset() {
998
- return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, a.DEFAULT_CHARSET), true;
999
- }
1000
- selectCharset(e3) {
1001
- return 2 !== e3.length ? (this.selectDefaultCharset(), true) : ("/" === e3[0] || this._charsetService.setgCharset(m[e3[0]], a.CHARSETS[e3[1]] || a.DEFAULT_CHARSET), true);
1002
- }
1003
- index() {
1004
- 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;
1005
- }
1006
- tabSet() {
1007
- return this._activeBuffer.tabs[this._activeBuffer.x] = true, true;
1008
- }
1009
- reverseIndex() {
1010
- if (this._restrictCursor(), this._activeBuffer.y === this._activeBuffer.scrollTop) {
1011
- const e3 = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;
1012
- 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);
1013
- } else this._activeBuffer.y--, this._restrictCursor();
1014
- return true;
1015
- }
1016
- fullReset() {
1017
- return this._parser.reset(), this._onRequestReset.fire(), true;
1018
- }
1019
- reset() {
1020
- this._curAttrData = l.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone();
1021
- }
1022
- _eraseAttrData() {
1023
- return this._eraseAttrDataInternal.bg &= -67108864, this._eraseAttrDataInternal.bg |= 67108863 & this._curAttrData.bg, this._eraseAttrDataInternal;
1024
- }
1025
- setgLevel(e3) {
1026
- return this._charsetService.setgLevel(e3), true;
1027
- }
1028
- screenAlignmentPattern() {
1029
- const e3 = new f.CellData();
1030
- e3.content = 1 << 22 | "E".charCodeAt(0), e3.fg = this._curAttrData.fg, e3.bg = this._curAttrData.bg, this._setCursor(0, 0);
1031
- for (let t3 = 0; t3 < this._bufferService.rows; ++t3) {
1032
- const i3 = this._activeBuffer.ybase + this._activeBuffer.y + t3, s3 = this._activeBuffer.lines.get(i3);
1033
- s3 && (s3.fill(e3), s3.isWrapped = false);
1034
- }
1035
- return this._dirtyRowTracker.markAllDirty(), this._setCursor(0, 0), true;
1036
- }
1037
- requestStatusString(e3, t3) {
1038
- const i3 = this._bufferService.buffer, s3 = this._optionsService.rawOptions;
1039
- return ((e4) => (this._coreService.triggerDataEvent(`${n2.C0.ESC}${e4}${n2.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");
1040
- }
1041
- markRangeDirty(e3, t3) {
1042
- this._dirtyRowTracker.markRangeDirty(e3, t3);
1043
- }
1044
- }
1045
- t2.InputHandler = E;
1046
- let A = class {
1047
- constructor(e3) {
1048
- this._bufferService = e3, this.clearRange();
1049
- }
1050
- clearRange() {
1051
- this.start = this._bufferService.buffer.y, this.end = this._bufferService.buffer.y;
1052
- }
1053
- markDirty(e3) {
1054
- e3 < this.start ? this.start = e3 : e3 > this.end && (this.end = e3);
1055
- }
1056
- markRangeDirty(e3, t3) {
1057
- e3 > t3 && (B = e3, e3 = t3, t3 = B), e3 < this.start && (this.start = e3), t3 > this.end && (this.end = t3);
1058
- }
1059
- markAllDirty() {
1060
- this.markRangeDirty(0, this._bufferService.rows - 1);
1061
- }
1062
- };
1063
- function L(e3) {
1064
- return 0 <= e3 && e3 < 256;
1065
- }
1066
- A = s2([r2(0, p.IBufferService)], A);
1067
- }, 844: (e2, t2) => {
1068
- function i2(e3) {
1069
- for (const t3 of e3) t3.dispose();
1070
- e3.length = 0;
1071
- }
1072
- Object.defineProperty(t2, "__esModule", { value: true }), t2.getDisposeArrayDisposable = t2.disposeArray = t2.toDisposable = t2.MutableDisposable = t2.Disposable = void 0, t2.Disposable = class {
1073
- constructor() {
1074
- this._disposables = [], this._isDisposed = false;
1075
- }
1076
- dispose() {
1077
- this._isDisposed = true;
1078
- for (const e3 of this._disposables) e3.dispose();
1079
- this._disposables.length = 0;
1080
- }
1081
- register(e3) {
1082
- return this._disposables.push(e3), e3;
1083
- }
1084
- unregister(e3) {
1085
- const t3 = this._disposables.indexOf(e3);
1086
- -1 !== t3 && this._disposables.splice(t3, 1);
1087
- }
1088
- }, t2.MutableDisposable = class {
1089
- constructor() {
1090
- this._isDisposed = false;
1091
- }
1092
- get value() {
1093
- return this._isDisposed ? void 0 : this._value;
1094
- }
1095
- set value(e3) {
1096
- this._isDisposed || e3 === this._value || (this._value?.dispose(), this._value = e3);
1097
- }
1098
- clear() {
1099
- this.value = void 0;
1100
- }
1101
- dispose() {
1102
- this._isDisposed = true, this._value?.dispose(), this._value = void 0;
1103
- }
1104
- }, t2.toDisposable = function(e3) {
1105
- return { dispose: e3 };
1106
- }, t2.disposeArray = i2, t2.getDisposeArrayDisposable = function(e3) {
1107
- return { dispose: () => i2(e3) };
1108
- };
1109
- }, 114: (e2, t2) => {
1110
- 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;
1111
- const i2 = t2.isNode ? "node" : navigator.userAgent, s2 = t2.isNode ? "node" : navigator.platform;
1112
- t2.isFirefox = i2.includes("Firefox"), t2.isLegacyEdge = i2.includes("Edge"), t2.isSafari = /^((?!chrome|android).)*safari/i.test(i2), t2.getSafariVersion = function() {
1113
- if (!t2.isSafari) return 0;
1114
- const e3 = i2.match(/Version\/(\d+)/);
1115
- return null === e3 || e3.length < 2 ? 0 : parseInt(e3[1]);
1116
- }, 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);
1117
- }, 226: (e2, t2, i2) => {
1118
- Object.defineProperty(t2, "__esModule", { value: true }), t2.DebouncedIdleTask = t2.IdleTaskQueue = t2.PriorityTaskQueue = void 0;
1119
- const s2 = i2(114);
1120
- class r2 {
1121
- constructor() {
1122
- this._tasks = [], this._i = 0;
1123
- }
1124
- enqueue(e3) {
1125
- this._tasks.push(e3), this._start();
1126
- }
1127
- flush() {
1128
- for (; this._i < this._tasks.length; ) this._tasks[this._i]() || this._i++;
1129
- this.clear();
1130
- }
1131
- clear() {
1132
- this._idleCallback && (this._cancelCallback(this._idleCallback), this._idleCallback = void 0), this._i = 0, this._tasks.length = 0;
1133
- }
1134
- _start() {
1135
- this._idleCallback || (this._idleCallback = this._requestCallback(this._process.bind(this)));
1136
- }
1137
- _process(e3) {
1138
- this._idleCallback = void 0;
1139
- let t3 = 0, i3 = 0, s3 = e3.timeRemaining(), r3 = 0;
1140
- for (; this._i < this._tasks.length; ) {
1141
- if (t3 = Date.now(), this._tasks[this._i]() || this._i++, t3 = Math.max(1, Date.now() - t3), i3 = Math.max(t3, i3), r3 = e3.timeRemaining(), 1.5 * i3 > r3) return s3 - t3 < -20 && console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s3 - t3))}ms`), void this._start();
1142
- s3 = r3;
1143
- }
1144
- this.clear();
1145
- }
1146
- }
1147
- class n2 extends r2 {
1148
- _requestCallback(e3) {
1149
- return setTimeout((() => e3(this._createDeadline(16))));
1150
- }
1151
- _cancelCallback(e3) {
1152
- clearTimeout(e3);
1153
- }
1154
- _createDeadline(e3) {
1155
- const t3 = Date.now() + e3;
1156
- return { timeRemaining: () => Math.max(0, t3 - Date.now()) };
1157
- }
1158
- }
1159
- t2.PriorityTaskQueue = n2, t2.IdleTaskQueue = !s2.isNode && "requestIdleCallback" in window ? class extends r2 {
1160
- _requestCallback(e3) {
1161
- return requestIdleCallback(e3);
1162
- }
1163
- _cancelCallback(e3) {
1164
- cancelIdleCallback(e3);
1165
- }
1166
- } : n2, t2.DebouncedIdleTask = class {
1167
- constructor() {
1168
- this._queue = new t2.IdleTaskQueue();
1169
- }
1170
- set(e3) {
1171
- this._queue.clear(), this._queue.enqueue(e3);
1172
- }
1173
- flush() {
1174
- this._queue.flush();
1175
- }
1176
- };
1177
- }, 282: (e2, t2, i2) => {
1178
- Object.defineProperty(t2, "__esModule", { value: true }), t2.updateWindowsModeWrappedState = void 0;
1179
- const s2 = i2(643);
1180
- t2.updateWindowsModeWrappedState = function(e3) {
1181
- const t3 = e3.buffer.lines.get(e3.buffer.ybase + e3.buffer.y - 1), i3 = t3?.get(e3.cols - 1), r2 = e3.buffer.lines.get(e3.buffer.ybase + e3.buffer.y);
1182
- r2 && i3 && (r2.isWrapped = i3[s2.CHAR_DATA_CODE_INDEX] !== s2.NULL_CELL_CODE && i3[s2.CHAR_DATA_CODE_INDEX] !== s2.WHITESPACE_CELL_CODE);
1183
- };
1184
- }, 734: (e2, t2) => {
1185
- Object.defineProperty(t2, "__esModule", { value: true }), t2.ExtendedAttrs = t2.AttributeData = void 0;
1186
- class i2 {
1187
- constructor() {
1188
- this.fg = 0, this.bg = 0, this.extended = new s2();
1189
- }
1190
- static toColorRGB(e3) {
1191
- return [e3 >>> 16 & 255, e3 >>> 8 & 255, 255 & e3];
1192
- }
1193
- static fromColorRGB(e3) {
1194
- return (255 & e3[0]) << 16 | (255 & e3[1]) << 8 | 255 & e3[2];
1195
- }
1196
- clone() {
1197
- const e3 = new i2();
1198
- return e3.fg = this.fg, e3.bg = this.bg, e3.extended = this.extended.clone(), e3;
1199
- }
1200
- isInverse() {
1201
- return 67108864 & this.fg;
1202
- }
1203
- isBold() {
1204
- return 134217728 & this.fg;
1205
- }
1206
- isUnderline() {
1207
- return this.hasExtendedAttrs() && 0 !== this.extended.underlineStyle ? 1 : 268435456 & this.fg;
1208
- }
1209
- isBlink() {
1210
- return 536870912 & this.fg;
1211
- }
1212
- isInvisible() {
1213
- return 1073741824 & this.fg;
1214
- }
1215
- isItalic() {
1216
- return 67108864 & this.bg;
1217
- }
1218
- isDim() {
1219
- return 134217728 & this.bg;
1220
- }
1221
- isStrikethrough() {
1222
- return 2147483648 & this.fg;
1223
- }
1224
- isProtected() {
1225
- return 536870912 & this.bg;
1226
- }
1227
- isOverline() {
1228
- return 1073741824 & this.bg;
1229
- }
1230
- getFgColorMode() {
1231
- return 50331648 & this.fg;
1232
- }
1233
- getBgColorMode() {
1234
- return 50331648 & this.bg;
1235
- }
1236
- isFgRGB() {
1237
- return 50331648 == (50331648 & this.fg);
1238
- }
1239
- isBgRGB() {
1240
- return 50331648 == (50331648 & this.bg);
1241
- }
1242
- isFgPalette() {
1243
- return 16777216 == (50331648 & this.fg) || 33554432 == (50331648 & this.fg);
1244
- }
1245
- isBgPalette() {
1246
- return 16777216 == (50331648 & this.bg) || 33554432 == (50331648 & this.bg);
1247
- }
1248
- isFgDefault() {
1249
- return 0 == (50331648 & this.fg);
1250
- }
1251
- isBgDefault() {
1252
- return 0 == (50331648 & this.bg);
1253
- }
1254
- isAttributeDefault() {
1255
- return 0 === this.fg && 0 === this.bg;
1256
- }
1257
- getFgColor() {
1258
- switch (50331648 & this.fg) {
1259
- case 16777216:
1260
- case 33554432:
1261
- return 255 & this.fg;
1262
- case 50331648:
1263
- return 16777215 & this.fg;
1264
- default:
1265
- return -1;
1266
- }
1267
- }
1268
- getBgColor() {
1269
- switch (50331648 & this.bg) {
1270
- case 16777216:
1271
- case 33554432:
1272
- return 255 & this.bg;
1273
- case 50331648:
1274
- return 16777215 & this.bg;
1275
- default:
1276
- return -1;
1277
- }
1278
- }
1279
- hasExtendedAttrs() {
1280
- return 268435456 & this.bg;
1281
- }
1282
- updateExtended() {
1283
- this.extended.isEmpty() ? this.bg &= -268435457 : this.bg |= 268435456;
1284
- }
1285
- getUnderlineColor() {
1286
- if (268435456 & this.bg && ~this.extended.underlineColor) switch (50331648 & this.extended.underlineColor) {
1287
- case 16777216:
1288
- case 33554432:
1289
- return 255 & this.extended.underlineColor;
1290
- case 50331648:
1291
- return 16777215 & this.extended.underlineColor;
1292
- default:
1293
- return this.getFgColor();
1294
- }
1295
- return this.getFgColor();
1296
- }
1297
- getUnderlineColorMode() {
1298
- return 268435456 & this.bg && ~this.extended.underlineColor ? 50331648 & this.extended.underlineColor : this.getFgColorMode();
1299
- }
1300
- isUnderlineColorRGB() {
1301
- return 268435456 & this.bg && ~this.extended.underlineColor ? 50331648 == (50331648 & this.extended.underlineColor) : this.isFgRGB();
1302
- }
1303
- isUnderlineColorPalette() {
1304
- return 268435456 & this.bg && ~this.extended.underlineColor ? 16777216 == (50331648 & this.extended.underlineColor) || 33554432 == (50331648 & this.extended.underlineColor) : this.isFgPalette();
1305
- }
1306
- isUnderlineColorDefault() {
1307
- return 268435456 & this.bg && ~this.extended.underlineColor ? 0 == (50331648 & this.extended.underlineColor) : this.isFgDefault();
1308
- }
1309
- getUnderlineStyle() {
1310
- return 268435456 & this.fg ? 268435456 & this.bg ? this.extended.underlineStyle : 1 : 0;
1311
- }
1312
- getUnderlineVariantOffset() {
1313
- return this.extended.underlineVariantOffset;
1314
- }
1315
- }
1316
- t2.AttributeData = i2;
1317
- class s2 {
1318
- get ext() {
1319
- return this._urlId ? -469762049 & this._ext | this.underlineStyle << 26 : this._ext;
1320
- }
1321
- set ext(e3) {
1322
- this._ext = e3;
1323
- }
1324
- get underlineStyle() {
1325
- return this._urlId ? 5 : (469762048 & this._ext) >> 26;
1326
- }
1327
- set underlineStyle(e3) {
1328
- this._ext &= -469762049, this._ext |= e3 << 26 & 469762048;
1329
- }
1330
- get underlineColor() {
1331
- return 67108863 & this._ext;
1332
- }
1333
- set underlineColor(e3) {
1334
- this._ext &= -67108864, this._ext |= 67108863 & e3;
1335
- }
1336
- get urlId() {
1337
- return this._urlId;
1338
- }
1339
- set urlId(e3) {
1340
- this._urlId = e3;
1341
- }
1342
- get underlineVariantOffset() {
1343
- const e3 = (3758096384 & this._ext) >> 29;
1344
- return e3 < 0 ? 4294967288 ^ e3 : e3;
1345
- }
1346
- set underlineVariantOffset(e3) {
1347
- this._ext &= 536870911, this._ext |= e3 << 29 & 3758096384;
1348
- }
1349
- constructor(e3 = 0, t3 = 0) {
1350
- this._ext = 0, this._urlId = 0, this._ext = e3, this._urlId = t3;
1351
- }
1352
- clone() {
1353
- return new s2(this._ext, this._urlId);
1354
- }
1355
- isEmpty() {
1356
- return 0 === this.underlineStyle && 0 === this._urlId;
1357
- }
1358
- }
1359
- t2.ExtendedAttrs = s2;
1360
- }, 92: (e2, t2, i2) => {
1361
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Buffer = t2.MAX_BUFFER_SIZE = void 0;
1362
- const s2 = i2(349), r2 = i2(226), n2 = i2(734), a = i2(437), o = i2(634), h = i2(511), c = i2(643), l = i2(863), _ = i2(116);
1363
- t2.MAX_BUFFER_SIZE = 4294967295, t2.Buffer = class {
1364
- constructor(e3, t3, i3) {
1365
- 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 = a.DEFAULT_ATTR_DATA.clone(), this.savedCharset = _.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 r2.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();
1366
- }
1367
- getNullCell(e3) {
1368
- 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 n2.ExtendedAttrs()), this._nullCell;
1369
- }
1370
- getWhitespaceCell(e3) {
1371
- 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 n2.ExtendedAttrs()), this._whitespaceCell;
1372
- }
1373
- getBlankLine(e3, t3) {
1374
- return new a.BufferLine(this._bufferService.cols, this.getNullCell(e3), t3);
1375
- }
1376
- get hasScrollback() {
1377
- return this._hasScrollback && this.lines.maxLength > this._rows;
1378
- }
1379
- get isCursorInViewport() {
1380
- const e3 = this.ybase + this.y - this.ydisp;
1381
- return e3 >= 0 && e3 < this._rows;
1382
- }
1383
- _getCorrectBufferLength(e3) {
1384
- if (!this._hasScrollback) return e3;
1385
- const i3 = e3 + this._optionsService.rawOptions.scrollback;
1386
- return i3 > t2.MAX_BUFFER_SIZE ? t2.MAX_BUFFER_SIZE : i3;
1387
- }
1388
- fillViewportRows(e3) {
1389
- if (0 === this.lines.length) {
1390
- void 0 === e3 && (e3 = a.DEFAULT_ATTR_DATA);
1391
- let t3 = this._rows;
1392
- for (; t3--; ) this.lines.push(this.getBlankLine(e3));
1393
- }
1394
- }
1395
- clear() {
1396
- 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();
1397
- }
1398
- resize(e3, t3) {
1399
- const i3 = this.getNullCell(a.DEFAULT_ATTR_DATA);
1400
- let s3 = 0;
1401
- const r3 = this._getCorrectBufferLength(t3);
1402
- if (r3 > this.lines.maxLength && (this.lines.maxLength = r3), this.lines.length > 0) {
1403
- if (this._cols < e3) for (let t4 = 0; t4 < this.lines.length; t4++) s3 += +this.lines.get(t4).resize(e3, i3);
1404
- let n3 = 0;
1405
- 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 a.BufferLine(e3, i3)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + n3 + 1 ? (this.ybase--, n3++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new a.BufferLine(e3, i3)));
1406
- 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++));
1407
- if (r3 < this.lines.maxLength) {
1408
- const e4 = this.lines.length - r3;
1409
- 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 = r3;
1410
- }
1411
- this.x = Math.min(this.x, e3 - 1), this.y = Math.min(this.y, t3 - 1), n3 && (this.y += n3), this.savedX = Math.min(this.savedX, e3 - 1), this.scrollTop = 0;
1412
- }
1413
- 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);
1414
- this._cols = e3, this._rows = t3, this._memoryCleanupQueue.clear(), s3 > 0.1 * this.lines.length && (this._memoryCleanupPosition = 0, this._memoryCleanupQueue.enqueue((() => this._batchedMemoryCleanup())));
1415
- }
1416
- _batchedMemoryCleanup() {
1417
- let e3 = true;
1418
- this._memoryCleanupPosition >= this.lines.length && (this._memoryCleanupPosition = 0, e3 = false);
1419
- let t3 = 0;
1420
- for (; this._memoryCleanupPosition < this.lines.length; ) if (t3 += this.lines.get(this._memoryCleanupPosition++).cleanupMemory(), t3 > 100) return true;
1421
- return e3;
1422
- }
1423
- get _isReflowEnabled() {
1424
- const e3 = this._optionsService.rawOptions.windowsPty;
1425
- return e3 && e3.buildNumber ? this._hasScrollback && "conpty" === e3.backend && e3.buildNumber >= 21376 : this._hasScrollback && !this._optionsService.rawOptions.windowsMode;
1426
- }
1427
- _reflow(e3, t3) {
1428
- this._cols !== e3 && (e3 > this._cols ? this._reflowLarger(e3, t3) : this._reflowSmaller(e3, t3));
1429
- }
1430
- _reflowLarger(e3, t3) {
1431
- const i3 = (0, o.reflowLargerGetLinesToRemove)(this.lines, this._cols, e3, this.ybase + this.y, this.getNullCell(a.DEFAULT_ATTR_DATA));
1432
- if (i3.length > 0) {
1433
- const s3 = (0, o.reflowLargerCreateNewLayout)(this.lines, i3);
1434
- (0, o.reflowLargerApplyNewLayout)(this.lines, s3.layout), this._reflowLargerAdjustViewport(e3, t3, s3.countRemoved);
1435
- }
1436
- }
1437
- _reflowLargerAdjustViewport(e3, t3, i3) {
1438
- const s3 = this.getNullCell(a.DEFAULT_ATTR_DATA);
1439
- let r3 = i3;
1440
- for (; r3-- > 0; ) 0 === this.ybase ? (this.y > 0 && this.y--, this.lines.length < t3 && this.lines.push(new a.BufferLine(e3, s3))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--);
1441
- this.savedY = Math.max(this.savedY - i3, 0);
1442
- }
1443
- _reflowSmaller(e3, t3) {
1444
- const i3 = this.getNullCell(a.DEFAULT_ATTR_DATA), s3 = [];
1445
- let r3 = 0;
1446
- for (let n3 = this.lines.length - 1; n3 >= 0; n3--) {
1447
- let h2 = this.lines.get(n3);
1448
- if (!h2 || !h2.isWrapped && h2.getTrimmedLength() <= e3) continue;
1449
- const c2 = [h2];
1450
- for (; h2.isWrapped && n3 > 0; ) h2 = this.lines.get(--n3), c2.unshift(h2);
1451
- const l2 = this.ybase + this.y;
1452
- if (l2 >= n3 && l2 < n3 + c2.length) continue;
1453
- const _2 = c2[c2.length - 1].getTrimmedLength(), d = (0, o.reflowSmallerGetNewLineLengths)(c2, this._cols, e3), f = d.length - c2.length;
1454
- let u;
1455
- u = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + f) : Math.max(0, this.lines.length - this.lines.maxLength + f);
1456
- const p = [];
1457
- for (let e4 = 0; e4 < f; e4++) {
1458
- const e5 = this.getBlankLine(a.DEFAULT_ATTR_DATA, true);
1459
- p.push(e5);
1460
- }
1461
- p.length > 0 && (s3.push({ start: n3 + c2.length + r3, newLines: p }), r3 += p.length), c2.push(...p);
1462
- let g = d.length - 1, v = d[g];
1463
- 0 === v && (g--, v = d[g]);
1464
- let b = c2.length - f - 1, S = _2;
1465
- for (; b >= 0; ) {
1466
- const e4 = Math.min(S, v);
1467
- if (void 0 === c2[g]) break;
1468
- if (c2[g].copyCellsFrom(c2[b], S - e4, v - e4, e4, true), v -= e4, 0 === v && (g--, v = d[g]), S -= e4, 0 === S) {
1469
- b--;
1470
- const e5 = Math.max(b, 0);
1471
- S = (0, o.getWrappedLineTrimmedLength)(c2, e5, this._cols);
1472
- }
1473
- }
1474
- for (let t4 = 0; t4 < c2.length; t4++) d[t4] < e3 && c2[t4].setCell(d[t4], i3);
1475
- let m = f - u;
1476
- for (; m-- > 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 + r3) - t3 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++);
1477
- this.savedY = Math.min(this.savedY + f, this.ybase + t3 - 1);
1478
- }
1479
- if (s3.length > 0) {
1480
- const e4 = [], t4 = [];
1481
- for (let e5 = 0; e5 < this.lines.length; e5++) t4.push(this.lines.get(e5));
1482
- const i4 = this.lines.length;
1483
- let n3 = i4 - 1, a2 = 0, o2 = s3[a2];
1484
- this.lines.length = Math.min(this.lines.maxLength, this.lines.length + r3);
1485
- let h2 = 0;
1486
- for (let c3 = Math.min(this.lines.maxLength - 1, i4 + r3 - 1); c3 >= 0; c3--) if (o2 && o2.start > n3 + h2) {
1487
- for (let e5 = o2.newLines.length - 1; e5 >= 0; e5--) this.lines.set(c3--, o2.newLines[e5]);
1488
- c3++, e4.push({ index: n3 + 1, amount: o2.newLines.length }), h2 += o2.newLines.length, o2 = s3[++a2];
1489
- } else this.lines.set(c3, t4[n3--]);
1490
- let c2 = 0;
1491
- for (let t5 = e4.length - 1; t5 >= 0; t5--) e4[t5].index += c2, this.lines.onInsertEmitter.fire(e4[t5]), c2 += e4[t5].amount;
1492
- const l2 = Math.max(0, i4 + r3 - this.lines.maxLength);
1493
- l2 > 0 && this.lines.onTrimEmitter.fire(l2);
1494
- }
1495
- }
1496
- translateBufferLineToString(e3, t3, i3 = 0, s3) {
1497
- const r3 = this.lines.get(e3);
1498
- return r3 ? r3.translateToString(t3, i3, s3) : "";
1499
- }
1500
- getWrappedRangeForLine(e3) {
1501
- let t3 = e3, i3 = e3;
1502
- for (; t3 > 0 && this.lines.get(t3).isWrapped; ) t3--;
1503
- for (; i3 + 1 < this.lines.length && this.lines.get(i3 + 1).isWrapped; ) i3++;
1504
- return { first: t3, last: i3 };
1505
- }
1506
- setupTabStops(e3) {
1507
- 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;
1508
- }
1509
- prevStop(e3) {
1510
- for (null == e3 && (e3 = this.x); !this.tabs[--e3] && e3 > 0; ) ;
1511
- return e3 >= this._cols ? this._cols - 1 : e3 < 0 ? 0 : e3;
1512
- }
1513
- nextStop(e3) {
1514
- for (null == e3 && (e3 = this.x); !this.tabs[++e3] && e3 < this._cols; ) ;
1515
- return e3 >= this._cols ? this._cols - 1 : e3 < 0 ? 0 : e3;
1516
- }
1517
- clearMarkers(e3) {
1518
- this._isClearing = true;
1519
- for (let t3 = 0; t3 < this.markers.length; t3++) this.markers[t3].line === e3 && (this.markers[t3].dispose(), this.markers.splice(t3--, 1));
1520
- this._isClearing = false;
1521
- }
1522
- clearAllMarkers() {
1523
- this._isClearing = true;
1524
- for (let e3 = 0; e3 < this.markers.length; e3++) this.markers[e3].dispose(), this.markers.splice(e3--, 1);
1525
- this._isClearing = false;
1526
- }
1527
- addMarker(e3) {
1528
- const t3 = new l.Marker(e3);
1529
- return this.markers.push(t3), t3.register(this.lines.onTrim(((e4) => {
1530
- t3.line -= e4, t3.line < 0 && t3.dispose();
1531
- }))), t3.register(this.lines.onInsert(((e4) => {
1532
- t3.line >= e4.index && (t3.line += e4.amount);
1533
- }))), t3.register(this.lines.onDelete(((e4) => {
1534
- t3.line >= e4.index && t3.line < e4.index + e4.amount && t3.dispose(), t3.line > e4.index && (t3.line -= e4.amount);
1535
- }))), t3.register(t3.onDispose((() => this._removeMarker(t3)))), t3;
1536
- }
1537
- _removeMarker(e3) {
1538
- this._isClearing || this.markers.splice(this.markers.indexOf(e3), 1);
1539
- }
1540
- };
1541
- }, 437: (e2, t2, i2) => {
1542
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferLine = t2.DEFAULT_ATTR_DATA = void 0;
1543
- const s2 = i2(734), r2 = i2(511), n2 = i2(643), a = i2(482);
1544
- t2.DEFAULT_ATTR_DATA = Object.freeze(new s2.AttributeData());
1545
- let o = 0;
1546
- class h {
1547
- constructor(e3, t3, i3 = false) {
1548
- this.isWrapped = i3, this._combined = {}, this._extendedAttrs = {}, this._data = new Uint32Array(3 * e3);
1549
- const s3 = t3 || r2.CellData.fromCharData([0, n2.NULL_CELL_CHAR, n2.NULL_CELL_WIDTH, n2.NULL_CELL_CODE]);
1550
- for (let t4 = 0; t4 < e3; ++t4) this.setCell(t4, s3);
1551
- this.length = e3;
1552
- }
1553
- get(e3) {
1554
- const t3 = this._data[3 * e3 + 0], i3 = 2097151 & t3;
1555
- return [this._data[3 * e3 + 1], 2097152 & t3 ? this._combined[e3] : i3 ? (0, a.stringFromCodePoint)(i3) : "", t3 >> 22, 2097152 & t3 ? this._combined[e3].charCodeAt(this._combined[e3].length - 1) : i3];
1556
- }
1557
- set(e3, t3) {
1558
- this._data[3 * e3 + 1] = t3[n2.CHAR_DATA_ATTR_INDEX], t3[n2.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e3] = t3[1], this._data[3 * e3 + 0] = 2097152 | e3 | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e3 + 0] = t3[n2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22;
1559
- }
1560
- getWidth(e3) {
1561
- return this._data[3 * e3 + 0] >> 22;
1562
- }
1563
- hasWidth(e3) {
1564
- return 12582912 & this._data[3 * e3 + 0];
1565
- }
1566
- getFg(e3) {
1567
- return this._data[3 * e3 + 1];
1568
- }
1569
- getBg(e3) {
1570
- return this._data[3 * e3 + 2];
1571
- }
1572
- hasContent(e3) {
1573
- return 4194303 & this._data[3 * e3 + 0];
1574
- }
1575
- getCodePoint(e3) {
1576
- const t3 = this._data[3 * e3 + 0];
1577
- return 2097152 & t3 ? this._combined[e3].charCodeAt(this._combined[e3].length - 1) : 2097151 & t3;
1578
- }
1579
- isCombined(e3) {
1580
- return 2097152 & this._data[3 * e3 + 0];
1581
- }
1582
- getString(e3) {
1583
- const t3 = this._data[3 * e3 + 0];
1584
- return 2097152 & t3 ? this._combined[e3] : 2097151 & t3 ? (0, a.stringFromCodePoint)(2097151 & t3) : "";
1585
- }
1586
- isProtected(e3) {
1587
- return 536870912 & this._data[3 * e3 + 2];
1588
- }
1589
- loadCell(e3, t3) {
1590
- return o = 3 * e3, t3.content = this._data[o + 0], t3.fg = this._data[o + 1], t3.bg = this._data[o + 2], 2097152 & t3.content && (t3.combinedData = this._combined[e3]), 268435456 & t3.bg && (t3.extended = this._extendedAttrs[e3]), t3;
1591
- }
1592
- setCell(e3, t3) {
1593
- 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;
1594
- }
1595
- setCellFromCodepoint(e3, t3, i3, s3) {
1596
- 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;
1597
- }
1598
- addCodepointToCell(e3, t3, i3) {
1599
- let s3 = this._data[3 * e3 + 0];
1600
- 2097152 & s3 ? this._combined[e3] += (0, a.stringFromCodePoint)(t3) : 2097151 & s3 ? (this._combined[e3] = (0, a.stringFromCodePoint)(2097151 & s3) + (0, a.stringFromCodePoint)(t3), s3 &= -2097152, s3 |= 2097152) : s3 = t3 | 1 << 22, i3 && (s3 &= -12582913, s3 |= i3 << 22), this._data[3 * e3 + 0] = s3;
1601
- }
1602
- insertCells(e3, t3, i3) {
1603
- if ((e3 %= this.length) && 2 === this.getWidth(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length - e3) {
1604
- const s3 = new r2.CellData();
1605
- for (let i4 = this.length - e3 - t3 - 1; i4 >= 0; --i4) this.setCell(e3 + t3 + i4, this.loadCell(e3 + i4, s3));
1606
- for (let s4 = 0; s4 < t3; ++s4) this.setCell(e3 + s4, i3);
1607
- } else for (let t4 = e3; t4 < this.length; ++t4) this.setCell(t4, i3);
1608
- 2 === this.getWidth(this.length - 1) && this.setCellFromCodepoint(this.length - 1, 0, 1, i3);
1609
- }
1610
- deleteCells(e3, t3, i3) {
1611
- if (e3 %= this.length, t3 < this.length - e3) {
1612
- const s3 = new r2.CellData();
1613
- for (let i4 = 0; i4 < this.length - e3 - t3; ++i4) this.setCell(e3 + i4, this.loadCell(e3 + t3 + i4, s3));
1614
- for (let e4 = this.length - t3; e4 < this.length; ++e4) this.setCell(e4, i3);
1615
- } else for (let t4 = e3; t4 < this.length; ++t4) this.setCell(t4, i3);
1616
- 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);
1617
- }
1618
- replaceCells(e3, t3, i3, s3 = false) {
1619
- 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++;
1620
- 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);
1621
- }
1622
- resize(e3, t3) {
1623
- if (e3 === this.length) return 4 * this._data.length * 2 < this._data.buffer.byteLength;
1624
- const i3 = 3 * e3;
1625
- if (e3 > this.length) {
1626
- if (this._data.buffer.byteLength >= 4 * i3) this._data = new Uint32Array(this._data.buffer, 0, i3);
1627
- else {
1628
- const e4 = new Uint32Array(i3);
1629
- e4.set(this._data), this._data = e4;
1630
- }
1631
- for (let i4 = this.length; i4 < e3; ++i4) this.setCell(i4, t3);
1632
- } else {
1633
- this._data = this._data.subarray(0, i3);
1634
- const t4 = Object.keys(this._combined);
1635
- for (let i4 = 0; i4 < t4.length; i4++) {
1636
- const s4 = parseInt(t4[i4], 10);
1637
- s4 >= e3 && delete this._combined[s4];
1638
- }
1639
- const s3 = Object.keys(this._extendedAttrs);
1640
- for (let t5 = 0; t5 < s3.length; t5++) {
1641
- const i4 = parseInt(s3[t5], 10);
1642
- i4 >= e3 && delete this._extendedAttrs[i4];
1643
- }
1644
- }
1645
- return this.length = e3, 4 * i3 * 2 < this._data.buffer.byteLength;
1646
- }
1647
- cleanupMemory() {
1648
- if (4 * this._data.length * 2 < this._data.buffer.byteLength) {
1649
- const e3 = new Uint32Array(this._data.length);
1650
- return e3.set(this._data), this._data = e3, 1;
1651
- }
1652
- return 0;
1653
- }
1654
- fill(e3, t3 = false) {
1655
- if (t3) for (let t4 = 0; t4 < this.length; ++t4) this.isProtected(t4) || this.setCell(t4, e3);
1656
- else {
1657
- this._combined = {}, this._extendedAttrs = {};
1658
- for (let t4 = 0; t4 < this.length; ++t4) this.setCell(t4, e3);
1659
- }
1660
- }
1661
- copyFrom(e3) {
1662
- this.length !== e3.length ? this._data = new Uint32Array(e3._data) : this._data.set(e3._data), this.length = e3.length, this._combined = {};
1663
- for (const t3 in e3._combined) this._combined[t3] = e3._combined[t3];
1664
- this._extendedAttrs = {};
1665
- for (const t3 in e3._extendedAttrs) this._extendedAttrs[t3] = e3._extendedAttrs[t3];
1666
- this.isWrapped = e3.isWrapped;
1667
- }
1668
- clone() {
1669
- const e3 = new h(0);
1670
- e3._data = new Uint32Array(this._data), e3.length = this.length;
1671
- for (const t3 in this._combined) e3._combined[t3] = this._combined[t3];
1672
- for (const t3 in this._extendedAttrs) e3._extendedAttrs[t3] = this._extendedAttrs[t3];
1673
- return e3.isWrapped = this.isWrapped, e3;
1674
- }
1675
- getTrimmedLength() {
1676
- for (let e3 = this.length - 1; e3 >= 0; --e3) if (4194303 & this._data[3 * e3 + 0]) return e3 + (this._data[3 * e3 + 0] >> 22);
1677
- return 0;
1678
- }
1679
- getNoBgTrimmedLength() {
1680
- 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);
1681
- return 0;
1682
- }
1683
- copyCellsFrom(e3, t3, i3, s3, r3) {
1684
- const n3 = e3._data;
1685
- if (r3) for (let r4 = s3 - 1; r4 >= 0; r4--) {
1686
- for (let e4 = 0; e4 < 3; e4++) this._data[3 * (i3 + r4) + e4] = n3[3 * (t3 + r4) + e4];
1687
- 268435456 & n3[3 * (t3 + r4) + 2] && (this._extendedAttrs[i3 + r4] = e3._extendedAttrs[t3 + r4]);
1688
- }
1689
- else for (let r4 = 0; r4 < s3; r4++) {
1690
- for (let e4 = 0; e4 < 3; e4++) this._data[3 * (i3 + r4) + e4] = n3[3 * (t3 + r4) + e4];
1691
- 268435456 & n3[3 * (t3 + r4) + 2] && (this._extendedAttrs[i3 + r4] = e3._extendedAttrs[t3 + r4]);
1692
- }
1693
- const a2 = Object.keys(e3._combined);
1694
- for (let s4 = 0; s4 < a2.length; s4++) {
1695
- const r4 = parseInt(a2[s4], 10);
1696
- r4 >= t3 && (this._combined[r4 - t3 + i3] = e3._combined[r4]);
1697
- }
1698
- }
1699
- translateToString(e3, t3, i3, s3) {
1700
- t3 = t3 ?? 0, i3 = i3 ?? this.length, e3 && (i3 = Math.min(i3, this.getTrimmedLength())), s3 && (s3.length = 0);
1701
- let r3 = "";
1702
- for (; t3 < i3; ) {
1703
- const e4 = this._data[3 * t3 + 0], i4 = 2097151 & e4, o2 = 2097152 & e4 ? this._combined[t3] : i4 ? (0, a.stringFromCodePoint)(i4) : n2.WHITESPACE_CELL_CHAR;
1704
- if (r3 += o2, s3) for (let e5 = 0; e5 < o2.length; ++e5) s3.push(t3);
1705
- t3 += e4 >> 22 || 1;
1706
- }
1707
- return s3 && s3.push(t3), r3;
1708
- }
1709
- }
1710
- t2.BufferLine = h;
1711
- }, 634: (e2, t2) => {
1712
- function i2(e3, t3, i3) {
1713
- if (t3 === e3.length - 1) return e3[t3].getTrimmedLength();
1714
- const s2 = !e3[t3].hasContent(i3 - 1) && 1 === e3[t3].getWidth(i3 - 1), r2 = 2 === e3[t3 + 1].getWidth(0);
1715
- return s2 && r2 ? i3 - 1 : i3;
1716
- }
1717
- Object.defineProperty(t2, "__esModule", { value: true }), t2.getWrappedLineTrimmedLength = t2.reflowSmallerGetNewLineLengths = t2.reflowLargerApplyNewLayout = t2.reflowLargerCreateNewLayout = t2.reflowLargerGetLinesToRemove = void 0, t2.reflowLargerGetLinesToRemove = function(e3, t3, s2, r2, n2) {
1718
- const a = [];
1719
- for (let o = 0; o < e3.length - 1; o++) {
1720
- let h = o, c = e3.get(++h);
1721
- if (!c.isWrapped) continue;
1722
- const l = [e3.get(o)];
1723
- for (; h < e3.length && c.isWrapped; ) l.push(c), c = e3.get(++h);
1724
- if (r2 >= o && r2 < h) {
1725
- o += l.length - 1;
1726
- continue;
1727
- }
1728
- let _ = 0, d = i2(l, _, t3), f = 1, u = 0;
1729
- for (; f < l.length; ) {
1730
- const e4 = i2(l, f, t3), r3 = e4 - u, a2 = s2 - d, o2 = Math.min(r3, a2);
1731
- l[_].copyCellsFrom(l[f], u, d, o2, false), d += o2, d === s2 && (_++, d = 0), u += o2, u === e4 && (f++, u = 0), 0 === d && 0 !== _ && 2 === l[_ - 1].getWidth(s2 - 1) && (l[_].copyCellsFrom(l[_ - 1], s2 - 1, d++, 1, false), l[_ - 1].setCell(s2 - 1, n2));
1732
- }
1733
- l[_].replaceCells(d, s2, n2);
1734
- let p = 0;
1735
- for (let e4 = l.length - 1; e4 > 0 && (e4 > _ || 0 === l[e4].getTrimmedLength()); e4--) p++;
1736
- p > 0 && (a.push(o + l.length - p), a.push(p)), o += l.length - 1;
1737
- }
1738
- return a;
1739
- }, t2.reflowLargerCreateNewLayout = function(e3, t3) {
1740
- const i3 = [];
1741
- let s2 = 0, r2 = t3[s2], n2 = 0;
1742
- for (let a = 0; a < e3.length; a++) if (r2 === a) {
1743
- const i4 = t3[++s2];
1744
- e3.onDeleteEmitter.fire({ index: a - n2, amount: i4 }), a += i4 - 1, n2 += i4, r2 = t3[++s2];
1745
- } else i3.push(a);
1746
- return { layout: i3, countRemoved: n2 };
1747
- }, t2.reflowLargerApplyNewLayout = function(e3, t3) {
1748
- const i3 = [];
1749
- for (let s2 = 0; s2 < t3.length; s2++) i3.push(e3.get(t3[s2]));
1750
- for (let t4 = 0; t4 < i3.length; t4++) e3.set(t4, i3[t4]);
1751
- e3.length = t3.length;
1752
- }, t2.reflowSmallerGetNewLineLengths = function(e3, t3, s2) {
1753
- const r2 = [], n2 = e3.map(((s3, r3) => i2(e3, r3, t3))).reduce(((e4, t4) => e4 + t4));
1754
- let a = 0, o = 0, h = 0;
1755
- for (; h < n2; ) {
1756
- if (n2 - h < s2) {
1757
- r2.push(n2 - h);
1758
- break;
1759
- }
1760
- a += s2;
1761
- const c = i2(e3, o, t3);
1762
- a > c && (a -= c, o++);
1763
- const l = 2 === e3[o].getWidth(a - 1);
1764
- l && a--;
1765
- const _ = l ? s2 - 1 : s2;
1766
- r2.push(_), h += _;
1767
- }
1768
- return r2;
1769
- }, t2.getWrappedLineTrimmedLength = i2;
1770
- }, 295: (e2, t2, i2) => {
1771
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferSet = void 0;
1772
- const s2 = i2(460), r2 = i2(844), n2 = i2(92);
1773
- class a extends r2.Disposable {
1774
- constructor(e3, t3) {
1775
- 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())));
1776
- }
1777
- reset() {
1778
- this._normal = new n2.Buffer(true, this._optionsService, this._bufferService), this._normal.fillViewportRows(), this._alt = new n2.Buffer(false, this._optionsService, this._bufferService), this._activeBuffer = this._normal, this._onBufferActivate.fire({ activeBuffer: this._normal, inactiveBuffer: this._alt }), this.setupTabStops();
1779
- }
1780
- get alt() {
1781
- return this._alt;
1782
- }
1783
- get active() {
1784
- return this._activeBuffer;
1785
- }
1786
- get normal() {
1787
- return this._normal;
1788
- }
1789
- activateNormalBuffer() {
1790
- 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 }));
1791
- }
1792
- activateAltBuffer(e3) {
1793
- 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 }));
1794
- }
1795
- resize(e3, t3) {
1796
- this._normal.resize(e3, t3), this._alt.resize(e3, t3), this.setupTabStops(e3);
1797
- }
1798
- setupTabStops(e3) {
1799
- this._normal.setupTabStops(e3), this._alt.setupTabStops(e3);
1800
- }
1801
- }
1802
- t2.BufferSet = a;
1803
- }, 511: (e2, t2, i2) => {
1804
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CellData = void 0;
1805
- const s2 = i2(482), r2 = i2(643), n2 = i2(734);
1806
- class a extends n2.AttributeData {
1807
- constructor() {
1808
- super(...arguments), this.content = 0, this.fg = 0, this.bg = 0, this.extended = new n2.ExtendedAttrs(), this.combinedData = "";
1809
- }
1810
- static fromCharData(e3) {
1811
- const t3 = new a();
1812
- return t3.setFromCharData(e3), t3;
1813
- }
1814
- isCombined() {
1815
- return 2097152 & this.content;
1816
- }
1817
- getWidth() {
1818
- return this.content >> 22;
1819
- }
1820
- getChars() {
1821
- return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0, s2.stringFromCodePoint)(2097151 & this.content) : "";
1822
- }
1823
- getCode() {
1824
- return this.isCombined() ? this.combinedData.charCodeAt(this.combinedData.length - 1) : 2097151 & this.content;
1825
- }
1826
- setFromCharData(e3) {
1827
- this.fg = e3[r2.CHAR_DATA_ATTR_INDEX], this.bg = 0;
1828
- let t3 = false;
1829
- if (e3[r2.CHAR_DATA_CHAR_INDEX].length > 2) t3 = true;
1830
- else if (2 === e3[r2.CHAR_DATA_CHAR_INDEX].length) {
1831
- const i3 = e3[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(0);
1832
- if (55296 <= i3 && i3 <= 56319) {
1833
- const s3 = e3[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(1);
1834
- 56320 <= s3 && s3 <= 57343 ? this.content = 1024 * (i3 - 55296) + s3 - 56320 + 65536 | e3[r2.CHAR_DATA_WIDTH_INDEX] << 22 : t3 = true;
1835
- } else t3 = true;
1836
- } else this.content = e3[r2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | e3[r2.CHAR_DATA_WIDTH_INDEX] << 22;
1837
- t3 && (this.combinedData = e3[r2.CHAR_DATA_CHAR_INDEX], this.content = 2097152 | e3[r2.CHAR_DATA_WIDTH_INDEX] << 22);
1838
- }
1839
- getAsCharData() {
1840
- return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
1841
- }
1842
- }
1843
- t2.CellData = a;
1844
- }, 643: (e2, t2) => {
1845
- 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;
1846
- }, 863: (e2, t2, i2) => {
1847
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Marker = void 0;
1848
- const s2 = i2(460), r2 = i2(844);
1849
- class n2 {
1850
- get id() {
1851
- return this._id;
1852
- }
1853
- constructor(e3) {
1854
- this.line = e3, this.isDisposed = false, this._disposables = [], this._id = n2._nextId++, this._onDispose = this.register(new s2.EventEmitter()), this.onDispose = this._onDispose.event;
1855
- }
1856
- dispose() {
1857
- this.isDisposed || (this.isDisposed = true, this.line = -1, this._onDispose.fire(), (0, r2.disposeArray)(this._disposables), this._disposables.length = 0);
1858
- }
1859
- register(e3) {
1860
- return this._disposables.push(e3), e3;
1861
- }
1862
- }
1863
- t2.Marker = n2, n2._nextId = 1;
1864
- }, 116: (e2, t2) => {
1865
- 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" };
1866
- }, 584: (e2, t2) => {
1867
- var i2, s2, r2;
1868
- Object.defineProperty(t2, "__esModule", { value: true }), t2.C1_ESCAPED = t2.C1 = t2.C0 = void 0, (function(e3) {
1869
- 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";
1870
- })(i2 || (t2.C0 = i2 = {})), (function(e3) {
1871
- 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";
1872
- })(s2 || (t2.C1 = s2 = {})), (function(e3) {
1873
- e3.ST = `${i2.ESC}\\`;
1874
- })(r2 || (t2.C1_ESCAPED = r2 = {}));
1875
- }, 482: (e2, t2) => {
1876
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Utf8ToUtf32 = t2.StringToUtf32 = t2.utf32ToString = t2.stringFromCodePoint = void 0, t2.stringFromCodePoint = function(e3) {
1877
- return e3 > 65535 ? (e3 -= 65536, String.fromCharCode(55296 + (e3 >> 10)) + String.fromCharCode(e3 % 1024 + 56320)) : String.fromCharCode(e3);
1878
- }, t2.utf32ToString = function(e3, t3 = 0, i2 = e3.length) {
1879
- let s2 = "";
1880
- for (let r2 = t3; r2 < i2; ++r2) {
1881
- let t4 = e3[r2];
1882
- t4 > 65535 ? (t4 -= 65536, s2 += String.fromCharCode(55296 + (t4 >> 10)) + String.fromCharCode(t4 % 1024 + 56320)) : s2 += String.fromCharCode(t4);
1883
- }
1884
- return s2;
1885
- }, t2.StringToUtf32 = class {
1886
- constructor() {
1887
- this._interim = 0;
1888
- }
1889
- clear() {
1890
- this._interim = 0;
1891
- }
1892
- decode(e3, t3) {
1893
- const i2 = e3.length;
1894
- if (!i2) return 0;
1895
- let s2 = 0, r2 = 0;
1896
- if (this._interim) {
1897
- const i3 = e3.charCodeAt(r2++);
1898
- 56320 <= i3 && i3 <= 57343 ? t3[s2++] = 1024 * (this._interim - 55296) + i3 - 56320 + 65536 : (t3[s2++] = this._interim, t3[s2++] = i3), this._interim = 0;
1899
- }
1900
- for (let n2 = r2; n2 < i2; ++n2) {
1901
- const r3 = e3.charCodeAt(n2);
1902
- if (55296 <= r3 && r3 <= 56319) {
1903
- if (++n2 >= i2) return this._interim = r3, s2;
1904
- const a = e3.charCodeAt(n2);
1905
- 56320 <= a && a <= 57343 ? t3[s2++] = 1024 * (r3 - 55296) + a - 56320 + 65536 : (t3[s2++] = r3, t3[s2++] = a);
1906
- } else 65279 !== r3 && (t3[s2++] = r3);
1907
- }
1908
- return s2;
1909
- }
1910
- }, t2.Utf8ToUtf32 = class {
1911
- constructor() {
1912
- this.interim = new Uint8Array(3);
1913
- }
1914
- clear() {
1915
- this.interim.fill(0);
1916
- }
1917
- decode(e3, t3) {
1918
- const i2 = e3.length;
1919
- if (!i2) return 0;
1920
- let s2, r2, n2, a, o = 0, h = 0, c = 0;
1921
- if (this.interim[0]) {
1922
- let s3 = false, r3 = this.interim[0];
1923
- r3 &= 192 == (224 & r3) ? 31 : 224 == (240 & r3) ? 15 : 7;
1924
- let n3, a2 = 0;
1925
- for (; (n3 = 63 & this.interim[++a2]) && a2 < 4; ) r3 <<= 6, r3 |= n3;
1926
- const h2 = 192 == (224 & this.interim[0]) ? 2 : 224 == (240 & this.interim[0]) ? 3 : 4, l2 = h2 - a2;
1927
- for (; c < l2; ) {
1928
- if (c >= i2) return 0;
1929
- if (n3 = e3[c++], 128 != (192 & n3)) {
1930
- c--, s3 = true;
1931
- break;
1932
- }
1933
- this.interim[a2++] = n3, r3 <<= 6, r3 |= 63 & n3;
1934
- }
1935
- s3 || (2 === h2 ? r3 < 128 ? c-- : t3[o++] = r3 : 3 === h2 ? r3 < 2048 || r3 >= 55296 && r3 <= 57343 || 65279 === r3 || (t3[o++] = r3) : r3 < 65536 || r3 > 1114111 || (t3[o++] = r3)), this.interim.fill(0);
1936
- }
1937
- const l = i2 - 4;
1938
- let _ = c;
1939
- for (; _ < i2; ) {
1940
- for (; !(!(_ < l) || 128 & (s2 = e3[_]) || 128 & (r2 = e3[_ + 1]) || 128 & (n2 = e3[_ + 2]) || 128 & (a = e3[_ + 3])); ) t3[o++] = s2, t3[o++] = r2, t3[o++] = n2, t3[o++] = a, _ += 4;
1941
- if (s2 = e3[_++], s2 < 128) t3[o++] = s2;
1942
- else if (192 == (224 & s2)) {
1943
- if (_ >= i2) return this.interim[0] = s2, o;
1944
- if (r2 = e3[_++], 128 != (192 & r2)) {
1945
- _--;
1946
- continue;
1947
- }
1948
- if (h = (31 & s2) << 6 | 63 & r2, h < 128) {
1949
- _--;
1950
- continue;
1951
- }
1952
- t3[o++] = h;
1953
- } else if (224 == (240 & s2)) {
1954
- if (_ >= i2) return this.interim[0] = s2, o;
1955
- if (r2 = e3[_++], 128 != (192 & r2)) {
1956
- _--;
1957
- continue;
1958
- }
1959
- if (_ >= i2) return this.interim[0] = s2, this.interim[1] = r2, o;
1960
- if (n2 = e3[_++], 128 != (192 & n2)) {
1961
- _--;
1962
- continue;
1963
- }
1964
- if (h = (15 & s2) << 12 | (63 & r2) << 6 | 63 & n2, h < 2048 || h >= 55296 && h <= 57343 || 65279 === h) continue;
1965
- t3[o++] = h;
1966
- } else if (240 == (248 & s2)) {
1967
- if (_ >= i2) return this.interim[0] = s2, o;
1968
- if (r2 = e3[_++], 128 != (192 & r2)) {
1969
- _--;
1970
- continue;
1971
- }
1972
- if (_ >= i2) return this.interim[0] = s2, this.interim[1] = r2, o;
1973
- if (n2 = e3[_++], 128 != (192 & n2)) {
1974
- _--;
1975
- continue;
1976
- }
1977
- if (_ >= i2) return this.interim[0] = s2, this.interim[1] = r2, this.interim[2] = n2, o;
1978
- if (a = e3[_++], 128 != (192 & a)) {
1979
- _--;
1980
- continue;
1981
- }
1982
- if (h = (7 & s2) << 18 | (63 & r2) << 12 | (63 & n2) << 6 | 63 & a, h < 65536 || h > 1114111) continue;
1983
- t3[o++] = h;
1984
- }
1985
- }
1986
- return o;
1987
- }
1988
- };
1989
- }, 225: (e2, t2, i2) => {
1990
- Object.defineProperty(t2, "__esModule", { value: true }), t2.UnicodeV6 = void 0;
1991
- const s2 = i2(480), r2 = [[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]], n2 = [[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]];
1992
- let a;
1993
- t2.UnicodeV6 = class {
1994
- constructor() {
1995
- if (this.version = "6", !a) {
1996
- a = new Uint8Array(65536), a.fill(1), a[0] = 0, a.fill(0, 1, 32), a.fill(0, 127, 160), a.fill(2, 4352, 4448), a[9001] = 2, a[9002] = 2, a.fill(2, 11904, 42192), a[12351] = 1, a.fill(2, 44032, 55204), a.fill(2, 63744, 64256), a.fill(2, 65040, 65050), a.fill(2, 65072, 65136), a.fill(2, 65280, 65377), a.fill(2, 65504, 65511);
1997
- for (let e3 = 0; e3 < r2.length; ++e3) a.fill(0, r2[e3][0], r2[e3][1] + 1);
1998
- }
1999
- }
2000
- wcwidth(e3) {
2001
- return e3 < 32 ? 0 : e3 < 127 ? 1 : e3 < 65536 ? a[e3] : (function(e4, t3) {
2002
- let i3, s3 = 0, r3 = t3.length - 1;
2003
- if (e4 < t3[0][0] || e4 > t3[r3][1]) return false;
2004
- for (; r3 >= s3; ) if (i3 = s3 + r3 >> 1, e4 > t3[i3][1]) s3 = i3 + 1;
2005
- else {
2006
- if (!(e4 < t3[i3][0])) return true;
2007
- r3 = i3 - 1;
2008
- }
2009
- return false;
2010
- })(e3, n2) ? 0 : e3 >= 131072 && e3 <= 196605 || e3 >= 196608 && e3 <= 262141 ? 2 : 1;
2011
- }
2012
- charProperties(e3, t3) {
2013
- let i3 = this.wcwidth(e3), r3 = 0 === i3 && 0 !== t3;
2014
- if (r3) {
2015
- const e4 = s2.UnicodeService.extractWidth(t3);
2016
- 0 === e4 ? r3 = false : e4 > i3 && (i3 = e4);
2017
- }
2018
- return s2.UnicodeService.createPropertyValue(0, i3, r3);
2019
- }
2020
- };
2021
- }, 981: (e2, t2, i2) => {
2022
- Object.defineProperty(t2, "__esModule", { value: true }), t2.WriteBuffer = void 0;
2023
- const s2 = i2(460), r2 = i2(844);
2024
- class n2 extends r2.Disposable {
2025
- constructor(e3) {
2026
- 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;
2027
- }
2028
- handleUserInput() {
2029
- this._didUserInput = true;
2030
- }
2031
- writeSync(e3, t3) {
2032
- if (void 0 !== t3 && this._syncCalls > t3) return void (this._syncCalls = 0);
2033
- if (this._pendingData += e3.length, this._writeBuffer.push(e3), this._callbacks.push(void 0), this._syncCalls++, this._isSyncWriting) return;
2034
- let i3;
2035
- for (this._isSyncWriting = true; i3 = this._writeBuffer.shift(); ) {
2036
- this._action(i3);
2037
- const e4 = this._callbacks.shift();
2038
- e4 && e4();
2039
- }
2040
- this._pendingData = 0, this._bufferOffset = 2147483647, this._isSyncWriting = false, this._syncCalls = 0;
2041
- }
2042
- write(e3, t3) {
2043
- if (this._pendingData > 5e7) throw new Error("write data discarded, use flow control to avoid losing data");
2044
- if (!this._writeBuffer.length) {
2045
- 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();
2046
- setTimeout((() => this._innerWrite()));
2047
- }
2048
- this._pendingData += e3.length, this._writeBuffer.push(e3), this._callbacks.push(t3);
2049
- }
2050
- _innerWrite(e3 = 0, t3 = true) {
2051
- const i3 = e3 || Date.now();
2052
- for (; this._writeBuffer.length > this._bufferOffset; ) {
2053
- const e4 = this._writeBuffer[this._bufferOffset], s3 = this._action(e4, t3);
2054
- if (s3) {
2055
- const e5 = (e6) => Date.now() - i3 >= 12 ? setTimeout((() => this._innerWrite(0, e6))) : this._innerWrite(i3, e6);
2056
- return void s3.catch(((e6) => (queueMicrotask((() => {
2057
- throw e6;
2058
- })), Promise.resolve(false)))).then(e5);
2059
- }
2060
- const r3 = this._callbacks[this._bufferOffset];
2061
- if (r3 && r3(), this._bufferOffset++, this._pendingData -= e4.length, Date.now() - i3 >= 12) break;
2062
- }
2063
- 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();
2064
- }
2065
- }
2066
- t2.WriteBuffer = n2;
2067
- }, 941: (e2, t2) => {
2068
- Object.defineProperty(t2, "__esModule", { value: true }), t2.toRgbString = t2.parseColor = void 0;
2069
- 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]+$/;
2070
- function r2(e3, t3) {
2071
- const i3 = e3.toString(16), s3 = i3.length < 2 ? "0" + i3 : i3;
2072
- switch (t3) {
2073
- case 4:
2074
- return i3[0];
2075
- case 8:
2076
- return s3;
2077
- case 12:
2078
- return (s3 + s3).slice(0, 3);
2079
- default:
2080
- return s3 + s3;
2081
- }
2082
- }
2083
- t2.parseColor = function(e3) {
2084
- if (!e3) return;
2085
- let t3 = e3.toLowerCase();
2086
- if (0 === t3.indexOf("rgb:")) {
2087
- t3 = t3.slice(4);
2088
- const e4 = i2.exec(t3);
2089
- if (e4) {
2090
- const t4 = e4[1] ? 15 : e4[4] ? 255 : e4[7] ? 4095 : 65535;
2091
- 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)];
2092
- }
2093
- } else if (0 === t3.indexOf("#") && (t3 = t3.slice(1), s2.exec(t3) && [3, 6, 9, 12].includes(t3.length))) {
2094
- const e4 = t3.length / 3, i3 = [0, 0, 0];
2095
- for (let s3 = 0; s3 < 3; ++s3) {
2096
- const r3 = parseInt(t3.slice(e4 * s3, e4 * s3 + e4), 16);
2097
- i3[s3] = 1 === e4 ? r3 << 4 : 2 === e4 ? r3 : 3 === e4 ? r3 >> 4 : r3 >> 8;
2098
- }
2099
- return i3;
2100
- }
2101
- }, t2.toRgbString = function(e3, t3 = 16) {
2102
- const [i3, s3, n2] = e3;
2103
- return `rgb:${r2(i3, t3)}/${r2(s3, t3)}/${r2(n2, t3)}`;
2104
- };
2105
- }, 770: (e2, t2) => {
2106
- Object.defineProperty(t2, "__esModule", { value: true }), t2.PAYLOAD_LIMIT = void 0, t2.PAYLOAD_LIMIT = 1e7;
2107
- }, 351: (e2, t2, i2) => {
2108
- Object.defineProperty(t2, "__esModule", { value: true }), t2.DcsHandler = t2.DcsParser = void 0;
2109
- const s2 = i2(482), r2 = i2(742), n2 = i2(770), a = [];
2110
- t2.DcsParser = class {
2111
- constructor() {
2112
- this._handlers = /* @__PURE__ */ Object.create(null), this._active = a, this._ident = 0, this._handlerFb = () => {
2113
- }, this._stack = { paused: false, loopPosition: 0, fallThrough: false };
2114
- }
2115
- dispose() {
2116
- this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
2117
- }, this._active = a;
2118
- }
2119
- registerHandler(e3, t3) {
2120
- void 0 === this._handlers[e3] && (this._handlers[e3] = []);
2121
- const i3 = this._handlers[e3];
2122
- return i3.push(t3), { dispose: () => {
2123
- const e4 = i3.indexOf(t3);
2124
- -1 !== e4 && i3.splice(e4, 1);
2125
- } };
2126
- }
2127
- clearHandler(e3) {
2128
- this._handlers[e3] && delete this._handlers[e3];
2129
- }
2130
- setHandlerFallback(e3) {
2131
- this._handlerFb = e3;
2132
- }
2133
- reset() {
2134
- 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);
2135
- this._stack.paused = false, this._active = a, this._ident = 0;
2136
- }
2137
- hook(e3, t3) {
2138
- if (this.reset(), this._ident = e3, this._active = this._handlers[e3] || a, this._active.length) for (let e4 = this._active.length - 1; e4 >= 0; e4--) this._active[e4].hook(t3);
2139
- else this._handlerFb(this._ident, "HOOK", t3);
2140
- }
2141
- put(e3, t3, i3) {
2142
- if (this._active.length) for (let s3 = this._active.length - 1; s3 >= 0; s3--) this._active[s3].put(e3, t3, i3);
2143
- else this._handlerFb(this._ident, "PUT", (0, s2.utf32ToString)(e3, t3, i3));
2144
- }
2145
- unhook(e3, t3 = true) {
2146
- if (this._active.length) {
2147
- let i3 = false, s3 = this._active.length - 1, r3 = false;
2148
- if (this._stack.paused && (s3 = this._stack.loopPosition - 1, i3 = t3, r3 = this._stack.fallThrough, this._stack.paused = false), !r3 && false === i3) {
2149
- 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;
2150
- s3--;
2151
- }
2152
- 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;
2153
- } else this._handlerFb(this._ident, "UNHOOK", e3);
2154
- this._active = a, this._ident = 0;
2155
- }
2156
- };
2157
- const o = new r2.Params();
2158
- o.addParam(0), t2.DcsHandler = class {
2159
- constructor(e3) {
2160
- this._handler = e3, this._data = "", this._params = o, this._hitLimit = false;
2161
- }
2162
- hook(e3) {
2163
- this._params = e3.length > 1 || e3.params[0] ? e3.clone() : o, this._data = "", this._hitLimit = false;
2164
- }
2165
- put(e3, t3, i3) {
2166
- this._hitLimit || (this._data += (0, s2.utf32ToString)(e3, t3, i3), this._data.length > n2.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true));
2167
- }
2168
- unhook(e3) {
2169
- let t3 = false;
2170
- if (this._hitLimit) t3 = false;
2171
- else if (e3 && (t3 = this._handler(this._data, this._params), t3 instanceof Promise)) return t3.then(((e4) => (this._params = o, this._data = "", this._hitLimit = false, e4)));
2172
- return this._params = o, this._data = "", this._hitLimit = false, t3;
2173
- }
2174
- };
2175
- }, 15: (e2, t2, i2) => {
2176
- Object.defineProperty(t2, "__esModule", { value: true }), t2.EscapeSequenceParser = t2.VT500_TRANSITION_TABLE = t2.TransitionTable = void 0;
2177
- const s2 = i2(844), r2 = i2(742), n2 = i2(242), a = i2(351);
2178
- class o {
2179
- constructor(e3) {
2180
- this.table = new Uint8Array(e3);
2181
- }
2182
- setDefault(e3, t3) {
2183
- this.table.fill(e3 << 4 | t3);
2184
- }
2185
- add(e3, t3, i3, s3) {
2186
- this.table[t3 << 8 | e3] = i3 << 4 | s3;
2187
- }
2188
- addMany(e3, t3, i3, s3) {
2189
- for (let r3 = 0; r3 < e3.length; r3++) this.table[t3 << 8 | e3[r3]] = i3 << 4 | s3;
2190
- }
2191
- }
2192
- t2.TransitionTable = o;
2193
- const h = 160;
2194
- t2.VT500_TRANSITION_TABLE = (function() {
2195
- const e3 = new o(4095), t3 = Array.apply(null, Array(256)).map(((e4, t4) => t4)), i3 = (e4, i4) => t3.slice(e4, i4), s3 = i3(32, 127), r3 = i3(0, 24);
2196
- r3.push(25), r3.push.apply(r3, i3(28, 32));
2197
- const n3 = i3(0, 14);
2198
- let a2;
2199
- for (a2 in e3.setDefault(1, 0), e3.addMany(s3, 0, 2, 0), n3) e3.addMany([24, 26, 153, 154], a2, 3, 0), e3.addMany(i3(128, 144), a2, 3, 0), e3.addMany(i3(144, 152), a2, 3, 0), e3.add(156, a2, 0, 0), e3.add(27, a2, 11, 1), e3.add(157, a2, 4, 8), e3.addMany([152, 158, 159], a2, 0, 7), e3.add(155, a2, 11, 3), e3.add(144, a2, 11, 9);
2200
- return e3.addMany(r3, 0, 3, 0), e3.addMany(r3, 1, 3, 1), e3.add(127, 1, 0, 1), e3.addMany(r3, 8, 0, 8), e3.addMany(r3, 3, 3, 3), e3.add(127, 3, 0, 3), e3.addMany(r3, 4, 3, 4), e3.add(127, 4, 0, 4), e3.addMany(r3, 6, 3, 6), e3.addMany(r3, 5, 3, 5), e3.add(127, 5, 0, 5), e3.addMany(r3, 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(r3, 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(r3, 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(r3, 11, 0, 11), e3.addMany(i3(32, 128), 11, 0, 11), e3.addMany(i3(28, 32), 11, 0, 11), e3.addMany(r3, 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(r3, 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(r3, 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;
2201
- })();
2202
- class c extends s2.Disposable {
2203
- constructor(e3 = t2.VT500_TRANSITION_TABLE) {
2204
- 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 r2.Params(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0, this._printHandlerFb = (e4, t3, i3) => {
2205
- }, this._executeHandlerFb = (e4) => {
2206
- }, this._csiHandlerFb = (e4, t3) => {
2207
- }, this._escHandlerFb = (e4) => {
2208
- }, 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)((() => {
2209
- this._csiHandlers = /* @__PURE__ */ Object.create(null), this._executeHandlers = /* @__PURE__ */ Object.create(null), this._escHandlers = /* @__PURE__ */ Object.create(null);
2210
- }))), this._oscParser = this.register(new n2.OscParser()), this._dcsParser = this.register(new a.DcsParser()), this._errorHandler = this._errorHandlerFb, this.registerEscHandler({ final: "\\" }, (() => true));
2211
- }
2212
- _identifier(e3, t3 = [64, 126]) {
2213
- let i3 = 0;
2214
- if (e3.prefix) {
2215
- if (e3.prefix.length > 1) throw new Error("only one byte as prefix supported");
2216
- if (i3 = e3.prefix.charCodeAt(0), i3 && 60 > i3 || i3 > 63) throw new Error("prefix must be in range 0x3c .. 0x3f");
2217
- }
2218
- if (e3.intermediates) {
2219
- if (e3.intermediates.length > 2) throw new Error("only two bytes as intermediates are supported");
2220
- for (let t4 = 0; t4 < e3.intermediates.length; ++t4) {
2221
- const s4 = e3.intermediates.charCodeAt(t4);
2222
- if (32 > s4 || s4 > 47) throw new Error("intermediate must be in range 0x20 .. 0x2f");
2223
- i3 <<= 8, i3 |= s4;
2224
- }
2225
- }
2226
- if (1 !== e3.final.length) throw new Error("final must be a single byte");
2227
- const s3 = e3.final.charCodeAt(0);
2228
- if (t3[0] > s3 || s3 > t3[1]) throw new Error(`final must be in range ${t3[0]} .. ${t3[1]}`);
2229
- return i3 <<= 8, i3 |= s3, i3;
2230
- }
2231
- identToString(e3) {
2232
- const t3 = [];
2233
- for (; e3; ) t3.push(String.fromCharCode(255 & e3)), e3 >>= 8;
2234
- return t3.reverse().join("");
2235
- }
2236
- setPrintHandler(e3) {
2237
- this._printHandler = e3;
2238
- }
2239
- clearPrintHandler() {
2240
- this._printHandler = this._printHandlerFb;
2241
- }
2242
- registerEscHandler(e3, t3) {
2243
- const i3 = this._identifier(e3, [48, 126]);
2244
- void 0 === this._escHandlers[i3] && (this._escHandlers[i3] = []);
2245
- const s3 = this._escHandlers[i3];
2246
- return s3.push(t3), { dispose: () => {
2247
- const e4 = s3.indexOf(t3);
2248
- -1 !== e4 && s3.splice(e4, 1);
2249
- } };
2250
- }
2251
- clearEscHandler(e3) {
2252
- this._escHandlers[this._identifier(e3, [48, 126])] && delete this._escHandlers[this._identifier(e3, [48, 126])];
2253
- }
2254
- setEscHandlerFallback(e3) {
2255
- this._escHandlerFb = e3;
2256
- }
2257
- setExecuteHandler(e3, t3) {
2258
- this._executeHandlers[e3.charCodeAt(0)] = t3;
2259
- }
2260
- clearExecuteHandler(e3) {
2261
- this._executeHandlers[e3.charCodeAt(0)] && delete this._executeHandlers[e3.charCodeAt(0)];
2262
- }
2263
- setExecuteHandlerFallback(e3) {
2264
- this._executeHandlerFb = e3;
2265
- }
2266
- registerCsiHandler(e3, t3) {
2267
- const i3 = this._identifier(e3);
2268
- void 0 === this._csiHandlers[i3] && (this._csiHandlers[i3] = []);
2269
- const s3 = this._csiHandlers[i3];
2270
- return s3.push(t3), { dispose: () => {
2271
- const e4 = s3.indexOf(t3);
2272
- -1 !== e4 && s3.splice(e4, 1);
2273
- } };
2274
- }
2275
- clearCsiHandler(e3) {
2276
- this._csiHandlers[this._identifier(e3)] && delete this._csiHandlers[this._identifier(e3)];
2277
- }
2278
- setCsiHandlerFallback(e3) {
2279
- this._csiHandlerFb = e3;
2280
- }
2281
- registerDcsHandler(e3, t3) {
2282
- return this._dcsParser.registerHandler(this._identifier(e3), t3);
2283
- }
2284
- clearDcsHandler(e3) {
2285
- this._dcsParser.clearHandler(this._identifier(e3));
2286
- }
2287
- setDcsHandlerFallback(e3) {
2288
- this._dcsParser.setHandlerFallback(e3);
2289
- }
2290
- registerOscHandler(e3, t3) {
2291
- return this._oscParser.registerHandler(e3, t3);
2292
- }
2293
- clearOscHandler(e3) {
2294
- this._oscParser.clearHandler(e3);
2295
- }
2296
- setOscHandlerFallback(e3) {
2297
- this._oscParser.setHandlerFallback(e3);
2298
- }
2299
- setErrorHandler(e3) {
2300
- this._errorHandler = e3;
2301
- }
2302
- clearErrorHandler() {
2303
- this._errorHandler = this._errorHandlerFb;
2304
- }
2305
- reset() {
2306
- 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 = []);
2307
- }
2308
- _preserveStack(e3, t3, i3, s3, r3) {
2309
- this._parseStack.state = e3, this._parseStack.handlers = t3, this._parseStack.handlerPos = i3, this._parseStack.transition = s3, this._parseStack.chunkPos = r3;
2310
- }
2311
- parse(e3, t3, i3) {
2312
- let s3, r3 = 0, n3 = 0, a2 = 0;
2313
- if (this._parseStack.state) if (2 === this._parseStack.state) this._parseStack.state = 0, a2 = this._parseStack.chunkPos + 1;
2314
- else {
2315
- 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");
2316
- const t4 = this._parseStack.handlers;
2317
- let n4 = this._parseStack.handlerPos - 1;
2318
- switch (this._parseStack.state) {
2319
- case 3:
2320
- if (false === i3 && n4 > -1) {
2321
- for (; n4 >= 0 && (s3 = t4[n4](this._params), true !== s3); n4--) if (s3 instanceof Promise) return this._parseStack.handlerPos = n4, s3;
2322
- }
2323
- this._parseStack.handlers = [];
2324
- break;
2325
- case 4:
2326
- if (false === i3 && n4 > -1) {
2327
- for (; n4 >= 0 && (s3 = t4[n4](), true !== s3); n4--) if (s3 instanceof Promise) return this._parseStack.handlerPos = n4, s3;
2328
- }
2329
- this._parseStack.handlers = [];
2330
- break;
2331
- case 6:
2332
- if (r3 = e3[this._parseStack.chunkPos], s3 = this._dcsParser.unhook(24 !== r3 && 26 !== r3, i3), s3) return s3;
2333
- 27 === r3 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0;
2334
- break;
2335
- case 5:
2336
- if (r3 = e3[this._parseStack.chunkPos], s3 = this._oscParser.end(24 !== r3 && 26 !== r3, i3), s3) return s3;
2337
- 27 === r3 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0;
2338
- }
2339
- this._parseStack.state = 0, a2 = this._parseStack.chunkPos + 1, this.precedingJoinState = 0, this.currentState = 15 & this._parseStack.transition;
2340
- }
2341
- for (let i4 = a2; i4 < t3; ++i4) {
2342
- switch (r3 = e3[i4], n3 = this._transitions.table[this.currentState << 8 | (r3 < 160 ? r3 : h)], n3 >> 4) {
2343
- case 2:
2344
- for (let s4 = i4 + 1; ; ++s4) {
2345
- if (s4 >= t3 || (r3 = e3[s4]) < 32 || r3 > 126 && r3 < h) {
2346
- this._printHandler(e3, i4, s4), i4 = s4 - 1;
2347
- break;
2348
- }
2349
- if (++s4 >= t3 || (r3 = e3[s4]) < 32 || r3 > 126 && r3 < h) {
2350
- this._printHandler(e3, i4, s4), i4 = s4 - 1;
2351
- break;
2352
- }
2353
- if (++s4 >= t3 || (r3 = e3[s4]) < 32 || r3 > 126 && r3 < h) {
2354
- this._printHandler(e3, i4, s4), i4 = s4 - 1;
2355
- break;
2356
- }
2357
- if (++s4 >= t3 || (r3 = e3[s4]) < 32 || r3 > 126 && r3 < h) {
2358
- this._printHandler(e3, i4, s4), i4 = s4 - 1;
2359
- break;
2360
- }
2361
- }
2362
- break;
2363
- case 3:
2364
- this._executeHandlers[r3] ? this._executeHandlers[r3]() : this._executeHandlerFb(r3), this.precedingJoinState = 0;
2365
- break;
2366
- case 0:
2367
- break;
2368
- case 1:
2369
- if (this._errorHandler({ position: i4, code: r3, currentState: this.currentState, collect: this._collect, params: this._params, abort: false }).abort) return;
2370
- break;
2371
- case 7:
2372
- const a3 = this._csiHandlers[this._collect << 8 | r3];
2373
- let o2 = a3 ? a3.length - 1 : -1;
2374
- for (; o2 >= 0 && (s3 = a3[o2](this._params), true !== s3); o2--) if (s3 instanceof Promise) return this._preserveStack(3, a3, o2, n3, i4), s3;
2375
- o2 < 0 && this._csiHandlerFb(this._collect << 8 | r3, this._params), this.precedingJoinState = 0;
2376
- break;
2377
- case 8:
2378
- do {
2379
- switch (r3) {
2380
- case 59:
2381
- this._params.addParam(0);
2382
- break;
2383
- case 58:
2384
- this._params.addSubParam(-1);
2385
- break;
2386
- default:
2387
- this._params.addDigit(r3 - 48);
2388
- }
2389
- } while (++i4 < t3 && (r3 = e3[i4]) > 47 && r3 < 60);
2390
- i4--;
2391
- break;
2392
- case 9:
2393
- this._collect <<= 8, this._collect |= r3;
2394
- break;
2395
- case 10:
2396
- const c2 = this._escHandlers[this._collect << 8 | r3];
2397
- let l = c2 ? c2.length - 1 : -1;
2398
- for (; l >= 0 && (s3 = c2[l](), true !== s3); l--) if (s3 instanceof Promise) return this._preserveStack(4, c2, l, n3, i4), s3;
2399
- l < 0 && this._escHandlerFb(this._collect << 8 | r3), this.precedingJoinState = 0;
2400
- break;
2401
- case 11:
2402
- this._params.reset(), this._params.addParam(0), this._collect = 0;
2403
- break;
2404
- case 12:
2405
- this._dcsParser.hook(this._collect << 8 | r3, this._params);
2406
- break;
2407
- case 13:
2408
- for (let s4 = i4 + 1; ; ++s4) if (s4 >= t3 || 24 === (r3 = e3[s4]) || 26 === r3 || 27 === r3 || r3 > 127 && r3 < h) {
2409
- this._dcsParser.put(e3, i4, s4), i4 = s4 - 1;
2410
- break;
2411
- }
2412
- break;
2413
- case 14:
2414
- if (s3 = this._dcsParser.unhook(24 !== r3 && 26 !== r3), s3) return this._preserveStack(6, [], 0, n3, i4), s3;
2415
- 27 === r3 && (n3 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0;
2416
- break;
2417
- case 4:
2418
- this._oscParser.start();
2419
- break;
2420
- case 5:
2421
- for (let s4 = i4 + 1; ; s4++) if (s4 >= t3 || (r3 = e3[s4]) < 32 || r3 > 127 && r3 < h) {
2422
- this._oscParser.put(e3, i4, s4), i4 = s4 - 1;
2423
- break;
2424
- }
2425
- break;
2426
- case 6:
2427
- if (s3 = this._oscParser.end(24 !== r3 && 26 !== r3), s3) return this._preserveStack(5, [], 0, n3, i4), s3;
2428
- 27 === r3 && (n3 |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingJoinState = 0;
2429
- }
2430
- this.currentState = 15 & n3;
2431
- }
2432
- }
2433
- }
2434
- t2.EscapeSequenceParser = c;
2435
- }, 242: (e2, t2, i2) => {
2436
- Object.defineProperty(t2, "__esModule", { value: true }), t2.OscHandler = t2.OscParser = void 0;
2437
- const s2 = i2(770), r2 = i2(482), n2 = [];
2438
- t2.OscParser = class {
2439
- constructor() {
2440
- this._state = 0, this._active = n2, this._id = -1, this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
2441
- }, this._stack = { paused: false, loopPosition: 0, fallThrough: false };
2442
- }
2443
- registerHandler(e3, t3) {
2444
- void 0 === this._handlers[e3] && (this._handlers[e3] = []);
2445
- const i3 = this._handlers[e3];
2446
- return i3.push(t3), { dispose: () => {
2447
- const e4 = i3.indexOf(t3);
2448
- -1 !== e4 && i3.splice(e4, 1);
2449
- } };
2450
- }
2451
- clearHandler(e3) {
2452
- this._handlers[e3] && delete this._handlers[e3];
2453
- }
2454
- setHandlerFallback(e3) {
2455
- this._handlerFb = e3;
2456
- }
2457
- dispose() {
2458
- this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
2459
- }, this._active = n2;
2460
- }
2461
- reset() {
2462
- 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);
2463
- this._stack.paused = false, this._active = n2, this._id = -1, this._state = 0;
2464
- }
2465
- _start() {
2466
- if (this._active = this._handlers[this._id] || n2, this._active.length) for (let e3 = this._active.length - 1; e3 >= 0; e3--) this._active[e3].start();
2467
- else this._handlerFb(this._id, "START");
2468
- }
2469
- _put(e3, t3, i3) {
2470
- if (this._active.length) for (let s3 = this._active.length - 1; s3 >= 0; s3--) this._active[s3].put(e3, t3, i3);
2471
- else this._handlerFb(this._id, "PUT", (0, r2.utf32ToString)(e3, t3, i3));
2472
- }
2473
- start() {
2474
- this.reset(), this._state = 1;
2475
- }
2476
- put(e3, t3, i3) {
2477
- if (3 !== this._state) {
2478
- if (1 === this._state) for (; t3 < i3; ) {
2479
- const i4 = e3[t3++];
2480
- if (59 === i4) {
2481
- this._state = 2, this._start();
2482
- break;
2483
- }
2484
- if (i4 < 48 || 57 < i4) return void (this._state = 3);
2485
- -1 === this._id && (this._id = 0), this._id = 10 * this._id + i4 - 48;
2486
- }
2487
- 2 === this._state && i3 - t3 > 0 && this._put(e3, t3, i3);
2488
- }
2489
- }
2490
- end(e3, t3 = true) {
2491
- if (0 !== this._state) {
2492
- if (3 !== this._state) if (1 === this._state && this._start(), this._active.length) {
2493
- let i3 = false, s3 = this._active.length - 1, r3 = false;
2494
- if (this._stack.paused && (s3 = this._stack.loopPosition - 1, i3 = t3, r3 = this._stack.fallThrough, this._stack.paused = false), !r3 && false === i3) {
2495
- 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;
2496
- s3--;
2497
- }
2498
- 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;
2499
- } else this._handlerFb(this._id, "END", e3);
2500
- this._active = n2, this._id = -1, this._state = 0;
2501
- }
2502
- }
2503
- }, t2.OscHandler = class {
2504
- constructor(e3) {
2505
- this._handler = e3, this._data = "", this._hitLimit = false;
2506
- }
2507
- start() {
2508
- this._data = "", this._hitLimit = false;
2509
- }
2510
- put(e3, t3, i3) {
2511
- this._hitLimit || (this._data += (0, r2.utf32ToString)(e3, t3, i3), this._data.length > s2.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = true));
2512
- }
2513
- end(e3) {
2514
- let t3 = false;
2515
- if (this._hitLimit) t3 = false;
2516
- else if (e3 && (t3 = this._handler(this._data), t3 instanceof Promise)) return t3.then(((e4) => (this._data = "", this._hitLimit = false, e4)));
2517
- return this._data = "", this._hitLimit = false, t3;
2518
- }
2519
- };
2520
- }, 742: (e2, t2) => {
2521
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Params = void 0;
2522
- const i2 = 2147483647;
2523
- class s2 {
2524
- static fromArray(e3) {
2525
- const t3 = new s2();
2526
- if (!e3.length) return t3;
2527
- for (let i3 = Array.isArray(e3[0]) ? 1 : 0; i3 < e3.length; ++i3) {
2528
- const s3 = e3[i3];
2529
- if (Array.isArray(s3)) for (let e4 = 0; e4 < s3.length; ++e4) t3.addSubParam(s3[e4]);
2530
- else t3.addParam(s3);
2531
- }
2532
- return t3;
2533
- }
2534
- constructor(e3 = 32, t3 = 32) {
2535
- if (this.maxLength = e3, this.maxSubParamsLength = t3, t3 > 256) throw new Error("maxSubParamsLength must not be greater than 256");
2536
- 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;
2537
- }
2538
- clone() {
2539
- const e3 = new s2(this.maxLength, this.maxSubParamsLength);
2540
- 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;
2541
- }
2542
- toArray() {
2543
- const e3 = [];
2544
- for (let t3 = 0; t3 < this.length; ++t3) {
2545
- e3.push(this.params[t3]);
2546
- const i3 = this._subParamsIdx[t3] >> 8, s3 = 255 & this._subParamsIdx[t3];
2547
- s3 - i3 > 0 && e3.push(Array.prototype.slice.call(this._subParams, i3, s3));
2548
- }
2549
- return e3;
2550
- }
2551
- reset() {
2552
- this.length = 0, this._subParamsLength = 0, this._rejectDigits = false, this._rejectSubDigits = false, this._digitIsSub = false;
2553
- }
2554
- addParam(e3) {
2555
- if (this._digitIsSub = false, this.length >= this.maxLength) this._rejectDigits = true;
2556
- else {
2557
- if (e3 < -1) throw new Error("values lesser than -1 are not allowed");
2558
- this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength, this.params[this.length++] = e3 > i2 ? i2 : e3;
2559
- }
2560
- }
2561
- addSubParam(e3) {
2562
- if (this._digitIsSub = true, this.length) if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength) this._rejectSubDigits = true;
2563
- else {
2564
- if (e3 < -1) throw new Error("values lesser than -1 are not allowed");
2565
- this._subParams[this._subParamsLength++] = e3 > i2 ? i2 : e3, this._subParamsIdx[this.length - 1]++;
2566
- }
2567
- }
2568
- hasSubParams(e3) {
2569
- return (255 & this._subParamsIdx[e3]) - (this._subParamsIdx[e3] >> 8) > 0;
2570
- }
2571
- getSubParams(e3) {
2572
- const t3 = this._subParamsIdx[e3] >> 8, i3 = 255 & this._subParamsIdx[e3];
2573
- return i3 - t3 > 0 ? this._subParams.subarray(t3, i3) : null;
2574
- }
2575
- getSubParamsAll() {
2576
- const e3 = {};
2577
- for (let t3 = 0; t3 < this.length; ++t3) {
2578
- const i3 = this._subParamsIdx[t3] >> 8, s3 = 255 & this._subParamsIdx[t3];
2579
- s3 - i3 > 0 && (e3[t3] = this._subParams.slice(i3, s3));
2580
- }
2581
- return e3;
2582
- }
2583
- addDigit(e3) {
2584
- let t3;
2585
- if (this._rejectDigits || !(t3 = this._digitIsSub ? this._subParamsLength : this.length) || this._digitIsSub && this._rejectSubDigits) return;
2586
- const s3 = this._digitIsSub ? this._subParams : this.params, r2 = s3[t3 - 1];
2587
- s3[t3 - 1] = ~r2 ? Math.min(10 * r2 + e3, i2) : e3;
2588
- }
2589
- }
2590
- t2.Params = s2;
2591
- }, 741: (e2, t2) => {
2592
- Object.defineProperty(t2, "__esModule", { value: true }), t2.AddonManager = void 0, t2.AddonManager = class {
2593
- constructor() {
2594
- this._addons = [];
2595
- }
2596
- dispose() {
2597
- for (let e3 = this._addons.length - 1; e3 >= 0; e3--) this._addons[e3].instance.dispose();
2598
- }
2599
- loadAddon(e3, t3) {
2600
- const i2 = { instance: t3, dispose: t3.dispose, isDisposed: false };
2601
- this._addons.push(i2), t3.dispose = () => this._wrappedAddonDispose(i2), t3.activate(e3);
2602
- }
2603
- _wrappedAddonDispose(e3) {
2604
- if (e3.isDisposed) return;
2605
- let t3 = -1;
2606
- for (let i2 = 0; i2 < this._addons.length; i2++) if (this._addons[i2] === e3) {
2607
- t3 = i2;
2608
- break;
2609
- }
2610
- if (-1 === t3) throw new Error("Could not dispose an addon that has not been loaded");
2611
- e3.isDisposed = true, e3.dispose.apply(e3.instance), this._addons.splice(t3, 1);
2612
- }
2613
- };
2614
- }, 771: (e2, t2, i2) => {
2615
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferApiView = void 0;
2616
- const s2 = i2(785), r2 = i2(511);
2617
- t2.BufferApiView = class {
2618
- constructor(e3, t3) {
2619
- this._buffer = e3, this.type = t3;
2620
- }
2621
- init(e3) {
2622
- return this._buffer = e3, this;
2623
- }
2624
- get cursorY() {
2625
- return this._buffer.y;
2626
- }
2627
- get cursorX() {
2628
- return this._buffer.x;
2629
- }
2630
- get viewportY() {
2631
- return this._buffer.ydisp;
2632
- }
2633
- get baseY() {
2634
- return this._buffer.ybase;
2635
- }
2636
- get length() {
2637
- return this._buffer.lines.length;
2638
- }
2639
- getLine(e3) {
2640
- const t3 = this._buffer.lines.get(e3);
2641
- if (t3) return new s2.BufferLineApiView(t3);
2642
- }
2643
- getNullCell() {
2644
- return new r2.CellData();
2645
- }
2646
- };
2647
- }, 785: (e2, t2, i2) => {
2648
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferLineApiView = void 0;
2649
- const s2 = i2(511);
2650
- t2.BufferLineApiView = class {
2651
- constructor(e3) {
2652
- this._line = e3;
2653
- }
2654
- get isWrapped() {
2655
- return this._line.isWrapped;
2656
- }
2657
- get length() {
2658
- return this._line.length;
2659
- }
2660
- getCell(e3, t3) {
2661
- if (!(e3 < 0 || e3 >= this._line.length)) return t3 ? (this._line.loadCell(e3, t3), t3) : this._line.loadCell(e3, new s2.CellData());
2662
- }
2663
- translateToString(e3, t3, i3) {
2664
- return this._line.translateToString(e3, t3, i3);
2665
- }
2666
- };
2667
- }, 285: (e2, t2, i2) => {
2668
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferNamespaceApi = void 0;
2669
- const s2 = i2(771), r2 = i2(460), n2 = i2(844);
2670
- class a extends n2.Disposable {
2671
- constructor(e3) {
2672
- super(), this._core = e3, this._onBufferChange = this.register(new r2.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)));
2673
- }
2674
- get active() {
2675
- if (this._core.buffers.active === this._core.buffers.normal) return this.normal;
2676
- if (this._core.buffers.active === this._core.buffers.alt) return this.alternate;
2677
- throw new Error("Active buffer is neither normal nor alternate");
2678
- }
2679
- get normal() {
2680
- return this._normal.init(this._core.buffers.normal);
2681
- }
2682
- get alternate() {
2683
- return this._alternate.init(this._core.buffers.alt);
2684
- }
2685
- }
2686
- t2.BufferNamespaceApi = a;
2687
- }, 975: (e2, t2) => {
2688
- Object.defineProperty(t2, "__esModule", { value: true }), t2.ParserApi = void 0, t2.ParserApi = class {
2689
- constructor(e3) {
2690
- this._core = e3;
2691
- }
2692
- registerCsiHandler(e3, t3) {
2693
- return this._core.registerCsiHandler(e3, ((e4) => t3(e4.toArray())));
2694
- }
2695
- addCsiHandler(e3, t3) {
2696
- return this.registerCsiHandler(e3, t3);
2697
- }
2698
- registerDcsHandler(e3, t3) {
2699
- return this._core.registerDcsHandler(e3, ((e4, i2) => t3(e4, i2.toArray())));
2700
- }
2701
- addDcsHandler(e3, t3) {
2702
- return this.registerDcsHandler(e3, t3);
2703
- }
2704
- registerEscHandler(e3, t3) {
2705
- return this._core.registerEscHandler(e3, t3);
2706
- }
2707
- addEscHandler(e3, t3) {
2708
- return this.registerEscHandler(e3, t3);
2709
- }
2710
- registerOscHandler(e3, t3) {
2711
- return this._core.registerOscHandler(e3, t3);
2712
- }
2713
- addOscHandler(e3, t3) {
2714
- return this.registerOscHandler(e3, t3);
2715
- }
2716
- };
2717
- }, 90: (e2, t2) => {
2718
- Object.defineProperty(t2, "__esModule", { value: true }), t2.UnicodeApi = void 0, t2.UnicodeApi = class {
2719
- constructor(e3) {
2720
- this._core = e3;
2721
- }
2722
- register(e3) {
2723
- this._core.unicodeService.register(e3);
2724
- }
2725
- get versions() {
2726
- return this._core.unicodeService.versions;
2727
- }
2728
- get activeVersion() {
2729
- return this._core.unicodeService.activeVersion;
2730
- }
2731
- set activeVersion(e3) {
2732
- this._core.unicodeService.activeVersion = e3;
2733
- }
2734
- };
2735
- }, 744: function(e2, t2, i2) {
2736
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
2737
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
2738
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
2739
- else for (var o2 = e3.length - 1; o2 >= 0; o2--) (r3 = e3[o2]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
2740
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
2741
- }, r2 = this && this.__param || function(e3, t3) {
2742
- return function(i3, s3) {
2743
- t3(i3, s3, e3);
2744
- };
2745
- };
2746
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferService = t2.MINIMUM_ROWS = t2.MINIMUM_COLS = void 0;
2747
- const n2 = i2(460), a = i2(844), o = i2(295), h = i2(585);
2748
- t2.MINIMUM_COLS = 2, t2.MINIMUM_ROWS = 1;
2749
- let c = t2.BufferService = class extends a.Disposable {
2750
- get buffer() {
2751
- return this.buffers.active;
2752
- }
2753
- constructor(e3) {
2754
- super(), this.isUserScrolling = false, this._onResize = this.register(new n2.EventEmitter()), this.onResize = this._onResize.event, this._onScroll = this.register(new n2.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 o.BufferSet(e3, this));
2755
- }
2756
- resize(e3, t3) {
2757
- this.cols = e3, this.rows = t3, this.buffers.resize(e3, t3), this._onResize.fire({ cols: e3, rows: t3 });
2758
- }
2759
- reset() {
2760
- this.buffers.reset(), this.isUserScrolling = false;
2761
- }
2762
- scroll(e3, t3 = false) {
2763
- const i3 = this.buffer;
2764
- let s3;
2765
- 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;
2766
- const r3 = i3.ybase + i3.scrollTop, n3 = i3.ybase + i3.scrollBottom;
2767
- if (0 === i3.scrollTop) {
2768
- const e4 = i3.lines.isFull;
2769
- n3 === i3.lines.length - 1 ? e4 ? i3.lines.recycle().copyFrom(s3) : i3.lines.push(s3.clone()) : i3.lines.splice(n3 + 1, 0, s3.clone()), e4 ? this.isUserScrolling && (i3.ydisp = Math.max(i3.ydisp - 1, 0)) : (i3.ybase++, this.isUserScrolling || i3.ydisp++);
2770
- } else {
2771
- const e4 = n3 - r3 + 1;
2772
- i3.lines.shiftElements(r3 + 1, e4 - 1, -1), i3.lines.set(n3, s3.clone());
2773
- }
2774
- this.isUserScrolling || (i3.ydisp = i3.ybase), this._onScroll.fire(i3.ydisp);
2775
- }
2776
- scrollLines(e3, t3, i3) {
2777
- const s3 = this.buffer;
2778
- if (e3 < 0) {
2779
- if (0 === s3.ydisp) return;
2780
- this.isUserScrolling = true;
2781
- } else e3 + s3.ydisp >= s3.ybase && (this.isUserScrolling = false);
2782
- const r3 = s3.ydisp;
2783
- s3.ydisp = Math.max(Math.min(s3.ydisp + e3, s3.ybase), 0), r3 !== s3.ydisp && (t3 || this._onScroll.fire(s3.ydisp));
2784
- }
2785
- };
2786
- t2.BufferService = c = s2([r2(0, h.IOptionsService)], c);
2787
- }, 994: (e2, t2) => {
2788
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CharsetService = void 0, t2.CharsetService = class {
2789
- constructor() {
2790
- this.glevel = 0, this._charsets = [];
2791
- }
2792
- reset() {
2793
- this.charset = void 0, this._charsets = [], this.glevel = 0;
2794
- }
2795
- setgLevel(e3) {
2796
- this.glevel = e3, this.charset = this._charsets[e3];
2797
- }
2798
- setgCharset(e3, t3) {
2799
- this._charsets[e3] = t3, this.glevel === e3 && (this.charset = t3);
2800
- }
2801
- };
2802
- }, 753: function(e2, t2, i2) {
2803
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
2804
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
2805
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
2806
- else for (var o2 = e3.length - 1; o2 >= 0; o2--) (r3 = e3[o2]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
2807
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
2808
- }, r2 = this && this.__param || function(e3, t3) {
2809
- return function(i3, s3) {
2810
- t3(i3, s3, e3);
2811
- };
2812
- };
2813
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreMouseService = void 0;
2814
- const n2 = i2(585), a = i2(460), o = 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 } };
2815
- function c(e3, t3) {
2816
- let i3 = (e3.ctrl ? 16 : 0) | (e3.shift ? 4 : 0) | (e3.alt ? 8 : 0);
2817
- 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;
2818
- }
2819
- const l = String.fromCharCode, _ = { DEFAULT: (e3) => {
2820
- const t3 = [c(e3, false) + 32, e3.col + 32, e3.row + 32];
2821
- return t3[0] > 255 || t3[1] > 255 || t3[2] > 255 ? "" : `\x1B[M${l(t3[0])}${l(t3[1])}${l(t3[2])}`;
2822
- }, SGR: (e3) => {
2823
- const t3 = 0 === e3.action && 4 !== e3.button ? "m" : "M";
2824
- return `\x1B[<${c(e3, true)};${e3.col};${e3.row}${t3}`;
2825
- }, SGR_PIXELS: (e3) => {
2826
- const t3 = 0 === e3.action && 4 !== e3.button ? "m" : "M";
2827
- return `\x1B[<${c(e3, true)};${e3.x};${e3.y}${t3}`;
2828
- } };
2829
- let d = t2.CoreMouseService = class extends o.Disposable {
2830
- constructor(e3, t3) {
2831
- super(), this._bufferService = e3, this._coreService = t3, this._protocols = {}, this._encodings = {}, this._activeProtocol = "", this._activeEncoding = "", this._lastEvent = null, this._onProtocolChange = this.register(new a.EventEmitter()), this.onProtocolChange = this._onProtocolChange.event;
2832
- for (const e4 of Object.keys(h)) this.addProtocol(e4, h[e4]);
2833
- for (const e4 of Object.keys(_)) this.addEncoding(e4, _[e4]);
2834
- this.reset();
2835
- }
2836
- addProtocol(e3, t3) {
2837
- this._protocols[e3] = t3;
2838
- }
2839
- addEncoding(e3, t3) {
2840
- this._encodings[e3] = t3;
2841
- }
2842
- get activeProtocol() {
2843
- return this._activeProtocol;
2844
- }
2845
- get areMouseEventsActive() {
2846
- return 0 !== this._protocols[this._activeProtocol].events;
2847
- }
2848
- set activeProtocol(e3) {
2849
- if (!this._protocols[e3]) throw new Error(`unknown protocol "${e3}"`);
2850
- this._activeProtocol = e3, this._onProtocolChange.fire(this._protocols[e3].events);
2851
- }
2852
- get activeEncoding() {
2853
- return this._activeEncoding;
2854
- }
2855
- set activeEncoding(e3) {
2856
- if (!this._encodings[e3]) throw new Error(`unknown encoding "${e3}"`);
2857
- this._activeEncoding = e3;
2858
- }
2859
- reset() {
2860
- this.activeProtocol = "NONE", this.activeEncoding = "DEFAULT", this._lastEvent = null;
2861
- }
2862
- triggerMouseEvent(e3) {
2863
- if (e3.col < 0 || e3.col >= this._bufferService.cols || e3.row < 0 || e3.row >= this._bufferService.rows) return false;
2864
- if (4 === e3.button && 32 === e3.action) return false;
2865
- if (3 === e3.button && 32 !== e3.action) return false;
2866
- if (4 !== e3.button && (2 === e3.action || 3 === e3.action)) return false;
2867
- if (e3.col++, e3.row++, 32 === e3.action && this._lastEvent && this._equalEvents(this._lastEvent, e3, "SGR_PIXELS" === this._activeEncoding)) return false;
2868
- if (!this._protocols[this._activeProtocol].restrict(e3)) return false;
2869
- const t3 = this._encodings[this._activeEncoding](e3);
2870
- return t3 && ("DEFAULT" === this._activeEncoding ? this._coreService.triggerBinaryEvent(t3) : this._coreService.triggerDataEvent(t3, true)), this._lastEvent = e3, true;
2871
- }
2872
- explainEvents(e3) {
2873
- return { down: !!(1 & e3), up: !!(2 & e3), drag: !!(4 & e3), move: !!(8 & e3), wheel: !!(16 & e3) };
2874
- }
2875
- _equalEvents(e3, t3, i3) {
2876
- if (i3) {
2877
- if (e3.x !== t3.x) return false;
2878
- if (e3.y !== t3.y) return false;
2879
- } else {
2880
- if (e3.col !== t3.col) return false;
2881
- if (e3.row !== t3.row) return false;
2882
- }
2883
- return e3.button === t3.button && e3.action === t3.action && e3.ctrl === t3.ctrl && e3.alt === t3.alt && e3.shift === t3.shift;
2884
- }
2885
- };
2886
- t2.CoreMouseService = d = s2([r2(0, n2.IBufferService), r2(1, n2.ICoreService)], d);
2887
- }, 83: function(e2, t2, i2) {
2888
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
2889
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
2890
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
2891
- else for (var o2 = e3.length - 1; o2 >= 0; o2--) (r3 = e3[o2]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
2892
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
2893
- }, r2 = this && this.__param || function(e3, t3) {
2894
- return function(i3, s3) {
2895
- t3(i3, s3, e3);
2896
- };
2897
- };
2898
- Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreService = void 0;
2899
- const n2 = i2(439), a = i2(460), o = i2(844), h = i2(585), c = Object.freeze({ insertMode: false }), l = Object.freeze({ applicationCursorKeys: false, applicationKeypad: false, bracketedPasteMode: false, origin: false, reverseWraparound: false, sendFocus: false, wraparound: true });
2900
- let _ = t2.CoreService = class extends o.Disposable {
2901
- constructor(e3, t3, i3) {
2902
- super(), this._bufferService = e3, this._logService = t3, this._optionsService = i3, this.isCursorInitialized = false, this.isCursorHidden = false, this._onData = this.register(new a.EventEmitter()), this.onData = this._onData.event, this._onUserInput = this.register(new a.EventEmitter()), this.onUserInput = this._onUserInput.event, this._onBinary = this.register(new a.EventEmitter()), this.onBinary = this._onBinary.event, this._onRequestScrollToBottom = this.register(new a.EventEmitter()), this.onRequestScrollToBottom = this._onRequestScrollToBottom.event, this.modes = (0, n2.clone)(c), this.decPrivateModes = (0, n2.clone)(l);
2903
- }
2904
- reset() {
2905
- this.modes = (0, n2.clone)(c), this.decPrivateModes = (0, n2.clone)(l);
2906
- }
2907
- triggerDataEvent(e3, t3 = false) {
2908
- if (this._optionsService.rawOptions.disableStdin) return;
2909
- const i3 = this._bufferService.buffer;
2910
- 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);
2911
- }
2912
- triggerBinaryEvent(e3) {
2913
- this._optionsService.rawOptions.disableStdin || (this._logService.debug(`sending binary "${e3}"`, (() => e3.split("").map(((e4) => e4.charCodeAt(0))))), this._onBinary.fire(e3));
2914
- }
2915
- };
2916
- t2.CoreService = _ = s2([r2(0, h.IBufferService), r2(1, h.ILogService), r2(2, h.IOptionsService)], _);
2917
- }, 348: (e2, t2, i2) => {
2918
- Object.defineProperty(t2, "__esModule", { value: true }), t2.InstantiationService = t2.ServiceCollection = void 0;
2919
- const s2 = i2(585), r2 = i2(343);
2920
- class n2 {
2921
- constructor(...e3) {
2922
- this._entries = /* @__PURE__ */ new Map();
2923
- for (const [t3, i3] of e3) this.set(t3, i3);
2924
- }
2925
- set(e3, t3) {
2926
- const i3 = this._entries.get(e3);
2927
- return this._entries.set(e3, t3), i3;
2928
- }
2929
- forEach(e3) {
2930
- for (const [t3, i3] of this._entries.entries()) e3(t3, i3);
2931
- }
2932
- has(e3) {
2933
- return this._entries.has(e3);
2934
- }
2935
- get(e3) {
2936
- return this._entries.get(e3);
2937
- }
2938
- }
2939
- t2.ServiceCollection = n2, t2.InstantiationService = class {
2940
- constructor() {
2941
- this._services = new n2(), this._services.set(s2.IInstantiationService, this);
2942
- }
2943
- setService(e3, t3) {
2944
- this._services.set(e3, t3);
2945
- }
2946
- getService(e3) {
2947
- return this._services.get(e3);
2948
- }
2949
- createInstance(e3, ...t3) {
2950
- const i3 = (0, r2.getServiceDependencies)(e3).sort(((e4, t4) => e4.index - t4.index)), s3 = [];
2951
- for (const t4 of i3) {
2952
- const i4 = this._services.get(t4.id);
2953
- if (!i4) throw new Error(`[createInstance] ${e3.name} depends on UNKNOWN service ${t4.id}.`);
2954
- s3.push(i4);
2955
- }
2956
- const n3 = i3.length > 0 ? i3[0].index : t3.length;
2957
- if (t3.length !== n3) throw new Error(`[createInstance] First service dependency of ${e3.name} at position ${n3 + 1} conflicts with ${t3.length} static arguments`);
2958
- return new e3(...[...t3, ...s3]);
2959
- }
2960
- };
2961
- }, 866: function(e2, t2, i2) {
2962
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
2963
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
2964
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
2965
- else for (var o2 = e3.length - 1; o2 >= 0; o2--) (r3 = e3[o2]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
2966
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
2967
- }, r2 = this && this.__param || function(e3, t3) {
2968
- return function(i3, s3) {
2969
- t3(i3, s3, e3);
2970
- };
2971
- };
2972
- Object.defineProperty(t2, "__esModule", { value: true }), t2.traceCall = t2.setTraceLogger = t2.LogService = void 0;
2973
- const n2 = i2(844), a = i2(585), o = { trace: a.LogLevelEnum.TRACE, debug: a.LogLevelEnum.DEBUG, info: a.LogLevelEnum.INFO, warn: a.LogLevelEnum.WARN, error: a.LogLevelEnum.ERROR, off: a.LogLevelEnum.OFF };
2974
- let h, c = t2.LogService = class extends n2.Disposable {
2975
- get logLevel() {
2976
- return this._logLevel;
2977
- }
2978
- constructor(e3) {
2979
- super(), this._optionsService = e3, this._logLevel = a.LogLevelEnum.OFF, this._updateLogLevel(), this.register(this._optionsService.onSpecificOptionChange("logLevel", (() => this._updateLogLevel()))), h = this;
2980
- }
2981
- _updateLogLevel() {
2982
- this._logLevel = o[this._optionsService.rawOptions.logLevel];
2983
- }
2984
- _evalLazyOptionalParams(e3) {
2985
- for (let t3 = 0; t3 < e3.length; t3++) "function" == typeof e3[t3] && (e3[t3] = e3[t3]());
2986
- }
2987
- _log(e3, t3, i3) {
2988
- this._evalLazyOptionalParams(i3), e3.call(console, (this._optionsService.options.logger ? "" : "xterm.js: ") + t3, ...i3);
2989
- }
2990
- trace(e3, ...t3) {
2991
- this._logLevel <= a.LogLevelEnum.TRACE && this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger) ?? console.log, e3, t3);
2992
- }
2993
- debug(e3, ...t3) {
2994
- this._logLevel <= a.LogLevelEnum.DEBUG && this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger) ?? console.log, e3, t3);
2995
- }
2996
- info(e3, ...t3) {
2997
- this._logLevel <= a.LogLevelEnum.INFO && this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger) ?? console.info, e3, t3);
2998
- }
2999
- warn(e3, ...t3) {
3000
- this._logLevel <= a.LogLevelEnum.WARN && this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger) ?? console.warn, e3, t3);
3001
- }
3002
- error(e3, ...t3) {
3003
- this._logLevel <= a.LogLevelEnum.ERROR && this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger) ?? console.error, e3, t3);
3004
- }
3005
- };
3006
- t2.LogService = c = s2([r2(0, a.IOptionsService)], c), t2.setTraceLogger = function(e3) {
3007
- h = e3;
3008
- }, t2.traceCall = function(e3, t3, i3) {
3009
- if ("function" != typeof i3.value) throw new Error("not supported");
3010
- const s3 = i3.value;
3011
- i3.value = function(...e4) {
3012
- if (h.logLevel !== a.LogLevelEnum.TRACE) return s3.apply(this, e4);
3013
- h.trace(`GlyphRenderer#${s3.name}(${e4.map(((e5) => JSON.stringify(e5))).join(", ")})`);
3014
- const t4 = s3.apply(this, e4);
3015
- return h.trace(`GlyphRenderer#${s3.name} return`, t4), t4;
3016
- };
3017
- };
3018
- }, 302: (e2, t2, i2) => {
3019
- Object.defineProperty(t2, "__esModule", { value: true }), t2.OptionsService = t2.DEFAULT_OPTIONS = void 0;
3020
- const s2 = i2(460), r2 = i2(844), n2 = i2(114);
3021
- 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: n2.isMac, windowOptions: {}, windowsMode: false, windowsPty: {}, wordSeparator: " ()[]{}',\"`", altClickMovesCursor: true, convertEol: false, termName: "xterm", cancelEvents: false, overviewRulerWidth: 0 };
3022
- const a = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
3023
- class o extends r2.Disposable {
3024
- constructor(e3) {
3025
- super(), this._onOptionChange = this.register(new s2.EventEmitter()), this.onOptionChange = this._onOptionChange.event;
3026
- const i3 = { ...t2.DEFAULT_OPTIONS };
3027
- for (const t3 in e3) if (t3 in i3) try {
3028
- const s3 = e3[t3];
3029
- i3[t3] = this._sanitizeAndValidateOption(t3, s3);
3030
- } catch (e4) {
3031
- console.error(e4);
3032
- }
3033
- this.rawOptions = i3, this.options = { ...i3 }, this._setupOptions(), this.register((0, r2.toDisposable)((() => {
3034
- this.rawOptions.linkHandler = null, this.rawOptions.documentOverride = null;
3035
- })));
3036
- }
3037
- onSpecificOptionChange(e3, t3) {
3038
- return this.onOptionChange(((i3) => {
3039
- i3 === e3 && t3(this.rawOptions[e3]);
3040
- }));
3041
- }
3042
- onMultipleOptionChange(e3, t3) {
3043
- return this.onOptionChange(((i3) => {
3044
- -1 !== e3.indexOf(i3) && t3();
3045
- }));
3046
- }
3047
- _setupOptions() {
3048
- const e3 = (e4) => {
3049
- if (!(e4 in t2.DEFAULT_OPTIONS)) throw new Error(`No option with key "${e4}"`);
3050
- return this.rawOptions[e4];
3051
- }, i3 = (e4, i4) => {
3052
- if (!(e4 in t2.DEFAULT_OPTIONS)) throw new Error(`No option with key "${e4}"`);
3053
- i4 = this._sanitizeAndValidateOption(e4, i4), this.rawOptions[e4] !== i4 && (this.rawOptions[e4] = i4, this._onOptionChange.fire(e4));
3054
- };
3055
- for (const t3 in this.rawOptions) {
3056
- const s3 = { get: e3.bind(this, t3), set: i3.bind(this, t3) };
3057
- Object.defineProperty(this.options, t3, s3);
3058
- }
3059
- }
3060
- _sanitizeAndValidateOption(e3, i3) {
3061
- switch (e3) {
3062
- case "cursorStyle":
3063
- if (i3 || (i3 = t2.DEFAULT_OPTIONS[e3]), !/* @__PURE__ */ (function(e4) {
3064
- return "block" === e4 || "underline" === e4 || "bar" === e4;
3065
- })(i3)) throw new Error(`"${i3}" is not a valid value for ${e3}`);
3066
- break;
3067
- case "wordSeparator":
3068
- i3 || (i3 = t2.DEFAULT_OPTIONS[e3]);
3069
- break;
3070
- case "fontWeight":
3071
- case "fontWeightBold":
3072
- if ("number" == typeof i3 && 1 <= i3 && i3 <= 1e3) break;
3073
- i3 = a.includes(i3) ? i3 : t2.DEFAULT_OPTIONS[e3];
3074
- break;
3075
- case "cursorWidth":
3076
- i3 = Math.floor(i3);
3077
- case "lineHeight":
3078
- case "tabStopWidth":
3079
- if (i3 < 1) throw new Error(`${e3} cannot be less than 1, value: ${i3}`);
3080
- break;
3081
- case "minimumContrastRatio":
3082
- i3 = Math.max(1, Math.min(21, Math.round(10 * i3) / 10));
3083
- break;
3084
- case "scrollback":
3085
- if ((i3 = Math.min(i3, 4294967295)) < 0) throw new Error(`${e3} cannot be less than 0, value: ${i3}`);
3086
- break;
3087
- case "fastScrollSensitivity":
3088
- case "scrollSensitivity":
3089
- if (i3 <= 0) throw new Error(`${e3} cannot be less than or equal to 0, value: ${i3}`);
3090
- break;
3091
- case "rows":
3092
- case "cols":
3093
- if (!i3 && 0 !== i3) throw new Error(`${e3} must be numeric, value: ${i3}`);
3094
- break;
3095
- case "windowsPty":
3096
- i3 = i3 ?? {};
3097
- }
3098
- return i3;
3099
- }
3100
- }
3101
- t2.OptionsService = o;
3102
- }, 660: function(e2, t2, i2) {
3103
- var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
3104
- var r3, n3 = arguments.length, a2 = n3 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
3105
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a2 = Reflect.decorate(e3, t3, i3, s3);
3106
- else for (var o = e3.length - 1; o >= 0; o--) (r3 = e3[o]) && (a2 = (n3 < 3 ? r3(a2) : n3 > 3 ? r3(t3, i3, a2) : r3(t3, i3)) || a2);
3107
- return n3 > 3 && a2 && Object.defineProperty(t3, i3, a2), a2;
3108
- }, r2 = this && this.__param || function(e3, t3) {
3109
- return function(i3, s3) {
3110
- t3(i3, s3, e3);
3111
- };
3112
- };
3113
- Object.defineProperty(t2, "__esModule", { value: true }), t2.OscLinkService = void 0;
3114
- const n2 = i2(585);
3115
- let a = t2.OscLinkService = class {
3116
- constructor(e3) {
3117
- this._bufferService = e3, this._nextId = 1, this._entriesWithId = /* @__PURE__ */ new Map(), this._dataByLinkId = /* @__PURE__ */ new Map();
3118
- }
3119
- registerLink(e3) {
3120
- const t3 = this._bufferService.buffer;
3121
- if (void 0 === e3.id) {
3122
- const i4 = t3.addMarker(t3.ybase + t3.y), s4 = { data: e3, id: this._nextId++, lines: [i4] };
3123
- return i4.onDispose((() => this._removeMarkerFromLink(s4, i4))), this._dataByLinkId.set(s4.id, s4), s4.id;
3124
- }
3125
- const i3 = e3, s3 = this._getEntryIdKey(i3), r3 = this._entriesWithId.get(s3);
3126
- if (r3) return this.addLineToLink(r3.id, t3.ybase + t3.y), r3.id;
3127
- const n3 = t3.addMarker(t3.ybase + t3.y), a2 = { id: this._nextId++, key: this._getEntryIdKey(i3), data: i3, lines: [n3] };
3128
- return n3.onDispose((() => this._removeMarkerFromLink(a2, n3))), this._entriesWithId.set(a2.key, a2), this._dataByLinkId.set(a2.id, a2), a2.id;
3129
- }
3130
- addLineToLink(e3, t3) {
3131
- const i3 = this._dataByLinkId.get(e3);
3132
- if (i3 && i3.lines.every(((e4) => e4.line !== t3))) {
3133
- const e4 = this._bufferService.buffer.addMarker(t3);
3134
- i3.lines.push(e4), e4.onDispose((() => this._removeMarkerFromLink(i3, e4)));
3135
- }
3136
- }
3137
- getLinkData(e3) {
3138
- return this._dataByLinkId.get(e3)?.data;
3139
- }
3140
- _getEntryIdKey(e3) {
3141
- return `${e3.id};;${e3.uri}`;
3142
- }
3143
- _removeMarkerFromLink(e3, t3) {
3144
- const i3 = e3.lines.indexOf(t3);
3145
- -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)));
3146
- }
3147
- };
3148
- t2.OscLinkService = a = s2([r2(0, n2.IBufferService)], a);
3149
- }, 343: (e2, t2) => {
3150
- Object.defineProperty(t2, "__esModule", { value: true }), t2.createDecorator = t2.getServiceDependencies = t2.serviceRegistry = void 0;
3151
- const i2 = "di$target", s2 = "di$dependencies";
3152
- t2.serviceRegistry = /* @__PURE__ */ new Map(), t2.getServiceDependencies = function(e3) {
3153
- return e3[s2] || [];
3154
- }, t2.createDecorator = function(e3) {
3155
- if (t2.serviceRegistry.has(e3)) return t2.serviceRegistry.get(e3);
3156
- const r2 = function(e4, t3, n2) {
3157
- if (3 !== arguments.length) throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
3158
- !(function(e5, t4, r3) {
3159
- t4[i2] === t4 ? t4[s2].push({ id: e5, index: r3 }) : (t4[s2] = [{ id: e5, index: r3 }], t4[i2] = t4);
3160
- })(r2, e4, n2);
3161
- };
3162
- return r2.toString = () => e3, t2.serviceRegistry.set(e3, r2), r2;
3163
- };
3164
- }, 585: (e2, t2, i2) => {
3165
- 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;
3166
- const s2 = i2(343);
3167
- var r2;
3168
- 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) {
3169
- 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";
3170
- })(r2 || (t2.LogLevelEnum = r2 = {})), 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");
3171
- }, 480: (e2, t2, i2) => {
3172
- Object.defineProperty(t2, "__esModule", { value: true }), t2.UnicodeService = void 0;
3173
- const s2 = i2(460), r2 = i2(225);
3174
- class n2 {
3175
- static extractShouldJoin(e3) {
3176
- return 0 != (1 & e3);
3177
- }
3178
- static extractWidth(e3) {
3179
- return e3 >> 1 & 3;
3180
- }
3181
- static extractCharKind(e3) {
3182
- return e3 >> 3;
3183
- }
3184
- static createPropertyValue(e3, t3, i3 = false) {
3185
- return (16777215 & e3) << 3 | (3 & t3) << 1 | (i3 ? 1 : 0);
3186
- }
3187
- constructor() {
3188
- this._providers = /* @__PURE__ */ Object.create(null), this._active = "", this._onChange = new s2.EventEmitter(), this.onChange = this._onChange.event;
3189
- const e3 = new r2.UnicodeV6();
3190
- this.register(e3), this._active = e3.version, this._activeProvider = e3;
3191
- }
3192
- dispose() {
3193
- this._onChange.dispose();
3194
- }
3195
- get versions() {
3196
- return Object.keys(this._providers);
3197
- }
3198
- get activeVersion() {
3199
- return this._active;
3200
- }
3201
- set activeVersion(e3) {
3202
- if (!this._providers[e3]) throw new Error(`unknown Unicode version "${e3}"`);
3203
- this._active = e3, this._activeProvider = this._providers[e3], this._onChange.fire(e3);
3204
- }
3205
- register(e3) {
3206
- this._providers[e3.version] = e3;
3207
- }
3208
- wcwidth(e3) {
3209
- return this._activeProvider.wcwidth(e3);
3210
- }
3211
- getStringCellWidth(e3) {
3212
- let t3 = 0, i3 = 0;
3213
- const s3 = e3.length;
3214
- for (let r3 = 0; r3 < s3; ++r3) {
3215
- let a = e3.charCodeAt(r3);
3216
- if (55296 <= a && a <= 56319) {
3217
- if (++r3 >= s3) return t3 + this.wcwidth(a);
3218
- const i4 = e3.charCodeAt(r3);
3219
- 56320 <= i4 && i4 <= 57343 ? a = 1024 * (a - 55296) + i4 - 56320 + 65536 : t3 += this.wcwidth(i4);
3220
- }
3221
- const o = this.charProperties(a, i3);
3222
- let h = n2.extractWidth(o);
3223
- n2.extractShouldJoin(o) && (h -= n2.extractWidth(i3)), t3 += h, i3 = o;
3224
- }
3225
- return t3;
3226
- }
3227
- charProperties(e3, t3) {
3228
- return this._activeProvider.charProperties(e3, t3);
3229
- }
3230
- }
3231
- t2.UnicodeService = n2;
3232
- }, 781: (e2, t2, i2) => {
3233
- Object.defineProperty(t2, "__esModule", { value: true }), t2.Terminal = void 0;
3234
- const s2 = i2(437), r2 = i2(969), n2 = i2(460);
3235
- class a extends r2.CoreTerminal {
3236
- constructor(e3 = {}) {
3237
- super(e3), this._onBell = this.register(new n2.EventEmitter()), this.onBell = this._onBell.event, this._onCursorMove = this.register(new n2.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onTitleChange = this.register(new n2.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onA11yCharEmitter = this.register(new n2.EventEmitter()), this.onA11yChar = this._onA11yCharEmitter.event, this._onA11yTabEmitter = this.register(new n2.EventEmitter()), this.onA11yTab = this._onA11yTabEmitter.event, this._setup(), this.register(this._inputHandler.onRequestBell((() => this.bell()))), this.register(this._inputHandler.onRequestReset((() => this.reset()))), this.register((0, n2.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)), this.register((0, n2.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)), this.register((0, n2.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)), this.register((0, n2.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter));
3238
- }
3239
- get buffer() {
3240
- return this.buffers.active;
3241
- }
3242
- get markers() {
3243
- return this.buffer.markers;
3244
- }
3245
- addMarker(e3) {
3246
- if (this.buffer === this.buffers.normal) return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + e3);
3247
- }
3248
- bell() {
3249
- this._onBell.fire();
3250
- }
3251
- input(e3, t3 = true) {
3252
- this.coreService.triggerDataEvent(e3, t3);
3253
- }
3254
- resize(e3, t3) {
3255
- e3 === this.cols && t3 === this.rows || super.resize(e3, t3);
3256
- }
3257
- clear() {
3258
- if (0 !== this.buffer.ybase || 0 !== this.buffer.y) {
3259
- 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;
3260
- for (let e3 = 1; e3 < this.rows; e3++) this.buffer.lines.push(this.buffer.getBlankLine(s2.DEFAULT_ATTR_DATA));
3261
- this._onScroll.fire({ position: this.buffer.ydisp, source: 0 });
3262
- }
3263
- }
3264
- reset() {
3265
- this.options.rows = this.rows, this.options.cols = this.cols, this._setup(), super.reset();
3266
- }
3267
- }
3268
- t2.Terminal = a;
3269
- } }, t = {};
3270
- function i(s2) {
3271
- var r2 = t[s2];
3272
- if (void 0 !== r2) return r2.exports;
3273
- var n2 = t[s2] = { exports: {} };
3274
- return e[s2].call(n2.exports, n2, n2.exports, i), n2.exports;
3275
- }
3276
- var s = {};
3277
- (() => {
3278
- var e2 = s;
3279
- Object.defineProperty(e2, "__esModule", { value: true }), e2.Terminal = void 0;
3280
- const t2 = i(285), r2 = i(975), n2 = i(90), a = i(781), o = i(741), h = i(844), c = ["cols", "rows"];
3281
- class l extends h.Disposable {
3282
- constructor(e3) {
3283
- super(), this._core = this.register(new a.Terminal(e3)), this._addonManager = this.register(new o.AddonManager()), this._publicOptions = { ...this._core.options };
3284
- const t3 = (e4) => this._core.options[e4], i2 = (e4, t4) => {
3285
- this._checkReadonlyOptions(e4), this._core.options[e4] = t4;
3286
- };
3287
- for (const e4 in this._core.options) {
3288
- Object.defineProperty(this._publicOptions, e4, { get: () => this._core.options[e4], set: (t4) => {
3289
- this._checkReadonlyOptions(e4), this._core.options[e4] = t4;
3290
- } });
3291
- const s2 = { get: t3.bind(this, e4), set: i2.bind(this, e4) };
3292
- Object.defineProperty(this._publicOptions, e4, s2);
3293
- }
3294
- }
3295
- _checkReadonlyOptions(e3) {
3296
- if (c.includes(e3)) throw new Error(`Option "${e3}" can only be set in the constructor`);
3297
- }
3298
- _checkProposedApi() {
3299
- if (!this._core.optionsService.options.allowProposedApi) throw new Error("You must set the allowProposedApi option to true to use proposed API");
3300
- }
3301
- get onBell() {
3302
- return this._core.onBell;
3303
- }
3304
- get onBinary() {
3305
- return this._core.onBinary;
3306
- }
3307
- get onCursorMove() {
3308
- return this._core.onCursorMove;
3309
- }
3310
- get onData() {
3311
- return this._core.onData;
3312
- }
3313
- get onLineFeed() {
3314
- return this._core.onLineFeed;
3315
- }
3316
- get onResize() {
3317
- return this._core.onResize;
3318
- }
3319
- get onScroll() {
3320
- return this._core.onScroll;
3321
- }
3322
- get onTitleChange() {
3323
- return this._core.onTitleChange;
3324
- }
3325
- get parser() {
3326
- return this._checkProposedApi(), this._parser || (this._parser = new r2.ParserApi(this._core)), this._parser;
3327
- }
3328
- get unicode() {
3329
- return this._checkProposedApi(), new n2.UnicodeApi(this._core);
3330
- }
3331
- get rows() {
3332
- return this._core.rows;
3333
- }
3334
- get cols() {
3335
- return this._core.cols;
3336
- }
3337
- get buffer() {
3338
- return this._checkProposedApi(), this._buffer || (this._buffer = this.register(new t2.BufferNamespaceApi(this._core))), this._buffer;
3339
- }
3340
- get markers() {
3341
- return this._checkProposedApi(), this._core.markers;
3342
- }
3343
- get modes() {
3344
- const e3 = this._core.coreService.decPrivateModes;
3345
- let t3 = "none";
3346
- switch (this._core.coreMouseService.activeProtocol) {
3347
- case "X10":
3348
- t3 = "x10";
3349
- break;
3350
- case "VT200":
3351
- t3 = "vt200";
3352
- break;
3353
- case "DRAG":
3354
- t3 = "drag";
3355
- break;
3356
- case "ANY":
3357
- t3 = "any";
3358
- }
3359
- 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 };
3360
- }
3361
- get options() {
3362
- return this._publicOptions;
3363
- }
3364
- set options(e3) {
3365
- for (const t3 in e3) this._publicOptions[t3] = e3[t3];
3366
- }
3367
- input(e3, t3 = true) {
3368
- this._core.input(e3, t3);
3369
- }
3370
- resize(e3, t3) {
3371
- this._verifyIntegers(e3, t3), this._core.resize(e3, t3);
3372
- }
3373
- registerMarker(e3 = 0) {
3374
- return this._checkProposedApi(), this._verifyIntegers(e3), this._core.addMarker(e3);
3375
- }
3376
- addMarker(e3) {
3377
- return this.registerMarker(e3);
3378
- }
3379
- dispose() {
3380
- super.dispose();
3381
- }
3382
- scrollLines(e3) {
3383
- this._verifyIntegers(e3), this._core.scrollLines(e3);
3384
- }
3385
- scrollPages(e3) {
3386
- this._verifyIntegers(e3), this._core.scrollPages(e3);
3387
- }
3388
- scrollToTop() {
3389
- this._core.scrollToTop();
3390
- }
3391
- scrollToBottom() {
3392
- this._core.scrollToBottom();
3393
- }
3394
- scrollToLine(e3) {
3395
- this._verifyIntegers(e3), this._core.scrollToLine(e3);
3396
- }
3397
- clear() {
3398
- this._core.clear();
3399
- }
3400
- write(e3, t3) {
3401
- this._core.write(e3, t3);
3402
- }
3403
- writeln(e3, t3) {
3404
- this._core.write(e3), this._core.write("\r\n", t3);
3405
- }
3406
- reset() {
3407
- this._core.reset();
3408
- }
3409
- loadAddon(e3) {
3410
- this._addonManager.loadAddon(this, e3);
3411
- }
3412
- _verifyIntegers(...e3) {
3413
- for (const t3 of e3) if (t3 === 1 / 0 || isNaN(t3) || t3 % 1 != 0) throw new Error("This API only accepts integers");
3414
- }
3415
- }
3416
- e2.Terminal = l;
3417
- })();
3418
- var r = exports;
3419
- for (var n in s) r[n] = s[n];
3420
- s.__esModule && Object.defineProperty(r, "__esModule", { value: true });
3421
- })();
3422
- }
3423
- });
3424
12
 
3425
13
  // node_modules/electron/index.js
3426
14
  var require_electron = __commonJS({
@@ -3638,44 +226,25 @@ var CtlsurfApi = class {
3638
226
  };
3639
227
 
3640
228
  // src/main/bridge.ts
3641
- var import_headless = __toESM(require_xterm_headless());
3642
229
  var ConversationBridge = class {
3643
230
  wsClient = null;
3644
231
  sessionActive = false;
3645
232
  inputBuffer = "";
3646
- bytesAccumulated = 0;
3647
- // Virtual terminal for processing escape sequences into rendered text
3648
- terminal;
3649
- lastSnapshot = "";
3650
- // Flush after accumulating enough data or on a timer
233
+ outputBuffer = "";
3651
234
  FLUSH_BYTES = 2e3;
3652
- flushTimer = null;
3653
- constructor() {
3654
- this.terminal = new import_headless.Terminal({ cols: 120, rows: 50, scrollback: 1e4, allowProposedApi: true });
3655
- }
3656
235
  setWsClient(ws) {
3657
236
  this.wsClient = ws;
3658
237
  }
3659
238
  startSession() {
3660
- this.terminal.reset();
3661
- this.lastSnapshot = "";
3662
- this.bytesAccumulated = 0;
239
+ this.outputBuffer = "";
3663
240
  this.inputBuffer = "";
3664
241
  this.sessionActive = true;
3665
- if (this.flushTimer) clearInterval(this.flushTimer);
3666
- this.flushTimer = setInterval(() => this.flush(), 5e3);
3667
242
  console.log("[bridge] Session started");
3668
243
  }
3669
- /**
3670
- * Feed terminal output data into the bridge.
3671
- * xterm.write() is async — we track pending writes and only flush
3672
- * when all writes have been processed into the buffer.
3673
- */
3674
244
  feedOutput(data) {
3675
245
  if (!this.sessionActive) return;
3676
- this.terminal.write(data);
3677
- this.bytesAccumulated += data.length;
3678
- if (this.bytesAccumulated >= this.FLUSH_BYTES) {
246
+ this.outputBuffer += data;
247
+ if (this.outputBuffer.length >= this.FLUSH_BYTES) {
3679
248
  this.flush();
3680
249
  }
3681
250
  }
@@ -3690,33 +259,13 @@ var ConversationBridge = class {
3690
259
  this.inputBuffer = "";
3691
260
  }
3692
261
  }
3693
- resize(cols, rows) {
3694
- this.terminal.resize(cols, rows);
262
+ resize(_cols, _rows) {
3695
263
  }
3696
- /**
3697
- * Read new content from the terminal buffer since the last flush.
3698
- * Only flushes when all pending writes have completed.
3699
- */
3700
264
  flush() {
3701
- const buf = this.terminal.buffer.active;
3702
- const totalLines = buf.baseY + this.terminal.rows;
3703
- const allLines = [];
3704
- for (let i = 0; i < totalLines; i++) {
3705
- const line = buf.getLine(i);
3706
- if (line) {
3707
- allLines.push(line.translateToString(true));
3708
- }
3709
- }
3710
- const currentSnapshot = allLines.join("\n");
3711
- let newContent;
3712
- if (currentSnapshot.startsWith(this.lastSnapshot)) {
3713
- newContent = currentSnapshot.slice(this.lastSnapshot.length);
3714
- } else {
3715
- newContent = currentSnapshot;
3716
- }
3717
- this.lastSnapshot = currentSnapshot;
3718
- const cleaned = newContent.replace(/\n{3,}/g, "\n\n").trim();
3719
- this.bytesAccumulated = 0;
265
+ if (this.outputBuffer.length === 0) return;
266
+ const raw = this.outputBuffer;
267
+ this.outputBuffer = "";
268
+ const cleaned = cleanOutput(raw);
3720
269
  if (cleaned.length === 0) return;
3721
270
  this.sendEntry("terminal_output", cleaned);
3722
271
  }
@@ -3731,17 +280,14 @@ var ConversationBridge = class {
3731
280
  endSession() {
3732
281
  if (!this.sessionActive) return;
3733
282
  this.flush();
3734
- if (this.flushTimer) {
3735
- clearInterval(this.flushTimer);
3736
- this.flushTimer = null;
3737
- }
3738
283
  this.sessionActive = false;
3739
284
  this.inputBuffer = "";
285
+ this.outputBuffer = "";
3740
286
  console.log("[bridge] Session ended");
3741
287
  }
3742
288
  };
3743
289
  function stripAnsi(str) {
3744
- return str.replace(/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g, "").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "").replace(/\x1b[^[\]](.|$)/g, "").replace(/\x1b/g, "");
290
+ return str.replace(/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g, "").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "").replace(/\x1b[PX^_][^\x1b]*\x1b\\/g, "").replace(/\x1b[^[\]PX^_](.|$)/g, "").replace(/\x1b/g, "");
3745
291
  }
3746
292
  function processBackspaces(str) {
3747
293
  const result = [];
@@ -3760,6 +306,14 @@ function cleanInput(str) {
3760
306
  cleaned = cleaned.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
3761
307
  return cleaned.trim();
3762
308
  }
309
+ function cleanOutput(str) {
310
+ let cleaned = stripAnsi(str);
311
+ cleaned = cleaned.replace(/\r/g, "");
312
+ cleaned = cleaned.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
313
+ cleaned = cleaned.replace(/\n{3,}/g, "\n\n");
314
+ cleaned = cleaned.split("\n").filter((line) => line.trim().length > 0).join("\n");
315
+ return cleaned.trim();
316
+ }
3763
317
 
3764
318
  // src/main/workerWs.ts
3765
319
  import os from "os";