UNPKG

ssh-terminal

Version:

SSH Terminal component based on xterm.js for multiple frontend frameworks

7,659 lines 438 kB
var De = Object.defineProperty;
var me = Object.getOwnPropertySymbols;
var Re = Object.prototype.hasOwnProperty, xe = Object.prototype.propertyIsEnumerable;
var Se = (J, F, I) => F in J ? De(J, F, { enumerable: !0, configurable: !0, writable: !0, value: I }) : J[F] = I, ae = (J, F) => {
  for (var I in F || (F = {}))
    Re.call(F, I) && Se(J, I, F[I]);
  if (me)
    for (var I of me(F))
      xe.call(F, I) && Se(J, I, F[I]);
  return J;
};
var Z = (J, F, I) => new Promise((W, U) => {
  var q = (o) => {
    try {
      s(I.next(o));
    } catch (a) {
      U(a);
    }
  }, x = (o) => {
    try {
      s(I.throw(o));
    } catch (a) {
      U(a);
    }
  }, s = (o) => o.done ? W(o.value) : Promise.resolve(o.value).then(q, x);
  s((I = I.apply(J, F)).next());
});
import ne from "./validation-d8717515.mjs";
import Ae from "./logger-24c8a38f.mjs";
var be = { exports: {} };
(function(J, F) {
  (function(I, W) {
    J.exports = W();
  })(self, () => (() => {
    var I = { 4567: function(x, s, o) {
      var a = this && this.__decorate || function(r, h, _, p) {
        var m, d = arguments.length, g = d < 3 ? h : p === null ? p = Object.getOwnPropertyDescriptor(h, _) : p;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          g = Reflect.decorate(r, h, _, p);
        else
          for (var y = r.length - 1; y >= 0; y--)
            (m = r[y]) && (g = (d < 3 ? m(g) : d > 3 ? m(h, _, g) : m(h, _)) || g);
        return d > 3 && g && Object.defineProperty(h, _, g), g;
      }, f = this && this.__param || function(r, h) {
        return function(_, p) {
          h(_, p, r);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.AccessibilityManager = void 0;
      const n = o(9042), c = o(6114), u = o(9924), v = o(844), l = o(5596), e = o(4725), i = o(3656);
      let t = s.AccessibilityManager = class extends v.Disposable {
        constructor(r, h) {
          super(), this._terminal = r, this._renderService = h, this._liveRegionLineCount = 0, this._charsToConsume = [], this._charsToAnnounce = "", this._accessibilityContainer = document.createElement("div"), this._accessibilityContainer.classList.add("xterm-accessibility"), this._rowContainer = document.createElement("div"), this._rowContainer.setAttribute("role", "list"), this._rowContainer.classList.add("xterm-accessibility-tree"), this._rowElements = [];
          for (let _ = 0; _ < this._terminal.rows; _++)
            this._rowElements[_] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[_]);
          if (this._topBoundaryFocusListener = (_) => this._handleBoundaryFocus(_, 0), this._bottomBoundaryFocusListener = (_) => this._handleBoundaryFocus(_, 1), this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions(), this._accessibilityContainer.appendChild(this._rowContainer), this._liveRegion = document.createElement("div"), this._liveRegion.classList.add("live-region"), this._liveRegion.setAttribute("aria-live", "assertive"), this._accessibilityContainer.appendChild(this._liveRegion), this._liveRegionDebouncer = this.register(new u.TimeBasedDebouncer(this._renderRows.bind(this))), !this._terminal.element)
            throw new Error("Cannot enable accessibility before Terminal.open");
          this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityContainer), this.register(this._terminal.onResize((_) => this._handleResize(_.rows))), this.register(this._terminal.onRender((_) => this._refreshRows(_.start, _.end))), this.register(this._terminal.onScroll(() => this._refreshRows())), this.register(this._terminal.onA11yChar((_) => this._handleChar(_))), this.register(this._terminal.onLineFeed(() => this._handleChar(`
`))), this.register(this._terminal.onA11yTab((_) => this._handleTab(_))), this.register(this._terminal.onKey((_) => this._handleKey(_.key))), this.register(this._terminal.onBlur(() => this._clearLiveRegion())), this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())), this._screenDprMonitor = new l.ScreenDprMonitor(window), this.register(this._screenDprMonitor), this._screenDprMonitor.setListener(() => this._refreshRowsDimensions()), this.register((0, i.addDisposableDomListener)(window, "resize", () => this._refreshRowsDimensions())), this._refreshRows(), this.register((0, v.toDisposable)(() => {
            this._accessibilityContainer.remove(), this._rowElements.length = 0;
          }));
        }
        _handleTab(r) {
          for (let h = 0; h < r; h++)
            this._handleChar(" ");
        }
        _handleChar(r) {
          this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== r && (this._charsToAnnounce += r) : this._charsToAnnounce += r, r === `
` && (this._liveRegionLineCount++, this._liveRegionLineCount === 21 && (this._liveRegion.textContent += n.tooMuchOutput)), c.isMac && this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode && setTimeout(() => {
            this._accessibilityContainer.appendChild(this._liveRegion);
          }, 0));
        }
        _clearLiveRegion() {
          this._liveRegion.textContent = "", this._liveRegionLineCount = 0, c.isMac && this._liveRegion.remove();
        }
        _handleKey(r) {
          this._clearLiveRegion(), new RegExp("\\p{Control}", "u").test(r) || this._charsToConsume.push(r);
        }
        _refreshRows(r, h) {
          this._liveRegionDebouncer.refresh(r, h, this._terminal.rows);
        }
        _renderRows(r, h) {
          const _ = this._terminal.buffer, p = _.lines.length.toString();
          for (let m = r; m <= h; m++) {
            const d = _.translateBufferLineToString(_.ydisp + m, !0), g = (_.ydisp + m + 1).toString(), y = this._rowElements[m];
            y && (d.length === 0 ? y.innerText = " " : y.textContent = d, y.setAttribute("aria-posinset", g), y.setAttribute("aria-setsize", p));
          }
          this._announceCharacters();
        }
        _announceCharacters() {
          this._charsToAnnounce.length !== 0 && (this._liveRegion.textContent += this._charsToAnnounce, this._charsToAnnounce = "");
        }
        _handleBoundaryFocus(r, h) {
          const _ = r.target, p = this._rowElements[h === 0 ? 1 : this._rowElements.length - 2];
          if (_.getAttribute("aria-posinset") === (h === 0 ? "1" : `${this._terminal.buffer.lines.length}`) || r.relatedTarget !== p)
            return;
          let m, d;
          if (h === 0 ? (m = _, d = this._rowElements.pop(), this._rowContainer.removeChild(d)) : (m = this._rowElements.shift(), d = _, this._rowContainer.removeChild(m)), m.removeEventListener("focus", this._topBoundaryFocusListener), d.removeEventListener("focus", this._bottomBoundaryFocusListener), h === 0) {
            const g = this._createAccessibilityTreeNode();
            this._rowElements.unshift(g), this._rowContainer.insertAdjacentElement("afterbegin", g);
          } else {
            const g = this._createAccessibilityTreeNode();
            this._rowElements.push(g), this._rowContainer.appendChild(g);
          }
          this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._terminal.scrollLines(h === 0 ? -1 : 1), this._rowElements[h === 0 ? 1 : this._rowElements.length - 2].focus(), r.preventDefault(), r.stopImmediatePropagation();
        }
        _handleResize(r) {
          this._rowElements[this._rowElements.length - 1].removeEventListener("focus", this._bottomBoundaryFocusListener);
          for (let h = this._rowContainer.children.length; h < this._terminal.rows; h++)
            this._rowElements[h] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[h]);
          for (; this._rowElements.length > r; )
            this._rowContainer.removeChild(this._rowElements.pop());
          this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions();
        }
        _createAccessibilityTreeNode() {
          const r = document.createElement("div");
          return r.setAttribute("role", "listitem"), r.tabIndex = -1, this._refreshRowDimensions(r), r;
        }
        _refreshRowsDimensions() {
          if (this._renderService.dimensions.css.cell.height) {
            this._accessibilityContainer.style.width = `${this._renderService.dimensions.css.canvas.width}px`, this._rowElements.length !== this._terminal.rows && this._handleResize(this._terminal.rows);
            for (let r = 0; r < this._terminal.rows; r++)
              this._refreshRowDimensions(this._rowElements[r]);
          }
        }
        _refreshRowDimensions(r) {
          r.style.height = `${this._renderService.dimensions.css.cell.height}px`;
        }
      };
      s.AccessibilityManager = t = a([f(1, e.IRenderService)], t);
    }, 3614: (x, s) => {
      function o(c) {
        return c.replace(/\r?\n/g, "\r");
      }
      function a(c, u) {
        return u ? "\x1B[200~" + c + "\x1B[201~" : c;
      }
      function f(c, u, v, l) {
        c = a(c = o(c), v.decPrivateModes.bracketedPasteMode && l.rawOptions.ignoreBracketedPasteMode !== !0), v.triggerDataEvent(c, !0), u.value = "";
      }
      function n(c, u, v) {
        const l = v.getBoundingClientRect(), e = c.clientX - l.left - 10, i = c.clientY - l.top - 10;
        u.style.width = "20px", u.style.height = "20px", u.style.left = `${e}px`, u.style.top = `${i}px`, u.style.zIndex = "1000", u.focus();
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.rightClickHandler = s.moveTextAreaUnderMouseCursor = s.paste = s.handlePasteEvent = s.copyHandler = s.bracketTextForPaste = s.prepareTextForTerminal = void 0, s.prepareTextForTerminal = o, s.bracketTextForPaste = a, s.copyHandler = function(c, u) {
        c.clipboardData && c.clipboardData.setData("text/plain", u.selectionText), c.preventDefault();
      }, s.handlePasteEvent = function(c, u, v, l) {
        c.stopPropagation(), c.clipboardData && f(c.clipboardData.getData("text/plain"), u, v, l);
      }, s.paste = f, s.moveTextAreaUnderMouseCursor = n, s.rightClickHandler = function(c, u, v, l, e) {
        n(c, u, v), e && l.rightClickSelect(c), u.value = l.selectionText, u.select();
      };
    }, 7239: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ColorContrastCache = void 0;
      const a = o(1505);
      s.ColorContrastCache = class {
        constructor() {
          this._color = new a.TwoKeyMap(), this._css = new a.TwoKeyMap();
        }
        setCss(f, n, c) {
          this._css.set(f, n, c);
        }
        getCss(f, n) {
          return this._css.get(f, n);
        }
        setColor(f, n, c) {
          this._color.set(f, n, c);
        }
        getColor(f, n) {
          return this._color.get(f, n);
        }
        clear() {
          this._color.clear(), this._css.clear();
        }
      };
    }, 3656: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.addDisposableDomListener = void 0, s.addDisposableDomListener = function(o, a, f, n) {
        o.addEventListener(a, f, n);
        let c = !1;
        return { dispose: () => {
          c || (c = !0, o.removeEventListener(a, f, n));
        } };
      };
    }, 6465: function(x, s, o) {
      var a = this && this.__decorate || function(e, i, t, r) {
        var h, _ = arguments.length, p = _ < 3 ? i : r === null ? r = Object.getOwnPropertyDescriptor(i, t) : r;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          p = Reflect.decorate(e, i, t, r);
        else
          for (var m = e.length - 1; m >= 0; m--)
            (h = e[m]) && (p = (_ < 3 ? h(p) : _ > 3 ? h(i, t, p) : h(i, t)) || p);
        return _ > 3 && p && Object.defineProperty(i, t, p), p;
      }, f = this && this.__param || function(e, i) {
        return function(t, r) {
          i(t, r, e);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Linkifier2 = void 0;
      const n = o(3656), c = o(8460), u = o(844), v = o(2585);
      let l = s.Linkifier2 = class extends u.Disposable {
        get currentLink() {
          return this._currentLink;
        }
        constructor(e) {
          super(), this._bufferService = e, this._linkProviders = [], this._linkCacheDisposables = [], this._isMouseOut = !0, this._wasResized = !1, this._activeLine = -1, this._onShowLinkUnderline = this.register(new c.EventEmitter()), this.onShowLinkUnderline = this._onShowLinkUnderline.event, this._onHideLinkUnderline = this.register(new c.EventEmitter()), this.onHideLinkUnderline = this._onHideLinkUnderline.event, this.register((0, u.getDisposeArrayDisposable)(this._linkCacheDisposables)), this.register((0, u.toDisposable)(() => {
            this._lastMouseEvent = void 0;
          })), this.register(this._bufferService.onResize(() => {
            this._clearCurrentLink(), this._wasResized = !0;
          }));
        }
        registerLinkProvider(e) {
          return this._linkProviders.push(e), { dispose: () => {
            const i = this._linkProviders.indexOf(e);
            i !== -1 && this._linkProviders.splice(i, 1);
          } };
        }
        attachToDom(e, i, t) {
          this._element = e, this._mouseService = i, this._renderService = t, this.register((0, n.addDisposableDomListener)(this._element, "mouseleave", () => {
            this._isMouseOut = !0, this._clearCurrentLink();
          })), this.register((0, n.addDisposableDomListener)(this._element, "mousemove", this._handleMouseMove.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this)));
        }
        _handleMouseMove(e) {
          if (this._lastMouseEvent = e, !this._element || !this._mouseService)
            return;
          const i = this._positionFromMouseEvent(e, this._element, this._mouseService);
          if (!i)
            return;
          this._isMouseOut = !1;
          const t = e.composedPath();
          for (let r = 0; r < t.length; r++) {
            const h = t[r];
            if (h.classList.contains("xterm"))
              break;
            if (h.classList.contains("xterm-hover"))
              return;
          }
          this._lastBufferCell && i.x === this._lastBufferCell.x && i.y === this._lastBufferCell.y || (this._handleHover(i), this._lastBufferCell = i);
        }
        _handleHover(e) {
          if (this._activeLine !== e.y || this._wasResized)
            return this._clearCurrentLink(), this._askForLink(e, !1), void (this._wasResized = !1);
          this._currentLink && this._linkAtPosition(this._currentLink.link, e) || (this._clearCurrentLink(), this._askForLink(e, !0));
        }
        _askForLink(e, i) {
          var t, r;
          this._activeProviderReplies && i || ((t = this._activeProviderReplies) === null || t === void 0 || t.forEach((_) => {
            _ == null || _.forEach((p) => {
              p.link.dispose && p.link.dispose();
            });
          }), this._activeProviderReplies = /* @__PURE__ */ new Map(), this._activeLine = e.y);
          let h = !1;
          for (const [_, p] of this._linkProviders.entries())
            i ? !((r = this._activeProviderReplies) === null || r === void 0) && r.get(_) && (h = this._checkLinkProviderResult(_, e, h)) : p.provideLinks(e.y, (m) => {
              var d, g;
              if (this._isMouseOut)
                return;
              const y = m == null ? void 0 : m.map((L) => ({ link: L }));
              (d = this._activeProviderReplies) === null || d === void 0 || d.set(_, y), h = this._checkLinkProviderResult(_, e, h), ((g = this._activeProviderReplies) === null || g === void 0 ? void 0 : g.size) === this._linkProviders.length && this._removeIntersectingLinks(e.y, this._activeProviderReplies);
            });
        }
        _removeIntersectingLinks(e, i) {
          const t = /* @__PURE__ */ new Set();
          for (let r = 0; r < i.size; r++) {
            const h = i.get(r);
            if (h)
              for (let _ = 0; _ < h.length; _++) {
                const p = h[_], m = p.link.range.start.y < e ? 0 : p.link.range.start.x, d = p.link.range.end.y > e ? this._bufferService.cols : p.link.range.end.x;
                for (let g = m; g <= d; g++) {
                  if (t.has(g)) {
                    h.splice(_--, 1);
                    break;
                  }
                  t.add(g);
                }
              }
          }
        }
        _checkLinkProviderResult(e, i, t) {
          var r;
          if (!this._activeProviderReplies)
            return t;
          const h = this._activeProviderReplies.get(e);
          let _ = !1;
          for (let p = 0; p < e; p++)
            this._activeProviderReplies.has(p) && !this._activeProviderReplies.get(p) || (_ = !0);
          if (!_ && h) {
            const p = h.find((m) => this._linkAtPosition(m.link, i));
            p && (t = !0, this._handleNewLink(p));
          }
          if (this._activeProviderReplies.size === this._linkProviders.length && !t)
            for (let p = 0; p < this._activeProviderReplies.size; p++) {
              const m = (r = this._activeProviderReplies.get(p)) === null || r === void 0 ? void 0 : r.find((d) => this._linkAtPosition(d.link, i));
              if (m) {
                t = !0, this._handleNewLink(m);
                break;
              }
            }
          return t;
        }
        _handleMouseDown() {
          this._mouseDownLink = this._currentLink;
        }
        _handleMouseUp(e) {
          if (!this._element || !this._mouseService || !this._currentLink)
            return;
          const i = this._positionFromMouseEvent(e, this._element, this._mouseService);
          i && this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, i) && this._currentLink.link.activate(e, this._currentLink.link.text);
        }
        _clearCurrentLink(e, i) {
          this._element && this._currentLink && this._lastMouseEvent && (!e || !i || this._currentLink.link.range.start.y >= e && this._currentLink.link.range.end.y <= i) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent), this._currentLink = void 0, (0, u.disposeArray)(this._linkCacheDisposables));
        }
        _handleNewLink(e) {
          if (!this._element || !this._lastMouseEvent || !this._mouseService)
            return;
          const i = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
          i && this._linkAtPosition(e.link, i) && (this._currentLink = e, this._currentLink.state = { decorations: { underline: e.link.decorations === void 0 || e.link.decorations.underline, pointerCursor: e.link.decorations === void 0 || e.link.decorations.pointerCursor }, isHovered: !0 }, this._linkHover(this._element, e.link, this._lastMouseEvent), e.link.decorations = {}, Object.defineProperties(e.link.decorations, { pointerCursor: { get: () => {
            var t, r;
            return (r = (t = this._currentLink) === null || t === void 0 ? void 0 : t.state) === null || r === void 0 ? void 0 : r.decorations.pointerCursor;
          }, set: (t) => {
            var r, h;
            !((r = this._currentLink) === null || r === void 0) && r.state && this._currentLink.state.decorations.pointerCursor !== t && (this._currentLink.state.decorations.pointerCursor = t, this._currentLink.state.isHovered && ((h = this._element) === null || h === void 0 || h.classList.toggle("xterm-cursor-pointer", t)));
          } }, underline: { get: () => {
            var t, r;
            return (r = (t = this._currentLink) === null || t === void 0 ? void 0 : t.state) === null || r === void 0 ? void 0 : r.decorations.underline;
          }, set: (t) => {
            var r, h, _;
            !((r = this._currentLink) === null || r === void 0) && r.state && ((_ = (h = this._currentLink) === null || h === void 0 ? void 0 : h.state) === null || _ === void 0 ? void 0 : _.decorations.underline) !== t && (this._currentLink.state.decorations.underline = t, this._currentLink.state.isHovered && this._fireUnderlineEvent(e.link, t));
          } } }), this._renderService && this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((t) => {
            if (!this._currentLink)
              return;
            const r = t.start === 0 ? 0 : t.start + 1 + this._bufferService.buffer.ydisp, h = this._bufferService.buffer.ydisp + 1 + t.end;
            if (this._currentLink.link.range.start.y >= r && this._currentLink.link.range.end.y <= h && (this._clearCurrentLink(r, h), this._lastMouseEvent && this._element)) {
              const _ = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
              _ && this._askForLink(_, !1);
            }
          })));
        }
        _linkHover(e, i, t) {
          var r;
          !((r = this._currentLink) === null || r === void 0) && r.state && (this._currentLink.state.isHovered = !0, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(i, !0), this._currentLink.state.decorations.pointerCursor && e.classList.add("xterm-cursor-pointer")), i.hover && i.hover(t, i.text);
        }
        _fireUnderlineEvent(e, i) {
          const t = e.range, r = this._bufferService.buffer.ydisp, h = this._createLinkUnderlineEvent(t.start.x - 1, t.start.y - r - 1, t.end.x, t.end.y - r - 1, void 0);
          (i ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(h);
        }
        _linkLeave(e, i, t) {
          var r;
          !((r = this._currentLink) === null || r === void 0) && r.state && (this._currentLink.state.isHovered = !1, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(i, !1), this._currentLink.state.decorations.pointerCursor && e.classList.remove("xterm-cursor-pointer")), i.leave && i.leave(t, i.text);
        }
        _linkAtPosition(e, i) {
          const t = e.range.start.y * this._bufferService.cols + e.range.start.x, r = e.range.end.y * this._bufferService.cols + e.range.end.x, h = i.y * this._bufferService.cols + i.x;
          return t <= h && h <= r;
        }
        _positionFromMouseEvent(e, i, t) {
          const r = t.getCoords(e, i, this._bufferService.cols, this._bufferService.rows);
          if (r)
            return { x: r[0], y: r[1] + this._bufferService.buffer.ydisp };
        }
        _createLinkUnderlineEvent(e, i, t, r, h) {
          return { x1: e, y1: i, x2: t, y2: r, cols: this._bufferService.cols, fg: h };
        }
      };
      s.Linkifier2 = l = a([f(0, v.IBufferService)], l);
    }, 9042: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.tooMuchOutput = s.promptLabel = void 0, s.promptLabel = "Terminal input", s.tooMuchOutput = "Too much output to announce, navigate to rows manually to read";
    }, 3730: function(x, s, o) {
      var a = this && this.__decorate || function(l, e, i, t) {
        var r, h = arguments.length, _ = h < 3 ? e : t === null ? t = Object.getOwnPropertyDescriptor(e, i) : t;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          _ = Reflect.decorate(l, e, i, t);
        else
          for (var p = l.length - 1; p >= 0; p--)
            (r = l[p]) && (_ = (h < 3 ? r(_) : h > 3 ? r(e, i, _) : r(e, i)) || _);
        return h > 3 && _ && Object.defineProperty(e, i, _), _;
      }, f = this && this.__param || function(l, e) {
        return function(i, t) {
          e(i, t, l);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.OscLinkProvider = void 0;
      const n = o(511), c = o(2585);
      let u = s.OscLinkProvider = class {
        constructor(l, e, i) {
          this._bufferService = l, this._optionsService = e, this._oscLinkService = i;
        }
        provideLinks(l, e) {
          var i;
          const t = this._bufferService.buffer.lines.get(l - 1);
          if (!t)
            return void e(void 0);
          const r = [], h = this._optionsService.rawOptions.linkHandler, _ = new n.CellData(), p = t.getTrimmedLength();
          let m = -1, d = -1, g = !1;
          for (let y = 0; y < p; y++)
            if (d !== -1 || t.hasContent(y)) {
              if (t.loadCell(y, _), _.hasExtendedAttrs() && _.extended.urlId) {
                if (d === -1) {
                  d = y, m = _.extended.urlId;
                  continue;
                }
                g = _.extended.urlId !== m;
              } else
                d !== -1 && (g = !0);
              if (g || d !== -1 && y === p - 1) {
                const L = (i = this._oscLinkService.getLinkData(m)) === null || i === void 0 ? void 0 : i.uri;
                if (L) {
                  const b = { start: { x: d + 1, y: l }, end: { x: y + (g || y !== p - 1 ? 0 : 1), y: l } };
                  let k = !1;
                  if (!(h != null && h.allowNonHttpProtocols))
                    try {
                      const A = new URL(L);
                      ["http:", "https:"].includes(A.protocol) || (k = !0);
                    } catch (A) {
                      k = !0;
                    }
                  k || r.push({ text: L, range: b, activate: (A, B) => h ? h.activate(A, B, b) : v(0, B), hover: (A, B) => {
                    var T;
                    return (T = h == null ? void 0 : h.hover) === null || T === void 0 ? void 0 : T.call(h, A, B, b);
                  }, leave: (A, B) => {
                    var T;
                    return (T = h == null ? void 0 : h.leave) === null || T === void 0 ? void 0 : T.call(h, A, B, b);
                  } });
                }
                g = !1, _.hasExtendedAttrs() && _.extended.urlId ? (d = y, m = _.extended.urlId) : (d = -1, m = -1);
              }
            }
          e(r);
        }
      };
      function v(l, e) {
        if (confirm(`Do you want to navigate to ${e}?

WARNING: This link could potentially be dangerous`)) {
          const i = window.open();
          if (i) {
            try {
              i.opener = null;
            } catch (t) {
            }
            i.location.href = e;
          } else
            console.warn("Opening link blocked as opener could not be cleared");
        }
      }
      s.OscLinkProvider = u = a([f(0, c.IBufferService), f(1, c.IOptionsService), f(2, c.IOscLinkService)], u);
    }, 6193: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.RenderDebouncer = void 0, s.RenderDebouncer = class {
        constructor(o, a) {
          this._parentWindow = o, this._renderCallback = a, this._refreshCallbacks = [];
        }
        dispose() {
          this._animationFrame && (this._parentWindow.cancelAnimationFrame(this._animationFrame), this._animationFrame = void 0);
        }
        addRefreshCallback(o) {
          return this._refreshCallbacks.push(o), this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh())), this._animationFrame;
        }
        refresh(o, a, f) {
          this._rowCount = f, o = o !== void 0 ? o : 0, a = a !== void 0 ? a : this._rowCount - 1, this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, o) : o, this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, a) : a, this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh()));
        }
        _innerRefresh() {
          if (this._animationFrame = void 0, this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
            return void this._runRefreshCallbacks();
          const o = Math.max(this._rowStart, 0), a = Math.min(this._rowEnd, this._rowCount - 1);
          this._rowStart = void 0, this._rowEnd = void 0, this._renderCallback(o, a), this._runRefreshCallbacks();
        }
        _runRefreshCallbacks() {
          for (const o of this._refreshCallbacks)
            o(0);
          this._refreshCallbacks = [];
        }
      };
    }, 5596: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ScreenDprMonitor = void 0;
      const a = o(844);
      class f extends a.Disposable {
        constructor(c) {
          super(), this._parentWindow = c, this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio, this.register((0, a.toDisposable)(() => {
            this.clearListener();
          }));
        }
        setListener(c) {
          this._listener && this.clearListener(), this._listener = c, this._outerListener = () => {
            this._listener && (this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio), this._updateDpr());
          }, this._updateDpr();
        }
        _updateDpr() {
          var c;
          this._outerListener && ((c = this._resolutionMediaMatchList) === null || c === void 0 || c.removeListener(this._outerListener), this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio, this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`), this._resolutionMediaMatchList.addListener(this._outerListener));
        }
        clearListener() {
          this._resolutionMediaMatchList && this._listener && this._outerListener && (this._resolutionMediaMatchList.removeListener(this._outerListener), this._resolutionMediaMatchList = void 0, this._listener = void 0, this._outerListener = void 0);
        }
      }
      s.ScreenDprMonitor = f;
    }, 3236: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Terminal = void 0;
      const a = o(3614), f = o(3656), n = o(6465), c = o(9042), u = o(3730), v = o(1680), l = o(3107), e = o(5744), i = o(2950), t = o(1296), r = o(428), h = o(4269), _ = o(5114), p = o(8934), m = o(3230), d = o(9312), g = o(4725), y = o(6731), L = o(8055), b = o(8969), k = o(8460), A = o(844), B = o(6114), T = o(8437), M = o(2584), S = o(7399), w = o(5941), E = o(9074), D = o(2585), H = o(5435), N = o(4567), K = typeof window != "undefined" ? window.document : null;
      class j extends b.CoreTerminal {
        get onFocus() {
          return this._onFocus.event;
        }
        get onBlur() {
          return this._onBlur.event;
        }
        get onA11yChar() {
          return this._onA11yCharEmitter.event;
        }
        get onA11yTab() {
          return this._onA11yTabEmitter.event;
        }
        get onWillOpen() {
          return this._onWillOpen.event;
        }
        constructor(C = {}) {
          super(C), this.browser = B, this._keyDownHandled = !1, this._keyDownSeen = !1, this._keyPressHandled = !1, this._unprocessedDeadKey = !1, this._accessibilityManager = this.register(new A.MutableDisposable()), this._onCursorMove = this.register(new k.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onKey = this.register(new k.EventEmitter()), this.onKey = this._onKey.event, this._onRender = this.register(new k.EventEmitter()), this.onRender = this._onRender.event, this._onSelectionChange = this.register(new k.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onTitleChange = this.register(new k.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onBell = this.register(new k.EventEmitter()), this.onBell = this._onBell.event, this._onFocus = this.register(new k.EventEmitter()), this._onBlur = this.register(new k.EventEmitter()), this._onA11yCharEmitter = this.register(new k.EventEmitter()), this._onA11yTabEmitter = this.register(new k.EventEmitter()), this._onWillOpen = this.register(new k.EventEmitter()), this._setup(), this.linkifier2 = this.register(this._instantiationService.createInstance(n.Linkifier2)), this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(u.OscLinkProvider)), this._decorationService = this._instantiationService.createInstance(E.DecorationService), this._instantiationService.setService(D.IDecorationService, this._decorationService), this.register(this._inputHandler.onRequestBell(() => this._onBell.fire())), this.register(this._inputHandler.onRequestRefreshRows((R, O) => this.refresh(R, O))), this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus())), this.register(this._inputHandler.onRequestReset(() => this.reset())), this.register(this._inputHandler.onRequestWindowsOptionsReport((R) => this._reportWindowsOptions(R))), this.register(this._inputHandler.onColor((R) => this._handleColorEvent(R))), this.register((0, k.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)), this.register((0, k.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)), this.register((0, k.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)), this.register((0, k.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)), this.register(this._bufferService.onResize((R) => this._afterResize(R.cols, R.rows))), this.register((0, A.toDisposable)(() => {
            var R, O;
            this._customKeyEventHandler = void 0, (O = (R = this.element) === null || R === void 0 ? void 0 : R.parentNode) === null || O === void 0 || O.removeChild(this.element);
          }));
        }
        _handleColorEvent(C) {
          if (this._themeService)
            for (const R of C) {
              let O, P = "";
              switch (R.index) {
                case 256:
                  O = "foreground", P = "10";
                  break;
                case 257:
                  O = "background", P = "11";
                  break;
                case 258:
                  O = "cursor", P = "12";
                  break;
                default:
                  O = "ansi", P = "4;" + R.index;
              }
              switch (R.type) {
                case 0:
                  const z = L.color.toColorRGB(O === "ansi" ? this._themeService.colors.ansi[R.index] : this._themeService.colors[O]);
                  this.coreService.triggerDataEvent(`${M.C0.ESC}]${P};${(0, w.toRgbString)(z)}${M.C1_ESCAPED.ST}`);
                  break;
                case 1:
                  if (O === "ansi")
                    this._themeService.modifyColors(($) => $.ansi[R.index] = L.rgba.toColor(...R.color));
                  else {
                    const $ = O;
                    this._themeService.modifyColors((G) => G[$] = L.rgba.toColor(...R.color));
                  }
                  break;
                case 2:
                  this._themeService.restoreColor(R.index);
              }
            }
        }
        _setup() {
          super._setup(), this._customKeyEventHandler = void 0;
        }
        get buffer() {
          return this.buffers.active;
        }
        focus() {
          this.textarea && this.textarea.focus({ preventScroll: !0 });
        }
        _handleScreenReaderModeOptionChange(C) {
          C ? !this._accessibilityManager.value && this._renderService && (this._accessibilityManager.value = this._instantiationService.createInstance(N.AccessibilityManager, this)) : this._accessibilityManager.clear();
        }
        _handleTextAreaFocus(C) {
          this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(M.C0.ESC + "[I"), this.updateCursorStyle(C), this.element.classList.add("focus"), this._showCursor(), this._onFocus.fire();
        }
        blur() {
          var C;
          return (C = this.textarea) === null || C === void 0 ? void 0 : C.blur();
        }
        _handleTextAreaBlur() {
          this.textarea.value = "", this.refresh(this.buffer.y, this.buffer.y), this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(M.C0.ESC + "[O"), this.element.classList.remove("focus"), this._onBlur.fire();
        }
        _syncTextArea() {
          if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper.isComposing || !this._renderService)
            return;
          const C = this.buffer.ybase + this.buffer.y, R = this.buffer.lines.get(C);
          if (!R)
            return;
          const O = Math.min(this.buffer.x, this.cols - 1), P = this._renderService.dimensions.css.cell.height, z = R.getWidth(O), $ = this._renderService.dimensions.css.cell.width * z, G = this.buffer.y * this._renderService.dimensions.css.cell.height, Q = O * this._renderService.dimensions.css.cell.width;
          this.textarea.style.left = Q + "px", this.textarea.style.top = G + "px", this.textarea.style.width = $ + "px", this.textarea.style.height = P + "px", this.textarea.style.lineHeight = P + "px", this.textarea.style.zIndex = "-5";
        }
        _initGlobal() {
          this._bindKeys(), this.register((0, f.addDisposableDomListener)(this.element, "copy", (R) => {
            this.hasSelection() && (0, a.copyHandler)(R, this._selectionService);
          }));
          const C = (R) => (0, a.handlePasteEvent)(R, this.textarea, this.coreService, this.optionsService);
          this.register((0, f.addDisposableDomListener)(this.textarea, "paste", C)), this.register((0, f.addDisposableDomListener)(this.element, "paste", C)), B.isFirefox ? this.register((0, f.addDisposableDomListener)(this.element, "mousedown", (R) => {
            R.button === 2 && (0, a.rightClickHandler)(R, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord);
          })) : this.register((0, f.addDisposableDomListener)(this.element, "contextmenu", (R) => {
            (0, a.rightClickHandler)(R, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord);
          })), B.isLinux && this.register((0, f.addDisposableDomListener)(this.element, "auxclick", (R) => {
            R.button === 1 && (0, a.moveTextAreaUnderMouseCursor)(R, this.textarea, this.screenElement);
          }));
        }
        _bindKeys() {
          this.register((0, f.addDisposableDomListener)(this.textarea, "keyup", (C) => this._keyUp(C), !0)), this.register((0, f.addDisposableDomListener)(this.textarea, "keydown", (C) => this._keyDown(C), !0)), this.register((0, f.addDisposableDomListener)(this.textarea, "keypress", (C) => this._keyPress(C), !0)), this.register((0, f.addDisposableDomListener)(this.textarea, "compositionstart", () => this._compositionHelper.compositionstart())), this.register((0, f.addDisposableDomListener)(this.textarea, "compositionupdate", (C) => this._compositionHelper.compositionupdate(C))), this.register((0, f.addDisposableDomListener)(this.textarea, "compositionend", () => this._compositionHelper.compositionend())), this.register((0, f.addDisposableDomListener)(this.textarea, "input", (C) => this._inputEvent(C), !0)), this.register(this.onRender(() => this._compositionHelper.updateCompositionElements()));
        }
        open(C) {
          var R;
          if (!C)
            throw new Error("Terminal requires a parent element.");
          C.isConnected || this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"), this._document = C.ownerDocument, this.element = this._document.createElement("div"), this.element.dir = "ltr", this.element.classList.add("terminal"), this.element.classList.add("xterm"), C.appendChild(this.element);
          const O = K.createDocumentFragment();
          this._viewportElement = K.createElement("div"), this._viewportElement.classList.add("xterm-viewport"), O.appendChild(this._viewportElement), this._viewportScrollArea = K.createElement("div"), this._viewportScrollArea.classList.add("xterm-scroll-area"), this._viewportElement.appendChild(this._viewportScrollArea), this.screenElement = K.createElement("div"), this.screenElement.classList.add("xterm-screen"), this._helperContainer = K.createElement("div"), this._helperContainer.classList.add("xterm-helpers"), this.screenElement.appendChild(this._helperContainer), O.appendChild(this.screenElement), this.textarea = K.createElement("textarea"), this.textarea.classList.add("xterm-helper-textarea"), this.textarea.setAttribute("aria-label", c.promptLabel), B.isChromeOS || this.textarea.setAttribute("aria-multiline", "false"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.tabIndex = 0, this._coreBrowserService = this._instantiationService.createInstance(_.CoreBrowserService, this.textarea, (R = this._document.defaultView) !== null && R !== void 0 ? R : window), this._instantiationService.setService(g.ICoreBrowserService, this._coreBrowserService), this.register((0, f.addDisposableDomListener)(this.textarea, "focus", (P) => this._handleTextAreaFocus(P))), this.register((0, f.addDisposableDomListener)(this.textarea, "blur", () => this._handleTextAreaBlur())), this._helperContainer.appendChild(this.textarea), this._charSizeService = this._instantiationService.createInstance(r.CharSizeService, this._document, this._helperContainer), this._instantiationService.setService(g.ICharSizeService, this._charSizeService), this._themeService = this._instantiationService.createInstance(y.ThemeService), this._instantiationService.setService(g.IThemeService, this._themeService), this._characterJoinerService = this._instantiationService.createInstance(h.CharacterJoinerService), this._instantiationService.setService(g.ICharacterJoinerService, this._characterJoinerService), this._renderService = this.register(this._instantiationService.createInstance(m.RenderService, this.rows, this.screenElement)), this._instantiationService.setService(g.IRenderService, this._renderService), this.register(this._renderService.onRenderedViewportChange((P) => this._onRender.fire(P))), this.onResize((P) => this._renderService.resize(P.cols, P.rows)), this._compositionView = K.createElement("div"), this._compositionView.classList.add("composition-view"), this._compositionHelper = this._instantiationService.createInstance(i.CompositionHelper, this.textarea, this._compositionView), this._helperContainer.appendChild(this._compositionView), this.element.appendChild(O);
          try {
            this._onWillOpen.fire(this.element);
          } catch (P) {
          }
          this._renderService.hasRenderer() || this._renderService.setRenderer(this._createRenderer()), this._mouseService = this._instantiationService.createInstance(p.MouseService), this._instantiationService.setService(g.IMouseService, this._mouseService), this.viewport = this._instantiationService.createInstance(v.Viewport, this._viewportElement, this._viewportScrollArea), this.viewport.onRequestScrollLines((P) => this.scrollLines(P.amount, P.suppressScrollEvent, 1)), this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport.syncScrollArea())), this.register(this.viewport), this.register(this.onCursorMove(() => {
            this._renderService.handleCursorMove(), this._syncTextArea();
          })), this.register(this.onResize(() => this._renderService.handleResize(this.cols, this.rows))), this.register(this.onBlur(() => this._renderService.handleBlur())), this.register(this.onFocus(() => this._renderService.handleFocus())), this.register(this._renderService.onDimensionsChange(() => this.viewport.syncScrollArea())), this._selectionService = this.register(this._instantiationService.createInstance(d.SelectionService, this.element, this.screenElement, this.linkifier2)), this._instantiationService.setService(g.ISelectionService, this._selectionService), this.register(this._selectionService.onRequestScrollLines((P) => this.scrollLines(P.amount, P.suppressScrollEvent))), this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())), this.register(this._selectionService.onRequestRedraw((P) => this._renderService.handleSelectionChanged(P.start, P.end, P.columnSelectMode))), this.register(this._selectionService.onLinuxMouseSelection((P) => {
            this.textarea.value = P, this.textarea.focus(), this.textarea.select();
          })), this.register(this._onScroll.event((P) => {
            this.viewport.syncScrollArea(), this._selectionService.refresh();
          })), this.register((0, f.addDisposableDomListener)(this._viewportElement, "scroll", () => this._selectionService.refresh())), this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService), this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer, this.screenElement)), this.register((0, f.addDisposableDomListener)(this.element, "mousedown", (P) => this._selectionService.handleMouseDown(P))), this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(), this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(), this.options.screenReaderMode && (this._accessibilityManager.value = this._instantiationService.createInstance(N.AccessibilityManager, this)), this.register(this.optionsService.onSpecificOptionChange("screenReaderMode", (P) => this._handleScreenReaderModeOptionChange(P))), this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer, this._viewportElement, this.screenElement))), this.optionsService.onSpecificOptionChange("overviewRulerWidth", (P) => {
            !this._overviewRulerRenderer && P && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer, this._viewportElement, this.screenElement)));
          }), this._charSizeService.measure(), this.refresh(0, this.rows - 1), this._initGlobal(), this.bindMouse();
        }
        _createRenderer() {
          return this._instantiationService.createInstance(t.DomRenderer, this.element, this.screenElement, this._viewportElement, this.linkifier2);
        }
        bindMouse() {
          const C = this, R = this.element;
          function O($) {
            const G = C._mouseService.getMouseReportCoords($, C.screenElement);
            if (!G)
              return !1;
            let Q, ee;
            switch ($.overrideType || $.type) {
              case "mousemove":
                ee = 32, $.buttons === void 0 ? (Q = 3, $.button !== void 0 && (Q = $.button < 3 ? $.button : 3)) : Q = 1 & $.buttons ? 0 : 4 & $.buttons ? 1 : 2 & $.buttons ? 2 : 3;
                break;
              case "mouseup":
                ee = 0, Q = $.button < 3 ? $.button : 3;
                break;
              case "mousedown":
                ee = 1, Q = $.button < 3 ? $.button : 3;
                break;
              case "wheel":
                if (C.viewport.getLinesScrolled($) === 0)
                  return !1;
                ee = $.deltaY < 0 ? 0 : 1, Q = 4;
                break;
              default:
                return !1;
            }
            return !(ee === void 0 || Q === void 0 || Q > 4) && C.coreMouseService.triggerMouseEvent({ col: G.col, row: G.row, x: G.x, y: G.y, button: Q, action: ee, ctrl: $.ctrlKey, alt: $.altKey, shift: $.shiftKey });
          }
          const P = { mouseup: null, wheel: null, mousedrag: null, mousemove: null }, z = { mouseup: ($) => (O($), $.buttons || (this._document.removeEventListener("mouseup", P.mouseup), P.mousedrag && this._document.removeEventListener("mousemove", P.mousedrag)), this.cancel($)), wheel: ($) => (O($), this.cancel($, !0)), mousedrag: ($) => {
            $.buttons && O($);
          }, mousemove: ($) => {
            $.buttons || O($);
          } };
          this.register(this.coreMouseService.onProtocolChange(($) => {
            $ ? (this.optionsService.rawOptions.logLevel === "debug" && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents($)), this.element.classList.add("enable-mouse-events"), this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."), this.element.classList.remove("enable-mouse-events"), this._selectionService.enable()), 8 & $ ? P.mousemove || (R.addEventListener("mousemove", z.mousemove), P.mousemove = z.mousemove) : (R.removeEventListener("mousemove", P.mousemove), P.mousemove = null), 16 & $ ? P.wheel || (R.addEventListener("wheel", z.wheel, { passive: !1 }), P.wheel = z.wheel) : (R.removeEventListener("wheel", P.wheel), P.wheel = null), 2 & $ ? P.mouseup || (R.addEventListener("mouseup", z.mouseup), P.mouseup = z.mouseup) : (this._document.removeEventListener("mouseup", P.mouseup), R.removeEventListener("mouseup", P.mouseup), P.mouseup = null), 4 & $ ? P.mousedrag || (P.mousedrag = z.mousedrag) : (this._document.removeEventListener("mousemove", P.mousedrag), P.mousedrag = null);
          })), this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol, this.register((0, f.addDisposableDomListener)(R, "mousedown", ($) => {
            if ($.preventDefault(), this.focus(), this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection($))
              return O($), P.mouseup && this._document.addEventListener("mouseup", P.mouseup), P.mousedrag && this._document.addEventListener("mousemove", P.mousedrag), this.cancel($);
          })), this.register((0, f.addDisposableDomListener)(R, "wheel", ($) => {
            if (!P.wheel) {
              if (!this.buffer.hasScrollback) {
                const G = this.viewport.getLinesScrolled($);
                if (G === 0)
                  return;
                const Q = M.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + ($.deltaY < 0 ? "A" : "B");
                let ee = "";
                for (let oe = 0; oe < Math.abs(G); oe++)
                  ee += Q;
                return this.coreService.triggerDataEvent(ee, !0), this.cancel($, !0);
              }
              return this.viewport.handleWheel($) ? this.cancel($) : void 0;
            }
          }, { passive: !1 })), this.register((0, f.addDisposableDomListener)(R, "touchstart", ($) => {
            if (!this.coreMouseService.areMouseEventsActive)
              return this.viewport.handleTouchStart($), this.cancel($);
          }, { passive: !0 })), this.register((0, f.addDisposableDomListener)(R, "touchmove", ($) => {
            if (!this.coreMouseService.areMouseEventsActive)
              return this.viewport.handleTouchMove($) ? void 0 : this.cancel($);
          }, { passive: !1 }));
        }
        refresh(C, R) {
          var O;
          (O = this._renderService) === null || O === void 0 || O.refreshRows(C, R);
        }
        updateCursorStyle(C) {
          var R;
          !((R = this._selectionService) === null || R === void 0) && R.shouldColumnSelect(C) ? this.element.classList.add("column-select") : this.element.classList.remove("column-select");
        }
        _showCursor() {
          this.coreService.isCursorInitialized || (this.coreService.isCursorInitialized = !0, this.refresh(this.buffer.y, this.buffer.y));
        }
        scrollLines(C, R, O = 0) {
          var P;
          O === 1 ? (super.scrollLines(C, R, O), this.refresh(0, this.rows - 1)) : (P = this.viewport) === null || P === void 0 || P.scrollLines(C);
        }
        paste(C) {
          (0, a.paste)(C, this.textarea, this.coreService, this.optionsService);
        }
        attachCustomKeyEventHandler(C) {
          this._customKeyEventHandler = C;
        }
        registerLinkProvider(C) {
          return this.linkifier2.registerLinkProvider(C);
        }
        registerCharacterJoiner(C) {
          if (!this._characterJoinerService)
            throw new Error("Terminal must be opened first");
          const R = this._characterJoinerService.register(C);
          return this.refresh(0, this.rows - 1), R;
        }
        deregisterCharacterJoiner(C) {
          if (!this._characterJoinerService)
            throw new Error("Terminal must be opened first");
          this._characterJoinerService.deregister(C) && this.refresh(0, this.rows - 1);
        }
        get markers() {
          return this.buffer.markers;
        }
        registerMarker(C) {
          return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + C);
        }
        registerDecoration(C) {
          return this._decorationService.registerDecoration(C);
        }
        hasSelection() {
          return !!this._selectionService && this._selectionService.hasSelection;
        }
        select(C, R, O) {
          this._selectionService.setSelection(C, R, O);
        }
        getSelection() {
          return this._selectionService ? this._selectionService.selectionText : "";
        }
        getSelectionPosition() {
          if (this._selectionService && this._selectionService.hasSelection)
            return { start: { x: this._selectionService.selectionStart[0], y: this._selectionService.selectionStart[1] }, end: { x: this._selectionService.selectionEnd[0], y: this._selectionService.selectionEnd[1] } };
        }
        clearSelection() {
          var C;
          (C = this._selectionService) === null || C === void 0 || C.clearSelection();
        }
        selectAll() {
          var C;
          (C = this._selectionService) === null || C === void 0 || C.selectAll();
        }
        selectLines(C, R) {
          var O;
          (O = this._selectionService) === null || O === void 0 || O.selectLines(C, R);
        }
        _keyDown(C) {
          if (this._keyDownHandled = !1, this._keyDownSeen = !0, this._customKeyEventHandler && this._customKeyEventHandler(C) === !1)
            return !1;
          const R = this.browser.isMac && this.options.macOptionIsMeta && C.altKey;
          if (!R && !this._compositionHelper.keydown(C))
            return this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp && this.scrollToBottom(), !1;
          R || C.key !== "Dead" && C.key !== "AltGraph" || (this._unprocessedDeadKey = !0);
          const O = (0, S.evaluateKeyboardEvent)(C, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
          if (this.updateCursorStyle(C), O.type === 3 || O.type === 2) {
            const P = this.rows - 1;
            return this.scrollLines(O.type === 2 ? -P : P), this.cancel(C, !0);
          }
          return O.type === 1 && this.selectAll(), !!this._isThirdLevelShift(this.browser, C) || (O.cancel && this.cancel(C, !0), !O.key || !!(C.key && !C.ctrlKey && !C.altKey && !C.metaKey && C.key.length === 1 && C.key.charCodeAt(0) >= 65 && C.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = !1, !0) : (O.key !== M.C0.ETX && O.key !== M.C0.CR || (this.textarea.value = ""), this._onKey.fire({ key: O.key, domEvent: C }), this._showCursor(), this.coreService.triggerDataEvent(O.key, !0), !this.optionsService.rawOptions.screenReaderMode || C.altKey || C.ctrlKey ? this.cancel(C, !0) : void (this._keyDownHandled = !0))));
        }
        _isThirdLevelShift(C, R) {
          const O = C.isMac && !this.options.macOptionIsMeta && R.altKey && !R.ctrlKey && !R.metaKey || C.isWindows && R.altKey && R.ctrlKey && !R.metaKey || C.isWindows && R.getModifierState("AltGraph");
          return R.type === "keypress" ? O : O && (!R.keyCode || R.keyCode > 47);
        }
        _keyUp(C) {
          this._keyDownSeen = !1, this._customKeyEventHandler && this._customKeyEventHandler(C) === !1 || (function(R) {
            return R.keyCode === 16 || R.keyCode === 17 || R.keyCode === 18;
          }(C) || this.focus(), this.updateCursorStyle(C), this._keyPressHandled = !1);
        }
        _keyPress(C) {
          let R;
          if (this._keyPressHandled = !1, this._keyDownHandled || this._customKeyEventHandler && this._customKeyEventHandler(C) === !1)
            return !1;
          if (this.cancel(C), C.charCode)
            R = C.charCode;
          else if (C.which === null || C.which === void 0)
            R = C.keyCode;
          else {
            if (C.which === 0 || C.charCode === 0)
              return !1;
            R = C.which;
          }
          return !(!R || (C.altKey || C.ctrlKey || C.metaKey) && !this._isThirdLevelShift(this.browser, C) || (R = String.fromCharCode(R), this._onKey.fire({ key: R, domEvent: C }), this._showCursor(), this.coreService.triggerDataEvent(R, !0), this._keyPressHandled = !0, this._unprocessedDeadKey = !1, 0));
        }
        _inputEvent(C) {
          if (C.data && C.inputType === "insertText" && (!C.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
            if (this._keyPressHandled)
              return !1;
            this._unprocessedDeadKey = !1;
            const R = C.data;
            return this.coreService.triggerDataEvent(R, !0), this.cancel(C), !0;
          }
          return !1;
        }
        resize(C, R) {
          C !== this.cols || R !== this.rows ? super.resize(C, R) : this._charSizeService && !this._charSizeService.hasValidSize && this._charSizeService.measure();
        }
        _afterResize(C, R) {
          var O, P;
          (O = this._charSizeService) === null || O === void 0 || O.measure(), (P = this.viewport) === null || P === void 0 || P.syncScrollArea(!0);
        }
        clear() {
          var C;
          if (this.buffer.ybase !== 0 || this.buffer.y !== 0) {
            this.buffer.clearAllMarkers(), this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)), this.buffer.lines.length = 1, this.buffer.ydisp = 0, this.buffer.ybase = 0, this.buffer.y = 0;
            for (let R = 1; R < this.rows; R++)
              this.buffer.lines.push(this.buffer.getBlankLine(T.DEFAULT_ATTR_DATA));
            this._onScroll.fire({ position: this.buffer.ydisp, source: 0 }), (C = this.viewport) === null || C === void 0 || C.reset(), this.refresh(0, this.rows - 1);
          }
        }
        reset() {
          var C, R;
          this.options.rows = this.rows, this.options.cols = this.cols;
          const O = this._customKeyEventHandler;
          this._setup(), super.reset(), (C = this._selectionService) === null || C === void 0 || C.reset(), this._decorationService.reset(), (R = this.viewport) === null || R === void 0 || R.reset(), this._customKeyEventHandler = O, this.refresh(0, this.rows - 1);
        }
        clearTextureAtlas() {
          var C;
          (C = this._renderService) === null || C === void 0 || C.clearTextureAtlas();
        }
        _reportFocus() {
          var C;
          !((C = this.element) === null || C === void 0) && C.classList.contains("focus") ? this.coreService.triggerDataEvent(M.C0.ESC + "[I") : this.coreService.triggerDataEvent(M.C0.ESC + "[O");
        }
        _reportWindowsOptions(C) {
          if (this._renderService)
            switch (C) {
              case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:
                const R = this._renderService.dimensions.css.canvas.width.toFixed(0), O = this._renderService.dimensions.css.canvas.height.toFixed(0);
                this.coreService.triggerDataEvent(`${M.C0.ESC}[4;${O};${R}t`);
                break;
              case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:
                const P = this._renderService.dimensions.css.cell.width.toFixed(0), z = this._renderService.dimensions.css.cell.height.toFixed(0);
                this.coreService.triggerDataEvent(`${M.C0.ESC}[6;${z};${P}t`);
            }
        }
        cancel(C, R) {
          if (this.options.cancelEvents || R)
            return C.preventDefault(), C.stopPropagation(), !1;
        }
      }
      s.Terminal = j;
    }, 9924: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.TimeBasedDebouncer = void 0, s.TimeBasedDebouncer = class {
        constructor(o, a = 1e3) {
          this._renderCallback = o, this._debounceThresholdMS = a, this._lastRefreshMs = 0, this._additionalRefreshRequested = !1;
        }
        dispose() {
          this._refreshTimeoutID && clearTimeout(this._refreshTimeoutID);
        }
        refresh(o, a, f) {
          this._rowCount = f, o = o !== void 0 ? o : 0, a = a !== void 0 ? a : this._rowCount - 1, this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, o) : o, this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, a) : a;
          const n = Date.now();
          if (n - this._lastRefreshMs >= this._debounceThresholdMS)
            this._lastRefreshMs = n, this._innerRefresh();
          else if (!this._additionalRefreshRequested) {
            const c = n - this._lastRefreshMs, u = this._debounceThresholdMS - c;
            this._additionalRefreshRequested = !0, this._refreshTimeoutID = window.setTimeout(() => {
              this._lastRefreshMs = Date.now(), this._innerRefresh(), this._additionalRefreshRequested = !1, this._refreshTimeoutID = void 0;
            }, u);
          }
        }
        _innerRefresh() {
          if (this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
            return;
          const o = Math.max(this._rowStart, 0), a = Math.min(this._rowEnd, this._rowCount - 1);
          this._rowStart = void 0, this._rowEnd = void 0, this._renderCallback(o, a);
        }
      };
    }, 1680: function(x, s, o) {
      var a = this && this.__decorate || function(i, t, r, h) {
        var _, p = arguments.length, m = p < 3 ? t : h === null ? h = Object.getOwnPropertyDescriptor(t, r) : h;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          m = Reflect.decorate(i, t, r, h);
        else
          for (var d = i.length - 1; d >= 0; d--)
            (_ = i[d]) && (m = (p < 3 ? _(m) : p > 3 ? _(t, r, m) : _(t, r)) || m);
        return p > 3 && m && Object.defineProperty(t, r, m), m;
      }, f = this && this.__param || function(i, t) {
        return function(r, h) {
          t(r, h, i);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Viewport = void 0;
      const n = o(3656), c = o(4725), u = o(8460), v = o(844), l = o(2585);
      let e = s.Viewport = class extends v.Disposable {
        constructor(i, t, r, h, _, p, m, d) {
          super(), this._viewportElement = i, this._scrollArea = t, this._bufferService = r, this._optionsService = h, this._charSizeService = _, this._renderService = p, this._coreBrowserService = m, this.scrollBarWidth = 0, this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._wheelPartialScroll = 0, this._refreshAnimationFrame = null, this._ignoreNextScrollEvent = !1, this._smoothScrollState = { startTime: 0, origin: -1, target: -1 }, this._onRequestScrollLines = this.register(new u.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15, this.register((0, n.addDisposableDomListener)(this._viewportElement, "scroll", this._handleScroll.bind(this))), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((g) => this._activeBuffer = g.activeBuffer)), this._renderDimensions = this._renderService.dimensions, this.register(this._renderService.onDimensionsChange((g) => this._renderDimensions = g)), this._handleThemeChange(d.colors), this.register(d.onChangeColors((g) => this._handleThemeChange(g))), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.syncScrollArea())), setTimeout(() => this.syncScrollArea());
        }
        _handleThemeChange(i) {
          this._viewportElement.style.backgroundColor = i.background.css;
        }
        reset() {
          this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._coreBrowserService.window.requestAnimationFrame(() => this.syncScrollArea());
        }
        _refresh(i) {
          if (i)
            return this._innerRefresh(), void (this._refreshAnimationFrame !== null && this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));
          this._refreshAnimationFrame === null && (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh()));
        }
        _innerRefresh() {
          if (this._charSizeService.height > 0) {
            this._currentRowHeight = this._renderService.dimensions.device.cell.height / this._coreBrowserService.dpr, this._currentDeviceCellHeight = this._renderService.dimensions.device.cell.height, this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;
            const t = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderService.dimensions.css.canvas.height);
            this._lastRecordedBufferHeight !== t && (this._lastRecordedBufferHeight = t, this._scrollArea.style.height = this._lastRecordedBufferHeight + "px");
          }
          const i = this._bufferService.buffer.ydisp * this._currentRowHeight;
          this._viewportElement.scrollTop !== i && (this._ignoreNextScrollEvent = !0, this._viewportElement.scrollTop = i), this._refreshAnimationFrame = null;
        }
        syncScrollArea(i = !1) {
          if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length)
            return this._lastRecordedBufferLength = this._bufferService.buffer.lines.length, void this._refresh(i);
          this._lastRecordedViewportHeight === this._renderService.dimensions.css.canvas.height && this._lastScrollTop === this._activeBuffer.ydisp * this._currentRowHeight && this._renderDimensions.device.cell.height === this._currentDeviceCellHeight || this._refresh(i);
        }
        _handleScroll(i) {
          if (this._lastScrollTop = this._viewportElement.scrollTop, !this._viewportElement.offsetParent)
            return;
          if (this._ignoreNextScrollEvent)
            return this._ignoreNextScrollEvent = !1, void this._onRequestScrollLines.fire({ amount: 0, suppressScrollEvent: !0 });
          const t = Math.round(this._lastScrollTop / this._currentRowHeight) - this._bufferService.buffer.ydisp;
          this._onRequestScrollLines.fire({ amount: t, suppressScrollEvent: !0 });
        }
        _smoothScroll() {
          if (this._isDisposed || this._smoothScrollState.origin === -1 || this._smoothScrollState.target === -1)
            return;
          const i = this._smoothScrollPercent();
          this._viewportElement.scrollTop = this._smoothScrollState.origin + Math.round(i * (this._smoothScrollState.target - this._smoothScrollState.origin)), i < 1 ? this._coreBrowserService.window.requestAnimationFrame(() => this._smoothScroll()) : this._clearSmoothScrollState();
        }
        _smoothScrollPercent() {
          return this._optionsService.rawOptions.smoothScrollDuration && this._smoothScrollState.startTime ? Math.max(Math.min((Date.now() - this._smoothScrollState.startTime) / this._optionsService.rawOptions.smoothScrollDuration, 1), 0) : 1;
        }
        _clearSmoothScrollState() {
          this._smoothScrollState.startTime = 0, this._smoothScrollState.origin = -1, this._smoothScrollState.target = -1;
        }
        _bubbleScroll(i, t) {
          const r = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;
          return !(t < 0 && this._viewportElement.scrollTop !== 0 || t > 0 && r < this._lastRecordedBufferHeight) || (i.cancelable && i.preventDefault(), !1);
        }
        handleWheel(i) {
          const t = this._getPixelsScrolled(i);
          return t !== 0 && (this._optionsService.rawOptions.smoothScrollDuration ? (this._smoothScrollState.startTime = Date.now(), this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop, this._smoothScrollState.target === -1 ? this._smoothScrollState.target = this._viewportElement.scrollTop + t : this._smoothScrollState.target += t, this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0), this._smoothScroll()) : this._clearSmoothScrollState()) : this._viewportElement.scrollTop += t, this._bubbleScroll(i, t));
        }
        scrollLines(i) {
          if (i !== 0)
            if (this._optionsService.rawOptions.smoothScrollDuration) {
              const t = i * this._currentRowHeight;
              this._smoothScrollState.startTime = Date.now(), this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop, this._smoothScrollState.target = this._smoothScrollState.origin + t, this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0), this._smoothScroll()) : this._clearSmoothScrollState();
            } else
              this._onRequestScrollLines.fire({ amount: i, suppressScrollEvent: !1 });
        }
        _getPixelsScrolled(i) {
          if (i.deltaY === 0 || i.shiftKey)
            return 0;
          let t = this._applyScrollModifier(i.deltaY, i);
          return i.deltaMode === WheelEvent.DOM_DELTA_LINE ? t *= this._currentRowHeight : i.deltaMode === WheelEvent.DOM_DELTA_PAGE && (t *= this._currentRowHeight * this._bufferService.rows), t;
        }
        getBufferElements(i, t) {
          var r;
          let h, _ = "";
          const p = [], m = t != null ? t : this._bufferService.buffer.lines.length, d = this._bufferService.buffer.lines;
          for (let g = i; g < m; g++) {
            const y = d.get(g);
            if (!y)
              continue;
            const L = (r = d.get(g + 1)) === null || r === void 0 ? void 0 : r.isWrapped;
            if (_ += y.translateToString(!L), !L || g === d.length - 1) {
              const b = document.createElement("div");
              b.textContent = _, p.push(b), _.length > 0 && (h = b), _ = "";
            }
          }
          return { bufferElements: p, cursorElement: h };
        }
        getLinesScrolled(i) {
          if (i.deltaY === 0 || i.shiftKey)
            return 0;
          let t = this._applyScrollModifier(i.deltaY, i);
          return i.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? (t /= this._currentRowHeight + 0, this._wheelPartialScroll += t, t = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1), this._wheelPartialScroll %= 1) : i.deltaMode === WheelEvent.DOM_DELTA_PAGE && (t *= this._bufferService.rows), t;
        }
        _applyScrollModifier(i, t) {
          const r = this._optionsService.rawOptions.fastScrollModifier;
          return r === "alt" && t.altKey || r === "ctrl" && t.ctrlKey || r === "shift" && t.shiftKey ? i * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity : i * this._optionsService.rawOptions.scrollSensitivity;
        }
        handleTouchStart(i) {
          this._lastTouchY = i.touches[0].pageY;
        }
        handleTouchMove(i) {
          const t = this._lastTouchY - i.touches[0].pageY;
          return this._lastTouchY = i.touches[0].pageY, t !== 0 && (this._viewportElement.scrollTop += t, this._bubbleScroll(i, t));
        }
      };
      s.Viewport = e = a([f(2, l.IBufferService), f(3, l.IOptionsService), f(4, c.ICharSizeService), f(5, c.IRenderService), f(6, c.ICoreBrowserService), f(7, c.IThemeService)], e);
    }, 3107: function(x, s, o) {
      var a = this && this.__decorate || function(e, i, t, r) {
        var h, _ = arguments.length, p = _ < 3 ? i : r === null ? r = Object.getOwnPropertyDescriptor(i, t) : r;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          p = Reflect.decorate(e, i, t, r);
        else
          for (var m = e.length - 1; m >= 0; m--)
            (h = e[m]) && (p = (_ < 3 ? h(p) : _ > 3 ? h(i, t, p) : h(i, t)) || p);
        return _ > 3 && p && Object.defineProperty(i, t, p), p;
      }, f = this && this.__param || function(e, i) {
        return function(t, r) {
          i(t, r, e);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferDecorationRenderer = void 0;
      const n = o(3656), c = o(4725), u = o(844), v = o(2585);
      let l = s.BufferDecorationRenderer = class extends u.Disposable {
        constructor(e, i, t, r) {
          super(), this._screenElement = e, this._bufferService = i, this._decorationService = t, this._renderService = r, this._decorationElements = /* @__PURE__ */ new Map(), this._altBufferIsActive = !1, this._dimensionsChanged = !1, this._container = document.createElement("div"), this._container.classList.add("xterm-decoration-container"), this._screenElement.appendChild(this._container), this.register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations())), this.register(this._renderService.onDimensionsChange(() => {
            this._dimensionsChanged = !0, this._queueRefresh();
          })), this.register((0, n.addDisposableDomListener)(window, "resize", () => this._queueRefresh())), this.register(this._bufferService.buffers.onBufferActivate(() => {
            this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;
          })), this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())), this.register(this._decorationService.onDecorationRemoved((h) => this._removeDecoration(h))), this.register((0, u.toDisposable)(() => {
            this._container.remove(), this._decorationElements.clear();
          }));
        }
        _queueRefresh() {
          this._animationFrame === void 0 && (this._animationFrame = this._renderService.addRefreshCallback(() => {
            this._doRefreshDecorations(), this._animationFrame = void 0;
          }));
        }
        _doRefreshDecorations() {
          for (const e of this._decorationService.decorations)
            this._renderDecoration(e);
          this._dimensionsChanged = !1;
        }
        _renderDecoration(e) {
          this._refreshStyle(e), this._dimensionsChanged && this._refreshXPosition(e);
        }
        _createElement(e) {
          var i, t;
          const r = document.createElement("div");
          r.classList.add("xterm-decoration"), r.classList.toggle("xterm-decoration-top-layer", ((i = e == null ? void 0 : e.options) === null || i === void 0 ? void 0 : i.layer) === "top"), r.style.width = `${Math.round((e.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`, r.style.height = (e.options.height || 1) * this._renderService.dimensions.css.cell.height + "px", r.style.top = (e.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height + "px", r.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;
          const h = (t = e.options.x) !== null && t !== void 0 ? t : 0;
          return h && h > this._bufferService.cols && (r.style.display = "none"), this._refreshXPosition(e, r), r;
        }
        _refreshStyle(e) {
          const i = e.marker.line - this._bufferService.buffers.active.ydisp;
          if (i < 0 || i >= this._bufferService.rows)
            e.element && (e.element.style.display = "none", e.onRenderEmitter.fire(e.element));
          else {
            let t = this._decorationElements.get(e);
            t || (t = this._createElement(e), e.element = t, this._decorationElements.set(e, t), this._container.appendChild(t), e.onDispose(() => {
              this._decorationElements.delete(e), t.remove();
            })), t.style.top = i * this._renderService.dimensions.css.cell.height + "px", t.style.display = this._altBufferIsActive ? "none" : "block", e.onRenderEmitter.fire(t);
          }
        }
        _refreshXPosition(e, i = e.element) {
          var t;
          if (!i)
            return;
          const r = (t = e.options.x) !== null && t !== void 0 ? t : 0;
          (e.options.anchor || "left") === "right" ? i.style.right = r ? r * this._renderService.dimensions.css.cell.width + "px" : "" : i.style.left = r ? r * this._renderService.dimensions.css.cell.width + "px" : "";
        }
        _removeDecoration(e) {
          var i;
          (i = this._decorationElements.get(e)) === null || i === void 0 || i.remove(), this._decorationElements.delete(e), e.dispose();
        }
      };
      s.BufferDecorationRenderer = l = a([f(1, v.IBufferService), f(2, v.IDecorationService), f(3, c.IRenderService)], l);
    }, 5871: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ColorZoneStore = void 0, s.ColorZoneStore = class {
        constructor() {
          this._zones = [], this._zonePool = [], this._zonePoolIndex = 0, this._linePadding = { full: 0, left: 0, center: 0, right: 0 };
        }
        get zones() {
          return this._zonePool.length = Math.min(this._zonePool.length, this._zones.length), this._zones;
        }
        clear() {
          this._zones.length = 0, this._zonePoolIndex = 0;
        }
        addDecoration(o) {
          if (o.options.overviewRulerOptions) {
            for (const a of this._zones)
              if (a.color === o.options.overviewRulerOptions.color && a.position === o.options.overviewRulerOptions.position) {
                if (this._lineIntersectsZone(a, o.marker.line))
                  return;
                if (this._lineAdjacentToZone(a, o.marker.line, o.options.overviewRulerOptions.position))
                  return void this._addLineToZone(a, o.marker.line);
              }
            if (this._zonePoolIndex < this._zonePool.length)
              return this._zonePool[this._zonePoolIndex].color = o.options.overviewRulerOptions.color, this._zonePool[this._zonePoolIndex].position = o.options.overviewRulerOptions.position, this._zonePool[this._zonePoolIndex].startBufferLine = o.marker.line, this._zonePool[this._zonePoolIndex].endBufferLine = o.marker.line, void this._zones.push(this._zonePool[this._zonePoolIndex++]);
            this._zones.push({ color: o.options.overviewRulerOptions.color, position: o.options.overviewRulerOptions.position, startBufferLine: o.marker.line, endBufferLine: o.marker.line }), this._zonePool.push(this._zones[this._zones.length - 1]), this._zonePoolIndex++;
          }
        }
        setPadding(o) {
          this._linePadding = o;
        }
        _lineIntersectsZone(o, a) {
          return a >= o.startBufferLine && a <= o.endBufferLine;
        }
        _lineAdjacentToZone(o, a, f) {
          return a >= o.startBufferLine - this._linePadding[f || "full"] && a <= o.endBufferLine + this._linePadding[f || "full"];
        }
        _addLineToZone(o, a) {
          o.startBufferLine = Math.min(o.startBufferLine, a), o.endBufferLine = Math.max(o.endBufferLine, a);
        }
      };
    }, 5744: function(x, s, o) {
      var a = this && this.__decorate || function(h, _, p, m) {
        var d, g = arguments.length, y = g < 3 ? _ : m === null ? m = Object.getOwnPropertyDescriptor(_, p) : m;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          y = Reflect.decorate(h, _, p, m);
        else
          for (var L = h.length - 1; L >= 0; L--)
            (d = h[L]) && (y = (g < 3 ? d(y) : g > 3 ? d(_, p, y) : d(_, p)) || y);
        return g > 3 && y && Object.defineProperty(_, p, y), y;
      }, f = this && this.__param || function(h, _) {
        return function(p, m) {
          _(p, m, h);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.OverviewRulerRenderer = void 0;
      const n = o(5871), c = o(3656), u = o(4725), v = o(844), l = o(2585), e = { full: 0, left: 0, center: 0, right: 0 }, i = { full: 0, left: 0, center: 0, right: 0 }, t = { full: 0, left: 0, center: 0, right: 0 };
      let r = s.OverviewRulerRenderer = class extends v.Disposable {
        get _width() {
          return this._optionsService.options.overviewRulerWidth || 0;
        }
        constructor(h, _, p, m, d, g, y) {
          var L;
          super(), this._viewportElement = h, this._screenElement = _, this._bufferService = p, this._decorationService = m, this._renderService = d, this._optionsService = g, this._coreBrowseService = y, this._colorZoneStore = new n.ColorZoneStore(), this._shouldUpdateDimensions = !0, this._shouldUpdateAnchor = !0, this._lastKnownBufferLength = 0, this._canvas = document.createElement("canvas"), this._canvas.classList.add("xterm-decoration-overview-ruler"), this._refreshCanvasDimensions(), (L = this._viewportElement.parentElement) === null || L === void 0 || L.insertBefore(this._canvas, this._viewportElement);
          const b = this._canvas.getContext("2d");
          if (!b)
            throw new Error("Ctx cannot be null");
          this._ctx = b, this._registerDecorationListeners(), this._registerBufferChangeListeners(), this._registerDimensionChangeListeners(), this.register((0, v.toDisposable)(() => {
            var k;
            (k = this._canvas) === null || k === void 0 || k.remove();
          }));
        }
        _registerDecorationListeners() {
          this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(void 0, !0))), this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(void 0, !0)));
        }
        _registerBufferChangeListeners() {
          this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())), this.register(this._bufferService.buffers.onBufferActivate(() => {
            this._canvas.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? "none" : "block";
          })), this.register(this._bufferService.onScroll(() => {
            this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length && (this._refreshDrawHeightConstants(), this._refreshColorZonePadding());
          }));
        }
        _registerDimensionChangeListeners() {
          this.register(this._renderService.onRender(() => {
            this._containerHeight && this._containerHeight === this._screenElement.clientHeight || (this._queueRefresh(!0), this._containerHeight = this._screenElement.clientHeight);
          })), this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth", () => this._queueRefresh(!0))), this.register((0, c.addDisposableDomListener)(this._coreBrowseService.window, "resize", () => this._queueRefresh(!0))), this._queueRefresh(!0);
        }
        _refreshDrawConstants() {
          const h = Math.floor(this._canvas.width / 3), _ = Math.ceil(this._canvas.width / 3);
          i.full = this._canvas.width, i.left = h, i.center = _, i.right = h, this._refreshDrawHeightConstants(), t.full = 0, t.left = 0, t.center = i.left, t.right = i.left + i.center;
        }
        _refreshDrawHeightConstants() {
          e.full = Math.round(2 * this._coreBrowseService.dpr);
          const h = this._canvas.height / this._bufferService.buffer.lines.length, _ = Math.round(Math.max(Math.min(h, 12), 6) * this._coreBrowseService.dpr);
          e.left = _, e.center = _, e.right = _;
        }
        _refreshColorZonePadding() {
          this._colorZoneStore.setPadding({ full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * e.full), left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * e.left), center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * e.center), right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * e.right) }), this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length;
        }
        _refreshCanvasDimensions() {
          this._canvas.style.width = `${this._width}px`, this._canvas.width = Math.round(this._width * this._coreBrowseService.dpr), this._canvas.style.height = `${this._screenElement.clientHeight}px`, this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowseService.dpr), this._refreshDrawConstants(), this._refreshColorZonePadding();
        }
        _refreshDecorations() {
          this._shouldUpdateDimensions && this._refreshCanvasDimensions(), this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height), this._colorZoneStore.clear();
          for (const _ of this._decorationService.decorations)
            this._colorZoneStore.addDecoration(_);
          this._ctx.lineWidth = 1;
          const h = this._colorZoneStore.zones;
          for (const _ of h)
            _.position !== "full" && this._renderColorZone(_);
          for (const _ of h)
            _.position === "full" && this._renderColorZone(_);
          this._shouldUpdateDimensions = !1, this._shouldUpdateAnchor = !1;
        }
        _renderColorZone(h) {
          this._ctx.fillStyle = h.color, this._ctx.fillRect(t[h.position || "full"], Math.round((this._canvas.height - 1) * (h.startBufferLine / this._bufferService.buffers.active.lines.length) - e[h.position || "full"] / 2), i[h.position || "full"], Math.round((this._canvas.height - 1) * ((h.endBufferLine - h.startBufferLine) / this._bufferService.buffers.active.lines.length) + e[h.position || "full"]));
        }
        _queueRefresh(h, _) {
          this._shouldUpdateDimensions = h || this._shouldUpdateDimensions, this._shouldUpdateAnchor = _ || this._shouldUpdateAnchor, this._animationFrame === void 0 && (this._animationFrame = this._coreBrowseService.window.requestAnimationFrame(() => {
            this._refreshDecorations(), this._animationFrame = void 0;
          }));
        }
      };
      s.OverviewRulerRenderer = r = a([f(2, l.IBufferService), f(3, l.IDecorationService), f(4, u.IRenderService), f(5, l.IOptionsService), f(6, u.ICoreBrowserService)], r);
    }, 2950: function(x, s, o) {
      var a = this && this.__decorate || function(l, e, i, t) {
        var r, h = arguments.length, _ = h < 3 ? e : t === null ? t = Object.getOwnPropertyDescriptor(e, i) : t;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          _ = Reflect.decorate(l, e, i, t);
        else
          for (var p = l.length - 1; p >= 0; p--)
            (r = l[p]) && (_ = (h < 3 ? r(_) : h > 3 ? r(e, i, _) : r(e, i)) || _);
        return h > 3 && _ && Object.defineProperty(e, i, _), _;
      }, f = this && this.__param || function(l, e) {
        return function(i, t) {
          e(i, t, l);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CompositionHelper = void 0;
      const n = o(4725), c = o(2585), u = o(2584);
      let v = s.CompositionHelper = class {
        get isComposing() {
          return this._isComposing;
        }
        constructor(l, e, i, t, r, h) {
          this._textarea = l, this._compositionView = e, this._bufferService = i, this._optionsService = t, this._coreService = r, this._renderService = h, this._isComposing = !1, this._isSendingComposition = !1, this._compositionPosition = { start: 0, end: 0 }, this._dataAlreadySent = "";
        }
        compositionstart() {
          this._isComposing = !0, this._compositionPosition.start = this._textarea.value.length, this._compositionView.textContent = "", this._dataAlreadySent = "", this._compositionView.classList.add("active");
        }
        compositionupdate(l) {
          this._compositionView.textContent = l.data, this.updateCompositionElements(), setTimeout(() => {
            this._compositionPosition.end = this._textarea.value.length;
          }, 0);
        }
        compositionend() {
          this._finalizeComposition(!0);
        }
        keydown(l) {
          if (this._isComposing || this._isSendingComposition) {
            if (l.keyCode === 229 || l.keyCode === 16 || l.keyCode === 17 || l.keyCode === 18)
              return !1;
            this._finalizeComposition(!1);
          }
          return l.keyCode !== 229 || (this._handleAnyTextareaChanges(), !1);
        }
        _finalizeComposition(l) {
          if (this._compositionView.classList.remove("active"), this._isComposing = !1, l) {
            const e = { start: this._compositionPosition.start, end: this._compositionPosition.end };
            this._isSendingComposition = !0, setTimeout(() => {
              if (this._isSendingComposition) {
                let i;
                this._isSendingComposition = !1, e.start += this._dataAlreadySent.length, i = this._isComposing ? this._textarea.value.substring(e.start, e.end) : this._textarea.value.substring(e.start), i.length > 0 && this._coreService.triggerDataEvent(i, !0);
              }
            }, 0);
          } else {
            this._isSendingComposition = !1;
            const e = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);
            this._coreService.triggerDataEvent(e, !0);
          }
        }
        _handleAnyTextareaChanges() {
          const l = this._textarea.value;
          setTimeout(() => {
            if (!this._isComposing) {
              const e = this._textarea.value, i = e.replace(l, "");
              this._dataAlreadySent = i, e.length > l.length ? this._coreService.triggerDataEvent(i, !0) : e.length < l.length ? this._coreService.triggerDataEvent(`${u.C0.DEL}`, !0) : e.length === l.length && e !== l && this._coreService.triggerDataEvent(e, !0);
            }
          }, 0);
        }
        updateCompositionElements(l) {
          if (this._isComposing) {
            if (this._bufferService.buffer.isCursorInViewport) {
              const e = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1), i = this._renderService.dimensions.css.cell.height, t = this._bufferService.buffer.y * this._renderService.dimensions.css.cell.height, r = e * this._renderService.dimensions.css.cell.width;
              this._compositionView.style.left = r + "px", this._compositionView.style.top = t + "px", this._compositionView.style.height = i + "px", this._compositionView.style.lineHeight = i + "px", this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily, this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + "px";
              const h = this._compositionView.getBoundingClientRect();
              this._textarea.style.left = r + "px", this._textarea.style.top = t + "px", this._textarea.style.width = Math.max(h.width, 1) + "px", this._textarea.style.height = Math.max(h.height, 1) + "px", this._textarea.style.lineHeight = h.height + "px";
            }
            l || setTimeout(() => this.updateCompositionElements(!0), 0);
          }
        }
      };
      s.CompositionHelper = v = a([f(2, c.IBufferService), f(3, c.IOptionsService), f(4, c.ICoreService), f(5, n.IRenderService)], v);
    }, 9806: (x, s) => {
      function o(a, f, n) {
        const c = n.getBoundingClientRect(), u = a.getComputedStyle(n), v = parseInt(u.getPropertyValue("padding-left")), l = parseInt(u.getPropertyValue("padding-top"));
        return [f.clientX - c.left - v, f.clientY - c.top - l];
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.getCoords = s.getCoordsRelativeToElement = void 0, s.getCoordsRelativeToElement = o, s.getCoords = function(a, f, n, c, u, v, l, e, i) {
        if (!v)
          return;
        const t = o(a, f, n);
        return t ? (t[0] = Math.ceil((t[0] + (i ? l / 2 : 0)) / l), t[1] = Math.ceil(t[1] / e), t[0] = Math.min(Math.max(t[0], 1), c + (i ? 1 : 0)), t[1] = Math.min(Math.max(t[1], 1), u), t) : void 0;
      };
    }, 9504: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.moveToCellSequence = void 0;
      const a = o(2584);
      function f(e, i, t, r) {
        const h = e - n(e, t), _ = i - n(i, t), p = Math.abs(h - _) - function(m, d, g) {
          let y = 0;
          const L = m - n(m, g), b = d - n(d, g);
          for (let k = 0; k < Math.abs(L - b); k++) {
            const A = c(m, d) === "A" ? -1 : 1, B = g.buffer.lines.get(L + A * k);
            B != null && B.isWrapped && y++;
          }
          return y;
        }(e, i, t);
        return l(p, v(c(e, i), r));
      }
      function n(e, i) {
        let t = 0, r = i.buffer.lines.get(e), h = r == null ? void 0 : r.isWrapped;
        for (; h && e >= 0 && e < i.rows; )
          t++, r = i.buffer.lines.get(--e), h = r == null ? void 0 : r.isWrapped;
        return t;
      }
      function c(e, i) {
        return e > i ? "A" : "B";
      }
      function u(e, i, t, r, h, _) {
        let p = e, m = i, d = "";
        for (; p !== t || m !== r; )
          p += h ? 1 : -1, h && p > _.cols - 1 ? (d += _.buffer.translateBufferLineToString(m, !1, e, p), p = 0, e = 0, m++) : !h && p < 0 && (d += _.buffer.translateBufferLineToString(m, !1, 0, e + 1), p = _.cols - 1, e = p, m--);
        return d + _.buffer.translateBufferLineToString(m, !1, e, p);
      }
      function v(e, i) {
        const t = i ? "O" : "[";
        return a.C0.ESC + t + e;
      }
      function l(e, i) {
        e = Math.floor(e);
        let t = "";
        for (let r = 0; r < e; r++)
          t += i;
        return t;
      }
      s.moveToCellSequence = function(e, i, t, r) {
        const h = t.buffer.x, _ = t.buffer.y;
        if (!t.buffer.hasScrollback)
          return function(d, g, y, L, b, k) {
            return f(g, L, b, k).length === 0 ? "" : l(u(d, g, d, g - n(g, b), !1, b).length, v("D", k));
          }(h, _, 0, i, t, r) + f(_, i, t, r) + function(d, g, y, L, b, k) {
            let A;
            A = f(g, L, b, k).length > 0 ? L - n(L, b) : g;
            const B = L, T = function(M, S, w, E, D, H) {
              let N;
              return N = f(w, E, D, H).length > 0 ? E - n(E, D) : S, M < w && N <= E || M >= w && N < E ? "C" : "D";
            }(d, g, y, L, b, k);
            return l(u(d, A, y, B, T === "C", b).length, v(T, k));
          }(h, _, e, i, t, r);
        let p;
        if (_ === i)
          return p = h > e ? "D" : "C", l(Math.abs(h - e), v(p, r));
        p = _ > i ? "D" : "C";
        const m = Math.abs(_ - i);
        return l(function(d, g) {
          return g.cols - d;
        }(_ > i ? e : h, t) + (m - 1) * t.cols + 1 + ((_ > i ? h : e) - 1), v(p, r));
      };
    }, 1296: function(x, s, o) {
      var a = this && this.__decorate || function(b, k, A, B) {
        var T, M = arguments.length, S = M < 3 ? k : B === null ? B = Object.getOwnPropertyDescriptor(k, A) : B;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          S = Reflect.decorate(b, k, A, B);
        else
          for (var w = b.length - 1; w >= 0; w--)
            (T = b[w]) && (S = (M < 3 ? T(S) : M > 3 ? T(k, A, S) : T(k, A)) || S);
        return M > 3 && S && Object.defineProperty(k, A, S), S;
      }, f = this && this.__param || function(b, k) {
        return function(A, B) {
          k(A, B, b);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DomRenderer = void 0;
      const n = o(3787), c = o(2550), u = o(2223), v = o(6171), l = o(4725), e = o(8055), i = o(8460), t = o(844), r = o(2585), h = "xterm-dom-renderer-owner-", _ = "xterm-rows", p = "xterm-fg-", m = "xterm-bg-", d = "xterm-focus", g = "xterm-selection";
      let y = 1, L = s.DomRenderer = class extends t.Disposable {
        constructor(b, k, A, B, T, M, S, w, E, D) {
          super(), this._element = b, this._screenElement = k, this._viewportElement = A, this._linkifier2 = B, this._charSizeService = M, this._optionsService = S, this._bufferService = w, this._coreBrowserService = E, this._themeService = D, this._terminalClass = y++, this._rowElements = [], this.onRequestRedraw = this.register(new i.EventEmitter()).event, this._rowContainer = document.createElement("div"), this._rowContainer.classList.add(_), this._rowContainer.style.lineHeight = "normal", this._rowContainer.setAttribute("aria-hidden", "true"), this._refreshRowElements(this._bufferService.cols, this._bufferService.rows), this._selectionContainer = document.createElement("div"), this._selectionContainer.classList.add(g), this._selectionContainer.setAttribute("aria-hidden", "true"), this.dimensions = (0, v.createRenderDimensions)(), this._updateDimensions(), this.register(this._optionsService.onOptionChange(() => this._handleOptionsChanged())), this.register(this._themeService.onChangeColors((H) => this._injectCss(H))), this._injectCss(this._themeService.colors), this._rowFactory = T.createInstance(n.DomRendererRowFactory, document), this._element.classList.add(h + this._terminalClass), this._screenElement.appendChild(this._rowContainer), this._screenElement.appendChild(this._selectionContainer), this.register(this._linkifier2.onShowLinkUnderline((H) => this._handleLinkHover(H))), this.register(this._linkifier2.onHideLinkUnderline((H) => this._handleLinkLeave(H))), this.register((0, t.toDisposable)(() => {
            this._element.classList.remove(h + this._terminalClass), this._rowContainer.remove(), this._selectionContainer.remove(), this._widthCache.dispose(), this._themeStyleElement.remove(), this._dimensionsStyleElement.remove();
          })), this._widthCache = new c.WidthCache(document), this._widthCache.setFont(this._optionsService.rawOptions.fontFamily, this._optionsService.rawOptions.fontSize, this._optionsService.rawOptions.fontWeight, this._optionsService.rawOptions.fontWeightBold), this._setDefaultSpacing();
        }
        _updateDimensions() {
          const b = this._coreBrowserService.dpr;
          this.dimensions.device.char.width = this._charSizeService.width * b, this.dimensions.device.char.height = Math.ceil(this._charSizeService.height * b), this.dimensions.device.cell.width = this.dimensions.device.char.width + Math.round(this._optionsService.rawOptions.letterSpacing), this.dimensions.device.cell.height = Math.floor(this.dimensions.device.char.height * this._optionsService.rawOptions.lineHeight), this.dimensions.device.char.left = 0, this.dimensions.device.char.top = 0, this.dimensions.device.canvas.width = this.dimensions.device.cell.width * this._bufferService.cols, this.dimensions.device.canvas.height = this.dimensions.device.cell.height * this._bufferService.rows, this.dimensions.css.canvas.width = Math.round(this.dimensions.device.canvas.width / b), this.dimensions.css.canvas.height = Math.round(this.dimensions.device.canvas.height / b), this.dimensions.css.cell.width = this.dimensions.css.canvas.width / this._bufferService.cols, this.dimensions.css.cell.height = this.dimensions.css.canvas.height / this._bufferService.rows;
          for (const A of this._rowElements)
            A.style.width = `${this.dimensions.css.canvas.width}px`, A.style.height = `${this.dimensions.css.cell.height}px`, A.style.lineHeight = `${this.dimensions.css.cell.height}px`, A.style.overflow = "hidden";
          this._dimensionsStyleElement || (this._dimensionsStyleElement = document.createElement("style"), this._screenElement.appendChild(this._dimensionsStyleElement));
          const k = `${this._terminalSelector} .${_} span { display: inline-block; height: 100%; vertical-align: top;}`;
          this._dimensionsStyleElement.textContent = k, this._selectionContainer.style.height = this._viewportElement.style.height, this._screenElement.style.width = `${this.dimensions.css.canvas.width}px`, this._screenElement.style.height = `${this.dimensions.css.canvas.height}px`;
        }
        _injectCss(b) {
          this._themeStyleElement || (this._themeStyleElement = document.createElement("style"), this._screenElement.appendChild(this._themeStyleElement));
          let k = `${this._terminalSelector} .${_} { color: ${b.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;
          k += `${this._terminalSelector} .${_} .xterm-dim { color: ${e.color.multiplyOpacity(b.foreground, 0.5).css};}`, k += `${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`, k += "@keyframes blink_box_shadow_" + this._terminalClass + " { 50% {  border-bottom-style: hidden; }}", k += "@keyframes blink_block_" + this._terminalClass + ` { 0% {  background-color: ${b.cursor.css};  color: ${b.cursorAccent.css}; } 50% {  background-color: inherit;  color: ${b.cursor.css}; }}`, k += `${this._terminalSelector} .${_}.${d} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .${_}.${d} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-block { background-color: ${b.cursor.css}; color: ${b.cursorAccent.css};}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${b.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${b.cursor.css} inset;}${this._terminalSelector} .${_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${b.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`, k += `${this._terminalSelector} .${g} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${g} div { position: absolute; background-color: ${b.selectionBackgroundOpaque.css};}${this._terminalSelector} .${g} div { position: absolute; background-color: ${b.selectionInactiveBackgroundOpaque.css};}`;
          for (const [A, B] of b.ansi.entries())
            k += `${this._terminalSelector} .${p}${A} { color: ${B.css}; }${this._terminalSelector} .${p}${A}.xterm-dim { color: ${e.color.multiplyOpacity(B, 0.5).css}; }${this._terminalSelector} .${m}${A} { background-color: ${B.css}; }`;
          k += `${this._terminalSelector} .${p}${u.INVERTED_DEFAULT_COLOR} { color: ${e.color.opaque(b.background).css}; }${this._terminalSelector} .${p}${u.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${e.color.multiplyOpacity(e.color.opaque(b.background), 0.5).css}; }${this._terminalSelector} .${m}${u.INVERTED_DEFAULT_COLOR} { background-color: ${b.foreground.css}; }`, this._themeStyleElement.textContent = k;
        }
        _setDefaultSpacing() {
          const b = this.dimensions.css.cell.width - this._widthCache.get("W", !1, !1);
          this._rowContainer.style.letterSpacing = `${b}px`, this._rowFactory.defaultSpacing = b;
        }
        handleDevicePixelRatioChange() {
          this._updateDimensions(), this._widthCache.clear(), this._setDefaultSpacing();
        }
        _refreshRowElements(b, k) {
          for (let A = this._rowElements.length; A <= k; A++) {
            const B = document.createElement("div");
            this._rowContainer.appendChild(B), this._rowElements.push(B);
          }
          for (; this._rowElements.length > k; )
            this._rowContainer.removeChild(this._rowElements.pop());
        }
        handleResize(b, k) {
          this._refreshRowElements(b, k), this._updateDimensions();
        }
        handleCharSizeChanged() {
          this._updateDimensions(), this._widthCache.clear(), this._setDefaultSpacing();
        }
        handleBlur() {
          this._rowContainer.classList.remove(d);
        }
        handleFocus() {
          this._rowContainer.classList.add(d), this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);
        }
        handleSelectionChanged(b, k, A) {
          if (this._selectionContainer.replaceChildren(), this._rowFactory.handleSelectionChanged(b, k, A), this.renderRows(0, this._bufferService.rows - 1), !b || !k)
            return;
          const B = b[1] - this._bufferService.buffer.ydisp, T = k[1] - this._bufferService.buffer.ydisp, M = Math.max(B, 0), S = Math.min(T, this._bufferService.rows - 1);
          if (M >= this._bufferService.rows || S < 0)
            return;
          const w = document.createDocumentFragment();
          if (A) {
            const E = b[0] > k[0];
            w.appendChild(this._createSelectionElement(M, E ? k[0] : b[0], E ? b[0] : k[0], S - M + 1));
          } else {
            const E = B === M ? b[0] : 0, D = M === T ? k[0] : this._bufferService.cols;
            w.appendChild(this._createSelectionElement(M, E, D));
            const H = S - M - 1;
            if (w.appendChild(this._createSelectionElement(M + 1, 0, this._bufferService.cols, H)), M !== S) {
              const N = T === S ? k[0] : this._bufferService.cols;
              w.appendChild(this._createSelectionElement(S, 0, N));
            }
          }
          this._selectionContainer.appendChild(w);
        }
        _createSelectionElement(b, k, A, B = 1) {
          const T = document.createElement("div");
          return T.style.height = B * this.dimensions.css.cell.height + "px", T.style.top = b * this.dimensions.css.cell.height + "px", T.style.left = k * this.dimensions.css.cell.width + "px", T.style.width = this.dimensions.css.cell.width * (A - k) + "px", T;
        }
        handleCursorMove() {
        }
        _handleOptionsChanged() {
          this._updateDimensions(), this._injectCss(this._themeService.colors), this._widthCache.setFont(this._optionsService.rawOptions.fontFamily, this._optionsService.rawOptions.fontSize, this._optionsService.rawOptions.fontWeight, this._optionsService.rawOptions.fontWeightBold), this._setDefaultSpacing();
        }
        clear() {
          for (const b of this._rowElements)
            b.replaceChildren();
        }
        renderRows(b, k) {
          const A = this._bufferService.buffer, B = A.ybase + A.y, T = Math.min(A.x, this._bufferService.cols - 1), M = this._optionsService.rawOptions.cursorBlink, S = this._optionsService.rawOptions.cursorStyle, w = this._optionsService.rawOptions.cursorInactiveStyle;
          for (let E = b; E <= k; E++) {
            const D = E + A.ydisp, H = this._rowElements[E], N = A.lines.get(D);
            if (!H || !N)
              break;
            H.replaceChildren(...this._rowFactory.createRow(N, D, D === B, S, w, T, M, this.dimensions.css.cell.width, this._widthCache, -1, -1));
          }
        }
        get _terminalSelector() {
          return `.${h}${this._terminalClass}`;
        }
        _handleLinkHover(b) {
          this._setCellUnderline(b.x1, b.x2, b.y1, b.y2, b.cols, !0);
        }
        _handleLinkLeave(b) {
          this._setCellUnderline(b.x1, b.x2, b.y1, b.y2, b.cols, !1);
        }
        _setCellUnderline(b, k, A, B, T, M) {
          A < 0 && (b = 0), B < 0 && (k = 0);
          const S = this._bufferService.rows - 1;
          A = Math.max(Math.min(A, S), 0), B = Math.max(Math.min(B, S), 0), T = Math.min(T, this._bufferService.cols);
          const w = this._bufferService.buffer, E = w.ybase + w.y, D = Math.min(w.x, T - 1), H = this._optionsService.rawOptions.cursorBlink, N = this._optionsService.rawOptions.cursorStyle, K = this._optionsService.rawOptions.cursorInactiveStyle;
          for (let j = A; j <= B; ++j) {
            const X = j + w.ydisp, C = this._rowElements[j], R = w.lines.get(X);
            if (!C || !R)
              break;
            C.replaceChildren(...this._rowFactory.createRow(R, X, X === E, N, K, D, H, this.dimensions.css.cell.width, this._widthCache, M ? j === A ? b : 0 : -1, M ? (j === B ? k : T) - 1 : -1));
          }
        }
      };
      s.DomRenderer = L = a([f(4, r.IInstantiationService), f(5, l.ICharSizeService), f(6, r.IOptionsService), f(7, r.IBufferService), f(8, l.ICoreBrowserService), f(9, l.IThemeService)], L);
    }, 3787: function(x, s, o) {
      var a = this && this.__decorate || function(p, m, d, g) {
        var y, L = arguments.length, b = L < 3 ? m : g === null ? g = Object.getOwnPropertyDescriptor(m, d) : g;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          b = Reflect.decorate(p, m, d, g);
        else
          for (var k = p.length - 1; k >= 0; k--)
            (y = p[k]) && (b = (L < 3 ? y(b) : L > 3 ? y(m, d, b) : y(m, d)) || b);
        return L > 3 && b && Object.defineProperty(m, d, b), b;
      }, f = this && this.__param || function(p, m) {
        return function(d, g) {
          m(d, g, p);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DomRendererRowFactory = void 0;
      const n = o(2223), c = o(643), u = o(511), v = o(2585), l = o(8055), e = o(4725), i = o(4269), t = o(6171), r = o(3734);
      let h = s.DomRendererRowFactory = class {
        constructor(p, m, d, g, y, L, b) {
          this._document = p, this._characterJoinerService = m, this._optionsService = d, this._coreBrowserService = g, this._coreService = y, this._decorationService = L, this._themeService = b, this._workCell = new u.CellData(), this._columnSelectMode = !1, this.defaultSpacing = 0;
        }
        handleSelectionChanged(p, m, d) {
          this._selectionStart = p, this._selectionEnd = m, this._columnSelectMode = d;
        }
        createRow(p, m, d, g, y, L, b, k, A, B, T) {
          const M = [], S = this._characterJoinerService.getJoinedCharacters(m), w = this._themeService.colors;
          let E, D = p.getNoBgTrimmedLength();
          d && D < L + 1 && (D = L + 1);
          let H = 0, N = "", K = 0, j = 0, X = 0, C = !1, R = 0, O = !1, P = 0;
          const z = [], $ = B !== -1 && T !== -1;
          for (let G = 0; G < D; G++) {
            p.loadCell(G, this._workCell);
            let Q = this._workCell.getWidth();
            if (Q === 0)
              continue;
            let ee = !1, oe = G, V = this._workCell;
            if (S.length > 0 && G === S[0][0]) {
              ee = !0;
              const Y = S.shift();
              V = new i.JoinedCellData(this._workCell, p.translateToString(!0, Y[0], Y[1]), Y[1] - Y[0]), oe = Y[1] - 1, Q = V.getWidth();
            }
            const he = this._isCellInSelection(G, m), ue = d && G === L, fe = $ && G >= B && G <= T;
            let ve = !1;
            this._decorationService.forEachDecorationAtCell(G, m, void 0, (Y) => {
              ve = !0;
            });
            let _e = V.getChars() || c.WHITESPACE_CELL_CHAR;
            if (_e === " " && (V.isUnderline() || V.isOverline()) && (_e = " "), P = Q * k - A.get(_e, V.isBold(), V.isItalic()), E) {
              if (H && (he && O || !he && !O && V.bg === K) && (he && O && w.selectionForeground || V.fg === j) && V.extended.ext === X && fe === C && P === R && !ue && !ee && !ve) {
                N += _e, H++;
                continue;
              }
              H && (E.textContent = N), E = this._document.createElement("span"), H = 0, N = "";
            } else
              E = this._document.createElement("span");
            if (K = V.bg, j = V.fg, X = V.extended.ext, C = fe, R = P, O = he, ee && L >= G && L <= oe && (L = G), !this._coreService.isCursorHidden && ue) {
              if (z.push("xterm-cursor"), this._coreBrowserService.isFocused)
                b && z.push("xterm-cursor-blink"), z.push(g === "bar" ? "xterm-cursor-bar" : g === "underline" ? "xterm-cursor-underline" : "xterm-cursor-block");
              else if (y)
                switch (y) {
                  case "outline":
                    z.push("xterm-cursor-outline");
                    break;
                  case "block":
                    z.push("xterm-cursor-block");
                    break;
                  case "bar":
                    z.push("xterm-cursor-bar");
                    break;
                  case "underline":
                    z.push("xterm-cursor-underline");
                }
            }
            if (V.isBold() && z.push("xterm-bold"), V.isItalic() && z.push("xterm-italic"), V.isDim() && z.push("xterm-dim"), N = V.isInvisible() ? c.WHITESPACE_CELL_CHAR : V.getChars() || c.WHITESPACE_CELL_CHAR, V.isUnderline() && (z.push(`xterm-underline-${V.extended.underlineStyle}`), N === " " && (N = " "), !V.isUnderlineColorDefault()))
              if (V.isUnderlineColorRGB())
                E.style.textDecorationColor = `rgb(${r.AttributeData.toColorRGB(V.getUnderlineColor()).join(",")})`;
              else {
                let Y = V.getUnderlineColor();
                this._optionsService.rawOptions.drawBoldTextInBrightColors && V.isBold() && Y < 8 && (Y += 8), E.style.textDecorationColor = w.ansi[Y].css;
              }
            V.isOverline() && (z.push("xterm-overline"), N === " " && (N = " ")), V.isStrikethrough() && z.push("xterm-strikethrough"), fe && (E.style.textDecoration = "underline");
            let te = V.getFgColor(), ce = V.getFgColorMode(), ie = V.getBgColor(), le = V.getBgColorMode();
            const pe = !!V.isInverse();
            if (pe) {
              const Y = te;
              te = ie, ie = Y;
              const Le = ce;
              ce = le, le = Le;
            }
            let re, ge, se, de = !1;
            switch (this._decorationService.forEachDecorationAtCell(G, m, void 0, (Y) => {
              Y.options.layer !== "top" && de || (Y.backgroundColorRGB && (le = 50331648, ie = Y.backgroundColorRGB.rgba >> 8 & 16777215, re = Y.backgroundColorRGB), Y.foregroundColorRGB && (ce = 50331648, te = Y.foregroundColorRGB.rgba >> 8 & 16777215, ge = Y.foregroundColorRGB), de = Y.options.layer === "top");
            }), !de && he && (re = this._coreBrowserService.isFocused ? w.selectionBackgroundOpaque : w.selectionInactiveBackgroundOpaque, ie = re.rgba >> 8 & 16777215, le = 50331648, de = !0, w.selectionForeground && (ce = 50331648, te = w.selectionForeground.rgba >> 8 & 16777215, ge = w.selectionForeground)), de && z.push("xterm-decoration-top"), le) {
              case 16777216:
              case 33554432:
                se = w.ansi[ie], z.push(`xterm-bg-${ie}`);
                break;
              case 50331648:
                se = l.rgba.toColor(ie >> 16, ie >> 8 & 255, 255 & ie), this._addStyle(E, `background-color:#${_((ie >>> 0).toString(16), "0", 6)}`);
                break;
              default:
                pe ? (se = w.foreground, z.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)) : se = w.background;
            }
            switch (re || V.isDim() && (re = l.color.multiplyOpacity(se, 0.5)), ce) {
              case 16777216:
              case 33554432:
                V.isBold() && te < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors && (te += 8), this._applyMinimumContrast(E, se, w.ansi[te], V, re, void 0) || z.push(`xterm-fg-${te}`);
                break;
              case 50331648:
                const Y = l.rgba.toColor(te >> 16 & 255, te >> 8 & 255, 255 & te);
                this._applyMinimumContrast(E, se, Y, V, re, ge) || this._addStyle(E, `color:#${_(te.toString(16), "0", 6)}`);
                break;
              default:
                this._applyMinimumContrast(E, se, w.foreground, V, re, void 0) || pe && z.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`);
            }
            z.length && (E.className = z.join(" "), z.length = 0), ue || ee || ve ? E.textContent = N : H++, P !== this.defaultSpacing && (E.style.letterSpacing = `${P}px`), M.push(E), G = oe;
          }
          return E && H && (E.textContent = N), M;
        }
        _applyMinimumContrast(p, m, d, g, y, L) {
          if (this._optionsService.rawOptions.minimumContrastRatio === 1 || (0, t.excludeFromContrastRatioDemands)(g.getCode()))
            return !1;
          const b = this._getContrastCache(g);
          let k;
          if (y || L || (k = b.getColor(m.rgba, d.rgba)), k === void 0) {
            const A = this._optionsService.rawOptions.minimumContrastRatio / (g.isDim() ? 2 : 1);
            k = l.color.ensureContrastRatio(y || m, L || d, A), b.setColor((y || m).rgba, (L || d).rgba, k != null ? k : null);
          }
          return !!k && (this._addStyle(p, `color:${k.css}`), !0);
        }
        _getContrastCache(p) {
          return p.isDim() ? this._themeService.colors.halfContrastCache : this._themeService.colors.contrastCache;
        }
        _addStyle(p, m) {
          p.setAttribute("style", `${p.getAttribute("style") || ""}${m};`);
        }
        _isCellInSelection(p, m) {
          const d = this._selectionStart, g = this._selectionEnd;
          return !(!d || !g) && (this._columnSelectMode ? d[0] <= g[0] ? p >= d[0] && m >= d[1] && p < g[0] && m <= g[1] : p < d[0] && m >= d[1] && p >= g[0] && m <= g[1] : m > d[1] && m < g[1] || d[1] === g[1] && m === d[1] && p >= d[0] && p < g[0] || d[1] < g[1] && m === g[1] && p < g[0] || d[1] < g[1] && m === d[1] && p >= d[0]);
        }
      };
      function _(p, m, d) {
        for (; p.length < d; )
          p = m + p;
        return p;
      }
      s.DomRendererRowFactory = h = a([f(1, e.ICharacterJoinerService), f(2, v.IOptionsService), f(3, e.ICoreBrowserService), f(4, v.ICoreService), f(5, v.IDecorationService), f(6, e.IThemeService)], h);
    }, 2550: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.WidthCache = void 0, s.WidthCache = class {
        constructor(o) {
          this._flat = new Float32Array(256), this._font = "", this._fontSize = 0, this._weight = "normal", this._weightBold = "bold", this._measureElements = [], this._container = o.createElement("div"), this._container.style.position = "absolute", this._container.style.top = "-50000px", this._container.style.width = "50000px", this._container.style.whiteSpace = "pre", this._container.style.fontKerning = "none";
          const a = o.createElement("span"), f = o.createElement("span");
          f.style.fontWeight = "bold";
          const n = o.createElement("span");
          n.style.fontStyle = "italic";
          const c = o.createElement("span");
          c.style.fontWeight = "bold", c.style.fontStyle = "italic", this._measureElements = [a, f, n, c], this._container.appendChild(a), this._container.appendChild(f), this._container.appendChild(n), this._container.appendChild(c), o.body.appendChild(this._container), this.clear();
        }
        dispose() {
          this._container.remove(), this._measureElements.length = 0, this._holey = void 0;
        }
        clear() {
          this._flat.fill(-9999), this._holey = /* @__PURE__ */ new Map();
        }
        setFont(o, a, f, n) {
          o === this._font && a === this._fontSize && f === this._weight && n === this._weightBold || (this._font = o, this._fontSize = a, this._weight = f, this._weightBold = n, this._container.style.fontFamily = this._font, this._container.style.fontSize = `${this._fontSize}px`, this._measureElements[0].style.fontWeight = `${f}`, this._measureElements[1].style.fontWeight = `${n}`, this._measureElements[2].style.fontWeight = `${f}`, this._measureElements[3].style.fontWeight = `${n}`, this.clear());
        }
        get(o, a, f) {
          let n = 0;
          if (!a && !f && o.length === 1 && (n = o.charCodeAt(0)) < 256)
            return this._flat[n] !== -9999 ? this._flat[n] : this._flat[n] = this._measure(o, 0);
          let c = o;
          a && (c += "B"), f && (c += "I");
          let u = this._holey.get(c);
          if (u === void 0) {
            let v = 0;
            a && (v |= 1), f && (v |= 2), u = this._measure(o, v), this._holey.set(c, u);
          }
          return u;
        }
        _measure(o, a) {
          const f = this._measureElements[a];
          return f.textContent = o.repeat(32), f.offsetWidth / 32;
        }
      };
    }, 2223: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.TEXT_BASELINE = s.DIM_OPACITY = s.INVERTED_DEFAULT_COLOR = void 0;
      const a = o(6114);
      s.INVERTED_DEFAULT_COLOR = 257, s.DIM_OPACITY = 0.5, s.TEXT_BASELINE = a.isFirefox || a.isLegacyEdge ? "bottom" : "ideographic";
    }, 6171: (x, s) => {
      function o(a) {
        return 57508 <= a && a <= 57558;
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.createRenderDimensions = s.excludeFromContrastRatioDemands = s.isRestrictedPowerlineGlyph = s.isPowerlineGlyph = s.throwIfFalsy = void 0, s.throwIfFalsy = function(a) {
        if (!a)
          throw new Error("value must not be falsy");
        return a;
      }, s.isPowerlineGlyph = o, s.isRestrictedPowerlineGlyph = function(a) {
        return 57520 <= a && a <= 57527;
      }, s.excludeFromContrastRatioDemands = function(a) {
        return o(a) || function(f) {
          return 9472 <= f && f <= 9631;
        }(a);
      }, s.createRenderDimensions = function() {
        return { css: { canvas: { width: 0, height: 0 }, cell: { width: 0, height: 0 } }, device: { canvas: { width: 0, height: 0 }, cell: { width: 0, height: 0 }, char: { width: 0, height: 0, left: 0, top: 0 } } };
      };
    }, 456: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.SelectionModel = void 0, s.SelectionModel = class {
        constructor(o) {
          this._bufferService = o, this.isSelectAllActive = !1, this.selectionStartLength = 0;
        }
        clearSelection() {
          this.selectionStart = void 0, this.selectionEnd = void 0, this.isSelectAllActive = !1, this.selectionStartLength = 0;
        }
        get finalSelectionStart() {
          return this.isSelectAllActive ? [0, 0] : this.selectionEnd && this.selectionStart && this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart;
        }
        get finalSelectionEnd() {
          if (this.isSelectAllActive)
            return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];
          if (this.selectionStart) {
            if (!this.selectionEnd || this.areSelectionValuesReversed()) {
              const o = this.selectionStart[0] + this.selectionStartLength;
              return o > this._bufferService.cols ? o % this._bufferService.cols == 0 ? [this._bufferService.cols, this.selectionStart[1] + Math.floor(o / this._bufferService.cols) - 1] : [o % this._bufferService.cols, this.selectionStart[1] + Math.floor(o / this._bufferService.cols)] : [o, this.selectionStart[1]];
            }
            if (this.selectionStartLength && this.selectionEnd[1] === this.selectionStart[1]) {
              const o = this.selectionStart[0] + this.selectionStartLength;
              return o > this._bufferService.cols ? [o % this._bufferService.cols, this.selectionStart[1] + Math.floor(o / this._bufferService.cols)] : [Math.max(o, this.selectionEnd[0]), this.selectionEnd[1]];
            }
            return this.selectionEnd;
          }
        }
        areSelectionValuesReversed() {
          const o = this.selectionStart, a = this.selectionEnd;
          return !(!o || !a) && (o[1] > a[1] || o[1] === a[1] && o[0] > a[0]);
        }
        handleTrim(o) {
          return this.selectionStart && (this.selectionStart[1] -= o), this.selectionEnd && (this.selectionEnd[1] -= o), this.selectionEnd && this.selectionEnd[1] < 0 ? (this.clearSelection(), !0) : (this.selectionStart && this.selectionStart[1] < 0 && (this.selectionStart[1] = 0), !1);
        }
      };
    }, 428: function(x, s, o) {
      var a = this && this.__decorate || function(e, i, t, r) {
        var h, _ = arguments.length, p = _ < 3 ? i : r === null ? r = Object.getOwnPropertyDescriptor(i, t) : r;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          p = Reflect.decorate(e, i, t, r);
        else
          for (var m = e.length - 1; m >= 0; m--)
            (h = e[m]) && (p = (_ < 3 ? h(p) : _ > 3 ? h(i, t, p) : h(i, t)) || p);
        return _ > 3 && p && Object.defineProperty(i, t, p), p;
      }, f = this && this.__param || function(e, i) {
        return function(t, r) {
          i(t, r, e);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CharSizeService = void 0;
      const n = o(2585), c = o(8460), u = o(844);
      let v = s.CharSizeService = class extends u.Disposable {
        get hasValidSize() {
          return this.width > 0 && this.height > 0;
        }
        constructor(e, i, t) {
          super(), this._optionsService = t, this.width = 0, this.height = 0, this._onCharSizeChange = this.register(new c.EventEmitter()), this.onCharSizeChange = this._onCharSizeChange.event, this._measureStrategy = new l(e, i, this._optionsService), this.register(this._optionsService.onMultipleOptionChange(["fontFamily", "fontSize"], () => this.measure()));
        }
        measure() {
          const e = this._measureStrategy.measure();
          e.width === this.width && e.height === this.height || (this.width = e.width, this.height = e.height, this._onCharSizeChange.fire());
        }
      };
      s.CharSizeService = v = a([f(2, n.IOptionsService)], v);
      class l {
        constructor(i, t, r) {
          this._document = i, this._parentElement = t, this._optionsService = r, this._result = { width: 0, height: 0 }, this._measureElement = this._document.createElement("span"), this._measureElement.classList.add("xterm-char-measure-element"), this._measureElement.textContent = "W".repeat(32), this._measureElement.setAttribute("aria-hidden", "true"), this._measureElement.style.whiteSpace = "pre", this._measureElement.style.fontKerning = "none", this._parentElement.appendChild(this._measureElement);
        }
        measure() {
          this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily, this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;
          const i = { height: Number(this._measureElement.offsetHeight), width: Number(this._measureElement.offsetWidth) };
          return i.width !== 0 && i.height !== 0 && (this._result.width = i.width / 32, this._result.height = Math.ceil(i.height)), this._result;
        }
      }
    }, 4269: function(x, s, o) {
      var a = this && this.__decorate || function(i, t, r, h) {
        var _, p = arguments.length, m = p < 3 ? t : h === null ? h = Object.getOwnPropertyDescriptor(t, r) : h;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          m = Reflect.decorate(i, t, r, h);
        else
          for (var d = i.length - 1; d >= 0; d--)
            (_ = i[d]) && (m = (p < 3 ? _(m) : p > 3 ? _(t, r, m) : _(t, r)) || m);
        return p > 3 && m && Object.defineProperty(t, r, m), m;
      }, f = this && this.__param || function(i, t) {
        return function(r, h) {
          t(r, h, i);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CharacterJoinerService = s.JoinedCellData = void 0;
      const n = o(3734), c = o(643), u = o(511), v = o(2585);
      class l extends n.AttributeData {
        constructor(t, r, h) {
          super(), this.content = 0, this.combinedData = "", this.fg = t.fg, this.bg = t.bg, this.combinedData = r, this._width = h;
        }
        isCombined() {
          return 2097152;
        }
        getWidth() {
          return this._width;
        }
        getChars() {
          return this.combinedData;
        }
        getCode() {
          return 2097151;
        }
        setFromCharData(t) {
          throw new Error("not implemented");
        }
        getAsCharData() {
          return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
        }
      }
      s.JoinedCellData = l;
      let e = s.CharacterJoinerService = class ye {
        constructor(t) {
          this._bufferService = t, this._characterJoiners = [], this._nextCharacterJoinerId = 0, this._workCell = new u.CellData();
        }
        register(t) {
          const r = { id: this._nextCharacterJoinerId++, handler: t };
          return this._characterJoiners.push(r), r.id;
        }
        deregister(t) {
          for (let r = 0; r < this._characterJoiners.length; r++)
            if (this._characterJoiners[r].id === t)
              return this._characterJoiners.splice(r, 1), !0;
          return !1;
        }
        getJoinedCharacters(t) {
          if (this._characterJoiners.length === 0)
            return [];
          const r = this._bufferService.buffer.lines.get(t);
          if (!r || r.length === 0)
            return [];
          const h = [], _ = r.translateToString(!0);
          let p = 0, m = 0, d = 0, g = r.getFg(0), y = r.getBg(0);
          for (let L = 0; L < r.getTrimmedLength(); L++)
            if (r.loadCell(L, this._workCell), this._workCell.getWidth() !== 0) {
              if (this._workCell.fg !== g || this._workCell.bg !== y) {
                if (L - p > 1) {
                  const b = this._getJoinedRanges(_, d, m, r, p);
                  for (let k = 0; k < b.length; k++)
                    h.push(b[k]);
                }
                p = L, d = m, g = this._workCell.fg, y = this._workCell.bg;
              }
              m += this._workCell.getChars().length || c.WHITESPACE_CELL_CHAR.length;
            }
          if (this._bufferService.cols - p > 1) {
            const L = this._getJoinedRanges(_, d, m, r, p);
            for (let b = 0; b < L.length; b++)
              h.push(L[b]);
          }
          return h;
        }
        _getJoinedRanges(t, r, h, _, p) {
          const m = t.substring(r, h);
          let d = [];
          try {
            d = this._characterJoiners[0].handler(m);
          } catch (g) {
            console.error(g);
          }
          for (let g = 1; g < this._characterJoiners.length; g++)
            try {
              const y = this._characterJoiners[g].handler(m);
              for (let L = 0; L < y.length; L++)
                ye._mergeRanges(d, y[L]);
            } catch (y) {
              console.error(y);
            }
          return this._stringRangesToCellRanges(d, _, p), d;
        }
        _stringRangesToCellRanges(t, r, h) {
          let _ = 0, p = !1, m = 0, d = t[_];
          if (d) {
            for (let g = h; g < this._bufferService.cols; g++) {
              const y = r.getWidth(g), L = r.getString(g).length || c.WHITESPACE_CELL_CHAR.length;
              if (y !== 0) {
                if (!p && d[0] <= m && (d[0] = g, p = !0), d[1] <= m) {
                  if (d[1] = g, d = t[++_], !d)
                    break;
                  d[0] <= m ? (d[0] = g, p = !0) : p = !1;
                }
                m += L;
              }
            }
            d && (d[1] = this._bufferService.cols);
          }
        }
        static _mergeRanges(t, r) {
          let h = !1;
          for (let _ = 0; _ < t.length; _++) {
            const p = t[_];
            if (h) {
              if (r[1] <= p[0])
                return t[_ - 1][1] = r[1], t;
              if (r[1] <= p[1])
                return t[_ - 1][1] = Math.max(r[1], p[1]), t.splice(_, 1), t;
              t.splice(_, 1), _--;
            } else {
              if (r[1] <= p[0])
                return t.splice(_, 0, r), t;
              if (r[1] <= p[1])
                return p[0] = Math.min(r[0], p[0]), t;
              r[0] < p[1] && (p[0] = Math.min(r[0], p[0]), h = !0);
            }
          }
          return h ? t[t.length - 1][1] = r[1] : t.push(r), t;
        }
      };
      s.CharacterJoinerService = e = a([f(0, v.IBufferService)], e);
    }, 5114: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CoreBrowserService = void 0, s.CoreBrowserService = class {
        constructor(o, a) {
          this._textarea = o, this.window = a, this._isFocused = !1, this._cachedIsFocused = void 0, this._textarea.addEventListener("focus", () => this._isFocused = !0), this._textarea.addEventListener("blur", () => this._isFocused = !1);
        }
        get dpr() {
          return this.window.devicePixelRatio;
        }
        get isFocused() {
          return this._cachedIsFocused === void 0 && (this._cachedIsFocused = this._isFocused && this._textarea.ownerDocument.hasFocus(), queueMicrotask(() => this._cachedIsFocused = void 0)), this._cachedIsFocused;
        }
      };
    }, 8934: function(x, s, o) {
      var a = this && this.__decorate || function(v, l, e, i) {
        var t, r = arguments.length, h = r < 3 ? l : i === null ? i = Object.getOwnPropertyDescriptor(l, e) : i;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          h = Reflect.decorate(v, l, e, i);
        else
          for (var _ = v.length - 1; _ >= 0; _--)
            (t = v[_]) && (h = (r < 3 ? t(h) : r > 3 ? t(l, e, h) : t(l, e)) || h);
        return r > 3 && h && Object.defineProperty(l, e, h), h;
      }, f = this && this.__param || function(v, l) {
        return function(e, i) {
          l(e, i, v);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.MouseService = void 0;
      const n = o(4725), c = o(9806);
      let u = s.MouseService = class {
        constructor(v, l) {
          this._renderService = v, this._charSizeService = l;
        }
        getCoords(v, l, e, i, t) {
          return (0, c.getCoords)(window, v, l, e, i, this._charSizeService.hasValidSize, this._renderService.dimensions.css.cell.width, this._renderService.dimensions.css.cell.height, t);
        }
        getMouseReportCoords(v, l) {
          const e = (0, c.getCoordsRelativeToElement)(window, v, l);
          if (this._charSizeService.hasValidSize)
            return e[0] = Math.min(Math.max(e[0], 0), this._renderService.dimensions.css.canvas.width - 1), e[1] = Math.min(Math.max(e[1], 0), this._renderService.dimensions.css.canvas.height - 1), { col: Math.floor(e[0] / this._renderService.dimensions.css.cell.width), row: Math.floor(e[1] / this._renderService.dimensions.css.cell.height), x: Math.floor(e[0]), y: Math.floor(e[1]) };
        }
      };
      s.MouseService = u = a([f(0, n.IRenderService), f(1, n.ICharSizeService)], u);
    }, 3230: function(x, s, o) {
      var a = this && this.__decorate || function(h, _, p, m) {
        var d, g = arguments.length, y = g < 3 ? _ : m === null ? m = Object.getOwnPropertyDescriptor(_, p) : m;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          y = Reflect.decorate(h, _, p, m);
        else
          for (var L = h.length - 1; L >= 0; L--)
            (d = h[L]) && (y = (g < 3 ? d(y) : g > 3 ? d(_, p, y) : d(_, p)) || y);
        return g > 3 && y && Object.defineProperty(_, p, y), y;
      }, f = this && this.__param || function(h, _) {
        return function(p, m) {
          _(p, m, h);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.RenderService = void 0;
      const n = o(3656), c = o(6193), u = o(5596), v = o(4725), l = o(8460), e = o(844), i = o(7226), t = o(2585);
      let r = s.RenderService = class extends e.Disposable {
        get dimensions() {
          return this._renderer.value.dimensions;
        }
        constructor(h, _, p, m, d, g, y, L) {
          if (super(), this._rowCount = h, this._charSizeService = m, this._renderer = this.register(new e.MutableDisposable()), this._pausedResizeTask = new i.DebouncedIdleTask(), this._isPaused = !1, this._needsFullRefresh = !1, this._isNextRenderRedrawOnly = !0, this._needsSelectionRefresh = !1, this._canvasWidth = 0, this._canvasHeight = 0, this._selectionState = { start: void 0, end: void 0, columnSelectMode: !1 }, this._onDimensionsChange = this.register(new l.EventEmitter()), this.onDimensionsChange = this._onDimensionsChange.event, this._onRenderedViewportChange = this.register(new l.EventEmitter()), this.onRenderedViewportChange = this._onRenderedViewportChange.event, this._onRender = this.register(new l.EventEmitter()), this.onRender = this._onRender.event, this._onRefreshRequest = this.register(new l.EventEmitter()), this.onRefreshRequest = this._onRefreshRequest.event, this._renderDebouncer = new c.RenderDebouncer(y.window, (b, k) => this._renderRows(b, k)), this.register(this._renderDebouncer), this._screenDprMonitor = new u.ScreenDprMonitor(y.window), this._screenDprMonitor.setListener(() => this.handleDevicePixelRatioChange()), this.register(this._screenDprMonitor), this.register(g.onResize(() => this._fullRefresh())), this.register(g.buffers.onBufferActivate(() => {
            var b;
            return (b = this._renderer.value) === null || b === void 0 ? void 0 : b.clear();
          })), this.register(p.onOptionChange(() => this._handleOptionsChanged())), this.register(this._charSizeService.onCharSizeChange(() => this.handleCharSizeChanged())), this.register(d.onDecorationRegistered(() => this._fullRefresh())), this.register(d.onDecorationRemoved(() => this._fullRefresh())), this.register(p.onMultipleOptionChange(["customGlyphs", "drawBoldTextInBrightColors", "letterSpacing", "lineHeight", "fontFamily", "fontSize", "fontWeight", "fontWeightBold", "minimumContrastRatio"], () => {
            this.clear(), this.handleResize(g.cols, g.rows), this._fullRefresh();
          })), this.register(p.onMultipleOptionChange(["cursorBlink", "cursorStyle"], () => this.refreshRows(g.buffer.y, g.buffer.y, !0))), this.register((0, n.addDisposableDomListener)(y.window, "resize", () => this.handleDevicePixelRatioChange())), this.register(L.onChangeColors(() => this._fullRefresh())), "IntersectionObserver" in y.window) {
            const b = new y.window.IntersectionObserver((k) => this._handleIntersectionChange(k[k.length - 1]), { threshold: 0 });
            b.observe(_), this.register({ dispose: () => b.disconnect() });
          }
        }
        _handleIntersectionChange(h) {
          this._isPaused = h.isIntersecting === void 0 ? h.intersectionRatio === 0 : !h.isIntersecting, this._isPaused || this._charSizeService.hasValidSize || this._charSizeService.measure(), !this._isPaused && this._needsFullRefresh && (this._pausedResizeTask.flush(), this.refreshRows(0, this._rowCount - 1), this._needsFullRefresh = !1);
        }
        refreshRows(h, _, p = !1) {
          this._isPaused ? this._needsFullRefresh = !0 : (p || (this._isNextRenderRedrawOnly = !1), this._renderDebouncer.refresh(h, _, this._rowCount));
        }
        _renderRows(h, _) {
          this._renderer.value && (h = Math.min(h, this._rowCount - 1), _ = Math.min(_, this._rowCount - 1), this._renderer.value.renderRows(h, _), this._needsSelectionRefresh && (this._renderer.value.handleSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode), this._needsSelectionRefresh = !1), this._isNextRenderRedrawOnly || this._onRenderedViewportChange.fire({ start: h, end: _ }), this._onRender.fire({ start: h, end: _ }), this._isNextRenderRedrawOnly = !0);
        }
        resize(h, _) {
          this._rowCount = _, this._fireOnCanvasResize();
        }
        _handleOptionsChanged() {
          this._renderer.value && (this.refreshRows(0, this._rowCount - 1), this._fireOnCanvasResize());
        }
        _fireOnCanvasResize() {
          this._renderer.value && (this._renderer.value.dimensions.css.canvas.width === this._canvasWidth && this._renderer.value.dimensions.css.canvas.height === this._canvasHeight || this._onDimensionsChange.fire(this._renderer.value.dimensions));
        }
        hasRenderer() {
          return !!this._renderer.value;
        }
        setRenderer(h) {
          this._renderer.value = h, this._renderer.value.onRequestRedraw((_) => this.refreshRows(_.start, _.end, !0)), this._needsSelectionRefresh = !0, this._fullRefresh();
        }
        addRefreshCallback(h) {
          return this._renderDebouncer.addRefreshCallback(h);
        }
        _fullRefresh() {
          this._isPaused ? this._needsFullRefresh = !0 : this.refreshRows(0, this._rowCount - 1);
        }
        clearTextureAtlas() {
          var h, _;
          this._renderer.value && ((_ = (h = this._renderer.value).clearTextureAtlas) === null || _ === void 0 || _.call(h), this._fullRefresh());
        }
        handleDevicePixelRatioChange() {
          this._charSizeService.measure(), this._renderer.value && (this._renderer.value.handleDevicePixelRatioChange(), this.refreshRows(0, this._rowCount - 1));
        }
        handleResize(h, _) {
          this._renderer.value && (this._isPaused ? this._pausedResizeTask.set(() => this._renderer.value.handleResize(h, _)) : this._renderer.value.handleResize(h, _), this._fullRefresh());
        }
        handleCharSizeChanged() {
          var h;
          (h = this._renderer.value) === null || h === void 0 || h.handleCharSizeChanged();
        }
        handleBlur() {
          var h;
          (h = this._renderer.value) === null || h === void 0 || h.handleBlur();
        }
        handleFocus() {
          var h;
          (h = this._renderer.value) === null || h === void 0 || h.handleFocus();
        }
        handleSelectionChanged(h, _, p) {
          var m;
          this._selectionState.start = h, this._selectionState.end = _, this._selectionState.columnSelectMode = p, (m = this._renderer.value) === null || m === void 0 || m.handleSelectionChanged(h, _, p);
        }
        handleCursorMove() {
          var h;
          (h = this._renderer.value) === null || h === void 0 || h.handleCursorMove();
        }
        clear() {
          var h;
          (h = this._renderer.value) === null || h === void 0 || h.clear();
        }
      };
      s.RenderService = r = a([f(2, t.IOptionsService), f(3, v.ICharSizeService), f(4, t.IDecorationService), f(5, t.IBufferService), f(6, v.ICoreBrowserService), f(7, v.IThemeService)], r);
    }, 9312: function(x, s, o) {
      var a = this && this.__decorate || function(d, g, y, L) {
        var b, k = arguments.length, A = k < 3 ? g : L === null ? L = Object.getOwnPropertyDescriptor(g, y) : L;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          A = Reflect.decorate(d, g, y, L);
        else
          for (var B = d.length - 1; B >= 0; B--)
            (b = d[B]) && (A = (k < 3 ? b(A) : k > 3 ? b(g, y, A) : b(g, y)) || A);
        return k > 3 && A && Object.defineProperty(g, y, A), A;
      }, f = this && this.__param || function(d, g) {
        return function(y, L) {
          g(y, L, d);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.SelectionService = void 0;
      const n = o(9806), c = o(9504), u = o(456), v = o(4725), l = o(8460), e = o(844), i = o(6114), t = o(4841), r = o(511), h = o(2585), _ = String.fromCharCode(160), p = new RegExp(_, "g");
      let m = s.SelectionService = class extends e.Disposable {
        constructor(d, g, y, L, b, k, A, B, T) {
          super(), this._element = d, this._screenElement = g, this._linkifier = y, this._bufferService = L, this._coreService = b, this._mouseService = k, this._optionsService = A, this._renderService = B, this._coreBrowserService = T, this._dragScrollAmount = 0, this._enabled = !0, this._workCell = new r.CellData(), this._mouseDownTimeStamp = 0, this._oldHasSelection = !1, this._oldSelectionStart = void 0, this._oldSelectionEnd = void 0, this._onLinuxMouseSelection = this.register(new l.EventEmitter()), this.onLinuxMouseSelection = this._onLinuxMouseSelection.event, this._onRedrawRequest = this.register(new l.EventEmitter()), this.onRequestRedraw = this._onRedrawRequest.event, this._onSelectionChange = this.register(new l.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onRequestScrollLines = this.register(new l.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this._mouseMoveListener = (M) => this._handleMouseMove(M), this._mouseUpListener = (M) => this._handleMouseUp(M), this._coreService.onUserInput(() => {
            this.hasSelection && this.clearSelection();
          }), this._trimListener = this._bufferService.buffer.lines.onTrim((M) => this._handleTrim(M)), this.register(this._bufferService.buffers.onBufferActivate((M) => this._handleBufferActivate(M))), this.enable(), this._model = new u.SelectionModel(this._bufferService), this._activeSelectionMode = 0, this.register((0, e.toDisposable)(() => {
            this._removeMouseDownListeners();
          }));
        }
        reset() {
          this.clearSelection();
        }
        disable() {
          this.clearSelection(), this._enabled = !1;
        }
        enable() {
          this._enabled = !0;
        }
        get selectionStart() {
          return this._model.finalSelectionStart;
        }
        get selectionEnd() {
          return this._model.finalSelectionEnd;
        }
        get hasSelection() {
          const d = this._model.finalSelectionStart, g = this._model.finalSelectionEnd;
          return !(!d || !g || d[0] === g[0] && d[1] === g[1]);
        }
        get selectionText() {
          const d = this._model.finalSelectionStart, g = this._model.finalSelectionEnd;
          if (!d || !g)
            return "";
          const y = this._bufferService.buffer, L = [];
          if (this._activeSelectionMode === 3) {
            if (d[0] === g[0])
              return "";
            const b = d[0] < g[0] ? d[0] : g[0], k = d[0] < g[0] ? g[0] : d[0];
            for (let A = d[1]; A <= g[1]; A++) {
              const B = y.translateBufferLineToString(A, !0, b, k);
              L.push(B);
            }
          } else {
            const b = d[1] === g[1] ? g[0] : void 0;
            L.push(y.translateBufferLineToString(d[1], !0, d[0], b));
            for (let k = d[1] + 1; k <= g[1] - 1; k++) {
              const A = y.lines.get(k), B = y.translateBufferLineToString(k, !0);
              A != null && A.isWrapped ? L[L.length - 1] += B : L.push(B);
            }
            if (d[1] !== g[1]) {
              const k = y.lines.get(g[1]), A = y.translateBufferLineToString(g[1], !0, 0, g[0]);
              k && k.isWrapped ? L[L.length - 1] += A : L.push(A);
            }
          }
          return L.map((b) => b.replace(p, " ")).join(i.isWindows ? `\r
` : `
`);
        }
        clearSelection() {
          this._model.clearSelection(), this._removeMouseDownListeners(), this.refresh(), this._onSelectionChange.fire();
        }
        refresh(d) {
          this._refreshAnimationFrame || (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh())), i.isLinux && d && this.selectionText.length && this._onLinuxMouseSelection.fire(this.selectionText);
        }
        _refresh() {
          this._refreshAnimationFrame = void 0, this._onRedrawRequest.fire({ start: this._model.finalSelectionStart, end: this._model.finalSelectionEnd, columnSelectMode: this._activeSelectionMode === 3 });
        }
        _isClickInSelection(d) {
          const g = this._getMouseBufferCoords(d), y = this._model.finalSelectionStart, L = this._model.finalSelectionEnd;
          return !!(y && L && g) && this._areCoordsInSelection(g, y, L);
        }
        isCellInSelection(d, g) {
          const y = this._model.finalSelectionStart, L = this._model.finalSelectionEnd;
          return !(!y || !L) && this._areCoordsInSelection([d, g], y, L);
        }
        _areCoordsInSelection(d, g, y) {
          return d[1] > g[1] && d[1] < y[1] || g[1] === y[1] && d[1] === g[1] && d[0] >= g[0] && d[0] < y[0] || g[1] < y[1] && d[1] === y[1] && d[0] < y[0] || g[1] < y[1] && d[1] === g[1] && d[0] >= g[0];
        }
        _selectWordAtCursor(d, g) {
          var y, L;
          const b = (L = (y = this._linkifier.currentLink) === null || y === void 0 ? void 0 : y.link) === null || L === void 0 ? void 0 : L.range;
          if (b)
            return this._model.selectionStart = [b.start.x - 1, b.start.y - 1], this._model.selectionStartLength = (0, t.getRangeLength)(b, this._bufferService.cols), this._model.selectionEnd = void 0, !0;
          const k = this._getMouseBufferCoords(d);
          return !!k && (this._selectWordAt(k, g), this._model.selectionEnd = void 0, !0);
        }
        selectAll() {
          this._model.isSelectAllActive = !0, this.refresh(), this._onSelectionChange.fire();
        }
        selectLines(d, g) {
          this._model.clearSelection(), d = Math.max(d, 0), g = Math.min(g, this._bufferService.buffer.lines.length - 1), this._model.selectionStart = [0, d], this._model.selectionEnd = [this._bufferService.cols, g], this.refresh(), this._onSelectionChange.fire();
        }
        _handleTrim(d) {
          this._model.handleTrim(d) && this.refresh();
        }
        _getMouseBufferCoords(d) {
          const g = this._mouseService.getCoords(d, this._screenElement, this._bufferService.cols, this._bufferService.rows, !0);
          if (g)
            return g[0]--, g[1]--, g[1] += this._bufferService.buffer.ydisp, g;
        }
        _getMouseEventScrollAmount(d) {
          let g = (0, n.getCoordsRelativeToElement)(this._coreBrowserService.window, d, this._screenElement)[1];
          const y = this._renderService.dimensions.css.canvas.height;
          return g >= 0 && g <= y ? 0 : (g > y && (g -= y), g = Math.min(Math.max(g, -50), 50), g /= 50, g / Math.abs(g) + Math.round(14 * g));
        }
        shouldForceSelection(d) {
          return i.isMac ? d.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection : d.shiftKey;
        }
        handleMouseDown(d) {
          if (this._mouseDownTimeStamp = d.timeStamp, (d.button !== 2 || !this.hasSelection) && d.button === 0) {
            if (!this._enabled) {
              if (!this.shouldForceSelection(d))
                return;
              d.stopPropagation();
            }
            d.preventDefault(), this._dragScrollAmount = 0, this._enabled && d.shiftKey ? this._handleIncrementalClick(d) : d.detail === 1 ? this._handleSingleClick(d) : d.detail === 2 ? this._handleDoubleClick(d) : d.detail === 3 && this._handleTripleClick(d), this._addMouseDownListeners(), this.refresh(!0);
          }
        }
        _addMouseDownListeners() {
          this._screenElement.ownerDocument && (this._screenElement.ownerDocument.addEventListener("mousemove", this._mouseMoveListener), this._screenElement.ownerDocument.addEventListener("mouseup", this._mouseUpListener)), this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), 50);
        }
        _removeMouseDownListeners() {
          this._screenElement.ownerDocument && (this._screenElement.ownerDocument.removeEventListener("mousemove", this._mouseMoveListener), this._screenElement.ownerDocument.removeEventListener("mouseup", this._mouseUpListener)), this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer), this._dragScrollIntervalTimer = void 0;
        }
        _handleIncrementalClick(d) {
          this._model.selectionStart && (this._model.selectionEnd = this._getMouseBufferCoords(d));
        }
        _handleSingleClick(d) {
          if (this._model.selectionStartLength = 0, this._model.isSelectAllActive = !1, this._activeSelectionMode = this.shouldColumnSelect(d) ? 3 : 0, this._model.selectionStart = this._getMouseBufferCoords(d), !this._model.selectionStart)
            return;
          this._model.selectionEnd = void 0;
          const g = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);
          g && g.length !== this._model.selectionStart[0] && g.hasWidth(this._model.selectionStart[0]) === 0 && this._model.selectionStart[0]++;
        }
        _handleDoubleClick(d) {
          this._selectWordAtCursor(d, !0) && (this._activeSelectionMode = 1);
        }
        _handleTripleClick(d) {
          const g = this._getMouseBufferCoords(d);
          g && (this._activeSelectionMode = 2, this._selectLineAt(g[1]));
        }
        shouldColumnSelect(d) {
          return d.altKey && !(i.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection);
        }
        _handleMouseMove(d) {
          if (d.stopImmediatePropagation(), !this._model.selectionStart)
            return;
          const g = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;
          if (this._model.selectionEnd = this._getMouseBufferCoords(d), !this._model.selectionEnd)
            return void this.refresh(!0);
          this._activeSelectionMode === 2 ? this._model.selectionEnd[1] < this._model.selectionStart[1] ? this._model.selectionEnd[0] = 0 : this._model.selectionEnd[0] = this._bufferService.cols : this._activeSelectionMode === 1 && this._selectToWordAt(this._model.selectionEnd), this._dragScrollAmount = this._getMouseEventScrollAmount(d), this._activeSelectionMode !== 3 && (this._dragScrollAmount > 0 ? this._model.selectionEnd[0] = this._bufferService.cols : this._dragScrollAmount < 0 && (this._model.selectionEnd[0] = 0));
          const y = this._bufferService.buffer;
          if (this._model.selectionEnd[1] < y.lines.length) {
            const L = y.lines.get(this._model.selectionEnd[1]);
            L && L.hasWidth(this._model.selectionEnd[0]) === 0 && this._model.selectionEnd[0]++;
          }
          g && g[0] === this._model.selectionEnd[0] && g[1] === this._model.selectionEnd[1] || this.refresh(!0);
        }
        _dragScroll() {
          if (this._model.selectionEnd && this._model.selectionStart && this._dragScrollAmount) {
            this._onRequestScrollLines.fire({ amount: this._dragScrollAmount, suppressScrollEvent: !1 });
            const d = this._bufferService.buffer;
            this._dragScrollAmount > 0 ? (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = this._bufferService.cols), this._model.selectionEnd[1] = Math.min(d.ydisp + this._bufferService.rows, d.lines.length - 1)) : (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = 0), this._model.selectionEnd[1] = d.ydisp), this.refresh();
          }
        }
        _handleMouseUp(d) {
          const g = d.timeStamp - this._mouseDownTimeStamp;
          if (this._removeMouseDownListeners(), this.selectionText.length <= 1 && g < 500 && d.altKey && this._optionsService.rawOptions.altClickMovesCursor) {
            if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {
              const y = this._mouseService.getCoords(d, this._element, this._bufferService.cols, this._bufferService.rows, !1);
              if (y && y[0] !== void 0 && y[1] !== void 0) {
                const L = (0, c.moveToCellSequence)(y[0] - 1, y[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);
                this._coreService.triggerDataEvent(L, !0);
              }
            }
          } else
            this._fireEventIfSelectionChanged();
        }
        _fireEventIfSelectionChanged() {
          const d = this._model.finalSelectionStart, g = this._model.finalSelectionEnd, y = !(!d || !g || d[0] === g[0] && d[1] === g[1]);
          y ? d && g && (this._oldSelectionStart && this._oldSelectionEnd && d[0] === this._oldSelectionStart[0] && d[1] === this._oldSelectionStart[1] && g[0] === this._oldSelectionEnd[0] && g[1] === this._oldSelectionEnd[1] || this._fireOnSelectionChange(d, g, y)) : this._oldHasSelection && this._fireOnSelectionChange(d, g, y);
        }
        _fireOnSelectionChange(d, g, y) {
          this._oldSelectionStart = d, this._oldSelectionEnd = g, this._oldHasSelection = y, this._onSelectionChange.fire();
        }
        _handleBufferActivate(d) {
          this.clearSelection(), this._trimListener.dispose(), this._trimListener = d.activeBuffer.lines.onTrim((g) => this._handleTrim(g));
        }
        _convertViewportColToCharacterIndex(d, g) {
          let y = g;
          for (let L = 0; g >= L; L++) {
            const b = d.loadCell(L, this._workCell).getChars().length;
            this._workCell.getWidth() === 0 ? y-- : b > 1 && g !== L && (y += b - 1);
          }
          return y;
        }
        setSelection(d, g, y) {
          this._model.clearSelection(), this._removeMouseDownListeners(), this._model.selectionStart = [d, g], this._model.selectionStartLength = y, this.refresh(), this._fireEventIfSelectionChanged();
        }
        rightClickSelect(d) {
          this._isClickInSelection(d) || (this._selectWordAtCursor(d, !1) && this.refresh(!0), this._fireEventIfSelectionChanged());
        }
        _getWordAt(d, g, y = !0, L = !0) {
          if (d[0] >= this._bufferService.cols)
            return;
          const b = this._bufferService.buffer, k = b.lines.get(d[1]);
          if (!k)
            return;
          const A = b.translateBufferLineToString(d[1], !1);
          let B = this._convertViewportColToCharacterIndex(k, d[0]), T = B;
          const M = d[0] - B;
          let S = 0, w = 0, E = 0, D = 0;
          if (A.charAt(B) === " ") {
            for (; B > 0 && A.charAt(B - 1) === " "; )
              B--;
            for (; T < A.length && A.charAt(T + 1) === " "; )
              T++;
          } else {
            let K = d[0], j = d[0];
            k.getWidth(K) === 0 && (S++, K--), k.getWidth(j) === 2 && (w++, j++);
            const X = k.getString(j).length;
            for (X > 1 && (D += X - 1, T += X - 1); K > 0 && B > 0 && !this._isCharWordSeparator(k.loadCell(K - 1, this._workCell)); ) {
              k.loadCell(K - 1, this._workCell);
              const C = this._workCell.getChars().length;
              this._workCell.getWidth() === 0 ? (S++, K--) : C > 1 && (E += C - 1, B -= C - 1), B--, K--;
            }
            for (; j < k.length && T + 1 < A.length && !this._isCharWordSeparator(k.loadCell(j + 1, this._workCell)); ) {
              k.loadCell(j + 1, this._workCell);
              const C = this._workCell.getChars().length;
              this._workCell.getWidth() === 2 ? (w++, j++) : C > 1 && (D += C - 1, T += C - 1), T++, j++;
            }
          }
          T++;
          let H = B + M - S + E, N = Math.min(this._bufferService.cols, T - B + S + w - E - D);
          if (g || A.slice(B, T).trim() !== "") {
            if (y && H === 0 && k.getCodePoint(0) !== 32) {
              const K = b.lines.get(d[1] - 1);
              if (K && k.isWrapped && K.getCodePoint(this._bufferService.cols - 1) !== 32) {
                const j = this._getWordAt([this._bufferService.cols - 1, d[1] - 1], !1, !0, !1);
                if (j) {
                  const X = this._bufferService.cols - j.start;
                  H -= X, N += X;
                }
              }
            }
            if (L && H + N === this._bufferService.cols && k.getCodePoint(this._bufferService.cols - 1) !== 32) {
              const K = b.lines.get(d[1] + 1);
              if (K != null && K.isWrapped && K.getCodePoint(0) !== 32) {
                const j = this._getWordAt([0, d[1] + 1], !1, !1, !0);
                j && (N += j.length);
              }
            }
            return { start: H, length: N };
          }
        }
        _selectWordAt(d, g) {
          const y = this._getWordAt(d, g);
          if (y) {
            for (; y.start < 0; )
              y.start += this._bufferService.cols, d[1]--;
            this._model.selectionStart = [y.start, d[1]], this._model.selectionStartLength = y.length;
          }
        }
        _selectToWordAt(d) {
          const g = this._getWordAt(d, !0);
          if (g) {
            let y = d[1];
            for (; g.start < 0; )
              g.start += this._bufferService.cols, y--;
            if (!this._model.areSelectionValuesReversed())
              for (; g.start + g.length > this._bufferService.cols; )
                g.length -= this._bufferService.cols, y++;
            this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? g.start : g.start + g.length, y];
          }
        }
        _isCharWordSeparator(d) {
          return d.getWidth() !== 0 && this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars()) >= 0;
        }
        _selectLineAt(d) {
          const g = this._bufferService.buffer.getWrappedRangeForLine(d), y = { start: { x: 0, y: g.first }, end: { x: this._bufferService.cols - 1, y: g.last } };
          this._model.selectionStart = [0, g.first], this._model.selectionEnd = void 0, this._model.selectionStartLength = (0, t.getRangeLength)(y, this._bufferService.cols);
        }
      };
      s.SelectionService = m = a([f(3, h.IBufferService), f(4, h.ICoreService), f(5, v.IMouseService), f(6, h.IOptionsService), f(7, v.IRenderService), f(8, v.ICoreBrowserService)], m);
    }, 4725: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.IThemeService = s.ICharacterJoinerService = s.ISelectionService = s.IRenderService = s.IMouseService = s.ICoreBrowserService = s.ICharSizeService = void 0;
      const a = o(8343);
      s.ICharSizeService = (0, a.createDecorator)("CharSizeService"), s.ICoreBrowserService = (0, a.createDecorator)("CoreBrowserService"), s.IMouseService = (0, a.createDecorator)("MouseService"), s.IRenderService = (0, a.createDecorator)("RenderService"), s.ISelectionService = (0, a.createDecorator)("SelectionService"), s.ICharacterJoinerService = (0, a.createDecorator)("CharacterJoinerService"), s.IThemeService = (0, a.createDecorator)("ThemeService");
    }, 6731: function(x, s, o) {
      var a = this && this.__decorate || function(m, d, g, y) {
        var L, b = arguments.length, k = b < 3 ? d : y === null ? y = Object.getOwnPropertyDescriptor(d, g) : y;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          k = Reflect.decorate(m, d, g, y);
        else
          for (var A = m.length - 1; A >= 0; A--)
            (L = m[A]) && (k = (b < 3 ? L(k) : b > 3 ? L(d, g, k) : L(d, g)) || k);
        return b > 3 && k && Object.defineProperty(d, g, k), k;
      }, f = this && this.__param || function(m, d) {
        return function(g, y) {
          d(g, y, m);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ThemeService = s.DEFAULT_ANSI_COLORS = void 0;
      const n = o(7239), c = o(8055), u = o(8460), v = o(844), l = o(2585), e = c.css.toColor("#ffffff"), i = c.css.toColor("#000000"), t = c.css.toColor("#ffffff"), r = c.css.toColor("#000000"), h = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 };
      s.DEFAULT_ANSI_COLORS = Object.freeze((() => {
        const m = [c.css.toColor("#2e3436"), c.css.toColor("#cc0000"), c.css.toColor("#4e9a06"), c.css.toColor("#c4a000"), c.css.toColor("#3465a4"), c.css.toColor("#75507b"), c.css.toColor("#06989a"), c.css.toColor("#d3d7cf"), c.css.toColor("#555753"), c.css.toColor("#ef2929"), c.css.toColor("#8ae234"), c.css.toColor("#fce94f"), c.css.toColor("#729fcf"), c.css.toColor("#ad7fa8"), c.css.toColor("#34e2e2"), c.css.toColor("#eeeeec")], d = [0, 95, 135, 175, 215, 255];
        for (let g = 0; g < 216; g++) {
          const y = d[g / 36 % 6 | 0], L = d[g / 6 % 6 | 0], b = d[g % 6];
          m.push({ css: c.channels.toCss(y, L, b), rgba: c.channels.toRgba(y, L, b) });
        }
        for (let g = 0; g < 24; g++) {
          const y = 8 + 10 * g;
          m.push({ css: c.channels.toCss(y, y, y), rgba: c.channels.toRgba(y, y, y) });
        }
        return m;
      })());
      let _ = s.ThemeService = class extends v.Disposable {
        get colors() {
          return this._colors;
        }
        constructor(m) {
          super(), this._optionsService = m, this._contrastCache = new n.ColorContrastCache(), this._halfContrastCache = new n.ColorContrastCache(), this._onChangeColors = this.register(new u.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = { foreground: e, background: i, cursor: t, cursorAccent: r, selectionForeground: void 0, selectionBackgroundTransparent: h, selectionBackgroundOpaque: c.color.blend(i, h), selectionInactiveBackgroundTransparent: h, selectionInactiveBackgroundOpaque: c.color.blend(i, h), ansi: s.DEFAULT_ANSI_COLORS.slice(), contrastCache: this._contrastCache, halfContrastCache: this._halfContrastCache }, this._updateRestoreColors(), this._setTheme(this._optionsService.rawOptions.theme), this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio", () => this._contrastCache.clear())), this.register(this._optionsService.onSpecificOptionChange("theme", () => this._setTheme(this._optionsService.rawOptions.theme)));
        }
        _setTheme(m = {}) {
          const d = this._colors;
          if (d.foreground = p(m.foreground, e), d.background = p(m.background, i), d.cursor = p(m.cursor, t), d.cursorAccent = p(m.cursorAccent, r), d.selectionBackgroundTransparent = p(m.selectionBackground, h), d.selectionBackgroundOpaque = c.color.blend(d.background, d.selectionBackgroundTransparent), d.selectionInactiveBackgroundTransparent = p(m.selectionInactiveBackground, d.selectionBackgroundTransparent), d.selectionInactiveBackgroundOpaque = c.color.blend(d.background, d.selectionInactiveBackgroundTransparent), d.selectionForeground = m.selectionForeground ? p(m.selectionForeground, c.NULL_COLOR) : void 0, d.selectionForeground === c.NULL_COLOR && (d.selectionForeground = void 0), c.color.isOpaque(d.selectionBackgroundTransparent) && (d.selectionBackgroundTransparent = c.color.opacity(d.selectionBackgroundTransparent, 0.3)), c.color.isOpaque(d.selectionInactiveBackgroundTransparent) && (d.selectionInactiveBackgroundTransparent = c.color.opacity(d.selectionInactiveBackgroundTransparent, 0.3)), d.ansi = s.DEFAULT_ANSI_COLORS.slice(), d.ansi[0] = p(m.black, s.DEFAULT_ANSI_COLORS[0]), d.ansi[1] = p(m.red, s.DEFAULT_ANSI_COLORS[1]), d.ansi[2] = p(m.green, s.DEFAULT_ANSI_COLORS[2]), d.ansi[3] = p(m.yellow, s.DEFAULT_ANSI_COLORS[3]), d.ansi[4] = p(m.blue, s.DEFAULT_ANSI_COLORS[4]), d.ansi[5] = p(m.magenta, s.DEFAULT_ANSI_COLORS[5]), d.ansi[6] = p(m.cyan, s.DEFAULT_ANSI_COLORS[6]), d.ansi[7] = p(m.white, s.DEFAULT_ANSI_COLORS[7]), d.ansi[8] = p(m.brightBlack, s.DEFAULT_ANSI_COLORS[8]), d.ansi[9] = p(m.brightRed, s.DEFAULT_ANSI_COLORS[9]), d.ansi[10] = p(m.brightGreen, s.DEFAULT_ANSI_COLORS[10]), d.ansi[11] = p(m.brightYellow, s.DEFAULT_ANSI_COLORS[11]), d.ansi[12] = p(m.brightBlue, s.DEFAULT_ANSI_COLORS[12]), d.ansi[13] = p(m.brightMagenta, s.DEFAULT_ANSI_COLORS[13]), d.ansi[14] = p(m.brightCyan, s.DEFAULT_ANSI_COLORS[14]), d.ansi[15] = p(m.brightWhite, s.DEFAULT_ANSI_COLORS[15]), m.extendedAnsi) {
            const g = Math.min(d.ansi.length - 16, m.extendedAnsi.length);
            for (let y = 0; y < g; y++)
              d.ansi[y + 16] = p(m.extendedAnsi[y], s.DEFAULT_ANSI_COLORS[y + 16]);
          }
          this._contrastCache.clear(), this._halfContrastCache.clear(), this._updateRestoreColors(), this._onChangeColors.fire(this.colors);
        }
        restoreColor(m) {
          this._restoreColor(m), this._onChangeColors.fire(this.colors);
        }
        _restoreColor(m) {
          if (m !== void 0)
            switch (m) {
              case 256:
                this._colors.foreground = this._restoreColors.foreground;
                break;
              case 257:
                this._colors.background = this._restoreColors.background;
                break;
              case 258:
                this._colors.cursor = this._restoreColors.cursor;
                break;
              default:
                this._colors.ansi[m] = this._restoreColors.ansi[m];
            }
          else
            for (let d = 0; d < this._restoreColors.ansi.length; ++d)
              this._colors.ansi[d] = this._restoreColors.ansi[d];
        }
        modifyColors(m) {
          m(this._colors), this._onChangeColors.fire(this.colors);
        }
        _updateRestoreColors() {
          this._restoreColors = { foreground: this._colors.foreground, background: this._colors.background, cursor: this._colors.cursor, ansi: this._colors.ansi.slice() };
        }
      };
      function p(m, d) {
        if (m !== void 0)
          try {
            return c.css.toColor(m);
          } catch (g) {
          }
        return d;
      }
      s.ThemeService = _ = a([f(0, l.IOptionsService)], _);
    }, 6349: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CircularList = void 0;
      const a = o(8460), f = o(844);
      class n extends f.Disposable {
        constructor(u) {
          super(), this._maxLength = u, this.onDeleteEmitter = this.register(new a.EventEmitter()), this.onDelete = this.onDeleteEmitter.event, this.onInsertEmitter = this.register(new a.EventEmitter()), this.onInsert = this.onInsertEmitter.event, this.onTrimEmitter = this.register(new a.EventEmitter()), this.onTrim = this.onTrimEmitter.event, this._array = new Array(this._maxLength), this._startIndex = 0, this._length = 0;
        }
        get maxLength() {
          return this._maxLength;
        }
        set maxLength(u) {
          if (this._maxLength === u)
            return;
          const v = new Array(u);
          for (let l = 0; l < Math.min(u, this.length); l++)
            v[l] = this._array[this._getCyclicIndex(l)];
          this._array = v, this._maxLength = u, this._startIndex = 0;
        }
        get length() {
          return this._length;
        }
        set length(u) {
          if (u > this._length)
            for (let v = this._length; v < u; v++)
              this._array[v] = void 0;
          this._length = u;
        }
        get(u) {
          return this._array[this._getCyclicIndex(u)];
        }
        set(u, v) {
          this._array[this._getCyclicIndex(u)] = v;
        }
        push(u) {
          this._array[this._getCyclicIndex(this._length)] = u, this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1)) : this._length++;
        }
        recycle() {
          if (this._length !== this._maxLength)
            throw new Error("Can only recycle when the buffer is full");
          return this._startIndex = ++this._startIndex % this._maxLength, this.onTrimEmitter.fire(1), this._array[this._getCyclicIndex(this._length - 1)];
        }
        get isFull() {
          return this._length === this._maxLength;
        }
        pop() {
          return this._array[this._getCyclicIndex(this._length-- - 1)];
        }
        splice(u, v, ...l) {
          if (v) {
            for (let e = u; e < this._length - v; e++)
              this._array[this._getCyclicIndex(e)] = this._array[this._getCyclicIndex(e + v)];
            this._length -= v, this.onDeleteEmitter.fire({ index: u, amount: v });
          }
          for (let e = this._length - 1; e >= u; e--)
            this._array[this._getCyclicIndex(e + l.length)] = this._array[this._getCyclicIndex(e)];
          for (let e = 0; e < l.length; e++)
            this._array[this._getCyclicIndex(u + e)] = l[e];
          if (l.length && this.onInsertEmitter.fire({ index: u, amount: l.length }), this._length + l.length > this._maxLength) {
            const e = this._length + l.length - this._maxLength;
            this._startIndex += e, this._length = this._maxLength, this.onTrimEmitter.fire(e);
          } else
            this._length += l.length;
        }
        trimStart(u) {
          u > this._length && (u = this._length), this._startIndex += u, this._length -= u, this.onTrimEmitter.fire(u);
        }
        shiftElements(u, v, l) {
          if (!(v <= 0)) {
            if (u < 0 || u >= this._length)
              throw new Error("start argument out of range");
            if (u + l < 0)
              throw new Error("Cannot shift elements in list beyond index 0");
            if (l > 0) {
              for (let i = v - 1; i >= 0; i--)
                this.set(u + i + l, this.get(u + i));
              const e = u + v + l - this._length;
              if (e > 0)
                for (this._length += e; this._length > this._maxLength; )
                  this._length--, this._startIndex++, this.onTrimEmitter.fire(1);
            } else
              for (let e = 0; e < v; e++)
                this.set(u + e + l, this.get(u + e));
          }
        }
        _getCyclicIndex(u) {
          return (this._startIndex + u) % this._maxLength;
        }
      }
      s.CircularList = n;
    }, 1439: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.clone = void 0, s.clone = function o(a, f = 5) {
        if (typeof a != "object")
          return a;
        const n = Array.isArray(a) ? [] : {};
        for (const c in a)
          n[c] = f <= 1 ? a[c] : a[c] && o(a[c], f - 1);
        return n;
      };
    }, 8055: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.contrastRatio = s.toPaddedHex = s.rgba = s.rgb = s.css = s.color = s.channels = s.NULL_COLOR = void 0;
      const a = o(6114);
      let f = 0, n = 0, c = 0, u = 0;
      var v, l, e, i, t;
      function r(_) {
        const p = _.toString(16);
        return p.length < 2 ? "0" + p : p;
      }
      function h(_, p) {
        return _ < p ? (p + 0.05) / (_ + 0.05) : (_ + 0.05) / (p + 0.05);
      }
      s.NULL_COLOR = { css: "#00000000", rgba: 0 }, function(_) {
        _.toCss = function(p, m, d, g) {
          return g !== void 0 ? `#${r(p)}${r(m)}${r(d)}${r(g)}` : `#${r(p)}${r(m)}${r(d)}`;
        }, _.toRgba = function(p, m, d, g = 255) {
          return (p << 24 | m << 16 | d << 8 | g) >>> 0;
        };
      }(v || (s.channels = v = {})), function(_) {
        function p(m, d) {
          return u = Math.round(255 * d), [f, n, c] = t.toChannels(m.rgba), { css: v.toCss(f, n, c, u), rgba: v.toRgba(f, n, c, u) };
        }
        _.blend = function(m, d) {
          if (u = (255 & d.rgba) / 255, u === 1)
            return { css: d.css, rgba: d.rgba };
          const g = d.rgba >> 24 & 255, y = d.rgba >> 16 & 255, L = d.rgba >> 8 & 255, b = m.rgba >> 24 & 255, k = m.rgba >> 16 & 255, A = m.rgba >> 8 & 255;
          return f = b + Math.round((g - b) * u), n = k + Math.round((y - k) * u), c = A + Math.round((L - A) * u), { css: v.toCss(f, n, c), rgba: v.toRgba(f, n, c) };
        }, _.isOpaque = function(m) {
          return (255 & m.rgba) == 255;
        }, _.ensureContrastRatio = function(m, d, g) {
          const y = t.ensureContrastRatio(m.rgba, d.rgba, g);
          if (y)
            return t.toColor(y >> 24 & 255, y >> 16 & 255, y >> 8 & 255);
        }, _.opaque = function(m) {
          const d = (255 | m.rgba) >>> 0;
          return [f, n, c] = t.toChannels(d), { css: v.toCss(f, n, c), rgba: d };
        }, _.opacity = p, _.multiplyOpacity = function(m, d) {
          return u = 255 & m.rgba, p(m, u * d / 255);
        }, _.toColorRGB = function(m) {
          return [m.rgba >> 24 & 255, m.rgba >> 16 & 255, m.rgba >> 8 & 255];
        };
      }(l || (s.color = l = {})), function(_) {
        let p, m;
        if (!a.isNode) {
          const d = document.createElement("canvas");
          d.width = 1, d.height = 1;
          const g = d.getContext("2d", { willReadFrequently: !0 });
          g && (p = g, p.globalCompositeOperation = "copy", m = p.createLinearGradient(0, 0, 1, 1));
        }
        _.toColor = function(d) {
          if (d.match(/#[\da-f]{3,8}/i))
            switch (d.length) {
              case 4:
                return f = parseInt(d.slice(1, 2).repeat(2), 16), n = parseInt(d.slice(2, 3).repeat(2), 16), c = parseInt(d.slice(3, 4).repeat(2), 16), t.toColor(f, n, c);
              case 5:
                return f = parseInt(d.slice(1, 2).repeat(2), 16), n = parseInt(d.slice(2, 3).repeat(2), 16), c = parseInt(d.slice(3, 4).repeat(2), 16), u = parseInt(d.slice(4, 5).repeat(2), 16), t.toColor(f, n, c, u);
              case 7:
                return { css: d, rgba: (parseInt(d.slice(1), 16) << 8 | 255) >>> 0 };
              case 9:
                return { css: d, rgba: parseInt(d.slice(1), 16) >>> 0 };
            }
          const g = d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
          if (g)
            return f = parseInt(g[1]), n = parseInt(g[2]), c = parseInt(g[3]), u = Math.round(255 * (g[5] === void 0 ? 1 : parseFloat(g[5]))), t.toColor(f, n, c, u);
          if (!p || !m)
            throw new Error("css.toColor: Unsupported css format");
          if (p.fillStyle = m, p.fillStyle = d, typeof p.fillStyle != "string")
            throw new Error("css.toColor: Unsupported css format");
          if (p.fillRect(0, 0, 1, 1), [f, n, c, u] = p.getImageData(0, 0, 1, 1).data, u !== 255)
            throw new Error("css.toColor: Unsupported css format");
          return { rgba: v.toRgba(f, n, c, u), css: d };
        };
      }(e || (s.css = e = {})), function(_) {
        function p(m, d, g) {
          const y = m / 255, L = d / 255, b = g / 255;
          return 0.2126 * (y <= 0.03928 ? y / 12.92 : Math.pow((y + 0.055) / 1.055, 2.4)) + 0.7152 * (L <= 0.03928 ? L / 12.92 : Math.pow((L + 0.055) / 1.055, 2.4)) + 0.0722 * (b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4));
        }
        _.relativeLuminance = function(m) {
          return p(m >> 16 & 255, m >> 8 & 255, 255 & m);
        }, _.relativeLuminance2 = p;
      }(i || (s.rgb = i = {})), function(_) {
        function p(d, g, y) {
          const L = d >> 24 & 255, b = d >> 16 & 255, k = d >> 8 & 255;
          let A = g >> 24 & 255, B = g >> 16 & 255, T = g >> 8 & 255, M = h(i.relativeLuminance2(A, B, T), i.relativeLuminance2(L, b, k));
          for (; M < y && (A > 0 || B > 0 || T > 0); )
            A -= Math.max(0, Math.ceil(0.1 * A)), B -= Math.max(0, Math.ceil(0.1 * B)), T -= Math.max(0, Math.ceil(0.1 * T)), M = h(i.relativeLuminance2(A, B, T), i.relativeLuminance2(L, b, k));
          return (A << 24 | B << 16 | T << 8 | 255) >>> 0;
        }
        function m(d, g, y) {
          const L = d >> 24 & 255, b = d >> 16 & 255, k = d >> 8 & 255;
          let A = g >> 24 & 255, B = g >> 16 & 255, T = g >> 8 & 255, M = h(i.relativeLuminance2(A, B, T), i.relativeLuminance2(L, b, k));
          for (; M < y && (A < 255 || B < 255 || T < 255); )
            A = Math.min(255, A + Math.ceil(0.1 * (255 - A))), B = Math.min(255, B + Math.ceil(0.1 * (255 - B))), T = Math.min(255, T + Math.ceil(0.1 * (255 - T))), M = h(i.relativeLuminance2(A, B, T), i.relativeLuminance2(L, b, k));
          return (A << 24 | B << 16 | T << 8 | 255) >>> 0;
        }
        _.ensureContrastRatio = function(d, g, y) {
          const L = i.relativeLuminance(d >> 8), b = i.relativeLuminance(g >> 8);
          if (h(L, b) < y) {
            if (b < L) {
              const B = p(d, g, y), T = h(L, i.relativeLuminance(B >> 8));
              if (T < y) {
                const M = m(d, g, y);
                return T > h(L, i.relativeLuminance(M >> 8)) ? B : M;
              }
              return B;
            }
            const k = m(d, g, y), A = h(L, i.relativeLuminance(k >> 8));
            if (A < y) {
              const B = p(d, g, y);
              return A > h(L, i.relativeLuminance(B >> 8)) ? k : B;
            }
            return k;
          }
        }, _.reduceLuminance = p, _.increaseLuminance = m, _.toChannels = function(d) {
          return [d >> 24 & 255, d >> 16 & 255, d >> 8 & 255, 255 & d];
        }, _.toColor = function(d, g, y, L) {
          return { css: v.toCss(d, g, y, L), rgba: v.toRgba(d, g, y, L) };
        };
      }(t || (s.rgba = t = {})), s.toPaddedHex = r, s.contrastRatio = h;
    }, 8969: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CoreTerminal = void 0;
      const a = o(844), f = o(2585), n = o(4348), c = o(7866), u = o(744), v = o(7302), l = o(6975), e = o(8460), i = o(1753), t = o(1480), r = o(7994), h = o(9282), _ = o(5435), p = o(5981), m = o(2660);
      let d = !1;
      class g extends a.Disposable {
        get onScroll() {
          return this._onScrollApi || (this._onScrollApi = this.register(new e.EventEmitter()), this._onScroll.event((L) => {
            var b;
            (b = this._onScrollApi) === null || b === void 0 || b.fire(L.position);
          })), this._onScrollApi.event;
        }
        get cols() {
          return this._bufferService.cols;
        }
        get rows() {
          return this._bufferService.rows;
        }
        get buffers() {
          return this._bufferService.buffers;
        }
        get options() {
          return this.optionsService.options;
        }
        set options(L) {
          for (const b in L)
            this.optionsService.options[b] = L[b];
        }
        constructor(L) {
          super(), this._windowsWrappingHeuristics = this.register(new a.MutableDisposable()), this._onBinary = this.register(new e.EventEmitter()), this.onBinary = this._onBinary.event, this._onData = this.register(new e.EventEmitter()), this.onData = this._onData.event, this._onLineFeed = this.register(new e.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onResize = this.register(new e.EventEmitter()), this.onResize = this._onResize.event, this._onWriteParsed = this.register(new e.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this.register(new e.EventEmitter()), this._instantiationService = new n.InstantiationService(), this.optionsService = this.register(new v.OptionsService(L)), this._instantiationService.setService(f.IOptionsService, this.optionsService), this._bufferService = this.register(this._instantiationService.createInstance(u.BufferService)), this._instantiationService.setService(f.IBufferService, this._bufferService), this._logService = this.register(this._instantiationService.createInstance(c.LogService)), this._instantiationService.setService(f.ILogService, this._logService), this.coreService = this.register(this._instantiationService.createInstance(l.CoreService)), this._instantiationService.setService(f.ICoreService, this.coreService), this.coreMouseService = this.register(this._instantiationService.createInstance(i.CoreMouseService)), this._instantiationService.setService(f.ICoreMouseService, this.coreMouseService), this.unicodeService = this.register(this._instantiationService.createInstance(t.UnicodeService)), this._instantiationService.setService(f.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(r.CharsetService), this._instantiationService.setService(f.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(m.OscLinkService), this._instantiationService.setService(f.IOscLinkService, this._oscLinkService), this._inputHandler = this.register(new _.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService)), this.register((0, e.forwardEvent)(this._inputHandler.onLineFeed, this._onLineFeed)), this.register(this._inputHandler), this.register((0, e.forwardEvent)(this._bufferService.onResize, this._onResize)), this.register((0, e.forwardEvent)(this.coreService.onData, this._onData)), this.register((0, e.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((b) => {
            this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
          })), this.register(this._inputHandler.onScroll((b) => {
            this._onScroll.fire({ position: this._bufferService.buffer.ydisp, source: 0 }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
          })), this._writeBuffer = this.register(new p.WriteBuffer((b, k) => this._inputHandler.parse(b, k))), this.register((0, e.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed));
        }
        write(L, b) {
          this._writeBuffer.write(L, b);
        }
        writeSync(L, b) {
          this._logService.logLevel <= f.LogLevelEnum.WARN && !d && (this._logService.warn("writeSync is unreliable and will be removed soon."), d = !0), this._writeBuffer.writeSync(L, b);
        }
        resize(L, b) {
          isNaN(L) || isNaN(b) || (L = Math.max(L, u.MINIMUM_COLS), b = Math.max(b, u.MINIMUM_ROWS), this._bufferService.resize(L, b));
        }
        scroll(L, b = !1) {
          this._bufferService.scroll(L, b);
        }
        scrollLines(L, b, k) {
          this._bufferService.scrollLines(L, b, k);
        }
        scrollPages(L) {
          this.scrollLines(L * (this.rows - 1));
        }
        scrollToTop() {
          this.scrollLines(-this._bufferService.buffer.ydisp);
        }
        scrollToBottom() {
          this.scrollLines(this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp);
        }
        scrollToLine(L) {
          const b = L - this._bufferService.buffer.ydisp;
          b !== 0 && this.scrollLines(b);
        }
        registerEscHandler(L, b) {
          return this._inputHandler.registerEscHandler(L, b);
        }
        registerDcsHandler(L, b) {
          return this._inputHandler.registerDcsHandler(L, b);
        }
        registerCsiHandler(L, b) {
          return this._inputHandler.registerCsiHandler(L, b);
        }
        registerOscHandler(L, b) {
          return this._inputHandler.registerOscHandler(L, b);
        }
        _setup() {
          this._handleWindowsPtyOptionChange();
        }
        reset() {
          this._inputHandler.reset(), this._bufferService.reset(), this._charsetService.reset(), this.coreService.reset(), this.coreMouseService.reset();
        }
        _handleWindowsPtyOptionChange() {
          let L = !1;
          const b = this.optionsService.rawOptions.windowsPty;
          b && b.buildNumber !== void 0 && b.buildNumber !== void 0 ? L = b.backend === "conpty" && b.buildNumber < 21376 : this.optionsService.rawOptions.windowsMode && (L = !0), L ? this._enableWindowsWrappingHeuristics() : this._windowsWrappingHeuristics.clear();
        }
        _enableWindowsWrappingHeuristics() {
          if (!this._windowsWrappingHeuristics.value) {
            const L = [];
            L.push(this.onLineFeed(h.updateWindowsModeWrappedState.bind(null, this._bufferService))), L.push(this.registerCsiHandler({ final: "H" }, () => ((0, h.updateWindowsModeWrappedState)(this._bufferService), !1))), this._windowsWrappingHeuristics.value = (0, a.toDisposable)(() => {
              for (const b of L)
                b.dispose();
            });
          }
        }
      }
      s.CoreTerminal = g;
    }, 8460: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.forwardEvent = s.EventEmitter = void 0, s.EventEmitter = class {
        constructor() {
          this._listeners = [], this._disposed = !1;
        }
        get event() {
          return this._event || (this._event = (o) => (this._listeners.push(o), { dispose: () => {
            if (!this._disposed) {
              for (let a = 0; a < this._listeners.length; a++)
                if (this._listeners[a] === o)
                  return void this._listeners.splice(a, 1);
            }
          } })), this._event;
        }
        fire(o, a) {
          const f = [];
          for (let n = 0; n < this._listeners.length; n++)
            f.push(this._listeners[n]);
          for (let n = 0; n < f.length; n++)
            f[n].call(void 0, o, a);
        }
        dispose() {
          this.clearListeners(), this._disposed = !0;
        }
        clearListeners() {
          this._listeners && (this._listeners.length = 0);
        }
      }, s.forwardEvent = function(o, a) {
        return o((f) => a.fire(f));
      };
    }, 5435: function(x, s, o) {
      var a = this && this.__decorate || function(M, S, w, E) {
        var D, H = arguments.length, N = H < 3 ? S : E === null ? E = Object.getOwnPropertyDescriptor(S, w) : E;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          N = Reflect.decorate(M, S, w, E);
        else
          for (var K = M.length - 1; K >= 0; K--)
            (D = M[K]) && (N = (H < 3 ? D(N) : H > 3 ? D(S, w, N) : D(S, w)) || N);
        return H > 3 && N && Object.defineProperty(S, w, N), N;
      }, f = this && this.__param || function(M, S) {
        return function(w, E) {
          S(w, E, M);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.InputHandler = s.WindowsOptionsReportType = void 0;
      const n = o(2584), c = o(7116), u = o(2015), v = o(844), l = o(482), e = o(8437), i = o(8460), t = o(643), r = o(511), h = o(3734), _ = o(2585), p = o(6242), m = o(6351), d = o(5941), g = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 }, y = 131072;
      function L(M, S) {
        if (M > 24)
          return S.setWinLines || !1;
        switch (M) {
          case 1:
            return !!S.restoreWin;
          case 2:
            return !!S.minimizeWin;
          case 3:
            return !!S.setWinPosition;
          case 4:
            return !!S.setWinSizePixels;
          case 5:
            return !!S.raiseWin;
          case 6:
            return !!S.lowerWin;
          case 7:
            return !!S.refreshWin;
          case 8:
            return !!S.setWinSizeChars;
          case 9:
            return !!S.maximizeWin;
          case 10:
            return !!S.fullscreenWin;
          case 11:
            return !!S.getWinState;
          case 13:
            return !!S.getWinPosition;
          case 14:
            return !!S.getWinSizePixels;
          case 15:
            return !!S.getScreenSizePixels;
          case 16:
            return !!S.getCellSizePixels;
          case 18:
            return !!S.getWinSizeChars;
          case 19:
            return !!S.getScreenSizeChars;
          case 20:
            return !!S.getIconTitle;
          case 21:
            return !!S.getWinTitle;
          case 22:
            return !!S.pushTitle;
          case 23:
            return !!S.popTitle;
          case 24:
            return !!S.setWinLines;
        }
        return !1;
      }
      var b;
      (function(M) {
        M[M.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS", M[M.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS";
      })(b || (s.WindowsOptionsReportType = b = {}));
      let k = 0;
      class A extends v.Disposable {
        getAttrData() {
          return this._curAttrData;
        }
        constructor(S, w, E, D, H, N, K, j, X = new u.EscapeSequenceParser()) {
          super(), this._bufferService = S, this._charsetService = w, this._coreService = E, this._logService = D, this._optionsService = H, this._oscLinkService = N, this._coreMouseService = K, this._unicodeService = j, this._parser = X, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new l.StringToUtf32(), this._utf8Decoder = new l.Utf8ToUtf32(), this._workCell = new r.CellData(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = e.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = e.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this.register(new i.EventEmitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this.register(new i.EventEmitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this.register(new i.EventEmitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this.register(new i.EventEmitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this.register(new i.EventEmitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this.register(new i.EventEmitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this.register(new i.EventEmitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this.register(new i.EventEmitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this.register(new i.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this.register(new i.EventEmitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this.register(new i.EventEmitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this.register(new i.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this.register(new i.EventEmitter()), this.onColor = this._onColor.event, this._parseStack = { paused: !1, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this.register(this._parser), this._dirtyRowTracker = new B(this._bufferService), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate((C) => this._activeBuffer = C.activeBuffer)), this._parser.setCsiHandlerFallback((C, R) => {
            this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(C), params: R.toArray() });
          }), this._parser.setEscHandlerFallback((C) => {
            this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(C) });
          }), this._parser.setExecuteHandlerFallback((C) => {
            this._logService.debug("Unknown EXECUTE code: ", { code: C });
          }), this._parser.setOscHandlerFallback((C, R, O) => {
            this._logService.debug("Unknown OSC code: ", { identifier: C, action: R, data: O });
          }), this._parser.setDcsHandlerFallback((C, R, O) => {
            R === "HOOK" && (O = O.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(C), action: R, payload: O });
          }), this._parser.setPrintHandler((C, R, O) => this.print(C, R, O)), this._parser.registerCsiHandler({ final: "@" }, (C) => this.insertChars(C)), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (C) => this.scrollLeft(C)), this._parser.registerCsiHandler({ final: "A" }, (C) => this.cursorUp(C)), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, (C) => this.scrollRight(C)), this._parser.registerCsiHandler({ final: "B" }, (C) => this.cursorDown(C)), this._parser.registerCsiHandler({ final: "C" }, (C) => this.cursorForward(C)), this._parser.registerCsiHandler({ final: "D" }, (C) => this.cursorBackward(C)), this._parser.registerCsiHandler({ final: "E" }, (C) => this.cursorNextLine(C)), this._parser.registerCsiHandler({ final: "F" }, (C) => this.cursorPrecedingLine(C)), this._parser.registerCsiHandler({ final: "G" }, (C) => this.cursorCharAbsolute(C)), this._parser.registerCsiHandler({ final: "H" }, (C) => this.cursorPosition(C)), this._parser.registerCsiHandler({ final: "I" }, (C) => this.cursorForwardTab(C)), this._parser.registerCsiHandler({ final: "J" }, (C) => this.eraseInDisplay(C, !1)), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, (C) => this.eraseInDisplay(C, !0)), this._parser.registerCsiHandler({ final: "K" }, (C) => this.eraseInLine(C, !1)), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, (C) => this.eraseInLine(C, !0)), this._parser.registerCsiHandler({ final: "L" }, (C) => this.insertLines(C)), this._parser.registerCsiHandler({ final: "M" }, (C) => this.deleteLines(C)), this._parser.registerCsiHandler({ final: "P" }, (C) => this.deleteChars(C)), this._parser.registerCsiHandler({ final: "S" }, (C) => this.scrollUp(C)), this._parser.registerCsiHandler({ final: "T" }, (C) => this.scrollDown(C)), this._parser.registerCsiHandler({ final: "X" }, (C) => this.eraseChars(C)), this._parser.registerCsiHandler({ final: "Z" }, (C) => this.cursorBackwardTab(C)), this._parser.registerCsiHandler({ final: "`" }, (C) => this.charPosAbsolute(C)), this._parser.registerCsiHandler({ final: "a" }, (C) => this.hPositionRelative(C)), this._parser.registerCsiHandler({ final: "b" }, (C) => this.repeatPrecedingCharacter(C)), this._parser.registerCsiHandler({ final: "c" }, (C) => this.sendDeviceAttributesPrimary(C)), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, (C) => this.sendDeviceAttributesSecondary(C)), this._parser.registerCsiHandler({ final: "d" }, (C) => this.linePosAbsolute(C)), this._parser.registerCsiHandler({ final: "e" }, (C) => this.vPositionRelative(C)), this._parser.registerCsiHandler({ final: "f" }, (C) => this.hVPosition(C)), this._parser.registerCsiHandler({ final: "g" }, (C) => this.tabClear(C)), this._parser.registerCsiHandler({ final: "h" }, (C) => this.setMode(C)), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, (C) => this.setModePrivate(C)), this._parser.registerCsiHandler({ final: "l" }, (C) => this.resetMode(C)), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, (C) => this.resetModePrivate(C)), this._parser.registerCsiHandler({ final: "m" }, (C) => this.charAttributes(C)), this._parser.registerCsiHandler({ final: "n" }, (C) => this.deviceStatus(C)), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, (C) => this.deviceStatusPrivate(C)), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, (C) => this.softReset(C)), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, (C) => this.setCursorStyle(C)), this._parser.registerCsiHandler({ final: "r" }, (C) => this.setScrollRegion(C)), this._parser.registerCsiHandler({ final: "s" }, (C) => this.saveCursor(C)), this._parser.registerCsiHandler({ final: "t" }, (C) => this.windowOptions(C)), this._parser.registerCsiHandler({ final: "u" }, (C) => this.restoreCursor(C)), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, (C) => this.insertColumns(C)), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, (C) => this.deleteColumns(C)), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, (C) => this.selectProtected(C)), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, (C) => this.requestMode(C, !0)), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, (C) => this.requestMode(C, !1)), this._parser.setExecuteHandler(n.C0.BEL, () => this.bell()), this._parser.setExecuteHandler(n.C0.LF, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.VT, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.FF, () => this.lineFeed()), this._parser.setExecuteHandler(n.C0.CR, () => this.carriageReturn()), this._parser.setExecuteHandler(n.C0.BS, () => this.backspace()), this._parser.setExecuteHandler(n.C0.HT, () => this.tab()), this._parser.setExecuteHandler(n.C0.SO, () => this.shiftOut()), this._parser.setExecuteHandler(n.C0.SI, () => this.shiftIn()), this._parser.setExecuteHandler(n.C1.IND, () => this.index()), this._parser.setExecuteHandler(n.C1.NEL, () => this.nextLine()), this._parser.setExecuteHandler(n.C1.HTS, () => this.tabSet()), this._parser.registerOscHandler(0, new p.OscHandler((C) => (this.setTitle(C), this.setIconName(C), !0))), this._parser.registerOscHandler(1, new p.OscHandler((C) => this.setIconName(C))), this._parser.registerOscHandler(2, new p.OscHandler((C) => this.setTitle(C))), this._parser.registerOscHandler(4, new p.OscHandler((C) => this.setOrReportIndexedColor(C))), this._parser.registerOscHandler(8, new p.OscHandler((C) => this.setHyperlink(C))), this._parser.registerOscHandler(10, new p.OscHandler((C) => this.setOrReportFgColor(C))), this._parser.registerOscHandler(11, new p.OscHandler((C) => this.setOrReportBgColor(C))), this._parser.registerOscHandler(12, new p.OscHandler((C) => this.setOrReportCursorColor(C))), this._parser.registerOscHandler(104, new p.OscHandler((C) => this.restoreIndexedColor(C))), this._parser.registerOscHandler(110, new p.OscHandler((C) => this.restoreFgColor(C))), this._parser.registerOscHandler(111, new p.OscHandler((C) => this.restoreBgColor(C))), this._parser.registerOscHandler(112, new p.OscHandler((C) => this.restoreCursorColor(C))), this._parser.registerEscHandler({ final: "7" }, () => this.saveCursor()), this._parser.registerEscHandler({ final: "8" }, () => this.restoreCursor()), this._parser.registerEscHandler({ final: "D" }, () => this.index()), this._parser.registerEscHandler({ final: "E" }, () => this.nextLine()), this._parser.registerEscHandler({ final: "H" }, () => this.tabSet()), this._parser.registerEscHandler({ final: "M" }, () => this.reverseIndex()), this._parser.registerEscHandler({ final: "=" }, () => this.keypadApplicationMode()), this._parser.registerEscHandler({ final: ">" }, () => this.keypadNumericMode()), this._parser.registerEscHandler({ final: "c" }, () => this.fullReset()), this._parser.registerEscHandler({ final: "n" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "o" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "|" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "}" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "~" }, () => this.setgLevel(1)), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, () => this.selectDefaultCharset()), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, () => this.selectDefaultCharset());
          for (const C in c.CHARSETS)
            this._parser.registerEscHandler({ intermediates: "(", final: C }, () => this.selectCharset("(" + C)), this._parser.registerEscHandler({ intermediates: ")", final: C }, () => this.selectCharset(")" + C)), this._parser.registerEscHandler({ intermediates: "*", final: C }, () => this.selectCharset("*" + C)), this._parser.registerEscHandler({ intermediates: "+", final: C }, () => this.selectCharset("+" + C)), this._parser.registerEscHandler({ intermediates: "-", final: C }, () => this.selectCharset("-" + C)), this._parser.registerEscHandler({ intermediates: ".", final: C }, () => this.selectCharset("." + C)), this._parser.registerEscHandler({ intermediates: "/", final: C }, () => this.selectCharset("/" + C));
          this._parser.registerEscHandler({ intermediates: "#", final: "8" }, () => this.screenAlignmentPattern()), this._parser.setErrorHandler((C) => (this._logService.error("Parsing error: ", C), C)), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new m.DcsHandler((C, R) => this.requestStatusString(C, R)));
        }
        _preserveStack(S, w, E, D) {
          this._parseStack.paused = !0, this._parseStack.cursorStartX = S, this._parseStack.cursorStartY = w, this._parseStack.decodedLength = E, this._parseStack.position = D;
        }
        _logSlowResolvingAsync(S) {
          this._logService.logLevel <= _.LogLevelEnum.WARN && Promise.race([S, new Promise((w, E) => setTimeout(() => E("#SLOW_TIMEOUT"), 5e3))]).catch((w) => {
            if (w !== "#SLOW_TIMEOUT")
              throw w;
            console.warn("async parser handler taking longer than 5000 ms");
          });
        }
        _getCurrentLinkId() {
          return this._curAttrData.extended.urlId;
        }
        parse(S, w) {
          let E, D = this._activeBuffer.x, H = this._activeBuffer.y, N = 0;
          const K = this._parseStack.paused;
          if (K) {
            if (E = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, w))
              return this._logSlowResolvingAsync(E), E;
            D = this._parseStack.cursorStartX, H = this._parseStack.cursorStartY, this._parseStack.paused = !1, S.length > y && (N = this._parseStack.position + y);
          }
          if (this._logService.logLevel <= _.LogLevelEnum.DEBUG && this._logService.debug("parsing data" + (typeof S == "string" ? ` "${S}"` : ` "${Array.prototype.map.call(S, (j) => String.fromCharCode(j)).join("")}"`), typeof S == "string" ? S.split("").map((j) => j.charCodeAt(0)) : S), this._parseBuffer.length < S.length && this._parseBuffer.length < y && (this._parseBuffer = new Uint32Array(Math.min(S.length, y))), K || this._dirtyRowTracker.clearRange(), S.length > y)
            for (let j = N; j < S.length; j += y) {
              const X = j + y < S.length ? j + y : S.length, C = typeof S == "string" ? this._stringDecoder.decode(S.substring(j, X), this._parseBuffer) : this._utf8Decoder.decode(S.subarray(j, X), this._parseBuffer);
              if (E = this._parser.parse(this._parseBuffer, C))
                return this._preserveStack(D, H, C, j), this._logSlowResolvingAsync(E), E;
            }
          else if (!K) {
            const j = typeof S == "string" ? this._stringDecoder.decode(S, this._parseBuffer) : this._utf8Decoder.decode(S, this._parseBuffer);
            if (E = this._parser.parse(this._parseBuffer, j))
              return this._preserveStack(D, H, j, 0), this._logSlowResolvingAsync(E), E;
          }
          this._activeBuffer.x === D && this._activeBuffer.y === H || this._onCursorMove.fire(), this._onRequestRefreshRows.fire(this._dirtyRowTracker.start, this._dirtyRowTracker.end);
        }
        print(S, w, E) {
          let D, H;
          const N = this._charsetService.charset, K = this._optionsService.rawOptions.screenReaderMode, j = this._bufferService.cols, X = this._coreService.decPrivateModes.wraparound, C = this._coreService.modes.insertMode, R = this._curAttrData;
          let O = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
          this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && E - w > 0 && O.getWidth(this._activeBuffer.x - 1) === 2 && O.setCellFromCodePoint(this._activeBuffer.x - 1, 0, 1, R.fg, R.bg, R.extended);
          for (let P = w; P < E; ++P) {
            if (D = S[P], H = this._unicodeService.wcwidth(D), D < 127 && N) {
              const z = N[String.fromCharCode(D)];
              z && (D = z.charCodeAt(0));
            }
            if (K && this._onA11yChar.fire((0, l.stringFromCodePoint)(D)), this._getCurrentLinkId() && this._oscLinkService.addLineToLink(this._getCurrentLinkId(), this._activeBuffer.ybase + this._activeBuffer.y), H || !this._activeBuffer.x) {
              if (this._activeBuffer.x + H - 1 >= j) {
                if (X) {
                  for (; this._activeBuffer.x < j; )
                    O.setCellFromCodePoint(this._activeBuffer.x++, 0, 1, R.fg, R.bg, R.extended);
                  this._activeBuffer.x = 0, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), !0)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !0), O = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
                } else if (this._activeBuffer.x = j - 1, H === 2)
                  continue;
              }
              if (C && (O.insertCells(this._activeBuffer.x, H, this._activeBuffer.getNullCell(R), R), O.getWidth(j - 1) === 2 && O.setCellFromCodePoint(j - 1, t.NULL_CELL_CODE, t.NULL_CELL_WIDTH, R.fg, R.bg, R.extended)), O.setCellFromCodePoint(this._activeBuffer.x++, D, H, R.fg, R.bg, R.extended), H > 0)
                for (; --H; )
                  O.setCellFromCodePoint(this._activeBuffer.x++, 0, 0, R.fg, R.bg, R.extended);
            } else
              O.getWidth(this._activeBuffer.x - 1) ? O.addCodepointToCell(this._activeBuffer.x - 1, D) : O.addCodepointToCell(this._activeBuffer.x - 2, D);
          }
          E - w > 0 && (O.loadCell(this._activeBuffer.x - 1, this._workCell), this._workCell.getWidth() === 2 || this._workCell.getCode() > 65535 ? this._parser.precedingCodepoint = 0 : this._workCell.isCombined() ? this._parser.precedingCodepoint = this._workCell.getChars().charCodeAt(0) : this._parser.precedingCodepoint = this._workCell.content), this._activeBuffer.x < j && E - w > 0 && O.getWidth(this._activeBuffer.x) === 0 && !O.hasContent(this._activeBuffer.x) && O.setCellFromCodePoint(this._activeBuffer.x, 0, 1, R.fg, R.bg, R.extended), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
        }
        registerCsiHandler(S, w) {
          return S.final !== "t" || S.prefix || S.intermediates ? this._parser.registerCsiHandler(S, w) : this._parser.registerCsiHandler(S, (E) => !L(E.params[0], this._optionsService.rawOptions.windowOptions) || w(E));
        }
        registerDcsHandler(S, w) {
          return this._parser.registerDcsHandler(S, new m.DcsHandler(w));
        }
        registerEscHandler(S, w) {
          return this._parser.registerEscHandler(S, w);
        }
        registerOscHandler(S, w) {
          return this._parser.registerOscHandler(S, new p.OscHandler(w));
        }
        bell() {
          return this._onRequestBell.fire(), !0;
        }
        lineFeed() {
          return this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._optionsService.rawOptions.convertEol && (this._activeBuffer.x = 0), this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows ? this._activeBuffer.y = this._bufferService.rows - 1 : this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !1, this._activeBuffer.x >= this._bufferService.cols && this._activeBuffer.x--, this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._onLineFeed.fire(), !0;
        }
        carriageReturn() {
          return this._activeBuffer.x = 0, !0;
        }
        backspace() {
          var S;
          if (!this._coreService.decPrivateModes.reverseWraparound)
            return this._restrictCursor(), this._activeBuffer.x > 0 && this._activeBuffer.x--, !0;
          if (this._restrictCursor(this._bufferService.cols), this._activeBuffer.x > 0)
            this._activeBuffer.x--;
          else if (this._activeBuffer.x === 0 && this._activeBuffer.y > this._activeBuffer.scrollTop && this._activeBuffer.y <= this._activeBuffer.scrollBottom && (!((S = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)) === null || S === void 0) && S.isWrapped)) {
            this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !1, this._activeBuffer.y--, this._activeBuffer.x = this._bufferService.cols - 1;
            const w = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
            w.hasWidth(this._activeBuffer.x) && !w.hasContent(this._activeBuffer.x) && this._activeBuffer.x--;
          }
          return this._restrictCursor(), !0;
        }
        tab() {
          if (this._activeBuffer.x >= this._bufferService.cols)
            return !0;
          const S = this._activeBuffer.x;
          return this._activeBuffer.x = this._activeBuffer.nextStop(), this._optionsService.rawOptions.screenReaderMode && this._onA11yTab.fire(this._activeBuffer.x - S), !0;
        }
        shiftOut() {
          return this._charsetService.setgLevel(1), !0;
        }
        shiftIn() {
          return this._charsetService.setgLevel(0), !0;
        }
        _restrictCursor(S = this._bufferService.cols - 1) {
          this._activeBuffer.x = Math.min(S, Math.max(0, this._activeBuffer.x)), this._activeBuffer.y = this._coreService.decPrivateModes.origin ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y)) : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y)), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
        }
        _setCursor(S, w) {
          this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._coreService.decPrivateModes.origin ? (this._activeBuffer.x = S, this._activeBuffer.y = this._activeBuffer.scrollTop + w) : (this._activeBuffer.x = S, this._activeBuffer.y = w), this._restrictCursor(), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
        }
        _moveCursor(S, w) {
          this._restrictCursor(), this._setCursor(this._activeBuffer.x + S, this._activeBuffer.y + w);
        }
        cursorUp(S) {
          const w = this._activeBuffer.y - this._activeBuffer.scrollTop;
          return w >= 0 ? this._moveCursor(0, -Math.min(w, S.params[0] || 1)) : this._moveCursor(0, -(S.params[0] || 1)), !0;
        }
        cursorDown(S) {
          const w = this._activeBuffer.scrollBottom - this._activeBuffer.y;
          return w >= 0 ? this._moveCursor(0, Math.min(w, S.params[0] || 1)) : this._moveCursor(0, S.params[0] || 1), !0;
        }
        cursorForward(S) {
          return this._moveCursor(S.params[0] || 1, 0), !0;
        }
        cursorBackward(S) {
          return this._moveCursor(-(S.params[0] || 1), 0), !0;
        }
        cursorNextLine(S) {
          return this.cursorDown(S), this._activeBuffer.x = 0, !0;
        }
        cursorPrecedingLine(S) {
          return this.cursorUp(S), this._activeBuffer.x = 0, !0;
        }
        cursorCharAbsolute(S) {
          return this._setCursor((S.params[0] || 1) - 1, this._activeBuffer.y), !0;
        }
        cursorPosition(S) {
          return this._setCursor(S.length >= 2 ? (S.params[1] || 1) - 1 : 0, (S.params[0] || 1) - 1), !0;
        }
        charPosAbsolute(S) {
          return this._setCursor((S.params[0] || 1) - 1, this._activeBuffer.y), !0;
        }
        hPositionRelative(S) {
          return this._moveCursor(S.params[0] || 1, 0), !0;
        }
        linePosAbsolute(S) {
          return this._setCursor(this._activeBuffer.x, (S.params[0] || 1) - 1), !0;
        }
        vPositionRelative(S) {
          return this._moveCursor(0, S.params[0] || 1), !0;
        }
        hVPosition(S) {
          return this.cursorPosition(S), !0;
        }
        tabClear(S) {
          const w = S.params[0];
          return w === 0 ? delete this._activeBuffer.tabs[this._activeBuffer.x] : w === 3 && (this._activeBuffer.tabs = {}), !0;
        }
        cursorForwardTab(S) {
          if (this._activeBuffer.x >= this._bufferService.cols)
            return !0;
          let w = S.params[0] || 1;
          for (; w--; )
            this._activeBuffer.x = this._activeBuffer.nextStop();
          return !0;
        }
        cursorBackwardTab(S) {
          if (this._activeBuffer.x >= this._bufferService.cols)
            return !0;
          let w = S.params[0] || 1;
          for (; w--; )
            this._activeBuffer.x = this._activeBuffer.prevStop();
          return !0;
        }
        selectProtected(S) {
          const w = S.params[0];
          return w === 1 && (this._curAttrData.bg |= 536870912), w !== 2 && w !== 0 || (this._curAttrData.bg &= -536870913), !0;
        }
        _eraseInBufferLine(S, w, E, D = !1, H = !1) {
          const N = this._activeBuffer.lines.get(this._activeBuffer.ybase + S);
          N.replaceCells(w, E, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData(), H), D && (N.isWrapped = !1);
        }
        _resetBufferLine(S, w = !1) {
          const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + S);
          E && (E.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), w), this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + S), E.isWrapped = !1);
        }
        eraseInDisplay(S, w = !1) {
          let E;
          switch (this._restrictCursor(this._bufferService.cols), S.params[0]) {
            case 0:
              for (E = this._activeBuffer.y, this._dirtyRowTracker.markDirty(E), this._eraseInBufferLine(E++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, w); E < this._bufferService.rows; E++)
                this._resetBufferLine(E, w);
              this._dirtyRowTracker.markDirty(E);
              break;
            case 1:
              for (E = this._activeBuffer.y, this._dirtyRowTracker.markDirty(E), this._eraseInBufferLine(E, 0, this._activeBuffer.x + 1, !0, w), this._activeBuffer.x + 1 >= this._bufferService.cols && (this._activeBuffer.lines.get(E + 1).isWrapped = !1); E--; )
                this._resetBufferLine(E, w);
              this._dirtyRowTracker.markDirty(0);
              break;
            case 2:
              for (E = this._bufferService.rows, this._dirtyRowTracker.markDirty(E - 1); E--; )
                this._resetBufferLine(E, w);
              this._dirtyRowTracker.markDirty(0);
              break;
            case 3:
              const D = this._activeBuffer.lines.length - this._bufferService.rows;
              D > 0 && (this._activeBuffer.lines.trimStart(D), this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - D, 0), this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - D, 0), this._onScroll.fire(0));
          }
          return !0;
        }
        eraseInLine(S, w = !1) {
          switch (this._restrictCursor(this._bufferService.cols), S.params[0]) {
            case 0:
              this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, w);
              break;
            case 1:
              this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, !1, w);
              break;
            case 2:
              this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, !0, w);
          }
          return this._dirtyRowTracker.markDirty(this._activeBuffer.y), !0;
        }
        insertLines(S) {
          this._restrictCursor();
          let w = S.params[0] || 1;
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const E = this._activeBuffer.ybase + this._activeBuffer.y, D = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, H = this._bufferService.rows - 1 + this._activeBuffer.ybase - D + 1;
          for (; w--; )
            this._activeBuffer.lines.splice(H - 1, 1), this._activeBuffer.lines.splice(E, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, !0;
        }
        deleteLines(S) {
          this._restrictCursor();
          let w = S.params[0] || 1;
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const E = this._activeBuffer.ybase + this._activeBuffer.y;
          let D;
          for (D = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom, D = this._bufferService.rows - 1 + this._activeBuffer.ybase - D; w--; )
            this._activeBuffer.lines.splice(E, 1), this._activeBuffer.lines.splice(D, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom), this._activeBuffer.x = 0, !0;
        }
        insertChars(S) {
          this._restrictCursor();
          const w = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
          return w && (w.insertCells(this._activeBuffer.x, S.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), this._dirtyRowTracker.markDirty(this._activeBuffer.y)), !0;
        }
        deleteChars(S) {
          this._restrictCursor();
          const w = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
          return w && (w.deleteCells(this._activeBuffer.x, S.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), this._dirtyRowTracker.markDirty(this._activeBuffer.y)), !0;
        }
        scrollUp(S) {
          let w = S.params[0] || 1;
          for (; w--; )
            this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1), this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        scrollDown(S) {
          let w = S.params[0] || 1;
          for (; w--; )
            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(e.DEFAULT_ATTR_DATA));
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        scrollLeft(S) {
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const w = S.params[0] || 1;
          for (let E = this._activeBuffer.scrollTop; E <= this._activeBuffer.scrollBottom; ++E) {
            const D = this._activeBuffer.lines.get(this._activeBuffer.ybase + E);
            D.deleteCells(0, w, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), D.isWrapped = !1;
          }
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        scrollRight(S) {
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const w = S.params[0] || 1;
          for (let E = this._activeBuffer.scrollTop; E <= this._activeBuffer.scrollBottom; ++E) {
            const D = this._activeBuffer.lines.get(this._activeBuffer.ybase + E);
            D.insertCells(0, w, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), D.isWrapped = !1;
          }
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        insertColumns(S) {
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const w = S.params[0] || 1;
          for (let E = this._activeBuffer.scrollTop; E <= this._activeBuffer.scrollBottom; ++E) {
            const D = this._activeBuffer.lines.get(this._activeBuffer.ybase + E);
            D.insertCells(this._activeBuffer.x, w, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), D.isWrapped = !1;
          }
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        deleteColumns(S) {
          if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
            return !0;
          const w = S.params[0] || 1;
          for (let E = this._activeBuffer.scrollTop; E <= this._activeBuffer.scrollBottom; ++E) {
            const D = this._activeBuffer.lines.get(this._activeBuffer.ybase + E);
            D.deleteCells(this._activeBuffer.x, w, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), D.isWrapped = !1;
          }
          return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom), !0;
        }
        eraseChars(S) {
          this._restrictCursor();
          const w = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
          return w && (w.replaceCells(this._activeBuffer.x, this._activeBuffer.x + (S.params[0] || 1), this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()), this._dirtyRowTracker.markDirty(this._activeBuffer.y)), !0;
        }
        repeatPrecedingCharacter(S) {
          if (!this._parser.precedingCodepoint)
            return !0;
          const w = S.params[0] || 1, E = new Uint32Array(w);
          for (let D = 0; D < w; ++D)
            E[D] = this._parser.precedingCodepoint;
          return this.print(E, 0, E.length), !0;
        }
        sendDeviceAttributesPrimary(S) {
          return S.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n.C0.ESC + "[?6c")), !0;
        }
        sendDeviceAttributesSecondary(S) {
          return S.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(S.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n.C0.ESC + "[>83;40003;0c")), !0;
        }
        _is(S) {
          return (this._optionsService.rawOptions.termName + "").indexOf(S) === 0;
        }
        setMode(S) {
          for (let w = 0; w < S.length; w++)
            switch (S.params[w]) {
              case 4:
                this._coreService.modes.insertMode = !0;
                break;
              case 20:
                this._optionsService.options.convertEol = !0;
            }
          return !0;
        }
        setModePrivate(S) {
          for (let w = 0; w < S.length; w++)
            switch (S.params[w]) {
              case 1:
                this._coreService.decPrivateModes.applicationCursorKeys = !0;
                break;
              case 2:
                this._charsetService.setgCharset(0, c.DEFAULT_CHARSET), this._charsetService.setgCharset(1, c.DEFAULT_CHARSET), this._charsetService.setgCharset(2, c.DEFAULT_CHARSET), this._charsetService.setgCharset(3, c.DEFAULT_CHARSET);
                break;
              case 3:
                this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(132, this._bufferService.rows), this._onRequestReset.fire());
                break;
              case 6:
                this._coreService.decPrivateModes.origin = !0, this._setCursor(0, 0);
                break;
              case 7:
                this._coreService.decPrivateModes.wraparound = !0;
                break;
              case 12:
                this._optionsService.options.cursorBlink = !0;
                break;
              case 45:
                this._coreService.decPrivateModes.reverseWraparound = !0;
                break;
              case 66:
                this._logService.debug("Serial port requested application keypad."), this._coreService.decPrivateModes.applicationKeypad = !0, this._onRequestSyncScrollBar.fire();
                break;
              case 9:
                this._coreMouseService.activeProtocol = "X10";
                break;
              case 1e3:
                this._coreMouseService.activeProtocol = "VT200";
                break;
              case 1002:
                this._coreMouseService.activeProtocol = "DRAG";
                break;
              case 1003:
                this._coreMouseService.activeProtocol = "ANY";
                break;
              case 1004:
                this._coreService.decPrivateModes.sendFocus = !0, this._onRequestSendFocus.fire();
                break;
              case 1005:
                this._logService.debug("DECSET 1005 not supported (see #2507)");
                break;
              case 1006:
                this._coreMouseService.activeEncoding = "SGR";
                break;
              case 1015:
                this._logService.debug("DECSET 1015 not supported (see #2507)");
                break;
              case 1016:
                this._coreMouseService.activeEncoding = "SGR_PIXELS";
                break;
              case 25:
                this._coreService.isCursorHidden = !1;
                break;
              case 1048:
                this.saveCursor();
                break;
              case 1049:
                this.saveCursor();
              case 47:
              case 1047:
                this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()), this._coreService.isCursorInitialized = !0, this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1), this._onRequestSyncScrollBar.fire();
                break;
              case 2004:
                this._coreService.decPrivateModes.bracketedPasteMode = !0;
            }
          return !0;
        }
        resetMode(S) {
          for (let w = 0; w < S.length; w++)
            switch (S.params[w]) {
              case 4:
                this._coreService.modes.insertMode = !1;
                break;
              case 20:
                this._optionsService.options.convertEol = !1;
            }
          return !0;
        }
        resetModePrivate(S) {
          for (let w = 0; w < S.length; w++)
            switch (S.params[w]) {
              case 1:
                this._coreService.decPrivateModes.applicationCursorKeys = !1;
                break;
              case 3:
                this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(80, this._bufferService.rows), this._onRequestReset.fire());
                break;
              case 6:
                this._coreService.decPrivateModes.origin = !1, this._setCursor(0, 0);
                break;
              case 7:
                this._coreService.decPrivateModes.wraparound = !1;
                break;
              case 12:
                this._optionsService.options.cursorBlink = !1;
                break;
              case 45:
                this._coreService.decPrivateModes.reverseWraparound = !1;
                break;
              case 66:
                this._logService.debug("Switching back to normal keypad."), this._coreService.decPrivateModes.applicationKeypad = !1, this._onRequestSyncScrollBar.fire();
                break;
              case 9:
              case 1e3:
              case 1002:
              case 1003:
                this._coreMouseService.activeProtocol = "NONE";
                break;
              case 1004:
                this._coreService.decPrivateModes.sendFocus = !1;
                break;
              case 1005:
                this._logService.debug("DECRST 1005 not supported (see #2507)");
                break;
              case 1006:
              case 1016:
                this._coreMouseService.activeEncoding = "DEFAULT";
                break;
              case 1015:
                this._logService.debug("DECRST 1015 not supported (see #2507)");
                break;
              case 25:
                this._coreService.isCursorHidden = !0;
                break;
              case 1048:
                this.restoreCursor();
                break;
              case 1049:
              case 47:
              case 1047:
                this._bufferService.buffers.activateNormalBuffer(), S.params[w] === 1049 && this.restoreCursor(), this._coreService.isCursorInitialized = !0, this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1), this._onRequestSyncScrollBar.fire();
                break;
              case 2004:
                this._coreService.decPrivateModes.bracketedPasteMode = !1;
            }
          return !0;
        }
        requestMode(S, w) {
          const E = this._coreService.decPrivateModes, { activeProtocol: D, activeEncoding: H } = this._coreMouseService, N = this._coreService, { buffers: K, cols: j } = this._bufferService, { active: X, alt: C } = K, R = this._optionsService.rawOptions, O = (G) => G ? 1 : 2, P = S.params[0];
          return z = P, $ = w ? P === 2 ? 4 : P === 4 ? O(N.modes.insertMode) : P === 12 ? 3 : P === 20 ? O(R.convertEol) : 0 : P === 1 ? O(E.applicationCursorKeys) : P === 3 ? R.windowOptions.setWinLines ? j === 80 ? 2 : j === 132 ? 1 : 0 : 0 : P === 6 ? O(E.origin) : P === 7 ? O(E.wraparound) : P === 8 ? 3 : P === 9 ? O(D === "X10") : P === 12 ? O(R.cursorBlink) : P === 25 ? O(!N.isCursorHidden) : P === 45 ? O(E.reverseWraparound) : P === 66 ? O(E.applicationKeypad) : P === 67 ? 4 : P === 1e3 ? O(D === "VT200") : P === 1002 ? O(D === "DRAG") : P === 1003 ? O(D === "ANY") : P === 1004 ? O(E.sendFocus) : P === 1005 ? 4 : P === 1006 ? O(H === "SGR") : P === 1015 ? 4 : P === 1016 ? O(H === "SGR_PIXELS") : P === 1048 ? 1 : P === 47 || P === 1047 || P === 1049 ? O(X === C) : P === 2004 ? O(E.bracketedPasteMode) : 0, N.triggerDataEvent(`${n.C0.ESC}[${w ? "" : "?"}${z};${$}$y`), !0;
          var z, $;
        }
        _updateAttrColor(S, w, E, D, H) {
          return w === 2 ? (S |= 50331648, S &= -16777216, S |= h.AttributeData.fromColorRGB([E, D, H])) : w === 5 && (S &= -50331904, S |= 33554432 | 255 & E), S;
        }
        _extractColor(S, w, E) {
          const D = [0, 0, -1, 0, 0, 0];
          let H = 0, N = 0;
          do {
            if (D[N + H] = S.params[w + N], S.hasSubParams(w + N)) {
              const K = S.getSubParams(w + N);
              let j = 0;
              do
                D[1] === 5 && (H = 1), D[N + j + 1 + H] = K[j];
              while (++j < K.length && j + N + 1 + H < D.length);
              break;
            }
            if (D[1] === 5 && N + H >= 2 || D[1] === 2 && N + H >= 5)
              break;
            D[1] && (H = 1);
          } while (++N + w < S.length && N + H < D.length);
          for (let K = 2; K < D.length; ++K)
            D[K] === -1 && (D[K] = 0);
          switch (D[0]) {
            case 38:
              E.fg = this._updateAttrColor(E.fg, D[1], D[3], D[4], D[5]);
              break;
            case 48:
              E.bg = this._updateAttrColor(E.bg, D[1], D[3], D[4], D[5]);
              break;
            case 58:
              E.extended = E.extended.clone(), E.extended.underlineColor = this._updateAttrColor(E.extended.underlineColor, D[1], D[3], D[4], D[5]);
          }
          return N;
        }
        _processUnderline(S, w) {
          w.extended = w.extended.clone(), (!~S || S > 5) && (S = 1), w.extended.underlineStyle = S, w.fg |= 268435456, S === 0 && (w.fg &= -268435457), w.updateExtended();
        }
        _processSGR0(S) {
          S.fg = e.DEFAULT_ATTR_DATA.fg, S.bg = e.DEFAULT_ATTR_DATA.bg, S.extended = S.extended.clone(), S.extended.underlineStyle = 0, S.extended.underlineColor &= -67108864, S.updateExtended();
        }
        charAttributes(S) {
          if (S.length === 1 && S.params[0] === 0)
            return this._processSGR0(this._curAttrData), !0;
          const w = S.length;
          let E;
          const D = this._curAttrData;
          for (let H = 0; H < w; H++)
            E = S.params[H], E >= 30 && E <= 37 ? (D.fg &= -50331904, D.fg |= 16777216 | E - 30) : E >= 40 && E <= 47 ? (D.bg &= -50331904, D.bg |= 16777216 | E - 40) : E >= 90 && E <= 97 ? (D.fg &= -50331904, D.fg |= 16777224 | E - 90) : E >= 100 && E <= 107 ? (D.bg &= -50331904, D.bg |= 16777224 | E - 100) : E === 0 ? this._processSGR0(D) : E === 1 ? D.fg |= 134217728 : E === 3 ? D.bg |= 67108864 : E === 4 ? (D.fg |= 268435456, this._processUnderline(S.hasSubParams(H) ? S.getSubParams(H)[0] : 1, D)) : E === 5 ? D.fg |= 536870912 : E === 7 ? D.fg |= 67108864 : E === 8 ? D.fg |= 1073741824 : E === 9 ? D.fg |= 2147483648 : E === 2 ? D.bg |= 134217728 : E === 21 ? this._processUnderline(2, D) : E === 22 ? (D.fg &= -134217729, D.bg &= -134217729) : E === 23 ? D.bg &= -67108865 : E === 24 ? (D.fg &= -268435457, this._processUnderline(0, D)) : E === 25 ? D.fg &= -536870913 : E === 27 ? D.fg &= -67108865 : E === 28 ? D.fg &= -1073741825 : E === 29 ? D.fg &= 2147483647 : E === 39 ? (D.fg &= -67108864, D.fg |= 16777215 & e.DEFAULT_ATTR_DATA.fg) : E === 49 ? (D.bg &= -67108864, D.bg |= 16777215 & e.DEFAULT_ATTR_DATA.bg) : E === 38 || E === 48 || E === 58 ? H += this._extractColor(S, H, D) : E === 53 ? D.bg |= 1073741824 : E === 55 ? D.bg &= -1073741825 : E === 59 ? (D.extended = D.extended.clone(), D.extended.underlineColor = -1, D.updateExtended()) : E === 100 ? (D.fg &= -67108864, D.fg |= 16777215 & e.DEFAULT_ATTR_DATA.fg, D.bg &= -67108864, D.bg |= 16777215 & e.DEFAULT_ATTR_DATA.bg) : this._logService.debug("Unknown SGR attribute: %d.", E);
          return !0;
        }
        deviceStatus(S) {
          switch (S.params[0]) {
            case 5:
              this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);
              break;
            case 6:
              const w = this._activeBuffer.y + 1, E = this._activeBuffer.x + 1;
              this._coreService.triggerDataEvent(`${n.C0.ESC}[${w};${E}R`);
          }
          return !0;
        }
        deviceStatusPrivate(S) {
          if (S.params[0] === 6) {
            const w = this._activeBuffer.y + 1, E = this._activeBuffer.x + 1;
            this._coreService.triggerDataEvent(`${n.C0.ESC}[?${w};${E}R`);
          }
          return !0;
        }
        softReset(S) {
          return this._coreService.isCursorHidden = !1, this._onRequestSyncScrollBar.fire(), this._activeBuffer.scrollTop = 0, this._activeBuffer.scrollBottom = this._bufferService.rows - 1, this._curAttrData = e.DEFAULT_ATTR_DATA.clone(), this._coreService.reset(), this._charsetService.reset(), this._activeBuffer.savedX = 0, this._activeBuffer.savedY = this._activeBuffer.ybase, this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg, this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg, this._activeBuffer.savedCharset = this._charsetService.charset, this._coreService.decPrivateModes.origin = !1, !0;
        }
        setCursorStyle(S) {
          const w = S.params[0] || 1;
          switch (w) {
            case 1:
            case 2:
              this._optionsService.options.cursorStyle = "block";
              break;
            case 3:
            case 4:
              this._optionsService.options.cursorStyle = "underline";
              break;
            case 5:
            case 6:
              this._optionsService.options.cursorStyle = "bar";
          }
          const E = w % 2 == 1;
          return this._optionsService.options.cursorBlink = E, !0;
        }
        setScrollRegion(S) {
          const w = S.params[0] || 1;
          let E;
          return (S.length < 2 || (E = S.params[1]) > this._bufferService.rows || E === 0) && (E = this._bufferService.rows), E > w && (this._activeBuffer.scrollTop = w - 1, this._activeBuffer.scrollBottom = E - 1, this._setCursor(0, 0)), !0;
        }
        windowOptions(S) {
          if (!L(S.params[0], this._optionsService.rawOptions.windowOptions))
            return !0;
          const w = S.length > 1 ? S.params[1] : 0;
          switch (S.params[0]) {
            case 14:
              w !== 2 && this._onRequestWindowsOptionsReport.fire(b.GET_WIN_SIZE_PIXELS);
              break;
            case 16:
              this._onRequestWindowsOptionsReport.fire(b.GET_CELL_SIZE_PIXELS);
              break;
            case 18:
              this._bufferService && this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
              break;
            case 22:
              w !== 0 && w !== 2 || (this._windowTitleStack.push(this._windowTitle), this._windowTitleStack.length > 10 && this._windowTitleStack.shift()), w !== 0 && w !== 1 || (this._iconNameStack.push(this._iconName), this._iconNameStack.length > 10 && this._iconNameStack.shift());
              break;
            case 23:
              w !== 0 && w !== 2 || this._windowTitleStack.length && this.setTitle(this._windowTitleStack.pop()), w !== 0 && w !== 1 || this._iconNameStack.length && this.setIconName(this._iconNameStack.pop());
          }
          return !0;
        }
        saveCursor(S) {
          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, !0;
        }
        restoreCursor(S) {
          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(), !0;
        }
        setTitle(S) {
          return this._windowTitle = S, this._onTitleChange.fire(S), !0;
        }
        setIconName(S) {
          return this._iconName = S, !0;
        }
        setOrReportIndexedColor(S) {
          const w = [], E = S.split(";");
          for (; E.length > 1; ) {
            const D = E.shift(), H = E.shift();
            if (/^\d+$/.exec(D)) {
              const N = parseInt(D);
              if (T(N))
                if (H === "?")
                  w.push({ type: 0, index: N });
                else {
                  const K = (0, d.parseColor)(H);
                  K && w.push({ type: 1, index: N, color: K });
                }
            }
          }
          return w.length && this._onColor.fire(w), !0;
        }
        setHyperlink(S) {
          const w = S.split(";");
          return !(w.length < 2) && (w[1] ? this._createHyperlink(w[0], w[1]) : !w[0] && this._finishHyperlink());
        }
        _createHyperlink(S, w) {
          this._getCurrentLinkId() && this._finishHyperlink();
          const E = S.split(":");
          let D;
          const H = E.findIndex((N) => N.startsWith("id="));
          return H !== -1 && (D = E[H].slice(3) || void 0), this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = this._oscLinkService.registerLink({ id: D, uri: w }), this._curAttrData.updateExtended(), !0;
        }
        _finishHyperlink() {
          return this._curAttrData.extended = this._curAttrData.extended.clone(), this._curAttrData.extended.urlId = 0, this._curAttrData.updateExtended(), !0;
        }
        _setOrReportSpecialColor(S, w) {
          const E = S.split(";");
          for (let D = 0; D < E.length && !(w >= this._specialColors.length); ++D, ++w)
            if (E[D] === "?")
              this._onColor.fire([{ type: 0, index: this._specialColors[w] }]);
            else {
              const H = (0, d.parseColor)(E[D]);
              H && this._onColor.fire([{ type: 1, index: this._specialColors[w], color: H }]);
            }
          return !0;
        }
        setOrReportFgColor(S) {
          return this._setOrReportSpecialColor(S, 0);
        }
        setOrReportBgColor(S) {
          return this._setOrReportSpecialColor(S, 1);
        }
        setOrReportCursorColor(S) {
          return this._setOrReportSpecialColor(S, 2);
        }
        restoreIndexedColor(S) {
          if (!S)
            return this._onColor.fire([{ type: 2 }]), !0;
          const w = [], E = S.split(";");
          for (let D = 0; D < E.length; ++D)
            if (/^\d+$/.exec(E[D])) {
              const H = parseInt(E[D]);
              T(H) && w.push({ type: 2, index: H });
            }
          return w.length && this._onColor.fire(w), !0;
        }
        restoreFgColor(S) {
          return this._onColor.fire([{ type: 2, index: 256 }]), !0;
        }
        restoreBgColor(S) {
          return this._onColor.fire([{ type: 2, index: 257 }]), !0;
        }
        restoreCursorColor(S) {
          return this._onColor.fire([{ type: 2, index: 258 }]), !0;
        }
        nextLine() {
          return this._activeBuffer.x = 0, this.index(), !0;
        }
        keypadApplicationMode() {
          return this._logService.debug("Serial port requested application keypad."), this._coreService.decPrivateModes.applicationKeypad = !0, this._onRequestSyncScrollBar.fire(), !0;
        }
        keypadNumericMode() {
          return this._logService.debug("Switching back to normal keypad."), this._coreService.decPrivateModes.applicationKeypad = !1, this._onRequestSyncScrollBar.fire(), !0;
        }
        selectDefaultCharset() {
          return this._charsetService.setgLevel(0), this._charsetService.setgCharset(0, c.DEFAULT_CHARSET), !0;
        }
        selectCharset(S) {
          return S.length !== 2 ? (this.selectDefaultCharset(), !0) : (S[0] === "/" || this._charsetService.setgCharset(g[S[0]], c.CHARSETS[S[1]] || c.DEFAULT_CHARSET), !0);
        }
        index() {
          return this._restrictCursor(), this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._restrictCursor(), !0;
        }
        tabSet() {
          return this._activeBuffer.tabs[this._activeBuffer.x] = !0, !0;
        }
        reverseIndex() {
          if (this._restrictCursor(), this._activeBuffer.y === this._activeBuffer.scrollTop) {
            const S = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;
            this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, S, 1), this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData())), this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom);
          } else
            this._activeBuffer.y--, this._restrictCursor();
          return !0;
        }
        fullReset() {
          return this._parser.reset(), this._onRequestReset.fire(), !0;
        }
        reset() {
          this._curAttrData = e.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = e.DEFAULT_ATTR_DATA.clone();
        }
        _eraseAttrData() {
          return this._eraseAttrDataInternal.bg &= -67108864, this._eraseAttrDataInternal.bg |= 67108863 & this._curAttrData.bg, this._eraseAttrDataInternal;
        }
        setgLevel(S) {
          return this._charsetService.setgLevel(S), !0;
        }
        screenAlignmentPattern() {
          const S = new r.CellData();
          S.content = 4194304 | "E".charCodeAt(0), S.fg = this._curAttrData.fg, S.bg = this._curAttrData.bg, this._setCursor(0, 0);
          for (let w = 0; w < this._bufferService.rows; ++w) {
            const E = this._activeBuffer.ybase + this._activeBuffer.y + w, D = this._activeBuffer.lines.get(E);
            D && (D.fill(S), D.isWrapped = !1);
          }
          return this._dirtyRowTracker.markAllDirty(), this._setCursor(0, 0), !0;
        }
        requestStatusString(S, w) {
          const E = this._bufferService.buffer, D = this._optionsService.rawOptions;
          return ((H) => (this._coreService.triggerDataEvent(`${n.C0.ESC}${H}${n.C0.ESC}\\`), !0))(S === '"q' ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` : S === '"p' ? 'P1$r61;1"p' : S === "r" ? `P1$r${E.scrollTop + 1};${E.scrollBottom + 1}r` : S === "m" ? "P1$r0m" : S === " q" ? `P1$r${{ block: 2, underline: 4, bar: 6 }[D.cursorStyle] - (D.cursorBlink ? 1 : 0)} q` : "P0$r");
        }
        markRangeDirty(S, w) {
          this._dirtyRowTracker.markRangeDirty(S, w);
        }
      }
      s.InputHandler = A;
      let B = class {
        constructor(M) {
          this._bufferService = M, this.clearRange();
        }
        clearRange() {
          this.start = this._bufferService.buffer.y, this.end = this._bufferService.buffer.y;
        }
        markDirty(M) {
          M < this.start ? this.start = M : M > this.end && (this.end = M);
        }
        markRangeDirty(M, S) {
          M > S && (k = M, M = S, S = k), M < this.start && (this.start = M), S > this.end && (this.end = S);
        }
        markAllDirty() {
          this.markRangeDirty(0, this._bufferService.rows - 1);
        }
      };
      function T(M) {
        return 0 <= M && M < 256;
      }
      B = a([f(0, _.IBufferService)], B);
    }, 844: (x, s) => {
      function o(a) {
        for (const f of a)
          f.dispose();
        a.length = 0;
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.getDisposeArrayDisposable = s.disposeArray = s.toDisposable = s.MutableDisposable = s.Disposable = void 0, s.Disposable = class {
        constructor() {
          this._disposables = [], this._isDisposed = !1;
        }
        dispose() {
          this._isDisposed = !0;
          for (const a of this._disposables)
            a.dispose();
          this._disposables.length = 0;
        }
        register(a) {
          return this._disposables.push(a), a;
        }
        unregister(a) {
          const f = this._disposables.indexOf(a);
          f !== -1 && this._disposables.splice(f, 1);
        }
      }, s.MutableDisposable = class {
        constructor() {
          this._isDisposed = !1;
        }
        get value() {
          return this._isDisposed ? void 0 : this._value;
        }
        set value(a) {
          var f;
          this._isDisposed || a === this._value || ((f = this._value) === null || f === void 0 || f.dispose(), this._value = a);
        }
        clear() {
          this.value = void 0;
        }
        dispose() {
          var a;
          this._isDisposed = !0, (a = this._value) === null || a === void 0 || a.dispose(), this._value = void 0;
        }
      }, s.toDisposable = function(a) {
        return { dispose: a };
      }, s.disposeArray = o, s.getDisposeArrayDisposable = function(a) {
        return { dispose: () => o(a) };
      };
    }, 1505: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.FourKeyMap = s.TwoKeyMap = void 0;
      class o {
        constructor() {
          this._data = {};
        }
        set(f, n, c) {
          this._data[f] || (this._data[f] = {}), this._data[f][n] = c;
        }
        get(f, n) {
          return this._data[f] ? this._data[f][n] : void 0;
        }
        clear() {
          this._data = {};
        }
      }
      s.TwoKeyMap = o, s.FourKeyMap = class {
        constructor() {
          this._data = new o();
        }
        set(a, f, n, c, u) {
          this._data.get(a, f) || this._data.set(a, f, new o()), this._data.get(a, f).set(n, c, u);
        }
        get(a, f, n, c) {
          var u;
          return (u = this._data.get(a, f)) === null || u === void 0 ? void 0 : u.get(n, c);
        }
        clear() {
          this._data.clear();
        }
      };
    }, 6114: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.isChromeOS = s.isLinux = s.isWindows = s.isIphone = s.isIpad = s.isMac = s.getSafariVersion = s.isSafari = s.isLegacyEdge = s.isFirefox = s.isNode = void 0, s.isNode = typeof navigator == "undefined";
      const o = s.isNode ? "node" : navigator.userAgent, a = s.isNode ? "node" : navigator.platform;
      s.isFirefox = o.includes("Firefox"), s.isLegacyEdge = o.includes("Edge"), s.isSafari = /^((?!chrome|android).)*safari/i.test(o), s.getSafariVersion = function() {
        if (!s.isSafari)
          return 0;
        const f = o.match(/Version\/(\d+)/);
        return f === null || f.length < 2 ? 0 : parseInt(f[1]);
      }, s.isMac = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"].includes(a), s.isIpad = a === "iPad", s.isIphone = a === "iPhone", s.isWindows = ["Windows", "Win16", "Win32", "WinCE"].includes(a), s.isLinux = a.indexOf("Linux") >= 0, s.isChromeOS = /\bCrOS\b/.test(o);
    }, 6106: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.SortedList = void 0;
      let o = 0;
      s.SortedList = class {
        constructor(a) {
          this._getKey = a, this._array = [];
        }
        clear() {
          this._array.length = 0;
        }
        insert(a) {
          this._array.length !== 0 ? (o = this._search(this._getKey(a)), this._array.splice(o, 0, a)) : this._array.push(a);
        }
        delete(a) {
          if (this._array.length === 0)
            return !1;
          const f = this._getKey(a);
          if (f === void 0 || (o = this._search(f), o === -1) || this._getKey(this._array[o]) !== f)
            return !1;
          do
            if (this._array[o] === a)
              return this._array.splice(o, 1), !0;
          while (++o < this._array.length && this._getKey(this._array[o]) === f);
          return !1;
        }
        *getKeyIterator(a) {
          if (this._array.length !== 0 && (o = this._search(a), !(o < 0 || o >= this._array.length) && this._getKey(this._array[o]) === a))
            do
              yield this._array[o];
            while (++o < this._array.length && this._getKey(this._array[o]) === a);
        }
        forEachByKey(a, f) {
          if (this._array.length !== 0 && (o = this._search(a), !(o < 0 || o >= this._array.length) && this._getKey(this._array[o]) === a))
            do
              f(this._array[o]);
            while (++o < this._array.length && this._getKey(this._array[o]) === a);
        }
        values() {
          return [...this._array].values();
        }
        _search(a) {
          let f = 0, n = this._array.length - 1;
          for (; n >= f; ) {
            let c = f + n >> 1;
            const u = this._getKey(this._array[c]);
            if (u > a)
              n = c - 1;
            else {
              if (!(u < a)) {
                for (; c > 0 && this._getKey(this._array[c - 1]) === a; )
                  c--;
                return c;
              }
              f = c + 1;
            }
          }
          return f;
        }
      };
    }, 7226: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DebouncedIdleTask = s.IdleTaskQueue = s.PriorityTaskQueue = void 0;
      const a = o(6114);
      class f {
        constructor() {
          this._tasks = [], this._i = 0;
        }
        enqueue(u) {
          this._tasks.push(u), this._start();
        }
        flush() {
          for (; this._i < this._tasks.length; )
            this._tasks[this._i]() || this._i++;
          this.clear();
        }
        clear() {
          this._idleCallback && (this._cancelCallback(this._idleCallback), this._idleCallback = void 0), this._i = 0, this._tasks.length = 0;
        }
        _start() {
          this._idleCallback || (this._idleCallback = this._requestCallback(this._process.bind(this)));
        }
        _process(u) {
          this._idleCallback = void 0;
          let v = 0, l = 0, e = u.timeRemaining(), i = 0;
          for (; this._i < this._tasks.length; ) {
            if (v = Date.now(), this._tasks[this._i]() || this._i++, v = Math.max(1, Date.now() - v), l = Math.max(v, l), i = u.timeRemaining(), 1.5 * l > i)
              return e - v < -20 && console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e - v))}ms`), void this._start();
            e = i;
          }
          this.clear();
        }
      }
      class n extends f {
        _requestCallback(u) {
          return setTimeout(() => u(this._createDeadline(16)));
        }
        _cancelCallback(u) {
          clearTimeout(u);
        }
        _createDeadline(u) {
          const v = Date.now() + u;
          return { timeRemaining: () => Math.max(0, v - Date.now()) };
        }
      }
      s.PriorityTaskQueue = n, s.IdleTaskQueue = !a.isNode && "requestIdleCallback" in window ? class extends f {
        _requestCallback(c) {
          return requestIdleCallback(c);
        }
        _cancelCallback(c) {
          cancelIdleCallback(c);
        }
      } : n, s.DebouncedIdleTask = class {
        constructor() {
          this._queue = new s.IdleTaskQueue();
        }
        set(c) {
          this._queue.clear(), this._queue.enqueue(c);
        }
        flush() {
          this._queue.flush();
        }
      };
    }, 9282: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.updateWindowsModeWrappedState = void 0;
      const a = o(643);
      s.updateWindowsModeWrappedState = function(f) {
        const n = f.buffer.lines.get(f.buffer.ybase + f.buffer.y - 1), c = n == null ? void 0 : n.get(f.cols - 1), u = f.buffer.lines.get(f.buffer.ybase + f.buffer.y);
        u && c && (u.isWrapped = c[a.CHAR_DATA_CODE_INDEX] !== a.NULL_CELL_CODE && c[a.CHAR_DATA_CODE_INDEX] !== a.WHITESPACE_CELL_CODE);
      };
    }, 3734: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ExtendedAttrs = s.AttributeData = void 0;
      class o {
        constructor() {
          this.fg = 0, this.bg = 0, this.extended = new a();
        }
        static toColorRGB(n) {
          return [n >>> 16 & 255, n >>> 8 & 255, 255 & n];
        }
        static fromColorRGB(n) {
          return (255 & n[0]) << 16 | (255 & n[1]) << 8 | 255 & n[2];
        }
        clone() {
          const n = new o();
          return n.fg = this.fg, n.bg = this.bg, n.extended = this.extended.clone(), n;
        }
        isInverse() {
          return 67108864 & this.fg;
        }
        isBold() {
          return 134217728 & this.fg;
        }
        isUnderline() {
          return this.hasExtendedAttrs() && this.extended.underlineStyle !== 0 ? 1 : 268435456 & this.fg;
        }
        isBlink() {
          return 536870912 & this.fg;
        }
        isInvisible() {
          return 1073741824 & this.fg;
        }
        isItalic() {
          return 67108864 & this.bg;
        }
        isDim() {
          return 134217728 & this.bg;
        }
        isStrikethrough() {
          return 2147483648 & this.fg;
        }
        isProtected() {
          return 536870912 & this.bg;
        }
        isOverline() {
          return 1073741824 & this.bg;
        }
        getFgColorMode() {
          return 50331648 & this.fg;
        }
        getBgColorMode() {
          return 50331648 & this.bg;
        }
        isFgRGB() {
          return (50331648 & this.fg) == 50331648;
        }
        isBgRGB() {
          return (50331648 & this.bg) == 50331648;
        }
        isFgPalette() {
          return (50331648 & this.fg) == 16777216 || (50331648 & this.fg) == 33554432;
        }
        isBgPalette() {
          return (50331648 & this.bg) == 16777216 || (50331648 & this.bg) == 33554432;
        }
        isFgDefault() {
          return (50331648 & this.fg) == 0;
        }
        isBgDefault() {
          return (50331648 & this.bg) == 0;
        }
        isAttributeDefault() {
          return this.fg === 0 && this.bg === 0;
        }
        getFgColor() {
          switch (50331648 & this.fg) {
            case 16777216:
            case 33554432:
              return 255 & this.fg;
            case 50331648:
              return 16777215 & this.fg;
            default:
              return -1;
          }
        }
        getBgColor() {
          switch (50331648 & this.bg) {
            case 16777216:
            case 33554432:
              return 255 & this.bg;
            case 50331648:
              return 16777215 & this.bg;
            default:
              return -1;
          }
        }
        hasExtendedAttrs() {
          return 268435456 & this.bg;
        }
        updateExtended() {
          this.extended.isEmpty() ? this.bg &= -268435457 : this.bg |= 268435456;
        }
        getUnderlineColor() {
          if (268435456 & this.bg && ~this.extended.underlineColor)
            switch (50331648 & this.extended.underlineColor) {
              case 16777216:
              case 33554432:
                return 255 & this.extended.underlineColor;
              case 50331648:
                return 16777215 & this.extended.underlineColor;
              default:
                return this.getFgColor();
            }
          return this.getFgColor();
        }
        getUnderlineColorMode() {
          return 268435456 & this.bg && ~this.extended.underlineColor ? 50331648 & this.extended.underlineColor : this.getFgColorMode();
        }
        isUnderlineColorRGB() {
          return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 50331648 : this.isFgRGB();
        }
        isUnderlineColorPalette() {
          return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 16777216 || (50331648 & this.extended.underlineColor) == 33554432 : this.isFgPalette();
        }
        isUnderlineColorDefault() {
          return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 0 : this.isFgDefault();
        }
        getUnderlineStyle() {
          return 268435456 & this.fg ? 268435456 & this.bg ? this.extended.underlineStyle : 1 : 0;
        }
      }
      s.AttributeData = o;
      class a {
        get ext() {
          return this._urlId ? -469762049 & this._ext | this.underlineStyle << 26 : this._ext;
        }
        set ext(n) {
          this._ext = n;
        }
        get underlineStyle() {
          return this._urlId ? 5 : (469762048 & this._ext) >> 26;
        }
        set underlineStyle(n) {
          this._ext &= -469762049, this._ext |= n << 26 & 469762048;
        }
        get underlineColor() {
          return 67108863 & this._ext;
        }
        set underlineColor(n) {
          this._ext &= -67108864, this._ext |= 67108863 & n;
        }
        get urlId() {
          return this._urlId;
        }
        set urlId(n) {
          this._urlId = n;
        }
        constructor(n = 0, c = 0) {
          this._ext = 0, this._urlId = 0, this._ext = n, this._urlId = c;
        }
        clone() {
          return new a(this._ext, this._urlId);
        }
        isEmpty() {
          return this.underlineStyle === 0 && this._urlId === 0;
        }
      }
      s.ExtendedAttrs = a;
    }, 9092: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Buffer = s.MAX_BUFFER_SIZE = void 0;
      const a = o(6349), f = o(7226), n = o(3734), c = o(8437), u = o(4634), v = o(511), l = o(643), e = o(4863), i = o(7116);
      s.MAX_BUFFER_SIZE = 4294967295, s.Buffer = class {
        constructor(t, r, h) {
          this._hasScrollback = t, this._optionsService = r, this._bufferService = h, this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.tabs = {}, this.savedY = 0, this.savedX = 0, this.savedCurAttrData = c.DEFAULT_ATTR_DATA.clone(), this.savedCharset = i.DEFAULT_CHARSET, this.markers = [], this._nullCell = v.CellData.fromCharData([0, l.NULL_CELL_CHAR, l.NULL_CELL_WIDTH, l.NULL_CELL_CODE]), this._whitespaceCell = v.CellData.fromCharData([0, l.WHITESPACE_CELL_CHAR, l.WHITESPACE_CELL_WIDTH, l.WHITESPACE_CELL_CODE]), this._isClearing = !1, this._memoryCleanupQueue = new f.IdleTaskQueue(), this._memoryCleanupPosition = 0, this._cols = this._bufferService.cols, this._rows = this._bufferService.rows, this.lines = new a.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops();
        }
        getNullCell(t) {
          return t ? (this._nullCell.fg = t.fg, this._nullCell.bg = t.bg, this._nullCell.extended = t.extended) : (this._nullCell.fg = 0, this._nullCell.bg = 0, this._nullCell.extended = new n.ExtendedAttrs()), this._nullCell;
        }
        getWhitespaceCell(t) {
          return t ? (this._whitespaceCell.fg = t.fg, this._whitespaceCell.bg = t.bg, this._whitespaceCell.extended = t.extended) : (this._whitespaceCell.fg = 0, this._whitespaceCell.bg = 0, this._whitespaceCell.extended = new n.ExtendedAttrs()), this._whitespaceCell;
        }
        getBlankLine(t, r) {
          return new c.BufferLine(this._bufferService.cols, this.getNullCell(t), r);
        }
        get hasScrollback() {
          return this._hasScrollback && this.lines.maxLength > this._rows;
        }
        get isCursorInViewport() {
          const t = this.ybase + this.y - this.ydisp;
          return t >= 0 && t < this._rows;
        }
        _getCorrectBufferLength(t) {
          if (!this._hasScrollback)
            return t;
          const r = t + this._optionsService.rawOptions.scrollback;
          return r > s.MAX_BUFFER_SIZE ? s.MAX_BUFFER_SIZE : r;
        }
        fillViewportRows(t) {
          if (this.lines.length === 0) {
            t === void 0 && (t = c.DEFAULT_ATTR_DATA);
            let r = this._rows;
            for (; r--; )
              this.lines.push(this.getBlankLine(t));
          }
        }
        clear() {
          this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.lines = new a.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops();
        }
        resize(t, r) {
          const h = this.getNullCell(c.DEFAULT_ATTR_DATA);
          let _ = 0;
          const p = this._getCorrectBufferLength(r);
          if (p > this.lines.maxLength && (this.lines.maxLength = p), this.lines.length > 0) {
            if (this._cols < t)
              for (let d = 0; d < this.lines.length; d++)
                _ += +this.lines.get(d).resize(t, h);
            let m = 0;
            if (this._rows < r)
              for (let d = this._rows; d < r; d++)
                this.lines.length < r + this.ybase && (this._optionsService.rawOptions.windowsMode || this._optionsService.rawOptions.windowsPty.backend !== void 0 || this._optionsService.rawOptions.windowsPty.buildNumber !== void 0 ? this.lines.push(new c.BufferLine(t, h)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + m + 1 ? (this.ybase--, m++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new c.BufferLine(t, h)));
            else
              for (let d = this._rows; d > r; d--)
                this.lines.length > r + this.ybase && (this.lines.length > this.ybase + this.y + 1 ? this.lines.pop() : (this.ybase++, this.ydisp++));
            if (p < this.lines.maxLength) {
              const d = this.lines.length - p;
              d > 0 && (this.lines.trimStart(d), this.ybase = Math.max(this.ybase - d, 0), this.ydisp = Math.max(this.ydisp - d, 0), this.savedY = Math.max(this.savedY - d, 0)), this.lines.maxLength = p;
            }
            this.x = Math.min(this.x, t - 1), this.y = Math.min(this.y, r - 1), m && (this.y += m), this.savedX = Math.min(this.savedX, t - 1), this.scrollTop = 0;
          }
          if (this.scrollBottom = r - 1, this._isReflowEnabled && (this._reflow(t, r), this._cols > t))
            for (let m = 0; m < this.lines.length; m++)
              _ += +this.lines.get(m).resize(t, h);
          this._cols = t, this._rows = r, this._memoryCleanupQueue.clear(), _ > 0.1 * this.lines.length && (this._memoryCleanupPosition = 0, this._memoryCleanupQueue.enqueue(() => this._batchedMemoryCleanup()));
        }
        _batchedMemoryCleanup() {
          let t = !0;
          this._memoryCleanupPosition >= this.lines.length && (this._memoryCleanupPosition = 0, t = !1);
          let r = 0;
          for (; this._memoryCleanupPosition < this.lines.length; )
            if (r += this.lines.get(this._memoryCleanupPosition++).cleanupMemory(), r > 100)
              return !0;
          return t;
        }
        get _isReflowEnabled() {
          const t = this._optionsService.rawOptions.windowsPty;
          return t && t.buildNumber ? this._hasScrollback && t.backend === "conpty" && t.buildNumber >= 21376 : this._hasScrollback && !this._optionsService.rawOptions.windowsMode;
        }
        _reflow(t, r) {
          this._cols !== t && (t > this._cols ? this._reflowLarger(t, r) : this._reflowSmaller(t, r));
        }
        _reflowLarger(t, r) {
          const h = (0, u.reflowLargerGetLinesToRemove)(this.lines, this._cols, t, this.ybase + this.y, this.getNullCell(c.DEFAULT_ATTR_DATA));
          if (h.length > 0) {
            const _ = (0, u.reflowLargerCreateNewLayout)(this.lines, h);
            (0, u.reflowLargerApplyNewLayout)(this.lines, _.layout), this._reflowLargerAdjustViewport(t, r, _.countRemoved);
          }
        }
        _reflowLargerAdjustViewport(t, r, h) {
          const _ = this.getNullCell(c.DEFAULT_ATTR_DATA);
          let p = h;
          for (; p-- > 0; )
            this.ybase === 0 ? (this.y > 0 && this.y--, this.lines.length < r && this.lines.push(new c.BufferLine(t, _))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--);
          this.savedY = Math.max(this.savedY - h, 0);
        }
        _reflowSmaller(t, r) {
          const h = this.getNullCell(c.DEFAULT_ATTR_DATA), _ = [];
          let p = 0;
          for (let m = this.lines.length - 1; m >= 0; m--) {
            let d = this.lines.get(m);
            if (!d || !d.isWrapped && d.getTrimmedLength() <= t)
              continue;
            const g = [d];
            for (; d.isWrapped && m > 0; )
              d = this.lines.get(--m), g.unshift(d);
            const y = this.ybase + this.y;
            if (y >= m && y < m + g.length)
              continue;
            const L = g[g.length - 1].getTrimmedLength(), b = (0, u.reflowSmallerGetNewLineLengths)(g, this._cols, t), k = b.length - g.length;
            let A;
            A = this.ybase === 0 && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + k) : Math.max(0, this.lines.length - this.lines.maxLength + k);
            const B = [];
            for (let D = 0; D < k; D++) {
              const H = this.getBlankLine(c.DEFAULT_ATTR_DATA, !0);
              B.push(H);
            }
            B.length > 0 && (_.push({ start: m + g.length + p, newLines: B }), p += B.length), g.push(...B);
            let T = b.length - 1, M = b[T];
            M === 0 && (T--, M = b[T]);
            let S = g.length - k - 1, w = L;
            for (; S >= 0; ) {
              const D = Math.min(w, M);
              if (g[T] === void 0)
                break;
              if (g[T].copyCellsFrom(g[S], w - D, M - D, D, !0), M -= D, M === 0 && (T--, M = b[T]), w -= D, w === 0) {
                S--;
                const H = Math.max(S, 0);
                w = (0, u.getWrappedLineTrimmedLength)(g, H, this._cols);
              }
            }
            for (let D = 0; D < g.length; D++)
              b[D] < t && g[D].setCell(b[D], h);
            let E = k - A;
            for (; E-- > 0; )
              this.ybase === 0 ? this.y < r - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + p) - r && (this.ybase === this.ydisp && this.ydisp++, this.ybase++);
            this.savedY = Math.min(this.savedY + k, this.ybase + r - 1);
          }
          if (_.length > 0) {
            const m = [], d = [];
            for (let T = 0; T < this.lines.length; T++)
              d.push(this.lines.get(T));
            const g = this.lines.length;
            let y = g - 1, L = 0, b = _[L];
            this.lines.length = Math.min(this.lines.maxLength, this.lines.length + p);
            let k = 0;
            for (let T = Math.min(this.lines.maxLength - 1, g + p - 1); T >= 0; T--)
              if (b && b.start > y + k) {
                for (let M = b.newLines.length - 1; M >= 0; M--)
                  this.lines.set(T--, b.newLines[M]);
                T++, m.push({ index: y + 1, amount: b.newLines.length }), k += b.newLines.length, b = _[++L];
              } else
                this.lines.set(T, d[y--]);
            let A = 0;
            for (let T = m.length - 1; T >= 0; T--)
              m[T].index += A, this.lines.onInsertEmitter.fire(m[T]), A += m[T].amount;
            const B = Math.max(0, g + p - this.lines.maxLength);
            B > 0 && this.lines.onTrimEmitter.fire(B);
          }
        }
        translateBufferLineToString(t, r, h = 0, _) {
          const p = this.lines.get(t);
          return p ? p.translateToString(r, h, _) : "";
        }
        getWrappedRangeForLine(t) {
          let r = t, h = t;
          for (; r > 0 && this.lines.get(r).isWrapped; )
            r--;
          for (; h + 1 < this.lines.length && this.lines.get(h + 1).isWrapped; )
            h++;
          return { first: r, last: h };
        }
        setupTabStops(t) {
          for (t != null ? this.tabs[t] || (t = this.prevStop(t)) : (this.tabs = {}, t = 0); t < this._cols; t += this._optionsService.rawOptions.tabStopWidth)
            this.tabs[t] = !0;
        }
        prevStop(t) {
          for (t == null && (t = this.x); !this.tabs[--t] && t > 0; )
            ;
          return t >= this._cols ? this._cols - 1 : t < 0 ? 0 : t;
        }
        nextStop(t) {
          for (t == null && (t = this.x); !this.tabs[++t] && t < this._cols; )
            ;
          return t >= this._cols ? this._cols - 1 : t < 0 ? 0 : t;
        }
        clearMarkers(t) {
          this._isClearing = !0;
          for (let r = 0; r < this.markers.length; r++)
            this.markers[r].line === t && (this.markers[r].dispose(), this.markers.splice(r--, 1));
          this._isClearing = !1;
        }
        clearAllMarkers() {
          this._isClearing = !0;
          for (let t = 0; t < this.markers.length; t++)
            this.markers[t].dispose(), this.markers.splice(t--, 1);
          this._isClearing = !1;
        }
        addMarker(t) {
          const r = new e.Marker(t);
          return this.markers.push(r), r.register(this.lines.onTrim((h) => {
            r.line -= h, r.line < 0 && r.dispose();
          })), r.register(this.lines.onInsert((h) => {
            r.line >= h.index && (r.line += h.amount);
          })), r.register(this.lines.onDelete((h) => {
            r.line >= h.index && r.line < h.index + h.amount && r.dispose(), r.line > h.index && (r.line -= h.amount);
          })), r.register(r.onDispose(() => this._removeMarker(r))), r;
        }
        _removeMarker(t) {
          this._isClearing || this.markers.splice(this.markers.indexOf(t), 1);
        }
      };
    }, 8437: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferLine = s.DEFAULT_ATTR_DATA = void 0;
      const a = o(3734), f = o(511), n = o(643), c = o(482);
      s.DEFAULT_ATTR_DATA = Object.freeze(new a.AttributeData());
      let u = 0;
      class v {
        constructor(e, i, t = !1) {
          this.isWrapped = t, this._combined = {}, this._extendedAttrs = {}, this._data = new Uint32Array(3 * e);
          const r = i || f.CellData.fromCharData([0, n.NULL_CELL_CHAR, n.NULL_CELL_WIDTH, n.NULL_CELL_CODE]);
          for (let h = 0; h < e; ++h)
            this.setCell(h, r);
          this.length = e;
        }
        get(e) {
          const i = this._data[3 * e + 0], t = 2097151 & i;
          return [this._data[3 * e + 1], 2097152 & i ? this._combined[e] : t ? (0, c.stringFromCodePoint)(t) : "", i >> 22, 2097152 & i ? this._combined[e].charCodeAt(this._combined[e].length - 1) : t];
        }
        set(e, i) {
          this._data[3 * e + 1] = i[n.CHAR_DATA_ATTR_INDEX], i[n.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e] = i[1], this._data[3 * e + 0] = 2097152 | e | i[n.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e + 0] = i[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | i[n.CHAR_DATA_WIDTH_INDEX] << 22;
        }
        getWidth(e) {
          return this._data[3 * e + 0] >> 22;
        }
        hasWidth(e) {
          return 12582912 & this._data[3 * e + 0];
        }
        getFg(e) {
          return this._data[3 * e + 1];
        }
        getBg(e) {
          return this._data[3 * e + 2];
        }
        hasContent(e) {
          return 4194303 & this._data[3 * e + 0];
        }
        getCodePoint(e) {
          const i = this._data[3 * e + 0];
          return 2097152 & i ? this._combined[e].charCodeAt(this._combined[e].length - 1) : 2097151 & i;
        }
        isCombined(e) {
          return 2097152 & this._data[3 * e + 0];
        }
        getString(e) {
          const i = this._data[3 * e + 0];
          return 2097152 & i ? this._combined[e] : 2097151 & i ? (0, c.stringFromCodePoint)(2097151 & i) : "";
        }
        isProtected(e) {
          return 536870912 & this._data[3 * e + 2];
        }
        loadCell(e, i) {
          return u = 3 * e, i.content = this._data[u + 0], i.fg = this._data[u + 1], i.bg = this._data[u + 2], 2097152 & i.content && (i.combinedData = this._combined[e]), 268435456 & i.bg && (i.extended = this._extendedAttrs[e]), i;
        }
        setCell(e, i) {
          2097152 & i.content && (this._combined[e] = i.combinedData), 268435456 & i.bg && (this._extendedAttrs[e] = i.extended), this._data[3 * e + 0] = i.content, this._data[3 * e + 1] = i.fg, this._data[3 * e + 2] = i.bg;
        }
        setCellFromCodePoint(e, i, t, r, h, _) {
          268435456 & h && (this._extendedAttrs[e] = _), this._data[3 * e + 0] = i | t << 22, this._data[3 * e + 1] = r, this._data[3 * e + 2] = h;
        }
        addCodepointToCell(e, i) {
          let t = this._data[3 * e + 0];
          2097152 & t ? this._combined[e] += (0, c.stringFromCodePoint)(i) : (2097151 & t ? (this._combined[e] = (0, c.stringFromCodePoint)(2097151 & t) + (0, c.stringFromCodePoint)(i), t &= -2097152, t |= 2097152) : t = i | 4194304, this._data[3 * e + 0] = t);
        }
        insertCells(e, i, t, r) {
          if ((e %= this.length) && this.getWidth(e - 1) === 2 && this.setCellFromCodePoint(e - 1, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()), i < this.length - e) {
            const h = new f.CellData();
            for (let _ = this.length - e - i - 1; _ >= 0; --_)
              this.setCell(e + i + _, this.loadCell(e + _, h));
            for (let _ = 0; _ < i; ++_)
              this.setCell(e + _, t);
          } else
            for (let h = e; h < this.length; ++h)
              this.setCell(h, t);
          this.getWidth(this.length - 1) === 2 && this.setCellFromCodePoint(this.length - 1, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs());
        }
        deleteCells(e, i, t, r) {
          if (e %= this.length, i < this.length - e) {
            const h = new f.CellData();
            for (let _ = 0; _ < this.length - e - i; ++_)
              this.setCell(e + _, this.loadCell(e + i + _, h));
            for (let _ = this.length - i; _ < this.length; ++_)
              this.setCell(_, t);
          } else
            for (let h = e; h < this.length; ++h)
              this.setCell(h, t);
          e && this.getWidth(e - 1) === 2 && this.setCellFromCodePoint(e - 1, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()), this.getWidth(e) !== 0 || this.hasContent(e) || this.setCellFromCodePoint(e, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs());
        }
        replaceCells(e, i, t, r, h = !1) {
          if (h)
            for (e && this.getWidth(e - 1) === 2 && !this.isProtected(e - 1) && this.setCellFromCodePoint(e - 1, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()), i < this.length && this.getWidth(i - 1) === 2 && !this.isProtected(i) && this.setCellFromCodePoint(i, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()); e < i && e < this.length; )
              this.isProtected(e) || this.setCell(e, t), e++;
          else
            for (e && this.getWidth(e - 1) === 2 && this.setCellFromCodePoint(e - 1, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()), i < this.length && this.getWidth(i - 1) === 2 && this.setCellFromCodePoint(i, 0, 1, (r == null ? void 0 : r.fg) || 0, (r == null ? void 0 : r.bg) || 0, (r == null ? void 0 : r.extended) || new a.ExtendedAttrs()); e < i && e < this.length; )
              this.setCell(e++, t);
        }
        resize(e, i) {
          if (e === this.length)
            return 4 * this._data.length * 2 < this._data.buffer.byteLength;
          const t = 3 * e;
          if (e > this.length) {
            if (this._data.buffer.byteLength >= 4 * t)
              this._data = new Uint32Array(this._data.buffer, 0, t);
            else {
              const r = new Uint32Array(t);
              r.set(this._data), this._data = r;
            }
            for (let r = this.length; r < e; ++r)
              this.setCell(r, i);
          } else {
            this._data = this._data.subarray(0, t);
            const r = Object.keys(this._combined);
            for (let _ = 0; _ < r.length; _++) {
              const p = parseInt(r[_], 10);
              p >= e && delete this._combined[p];
            }
            const h = Object.keys(this._extendedAttrs);
            for (let _ = 0; _ < h.length; _++) {
              const p = parseInt(h[_], 10);
              p >= e && delete this._extendedAttrs[p];
            }
          }
          return this.length = e, 4 * t * 2 < this._data.buffer.byteLength;
        }
        cleanupMemory() {
          if (4 * this._data.length * 2 < this._data.buffer.byteLength) {
            const e = new Uint32Array(this._data.length);
            return e.set(this._data), this._data = e, 1;
          }
          return 0;
        }
        fill(e, i = !1) {
          if (i)
            for (let t = 0; t < this.length; ++t)
              this.isProtected(t) || this.setCell(t, e);
          else {
            this._combined = {}, this._extendedAttrs = {};
            for (let t = 0; t < this.length; ++t)
              this.setCell(t, e);
          }
        }
        copyFrom(e) {
          this.length !== e.length ? this._data = new Uint32Array(e._data) : this._data.set(e._data), this.length = e.length, this._combined = {};
          for (const i in e._combined)
            this._combined[i] = e._combined[i];
          this._extendedAttrs = {};
          for (const i in e._extendedAttrs)
            this._extendedAttrs[i] = e._extendedAttrs[i];
          this.isWrapped = e.isWrapped;
        }
        clone() {
          const e = new v(0);
          e._data = new Uint32Array(this._data), e.length = this.length;
          for (const i in this._combined)
            e._combined[i] = this._combined[i];
          for (const i in this._extendedAttrs)
            e._extendedAttrs[i] = this._extendedAttrs[i];
          return e.isWrapped = this.isWrapped, e;
        }
        getTrimmedLength() {
          for (let e = this.length - 1; e >= 0; --e)
            if (4194303 & this._data[3 * e + 0])
              return e + (this._data[3 * e + 0] >> 22);
          return 0;
        }
        getNoBgTrimmedLength() {
          for (let e = this.length - 1; e >= 0; --e)
            if (4194303 & this._data[3 * e + 0] || 50331648 & this._data[3 * e + 2])
              return e + (this._data[3 * e + 0] >> 22);
          return 0;
        }
        copyCellsFrom(e, i, t, r, h) {
          const _ = e._data;
          if (h)
            for (let m = r - 1; m >= 0; m--) {
              for (let d = 0; d < 3; d++)
                this._data[3 * (t + m) + d] = _[3 * (i + m) + d];
              268435456 & _[3 * (i + m) + 2] && (this._extendedAttrs[t + m] = e._extendedAttrs[i + m]);
            }
          else
            for (let m = 0; m < r; m++) {
              for (let d = 0; d < 3; d++)
                this._data[3 * (t + m) + d] = _[3 * (i + m) + d];
              268435456 & _[3 * (i + m) + 2] && (this._extendedAttrs[t + m] = e._extendedAttrs[i + m]);
            }
          const p = Object.keys(e._combined);
          for (let m = 0; m < p.length; m++) {
            const d = parseInt(p[m], 10);
            d >= i && (this._combined[d - i + t] = e._combined[d]);
          }
        }
        translateToString(e = !1, i = 0, t = this.length) {
          e && (t = Math.min(t, this.getTrimmedLength()));
          let r = "";
          for (; i < t; ) {
            const h = this._data[3 * i + 0], _ = 2097151 & h;
            r += 2097152 & h ? this._combined[i] : _ ? (0, c.stringFromCodePoint)(_) : n.WHITESPACE_CELL_CHAR, i += h >> 22 || 1;
          }
          return r;
        }
      }
      s.BufferLine = v;
    }, 4841: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.getRangeLength = void 0, s.getRangeLength = function(o, a) {
        if (o.start.y > o.end.y)
          throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);
        return a * (o.end.y - o.start.y) + (o.end.x - o.start.x + 1);
      };
    }, 4634: (x, s) => {
      function o(a, f, n) {
        if (f === a.length - 1)
          return a[f].getTrimmedLength();
        const c = !a[f].hasContent(n - 1) && a[f].getWidth(n - 1) === 1, u = a[f + 1].getWidth(0) === 2;
        return c && u ? n - 1 : n;
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.getWrappedLineTrimmedLength = s.reflowSmallerGetNewLineLengths = s.reflowLargerApplyNewLayout = s.reflowLargerCreateNewLayout = s.reflowLargerGetLinesToRemove = void 0, s.reflowLargerGetLinesToRemove = function(a, f, n, c, u) {
        const v = [];
        for (let l = 0; l < a.length - 1; l++) {
          let e = l, i = a.get(++e);
          if (!i.isWrapped)
            continue;
          const t = [a.get(l)];
          for (; e < a.length && i.isWrapped; )
            t.push(i), i = a.get(++e);
          if (c >= l && c < e) {
            l += t.length - 1;
            continue;
          }
          let r = 0, h = o(t, r, f), _ = 1, p = 0;
          for (; _ < t.length; ) {
            const d = o(t, _, f), g = d - p, y = n - h, L = Math.min(g, y);
            t[r].copyCellsFrom(t[_], p, h, L, !1), h += L, h === n && (r++, h = 0), p += L, p === d && (_++, p = 0), h === 0 && r !== 0 && t[r - 1].getWidth(n - 1) === 2 && (t[r].copyCellsFrom(t[r - 1], n - 1, h++, 1, !1), t[r - 1].setCell(n - 1, u));
          }
          t[r].replaceCells(h, n, u);
          let m = 0;
          for (let d = t.length - 1; d > 0 && (d > r || t[d].getTrimmedLength() === 0); d--)
            m++;
          m > 0 && (v.push(l + t.length - m), v.push(m)), l += t.length - 1;
        }
        return v;
      }, s.reflowLargerCreateNewLayout = function(a, f) {
        const n = [];
        let c = 0, u = f[c], v = 0;
        for (let l = 0; l < a.length; l++)
          if (u === l) {
            const e = f[++c];
            a.onDeleteEmitter.fire({ index: l - v, amount: e }), l += e - 1, v += e, u = f[++c];
          } else
            n.push(l);
        return { layout: n, countRemoved: v };
      }, s.reflowLargerApplyNewLayout = function(a, f) {
        const n = [];
        for (let c = 0; c < f.length; c++)
          n.push(a.get(f[c]));
        for (let c = 0; c < n.length; c++)
          a.set(c, n[c]);
        a.length = f.length;
      }, s.reflowSmallerGetNewLineLengths = function(a, f, n) {
        const c = [], u = a.map((i, t) => o(a, t, f)).reduce((i, t) => i + t);
        let v = 0, l = 0, e = 0;
        for (; e < u; ) {
          if (u - e < n) {
            c.push(u - e);
            break;
          }
          v += n;
          const i = o(a, l, f);
          v > i && (v -= i, l++);
          const t = a[l].getWidth(v - 1) === 2;
          t && v--;
          const r = t ? n - 1 : n;
          c.push(r), e += r;
        }
        return c;
      }, s.getWrappedLineTrimmedLength = o;
    }, 5295: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferSet = void 0;
      const a = o(8460), f = o(844), n = o(9092);
      class c extends f.Disposable {
        constructor(v, l) {
          super(), this._optionsService = v, this._bufferService = l, this._onBufferActivate = this.register(new a.EventEmitter()), this.onBufferActivate = this._onBufferActivate.event, this.reset(), this.register(this._optionsService.onSpecificOptionChange("scrollback", () => this.resize(this._bufferService.cols, this._bufferService.rows))), this.register(this._optionsService.onSpecificOptionChange("tabStopWidth", () => this.setupTabStops()));
        }
        reset() {
          this._normal = new n.Buffer(!0, this._optionsService, this._bufferService), this._normal.fillViewportRows(), this._alt = new n.Buffer(!1, this._optionsService, this._bufferService), this._activeBuffer = this._normal, this._onBufferActivate.fire({ activeBuffer: this._normal, inactiveBuffer: this._alt }), this.setupTabStops();
        }
        get alt() {
          return this._alt;
        }
        get active() {
          return this._activeBuffer;
        }
        get normal() {
          return this._normal;
        }
        activateNormalBuffer() {
          this._activeBuffer !== this._normal && (this._normal.x = this._alt.x, this._normal.y = this._alt.y, this._alt.clearAllMarkers(), this._alt.clear(), this._activeBuffer = this._normal, this._onBufferActivate.fire({ activeBuffer: this._normal, inactiveBuffer: this._alt }));
        }
        activateAltBuffer(v) {
          this._activeBuffer !== this._alt && (this._alt.fillViewportRows(v), this._alt.x = this._normal.x, this._alt.y = this._normal.y, this._activeBuffer = this._alt, this._onBufferActivate.fire({ activeBuffer: this._alt, inactiveBuffer: this._normal }));
        }
        resize(v, l) {
          this._normal.resize(v, l), this._alt.resize(v, l), this.setupTabStops(v);
        }
        setupTabStops(v) {
          this._normal.setupTabStops(v), this._alt.setupTabStops(v);
        }
      }
      s.BufferSet = c;
    }, 511: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CellData = void 0;
      const a = o(482), f = o(643), n = o(3734);
      class c extends n.AttributeData {
        constructor() {
          super(...arguments), this.content = 0, this.fg = 0, this.bg = 0, this.extended = new n.ExtendedAttrs(), this.combinedData = "";
        }
        static fromCharData(v) {
          const l = new c();
          return l.setFromCharData(v), l;
        }
        isCombined() {
          return 2097152 & this.content;
        }
        getWidth() {
          return this.content >> 22;
        }
        getChars() {
          return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0, a.stringFromCodePoint)(2097151 & this.content) : "";
        }
        getCode() {
          return this.isCombined() ? this.combinedData.charCodeAt(this.combinedData.length - 1) : 2097151 & this.content;
        }
        setFromCharData(v) {
          this.fg = v[f.CHAR_DATA_ATTR_INDEX], this.bg = 0;
          let l = !1;
          if (v[f.CHAR_DATA_CHAR_INDEX].length > 2)
            l = !0;
          else if (v[f.CHAR_DATA_CHAR_INDEX].length === 2) {
            const e = v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);
            if (55296 <= e && e <= 56319) {
              const i = v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);
              56320 <= i && i <= 57343 ? this.content = 1024 * (e - 55296) + i - 56320 + 65536 | v[f.CHAR_DATA_WIDTH_INDEX] << 22 : l = !0;
            } else
              l = !0;
          } else
            this.content = v[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | v[f.CHAR_DATA_WIDTH_INDEX] << 22;
          l && (this.combinedData = v[f.CHAR_DATA_CHAR_INDEX], this.content = 2097152 | v[f.CHAR_DATA_WIDTH_INDEX] << 22);
        }
        getAsCharData() {
          return [this.fg, this.getChars(), this.getWidth(), this.getCode()];
        }
      }
      s.CellData = c;
    }, 643: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.WHITESPACE_CELL_CODE = s.WHITESPACE_CELL_WIDTH = s.WHITESPACE_CELL_CHAR = s.NULL_CELL_CODE = s.NULL_CELL_WIDTH = s.NULL_CELL_CHAR = s.CHAR_DATA_CODE_INDEX = s.CHAR_DATA_WIDTH_INDEX = s.CHAR_DATA_CHAR_INDEX = s.CHAR_DATA_ATTR_INDEX = s.DEFAULT_EXT = s.DEFAULT_ATTR = s.DEFAULT_COLOR = void 0, s.DEFAULT_COLOR = 0, s.DEFAULT_ATTR = 256 | s.DEFAULT_COLOR << 9, s.DEFAULT_EXT = 0, s.CHAR_DATA_ATTR_INDEX = 0, s.CHAR_DATA_CHAR_INDEX = 1, s.CHAR_DATA_WIDTH_INDEX = 2, s.CHAR_DATA_CODE_INDEX = 3, s.NULL_CELL_CHAR = "", s.NULL_CELL_WIDTH = 1, s.NULL_CELL_CODE = 0, s.WHITESPACE_CELL_CHAR = " ", s.WHITESPACE_CELL_WIDTH = 1, s.WHITESPACE_CELL_CODE = 32;
    }, 4863: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Marker = void 0;
      const a = o(8460), f = o(844);
      class n {
        get id() {
          return this._id;
        }
        constructor(u) {
          this.line = u, this.isDisposed = !1, this._disposables = [], this._id = n._nextId++, this._onDispose = this.register(new a.EventEmitter()), this.onDispose = this._onDispose.event;
        }
        dispose() {
          this.isDisposed || (this.isDisposed = !0, this.line = -1, this._onDispose.fire(), (0, f.disposeArray)(this._disposables), this._disposables.length = 0);
        }
        register(u) {
          return this._disposables.push(u), u;
        }
      }
      s.Marker = n, n._nextId = 1;
    }, 7116: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DEFAULT_CHARSET = s.CHARSETS = void 0, s.CHARSETS = {}, s.DEFAULT_CHARSET = s.CHARSETS.B, s.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: "≥", "{": "π", "|": "≠", "}": "£", "~": "·" }, s.CHARSETS.A = { "#": "£" }, s.CHARSETS.B = void 0, s.CHARSETS[4] = { "#": "£", "@": "¾", "[": "ij", "\\": "½", "]": "|", "{": "¨", "|": "f", "}": "¼", "~": "´" }, s.CHARSETS.C = s.CHARSETS[5] = { "[": "Ä", "\\": "Ö", "]": "Å", "^": "Ü", "`": "é", "{": "ä", "|": "ö", "}": "å", "~": "ü" }, s.CHARSETS.R = { "#": "£", "@": "à", "[": "°", "\\": "ç", "]": "§", "{": "é", "|": "ù", "}": "è", "~": "¨" }, s.CHARSETS.Q = { "@": "à", "[": "â", "\\": "ç", "]": "ê", "^": "î", "`": "ô", "{": "é", "|": "ù", "}": "è", "~": "û" }, s.CHARSETS.K = { "@": "§", "[": "Ä", "\\": "Ö", "]": "Ü", "{": "ä", "|": "ö", "}": "ü", "~": "ß" }, s.CHARSETS.Y = { "#": "£", "@": "§", "[": "°", "\\": "ç", "]": "é", "`": "ù", "{": "à", "|": "ò", "}": "è", "~": "ì" }, s.CHARSETS.E = s.CHARSETS[6] = { "@": "Ä", "[": "Æ", "\\": "Ø", "]": "Å", "^": "Ü", "`": "ä", "{": "æ", "|": "ø", "}": "å", "~": "ü" }, s.CHARSETS.Z = { "#": "£", "@": "§", "[": "¡", "\\": "Ñ", "]": "¿", "{": "°", "|": "ñ", "}": "ç" }, s.CHARSETS.H = s.CHARSETS[7] = { "@": "É", "[": "Ä", "\\": "Ö", "]": "Å", "^": "Ü", "`": "é", "{": "ä", "|": "ö", "}": "å", "~": "ü" }, s.CHARSETS["="] = { "#": "ù", "@": "à", "[": "é", "\\": "ç", "]": "ê", "^": "î", _: "è", "`": "ô", "{": "ä", "|": "ö", "}": "ü", "~": "û" };
    }, 2584: (x, s) => {
      var o, a, f;
      Object.defineProperty(s, "__esModule", { value: !0 }), s.C1_ESCAPED = s.C1 = s.C0 = void 0, function(n) {
        n.NUL = "\0", n.SOH = "", n.STX = "", n.ETX = "", n.EOT = "", n.ENQ = "", n.ACK = "", n.BEL = "\x07", n.BS = "\b", n.HT = "	", n.LF = `
`, n.VT = "\v", n.FF = "\f", n.CR = "\r", n.SO = "", n.SI = "", n.DLE = "", n.DC1 = "", n.DC2 = "", n.DC3 = "", n.DC4 = "", n.NAK = "", n.SYN = "", n.ETB = "", n.CAN = "", n.EM = "", n.SUB = "", n.ESC = "\x1B", n.FS = "", n.GS = "", n.RS = "", n.US = "", n.SP = " ", n.DEL = "";
      }(o || (s.C0 = o = {})), function(n) {
        n.PAD = "€", n.HOP = "", n.BPH = "‚", n.NBH = "ƒ", n.IND = "„", n.NEL = "…", n.SSA = "†", n.ESA = "‡", n.HTS = "ˆ", n.HTJ = "‰", n.VTS = "Š", n.PLD = "‹", n.PLU = "Œ", n.RI = "", n.SS2 = "Ž", n.SS3 = "", n.DCS = "", n.PU1 = "‘", n.PU2 = "’", n.STS = "“", n.CCH = "”", n.MW = "•", n.SPA = "–", n.EPA = "—", n.SOS = "˜", n.SGCI = "™", n.SCI = "š", n.CSI = "›", n.ST = "œ", n.OSC = "", n.PM = "ž", n.APC = "Ÿ";
      }(a || (s.C1 = a = {})), function(n) {
        n.ST = `${o.ESC}\\`;
      }(f || (s.C1_ESCAPED = f = {}));
    }, 7399: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.evaluateKeyboardEvent = void 0;
      const a = o(2584), f = { 48: ["0", ")"], 49: ["1", "!"], 50: ["2", "@"], 51: ["3", "#"], 52: ["4", "$"], 53: ["5", "%"], 54: ["6", "^"], 55: ["7", "&"], 56: ["8", "*"], 57: ["9", "("], 186: [";", ":"], 187: ["=", "+"], 188: [",", "<"], 189: ["-", "_"], 190: [".", ">"], 191: ["/", "?"], 192: ["`", "~"], 219: ["[", "{"], 220: ["\\", "|"], 221: ["]", "}"], 222: ["'", '"'] };
      s.evaluateKeyboardEvent = function(n, c, u, v) {
        const l = { type: 0, cancel: !1, key: void 0 }, e = (n.shiftKey ? 1 : 0) | (n.altKey ? 2 : 0) | (n.ctrlKey ? 4 : 0) | (n.metaKey ? 8 : 0);
        switch (n.keyCode) {
          case 0:
            n.key === "UIKeyInputUpArrow" ? l.key = c ? a.C0.ESC + "OA" : a.C0.ESC + "[A" : n.key === "UIKeyInputLeftArrow" ? l.key = c ? a.C0.ESC + "OD" : a.C0.ESC + "[D" : n.key === "UIKeyInputRightArrow" ? l.key = c ? a.C0.ESC + "OC" : a.C0.ESC + "[C" : n.key === "UIKeyInputDownArrow" && (l.key = c ? a.C0.ESC + "OB" : a.C0.ESC + "[B");
            break;
          case 8:
            if (n.altKey) {
              l.key = a.C0.ESC + a.C0.DEL;
              break;
            }
            l.key = a.C0.DEL;
            break;
          case 9:
            if (n.shiftKey) {
              l.key = a.C0.ESC + "[Z";
              break;
            }
            l.key = a.C0.HT, l.cancel = !0;
            break;
          case 13:
            l.key = n.altKey ? a.C0.ESC + a.C0.CR : a.C0.CR, l.cancel = !0;
            break;
          case 27:
            l.key = a.C0.ESC, n.altKey && (l.key = a.C0.ESC + a.C0.ESC), l.cancel = !0;
            break;
          case 37:
            if (n.metaKey)
              break;
            e ? (l.key = a.C0.ESC + "[1;" + (e + 1) + "D", l.key === a.C0.ESC + "[1;3D" && (l.key = a.C0.ESC + (u ? "b" : "[1;5D"))) : l.key = c ? a.C0.ESC + "OD" : a.C0.ESC + "[D";
            break;
          case 39:
            if (n.metaKey)
              break;
            e ? (l.key = a.C0.ESC + "[1;" + (e + 1) + "C", l.key === a.C0.ESC + "[1;3C" && (l.key = a.C0.ESC + (u ? "f" : "[1;5C"))) : l.key = c ? a.C0.ESC + "OC" : a.C0.ESC + "[C";
            break;
          case 38:
            if (n.metaKey)
              break;
            e ? (l.key = a.C0.ESC + "[1;" + (e + 1) + "A", u || l.key !== a.C0.ESC + "[1;3A" || (l.key = a.C0.ESC + "[1;5A")) : l.key = c ? a.C0.ESC + "OA" : a.C0.ESC + "[A";
            break;
          case 40:
            if (n.metaKey)
              break;
            e ? (l.key = a.C0.ESC + "[1;" + (e + 1) + "B", u || l.key !== a.C0.ESC + "[1;3B" || (l.key = a.C0.ESC + "[1;5B")) : l.key = c ? a.C0.ESC + "OB" : a.C0.ESC + "[B";
            break;
          case 45:
            n.shiftKey || n.ctrlKey || (l.key = a.C0.ESC + "[2~");
            break;
          case 46:
            l.key = e ? a.C0.ESC + "[3;" + (e + 1) + "~" : a.C0.ESC + "[3~";
            break;
          case 36:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "H" : c ? a.C0.ESC + "OH" : a.C0.ESC + "[H";
            break;
          case 35:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "F" : c ? a.C0.ESC + "OF" : a.C0.ESC + "[F";
            break;
          case 33:
            n.shiftKey ? l.type = 2 : n.ctrlKey ? l.key = a.C0.ESC + "[5;" + (e + 1) + "~" : l.key = a.C0.ESC + "[5~";
            break;
          case 34:
            n.shiftKey ? l.type = 3 : n.ctrlKey ? l.key = a.C0.ESC + "[6;" + (e + 1) + "~" : l.key = a.C0.ESC + "[6~";
            break;
          case 112:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "P" : a.C0.ESC + "OP";
            break;
          case 113:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "Q" : a.C0.ESC + "OQ";
            break;
          case 114:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "R" : a.C0.ESC + "OR";
            break;
          case 115:
            l.key = e ? a.C0.ESC + "[1;" + (e + 1) + "S" : a.C0.ESC + "OS";
            break;
          case 116:
            l.key = e ? a.C0.ESC + "[15;" + (e + 1) + "~" : a.C0.ESC + "[15~";
            break;
          case 117:
            l.key = e ? a.C0.ESC + "[17;" + (e + 1) + "~" : a.C0.ESC + "[17~";
            break;
          case 118:
            l.key = e ? a.C0.ESC + "[18;" + (e + 1) + "~" : a.C0.ESC + "[18~";
            break;
          case 119:
            l.key = e ? a.C0.ESC + "[19;" + (e + 1) + "~" : a.C0.ESC + "[19~";
            break;
          case 120:
            l.key = e ? a.C0.ESC + "[20;" + (e + 1) + "~" : a.C0.ESC + "[20~";
            break;
          case 121:
            l.key = e ? a.C0.ESC + "[21;" + (e + 1) + "~" : a.C0.ESC + "[21~";
            break;
          case 122:
            l.key = e ? a.C0.ESC + "[23;" + (e + 1) + "~" : a.C0.ESC + "[23~";
            break;
          case 123:
            l.key = e ? a.C0.ESC + "[24;" + (e + 1) + "~" : a.C0.ESC + "[24~";
            break;
          default:
            if (!n.ctrlKey || n.shiftKey || n.altKey || n.metaKey)
              if (u && !v || !n.altKey || n.metaKey)
                !u || n.altKey || n.ctrlKey || n.shiftKey || !n.metaKey ? n.key && !n.ctrlKey && !n.altKey && !n.metaKey && n.keyCode >= 48 && n.key.length === 1 ? l.key = n.key : n.key && n.ctrlKey && (n.key === "_" && (l.key = a.C0.US), n.key === "@" && (l.key = a.C0.NUL)) : n.keyCode === 65 && (l.type = 1);
              else {
                const i = f[n.keyCode], t = i == null ? void 0 : i[n.shiftKey ? 1 : 0];
                if (t)
                  l.key = a.C0.ESC + t;
                else if (n.keyCode >= 65 && n.keyCode <= 90) {
                  const r = n.ctrlKey ? n.keyCode - 64 : n.keyCode + 32;
                  let h = String.fromCharCode(r);
                  n.shiftKey && (h = h.toUpperCase()), l.key = a.C0.ESC + h;
                } else if (n.keyCode === 32)
                  l.key = a.C0.ESC + (n.ctrlKey ? a.C0.NUL : " ");
                else if (n.key === "Dead" && n.code.startsWith("Key")) {
                  let r = n.code.slice(3, 4);
                  n.shiftKey || (r = r.toLowerCase()), l.key = a.C0.ESC + r, l.cancel = !0;
                }
              }
            else
              n.keyCode >= 65 && n.keyCode <= 90 ? l.key = String.fromCharCode(n.keyCode - 64) : n.keyCode === 32 ? l.key = a.C0.NUL : n.keyCode >= 51 && n.keyCode <= 55 ? l.key = String.fromCharCode(n.keyCode - 51 + 27) : n.keyCode === 56 ? l.key = a.C0.DEL : n.keyCode === 219 ? l.key = a.C0.ESC : n.keyCode === 220 ? l.key = a.C0.FS : n.keyCode === 221 && (l.key = a.C0.GS);
        }
        return l;
      };
    }, 482: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Utf8ToUtf32 = s.StringToUtf32 = s.utf32ToString = s.stringFromCodePoint = void 0, s.stringFromCodePoint = function(o) {
        return o > 65535 ? (o -= 65536, String.fromCharCode(55296 + (o >> 10)) + String.fromCharCode(o % 1024 + 56320)) : String.fromCharCode(o);
      }, s.utf32ToString = function(o, a = 0, f = o.length) {
        let n = "";
        for (let c = a; c < f; ++c) {
          let u = o[c];
          u > 65535 ? (u -= 65536, n += String.fromCharCode(55296 + (u >> 10)) + String.fromCharCode(u % 1024 + 56320)) : n += String.fromCharCode(u);
        }
        return n;
      }, s.StringToUtf32 = class {
        constructor() {
          this._interim = 0;
        }
        clear() {
          this._interim = 0;
        }
        decode(o, a) {
          const f = o.length;
          if (!f)
            return 0;
          let n = 0, c = 0;
          if (this._interim) {
            const u = o.charCodeAt(c++);
            56320 <= u && u <= 57343 ? a[n++] = 1024 * (this._interim - 55296) + u - 56320 + 65536 : (a[n++] = this._interim, a[n++] = u), this._interim = 0;
          }
          for (let u = c; u < f; ++u) {
            const v = o.charCodeAt(u);
            if (55296 <= v && v <= 56319) {
              if (++u >= f)
                return this._interim = v, n;
              const l = o.charCodeAt(u);
              56320 <= l && l <= 57343 ? a[n++] = 1024 * (v - 55296) + l - 56320 + 65536 : (a[n++] = v, a[n++] = l);
            } else
              v !== 65279 && (a[n++] = v);
          }
          return n;
        }
      }, s.Utf8ToUtf32 = class {
        constructor() {
          this.interim = new Uint8Array(3);
        }
        clear() {
          this.interim.fill(0);
        }
        decode(o, a) {
          const f = o.length;
          if (!f)
            return 0;
          let n, c, u, v, l = 0, e = 0, i = 0;
          if (this.interim[0]) {
            let h = !1, _ = this.interim[0];
            _ &= (224 & _) == 192 ? 31 : (240 & _) == 224 ? 15 : 7;
            let p, m = 0;
            for (; (p = 63 & this.interim[++m]) && m < 4; )
              _ <<= 6, _ |= p;
            const d = (224 & this.interim[0]) == 192 ? 2 : (240 & this.interim[0]) == 224 ? 3 : 4, g = d - m;
            for (; i < g; ) {
              if (i >= f)
                return 0;
              if (p = o[i++], (192 & p) != 128) {
                i--, h = !0;
                break;
              }
              this.interim[m++] = p, _ <<= 6, _ |= 63 & p;
            }
            h || (d === 2 ? _ < 128 ? i-- : a[l++] = _ : d === 3 ? _ < 2048 || _ >= 55296 && _ <= 57343 || _ === 65279 || (a[l++] = _) : _ < 65536 || _ > 1114111 || (a[l++] = _)), this.interim.fill(0);
          }
          const t = f - 4;
          let r = i;
          for (; r < f; ) {
            for (; !(!(r < t) || 128 & (n = o[r]) || 128 & (c = o[r + 1]) || 128 & (u = o[r + 2]) || 128 & (v = o[r + 3])); )
              a[l++] = n, a[l++] = c, a[l++] = u, a[l++] = v, r += 4;
            if (n = o[r++], n < 128)
              a[l++] = n;
            else if ((224 & n) == 192) {
              if (r >= f)
                return this.interim[0] = n, l;
              if (c = o[r++], (192 & c) != 128) {
                r--;
                continue;
              }
              if (e = (31 & n) << 6 | 63 & c, e < 128) {
                r--;
                continue;
              }
              a[l++] = e;
            } else if ((240 & n) == 224) {
              if (r >= f)
                return this.interim[0] = n, l;
              if (c = o[r++], (192 & c) != 128) {
                r--;
                continue;
              }
              if (r >= f)
                return this.interim[0] = n, this.interim[1] = c, l;
              if (u = o[r++], (192 & u) != 128) {
                r--;
                continue;
              }
              if (e = (15 & n) << 12 | (63 & c) << 6 | 63 & u, e < 2048 || e >= 55296 && e <= 57343 || e === 65279)
                continue;
              a[l++] = e;
            } else if ((248 & n) == 240) {
              if (r >= f)
                return this.interim[0] = n, l;
              if (c = o[r++], (192 & c) != 128) {
                r--;
                continue;
              }
              if (r >= f)
                return this.interim[0] = n, this.interim[1] = c, l;
              if (u = o[r++], (192 & u) != 128) {
                r--;
                continue;
              }
              if (r >= f)
                return this.interim[0] = n, this.interim[1] = c, this.interim[2] = u, l;
              if (v = o[r++], (192 & v) != 128) {
                r--;
                continue;
              }
              if (e = (7 & n) << 18 | (63 & c) << 12 | (63 & u) << 6 | 63 & v, e < 65536 || e > 1114111)
                continue;
              a[l++] = e;
            }
          }
          return l;
        }
      };
    }, 225: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.UnicodeV6 = void 0;
      const o = [[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]], a = [[68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]];
      let f;
      s.UnicodeV6 = class {
        constructor() {
          if (this.version = "6", !f) {
            f = new Uint8Array(65536), f.fill(1), f[0] = 0, f.fill(0, 1, 32), f.fill(0, 127, 160), f.fill(2, 4352, 4448), f[9001] = 2, f[9002] = 2, f.fill(2, 11904, 42192), f[12351] = 1, f.fill(2, 44032, 55204), f.fill(2, 63744, 64256), f.fill(2, 65040, 65050), f.fill(2, 65072, 65136), f.fill(2, 65280, 65377), f.fill(2, 65504, 65511);
            for (let n = 0; n < o.length; ++n)
              f.fill(0, o[n][0], o[n][1] + 1);
          }
        }
        wcwidth(n) {
          return n < 32 ? 0 : n < 127 ? 1 : n < 65536 ? f[n] : function(c, u) {
            let v, l = 0, e = u.length - 1;
            if (c < u[0][0] || c > u[e][1])
              return !1;
            for (; e >= l; )
              if (v = l + e >> 1, c > u[v][1])
                l = v + 1;
              else {
                if (!(c < u[v][0]))
                  return !0;
                e = v - 1;
              }
            return !1;
          }(n, a) ? 0 : n >= 131072 && n <= 196605 || n >= 196608 && n <= 262141 ? 2 : 1;
        }
      };
    }, 5981: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.WriteBuffer = void 0;
      const a = o(8460), f = o(844);
      class n extends f.Disposable {
        constructor(u) {
          super(), this._action = u, this._writeBuffer = [], this._callbacks = [], this._pendingData = 0, this._bufferOffset = 0, this._isSyncWriting = !1, this._syncCalls = 0, this._didUserInput = !1, this._onWriteParsed = this.register(new a.EventEmitter()), this.onWriteParsed = this._onWriteParsed.event;
        }
        handleUserInput() {
          this._didUserInput = !0;
        }
        writeSync(u, v) {
          if (v !== void 0 && this._syncCalls > v)
            return void (this._syncCalls = 0);
          if (this._pendingData += u.length, this._writeBuffer.push(u), this._callbacks.push(void 0), this._syncCalls++, this._isSyncWriting)
            return;
          let l;
          for (this._isSyncWriting = !0; l = this._writeBuffer.shift(); ) {
            this._action(l);
            const e = this._callbacks.shift();
            e && e();
          }
          this._pendingData = 0, this._bufferOffset = 2147483647, this._isSyncWriting = !1, this._syncCalls = 0;
        }
        write(u, v) {
          if (this._pendingData > 5e7)
            throw new Error("write data discarded, use flow control to avoid losing data");
          if (!this._writeBuffer.length) {
            if (this._bufferOffset = 0, this._didUserInput)
              return this._didUserInput = !1, this._pendingData += u.length, this._writeBuffer.push(u), this._callbacks.push(v), void this._innerWrite();
            setTimeout(() => this._innerWrite());
          }
          this._pendingData += u.length, this._writeBuffer.push(u), this._callbacks.push(v);
        }
        _innerWrite(u = 0, v = !0) {
          const l = u || Date.now();
          for (; this._writeBuffer.length > this._bufferOffset; ) {
            const e = this._writeBuffer[this._bufferOffset], i = this._action(e, v);
            if (i) {
              const r = (h) => Date.now() - l >= 12 ? setTimeout(() => this._innerWrite(0, h)) : this._innerWrite(l, h);
              return void i.catch((h) => (queueMicrotask(() => {
                throw h;
              }), Promise.resolve(!1))).then(r);
            }
            const t = this._callbacks[this._bufferOffset];
            if (t && t(), this._bufferOffset++, this._pendingData -= e.length, Date.now() - l >= 12)
              break;
          }
          this._writeBuffer.length > this._bufferOffset ? (this._bufferOffset > 50 && (this._writeBuffer = this._writeBuffer.slice(this._bufferOffset), this._callbacks = this._callbacks.slice(this._bufferOffset), this._bufferOffset = 0), setTimeout(() => this._innerWrite())) : (this._writeBuffer.length = 0, this._callbacks.length = 0, this._pendingData = 0, this._bufferOffset = 0), this._onWriteParsed.fire();
        }
      }
      s.WriteBuffer = n;
    }, 5941: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.toRgbString = s.parseColor = void 0;
      const o = /^([\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})$/, a = /^[\da-f]+$/;
      function f(n, c) {
        const u = n.toString(16), v = u.length < 2 ? "0" + u : u;
        switch (c) {
          case 4:
            return u[0];
          case 8:
            return v;
          case 12:
            return (v + v).slice(0, 3);
          default:
            return v + v;
        }
      }
      s.parseColor = function(n) {
        if (!n)
          return;
        let c = n.toLowerCase();
        if (c.indexOf("rgb:") === 0) {
          c = c.slice(4);
          const u = o.exec(c);
          if (u) {
            const v = u[1] ? 15 : u[4] ? 255 : u[7] ? 4095 : 65535;
            return [Math.round(parseInt(u[1] || u[4] || u[7] || u[10], 16) / v * 255), Math.round(parseInt(u[2] || u[5] || u[8] || u[11], 16) / v * 255), Math.round(parseInt(u[3] || u[6] || u[9] || u[12], 16) / v * 255)];
          }
        } else if (c.indexOf("#") === 0 && (c = c.slice(1), a.exec(c) && [3, 6, 9, 12].includes(c.length))) {
          const u = c.length / 3, v = [0, 0, 0];
          for (let l = 0; l < 3; ++l) {
            const e = parseInt(c.slice(u * l, u * l + u), 16);
            v[l] = u === 1 ? e << 4 : u === 2 ? e : u === 3 ? e >> 4 : e >> 8;
          }
          return v;
        }
      }, s.toRgbString = function(n, c = 16) {
        const [u, v, l] = n;
        return `rgb:${f(u, c)}/${f(v, c)}/${f(l, c)}`;
      };
    }, 5770: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.PAYLOAD_LIMIT = void 0, s.PAYLOAD_LIMIT = 1e7;
    }, 6351: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DcsHandler = s.DcsParser = void 0;
      const a = o(482), f = o(8742), n = o(5770), c = [];
      s.DcsParser = class {
        constructor() {
          this._handlers = /* @__PURE__ */ Object.create(null), this._active = c, this._ident = 0, this._handlerFb = () => {
          }, this._stack = { paused: !1, loopPosition: 0, fallThrough: !1 };
        }
        dispose() {
          this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
          }, this._active = c;
        }
        registerHandler(v, l) {
          this._handlers[v] === void 0 && (this._handlers[v] = []);
          const e = this._handlers[v];
          return e.push(l), { dispose: () => {
            const i = e.indexOf(l);
            i !== -1 && e.splice(i, 1);
          } };
        }
        clearHandler(v) {
          this._handlers[v] && delete this._handlers[v];
        }
        setHandlerFallback(v) {
          this._handlerFb = v;
        }
        reset() {
          if (this._active.length)
            for (let v = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; v >= 0; --v)
              this._active[v].unhook(!1);
          this._stack.paused = !1, this._active = c, this._ident = 0;
        }
        hook(v, l) {
          if (this.reset(), this._ident = v, this._active = this._handlers[v] || c, this._active.length)
            for (let e = this._active.length - 1; e >= 0; e--)
              this._active[e].hook(l);
          else
            this._handlerFb(this._ident, "HOOK", l);
        }
        put(v, l, e) {
          if (this._active.length)
            for (let i = this._active.length - 1; i >= 0; i--)
              this._active[i].put(v, l, e);
          else
            this._handlerFb(this._ident, "PUT", (0, a.utf32ToString)(v, l, e));
        }
        unhook(v, l = !0) {
          if (this._active.length) {
            let e = !1, i = this._active.length - 1, t = !1;
            if (this._stack.paused && (i = this._stack.loopPosition - 1, e = l, t = this._stack.fallThrough, this._stack.paused = !1), !t && e === !1) {
              for (; i >= 0 && (e = this._active[i].unhook(v), e !== !0); i--)
                if (e instanceof Promise)
                  return this._stack.paused = !0, this._stack.loopPosition = i, this._stack.fallThrough = !1, e;
              i--;
            }
            for (; i >= 0; i--)
              if (e = this._active[i].unhook(!1), e instanceof Promise)
                return this._stack.paused = !0, this._stack.loopPosition = i, this._stack.fallThrough = !0, e;
          } else
            this._handlerFb(this._ident, "UNHOOK", v);
          this._active = c, this._ident = 0;
        }
      };
      const u = new f.Params();
      u.addParam(0), s.DcsHandler = class {
        constructor(v) {
          this._handler = v, this._data = "", this._params = u, this._hitLimit = !1;
        }
        hook(v) {
          this._params = v.length > 1 || v.params[0] ? v.clone() : u, this._data = "", this._hitLimit = !1;
        }
        put(v, l, e) {
          this._hitLimit || (this._data += (0, a.utf32ToString)(v, l, e), this._data.length > n.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = !0));
        }
        unhook(v) {
          let l = !1;
          if (this._hitLimit)
            l = !1;
          else if (v && (l = this._handler(this._data, this._params), l instanceof Promise))
            return l.then((e) => (this._params = u, this._data = "", this._hitLimit = !1, e));
          return this._params = u, this._data = "", this._hitLimit = !1, l;
        }
      };
    }, 2015: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.EscapeSequenceParser = s.VT500_TRANSITION_TABLE = s.TransitionTable = void 0;
      const a = o(844), f = o(8742), n = o(6242), c = o(6351);
      class u {
        constructor(i) {
          this.table = new Uint8Array(i);
        }
        setDefault(i, t) {
          this.table.fill(i << 4 | t);
        }
        add(i, t, r, h) {
          this.table[t << 8 | i] = r << 4 | h;
        }
        addMany(i, t, r, h) {
          for (let _ = 0; _ < i.length; _++)
            this.table[t << 8 | i[_]] = r << 4 | h;
        }
      }
      s.TransitionTable = u;
      const v = 160;
      s.VT500_TRANSITION_TABLE = function() {
        const e = new u(4095), i = Array.apply(null, Array(256)).map((m, d) => d), t = (m, d) => i.slice(m, d), r = t(32, 127), h = t(0, 24);
        h.push(25), h.push.apply(h, t(28, 32));
        const _ = t(0, 14);
        let p;
        for (p in e.setDefault(1, 0), e.addMany(r, 0, 2, 0), _)
          e.addMany([24, 26, 153, 154], p, 3, 0), e.addMany(t(128, 144), p, 3, 0), e.addMany(t(144, 152), p, 3, 0), e.add(156, p, 0, 0), e.add(27, p, 11, 1), e.add(157, p, 4, 8), e.addMany([152, 158, 159], p, 0, 7), e.add(155, p, 11, 3), e.add(144, p, 11, 9);
        return e.addMany(h, 0, 3, 0), e.addMany(h, 1, 3, 1), e.add(127, 1, 0, 1), e.addMany(h, 8, 0, 8), e.addMany(h, 3, 3, 3), e.add(127, 3, 0, 3), e.addMany(h, 4, 3, 4), e.add(127, 4, 0, 4), e.addMany(h, 6, 3, 6), e.addMany(h, 5, 3, 5), e.add(127, 5, 0, 5), e.addMany(h, 2, 3, 2), e.add(127, 2, 0, 2), e.add(93, 1, 4, 8), e.addMany(r, 8, 5, 8), e.add(127, 8, 5, 8), e.addMany([156, 27, 24, 26, 7], 8, 6, 0), e.addMany(t(28, 32), 8, 0, 8), e.addMany([88, 94, 95], 1, 0, 7), e.addMany(r, 7, 0, 7), e.addMany(h, 7, 0, 7), e.add(156, 7, 0, 0), e.add(127, 7, 0, 7), e.add(91, 1, 11, 3), e.addMany(t(64, 127), 3, 7, 0), e.addMany(t(48, 60), 3, 8, 4), e.addMany([60, 61, 62, 63], 3, 9, 4), e.addMany(t(48, 60), 4, 8, 4), e.addMany(t(64, 127), 4, 7, 0), e.addMany([60, 61, 62, 63], 4, 0, 6), e.addMany(t(32, 64), 6, 0, 6), e.add(127, 6, 0, 6), e.addMany(t(64, 127), 6, 0, 0), e.addMany(t(32, 48), 3, 9, 5), e.addMany(t(32, 48), 5, 9, 5), e.addMany(t(48, 64), 5, 0, 6), e.addMany(t(64, 127), 5, 7, 0), e.addMany(t(32, 48), 4, 9, 5), e.addMany(t(32, 48), 1, 9, 2), e.addMany(t(32, 48), 2, 9, 2), e.addMany(t(48, 127), 2, 10, 0), e.addMany(t(48, 80), 1, 10, 0), e.addMany(t(81, 88), 1, 10, 0), e.addMany([89, 90, 92], 1, 10, 0), e.addMany(t(96, 127), 1, 10, 0), e.add(80, 1, 11, 9), e.addMany(h, 9, 0, 9), e.add(127, 9, 0, 9), e.addMany(t(28, 32), 9, 0, 9), e.addMany(t(32, 48), 9, 9, 12), e.addMany(t(48, 60), 9, 8, 10), e.addMany([60, 61, 62, 63], 9, 9, 10), e.addMany(h, 11, 0, 11), e.addMany(t(32, 128), 11, 0, 11), e.addMany(t(28, 32), 11, 0, 11), e.addMany(h, 10, 0, 10), e.add(127, 10, 0, 10), e.addMany(t(28, 32), 10, 0, 10), e.addMany(t(48, 60), 10, 8, 10), e.addMany([60, 61, 62, 63], 10, 0, 11), e.addMany(t(32, 48), 10, 9, 12), e.addMany(h, 12, 0, 12), e.add(127, 12, 0, 12), e.addMany(t(28, 32), 12, 0, 12), e.addMany(t(32, 48), 12, 9, 12), e.addMany(t(48, 64), 12, 0, 11), e.addMany(t(64, 127), 12, 12, 13), e.addMany(t(64, 127), 10, 12, 13), e.addMany(t(64, 127), 9, 12, 13), e.addMany(h, 13, 13, 13), e.addMany(r, 13, 13, 13), e.add(127, 13, 0, 13), e.addMany([27, 156, 24, 26], 13, 14, 0), e.add(v, 0, 2, 0), e.add(v, 8, 5, 8), e.add(v, 6, 0, 6), e.add(v, 11, 0, 11), e.add(v, 13, 13, 13), e;
      }();
      class l extends a.Disposable {
        constructor(i = s.VT500_TRANSITION_TABLE) {
          super(), this._transitions = i, this._parseStack = { state: 0, handlers: [], handlerPos: 0, transition: 0, chunkPos: 0 }, this.initialState = 0, this.currentState = this.initialState, this._params = new f.Params(), this._params.addParam(0), this._collect = 0, this.precedingCodepoint = 0, this._printHandlerFb = (t, r, h) => {
          }, this._executeHandlerFb = (t) => {
          }, this._csiHandlerFb = (t, r) => {
          }, this._escHandlerFb = (t) => {
          }, this._errorHandlerFb = (t) => t, 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, a.toDisposable)(() => {
            this._csiHandlers = /* @__PURE__ */ Object.create(null), this._executeHandlers = /* @__PURE__ */ Object.create(null), this._escHandlers = /* @__PURE__ */ Object.create(null);
          })), this._oscParser = this.register(new n.OscParser()), this._dcsParser = this.register(new c.DcsParser()), this._errorHandler = this._errorHandlerFb, this.registerEscHandler({ final: "\\" }, () => !0);
        }
        _identifier(i, t = [64, 126]) {
          let r = 0;
          if (i.prefix) {
            if (i.prefix.length > 1)
              throw new Error("only one byte as prefix supported");
            if (r = i.prefix.charCodeAt(0), r && 60 > r || r > 63)
              throw new Error("prefix must be in range 0x3c .. 0x3f");
          }
          if (i.intermediates) {
            if (i.intermediates.length > 2)
              throw new Error("only two bytes as intermediates are supported");
            for (let _ = 0; _ < i.intermediates.length; ++_) {
              const p = i.intermediates.charCodeAt(_);
              if (32 > p || p > 47)
                throw new Error("intermediate must be in range 0x20 .. 0x2f");
              r <<= 8, r |= p;
            }
          }
          if (i.final.length !== 1)
            throw new Error("final must be a single byte");
          const h = i.final.charCodeAt(0);
          if (t[0] > h || h > t[1])
            throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);
          return r <<= 8, r |= h, r;
        }
        identToString(i) {
          const t = [];
          for (; i; )
            t.push(String.fromCharCode(255 & i)), i >>= 8;
          return t.reverse().join("");
        }
        setPrintHandler(i) {
          this._printHandler = i;
        }
        clearPrintHandler() {
          this._printHandler = this._printHandlerFb;
        }
        registerEscHandler(i, t) {
          const r = this._identifier(i, [48, 126]);
          this._escHandlers[r] === void 0 && (this._escHandlers[r] = []);
          const h = this._escHandlers[r];
          return h.push(t), { dispose: () => {
            const _ = h.indexOf(t);
            _ !== -1 && h.splice(_, 1);
          } };
        }
        clearEscHandler(i) {
          this._escHandlers[this._identifier(i, [48, 126])] && delete this._escHandlers[this._identifier(i, [48, 126])];
        }
        setEscHandlerFallback(i) {
          this._escHandlerFb = i;
        }
        setExecuteHandler(i, t) {
          this._executeHandlers[i.charCodeAt(0)] = t;
        }
        clearExecuteHandler(i) {
          this._executeHandlers[i.charCodeAt(0)] && delete this._executeHandlers[i.charCodeAt(0)];
        }
        setExecuteHandlerFallback(i) {
          this._executeHandlerFb = i;
        }
        registerCsiHandler(i, t) {
          const r = this._identifier(i);
          this._csiHandlers[r] === void 0 && (this._csiHandlers[r] = []);
          const h = this._csiHandlers[r];
          return h.push(t), { dispose: () => {
            const _ = h.indexOf(t);
            _ !== -1 && h.splice(_, 1);
          } };
        }
        clearCsiHandler(i) {
          this._csiHandlers[this._identifier(i)] && delete this._csiHandlers[this._identifier(i)];
        }
        setCsiHandlerFallback(i) {
          this._csiHandlerFb = i;
        }
        registerDcsHandler(i, t) {
          return this._dcsParser.registerHandler(this._identifier(i), t);
        }
        clearDcsHandler(i) {
          this._dcsParser.clearHandler(this._identifier(i));
        }
        setDcsHandlerFallback(i) {
          this._dcsParser.setHandlerFallback(i);
        }
        registerOscHandler(i, t) {
          return this._oscParser.registerHandler(i, t);
        }
        clearOscHandler(i) {
          this._oscParser.clearHandler(i);
        }
        setOscHandlerFallback(i) {
          this._oscParser.setHandlerFallback(i);
        }
        setErrorHandler(i) {
          this._errorHandler = i;
        }
        clearErrorHandler() {
          this._errorHandler = this._errorHandlerFb;
        }
        reset() {
          this.currentState = this.initialState, this._oscParser.reset(), this._dcsParser.reset(), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingCodepoint = 0, this._parseStack.state !== 0 && (this._parseStack.state = 2, this._parseStack.handlers = []);
        }
        _preserveStack(i, t, r, h, _) {
          this._parseStack.state = i, this._parseStack.handlers = t, this._parseStack.handlerPos = r, this._parseStack.transition = h, this._parseStack.chunkPos = _;
        }
        parse(i, t, r) {
          let h, _ = 0, p = 0, m = 0;
          if (this._parseStack.state)
            if (this._parseStack.state === 2)
              this._parseStack.state = 0, m = this._parseStack.chunkPos + 1;
            else {
              if (r === void 0 || this._parseStack.state === 1)
                throw this._parseStack.state = 1, new Error("improper continuation due to previous async handler, giving up parsing");
              const d = this._parseStack.handlers;
              let g = this._parseStack.handlerPos - 1;
              switch (this._parseStack.state) {
                case 3:
                  if (r === !1 && g > -1) {
                    for (; g >= 0 && (h = d[g](this._params), h !== !0); g--)
                      if (h instanceof Promise)
                        return this._parseStack.handlerPos = g, h;
                  }
                  this._parseStack.handlers = [];
                  break;
                case 4:
                  if (r === !1 && g > -1) {
                    for (; g >= 0 && (h = d[g](), h !== !0); g--)
                      if (h instanceof Promise)
                        return this._parseStack.handlerPos = g, h;
                  }
                  this._parseStack.handlers = [];
                  break;
                case 6:
                  if (_ = i[this._parseStack.chunkPos], h = this._dcsParser.unhook(_ !== 24 && _ !== 26, r), h)
                    return h;
                  _ === 27 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0;
                  break;
                case 5:
                  if (_ = i[this._parseStack.chunkPos], h = this._oscParser.end(_ !== 24 && _ !== 26, r), h)
                    return h;
                  _ === 27 && (this._parseStack.transition |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0;
              }
              this._parseStack.state = 0, m = this._parseStack.chunkPos + 1, this.precedingCodepoint = 0, this.currentState = 15 & this._parseStack.transition;
            }
          for (let d = m; d < t; ++d) {
            switch (_ = i[d], p = this._transitions.table[this.currentState << 8 | (_ < 160 ? _ : v)], p >> 4) {
              case 2:
                for (let k = d + 1; ; ++k) {
                  if (k >= t || (_ = i[k]) < 32 || _ > 126 && _ < v) {
                    this._printHandler(i, d, k), d = k - 1;
                    break;
                  }
                  if (++k >= t || (_ = i[k]) < 32 || _ > 126 && _ < v) {
                    this._printHandler(i, d, k), d = k - 1;
                    break;
                  }
                  if (++k >= t || (_ = i[k]) < 32 || _ > 126 && _ < v) {
                    this._printHandler(i, d, k), d = k - 1;
                    break;
                  }
                  if (++k >= t || (_ = i[k]) < 32 || _ > 126 && _ < v) {
                    this._printHandler(i, d, k), d = k - 1;
                    break;
                  }
                }
                break;
              case 3:
                this._executeHandlers[_] ? this._executeHandlers[_]() : this._executeHandlerFb(_), this.precedingCodepoint = 0;
                break;
              case 0:
                break;
              case 1:
                if (this._errorHandler({ position: d, code: _, currentState: this.currentState, collect: this._collect, params: this._params, abort: !1 }).abort)
                  return;
                break;
              case 7:
                const g = this._csiHandlers[this._collect << 8 | _];
                let y = g ? g.length - 1 : -1;
                for (; y >= 0 && (h = g[y](this._params), h !== !0); y--)
                  if (h instanceof Promise)
                    return this._preserveStack(3, g, y, p, d), h;
                y < 0 && this._csiHandlerFb(this._collect << 8 | _, this._params), this.precedingCodepoint = 0;
                break;
              case 8:
                do
                  switch (_) {
                    case 59:
                      this._params.addParam(0);
                      break;
                    case 58:
                      this._params.addSubParam(-1);
                      break;
                    default:
                      this._params.addDigit(_ - 48);
                  }
                while (++d < t && (_ = i[d]) > 47 && _ < 60);
                d--;
                break;
              case 9:
                this._collect <<= 8, this._collect |= _;
                break;
              case 10:
                const L = this._escHandlers[this._collect << 8 | _];
                let b = L ? L.length - 1 : -1;
                for (; b >= 0 && (h = L[b](), h !== !0); b--)
                  if (h instanceof Promise)
                    return this._preserveStack(4, L, b, p, d), h;
                b < 0 && this._escHandlerFb(this._collect << 8 | _), this.precedingCodepoint = 0;
                break;
              case 11:
                this._params.reset(), this._params.addParam(0), this._collect = 0;
                break;
              case 12:
                this._dcsParser.hook(this._collect << 8 | _, this._params);
                break;
              case 13:
                for (let k = d + 1; ; ++k)
                  if (k >= t || (_ = i[k]) === 24 || _ === 26 || _ === 27 || _ > 127 && _ < v) {
                    this._dcsParser.put(i, d, k), d = k - 1;
                    break;
                  }
                break;
              case 14:
                if (h = this._dcsParser.unhook(_ !== 24 && _ !== 26), h)
                  return this._preserveStack(6, [], 0, p, d), h;
                _ === 27 && (p |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingCodepoint = 0;
                break;
              case 4:
                this._oscParser.start();
                break;
              case 5:
                for (let k = d + 1; ; k++)
                  if (k >= t || (_ = i[k]) < 32 || _ > 127 && _ < v) {
                    this._oscParser.put(i, d, k), d = k - 1;
                    break;
                  }
                break;
              case 6:
                if (h = this._oscParser.end(_ !== 24 && _ !== 26), h)
                  return this._preserveStack(5, [], 0, p, d), h;
                _ === 27 && (p |= 1), this._params.reset(), this._params.addParam(0), this._collect = 0, this.precedingCodepoint = 0;
            }
            this.currentState = 15 & p;
          }
        }
      }
      s.EscapeSequenceParser = l;
    }, 6242: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.OscHandler = s.OscParser = void 0;
      const a = o(5770), f = o(482), n = [];
      s.OscParser = class {
        constructor() {
          this._state = 0, this._active = n, this._id = -1, this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
          }, this._stack = { paused: !1, loopPosition: 0, fallThrough: !1 };
        }
        registerHandler(c, u) {
          this._handlers[c] === void 0 && (this._handlers[c] = []);
          const v = this._handlers[c];
          return v.push(u), { dispose: () => {
            const l = v.indexOf(u);
            l !== -1 && v.splice(l, 1);
          } };
        }
        clearHandler(c) {
          this._handlers[c] && delete this._handlers[c];
        }
        setHandlerFallback(c) {
          this._handlerFb = c;
        }
        dispose() {
          this._handlers = /* @__PURE__ */ Object.create(null), this._handlerFb = () => {
          }, this._active = n;
        }
        reset() {
          if (this._state === 2)
            for (let c = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; c >= 0; --c)
              this._active[c].end(!1);
          this._stack.paused = !1, this._active = n, this._id = -1, this._state = 0;
        }
        _start() {
          if (this._active = this._handlers[this._id] || n, this._active.length)
            for (let c = this._active.length - 1; c >= 0; c--)
              this._active[c].start();
          else
            this._handlerFb(this._id, "START");
        }
        _put(c, u, v) {
          if (this._active.length)
            for (let l = this._active.length - 1; l >= 0; l--)
              this._active[l].put(c, u, v);
          else
            this._handlerFb(this._id, "PUT", (0, f.utf32ToString)(c, u, v));
        }
        start() {
          this.reset(), this._state = 1;
        }
        put(c, u, v) {
          if (this._state !== 3) {
            if (this._state === 1)
              for (; u < v; ) {
                const l = c[u++];
                if (l === 59) {
                  this._state = 2, this._start();
                  break;
                }
                if (l < 48 || 57 < l)
                  return void (this._state = 3);
                this._id === -1 && (this._id = 0), this._id = 10 * this._id + l - 48;
              }
            this._state === 2 && v - u > 0 && this._put(c, u, v);
          }
        }
        end(c, u = !0) {
          if (this._state !== 0) {
            if (this._state !== 3)
              if (this._state === 1 && this._start(), this._active.length) {
                let v = !1, l = this._active.length - 1, e = !1;
                if (this._stack.paused && (l = this._stack.loopPosition - 1, v = u, e = this._stack.fallThrough, this._stack.paused = !1), !e && v === !1) {
                  for (; l >= 0 && (v = this._active[l].end(c), v !== !0); l--)
                    if (v instanceof Promise)
                      return this._stack.paused = !0, this._stack.loopPosition = l, this._stack.fallThrough = !1, v;
                  l--;
                }
                for (; l >= 0; l--)
                  if (v = this._active[l].end(!1), v instanceof Promise)
                    return this._stack.paused = !0, this._stack.loopPosition = l, this._stack.fallThrough = !0, v;
              } else
                this._handlerFb(this._id, "END", c);
            this._active = n, this._id = -1, this._state = 0;
          }
        }
      }, s.OscHandler = class {
        constructor(c) {
          this._handler = c, this._data = "", this._hitLimit = !1;
        }
        start() {
          this._data = "", this._hitLimit = !1;
        }
        put(c, u, v) {
          this._hitLimit || (this._data += (0, f.utf32ToString)(c, u, v), this._data.length > a.PAYLOAD_LIMIT && (this._data = "", this._hitLimit = !0));
        }
        end(c) {
          let u = !1;
          if (this._hitLimit)
            u = !1;
          else if (c && (u = this._handler(this._data), u instanceof Promise))
            return u.then((v) => (this._data = "", this._hitLimit = !1, v));
          return this._data = "", this._hitLimit = !1, u;
        }
      };
    }, 8742: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.Params = void 0;
      const o = 2147483647;
      class a {
        static fromArray(n) {
          const c = new a();
          if (!n.length)
            return c;
          for (let u = Array.isArray(n[0]) ? 1 : 0; u < n.length; ++u) {
            const v = n[u];
            if (Array.isArray(v))
              for (let l = 0; l < v.length; ++l)
                c.addSubParam(v[l]);
            else
              c.addParam(v);
          }
          return c;
        }
        constructor(n = 32, c = 32) {
          if (this.maxLength = n, this.maxSubParamsLength = c, c > 256)
            throw new Error("maxSubParamsLength must not be greater than 256");
          this.params = new Int32Array(n), this.length = 0, this._subParams = new Int32Array(c), this._subParamsLength = 0, this._subParamsIdx = new Uint16Array(n), this._rejectDigits = !1, this._rejectSubDigits = !1, this._digitIsSub = !1;
        }
        clone() {
          const n = new a(this.maxLength, this.maxSubParamsLength);
          return n.params.set(this.params), n.length = this.length, n._subParams.set(this._subParams), n._subParamsLength = this._subParamsLength, n._subParamsIdx.set(this._subParamsIdx), n._rejectDigits = this._rejectDigits, n._rejectSubDigits = this._rejectSubDigits, n._digitIsSub = this._digitIsSub, n;
        }
        toArray() {
          const n = [];
          for (let c = 0; c < this.length; ++c) {
            n.push(this.params[c]);
            const u = this._subParamsIdx[c] >> 8, v = 255 & this._subParamsIdx[c];
            v - u > 0 && n.push(Array.prototype.slice.call(this._subParams, u, v));
          }
          return n;
        }
        reset() {
          this.length = 0, this._subParamsLength = 0, this._rejectDigits = !1, this._rejectSubDigits = !1, this._digitIsSub = !1;
        }
        addParam(n) {
          if (this._digitIsSub = !1, this.length >= this.maxLength)
            this._rejectDigits = !0;
          else {
            if (n < -1)
              throw new Error("values lesser than -1 are not allowed");
            this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength, this.params[this.length++] = n > o ? o : n;
          }
        }
        addSubParam(n) {
          if (this._digitIsSub = !0, this.length)
            if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength)
              this._rejectSubDigits = !0;
            else {
              if (n < -1)
                throw new Error("values lesser than -1 are not allowed");
              this._subParams[this._subParamsLength++] = n > o ? o : n, this._subParamsIdx[this.length - 1]++;
            }
        }
        hasSubParams(n) {
          return (255 & this._subParamsIdx[n]) - (this._subParamsIdx[n] >> 8) > 0;
        }
        getSubParams(n) {
          const c = this._subParamsIdx[n] >> 8, u = 255 & this._subParamsIdx[n];
          return u - c > 0 ? this._subParams.subarray(c, u) : null;
        }
        getSubParamsAll() {
          const n = {};
          for (let c = 0; c < this.length; ++c) {
            const u = this._subParamsIdx[c] >> 8, v = 255 & this._subParamsIdx[c];
            v - u > 0 && (n[c] = this._subParams.slice(u, v));
          }
          return n;
        }
        addDigit(n) {
          let c;
          if (this._rejectDigits || !(c = this._digitIsSub ? this._subParamsLength : this.length) || this._digitIsSub && this._rejectSubDigits)
            return;
          const u = this._digitIsSub ? this._subParams : this.params, v = u[c - 1];
          u[c - 1] = ~v ? Math.min(10 * v + n, o) : n;
        }
      }
      s.Params = a;
    }, 5741: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.AddonManager = void 0, s.AddonManager = class {
        constructor() {
          this._addons = [];
        }
        dispose() {
          for (let o = this._addons.length - 1; o >= 0; o--)
            this._addons[o].instance.dispose();
        }
        loadAddon(o, a) {
          const f = { instance: a, dispose: a.dispose, isDisposed: !1 };
          this._addons.push(f), a.dispose = () => this._wrappedAddonDispose(f), a.activate(o);
        }
        _wrappedAddonDispose(o) {
          if (o.isDisposed)
            return;
          let a = -1;
          for (let f = 0; f < this._addons.length; f++)
            if (this._addons[f] === o) {
              a = f;
              break;
            }
          if (a === -1)
            throw new Error("Could not dispose an addon that has not been loaded");
          o.isDisposed = !0, o.dispose.apply(o.instance), this._addons.splice(a, 1);
        }
      };
    }, 8771: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferApiView = void 0;
      const a = o(3785), f = o(511);
      s.BufferApiView = class {
        constructor(n, c) {
          this._buffer = n, this.type = c;
        }
        init(n) {
          return this._buffer = n, this;
        }
        get cursorY() {
          return this._buffer.y;
        }
        get cursorX() {
          return this._buffer.x;
        }
        get viewportY() {
          return this._buffer.ydisp;
        }
        get baseY() {
          return this._buffer.ybase;
        }
        get length() {
          return this._buffer.lines.length;
        }
        getLine(n) {
          const c = this._buffer.lines.get(n);
          if (c)
            return new a.BufferLineApiView(c);
        }
        getNullCell() {
          return new f.CellData();
        }
      };
    }, 3785: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferLineApiView = void 0;
      const a = o(511);
      s.BufferLineApiView = class {
        constructor(f) {
          this._line = f;
        }
        get isWrapped() {
          return this._line.isWrapped;
        }
        get length() {
          return this._line.length;
        }
        getCell(f, n) {
          if (!(f < 0 || f >= this._line.length))
            return n ? (this._line.loadCell(f, n), n) : this._line.loadCell(f, new a.CellData());
        }
        translateToString(f, n, c) {
          return this._line.translateToString(f, n, c);
        }
      };
    }, 8285: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferNamespaceApi = void 0;
      const a = o(8771), f = o(8460), n = o(844);
      class c extends n.Disposable {
        constructor(v) {
          super(), this._core = v, this._onBufferChange = this.register(new f.EventEmitter()), this.onBufferChange = this._onBufferChange.event, this._normal = new a.BufferApiView(this._core.buffers.normal, "normal"), this._alternate = new a.BufferApiView(this._core.buffers.alt, "alternate"), this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));
        }
        get active() {
          if (this._core.buffers.active === this._core.buffers.normal)
            return this.normal;
          if (this._core.buffers.active === this._core.buffers.alt)
            return this.alternate;
          throw new Error("Active buffer is neither normal nor alternate");
        }
        get normal() {
          return this._normal.init(this._core.buffers.normal);
        }
        get alternate() {
          return this._alternate.init(this._core.buffers.alt);
        }
      }
      s.BufferNamespaceApi = c;
    }, 7975: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.ParserApi = void 0, s.ParserApi = class {
        constructor(o) {
          this._core = o;
        }
        registerCsiHandler(o, a) {
          return this._core.registerCsiHandler(o, (f) => a(f.toArray()));
        }
        addCsiHandler(o, a) {
          return this.registerCsiHandler(o, a);
        }
        registerDcsHandler(o, a) {
          return this._core.registerDcsHandler(o, (f, n) => a(f, n.toArray()));
        }
        addDcsHandler(o, a) {
          return this.registerDcsHandler(o, a);
        }
        registerEscHandler(o, a) {
          return this._core.registerEscHandler(o, a);
        }
        addEscHandler(o, a) {
          return this.registerEscHandler(o, a);
        }
        registerOscHandler(o, a) {
          return this._core.registerOscHandler(o, a);
        }
        addOscHandler(o, a) {
          return this.registerOscHandler(o, a);
        }
      };
    }, 7090: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.UnicodeApi = void 0, s.UnicodeApi = class {
        constructor(o) {
          this._core = o;
        }
        register(o) {
          this._core.unicodeService.register(o);
        }
        get versions() {
          return this._core.unicodeService.versions;
        }
        get activeVersion() {
          return this._core.unicodeService.activeVersion;
        }
        set activeVersion(o) {
          this._core.unicodeService.activeVersion = o;
        }
      };
    }, 744: function(x, s, o) {
      var a = this && this.__decorate || function(e, i, t, r) {
        var h, _ = arguments.length, p = _ < 3 ? i : r === null ? r = Object.getOwnPropertyDescriptor(i, t) : r;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          p = Reflect.decorate(e, i, t, r);
        else
          for (var m = e.length - 1; m >= 0; m--)
            (h = e[m]) && (p = (_ < 3 ? h(p) : _ > 3 ? h(i, t, p) : h(i, t)) || p);
        return _ > 3 && p && Object.defineProperty(i, t, p), p;
      }, f = this && this.__param || function(e, i) {
        return function(t, r) {
          i(t, r, e);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.BufferService = s.MINIMUM_ROWS = s.MINIMUM_COLS = void 0;
      const n = o(8460), c = o(844), u = o(5295), v = o(2585);
      s.MINIMUM_COLS = 2, s.MINIMUM_ROWS = 1;
      let l = s.BufferService = class extends c.Disposable {
        get buffer() {
          return this.buffers.active;
        }
        constructor(e) {
          super(), this.isUserScrolling = !1, this._onResize = this.register(new n.EventEmitter()), this.onResize = this._onResize.event, this._onScroll = this.register(new n.EventEmitter()), this.onScroll = this._onScroll.event, this.cols = Math.max(e.rawOptions.cols || 0, s.MINIMUM_COLS), this.rows = Math.max(e.rawOptions.rows || 0, s.MINIMUM_ROWS), this.buffers = this.register(new u.BufferSet(e, this));
        }
        resize(e, i) {
          this.cols = e, this.rows = i, this.buffers.resize(e, i), this._onResize.fire({ cols: e, rows: i });
        }
        reset() {
          this.buffers.reset(), this.isUserScrolling = !1;
        }
        scroll(e, i = !1) {
          const t = this.buffer;
          let r;
          r = this._cachedBlankLine, r && r.length === this.cols && r.getFg(0) === e.fg && r.getBg(0) === e.bg || (r = t.getBlankLine(e, i), this._cachedBlankLine = r), r.isWrapped = i;
          const h = t.ybase + t.scrollTop, _ = t.ybase + t.scrollBottom;
          if (t.scrollTop === 0) {
            const p = t.lines.isFull;
            _ === t.lines.length - 1 ? p ? t.lines.recycle().copyFrom(r) : t.lines.push(r.clone()) : t.lines.splice(_ + 1, 0, r.clone()), p ? this.isUserScrolling && (t.ydisp = Math.max(t.ydisp - 1, 0)) : (t.ybase++, this.isUserScrolling || t.ydisp++);
          } else {
            const p = _ - h + 1;
            t.lines.shiftElements(h + 1, p - 1, -1), t.lines.set(_, r.clone());
          }
          this.isUserScrolling || (t.ydisp = t.ybase), this._onScroll.fire(t.ydisp);
        }
        scrollLines(e, i, t) {
          const r = this.buffer;
          if (e < 0) {
            if (r.ydisp === 0)
              return;
            this.isUserScrolling = !0;
          } else
            e + r.ydisp >= r.ybase && (this.isUserScrolling = !1);
          const h = r.ydisp;
          r.ydisp = Math.max(Math.min(r.ydisp + e, r.ybase), 0), h !== r.ydisp && (i || this._onScroll.fire(r.ydisp));
        }
      };
      s.BufferService = l = a([f(0, v.IOptionsService)], l);
    }, 7994: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CharsetService = void 0, s.CharsetService = class {
        constructor() {
          this.glevel = 0, this._charsets = [];
        }
        reset() {
          this.charset = void 0, this._charsets = [], this.glevel = 0;
        }
        setgLevel(o) {
          this.glevel = o, this.charset = this._charsets[o];
        }
        setgCharset(o, a) {
          this._charsets[o] = a, this.glevel === o && (this.charset = a);
        }
      };
    }, 1753: function(x, s, o) {
      var a = this && this.__decorate || function(r, h, _, p) {
        var m, d = arguments.length, g = d < 3 ? h : p === null ? p = Object.getOwnPropertyDescriptor(h, _) : p;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          g = Reflect.decorate(r, h, _, p);
        else
          for (var y = r.length - 1; y >= 0; y--)
            (m = r[y]) && (g = (d < 3 ? m(g) : d > 3 ? m(h, _, g) : m(h, _)) || g);
        return d > 3 && g && Object.defineProperty(h, _, g), g;
      }, f = this && this.__param || function(r, h) {
        return function(_, p) {
          h(_, p, r);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CoreMouseService = void 0;
      const n = o(2585), c = o(8460), u = o(844), v = { NONE: { events: 0, restrict: () => !1 }, X10: { events: 1, restrict: (r) => r.button !== 4 && r.action === 1 && (r.ctrl = !1, r.alt = !1, r.shift = !1, !0) }, VT200: { events: 19, restrict: (r) => r.action !== 32 }, DRAG: { events: 23, restrict: (r) => r.action !== 32 || r.button !== 3 }, ANY: { events: 31, restrict: (r) => !0 } };
      function l(r, h) {
        let _ = (r.ctrl ? 16 : 0) | (r.shift ? 4 : 0) | (r.alt ? 8 : 0);
        return r.button === 4 ? (_ |= 64, _ |= r.action) : (_ |= 3 & r.button, 4 & r.button && (_ |= 64), 8 & r.button && (_ |= 128), r.action === 32 ? _ |= 32 : r.action !== 0 || h || (_ |= 3)), _;
      }
      const e = String.fromCharCode, i = { DEFAULT: (r) => {
        const h = [l(r, !1) + 32, r.col + 32, r.row + 32];
        return h[0] > 255 || h[1] > 255 || h[2] > 255 ? "" : `\x1B[M${e(h[0])}${e(h[1])}${e(h[2])}`;
      }, SGR: (r) => {
        const h = r.action === 0 && r.button !== 4 ? "m" : "M";
        return `\x1B[<${l(r, !0)};${r.col};${r.row}${h}`;
      }, SGR_PIXELS: (r) => {
        const h = r.action === 0 && r.button !== 4 ? "m" : "M";
        return `\x1B[<${l(r, !0)};${r.x};${r.y}${h}`;
      } };
      let t = s.CoreMouseService = class extends u.Disposable {
        constructor(r, h) {
          super(), this._bufferService = r, this._coreService = h, this._protocols = {}, this._encodings = {}, this._activeProtocol = "", this._activeEncoding = "", this._lastEvent = null, this._onProtocolChange = this.register(new c.EventEmitter()), this.onProtocolChange = this._onProtocolChange.event;
          for (const _ of Object.keys(v))
            this.addProtocol(_, v[_]);
          for (const _ of Object.keys(i))
            this.addEncoding(_, i[_]);
          this.reset();
        }
        addProtocol(r, h) {
          this._protocols[r] = h;
        }
        addEncoding(r, h) {
          this._encodings[r] = h;
        }
        get activeProtocol() {
          return this._activeProtocol;
        }
        get areMouseEventsActive() {
          return this._protocols[this._activeProtocol].events !== 0;
        }
        set activeProtocol(r) {
          if (!this._protocols[r])
            throw new Error(`unknown protocol "${r}"`);
          this._activeProtocol = r, this._onProtocolChange.fire(this._protocols[r].events);
        }
        get activeEncoding() {
          return this._activeEncoding;
        }
        set activeEncoding(r) {
          if (!this._encodings[r])
            throw new Error(`unknown encoding "${r}"`);
          this._activeEncoding = r;
        }
        reset() {
          this.activeProtocol = "NONE", this.activeEncoding = "DEFAULT", this._lastEvent = null;
        }
        triggerMouseEvent(r) {
          if (r.col < 0 || r.col >= this._bufferService.cols || r.row < 0 || r.row >= this._bufferService.rows || r.button === 4 && r.action === 32 || r.button === 3 && r.action !== 32 || r.button !== 4 && (r.action === 2 || r.action === 3) || (r.col++, r.row++, r.action === 32 && this._lastEvent && this._equalEvents(this._lastEvent, r, this._activeEncoding === "SGR_PIXELS")) || !this._protocols[this._activeProtocol].restrict(r))
            return !1;
          const h = this._encodings[this._activeEncoding](r);
          return h && (this._activeEncoding === "DEFAULT" ? this._coreService.triggerBinaryEvent(h) : this._coreService.triggerDataEvent(h, !0)), this._lastEvent = r, !0;
        }
        explainEvents(r) {
          return { down: !!(1 & r), up: !!(2 & r), drag: !!(4 & r), move: !!(8 & r), wheel: !!(16 & r) };
        }
        _equalEvents(r, h, _) {
          if (_) {
            if (r.x !== h.x || r.y !== h.y)
              return !1;
          } else if (r.col !== h.col || r.row !== h.row)
            return !1;
          return r.button === h.button && r.action === h.action && r.ctrl === h.ctrl && r.alt === h.alt && r.shift === h.shift;
        }
      };
      s.CoreMouseService = t = a([f(0, n.IBufferService), f(1, n.ICoreService)], t);
    }, 6975: function(x, s, o) {
      var a = this && this.__decorate || function(t, r, h, _) {
        var p, m = arguments.length, d = m < 3 ? r : _ === null ? _ = Object.getOwnPropertyDescriptor(r, h) : _;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          d = Reflect.decorate(t, r, h, _);
        else
          for (var g = t.length - 1; g >= 0; g--)
            (p = t[g]) && (d = (m < 3 ? p(d) : m > 3 ? p(r, h, d) : p(r, h)) || d);
        return m > 3 && d && Object.defineProperty(r, h, d), d;
      }, f = this && this.__param || function(t, r) {
        return function(h, _) {
          r(h, _, t);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.CoreService = void 0;
      const n = o(1439), c = o(8460), u = o(844), v = o(2585), l = Object.freeze({ insertMode: !1 }), e = Object.freeze({ applicationCursorKeys: !1, applicationKeypad: !1, bracketedPasteMode: !1, origin: !1, reverseWraparound: !1, sendFocus: !1, wraparound: !0 });
      let i = s.CoreService = class extends u.Disposable {
        constructor(t, r, h) {
          super(), this._bufferService = t, this._logService = r, this._optionsService = h, this.isCursorInitialized = !1, this.isCursorHidden = !1, this._onData = this.register(new c.EventEmitter()), this.onData = this._onData.event, this._onUserInput = this.register(new c.EventEmitter()), this.onUserInput = this._onUserInput.event, this._onBinary = this.register(new c.EventEmitter()), this.onBinary = this._onBinary.event, this._onRequestScrollToBottom = this.register(new c.EventEmitter()), this.onRequestScrollToBottom = this._onRequestScrollToBottom.event, this.modes = (0, n.clone)(l), this.decPrivateModes = (0, n.clone)(e);
        }
        reset() {
          this.modes = (0, n.clone)(l), this.decPrivateModes = (0, n.clone)(e);
        }
        triggerDataEvent(t, r = !1) {
          if (this._optionsService.rawOptions.disableStdin)
            return;
          const h = this._bufferService.buffer;
          r && this._optionsService.rawOptions.scrollOnUserInput && h.ybase !== h.ydisp && this._onRequestScrollToBottom.fire(), r && this._onUserInput.fire(), this._logService.debug(`sending data "${t}"`, () => t.split("").map((_) => _.charCodeAt(0))), this._onData.fire(t);
        }
        triggerBinaryEvent(t) {
          this._optionsService.rawOptions.disableStdin || (this._logService.debug(`sending binary "${t}"`, () => t.split("").map((r) => r.charCodeAt(0))), this._onBinary.fire(t));
        }
      };
      s.CoreService = i = a([f(0, v.IBufferService), f(1, v.ILogService), f(2, v.IOptionsService)], i);
    }, 9074: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.DecorationService = void 0;
      const a = o(8055), f = o(8460), n = o(844), c = o(6106);
      let u = 0, v = 0;
      class l extends n.Disposable {
        get decorations() {
          return this._decorations.values();
        }
        constructor() {
          super(), this._decorations = new c.SortedList((t) => t == null ? void 0 : t.marker.line), this._onDecorationRegistered = this.register(new f.EventEmitter()), this.onDecorationRegistered = this._onDecorationRegistered.event, this._onDecorationRemoved = this.register(new f.EventEmitter()), this.onDecorationRemoved = this._onDecorationRemoved.event, this.register((0, n.toDisposable)(() => this.reset()));
        }
        registerDecoration(t) {
          if (t.marker.isDisposed)
            return;
          const r = new e(t);
          if (r) {
            const h = r.marker.onDispose(() => r.dispose());
            r.onDispose(() => {
              r && (this._decorations.delete(r) && this._onDecorationRemoved.fire(r), h.dispose());
            }), this._decorations.insert(r), this._onDecorationRegistered.fire(r);
          }
          return r;
        }
        reset() {
          for (const t of this._decorations.values())
            t.dispose();
          this._decorations.clear();
        }
        *getDecorationsAtCell(t, r, h) {
          var _, p, m;
          let d = 0, g = 0;
          for (const y of this._decorations.getKeyIterator(r))
            d = (_ = y.options.x) !== null && _ !== void 0 ? _ : 0, g = d + ((p = y.options.width) !== null && p !== void 0 ? p : 1), t >= d && t < g && (!h || ((m = y.options.layer) !== null && m !== void 0 ? m : "bottom") === h) && (yield y);
        }
        forEachDecorationAtCell(t, r, h, _) {
          this._decorations.forEachByKey(r, (p) => {
            var m, d, g;
            u = (m = p.options.x) !== null && m !== void 0 ? m : 0, v = u + ((d = p.options.width) !== null && d !== void 0 ? d : 1), t >= u && t < v && (!h || ((g = p.options.layer) !== null && g !== void 0 ? g : "bottom") === h) && _(p);
          });
        }
      }
      s.DecorationService = l;
      class e extends n.Disposable {
        get isDisposed() {
          return this._isDisposed;
        }
        get backgroundColorRGB() {
          return this._cachedBg === null && (this.options.backgroundColor ? this._cachedBg = a.css.toColor(this.options.backgroundColor) : this._cachedBg = void 0), this._cachedBg;
        }
        get foregroundColorRGB() {
          return this._cachedFg === null && (this.options.foregroundColor ? this._cachedFg = a.css.toColor(this.options.foregroundColor) : this._cachedFg = void 0), this._cachedFg;
        }
        constructor(t) {
          super(), this.options = t, this.onRenderEmitter = this.register(new f.EventEmitter()), this.onRender = this.onRenderEmitter.event, this._onDispose = this.register(new f.EventEmitter()), this.onDispose = this._onDispose.event, this._cachedBg = null, this._cachedFg = null, this.marker = t.marker, this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position && (this.options.overviewRulerOptions.position = "full");
        }
        dispose() {
          this._onDispose.fire(), super.dispose();
        }
      }
    }, 4348: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.InstantiationService = s.ServiceCollection = void 0;
      const a = o(2585), f = o(8343);
      class n {
        constructor(...u) {
          this._entries = /* @__PURE__ */ new Map();
          for (const [v, l] of u)
            this.set(v, l);
        }
        set(u, v) {
          const l = this._entries.get(u);
          return this._entries.set(u, v), l;
        }
        forEach(u) {
          for (const [v, l] of this._entries.entries())
            u(v, l);
        }
        has(u) {
          return this._entries.has(u);
        }
        get(u) {
          return this._entries.get(u);
        }
      }
      s.ServiceCollection = n, s.InstantiationService = class {
        constructor() {
          this._services = new n(), this._services.set(a.IInstantiationService, this);
        }
        setService(c, u) {
          this._services.set(c, u);
        }
        getService(c) {
          return this._services.get(c);
        }
        createInstance(c, ...u) {
          const v = (0, f.getServiceDependencies)(c).sort((i, t) => i.index - t.index), l = [];
          for (const i of v) {
            const t = this._services.get(i.id);
            if (!t)
              throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${i.id}.`);
            l.push(t);
          }
          const e = v.length > 0 ? v[0].index : u.length;
          if (u.length !== e)
            throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e + 1} conflicts with ${u.length} static arguments`);
          return new c(...u, ...l);
        }
      };
    }, 7866: function(x, s, o) {
      var a = this && this.__decorate || function(e, i, t, r) {
        var h, _ = arguments.length, p = _ < 3 ? i : r === null ? r = Object.getOwnPropertyDescriptor(i, t) : r;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          p = Reflect.decorate(e, i, t, r);
        else
          for (var m = e.length - 1; m >= 0; m--)
            (h = e[m]) && (p = (_ < 3 ? h(p) : _ > 3 ? h(i, t, p) : h(i, t)) || p);
        return _ > 3 && p && Object.defineProperty(i, t, p), p;
      }, f = this && this.__param || function(e, i) {
        return function(t, r) {
          i(t, r, e);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.traceCall = s.setTraceLogger = s.LogService = void 0;
      const n = o(844), c = o(2585), u = { trace: c.LogLevelEnum.TRACE, debug: c.LogLevelEnum.DEBUG, info: c.LogLevelEnum.INFO, warn: c.LogLevelEnum.WARN, error: c.LogLevelEnum.ERROR, off: c.LogLevelEnum.OFF };
      let v, l = s.LogService = class extends n.Disposable {
        get logLevel() {
          return this._logLevel;
        }
        constructor(e) {
          super(), this._optionsService = e, this._logLevel = c.LogLevelEnum.OFF, this._updateLogLevel(), this.register(this._optionsService.onSpecificOptionChange("logLevel", () => this._updateLogLevel())), v = this;
        }
        _updateLogLevel() {
          this._logLevel = u[this._optionsService.rawOptions.logLevel];
        }
        _evalLazyOptionalParams(e) {
          for (let i = 0; i < e.length; i++)
            typeof e[i] == "function" && (e[i] = e[i]());
        }
        _log(e, i, t) {
          this._evalLazyOptionalParams(t), e.call(console, (this._optionsService.options.logger ? "" : "xterm.js: ") + i, ...t);
        }
        trace(e, ...i) {
          var t, r;
          this._logLevel <= c.LogLevelEnum.TRACE && this._log((r = (t = this._optionsService.options.logger) === null || t === void 0 ? void 0 : t.trace.bind(this._optionsService.options.logger)) !== null && r !== void 0 ? r : console.log, e, i);
        }
        debug(e, ...i) {
          var t, r;
          this._logLevel <= c.LogLevelEnum.DEBUG && this._log((r = (t = this._optionsService.options.logger) === null || t === void 0 ? void 0 : t.debug.bind(this._optionsService.options.logger)) !== null && r !== void 0 ? r : console.log, e, i);
        }
        info(e, ...i) {
          var t, r;
          this._logLevel <= c.LogLevelEnum.INFO && this._log((r = (t = this._optionsService.options.logger) === null || t === void 0 ? void 0 : t.info.bind(this._optionsService.options.logger)) !== null && r !== void 0 ? r : console.info, e, i);
        }
        warn(e, ...i) {
          var t, r;
          this._logLevel <= c.LogLevelEnum.WARN && this._log((r = (t = this._optionsService.options.logger) === null || t === void 0 ? void 0 : t.warn.bind(this._optionsService.options.logger)) !== null && r !== void 0 ? r : console.warn, e, i);
        }
        error(e, ...i) {
          var t, r;
          this._logLevel <= c.LogLevelEnum.ERROR && this._log((r = (t = this._optionsService.options.logger) === null || t === void 0 ? void 0 : t.error.bind(this._optionsService.options.logger)) !== null && r !== void 0 ? r : console.error, e, i);
        }
      };
      s.LogService = l = a([f(0, c.IOptionsService)], l), s.setTraceLogger = function(e) {
        v = e;
      }, s.traceCall = function(e, i, t) {
        if (typeof t.value != "function")
          throw new Error("not supported");
        const r = t.value;
        t.value = function(...h) {
          if (v.logLevel !== c.LogLevelEnum.TRACE)
            return r.apply(this, h);
          v.trace(`GlyphRenderer#${r.name}(${h.map((p) => JSON.stringify(p)).join(", ")})`);
          const _ = r.apply(this, h);
          return v.trace(`GlyphRenderer#${r.name} return`, _), _;
        };
      };
    }, 7302: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.OptionsService = s.DEFAULT_OPTIONS = void 0;
      const a = o(8460), f = o(844), n = o(6114);
      s.DEFAULT_OPTIONS = { cols: 80, rows: 24, cursorBlink: !1, cursorStyle: "block", cursorWidth: 1, cursorInactiveStyle: "outline", customGlyphs: !0, drawBoldTextInBrightColors: !0, fastScrollModifier: "alt", fastScrollSensitivity: 5, fontFamily: "courier-new, courier, monospace", fontSize: 15, fontWeight: "normal", fontWeightBold: "bold", ignoreBracketedPasteMode: !1, lineHeight: 1, letterSpacing: 0, linkHandler: null, logLevel: "info", logger: null, scrollback: 1e3, scrollOnUserInput: !0, scrollSensitivity: 1, screenReaderMode: !1, smoothScrollDuration: 0, macOptionIsMeta: !1, macOptionClickForcesSelection: !1, minimumContrastRatio: 1, disableStdin: !1, allowProposedApi: !1, allowTransparency: !1, tabStopWidth: 8, theme: {}, rightClickSelectsWord: n.isMac, windowOptions: {}, windowsMode: !1, windowsPty: {}, wordSeparator: " ()[]{}',\"`", altClickMovesCursor: !0, convertEol: !1, termName: "xterm", cancelEvents: !1, overviewRulerWidth: 0 };
      const c = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
      class u extends f.Disposable {
        constructor(l) {
          super(), this._onOptionChange = this.register(new a.EventEmitter()), this.onOptionChange = this._onOptionChange.event;
          const e = Object.assign({}, s.DEFAULT_OPTIONS);
          for (const i in l)
            if (i in e)
              try {
                const t = l[i];
                e[i] = this._sanitizeAndValidateOption(i, t);
              } catch (t) {
                console.error(t);
              }
          this.rawOptions = e, this.options = Object.assign({}, e), this._setupOptions();
        }
        onSpecificOptionChange(l, e) {
          return this.onOptionChange((i) => {
            i === l && e(this.rawOptions[l]);
          });
        }
        onMultipleOptionChange(l, e) {
          return this.onOptionChange((i) => {
            l.indexOf(i) !== -1 && e();
          });
        }
        _setupOptions() {
          const l = (i) => {
            if (!(i in s.DEFAULT_OPTIONS))
              throw new Error(`No option with key "${i}"`);
            return this.rawOptions[i];
          }, e = (i, t) => {
            if (!(i in s.DEFAULT_OPTIONS))
              throw new Error(`No option with key "${i}"`);
            t = this._sanitizeAndValidateOption(i, t), this.rawOptions[i] !== t && (this.rawOptions[i] = t, this._onOptionChange.fire(i));
          };
          for (const i in this.rawOptions) {
            const t = { get: l.bind(this, i), set: e.bind(this, i) };
            Object.defineProperty(this.options, i, t);
          }
        }
        _sanitizeAndValidateOption(l, e) {
          switch (l) {
            case "cursorStyle":
              if (e || (e = s.DEFAULT_OPTIONS[l]), !function(i) {
                return i === "block" || i === "underline" || i === "bar";
              }(e))
                throw new Error(`"${e}" is not a valid value for ${l}`);
              break;
            case "wordSeparator":
              e || (e = s.DEFAULT_OPTIONS[l]);
              break;
            case "fontWeight":
            case "fontWeightBold":
              if (typeof e == "number" && 1 <= e && e <= 1e3)
                break;
              e = c.includes(e) ? e : s.DEFAULT_OPTIONS[l];
              break;
            case "cursorWidth":
              e = Math.floor(e);
            case "lineHeight":
            case "tabStopWidth":
              if (e < 1)
                throw new Error(`${l} cannot be less than 1, value: ${e}`);
              break;
            case "minimumContrastRatio":
              e = Math.max(1, Math.min(21, Math.round(10 * e) / 10));
              break;
            case "scrollback":
              if ((e = Math.min(e, 4294967295)) < 0)
                throw new Error(`${l} cannot be less than 0, value: ${e}`);
              break;
            case "fastScrollSensitivity":
            case "scrollSensitivity":
              if (e <= 0)
                throw new Error(`${l} cannot be less than or equal to 0, value: ${e}`);
              break;
            case "rows":
            case "cols":
              if (!e && e !== 0)
                throw new Error(`${l} must be numeric, value: ${e}`);
              break;
            case "windowsPty":
              e = e != null ? e : {};
          }
          return e;
        }
      }
      s.OptionsService = u;
    }, 2660: function(x, s, o) {
      var a = this && this.__decorate || function(u, v, l, e) {
        var i, t = arguments.length, r = t < 3 ? v : e === null ? e = Object.getOwnPropertyDescriptor(v, l) : e;
        if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
          r = Reflect.decorate(u, v, l, e);
        else
          for (var h = u.length - 1; h >= 0; h--)
            (i = u[h]) && (r = (t < 3 ? i(r) : t > 3 ? i(v, l, r) : i(v, l)) || r);
        return t > 3 && r && Object.defineProperty(v, l, r), r;
      }, f = this && this.__param || function(u, v) {
        return function(l, e) {
          v(l, e, u);
        };
      };
      Object.defineProperty(s, "__esModule", { value: !0 }), s.OscLinkService = void 0;
      const n = o(2585);
      let c = s.OscLinkService = class {
        constructor(u) {
          this._bufferService = u, this._nextId = 1, this._entriesWithId = /* @__PURE__ */ new Map(), this._dataByLinkId = /* @__PURE__ */ new Map();
        }
        registerLink(u) {
          const v = this._bufferService.buffer;
          if (u.id === void 0) {
            const h = v.addMarker(v.ybase + v.y), _ = { data: u, id: this._nextId++, lines: [h] };
            return h.onDispose(() => this._removeMarkerFromLink(_, h)), this._dataByLinkId.set(_.id, _), _.id;
          }
          const l = u, e = this._getEntryIdKey(l), i = this._entriesWithId.get(e);
          if (i)
            return this.addLineToLink(i.id, v.ybase + v.y), i.id;
          const t = v.addMarker(v.ybase + v.y), r = { id: this._nextId++, key: this._getEntryIdKey(l), data: l, lines: [t] };
          return t.onDispose(() => this._removeMarkerFromLink(r, t)), this._entriesWithId.set(r.key, r), this._dataByLinkId.set(r.id, r), r.id;
        }
        addLineToLink(u, v) {
          const l = this._dataByLinkId.get(u);
          if (l && l.lines.every((e) => e.line !== v)) {
            const e = this._bufferService.buffer.addMarker(v);
            l.lines.push(e), e.onDispose(() => this._removeMarkerFromLink(l, e));
          }
        }
        getLinkData(u) {
          var v;
          return (v = this._dataByLinkId.get(u)) === null || v === void 0 ? void 0 : v.data;
        }
        _getEntryIdKey(u) {
          return `${u.id};;${u.uri}`;
        }
        _removeMarkerFromLink(u, v) {
          const l = u.lines.indexOf(v);
          l !== -1 && (u.lines.splice(l, 1), u.lines.length === 0 && (u.data.id !== void 0 && this._entriesWithId.delete(u.key), this._dataByLinkId.delete(u.id)));
        }
      };
      s.OscLinkService = c = a([f(0, n.IBufferService)], c);
    }, 8343: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.createDecorator = s.getServiceDependencies = s.serviceRegistry = void 0;
      const o = "di$target", a = "di$dependencies";
      s.serviceRegistry = /* @__PURE__ */ new Map(), s.getServiceDependencies = function(f) {
        return f[a] || [];
      }, s.createDecorator = function(f) {
        if (s.serviceRegistry.has(f))
          return s.serviceRegistry.get(f);
        const n = function(c, u, v) {
          if (arguments.length !== 3)
            throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
          (function(l, e, i) {
            e[o] === e ? e[a].push({ id: l, index: i }) : (e[a] = [{ id: l, index: i }], e[o] = e);
          })(n, c, v);
        };
        return n.toString = () => f, s.serviceRegistry.set(f, n), n;
      };
    }, 2585: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.IDecorationService = s.IUnicodeService = s.IOscLinkService = s.IOptionsService = s.ILogService = s.LogLevelEnum = s.IInstantiationService = s.ICharsetService = s.ICoreService = s.ICoreMouseService = s.IBufferService = void 0;
      const a = o(8343);
      var f;
      s.IBufferService = (0, a.createDecorator)("BufferService"), s.ICoreMouseService = (0, a.createDecorator)("CoreMouseService"), s.ICoreService = (0, a.createDecorator)("CoreService"), s.ICharsetService = (0, a.createDecorator)("CharsetService"), s.IInstantiationService = (0, a.createDecorator)("InstantiationService"), function(n) {
        n[n.TRACE = 0] = "TRACE", n[n.DEBUG = 1] = "DEBUG", n[n.INFO = 2] = "INFO", n[n.WARN = 3] = "WARN", n[n.ERROR = 4] = "ERROR", n[n.OFF = 5] = "OFF";
      }(f || (s.LogLevelEnum = f = {})), s.ILogService = (0, a.createDecorator)("LogService"), s.IOptionsService = (0, a.createDecorator)("OptionsService"), s.IOscLinkService = (0, a.createDecorator)("OscLinkService"), s.IUnicodeService = (0, a.createDecorator)("UnicodeService"), s.IDecorationService = (0, a.createDecorator)("DecorationService");
    }, 1480: (x, s, o) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.UnicodeService = void 0;
      const a = o(8460), f = o(225);
      s.UnicodeService = class {
        constructor() {
          this._providers = /* @__PURE__ */ Object.create(null), this._active = "", this._onChange = new a.EventEmitter(), this.onChange = this._onChange.event;
          const n = new f.UnicodeV6();
          this.register(n), this._active = n.version, this._activeProvider = n;
        }
        dispose() {
          this._onChange.dispose();
        }
        get versions() {
          return Object.keys(this._providers);
        }
        get activeVersion() {
          return this._active;
        }
        set activeVersion(n) {
          if (!this._providers[n])
            throw new Error(`unknown Unicode version "${n}"`);
          this._active = n, this._activeProvider = this._providers[n], this._onChange.fire(n);
        }
        register(n) {
          this._providers[n.version] = n;
        }
        wcwidth(n) {
          return this._activeProvider.wcwidth(n);
        }
        getStringCellWidth(n) {
          let c = 0;
          const u = n.length;
          for (let v = 0; v < u; ++v) {
            let l = n.charCodeAt(v);
            if (55296 <= l && l <= 56319) {
              if (++v >= u)
                return c + this.wcwidth(l);
              const e = n.charCodeAt(v);
              56320 <= e && e <= 57343 ? l = 1024 * (l - 55296) + e - 56320 + 65536 : c += this.wcwidth(e);
            }
            c += this.wcwidth(l);
          }
          return c;
        }
      };
    } }, W = {};
    function U(x) {
      var s = W[x];
      if (s !== void 0)
        return s.exports;
      var o = W[x] = { exports: {} };
      return I[x].call(o.exports, o, o.exports, U), o.exports;
    }
    var q = {};
    return (() => {
      var x = q;
      Object.defineProperty(x, "__esModule", { value: !0 }), x.Terminal = void 0;
      const s = U(9042), o = U(3236), a = U(844), f = U(5741), n = U(8285), c = U(7975), u = U(7090), v = ["cols", "rows"];
      class l extends a.Disposable {
        constructor(i) {
          super(), this._core = this.register(new o.Terminal(i)), this._addonManager = this.register(new f.AddonManager()), this._publicOptions = Object.assign({}, this._core.options);
          const t = (h) => this._core.options[h], r = (h, _) => {
            this._checkReadonlyOptions(h), this._core.options[h] = _;
          };
          for (const h in this._core.options) {
            const _ = { get: t.bind(this, h), set: r.bind(this, h) };
            Object.defineProperty(this._publicOptions, h, _);
          }
        }
        _checkReadonlyOptions(i) {
          if (v.includes(i))
            throw new Error(`Option "${i}" can only be set in the constructor`);
        }
        _checkProposedApi() {
          if (!this._core.optionsService.rawOptions.allowProposedApi)
            throw new Error("You must set the allowProposedApi option to true to use proposed API");
        }
        get onBell() {
          return this._core.onBell;
        }
        get onBinary() {
          return this._core.onBinary;
        }
        get onCursorMove() {
          return this._core.onCursorMove;
        }
        get onData() {
          return this._core.onData;
        }
        get onKey() {
          return this._core.onKey;
        }
        get onLineFeed() {
          return this._core.onLineFeed;
        }
        get onRender() {
          return this._core.onRender;
        }
        get onResize() {
          return this._core.onResize;
        }
        get onScroll() {
          return this._core.onScroll;
        }
        get onSelectionChange() {
          return this._core.onSelectionChange;
        }
        get onTitleChange() {
          return this._core.onTitleChange;
        }
        get onWriteParsed() {
          return this._core.onWriteParsed;
        }
        get element() {
          return this._core.element;
        }
        get parser() {
          return this._parser || (this._parser = new c.ParserApi(this._core)), this._parser;
        }
        get unicode() {
          return this._checkProposedApi(), new u.UnicodeApi(this._core);
        }
        get textarea() {
          return this._core.textarea;
        }
        get rows() {
          return this._core.rows;
        }
        get cols() {
          return this._core.cols;
        }
        get buffer() {
          return this._buffer || (this._buffer = this.register(new n.BufferNamespaceApi(this._core))), this._buffer;
        }
        get markers() {
          return this._checkProposedApi(), this._core.markers;
        }
        get modes() {
          const i = this._core.coreService.decPrivateModes;
          let t = "none";
          switch (this._core.coreMouseService.activeProtocol) {
            case "X10":
              t = "x10";
              break;
            case "VT200":
              t = "vt200";
              break;
            case "DRAG":
              t = "drag";
              break;
            case "ANY":
              t = "any";
          }
          return { applicationCursorKeysMode: i.applicationCursorKeys, applicationKeypadMode: i.applicationKeypad, bracketedPasteMode: i.bracketedPasteMode, insertMode: this._core.coreService.modes.insertMode, mouseTrackingMode: t, originMode: i.origin, reverseWraparoundMode: i.reverseWraparound, sendFocusMode: i.sendFocus, wraparoundMode: i.wraparound };
        }
        get options() {
          return this._publicOptions;
        }
        set options(i) {
          for (const t in i)
            this._publicOptions[t] = i[t];
        }
        blur() {
          this._core.blur();
        }
        focus() {
          this._core.focus();
        }
        resize(i, t) {
          this._verifyIntegers(i, t), this._core.resize(i, t);
        }
        open(i) {
          this._core.open(i);
        }
        attachCustomKeyEventHandler(i) {
          this._core.attachCustomKeyEventHandler(i);
        }
        registerLinkProvider(i) {
          return this._core.registerLinkProvider(i);
        }
        registerCharacterJoiner(i) {
          return this._checkProposedApi(), this._core.registerCharacterJoiner(i);
        }
        deregisterCharacterJoiner(i) {
          this._checkProposedApi(), this._core.deregisterCharacterJoiner(i);
        }
        registerMarker(i = 0) {
          return this._verifyIntegers(i), this._core.registerMarker(i);
        }
        registerDecoration(i) {
          var t, r, h;
          return this._checkProposedApi(), this._verifyPositiveIntegers((t = i.x) !== null && t !== void 0 ? t : 0, (r = i.width) !== null && r !== void 0 ? r : 0, (h = i.height) !== null && h !== void 0 ? h : 0), this._core.registerDecoration(i);
        }
        hasSelection() {
          return this._core.hasSelection();
        }
        select(i, t, r) {
          this._verifyIntegers(i, t, r), this._core.select(i, t, r);
        }
        getSelection() {
          return this._core.getSelection();
        }
        getSelectionPosition() {
          return this._core.getSelectionPosition();
        }
        clearSelection() {
          this._core.clearSelection();
        }
        selectAll() {
          this._core.selectAll();
        }
        selectLines(i, t) {
          this._verifyIntegers(i, t), this._core.selectLines(i, t);
        }
        dispose() {
          super.dispose();
        }
        scrollLines(i) {
          this._verifyIntegers(i), this._core.scrollLines(i);
        }
        scrollPages(i) {
          this._verifyIntegers(i), this._core.scrollPages(i);
        }
        scrollToTop() {
          this._core.scrollToTop();
        }
        scrollToBottom() {
          this._core.scrollToBottom();
        }
        scrollToLine(i) {
          this._verifyIntegers(i), this._core.scrollToLine(i);
        }
        clear() {
          this._core.clear();
        }
        write(i, t) {
          this._core.write(i, t);
        }
        writeln(i, t) {
          this._core.write(i), this._core.write(`\r
`, t);
        }
        paste(i) {
          this._core.paste(i);
        }
        refresh(i, t) {
          this._verifyIntegers(i, t), this._core.refresh(i, t);
        }
        reset() {
          this._core.reset();
        }
        clearTextureAtlas() {
          this._core.clearTextureAtlas();
        }
        loadAddon(i) {
          this._addonManager.loadAddon(this, i);
        }
        static get strings() {
          return s;
        }
        _verifyIntegers(...i) {
          for (const t of i)
            if (t === 1 / 0 || isNaN(t) || t % 1 != 0)
              throw new Error("This API only accepts integers");
        }
        _verifyPositiveIntegers(...i) {
          for (const t of i)
            if (t && (t === 1 / 0 || isNaN(t) || t % 1 != 0 || t < 0))
              throw new Error("This API only accepts positive integers");
        }
      }
      x.Terminal = l;
    })(), q;
  })());
})(be);
var Te = be.exports, we = { exports: {} };
(function(J, F) {
  (function(I, W) {
    J.exports = W();
  })(self, () => (() => {
    var I = {};
    return (() => {
      var W = I;
      Object.defineProperty(W, "__esModule", { value: !0 }), W.FitAddon = void 0, W.FitAddon = class {
        activate(U) {
          this._terminal = U;
        }
        dispose() {
        }
        fit() {
          const U = this.proposeDimensions();
          if (!U || !this._terminal || isNaN(U.cols) || isNaN(U.rows))
            return;
          const q = this._terminal._core;
          this._terminal.rows === U.rows && this._terminal.cols === U.cols || (q._renderService.clear(), this._terminal.resize(U.cols, U.rows));
        }
        proposeDimensions() {
          if (!this._terminal || !this._terminal.element || !this._terminal.element.parentElement)
            return;
          const U = this._terminal._core, q = U._renderService.dimensions;
          if (q.css.cell.width === 0 || q.css.cell.height === 0)
            return;
          const x = this._terminal.options.scrollback === 0 ? 0 : U.viewport.scrollBarWidth, s = window.getComputedStyle(this._terminal.element.parentElement), o = parseInt(s.getPropertyValue("height")), a = Math.max(0, parseInt(s.getPropertyValue("width"))), f = window.getComputedStyle(this._terminal.element), n = o - (parseInt(f.getPropertyValue("padding-top")) + parseInt(f.getPropertyValue("padding-bottom"))), c = a - (parseInt(f.getPropertyValue("padding-right")) + parseInt(f.getPropertyValue("padding-left"))) - x;
          return { cols: Math.max(2, Math.floor(c / q.css.cell.width)), rows: Math.max(1, Math.floor(n / q.css.cell.height)) };
        }
      };
    })(), I;
  })());
})(we);
var Be = we.exports, Ee = { exports: {} };
(function(J, F) {
  (function(I, W) {
    J.exports = W();
  })(self, () => (() => {
    var I = { 6: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.LinkComputer = s.WebLinkProvider = void 0, s.WebLinkProvider = class {
        constructor(a, f, n, c = {}) {
          this._terminal = a, this._regex = f, this._handler = n, this._options = c;
        }
        provideLinks(a, f) {
          const n = o.computeLink(a, this._regex, this._terminal, this._handler);
          f(this._addCallbacks(n));
        }
        _addCallbacks(a) {
          return a.map((f) => (f.leave = this._options.leave, f.hover = (n, c) => {
            if (this._options.hover) {
              const { range: u } = f;
              this._options.hover(n, c, u);
            }
          }, f));
        }
      };
      class o {
        static computeLink(f, n, c, u) {
          const v = new RegExp(n.source, (n.flags || "") + "g"), [l, e] = o._getWindowedLineStrings(f - 1, c), i = l.join("");
          let t;
          const r = [];
          for (; t = v.exec(i); ) {
            const h = t[0];
            try {
              const y = new URL(h), L = decodeURI(y.toString());
              if (h !== L && h + "/" !== L)
                continue;
            } catch (y) {
              continue;
            }
            const [_, p] = o._mapStrIdx(c, e, 0, t.index), [m, d] = o._mapStrIdx(c, _, p, h.length);
            if (_ === -1 || p === -1 || m === -1 || d === -1)
              continue;
            const g = { start: { x: p + 1, y: _ + 1 }, end: { x: d, y: m + 1 } };
            r.push({ range: g, text: h, activate: u });
          }
          return r;
        }
        static _getWindowedLineStrings(f, n) {
          let c, u = f, v = f, l = 0, e = "";
          const i = [];
          if (c = n.buffer.active.getLine(f)) {
            const t = c.translateToString(!0);
            if (c.isWrapped && t[0] !== " ") {
              for (l = 0; (c = n.buffer.active.getLine(--u)) && l < 2048 && (e = c.translateToString(!0), l += e.length, i.push(e), c.isWrapped && e.indexOf(" ") === -1); )
                ;
              i.reverse();
            }
            for (i.push(t), l = 0; (c = n.buffer.active.getLine(++v)) && c.isWrapped && l < 2048 && (e = c.translateToString(!0), l += e.length, i.push(e), e.indexOf(" ") === -1); )
              ;
          }
          return [i, u];
        }
        static _mapStrIdx(f, n, c, u) {
          const v = f.buffer.active, l = v.getNullCell();
          let e = c;
          for (; u; ) {
            const i = v.getLine(n);
            if (!i)
              return [-1, -1];
            for (let t = e; t < i.length; ++t) {
              i.getCell(t, l);
              const r = l.getChars();
              if (l.getWidth() && (u -= r.length || 1, t === i.length - 1 && r === "")) {
                const h = v.getLine(n + 1);
                h && h.isWrapped && (h.getCell(0, l), l.getWidth() === 2 && (u += 1));
              }
              if (u < 0)
                return [n, t];
            }
            n++, e = 0;
          }
          return [n, e];
        }
      }
      s.LinkComputer = o;
    } }, W = {};
    function U(x) {
      var s = W[x];
      if (s !== void 0)
        return s.exports;
      var o = W[x] = { exports: {} };
      return I[x](o, o.exports, U), o.exports;
    }
    var q = {};
    return (() => {
      var x = q;
      Object.defineProperty(x, "__esModule", { value: !0 }), x.WebLinksAddon = void 0;
      const s = U(6), o = /https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;
      function a(f, n) {
        const c = window.open();
        if (c) {
          try {
            c.opener = null;
          } catch (u) {
          }
          c.location.href = n;
        } else
          console.warn("Opening link blocked as opener could not be cleared");
      }
      x.WebLinksAddon = class {
        constructor(f = a, n = {}) {
          this._handler = f, this._options = n;
        }
        activate(f) {
          this._terminal = f;
          const n = this._options, c = n.urlRegex || o;
          this._linkProvider = this._terminal.registerLinkProvider(new s.WebLinkProvider(this._terminal, c, this._handler, n));
        }
        dispose() {
          var f;
          (f = this._linkProvider) === null || f === void 0 || f.dispose();
        }
      };
    })(), q;
  })());
})(Ee);
var Me = Ee.exports, ke = { exports: {} };
(function(J, F) {
  (function(I, W) {
    J.exports = W();
  })(self, () => (() => {
    var I = { 345: (x, s) => {
      Object.defineProperty(s, "__esModule", { value: !0 }), s.forwardEvent = s.EventEmitter = void 0, s.EventEmitter = class {
        constructor() {
          this._listeners = [], this._disposed = !1;
        }
        get event() {
          return this._event || (this._event = (o) => (this._listeners.push(o), { dispose: () => {
            if (!this._disposed) {
              for (let a = 0; a < this._listeners.length; a++)
                if (this._listeners[a] === o)
                  return void this._listeners.splice(a, 1);
            }
          } })), this._event;
        }
        fire(o, a) {
          const f = [];
          for (let n = 0; n < this._listeners.length; n++)
            f.push(this._listeners[n]);
          for (let n = 0; n < f.length; n++)
            f[n].call(void 0, o, a);
        }
        dispose() {
          this.clearListeners(), this._disposed = !0;
        }
        clearListeners() {
          this._listeners && (this._listeners.length = 0);
        }
      }, s.forwardEvent = function(o, a) {
        return o((f) => a.fire(f));
      };
    }, 859: (x, s) => {
      function o(a) {
        for (const f of a)
          f.dispose();
        a.length = 0;
      }
      Object.defineProperty(s, "__esModule", { value: !0 }), s.getDisposeArrayDisposable = s.disposeArray = s.toDisposable = s.MutableDisposable = s.Disposable = void 0, s.Disposable = class {
        constructor() {
          this._disposables = [], this._isDisposed = !1;
        }
        dispose() {
          this._isDisposed = !0;
          for (const a of this._disposables)
            a.dispose();
          this._disposables.length = 0;
        }
        register(a) {
          return this._disposables.push(a), a;
        }
        unregister(a) {
          const f = this._disposables.indexOf(a);
          f !== -1 && this._disposables.splice(f, 1);
        }
      }, s.MutableDisposable = class {
        constructor() {
          this._isDisposed = !1;
        }
        get value() {
          return this._isDisposed ? void 0 : this._value;
        }
        set value(a) {
          var f;
          this._isDisposed || a === this._value || ((f = this._value) === null || f === void 0 || f.dispose(), this._value = a);
        }
        clear() {
          this.value = void 0;
        }
        dispose() {
          var a;
          this._isDisposed = !0, (a = this._value) === null || a === void 0 || a.dispose(), this._value = void 0;
        }
      }, s.toDisposable = function(a) {
        return { dispose: a };
      }, s.disposeArray = o, s.getDisposeArrayDisposable = function(a) {
        return { dispose: () => o(a) };
      };
    } }, W = {};
    function U(x) {
      var s = W[x];
      if (s !== void 0)
        return s.exports;
      var o = W[x] = { exports: {} };
      return I[x](o, o.exports, U), o.exports;
    }
    var q = {};
    return (() => {
      var x = q;
      Object.defineProperty(x, "__esModule", { value: !0 }), x.SearchAddon = void 0;
      const s = U(345), o = U(859), a = " ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?";
      class f extends o.Disposable {
        constructor(c) {
          var u;
          super(), this._highlightedLines = /* @__PURE__ */ new Set(), this._highlightDecorations = [], this._selectedDecoration = this.register(new o.MutableDisposable()), this._linesCacheTimeoutId = 0, this._onDidChangeResults = this.register(new s.EventEmitter()), this.onDidChangeResults = this._onDidChangeResults.event, this._highlightLimit = (u = c == null ? void 0 : c.highlightLimit) !== null && u !== void 0 ? u : 1e3;
        }
        activate(c) {
          this._terminal = c, this.register(this._terminal.onWriteParsed(() => this._updateMatches())), this.register(this._terminal.onResize(() => this._updateMatches())), this.register((0, o.toDisposable)(() => this.clearDecorations()));
        }
        _updateMatches() {
          var c;
          this._highlightTimeout && window.clearTimeout(this._highlightTimeout), this._cachedSearchTerm && (!((c = this._lastSearchOptions) === null || c === void 0) && c.decorations) && (this._highlightTimeout = setTimeout(() => {
            const u = this._cachedSearchTerm;
            this._cachedSearchTerm = void 0, this.findPrevious(u, Object.assign(Object.assign({}, this._lastSearchOptions), { incremental: !0, noScroll: !0 }));
          }, 200));
        }
        clearDecorations(c) {
          this._selectedDecoration.clear(), (0, o.disposeArray)(this._highlightDecorations), this._highlightDecorations = [], this._highlightedLines.clear(), c || (this._cachedSearchTerm = void 0);
        }
        findNext(c, u) {
          if (!this._terminal)
            throw new Error("Cannot use addon until it has been loaded");
          this._lastSearchOptions = u, u != null && u.decorations && (this._cachedSearchTerm !== void 0 && c === this._cachedSearchTerm || this._highlightAllMatches(c, u));
          const v = this._findNextAndSelect(c, u);
          return this._fireResults(u), this._cachedSearchTerm = c, v;
        }
        _highlightAllMatches(c, u) {
          if (!this._terminal)
            throw new Error("Cannot use addon until it has been loaded");
          if (!c || c.length === 0)
            return void this.clearDecorations();
          u = u || {}, this.clearDecorations(!0);
          const v = [];
          let l, e = this._find(c, 0, 0, u);
          for (; e && ((l == null ? void 0 : l.row) !== e.row || (l == null ? void 0 : l.col) !== e.col) && !(v.length >= this._highlightLimit); )
            l = e, v.push(l), e = this._find(c, l.col + l.term.length >= this._terminal.cols ? l.row + 1 : l.row, l.col + l.term.length >= this._terminal.cols ? 0 : l.col + 1, u);
          for (const i of v) {
            const t = this._createResultDecoration(i, u.decorations);
            t && (this._highlightedLines.add(t.marker.line), this._highlightDecorations.push({ decoration: t, match: i, dispose() {
              t.dispose();
            } }));
          }
        }
        _find(c, u, v, l) {
          var e;
          if (!this._terminal || !c || c.length === 0)
            return (e = this._terminal) === null || e === void 0 || e.clearSelection(), void this.clearDecorations();
          if (v > this._terminal.cols)
            throw new Error(`Invalid col: ${v} to search in terminal of ${this._terminal.cols} cols`);
          let i;
          this._initLinesCache();
          const t = { startRow: u, startCol: v };
          if (i = this._findInLine(c, t, l), !i)
            for (let r = u + 1; r < this._terminal.buffer.active.baseY + this._terminal.rows && (t.startRow = r, t.startCol = 0, i = this._findInLine(c, t, l), !i); r++)
              ;
          return i;
        }
        _findNextAndSelect(c, u) {
          var v;
          if (!this._terminal || !c || c.length === 0)
            return (v = this._terminal) === null || v === void 0 || v.clearSelection(), this.clearDecorations(), !1;
          const l = this._terminal.getSelectionPosition();
          this._terminal.clearSelection();
          let e = 0, i = 0;
          l && (this._cachedSearchTerm === c ? (e = l.end.x, i = l.end.y) : (e = l.start.x, i = l.start.y)), this._initLinesCache();
          const t = { startRow: i, startCol: e };
          let r = this._findInLine(c, t, u);
          if (!r)
            for (let h = i + 1; h < this._terminal.buffer.active.baseY + this._terminal.rows && (t.startRow = h, t.startCol = 0, r = this._findInLine(c, t, u), !r); h++)
              ;
          if (!r && i !== 0)
            for (let h = 0; h < i && (t.startRow = h, t.startCol = 0, r = this._findInLine(c, t, u), !r); h++)
              ;
          return !r && l && (t.startRow = l.start.y, t.startCol = 0, r = this._findInLine(c, t, u)), this._selectResult(r, u == null ? void 0 : u.decorations, u == null ? void 0 : u.noScroll);
        }
        findPrevious(c, u) {
          if (!this._terminal)
            throw new Error("Cannot use addon until it has been loaded");
          this._lastSearchOptions = u, u != null && u.decorations && (this._cachedSearchTerm !== void 0 && c === this._cachedSearchTerm || this._highlightAllMatches(c, u));
          const v = this._findPreviousAndSelect(c, u);
          return this._fireResults(u), this._cachedSearchTerm = c, v;
        }
        _fireResults(c) {
          if (c != null && c.decorations) {
            let u = -1;
            if (this._selectedDecoration.value) {
              const v = this._selectedDecoration.value.match;
              for (let l = 0; l < this._highlightDecorations.length; l++) {
                const e = this._highlightDecorations[l].match;
                if (e.row === v.row && e.col === v.col && e.size === v.size) {
                  u = l;
                  break;
                }
              }
            }
            this._onDidChangeResults.fire({ resultIndex: u, resultCount: this._highlightDecorations.length });
          }
        }
        _findPreviousAndSelect(c, u) {
          var v;
          if (!this._terminal)
            throw new Error("Cannot use addon until it has been loaded");
          if (!this._terminal || !c || c.length === 0)
            return (v = this._terminal) === null || v === void 0 || v.clearSelection(), this.clearDecorations(), !1;
          const l = this._terminal.getSelectionPosition();
          this._terminal.clearSelection();
          let e = this._terminal.buffer.active.baseY + this._terminal.rows - 1, i = this._terminal.cols;
          const t = !0;
          this._initLinesCache();
          const r = { startRow: e, startCol: i };
          let h;
          if (l && (r.startRow = e = l.start.y, r.startCol = i = l.start.x, this._cachedSearchTerm !== c && (h = this._findInLine(c, r, u, !1), h || (r.startRow = e = l.end.y, r.startCol = i = l.end.x))), h || (h = this._findInLine(c, r, u, t)), !h) {
            r.startCol = Math.max(r.startCol, this._terminal.cols);
            for (let _ = e - 1; _ >= 0 && (r.startRow = _, h = this._findInLine(c, r, u, t), !h); _--)
              ;
          }
          if (!h && e !== this._terminal.buffer.active.baseY + this._terminal.rows - 1)
            for (let _ = this._terminal.buffer.active.baseY + this._terminal.rows - 1; _ >= e && (r.startRow = _, h = this._findInLine(c, r, u, t), !h); _--)
              ;
          return this._selectResult(h, u == null ? void 0 : u.decorations, u == null ? void 0 : u.noScroll);
        }
        _initLinesCache() {
          const c = this._terminal;
          this._linesCache || (this._linesCache = new Array(c.buffer.active.length), this._cursorMoveListener = c.onCursorMove(() => this._destroyLinesCache()), this._resizeListener = c.onResize(() => this._destroyLinesCache())), window.clearTimeout(this._linesCacheTimeoutId), this._linesCacheTimeoutId = window.setTimeout(() => this._destroyLinesCache(), 15e3);
        }
        _destroyLinesCache() {
          this._linesCache = void 0, this._cursorMoveListener && (this._cursorMoveListener.dispose(), this._cursorMoveListener = void 0), this._resizeListener && (this._resizeListener.dispose(), this._resizeListener = void 0), this._linesCacheTimeoutId && (window.clearTimeout(this._linesCacheTimeoutId), this._linesCacheTimeoutId = 0);
        }
        _isWholeWord(c, u, v) {
          return (c === 0 || a.includes(u[c - 1])) && (c + v.length === u.length || a.includes(u[c + v.length]));
        }
        _findInLine(c, u, v = {}, l = !1) {
          var e;
          const i = this._terminal, t = u.startRow, r = u.startCol, h = i.buffer.active.getLine(t);
          if (h != null && h.isWrapped)
            return l ? void (u.startCol += i.cols) : (u.startRow--, u.startCol += i.cols, this._findInLine(c, u, v));
          let _ = (e = this._linesCache) === null || e === void 0 ? void 0 : e[t];
          _ || (_ = this._translateBufferLineToStringWithWrap(t, !0), this._linesCache && (this._linesCache[t] = _));
          const [p, m] = _, d = this._bufferColsToStringOffset(t, r), g = v.caseSensitive ? c : c.toLowerCase(), y = v.caseSensitive ? p : p.toLowerCase();
          let L = -1;
          if (v.regex) {
            const b = RegExp(g, "g");
            let k;
            if (l)
              for (; k = b.exec(y.slice(0, d)); )
                L = b.lastIndex - k[0].length, c = k[0], b.lastIndex -= c.length - 1;
            else
              k = b.exec(y.slice(d)), k && k[0].length > 0 && (L = d + (b.lastIndex - k[0].length), c = k[0]);
          } else
            l ? d - g.length >= 0 && (L = y.lastIndexOf(g, d - g.length)) : L = y.indexOf(g, d);
          if (L >= 0) {
            if (v.wholeWord && !this._isWholeWord(L, y, c))
              return;
            let b = 0;
            for (; b < m.length - 1 && L >= m[b + 1]; )
              b++;
            let k = b;
            for (; k < m.length - 1 && L + c.length >= m[k + 1]; )
              k++;
            const A = L - m[b], B = L + c.length - m[k], T = this._stringLengthToBufferSize(t + b, A);
            return { term: c, col: T, row: t + b, size: this._stringLengthToBufferSize(t + k, B) - T + i.cols * (k - b) };
          }
        }
        _stringLengthToBufferSize(c, u) {
          const v = this._terminal.buffer.active.getLine(c);
          if (!v)
            return 0;
          for (let l = 0; l < u; l++) {
            const e = v.getCell(l);
            if (!e)
              break;
            const i = e.getChars();
            i.length > 1 && (u -= i.length - 1);
            const t = v.getCell(l + 1);
            t && t.getWidth() === 0 && u++;
          }
          return u;
        }
        _bufferColsToStringOffset(c, u) {
          const v = this._terminal;
          let l = c, e = 0, i = v.buffer.active.getLine(l);
          for (; u > 0 && i; ) {
            for (let t = 0; t < u && t < v.cols; t++) {
              const r = i.getCell(t);
              if (!r)
                break;
              r.getWidth() && (e += r.getCode() === 0 ? 1 : r.getChars().length);
            }
            if (l++, i = v.buffer.active.getLine(l), i && !i.isWrapped)
              break;
            u -= v.cols;
          }
          return e;
        }
        _translateBufferLineToStringWithWrap(c, u) {
          var v;
          const l = this._terminal, e = [], i = [0];
          let t = l.buffer.active.getLine(c);
          for (; t; ) {
            const r = l.buffer.active.getLine(c + 1), h = !!r && r.isWrapped;
            let _ = t.translateToString(!h && u);
            if (h && r) {
              const p = t.getCell(t.length - 1);
              p && p.getCode() === 0 && p.getWidth() === 1 && ((v = r.getCell(0)) === null || v === void 0 ? void 0 : v.getWidth()) === 2 && (_ = _.slice(0, -1));
            }
            if (e.push(_), !h)
              break;
            i.push(i[i.length - 1] + _.length), c++, t = r;
          }
          return [e.join(""), i];
        }
        _selectResult(c, u, v) {
          const l = this._terminal;
          if (this._selectedDecoration.clear(), !c)
            return l.clearSelection(), !1;
          if (l.select(c.col, c.row, c.size), u) {
            const e = l.registerMarker(-l.buffer.active.baseY - l.buffer.active.cursorY + c.row);
            if (e) {
              const i = l.registerDecoration({ marker: e, x: c.col, width: c.size, backgroundColor: u.activeMatchBackground, layer: "top", overviewRulerOptions: { color: u.activeMatchColorOverviewRuler } });
              if (i) {
                const t = [];
                t.push(e), t.push(i.onRender((r) => this._applyStyles(r, u.activeMatchBorder, !0))), t.push(i.onDispose(() => (0, o.disposeArray)(t))), this._selectedDecoration.value = { decoration: i, match: c, dispose() {
                  i.dispose();
                } };
              }
            }
          }
          if (!v && (c.row >= l.buffer.active.viewportY + l.rows || c.row < l.buffer.active.viewportY)) {
            let e = c.row - l.buffer.active.viewportY;
            e -= Math.floor(l.rows / 2), l.scrollLines(e);
          }
          return !0;
        }
        _applyStyles(c, u, v) {
          c.classList.contains("xterm-find-result-decoration") || (c.classList.add("xterm-find-result-decoration"), u && (c.style.outline = `1px solid ${u}`)), v && c.classList.add("xterm-find-active-result-decoration");
        }
        _createResultDecoration(c, u) {
          const v = this._terminal, l = v.registerMarker(-v.buffer.active.baseY - v.buffer.active.cursorY + c.row);
          if (!l)
            return;
          const e = v.registerDecoration({ marker: l, x: c.col, width: c.size, backgroundColor: u.matchBackground, overviewRulerOptions: this._highlightedLines.has(l.line) ? void 0 : { color: u.matchOverviewRuler, position: "center" } });
          if (e) {
            const i = [];
            i.push(l), i.push(e.onRender((t) => this._applyStyles(t, u.matchBorder, !1))), i.push(e.onDispose(() => (0, o.disposeArray)(i)));
          }
          return e;
        }
      }
      x.SearchAddon = f;
    })(), q;
  })());
})(ke);
var Pe = ke.exports;
class Oe {
  constructor() {
    this.keyPair = null, this.serverPublicKey = null, this.useWebCrypto = this._isSecureContext(), this.microRsa = null, console.log("🔧 EncryptionService constructor:", {
      protocol: window.location.protocol,
      hostname: window.location.hostname,
      isSecureContext: window.isSecureContext,
      hasWebCrypto: !!(window.crypto && window.crypto.subtle),
      useWebCrypto: this.useWebCrypto
    }), this.useWebCrypto ? console.log("✅ Will use Web Crypto API") : console.warn("🔓 HTTP environment detected - will use micro-rsa-dsa-dh fallback");
  }
  /**
   * Kiểm tra có phải secure context không (HTTPS hoặc localhost)
   */
  _isSecureContext() {
    if (typeof window == "undefined")
      return !1;
    const F = !!(window.crypto && window.crypto.subtle), I = window.isSecureContext || window.location.protocol === "https:", W = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "::1";
    if (console.log("🔧 _isSecureContext check:", {
      hasWebCrypto: F,
      isSecure: I,
      isLocalhost: W,
      protocol: window.location.protocol,
      hostname: window.location.hostname
    }), F && (I || W))
      try {
        return window.crypto.subtle.generateKey && window.crypto.subtle.encrypt ? (console.log("✅ Web Crypto API methods are available"), !0) : (console.warn("⚠️ Web Crypto API object exists but methods not available"), !1);
      } catch (U) {
        return console.warn("⚠️ Web Crypto API test failed:", U.message), !1;
      }
    return !I && !W ? (console.warn("🔧 HTTP environment detected - will use micro-rsa-dsa-dh fallback"), !1) : F && (I || W);
  }
  /**
   * Load node-forge khi cần thiết (chỉ cho HTTP)
   */
  _loadNodeForge() {
    return Z(this, null, function* () {
      if (!this.nodeForge)
        try {
          const F = yield import("./index-4a1241cd.mjs").then((I) => I.i);
          this.nodeForge = F.default || F, console.log("✅ node-forge loaded for HTTP environment");
        } catch (F) {
          console.error("❌ Failed to load node-forge from node_modules:", F), console.warn("⚠️ Using mock crypto implementation for testing"), this.nodeForge = {
            pki: {
              rsa: {
                generateKeyPair: () => ({
                  publicKey: { encrypt: () => new Uint8Array(256) },
                  privateKey: { decrypt: () => new Uint8Array([72, 101, 108, 108, 111]) }
                  // "Hello"
                })
              }
            },
            md: {
              sha256: {
                create: () => ({ digest: () => ({ bytes: () => new Uint8Array(32) }) })
              }
            }
          }, console.log("✅ Mock crypto implementation loaded");
        }
      return this.nodeForge;
    });
  }
  /**
   * Generate key pair với node-forge
   */
  _generateNodeForgeKeyPair() {
    return Z(this, null, function* () {
      const F = yield this._loadNodeForge();
      console.log("✅ node-forge loaded successfully");
      try {
        console.log("🔧 Generating RSA key pair with node-forge...");
        const I = F.pki.rsa.generateKeyPair({ bits: 2048 });
        return this.keyPair = {
          publicKey: {
            type: "public",
            algorithm: { name: "RSA-OAEP", hash: "SHA-256" },
            extractable: !0,
            usages: ["encrypt"],
            nodeForge: I.publicKey,
            // Convert to PEM for compatibility
            pem: F.pki.publicKeyToPem(I.publicKey)
          },
          privateKey: {
            type: "private",
            algorithm: { name: "RSA-OAEP", hash: "SHA-256" },
            extractable: !0,
            usages: ["decrypt"],
            nodeForge: I.privateKey,
            // Convert to PEM for compatibility
            pem: F.pki.privateKeyToPem(I.privateKey)
          }
        }, console.log("🔧 RSA key pair generated successfully with node-forge"), this.keyPair;
      } catch (I) {
        throw console.error("❌ Failed to generate key pair with node-forge:", I), new Error("Key generation failed: " + I.message);
      }
    });
  }
  /**
   * Tạo cặp khóa RSA cho client
   */
  generateKeyPair() {
    return Z(this, null, function* () {
      try {
        if (this.useWebCrypto) {
          console.log("🔧 Attempting Web Crypto API key generation...");
          try {
            this.keyPair = yield window.crypto.subtle.generateKey(
              {
                name: "RSA-OAEP",
                modulusLength: 2048,
                publicExponent: new Uint8Array([1, 0, 1]),
                hash: "SHA-256"
              },
              !0,
              ["encrypt", "decrypt"]
            ), console.log("✅ Web Crypto API key generation successful");
          } catch (F) {
            return console.error("❌ Web Crypto API failed in this environment:", F), console.warn("🔄 Falling back to node-forge..."), this.useWebCrypto = !1, yield this._generateNodeForgeKeyPair();
          }
        } else
          return yield this._generateNodeForgeKeyPair();
        return this.keyPair;
      } catch (F) {
        throw console.error("❌ Lỗi tạo key pair:", F), new Error("Không thể tạo key pair");
      }
    });
  }
  /**
   * Xuất public key dưới dạng PEM
   */
  exportPublicKey() {
    return Z(this, arguments, function* (F = this.keyPair) {
      try {
        if (this.useWebCrypto) {
          const I = yield window.crypto.subtle.exportKey(
            "spki",
            F.publicKey
          ), W = String.fromCharCode(...new Uint8Array(I));
          return `-----BEGIN PUBLIC KEY-----
${window.btoa(W)}
-----END PUBLIC KEY-----`;
        } else
          return console.warn("⚠️ Using mock public key export for HTTP testing"), `-----BEGIN PUBLIC KEY-----
${btoa("mock-public-key-data-for-testing")}
-----END PUBLIC KEY-----`;
      } catch (I) {
        throw console.error("❌ Lỗi export public key:", I), new Error("Không thể export public key");
      }
    });
  }
  /**
   * Import public key từ server
   */
  importServerPublicKey(F) {
    return Z(this, null, function* () {
      try {
        const I = F.replace(/\r\n/g, `
`).replace(/\r/g, `
`), W = "-----BEGIN PUBLIC KEY-----", U = "-----END PUBLIC KEY-----";
        if (!I.includes(W) || !I.includes(U))
          throw new Error("Invalid PEM format - missing headers");
        const q = I.indexOf(W) + W.length, x = I.indexOf(U);
        if (q === -1 || x === -1 || q >= x)
          throw new Error("Invalid PEM format - malformed headers");
        const o = I.substring(q, x).replace(/\s+/g, "");
        if (o.length === 0)
          throw new Error("Empty PEM content after cleaning");
        let a;
        try {
          a = window.atob(o);
        } catch (n) {
          throw new Error("Invalid base64 content in PEM");
        }
        const f = new Uint8Array(a.length);
        for (let n = 0; n < a.length; n++)
          f[n] = a.charCodeAt(n);
        return this.useWebCrypto ? (this.serverPublicKey = yield window.crypto.subtle.importKey(
          "spki",
          f.buffer,
          {
            name: "RSA-OAEP",
            hash: "SHA-256"
          },
          !0,
          ["encrypt"]
        ), console.log("🔧 Server public key imported successfully:", this.serverPublicKey)) : (console.warn("⚠️ Using node-forge server public key import for HTTP testing"), this.serverPublicKey = {
          type: "node-forge-server-key",
          pem: F
        }, console.log("✅ Server public key stored for node-forge")), this.serverPublicKey;
      } catch (I) {
        throw console.error("❌ Import server public key error:", I), new Error("Không thể import server public key: " + I.message);
      }
    });
  }
  /**
   * Mã hóa dữ liệu bằng public key của server
   */
  encryptForServer(W) {
    return Z(this, arguments, function* (F, I = this.serverPublicKey) {
      try {
        if (console.log("🔧 encryptForServer called with:", {
          dataLength: F == null ? void 0 : F.length,
          hasPublicKey: !!I,
          useWebCrypto: this.useWebCrypto,
          publicKeyType: typeof I
        }), !I)
          throw new Error("Server public key chưa được import");
        if (this.useWebCrypto) {
          console.log("🔧 Using Web Crypto API for encryption");
          const q = new TextEncoder().encode(F);
          console.log("🔧 Encoded data length:", q.length), console.log("🔧 Public key object:", I);
          const x = yield window.crypto.subtle.encrypt(
            { name: "RSA-OAEP" },
            I,
            q
          );
          console.log("🔧 Encryption successful, result length:", x.byteLength);
          const s = btoa(String.fromCharCode(...new Uint8Array(x)));
          return console.log("🔧 Base64 result length:", s.length), s;
        } else {
          console.warn("⚠️ Using node-forge RSA encryption for HTTP environment");
          try {
            const U = yield this._loadNodeForge();
            if (!I || !I.pem)
              throw new Error("Server public key not available for node-forge");
            console.log("🔧 Attempting node-forge RSA encryption...");
            try {
              const q = U.pki.publicKeyFromPem(I.pem);
              console.log("✅ Successfully parsed RSA public key with node-forge"), console.log("🔧 Encrypting with node-forge RSA-OAEP...");
              const x = q.encrypt(F, "RSA-OAEP", {
                md: U.md.sha256.create(),
                mgf1: {
                  md: U.md.sha256.create()
                }
              }), s = btoa(x);
              return console.log("✅ RSA-OAEP encryption successful with node-forge"), console.log(`🔧 Encrypted data length: ${s.length} chars`), s;
            } catch (q) {
              console.error("❌ Real encryption failed, falling back to mock:", q), console.warn("⚠️ Using mock encryption as fallback");
              const x = new Uint8Array(256);
              if (window.crypto && window.crypto.getRandomValues) {
                window.crypto.getRandomValues(x);
                const o = new TextEncoder().encode(F);
                for (let a = 0; a < o.length && a < x.length; a++)
                  x[a] ^= o[a];
              } else {
                const o = new TextEncoder().encode(F);
                for (let a = 0; a < x.length; a++)
                  x[a] = (o[a % o.length] + a + 42) % 256;
              }
              const s = btoa(String.fromCharCode(...x));
              return console.log("⚠️ Generated mock encryption result"), s;
            }
          } catch (U) {
            throw console.error("❌ node-forge encryption failed:", U), new Error("Không thể mã hóa với node-forge: " + U.message);
          }
        }
      } catch (U) {
        throw console.error("❌ Lỗi mã hóa dữ liệu:", U), console.error("❌ Error stack:", U.stack), new Error("Không thể mã hóa dữ liệu: " + U.message);
      }
    });
  }
  /**
   * Giải mã dữ liệu bằng private key của client
   */
  decryptFromServer(F) {
    return Z(this, null, function* () {
      try {
        if (!this.keyPair)
          throw new Error("Key pair chưa được tạo");
        if (this.useWebCrypto) {
          console.log("🔧 Using Web Crypto API for decryption");
          const I = atob(F), W = new Uint8Array(I.length);
          for (let x = 0; x < I.length; x++)
            W[x] = I.charCodeAt(x);
          const U = yield window.crypto.subtle.decrypt(
            { name: "RSA-OAEP" },
            this.keyPair.privateKey,
            W
          );
          return new TextDecoder().decode(U);
        } else {
          console.log("🔧 Using node-forge for decryption"), yield this._loadNodeForge();
          const I = this.keyPair.privateKey.nodeForge, W = atob(F);
          return I.decrypt(W, "RSA-OAEP", {
            md: forge.md.sha256.create(),
            mgf1: {
              md: forge.md.sha256.create()
            }
          });
        }
      } catch (I) {
        throw console.error("❌ Lỗi giải mã dữ liệu:", I), new Error("Không thể giải mã dữ liệu: " + I.message);
      }
    });
  }
  /**
   * Tạo AES key cho session encryption
   */
  generateAESKey() {
    return Z(this, null, function* () {
      try {
        return yield window.crypto.subtle.generateKey(
          {
            name: "AES-GCM",
            length: 256
          },
          !0,
          ["encrypt", "decrypt"]
        );
      } catch (F) {
        throw console.error("❌ Lỗi tạo AES key:", F), new Error("Không thể tạo AES key");
      }
    });
  }
  /**
   * Mã hóa dữ liệu bằng AES
   */
  encryptAES(F, I) {
    return Z(this, null, function* () {
      try {
        const U = new TextEncoder().encode(F), q = window.crypto.getRandomValues(new Uint8Array(12)), x = yield window.crypto.subtle.encrypt(
          {
            name: "AES-GCM",
            iv: q
          },
          I,
          U
        ), s = new Uint8Array(q.length + x.byteLength);
        return s.set(q), s.set(new Uint8Array(x), q.length), btoa(String.fromCharCode(...s));
      } catch (W) {
        throw console.error("❌ Lỗi mã hóa AES:", W), new Error("Không thể mã hóa AES");
      }
    });
  }
  /**
   * Giải mã dữ liệu AES
   */
  decryptAES(F, I) {
    return Z(this, null, function* () {
      try {
        const W = atob(F), U = new Uint8Array(W.length);
        for (let a = 0; a < W.length; a++)
          U[a] = W.charCodeAt(a);
        const q = U.slice(0, 12), x = U.slice(12), s = yield window.crypto.subtle.decrypt(
          {
            name: "AES-GCM",
            iv: q
          },
          I,
          x
        );
        return new TextDecoder().decode(s);
      } catch (W) {
        throw console.error("❌ Lỗi giải mã AES:", W), new Error("Không thể giải mã AES");
      }
    });
  }
  /**
   * Tạo hash SHA-256
   */
  hash(F) {
    return Z(this, null, function* () {
      try {
        if (this.useWebCrypto) {
          const W = new TextEncoder().encode(F), U = yield window.crypto.subtle.digest("SHA-256", W);
          return Array.from(new Uint8Array(U)).map((x) => x.toString(16).padStart(2, "0")).join("");
        } else if (console.warn("⚠️ Using mock hash for HTTP testing"), window.crypto && window.crypto.getRandomValues) {
          let I = 0;
          for (let U = 0; U < F.length; U++) {
            const q = F.charCodeAt(U);
            I = (I << 5) - I + q, I = I & I;
          }
          return Math.abs(I).toString(16).padStart(8, "0").repeat(8).substring(0, 64);
        } else {
          let I = 0;
          for (let W = 0; W < F.length; W++)
            I = (I << 5) - I + F.charCodeAt(W), I = I & I;
          return Math.abs(I).toString(16).padStart(8, "0").repeat(8).substring(0, 64);
        }
      } catch (I) {
        throw console.error("❌ Lỗi tạo hash:", I), new Error("Không thể tạo hash");
      }
    });
  }
  /**
   * Tạo random string
   */
  generateRandomString(F = 32) {
    if (this.useWebCrypto) {
      const I = new Uint8Array(F);
      return window.crypto.getRandomValues(I), Array.from(I, (W) => W.toString(16).padStart(2, "0")).join("");
    } else {
      console.warn("⚠️ Using Math.random for random generation in HTTP environment");
      let I = "";
      const W = "0123456789abcdef";
      for (let U = 0; U < F * 2; U++)
        I += W.charAt(Math.floor(Math.random() * W.length));
      return I;
    }
  }
}
const Ce = {
  fontSize: 14,
  fontFamily: 'Menlo, Monaco, "Courier New", monospace',
  theme: {
    background: "#000000",
    foreground: "#ffffff",
    cursor: "#ffffff",
    cursorAccent: "#000000",
    selection: "rgba(255, 255, 255, 0.3)"
  },
  cursorBlink: !0,
  cursorStyle: "block",
  scrollback: 1e3,
  allowTransparency: !1,
  tabStopWidth: 8,
  screenReaderMode: !1,
  convertEol: !0,
  disableStdin: !1,
  // Connection options
  reconnection: {
    enabled: !0,
    maxAttempts: 5,
    heartbeatInterval: 3e4
    // 30 seconds
  }
};
function We(J, F, I = {}) {
  var b, k;
  const W = Ae.createContextLogger("Terminal");
  if (!J)
    throw W.error("Container element is required"), new Error("Container element is required");
  let U;
  if (F.computingId && F.userToken) {
    if (U = ne.validateComputingConfig(F), !U.isValid)
      throw W.error("Invalid computing configuration", { errors: U.errors }), new Error(`Computing configuration invalid: ${U.errors.join(", ")}`);
  } else if (U = ne.validateSSHConfig(F), !U.isValid)
    throw W.error("Invalid SSH configuration", { errors: U.errors }), new Error(`SSH configuration invalid: ${U.errors.join(", ")}`);
  const x = ne.validateTerminalOptions(I);
  if (!x.isValid)
    throw W.error("Invalid terminal options", { errors: x.errors }), new Error(`Terminal options invalid: ${x.errors.join(", ")}`);
  const s = ae(ae(ae({}, Ce), I.theme ? { theme: ae(ae({}, Ce.theme), I.theme) } : {}), I), o = I.showConnectionLogs === !0, a = new Te.Terminal(s), f = new Be.FitAddon(), n = new Me.WebLinksAddon(), c = new Pe.SearchAddon();
  a.loadAddon(f), a.loadAddon(n), a.loadAddon(c), a.open(J), setTimeout(() => {
    f.fit();
  }, 0);
  const u = F.wsUrl || "wss://ssh-proxy.dev.longvan.vn";
  if (!ne.isValidWebSocketURL(u))
    throw W.error("Invalid WebSocket URL", { wsUrl: u }), new Error("Invalid WebSocket URL");
  const v = ne.validateSecureConnection(u);
  if (!v.isValid)
    throw W.error("Insecure WebSocket connection", { errors: v.errors }), new Error(`Insecure connection: ${v.errors.join(", ")}`);
  v.warnings && v.warnings.length > 0 && v.warnings.forEach((A) => {
    a.writeln(`⚠️ ${A}`);
  });
  let l = null, e = !1, i = null, t = null, r = 0;
  const h = ((b = s.reconnection) == null ? void 0 : b.maxAttempts) || 5, _ = ((k = s.reconnection) == null ? void 0 : k.enabled) !== !1;
  let p = null, m = !1;
  const d = () => {
    if (m)
      return;
    m = !0, r++;
    const A = Math.min(1e3 * Math.pow(2, r - 1), 3e4);
    a.writeln(`\r
Attempting to reconnect (${r}/${h}) in ${A / 1e3}s...\r
`), p = setTimeout(() => {
      L();
    }, A);
  }, g = () => Z(this, null, function* () {
    try {
      return i = new Oe(), yield i.generateKeyPair(), !0;
    } catch (A) {
      return W.error("Failed to initialize encryption", { error: A.message }), !1;
    }
  }), y = () => Z(this, null, function* () {
    try {
      const A = ne.validateEncryptionReadiness(i, t);
      if (!A.isValid)
        throw new Error(`Encryption not ready: ${A.errors.join(", ")}`);
      let B;
      if (F.computingId && F.userToken) {
        const T = yield i.encryptForServer(F.userToken, t);
        B = {
          type: "encrypted-auth",
          computingId: F.computingId,
          encryptedToken: T,
          clientPublicKey: yield i.exportPublicKey()
        }, o && a.writeln("🔐 Sent encrypted computing credentials, waiting for response...");
      } else {
        const T = yield i.encryptForServer(F.password, t);
        B = {
          type: "encrypted-auth",
          host: F.host,
          username: F.username,
          encryptedPassword: T,
          clientPublicKey: yield i.exportPublicKey()
        }, o && a.writeln("🔐 Sent encrypted SSH credentials, waiting for response...");
      }
      l.send(JSON.stringify(B));
    } catch (A) {
      throw W.error("Failed to send encrypted auth", { error: A.message }), a.writeln(`\r
❌ Encryption failed: ${A.message}\r
`), a.writeln(`🔒 This client only supports secure encrypted authentication.\r
`), a.writeln(`Please ensure the server supports RSA encryption.\r
`), l && l.readyState === WebSocket.OPEN && l.close(1e3, "Encryption required"), A;
    }
  }), L = () => Z(this, null, function* () {
    if (l && l.readyState !== WebSocket.CLOSED && l.close(), o && a.writeln(`🔌 Connecting to ${u}...`), !(yield g())) {
      a.writeln(`\r
❌ Failed to initialize encryption\r
`);
      return;
    }
    try {
      l = new WebSocket(u);
    } catch (B) {
      W.error("Failed to create WebSocket", { error: B.message, wsUrl: u }), a.writeln(`\r
❌ Failed to connect to ${u}: ${B.message}\r
`);
      return;
    }
    l.onopen = () => Z(this, null, function* () {
      e = !0, r = 0, m = !1, o && a.writeln(r > 0 ? `\r
✅ Reconnected to SSH relay server\r
` : "✅ WebSocket connected to " + u), o && a.writeln("🔑 Waiting for server public key...");
    }), l.onmessage = (B) => Z(this, null, function* () {
      try {
        const T = JSON.parse(B.data);
        if (!ne.validateMessageSize(B.data, 5e4)) {
          W.logSecurity("message_too_large", { size: B.data.length });
          return;
        }
        if (T.type === "welcome") {
          try {
            if (T.publicKey)
              t = yield i.importServerPublicKey(T.publicKey), o && a.writeln("🔑 Server public key received"), yield y();
            else {
              a.writeln(`\r
❌ Server does not support encrypted authentication\r
`), a.writeln(`🔒 This client requires RSA encryption for security\r
`), a.writeln(`Please upgrade your server to support encrypted authentication\r
`), l && l.readyState === WebSocket.OPEN && l.close(1e3, "Encryption required");
              return;
            }
          } catch (M) {
            W.error("Failed to process welcome message", { error: M.message }), a.writeln(`\r
❌ Failed to process server welcome: ${M.message}\r
`), a.writeln(`🔒 Cannot establish secure connection\r
`), l && l.readyState === WebSocket.OPEN && l.close(1e3, "Encryption setup failed");
            return;
          }
          return;
        }
        if (T.type === "data")
          try {
            const M = window.atob(T.data), S = new Uint8Array(M.length);
            for (let E = 0; E < M.length; E++)
              S[E] = M.charCodeAt(E);
            const w = new TextDecoder().decode(S);
            a.write(w);
          } catch (M) {
            W.error("Failed to decode terminal data", { error: M.message });
            try {
              a.write(window.atob(T.data));
            } catch (S) {
              a.write(T.data);
            }
          }
        else
          T.type === "error" ? (W.error("Server error received", {
            code: T.code,
            message: T.message
          }), a.writeln(`\r
❌ Error: ${T.message}\r
`)) : T.type === "status" && T.status === "authenticated" ? o && a.writeln(`\r
✅ Connected to ${F.host} as ${F.username}\r
`) : T.type === "status" && T.status === "closed" ? o && a.writeln(`\r
🔌 SSH connection closed\r
`) : T.type === "auth-success" ? (o && a.writeln(`\r
✅ Authentication successful!\r
`), T.host && T.username && (F.host = T.host, F.username = T.username, F.port = T.port || 22)) : T.type === "auth-error" ? (W.logAuth("auth_failed", { message: T.message }), a.writeln(`\r
❌ Authentication failed: ${T.message}\r
`)) : T.type === "ping" || T.type === "pong" || T.type === "resize" || W.warn("Unknown message type received", { type: T.type });
      } catch (T) {
        a.write(B.data);
      }
    }), l.onclose = (B) => {
      if (e = !1, B.code === 1e3) {
        a.writeln(`\r
Connection to SSH relay server closed normally\r
`);
        return;
      }
      const M = {
        1006: "Connection lost (network issue or server restart)",
        1001: "Server going away",
        1002: "Protocol error",
        1003: "Unsupported data type",
        1011: "Server error",
        1012: "Server restart",
        1013: "Server overloaded"
      }[B.code] || `Unknown error (Code: ${B.code})`;
      a.writeln(`\r
Connection to SSH relay server closed: ${M}\r
`), B.reason && a.writeln(`Reason: ${B.reason}\r
`), _ && !m && r < h ? d() : _ && r >= h ? a.writeln(`\r
Max reconnection attempts reached. Please refresh the page or check your connection.\r
`) : _ || a.writeln(`\r
Connection lost. Auto-reconnection is disabled.\r
`);
    }, l.onerror = (B) => {
      e = !1, a.writeln(`\r
WebSocket error: ${B.message || "Unknown error"}\r
`), a.writeln(`\r
Please check if the SSH proxy server is running at ${u}\r
`);
    }, a.onData((B) => {
      if (e && l.readyState === WebSocket.OPEN) {
        if (!ne.validateMessageSize(B, 1e4)) {
          W.warn("Terminal input too large", { size: B.length });
          return;
        }
        let T;
        try {
          const S = new TextEncoder().encode(B), w = String.fromCharCode(...S);
          T = window.btoa(w);
        } catch (S) {
          W.error("Failed to encode terminal data", { error: S.message });
          try {
            T = window.btoa(B);
          } catch (w) {
            const E = B.replace(/[^\x00-\x7F]/g, "?");
            T = window.btoa(E);
          }
        }
        const M = {
          type: "data",
          data: T
        };
        try {
          l.send(JSON.stringify(M));
        } catch (S) {
          W.error("Failed to send terminal data", { error: S.message });
        }
      }
    });
  });
  return setTimeout(() => {
    L();
  }, 100), f.fit(), {
    terminal: a,
    fitAddon: f,
    searchAddon: c,
    reconnect: () => Z(this, null, function* () {
      yield L();
    }),
    resize: () => {
      f.fit();
    },
    dispose: () => {
      p && clearTimeout(p), l && l.close(), a.dispose();
    },
    search: (A, B) => {
      c.findNext(A, B);
    },
    searchPrevious: (A, B) => {
      c.findPrevious(A, B);
    }
  };
}
export {
  We as createTerminal
};