brsh 2.8.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wbt.es.js CHANGED
@@ -572,14 +572,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
572
572
  return e = +e, t >>>= 0, n || U(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
573
573
  };
574
574
  function W(e, t, n, r, i) {
575
- Y(t, r, i, e, n, 7);
575
+ re(t, r, i, e, n, 7);
576
576
  let a = Number(t & BigInt(4294967295));
577
577
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
578
578
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
579
579
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
580
580
  }
581
581
  function G(e, t, n, r, i) {
582
- Y(t, r, i, e, n, 7);
582
+ re(t, r, i, e, n, 7);
583
583
  let a = Number(t & BigInt(4294967295));
584
584
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
585
585
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
@@ -623,21 +623,21 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
623
623
  function K(e, t, n, r, i, a) {
624
624
  if (n + r > e.length || n < 0) throw RangeError("Index out of range");
625
625
  }
626
- function ee(e, t, r, i, a) {
626
+ function q(e, t, r, i, a) {
627
627
  return t = +t, r >>>= 0, a || K(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
628
628
  }
629
629
  u.prototype.writeFloatLE = function(e, t, n) {
630
- return ee(this, e, t, !0, n);
630
+ return q(this, e, t, !0, n);
631
631
  }, u.prototype.writeFloatBE = function(e, t, n) {
632
- return ee(this, e, t, !1, n);
632
+ return q(this, e, t, !1, n);
633
633
  };
634
- function te(e, t, r, i, a) {
634
+ function ee(e, t, r, i, a) {
635
635
  return t = +t, r >>>= 0, a || K(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
636
636
  }
637
637
  u.prototype.writeDoubleLE = function(e, t, n) {
638
- return te(this, e, t, !0, n);
638
+ return ee(this, e, t, !0, n);
639
639
  }, u.prototype.writeDoubleBE = function(e, t, n) {
640
- return te(this, e, t, !1, n);
640
+ return ee(this, e, t, !1, n);
641
641
  }, u.prototype.copy = function(e, t, n, r) {
642
642
  if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
643
643
  if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
@@ -668,9 +668,9 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
668
668
  }
669
669
  return this;
670
670
  };
671
- let q = {};
672
- function ne(e, t, n) {
673
- q[e] = class extends n {
671
+ let J = {};
672
+ function Y(e, t, n) {
673
+ J[e] = class extends n {
674
674
  constructor() {
675
675
  super(), Object.defineProperty(this, "message", {
676
676
  value: t.apply(this, arguments),
@@ -694,34 +694,34 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
694
694
  }
695
695
  };
696
696
  }
697
- ne("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
697
+ Y("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
698
698
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
699
- }, RangeError), ne("ERR_INVALID_ARG_TYPE", function(e, t) {
699
+ }, RangeError), Y("ERR_INVALID_ARG_TYPE", function(e, t) {
700
700
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
701
- }, TypeError), ne("ERR_OUT_OF_RANGE", function(e, t, n) {
701
+ }, TypeError), Y("ERR_OUT_OF_RANGE", function(e, t, n) {
702
702
  let r = `The value of "${e}" is out of range.`, i = n;
703
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = J(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = J(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
703
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = te(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = te(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
704
704
  }, RangeError);
705
- function J(e) {
705
+ function te(e) {
706
706
  let t = "", n = e.length, r = +(e[0] === "-");
707
707
  for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
708
708
  return `${e.slice(0, n)}${t}`;
709
709
  }
710
- function re(e, t, n) {
710
+ function ne(e, t, n) {
711
711
  X(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && Z(t, e.length - (n + 1));
712
712
  }
713
- function Y(e, t, n, r, i, a) {
713
+ function re(e, t, n, r, i, a) {
714
714
  if (e > n || e < t) {
715
715
  let r = typeof t == "bigint" ? "n" : "", i;
716
- throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new q.ERR_OUT_OF_RANGE("value", i, e);
716
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new J.ERR_OUT_OF_RANGE("value", i, e);
717
717
  }
718
- re(r, i, a);
718
+ ne(r, i, a);
719
719
  }
720
720
  function X(e, t) {
721
- if (typeof e != "number") throw new q.ERR_INVALID_ARG_TYPE(t, "number", e);
721
+ if (typeof e != "number") throw new J.ERR_INVALID_ARG_TYPE(t, "number", e);
722
722
  }
723
723
  function Z(e, t, n) {
724
- throw Math.floor(e) === e ? t < 0 ? new q.ERR_BUFFER_OUT_OF_BOUNDS() : new q.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (X(e, n), new q.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
724
+ throw Math.floor(e) === e ? t < 0 ? new J.ERR_BUFFER_OUT_OF_BOUNDS() : new J.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (X(e, n), new J.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
725
725
  }
726
726
  let ie = /[^+/0-9A-Za-z-_]/g;
727
727
  function ae(e) {
@@ -1015,10 +1015,139 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1015
1015
  }
1016
1016
  };
1017
1017
  })), w = /* @__PURE__ */ t(((e, t) => {
1018
- var n = x(), r = C(), i = n.EventEmitter || n.default || n;
1019
- t.exports = class extends i {
1018
+ b();
1019
+ var n = x(), r = n.EventEmitter || n.default || n;
1020
+ function i(e) {
1021
+ if (!e) return [];
1022
+ let t = typeof e == "string" ? e : e instanceof Uint8Array || y !== void 0 && y.isBuffer(e) ? new TextDecoder().decode(e) : String(e), n = [], r = 0;
1023
+ for (; r < t.length;) {
1024
+ let e = t[r], i = t.charCodeAt(r);
1025
+ if (i === 27) {
1026
+ if (t.charCodeAt(r + 1) === 127 || t.charCodeAt(r + 1) === 8) {
1027
+ n.push("^W"), r += 2;
1028
+ continue;
1029
+ }
1030
+ if (t[r + 1] === "[" || t[r + 1] === "O") {
1031
+ let e = r + 2;
1032
+ for (; e < t.length && t.charCodeAt(e) >= 32 && t.charCodeAt(e) <= 63;) e++;
1033
+ if (e < t.length) {
1034
+ let i = t.slice(r + 2, e + 1), a = {
1035
+ A: "ArrowUp",
1036
+ B: "ArrowDown",
1037
+ C: "ArrowRight",
1038
+ D: "ArrowLeft",
1039
+ H: "Home",
1040
+ F: "End",
1041
+ "1~": "Home",
1042
+ "3~": "Delete",
1043
+ "4~": "End",
1044
+ "5~": "PageUp",
1045
+ "6~": "PageDown",
1046
+ "7~": "Home",
1047
+ "8~": "End"
1048
+ };
1049
+ a[i] && n.push(a[i]), r = e + 1;
1050
+ continue;
1051
+ }
1052
+ }
1053
+ n.push("Escape"), r++;
1054
+ continue;
1055
+ }
1056
+ if (i === 13 || i === 10) {
1057
+ n.push("Enter"), i === 13 && t[r + 1] === "\n" && r++, r++;
1058
+ continue;
1059
+ }
1060
+ if (i === 127 || i === 8) {
1061
+ n.push("Backspace"), r++;
1062
+ continue;
1063
+ }
1064
+ if (i === 9) {
1065
+ n.push("Tab"), r++;
1066
+ continue;
1067
+ }
1068
+ if (i >= 1 && i <= 26) {
1069
+ n.push("^" + String.fromCharCode(i + 64)), r++;
1070
+ continue;
1071
+ }
1072
+ n.push(e), r++;
1073
+ }
1074
+ return n;
1075
+ }
1076
+ t.exports = {
1077
+ TtyStream: class extends r {
1078
+ constructor(e = {}) {
1079
+ super(), this.isTTY = e.isTTY !== !1, this.readable = !0, this.writable = !0, this.columns = e.columns || 80, this.rows = e.rows || 24, this.isRaw = !1, this._encoding = null, this._onWrite = e.onWrite || null;
1080
+ }
1081
+ write(e, t, n) {
1082
+ return e == null ? !0 : (typeof this._onWrite == "function" && this._onWrite(e), this.emit("data", this._formatChunk(e)), typeof t == "function" ? t() : typeof n == "function" && n(), !0);
1083
+ }
1084
+ pushData(e) {
1085
+ e != null && this.emit("data", this._formatChunk(e));
1086
+ }
1087
+ _formatChunk(e) {
1088
+ return this._encoding ? typeof e == "string" ? e : e instanceof Uint8Array || y !== void 0 && y.isBuffer(e) ? new TextDecoder().decode(e) : String(e) : e;
1089
+ }
1090
+ setRawMode(e) {
1091
+ return this.isRaw = !!e, this;
1092
+ }
1093
+ setEncoding(e) {
1094
+ return this._encoding = e, this;
1095
+ }
1096
+ getWindowSize() {
1097
+ return [this.columns, this.rows];
1098
+ }
1099
+ resize(e, t) {
1100
+ this.columns = e, this.rows = t, this.emit("resize");
1101
+ }
1102
+ resume() {
1103
+ return this;
1104
+ }
1105
+ pause() {
1106
+ return this;
1107
+ }
1108
+ pipe(e) {
1109
+ return this.on("data", (t) => e.write(t)), e;
1110
+ }
1111
+ unpipe() {
1112
+ return this;
1113
+ }
1114
+ end(e, t, n) {
1115
+ return e != null && this.write(e, typeof t == "string" ? t : void 0), this.emit("end"), typeof t == "function" ? t() : typeof n == "function" && n(), this;
1116
+ }
1117
+ destroy() {
1118
+ this.removeAllListeners();
1119
+ }
1120
+ toString() {
1121
+ return "";
1122
+ }
1123
+ valueOf() {
1124
+ return "";
1125
+ }
1126
+ },
1127
+ parseVtKeys: i
1128
+ };
1129
+ })), T = /* @__PURE__ */ t(((e, t) => {
1130
+ var n = x(), r = C(), { TtyStream: i, parseVtKeys: a } = w(), o = n.EventEmitter || n.default || n;
1131
+ t.exports = class extends o {
1020
1132
  constructor(e, t) {
1021
1133
  super(), this.arguments = e, this.result = new r(), this.context = t || null;
1134
+ let n = this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, o = this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
1135
+ this.stdinStream = new i({
1136
+ columns: n,
1137
+ rows: o
1138
+ }), this.stdin = this.stdinStream, this.stdout = new i({
1139
+ columns: n,
1140
+ rows: o,
1141
+ onWrite: (e) => this.emit("stdout", e)
1142
+ }), this.stderr = new i({
1143
+ columns: n,
1144
+ rows: o,
1145
+ onWrite: (e) => this.emit("stderr", e)
1146
+ }), this.stdinStream.on("data", (e) => {
1147
+ if (!this.captureInput) return;
1148
+ let t = a(e);
1149
+ for (let e of t) !this.interactive && !this.stdinStream.isRaw && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
1150
+ });
1022
1151
  }
1023
1152
  get name() {
1024
1153
  return "unnamed";
@@ -1046,15 +1175,15 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1046
1175
  this.emit("flush", this.result.flush());
1047
1176
  }
1048
1177
  };
1049
- })), T = /* @__PURE__ */ t(((e, t) => {
1050
- var n = w();
1178
+ })), E = /* @__PURE__ */ t(((e, t) => {
1179
+ var n = T();
1051
1180
  t.exports = class extends n {
1052
1181
  constructor(e, t) {
1053
1182
  super(e, t);
1054
1183
  }
1055
1184
  };
1056
- })), E = /* @__PURE__ */ t(((e, t) => {
1057
- var n = T();
1185
+ })), D = /* @__PURE__ */ t(((e, t) => {
1186
+ var n = E();
1058
1187
  function r(e) {
1059
1188
  return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
1060
1189
  }
@@ -1219,7 +1348,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1219
1348
  }
1220
1349
  _executeNode(e) {
1221
1350
  if (e.type === "function") {
1222
- let t = e.name, n = e.bodyLines, r = this, i = T(), a = class extends i {
1351
+ let t = e.name, n = e.bodyLines, r = this, i = E(), a = class extends i {
1223
1352
  static get name() {
1224
1353
  return t;
1225
1354
  }
@@ -1419,7 +1548,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1419
1548
  }
1420
1549
  }
1421
1550
  }, t.exports.isKnownInterpreter = r;
1422
- })), D = /* @__PURE__ */ t(((e, t) => {
1551
+ })), O = /* @__PURE__ */ t(((e, t) => {
1423
1552
  b();
1424
1553
  var n = new Set([
1425
1554
  "getFileByPath",
@@ -1497,90 +1626,90 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1497
1626
  }));
1498
1627
  //#endregion
1499
1628
  //#region node_modules/vite-plugin-node-polyfills/shims/process/dist/index.js
1500
- function O(e) {
1629
+ function k(e) {
1501
1630
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1502
1631
  }
1503
- function k() {
1632
+ function A() {
1504
1633
  throw Error("setTimeout has not been defined");
1505
1634
  }
1506
- function A() {
1635
+ function j() {
1507
1636
  throw Error("clearTimeout has not been defined");
1508
1637
  }
1509
- function j(e) {
1510
- if (z === setTimeout) return setTimeout(e, 0);
1511
- if ((z === k || !z) && setTimeout) return z = setTimeout, setTimeout(e, 0);
1638
+ function M(e) {
1639
+ if (B === setTimeout) return setTimeout(e, 0);
1640
+ if ((B === A || !B) && setTimeout) return B = setTimeout, setTimeout(e, 0);
1512
1641
  try {
1513
- return z(e, 0);
1642
+ return B(e, 0);
1514
1643
  } catch {
1515
1644
  try {
1516
- return z.call(null, e, 0);
1645
+ return B.call(null, e, 0);
1517
1646
  } catch {
1518
- return z.call(this, e, 0);
1647
+ return B.call(this, e, 0);
1519
1648
  }
1520
1649
  }
1521
1650
  }
1522
- function M(e) {
1523
- if (B === clearTimeout) return clearTimeout(e);
1524
- if ((B === A || !B) && clearTimeout) return B = clearTimeout, clearTimeout(e);
1651
+ function N(e) {
1652
+ if (V === clearTimeout) return clearTimeout(e);
1653
+ if ((V === j || !V) && clearTimeout) return V = clearTimeout, clearTimeout(e);
1525
1654
  try {
1526
- return B(e);
1655
+ return V(e);
1527
1656
  } catch {
1528
1657
  try {
1529
- return B.call(null, e);
1658
+ return V.call(null, e);
1530
1659
  } catch {
1531
- return B.call(this, e);
1660
+ return V.call(this, e);
1532
1661
  }
1533
1662
  }
1534
1663
  }
1535
- function N() {
1536
- !H || !U || (H = !1, U.length ? V = U.concat(V) : W = -1, V.length && P());
1537
- }
1538
1664
  function P() {
1539
- if (!H) {
1540
- var e = j(N);
1541
- H = !0;
1542
- for (var t = V.length; t;) {
1543
- for (U = V, V = []; ++W < t;) U && U[W].run();
1544
- W = -1, t = V.length;
1545
- }
1546
- U = null, H = !1, M(e);
1665
+ !U || !W || (U = !1, W.length ? H = W.concat(H) : G = -1, H.length && F());
1666
+ }
1667
+ function F() {
1668
+ if (!U) {
1669
+ var e = M(P);
1670
+ U = !0;
1671
+ for (var t = H.length; t;) {
1672
+ for (W = H, H = []; ++G < t;) W && W[G].run();
1673
+ G = -1, t = H.length;
1674
+ }
1675
+ W = null, U = !1, N(e);
1547
1676
  }
1548
1677
  }
1549
- function F(e, t) {
1678
+ function I(e, t) {
1550
1679
  this.fun = e, this.array = t;
1551
1680
  }
1552
- function I() {}
1553
- var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1554
- L = { exports: {} }, R = L.exports = {}, (function() {
1681
+ function L() {}
1682
+ var R, z, B, V, H, U, W, G, K, q, ee = e((() => {
1683
+ R = { exports: {} }, z = R.exports = {}, (function() {
1555
1684
  try {
1556
- z = typeof setTimeout == "function" ? setTimeout : k;
1685
+ B = typeof setTimeout == "function" ? setTimeout : A;
1557
1686
  } catch {
1558
- z = k;
1687
+ B = A;
1559
1688
  }
1560
1689
  try {
1561
- B = typeof clearTimeout == "function" ? clearTimeout : A;
1690
+ V = typeof clearTimeout == "function" ? clearTimeout : j;
1562
1691
  } catch {
1563
- B = A;
1692
+ V = j;
1564
1693
  }
1565
- })(), V = [], H = !1, W = -1, R.nextTick = function(e) {
1694
+ })(), H = [], U = !1, G = -1, z.nextTick = function(e) {
1566
1695
  var t = Array(arguments.length - 1);
1567
1696
  if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
1568
- V.push(new F(e, t)), V.length === 1 && !H && j(P);
1569
- }, F.prototype.run = function() {
1697
+ H.push(new I(e, t)), H.length === 1 && !U && M(F);
1698
+ }, I.prototype.run = function() {
1570
1699
  this.fun.apply(null, this.array);
1571
- }, R.title = "browser", R.browser = !0, R.env = {}, R.argv = [], R.version = "", R.versions = {}, R.on = I, R.addListener = I, R.once = I, R.off = I, R.removeListener = I, R.removeAllListeners = I, R.emit = I, R.prependListener = I, R.prependOnceListener = I, R.listeners = function(e) {
1700
+ }, z.title = "browser", z.browser = !0, z.env = {}, z.argv = [], z.version = "", z.versions = {}, z.on = L, z.addListener = L, z.once = L, z.off = L, z.removeListener = L, z.removeAllListeners = L, z.emit = L, z.prependListener = L, z.prependOnceListener = L, z.listeners = function(e) {
1572
1701
  return [];
1573
- }, R.binding = function(e) {
1702
+ }, z.binding = function(e) {
1574
1703
  throw Error("process.binding is not supported");
1575
- }, R.cwd = function() {
1704
+ }, z.cwd = function() {
1576
1705
  return "/";
1577
- }, R.chdir = function(e) {
1706
+ }, z.chdir = function(e) {
1578
1707
  throw Error("process.chdir is not supported");
1579
- }, R.umask = function() {
1708
+ }, z.umask = function() {
1580
1709
  return 0;
1581
- }, G = L.exports, K = /* @__PURE__ */ O(G);
1582
- })), te = /* @__PURE__ */ t(((e, t) => {
1583
- var n = w();
1710
+ }, K = R.exports, q = /* @__PURE__ */ k(K);
1711
+ })), J = /* @__PURE__ */ t(((e, t) => {
1712
+ var n = T();
1584
1713
  t.exports = class extends n {
1585
1714
  get captureInput() {
1586
1715
  return !0;
@@ -1589,15 +1718,29 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1589
1718
  return !0;
1590
1719
  }
1591
1720
  get terminalSize() {
1592
- return {
1721
+ return this.stdout && this.stdout.columns && this.stdout.rows ? {
1722
+ cols: parseInt(this.context && this.context.getVar && this.context.getVar("COLUMNS"), 10) || this.stdout.columns || 80,
1723
+ rows: parseInt(this.context && this.context.getVar && this.context.getVar("LINES"), 10) || this.stdout.rows || 24
1724
+ } : {
1593
1725
  cols: parseInt(this.context.getVar("COLUMNS"), 10) || 80,
1594
1726
  rows: parseInt(this.context.getVar("LINES"), 10) || 24
1595
1727
  };
1596
1728
  }
1729
+ _enterAltScreen() {
1730
+ this._inAltScreen || (this._inAltScreen = !0, this.stdinStream && this.stdinStream.setRawMode(!0), this.stdout && this.stdout.write("\x1B[?1049h\x1B[2J\x1B[H"));
1731
+ }
1732
+ _exitAltScreen() {
1733
+ this._inAltScreen && (this._inAltScreen = !1, this.stdinStream && this.stdinStream.setRawMode(!1), this.stdout && this.stdout.write("\x1B[?1049l\x1B[?25h"));
1734
+ }
1735
+ runCommand() {
1736
+ return this.interactive && this._enterAltScreen(), super.runCommand().finally(() => {
1737
+ this._exitAltScreen();
1738
+ });
1739
+ }
1597
1740
  };
1598
- })), q = /* @__PURE__ */ t(((e, t) => {
1741
+ })), Y = /* @__PURE__ */ t(((e, t) => {
1599
1742
  b(), ee();
1600
- var { BinaryFile: n, SymlinkRef: r } = D(), i = new Uint8Array([
1743
+ var { BinaryFile: n, SymlinkRef: r } = O(), i = new Uint8Array([
1601
1744
  66,
1602
1745
  82,
1603
1746
  70,
@@ -1701,7 +1844,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1701
1844
  let t = e.$c;
1702
1845
  if (m[t]) return m[t];
1703
1846
  if (f.inlineCommands && f.inlineCommands[t]) try {
1704
- let e = w(), n = te();
1847
+ let e = T(), n = J();
1705
1848
  return Function("Command", "InteractiveCommand", `return (${f.inlineCommands[t]});`)(e, n);
1706
1849
  } catch {
1707
1850
  return null;
@@ -1733,8 +1876,8 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1733
1876
  let t = new DecompressionStream("gzip"), n = new Blob([e]).stream().pipeThrough(t), r = await new Response(n).arrayBuffer();
1734
1877
  return new Uint8Array(r);
1735
1878
  }
1736
- if (K !== void 0 && typeof K.getBuiltinModule == "function") {
1737
- let t = K.getBuiltinModule("zlib");
1879
+ if (q !== void 0 && typeof q.getBuiltinModule == "function") {
1880
+ let t = q.getBuiltinModule("zlib");
1738
1881
  if (t) return new Uint8Array(t.gunzipSync(y.from(e.buffer, e.byteOffset, e.byteLength)));
1739
1882
  }
1740
1883
  throw Error("Gzip decompression is not supported in this environment");
@@ -1753,8 +1896,8 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1753
1896
  return f(new Uint8Array(n), t);
1754
1897
  }
1755
1898
  if (typeof e == "string") {
1756
- if (!/^https?:\/\//i.test(e) && K !== void 0 && typeof K.getBuiltinModule == "function" && typeof window > "u") try {
1757
- let n = K.getBuiltinModule("fs");
1899
+ if (!/^https?:\/\//i.test(e) && q !== void 0 && typeof q.getBuiltinModule == "function" && typeof window > "u") try {
1900
+ let n = q.getBuiltinModule("fs");
1758
1901
  if (n && n.existsSync(e)) {
1759
1902
  let r = await n.promises.readFile(e);
1760
1903
  return f(new Uint8Array(r.buffer, r.byteOffset, r.byteLength), t);
@@ -1866,9 +2009,9 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1866
2009
  }
1867
2010
  }
1868
2011
  };
1869
- })), ne = /* @__PURE__ */ t(((e, t) => {
2012
+ })), te = /* @__PURE__ */ t(((e, t) => {
1870
2013
  b();
1871
- var n = D(), { BinaryFile: r, SymlinkRef: i } = n;
2014
+ var n = O(), { BinaryFile: r, SymlinkRef: i } = n;
1872
2015
  function a(e) {
1873
2016
  for (let t of Object.keys(e)) {
1874
2017
  let n = e[t];
@@ -1891,20 +2034,20 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
1891
2034
  t.exports = class extends n {
1892
2035
  constructor(e = "/", t = {}, n = {}, r = null) {
1893
2036
  if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
1894
- let { deserializeBinaryFilesystem: e } = q(), r = e(t);
2037
+ let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
1895
2038
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1896
2039
  } else if (t && typeof t == "object" && t.filesystem && (t.filesystem instanceof Uint8Array || typeof t.filesystem == "object") && (n = Object.assign({}, t.permissions || {}, n), t = t.filesystem, t instanceof Uint8Array || t instanceof ArrayBuffer)) {
1897
- let { deserializeBinaryFilesystem: e } = q(), r = e(t);
2040
+ let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
1898
2041
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1899
2042
  }
1900
2043
  a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
1901
2044
  }
1902
2045
  toBinaryContainer(e = {}) {
1903
- let { serializeBinaryFilesystem: t } = q();
2046
+ let { serializeBinaryFilesystem: t } = Y();
1904
2047
  return t(this.fileSystem, this.permissions, e);
1905
2048
  }
1906
2049
  static fromBinaryContainer(e, t = {}) {
1907
- let { deserializeBinaryFilesystem: n } = q();
2050
+ let { deserializeBinaryFilesystem: n } = Y();
1908
2051
  return n(e, t);
1909
2052
  }
1910
2053
  getFileByPath(e) {
@@ -2082,7 +2225,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2082
2225
  return null;
2083
2226
  }
2084
2227
  }, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
2085
- })), J = /* @__PURE__ */ t(((e, t) => {
2228
+ })), ne = /* @__PURE__ */ t(((e, t) => {
2086
2229
  t.exports = null;
2087
2230
  })), re = /* @__PURE__ */ t(((e, t) => {
2088
2231
  ee();
@@ -2123,7 +2266,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2123
2266
  resolve: function() {
2124
2267
  for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
2125
2268
  var o;
2126
- a >= 0 ? o = arguments[a] : (i === void 0 && (i = K.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
2269
+ a >= 0 ? o = arguments[a] : (i === void 0 && (i = q.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
2127
2270
  }
2128
2271
  return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
2129
2272
  },
@@ -2252,9 +2395,9 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2252
2395
  posix: null
2253
2396
  };
2254
2397
  a.posix = a, t.exports = a;
2255
- })), Y = /* @__PURE__ */ t(((e, t) => {
2398
+ })), X = /* @__PURE__ */ t(((e, t) => {
2256
2399
  b();
2257
- var n = E(), { BinaryFile: r } = ne(), i = 0, a = 8, o = 20, s = 28, c = 31, l = 44, u = 54, d = 70, f = 0, p = 2, m = 3, h = 4, g = 1, _ = 2, v = 4, x = 8, S = 1, C = class extends n {
2400
+ var n = D(), { BinaryFile: r } = te(), i = 0, a = 8, o = 20, s = 28, c = 31, l = 44, u = 54, d = 70, f = 0, p = 2, m = 3, h = 4, g = 1, _ = 2, v = 4, x = 8, S = 1, C = class extends n {
2258
2401
  get name() {
2259
2402
  return "wasm";
2260
2403
  }
@@ -2264,7 +2407,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2264
2407
  run() {
2265
2408
  let e = this.script, t = (() => {
2266
2409
  try {
2267
- return J();
2410
+ return ne();
2268
2411
  } catch {
2269
2412
  return null;
2270
2413
  }
@@ -2694,10 +2837,10 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2694
2837
  }
2695
2838
  }
2696
2839
  }, w = /* @__PURE__ */ new Map();
2697
- function D(e, t) {
2840
+ function T(e, t) {
2698
2841
  if (!e || !e.exists(t)) return null;
2699
2842
  if (e.isRealFilesystem) try {
2700
- let n = J();
2843
+ let n = ne();
2701
2844
  return new Uint8Array(n.readFileSync(e.absolutePath(t)));
2702
2845
  } catch {}
2703
2846
  let n = e.getFileByPath(t);
@@ -2726,7 +2869,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2726
2869
  o.set(a);
2727
2870
  let s = new r(o.buffer, i);
2728
2871
  if (e.isRealFilesystem) try {
2729
- let n = J(), r = re(), i = e.absolutePath(t);
2872
+ let n = ne(), r = re(), i = e.absolutePath(t);
2730
2873
  n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
2731
2874
  return;
2732
2875
  } catch {
@@ -2821,7 +2964,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2821
2964
  return u.push(" -h, --help Show this help message and exit"), u.push(" -V, --version Show WebAssembly binary version and exit"), n && n.exports && n.exports.length > 0 && u.push("", `WASM Exports: ${n.exports.join(", ")}`), Array.isArray(t.aliases) && t.aliases.length > 0 && u.push("", `Aliases: ${t.aliases.join(", ")}`), (t.homepage || t.cdnUrl || t.wasmUrl) && u.push(`Source: ${t.homepage || t.cdnUrl || t.wasmUrl}`), u;
2822
2965
  }
2823
2966
  function N(e, t = {}, n = null) {
2824
- let r = T(), i = (n || e.bin || e.name).toLowerCase();
2967
+ let r = E(), i = (n || e.bin || e.name).toLowerCase();
2825
2968
  class a extends r {
2826
2969
  static get name() {
2827
2970
  return i;
@@ -2834,7 +2977,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2834
2977
  }
2835
2978
  async run() {
2836
2979
  let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v"));
2837
- this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? D(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = j(this._persistedWasmBytes));
2980
+ this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? T(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = j(this._persistedWasmBytes));
2838
2981
  try {
2839
2982
  if (e.type === "wasm" && (this._persistedWasmBytes || e.wasmUrl) && !t.moduleLoader) {
2840
2983
  let t = this._persistedWasmBytes || await this._fetchWasmBytes(e.wasmUrl);
@@ -2939,7 +3082,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
2939
3082
  let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
2940
3083
  return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
2941
3084
  },
2942
- readBytes: (e) => D(this.fs, e),
3085
+ readBytes: (e) => T(this.fs, e),
2943
3086
  writeFile: (e, t, n) => {
2944
3087
  if (!this.fs) return;
2945
3088
  let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
@@ -3044,7 +3187,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3044
3187
  }), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
3045
3188
  let a = /* @__PURE__ */ new Set(), o = [];
3046
3189
  for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
3047
- let n = D(this.fs, e);
3190
+ let n = T(this.fs, e);
3048
3191
  n && (await t.writeFile(e, n), a.add(e));
3049
3192
  }
3050
3193
  let s = await t.exec(n);
@@ -3068,7 +3211,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3068
3211
  let n = /* @__PURE__ */ new Set();
3069
3212
  if (!this.fs || !e || typeof e.writeFile != "function") return n;
3070
3213
  for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
3071
- let t = D(this.fs, r);
3214
+ let t = T(this.fs, r);
3072
3215
  if (t) try {
3073
3216
  e.writeFile(r, t), n.add(r);
3074
3217
  } catch {}
@@ -3091,9 +3234,9 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3091
3234
  }
3092
3235
  return a;
3093
3236
  }
3094
- C.readBytesFromFs = D, C.writeBytesToFs = O, C.loadModule = k, C.extractHelpFromText = A, C.inspectWasmBytes = j, C.formatWasmHelp = M, C.createGenericWasmCommand = N, C.createCommand = N, t.exports = C;
3095
- })), X = /* @__PURE__ */ t(((e, t) => {
3096
- var n = te(), { createGenericWasmCommand: r } = Y(), i = "\x1B[2J\x1B[H", a = "\x1B[0m", o = "\x1B[7m", s = "\x1B[1m", c = "\x1B[2m", l = "\x1B[36m", u = "\x1B[31m", d = "\x1B[32m", f = class extends n {
3237
+ C.readBytesFromFs = T, C.writeBytesToFs = O, C.loadModule = k, C.extractHelpFromText = A, C.inspectWasmBytes = j, C.formatWasmHelp = M, C.createGenericWasmCommand = N, C.createCommand = N, t.exports = C;
3238
+ })), Z = /* @__PURE__ */ t(((e, t) => {
3239
+ var n = J(), { createGenericWasmCommand: r } = X(), i = "\x1B[2J\x1B[H", a = "\x1B[0m", o = "\x1B[7m", s = "\x1B[1m", c = "\x1B[2m", l = "\x1B[36m", u = "\x1B[31m", d = "\x1B[32m", f = class extends n {
3097
3240
  get requiresFilesystem() {
3098
3241
  return !0;
3099
3242
  }
@@ -3128,7 +3271,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3128
3271
  }
3129
3272
  async runNonInteractive() {}
3130
3273
  startRepl(e = {}) {
3131
- return this._dynamicReplActive = !0, this._dynamicReplOpts = e, this._dynamicReplBuffer = "", this._dynamicReplMultiline = !1, this._launchInteractiveReplLoop();
3274
+ return this._dynamicReplActive = !0, this._dynamicReplOpts = e, this._dynamicReplBuffer = "", this._dynamicReplMultiline = !1, typeof this._enterAltScreen == "function" && this._enterAltScreen(), this._launchInteractiveReplLoop();
3132
3275
  }
3133
3276
  run() {
3134
3277
  return this.shouldBeInteractive() ? this._launchInteractiveReplLoop() : Promise.resolve(this.runNonInteractive());
@@ -3203,6 +3346,13 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3203
3346
  this._replCursor > 0 && (this._replInput = this._replInput.slice(0, this._replCursor - 1) + this._replInput.slice(this._replCursor), this._replCursor--, this._renderRepl());
3204
3347
  return;
3205
3348
  }
3349
+ if (e === "^W") {
3350
+ let e = this._replCursor;
3351
+ for (; e > 0 && this._replInput[e - 1] === " ";) e--;
3352
+ for (; e > 0 && this._replInput[e - 1] !== " ";) e--;
3353
+ this._replInput = this._replInput.slice(0, e) + this._replInput.slice(this._replCursor), this._replCursor = e, this._renderRepl();
3354
+ return;
3355
+ }
3206
3356
  if (e === "Delete") {
3207
3357
  this._replCursor < this._replInput.length && (this._replInput = this._replInput.slice(0, this._replCursor) + this._replInput.slice(this._replCursor + 1), this._renderRepl());
3208
3358
  return;
@@ -3341,7 +3491,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3341
3491
  return s;
3342
3492
  }
3343
3493
  f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
3344
- })), Z = /* @__PURE__ */ t(((e, t) => {
3494
+ })), ie = /* @__PURE__ */ t(((e, t) => {
3345
3495
  var n = {
3346
3496
  sqlite3: {
3347
3497
  name: "sqlite3",
@@ -3546,7 +3696,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3546
3696
  PACKAGE_ALIASES: r,
3547
3697
  resolvePackageName: i
3548
3698
  };
3549
- })), ie = /* @__PURE__ */ t(((e, t) => {
3699
+ })), ae = /* @__PURE__ */ t(((e, t) => {
3550
3700
  function n(e, t, n = {}) {
3551
3701
  let { showRowCount: r = !0 } = n;
3552
3702
  if (!e || e.length === 0) return [];
@@ -3582,7 +3732,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3582
3732
  }
3583
3733
  return i;
3584
3734
  }
3585
- var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } = Y();
3735
+ var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } = X();
3586
3736
  t.exports = {
3587
3737
  formatTable: n,
3588
3738
  formatPipeList: r,
@@ -3594,9 +3744,9 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
3594
3744
  inspectWasmBytes: l,
3595
3745
  formatWasmHelp: u
3596
3746
  };
3597
- })), ae = /* @__PURE__ */ t(((e, t) => {
3598
- w();
3599
- var n = X(), { readBytesFromFs: r, writeBytesToFs: i, loadModule: a } = ie(), o = "https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K.gguf", s = "https://cdn.jsdelivr.net/npm/@wllama/wllama@3.8.1/src/wasm/wllama.wasm", c = "/var/cache/wllama", l = /* @__PURE__ */ new Map();
3747
+ })), oe = /* @__PURE__ */ t(((e, t) => {
3748
+ T();
3749
+ var n = Z(), { readBytesFromFs: r, writeBytesToFs: i, loadModule: a } = ae(), o = "https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K.gguf", s = "https://cdn.jsdelivr.net/npm/@wllama/wllama@3.8.1/src/wasm/wllama.wasm", c = "/var/cache/wllama", l = /* @__PURE__ */ new Map();
3600
3750
  function u(e) {
3601
3751
  if (!e) return `${c}/model.gguf`;
3602
3752
  if (e.kind === "fs") return e.path;
@@ -4280,9 +4430,9 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
4280
4430
  name: "wllama",
4281
4431
  version: "3.8.1"
4282
4432
  }), t.exports.wllamaInstances = l, t.exports.getDefaultPersistPath = u, t.exports.DEFAULT_PERSIST_DIR = c, t.exports.resolveModelSpec = f, t.exports.formatDownloadProgress = d;
4283
- })), oe = /* @__PURE__ */ t(((e, t) => {
4433
+ })), se = /* @__PURE__ */ t(((e, t) => {
4284
4434
  b();
4285
- var r = T(), i = Y(), a = X(), { DEFAULT_REGISTRY: o, resolvePackageName: s } = Z(), c = ae(), { writeBytesToFs: l, createGenericWasmCommand: u } = i, { createReplWasmCommand: d } = a, f = "/var/lib/wbt/installed.json", p = "/var/cache/wbt";
4435
+ var r = E(), i = X(), a = Z(), { DEFAULT_REGISTRY: o, resolvePackageName: s } = ie(), c = oe(), { writeBytesToFs: l, createGenericWasmCommand: u } = i, { createReplWasmCommand: d } = a, f = "/var/lib/wbt/installed.json", p = "/var/cache/wbt";
4286
4436
  function m(e, t, n = {}) {
4287
4437
  class r extends i {
4288
4438
  static get name() {
@@ -4641,7 +4791,7 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
4641
4791
  return null;
4642
4792
  }
4643
4793
  async _pullPackageWasm(e, t = !1, n = !1) {
4644
- let r = this.constructor._config || {}, i = r.fetch || (typeof fetch == "function" ? fetch : null), { loadModule: a } = ie(), o = null, s = null, c = e.wasmUrl || (/\.(wasm|wat)(\?.*)?$/i.test(e.cdnUrl || "") ? e.cdnUrl : null);
4794
+ let r = this.constructor._config || {}, i = r.fetch || (typeof fetch == "function" ? fetch : null), { loadModule: a } = ae(), o = null, s = null, c = e.wasmUrl || (/\.(wasm|wat)(\?.*)?$/i.test(e.cdnUrl || "") ? e.cdnUrl : null);
4645
4795
  if (c && i) try {
4646
4796
  let n = await i(c);
4647
4797
  n && n.ok ? o = await this._readResponseBytes(n, `${e.name}.wasm`, t) : s = /* @__PURE__ */ Error(`HTTP ${n ? n.status : "error"} fetching ${c}`);
@@ -4930,6 +5080,6 @@ var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
4930
5080
  t.exports = h, t.exports.Wbt = h, t.exports.DEFAULT_REGISTRY = o, t.exports.createGenericWasmCommand = u, t.exports.createReplWasmCommand = d;
4931
5081
  }));
4932
5082
  //#endregion
4933
- export default oe();
5083
+ export default se();
4934
5084
 
4935
5085
  //# sourceMappingURL=wbt.es.js.map