@phenx-inc/ctlsurf 0.1.4 → 0.1.7

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