UNPKG

84.9 kBJavaScriptView Raw
1/*! Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
2 * https://github.com/denoland/deno/blob/master/LICENSE
3 * https://deno.land/ */
4function assertPath(e) {
5 if ("string" != typeof e) throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`);
6}
7
8function isPosixPathSeparator(e) {
9 return 47 === e;
10}
11
12function isPathSeparator(e) {
13 return isPosixPathSeparator(e) || 92 === e;
14}
15
16function isWindowsDeviceRoot(e) {
17 return e >= 97 && e <= 122 || e >= 65 && e <= 90;
18}
19
20function normalizeString(e, t, n, r) {
21 let i, o = "", s = 0, a = -1, l = 0;
22 for (let c = 0, u = e.length; c <= u; ++c) {
23 if (c < u) i = e.charCodeAt(c); else {
24 if (r(i)) break;
25 i = 47;
26 }
27 if (r(i)) {
28 if (a === c - 1 || 1 === l) ; else if (a !== c - 1 && 2 === l) {
29 if (o.length < 2 || 2 !== s || 46 !== o.charCodeAt(o.length - 1) || 46 !== o.charCodeAt(o.length - 2)) {
30 if (o.length > 2) {
31 const e = o.lastIndexOf(n);
32 -1 === e ? (o = "", s = 0) : (o = o.slice(0, e), s = o.length - 1 - o.lastIndexOf(n)),
33 a = c, l = 0;
34 continue;
35 }
36 if (2 === o.length || 1 === o.length) {
37 o = "", s = 0, a = c, l = 0;
38 continue;
39 }
40 }
41 t && (o.length > 0 ? o += `${n}..` : o = "..", s = 2);
42 } else o.length > 0 ? o += n + e.slice(a + 1, c) : o = e.slice(a + 1, c), s = c - a - 1;
43 a = c, l = 0;
44 } else 46 === i && -1 !== l ? ++l : l = -1;
45 }
46 return o;
47}
48
49function _format(e, t) {
50 const n = t.dir || t.root, r = t.base || (t.name || "") + (t.ext || "");
51 return n ? n === t.root ? n + r : n + e + r : r;
52}
53
54function assert(e, t = "") {
55 if (!e) throw new DenoStdInternalError(t);
56}
57
58function resolve$2(...e) {
59 let t = "", n = "", r = !1;
60 for (let i = e.length - 1; i >= -1; i--) {
61 let o;
62 if (i >= 0) o = e[i]; else if (t) {
63 if (null == globalThis.Deno) throw new TypeError("Resolved a relative path without a CWD.");
64 o = Deno.env.get(`=${t}`) || Deno.cwd(), void 0 !== o && o.slice(0, 3).toLowerCase() === `${t.toLowerCase()}\\` || (o = `${t}\\`);
65 } else {
66 if (null == globalThis.Deno) throw new TypeError("Resolved a drive-letter-less path without a CWD.");
67 o = Deno.cwd();
68 }
69 assertPath(o);
70 const s = o.length;
71 if (0 === s) continue;
72 let a = 0, l = "", c = !1;
73 const u = o.charCodeAt(0);
74 if (s > 1) if (isPathSeparator(u)) if (c = !0, isPathSeparator(o.charCodeAt(1))) {
75 let e = 2, t = e;
76 for (;e < s && !isPathSeparator(o.charCodeAt(e)); ++e) ;
77 if (e < s && e !== t) {
78 const n = o.slice(t, e);
79 for (t = e; e < s && isPathSeparator(o.charCodeAt(e)); ++e) ;
80 if (e < s && e !== t) {
81 for (t = e; e < s && !isPathSeparator(o.charCodeAt(e)); ++e) ;
82 e === s ? (l = `\\\\${n}\\${o.slice(t)}`, a = e) : e !== t && (l = `\\\\${n}\\${o.slice(t, e)}`,
83 a = e);
84 }
85 }
86 } else a = 1; else isWindowsDeviceRoot(u) && 58 === o.charCodeAt(1) && (l = o.slice(0, 2),
87 a = 2, s > 2 && isPathSeparator(o.charCodeAt(2)) && (c = !0, a = 3)); else isPathSeparator(u) && (a = 1,
88 c = !0);
89 if (!(l.length > 0 && t.length > 0 && l.toLowerCase() !== t.toLowerCase()) && (0 === t.length && l.length > 0 && (t = l),
90 r || (n = `${o.slice(a)}\\${n}`, r = c), r && t.length > 0)) break;
91 }
92 return n = normalizeString(n, !r, "\\", isPathSeparator), t + (r ? "\\" : "") + n || ".";
93}
94
95function normalize$2(e) {
96 assertPath(e);
97 const t = e.length;
98 if (0 === t) return ".";
99 let n, r = 0, i = !1;
100 const o = e.charCodeAt(0);
101 if (t > 1) if (isPathSeparator(o)) if (i = !0, isPathSeparator(e.charCodeAt(1))) {
102 let i = 2, o = i;
103 for (;i < t && !isPathSeparator(e.charCodeAt(i)); ++i) ;
104 if (i < t && i !== o) {
105 const s = e.slice(o, i);
106 for (o = i; i < t && isPathSeparator(e.charCodeAt(i)); ++i) ;
107 if (i < t && i !== o) {
108 for (o = i; i < t && !isPathSeparator(e.charCodeAt(i)); ++i) ;
109 if (i === t) return `\\\\${s}\\${e.slice(o)}\\`;
110 i !== o && (n = `\\\\${s}\\${e.slice(o, i)}`, r = i);
111 }
112 }
113 } else r = 1; else isWindowsDeviceRoot(o) && 58 === e.charCodeAt(1) && (n = e.slice(0, 2),
114 r = 2, t > 2 && isPathSeparator(e.charCodeAt(2)) && (i = !0, r = 3)); else if (isPathSeparator(o)) return "\\";
115 let s;
116 return s = r < t ? normalizeString(e.slice(r), !i, "\\", isPathSeparator) : "",
117 0 !== s.length || i || (s = "."), s.length > 0 && isPathSeparator(e.charCodeAt(t - 1)) && (s += "\\"),
118 void 0 === n ? i ? s.length > 0 ? `\\${s}` : "\\" : s.length > 0 ? s : "" : i ? s.length > 0 ? `${n}\\${s}` : `${n}\\` : s.length > 0 ? n + s : n;
119}
120
121function resolve$1(...e) {
122 let t = "", n = !1;
123 for (let r = e.length - 1; r >= -1 && !n; r--) {
124 let i;
125 if (r >= 0) i = e[r]; else {
126 if (null == globalThis.Deno) throw new TypeError("Resolved a relative path without a CWD.");
127 i = Deno.cwd();
128 }
129 assertPath(i), 0 !== i.length && (t = `${i}/${t}`, n = 47 === i.charCodeAt(0));
130 }
131 return t = normalizeString(t, !n, "/", isPosixPathSeparator), n ? t.length > 0 ? `/${t}` : "/" : t.length > 0 ? t : ".";
132}
133
134function normalize$1(e) {
135 if (assertPath(e), 0 === e.length) return ".";
136 const t = 47 === e.charCodeAt(0), n = 47 === e.charCodeAt(e.length - 1);
137 return 0 !== (e = normalizeString(e, !t, "/", isPosixPathSeparator)).length || t || (e = "."),
138 e.length > 0 && n && (e += "/"), t ? `/${e}` : e;
139}
140
141function normalizeGlob(e, {globstar: t = !1} = {}) {
142 if (e.match(/\0/g)) throw new Error(`Glob contains invalid characters: "${e}"`);
143 if (!t) return normalize(e);
144 const n = SEP_PATTERN.source, r = new RegExp(`(?<=(${n}|^)\\*\\*${n})\\.\\.(?=${n}|$)`, "g");
145 return normalize(e.replace(r, "\0")).replace(/\0/g, "..");
146}
147
148function fromHexChar(e) {
149 if (48 <= e && e <= 57) return e - 48;
150 if (97 <= e && e <= 102) return e - 97 + 10;
151 if (65 <= e && e <= 70) return e - 65 + 10;
152 throw function t(e) {
153 return new Error("encoding/hex: invalid byte: " + (new TextDecoder).decode(new Uint8Array([ e ])));
154 }(e);
155}
156
157function notImplemented(e) {
158 throw new Error(e ? `Not implemented: ${e}` : "Not implemented");
159}
160
161function normalizeEncoding$1(e) {
162 return null == e || "utf8" === e || "utf-8" === e ? "utf8" : function t(e) {
163 switch (e.length) {
164 case 4:
165 if ("UTF8" === e) return "utf8";
166 if ("ucs2" === e || "UCS2" === e) return "utf16le";
167 if ("utf8" === (e = `${e}`.toLowerCase())) return "utf8";
168 if ("ucs2" === e) return "utf16le";
169 break;
170
171 case 3:
172 if ("hex" === e || "HEX" === e || "hex" === `${e}`.toLowerCase()) return "hex";
173 break;
174
175 case 5:
176 if ("ascii" === e) return "ascii";
177 if ("ucs-2" === e) return "utf16le";
178 if ("UTF-8" === e) return "utf8";
179 if ("ASCII" === e) return "ascii";
180 if ("UCS-2" === e) return "utf16le";
181 if ("utf-8" === (e = `${e}`.toLowerCase())) return "utf8";
182 if ("ascii" === e) return "ascii";
183 if ("ucs-2" === e) return "utf16le";
184 break;
185
186 case 6:
187 if ("base64" === e) return "base64";
188 if ("latin1" === e || "binary" === e) return "latin1";
189 if ("BASE64" === e) return "base64";
190 if ("LATIN1" === e || "BINARY" === e) return "latin1";
191 if ("base64" === (e = `${e}`.toLowerCase())) return "base64";
192 if ("latin1" === e || "binary" === e) return "latin1";
193 break;
194
195 case 7:
196 if ("utf16le" === e || "UTF16LE" === e || "utf16le" === `${e}`.toLowerCase()) return "utf16le";
197 break;
198
199 case 8:
200 if ("utf-16le" === e || "UTF-16LE" === e || "utf-16le" === `${e}`.toLowerCase()) return "utf16le";
201 break;
202
203 default:
204 if ("" === e) return "utf8";
205 }
206 }(e);
207}
208
209function checkEncoding$1(e = "utf8", t = !0) {
210 if ("string" != typeof e || t && "" === e) {
211 if (!t) return "utf8";
212 throw new TypeError(`Unkown encoding: ${e}`);
213 }
214 const n = normalizeEncoding$1(e);
215 if (void 0 === n) throw new TypeError(`Unkown encoding: ${e}`);
216 return notImplementedEncodings.includes(e) && notImplemented(`"${e}" encoding`),
217 n;
218}
219
220function promisify(e) {
221 function t(...t) {
222 return new Promise(((r, i) => {
223 e.call(this, ...t, ((e, ...t) => {
224 if (e) return i(e);
225 if (void 0 !== n && t.length > 1) {
226 const e = {};
227 for (let r = 0; r < n.length; r++) e[n[r]] = t[r];
228 r(e);
229 } else r(t[0]);
230 }));
231 }));
232 }
233 if ("function" != typeof e) throw new NodeInvalidArgTypeError$1("original", "Function", e);
234 if (e[kCustomPromisifiedSymbol]) {
235 const t = e[kCustomPromisifiedSymbol];
236 if ("function" != typeof t) throw new NodeInvalidArgTypeError$1("util.promisify.custom", "Function", t);
237 return Object.defineProperty(t, kCustomPromisifiedSymbol, {
238 value: t,
239 enumerable: !1,
240 writable: !1,
241 configurable: !0
242 });
243 }
244 const n = e[kCustomPromisifyArgsSymbol];
245 return Object.setPrototypeOf(t, Object.getPrototypeOf(e)), Object.defineProperty(t, kCustomPromisifiedSymbol, {
246 value: t,
247 enumerable: !1,
248 writable: !1,
249 configurable: !0
250 }), Object.defineProperties(t, Object.getOwnPropertyDescriptors(e));
251}
252
253function isBooleanObject(e) {
254 return _isObjectLike(e) && "[object Boolean]" === _toString.call(e);
255}
256
257function isNumberObject(e) {
258 return _isObjectLike(e) && "[object Number]" === _toString.call(e);
259}
260
261function isBigIntObject(e) {
262 return _isObjectLike(e) && "[object BigInt]" === _toString.call(e);
263}
264
265function isStringObject(e) {
266 return _isObjectLike(e) && "[object String]" === _toString.call(e);
267}
268
269function isSymbolObject(e) {
270 return _isObjectLike(e) && "[object Symbol]" === _toString.call(e);
271}
272
273function validateIntegerRange(e, t, n = -2147483648, r = 2147483647) {
274 if (!Number.isInteger(e)) throw new Error(`${t} must be 'an integer' but was ${e}`);
275 if (e < n || e > r) throw new Error(`${t} must be >= ${n} && <= ${r}. Value was ${e}`);
276}
277
278function createIterResult(e, t) {
279 return {
280 value: e,
281 done: t
282 };
283}
284
285function isFileOptions(e) {
286 return !!e && (null != e.encoding || null != e.flag || null != e.mode);
287}
288
289function getEncoding$1(e) {
290 if (!e || "function" == typeof e) return null;
291 return ("string" == typeof e ? e : e.encoding) || null;
292}
293
294function checkEncoding(e) {
295 if (!e) return null;
296 if (e = e.toLowerCase(), [ "utf8", "hex", "base64" ].includes(e)) return e;
297 if ("utf-8" === e) return "utf8";
298 if ("binary" === e) return "binary";
299 throw [ "utf16le", "latin1", "ascii", "ucs2" ].includes(e) && notImplemented(`"${e}" encoding`),
300 new Error(`The value "${e}" is invalid for option "encoding"`);
301}
302
303function getOpenOptions(e) {
304 if (!e) return {
305 create: !0,
306 append: !0
307 };
308 let t;
309 switch (e) {
310 case "a":
311 t = {
312 create: !0,
313 append: !0
314 };
315 break;
316
317 case "ax":
318 t = {
319 createNew: !0,
320 write: !0,
321 append: !0
322 };
323 break;
324
325 case "a+":
326 t = {
327 read: !0,
328 create: !0,
329 append: !0
330 };
331 break;
332
333 case "ax+":
334 t = {
335 read: !0,
336 createNew: !0,
337 append: !0
338 };
339 break;
340
341 case "r":
342 t = {
343 read: !0
344 };
345 break;
346
347 case "r+":
348 t = {
349 read: !0,
350 write: !0
351 };
352 break;
353
354 case "w":
355 t = {
356 create: !0,
357 write: !0,
358 truncate: !0
359 };
360 break;
361
362 case "wx":
363 t = {
364 createNew: !0,
365 write: !0
366 };
367 break;
368
369 case "w+":
370 t = {
371 create: !0,
372 write: !0,
373 truncate: !0,
374 read: !0
375 };
376 break;
377
378 case "wx+":
379 t = {
380 createNew: !0,
381 write: !0,
382 read: !0
383 };
384 break;
385
386 case "as":
387 t = {
388 create: !0,
389 append: !0
390 };
391
392 case "as+":
393 t = {
394 create: !0,
395 read: !0,
396 append: !0
397 };
398
399 case "rs+":
400 t = {
401 create: !0,
402 read: !0,
403 write: !0
404 };
405
406 default:
407 throw new Error(`Unrecognized file system flag: ${e}`);
408 }
409 return t;
410}
411
412function closeRidIfNecessary(e, t) {
413 e && -1 != t && Deno.close(t);
414}
415
416function validateEncoding(e) {
417 if (e) if ("string" == typeof e) {
418 if ("utf8" !== e) throw new Error("Only 'utf8' encoding is currently supported");
419 } else if (e.encoding && "utf8" !== e.encoding) throw new Error("Only 'utf8' encoding is currently supported");
420}
421
422function getResolvedMode(e) {
423 if ("number" == typeof e) return e;
424 if ("string" == typeof e && !allowedModes.test(e)) throw new Error("Unrecognized mode: " + e);
425 return parseInt(e, 8);
426}
427
428function maybeDecode(e, t) {
429 const n = new Buffer(e.buffer, e.byteOffset, e.byteLength);
430 return t && "binary" !== t ? n.toString(t) : n;
431}
432
433function readFile$1(e, t, n) {
434 let r;
435 e = e instanceof URL ? fromFileUrl(e) : e, r = "function" == typeof t ? t : n;
436 const i = getEncoding$1(t), o = Deno.readFile(e);
437 r && o.then((e => {
438 if (i && "binary" !== i) {
439 const t = maybeDecode(e, i);
440 return r(null, t);
441 }
442 const t = maybeDecode(e, i);
443 r(null, t);
444 })).catch((e => r && r(e)));
445}
446
447function maybeEncode(e, t) {
448 return "buffer" === t ? (new TextEncoder).encode(e) : e;
449}
450
451function getEncoding(e) {
452 if (e && "function" != typeof e) {
453 if (e.encoding) {
454 if ("utf8" === e.encoding || "utf-8" === e.encoding) return "utf8";
455 if ("buffer" === e.encoding) return "buffer";
456 notImplemented();
457 }
458 return null;
459 }
460 return null;
461}
462
463function writeFile$1(e, t, n, r) {
464 const i = n instanceof Function ? n : r, o = n instanceof Function ? void 0 : n;
465 if (!i) throw new TypeError("Callback must be a function.");
466 e = e instanceof URL ? fromFileUrl(e) : e;
467 const s = isFileOptions(o) ? o.flag : void 0, a = isFileOptions(o) ? o.mode : void 0, l = checkEncoding(getEncoding$1(o)) || "utf8", c = getOpenOptions(s || "w");
468 "string" == typeof t && (t = Buffer.from(t, l));
469 const u = "number" == typeof e;
470 let f, h = null;
471 (async () => {
472 try {
473 f = u ? new Deno.File(e) : await Deno.open(e, c), !u && a && ("windows" === Deno.build.os && notImplemented('"mode" on Windows'),
474 await Deno.chmod(e, a)), await Deno.writeAll(f, t);
475 } catch (e) {
476 h = e;
477 } finally {
478 !u && f && f.close(), i(h);
479 }
480 })();
481}
482
483function arch() {
484 return Deno.build.arch;
485}
486
487function endianness() {
488 const e = new ArrayBuffer(2);
489 return new DataView(e).setInt16(0, 256, !0), 256 === new Int16Array(e)[0] ? "LE" : "BE";
490}
491
492function freemem() {
493 notImplemented(SEE_GITHUB_ISSUE);
494}
495
496function homedir() {
497 notImplemented(SEE_GITHUB_ISSUE);
498}
499
500function hostname() {
501 notImplemented(SEE_GITHUB_ISSUE);
502}
503
504function platform() {
505 return process.platform;
506}
507
508function release() {
509 return Deno.osRelease();
510}
511
512function totalmem() {
513 notImplemented(SEE_GITHUB_ISSUE);
514}
515
516function type() {
517 notImplemented(SEE_GITHUB_ISSUE);
518}
519
520function uptime() {
521 notImplemented(SEE_GITHUB_ISSUE);
522}
523
524function parse(e, t = "&", n = "=", {decodeURIComponent: r = unescape, maxKeys: i = 1e3} = {}) {
525 const o = e.split(t).map((e => e.split(n).map(r))), s = {};
526 let a = 0;
527 for (;(Object.keys(s).length !== i || !i) && o[a]; ) {
528 const [e, t] = o[a];
529 s[e] ? Array.isArray(s[e]) ? s[e].push(t) : s[e] = [ s[e], t ] : s[e] = t, a++;
530 }
531 return s;
532}
533
534function stringify(e, t = "&", n = "=", {encodeURIComponent: r = escape} = {}) {
535 const i = [];
536 for (const t of Object.entries(e)) if (Array.isArray(t[1])) for (const e of t[1]) i.push(r(t[0]) + n + r(e)); else "object" != typeof t[1] && void 0 !== t[1] ? i.push(t.map(r).join(n)) : i.push(r(t[0]) + n);
537 return i.join(t);
538}
539
540function normalizeEncoding(e) {
541 const t = normalizeEncoding$1(null != e ? e : null);
542 if (t && t in NotImplemented && notImplemented(t), !t && "string" == typeof e && "raw" !== e.toLowerCase()) throw new Error(`Unknown encoding: ${e}`);
543 return String(t);
544}
545
546function utf8CheckByte(e) {
547 return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2;
548}
549
550function utf8FillLastComplete(e) {
551 const t = this.lastTotal - this.lastNeed, n = function r(e, t) {
552 if (128 != (192 & t[0])) return e.lastNeed = 0, "�";
553 if (e.lastNeed > 1 && t.length > 1) {
554 if (128 != (192 & t[1])) return e.lastNeed = 1, "�";
555 if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) return e.lastNeed = 2,
556 "�";
557 }
558 }(this, e);
559 return void 0 !== n ? n : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed),
560 this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length),
561 void (this.lastNeed -= e.length));
562}
563
564function utf8FillLastIncomplete(e) {
565 if (this.lastNeed <= e.length) return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed),
566 this.lastChar.toString(this.encoding, 0, this.lastTotal);
567 e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length;
568}
569
570function utf8Text(e, t) {
571 const n = function r(e, t, n) {
572 let r = t.length - 1;
573 if (r < n) return 0;
574 let i = utf8CheckByte(t[r]);
575 return i >= 0 ? (i > 0 && (e.lastNeed = i - 1), i) : --r < n || -2 === i ? 0 : (i = utf8CheckByte(t[r]),
576 i >= 0 ? (i > 0 && (e.lastNeed = i - 2), i) : --r < n || -2 === i ? 0 : (i = utf8CheckByte(t[r]),
577 i >= 0 ? (i > 0 && (2 === i ? i = 0 : e.lastNeed = i - 3), i) : 0));
578 }(this, e, t);
579 if (!this.lastNeed) return e.toString("utf8", t);
580 this.lastTotal = n;
581 const i = e.length - (n - this.lastNeed);
582 return e.copy(this.lastChar, 0, i), e.toString("utf8", t, i);
583}
584
585function utf8End(e) {
586 const t = e && e.length ? this.write(e) : "";
587 return this.lastNeed ? t + "�" : t;
588}
589
590function utf8Write(e) {
591 if (0 === e.length) return "";
592 let t, n;
593 if (this.lastNeed) {
594 if (t = this.fillLast(e), void 0 === t) return "";
595 n = this.lastNeed, this.lastNeed = 0;
596 } else n = 0;
597 return n < e.length ? t ? t + this.text(e, n) : this.text(e, n) : t || "";
598}
599
600function base64Text(e, t) {
601 const n = (e.length - t) % 3;
602 return 0 === n ? e.toString("base64", t) : (this.lastNeed = 3 - n, this.lastTotal = 3,
603 1 === n ? this.lastChar[0] = e[e.length - 1] : (this.lastChar[0] = e[e.length - 2],
604 this.lastChar[1] = e[e.length - 1]), e.toString("base64", t, e.length - n));
605}
606
607function base64End(e) {
608 const t = e && e.length ? this.write(e) : "";
609 return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t;
610}
611
612function simpleWrite(e) {
613 return e.toString(this.encoding);
614}
615
616function simpleEnd(e) {
617 return e && e.length ? this.write(e) : "";
618}
619
620function fileURLToPath(e) {
621 if ("string" == typeof e) e = new URL(e); else if (!(e instanceof URL)) throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");
622 if ("file:" !== e.protocol) throw new Deno.errors.InvalidData("invalid url scheme");
623 return isWindows$1 ? function t(e) {
624 const t = e.hostname;
625 let n = e.pathname;
626 for (let e = 0; e < n.length; e++) if ("%" === n[e]) {
627 const t = n.codePointAt(e + 2) || 32;
628 if ("2" === n[e + 1] && 102 === t || "5" === n[e + 1] && 99 === t) throw new Deno.errors.InvalidData("must not include encoded \\ or / characters");
629 }
630 if (n = n.replace(forwardSlashRegEx, "\\"), n = decodeURIComponent(n), "" !== t) return `\\\\${t}${n}`;
631 {
632 const e = 32 | n.codePointAt(1), t = n[2];
633 if (e < 97 || e > 122 || ":" !== t) throw new Deno.errors.InvalidData("file url path must be absolute");
634 return n.slice(1);
635 }
636 }(e) : function n(e) {
637 if ("" !== e.hostname) throw new Deno.errors.InvalidData("invalid file url hostname");
638 const t = e.pathname;
639 for (let e = 0; e < t.length; e++) if ("%" === t[e]) {
640 const n = t.codePointAt(e + 2) || 32;
641 if ("2" === t[e + 1] && 102 === n) throw new Deno.errors.InvalidData("must not include encoded / characters");
642 }
643 return decodeURIComponent(t);
644 }(e);
645}
646
647function pathToFileURL(e) {
648 let t = resolve(e);
649 const n = e.charCodeAt(e.length - 1);
650 (47 === n || isWindows$1 && 92 === n) && t[t.length - 1] !== sep && (t += "/");
651 const r = new URL("file://");
652 return t.includes("%") && (t = t.replace(percentRegEx, "%25")), !isWindows$1 && t.includes("\\") && (t = t.replace(backslashRegEx, "%5C")),
653 t.includes("\n") && (t = t.replace(newlineRegEx, "%0A")), t.includes("\r") && (t = t.replace(carriageReturnRegEx, "%0D")),
654 t.includes("\t") && (t = t.replace(tabRegEx, "%09")), r.pathname = t, r;
655}
656
657function stat(e) {
658 if (e = toNamespacedPath(e), null !== statCache) {
659 const t = statCache.get(e);
660 if (void 0 !== t) return t;
661 }
662 try {
663 const t = Deno.statSync(e).isFile ? 0 : 1;
664 return null !== statCache && statCache.set(e, t), t;
665 } catch (e) {
666 if (e instanceof Deno.errors.PermissionDenied) throw new Error("CJS loader requires --allow-read.");
667 return -1;
668 }
669}
670
671function updateChildren(e, t, n) {
672 const r = e && e.children;
673 !r || n && r.includes(t) || r.push(t);
674}
675
676function createNativeModule(e, t) {
677 const n = new Module(e);
678 return n.exports = t, n.loaded = !0, n;
679}
680
681function readPackage(e) {
682 const t = resolve(e, "package.json"), n = packageJsonCache.get(t);
683 if (void 0 !== n) return n;
684 let r;
685 try {
686 r = (new TextDecoder).decode(Deno.readFileSync(toNamespacedPath(t)));
687 } catch (e) {}
688 if (void 0 === r) return packageJsonCache.set(t, null), null;
689 try {
690 const e = JSON.parse(r), n = {
691 name: e.name,
692 main: e.main,
693 exports: e.exports,
694 type: e.type
695 };
696 return packageJsonCache.set(t, n), n;
697 } catch (e) {
698 throw e.path = t, e.message = "Error parsing " + t + ": " + e.message, e;
699 }
700}
701
702function tryPackage(e, t, n, r) {
703 const i = function o(e) {
704 const t = readPackage(e);
705 return t ? t.main : void 0;
706 }(e);
707 if (!i) return tryExtensions(resolve(e, "index"), t);
708 const s = resolve(e, i);
709 let a = tryFile(s) || tryExtensions(s, t) || tryExtensions(resolve(s, "index"), t);
710 if (!1 === a && (a = tryExtensions(resolve(e, "index"), t), !a)) {
711 const e = new Error(`Cannot find module '${s}'. Please verify that the package.json has a valid "main" entry`);
712 throw e.code = "MODULE_NOT_FOUND", e;
713 }
714 return a;
715}
716
717function tryFile(e, t) {
718 return 0 === stat(e) && toRealPath(e);
719}
720
721function toRealPath(e) {
722 let t = e;
723 for (;;) try {
724 t = Deno.readLinkSync(t);
725 } catch (e) {
726 break;
727 }
728 return resolve(e);
729}
730
731function tryExtensions(e, t, n) {
732 for (let n = 0; n < t.length; n++) {
733 const r = tryFile(e + t[n]);
734 if (r) return r;
735 }
736 return !1;
737}
738
739function resolveExports(e, t, n) {
740 if (!n) {
741 const [, n, r = ""] = t.match(EXPORTS_PATTERN) || [];
742 return n ? function r(e, t) {
743 const n = `.${t}`;
744 let r = function i(e) {
745 const t = readPackage(e);
746 return t ? t.exports : void 0;
747 }(e);
748 if (null == r) return resolve(e, n);
749 if (function o(e, t) {
750 if ("string" == typeof e) return !0;
751 if (Array.isArray(e)) return !0;
752 if ("object" != typeof e) return !1;
753 let n = !1, r = !0;
754 for (const t of Object.keys(e)) {
755 const e = "." !== t[0];
756 if (r) r = !1, n = e; else if (n !== e) throw new Error("\"exports\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.");
757 }
758 return n;
759 }(r) && (r = {
760 ".": r
761 }), "object" == typeof r) {
762 if (Object.prototype.hasOwnProperty.call(r, n)) {
763 const t = r[n];
764 return resolveExportsTarget(pathToFileURL(e + "/"), t, "", e, n);
765 }
766 if ("." === n) return e;
767 let t = "";
768 for (const e of Object.keys(r)) "/" === e[e.length - 1] && e.length > t.length && n.startsWith(e) && (t = e);
769 if ("" !== t) {
770 const i = r[t], o = n.slice(t.length);
771 return resolveExportsTarget(pathToFileURL(e + "/"), i, o, e, n);
772 }
773 }
774 if ("." === n) return e;
775 const s = new Error(`Package exports for '${e}' do not define a '${n}' subpath`);
776 throw s.code = "MODULE_NOT_FOUND", s;
777 }(resolve(e, n), r) : resolve(e, t);
778 }
779 return resolve(e, t);
780}
781
782function resolveExportsTarget(e, t, n, r, i) {
783 if ("string" == typeof t) {
784 if (t.startsWith("./") && (0 === n.length || t.endsWith("/"))) {
785 const r = new URL(t, e), i = e.pathname, o = r.pathname;
786 if (o.startsWith(i) && -1 === o.indexOf("/node_modules/", i.length - 1)) {
787 const e = new URL(n, r), t = e.pathname;
788 if (t.startsWith(o) && -1 === t.indexOf("/node_modules/", i.length - 1)) return fileURLToPath(e);
789 }
790 }
791 } else if (Array.isArray(t)) {
792 for (const s of t) if (!Array.isArray(s)) try {
793 return resolveExportsTarget(e, s, n, r, i);
794 } catch (o) {
795 if ("MODULE_NOT_FOUND" !== o.code) throw o;
796 }
797 } else if ("object" == typeof t && null !== t && Object.prototype.hasOwnProperty.call(t, "default")) try {
798 return resolveExportsTarget(e, t.default, n, r, i);
799 } catch (o) {
800 if ("MODULE_NOT_FOUND" !== o.code) throw o;
801 }
802 let o;
803 throw o = "." !== i ? new Error(`Package exports for '${r}' do not define a valid '${i}' target${n ? " for " + n : ""}`) : new Error(`No valid exports main found for '${r}'`),
804 o.code = "MODULE_NOT_FOUND", o;
805}
806
807function emitCircularRequireWarning(e) {
808 console.error(`Accessing non-existent property '${String(e)}' of module exports inside circular dependency`);
809}
810
811function getExportsForCircularRequire(e) {
812 return e.exports && Object.getPrototypeOf(e.exports) === PublicObjectPrototype && !e.exports.__esModule && Object.setPrototypeOf(e.exports, CircularRequirePrototypeWarningProxy),
813 e.exports;
814}
815
816function makeRequireFunction(e) {
817 function t(t, n) {
818 return Module._resolveFilename(t, e, !1, n);
819 }
820 const n = function t(n) {
821 return e.require(n);
822 };
823 return n.resolve = t, t.paths = function r(t) {
824 return Module._resolveLookupPaths(t, e);
825 }, n.extensions = Module._extensions, n.cache = Module._cache, n;
826}
827
828var EOL$1, NotImplemented;
829
830const navigator = globalThis.navigator;
831
832let isWindows$2 = !1;
833
834null != globalThis.Deno ? isWindows$2 = "windows" == Deno.build.os : null != (null == navigator ? void 0 : navigator.appVersion) && (isWindows$2 = navigator.appVersion.includes("Win"));
835
836class DenoStdInternalError extends Error {
837 constructor(e) {
838 super(e), this.name = "DenoStdInternalError";
839 }
840}
841
842const _win32 = {
843 __proto__: null,
844 sep: "\\",
845 delimiter: ";",
846 resolve: resolve$2,
847 normalize: normalize$2,
848 isAbsolute: function isAbsolute$2(e) {
849 assertPath(e);
850 const t = e.length;
851 if (0 === t) return !1;
852 const n = e.charCodeAt(0);
853 return !!isPathSeparator(n) || !!(isWindowsDeviceRoot(n) && t > 2 && 58 === e.charCodeAt(1) && isPathSeparator(e.charCodeAt(2)));
854 },
855 join: function join$2(...e) {
856 const t = e.length;
857 if (0 === t) return ".";
858 let n, r = null;
859 for (let i = 0; i < t; ++i) {
860 const t = e[i];
861 assertPath(t), t.length > 0 && (void 0 === n ? n = r = t : n += `\\${t}`);
862 }
863 if (void 0 === n) return ".";
864 let i = !0, o = 0;
865 if (assert(null != r), isPathSeparator(r.charCodeAt(0))) {
866 ++o;
867 const e = r.length;
868 e > 1 && isPathSeparator(r.charCodeAt(1)) && (++o, e > 2 && (isPathSeparator(r.charCodeAt(2)) ? ++o : i = !1));
869 }
870 if (i) {
871 for (;o < n.length && isPathSeparator(n.charCodeAt(o)); ++o) ;
872 o >= 2 && (n = `\\${n.slice(o)}`);
873 }
874 return normalize$2(n);
875 },
876 relative: function relative$2(e, t) {
877 if (assertPath(e), assertPath(t), e === t) return "";
878 const n = resolve$2(e), r = resolve$2(t);
879 if (n === r) return "";
880 if ((e = n.toLowerCase()) === (t = r.toLowerCase())) return "";
881 let i = 0, o = e.length;
882 for (;i < o && 92 === e.charCodeAt(i); ++i) ;
883 for (;o - 1 > i && 92 === e.charCodeAt(o - 1); --o) ;
884 const s = o - i;
885 let a = 0, l = t.length;
886 for (;a < l && 92 === t.charCodeAt(a); ++a) ;
887 for (;l - 1 > a && 92 === t.charCodeAt(l - 1); --l) ;
888 const c = l - a, u = s < c ? s : c;
889 let f = -1, h = 0;
890 for (;h <= u; ++h) {
891 if (h === u) {
892 if (c > u) {
893 if (92 === t.charCodeAt(a + h)) return r.slice(a + h + 1);
894 if (2 === h) return r.slice(a + h);
895 }
896 s > u && (92 === e.charCodeAt(i + h) ? f = h : 2 === h && (f = 3));
897 break;
898 }
899 const n = e.charCodeAt(i + h);
900 if (n !== t.charCodeAt(a + h)) break;
901 92 === n && (f = h);
902 }
903 if (h !== u && -1 === f) return r;
904 let d = "";
905 for (-1 === f && (f = 0), h = i + f + 1; h <= o; ++h) h !== o && 92 !== e.charCodeAt(h) || (0 === d.length ? d += ".." : d += "\\..");
906 return d.length > 0 ? d + r.slice(a + f, l) : (a += f, 92 === r.charCodeAt(a) && ++a,
907 r.slice(a, l));
908 },
909 toNamespacedPath: function toNamespacedPath$2(e) {
910 if ("string" != typeof e) return e;
911 if (0 === e.length) return "";
912 const t = resolve$2(e);
913 if (t.length >= 3) if (92 === t.charCodeAt(0)) {
914 if (92 === t.charCodeAt(1)) {
915 const e = t.charCodeAt(2);
916 if (63 !== e && 46 !== e) return `\\\\?\\UNC\\${t.slice(2)}`;
917 }
918 } else if (isWindowsDeviceRoot(t.charCodeAt(0)) && 58 === t.charCodeAt(1) && 92 === t.charCodeAt(2)) return `\\\\?\\${t}`;
919 return e;
920 },
921 dirname: function dirname$2(e) {
922 assertPath(e);
923 const t = e.length;
924 if (0 === t) return ".";
925 let n = -1, r = -1, i = !0, o = 0;
926 const s = e.charCodeAt(0);
927 if (t > 1) if (isPathSeparator(s)) {
928 if (n = o = 1, isPathSeparator(e.charCodeAt(1))) {
929 let r = 2, i = r;
930 for (;r < t && !isPathSeparator(e.charCodeAt(r)); ++r) ;
931 if (r < t && r !== i) {
932 for (i = r; r < t && isPathSeparator(e.charCodeAt(r)); ++r) ;
933 if (r < t && r !== i) {
934 for (i = r; r < t && !isPathSeparator(e.charCodeAt(r)); ++r) ;
935 if (r === t) return e;
936 r !== i && (n = o = r + 1);
937 }
938 }
939 }
940 } else isWindowsDeviceRoot(s) && 58 === e.charCodeAt(1) && (n = o = 2, t > 2 && isPathSeparator(e.charCodeAt(2)) && (n = o = 3)); else if (isPathSeparator(s)) return e;
941 for (let n = t - 1; n >= o; --n) if (isPathSeparator(e.charCodeAt(n))) {
942 if (!i) {
943 r = n;
944 break;
945 }
946 } else i = !1;
947 if (-1 === r) {
948 if (-1 === n) return ".";
949 r = n;
950 }
951 return e.slice(0, r);
952 },
953 basename: function basename$2(e, t = "") {
954 if (void 0 !== t && "string" != typeof t) throw new TypeError('"ext" argument must be a string');
955 assertPath(e);
956 let n, r = 0, i = -1, o = !0;
957 if (e.length >= 2 && isWindowsDeviceRoot(e.charCodeAt(0)) && 58 === e.charCodeAt(1) && (r = 2),
958 void 0 !== t && t.length > 0 && t.length <= e.length) {
959 if (t.length === e.length && t === e) return "";
960 let s = t.length - 1, a = -1;
961 for (n = e.length - 1; n >= r; --n) {
962 const l = e.charCodeAt(n);
963 if (isPathSeparator(l)) {
964 if (!o) {
965 r = n + 1;
966 break;
967 }
968 } else -1 === a && (o = !1, a = n + 1), s >= 0 && (l === t.charCodeAt(s) ? -1 == --s && (i = n) : (s = -1,
969 i = a));
970 }
971 return r === i ? i = a : -1 === i && (i = e.length), e.slice(r, i);
972 }
973 for (n = e.length - 1; n >= r; --n) if (isPathSeparator(e.charCodeAt(n))) {
974 if (!o) {
975 r = n + 1;
976 break;
977 }
978 } else -1 === i && (o = !1, i = n + 1);
979 return -1 === i ? "" : e.slice(r, i);
980 },
981 extname: function extname$2(e) {
982 assertPath(e);
983 let t = 0, n = -1, r = 0, i = -1, o = !0, s = 0;
984 e.length >= 2 && 58 === e.charCodeAt(1) && isWindowsDeviceRoot(e.charCodeAt(0)) && (t = r = 2);
985 for (let a = e.length - 1; a >= t; --a) {
986 const t = e.charCodeAt(a);
987 if (isPathSeparator(t)) {
988 if (!o) {
989 r = a + 1;
990 break;
991 }
992 } else -1 === i && (o = !1, i = a + 1), 46 === t ? -1 === n ? n = a : 1 !== s && (s = 1) : -1 !== n && (s = -1);
993 }
994 return -1 === n || -1 === i || 0 === s || 1 === s && n === i - 1 && n === r + 1 ? "" : e.slice(n, i);
995 },
996 format: function format$2(e) {
997 if (null === e || "object" != typeof e) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
998 return _format("\\", e);
999 },
1000 parse: function parse$3(e) {
1001 assertPath(e);
1002 const t = {
1003 root: "",
1004 dir: "",
1005 base: "",
1006 ext: "",
1007 name: ""
1008 }, n = e.length;
1009 if (0 === n) return t;
1010 let r = 0, i = e.charCodeAt(0);
1011 if (n > 1) {
1012 if (isPathSeparator(i)) {
1013 if (r = 1, isPathSeparator(e.charCodeAt(1))) {
1014 let t = 2, i = t;
1015 for (;t < n && !isPathSeparator(e.charCodeAt(t)); ++t) ;
1016 if (t < n && t !== i) {
1017 for (i = t; t < n && isPathSeparator(e.charCodeAt(t)); ++t) ;
1018 if (t < n && t !== i) {
1019 for (i = t; t < n && !isPathSeparator(e.charCodeAt(t)); ++t) ;
1020 t === n ? r = t : t !== i && (r = t + 1);
1021 }
1022 }
1023 }
1024 } else if (isWindowsDeviceRoot(i) && 58 === e.charCodeAt(1)) {
1025 if (r = 2, !(n > 2)) return t.root = t.dir = e, t;
1026 if (isPathSeparator(e.charCodeAt(2))) {
1027 if (3 === n) return t.root = t.dir = e, t;
1028 r = 3;
1029 }
1030 }
1031 } else if (isPathSeparator(i)) return t.root = t.dir = e, t;
1032 r > 0 && (t.root = e.slice(0, r));
1033 let o = -1, s = r, a = -1, l = !0, c = e.length - 1, u = 0;
1034 for (;c >= r; --c) if (i = e.charCodeAt(c), isPathSeparator(i)) {
1035 if (!l) {
1036 s = c + 1;
1037 break;
1038 }
1039 } else -1 === a && (l = !1, a = c + 1), 46 === i ? -1 === o ? o = c : 1 !== u && (u = 1) : -1 !== o && (u = -1);
1040 return -1 === o || -1 === a || 0 === u || 1 === u && o === a - 1 && o === s + 1 ? -1 !== a && (t.base = t.name = e.slice(s, a)) : (t.name = e.slice(s, o),
1041 t.base = e.slice(s, a), t.ext = e.slice(o, a)), t.dir = s > 0 && s !== r ? e.slice(0, s - 1) : t.root,
1042 t;
1043 },
1044 fromFileUrl: function fromFileUrl$2(e) {
1045 if ("file:" != (e = e instanceof URL ? e : new URL(e)).protocol) throw new TypeError("Must be a file URL.");
1046 let t = decodeURIComponent(e.pathname.replace(/^\/*([A-Za-z]:)(\/|$)/, "$1/").replace(/\//g, "\\"));
1047 return "" != e.hostname && (t = `\\\\${e.hostname}${t}`), t;
1048 }
1049}, _posix = {
1050 __proto__: null,
1051 sep: "/",
1052 delimiter: ":",
1053 resolve: resolve$1,
1054 normalize: normalize$1,
1055 isAbsolute: function isAbsolute$1(e) {
1056 return assertPath(e), e.length > 0 && 47 === e.charCodeAt(0);
1057 },
1058 join: function join$1(...e) {
1059 if (0 === e.length) return ".";
1060 let t;
1061 for (let n = 0, r = e.length; n < r; ++n) {
1062 const r = e[n];
1063 assertPath(r), r.length > 0 && (t ? t += `/${r}` : t = r);
1064 }
1065 return t ? normalize$1(t) : ".";
1066 },
1067 relative: function relative$1(e, t) {
1068 if (assertPath(e), assertPath(t), e === t) return "";
1069 if ((e = resolve$1(e)) === (t = resolve$1(t))) return "";
1070 let n = 1;
1071 const r = e.length;
1072 for (;n < r && 47 === e.charCodeAt(n); ++n) ;
1073 const i = r - n;
1074 let o = 1;
1075 const s = t.length;
1076 for (;o < s && 47 === t.charCodeAt(o); ++o) ;
1077 const a = s - o, l = i < a ? i : a;
1078 let c = -1, u = 0;
1079 for (;u <= l; ++u) {
1080 if (u === l) {
1081 if (a > l) {
1082 if (47 === t.charCodeAt(o + u)) return t.slice(o + u + 1);
1083 if (0 === u) return t.slice(o + u);
1084 } else i > l && (47 === e.charCodeAt(n + u) ? c = u : 0 === u && (c = 0));
1085 break;
1086 }
1087 const r = e.charCodeAt(n + u);
1088 if (r !== t.charCodeAt(o + u)) break;
1089 47 === r && (c = u);
1090 }
1091 let f = "";
1092 for (u = n + c + 1; u <= r; ++u) u !== r && 47 !== e.charCodeAt(u) || (0 === f.length ? f += ".." : f += "/..");
1093 return f.length > 0 ? f + t.slice(o + c) : (o += c, 47 === t.charCodeAt(o) && ++o,
1094 t.slice(o));
1095 },
1096 toNamespacedPath: function toNamespacedPath$1(e) {
1097 return e;
1098 },
1099 dirname: function dirname$1(e) {
1100 if (assertPath(e), 0 === e.length) return ".";
1101 const t = 47 === e.charCodeAt(0);
1102 let n = -1, r = !0;
1103 for (let t = e.length - 1; t >= 1; --t) if (47 === e.charCodeAt(t)) {
1104 if (!r) {
1105 n = t;
1106 break;
1107 }
1108 } else r = !1;
1109 return -1 === n ? t ? "/" : "." : t && 1 === n ? "//" : e.slice(0, n);
1110 },
1111 basename: function basename$1(e, t = "") {
1112 if (void 0 !== t && "string" != typeof t) throw new TypeError('"ext" argument must be a string');
1113 assertPath(e);
1114 let n, r = 0, i = -1, o = !0;
1115 if (void 0 !== t && t.length > 0 && t.length <= e.length) {
1116 if (t.length === e.length && t === e) return "";
1117 let s = t.length - 1, a = -1;
1118 for (n = e.length - 1; n >= 0; --n) {
1119 const l = e.charCodeAt(n);
1120 if (47 === l) {
1121 if (!o) {
1122 r = n + 1;
1123 break;
1124 }
1125 } else -1 === a && (o = !1, a = n + 1), s >= 0 && (l === t.charCodeAt(s) ? -1 == --s && (i = n) : (s = -1,
1126 i = a));
1127 }
1128 return r === i ? i = a : -1 === i && (i = e.length), e.slice(r, i);
1129 }
1130 for (n = e.length - 1; n >= 0; --n) if (47 === e.charCodeAt(n)) {
1131 if (!o) {
1132 r = n + 1;
1133 break;
1134 }
1135 } else -1 === i && (o = !1, i = n + 1);
1136 return -1 === i ? "" : e.slice(r, i);
1137 },
1138 extname: function extname$1(e) {
1139 assertPath(e);
1140 let t = -1, n = 0, r = -1, i = !0, o = 0;
1141 for (let s = e.length - 1; s >= 0; --s) {
1142 const a = e.charCodeAt(s);
1143 if (47 !== a) -1 === r && (i = !1, r = s + 1), 46 === a ? -1 === t ? t = s : 1 !== o && (o = 1) : -1 !== t && (o = -1); else if (!i) {
1144 n = s + 1;
1145 break;
1146 }
1147 }
1148 return -1 === t || -1 === r || 0 === o || 1 === o && t === r - 1 && t === n + 1 ? "" : e.slice(t, r);
1149 },
1150 format: function format$1(e) {
1151 if (null === e || "object" != typeof e) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof e);
1152 return _format("/", e);
1153 },
1154 parse: function parse$2(e) {
1155 assertPath(e);
1156 const t = {
1157 root: "",
1158 dir: "",
1159 base: "",
1160 ext: "",
1161 name: ""
1162 };
1163 if (0 === e.length) return t;
1164 const n = 47 === e.charCodeAt(0);
1165 let r;
1166 n ? (t.root = "/", r = 1) : r = 0;
1167 let i = -1, o = 0, s = -1, a = !0, l = e.length - 1, c = 0;
1168 for (;l >= r; --l) {
1169 const t = e.charCodeAt(l);
1170 if (47 !== t) -1 === s && (a = !1, s = l + 1), 46 === t ? -1 === i ? i = l : 1 !== c && (c = 1) : -1 !== i && (c = -1); else if (!a) {
1171 o = l + 1;
1172 break;
1173 }
1174 }
1175 return -1 === i || -1 === s || 0 === c || 1 === c && i === s - 1 && i === o + 1 ? -1 !== s && (t.base = t.name = 0 === o && n ? e.slice(1, s) : e.slice(o, s)) : (0 === o && n ? (t.name = e.slice(1, i),
1176 t.base = e.slice(1, s)) : (t.name = e.slice(o, i), t.base = e.slice(o, s)), t.ext = e.slice(i, s)),
1177 o > 0 ? t.dir = e.slice(0, o - 1) : n && (t.dir = "/"), t;
1178 },
1179 fromFileUrl: function fromFileUrl$1(e) {
1180 if ("file:" != (e = e instanceof URL ? e : new URL(e)).protocol) throw new TypeError("Must be a file URL.");
1181 return decodeURIComponent(e.pathname);
1182 }
1183}, SEP$1 = isWindows$2 ? "\\" : "/", SEP_PATTERN = isWindows$2 ? /[\\/]+/ : /\/+/, SEP = isWindows$2 ? "(?:\\\\|\\/)" : "\\/", SEP_ESC = isWindows$2 ? "\\\\" : "/", SEP_RAW = isWindows$2 ? "\\" : "/", GLOBSTAR = `(?:(?:[^${SEP_ESC}/]*(?:${SEP_ESC}|/|$))*)`, WILDCARD = `(?:[^${SEP_ESC}/]*)`, GLOBSTAR_SEGMENT = `((?:[^${SEP_ESC}/]*(?:${SEP_ESC}|/|$))*)`, WILDCARD_SEGMENT = `(?:[^${SEP_ESC}/]*)`, path = isWindows$2 ? _win32 : _posix, win32 = _win32, posix = _posix, {basename, delimiter, dirname, extname, format, fromFileUrl, isAbsolute, join, normalize, parse: parse$1, relative, resolve, sep, toNamespacedPath} = path;
1184
1185var EOL;
1186
1187(EOL = EOL$1 || (EOL$1 = {})).LF = "\n", EOL.CRLF = "\r\n";
1188
1189const hextable = (new TextEncoder).encode("0123456789abcdef"), _TextDecoder = TextDecoder, _TextEncoder = TextEncoder, notImplementedEncodings = [ "ascii", "binary", "latin1", "ucs2", "utf16le" ], encodingOps = {
1190 utf8: {
1191 byteLength: e => (new TextEncoder).encode(e).byteLength
1192 },
1193 ucs2: {
1194 byteLength: e => 2 * e.length
1195 },
1196 utf16le: {
1197 byteLength: e => 2 * e.length
1198 },
1199 latin1: {
1200 byteLength: e => e.length
1201 },
1202 ascii: {
1203 byteLength: e => e.length
1204 },
1205 base64: {
1206 byteLength: e => function t(e, n) {
1207 return 61 === e.charCodeAt(n - 1) && n--, n > 1 && 61 === e.charCodeAt(n - 1) && n--,
1208 3 * n >>> 2;
1209 }(e, e.length)
1210 },
1211 hex: {
1212 byteLength: e => e.length >>> 1
1213 }
1214};
1215
1216class Buffer extends Uint8Array {
1217 static alloc(e, t, n = "utf8") {
1218 if ("number" != typeof e) throw new TypeError('The "size" argument must be of type number. Received type ' + typeof e);
1219 const r = new Buffer(e);
1220 if (0 === e) return r;
1221 let i;
1222 if ("string" == typeof t) n = checkEncoding$1(n), "string" == typeof t && 1 === t.length && "utf8" === n ? r.fill(t.charCodeAt(0)) : i = Buffer.from(t, n); else if ("number" == typeof t) r.fill(t); else if (t instanceof Uint8Array) {
1223 if (0 === t.length) throw new TypeError(`The argument "value" is invalid. Received ${t.constructor.name} []`);
1224 i = t;
1225 }
1226 if (i) {
1227 i.length > r.length && (i = i.subarray(0, r.length));
1228 let t = 0;
1229 for (;t < e && (r.set(i, t), t += i.length, !(t + i.length >= e)); ) ;
1230 t !== e && r.set(i.subarray(0, e - t), t);
1231 }
1232 return r;
1233 }
1234 static allocUnsafe(e) {
1235 return new Buffer(e);
1236 }
1237 static byteLength(e, t = "utf8") {
1238 return "string" != typeof e ? e.byteLength : (t = normalizeEncoding$1(t) || "utf8",
1239 encodingOps[t].byteLength(e));
1240 }
1241 static concat(e, t) {
1242 if (null == t) {
1243 t = 0;
1244 for (const n of e) t += n.length;
1245 }
1246 const n = new Buffer(t);
1247 let r = 0;
1248 for (const t of e) n.set(t, r), r += t.length;
1249 return n;
1250 }
1251 static from(e, t, n) {
1252 const r = "string" == typeof t ? void 0 : t;
1253 let i = "string" == typeof t ? t : void 0;
1254 return "string" == typeof e ? (i = checkEncoding$1(i, !1), new Buffer("hex" === i ? function o(e) {
1255 return function t(e) {
1256 const t = new Uint8Array(function n(e) {
1257 return e >>> 1;
1258 }(e.length));
1259 for (let n = 0; n < t.length; n++) {
1260 const r = fromHexChar(e[2 * n]), i = fromHexChar(e[2 * n + 1]);
1261 t[n] = r << 4 | i;
1262 }
1263 if (e.length % 2 == 1) throw fromHexChar(e[2 * t.length]), function r() {
1264 return new Error("encoding/hex: odd length hex string");
1265 }();
1266 return t;
1267 }((new TextEncoder).encode(e));
1268 }(e).buffer : "base64" === i ? function s(e) {
1269 const t = function n(e) {
1270 return atob(e);
1271 }(e), r = new Uint8Array(t.length);
1272 for (let e = 0; e < r.length; ++e) r[e] = t.charCodeAt(e);
1273 return r.buffer;
1274 }(e) : (new TextEncoder).encode(e).buffer)) : new Buffer(e, r, n);
1275 }
1276 static isBuffer(e) {
1277 return e instanceof Buffer;
1278 }
1279 static isEncoding(e) {
1280 return "string" == typeof e && 0 !== e.length && void 0 !== normalizeEncoding$1(e);
1281 }
1282 copy(e, t = 0, n = 0, r = this.length) {
1283 const i = this.subarray(n, r);
1284 return e.set(i, t), i.length;
1285 }
1286 equals(e) {
1287 if (!(e instanceof Uint8Array)) throw new TypeError('The "otherBuffer" argument must be an instance of Buffer or Uint8Array. Received type ' + typeof e);
1288 if (this === e) return !0;
1289 if (this.byteLength !== e.byteLength) return !1;
1290 for (let t = 0; t < this.length; t++) if (this[t] !== e[t]) return !1;
1291 return !0;
1292 }
1293 readBigInt64BE(e = 0) {
1294 return new DataView(this.buffer, this.byteOffset, this.byteLength).getBigInt64(e);
1295 }
1296 readBigInt64LE(e = 0) {
1297 return new DataView(this.buffer, this.byteOffset, this.byteLength).getBigInt64(e, !0);
1298 }
1299 readBigUInt64BE(e = 0) {
1300 return new DataView(this.buffer, this.byteOffset, this.byteLength).getBigUint64(e);
1301 }
1302 readBigUInt64LE(e = 0) {
1303 return new DataView(this.buffer, this.byteOffset, this.byteLength).getBigUint64(e, !0);
1304 }
1305 readDoubleBE(e = 0) {
1306 return new DataView(this.buffer, this.byteOffset, this.byteLength).getFloat64(e);
1307 }
1308 readDoubleLE(e = 0) {
1309 return new DataView(this.buffer, this.byteOffset, this.byteLength).getFloat64(e, !0);
1310 }
1311 readFloatBE(e = 0) {
1312 return new DataView(this.buffer, this.byteOffset, this.byteLength).getFloat32(e);
1313 }
1314 readFloatLE(e = 0) {
1315 return new DataView(this.buffer, this.byteOffset, this.byteLength).getFloat32(e, !0);
1316 }
1317 readInt8(e = 0) {
1318 return new DataView(this.buffer, this.byteOffset, this.byteLength).getInt8(e);
1319 }
1320 readInt16BE(e = 0) {
1321 return new DataView(this.buffer, this.byteOffset, this.byteLength).getInt16(e);
1322 }
1323 readInt16LE(e = 0) {
1324 return new DataView(this.buffer, this.byteOffset, this.byteLength).getInt16(e, !0);
1325 }
1326 readInt32BE(e = 0) {
1327 return new DataView(this.buffer, this.byteOffset, this.byteLength).getInt32(e);
1328 }
1329 readInt32LE(e = 0) {
1330 return new DataView(this.buffer, this.byteOffset, this.byteLength).getInt32(e, !0);
1331 }
1332 readUInt8(e = 0) {
1333 return new DataView(this.buffer, this.byteOffset, this.byteLength).getUint8(e);
1334 }
1335 readUInt16BE(e = 0) {
1336 return new DataView(this.buffer, this.byteOffset, this.byteLength).getUint16(e);
1337 }
1338 readUInt16LE(e = 0) {
1339 return new DataView(this.buffer, this.byteOffset, this.byteLength).getUint16(e, !0);
1340 }
1341 readUInt32BE(e = 0) {
1342 return new DataView(this.buffer, this.byteOffset, this.byteLength).getUint32(e);
1343 }
1344 readUInt32LE(e = 0) {
1345 return new DataView(this.buffer, this.byteOffset, this.byteLength).getUint32(e, !0);
1346 }
1347 slice(e = 0, t = this.length) {
1348 return this.subarray(e, t);
1349 }
1350 toJSON() {
1351 return {
1352 type: "Buffer",
1353 data: Array.from(this)
1354 };
1355 }
1356 toString(e = "utf8", t = 0, n = this.length) {
1357 e = checkEncoding$1(e);
1358 const r = this.subarray(t, n);
1359 return "hex" === e ? function i(e) {
1360 return (new TextDecoder).decode(function t(e) {
1361 const t = new Uint8Array(function n(e) {
1362 return 2 * e;
1363 }(e.length));
1364 for (let n = 0; n < t.length; n++) {
1365 const r = e[n];
1366 t[2 * n] = hextable[r >> 4], t[2 * n + 1] = hextable[15 & r];
1367 }
1368 return t;
1369 }(e));
1370 }(r) : "base64" === e ? function o(e) {
1371 if ("string" == typeof e) return btoa(e);
1372 {
1373 const t = new Uint8Array(e);
1374 let n = "";
1375 for (let e = 0; e < t.length; ++e) n += String.fromCharCode(t[e]);
1376 return btoa(n);
1377 }
1378 }(r.buffer) : new TextDecoder(e).decode(r);
1379 }
1380 write(e, t = 0, n = this.length) {
1381 return (new TextEncoder).encodeInto(e, this.subarray(t, t + n)).written;
1382 }
1383 writeBigInt64BE(e, t = 0) {
1384 return new DataView(this.buffer, this.byteOffset, this.byteLength).setBigInt64(t, e),
1385 t + 4;
1386 }
1387 writeBigInt64LE(e, t = 0) {
1388 return new DataView(this.buffer, this.byteOffset, this.byteLength).setBigInt64(t, e, !0),
1389 t + 4;
1390 }
1391 writeBigUInt64BE(e, t = 0) {
1392 return new DataView(this.buffer, this.byteOffset, this.byteLength).setBigUint64(t, e),
1393 t + 4;
1394 }
1395 writeBigUInt64LE(e, t = 0) {
1396 return new DataView(this.buffer, this.byteOffset, this.byteLength).setBigUint64(t, e, !0),
1397 t + 4;
1398 }
1399 writeDoubleBE(e, t = 0) {
1400 return new DataView(this.buffer, this.byteOffset, this.byteLength).setFloat64(t, e),
1401 t + 8;
1402 }
1403 writeDoubleLE(e, t = 0) {
1404 return new DataView(this.buffer, this.byteOffset, this.byteLength).setFloat64(t, e, !0),
1405 t + 8;
1406 }
1407 writeFloatBE(e, t = 0) {
1408 return new DataView(this.buffer, this.byteOffset, this.byteLength).setFloat32(t, e),
1409 t + 4;
1410 }
1411 writeFloatLE(e, t = 0) {
1412 return new DataView(this.buffer, this.byteOffset, this.byteLength).setFloat32(t, e, !0),
1413 t + 4;
1414 }
1415 writeInt8(e, t = 0) {
1416 return new DataView(this.buffer, this.byteOffset, this.byteLength).setInt8(t, e),
1417 t + 1;
1418 }
1419 writeInt16BE(e, t = 0) {
1420 return new DataView(this.buffer, this.byteOffset, this.byteLength).setInt16(t, e),
1421 t + 2;
1422 }
1423 writeInt16LE(e, t = 0) {
1424 return new DataView(this.buffer, this.byteOffset, this.byteLength).setInt16(t, e, !0),
1425 t + 2;
1426 }
1427 writeInt32BE(e, t = 0) {
1428 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint32(t, e),
1429 t + 4;
1430 }
1431 writeInt32LE(e, t = 0) {
1432 return new DataView(this.buffer, this.byteOffset, this.byteLength).setInt32(t, e, !0),
1433 t + 4;
1434 }
1435 writeUInt8(e, t = 0) {
1436 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint8(t, e),
1437 t + 1;
1438 }
1439 writeUInt16BE(e, t = 0) {
1440 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint16(t, e),
1441 t + 2;
1442 }
1443 writeUInt16LE(e, t = 0) {
1444 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint16(t, e, !0),
1445 t + 2;
1446 }
1447 writeUInt32BE(e, t = 0) {
1448 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint32(t, e),
1449 t + 4;
1450 }
1451 writeUInt32LE(e, t = 0) {
1452 return new DataView(this.buffer, this.byteOffset, this.byteLength).setUint32(t, e, !0),
1453 t + 4;
1454 }
1455}
1456
1457Object.defineProperty(globalThis, "Buffer", {
1458 value: Buffer,
1459 enumerable: !1,
1460 writable: !0,
1461 configurable: !0
1462});
1463
1464const nodeBuffer = {
1465 __proto__: null,
1466 default: Buffer,
1467 Buffer
1468}, kCustomPromisifiedSymbol = Symbol.for("nodejs.util.promisify.custom"), kCustomPromisifyArgsSymbol = Symbol.for("nodejs.util.promisify.customArgs");
1469
1470class NodeInvalidArgTypeError$1 extends TypeError {
1471 constructor(e, t, n) {
1472 super(`The "${e}" argument must be of type ${t}. Received ${typeof n}`), this.code = "ERR_INVALID_ARG_TYPE";
1473 }
1474}
1475
1476promisify.custom = kCustomPromisifiedSymbol;
1477
1478class NodeFalsyValueRejectionError extends Error {
1479 constructor(e) {
1480 super("Promise was rejected with falsy value"), this.code = "ERR_FALSY_VALUE_REJECTION",
1481 this.reason = e;
1482 }
1483}
1484
1485class NodeInvalidArgTypeError extends TypeError {
1486 constructor(e) {
1487 super(`The ${e} argument must be of type function.`), this.code = "ERR_INVALID_ARG_TYPE";
1488 }
1489}
1490
1491const _toString = Object.prototype.toString, _isObjectLike = e => null !== e && "object" == typeof e, _isFunctionLike = e => null !== e && "function" == typeof e, nodeUtil = {
1492 __proto__: null,
1493 types: {
1494 __proto__: null,
1495 isAnyArrayBuffer: function isAnyArrayBuffer(e) {
1496 return _isObjectLike(e) && ("[object ArrayBuffer]" === _toString.call(e) || "[object SharedArrayBuffer]" === _toString.call(e));
1497 },
1498 isArrayBufferView: function isArrayBufferView(e) {
1499 return ArrayBuffer.isView(e);
1500 },
1501 isArgumentsObject: function isArgumentsObject(e) {
1502 return _isObjectLike(e) && "[object Arguments]" === _toString.call(e);
1503 },
1504 isArrayBuffer: function isArrayBuffer(e) {
1505 return _isObjectLike(e) && "[object ArrayBuffer]" === _toString.call(e);
1506 },
1507 isAsyncFunction: function isAsyncFunction(e) {
1508 return _isFunctionLike(e) && "[object AsyncFunction]" === _toString.call(e);
1509 },
1510 isBigInt64Array: function isBigInt64Array(e) {
1511 return _isObjectLike(e) && "[object BigInt64Array]" === _toString.call(e);
1512 },
1513 isBigUint64Array: function isBigUint64Array(e) {
1514 return _isObjectLike(e) && "[object BigUint64Array]" === _toString.call(e);
1515 },
1516 isBooleanObject,
1517 isBoxedPrimitive: function isBoxedPrimitive(e) {
1518 return isBooleanObject(e) || isStringObject(e) || isNumberObject(e) || isSymbolObject(e) || isBigIntObject(e);
1519 },
1520 isDataView: function isDataView(e) {
1521 return _isObjectLike(e) && "[object DataView]" === _toString.call(e);
1522 },
1523 isDate: function isDate(e) {
1524 return _isObjectLike(e) && "[object Date]" === _toString.call(e);
1525 },
1526 isFloat32Array: function isFloat32Array(e) {
1527 return _isObjectLike(e) && "[object Float32Array]" === _toString.call(e);
1528 },
1529 isFloat64Array: function isFloat64Array(e) {
1530 return _isObjectLike(e) && "[object Float64Array]" === _toString.call(e);
1531 },
1532 isGeneratorFunction: function isGeneratorFunction(e) {
1533 return _isFunctionLike(e) && "[object GeneratorFunction]" === _toString.call(e);
1534 },
1535 isGeneratorObject: function isGeneratorObject(e) {
1536 return _isObjectLike(e) && "[object Generator]" === _toString.call(e);
1537 },
1538 isInt8Array: function isInt8Array(e) {
1539 return _isObjectLike(e) && "[object Int8Array]" === _toString.call(e);
1540 },
1541 isInt16Array: function isInt16Array(e) {
1542 return _isObjectLike(e) && "[object Int16Array]" === _toString.call(e);
1543 },
1544 isInt32Array: function isInt32Array(e) {
1545 return _isObjectLike(e) && "[object Int32Array]" === _toString.call(e);
1546 },
1547 isMap: function isMap(e) {
1548 return _isObjectLike(e) && "[object Map]" === _toString.call(e);
1549 },
1550 isMapIterator: function isMapIterator(e) {
1551 return _isObjectLike(e) && "[object Map Iterator]" === _toString.call(e);
1552 },
1553 isModuleNamespaceObject: function isModuleNamespaceObject(e) {
1554 return _isObjectLike(e) && "[object Module]" === _toString.call(e);
1555 },
1556 isNativeError: function isNativeError(e) {
1557 return _isObjectLike(e) && "[object Error]" === _toString.call(e);
1558 },
1559 isNumberObject,
1560 isBigIntObject,
1561 isPromise: function isPromise(e) {
1562 return _isObjectLike(e) && "[object Promise]" === _toString.call(e);
1563 },
1564 isRegExp: function isRegExp$1(e) {
1565 return _isObjectLike(e) && "[object RegExp]" === _toString.call(e);
1566 },
1567 isSet: function isSet(e) {
1568 return _isObjectLike(e) && "[object Set]" === _toString.call(e);
1569 },
1570 isSetIterator: function isSetIterator(e) {
1571 return _isObjectLike(e) && "[object Set Iterator]" === _toString.call(e);
1572 },
1573 isSharedArrayBuffer: function isSharedArrayBuffer(e) {
1574 return _isObjectLike(e) && "[object SharedArrayBuffer]" === _toString.call(e);
1575 },
1576 isStringObject,
1577 isSymbolObject,
1578 isTypedArray: function isTypedArray(e) {
1579 return _isObjectLike(e) && /^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/.test(_toString.call(e));
1580 },
1581 isUint8Array: function isUint8Array(e) {
1582 return _isObjectLike(e) && "[object Uint8Array]" === _toString.call(e);
1583 },
1584 isUint8ClampedArray: function isUint8ClampedArray(e) {
1585 return _isObjectLike(e) && "[object Uint8ClampedArray]" === _toString.call(e);
1586 },
1587 isUint16Array: function isUint16Array(e) {
1588 return _isObjectLike(e) && "[object Uint16Array]" === _toString.call(e);
1589 },
1590 isUint32Array: function isUint32Array(e) {
1591 return _isObjectLike(e) && "[object Uint32Array]" === _toString.call(e);
1592 },
1593 isWeakMap: function isWeakMap(e) {
1594 return _isObjectLike(e) && "[object WeakMap]" === _toString.call(e);
1595 },
1596 isWeakSet: function isWeakSet(e) {
1597 return _isObjectLike(e) && "[object WeakSet]" === _toString.call(e);
1598 }
1599 },
1600 isArray: function isArray(e) {
1601 return Array.isArray(e);
1602 },
1603 isBoolean: function isBoolean(e) {
1604 return "boolean" == typeof e || e instanceof Boolean;
1605 },
1606 isNull: function isNull(e) {
1607 return null === e;
1608 },
1609 isNullOrUndefined: function isNullOrUndefined(e) {
1610 return null == e;
1611 },
1612 isNumber: function isNumber(e) {
1613 return "number" == typeof e || e instanceof Number;
1614 },
1615 isString: function isString(e) {
1616 return "string" == typeof e || e instanceof String;
1617 },
1618 isSymbol: function isSymbol(e) {
1619 return "symbol" == typeof e;
1620 },
1621 isUndefined: function isUndefined(e) {
1622 return void 0 === e;
1623 },
1624 isObject: function isObject(e) {
1625 return null !== e && "object" == typeof e;
1626 },
1627 isError: function isError(e) {
1628 return e instanceof Error;
1629 },
1630 isFunction: function isFunction(e) {
1631 return "function" == typeof e;
1632 },
1633 isRegExp: function isRegExp(e) {
1634 return e instanceof RegExp;
1635 },
1636 isPrimitive: function isPrimitive(e) {
1637 return null === e || "object" != typeof e && "function" != typeof e;
1638 },
1639 validateIntegerRange,
1640 TextDecoder: _TextDecoder,
1641 TextEncoder: _TextEncoder,
1642 promisify,
1643 callbackify: function callbackify(e) {
1644 if ("function" != typeof e) throw new NodeInvalidArgTypeError('"original"');
1645 const t = function(...t) {
1646 const n = t.pop();
1647 if ("function" != typeof n) throw new NodeInvalidArgTypeError("last");
1648 const r = (...e) => {
1649 n.apply(this, e);
1650 };
1651 e.apply(this, t).then((e => {
1652 queueMicrotask(r.bind(this, null, e));
1653 }), (e => {
1654 e = e || new NodeFalsyValueRejectionError(e), queueMicrotask(r.bind(this, e));
1655 }));
1656 }, n = Object.getOwnPropertyDescriptors(e);
1657 return "number" == typeof n.length.value && n.length.value++, "string" == typeof n.name.value && (n.name.value += "Callbackified"),
1658 Object.defineProperties(t, n), t;
1659 }
1660};
1661
1662class EventEmitter {
1663 constructor() {
1664 this._events = new Map;
1665 }
1666 _addListener(e, t, n) {
1667 if (this.emit("newListener", e, t), this._events.has(e)) {
1668 const r = this._events.get(e);
1669 n ? r.unshift(t) : r.push(t);
1670 } else this._events.set(e, [ t ]);
1671 const r = this.getMaxListeners();
1672 if (r > 0 && this.listenerCount(e) > r) {
1673 const t = new Error(`Possible EventEmitter memory leak detected.\n ${this.listenerCount(e)} ${e.toString()} listeners.\n Use emitter.setMaxListeners() to increase limit`);
1674 t.name = "MaxListenersExceededWarning", console.warn(t);
1675 }
1676 return this;
1677 }
1678 addListener(e, t) {
1679 return this._addListener(e, t, !1);
1680 }
1681 emit(e, ...t) {
1682 if (this._events.has(e)) {
1683 "error" === e && this._events.get(EventEmitter.errorMonitor) && this.emit(EventEmitter.errorMonitor, ...t);
1684 const n = this._events.get(e).slice();
1685 for (const e of n) try {
1686 e.apply(this, t);
1687 } catch (e) {
1688 this.emit("error", e);
1689 }
1690 return !0;
1691 }
1692 if ("error" === e) throw this._events.get(EventEmitter.errorMonitor) && this.emit(EventEmitter.errorMonitor, ...t),
1693 t.length > 0 ? t[0] : Error("Unhandled error.");
1694 return !1;
1695 }
1696 eventNames() {
1697 return Array.from(this._events.keys());
1698 }
1699 getMaxListeners() {
1700 return this.maxListeners || EventEmitter.defaultMaxListeners;
1701 }
1702 listenerCount(e) {
1703 return this._events.has(e) ? this._events.get(e).length : 0;
1704 }
1705 _listeners(e, t, n) {
1706 if (!e._events.has(t)) return [];
1707 const r = e._events.get(t);
1708 return n ? this.unwrapListeners(r) : r.slice(0);
1709 }
1710 unwrapListeners(e) {
1711 const t = new Array(e.length);
1712 for (let n = 0; n < e.length; n++) t[n] = e[n].listener || e[n];
1713 return t;
1714 }
1715 listeners(e) {
1716 return this._listeners(this, e, !0);
1717 }
1718 rawListeners(e) {
1719 return this._listeners(this, e, !1);
1720 }
1721 off(e, t) {
1722 return this.removeListener(e, t);
1723 }
1724 on(e, t) {
1725 return this.addListener(e, t);
1726 }
1727 once(e, t) {
1728 const n = this.onceWrap(e, t);
1729 return this.on(e, n), this;
1730 }
1731 onceWrap(e, t) {
1732 const n = function(...e) {
1733 this.context.removeListener(this.eventName, this.rawListener), this.listener.apply(this.context, e);
1734 }, r = {
1735 eventName: e,
1736 listener: t,
1737 rawListener: n,
1738 context: this
1739 }, i = n.bind(r);
1740 return r.rawListener = i, i.listener = t, i;
1741 }
1742 prependListener(e, t) {
1743 return this._addListener(e, t, !0);
1744 }
1745 prependOnceListener(e, t) {
1746 const n = this.onceWrap(e, t);
1747 return this.prependListener(e, n), this;
1748 }
1749 removeAllListeners(e) {
1750 if (void 0 === this._events) return this;
1751 if (e) {
1752 if (this._events.has(e)) {
1753 const t = this._events.get(e).slice();
1754 this._events.delete(e);
1755 for (const n of t) this.emit("removeListener", e, n);
1756 }
1757 } else this.eventNames().map((e => {
1758 this.removeAllListeners(e);
1759 }));
1760 return this;
1761 }
1762 removeListener(e, t) {
1763 if (this._events.has(e)) {
1764 const n = this._events.get(e);
1765 assert(n);
1766 let r = -1;
1767 for (let e = n.length - 1; e >= 0; e--) if (n[e] == t || n[e] && n[e].listener == t) {
1768 r = e;
1769 break;
1770 }
1771 r >= 0 && (n.splice(r, 1), this.emit("removeListener", e, t), 0 === n.length && this._events.delete(e));
1772 }
1773 return this;
1774 }
1775 setMaxListeners(e) {
1776 return validateIntegerRange(e, "maxListeners", 0), this.maxListeners = e, this;
1777 }
1778}
1779
1780EventEmitter.defaultMaxListeners = 10, EventEmitter.errorMonitor = Symbol("events.errorMonitor");
1781
1782const captureRejectionSymbol = Symbol.for("nodejs.rejection"), nodeEvents = {
1783 __proto__: null,
1784 default: EventEmitter,
1785 EventEmitter,
1786 once: function once(e, t) {
1787 return new Promise(((n, r) => {
1788 if (e instanceof EventTarget) e.addEventListener(t, ((...e) => {
1789 n(e);
1790 }), {
1791 once: !0,
1792 passive: !1,
1793 capture: !1
1794 }); else if (e instanceof EventEmitter) {
1795 const i = (...t) => {
1796 void 0 !== o && e.removeListener("error", o), n(t);
1797 };
1798 let o;
1799 return "error" !== t && (o = n => {
1800 e.removeListener(t, i), r(n);
1801 }, e.once("error", o)), void e.once(t, i);
1802 }
1803 }));
1804 },
1805 on: function on(e, t) {
1806 function n(...e) {
1807 const t = o.shift();
1808 t ? t.resolve(createIterResult(e, !1)) : i.push(e);
1809 }
1810 function r(e) {
1811 a = !0;
1812 const t = o.shift();
1813 t ? t.reject(e) : s = e, l.return();
1814 }
1815 const i = [], o = [];
1816 let s = null, a = !1;
1817 const l = {
1818 next() {
1819 const e = i.shift();
1820 if (e) return Promise.resolve(createIterResult(e, !1));
1821 if (s) {
1822 const e = Promise.reject(s);
1823 return s = null, e;
1824 }
1825 return a ? Promise.resolve(createIterResult(void 0, !0)) : new Promise((function(e, t) {
1826 o.push({
1827 resolve: e,
1828 reject: t
1829 });
1830 }));
1831 },
1832 return() {
1833 e.removeListener(t, n), e.removeListener("error", r), a = !0;
1834 for (const e of o) e.resolve(createIterResult(void 0, !0));
1835 return Promise.resolve(createIterResult(void 0, !0));
1836 },
1837 throw(i) {
1838 s = i, e.removeListener(t, n), e.removeListener("error", r);
1839 },
1840 [Symbol.asyncIterator]() {
1841 return this;
1842 }
1843 };
1844 return e.on(t, n), e.on("error", r), l;
1845 },
1846 captureRejectionSymbol
1847}, nodePath = {
1848 __proto__: null,
1849 SEP: SEP$1,
1850 SEP_PATTERN,
1851 common: function common(e, t = SEP$1) {
1852 const [n = "", ...r] = e;
1853 if ("" === n || 0 === r.length) return n.substring(0, n.lastIndexOf(t) + 1);
1854 const i = n.split(t);
1855 let o = i.length;
1856 for (const e of r) {
1857 const n = e.split(t);
1858 for (let e = 0; e < o; e++) n[e] !== i[e] && (o = e);
1859 if (0 === o) return "";
1860 }
1861 const s = i.slice(0, o).join(t);
1862 return s.endsWith(t) ? s : `${s}${t}`;
1863 },
1864 globToRegExp: function globToRegExp(e, {extended: t = !1, globstar: n = !0} = {}) {
1865 const r = function i(e, {extended: t = !1, globstar: n = !1, strict: r = !1, filepath: o = !1, flags: s = ""} = {}) {
1866 function a(e, t = {
1867 split: !1,
1868 last: !1,
1869 only: ""
1870 }) {
1871 const {split: n, last: r, only: i} = t;
1872 "path" !== i && (c += e), o && "regex" !== i && (f += e.match(l) ? SEP : e, n ? (r && (u += e),
1873 "" !== u && (s.includes("g") || (u = `^${u}$`), h.push(new RegExp(u, s))), u = "") : u += e);
1874 }
1875 const l = new RegExp(`^${SEP}${r ? "" : "+"}$`);
1876 let c = "", u = "", f = "";
1877 const h = [];
1878 let d = !1, p = !1;
1879 const g = [];
1880 let m, y;
1881 for (let i = 0; i < e.length; i++) if (m = e[i], y = e[i + 1], [ "\\", "$", "^", ".", "=" ].includes(m)) a(`\\${m}`); else if (m.match(l)) a(SEP, {
1882 split: !0
1883 }), null != y && y.match(l) && !r && (c += "?"); else if ("(" !== m) if (")" !== m) if ("|" !== m) if ("+" !== m) if ("@" === m && t && "(" === y) g.push(m); else if ("!" !== m) if ("?" !== m) if ("[" !== m) if ("]" !== m) if ("{" !== m) if ("}" !== m) if ("," !== m) if ("*" !== m) a(m); else {
1884 if ("(" === y && t) {
1885 g.push(m);
1886 continue;
1887 }
1888 const r = e[i - 1];
1889 let o = 1;
1890 for (;"*" === e[i + 1]; ) o++, i++;
1891 const s = e[i + 1];
1892 n ? o > 1 && [ SEP_RAW, "/", void 0 ].includes(r) && [ SEP_RAW, "/", void 0 ].includes(s) ? (a(GLOBSTAR, {
1893 only: "regex"
1894 }), a(GLOBSTAR_SEGMENT, {
1895 only: "path",
1896 last: !0,
1897 split: !0
1898 }), i++) : (a(WILDCARD, {
1899 only: "regex"
1900 }), a(WILDCARD_SEGMENT, {
1901 only: "path"
1902 })) : a(".*");
1903 } else {
1904 if (d) {
1905 a("|");
1906 continue;
1907 }
1908 a(`\\${m}`);
1909 } else {
1910 if (t) {
1911 d = !1, a(")");
1912 continue;
1913 }
1914 a(`\\${m}`);
1915 } else {
1916 if (t) {
1917 d = !0, a("(?:");
1918 continue;
1919 }
1920 a(`\\${m}`);
1921 } else {
1922 if (t) {
1923 p = !1, a(m);
1924 continue;
1925 }
1926 a(`\\${m}`);
1927 } else {
1928 if (p && ":" === y) {
1929 i++;
1930 let t = "";
1931 for (;":" !== e[++i]; ) t += e[i];
1932 "alnum" === t ? a("(?:\\w|\\d)") : "space" === t ? a("\\s") : "digit" === t && a("\\d"),
1933 i++;
1934 continue;
1935 }
1936 if (t) {
1937 p = !0, a(m);
1938 continue;
1939 }
1940 a(`\\${m}`);
1941 } else {
1942 if (t) {
1943 "(" === y ? g.push(m) : a(".");
1944 continue;
1945 }
1946 a(`\\${m}`);
1947 } else {
1948 if (t) {
1949 if (p) {
1950 a("^");
1951 continue;
1952 }
1953 if ("(" === y) {
1954 g.push(m), a("(?!"), i++;
1955 continue;
1956 }
1957 a(`\\${m}`);
1958 continue;
1959 }
1960 a(`\\${m}`);
1961 } else {
1962 if ("(" === y && t) {
1963 g.push(m);
1964 continue;
1965 }
1966 a(`\\${m}`);
1967 } else {
1968 if (g.length) {
1969 a(m);
1970 continue;
1971 }
1972 a(`\\${m}`);
1973 } else {
1974 if (g.length) {
1975 a(m);
1976 const e = g.pop();
1977 a("@" === e ? "{1}" : "!" === e ? WILDCARD : e);
1978 continue;
1979 }
1980 a(`\\${m}`);
1981 } else {
1982 if (g.length) {
1983 a(`${m}?:`);
1984 continue;
1985 }
1986 a(`\\${m}`);
1987 }
1988 s.includes("g") || (c = `^${c}$`, u = `^${u}$`, o && (f = `^${f}$`));
1989 const b = {
1990 regex: new RegExp(c, s)
1991 };
1992 return o && (h.push(new RegExp(u, s)), b.path = {
1993 regex: new RegExp(f, s),
1994 segments: h,
1995 globstar: new RegExp(s.includes("g") ? GLOBSTAR_SEGMENT : `^${GLOBSTAR_SEGMENT}$`, s)
1996 }), b;
1997 }(e, {
1998 extended: t,
1999 globstar: n,
2000 strict: !1,
2001 filepath: !0
2002 });
2003 return assert(null != r.path), r.path.regex;
2004 },
2005 isGlob: function isGlob(e) {
2006 const t = {
2007 "{": "}",
2008 "(": ")",
2009 "[": "]"
2010 }, n = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
2011 if ("" === e) return !1;
2012 let r;
2013 for (;r = n.exec(e); ) {
2014 if (r[2]) return !0;
2015 let n = r.index + r[0].length;
2016 const i = r[1], o = i ? t[i] : null;
2017 if (i && o) {
2018 const t = e.indexOf(o, n);
2019 -1 !== t && (n = t + 1);
2020 }
2021 e = e.slice(n);
2022 }
2023 return !1;
2024 },
2025 normalizeGlob,
2026 joinGlobs: function joinGlobs(e, {extended: t = !1, globstar: n = !1} = {}) {
2027 if (!n || 0 == e.length) return join(...e);
2028 if (0 === e.length) return ".";
2029 let r;
2030 for (const t of e) {
2031 const e = t;
2032 e.length > 0 && (r ? r += `${SEP$1}${e}` : r = e);
2033 }
2034 return r ? normalizeGlob(r, {
2035 extended: t,
2036 globstar: n
2037 }) : ".";
2038 },
2039 win32,
2040 posix,
2041 basename,
2042 delimiter,
2043 dirname,
2044 extname,
2045 format,
2046 fromFileUrl,
2047 isAbsolute,
2048 join,
2049 normalize,
2050 parse: parse$1,
2051 relative,
2052 resolve,
2053 sep,
2054 toNamespacedPath
2055}, allowedModes = /^[0-7]{3}/, mod = {
2056 __proto__: null,
2057 writeFile: function writeFile(e, t, n) {
2058 return new Promise(((r, i) => {
2059 writeFile$1(e, t, n, (e => {
2060 if (e) return i(e);
2061 r();
2062 }));
2063 }));
2064 },
2065 readFile: function readFile(e, t) {
2066 return new Promise(((n, r) => {
2067 readFile$1(e, t, ((e, t) => e ? r(e) : null == t ? r(new Error("Invalid state: data missing, but no error")) : void n(t)));
2068 }));
2069 }
2070}, nodeFs = {
2071 __proto__: null,
2072 access: function access(e, t, n) {
2073 notImplemented("Not yet available");
2074 },
2075 accessSync: function accessSync(e, t) {
2076 notImplemented("Not yet available");
2077 },
2078 appendFile: function appendFile(e, t, n, r) {
2079 e = e instanceof URL ? fromFileUrl(e) : e;
2080 const i = n instanceof Function ? n : r, o = n instanceof Function ? void 0 : n;
2081 if (!i) throw new Error("No callback function supplied");
2082 validateEncoding(o);
2083 let s = -1;
2084 const a = (new TextEncoder).encode(t);
2085 new Promise(((t, n) => {
2086 if ("number" == typeof e) s = e, Deno.write(s, a).then(t).catch(n); else {
2087 const r = isFileOptions(o) ? o.mode : void 0, i = isFileOptions(o) ? o.flag : void 0;
2088 r && notImplemented("Deno does not yet support setting mode on create"), Deno.open(e, getOpenOptions(i)).then((({rid: e}) => (s = e,
2089 Deno.write(e, a)))).then(t).catch(n);
2090 }
2091 })).then((() => {
2092 closeRidIfNecessary("string" == typeof e, s), i();
2093 })).catch((t => {
2094 closeRidIfNecessary("string" == typeof e, s), i(t);
2095 }));
2096 },
2097 appendFileSync: function appendFileSync(e, t, n) {
2098 let r = -1;
2099 validateEncoding(n), e = e instanceof URL ? fromFileUrl(e) : e;
2100 try {
2101 if ("number" == typeof e) r = e; else {
2102 const t = isFileOptions(n) ? n.mode : void 0, i = isFileOptions(n) ? n.flag : void 0;
2103 t && notImplemented("Deno does not yet support setting mode on create"), r = Deno.openSync(e, getOpenOptions(i)).rid;
2104 }
2105 const i = (new TextEncoder).encode(t);
2106 Deno.writeSync(r, i);
2107 } finally {
2108 closeRidIfNecessary("string" == typeof e, r);
2109 }
2110 },
2111 chmod: function chmod(e, t, n) {
2112 e = e instanceof URL ? fromFileUrl(e) : e, Deno.chmod(e, getResolvedMode(t)).then((() => n())).catch(n);
2113 },
2114 chmodSync: function chmodSync(e, t) {
2115 e = e instanceof URL ? fromFileUrl(e) : e, Deno.chmodSync(e, getResolvedMode(t));
2116 },
2117 chown: function chown(e, t, n, r) {
2118 e = e instanceof URL ? fromFileUrl(e) : e, Deno.chown(e, t, n).then((() => r())).catch(r);
2119 },
2120 chownSync: function chownSync(e, t, n) {
2121 e = e instanceof URL ? fromFileUrl(e) : e, Deno.chownSync(e, t, n);
2122 },
2123 close: function close(e, t) {
2124 queueMicrotask((() => {
2125 try {
2126 Deno.close(e), t(null);
2127 } catch (e) {
2128 t(e);
2129 }
2130 }));
2131 },
2132 closeSync: function closeSync(e) {
2133 Deno.close(e);
2134 },
2135 constants: {
2136 __proto__: null,
2137 F_OK: 0,
2138 R_OK: 4,
2139 W_OK: 2,
2140 X_OK: 1,
2141 S_IRUSR: 256,
2142 S_IWUSR: 128,
2143 S_IXUSR: 64,
2144 S_IRGRP: 32,
2145 S_IWGRP: 16,
2146 S_IXGRP: 8,
2147 S_IROTH: 4,
2148 S_IWOTH: 2,
2149 S_IXOTH: 1
2150 },
2151 copyFile: function copyFile(e, t, n) {
2152 e = e instanceof URL ? fromFileUrl(e) : e, Deno.copyFile(e, t).then((() => n())).catch(n);
2153 },
2154 copyFileSync: function copyFileSync(e, t) {
2155 e = e instanceof URL ? fromFileUrl(e) : e, Deno.copyFileSync(e, t);
2156 },
2157 exists: function exists(e, t) {
2158 e = e instanceof URL ? fromFileUrl(e) : e, Deno.lstat(e).then((() => {
2159 t(!0);
2160 })).catch((() => t(!1)));
2161 },
2162 existsSync: function existsSync(e) {
2163 e = e instanceof URL ? fromFileUrl(e) : e;
2164 try {
2165 return Deno.lstatSync(e), !0;
2166 } catch (e) {
2167 if (e instanceof Deno.errors.NotFound) return !1;
2168 throw e;
2169 }
2170 },
2171 readFile: readFile$1,
2172 readFileSync: function readFileSync(e, t) {
2173 e = e instanceof URL ? fromFileUrl(e) : e;
2174 const n = Deno.readFileSync(e), r = getEncoding$1(t);
2175 return maybeDecode(n, r);
2176 },
2177 readlink: function readlink(e, t, n) {
2178 let r;
2179 e = e instanceof URL ? fromFileUrl(e) : e, r = "function" == typeof t ? t : n;
2180 const i = getEncoding(t);
2181 !function o(e, t, n, ...r) {
2182 e(...r).then((e => n && n(null, t(e)))).catch((e => n && n(e, null)));
2183 }(Deno.readLink, (e => maybeEncode(e, i)), r, e);
2184 },
2185 readlinkSync: function readlinkSync(e, t) {
2186 return e = e instanceof URL ? fromFileUrl(e) : e, maybeEncode(Deno.readLinkSync(e), getEncoding(t));
2187 },
2188 mkdir: function mkdir(e, t, n) {
2189 e = e instanceof URL ? fromFileUrl(e) : e;
2190 let r = 511, i = !1;
2191 if ("function" == typeof t ? n = t : "number" == typeof t ? r = t : "boolean" == typeof t ? i = t : t && (void 0 !== t.recursive && (i = t.recursive),
2192 void 0 !== t.mode && (r = t.mode)), "boolean" != typeof i) throw new Deno.errors.InvalidData("invalid recursive option , must be a boolean");
2193 Deno.mkdir(e, {
2194 recursive: i,
2195 mode: r
2196 }).then((() => {
2197 "function" == typeof n && n();
2198 })).catch((e => {
2199 "function" == typeof n && n(e);
2200 }));
2201 },
2202 mkdirSync: function mkdirSync(e, t) {
2203 e = e instanceof URL ? fromFileUrl(e) : e;
2204 let n = 511, r = !1;
2205 if ("number" == typeof t ? n = t : "boolean" == typeof t ? r = t : t && (void 0 !== t.recursive && (r = t.recursive),
2206 void 0 !== t.mode && (n = t.mode)), "boolean" != typeof r) throw new Deno.errors.InvalidData("invalid recursive option , must be a boolean");
2207 Deno.mkdirSync(e, {
2208 recursive: r,
2209 mode: n
2210 });
2211 },
2212 writeFile: writeFile$1,
2213 writeFileSync: function writeFileSync(e, t, n) {
2214 e = e instanceof URL ? fromFileUrl(e) : e;
2215 const r = isFileOptions(n) ? n.flag : void 0, i = isFileOptions(n) ? n.mode : void 0, o = checkEncoding(getEncoding$1(n)) || "utf8", s = getOpenOptions(r || "w");
2216 "string" == typeof t && (t = Buffer.from(t, o));
2217 const a = "number" == typeof e;
2218 let l, c = null;
2219 try {
2220 l = a ? new Deno.File(e) : Deno.openSync(e, s), !a && i && ("windows" === Deno.build.os && notImplemented('"mode" on Windows'),
2221 Deno.chmodSync(e, i)), Deno.writeAllSync(l, t);
2222 } catch (e) {
2223 c = e;
2224 } finally {
2225 if (!a && l && l.close(), c) throw c;
2226 }
2227 },
2228 promises: mod
2229}, process = {
2230 arch: Deno.build.arch,
2231 chdir: Deno.chdir,
2232 cwd: Deno.cwd,
2233 exit: Deno.exit,
2234 pid: Deno.pid,
2235 platform: "windows" === Deno.build.os ? "win32" : Deno.build.os,
2236 version: "v12.0.0",
2237 versions: {
2238 node: "v12.0.0",
2239 ...Deno.version
2240 },
2241 on() {},
2242 env: {},
2243 argv: [ "deno", ...Deno.args ]
2244}, SEE_GITHUB_ISSUE = "See https://github.com/denoland/deno/issues/3802";
2245
2246arch[Symbol.toPrimitive] = () => arch(), endianness[Symbol.toPrimitive] = () => endianness(),
2247freemem[Symbol.toPrimitive] = () => freemem(), homedir[Symbol.toPrimitive] = () => homedir(),
2248hostname[Symbol.toPrimitive] = () => hostname(), platform[Symbol.toPrimitive] = () => platform(),
2249release[Symbol.toPrimitive] = () => release(), totalmem[Symbol.toPrimitive] = () => totalmem(),
2250type[Symbol.toPrimitive] = () => type(), uptime[Symbol.toPrimitive] = () => uptime();
2251
2252const nodeOs = {
2253 __proto__: null,
2254 arch,
2255 cpus: function cpus() {
2256 notImplemented(SEE_GITHUB_ISSUE);
2257 },
2258 endianness,
2259 freemem,
2260 getPriority: function getPriority(e = 0) {
2261 validateIntegerRange(e, "pid"), notImplemented(SEE_GITHUB_ISSUE);
2262 },
2263 homedir,
2264 hostname,
2265 loadavg: function loadavg() {
2266 return "windows" === Deno.build.os ? [ 0, 0, 0 ] : Deno.loadavg();
2267 },
2268 networkInterfaces: function networkInterfaces() {
2269 notImplemented(SEE_GITHUB_ISSUE);
2270 },
2271 platform,
2272 release,
2273 setPriority: function setPriority(e, t) {
2274 void 0 === t && (t = e, e = 0), validateIntegerRange(e, "pid"), validateIntegerRange(t, "priority", -20, 19),
2275 notImplemented(SEE_GITHUB_ISSUE);
2276 },
2277 tmpdir: function tmpdir() {
2278 notImplemented(SEE_GITHUB_ISSUE);
2279 },
2280 totalmem,
2281 type,
2282 uptime,
2283 userInfo: function userInfo(e = {
2284 encoding: "utf-8"
2285 }) {
2286 notImplemented(SEE_GITHUB_ISSUE);
2287 },
2288 constants: {
2289 dlopen: {},
2290 errno: {},
2291 signals: Deno.Signal,
2292 priority: {}
2293 },
2294 EOL: "windows" == Deno.build.os ? EOL$1.CRLF : EOL$1.LF
2295}, nodeTimers = {
2296 __proto__: null,
2297 setTimeout: window.setTimeout,
2298 clearTimeout: window.clearTimeout,
2299 setInterval: window.setInterval,
2300 clearInterval: window.clearInterval,
2301 setImmediate: (e, ...t) => window.setTimeout(e, 0, ...t),
2302 clearImmediate: window.clearTimeout
2303}, hexTable = new Array(256);
2304
2305for (let e = 0; e < 256; ++e) hexTable[e] = "%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase();
2306
2307const unescape = decodeURIComponent, escape = encodeURIComponent, nodeQueryString = {
2308 __proto__: null,
2309 hexTable,
2310 parse,
2311 encodeStr: function encodeStr(e, t, n) {
2312 const r = e.length;
2313 if (0 === r) return "";
2314 let i = "", o = 0;
2315 for (let s = 0; s < r; s++) {
2316 let a = e.charCodeAt(s);
2317 if (a < 128) {
2318 if (1 === t[a]) continue;
2319 o < s && (i += e.slice(o, s)), o = s + 1, i += n[a];
2320 } else if (o < s && (i += e.slice(o, s)), a < 2048) o = s + 1, i += n[192 | a >> 6] + n[128 | 63 & a]; else if (a < 55296 || a >= 57344) o = s + 1,
2321 i += n[224 | a >> 12] + n[128 | a >> 6 & 63] + n[128 | 63 & a]; else {
2322 if (++s, s >= r) throw new Deno.errors.InvalidData("invalid URI");
2323 o = s + 1, a = 65536 + ((1023 & a) << 10 | 1023 & e.charCodeAt(s)), i += n[240 | a >> 18] + n[128 | a >> 12 & 63] + n[128 | a >> 6 & 63] + n[128 | 63 & a];
2324 }
2325 }
2326 return 0 === o ? e : o < r ? i + e.slice(o) : i;
2327 },
2328 stringify,
2329 decode: parse,
2330 encode: stringify,
2331 unescape,
2332 escape
2333};
2334
2335!function(e) {
2336 e[e.ascii = 0] = "ascii", e[e.latin1 = 1] = "latin1", e[e.utf16le = 2] = "utf16le";
2337}(NotImplemented || (NotImplemented = {}));
2338
2339class StringDecoderBase {
2340 constructor(e, t) {
2341 this.encoding = e, this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Buffer.allocUnsafe(t);
2342 }
2343}
2344
2345class Base64Decoder extends StringDecoderBase {
2346 constructor(e) {
2347 super(normalizeEncoding(e), 3), this.end = base64End, this.fillLast = utf8FillLastIncomplete,
2348 this.text = base64Text, this.write = utf8Write;
2349 }
2350}
2351
2352class GenericDecoder extends StringDecoderBase {
2353 constructor(e) {
2354 super(normalizeEncoding(e), 4), this.end = simpleEnd, this.fillLast = void 0, this.text = utf8Text,
2355 this.write = simpleWrite;
2356 }
2357}
2358
2359class Utf8Decoder extends StringDecoderBase {
2360 constructor(e) {
2361 super(normalizeEncoding(e), 4), this.end = utf8End, this.fillLast = utf8FillLastComplete,
2362 this.text = utf8Text, this.write = utf8Write;
2363 }
2364}
2365
2366const nodeStringDecoder = {
2367 __proto__: null,
2368 StringDecoder: class StringDecoder {
2369 constructor(e) {
2370 let t;
2371 switch (e) {
2372 case "utf8":
2373 t = new Utf8Decoder(e);
2374 break;
2375
2376 case "base64":
2377 t = new Base64Decoder(e);
2378 break;
2379
2380 default:
2381 t = new GenericDecoder(e);
2382 }
2383 this.encoding = t.encoding, this.end = t.end, this.fillLast = t.fillLast, this.lastChar = t.lastChar,
2384 this.lastNeed = t.lastNeed, this.lastTotal = t.lastTotal, this.text = t.text, this.write = t.write;
2385 }
2386 }
2387}, isWindows$1 = "windows" === Deno.build.os, forwardSlashRegEx = /\//g, percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, CHAR_FORWARD_SLASH = "/".charCodeAt(0), CHAR_BACKWARD_SLASH = "\\".charCodeAt(0), CHAR_COLON = ":".charCodeAt(0), isWindows = "windows" == Deno.build.os, relativeResolveCache = Object.create(null);
2388
2389let requireDepth = 0, statCache = null;
2390
2391class Module {
2392 constructor(e = "", t) {
2393 this.id = e, this.exports = {}, this.parent = t || null, updateChildren(t || null, this, !1),
2394 this.filename = null, this.loaded = !1, this.children = [], this.paths = [], this.path = dirname(e);
2395 }
2396 require(e) {
2397 if ("" === e) throw new Error(`id '${e}' must be a non-empty string`);
2398 requireDepth++;
2399 try {
2400 return Module._load(e, this, !1);
2401 } finally {
2402 requireDepth--;
2403 }
2404 }
2405 load(e) {
2406 assert(!this.loaded), this.filename = e, this.paths = Module._nodeModulePaths(dirname(e));
2407 const t = function n(e) {
2408 const t = basename(e);
2409 let n, r, i = 0;
2410 for (;-1 !== (r = t.indexOf(".", i)); ) if (i = r + 1, 0 !== r && (n = t.slice(r),
2411 Module._extensions[n])) return n;
2412 return ".js";
2413 }(e);
2414 Module._extensions[t](this, e), this.loaded = !0;
2415 }
2416 _compile(e, t) {
2417 const n = function r(e, t) {
2418 const n = Module.wrap(t), [r, i] = Deno.core.evalContext(n, e);
2419 if (i) throw i;
2420 return r;
2421 }(t, e), i = dirname(t), o = makeRequireFunction(this), s = this.exports, a = s;
2422 0 === requireDepth && (statCache = new Map);
2423 const l = n.call(a, s, o, this, t, i);
2424 return 0 === requireDepth && (statCache = null), l;
2425 }
2426 static _resolveLookupPaths(e, t) {
2427 if ("." !== e.charAt(0) || e.length > 1 && "." !== e.charAt(1) && "/" !== e.charAt(1) && (!isWindows || "\\" !== e.charAt(1))) {
2428 let e = modulePaths;
2429 return null !== t && t.paths && t.paths.length && (e = t.paths.concat(e)), e.length > 0 ? e : null;
2430 }
2431 return t && t.id && t.filename ? [ dirname(t.filename) ] : [ "." ].concat(Module._nodeModulePaths("."), modulePaths);
2432 }
2433 static _resolveFilename(e, t, n, r) {
2434 if (function i(e) {
2435 return nativeModulePolyfill.has(e);
2436 }(e)) return e;
2437 let o;
2438 if ("object" == typeof r && null !== r) if (Array.isArray(r.paths)) if (e.startsWith("./") || e.startsWith("../") || isWindows && e.startsWith(".\\") || e.startsWith("..\\")) o = r.paths; else {
2439 const t = new Module("", null);
2440 o = [];
2441 for (let n = 0; n < r.paths.length; n++) {
2442 const i = r.paths[n];
2443 t.paths = Module._nodeModulePaths(i);
2444 const s = Module._resolveLookupPaths(e, t);
2445 for (let e = 0; e < s.length; e++) o.includes(s[e]) || o.push(s[e]);
2446 }
2447 } else {
2448 if (void 0 !== r.paths) throw new Error("options.paths is invalid");
2449 o = Module._resolveLookupPaths(e, t);
2450 } else o = Module._resolveLookupPaths(e, t);
2451 const s = Module._findPath(e, o, n);
2452 if (!s) {
2453 const n = [];
2454 for (let e = t; e; e = e.parent) n.push(e.filename || e.id);
2455 let r = `Cannot find module '${e}'`;
2456 n.length > 0 && (r = r + "\nRequire stack:\n- " + n.join("\n- "));
2457 const i = new Error(r);
2458 throw i.code = "MODULE_NOT_FOUND", i.requireStack = n, i;
2459 }
2460 return s;
2461 }
2462 static _findPath(e, t, n) {
2463 const r = isAbsolute(e);
2464 if (r) t = [ "" ]; else if (!t || 0 === t.length) return !1;
2465 const i = e + "\0" + (1 === t.length ? t[0] : t.join("\0")), o = Module._pathCache[i];
2466 if (o) return o;
2467 let s, a = e.length > 0 && e.charCodeAt(e.length - 1) === CHAR_FORWARD_SLASH;
2468 a || (a = /(?:^|\/)\.?\.$/.test(e));
2469 for (let n = 0; n < t.length; n++) {
2470 const o = t[n];
2471 if (o && stat(o) < 1) continue;
2472 const l = resolveExports(o, e, r);
2473 let c;
2474 const u = stat(l);
2475 if (a || (0 === u && (c = toRealPath(l)), c || (void 0 === s && (s = Object.keys(Module._extensions)),
2476 c = tryExtensions(l, s))), c || 1 !== u || (void 0 === s && (s = Object.keys(Module._extensions)),
2477 c = tryPackage(l, s)), c) return Module._pathCache[i] = c, c;
2478 }
2479 return !1;
2480 }
2481 static _load(e, t, n) {
2482 let r;
2483 if (t) {
2484 r = `${t.path}\0${e}`;
2485 const n = relativeResolveCache[r];
2486 if (void 0 !== n) {
2487 const e = Module._cache[n];
2488 if (void 0 !== e) return updateChildren(t, e, !0), e.loaded ? e.exports : getExportsForCircularRequire(e);
2489 delete relativeResolveCache[r];
2490 }
2491 }
2492 const i = Module._resolveFilename(e, t, n), o = Module._cache[i];
2493 if (void 0 !== o) return updateChildren(t, o, !0), o.loaded ? o.exports : getExportsForCircularRequire(o);
2494 const s = function a(e, t) {
2495 return nativeModulePolyfill.get(t);
2496 }(0, e);
2497 if (s) return s.exports;
2498 const l = new Module(i, t);
2499 n && (l.id = "."), Module._cache[i] = l, void 0 !== t && (assert(r), relativeResolveCache[r] = i);
2500 let c = !0;
2501 try {
2502 l.load(i), c = !1;
2503 } finally {
2504 c ? (delete Module._cache[i], void 0 !== t && (assert(r), delete relativeResolveCache[r])) : l.exports && Object.getPrototypeOf(l.exports) === CircularRequirePrototypeWarningProxy && Object.setPrototypeOf(l.exports, PublicObjectPrototype);
2505 }
2506 return l.exports;
2507 }
2508 static wrap(e) {
2509 return `${Module.wrapper[0]}${e}${Module.wrapper[1]}`;
2510 }
2511 static _nodeModulePaths(e) {
2512 if (isWindows) {
2513 if ((e = resolve(e)).charCodeAt(e.length - 1) === CHAR_BACKWARD_SLASH && e.charCodeAt(e.length - 2) === CHAR_COLON) return [ e + "node_modules" ];
2514 const t = [];
2515 for (let n = e.length - 1, r = 0, i = e.length; n >= 0; --n) {
2516 const o = e.charCodeAt(n);
2517 o === CHAR_BACKWARD_SLASH || o === CHAR_FORWARD_SLASH || o === CHAR_COLON ? (r !== nmLen && t.push(e.slice(0, i) + "\\node_modules"),
2518 i = n, r = 0) : -1 !== r && (nmChars[r] === o ? ++r : r = -1);
2519 }
2520 return t;
2521 }
2522 {
2523 if ("/" === (e = resolve(e))) return [ "/node_modules" ];
2524 const t = [];
2525 for (let n = e.length - 1, r = 0, i = e.length; n >= 0; --n) {
2526 const o = e.charCodeAt(n);
2527 o === CHAR_FORWARD_SLASH ? (r !== nmLen && t.push(e.slice(0, i) + "/node_modules"),
2528 i = n, r = 0) : -1 !== r && (nmChars[r] === o ? ++r : r = -1);
2529 }
2530 return t.push("/node_modules"), t;
2531 }
2532 }
2533 static createRequire(e) {
2534 let t;
2535 if (e instanceof URL || "string" == typeof e && !isAbsolute(e)) t = fileURLToPath(e); else {
2536 if ("string" != typeof e) throw new Error("filename should be a string");
2537 t = e;
2538 }
2539 return function n(e) {
2540 const t = e.endsWith("/") || isWindows && e.endsWith("\\") ? join(e, "noop.js") : e, n = new Module(t);
2541 return n.filename = t, n.paths = Module._nodeModulePaths(n.path), makeRequireFunction(n);
2542 }(t);
2543 }
2544 static _initPaths() {
2545 const e = Deno.env.get("HOME"), t = Deno.env.get("NODE_PATH");
2546 let n = [];
2547 e && (n.unshift(resolve(e, ".node_libraries")), n.unshift(resolve(e, ".node_modules"))),
2548 t && (n = t.split(delimiter).filter((function e(t) {
2549 return !!t;
2550 })).concat(n)), modulePaths = n, Module.globalPaths = modulePaths.slice(0);
2551 }
2552 static _preloadModules(e) {
2553 if (!Array.isArray(e)) return;
2554 const t = new Module("internal/preload", null);
2555 try {
2556 t.paths = Module._nodeModulePaths(Deno.cwd());
2557 } catch (e) {
2558 if ("ENOENT" !== e.code) throw e;
2559 }
2560 for (let n = 0; n < e.length; n++) t.require(e[n]);
2561 }
2562}
2563
2564Module.builtinModules = [], Module._extensions = Object.create(null), Module._cache = Object.create(null),
2565Module._pathCache = Object.create(null), Module.globalPaths = [], Module.wrapper = [ "(function (exports, require, module, __filename, __dirname) { ", "\n});" ];
2566
2567const nativeModulePolyfill = new Map;
2568
2569nativeModulePolyfill.set("buffer", createNativeModule("buffer", nodeBuffer)), nativeModulePolyfill.set("events", createNativeModule("events", nodeEvents)),
2570nativeModulePolyfill.set("fs", createNativeModule("fs", nodeFs)), nativeModulePolyfill.set("os", createNativeModule("os", nodeOs)),
2571nativeModulePolyfill.set("path", createNativeModule("path", nodePath)), nativeModulePolyfill.set("querystring", createNativeModule("querystring", nodeQueryString)),
2572nativeModulePolyfill.set("string_decoder", createNativeModule("string_decoder", nodeStringDecoder)),
2573nativeModulePolyfill.set("timers", createNativeModule("timers", nodeTimers)), nativeModulePolyfill.set("util", createNativeModule("util", nodeUtil));
2574
2575for (const e of nativeModulePolyfill.keys()) Module.builtinModules.push(e);
2576
2577let modulePaths = [];
2578
2579const packageJsonCache = new Map, EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/, nmChars = [ 115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110 ], nmLen = nmChars.length, CircularRequirePrototypeWarningProxy = new Proxy({}, {
2580 get(e, t) {
2581 if (t in e) return e[t];
2582 emitCircularRequireWarning(t);
2583 },
2584 getOwnPropertyDescriptor(e, t) {
2585 if (Object.prototype.hasOwnProperty.call(e, t)) return Object.getOwnPropertyDescriptor(e, t);
2586 emitCircularRequireWarning(t);
2587 }
2588}), PublicObjectPrototype = window.Object.prototype;
2589
2590Module._extensions[".js"] = (e, t) => {
2591 if (t.endsWith(".js")) {
2592 const e = function n(e) {
2593 const t = e.indexOf(sep);
2594 let n;
2595 for (;(n = e.lastIndexOf(sep)) > t; ) {
2596 if ((e = e.slice(0, n)).endsWith(sep + "node_modules")) return !1;
2597 const t = readPackage(e);
2598 if (t) return {
2599 path: e,
2600 data: t
2601 };
2602 }
2603 return !1;
2604 }(t);
2605 if (!1 !== e && e.data && "module" === e.data.type) throw new Error("Importing ESM module");
2606 }
2607 const r = (new TextDecoder).decode(Deno.readFileSync(t));
2608 e._compile(r, t);
2609}, Module._extensions[".json"] = (e, t) => {
2610 const n = (new TextDecoder).decode(Deno.readFileSync(t));
2611 try {
2612 e.exports = JSON.parse(function r(e) {
2613 return 65279 === e.charCodeAt(0) && (e = e.slice(1)), e;
2614 }(n));
2615 } catch (e) {
2616 throw e.message = t + ": " + e.message, e;
2617 }
2618};
2619
2620const createRequire = Module.createRequire;
2621
2622Object.assign(nodeFs, {
2623 stat: (...e) => {
2624 const t = e[0], n = e.length > 2 ? e[2] : e[1];
2625 try {
2626 const e = Deno.statSync(t);
2627 n && n(null, {
2628 isFile: () => e.isFile,
2629 isDirectory: () => e.isDirectory,
2630 isSymbolicLink: () => e.isSymlink,
2631 size: e.size
2632 });
2633 } catch (e) {
2634 n && n(e);
2635 }
2636 },
2637 statSync: e => {
2638 const t = Deno.statSync(e);
2639 return {
2640 isFile: () => t.isFile,
2641 isDirectory: () => t.isDirectory,
2642 isSymbolicLink: () => t.isSymlink,
2643 size: t.size
2644 };
2645 }
2646});
2647
2648const applyNodeCompat = e => {
2649 globalThis.process = process;
2650 const t = createRequire(join(e.fromDir, "noop.js"));
2651 globalThis.require = t;
2652};
2653
2654export { applyNodeCompat };
\No newline at end of file