brsh 2.5.0 → 2.5.1

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/shell.es.js CHANGED
@@ -4,2117 +4,2154 @@ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((
4
4
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
5
  }), r, i = e((() => {
6
6
  r = globalThis || self;
7
- })), a = /* @__PURE__ */ t(((e, t) => {
8
- var n = new Set([
9
- "getFileByPath",
10
- "setFileByPath",
11
- "deleteFileByPath",
12
- "exists",
13
- "stat",
14
- "absolutePath",
15
- "getMode",
16
- "setMode",
17
- "isReadable",
18
- "isWritable",
19
- "isExecutable",
20
- "getSize",
21
- "autoComplete",
22
- "isRealFilesystem",
23
- "isSymlink"
24
- ]);
25
- t.exports = class {
26
- isReadable(e) {
27
- let t = this.getMode(e);
28
- return t === null ? !1 : (t & 256) != 0;
29
- }
30
- isWritable(e) {
31
- let t = this.getMode(e);
32
- return t === null ? !1 : (t & 128) != 0;
33
- }
34
- isExecutable(e) {
35
- let t = this.getMode(e);
36
- return t === null ? !1 : (t & 64) != 0;
37
- }
38
- sandbox() {
39
- let e = this;
40
- return new Proxy(Object.create(null), {
41
- get(t, r) {
42
- if (!n.has(r)) return;
43
- let i = e[r];
44
- return typeof i == "function" ? i.bind(e) : i;
45
- },
46
- set() {
47
- return !1;
48
- },
49
- has(e, t) {
50
- return n.has(t);
51
- }
52
- });
53
- }
54
- _triggerChange() {
55
- !this._onChange || this._changeScheduled || (this._changeScheduled = !0, Promise.resolve().then(() => {
56
- this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(this.getRaw(), this.getRawPermissions());
57
- }));
58
- }
59
- };
60
- })), o = /* @__PURE__ */ t(((e, t) => {
61
- var n = a();
62
- t.exports = class extends n {
63
- constructor(e = "/", t = {}, n = {}, r = null) {
64
- super(), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
65
- }
66
- getFileByPath(e) {
67
- let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
68
- return t == null || !this.isReadable(e) ? null : t;
69
- }
70
- _getFileRaw(e) {
71
- return this._getFileByAbsolutePath(this._pathToAbsolute(e));
72
- }
73
- exists(e) {
74
- return this._getFileByAbsolutePath(this._pathToAbsolute(e)) != null;
75
- }
76
- stat(e) {
77
- let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
78
- return t == null ? null : {
79
- isDirectory: t.constructor === Object,
80
- isFile: typeof t == "string",
81
- isCommand: typeof t == "function"
82
- };
83
- }
84
- _pathToAbsolute(e) {
85
- return e.startsWith("./") && (e = e.substring(2)), e.startsWith("/") || (e = this.cwd + e), this._traverseComplexAbsolutePath(e);
86
- }
87
- _traverseComplexAbsolutePath(e) {
88
- let t = e.split("/");
89
- for (; t.includes("..");) {
90
- let e = t.indexOf("..") - 1;
91
- t.splice(e, 2);
7
+ }));
8
+ //#endregion
9
+ //#region node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
10
+ function a(e) {
11
+ var t = e.length;
12
+ if (t % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
13
+ var n = e.indexOf("=");
14
+ n === -1 && (n = t);
15
+ var r = n === t ? 0 : 4 - n % 4;
16
+ return [n, r];
17
+ }
18
+ function o(e) {
19
+ var t = a(e), n = t[0], r = t[1];
20
+ return (n + r) * 3 / 4 - r;
21
+ }
22
+ function s(e, t, n) {
23
+ return (t + n) * 3 / 4 - n;
24
+ }
25
+ function c(e) {
26
+ var t, n = a(e), r = n[0], i = n[1], o = new g(s(e, r, i)), c = 0, l = i > 0 ? r - 4 : r, u;
27
+ for (u = 0; u < l; u += 4) t = h[e.charCodeAt(u)] << 18 | h[e.charCodeAt(u + 1)] << 12 | h[e.charCodeAt(u + 2)] << 6 | h[e.charCodeAt(u + 3)], o[c++] = t >> 16 & 255, o[c++] = t >> 8 & 255, o[c++] = t & 255;
28
+ return i === 2 && (t = h[e.charCodeAt(u)] << 2 | h[e.charCodeAt(u + 1)] >> 4, o[c++] = t & 255), i === 1 && (t = h[e.charCodeAt(u)] << 10 | h[e.charCodeAt(u + 1)] << 4 | h[e.charCodeAt(u + 2)] >> 2, o[c++] = t >> 8 & 255, o[c++] = t & 255), o;
29
+ }
30
+ function l(e) {
31
+ return m[e >> 18 & 63] + m[e >> 12 & 63] + m[e >> 6 & 63] + m[e & 63];
32
+ }
33
+ function u(e, t, n) {
34
+ for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(l(r));
35
+ return i.join("");
36
+ }
37
+ function d(e) {
38
+ for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(u(e, o, o + a > s ? s : o + a));
39
+ return r === 1 ? (t = e[n - 1], i.push(m[t >> 2] + m[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(m[t >> 10] + m[t >> 4 & 63] + m[t << 2 & 63] + "=")), i.join("");
40
+ }
41
+ var f, p, m, h, g, _, v, y, b, x, S = e((() => {
42
+ for (f = {}, p = {}, p.byteLength = o, p.toByteArray = c, p.fromByteArray = d, m = [], h = [], g = typeof Uint8Array < "u" ? Uint8Array : Array, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", v = 0, y = _.length; v < y; ++v) m[v] = _[v], h[_.charCodeAt(v)] = v;
43
+ h[45] = 62, h[95] = 63, b = {}, b.read = function(e, t, n, r, i) {
44
+ var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
45
+ for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
46
+ for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
47
+ if (a === 0) a = 1 - l;
48
+ else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
49
+ else o += 2 ** r, a -= l;
50
+ return (p ? -1 : 1) * o * 2 ** (a - r);
51
+ }, b.write = function(e, t, n, r, i, a) {
52
+ var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = +(t < 0 || t === 0 && 1 / t < 0);
53
+ for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = +!!isNaN(t), o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
54
+ for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
55
+ e[n + p - m] |= h * 128;
56
+ }, (function(e) {
57
+ let t = p, n = b, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
58
+ e.Buffer = u, e.SlowBuffer = C, e.INSPECT_MAX_BYTES = 50;
59
+ let i = 2147483647;
60
+ e.kMaxLength = i;
61
+ let { Uint8Array: a, ArrayBuffer: o, SharedArrayBuffer: s } = globalThis;
62
+ u.TYPED_ARRAY_SUPPORT = c(), !u.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
63
+ function c() {
64
+ try {
65
+ let e = new a(1), t = { foo: function() {
66
+ return 42;
67
+ } };
68
+ return Object.setPrototypeOf(t, a.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
69
+ } catch {
70
+ return !1;
92
71
  }
93
- return t.join("/");
94
72
  }
95
- absolutePath(e) {
96
- return this._pathToAbsolute(e);
97
- }
98
- setFileByPath(e, t, n = !1) {
99
- let r = this._pathToAbsolute(e);
100
- if (this._getFileByAbsolutePath(r) != null) {
101
- if (!this.isWritable(e)) throw Error("Permission denied");
102
- } else {
103
- let e = r.split("/");
104
- e.pop();
105
- let t = e.join("/") || "/", n = this.getMode(t);
106
- if (n !== null && !(n & 128)) throw Error("Permission denied");
73
+ Object.defineProperty(u.prototype, "parent", {
74
+ enumerable: !0,
75
+ get: function() {
76
+ if (u.isBuffer(this)) return this.buffer;
107
77
  }
108
- this._setFileByAbsolutePath(r, t, n), this._triggerChange();
78
+ }), Object.defineProperty(u.prototype, "offset", {
79
+ enumerable: !0,
80
+ get: function() {
81
+ if (u.isBuffer(this)) return this.byteOffset;
82
+ }
83
+ });
84
+ function l(e) {
85
+ if (e > i) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
86
+ let t = new a(e);
87
+ return Object.setPrototypeOf(t, u.prototype), t;
109
88
  }
110
- _setFileRaw(e, t, n = !1) {
111
- let r = this._pathToAbsolute(e);
112
- this._setFileByAbsolutePath(r, t, n), this._triggerChange();
89
+ function u(e, t, n) {
90
+ if (typeof e == "number") {
91
+ if (typeof t == "string") throw TypeError("The \"string\" argument must be of type string. Received type number");
92
+ return h(e);
93
+ }
94
+ return d(e, t, n);
113
95
  }
114
- _setFileByAbsolutePath(e, t, n = !0) {
115
- let r = e.split("/");
116
- r.shift();
117
- let i = r.pop(), a = r.reduce((e, t) => {
118
- if (!e[t]) {
119
- if (!n) throw Error(`${t}: No such file or directory`);
120
- e[t] = {};
121
- }
122
- return e[t];
123
- }, this.fileSystem);
124
- a[i] = t;
96
+ u.poolSize = 8192;
97
+ function d(e, t, n) {
98
+ if (typeof e == "string") return g(e, t);
99
+ if (o.isView(e)) return v(e);
100
+ if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
101
+ if (J(e, o) || e && J(e.buffer, o) || s !== void 0 && (J(e, s) || e && J(e.buffer, s))) return y(e, t, n);
102
+ if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
103
+ let r = e.valueOf && e.valueOf();
104
+ if (r != null && r !== e) return u.from(r, t, n);
105
+ let i = x(e);
106
+ if (i) return i;
107
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") return u.from(e[Symbol.toPrimitive]("string"), t, n);
108
+ throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
125
109
  }
126
- _getFileByAbsolutePath(e) {
127
- let t = e.split("/");
128
- return t.shift(), t[t.length - 1].length < 1 && t.pop(), t.reduce((e, t) => e && e[t] ? e[t] : null, this.fileSystem);
110
+ u.from = function(e, t, n) {
111
+ return d(e, t, n);
112
+ }, Object.setPrototypeOf(u.prototype, a.prototype), Object.setPrototypeOf(u, a);
113
+ function f(e) {
114
+ if (typeof e != "number") throw TypeError("\"size\" argument must be of type number");
115
+ if (e < 0) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
129
116
  }
130
- deleteFileByPath(e) {
131
- let t = this._pathToAbsolute(e), n = t.split("/");
132
- n.pop();
133
- let r = n.join("/") || "/", i = this.getMode(r);
134
- if (i !== null && !(i & 128)) throw Error(`${e}: Permission denied`);
135
- this._deleteByAbsolutePath(t);
136
- let a = t + "/";
137
- Object.keys(this.permissions).forEach((e) => {
138
- (e === t || e.startsWith(a)) && delete this.permissions[e];
139
- }), this._triggerChange();
117
+ function m(e, t, n) {
118
+ return f(e), e <= 0 || t === void 0 ? l(e) : typeof n == "string" ? l(e).fill(t, n) : l(e).fill(t);
140
119
  }
141
- _deleteByAbsolutePath(e) {
142
- let t = e.split("/");
143
- t.shift(), t[t.length - 1] === "" && t.pop();
144
- let n = t.pop();
145
- if (!n) return;
146
- let r = t.reduce((e, t) => e && e[t] ? e[t] : null, this.fileSystem);
147
- r && n in r && delete r[n];
120
+ u.alloc = function(e, t, n) {
121
+ return m(e, t, n);
122
+ };
123
+ function h(e) {
124
+ return f(e), l(e < 0 ? 0 : S(e) | 0);
148
125
  }
149
- getMode(e) {
150
- let t = this._pathToAbsolute(e);
151
- if (this.permissions[t] !== void 0) return this.permissions[t];
152
- let n = this._getFileByAbsolutePath(t);
153
- return n == null ? null : n.constructor === Object ? 493 : typeof n == "function" ? 365 : 420;
126
+ u.allocUnsafe = function(e) {
127
+ return h(e);
128
+ }, u.allocUnsafeSlow = function(e) {
129
+ return h(e);
130
+ };
131
+ function g(e, t) {
132
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !u.isEncoding(t)) throw TypeError("Unknown encoding: " + t);
133
+ let n = w(e, t) | 0, r = l(n), i = r.write(e, t);
134
+ return i !== n && (r = r.slice(0, i)), r;
154
135
  }
155
- setMode(e, t) {
156
- let n = this._pathToAbsolute(e);
157
- this.permissions[n] = t, this._triggerChange();
136
+ function _(e) {
137
+ let t = e.length < 0 ? 0 : S(e.length) | 0, n = l(t);
138
+ for (let r = 0; r < t; r += 1) n[r] = e[r] & 255;
139
+ return n;
158
140
  }
159
- getSize(e) {
160
- let t = this._pathToAbsolute(e), n = this._getFileByAbsolutePath(t);
161
- return n == null ? 0 : n.constructor === Object ? JSON.stringify(n).length : n.toString().length;
141
+ function v(e) {
142
+ if (J(e, a)) {
143
+ let t = new a(e);
144
+ return y(t.buffer, t.byteOffset, t.byteLength);
145
+ }
146
+ return _(e);
162
147
  }
163
- getRawPermissions() {
164
- return Object.assign({}, this.permissions);
148
+ function y(e, t, n) {
149
+ if (t < 0 || e.byteLength < t) throw RangeError("\"offset\" is outside of buffer bounds");
150
+ if (e.byteLength < t + (n || 0)) throw RangeError("\"length\" is outside of buffer bounds");
151
+ let r;
152
+ return r = t === void 0 && n === void 0 ? new a(e) : n === void 0 ? new a(e, t) : new a(e, t, n), Object.setPrototypeOf(r, u.prototype), r;
165
153
  }
166
- setCwd(e) {
167
- this.cwd = this._pathToAbsolute(e.endsWith("/") ? e : e + "/");
154
+ function x(e) {
155
+ if (u.isBuffer(e)) {
156
+ let t = S(e.length) | 0, n = l(t);
157
+ return n.length === 0 || e.copy(n, 0, 0, t), n;
158
+ }
159
+ if (e.length !== void 0) return typeof e.length != "number" || he(e.length) ? l(0) : _(e);
160
+ if (e.type === "Buffer" && Array.isArray(e.data)) return _(e.data);
168
161
  }
169
- getRaw() {
170
- return this.fileSystem;
162
+ function S(e) {
163
+ if (e >= i) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes");
164
+ return e | 0;
171
165
  }
172
- addFiles(e) {
173
- Object.entries(e).forEach(([e, t]) => {
174
- this._setFileRaw(e, t, !0);
175
- });
166
+ function C(e) {
167
+ return +e != e && (e = 0), u.alloc(+e);
176
168
  }
177
- autoComplete(e, t) {
178
- let n = this._pathToAbsolute(e).split("/"), r = n.pop(), i = this._getFileRaw(n.length > 1 ? n.join("/") : "/"), a = this._getFileRaw(t);
179
- if (i && i.constructor === Object) {
180
- let t = Object.keys(i).filter((e) => e.startsWith(r));
181
- r.length < 1 && (t = t.filter((e) => !e.startsWith(".")));
182
- let n = e.split("/");
183
- n.pop();
184
- let o = i;
185
- if (t.length < 1 && n.length < 1 && a && (t = Object.keys(a).filter((e) => e.startsWith(r)), o = a), t.length) return {
186
- path: n.length ? n.join("/") : null,
187
- options: t.map((e) => o[e] && o[e].constructor === Object ? e.concat("/") : e)
188
- };
189
- }
190
- return null;
191
- }
192
- };
193
- }));
194
- //#endregion
195
- //#region node_modules/vite-plugin-node-polyfills/shims/process/dist/index.js
196
- function s(e) {
197
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
198
- }
199
- function c() {
200
- throw Error("setTimeout has not been defined");
201
- }
202
- function l() {
203
- throw Error("clearTimeout has not been defined");
204
- }
205
- function u(e) {
206
- if (v === setTimeout) return setTimeout(e, 0);
207
- if ((v === c || !v) && setTimeout) return v = setTimeout, setTimeout(e, 0);
208
- try {
209
- return v(e, 0);
210
- } catch {
211
- try {
212
- return v.call(null, e, 0);
213
- } catch {
214
- return v.call(this, e, 0);
215
- }
216
- }
217
- }
218
- function d(e) {
219
- if (y === clearTimeout) return clearTimeout(e);
220
- if ((y === l || !y) && clearTimeout) return y = clearTimeout, clearTimeout(e);
221
- try {
222
- return y(e);
223
- } catch {
224
- try {
225
- return y.call(null, e);
226
- } catch {
227
- return y.call(this, e);
228
- }
229
- }
230
- }
231
- function f() {
232
- !x || !S || (x = !1, S.length ? b = S.concat(b) : C = -1, b.length && p());
233
- }
234
- function p() {
235
- if (!x) {
236
- var e = u(f);
237
- x = !0;
238
- for (var t = b.length; t;) {
239
- for (S = b, b = []; ++C < t;) S && S[C].run();
240
- C = -1, t = b.length;
241
- }
242
- S = null, x = !1, d(e);
243
- }
244
- }
245
- function m(e, t) {
246
- this.fun = e, this.array = t;
247
- }
248
- function h() {}
249
- var g, _, v, y, b, x, S, C, w, T, E = e((() => {
250
- g = { exports: {} }, _ = g.exports = {}, (function() {
251
- try {
252
- v = typeof setTimeout == "function" ? setTimeout : c;
253
- } catch {
254
- v = c;
255
- }
256
- try {
257
- y = typeof clearTimeout == "function" ? clearTimeout : l;
258
- } catch {
259
- y = l;
260
- }
261
- })(), b = [], x = !1, C = -1, _.nextTick = function(e) {
262
- var t = Array(arguments.length - 1);
263
- if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
264
- b.push(new m(e, t)), b.length === 1 && !x && u(p);
265
- }, m.prototype.run = function() {
266
- this.fun.apply(null, this.array);
267
- }, _.title = "browser", _.browser = !0, _.env = {}, _.argv = [], _.version = "", _.versions = {}, _.on = h, _.addListener = h, _.once = h, _.off = h, _.removeListener = h, _.removeAllListeners = h, _.emit = h, _.prependListener = h, _.prependOnceListener = h, _.listeners = function(e) {
268
- return [];
269
- }, _.binding = function(e) {
270
- throw Error("process.binding is not supported");
271
- }, _.cwd = function() {
272
- return "/";
273
- }, _.chdir = function(e) {
274
- throw Error("process.chdir is not supported");
275
- }, _.umask = function() {
276
- return 0;
277
- }, w = g.exports, T = /* @__PURE__ */ s(w);
278
- })), D = /* @__PURE__ */ t(((e, t) => {
279
- t.exports = null;
280
- })), O = /* @__PURE__ */ t(((e, t) => {
281
- E();
282
- function n(e) {
283
- if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
284
- }
285
- function r(e, t) {
286
- for (var n = "", r = 0, i = -1, a = 0, o, s = 0; s <= e.length; ++s) {
287
- if (s < e.length) o = e.charCodeAt(s);
288
- else if (o === 47) break;
289
- else o = 47;
290
- if (o === 47) {
291
- if (!(i === s - 1 || a === 1)) if (i !== s - 1 && a === 2) {
292
- if (n.length < 2 || r !== 2 || n.charCodeAt(n.length - 1) !== 46 || n.charCodeAt(n.length - 2) !== 46) {
293
- if (n.length > 2) {
294
- var c = n.lastIndexOf("/");
295
- if (c !== n.length - 1) {
296
- c === -1 ? (n = "", r = 0) : (n = n.slice(0, c), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
297
- continue;
298
- }
299
- } else if (n.length === 2 || n.length === 1) {
300
- n = "", r = 0, i = s, a = 0;
301
- continue;
302
- }
303
- }
304
- t && (n.length > 0 ? n += "/.." : n = "..", r = 2);
305
- } else n.length > 0 ? n += "/" + e.slice(i + 1, s) : n = e.slice(i + 1, s), r = s - i - 1;
306
- i = s, a = 0;
307
- } else o === 46 && a !== -1 ? ++a : a = -1;
308
- }
309
- return n;
310
- }
311
- function i(e, t) {
312
- var n = t.dir || t.root, r = t.base || (t.name || "") + (t.ext || "");
313
- return n ? n === t.root ? n + r : n + e + r : r;
314
- }
315
- var a = {
316
- resolve: function() {
317
- for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
318
- var o;
319
- a >= 0 ? o = arguments[a] : (i === void 0 && (i = T.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
320
- }
321
- return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
322
- },
323
- normalize: function(e) {
324
- if (n(e), e.length === 0) return ".";
325
- var t = e.charCodeAt(0) === 47, i = e.charCodeAt(e.length - 1) === 47;
326
- return e = r(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && i && (e += "/"), t ? "/" + e : e;
327
- },
328
- isAbsolute: function(e) {
329
- return n(e), e.length > 0 && e.charCodeAt(0) === 47;
330
- },
331
- join: function() {
332
- if (arguments.length === 0) return ".";
333
- for (var e, t = 0; t < arguments.length; ++t) {
334
- var r = arguments[t];
335
- n(r), r.length > 0 && (e === void 0 ? e = r : e += "/" + r);
336
- }
337
- return e === void 0 ? "." : a.normalize(e);
338
- },
339
- relative: function(e, t) {
340
- if (n(e), n(t), e === t || (e = a.resolve(e), t = a.resolve(t), e === t)) return "";
341
- for (var r = 1; r < e.length && e.charCodeAt(r) === 47; ++r);
342
- for (var i = e.length, o = i - r, s = 1; s < t.length && t.charCodeAt(s) === 47; ++s);
343
- for (var c = t.length - s, l = o < c ? o : c, u = -1, d = 0; d <= l; ++d) {
344
- if (d === l) {
345
- if (c > l) {
346
- if (t.charCodeAt(s + d) === 47) return t.slice(s + d + 1);
347
- if (d === 0) return t.slice(s + d);
348
- } else o > l && (e.charCodeAt(r + d) === 47 ? u = d : d === 0 && (u = 0));
349
- break;
350
- }
351
- var f = e.charCodeAt(r + d);
352
- if (f !== t.charCodeAt(s + d)) break;
353
- f === 47 && (u = d);
169
+ u.isBuffer = function(e) {
170
+ return e != null && e._isBuffer === !0 && e !== u.prototype;
171
+ }, u.compare = function(e, t) {
172
+ if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), J(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
173
+ if (e === t) return 0;
174
+ let n = e.length, r = t.length;
175
+ for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
176
+ n = e[i], r = t[i];
177
+ break;
354
178
  }
355
- var p = "";
356
- for (d = r + u + 1; d <= i; ++d) (d === i || e.charCodeAt(d) === 47) && (p.length === 0 ? p += ".." : p += "/..");
357
- return p.length > 0 ? p + t.slice(s + u) : (s += u, t.charCodeAt(s) === 47 && ++s, t.slice(s));
358
- },
359
- _makeLong: function(e) {
360
- return e;
361
- },
362
- dirname: function(e) {
363
- if (n(e), e.length === 0) return ".";
364
- for (var t = e.charCodeAt(0), r = t === 47, i = -1, a = !0, o = e.length - 1; o >= 1; --o) if (t = e.charCodeAt(o), t === 47) {
365
- if (!a) {
366
- i = o;
367
- break;
368
- }
369
- } else a = !1;
370
- return i === -1 ? r ? "/" : "." : r && i === 1 ? "//" : e.slice(0, i);
371
- },
372
- basename: function(e, t) {
373
- if (t !== void 0 && typeof t != "string") throw TypeError("\"ext\" argument must be a string");
374
- n(e);
375
- var r = 0, i = -1, a = !0, o;
376
- if (t !== void 0 && t.length > 0 && t.length <= e.length) {
377
- if (t.length === e.length && t === e) return "";
378
- var s = t.length - 1, c = -1;
379
- for (o = e.length - 1; o >= 0; --o) {
380
- var l = e.charCodeAt(o);
381
- if (l === 47) {
382
- if (!a) {
383
- r = o + 1;
384
- break;
385
- }
386
- } else c === -1 && (a = !1, c = o + 1), s >= 0 && (l === t.charCodeAt(s) ? --s === -1 && (i = o) : (s = -1, i = c));
387
- }
388
- return r === i ? i = c : i === -1 && (i = e.length), e.slice(r, i);
389
- } else {
390
- for (o = e.length - 1; o >= 0; --o) if (e.charCodeAt(o) === 47) {
391
- if (!a) {
392
- r = o + 1;
393
- break;
394
- }
395
- } else i === -1 && (a = !1, i = o + 1);
396
- return i === -1 ? "" : e.slice(r, i);
179
+ return n < r ? -1 : +(r < n);
180
+ }, u.isEncoding = function(e) {
181
+ switch (String(e).toLowerCase()) {
182
+ case "hex":
183
+ case "utf8":
184
+ case "utf-8":
185
+ case "ascii":
186
+ case "latin1":
187
+ case "binary":
188
+ case "base64":
189
+ case "ucs2":
190
+ case "ucs-2":
191
+ case "utf16le":
192
+ case "utf-16le": return !0;
193
+ default: return !1;
397
194
  }
398
- },
399
- extname: function(e) {
400
- n(e);
401
- for (var t = -1, r = 0, i = -1, a = !0, o = 0, s = e.length - 1; s >= 0; --s) {
402
- var c = e.charCodeAt(s);
403
- if (c === 47) {
404
- if (!a) {
405
- r = s + 1;
406
- break;
407
- }
408
- continue;
409
- }
410
- i === -1 && (a = !1, i = s + 1), c === 46 ? t === -1 ? t = s : o !== 1 && (o = 1) : t !== -1 && (o = -1);
195
+ }, u.concat = function(e, t) {
196
+ if (!Array.isArray(e)) throw TypeError("\"list\" argument must be an Array of Buffers");
197
+ if (e.length === 0) return u.alloc(0);
198
+ let n;
199
+ if (t === void 0) for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
200
+ let r = u.allocUnsafe(t), i = 0;
201
+ for (n = 0; n < e.length; ++n) {
202
+ let t = e[n];
203
+ if (J(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
204
+ else if (u.isBuffer(t)) t.copy(r, i);
205
+ else throw TypeError("\"list\" argument must be an Array of Buffers");
206
+ i += t.length;
411
207
  }
412
- return t === -1 || i === -1 || o === 0 || o === 1 && t === i - 1 && t === r + 1 ? "" : e.slice(t, i);
413
- },
414
- format: function(e) {
415
- if (typeof e != "object" || !e) throw TypeError("The \"pathObject\" argument must be of type Object. Received type " + typeof e);
416
- return i("/", e);
417
- },
418
- parse: function(e) {
419
- n(e);
420
- var t = {
421
- root: "",
422
- dir: "",
423
- base: "",
424
- ext: "",
425
- name: ""
426
- };
427
- if (e.length === 0) return t;
428
- var r = e.charCodeAt(0), i = r === 47, a;
429
- i ? (t.root = "/", a = 1) : a = 0;
430
- for (var o = -1, s = 0, c = -1, l = !0, u = e.length - 1, d = 0; u >= a; --u) {
431
- if (r = e.charCodeAt(u), r === 47) {
432
- if (!l) {
433
- s = u + 1;
434
- break;
435
- }
436
- continue;
437
- }
438
- c === -1 && (l = !1, c = u + 1), r === 46 ? o === -1 ? o = u : d !== 1 && (d = 1) : o !== -1 && (d = -1);
208
+ return r;
209
+ };
210
+ function w(e, t) {
211
+ if (u.isBuffer(e)) return e.length;
212
+ if (o.isView(e) || J(e, o)) return e.byteLength;
213
+ if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
214
+ let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
215
+ if (!r && n === 0) return 0;
216
+ let i = !1;
217
+ for (;;) switch (t) {
218
+ case "ascii":
219
+ case "latin1":
220
+ case "binary": return n;
221
+ case "utf8":
222
+ case "utf-8": return ue(e).length;
223
+ case "ucs2":
224
+ case "ucs-2":
225
+ case "utf16le":
226
+ case "utf-16le": return n * 2;
227
+ case "hex": return n >>> 1;
228
+ case "base64": return pe(e).length;
229
+ default:
230
+ if (i) return r ? -1 : ue(e).length;
231
+ t = ("" + t).toLowerCase(), i = !0;
439
232
  }
440
- return o === -1 || c === -1 || d === 0 || d === 1 && o === c - 1 && o === s + 1 ? c !== -1 && (s === 0 && i ? t.base = t.name = e.slice(1, c) : t.base = t.name = e.slice(s, c)) : (s === 0 && i ? (t.name = e.slice(1, o), t.base = e.slice(1, c)) : (t.name = e.slice(s, o), t.base = e.slice(s, c)), t.ext = e.slice(o, c)), s > 0 ? t.dir = e.slice(0, s - 1) : i && (t.dir = "/"), t;
441
- },
442
- sep: "/",
443
- delimiter: ":",
444
- win32: null,
445
- posix: null
446
- };
447
- a.posix = a, t.exports = a;
448
- })), k = /* @__PURE__ */ t(((e, t) => {
449
- E();
450
- var n = D(), r = O(), i = a(), o = class extends i {
451
- constructor(e, t = null) {
452
- super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || T.cwd());
453
233
  }
454
- get isRealFilesystem() {
455
- return !0;
456
- }
457
- _normalizeCwd(e) {
458
- let t = r.resolve(e);
459
- return t === "/" ? "/" : t + "/";
234
+ u.byteLength = w;
235
+ function T(e, t, n) {
236
+ let r = !1;
237
+ if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
238
+ for (e ||= "utf8";;) switch (e) {
239
+ case "hex": return z(this, t, n);
240
+ case "utf8":
241
+ case "utf-8": return P(this, t, n);
242
+ case "ascii": return L(this, t, n);
243
+ case "latin1":
244
+ case "binary": return R(this, t, n);
245
+ case "base64": return ee(this, t, n);
246
+ case "ucs2":
247
+ case "ucs-2":
248
+ case "utf16le":
249
+ case "utf-16le": return te(this, t, n);
250
+ default:
251
+ if (r) throw TypeError("Unknown encoding: " + e);
252
+ e = (e + "").toLowerCase(), r = !0;
253
+ }
460
254
  }
461
- absolutePath(e) {
462
- e.startsWith("./") && (e = e.slice(2));
463
- let t = e.startsWith("/") ? e : r.join(this.cwd, e);
464
- return r.normalize(t);
255
+ u.prototype._isBuffer = !0;
256
+ function E(e, t, n) {
257
+ let r = e[t];
258
+ e[t] = e[n], e[n] = r;
465
259
  }
466
- setCwd(e) {
467
- let t = e.endsWith("/") ? e.slice(0, -1) : e, n = this.absolutePath(t);
468
- this.cwd = n === "/" ? "/" : n + "/";
260
+ u.prototype.swap16 = function() {
261
+ let e = this.length;
262
+ if (e % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits");
263
+ for (let t = 0; t < e; t += 2) E(this, t, t + 1);
264
+ return this;
265
+ }, u.prototype.swap32 = function() {
266
+ let e = this.length;
267
+ if (e % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits");
268
+ for (let t = 0; t < e; t += 4) E(this, t, t + 3), E(this, t + 1, t + 2);
269
+ return this;
270
+ }, u.prototype.swap64 = function() {
271
+ let e = this.length;
272
+ if (e % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits");
273
+ for (let t = 0; t < e; t += 8) E(this, t, t + 7), E(this, t + 1, t + 6), E(this, t + 2, t + 5), E(this, t + 3, t + 4);
274
+ return this;
275
+ }, u.prototype.toString = function() {
276
+ let e = this.length;
277
+ return e === 0 ? "" : arguments.length === 0 ? P(this, 0, e) : T.apply(this, arguments);
278
+ }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(e) {
279
+ if (!u.isBuffer(e)) throw TypeError("Argument must be a Buffer");
280
+ return this === e ? !0 : u.compare(this, e) === 0;
281
+ }, u.prototype.inspect = function() {
282
+ let t = "", n = e.INSPECT_MAX_BYTES;
283
+ return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
284
+ }, r && (u.prototype[r] = u.prototype.inspect), u.prototype.compare = function(e, t, n, r, i) {
285
+ if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
286
+ if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
287
+ if (r >= i && t >= n) return 0;
288
+ if (r >= i) return -1;
289
+ if (t >= n) return 1;
290
+ if (t >>>= 0, n >>>= 0, r >>>= 0, i >>>= 0, this === e) return 0;
291
+ let o = i - r, s = n - t, c = Math.min(o, s), l = this.slice(r, i), d = e.slice(t, n);
292
+ for (let e = 0; e < c; ++e) if (l[e] !== d[e]) {
293
+ o = l[e], s = d[e];
294
+ break;
295
+ }
296
+ return o < s ? -1 : +(s < o);
297
+ };
298
+ function D(e, t, n, r, i) {
299
+ if (e.length === 0) return -1;
300
+ if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, he(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
301
+ if (i) return -1;
302
+ n = e.length - 1;
303
+ } else if (n < 0) if (i) n = 0;
304
+ else return -1;
305
+ if (typeof t == "string" && (t = u.from(t, r)), u.isBuffer(t)) return t.length === 0 ? -1 : O(e, t, n, r, i);
306
+ if (typeof t == "number") return t &= 255, typeof a.prototype.indexOf == "function" ? i ? a.prototype.indexOf.call(e, t, n) : a.prototype.lastIndexOf.call(e, t, n) : O(e, [t], n, r, i);
307
+ throw TypeError("val must be string, number or Buffer");
469
308
  }
470
- getFileByPath(e) {
471
- let t = this.absolutePath(e);
472
- if (this._virtualFiles[t] !== void 0) return this._virtualFiles[t];
473
- let i;
474
- try {
475
- i = n.statSync(t);
476
- } catch {
477
- return null;
309
+ function O(e, t, n, r, i) {
310
+ let a = 1, o = e.length, s = t.length;
311
+ if (r !== void 0 && (r = String(r).toLowerCase(), r === "ucs2" || r === "ucs-2" || r === "utf16le" || r === "utf-16le")) {
312
+ if (e.length < 2 || t.length < 2) return -1;
313
+ a = 2, o /= 2, s /= 2, n /= 2;
314
+ }
315
+ function c(e, t) {
316
+ return a === 1 ? e[t] : e.readUInt16BE(t * a);
478
317
  }
479
- if (i.isDirectory()) {
480
- let e = {};
481
- try {
482
- for (let i of n.readdirSync(t)) {
483
- let a = r.join(t, i);
484
- if (this._virtualFiles[a] !== void 0) e[i] = this._virtualFiles[a];
485
- else try {
486
- e[i] = n.statSync(a).isDirectory() ? {} : "";
487
- } catch {}
488
- }
489
- } catch {}
490
- let i = t === "/" ? "/" : t + "/";
491
- for (let t of Object.keys(this._virtualFiles)) if (t.startsWith(i) && !t.slice(i.length).includes("/")) {
492
- let n = t.slice(i.length);
493
- n in e || (e[n] = this._virtualFiles[t]);
318
+ let l;
319
+ if (i) {
320
+ let r = -1;
321
+ for (l = n; l < o; l++) if (c(e, l) === c(t, r === -1 ? 0 : l - r)) {
322
+ if (r === -1 && (r = l), l - r + 1 === s) return r * a;
323
+ } else r !== -1 && (l -= l - r), r = -1;
324
+ } else for (n + s > o && (n = o - s), l = n; l >= 0; l--) {
325
+ let n = !0;
326
+ for (let r = 0; r < s; r++) if (c(e, l + r) !== c(t, r)) {
327
+ n = !1;
328
+ break;
494
329
  }
495
- return e;
496
- }
497
- try {
498
- return n.readFileSync(t, "utf8");
499
- } catch {
500
- return null;
330
+ if (n) return l;
501
331
  }
332
+ return -1;
502
333
  }
503
- setFileByPath(e, t, i = !1) {
504
- let a = this.absolutePath(e);
505
- if (typeof t == "function") {
506
- this._virtualFiles[a] = t;
507
- return;
508
- }
509
- if (t != null && t.constructor === Object) {
510
- n.mkdirSync(a, { recursive: i }), this._triggerChange();
511
- return;
334
+ u.prototype.includes = function(e, t, n) {
335
+ return this.indexOf(e, t, n) !== -1;
336
+ }, u.prototype.indexOf = function(e, t, n) {
337
+ return D(this, e, t, n, !0);
338
+ }, u.prototype.lastIndexOf = function(e, t, n) {
339
+ return D(this, e, t, n, !1);
340
+ };
341
+ function k(e, t, n, r) {
342
+ n = Number(n) || 0;
343
+ let i = e.length - n;
344
+ r ? (r = Number(r), r > i && (r = i)) : r = i;
345
+ let a = t.length;
346
+ r > a / 2 && (r = a / 2);
347
+ let o;
348
+ for (o = 0; o < r; ++o) {
349
+ let r = parseInt(t.substr(o * 2, 2), 16);
350
+ if (he(r)) return o;
351
+ e[n + o] = r;
512
352
  }
513
- i && n.mkdirSync(r.dirname(a), { recursive: !0 }), n.writeFileSync(a, String(t)), this._triggerChange();
353
+ return o;
514
354
  }
515
- deleteFileByPath(e) {
516
- let t = this.absolutePath(e);
517
- delete this._virtualFiles[t];
518
- try {
519
- n.lstatSync(t).isDirectory() ? n.rmdirSync(t) : n.unlinkSync(t), this._triggerChange();
520
- } catch {}
355
+ function A(e, t, n, r) {
356
+ return me(ue(t, e.length - n), e, n, r);
521
357
  }
522
- getMode(e) {
523
- let t = this.absolutePath(e);
524
- if (this._virtualFiles[t] !== void 0) return typeof this._virtualFiles[t] == "function" ? 493 : 420;
525
- try {
526
- return n.statSync(t).mode & 511;
527
- } catch {
528
- return null;
529
- }
358
+ function j(e, t, n, r) {
359
+ return me(de(t), e, n, r);
530
360
  }
531
- setMode(e, t) {
532
- let r = this.absolutePath(e);
533
- this._virtualFiles[r] === void 0 && (n.chmodSync(r, t), this._triggerChange());
361
+ function M(e, t, n, r) {
362
+ return me(pe(t), e, n, r);
534
363
  }
535
- getSize(e) {
536
- let t = this.absolutePath(e);
537
- if (this._virtualFiles[t] !== void 0) return 0;
538
- try {
539
- return n.statSync(t).size;
540
- } catch {
541
- return 0;
542
- }
364
+ function N(e, t, n, r) {
365
+ return me(fe(t, e.length - n), e, n, r);
543
366
  }
544
- isSymlink(e) {
545
- let t = this.absolutePath(e);
546
- try {
547
- return n.lstatSync(t).isSymbolicLink();
548
- } catch {
549
- return !1;
367
+ u.prototype.write = function(e, t, n, r) {
368
+ if (t === void 0) r = "utf8", n = this.length, t = 0;
369
+ else if (n === void 0 && typeof t == "string") r = t, n = this.length, t = 0;
370
+ else if (isFinite(t)) t >>>= 0, isFinite(n) ? (n >>>= 0, r === void 0 && (r = "utf8")) : (r = n, n = void 0);
371
+ else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
372
+ let i = this.length - t;
373
+ if ((n === void 0 || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw RangeError("Attempt to write outside buffer bounds");
374
+ r ||= "utf8";
375
+ let a = !1;
376
+ for (;;) switch (r) {
377
+ case "hex": return k(this, e, t, n);
378
+ case "utf8":
379
+ case "utf-8": return A(this, e, t, n);
380
+ case "ascii":
381
+ case "latin1":
382
+ case "binary": return j(this, e, t, n);
383
+ case "base64": return M(this, e, t, n);
384
+ case "ucs2":
385
+ case "ucs-2":
386
+ case "utf16le":
387
+ case "utf-16le": return N(this, e, t, n);
388
+ default:
389
+ if (a) throw TypeError("Unknown encoding: " + r);
390
+ r = ("" + r).toLowerCase(), a = !0;
550
391
  }
392
+ }, u.prototype.toJSON = function() {
393
+ return {
394
+ type: "Buffer",
395
+ data: Array.prototype.slice.call(this._arr || this, 0)
396
+ };
397
+ };
398
+ function ee(e, n, r) {
399
+ return n === 0 && r === e.length ? t.fromByteArray(e) : t.fromByteArray(e.slice(n, r));
551
400
  }
552
- readSymlink(e) {
553
- let t = this.absolutePath(e);
554
- try {
555
- return n.readlinkSync(t);
556
- } catch {
557
- return null;
401
+ function P(e, t, n) {
402
+ n = Math.min(e.length, n);
403
+ let r = [], i = t;
404
+ for (; i < n;) {
405
+ let t = e[i], a = null, o = t > 239 ? 4 : t > 223 ? 3 : t > 191 ? 2 : 1;
406
+ if (i + o <= n) {
407
+ let n, r, s, c;
408
+ switch (o) {
409
+ case 1:
410
+ t < 128 && (a = t);
411
+ break;
412
+ case 2:
413
+ n = e[i + 1], (n & 192) == 128 && (c = (t & 31) << 6 | n & 63, c > 127 && (a = c));
414
+ break;
415
+ case 3:
416
+ n = e[i + 1], r = e[i + 2], (n & 192) == 128 && (r & 192) == 128 && (c = (t & 15) << 12 | (n & 63) << 6 | r & 63, c > 2047 && (c < 55296 || c > 57343) && (a = c));
417
+ break;
418
+ case 4: n = e[i + 1], r = e[i + 2], s = e[i + 3], (n & 192) == 128 && (r & 192) == 128 && (s & 192) == 128 && (c = (t & 15) << 18 | (n & 63) << 12 | (r & 63) << 6 | s & 63, c > 65535 && c < 1114112 && (a = c));
419
+ }
420
+ }
421
+ a === null ? (a = 65533, o = 1) : a > 65535 && (a -= 65536, r.push(a >>> 10 & 1023 | 55296), a = 56320 | a & 1023), r.push(a), i += o;
558
422
  }
423
+ return I(r);
559
424
  }
560
- createSymlink(e, t) {
561
- let i = this.absolutePath(t);
562
- n.mkdirSync(r.dirname(i), { recursive: !0 }), n.symlinkSync(e, i), this._triggerChange();
425
+ let F = 4096;
426
+ function I(e) {
427
+ let t = e.length;
428
+ if (t <= F) return String.fromCharCode.apply(String, e);
429
+ let n = "", r = 0;
430
+ for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += F));
431
+ return n;
563
432
  }
564
- getRaw() {
565
- return null;
433
+ function L(e, t, n) {
434
+ let r = "";
435
+ n = Math.min(e.length, n);
436
+ for (let i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
437
+ return r;
566
438
  }
567
- getRawPermissions() {
568
- return {};
439
+ function R(e, t, n) {
440
+ let r = "";
441
+ n = Math.min(e.length, n);
442
+ for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
443
+ return r;
569
444
  }
570
- addFiles(e) {
571
- Object.entries(e).forEach(([e, t]) => {
572
- this.setFileByPath(e, t, !0);
573
- });
445
+ function z(e, t, n) {
446
+ let r = e.length;
447
+ (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
448
+ let i = "";
449
+ for (let r = t; r < n; ++r) i += ge[e[r]];
450
+ return i;
451
+ }
452
+ function te(e, t, n) {
453
+ let r = e.slice(t, n), i = "";
454
+ for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
455
+ return i;
456
+ }
457
+ u.prototype.slice = function(e, t) {
458
+ let n = this.length;
459
+ e = ~~e, t = t === void 0 ? n : ~~t, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < e && (t = e);
460
+ let r = this.subarray(e, t);
461
+ return Object.setPrototypeOf(r, u.prototype), r;
462
+ };
463
+ function B(e, t, n) {
464
+ if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
465
+ if (e + t > n) throw RangeError("Trying to access beyond buffer length");
466
+ }
467
+ u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
468
+ e >>>= 0, t >>>= 0, n || B(e, t, this.length);
469
+ let r = this[e], i = 1, a = 0;
470
+ for (; ++a < t && (i *= 256);) r += this[e + a] * i;
471
+ return r;
472
+ }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
473
+ e >>>= 0, t >>>= 0, n || B(e, t, this.length);
474
+ let r = this[e + --t], i = 1;
475
+ for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
476
+ return r;
477
+ }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
478
+ return e >>>= 0, t || B(e, 1, this.length), this[e];
479
+ }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
480
+ return e >>>= 0, t || B(e, 2, this.length), this[e] | this[e + 1] << 8;
481
+ }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
482
+ return e >>>= 0, t || B(e, 2, this.length), this[e] << 8 | this[e + 1];
483
+ }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
484
+ return e >>>= 0, t || B(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
485
+ }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
486
+ return e >>>= 0, t || B(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
487
+ }, u.prototype.readBigUInt64LE = Y(function(e) {
488
+ e >>>= 0, K(e, "offset");
489
+ let t = this[e], n = this[e + 7];
490
+ (t === void 0 || n === void 0) && q(e, this.length - 8);
491
+ let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
492
+ return BigInt(r) + (BigInt(i) << BigInt(32));
493
+ }), u.prototype.readBigUInt64BE = Y(function(e) {
494
+ e >>>= 0, K(e, "offset");
495
+ let t = this[e], n = this[e + 7];
496
+ (t === void 0 || n === void 0) && q(e, this.length - 8);
497
+ let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
498
+ return (BigInt(r) << BigInt(32)) + BigInt(i);
499
+ }), u.prototype.readIntLE = function(e, t, n) {
500
+ e >>>= 0, t >>>= 0, n || B(e, t, this.length);
501
+ let r = this[e], i = 1, a = 0;
502
+ for (; ++a < t && (i *= 256);) r += this[e + a] * i;
503
+ return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
504
+ }, u.prototype.readIntBE = function(e, t, n) {
505
+ e >>>= 0, t >>>= 0, n || B(e, t, this.length);
506
+ let r = t, i = 1, a = this[e + --r];
507
+ for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
508
+ return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
509
+ }, u.prototype.readInt8 = function(e, t) {
510
+ return e >>>= 0, t || B(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
511
+ }, u.prototype.readInt16LE = function(e, t) {
512
+ e >>>= 0, t || B(e, 2, this.length);
513
+ let n = this[e] | this[e + 1] << 8;
514
+ return n & 32768 ? n | 4294901760 : n;
515
+ }, u.prototype.readInt16BE = function(e, t) {
516
+ e >>>= 0, t || B(e, 2, this.length);
517
+ let n = this[e + 1] | this[e] << 8;
518
+ return n & 32768 ? n | 4294901760 : n;
519
+ }, u.prototype.readInt32LE = function(e, t) {
520
+ return e >>>= 0, t || B(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
521
+ }, u.prototype.readInt32BE = function(e, t) {
522
+ return e >>>= 0, t || B(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
523
+ }, u.prototype.readBigInt64LE = Y(function(e) {
524
+ e >>>= 0, K(e, "offset");
525
+ let t = this[e], n = this[e + 7];
526
+ (t === void 0 || n === void 0) && q(e, this.length - 8);
527
+ let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
528
+ return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
529
+ }), u.prototype.readBigInt64BE = Y(function(e) {
530
+ e >>>= 0, K(e, "offset");
531
+ let t = this[e], n = this[e + 7];
532
+ (t === void 0 || n === void 0) && q(e, this.length - 8);
533
+ let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
534
+ return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
535
+ }), u.prototype.readFloatLE = function(e, t) {
536
+ return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !0, 23, 4);
537
+ }, u.prototype.readFloatBE = function(e, t) {
538
+ return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !1, 23, 4);
539
+ }, u.prototype.readDoubleLE = function(e, t) {
540
+ return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !0, 52, 8);
541
+ }, u.prototype.readDoubleBE = function(e, t) {
542
+ return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !1, 52, 8);
543
+ };
544
+ function V(e, t, n, r, i, a) {
545
+ if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
546
+ if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
547
+ if (n + r > e.length) throw RangeError("Index out of range");
574
548
  }
575
- autoComplete(e, t) {
576
- let i = this.absolutePath(e).split("/"), a = i.pop(), o = i.join("/") || "/", s = [];
577
- try {
578
- s = n.readdirSync(o);
579
- } catch {}
580
- let c = o === "/" ? "/" : o + "/";
581
- for (let e of Object.keys(this._virtualFiles)) if (e.startsWith(c) && !e.slice(c.length).includes("/")) {
582
- let t = e.slice(c.length);
583
- s.includes(t) || s.push(t);
549
+ u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
550
+ if (e = +e, t >>>= 0, n >>>= 0, !r) {
551
+ let r = 2 ** (8 * n) - 1;
552
+ V(this, e, t, n, r, 0);
584
553
  }
585
- let l = s.filter((e) => e.startsWith(a));
586
- if (l.length === 0 && !e.includes("/")) {
587
- let n = this.getFileByPath(t);
588
- if (n && n.constructor === Object && (l = Object.keys(n).filter((t) => t.startsWith(e)), l.length)) return {
589
- path: null,
590
- options: l
591
- };
554
+ let i = 1, a = 0;
555
+ for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
556
+ return t + n;
557
+ }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
558
+ if (e = +e, t >>>= 0, n >>>= 0, !r) {
559
+ let r = 2 ** (8 * n) - 1;
560
+ V(this, e, t, n, r, 0);
592
561
  }
593
- if (!l.length) return null;
594
- let u = e.split("/");
595
- return u.pop(), {
596
- path: u.length ? u.join("/") : null,
597
- options: l.map((e) => {
598
- let t = r.join(o, e);
599
- if (this._virtualFiles[t] !== void 0) return e;
600
- try {
601
- return n.statSync(t).isDirectory() ? e + "/" : e;
602
- } catch {
603
- return e;
604
- }
605
- })
606
- };
607
- }
608
- _getFileRaw(e) {
609
- return this.getFileByPath(e);
562
+ let i = n - 1, a = 1;
563
+ for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
564
+ return t + n;
565
+ }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
566
+ return e = +e, t >>>= 0, n || V(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
567
+ }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
568
+ return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
569
+ }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
570
+ return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
571
+ }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
572
+ return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
573
+ }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
574
+ return e = +e, t >>>= 0, n || V(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;
575
+ };
576
+ function H(e, t, n, r, i) {
577
+ G(t, r, i, e, n, 7);
578
+ let a = Number(t & BigInt(4294967295));
579
+ e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
580
+ let o = Number(t >> BigInt(32) & BigInt(4294967295));
581
+ return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
610
582
  }
611
- exists(e) {
612
- let t = this.absolutePath(e);
613
- if (this._virtualFiles[t] !== void 0) return !0;
614
- try {
615
- return n.statSync(t), !0;
616
- } catch {
617
- return !1;
618
- }
583
+ function U(e, t, n, r, i) {
584
+ G(t, r, i, e, n, 7);
585
+ let a = Number(t & BigInt(4294967295));
586
+ e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
587
+ let o = Number(t >> BigInt(32) & BigInt(4294967295));
588
+ return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
619
589
  }
620
- stat(e) {
621
- let t = this.absolutePath(e);
622
- if (this._virtualFiles[t] !== void 0) {
623
- let e = this._virtualFiles[t];
624
- return {
625
- isDirectory: e != null && e.constructor === Object,
626
- isFile: typeof e == "string",
627
- isCommand: typeof e == "function"
628
- };
590
+ u.prototype.writeBigUInt64LE = Y(function(e, t = 0) {
591
+ return H(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
592
+ }), u.prototype.writeBigUInt64BE = Y(function(e, t = 0) {
593
+ return U(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
594
+ }), u.prototype.writeIntLE = function(e, t, n, r) {
595
+ if (e = +e, t >>>= 0, !r) {
596
+ let r = 2 ** (8 * n - 1);
597
+ V(this, e, t, n, r - 1, -r);
629
598
  }
630
- try {
631
- let e = n.statSync(t);
632
- return {
633
- isDirectory: e.isDirectory(),
634
- isFile: e.isFile(),
635
- isCommand: !1
636
- };
637
- } catch {
638
- return null;
599
+ let i = 0, a = 1, o = 0;
600
+ for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
601
+ return t + n;
602
+ }, u.prototype.writeIntBE = function(e, t, n, r) {
603
+ if (e = +e, t >>>= 0, !r) {
604
+ let r = 2 ** (8 * n - 1);
605
+ V(this, e, t, n, r - 1, -r);
639
606
  }
607
+ let i = n - 1, a = 1, o = 0;
608
+ for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
609
+ return t + n;
610
+ }, u.prototype.writeInt8 = function(e, t, n) {
611
+ return e = +e, t >>>= 0, n || V(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
612
+ }, u.prototype.writeInt16LE = function(e, t, n) {
613
+ return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
614
+ }, u.prototype.writeInt16BE = function(e, t, n) {
615
+ return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
616
+ }, u.prototype.writeInt32LE = function(e, t, n) {
617
+ return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
618
+ }, u.prototype.writeInt32BE = function(e, t, n) {
619
+ return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
620
+ }, u.prototype.writeBigInt64LE = Y(function(e, t = 0) {
621
+ return H(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
622
+ }), u.prototype.writeBigInt64BE = Y(function(e, t = 0) {
623
+ return U(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
624
+ });
625
+ function ne(e, t, n, r, i, a) {
626
+ if (n + r > e.length || n < 0) throw RangeError("Index out of range");
640
627
  }
641
- };
642
- t.exports = o, t.exports = o;
643
- })), A = /* @__PURE__ */ t(((e, t) => {
644
- var n = o();
645
- t.exports = class {
646
- constructor(e) {
647
- this.options = e;
648
- let { cwd: t = "/", clearFn: r, destroyFn: i, onFsChange: a } = this.options;
649
- this.vars = {}, this.aliases = {}, this.fs = new n(t, {}, {}, a || null), this._clearFn = r, this._destroyFn = i;
628
+ function re(e, t, r, i, a) {
629
+ return t = +t, r >>>= 0, a || ne(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
650
630
  }
651
- setVar(e, t) {
652
- t ? this.vars[e] = t : delete this.vars[e];
631
+ u.prototype.writeFloatLE = function(e, t, n) {
632
+ return re(this, e, t, !0, n);
633
+ }, u.prototype.writeFloatBE = function(e, t, n) {
634
+ return re(this, e, t, !1, n);
635
+ };
636
+ function ie(e, t, r, i, a) {
637
+ return t = +t, r >>>= 0, a || ne(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
653
638
  }
654
- unsetVar(e) {
655
- this.setVar(e);
639
+ u.prototype.writeDoubleLE = function(e, t, n) {
640
+ return ie(this, e, t, !0, n);
641
+ }, u.prototype.writeDoubleBE = function(e, t, n) {
642
+ return ie(this, e, t, !1, n);
643
+ }, u.prototype.copy = function(e, t, n, r) {
644
+ if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
645
+ 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;
646
+ if (t < 0) throw RangeError("targetStart out of bounds");
647
+ if (n < 0 || n >= this.length) throw RangeError("Index out of range");
648
+ if (r < 0) throw RangeError("sourceEnd out of bounds");
649
+ r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
650
+ let i = r - n;
651
+ return this === e && typeof a.prototype.copyWithin == "function" ? this.copyWithin(t, n, r) : a.prototype.set.call(e, this.subarray(n, r), t), i;
652
+ }, u.prototype.fill = function(e, t, n, r) {
653
+ if (typeof e == "string") {
654
+ if (typeof t == "string" ? (r = t, t = 0, n = this.length) : typeof n == "string" && (r = n, n = this.length), r !== void 0 && typeof r != "string") throw TypeError("encoding must be a string");
655
+ if (typeof r == "string" && !u.isEncoding(r)) throw TypeError("Unknown encoding: " + r);
656
+ if (e.length === 1) {
657
+ let t = e.charCodeAt(0);
658
+ (r === "utf8" && t < 128 || r === "latin1") && (e = t);
659
+ }
660
+ } else typeof e == "number" ? e &= 255 : typeof e == "boolean" && (e = Number(e));
661
+ if (t < 0 || this.length < t || this.length < n) throw RangeError("Out of range index");
662
+ if (n <= t) return this;
663
+ t >>>= 0, n = n === void 0 ? this.length : n >>> 0, e ||= 0;
664
+ let i;
665
+ if (typeof e == "number") for (i = t; i < n; ++i) this[i] = e;
666
+ else {
667
+ let a = u.isBuffer(e) ? e : u.from(e, r), o = a.length;
668
+ if (o === 0) throw TypeError("The value \"" + e + "\" is invalid for argument \"value\"");
669
+ for (i = 0; i < n - t; ++i) this[i + t] = a[i % o];
670
+ }
671
+ return this;
672
+ };
673
+ let ae = {};
674
+ function oe(e, t, n) {
675
+ ae[e] = class extends n {
676
+ constructor() {
677
+ super(), Object.defineProperty(this, "message", {
678
+ value: t.apply(this, arguments),
679
+ writable: !0,
680
+ configurable: !0
681
+ }), this.name = `${this.name} [${e}]`, this.stack, delete this.name;
682
+ }
683
+ get code() {
684
+ return e;
685
+ }
686
+ set code(e) {
687
+ Object.defineProperty(this, "code", {
688
+ configurable: !0,
689
+ enumerable: !0,
690
+ value: e,
691
+ writable: !0
692
+ });
693
+ }
694
+ toString() {
695
+ return `${this.name} [${e}]: ${this.message}`;
696
+ }
697
+ };
656
698
  }
657
- getVar(e) {
658
- return this.vars[e] || "";
699
+ oe("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
700
+ return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
701
+ }, RangeError), oe("ERR_INVALID_ARG_TYPE", function(e, t) {
702
+ return `The "${e}" argument must be of type number. Received type ${typeof t}`;
703
+ }, TypeError), oe("ERR_OUT_OF_RANGE", function(e, t, n) {
704
+ let r = `The value of "${e}" is out of range.`, i = n;
705
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = se(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = se(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
706
+ }, RangeError);
707
+ function se(e) {
708
+ let t = "", n = e.length, r = +(e[0] === "-");
709
+ for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
710
+ return `${e.slice(0, n)}${t}`;
659
711
  }
660
- setAlias(e, t) {
661
- t ? this.aliases[e] = t : delete this.aliases[e];
712
+ function W(e, t, n) {
713
+ K(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && q(t, e.length - (n + 1));
662
714
  }
663
- unsetAlias(e) {
664
- this.setAlias(e);
715
+ function G(e, t, n, r, i, a) {
716
+ if (e > n || e < t) {
717
+ let r = typeof t == "bigint" ? "n" : "", i;
718
+ 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 ae.ERR_OUT_OF_RANGE("value", i, e);
719
+ }
720
+ W(r, i, a);
665
721
  }
666
- getAlias(e) {
667
- return this.aliases[e] || null;
722
+ function K(e, t) {
723
+ if (typeof e != "number") throw new ae.ERR_INVALID_ARG_TYPE(t, "number", e);
668
724
  }
669
- setCommand(e) {
670
- let t = `${this.getVar("PATH")}/${e.name.toLowerCase()}`;
671
- this.fs.addFiles({ [t]: e }), this.fs.setMode(t, 365);
725
+ function q(e, t, n) {
726
+ throw Math.floor(e) === e ? t < 0 ? new ae.ERR_BUFFER_OUT_OF_BOUNDS() : new ae.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (K(e, n), new ae.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
672
727
  }
673
- getCommand(e) {
674
- let t = `${this.getVar("PATH")}/${e}`;
675
- return this.fs._getFileRaw(t) || null;
728
+ let ce = /[^+/0-9A-Za-z-_]/g;
729
+ function le(e) {
730
+ if (e = e.split("=")[0], e = e.trim().replace(ce, ""), e.length < 2) return "";
731
+ for (; e.length % 4 != 0;) e += "=";
732
+ return e;
676
733
  }
677
- setNodeFilesystem(e) {
678
- let t = k(), n = this.fs._onChange;
679
- this.fs = new t(e, n);
734
+ function ue(e, t) {
735
+ t ||= Infinity;
736
+ let n, r = e.length, i = null, a = [];
737
+ for (let o = 0; o < r; ++o) {
738
+ if (n = e.charCodeAt(o), n > 55295 && n < 57344) {
739
+ if (!i) {
740
+ if (n > 56319) {
741
+ (t -= 3) > -1 && a.push(239, 191, 189);
742
+ continue;
743
+ } else if (o + 1 === r) {
744
+ (t -= 3) > -1 && a.push(239, 191, 189);
745
+ continue;
746
+ }
747
+ i = n;
748
+ continue;
749
+ }
750
+ if (n < 56320) {
751
+ (t -= 3) > -1 && a.push(239, 191, 189), i = n;
752
+ continue;
753
+ }
754
+ n = (i - 55296 << 10 | n - 56320) + 65536;
755
+ } else i && (t -= 3) > -1 && a.push(239, 191, 189);
756
+ if (i = null, n < 128) {
757
+ if (--t < 0) break;
758
+ a.push(n);
759
+ } else if (n < 2048) {
760
+ if ((t -= 2) < 0) break;
761
+ a.push(n >> 6 | 192, n & 63 | 128);
762
+ } else if (n < 65536) {
763
+ if ((t -= 3) < 0) break;
764
+ a.push(n >> 12 | 224, n >> 6 & 63 | 128, n & 63 | 128);
765
+ } else if (n < 1114112) {
766
+ if ((t -= 4) < 0) break;
767
+ a.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, n & 63 | 128);
768
+ } else throw Error("Invalid code point");
769
+ }
770
+ return a;
771
+ }
772
+ function de(e) {
773
+ let t = [];
774
+ for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
775
+ return t;
680
776
  }
681
- setFilesystem(e, t = {}) {
682
- let r = this.fs._getFileRaw(this.getVar("PATH")) || {}, i = this.fs.getRawPermissions(), a = this.fs._onChange;
683
- this.fs = new n(this.fs.cwd, e, Object.assign({}, i, t), a), this.fs.addFiles(r);
777
+ function fe(e, t) {
778
+ let n, r, i, a = [];
779
+ for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
780
+ return a;
684
781
  }
685
- setCwd(e) {
686
- this.fs.setCwd(e);
782
+ function pe(e) {
783
+ return t.toByteArray(le(e));
687
784
  }
688
- source(e) {
689
- this.vars = Object.assign({}, this.vars, e.vars), this.aliases = Object.assign({}, this.aliases, e.aliases);
785
+ function me(e, t, n, r) {
786
+ let i;
787
+ for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
788
+ return i;
690
789
  }
691
- clear() {
692
- typeof this._clearFn == "function" && this._clearFn();
790
+ function J(e, t) {
791
+ return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
693
792
  }
694
- destroy(e = 0) {
695
- typeof this._destroyFn == "function" && this._destroyFn(e);
793
+ function he(e) {
794
+ return e !== e;
696
795
  }
697
- };
698
- })), j = /* @__PURE__ */ t(((e, t) => {
699
- var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
700
- return Function.prototype.apply.call(e, t, n);
701
- }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
702
- return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
703
- } : function(e) {
704
- return Object.getOwnPropertyNames(e);
705
- };
706
- function a(e) {
707
- console && console.warn && console.warn(e);
708
- }
709
- var o = Number.isNaN || function(e) {
710
- return e !== e;
711
- };
712
- function s() {
713
- s.init.call(this);
714
- }
715
- t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
716
- var c = 10;
717
- function l(e) {
718
- if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
719
- }
720
- Object.defineProperty(s, "defaultMaxListeners", {
721
- enumerable: !0,
722
- get: function() {
723
- return c;
724
- },
725
- set: function(e) {
726
- if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
727
- c = e;
796
+ let ge = (function() {
797
+ let e = "0123456789abcdef", t = Array(256);
798
+ for (let n = 0; n < 16; ++n) {
799
+ let r = n * 16;
800
+ for (let i = 0; i < 16; ++i) t[r + i] = e[n] + e[i];
801
+ }
802
+ return t;
803
+ })();
804
+ function Y(e) {
805
+ return typeof BigInt > "u" ? _e : e;
728
806
  }
729
- }), s.init = function() {
730
- (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
731
- }, s.prototype.setMaxListeners = function(e) {
732
- if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
733
- return this._maxListeners = e, this;
734
- };
735
- function u(e) {
736
- return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
737
- }
738
- s.prototype.getMaxListeners = function() {
739
- return u(this);
740
- }, s.prototype.emit = function(e) {
741
- for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
742
- var i = e === "error", a = this._events;
743
- if (a !== void 0) i &&= a.error === void 0;
744
- else if (!i) return !1;
745
- if (i) {
746
- var o;
747
- if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
748
- var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
749
- throw s.context = o, s;
807
+ function _e() {
808
+ throw Error("BigInt not supported");
750
809
  }
751
- var c = a[e];
752
- if (c === void 0) return !1;
753
- if (typeof c == "function") r(c, this, t);
754
- else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
755
- return !0;
756
- };
757
- function d(e, t, n, r) {
758
- var i, o, s;
759
- if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
760
- else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
761
- s.warned = !0;
762
- var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
763
- c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
810
+ })(f), x = f.Buffer, f.Blob, f.BlobOptions, f.Buffer, f.File, f.FileOptions, f.INSPECT_MAX_BYTES, f.SlowBuffer, f.TranscodeEncoding, f.atob, f.btoa, f.constants, f.isAscii, f.isUtf8, f.kMaxLength, f.kStringMaxLength, f.resolveObjectURL, f.transcode;
811
+ })), C = /* @__PURE__ */ t(((e, t) => {
812
+ var n = new Set([
813
+ "getFileByPath",
814
+ "setFileByPath",
815
+ "deleteFileByPath",
816
+ "exists",
817
+ "stat",
818
+ "absolutePath",
819
+ "getMode",
820
+ "setMode",
821
+ "isReadable",
822
+ "isWritable",
823
+ "isExecutable",
824
+ "getSize",
825
+ "autoComplete",
826
+ "isRealFilesystem",
827
+ "isSymlink"
828
+ ]);
829
+ t.exports = class {
830
+ isReadable(e) {
831
+ let t = this.getMode(e);
832
+ return t === null ? !1 : (t & 256) != 0;
764
833
  }
765
- return e;
766
- }
767
- s.prototype.addListener = function(e, t) {
768
- return d(this, e, t, !1);
769
- }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
770
- return d(this, e, t, !0);
771
- };
772
- function f() {
773
- if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
774
- }
775
- function p(e, t, n) {
776
- var r = {
777
- fired: !1,
778
- wrapFn: void 0,
779
- target: e,
780
- type: t,
781
- listener: n
782
- }, i = f.bind(r);
783
- return i.listener = n, r.wrapFn = i, i;
784
- }
785
- s.prototype.once = function(e, t) {
786
- return l(t), this.on(e, p(this, e, t)), this;
787
- }, s.prototype.prependOnceListener = function(e, t) {
788
- return l(t), this.prependListener(e, p(this, e, t)), this;
789
- }, s.prototype.removeListener = function(e, t) {
790
- var n, r, i, a, o;
791
- if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
792
- if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
793
- else if (typeof n != "function") {
794
- for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
795
- o = n[a].listener, i = a;
796
- break;
797
- }
798
- if (i < 0) return this;
799
- i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
834
+ isWritable(e) {
835
+ let t = this.getMode(e);
836
+ return t === null ? !1 : (t & 128) != 0;
800
837
  }
801
- return this;
802
- }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
803
- var t, n = this._events, r;
804
- if (n === void 0) return this;
805
- if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
806
- if (arguments.length === 0) {
807
- var i = Object.keys(n), a;
808
- for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
809
- return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
838
+ isExecutable(e) {
839
+ let t = this.getMode(e);
840
+ return t === null ? !1 : (t & 64) != 0;
810
841
  }
811
- if (t = n[e], typeof t == "function") this.removeListener(e, t);
812
- else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
813
- return this;
814
- };
815
- function m(e, t, n) {
816
- var r = e._events;
817
- if (r === void 0) return [];
818
- var i = r[t];
819
- return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
820
- }
821
- s.prototype.listeners = function(e) {
822
- return m(this, e, !0);
823
- }, s.prototype.rawListeners = function(e) {
824
- return m(this, e, !1);
825
- }, s.listenerCount = function(e, t) {
826
- return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
827
- }, s.prototype.listenerCount = h;
828
- function h(e) {
829
- var t = this._events;
830
- if (t !== void 0) {
831
- var n = t[e];
832
- if (typeof n == "function") return 1;
833
- if (n !== void 0) return n.length;
842
+ sandbox() {
843
+ let e = this;
844
+ return new Proxy(Object.create(null), {
845
+ get(t, r) {
846
+ if (!n.has(r)) return;
847
+ let i = e[r];
848
+ return typeof i == "function" ? i.bind(e) : i;
849
+ },
850
+ set() {
851
+ return !1;
852
+ },
853
+ has(e, t) {
854
+ return n.has(t);
855
+ }
856
+ });
857
+ }
858
+ _triggerChange() {
859
+ !this._onChange || this._changeScheduled || (this._changeScheduled = !0, Promise.resolve().then(() => {
860
+ this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(this.getRaw(), this.getRawPermissions());
861
+ }));
834
862
  }
835
- return 0;
836
- }
837
- s.prototype.eventNames = function() {
838
- return this._eventsCount > 0 ? i(this._events) : [];
839
863
  };
840
- function g(e, t) {
841
- for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
842
- return n;
843
- }
844
- function _(e, t) {
845
- for (; t + 1 < e.length; t++) e[t] = e[t + 1];
846
- e.pop();
847
- }
848
- function v(e) {
849
- for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
850
- return t;
851
- }
852
- function y(e, t) {
853
- return new Promise(function(n, r) {
854
- function i(n) {
855
- e.removeListener(t, a), r(n);
856
- }
857
- function a() {
858
- typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
859
- }
860
- x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
861
- });
862
- }
863
- function b(e, t, n) {
864
- typeof e.on == "function" && x(e, "error", t, n);
865
- }
866
- function x(e, t, n, r) {
867
- if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
868
- else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
869
- r.once && e.removeEventListener(t, i), n(a);
870
- });
871
- else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
872
- }
873
- })), M = /* @__PURE__ */ t(((e, t) => {
874
- var n = ["out", "err"];
875
- t.exports = class {
864
+ })), w = /* @__PURE__ */ t(((e, t) => {
865
+ S();
866
+ var n = C(), r = class extends Uint8Array {
876
867
  constructor(e, t) {
877
- if (!n.includes(e)) throw Error("incorrect std output type");
878
- this.type = e, this.string = t;
868
+ super(e), Object.defineProperty(this, "mimeType", {
869
+ value: t,
870
+ enumerable: !1,
871
+ configurable: !1,
872
+ writable: !1
873
+ });
874
+ }
875
+ toString() {
876
+ if (x !== void 0) return `data:${this.mimeType};base64,${x.from(this).toString("base64")}`;
877
+ let e = "", t = 8192;
878
+ for (let n = 0; n < this.length; n += t) e += String.fromCharCode(...this.subarray(n, n + t));
879
+ return `data:${this.mimeType};base64,${btoa(e)}`;
879
880
  }
880
881
  };
881
- })), N = /* @__PURE__ */ t(((e, t) => {
882
- var n = M();
883
- t.exports = class {
884
- constructor(e = [], t = 0) {
885
- if (typeof t != "number") throw Error("Command Result ExitCode must be a number");
886
- if (!Array.isArray(e)) throw Error("Command Result be array");
887
- this.std = e, this.exitCode = t;
882
+ function i(e) {
883
+ for (let t of Object.keys(e)) {
884
+ let n = e[t];
885
+ if (typeof n == "object" && n && !(n instanceof Uint8Array)) i(n);
886
+ else if (typeof n == "string" && n.startsWith("data:")) {
887
+ let i = n.indexOf(";"), a = n.indexOf(",", i);
888
+ if (i !== -1 && a !== -1 && n.slice(i + 1, a) === "base64") {
889
+ let o = n.slice(5, i), s = n.slice(a + 1), c;
890
+ if (x !== void 0) c = new Uint8Array(x.from(s, "base64"));
891
+ else {
892
+ let e = atob(s);
893
+ c = new Uint8Array(e.length);
894
+ for (let t = 0; t < e.length; t++) c[t] = e.charCodeAt(t);
895
+ }
896
+ e[t] = new r(c.buffer, o);
897
+ }
898
+ }
888
899
  }
889
- addStdOutLine(e) {
890
- this.std.push(new n("out", e));
900
+ }
901
+ t.exports = class extends n {
902
+ constructor(e = "/", t = {}, n = {}, r = null) {
903
+ super(), i(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
891
904
  }
892
- addStdErrLine(e) {
893
- this.std.push(new n("err", e));
905
+ getFileByPath(e) {
906
+ let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
907
+ return t == null || !this.isReadable(e) ? null : t;
894
908
  }
895
- getStdOutput() {
896
- return this.std;
909
+ _getFileRaw(e) {
910
+ return this._getFileByAbsolutePath(this._pathToAbsolute(e));
897
911
  }
898
- getExitCode() {
899
- return this.exitCode;
912
+ exists(e) {
913
+ return this._getFileByAbsolutePath(this._pathToAbsolute(e)) != null;
900
914
  }
901
- flush() {
902
- let e = this.std;
903
- return this.std = [], e;
915
+ stat(e) {
916
+ let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
917
+ return t == null ? null : {
918
+ isDirectory: t.constructor === Object,
919
+ isFile: typeof t == "string" || t instanceof Uint8Array,
920
+ isCommand: typeof t == "function",
921
+ isBinary: t instanceof Uint8Array
922
+ };
904
923
  }
905
- };
906
- })), P = /* @__PURE__ */ t(((e, t) => {
907
- var n = j(), r = N(), i = n.EventEmitter || n.default || n;
908
- t.exports = class extends i {
909
- constructor(e) {
910
- super(), this.arguments = e, this.result = new r();
924
+ _pathToAbsolute(e) {
925
+ return e.startsWith("./") && (e = e.substring(2)), e.startsWith("/") || (e = this.cwd + e), this._traverseComplexAbsolutePath(e);
911
926
  }
912
- get name() {
913
- return "unnamed";
927
+ _traverseComplexAbsolutePath(e) {
928
+ let t = e.split("/");
929
+ for (; t.includes("..");) {
930
+ let e = t.indexOf("..") - 1;
931
+ t.splice(e, 2);
932
+ }
933
+ return t.join("/");
914
934
  }
915
- run() {
916
- return Promise.reject("Command not implemented...");
935
+ absolutePath(e) {
936
+ return this._pathToAbsolute(e);
917
937
  }
918
- runCommand() {
919
- return this.run().then((e) => (e && e.split(/\r?\n/).forEach((e) => this.stdOut = e), this.result)).catch((e) => {
920
- if (e && e.__type) throw e;
921
- return e && (this.stdErr = e.message || e), this.exitCode = 127, this.result;
922
- });
938
+ setFileByPath(e, t, n = !1) {
939
+ let r = this._pathToAbsolute(e);
940
+ if (this._getFileByAbsolutePath(r) != null) {
941
+ if (!this.isWritable(e)) throw Error("Permission denied");
942
+ } else {
943
+ let e = r.split("/");
944
+ e.pop();
945
+ let t = e.join("/") || "/", n = this.getMode(t);
946
+ if (n !== null && !(n & 128)) throw Error("Permission denied");
947
+ }
948
+ this._setFileByAbsolutePath(r, t, n), this._triggerChange();
923
949
  }
924
- onInput(e) {}
925
- set exitCode(e) {
926
- this.result.exitCode = e;
950
+ _setFileRaw(e, t, n = !1) {
951
+ let r = this._pathToAbsolute(e);
952
+ this._setFileByAbsolutePath(r, t, n), this._triggerChange();
927
953
  }
928
- set stdOut(e) {
929
- this.result.addStdOutLine(e);
954
+ _setFileByAbsolutePath(e, t, n = !0) {
955
+ let r = e.split("/");
956
+ r.shift();
957
+ let i = r.pop(), a = r.reduce((e, t) => {
958
+ if (!e[t]) {
959
+ if (!n) throw Error(`${t}: No such file or directory`);
960
+ e[t] = {};
961
+ }
962
+ return e[t];
963
+ }, this.fileSystem);
964
+ a[i] = t;
930
965
  }
931
- set stdErr(e) {
932
- this.result.addStdErrLine(e);
966
+ _getFileByAbsolutePath(e) {
967
+ let t = e.split("/");
968
+ return t.shift(), t[t.length - 1].length < 1 && t.pop(), t.reduce((e, t) => e && e[t] ? e[t] : null, this.fileSystem);
933
969
  }
934
- flush() {
935
- this.emit("flush", this.result.flush());
970
+ deleteFileByPath(e) {
971
+ let t = this._pathToAbsolute(e), n = t.split("/");
972
+ n.pop();
973
+ let r = n.join("/") || "/", i = this.getMode(r);
974
+ if (i !== null && !(i & 128)) throw Error(`${e}: Permission denied`);
975
+ this._deleteByAbsolutePath(t);
976
+ let a = t + "/";
977
+ Object.keys(this.permissions).forEach((e) => {
978
+ (e === t || e.startsWith(a)) && delete this.permissions[e];
979
+ }), this._triggerChange();
936
980
  }
937
- };
938
- })), F = /* @__PURE__ */ t(((e, t) => {
939
- var n = P();
940
- t.exports = class extends n {
941
- constructor(e, t) {
942
- super(e), this.context = t;
981
+ _deleteByAbsolutePath(e) {
982
+ let t = e.split("/");
983
+ t.shift(), t[t.length - 1] === "" && t.pop();
984
+ let n = t.pop();
985
+ if (!n) return;
986
+ let r = t.reduce((e, t) => e && e[t] ? e[t] : null, this.fileSystem);
987
+ r && n in r && delete r[n];
943
988
  }
944
- };
945
- })), I = /* @__PURE__ */ t(((e, t) => {
946
- i();
947
- var n = F();
948
- function a(e) {
949
- return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
950
- }
951
- t.exports = class extends n {
952
- constructor(e, t, n, r = !1) {
953
- super(t, n), this.script = e, this.source = r;
989
+ getMode(e) {
990
+ let t = this._pathToAbsolute(e);
991
+ if (this.permissions[t] !== void 0) return this.permissions[t];
992
+ let n = this._getFileByAbsolutePath(t);
993
+ return n == null ? null : n.constructor === Object ? 493 : typeof n == "function" ? 365 : 420;
954
994
  }
955
- get captureInput() {
956
- return !!(this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand.captureInput);
995
+ setMode(e, t) {
996
+ let n = this._pathToAbsolute(e);
997
+ this.permissions[n] = t, this._triggerChange();
957
998
  }
958
- onInput(e) {
959
- this.sandbox && this.sandbox.onInput(e);
999
+ getSize(e) {
1000
+ let t = this._pathToAbsolute(e), n = this._getFileByAbsolutePath(t);
1001
+ return n == null ? 0 : n.constructor === Object ? JSON.stringify(n).length : n instanceof Uint8Array ? n.length : n.toString().length;
960
1002
  }
961
- run() {
962
- let e = this.context.fs.isRealFilesystem ? { useRealFilesystem: !0 } : {
963
- filesystem: this.context.fs.getRaw(),
964
- permissions: this.context.fs.getRawPermissions()
965
- };
966
- this.sandbox = new r.shell({
967
- cwd: this.context.fs.cwd,
968
- ...e
969
- }), this.sandbox.context.source(this.context), this.sandbox.on("stdOut", (e) => {
970
- this.stdOut = e, this.flush();
971
- }), this.sandbox.on("stdErr", (e) => {
972
- this.stdErr = e, this.flush();
973
- }), this._scriptFunctions = {};
974
- let t = this.script.split(/\r?\n/);
975
- if (!a(t[0])) {
976
- let e = t[0].startsWith("#!") ? t[0].slice(2).split(/\s/)[0] : t[0];
977
- return Promise.reject(`${e}: bad interpreter: No such file or directory`);
978
- }
979
- let n = this._parseLines(t.slice(1));
980
- return this._executeNodes(n).catch((e) => {
981
- if (e && e.__type === "return") this.sandbox.lastCode = e.code;
982
- else if (e && e.__type === "errexit") this.sandbox.lastCode = e.code;
983
- else if (e && (e.__type === "break" || e.__type === "continue")) this.stdErr = `${e.__type}: only meaningful in a for or while loop`, this.sandbox.lastCode = 1;
984
- else return Promise.reject(e);
985
- }).then(() => {
986
- this.exitCode = this.sandbox.lastCode, this.source && this.context.source(this.sandbox.context);
1003
+ getRawPermissions() {
1004
+ return Object.assign({}, this.permissions);
1005
+ }
1006
+ setCwd(e) {
1007
+ this.cwd = this._pathToAbsolute(e.endsWith("/") ? e : e + "/");
1008
+ }
1009
+ getRaw() {
1010
+ return this.fileSystem;
1011
+ }
1012
+ addFiles(e) {
1013
+ Object.entries(e).forEach(([e, t]) => {
1014
+ this._setFileRaw(e, t, !0);
987
1015
  });
988
1016
  }
989
- _parseLines(e) {
990
- let t = [], n = 0;
991
- for (; n < e.length;) {
992
- let r = e[n].trim();
993
- if (!r || r.startsWith("#")) {
994
- n++;
995
- continue;
996
- }
997
- if (r.startsWith("if ") || r === "if") {
998
- let r = this._parseIf(e, n);
999
- t.push(r.node), n += r.consumed;
1000
- continue;
1001
- }
1002
- if (r.startsWith("while ")) {
1003
- let r = this._parseWhile(e, n);
1004
- t.push(r.node), n += r.consumed;
1005
- continue;
1006
- }
1007
- if (r.startsWith("for ")) {
1008
- let r = this._parseFor(e, n);
1009
- t.push(r.node), n += r.consumed;
1010
- continue;
1011
- }
1012
- if (r.startsWith("case ") || r === "case") {
1013
- let r = this._parseCase(e, n);
1014
- t.push(r.node), n += r.consumed;
1015
- continue;
1016
- }
1017
- if (/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)) {
1018
- let r = this._parseFunction(e, n);
1019
- t.push(r.node), n += r.consumed;
1020
- continue;
1017
+ autoComplete(e, t) {
1018
+ let n = this._pathToAbsolute(e).split("/"), r = n.pop(), i = this._getFileRaw(n.length > 1 ? n.join("/") : "/"), a = this._getFileRaw(t);
1019
+ if (i && i.constructor === Object) {
1020
+ let t = Object.keys(i).filter((e) => e.startsWith(r));
1021
+ r.length < 1 && (t = t.filter((e) => !e.startsWith(".")));
1022
+ let n = e.split("/");
1023
+ n.pop();
1024
+ let o = i;
1025
+ if (t.length < 1 && n.length < 1 && a && (t = Object.keys(a).filter((e) => e.startsWith(r)), o = a), t.length) return {
1026
+ path: n.length ? n.join("/") : null,
1027
+ options: t.map((e) => o[e] && o[e].constructor === Object ? e.concat("/") : e)
1028
+ };
1029
+ }
1030
+ return null;
1031
+ }
1032
+ }, t.exports.BinaryFile = r;
1033
+ }));
1034
+ //#endregion
1035
+ //#region node_modules/vite-plugin-node-polyfills/shims/process/dist/index.js
1036
+ function T(e) {
1037
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1038
+ }
1039
+ function E() {
1040
+ throw Error("setTimeout has not been defined");
1041
+ }
1042
+ function D() {
1043
+ throw Error("clearTimeout has not been defined");
1044
+ }
1045
+ function O(e) {
1046
+ if (F === setTimeout) return setTimeout(e, 0);
1047
+ if ((F === E || !F) && setTimeout) return F = setTimeout, setTimeout(e, 0);
1048
+ try {
1049
+ return F(e, 0);
1050
+ } catch {
1051
+ try {
1052
+ return F.call(null, e, 0);
1053
+ } catch {
1054
+ return F.call(this, e, 0);
1055
+ }
1056
+ }
1057
+ }
1058
+ function k(e) {
1059
+ if (I === clearTimeout) return clearTimeout(e);
1060
+ if ((I === D || !I) && clearTimeout) return I = clearTimeout, clearTimeout(e);
1061
+ try {
1062
+ return I(e);
1063
+ } catch {
1064
+ try {
1065
+ return I.call(null, e);
1066
+ } catch {
1067
+ return I.call(this, e);
1068
+ }
1069
+ }
1070
+ }
1071
+ function A() {
1072
+ !R || !z || (R = !1, z.length ? L = z.concat(L) : te = -1, L.length && j());
1073
+ }
1074
+ function j() {
1075
+ if (!R) {
1076
+ var e = O(A);
1077
+ R = !0;
1078
+ for (var t = L.length; t;) {
1079
+ for (z = L, L = []; ++te < t;) z && z[te].run();
1080
+ te = -1, t = L.length;
1081
+ }
1082
+ z = null, R = !1, k(e);
1083
+ }
1084
+ }
1085
+ function M(e, t) {
1086
+ this.fun = e, this.array = t;
1087
+ }
1088
+ function N() {}
1089
+ var ee, P, F, I, L, R, z, te, B, V, H = e((() => {
1090
+ ee = { exports: {} }, P = ee.exports = {}, (function() {
1091
+ try {
1092
+ F = typeof setTimeout == "function" ? setTimeout : E;
1093
+ } catch {
1094
+ F = E;
1095
+ }
1096
+ try {
1097
+ I = typeof clearTimeout == "function" ? clearTimeout : D;
1098
+ } catch {
1099
+ I = D;
1100
+ }
1101
+ })(), L = [], R = !1, te = -1, P.nextTick = function(e) {
1102
+ var t = Array(arguments.length - 1);
1103
+ if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
1104
+ L.push(new M(e, t)), L.length === 1 && !R && O(j);
1105
+ }, M.prototype.run = function() {
1106
+ this.fun.apply(null, this.array);
1107
+ }, P.title = "browser", P.browser = !0, P.env = {}, P.argv = [], P.version = "", P.versions = {}, P.on = N, P.addListener = N, P.once = N, P.off = N, P.removeListener = N, P.removeAllListeners = N, P.emit = N, P.prependListener = N, P.prependOnceListener = N, P.listeners = function(e) {
1108
+ return [];
1109
+ }, P.binding = function(e) {
1110
+ throw Error("process.binding is not supported");
1111
+ }, P.cwd = function() {
1112
+ return "/";
1113
+ }, P.chdir = function(e) {
1114
+ throw Error("process.chdir is not supported");
1115
+ }, P.umask = function() {
1116
+ return 0;
1117
+ }, B = ee.exports, V = /* @__PURE__ */ T(B);
1118
+ })), U = /* @__PURE__ */ t(((e, t) => {
1119
+ t.exports = null;
1120
+ })), ne = /* @__PURE__ */ t(((e, t) => {
1121
+ H();
1122
+ function n(e) {
1123
+ if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
1124
+ }
1125
+ function r(e, t) {
1126
+ for (var n = "", r = 0, i = -1, a = 0, o, s = 0; s <= e.length; ++s) {
1127
+ if (s < e.length) o = e.charCodeAt(s);
1128
+ else if (o === 47) break;
1129
+ else o = 47;
1130
+ if (o === 47) {
1131
+ if (!(i === s - 1 || a === 1)) if (i !== s - 1 && a === 2) {
1132
+ if (n.length < 2 || r !== 2 || n.charCodeAt(n.length - 1) !== 46 || n.charCodeAt(n.length - 2) !== 46) {
1133
+ if (n.length > 2) {
1134
+ var c = n.lastIndexOf("/");
1135
+ if (c !== n.length - 1) {
1136
+ c === -1 ? (n = "", r = 0) : (n = n.slice(0, c), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
1137
+ continue;
1138
+ }
1139
+ } else if (n.length === 2 || n.length === 1) {
1140
+ n = "", r = 0, i = s, a = 0;
1141
+ continue;
1142
+ }
1143
+ }
1144
+ t && (n.length > 0 ? n += "/.." : n = "..", r = 2);
1145
+ } else n.length > 0 ? n += "/" + e.slice(i + 1, s) : n = e.slice(i + 1, s), r = s - i - 1;
1146
+ i = s, a = 0;
1147
+ } else o === 46 && a !== -1 ? ++a : a = -1;
1148
+ }
1149
+ return n;
1150
+ }
1151
+ function i(e, t) {
1152
+ var n = t.dir || t.root, r = t.base || (t.name || "") + (t.ext || "");
1153
+ return n ? n === t.root ? n + r : n + e + r : r;
1154
+ }
1155
+ var a = {
1156
+ resolve: function() {
1157
+ for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
1158
+ var o;
1159
+ a >= 0 ? o = arguments[a] : (i === void 0 && (i = V.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
1160
+ }
1161
+ return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
1162
+ },
1163
+ normalize: function(e) {
1164
+ if (n(e), e.length === 0) return ".";
1165
+ var t = e.charCodeAt(0) === 47, i = e.charCodeAt(e.length - 1) === 47;
1166
+ return e = r(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && i && (e += "/"), t ? "/" + e : e;
1167
+ },
1168
+ isAbsolute: function(e) {
1169
+ return n(e), e.length > 0 && e.charCodeAt(0) === 47;
1170
+ },
1171
+ join: function() {
1172
+ if (arguments.length === 0) return ".";
1173
+ for (var e, t = 0; t < arguments.length; ++t) {
1174
+ var r = arguments[t];
1175
+ n(r), r.length > 0 && (e === void 0 ? e = r : e += "/" + r);
1176
+ }
1177
+ return e === void 0 ? "." : a.normalize(e);
1178
+ },
1179
+ relative: function(e, t) {
1180
+ if (n(e), n(t), e === t || (e = a.resolve(e), t = a.resolve(t), e === t)) return "";
1181
+ for (var r = 1; r < e.length && e.charCodeAt(r) === 47; ++r);
1182
+ for (var i = e.length, o = i - r, s = 1; s < t.length && t.charCodeAt(s) === 47; ++s);
1183
+ for (var c = t.length - s, l = o < c ? o : c, u = -1, d = 0; d <= l; ++d) {
1184
+ if (d === l) {
1185
+ if (c > l) {
1186
+ if (t.charCodeAt(s + d) === 47) return t.slice(s + d + 1);
1187
+ if (d === 0) return t.slice(s + d);
1188
+ } else o > l && (e.charCodeAt(r + d) === 47 ? u = d : d === 0 && (u = 0));
1189
+ break;
1021
1190
  }
1022
- t.push({
1023
- type: "command",
1024
- line: r
1025
- }), n++;
1191
+ var f = e.charCodeAt(r + d);
1192
+ if (f !== t.charCodeAt(s + d)) break;
1193
+ f === 47 && (u = d);
1026
1194
  }
1027
- return t;
1028
- }
1029
- _parseIf(e, t) {
1030
- let n = (e) => e.replace(/^(?:if|elif)\s+/, "").replace(/\s*;\s*then\s*$/, "").replace(/\s+then\s*$/, "").trim(), r = [{
1031
- condition: n(e[t].trim()),
1032
- bodyLines: []
1033
- }], i = [], a = r[0], o = !1, s = 1, c = t + 1;
1034
- for (c < e.length && e[c].trim() === "then" && c++; c < e.length;) {
1035
- let t = e[c].trim();
1036
- if ((t.startsWith("if ") || t === "if") && s++, t === "fi" && (s--, s === 0)) {
1037
- c++;
1195
+ var p = "";
1196
+ for (d = r + u + 1; d <= i; ++d) (d === i || e.charCodeAt(d) === 47) && (p.length === 0 ? p += ".." : p += "/..");
1197
+ return p.length > 0 ? p + t.slice(s + u) : (s += u, t.charCodeAt(s) === 47 && ++s, t.slice(s));
1198
+ },
1199
+ _makeLong: function(e) {
1200
+ return e;
1201
+ },
1202
+ dirname: function(e) {
1203
+ if (n(e), e.length === 0) return ".";
1204
+ for (var t = e.charCodeAt(0), r = t === 47, i = -1, a = !0, o = e.length - 1; o >= 1; --o) if (t = e.charCodeAt(o), t === 47) {
1205
+ if (!a) {
1206
+ i = o;
1038
1207
  break;
1039
1208
  }
1040
- if (s === 1 && t.startsWith("elif ")) {
1041
- let i = {
1042
- condition: n(t),
1043
- bodyLines: []
1044
- };
1045
- r.push(i), a = i, c++, c < e.length && e[c].trim() === "then" && c++;
1046
- continue;
1209
+ } else a = !1;
1210
+ return i === -1 ? r ? "/" : "." : r && i === 1 ? "//" : e.slice(0, i);
1211
+ },
1212
+ basename: function(e, t) {
1213
+ if (t !== void 0 && typeof t != "string") throw TypeError("\"ext\" argument must be a string");
1214
+ n(e);
1215
+ var r = 0, i = -1, a = !0, o;
1216
+ if (t !== void 0 && t.length > 0 && t.length <= e.length) {
1217
+ if (t.length === e.length && t === e) return "";
1218
+ var s = t.length - 1, c = -1;
1219
+ for (o = e.length - 1; o >= 0; --o) {
1220
+ var l = e.charCodeAt(o);
1221
+ if (l === 47) {
1222
+ if (!a) {
1223
+ r = o + 1;
1224
+ break;
1225
+ }
1226
+ } else c === -1 && (a = !1, c = o + 1), s >= 0 && (l === t.charCodeAt(s) ? --s === -1 && (i = o) : (s = -1, i = c));
1047
1227
  }
1048
- if (s === 1 && t === "else") {
1049
- o = !0, c++;
1228
+ return r === i ? i = c : i === -1 && (i = e.length), e.slice(r, i);
1229
+ } else {
1230
+ for (o = e.length - 1; o >= 0; --o) if (e.charCodeAt(o) === 47) {
1231
+ if (!a) {
1232
+ r = o + 1;
1233
+ break;
1234
+ }
1235
+ } else i === -1 && (a = !1, i = o + 1);
1236
+ return i === -1 ? "" : e.slice(r, i);
1237
+ }
1238
+ },
1239
+ extname: function(e) {
1240
+ n(e);
1241
+ for (var t = -1, r = 0, i = -1, a = !0, o = 0, s = e.length - 1; s >= 0; --s) {
1242
+ var c = e.charCodeAt(s);
1243
+ if (c === 47) {
1244
+ if (!a) {
1245
+ r = s + 1;
1246
+ break;
1247
+ }
1050
1248
  continue;
1051
1249
  }
1052
- o ? i.push(e[c]) : a.bodyLines.push(e[c]), c++;
1250
+ i === -1 && (a = !1, i = s + 1), c === 46 ? t === -1 ? t = s : o !== 1 && (o = 1) : t !== -1 && (o = -1);
1053
1251
  }
1054
- return {
1055
- node: {
1056
- type: "if",
1057
- clauses: r,
1058
- elseLines: i
1059
- },
1060
- consumed: c - t
1252
+ return t === -1 || i === -1 || o === 0 || o === 1 && t === i - 1 && t === r + 1 ? "" : e.slice(t, i);
1253
+ },
1254
+ format: function(e) {
1255
+ if (typeof e != "object" || !e) throw TypeError("The \"pathObject\" argument must be of type Object. Received type " + typeof e);
1256
+ return i("/", e);
1257
+ },
1258
+ parse: function(e) {
1259
+ n(e);
1260
+ var t = {
1261
+ root: "",
1262
+ dir: "",
1263
+ base: "",
1264
+ ext: "",
1265
+ name: ""
1061
1266
  };
1062
- }
1063
- _parseWhile(e, t) {
1064
- let n = e[t].trim().replace(/^while\s+/, "").replace(/\s*;\s*do\s*$/, "").replace(/\s+do\s*$/, "").trim(), r = t + 1;
1065
- r < e.length && e[r].trim() === "do" && r++;
1066
- let i = [], a = 1;
1067
- for (; r < e.length;) {
1068
- let t = e[r].trim();
1069
- if ((t.startsWith("while ") || t.startsWith("for ")) && a++, t === "done" && (a--, a === 0)) {
1070
- r++;
1071
- break;
1267
+ if (e.length === 0) return t;
1268
+ var r = e.charCodeAt(0), i = r === 47, a;
1269
+ i ? (t.root = "/", a = 1) : a = 0;
1270
+ for (var o = -1, s = 0, c = -1, l = !0, u = e.length - 1, d = 0; u >= a; --u) {
1271
+ if (r = e.charCodeAt(u), r === 47) {
1272
+ if (!l) {
1273
+ s = u + 1;
1274
+ break;
1275
+ }
1276
+ continue;
1072
1277
  }
1073
- i.push(e[r]), r++;
1278
+ c === -1 && (l = !1, c = u + 1), r === 46 ? o === -1 ? o = u : d !== 1 && (d = 1) : o !== -1 && (d = -1);
1074
1279
  }
1075
- return {
1076
- node: {
1077
- type: "while",
1078
- condition: n,
1079
- bodyLines: i
1080
- },
1081
- consumed: r - t
1082
- };
1280
+ return o === -1 || c === -1 || d === 0 || d === 1 && o === c - 1 && o === s + 1 ? c !== -1 && (s === 0 && i ? t.base = t.name = e.slice(1, c) : t.base = t.name = e.slice(s, c)) : (s === 0 && i ? (t.name = e.slice(1, o), t.base = e.slice(1, c)) : (t.name = e.slice(s, o), t.base = e.slice(s, c)), t.ext = e.slice(o, c)), s > 0 ? t.dir = e.slice(0, s - 1) : i && (t.dir = "/"), t;
1281
+ },
1282
+ sep: "/",
1283
+ delimiter: ":",
1284
+ win32: null,
1285
+ posix: null
1286
+ };
1287
+ a.posix = a, t.exports = a;
1288
+ })), re = /* @__PURE__ */ t(((e, t) => {
1289
+ H();
1290
+ var n = U(), r = ne(), i = C(), a = class extends i {
1291
+ constructor(e, t = null) {
1292
+ super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || V.cwd());
1083
1293
  }
1084
- _parseFor(e, t) {
1085
- let n = e[t].trim().replace(/\s*;\s*do\s*$/, "").replace(/\s+do\s*$/, "").match(/^for\s+(\w+)\s+in\s+(.+)$/), r = n ? n[1] : "", i = n ? n[2].trim() : "", a = t + 1;
1086
- a < e.length && e[a].trim() === "do" && a++;
1087
- let o = [], s = 1;
1088
- for (; a < e.length;) {
1089
- let t = e[a].trim();
1090
- if ((t.startsWith("while ") || t.startsWith("for ")) && s++, t === "done" && (s--, s === 0)) {
1091
- a++;
1092
- break;
1294
+ get isRealFilesystem() {
1295
+ return !0;
1296
+ }
1297
+ _normalizeCwd(e) {
1298
+ let t = r.resolve(e);
1299
+ return t === "/" ? "/" : t + "/";
1300
+ }
1301
+ absolutePath(e) {
1302
+ e.startsWith("./") && (e = e.slice(2));
1303
+ let t = e.startsWith("/") ? e : r.join(this.cwd, e);
1304
+ return r.normalize(t);
1305
+ }
1306
+ setCwd(e) {
1307
+ let t = e.endsWith("/") ? e.slice(0, -1) : e, n = this.absolutePath(t);
1308
+ this.cwd = n === "/" ? "/" : n + "/";
1309
+ }
1310
+ getFileByPath(e) {
1311
+ let t = this.absolutePath(e);
1312
+ if (this._virtualFiles[t] !== void 0) return this._virtualFiles[t];
1313
+ let i;
1314
+ try {
1315
+ i = n.statSync(t);
1316
+ } catch {
1317
+ return null;
1318
+ }
1319
+ if (i.isDirectory()) {
1320
+ let e = {};
1321
+ try {
1322
+ for (let i of n.readdirSync(t)) {
1323
+ let a = r.join(t, i);
1324
+ if (this._virtualFiles[a] !== void 0) e[i] = this._virtualFiles[a];
1325
+ else try {
1326
+ e[i] = n.statSync(a).isDirectory() ? {} : "";
1327
+ } catch {}
1328
+ }
1329
+ } catch {}
1330
+ let i = t === "/" ? "/" : t + "/";
1331
+ for (let t of Object.keys(this._virtualFiles)) if (t.startsWith(i) && !t.slice(i.length).includes("/")) {
1332
+ let n = t.slice(i.length);
1333
+ n in e || (e[n] = this._virtualFiles[t]);
1093
1334
  }
1094
- o.push(e[a]), a++;
1335
+ return e;
1336
+ }
1337
+ try {
1338
+ return n.readFileSync(t, "utf8");
1339
+ } catch {
1340
+ return null;
1095
1341
  }
1096
- return {
1097
- node: {
1098
- type: "for",
1099
- variable: r,
1100
- list: i,
1101
- bodyLines: o
1102
- },
1103
- consumed: a - t
1104
- };
1105
- }
1106
- async _executeNodes(e) {
1107
- for (let t of e) await this._executeNode(t);
1108
1342
  }
1109
- _executeNode(e) {
1110
- if (e.type === "function") {
1111
- let t = e.name, n = e.bodyLines, r = this, i = F(), a = class extends i {
1112
- static get name() {
1113
- return t;
1114
- }
1115
- run() {
1116
- let e = this.arguments.map((e, t) => ({
1117
- key: String(t + 1),
1118
- prev: r.sandbox.context.getVar(String(t + 1))
1119
- }));
1120
- this.arguments.forEach((e, t) => r.sandbox.context.setVar(String(t + 1), e));
1121
- let t = () => e.forEach(({ key: e, prev: t }) => t ? r.sandbox.context.setVar(e, t) : r.sandbox.context.unsetVar(e));
1122
- return r._executeFunctionBody(n).then(() => {
1123
- t();
1124
- }).catch((e) => {
1125
- if (t(), e && e.__type === "return") {
1126
- this.exitCode = e.code;
1127
- return;
1128
- }
1129
- return Promise.reject(e);
1130
- });
1131
- }
1132
- };
1133
- return this.sandbox.context.setCommand(a), Promise.resolve();
1343
+ setFileByPath(e, t, i = !1) {
1344
+ let a = this.absolutePath(e);
1345
+ if (typeof t == "function") {
1346
+ this._virtualFiles[a] = t;
1347
+ return;
1134
1348
  }
1135
- if (e.type === "command") {
1136
- if (/^return(\s+\d+)?\s*$/.test(e.line.trim())) {
1137
- let t = e.line.trim().match(/^return\s+(\d+)/), n = t ? parseInt(t[1], 10) : 0;
1138
- return Promise.reject({
1139
- __type: "return",
1140
- code: n
1141
- });
1142
- }
1143
- if (/^break(\s+\d+)?\s*$/.test(e.line.trim())) {
1144
- let t = e.line.trim().match(/^break\s+(\d+)/), n = t ? parseInt(t[1], 10) : 1;
1145
- return Promise.reject({
1146
- __type: "break",
1147
- count: n
1148
- });
1149
- }
1150
- if (/^continue(\s+\d+)?\s*$/.test(e.line.trim())) {
1151
- let t = e.line.trim().match(/^continue\s+(\d+)/), n = t ? parseInt(t[1], 10) : 1;
1152
- return Promise.reject({
1153
- __type: "continue",
1154
- count: n
1155
- });
1156
- }
1157
- return (this.sandbox.context.getVar("-") || "").includes("x") && (this.stdErr = `+ ${e.line.trim()}`, this.flush()), this.sandbox.onCommand(e.line, !1).then(() => {
1158
- if ((this.sandbox.context.getVar("-") || "").includes("e") && this.sandbox.lastCode !== 0) return Promise.reject({
1159
- __type: "errexit",
1160
- code: this.sandbox.lastCode
1161
- });
1162
- });
1349
+ if (t != null && t.constructor === Object) {
1350
+ n.mkdirSync(a, { recursive: i }), this._triggerChange();
1351
+ return;
1163
1352
  }
1164
- return e.type === "if" ? this._executeIf(e) : e.type === "while" ? this._executeWhile(e) : e.type === "for" ? this._executeFor(e) : e.type === "case" ? this._executeCase(e) : Promise.resolve();
1353
+ i && n.mkdirSync(r.dirname(a), { recursive: !0 }), n.writeFileSync(a, String(t)), this._triggerChange();
1165
1354
  }
1166
- async _executeIf(e) {
1167
- for (let t of e.clauses) if (await this.sandbox.onCommand(t.condition, !1), this.sandbox.lastCode === 0) return this._executeNodes(this._parseLines(t.bodyLines));
1168
- if (e.elseLines.length > 0) return this._executeNodes(this._parseLines(e.elseLines));
1355
+ deleteFileByPath(e) {
1356
+ let t = this.absolutePath(e);
1357
+ delete this._virtualFiles[t];
1358
+ try {
1359
+ n.lstatSync(t).isDirectory() ? n.rmdirSync(t) : n.unlinkSync(t), this._triggerChange();
1360
+ } catch {}
1169
1361
  }
1170
- async _executeWhile(e) {
1171
- for (; await this.sandbox.onCommand(e.condition, !1), this.sandbox.lastCode === 0;) try {
1172
- await this._executeNodes(this._parseLines(e.bodyLines));
1173
- } catch (e) {
1174
- if (e && e.__type === "break") {
1175
- if (e.count <= 1) break;
1176
- throw {
1177
- __type: "break",
1178
- count: e.count - 1
1179
- };
1180
- }
1181
- if (e && e.__type === "continue") {
1182
- if (e.count <= 1) continue;
1183
- throw {
1184
- __type: "continue",
1185
- count: e.count - 1
1186
- };
1187
- }
1188
- throw e;
1362
+ getMode(e) {
1363
+ let t = this.absolutePath(e);
1364
+ if (this._virtualFiles[t] !== void 0) return typeof this._virtualFiles[t] == "function" ? 493 : 420;
1365
+ try {
1366
+ return n.statSync(t).mode & 511;
1367
+ } catch {
1368
+ return null;
1189
1369
  }
1190
1370
  }
1191
- async _executeFor(e) {
1192
- let t = e.list.replace(/\${?([\w\d]+)}?/g, (e, t) => this.sandbox.context.getVar(t) || "").split(/\s+/).filter(Boolean);
1193
- for (let n of t) {
1194
- this.sandbox.context.setVar(e.variable, n);
1195
- try {
1196
- await this._executeNodes(this._parseLines(e.bodyLines));
1197
- } catch (e) {
1198
- if (e && e.__type === "break") {
1199
- if (e.count <= 1) break;
1200
- throw {
1201
- __type: "break",
1202
- count: e.count - 1
1203
- };
1204
- }
1205
- if (e && e.__type === "continue") {
1206
- if (e.count <= 1) continue;
1207
- throw {
1208
- __type: "continue",
1209
- count: e.count - 1
1210
- };
1211
- }
1212
- throw e;
1213
- }
1371
+ setMode(e, t) {
1372
+ let r = this.absolutePath(e);
1373
+ this._virtualFiles[r] === void 0 && (n.chmodSync(r, t), this._triggerChange());
1374
+ }
1375
+ getSize(e) {
1376
+ let t = this.absolutePath(e);
1377
+ if (this._virtualFiles[t] !== void 0) return 0;
1378
+ try {
1379
+ return n.statSync(t).size;
1380
+ } catch {
1381
+ return 0;
1214
1382
  }
1215
1383
  }
1216
- _parseFunction(e, t) {
1217
- let n = e[t].trim(), r = n.match(/^function\s+([\w\d_]+)/) || n.match(/^([\w\d_]+)\s*\(/), i = r ? r[1] : "", a = t + 1;
1218
- if (!n.includes("{")) {
1219
- for (; a < e.length && !e[a].includes("{");) a++;
1220
- a++;
1384
+ isSymlink(e) {
1385
+ let t = this.absolutePath(e);
1386
+ try {
1387
+ return n.lstatSync(t).isSymbolicLink();
1388
+ } catch {
1389
+ return !1;
1221
1390
  }
1222
- let o = [], s = 1;
1223
- for (; a < e.length;) {
1224
- if (e[a].trim() === "}") {
1225
- a++;
1226
- break;
1227
- }
1228
- let t = (e[a].match(/\{/g) || []).length, n = (e[a].match(/\}/g) || []).length;
1229
- if (s += t - n, s <= 0) {
1230
- a++;
1231
- break;
1232
- }
1233
- o.push(e[a]), a++;
1391
+ }
1392
+ readSymlink(e) {
1393
+ let t = this.absolutePath(e);
1394
+ try {
1395
+ return n.readlinkSync(t);
1396
+ } catch {
1397
+ return null;
1234
1398
  }
1235
- return {
1236
- node: {
1237
- type: "function",
1238
- name: i,
1239
- bodyLines: o
1240
- },
1241
- consumed: a - t
1242
- };
1243
1399
  }
1244
- _parseCase(e, t) {
1245
- let n = e[t].trim().match(/^case\s+(.+?)\s+in\s*$/), r = n ? n[1] : "", i = t + 1, a = [], o = null, s = [];
1246
- for (; i < e.length;) {
1247
- let t = e[i], n = t.trim();
1248
- if (i++, !(!n || n.startsWith("#"))) {
1249
- if (n === "esac") break;
1250
- if (o === null) {
1251
- let e = n.match(/^(.+?)\)\s*(.*)$/);
1252
- if (e) {
1253
- o = e[1].trim();
1254
- let t = e[2].trim();
1255
- if (t === ";;") a.push({
1256
- pattern: o,
1257
- bodyLines: []
1258
- }), o = null;
1259
- else if (t.endsWith(";;")) {
1260
- let e = t.slice(0, -2).trim();
1261
- a.push({
1262
- pattern: o,
1263
- bodyLines: e ? [e] : []
1264
- }), o = null;
1265
- } else s = t ? [t] : [];
1266
- }
1267
- } else n === ";;" ? (a.push({
1268
- pattern: o,
1269
- bodyLines: s
1270
- }), o = null, s = []) : n.endsWith(";;") ? (s.push(n.slice(0, -2).trim()), a.push({
1271
- pattern: o,
1272
- bodyLines: s
1273
- }), o = null, s = []) : s.push(t);
1274
- }
1400
+ createSymlink(e, t) {
1401
+ let i = this.absolutePath(t);
1402
+ n.mkdirSync(r.dirname(i), { recursive: !0 }), n.symlinkSync(e, i), this._triggerChange();
1403
+ }
1404
+ getRaw() {
1405
+ return null;
1406
+ }
1407
+ getRawPermissions() {
1408
+ return {};
1409
+ }
1410
+ addFiles(e) {
1411
+ Object.entries(e).forEach(([e, t]) => {
1412
+ this.setFileByPath(e, t, !0);
1413
+ });
1414
+ }
1415
+ autoComplete(e, t) {
1416
+ let i = this.absolutePath(e).split("/"), a = i.pop(), o = i.join("/") || "/", s = [];
1417
+ try {
1418
+ s = n.readdirSync(o);
1419
+ } catch {}
1420
+ let c = o === "/" ? "/" : o + "/";
1421
+ for (let e of Object.keys(this._virtualFiles)) if (e.startsWith(c) && !e.slice(c.length).includes("/")) {
1422
+ let t = e.slice(c.length);
1423
+ s.includes(t) || s.push(t);
1424
+ }
1425
+ let l = s.filter((e) => e.startsWith(a));
1426
+ if (l.length === 0 && !e.includes("/")) {
1427
+ let n = this.getFileByPath(t);
1428
+ if (n && n.constructor === Object && (l = Object.keys(n).filter((t) => t.startsWith(e)), l.length)) return {
1429
+ path: null,
1430
+ options: l
1431
+ };
1275
1432
  }
1276
- return o !== null && a.push({
1277
- pattern: o,
1278
- bodyLines: s
1279
- }), {
1280
- node: {
1281
- type: "case",
1282
- word: r,
1283
- clauses: a
1284
- },
1285
- consumed: i - t
1433
+ if (!l.length) return null;
1434
+ let u = e.split("/");
1435
+ return u.pop(), {
1436
+ path: u.length ? u.join("/") : null,
1437
+ options: l.map((e) => {
1438
+ let t = r.join(o, e);
1439
+ if (this._virtualFiles[t] !== void 0) return e;
1440
+ try {
1441
+ return n.statSync(t).isDirectory() ? e + "/" : e;
1442
+ } catch {
1443
+ return e;
1444
+ }
1445
+ })
1286
1446
  };
1287
1447
  }
1288
- _executeFunctionBody(e) {
1289
- return this._executeNodes(this._parseLines(e));
1290
- }
1291
- async _executeCase(e) {
1292
- let t = await this.sandbox._replaceVariables(e.word), n = t.startsWith("\"") && t.endsWith("\"") || t.startsWith("'") && t.endsWith("'") ? t.slice(1, -1) : t;
1293
- for (let t of e.clauses) if (this._matchPattern(t.pattern, n)) return this._executeNodes(this._parseLines(t.bodyLines));
1448
+ _getFileRaw(e) {
1449
+ return this.getFileByPath(e);
1294
1450
  }
1295
- _matchPattern(e, t) {
1296
- let n = "", r = 0;
1297
- for (; r < e.length;) {
1298
- let t = e[r];
1299
- if (t === "[") {
1300
- let t = e.indexOf("]", r + 1);
1301
- t === -1 ? (n += "\\[", r++) : (n += e.slice(r, t + 1), r = t + 1);
1302
- } else t === "*" ? (n += ".*", r++) : t === "?" ? (n += ".", r++) : /[.+^${}()|\\]/.test(t) ? (n += "\\" + t, r++) : (n += t, r++);
1303
- }
1451
+ exists(e) {
1452
+ let t = this.absolutePath(e);
1453
+ if (this._virtualFiles[t] !== void 0) return !0;
1304
1454
  try {
1305
- return RegExp("^" + n + "$").test(t);
1455
+ return n.statSync(t), !0;
1306
1456
  } catch {
1307
1457
  return !1;
1308
1458
  }
1309
1459
  }
1310
- }, t.exports.isKnownInterpreter = a;
1311
- }));
1312
- //#endregion
1313
- //#region node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
1314
- function L(e) {
1315
- var t = e.length;
1316
- if (t % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
1317
- var n = e.indexOf("=");
1318
- n === -1 && (n = t);
1319
- var r = n === t ? 0 : 4 - n % 4;
1320
- return [n, r];
1321
- }
1322
- function ee(e) {
1323
- var t = L(e), n = t[0], r = t[1];
1324
- return (n + r) * 3 / 4 - r;
1325
- }
1326
- function te(e, t, n) {
1327
- return (t + n) * 3 / 4 - n;
1328
- }
1329
- function R(e) {
1330
- var t, n = L(e), r = n[0], i = n[1], a = new ie(te(e, r, i)), o = 0, s = i > 0 ? r - 4 : r, c;
1331
- for (c = 0; c < s; c += 4) t = U[e.charCodeAt(c)] << 18 | U[e.charCodeAt(c + 1)] << 12 | U[e.charCodeAt(c + 2)] << 6 | U[e.charCodeAt(c + 3)], a[o++] = t >> 16 & 255, a[o++] = t >> 8 & 255, a[o++] = t & 255;
1332
- return i === 2 && (t = U[e.charCodeAt(c)] << 2 | U[e.charCodeAt(c + 1)] >> 4, a[o++] = t & 255), i === 1 && (t = U[e.charCodeAt(c)] << 10 | U[e.charCodeAt(c + 1)] << 4 | U[e.charCodeAt(c + 2)] >> 2, a[o++] = t >> 8 & 255, a[o++] = t & 255), a;
1333
- }
1334
- function z(e) {
1335
- return H[e >> 18 & 63] + H[e >> 12 & 63] + H[e >> 6 & 63] + H[e & 63];
1336
- }
1337
- function ne(e, t, n) {
1338
- for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(z(r));
1339
- return i.join("");
1340
- }
1341
- function B(e) {
1342
- for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(ne(e, o, o + a > s ? s : o + a));
1343
- return r === 1 ? (t = e[n - 1], i.push(H[t >> 2] + H[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(H[t >> 10] + H[t >> 4 & 63] + H[t << 2 & 63] + "=")), i.join("");
1344
- }
1345
- var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
1346
- for (V = {}, re = {}, re.byteLength = ee, re.toByteArray = R, re.fromByteArray = B, H = [], U = [], ie = typeof Uint8Array < "u" ? Uint8Array : Array, ae = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", W = 0, oe = ae.length; W < oe; ++W) H[W] = ae[W], U[ae.charCodeAt(W)] = W;
1347
- U[45] = 62, U[95] = 63, se = {}, se.read = function(e, t, n, r, i) {
1348
- var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
1349
- for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
1350
- for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
1351
- if (a === 0) a = 1 - l;
1352
- else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
1353
- else o += 2 ** r, a -= l;
1354
- return (p ? -1 : 1) * o * 2 ** (a - r);
1355
- }, se.write = function(e, t, n, r, i, a) {
1356
- var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = +(t < 0 || t === 0 && 1 / t < 0);
1357
- for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = +!!isNaN(t), o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
1358
- for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
1359
- e[n + p - m] |= h * 128;
1360
- }, (function(e) {
1361
- let t = re, n = se, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
1362
- e.Buffer = u, e.SlowBuffer = x, e.INSPECT_MAX_BYTES = 50;
1363
- let i = 2147483647;
1364
- e.kMaxLength = i;
1365
- let { Uint8Array: a, ArrayBuffer: o, SharedArrayBuffer: s } = globalThis;
1366
- u.TYPED_ARRAY_SUPPORT = c(), !u.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
1367
- function c() {
1460
+ stat(e) {
1461
+ let t = this.absolutePath(e);
1462
+ if (this._virtualFiles[t] !== void 0) {
1463
+ let e = this._virtualFiles[t];
1464
+ return {
1465
+ isDirectory: e != null && e.constructor === Object,
1466
+ isFile: typeof e == "string" || e instanceof Uint8Array,
1467
+ isCommand: typeof e == "function",
1468
+ isBinary: e instanceof Uint8Array
1469
+ };
1470
+ }
1368
1471
  try {
1369
- let e = new a(1), t = { foo: function() {
1370
- return 42;
1371
- } };
1372
- return Object.setPrototypeOf(t, a.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
1472
+ let e = n.statSync(t);
1473
+ return {
1474
+ isDirectory: e.isDirectory(),
1475
+ isFile: e.isFile(),
1476
+ isCommand: !1
1477
+ };
1373
1478
  } catch {
1374
- return !1;
1479
+ return null;
1375
1480
  }
1376
1481
  }
1377
- Object.defineProperty(u.prototype, "parent", {
1378
- enumerable: !0,
1379
- get: function() {
1380
- if (u.isBuffer(this)) return this.buffer;
1381
- }
1382
- }), Object.defineProperty(u.prototype, "offset", {
1383
- enumerable: !0,
1384
- get: function() {
1385
- if (u.isBuffer(this)) return this.byteOffset;
1386
- }
1387
- });
1388
- function l(e) {
1389
- if (e > i) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
1390
- let t = new a(e);
1391
- return Object.setPrototypeOf(t, u.prototype), t;
1482
+ };
1483
+ t.exports = a, t.exports = a;
1484
+ })), ie = /* @__PURE__ */ t(((e, t) => {
1485
+ var n = w();
1486
+ t.exports = class {
1487
+ constructor(e) {
1488
+ this.options = e;
1489
+ let { cwd: t = "/", clearFn: r, destroyFn: i, onFsChange: a } = this.options;
1490
+ this.vars = {}, this.aliases = {}, this.fs = new n(t, {}, {}, a || null), this._clearFn = r, this._destroyFn = i;
1392
1491
  }
1393
- function u(e, t, n) {
1394
- if (typeof e == "number") {
1395
- if (typeof t == "string") throw TypeError("The \"string\" argument must be of type string. Received type number");
1396
- return m(e);
1397
- }
1398
- return d(e, t, n);
1492
+ setVar(e, t) {
1493
+ t ? this.vars[e] = t : delete this.vars[e];
1399
1494
  }
1400
- u.poolSize = 8192;
1401
- function d(e, t, n) {
1402
- if (typeof e == "string") return h(e, t);
1403
- if (o.isView(e)) return _(e);
1404
- if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
1405
- if (J(e, o) || e && J(e.buffer, o) || s !== void 0 && (J(e, s) || e && J(e.buffer, s))) return v(e, t, n);
1406
- if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
1407
- let r = e.valueOf && e.valueOf();
1408
- if (r != null && r !== e) return u.from(r, t, n);
1409
- let i = y(e);
1410
- if (i) return i;
1411
- if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") return u.from(e[Symbol.toPrimitive]("string"), t, n);
1412
- throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
1495
+ unsetVar(e) {
1496
+ this.setVar(e);
1413
1497
  }
1414
- u.from = function(e, t, n) {
1415
- return d(e, t, n);
1416
- }, Object.setPrototypeOf(u.prototype, a.prototype), Object.setPrototypeOf(u, a);
1417
- function f(e) {
1418
- if (typeof e != "number") throw TypeError("\"size\" argument must be of type number");
1419
- if (e < 0) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
1498
+ getVar(e) {
1499
+ return this.vars[e] || "";
1420
1500
  }
1421
- function p(e, t, n) {
1422
- return f(e), e <= 0 || t === void 0 ? l(e) : typeof n == "string" ? l(e).fill(t, n) : l(e).fill(t);
1501
+ setAlias(e, t) {
1502
+ t ? this.aliases[e] = t : delete this.aliases[e];
1423
1503
  }
1424
- u.alloc = function(e, t, n) {
1425
- return p(e, t, n);
1426
- };
1427
- function m(e) {
1428
- return f(e), l(e < 0 ? 0 : b(e) | 0);
1504
+ unsetAlias(e) {
1505
+ this.setAlias(e);
1429
1506
  }
1430
- u.allocUnsafe = function(e) {
1431
- return m(e);
1432
- }, u.allocUnsafeSlow = function(e) {
1433
- return m(e);
1434
- };
1435
- function h(e, t) {
1436
- if ((typeof t != "string" || t === "") && (t = "utf8"), !u.isEncoding(t)) throw TypeError("Unknown encoding: " + t);
1437
- let n = S(e, t) | 0, r = l(n), i = r.write(e, t);
1438
- return i !== n && (r = r.slice(0, i)), r;
1507
+ getAlias(e) {
1508
+ return this.aliases[e] || null;
1439
1509
  }
1440
- function g(e) {
1441
- let t = e.length < 0 ? 0 : b(e.length) | 0, n = l(t);
1442
- for (let r = 0; r < t; r += 1) n[r] = e[r] & 255;
1443
- return n;
1510
+ setCommand(e) {
1511
+ let t = `${this.getVar("PATH")}/${e.name.toLowerCase()}`;
1512
+ this.fs.addFiles({ [t]: e }), this.fs.setMode(t, 365);
1444
1513
  }
1445
- function _(e) {
1446
- if (J(e, a)) {
1447
- let t = new a(e);
1448
- return v(t.buffer, t.byteOffset, t.byteLength);
1449
- }
1450
- return g(e);
1514
+ getCommand(e) {
1515
+ let t = `${this.getVar("PATH")}/${e}`;
1516
+ return this.fs._getFileRaw(t) || null;
1451
1517
  }
1452
- function v(e, t, n) {
1453
- if (t < 0 || e.byteLength < t) throw RangeError("\"offset\" is outside of buffer bounds");
1454
- if (e.byteLength < t + (n || 0)) throw RangeError("\"length\" is outside of buffer bounds");
1455
- let r;
1456
- return r = t === void 0 && n === void 0 ? new a(e) : n === void 0 ? new a(e, t) : new a(e, t, n), Object.setPrototypeOf(r, u.prototype), r;
1518
+ setNodeFilesystem(e) {
1519
+ let t = re(), n = this.fs._onChange;
1520
+ this.fs = new t(e, n);
1521
+ }
1522
+ setFilesystem(e, t = {}) {
1523
+ let r = this.fs._getFileRaw(this.getVar("PATH")) || {}, i = this.fs.getRawPermissions(), a = this.fs._onChange;
1524
+ this.fs = new n(this.fs.cwd, e, Object.assign({}, i, t), a), this.fs.addFiles(r);
1525
+ }
1526
+ setCwd(e) {
1527
+ this.fs.setCwd(e);
1528
+ }
1529
+ source(e) {
1530
+ this.vars = Object.assign({}, this.vars, e.vars), this.aliases = Object.assign({}, this.aliases, e.aliases);
1531
+ }
1532
+ clear() {
1533
+ typeof this._clearFn == "function" && this._clearFn();
1534
+ }
1535
+ destroy(e = 0) {
1536
+ typeof this._destroyFn == "function" && this._destroyFn(e);
1537
+ }
1538
+ };
1539
+ })), ae = /* @__PURE__ */ t(((e, t) => {
1540
+ var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
1541
+ return Function.prototype.apply.call(e, t, n);
1542
+ }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
1543
+ return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
1544
+ } : function(e) {
1545
+ return Object.getOwnPropertyNames(e);
1546
+ };
1547
+ function a(e) {
1548
+ console && console.warn && console.warn(e);
1549
+ }
1550
+ var o = Number.isNaN || function(e) {
1551
+ return e !== e;
1552
+ };
1553
+ function s() {
1554
+ s.init.call(this);
1555
+ }
1556
+ t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
1557
+ var c = 10;
1558
+ function l(e) {
1559
+ if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
1560
+ }
1561
+ Object.defineProperty(s, "defaultMaxListeners", {
1562
+ enumerable: !0,
1563
+ get: function() {
1564
+ return c;
1565
+ },
1566
+ set: function(e) {
1567
+ if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
1568
+ c = e;
1569
+ }
1570
+ }), s.init = function() {
1571
+ (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
1572
+ }, s.prototype.setMaxListeners = function(e) {
1573
+ if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
1574
+ return this._maxListeners = e, this;
1575
+ };
1576
+ function u(e) {
1577
+ return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
1578
+ }
1579
+ s.prototype.getMaxListeners = function() {
1580
+ return u(this);
1581
+ }, s.prototype.emit = function(e) {
1582
+ for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
1583
+ var i = e === "error", a = this._events;
1584
+ if (a !== void 0) i &&= a.error === void 0;
1585
+ else if (!i) return !1;
1586
+ if (i) {
1587
+ var o;
1588
+ if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
1589
+ var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
1590
+ throw s.context = o, s;
1457
1591
  }
1458
- function y(e) {
1459
- if (u.isBuffer(e)) {
1460
- let t = b(e.length) | 0, n = l(t);
1461
- return n.length === 0 || e.copy(n, 0, 0, t), n;
1592
+ var c = a[e];
1593
+ if (c === void 0) return !1;
1594
+ if (typeof c == "function") r(c, this, t);
1595
+ else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
1596
+ return !0;
1597
+ };
1598
+ function d(e, t, n, r) {
1599
+ var i, o, s;
1600
+ if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
1601
+ else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
1602
+ s.warned = !0;
1603
+ var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
1604
+ c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
1605
+ }
1606
+ return e;
1607
+ }
1608
+ s.prototype.addListener = function(e, t) {
1609
+ return d(this, e, t, !1);
1610
+ }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
1611
+ return d(this, e, t, !0);
1612
+ };
1613
+ function f() {
1614
+ if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
1615
+ }
1616
+ function p(e, t, n) {
1617
+ var r = {
1618
+ fired: !1,
1619
+ wrapFn: void 0,
1620
+ target: e,
1621
+ type: t,
1622
+ listener: n
1623
+ }, i = f.bind(r);
1624
+ return i.listener = n, r.wrapFn = i, i;
1625
+ }
1626
+ s.prototype.once = function(e, t) {
1627
+ return l(t), this.on(e, p(this, e, t)), this;
1628
+ }, s.prototype.prependOnceListener = function(e, t) {
1629
+ return l(t), this.prependListener(e, p(this, e, t)), this;
1630
+ }, s.prototype.removeListener = function(e, t) {
1631
+ var n, r, i, a, o;
1632
+ if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
1633
+ if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
1634
+ else if (typeof n != "function") {
1635
+ for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
1636
+ o = n[a].listener, i = a;
1637
+ break;
1462
1638
  }
1463
- if (e.length !== void 0) return typeof e.length != "number" || he(e.length) ? l(0) : g(e);
1464
- if (e.type === "Buffer" && Array.isArray(e.data)) return g(e.data);
1639
+ if (i < 0) return this;
1640
+ i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
1465
1641
  }
1466
- function b(e) {
1467
- if (e >= i) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes");
1468
- return e | 0;
1642
+ return this;
1643
+ }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
1644
+ var t, n = this._events, r;
1645
+ if (n === void 0) return this;
1646
+ if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
1647
+ if (arguments.length === 0) {
1648
+ var i = Object.keys(n), a;
1649
+ for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
1650
+ return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
1469
1651
  }
1470
- function x(e) {
1471
- return +e != e && (e = 0), u.alloc(+e);
1652
+ if (t = n[e], typeof t == "function") this.removeListener(e, t);
1653
+ else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
1654
+ return this;
1655
+ };
1656
+ function m(e, t, n) {
1657
+ var r = e._events;
1658
+ if (r === void 0) return [];
1659
+ var i = r[t];
1660
+ return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
1661
+ }
1662
+ s.prototype.listeners = function(e) {
1663
+ return m(this, e, !0);
1664
+ }, s.prototype.rawListeners = function(e) {
1665
+ return m(this, e, !1);
1666
+ }, s.listenerCount = function(e, t) {
1667
+ return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
1668
+ }, s.prototype.listenerCount = h;
1669
+ function h(e) {
1670
+ var t = this._events;
1671
+ if (t !== void 0) {
1672
+ var n = t[e];
1673
+ if (typeof n == "function") return 1;
1674
+ if (n !== void 0) return n.length;
1472
1675
  }
1473
- u.isBuffer = function(e) {
1474
- return e != null && e._isBuffer === !0 && e !== u.prototype;
1475
- }, u.compare = function(e, t) {
1476
- if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), J(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
1477
- if (e === t) return 0;
1478
- let n = e.length, r = t.length;
1479
- for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
1480
- n = e[i], r = t[i];
1481
- break;
1482
- }
1483
- return n < r ? -1 : +(r < n);
1484
- }, u.isEncoding = function(e) {
1485
- switch (String(e).toLowerCase()) {
1486
- case "hex":
1487
- case "utf8":
1488
- case "utf-8":
1489
- case "ascii":
1490
- case "latin1":
1491
- case "binary":
1492
- case "base64":
1493
- case "ucs2":
1494
- case "ucs-2":
1495
- case "utf16le":
1496
- case "utf-16le": return !0;
1497
- default: return !1;
1498
- }
1499
- }, u.concat = function(e, t) {
1500
- if (!Array.isArray(e)) throw TypeError("\"list\" argument must be an Array of Buffers");
1501
- if (e.length === 0) return u.alloc(0);
1502
- let n;
1503
- if (t === void 0) for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
1504
- let r = u.allocUnsafe(t), i = 0;
1505
- for (n = 0; n < e.length; ++n) {
1506
- let t = e[n];
1507
- if (J(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
1508
- else if (u.isBuffer(t)) t.copy(r, i);
1509
- else throw TypeError("\"list\" argument must be an Array of Buffers");
1510
- i += t.length;
1676
+ return 0;
1677
+ }
1678
+ s.prototype.eventNames = function() {
1679
+ return this._eventsCount > 0 ? i(this._events) : [];
1680
+ };
1681
+ function g(e, t) {
1682
+ for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
1683
+ return n;
1684
+ }
1685
+ function _(e, t) {
1686
+ for (; t + 1 < e.length; t++) e[t] = e[t + 1];
1687
+ e.pop();
1688
+ }
1689
+ function v(e) {
1690
+ for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
1691
+ return t;
1692
+ }
1693
+ function y(e, t) {
1694
+ return new Promise(function(n, r) {
1695
+ function i(n) {
1696
+ e.removeListener(t, a), r(n);
1511
1697
  }
1512
- return r;
1513
- };
1514
- function S(e, t) {
1515
- if (u.isBuffer(e)) return e.length;
1516
- if (o.isView(e) || J(e, o)) return e.byteLength;
1517
- if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
1518
- let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
1519
- if (!r && n === 0) return 0;
1520
- let i = !1;
1521
- for (;;) switch (t) {
1522
- case "ascii":
1523
- case "latin1":
1524
- case "binary": return n;
1525
- case "utf8":
1526
- case "utf-8": return ue(e).length;
1527
- case "ucs2":
1528
- case "ucs-2":
1529
- case "utf16le":
1530
- case "utf-16le": return n * 2;
1531
- case "hex": return n >>> 1;
1532
- case "base64": return pe(e).length;
1533
- default:
1534
- if (i) return r ? -1 : ue(e).length;
1535
- t = ("" + t).toLowerCase(), i = !0;
1698
+ function a() {
1699
+ typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
1536
1700
  }
1701
+ x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
1702
+ });
1703
+ }
1704
+ function b(e, t, n) {
1705
+ typeof e.on == "function" && x(e, "error", t, n);
1706
+ }
1707
+ function x(e, t, n, r) {
1708
+ if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
1709
+ else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
1710
+ r.once && e.removeEventListener(t, i), n(a);
1711
+ });
1712
+ else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
1713
+ }
1714
+ })), oe = /* @__PURE__ */ t(((e, t) => {
1715
+ var n = ["out", "err"];
1716
+ t.exports = class {
1717
+ constructor(e, t) {
1718
+ if (!n.includes(e)) throw Error("incorrect std output type");
1719
+ this.type = e, this.string = t;
1537
1720
  }
1538
- u.byteLength = S;
1539
- function C(e, t, n) {
1540
- let r = !1;
1541
- if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
1542
- for (e ||= "utf8";;) switch (e) {
1543
- case "hex": return ee(this, t, n);
1544
- case "utf8":
1545
- case "utf-8": return N(this, t, n);
1546
- case "ascii": return I(this, t, n);
1547
- case "latin1":
1548
- case "binary": return L(this, t, n);
1549
- case "base64": return M(this, t, n);
1550
- case "ucs2":
1551
- case "ucs-2":
1552
- case "utf16le":
1553
- case "utf-16le": return te(this, t, n);
1554
- default:
1555
- if (r) throw TypeError("Unknown encoding: " + e);
1556
- e = (e + "").toLowerCase(), r = !0;
1557
- }
1721
+ };
1722
+ })), se = /* @__PURE__ */ t(((e, t) => {
1723
+ var n = oe();
1724
+ t.exports = class {
1725
+ constructor(e = [], t = 0) {
1726
+ if (typeof t != "number") throw Error("Command Result ExitCode must be a number");
1727
+ if (!Array.isArray(e)) throw Error("Command Result be array");
1728
+ this.std = e, this.exitCode = t;
1558
1729
  }
1559
- u.prototype._isBuffer = !0;
1560
- function w(e, t, n) {
1561
- let r = e[t];
1562
- e[t] = e[n], e[n] = r;
1730
+ addStdOutLine(e) {
1731
+ this.std.push(new n("out", e));
1563
1732
  }
1564
- u.prototype.swap16 = function() {
1565
- let e = this.length;
1566
- if (e % 2 != 0) throw RangeError("Buffer size must be a multiple of 16-bits");
1567
- for (let t = 0; t < e; t += 2) w(this, t, t + 1);
1568
- return this;
1569
- }, u.prototype.swap32 = function() {
1570
- let e = this.length;
1571
- if (e % 4 != 0) throw RangeError("Buffer size must be a multiple of 32-bits");
1572
- for (let t = 0; t < e; t += 4) w(this, t, t + 3), w(this, t + 1, t + 2);
1573
- return this;
1574
- }, u.prototype.swap64 = function() {
1575
- let e = this.length;
1576
- if (e % 8 != 0) throw RangeError("Buffer size must be a multiple of 64-bits");
1577
- for (let t = 0; t < e; t += 8) w(this, t, t + 7), w(this, t + 1, t + 6), w(this, t + 2, t + 5), w(this, t + 3, t + 4);
1578
- return this;
1579
- }, u.prototype.toString = function() {
1580
- let e = this.length;
1581
- return e === 0 ? "" : arguments.length === 0 ? N(this, 0, e) : C.apply(this, arguments);
1582
- }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(e) {
1583
- if (!u.isBuffer(e)) throw TypeError("Argument must be a Buffer");
1584
- return this === e ? !0 : u.compare(this, e) === 0;
1585
- }, u.prototype.inspect = function() {
1586
- let t = "", n = e.INSPECT_MAX_BYTES;
1587
- return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
1588
- }, r && (u.prototype[r] = u.prototype.inspect), u.prototype.compare = function(e, t, n, r, i) {
1589
- if (J(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
1590
- if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
1591
- if (r >= i && t >= n) return 0;
1592
- if (r >= i) return -1;
1593
- if (t >= n) return 1;
1594
- if (t >>>= 0, n >>>= 0, r >>>= 0, i >>>= 0, this === e) return 0;
1595
- let o = i - r, s = n - t, c = Math.min(o, s), l = this.slice(r, i), d = e.slice(t, n);
1596
- for (let e = 0; e < c; ++e) if (l[e] !== d[e]) {
1597
- o = l[e], s = d[e];
1598
- break;
1599
- }
1600
- return o < s ? -1 : +(s < o);
1601
- };
1602
- function T(e, t, n, r, i) {
1603
- if (e.length === 0) return -1;
1604
- if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, he(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
1605
- if (i) return -1;
1606
- n = e.length - 1;
1607
- } else if (n < 0) if (i) n = 0;
1608
- else return -1;
1609
- if (typeof t == "string" && (t = u.from(t, r)), u.isBuffer(t)) return t.length === 0 ? -1 : E(e, t, n, r, i);
1610
- if (typeof t == "number") return t &= 255, typeof a.prototype.indexOf == "function" ? i ? a.prototype.indexOf.call(e, t, n) : a.prototype.lastIndexOf.call(e, t, n) : E(e, [t], n, r, i);
1611
- throw TypeError("val must be string, number or Buffer");
1733
+ addStdErrLine(e) {
1734
+ this.std.push(new n("err", e));
1612
1735
  }
1613
- function E(e, t, n, r, i) {
1614
- let a = 1, o = e.length, s = t.length;
1615
- if (r !== void 0 && (r = String(r).toLowerCase(), r === "ucs2" || r === "ucs-2" || r === "utf16le" || r === "utf-16le")) {
1616
- if (e.length < 2 || t.length < 2) return -1;
1617
- a = 2, o /= 2, s /= 2, n /= 2;
1618
- }
1619
- function c(e, t) {
1620
- return a === 1 ? e[t] : e.readUInt16BE(t * a);
1621
- }
1622
- let l;
1623
- if (i) {
1624
- let r = -1;
1625
- for (l = n; l < o; l++) if (c(e, l) === c(t, r === -1 ? 0 : l - r)) {
1626
- if (r === -1 && (r = l), l - r + 1 === s) return r * a;
1627
- } else r !== -1 && (l -= l - r), r = -1;
1628
- } else for (n + s > o && (n = o - s), l = n; l >= 0; l--) {
1629
- let n = !0;
1630
- for (let r = 0; r < s; r++) if (c(e, l + r) !== c(t, r)) {
1631
- n = !1;
1632
- break;
1633
- }
1634
- if (n) return l;
1635
- }
1636
- return -1;
1736
+ getStdOutput() {
1737
+ return this.std;
1637
1738
  }
1638
- u.prototype.includes = function(e, t, n) {
1639
- return this.indexOf(e, t, n) !== -1;
1640
- }, u.prototype.indexOf = function(e, t, n) {
1641
- return T(this, e, t, n, !0);
1642
- }, u.prototype.lastIndexOf = function(e, t, n) {
1643
- return T(this, e, t, n, !1);
1644
- };
1645
- function D(e, t, n, r) {
1646
- n = Number(n) || 0;
1647
- let i = e.length - n;
1648
- r ? (r = Number(r), r > i && (r = i)) : r = i;
1649
- let a = t.length;
1650
- r > a / 2 && (r = a / 2);
1651
- let o;
1652
- for (o = 0; o < r; ++o) {
1653
- let r = parseInt(t.substr(o * 2, 2), 16);
1654
- if (he(r)) return o;
1655
- e[n + o] = r;
1656
- }
1657
- return o;
1739
+ getExitCode() {
1740
+ return this.exitCode;
1658
1741
  }
1659
- function O(e, t, n, r) {
1660
- return me(ue(t, e.length - n), e, n, r);
1742
+ flush() {
1743
+ let e = this.std;
1744
+ return this.std = [], e;
1661
1745
  }
1662
- function k(e, t, n, r) {
1663
- return me(de(t), e, n, r);
1746
+ };
1747
+ })), W = /* @__PURE__ */ t(((e, t) => {
1748
+ var n = ae(), r = se(), i = n.EventEmitter || n.default || n;
1749
+ t.exports = class extends i {
1750
+ constructor(e) {
1751
+ super(), this.arguments = e, this.result = new r();
1664
1752
  }
1665
- function A(e, t, n, r) {
1666
- return me(pe(t), e, n, r);
1753
+ get name() {
1754
+ return "unnamed";
1667
1755
  }
1668
- function j(e, t, n, r) {
1669
- return me(fe(t, e.length - n), e, n, r);
1756
+ run() {
1757
+ return Promise.reject("Command not implemented...");
1670
1758
  }
1671
- u.prototype.write = function(e, t, n, r) {
1672
- if (t === void 0) r = "utf8", n = this.length, t = 0;
1673
- else if (n === void 0 && typeof t == "string") r = t, n = this.length, t = 0;
1674
- else if (isFinite(t)) t >>>= 0, isFinite(n) ? (n >>>= 0, r === void 0 && (r = "utf8")) : (r = n, n = void 0);
1675
- else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
1676
- let i = this.length - t;
1677
- if ((n === void 0 || n > i) && (n = i), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw RangeError("Attempt to write outside buffer bounds");
1678
- r ||= "utf8";
1679
- let a = !1;
1680
- for (;;) switch (r) {
1681
- case "hex": return D(this, e, t, n);
1682
- case "utf8":
1683
- case "utf-8": return O(this, e, t, n);
1684
- case "ascii":
1685
- case "latin1":
1686
- case "binary": return k(this, e, t, n);
1687
- case "base64": return A(this, e, t, n);
1688
- case "ucs2":
1689
- case "ucs-2":
1690
- case "utf16le":
1691
- case "utf-16le": return j(this, e, t, n);
1692
- default:
1693
- if (a) throw TypeError("Unknown encoding: " + r);
1694
- r = ("" + r).toLowerCase(), a = !0;
1695
- }
1696
- }, u.prototype.toJSON = function() {
1697
- return {
1698
- type: "Buffer",
1699
- data: Array.prototype.slice.call(this._arr || this, 0)
1700
- };
1701
- };
1702
- function M(e, n, r) {
1703
- return n === 0 && r === e.length ? t.fromByteArray(e) : t.fromByteArray(e.slice(n, r));
1759
+ runCommand() {
1760
+ return this.run().then((e) => (e && e.split(/\r?\n/).forEach((e) => this.stdOut = e), this.result)).catch((e) => {
1761
+ if (e && e.__type) throw e;
1762
+ return e && (this.stdErr = e.message || e), this.exitCode = 127, this.result;
1763
+ });
1704
1764
  }
1705
- function N(e, t, n) {
1706
- n = Math.min(e.length, n);
1707
- let r = [], i = t;
1708
- for (; i < n;) {
1709
- let t = e[i], a = null, o = t > 239 ? 4 : t > 223 ? 3 : t > 191 ? 2 : 1;
1710
- if (i + o <= n) {
1711
- let n, r, s, c;
1712
- switch (o) {
1713
- case 1:
1714
- t < 128 && (a = t);
1715
- break;
1716
- case 2:
1717
- n = e[i + 1], (n & 192) == 128 && (c = (t & 31) << 6 | n & 63, c > 127 && (a = c));
1718
- break;
1719
- case 3:
1720
- n = e[i + 1], r = e[i + 2], (n & 192) == 128 && (r & 192) == 128 && (c = (t & 15) << 12 | (n & 63) << 6 | r & 63, c > 2047 && (c < 55296 || c > 57343) && (a = c));
1721
- break;
1722
- case 4: n = e[i + 1], r = e[i + 2], s = e[i + 3], (n & 192) == 128 && (r & 192) == 128 && (s & 192) == 128 && (c = (t & 15) << 18 | (n & 63) << 12 | (r & 63) << 6 | s & 63, c > 65535 && c < 1114112 && (a = c));
1723
- }
1724
- }
1725
- a === null ? (a = 65533, o = 1) : a > 65535 && (a -= 65536, r.push(a >>> 10 & 1023 | 55296), a = 56320 | a & 1023), r.push(a), i += o;
1726
- }
1727
- return F(r);
1765
+ onInput(e) {}
1766
+ set exitCode(e) {
1767
+ this.result.exitCode = e;
1728
1768
  }
1729
- let P = 4096;
1730
- function F(e) {
1731
- let t = e.length;
1732
- if (t <= P) return String.fromCharCode.apply(String, e);
1733
- let n = "", r = 0;
1734
- for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += P));
1735
- return n;
1769
+ set stdOut(e) {
1770
+ this.result.addStdOutLine(e);
1736
1771
  }
1737
- function I(e, t, n) {
1738
- let r = "";
1739
- n = Math.min(e.length, n);
1740
- for (let i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
1741
- return r;
1772
+ set stdErr(e) {
1773
+ this.result.addStdErrLine(e);
1742
1774
  }
1743
- function L(e, t, n) {
1744
- let r = "";
1745
- n = Math.min(e.length, n);
1746
- for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
1747
- return r;
1775
+ flush() {
1776
+ this.emit("flush", this.result.flush());
1748
1777
  }
1749
- function ee(e, t, n) {
1750
- let r = e.length;
1751
- (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
1752
- let i = "";
1753
- for (let r = t; r < n; ++r) i += ge[e[r]];
1754
- return i;
1778
+ };
1779
+ })), G = /* @__PURE__ */ t(((e, t) => {
1780
+ var n = W();
1781
+ t.exports = class extends n {
1782
+ constructor(e, t) {
1783
+ super(e), this.context = t;
1755
1784
  }
1756
- function te(e, t, n) {
1757
- let r = e.slice(t, n), i = "";
1758
- for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
1759
- return i;
1785
+ };
1786
+ })), K = /* @__PURE__ */ t(((e, t) => {
1787
+ i();
1788
+ var n = G();
1789
+ function a(e) {
1790
+ return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
1791
+ }
1792
+ t.exports = class extends n {
1793
+ constructor(e, t, n, r = !1) {
1794
+ super(t, n), this.script = e, this.source = r;
1760
1795
  }
1761
- u.prototype.slice = function(e, t) {
1762
- let n = this.length;
1763
- e = ~~e, t = t === void 0 ? n : ~~t, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < e && (t = e);
1764
- let r = this.subarray(e, t);
1765
- return Object.setPrototypeOf(r, u.prototype), r;
1766
- };
1767
- function R(e, t, n) {
1768
- if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
1769
- if (e + t > n) throw RangeError("Trying to access beyond buffer length");
1796
+ get captureInput() {
1797
+ return !!(this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand.captureInput);
1770
1798
  }
1771
- u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
1772
- e >>>= 0, t >>>= 0, n || R(e, t, this.length);
1773
- let r = this[e], i = 1, a = 0;
1774
- for (; ++a < t && (i *= 256);) r += this[e + a] * i;
1775
- return r;
1776
- }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
1777
- e >>>= 0, t >>>= 0, n || R(e, t, this.length);
1778
- let r = this[e + --t], i = 1;
1779
- for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
1780
- return r;
1781
- }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
1782
- return e >>>= 0, t || R(e, 1, this.length), this[e];
1783
- }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
1784
- return e >>>= 0, t || R(e, 2, this.length), this[e] | this[e + 1] << 8;
1785
- }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
1786
- return e >>>= 0, t || R(e, 2, this.length), this[e] << 8 | this[e + 1];
1787
- }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
1788
- return e >>>= 0, t || R(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
1789
- }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
1790
- return e >>>= 0, t || R(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
1791
- }, u.prototype.readBigUInt64LE = Y(function(e) {
1792
- e >>>= 0, K(e, "offset");
1793
- let t = this[e], n = this[e + 7];
1794
- (t === void 0 || n === void 0) && q(e, this.length - 8);
1795
- let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
1796
- return BigInt(r) + (BigInt(i) << BigInt(32));
1797
- }), u.prototype.readBigUInt64BE = Y(function(e) {
1798
- e >>>= 0, K(e, "offset");
1799
- let t = this[e], n = this[e + 7];
1800
- (t === void 0 || n === void 0) && q(e, this.length - 8);
1801
- let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
1802
- return (BigInt(r) << BigInt(32)) + BigInt(i);
1803
- }), u.prototype.readIntLE = function(e, t, n) {
1804
- e >>>= 0, t >>>= 0, n || R(e, t, this.length);
1805
- let r = this[e], i = 1, a = 0;
1806
- for (; ++a < t && (i *= 256);) r += this[e + a] * i;
1807
- return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
1808
- }, u.prototype.readIntBE = function(e, t, n) {
1809
- e >>>= 0, t >>>= 0, n || R(e, t, this.length);
1810
- let r = t, i = 1, a = this[e + --r];
1811
- for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
1812
- return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
1813
- }, u.prototype.readInt8 = function(e, t) {
1814
- return e >>>= 0, t || R(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
1815
- }, u.prototype.readInt16LE = function(e, t) {
1816
- e >>>= 0, t || R(e, 2, this.length);
1817
- let n = this[e] | this[e + 1] << 8;
1818
- return n & 32768 ? n | 4294901760 : n;
1819
- }, u.prototype.readInt16BE = function(e, t) {
1820
- e >>>= 0, t || R(e, 2, this.length);
1821
- let n = this[e + 1] | this[e] << 8;
1822
- return n & 32768 ? n | 4294901760 : n;
1823
- }, u.prototype.readInt32LE = function(e, t) {
1824
- return e >>>= 0, t || R(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
1825
- }, u.prototype.readInt32BE = function(e, t) {
1826
- return e >>>= 0, t || R(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
1827
- }, u.prototype.readBigInt64LE = Y(function(e) {
1828
- e >>>= 0, K(e, "offset");
1829
- let t = this[e], n = this[e + 7];
1830
- (t === void 0 || n === void 0) && q(e, this.length - 8);
1831
- let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
1832
- return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
1833
- }), u.prototype.readBigInt64BE = Y(function(e) {
1834
- e >>>= 0, K(e, "offset");
1835
- let t = this[e], n = this[e + 7];
1836
- (t === void 0 || n === void 0) && q(e, this.length - 8);
1837
- let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
1838
- return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
1839
- }), u.prototype.readFloatLE = function(e, t) {
1840
- return e >>>= 0, t || R(e, 4, this.length), n.read(this, e, !0, 23, 4);
1841
- }, u.prototype.readFloatBE = function(e, t) {
1842
- return e >>>= 0, t || R(e, 4, this.length), n.read(this, e, !1, 23, 4);
1843
- }, u.prototype.readDoubleLE = function(e, t) {
1844
- return e >>>= 0, t || R(e, 8, this.length), n.read(this, e, !0, 52, 8);
1845
- }, u.prototype.readDoubleBE = function(e, t) {
1846
- return e >>>= 0, t || R(e, 8, this.length), n.read(this, e, !1, 52, 8);
1847
- };
1848
- function z(e, t, n, r, i, a) {
1849
- if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
1850
- if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
1851
- if (n + r > e.length) throw RangeError("Index out of range");
1799
+ onInput(e) {
1800
+ this.sandbox && this.sandbox.onInput(e);
1852
1801
  }
1853
- u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
1854
- if (e = +e, t >>>= 0, n >>>= 0, !r) {
1855
- let r = 2 ** (8 * n) - 1;
1856
- z(this, e, t, n, r, 0);
1857
- }
1858
- let i = 1, a = 0;
1859
- for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
1860
- return t + n;
1861
- }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
1862
- if (e = +e, t >>>= 0, n >>>= 0, !r) {
1863
- let r = 2 ** (8 * n) - 1;
1864
- z(this, e, t, n, r, 0);
1802
+ run() {
1803
+ let e = this.context.fs.isRealFilesystem ? { useRealFilesystem: !0 } : {
1804
+ filesystem: this.context.fs.getRaw(),
1805
+ permissions: this.context.fs.getRawPermissions()
1806
+ };
1807
+ this.sandbox = new r.shell({
1808
+ cwd: this.context.fs.cwd,
1809
+ ...e
1810
+ }), this.sandbox.context.source(this.context), this.sandbox.on("stdOut", (e) => {
1811
+ this.stdOut = e, this.flush();
1812
+ }), this.sandbox.on("stdErr", (e) => {
1813
+ this.stdErr = e, this.flush();
1814
+ }), this._scriptFunctions = {};
1815
+ let t = this.script.split(/\r?\n/);
1816
+ if (!a(t[0])) {
1817
+ let e = t[0].startsWith("#!") ? t[0].slice(2).split(/\s/)[0] : t[0];
1818
+ return Promise.reject(`${e}: bad interpreter: No such file or directory`);
1865
1819
  }
1866
- let i = n - 1, a = 1;
1867
- for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
1868
- return t + n;
1869
- }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
1870
- return e = +e, t >>>= 0, n || z(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
1871
- }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
1872
- return e = +e, t >>>= 0, n || z(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
1873
- }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
1874
- return e = +e, t >>>= 0, n || z(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
1875
- }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
1876
- return e = +e, t >>>= 0, n || z(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
1877
- }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
1878
- return e = +e, t >>>= 0, n || z(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;
1879
- };
1880
- function ne(e, t, n, r, i) {
1881
- G(t, r, i, e, n, 7);
1882
- let a = Number(t & BigInt(4294967295));
1883
- e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
1884
- let o = Number(t >> BigInt(32) & BigInt(4294967295));
1885
- return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
1820
+ let n = this._parseLines(t.slice(1));
1821
+ return this._executeNodes(n).catch((e) => {
1822
+ if (e && e.__type === "return") this.sandbox.lastCode = e.code;
1823
+ else if (e && e.__type === "errexit") this.sandbox.lastCode = e.code;
1824
+ else if (e && (e.__type === "break" || e.__type === "continue")) this.stdErr = `${e.__type}: only meaningful in a for or while loop`, this.sandbox.lastCode = 1;
1825
+ else return Promise.reject(e);
1826
+ }).then(() => {
1827
+ this.exitCode = this.sandbox.lastCode, this.source && this.context.source(this.sandbox.context);
1828
+ });
1886
1829
  }
1887
- function B(e, t, n, r, i) {
1888
- G(t, r, i, e, n, 7);
1889
- let a = Number(t & BigInt(4294967295));
1890
- e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
1891
- let o = Number(t >> BigInt(32) & BigInt(4294967295));
1892
- return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
1830
+ _parseLines(e) {
1831
+ let t = [], n = 0;
1832
+ for (; n < e.length;) {
1833
+ let r = e[n].trim();
1834
+ if (!r || r.startsWith("#")) {
1835
+ n++;
1836
+ continue;
1837
+ }
1838
+ if (r.startsWith("if ") || r === "if") {
1839
+ let r = this._parseIf(e, n);
1840
+ t.push(r.node), n += r.consumed;
1841
+ continue;
1842
+ }
1843
+ if (r.startsWith("while ")) {
1844
+ let r = this._parseWhile(e, n);
1845
+ t.push(r.node), n += r.consumed;
1846
+ continue;
1847
+ }
1848
+ if (r.startsWith("for ")) {
1849
+ let r = this._parseFor(e, n);
1850
+ t.push(r.node), n += r.consumed;
1851
+ continue;
1852
+ }
1853
+ if (r.startsWith("case ") || r === "case") {
1854
+ let r = this._parseCase(e, n);
1855
+ t.push(r.node), n += r.consumed;
1856
+ continue;
1857
+ }
1858
+ if (/^(?:function\s+[\w\d_]+|[\w\d_]+\s*\(\s*\))\s*(?:\{.*)?$/.test(r)) {
1859
+ let r = this._parseFunction(e, n);
1860
+ t.push(r.node), n += r.consumed;
1861
+ continue;
1862
+ }
1863
+ t.push({
1864
+ type: "command",
1865
+ line: r
1866
+ }), n++;
1867
+ }
1868
+ return t;
1893
1869
  }
1894
- u.prototype.writeBigUInt64LE = Y(function(e, t = 0) {
1895
- return ne(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
1896
- }), u.prototype.writeBigUInt64BE = Y(function(e, t = 0) {
1897
- return B(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
1898
- }), u.prototype.writeIntLE = function(e, t, n, r) {
1899
- if (e = +e, t >>>= 0, !r) {
1900
- let r = 2 ** (8 * n - 1);
1901
- z(this, e, t, n, r - 1, -r);
1870
+ _parseIf(e, t) {
1871
+ let n = (e) => e.replace(/^(?:if|elif)\s+/, "").replace(/\s*;\s*then\s*$/, "").replace(/\s+then\s*$/, "").trim(), r = [{
1872
+ condition: n(e[t].trim()),
1873
+ bodyLines: []
1874
+ }], i = [], a = r[0], o = !1, s = 1, c = t + 1;
1875
+ for (c < e.length && e[c].trim() === "then" && c++; c < e.length;) {
1876
+ let t = e[c].trim();
1877
+ if ((t.startsWith("if ") || t === "if") && s++, t === "fi" && (s--, s === 0)) {
1878
+ c++;
1879
+ break;
1880
+ }
1881
+ if (s === 1 && t.startsWith("elif ")) {
1882
+ let i = {
1883
+ condition: n(t),
1884
+ bodyLines: []
1885
+ };
1886
+ r.push(i), a = i, c++, c < e.length && e[c].trim() === "then" && c++;
1887
+ continue;
1888
+ }
1889
+ if (s === 1 && t === "else") {
1890
+ o = !0, c++;
1891
+ continue;
1892
+ }
1893
+ o ? i.push(e[c]) : a.bodyLines.push(e[c]), c++;
1902
1894
  }
1903
- let i = 0, a = 1, o = 0;
1904
- for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
1905
- return t + n;
1906
- }, u.prototype.writeIntBE = function(e, t, n, r) {
1907
- if (e = +e, t >>>= 0, !r) {
1908
- let r = 2 ** (8 * n - 1);
1909
- z(this, e, t, n, r - 1, -r);
1895
+ return {
1896
+ node: {
1897
+ type: "if",
1898
+ clauses: r,
1899
+ elseLines: i
1900
+ },
1901
+ consumed: c - t
1902
+ };
1903
+ }
1904
+ _parseWhile(e, t) {
1905
+ let n = e[t].trim().replace(/^while\s+/, "").replace(/\s*;\s*do\s*$/, "").replace(/\s+do\s*$/, "").trim(), r = t + 1;
1906
+ r < e.length && e[r].trim() === "do" && r++;
1907
+ let i = [], a = 1;
1908
+ for (; r < e.length;) {
1909
+ let t = e[r].trim();
1910
+ if ((t.startsWith("while ") || t.startsWith("for ")) && a++, t === "done" && (a--, a === 0)) {
1911
+ r++;
1912
+ break;
1913
+ }
1914
+ i.push(e[r]), r++;
1910
1915
  }
1911
- let i = n - 1, a = 1, o = 0;
1912
- for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
1913
- return t + n;
1914
- }, u.prototype.writeInt8 = function(e, t, n) {
1915
- return e = +e, t >>>= 0, n || z(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
1916
- }, u.prototype.writeInt16LE = function(e, t, n) {
1917
- return e = +e, t >>>= 0, n || z(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
1918
- }, u.prototype.writeInt16BE = function(e, t, n) {
1919
- return e = +e, t >>>= 0, n || z(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
1920
- }, u.prototype.writeInt32LE = function(e, t, n) {
1921
- return e = +e, t >>>= 0, n || z(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
1922
- }, u.prototype.writeInt32BE = function(e, t, n) {
1923
- return e = +e, t >>>= 0, n || z(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
1924
- }, u.prototype.writeBigInt64LE = Y(function(e, t = 0) {
1925
- return ne(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1926
- }), u.prototype.writeBigInt64BE = Y(function(e, t = 0) {
1927
- return B(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1928
- });
1929
- function V(e, t, n, r, i, a) {
1930
- if (n + r > e.length || n < 0) throw RangeError("Index out of range");
1916
+ return {
1917
+ node: {
1918
+ type: "while",
1919
+ condition: n,
1920
+ bodyLines: i
1921
+ },
1922
+ consumed: r - t
1923
+ };
1931
1924
  }
1932
- function H(e, t, r, i, a) {
1933
- return t = +t, r >>>= 0, a || V(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
1925
+ _parseFor(e, t) {
1926
+ let n = e[t].trim().replace(/\s*;\s*do\s*$/, "").replace(/\s+do\s*$/, "").match(/^for\s+(\w+)\s+in\s+(.+)$/), r = n ? n[1] : "", i = n ? n[2].trim() : "", a = t + 1;
1927
+ a < e.length && e[a].trim() === "do" && a++;
1928
+ let o = [], s = 1;
1929
+ for (; a < e.length;) {
1930
+ let t = e[a].trim();
1931
+ if ((t.startsWith("while ") || t.startsWith("for ")) && s++, t === "done" && (s--, s === 0)) {
1932
+ a++;
1933
+ break;
1934
+ }
1935
+ o.push(e[a]), a++;
1936
+ }
1937
+ return {
1938
+ node: {
1939
+ type: "for",
1940
+ variable: r,
1941
+ list: i,
1942
+ bodyLines: o
1943
+ },
1944
+ consumed: a - t
1945
+ };
1934
1946
  }
1935
- u.prototype.writeFloatLE = function(e, t, n) {
1936
- return H(this, e, t, !0, n);
1937
- }, u.prototype.writeFloatBE = function(e, t, n) {
1938
- return H(this, e, t, !1, n);
1939
- };
1940
- function U(e, t, r, i, a) {
1941
- return t = +t, r >>>= 0, a || V(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
1947
+ async _executeNodes(e) {
1948
+ for (let t of e) await this._executeNode(t);
1942
1949
  }
1943
- u.prototype.writeDoubleLE = function(e, t, n) {
1944
- return U(this, e, t, !0, n);
1945
- }, u.prototype.writeDoubleBE = function(e, t, n) {
1946
- return U(this, e, t, !1, n);
1947
- }, u.prototype.copy = function(e, t, n, r) {
1948
- if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
1949
- 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;
1950
- if (t < 0) throw RangeError("targetStart out of bounds");
1951
- if (n < 0 || n >= this.length) throw RangeError("Index out of range");
1952
- if (r < 0) throw RangeError("sourceEnd out of bounds");
1953
- r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
1954
- let i = r - n;
1955
- return this === e && typeof a.prototype.copyWithin == "function" ? this.copyWithin(t, n, r) : a.prototype.set.call(e, this.subarray(n, r), t), i;
1956
- }, u.prototype.fill = function(e, t, n, r) {
1957
- if (typeof e == "string") {
1958
- if (typeof t == "string" ? (r = t, t = 0, n = this.length) : typeof n == "string" && (r = n, n = this.length), r !== void 0 && typeof r != "string") throw TypeError("encoding must be a string");
1959
- if (typeof r == "string" && !u.isEncoding(r)) throw TypeError("Unknown encoding: " + r);
1960
- if (e.length === 1) {
1961
- let t = e.charCodeAt(0);
1962
- (r === "utf8" && t < 128 || r === "latin1") && (e = t);
1963
- }
1964
- } else typeof e == "number" ? e &= 255 : typeof e == "boolean" && (e = Number(e));
1965
- if (t < 0 || this.length < t || this.length < n) throw RangeError("Out of range index");
1966
- if (n <= t) return this;
1967
- t >>>= 0, n = n === void 0 ? this.length : n >>> 0, e ||= 0;
1968
- let i;
1969
- if (typeof e == "number") for (i = t; i < n; ++i) this[i] = e;
1970
- else {
1971
- let a = u.isBuffer(e) ? e : u.from(e, r), o = a.length;
1972
- if (o === 0) throw TypeError("The value \"" + e + "\" is invalid for argument \"value\"");
1973
- for (i = 0; i < n - t; ++i) this[i + t] = a[i % o];
1950
+ _executeNode(e) {
1951
+ if (e.type === "function") {
1952
+ let t = e.name, n = e.bodyLines, r = this, i = G(), a = class extends i {
1953
+ static get name() {
1954
+ return t;
1955
+ }
1956
+ run() {
1957
+ let e = this.arguments.map((e, t) => ({
1958
+ key: String(t + 1),
1959
+ prev: r.sandbox.context.getVar(String(t + 1))
1960
+ }));
1961
+ this.arguments.forEach((e, t) => r.sandbox.context.setVar(String(t + 1), e));
1962
+ let t = () => e.forEach(({ key: e, prev: t }) => t ? r.sandbox.context.setVar(e, t) : r.sandbox.context.unsetVar(e));
1963
+ return r._executeFunctionBody(n).then(() => {
1964
+ t();
1965
+ }).catch((e) => {
1966
+ if (t(), e && e.__type === "return") {
1967
+ this.exitCode = e.code;
1968
+ return;
1969
+ }
1970
+ return Promise.reject(e);
1971
+ });
1972
+ }
1973
+ };
1974
+ return this.sandbox.context.setCommand(a), Promise.resolve();
1974
1975
  }
1975
- return this;
1976
- };
1977
- let ie = {};
1978
- function ae(e, t, n) {
1979
- ie[e] = class extends n {
1980
- constructor() {
1981
- super(), Object.defineProperty(this, "message", {
1982
- value: t.apply(this, arguments),
1983
- writable: !0,
1984
- configurable: !0
1985
- }), this.name = `${this.name} [${e}]`, this.stack, delete this.name;
1976
+ if (e.type === "command") {
1977
+ if (/^return(\s+\d+)?\s*$/.test(e.line.trim())) {
1978
+ let t = e.line.trim().match(/^return\s+(\d+)/), n = t ? parseInt(t[1], 10) : 0;
1979
+ return Promise.reject({
1980
+ __type: "return",
1981
+ code: n
1982
+ });
1986
1983
  }
1987
- get code() {
1988
- return e;
1984
+ if (/^break(\s+\d+)?\s*$/.test(e.line.trim())) {
1985
+ let t = e.line.trim().match(/^break\s+(\d+)/), n = t ? parseInt(t[1], 10) : 1;
1986
+ return Promise.reject({
1987
+ __type: "break",
1988
+ count: n
1989
+ });
1989
1990
  }
1990
- set code(e) {
1991
- Object.defineProperty(this, "code", {
1992
- configurable: !0,
1993
- enumerable: !0,
1994
- value: e,
1995
- writable: !0
1991
+ if (/^continue(\s+\d+)?\s*$/.test(e.line.trim())) {
1992
+ let t = e.line.trim().match(/^continue\s+(\d+)/), n = t ? parseInt(t[1], 10) : 1;
1993
+ return Promise.reject({
1994
+ __type: "continue",
1995
+ count: n
1996
1996
  });
1997
1997
  }
1998
- toString() {
1999
- return `${this.name} [${e}]: ${this.message}`;
2000
- }
2001
- };
2002
- }
2003
- ae("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
2004
- return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
2005
- }, RangeError), ae("ERR_INVALID_ARG_TYPE", function(e, t) {
2006
- return `The "${e}" argument must be of type number. Received type ${typeof t}`;
2007
- }, TypeError), ae("ERR_OUT_OF_RANGE", function(e, t, n) {
2008
- let r = `The value of "${e}" is out of range.`, i = n;
2009
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = W(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = W(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
2010
- }, RangeError);
2011
- function W(e) {
2012
- let t = "", n = e.length, r = +(e[0] === "-");
2013
- for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
2014
- return `${e.slice(0, n)}${t}`;
2015
- }
2016
- function oe(e, t, n) {
2017
- K(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && q(t, e.length - (n + 1));
2018
- }
2019
- function G(e, t, n, r, i, a) {
2020
- if (e > n || e < t) {
2021
- let r = typeof t == "bigint" ? "n" : "", i;
2022
- 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 ie.ERR_OUT_OF_RANGE("value", i, e);
1998
+ return (this.sandbox.context.getVar("-") || "").includes("x") && (this.stdErr = `+ ${e.line.trim()}`, this.flush()), this.sandbox.onCommand(e.line, !1).then(() => {
1999
+ if ((this.sandbox.context.getVar("-") || "").includes("e") && this.sandbox.lastCode !== 0) return Promise.reject({
2000
+ __type: "errexit",
2001
+ code: this.sandbox.lastCode
2002
+ });
2003
+ });
2023
2004
  }
2024
- oe(r, i, a);
2025
- }
2026
- function K(e, t) {
2027
- if (typeof e != "number") throw new ie.ERR_INVALID_ARG_TYPE(t, "number", e);
2005
+ return e.type === "if" ? this._executeIf(e) : e.type === "while" ? this._executeWhile(e) : e.type === "for" ? this._executeFor(e) : e.type === "case" ? this._executeCase(e) : Promise.resolve();
2028
2006
  }
2029
- function q(e, t, n) {
2030
- throw Math.floor(e) === e ? t < 0 ? new ie.ERR_BUFFER_OUT_OF_BOUNDS() : new ie.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (K(e, n), new ie.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
2007
+ async _executeIf(e) {
2008
+ for (let t of e.clauses) if (await this.sandbox.onCommand(t.condition, !1), this.sandbox.lastCode === 0) return this._executeNodes(this._parseLines(t.bodyLines));
2009
+ if (e.elseLines.length > 0) return this._executeNodes(this._parseLines(e.elseLines));
2031
2010
  }
2032
- let ce = /[^+/0-9A-Za-z-_]/g;
2033
- function le(e) {
2034
- if (e = e.split("=")[0], e = e.trim().replace(ce, ""), e.length < 2) return "";
2035
- for (; e.length % 4 != 0;) e += "=";
2036
- return e;
2011
+ async _executeWhile(e) {
2012
+ for (; await this.sandbox.onCommand(e.condition, !1), this.sandbox.lastCode === 0;) try {
2013
+ await this._executeNodes(this._parseLines(e.bodyLines));
2014
+ } catch (e) {
2015
+ if (e && e.__type === "break") {
2016
+ if (e.count <= 1) break;
2017
+ throw {
2018
+ __type: "break",
2019
+ count: e.count - 1
2020
+ };
2021
+ }
2022
+ if (e && e.__type === "continue") {
2023
+ if (e.count <= 1) continue;
2024
+ throw {
2025
+ __type: "continue",
2026
+ count: e.count - 1
2027
+ };
2028
+ }
2029
+ throw e;
2030
+ }
2037
2031
  }
2038
- function ue(e, t) {
2039
- t ||= Infinity;
2040
- let n, r = e.length, i = null, a = [];
2041
- for (let o = 0; o < r; ++o) {
2042
- if (n = e.charCodeAt(o), n > 55295 && n < 57344) {
2043
- if (!i) {
2044
- if (n > 56319) {
2045
- (t -= 3) > -1 && a.push(239, 191, 189);
2046
- continue;
2047
- } else if (o + 1 === r) {
2048
- (t -= 3) > -1 && a.push(239, 191, 189);
2049
- continue;
2050
- }
2051
- i = n;
2052
- continue;
2032
+ async _executeFor(e) {
2033
+ let t = e.list.replace(/\${?([\w\d]+)}?/g, (e, t) => this.sandbox.context.getVar(t) || "").split(/\s+/).filter(Boolean);
2034
+ for (let n of t) {
2035
+ this.sandbox.context.setVar(e.variable, n);
2036
+ try {
2037
+ await this._executeNodes(this._parseLines(e.bodyLines));
2038
+ } catch (e) {
2039
+ if (e && e.__type === "break") {
2040
+ if (e.count <= 1) break;
2041
+ throw {
2042
+ __type: "break",
2043
+ count: e.count - 1
2044
+ };
2053
2045
  }
2054
- if (n < 56320) {
2055
- (t -= 3) > -1 && a.push(239, 191, 189), i = n;
2056
- continue;
2046
+ if (e && e.__type === "continue") {
2047
+ if (e.count <= 1) continue;
2048
+ throw {
2049
+ __type: "continue",
2050
+ count: e.count - 1
2051
+ };
2057
2052
  }
2058
- n = (i - 55296 << 10 | n - 56320) + 65536;
2059
- } else i && (t -= 3) > -1 && a.push(239, 191, 189);
2060
- if (i = null, n < 128) {
2061
- if (--t < 0) break;
2062
- a.push(n);
2063
- } else if (n < 2048) {
2064
- if ((t -= 2) < 0) break;
2065
- a.push(n >> 6 | 192, n & 63 | 128);
2066
- } else if (n < 65536) {
2067
- if ((t -= 3) < 0) break;
2068
- a.push(n >> 12 | 224, n >> 6 & 63 | 128, n & 63 | 128);
2069
- } else if (n < 1114112) {
2070
- if ((t -= 4) < 0) break;
2071
- a.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, n & 63 | 128);
2072
- } else throw Error("Invalid code point");
2053
+ throw e;
2054
+ }
2073
2055
  }
2074
- return a;
2075
- }
2076
- function de(e) {
2077
- let t = [];
2078
- for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
2079
- return t;
2080
2056
  }
2081
- function fe(e, t) {
2082
- let n, r, i, a = [];
2083
- for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
2084
- return a;
2085
- }
2086
- function pe(e) {
2087
- return t.toByteArray(le(e));
2057
+ _parseFunction(e, t) {
2058
+ let n = e[t].trim(), r = n.match(/^function\s+([\w\d_]+)/) || n.match(/^([\w\d_]+)\s*\(/), i = r ? r[1] : "", a = t + 1;
2059
+ if (!n.includes("{")) {
2060
+ for (; a < e.length && !e[a].includes("{");) a++;
2061
+ a++;
2062
+ }
2063
+ let o = [], s = 1;
2064
+ for (; a < e.length;) {
2065
+ if (e[a].trim() === "}") {
2066
+ a++;
2067
+ break;
2068
+ }
2069
+ let t = (e[a].match(/\{/g) || []).length, n = (e[a].match(/\}/g) || []).length;
2070
+ if (s += t - n, s <= 0) {
2071
+ a++;
2072
+ break;
2073
+ }
2074
+ o.push(e[a]), a++;
2075
+ }
2076
+ return {
2077
+ node: {
2078
+ type: "function",
2079
+ name: i,
2080
+ bodyLines: o
2081
+ },
2082
+ consumed: a - t
2083
+ };
2088
2084
  }
2089
- function me(e, t, n, r) {
2090
- let i;
2091
- for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
2092
- return i;
2085
+ _parseCase(e, t) {
2086
+ let n = e[t].trim().match(/^case\s+(.+?)\s+in\s*$/), r = n ? n[1] : "", i = t + 1, a = [], o = null, s = [];
2087
+ for (; i < e.length;) {
2088
+ let t = e[i], n = t.trim();
2089
+ if (i++, !(!n || n.startsWith("#"))) {
2090
+ if (n === "esac") break;
2091
+ if (o === null) {
2092
+ let e = n.match(/^(.+?)\)\s*(.*)$/);
2093
+ if (e) {
2094
+ o = e[1].trim();
2095
+ let t = e[2].trim();
2096
+ if (t === ";;") a.push({
2097
+ pattern: o,
2098
+ bodyLines: []
2099
+ }), o = null;
2100
+ else if (t.endsWith(";;")) {
2101
+ let e = t.slice(0, -2).trim();
2102
+ a.push({
2103
+ pattern: o,
2104
+ bodyLines: e ? [e] : []
2105
+ }), o = null;
2106
+ } else s = t ? [t] : [];
2107
+ }
2108
+ } else n === ";;" ? (a.push({
2109
+ pattern: o,
2110
+ bodyLines: s
2111
+ }), o = null, s = []) : n.endsWith(";;") ? (s.push(n.slice(0, -2).trim()), a.push({
2112
+ pattern: o,
2113
+ bodyLines: s
2114
+ }), o = null, s = []) : s.push(t);
2115
+ }
2116
+ }
2117
+ return o !== null && a.push({
2118
+ pattern: o,
2119
+ bodyLines: s
2120
+ }), {
2121
+ node: {
2122
+ type: "case",
2123
+ word: r,
2124
+ clauses: a
2125
+ },
2126
+ consumed: i - t
2127
+ };
2093
2128
  }
2094
- function J(e, t) {
2095
- return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
2129
+ _executeFunctionBody(e) {
2130
+ return this._executeNodes(this._parseLines(e));
2096
2131
  }
2097
- function he(e) {
2098
- return e !== e;
2132
+ async _executeCase(e) {
2133
+ let t = await this.sandbox._replaceVariables(e.word), n = t.startsWith("\"") && t.endsWith("\"") || t.startsWith("'") && t.endsWith("'") ? t.slice(1, -1) : t;
2134
+ for (let t of e.clauses) if (this._matchPattern(t.pattern, n)) return this._executeNodes(this._parseLines(t.bodyLines));
2099
2135
  }
2100
- let ge = (function() {
2101
- let e = "0123456789abcdef", t = Array(256);
2102
- for (let n = 0; n < 16; ++n) {
2103
- let r = n * 16;
2104
- for (let i = 0; i < 16; ++i) t[r + i] = e[n] + e[i];
2136
+ _matchPattern(e, t) {
2137
+ let n = "", r = 0;
2138
+ for (; r < e.length;) {
2139
+ let t = e[r];
2140
+ if (t === "[") {
2141
+ let t = e.indexOf("]", r + 1);
2142
+ t === -1 ? (n += "\\[", r++) : (n += e.slice(r, t + 1), r = t + 1);
2143
+ } else t === "*" ? (n += ".*", r++) : t === "?" ? (n += ".", r++) : /[.+^${}()|\\]/.test(t) ? (n += "\\" + t, r++) : (n += t, r++);
2144
+ }
2145
+ try {
2146
+ return RegExp("^" + n + "$").test(t);
2147
+ } catch {
2148
+ return !1;
2105
2149
  }
2106
- return t;
2107
- })();
2108
- function Y(e) {
2109
- return typeof BigInt > "u" ? _e : e;
2110
- }
2111
- function _e() {
2112
- throw Error("BigInt not supported");
2113
2150
  }
2114
- })(V), G = V.Buffer, V.Blob, V.BlobOptions, V.Buffer, V.File, V.FileOptions, V.INSPECT_MAX_BYTES, V.SlowBuffer, V.TranscodeEncoding, V.atob, V.btoa, V.constants, V.isAscii, V.isUtf8, V.kMaxLength, V.kStringMaxLength, V.resolveObjectURL, V.transcode;
2151
+ }, t.exports.isKnownInterpreter = a;
2115
2152
  })), q = /* @__PURE__ */ t(((e, t) => {
2116
- K();
2117
- var n = I();
2153
+ S();
2154
+ var n = K();
2118
2155
  t.exports = class extends n {
2119
2156
  get name() {
2120
2157
  return "wasm";
@@ -2125,7 +2162,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2125
2162
  run() {
2126
2163
  let e = this.script, t = (() => {
2127
2164
  try {
2128
- return D();
2165
+ return U();
2129
2166
  } catch {
2130
2167
  return null;
2131
2168
  }
@@ -2157,7 +2194,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2157
2194
  }
2158
2195
  _contentToBytes(e) {
2159
2196
  if (e instanceof Uint8Array) return e;
2160
- if (G !== void 0 && G.isBuffer(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
2197
+ if (x !== void 0 && x.isBuffer(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
2161
2198
  if (e instanceof ArrayBuffer) return new Uint8Array(e);
2162
2199
  let t = new Uint8Array(e.length);
2163
2200
  for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n) & 255;
@@ -2312,7 +2349,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2312
2349
  }
2313
2350
  };
2314
2351
  })), ce = /* @__PURE__ */ t(((e, t) => {
2315
- var n = F();
2352
+ var n = G();
2316
2353
  t.exports = class extends n {
2317
2354
  get captureInput() {
2318
2355
  return !0;
@@ -2328,7 +2365,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2328
2365
  }
2329
2366
  };
2330
2367
  })), le = /* @__PURE__ */ t(((e, t) => {
2331
- var n = P(), r = class extends n {
2368
+ var n = W(), r = class extends n {
2332
2369
  static get name() {
2333
2370
  return "test";
2334
2371
  }
@@ -2413,7 +2450,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2413
2450
  }
2414
2451
  };
2415
2452
  })), ue = /* @__PURE__ */ t(((e, t) => {
2416
- var n = P();
2453
+ var n = W();
2417
2454
  t.exports = class extends n {
2418
2455
  static get name() {
2419
2456
  return "cat";
@@ -2565,36 +2602,36 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2565
2602
  }, e.isArrayLike = i, e.isAsyncFunction = g, e.isClass = u, e.isDefined = o, e.isDefinedValue = l, e.isFiniteNumber = n, e.isFunction = h, e.isIterable = p, e.isNull = c, e.isNumber = t, e.isObject = a, e.isPlainObject = r, e.isPrimitive = d, e.isPromise = f, e.isString = m, e.isUndefined = s;
2566
2603
  })), me = /* @__PURE__ */ t(((e, t) => {
2567
2604
  i();
2568
- var n = Infinity, a = "[object Symbol]", o = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, s = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, c = "\\ud800-\\udfff", l = "\\u0300-\\u036f\\ufe20-\\ufe23", u = "\\u20d0-\\u20f0", d = "\\u2700-\\u27bf", f = "a-z\\xdf-\\xf6\\xf8-\\xff", p = "\\xac\\xb1\\xd7\\xf7", m = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", h = "\\u2000-\\u206f", g = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", _ = "A-Z\\xc0-\\xd6\\xd8-\\xde", v = "\\ufe0e\\ufe0f", y = p + m + h + g, b = "['’]", x = "[" + c + "]", S = "[" + y + "]", C = "[" + l + u + "]", w = "\\d+", T = "[" + d + "]", E = "[" + f + "]", D = "[^" + c + y + w + d + f + _ + "]", O = "\\ud83c[\\udffb-\\udfff]", k = "(?:" + C + "|" + O + ")", A = "[^" + c + "]", j = "(?:\\ud83c[\\udde6-\\uddff]){2}", M = "[\\ud800-\\udbff][\\udc00-\\udfff]", N = "[" + _ + "]", P = "\\u200d", F = "(?:" + E + "|" + D + ")", I = "(?:" + N + "|" + D + ")", L = "(?:" + b + "(?:d|ll|m|re|s|t|ve))?", ee = "(?:" + b + "(?:D|LL|M|RE|S|T|VE))?", te = k + "?", R = "[" + v + "]?", z = "(?:" + P + "(?:" + [
2605
+ var n = Infinity, a = "[object Symbol]", o = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, s = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, c = "\\ud800-\\udfff", l = "\\u0300-\\u036f\\ufe20-\\ufe23", u = "\\u20d0-\\u20f0", d = "\\u2700-\\u27bf", f = "a-z\\xdf-\\xf6\\xf8-\\xff", p = "\\xac\\xb1\\xd7\\xf7", m = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", h = "\\u2000-\\u206f", g = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", _ = "A-Z\\xc0-\\xd6\\xd8-\\xde", v = "\\ufe0e\\ufe0f", y = p + m + h + g, b = "['’]", x = "[" + c + "]", S = "[" + y + "]", C = "[" + l + u + "]", w = "\\d+", T = "[" + d + "]", E = "[" + f + "]", D = "[^" + c + y + w + d + f + _ + "]", O = "\\ud83c[\\udffb-\\udfff]", k = "(?:" + C + "|" + O + ")", A = "[^" + c + "]", j = "(?:\\ud83c[\\udde6-\\uddff]){2}", M = "[\\ud800-\\udbff][\\udc00-\\udfff]", N = "[" + _ + "]", ee = "\\u200d", P = "(?:" + E + "|" + D + ")", F = "(?:" + N + "|" + D + ")", I = "(?:" + b + "(?:d|ll|m|re|s|t|ve))?", L = "(?:" + b + "(?:D|LL|M|RE|S|T|VE))?", R = k + "?", z = "[" + v + "]?", te = "(?:" + ee + "(?:" + [
2569
2606
  A,
2570
2607
  j,
2571
2608
  M
2572
- ].join("|") + ")" + R + te + ")*", ne = R + te + z, B = "(?:" + [
2609
+ ].join("|") + ")" + z + R + ")*", B = z + R + te, V = "(?:" + [
2573
2610
  T,
2574
2611
  j,
2575
2612
  M
2576
- ].join("|") + ")" + ne, V = "(?:" + [
2613
+ ].join("|") + ")" + B, H = "(?:" + [
2577
2614
  A + C + "?",
2578
2615
  C,
2579
2616
  j,
2580
2617
  M,
2581
2618
  x
2582
- ].join("|") + ")", re = RegExp(b, "g"), H = RegExp(C, "g"), U = RegExp(O + "(?=" + O + ")|" + V + ne, "g"), ie = RegExp([
2583
- N + "?" + E + "+" + L + "(?=" + [
2619
+ ].join("|") + ")", U = RegExp(b, "g"), ne = RegExp(C, "g"), re = RegExp(O + "(?=" + O + ")|" + H + B, "g"), ie = RegExp([
2620
+ N + "?" + E + "+" + I + "(?=" + [
2584
2621
  S,
2585
2622
  N,
2586
2623
  "$"
2587
2624
  ].join("|") + ")",
2588
- I + "+" + ee + "(?=" + [
2625
+ F + "+" + L + "(?=" + [
2589
2626
  S,
2590
- N + F,
2627
+ N + P,
2591
2628
  "$"
2592
2629
  ].join("|") + ")",
2593
- N + "?" + F + "+" + L,
2594
- N + "+" + ee,
2630
+ N + "?" + P + "+" + I,
2631
+ N + "+" + L,
2595
2632
  w,
2596
- B
2597
- ].join("|"), "g"), ae = RegExp("[" + P + c + l + u + v + "]"), W = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, oe = {
2633
+ V
2634
+ ].join("|"), "g"), ae = RegExp("[" + ee + c + l + u + v + "]"), oe = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, se = {
2598
2635
  À: "A",
2599
2636
  Á: "A",
2600
2637
  Â: "A",
@@ -2785,7 +2822,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2785
2822
  œ: "oe",
2786
2823
  ʼn: "'n",
2787
2824
  ſ: "ss"
2788
- }, se = typeof r == "object" && r && r.Object === Object && r, G = typeof self == "object" && self && self.Object === Object && self, K = se || G || Function("return this")();
2825
+ }, W = typeof r == "object" && r && r.Object === Object && r, G = typeof self == "object" && self && self.Object === Object && self, K = W || G || Function("return this")();
2789
2826
  function q(e, t, n, r) {
2790
2827
  var i = -1, a = e ? e.length : 0;
2791
2828
  for (r && a && (n = e[++i]); ++i < a;) n = t(n, e[i], i, e);
@@ -2802,18 +2839,18 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2802
2839
  return e?.[t];
2803
2840
  };
2804
2841
  }
2805
- var de = ue(oe);
2842
+ var de = ue(se);
2806
2843
  function fe(e) {
2807
2844
  return ae.test(e);
2808
2845
  }
2809
2846
  function pe(e) {
2810
- return W.test(e);
2847
+ return oe.test(e);
2811
2848
  }
2812
2849
  function me(e) {
2813
2850
  return fe(e) ? J(e) : ce(e);
2814
2851
  }
2815
2852
  function J(e) {
2816
- return e.match(U) || [];
2853
+ return e.match(re) || [];
2817
2854
  }
2818
2855
  function he(e) {
2819
2856
  return e.match(ie) || [];
@@ -2844,7 +2881,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2844
2881
  }
2845
2882
  function Ce(e) {
2846
2883
  return function(t) {
2847
- return q(je(ke(t).replace(re, "")), e, "");
2884
+ return q(je(ke(t).replace(U, "")), e, "");
2848
2885
  };
2849
2886
  }
2850
2887
  function we(e) {
@@ -2863,7 +2900,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2863
2900
  return Ae(Ee(e).toLowerCase());
2864
2901
  }
2865
2902
  function ke(e) {
2866
- return e = Ee(e), e && e.replace(s, de).replace(H, "");
2903
+ return e = Ee(e), e && e.replace(s, de).replace(ne, "");
2867
2904
  }
2868
2905
  var Ae = Se("toUpperCase");
2869
2906
  function je(e, t, n) {
@@ -2871,7 +2908,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2871
2908
  }
2872
2909
  t.exports = De;
2873
2910
  })), J = /* @__PURE__ */ t(((e, t) => {
2874
- E();
2911
+ H();
2875
2912
  var n = de(), r = fe(), i = pe(), a = me(), o = {
2876
2913
  short: /^-([^\d-])$/,
2877
2914
  long: /^--(\S+)/,
@@ -2879,10 +2916,10 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
2879
2916
  optEquals: /^(--\S+?)=(.*)/
2880
2917
  }, s = class extends Array {
2881
2918
  load(e) {
2882
- if (this.clear(), e && e !== T.argv) e = n(e);
2919
+ if (this.clear(), e && e !== V.argv) e = n(e);
2883
2920
  else {
2884
- e = T.argv.slice(0);
2885
- let t = T.execArgv.some(m) ? 1 : 2;
2921
+ e = V.argv.slice(0);
2922
+ let t = V.execArgv.some(m) ? 1 : 2;
2886
2923
  e.splice(0, t);
2887
2924
  }
2888
2925
  e.forEach((e) => this.push(String(e)));
@@ -3096,7 +3133,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3096
3133
  }
3097
3134
  return e.skipUnknown && delete t._unknown, t;
3098
3135
  }
3099
- }, D = class extends w {
3136
+ }, T = class extends w {
3100
3137
  toObject(e) {
3101
3138
  let t = super.toObject({ skipUnknown: e.skipUnknown }), r = super.toObject(e), o = r._unknown;
3102
3139
  delete r._unknown;
@@ -3110,13 +3147,13 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3110
3147
  }), s;
3111
3148
  }
3112
3149
  };
3113
- function O(e, t) {
3150
+ function E(e, t) {
3114
3151
  t ||= {}, t.stopAtFirstUnknown && (t.partial = !0), e = g.from(e, t.caseInsensitive);
3115
3152
  let n = new b(e, {
3116
3153
  argv: t.argv,
3117
3154
  stopAtFirstUnknown: t.stopAtFirstUnknown,
3118
3155
  caseInsensitive: t.caseInsensitive
3119
- }), r = new (e.isGrouped() ? D : w)(e);
3156
+ }), r = new (e.isGrouped() ? T : w)(e);
3120
3157
  for (let e of n) {
3121
3158
  let n = e.subArg || e.arg;
3122
3159
  if (!t.partial) {
@@ -3136,9 +3173,9 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3136
3173
  camelCase: t.camelCase
3137
3174
  });
3138
3175
  }
3139
- t.exports = O;
3176
+ t.exports = E;
3140
3177
  })), he = /* @__PURE__ */ t(((e, t) => {
3141
- var n = P(), r = J();
3178
+ var n = W(), r = J();
3142
3179
  t.exports = class extends n {
3143
3180
  static get name() {
3144
3181
  return "ls";
@@ -3239,7 +3276,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3239
3276
  }
3240
3277
  };
3241
3278
  })), ge = /* @__PURE__ */ t(((e, t) => {
3242
- var n = P();
3279
+ var n = W();
3243
3280
  t.exports = class extends n {
3244
3281
  static get name() {
3245
3282
  return "echo";
@@ -3255,7 +3292,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3255
3292
  }
3256
3293
  };
3257
3294
  })), Y = /* @__PURE__ */ t(((e, t) => {
3258
- var n = P();
3295
+ var n = W();
3259
3296
  t.exports = class extends n {
3260
3297
  static get name() {
3261
3298
  return "printf";
@@ -3274,7 +3311,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3274
3311
  }
3275
3312
  };
3276
3313
  })), _e = /* @__PURE__ */ t(((e, t) => {
3277
- var n = P();
3314
+ var n = W();
3278
3315
  t.exports = class extends n {
3279
3316
  static get name() {
3280
3317
  return "grep";
@@ -3472,7 +3509,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3472
3509
  }
3473
3510
  };
3474
3511
  })), ve = /* @__PURE__ */ t(((e, t) => {
3475
- var n = P();
3512
+ var n = W();
3476
3513
  t.exports = class extends n {
3477
3514
  static get name() {
3478
3515
  return "true";
@@ -3482,7 +3519,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3482
3519
  }
3483
3520
  };
3484
3521
  })), ye = /* @__PURE__ */ t(((e, t) => {
3485
- var n = P();
3522
+ var n = W();
3486
3523
  t.exports = class extends n {
3487
3524
  static get name() {
3488
3525
  return "false";
@@ -3505,7 +3542,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3505
3542
  r
3506
3543
  ];
3507
3544
  })), xe = /* @__PURE__ */ t(((e, t) => {
3508
- var n = F();
3545
+ var n = G();
3509
3546
  t.exports = class extends n {
3510
3547
  static get name() {
3511
3548
  return "alias";
@@ -3517,7 +3554,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3517
3554
  }
3518
3555
  };
3519
3556
  })), Se = /* @__PURE__ */ t(((e, t) => {
3520
- var n = F();
3557
+ var n = G();
3521
3558
  t.exports = class extends n {
3522
3559
  static get name() {
3523
3560
  return "export";
@@ -3529,7 +3566,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3529
3566
  }
3530
3567
  };
3531
3568
  })), Ce = /* @__PURE__ */ t(((e, t) => {
3532
- var n = F();
3569
+ var n = G();
3533
3570
  t.exports = class extends n {
3534
3571
  static get name() {
3535
3572
  return "cd";
@@ -3541,7 +3578,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3541
3578
  }
3542
3579
  };
3543
3580
  })), we = /* @__PURE__ */ t(((e, t) => {
3544
- var n = F();
3581
+ var n = G();
3545
3582
  t.exports = class extends n {
3546
3583
  static get name() {
3547
3584
  return "chmod";
@@ -3597,7 +3634,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3597
3634
  }
3598
3635
  };
3599
3636
  })), Te = /* @__PURE__ */ t(((e, t) => {
3600
- var n = F(), r = D();
3637
+ var n = G(), r = U();
3601
3638
  t.exports = class extends n {
3602
3639
  static get name() {
3603
3640
  return "cp";
@@ -3693,7 +3730,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3693
3730
  }
3694
3731
  };
3695
3732
  })), Ee = /* @__PURE__ */ t(((e, t) => {
3696
- var n = F();
3733
+ var n = G();
3697
3734
  t.exports = class extends n {
3698
3735
  static get name() {
3699
3736
  return "mkdir";
@@ -3720,7 +3757,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3720
3757
  }
3721
3758
  };
3722
3759
  })), De = /* @__PURE__ */ t(((e, t) => {
3723
- var n = F(), r = D();
3760
+ var n = G(), r = U();
3724
3761
  t.exports = class extends n {
3725
3762
  static get name() {
3726
3763
  return "mv";
@@ -3764,7 +3801,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3764
3801
  continue;
3765
3802
  }
3766
3803
  try {
3767
- let e = O();
3804
+ let e = ne();
3768
3805
  r.mkdirSync(e.dirname(i), { recursive: !0 }), r.renameSync(n, i);
3769
3806
  } catch (n) {
3770
3807
  this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
@@ -3793,7 +3830,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3793
3830
  }
3794
3831
  };
3795
3832
  })), Oe = /* @__PURE__ */ t(((e, t) => {
3796
- var n = F();
3833
+ var n = G();
3797
3834
  t.exports = class extends n {
3798
3835
  static get name() {
3799
3836
  return "pwd";
@@ -3804,7 +3841,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3804
3841
  }
3805
3842
  };
3806
3843
  })), ke = /* @__PURE__ */ t(((e, t) => {
3807
- var n = F(), r = D();
3844
+ var n = G(), r = U();
3808
3845
  t.exports = class extends n {
3809
3846
  static get name() {
3810
3847
  return "rm";
@@ -3849,7 +3886,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3849
3886
  }
3850
3887
  };
3851
3888
  })), Ae = /* @__PURE__ */ t(((e, t) => {
3852
- var n = F();
3889
+ var n = G();
3853
3890
  t.exports = class extends n {
3854
3891
  static get name() {
3855
3892
  return "which";
@@ -3861,7 +3898,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3861
3898
  }
3862
3899
  };
3863
3900
  })), je = /* @__PURE__ */ t(((e, t) => {
3864
- var n = I(), r = F();
3901
+ var n = K(), r = G();
3865
3902
  t.exports = class extends r {
3866
3903
  static get name() {
3867
3904
  return "source";
@@ -3890,7 +3927,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3890
3927
  }
3891
3928
  };
3892
3929
  })), Me = /* @__PURE__ */ t(((e, t) => {
3893
- var n = F();
3930
+ var n = G();
3894
3931
  t.exports = class extends n {
3895
3932
  static get name() {
3896
3933
  return "clear";
@@ -3900,7 +3937,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3900
3937
  }
3901
3938
  };
3902
3939
  })), Ne = /* @__PURE__ */ t(((e, t) => {
3903
- var n = F();
3940
+ var n = G();
3904
3941
  t.exports = class extends n {
3905
3942
  static get name() {
3906
3943
  return "exit";
@@ -3911,7 +3948,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3911
3948
  }
3912
3949
  };
3913
3950
  })), Pe = /* @__PURE__ */ t(((e, t) => {
3914
- var n = F(), r = J();
3951
+ var n = G(), r = J();
3915
3952
  t.exports = class extends n {
3916
3953
  static get name() {
3917
3954
  return "read";
@@ -3985,7 +4022,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
3985
4022
  }
3986
4023
  };
3987
4024
  })), Fe = /* @__PURE__ */ t(((e, t) => {
3988
- var n = F(), r = P();
4025
+ var n = G(), r = W();
3989
4026
  t.exports = class extends n {
3990
4027
  static get name() {
3991
4028
  return "jsfunction";
@@ -4021,7 +4058,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4021
4058
  }
4022
4059
  };
4023
4060
  })), Ie = /* @__PURE__ */ t(((e, t) => {
4024
- var n = F();
4061
+ var n = G();
4025
4062
  t.exports = class extends n {
4026
4063
  static get name() {
4027
4064
  return "curl";
@@ -4106,7 +4143,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4106
4143
  }
4107
4144
  };
4108
4145
  })), Le = /* @__PURE__ */ t(((e, t) => {
4109
- var n = F(), r = {
4146
+ var n = G(), r = {
4110
4147
  errexit: "e",
4111
4148
  xtrace: "x",
4112
4149
  nounset: "u",
@@ -4459,7 +4496,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4459
4496
  i && T && (n = T(i.prototype));
4460
4497
  }
4461
4498
  return M[t] = n, n;
4462
- }, P = {
4499
+ }, ee = {
4463
4500
  __proto__: null,
4464
4501
  "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
4465
4502
  "%ArrayPrototype%": ["Array", "prototype"],
@@ -4548,17 +4585,17 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4548
4585
  "%URIErrorPrototype%": ["URIError", "prototype"],
4549
4586
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
4550
4587
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
4551
- }, F = lt(), I = _t(), L = F.call(k, Array.prototype.concat), ee = F.call(O, Array.prototype.splice), te = F.call(k, String.prototype.replace), R = F.call(k, String.prototype.slice), z = F.call(k, RegExp.prototype.exec), ne = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, B = /\\(\\)?/g, V = function(e) {
4552
- var t = R(e, 0, 1), n = R(e, -1);
4588
+ }, P = lt(), F = _t(), I = P.call(k, Array.prototype.concat), L = P.call(O, Array.prototype.splice), R = P.call(k, String.prototype.replace), z = P.call(k, String.prototype.slice), te = P.call(k, RegExp.prototype.exec), B = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, V = /\\(\\)?/g, H = function(e) {
4589
+ var t = z(e, 0, 1), n = z(e, -1);
4553
4590
  if (t === "%" && n !== "%") throw new c("invalid intrinsic syntax, expected closing `%`");
4554
4591
  if (n === "%" && t !== "%") throw new c("invalid intrinsic syntax, expected opening `%`");
4555
4592
  var r = [];
4556
- return te(e, ne, function(e, t, n, i) {
4557
- r[r.length] = n ? te(i, B, "$1") : t || e;
4593
+ return R(e, B, function(e, t, n, i) {
4594
+ r[r.length] = n ? R(i, V, "$1") : t || e;
4558
4595
  }), r;
4559
- }, re = function(e, t) {
4596
+ }, U = function(e, t) {
4560
4597
  var n = e, r;
4561
- if (I(P, n) && (r = P[n], n = "%" + r[0] + "%"), I(M, n)) {
4598
+ if (F(ee, n) && (r = ee[n], n = "%" + r[0] + "%"), F(M, n)) {
4562
4599
  var i = M[n];
4563
4600
  if (i === A && (i = N(n)), i === void 0 && !t) throw new l("intrinsic " + e + " exists, but is not available. Please file an issue!");
4564
4601
  return {
@@ -4572,13 +4609,13 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4572
4609
  t.exports = function(e, t) {
4573
4610
  if (typeof e != "string" || e.length === 0) throw new l("intrinsic name must be a non-empty string");
4574
4611
  if (arguments.length > 1 && typeof t != "boolean") throw new l("\"allowMissing\" argument must be a boolean");
4575
- if (z(/^%?[^%]*%?$/, e) === null) throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
4576
- var n = V(e), r = n.length > 0 ? n[0] : "", i = re("%" + r + "%", t), a = i.name, o = i.value, s = !1, u = i.alias;
4577
- u && (r = u[0], ee(n, L([0, 1], u)));
4612
+ if (te(/^%?[^%]*%?$/, e) === null) throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
4613
+ var n = H(e), r = n.length > 0 ? n[0] : "", i = U("%" + r + "%", t), a = i.name, o = i.value, s = !1, u = i.alias;
4614
+ u && (r = u[0], L(n, I([0, 1], u)));
4578
4615
  for (var d = 1, f = !0; d < n.length; d += 1) {
4579
- var p = n[d], m = R(p, 0, 1), h = R(p, -1);
4616
+ var p = n[d], m = z(p, 0, 1), h = z(p, -1);
4580
4617
  if ((m === "\"" || m === "'" || m === "`" || h === "\"" || h === "'" || h === "`") && m !== h) throw new c("property names with quotes must have matching quotes");
4581
- if ((p === "constructor" || !f) && (s = !0), r += "." + p, a = "%" + r + "%", I(M, a)) o = M[a];
4618
+ if ((p === "constructor" || !f) && (s = !0), r += "." + p, a = "%" + r + "%", F(M, a)) o = M[a];
4582
4619
  else if (o != null) {
4583
4620
  if (!(p in o)) {
4584
4621
  if (!t) throw new l("base intrinsic for " + e + " exists, but the property is not available.");
@@ -4587,7 +4624,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4587
4624
  if (b && d + 1 >= n.length) {
4588
4625
  var g = b(o, p);
4589
4626
  f = !!g, o = f && "get" in g && !("originalValue" in g.get) ? g.get : o[p];
4590
- } else f = I(o, p), o = o[p];
4627
+ } else f = F(o, p), o = o[p];
4591
4628
  f && !s && (M[a] = o);
4592
4629
  }
4593
4630
  }
@@ -4775,10 +4812,10 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4775
4812
  t.exports = {};
4776
4813
  })), jt = /* @__PURE__ */ t(((e, t) => {
4777
4814
  i();
4778
- var n = typeof Map == "function" && Map.prototype, a = Object.getOwnPropertyDescriptor && n ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, o = n && a && typeof a.get == "function" ? a.get : null, s = n && Map.prototype.forEach, c = typeof Set == "function" && Set.prototype, l = Object.getOwnPropertyDescriptor && c ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = c && l && typeof l.get == "function" ? l.get : null, d = c && Set.prototype.forEach, f = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null, p = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null, m = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null, h = Boolean.prototype.valueOf, g = Object.prototype.toString, _ = Function.prototype.toString, v = String.prototype.match, y = String.prototype.slice, b = String.prototype.replace, x = String.prototype.toUpperCase, S = String.prototype.toLowerCase, C = RegExp.prototype.test, w = Array.prototype.concat, T = Array.prototype.join, E = Array.prototype.slice, D = Math.floor, O = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, k = Object.getOwnPropertySymbols, A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, j = typeof Symbol == "function" && typeof Symbol.iterator == "object", M = typeof Symbol == "function" && Symbol.toStringTag ? Symbol.toStringTag : null, N = Object.prototype.propertyIsEnumerable, P = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
4815
+ var n = typeof Map == "function" && Map.prototype, a = Object.getOwnPropertyDescriptor && n ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, o = n && a && typeof a.get == "function" ? a.get : null, s = n && Map.prototype.forEach, c = typeof Set == "function" && Set.prototype, l = Object.getOwnPropertyDescriptor && c ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = c && l && typeof l.get == "function" ? l.get : null, d = c && Set.prototype.forEach, f = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null, p = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null, m = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null, h = Boolean.prototype.valueOf, g = Object.prototype.toString, _ = Function.prototype.toString, v = String.prototype.match, y = String.prototype.slice, b = String.prototype.replace, x = String.prototype.toUpperCase, S = String.prototype.toLowerCase, C = RegExp.prototype.test, w = Array.prototype.concat, T = Array.prototype.join, E = Array.prototype.slice, D = Math.floor, O = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, k = Object.getOwnPropertySymbols, A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, j = typeof Symbol == "function" && typeof Symbol.iterator == "object", M = typeof Symbol == "function" && Symbol.toStringTag ? Symbol.toStringTag : null, N = Object.prototype.propertyIsEnumerable, ee = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
4779
4816
  return e.__proto__;
4780
4817
  } : null);
4781
- function F(e, t) {
4818
+ function P(e, t) {
4782
4819
  if (e === Infinity || e === -Infinity || e !== e || e && e > -1e3 && e < 1e3 || C.call(/e/, t)) return t;
4783
4820
  var n = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
4784
4821
  if (typeof e == "number") {
@@ -4790,18 +4827,18 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4790
4827
  }
4791
4828
  return b.call(t, n, "$&_");
4792
4829
  }
4793
- var I = At(), L = I.custom, ee = oe(L) ? L : null, te = {
4830
+ var F = At(), I = F.custom, L = se(I) ? I : null, R = {
4794
4831
  __proto__: null,
4795
4832
  double: "\"",
4796
4833
  single: "'"
4797
- }, R = {
4834
+ }, z = {
4798
4835
  __proto__: null,
4799
4836
  double: /(["\\])/g,
4800
4837
  single: /(['\\])/g
4801
4838
  };
4802
4839
  t.exports = function e(t, n, i, a) {
4803
4840
  var c = n || {};
4804
- if (K(c, "quoteStyle") && !K(te, c.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
4841
+ if (K(c, "quoteStyle") && !K(R, c.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
4805
4842
  if (K(c, "maxStringLength") && (typeof c.maxStringLength == "number" ? c.maxStringLength < 0 && c.maxStringLength !== Infinity : c.maxStringLength !== null)) throw TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
4806
4843
  var l = K(c, "customInspect") ? c.customInspect : !0;
4807
4844
  if (typeof l != "boolean" && l !== "symbol") throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
@@ -4815,14 +4852,14 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4815
4852
  if (typeof t == "number") {
4816
4853
  if (t === 0) return Infinity / t > 0 ? "0" : "-0";
4817
4854
  var p = String(t);
4818
- return f ? F(t, p) : p;
4855
+ return f ? P(t, p) : p;
4819
4856
  }
4820
4857
  if (typeof t == "bigint") {
4821
4858
  var m = String(t) + "n";
4822
- return f ? F(t, m) : m;
4859
+ return f ? P(t, m) : m;
4823
4860
  }
4824
4861
  var g = c.depth === void 0 ? 5 : c.depth;
4825
- if (i === void 0 && (i = 0), i >= g && g > 0 && typeof t == "object") return V(t) ? "[Array]" : "[Object]";
4862
+ if (i === void 0 && (i = 0), i >= g && g > 0 && typeof t == "object") return H(t) ? "[Array]" : "[Object]";
4826
4863
  var _ = be(c, i);
4827
4864
  if (a === void 0) a = [];
4828
4865
  else if (le(a, t) >= 0) return "[Circular]";
@@ -4833,29 +4870,29 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4833
4870
  }
4834
4871
  return e(t, c, i + 1, a);
4835
4872
  }
4836
- if (typeof t == "function" && !H(t)) {
4873
+ if (typeof t == "function" && !ne(t)) {
4837
4874
  var x = ce(t), C = Se(t, v);
4838
4875
  return "[Function" + (x ? ": " + x : " (anonymous)") + "]" + (C.length > 0 ? " { " + T.call(C, ", ") + " }" : "");
4839
4876
  }
4840
- if (oe(t)) {
4877
+ if (se(t)) {
4841
4878
  var D = j ? b.call(String(t), /^(Symbol\(.*\))_[^)]*$/, "$1") : A.call(t);
4842
4879
  return typeof t == "object" && !j ? Y(D) : D;
4843
4880
  }
4844
4881
  if (J(t)) {
4845
- for (var k = "<" + S.call(String(t.nodeName)), L = t.attributes || [], R = 0; R < L.length; R++) k += " " + L[R].name + "=" + z(ne(L[R].value), "double", c);
4882
+ for (var k = "<" + S.call(String(t.nodeName)), I = t.attributes || [], z = 0; z < I.length; z++) k += " " + I[z].name + "=" + te(B(I[z].value), "double", c);
4846
4883
  return k += ">", t.childNodes && t.childNodes.length && (k += "..."), k += "</" + S.call(String(t.nodeName)) + ">", k;
4847
4884
  }
4848
- if (V(t)) {
4885
+ if (H(t)) {
4849
4886
  if (t.length === 0) return "[]";
4850
- var B = Se(t, v);
4851
- return _ && !ye(B) ? "[" + xe(B, _) + "]" : "[ " + T.call(B, ", ") + " ]";
4887
+ var V = Se(t, v);
4888
+ return _ && !ye(V) ? "[" + xe(V, _) + "]" : "[ " + T.call(V, ", ") + " ]";
4852
4889
  }
4853
- if (U(t)) {
4890
+ if (re(t)) {
4854
4891
  var G = Se(t, v);
4855
4892
  return !("cause" in Error.prototype) && "cause" in t && !N.call(t, "cause") ? "{ [" + String(t) + "] " + T.call(w.call("[cause]: " + v(t.cause), G), ", ") + " }" : G.length === 0 ? "[" + String(t) + "]" : "{ [" + String(t) + "] " + T.call(G, ", ") + " }";
4856
4893
  }
4857
4894
  if (typeof t == "object" && l) {
4858
- if (ee && typeof t[ee] == "function" && I) return I(t, { depth: g - i });
4895
+ if (L && typeof t[L] == "function" && F) return F(t, { depth: g - i });
4859
4896
  if (l !== "symbol" && typeof t.inspect == "function") return t.inspect();
4860
4897
  }
4861
4898
  if (ue(t)) {
@@ -4874,49 +4911,49 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4874
4911
  if (me(t)) return _e("WeakSet");
4875
4912
  if (fe(t)) return _e("WeakRef");
4876
4913
  if (ae(t)) return Y(v(Number(t)));
4877
- if (se(t)) return Y(v(O.call(t)));
4878
- if (W(t)) return Y(h.call(t));
4914
+ if (W(t)) return Y(v(O.call(t)));
4915
+ if (oe(t)) return Y(h.call(t));
4879
4916
  if (ie(t)) return Y(v(String(t)));
4880
4917
  if (typeof window < "u" && t === window) return "{ [object Window] }";
4881
4918
  if (typeof globalThis < "u" && t === globalThis || r !== void 0 && t === r) return "{ [object globalThis] }";
4882
- if (!re(t) && !H(t)) {
4883
- var we = Se(t, v), Te = P ? P(t) === Object.prototype : t instanceof Object || t.constructor === Object, Ee = t instanceof Object ? "" : "null prototype", De = !Te && M && Object(t) === t && M in t ? y.call(q(t), 8, -1) : Ee ? "Object" : "", Oe = (Te || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "") + (De || Ee ? "[" + T.call(w.call([], De || [], Ee || []), ": ") + "] " : "");
4919
+ if (!U(t) && !ne(t)) {
4920
+ var we = Se(t, v), Te = ee ? ee(t) === Object.prototype : t instanceof Object || t.constructor === Object, Ee = t instanceof Object ? "" : "null prototype", De = !Te && M && Object(t) === t && M in t ? y.call(q(t), 8, -1) : Ee ? "Object" : "", Oe = (Te || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "") + (De || Ee ? "[" + T.call(w.call([], De || [], Ee || []), ": ") + "] " : "");
4884
4921
  return we.length === 0 ? Oe + "{}" : _ ? Oe + "{" + xe(we, _) + "}" : Oe + "{ " + T.call(we, ", ") + " }";
4885
4922
  }
4886
4923
  return String(t);
4887
4924
  };
4888
- function z(e, t, n) {
4889
- var r = te[n.quoteStyle || t];
4925
+ function te(e, t, n) {
4926
+ var r = R[n.quoteStyle || t];
4890
4927
  return r + e + r;
4891
4928
  }
4892
- function ne(e) {
4893
- return b.call(String(e), /"/g, "&quot;");
4894
- }
4895
4929
  function B(e) {
4896
- return !M || !(typeof e == "object" && (M in e || e[M] !== void 0));
4930
+ return b.call(String(e), /"/g, "&quot;");
4897
4931
  }
4898
4932
  function V(e) {
4899
- return q(e) === "[object Array]" && B(e);
4900
- }
4901
- function re(e) {
4902
- return q(e) === "[object Date]" && B(e);
4933
+ return !M || !(typeof e == "object" && (M in e || e[M] !== void 0));
4903
4934
  }
4904
4935
  function H(e) {
4905
- return q(e) === "[object RegExp]" && B(e);
4936
+ return q(e) === "[object Array]" && V(e);
4906
4937
  }
4907
4938
  function U(e) {
4908
- return q(e) === "[object Error]" && B(e);
4939
+ return q(e) === "[object Date]" && V(e);
4940
+ }
4941
+ function ne(e) {
4942
+ return q(e) === "[object RegExp]" && V(e);
4943
+ }
4944
+ function re(e) {
4945
+ return q(e) === "[object Error]" && V(e);
4909
4946
  }
4910
4947
  function ie(e) {
4911
- return q(e) === "[object String]" && B(e);
4948
+ return q(e) === "[object String]" && V(e);
4912
4949
  }
4913
4950
  function ae(e) {
4914
- return q(e) === "[object Number]" && B(e);
4915
- }
4916
- function W(e) {
4917
- return q(e) === "[object Boolean]" && B(e);
4951
+ return q(e) === "[object Number]" && V(e);
4918
4952
  }
4919
4953
  function oe(e) {
4954
+ return q(e) === "[object Boolean]" && V(e);
4955
+ }
4956
+ function se(e) {
4920
4957
  if (j) return e && typeof e == "object" && e instanceof Symbol;
4921
4958
  if (typeof e == "symbol") return !0;
4922
4959
  if (!e || typeof e != "object" || !A) return !1;
@@ -4925,7 +4962,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
4925
4962
  } catch {}
4926
4963
  return !1;
4927
4964
  }
4928
- function se(e) {
4965
+ function W(e) {
4929
4966
  if (!e || typeof e != "object" || !O) return !1;
4930
4967
  try {
4931
4968
  return O.call(e), !0;
@@ -5018,8 +5055,8 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
5018
5055
  var n = e.length - t.maxStringLength, r = "... " + n + " more character" + (n > 1 ? "s" : "");
5019
5056
  return he(y.call(e, 0, t.maxStringLength), t) + r;
5020
5057
  }
5021
- var i = R[t.quoteStyle || "single"];
5022
- return i.lastIndex = 0, z(b.call(b.call(e, i, "\\$1"), /[\x00-\x1f]/g, ge), "single", t);
5058
+ var i = z[t.quoteStyle || "single"];
5059
+ return i.lastIndex = 0, te(b.call(b.call(e, i, "\\$1"), /[\x00-\x1f]/g, ge), "single", t);
5023
5060
  }
5024
5061
  function ge(e) {
5025
5062
  var t = e.charCodeAt(0), n = {
@@ -5061,7 +5098,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
5061
5098
  return n + T.call(e, "," + n) + "\n" + t.prev;
5062
5099
  }
5063
5100
  function Se(e, t) {
5064
- var n = V(e), r = [];
5101
+ var n = H(e), r = [];
5065
5102
  if (n) {
5066
5103
  r.length = e.length;
5067
5104
  for (var i = 0; i < e.length; i++) r[i] = K(e, i) ? t(e[i], e) : "";
@@ -5985,20 +6022,20 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
5985
6022
  }), t.exports = s;
5986
6023
  })), nr = /* @__PURE__ */ t(((e, t) => {
5987
6024
  i();
5988
- var o = A(), s = F(), c = I(), l = q(), u = P(), d = ce(), f = be(), p = ze(), m = j(), h = a(), g = /\${?([\w\d]+)}?/g, _ = m.EventEmitter || m.default || m;
6025
+ var a = ie(), o = G(), s = K(), c = q(), l = W(), u = ce(), d = be(), f = ze(), p = ae(), m = C(), h = /\${?([\w\d]+)}?/g, g = p.EventEmitter || p.default || p;
5989
6026
  String.prototype.regexIndexOf = function(e, t) {
5990
6027
  let n = this.substring(t || 0).search(e);
5991
6028
  return n >= 0 ? n + (t || 0) : n;
5992
6029
  }, tr().shim();
5993
- var v = class e extends _ {
6030
+ var _ = class e extends g {
5994
6031
  constructor(t) {
5995
6032
  super();
5996
- let { path: n = "/bin", profile: r, hostname: i = "browser", filesystem: a = {}, permissions: s = {}, cwd: c = "/", onFsChange: l, useRealFilesystem: u = !1 } = t;
5997
- this.context = new o(Object.assign({}, t, {
6033
+ let { path: n = "/bin", profile: r, hostname: i = "browser", filesystem: o = {}, permissions: s = {}, cwd: c = "/", onFsChange: l, useRealFilesystem: u = !1 } = t;
6034
+ this.context = new a(Object.assign({}, t, {
5998
6035
  clearFn: this.clear.bind(this),
5999
6036
  destroyFn: this.destroy.bind(this),
6000
6037
  onFsChange: typeof l == "function" ? l : null
6001
- })), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(a, s), this.context.setCwd(c);
6038
+ })), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(o, s), this.context.setCwd(c);
6002
6039
  let d = u || this.context.fs.exists(this.context.getVar("PATH"));
6003
6040
  this._loadDefaultCommands(), this._loadBuiltinCommands(d), this._lastCode = 0, r ? this._loadProfile(r) : setTimeout(() => this.emit("status", e.STATUS_READY), 0);
6004
6041
  }
@@ -6033,12 +6070,12 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6033
6070
  };
6034
6071
  }
6035
6072
  _loadDefaultCommands() {
6036
- p.forEach((e) => {
6073
+ f.forEach((e) => {
6037
6074
  this.context.setCommand(e);
6038
6075
  });
6039
6076
  }
6040
6077
  _loadBuiltinCommands(e = !1) {
6041
- f.forEach((e) => {
6078
+ d.forEach((e) => {
6042
6079
  this.context.setCommand(e);
6043
6080
  }), e || this.context.fs.setMode(this.context.getVar("PATH"), 365);
6044
6081
  }
@@ -6079,12 +6116,12 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6079
6116
  this.context.setVar(r.slice(0, e), r.slice(e + 1)), this.lastCode = 0, this.emit("exitCode", 0);
6080
6117
  return;
6081
6118
  }
6082
- let i = null, a = !1, o = [];
6119
+ let i = null, a = !1, c = [];
6083
6120
  for (let e = 0; e < n.length; e++) {
6084
6121
  let { value: t, hasQuote: r } = n[e];
6085
- !r && (t === ">>" || t === ">") && e + 1 < n.length ? (a = t === ">>", i = n[++e].value) : !r && t.startsWith(">>") && t.length > 2 ? (a = !0, i = t.slice(2)) : !r && t.startsWith(">") && t.length > 1 ? (a = !1, i = t.slice(1)) : o.push(t);
6122
+ !r && (t === ">>" || t === ">") && e + 1 < n.length ? (a = t === ">>", i = n[++e].value) : !r && t.startsWith(">>") && t.length > 2 ? (a = !0, i = t.slice(2)) : !r && t.startsWith(">") && t.length > 1 ? (a = !1, i = t.slice(1)) : c.push(t);
6086
6123
  }
6087
- n = o;
6124
+ n = c;
6088
6125
  let l = this.context.getAlias(r);
6089
6126
  if (l) return this.onCommand(l, !1);
6090
6127
  let u;
@@ -6095,7 +6132,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6095
6132
  return;
6096
6133
  }
6097
6134
  let d = (e) => typeof e == "function" && typeof e.prototype.run == "function" && typeof e.prototype.runCommand == "function", f;
6098
- if (u.prototype instanceof s || new u() instanceof c) f = new u(n, this.context);
6135
+ if (u.prototype instanceof o || new u() instanceof s) f = new u(n, this.context);
6099
6136
  else if (d(u)) f = new u(n);
6100
6137
  else {
6101
6138
  this.emit("stdErr", `${r}: Command not found`), this.lastCode = 1, this.emit("exitCode", this.lastCode);
@@ -6200,11 +6237,11 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6200
6237
  }
6201
6238
  if (t.constructor === String && t.startsWith("#!")) {
6202
6239
  if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
6203
- return c.bind(this, t);
6240
+ return s.bind(this, t);
6204
6241
  }
6205
6242
  if (this._isWasmFile(e, t)) {
6206
6243
  if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
6207
- return l.bind(null, e);
6244
+ return c.bind(null, e);
6208
6245
  }
6209
6246
  if (this.context.fs.isRealFilesystem && typeof t == "string" && e.endsWith(".js")) {
6210
6247
  if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
@@ -6241,7 +6278,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6241
6278
  let n = await this._runAndCapture(e[1]);
6242
6279
  t = t.replace(e[0], n);
6243
6280
  }
6244
- let i = t.matchAll(g), a = i.next();
6281
+ let i = t.matchAll(h), a = i.next();
6245
6282
  for (; !a.done;) {
6246
6283
  let n = this.context.getVar(a.value[1]);
6247
6284
  t = t.replace(new RegExp(e._escapeRegExp(a.value[0]), "g"), String(n)), a = i.next();
@@ -6344,7 +6381,7 @@ var V, re, H, U, ie, ae, W, oe, se, G, K = e((() => {
6344
6381
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6345
6382
  }
6346
6383
  };
6347
- v.STATUS_READY = "READY", v.STATUS_WORKING = "WORKING", v.STATUS_DESTROYED = "DESTROYED", v.Command = u, v.InteractiveCommand = d, v.FS = h, r.shell = v, t.exports = v;
6384
+ _.STATUS_READY = "READY", _.STATUS_WORKING = "WORKING", _.STATUS_DESTROYED = "DESTROYED", _.Command = l, _.InteractiveCommand = u, _.FS = m, r.shell = _, t.exports = _;
6348
6385
  }));
6349
6386
  //#endregion
6350
6387
  export default nr();