@prozilla-os/shared 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/main.d.ts +819 -34
- package/dist/main.js +1000 -85
- package/dist/main.js.map +1 -1
- package/package.json +11 -9
package/dist/main.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var M = (t, n, e) => n in t ? g(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
6
|
-
var d = (t, n, e) => M(t, typeof n != "symbol" ? n + "" : n, e), y = (t, n, e) => n.has(t) || m("Cannot " + e);
|
|
7
|
-
var i = (t, n, e) => (y(t, n, "read from private field"), e ? e.call(t) : n.get(t)), x = (t, n, e) => n.has(t) ? m("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(t) : n.set(t, e);
|
|
8
|
-
const A = {
|
|
1
|
+
const a = {
|
|
2
|
+
/**
|
|
3
|
+
* Foreground colors.
|
|
4
|
+
*/
|
|
9
5
|
fg: {
|
|
10
6
|
black: "\x1B[30m",
|
|
11
7
|
red: "\x1B[31m",
|
|
@@ -16,24 +12,116 @@ const A = {
|
|
|
16
12
|
cyan: "\x1B[36m",
|
|
17
13
|
white: "\x1B[37m"
|
|
18
14
|
},
|
|
19
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Background colors.
|
|
17
|
+
*/
|
|
18
|
+
bg: {
|
|
19
|
+
black: "\x1B[40m",
|
|
20
|
+
red: "\x1B[41m",
|
|
21
|
+
green: "\x1B[42m",
|
|
22
|
+
yellow: "\x1B[43m",
|
|
23
|
+
blue: "\x1B[44m",
|
|
24
|
+
magenta: "\x1B[45m",
|
|
25
|
+
cyan: "\x1B[46m",
|
|
26
|
+
white: "\x1B[47m"
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Screen buffer and clearing controls.
|
|
30
|
+
*/
|
|
31
|
+
screen: {
|
|
32
|
+
enterAltBuffer: "\x1B[?1049h",
|
|
33
|
+
exitAltBuffer: "\x1B[?1049l",
|
|
34
|
+
clear: "\x1B[2J",
|
|
35
|
+
clearLine: "\x1B[2K",
|
|
36
|
+
home: "\x1B[H"
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Cursor controls.
|
|
40
|
+
*/
|
|
41
|
+
cursor: {
|
|
42
|
+
/** Changes the position of the cursor. */
|
|
43
|
+
position: (e, t) => `\x1B[${e};${t}H`,
|
|
44
|
+
hide: "\x1B[?25l",
|
|
45
|
+
show: "\x1B[?25h",
|
|
46
|
+
save: "\x1B[s",
|
|
47
|
+
restore: "\x1B[u"
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Terminal input.
|
|
51
|
+
*/
|
|
52
|
+
input: {
|
|
53
|
+
/** Move cursor up. */
|
|
54
|
+
arrowUp: "\x1B[A",
|
|
55
|
+
/** Move cursor down. */
|
|
56
|
+
arrowDown: "\x1B[B",
|
|
57
|
+
/** Move cursor right. */
|
|
58
|
+
arrowRight: "\x1B[C",
|
|
59
|
+
/** Move cursor left. */
|
|
60
|
+
arrowLeft: "\x1B[D",
|
|
61
|
+
horizontalTab: " ",
|
|
62
|
+
lineFeed: `
|
|
63
|
+
`,
|
|
64
|
+
verticalTab: "\v",
|
|
65
|
+
formFeed: "\f",
|
|
66
|
+
carriageReturn: "\r",
|
|
67
|
+
backspace: "\b",
|
|
68
|
+
delete: "",
|
|
69
|
+
escape: "\x1B",
|
|
70
|
+
pageUp: "\x1B[5~",
|
|
71
|
+
pageDown: "\x1B[6~",
|
|
72
|
+
ctrlA: "",
|
|
73
|
+
ctrlB: "",
|
|
74
|
+
ctrlC: "",
|
|
75
|
+
ctrlD: "",
|
|
76
|
+
ctrlE: "",
|
|
77
|
+
ctrlF: "",
|
|
78
|
+
ctrlG: "\x07",
|
|
79
|
+
ctrlH: "\b",
|
|
80
|
+
ctrlI: " ",
|
|
81
|
+
ctrlJ: `
|
|
82
|
+
`,
|
|
83
|
+
ctrlK: "\v",
|
|
84
|
+
ctrlL: "\f",
|
|
85
|
+
ctrlM: "\r",
|
|
86
|
+
ctrlN: "",
|
|
87
|
+
ctrlO: "",
|
|
88
|
+
ctrlP: "",
|
|
89
|
+
ctrlQ: "",
|
|
90
|
+
ctrlR: "",
|
|
91
|
+
ctrlS: "",
|
|
92
|
+
ctrlT: "",
|
|
93
|
+
ctrlU: "",
|
|
94
|
+
ctrlV: "",
|
|
95
|
+
ctrlW: "",
|
|
96
|
+
ctrlX: "",
|
|
97
|
+
ctrlY: "",
|
|
98
|
+
ctrlZ: ""
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Decorations.
|
|
102
|
+
*/
|
|
20
103
|
decoration: {
|
|
21
104
|
dim: "\x1B[2m",
|
|
22
|
-
bold: "\x1B[1m"
|
|
105
|
+
bold: "\x1B[1m",
|
|
106
|
+
italic: "\x1B[3m",
|
|
107
|
+
underline: "\x1B[4m",
|
|
108
|
+
blink: "\x1B[5m",
|
|
109
|
+
invert: "\x1B[7m",
|
|
110
|
+
strike: "\x1B[9m"
|
|
23
111
|
},
|
|
24
112
|
reset: "\x1B[0m"
|
|
25
113
|
};
|
|
26
|
-
function E(
|
|
27
|
-
const
|
|
28
|
-
|
|
114
|
+
function E(e, t) {
|
|
115
|
+
const r = t.indexOf(e);
|
|
116
|
+
r !== -1 && t.splice(r, 1);
|
|
29
117
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
118
|
+
function Y(e) {
|
|
119
|
+
return e[Math.floor(Math.random() * e.length)];
|
|
32
120
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
121
|
+
function Z(e) {
|
|
122
|
+
return e.filter((t, r) => e.indexOf(t) === r);
|
|
35
123
|
}
|
|
36
|
-
const
|
|
124
|
+
const w = {
|
|
37
125
|
s: 1e3,
|
|
38
126
|
m: 1e3 * 60,
|
|
39
127
|
h: 1e3 * 60 * 60,
|
|
@@ -43,97 +131,924 @@ const p = {
|
|
|
43
131
|
y: 1e3 * 60 * 60 * 24 * 365,
|
|
44
132
|
c: 1e3 * 60 * 60 * 24 * 365 * 100
|
|
45
133
|
};
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
return
|
|
50
|
-
let
|
|
51
|
-
return
|
|
134
|
+
function S(e, t = 3, r = !1) {
|
|
135
|
+
const n = [], u = (l, g) => {
|
|
136
|
+
if (!r)
|
|
137
|
+
return l.join(", ");
|
|
138
|
+
let m = "", b = "";
|
|
139
|
+
return g ? b = "ago" : m = "in", [m, l.join(", "), b].join(" ").trim();
|
|
52
140
|
};
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
55
|
-
return
|
|
56
|
-
const
|
|
57
|
-
s: "
|
|
58
|
-
m: "
|
|
59
|
-
h: "
|
|
60
|
-
d: "
|
|
61
|
-
n: "
|
|
62
|
-
y: "
|
|
141
|
+
let h = !1;
|
|
142
|
+
if (e < 0 && (e = -e, h = !0), Math.abs(e) < w.s)
|
|
143
|
+
return u(["less than a second"], h);
|
|
144
|
+
const p = [], y = {
|
|
145
|
+
s: "second",
|
|
146
|
+
m: "minute",
|
|
147
|
+
h: "hour",
|
|
148
|
+
d: "day",
|
|
149
|
+
n: "month",
|
|
150
|
+
y: "year"
|
|
63
151
|
};
|
|
64
|
-
for (const [
|
|
65
|
-
if (
|
|
152
|
+
for (const [l, g] of Object.entries(w).reverse()) {
|
|
153
|
+
if (l === "w" || l === "c")
|
|
66
154
|
continue;
|
|
67
|
-
const
|
|
68
|
-
|
|
155
|
+
const m = Math.floor(e / g);
|
|
156
|
+
e -= m * g, m > 0 && p.push({ amount: m, label: m != 1 ? y[l] + "s" : y[l] });
|
|
157
|
+
}
|
|
158
|
+
for (let l = 0; l < t; l++)
|
|
159
|
+
if (l < p.length) {
|
|
160
|
+
const g = p[l];
|
|
161
|
+
n.push(`${g.amount} ${g.label}`);
|
|
162
|
+
}
|
|
163
|
+
return n.length === 0 ? u(["less than a second"], h) : u(n, h);
|
|
164
|
+
}
|
|
165
|
+
function J(e, t = 3, r = !1) {
|
|
166
|
+
const n = e.valueOf() - Date.now();
|
|
167
|
+
return S(n, t, r);
|
|
168
|
+
}
|
|
169
|
+
class K {
|
|
170
|
+
#t = {};
|
|
171
|
+
/**
|
|
172
|
+
* Starts listening to an event.
|
|
173
|
+
* @param event - The event to listen to.
|
|
174
|
+
* @param listener - The function to call when the event is emitted.
|
|
175
|
+
* @returns The listener.
|
|
176
|
+
*/
|
|
177
|
+
on(t, r) {
|
|
178
|
+
return this.#t[t] === void 0 ? this.#t[t] = [r] : this.#t[t].push(r), r;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Registers an event listener that is automatically removed when called.
|
|
182
|
+
* @param event - The event to listen to.
|
|
183
|
+
* @param listener - The function to call once the event is emitted.
|
|
184
|
+
* @returns The wrapped listener.
|
|
185
|
+
*/
|
|
186
|
+
once(t, r) {
|
|
187
|
+
const n = (...u) => (this.off(t, n), r(...u));
|
|
188
|
+
return this.on(t, n);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Removes an event listener.
|
|
192
|
+
* @param event - The event to remove the listener from.
|
|
193
|
+
* @param listener - The listener to remove.
|
|
194
|
+
*/
|
|
195
|
+
off(t, r) {
|
|
196
|
+
const n = this.#t[t];
|
|
197
|
+
n !== void 0 && E(r, n);
|
|
69
198
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Emits an event to all its listeners.
|
|
201
|
+
* @param event - The event to emit.
|
|
202
|
+
* @param args - The arguments to pass to the listeners.
|
|
203
|
+
*/
|
|
204
|
+
emit(t, ...r) {
|
|
205
|
+
const n = this.#t[t];
|
|
206
|
+
if (n !== void 0)
|
|
207
|
+
for (const u of n)
|
|
208
|
+
u(...r);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Emits an event and waits for all listeners to resolve.
|
|
212
|
+
* @param event - The event to emit.
|
|
213
|
+
* @param args - The arguments to pass to the listeners.
|
|
214
|
+
*/
|
|
215
|
+
async emitAsync(t, ...r) {
|
|
216
|
+
const n = this.#t[t];
|
|
217
|
+
if (n === void 0)
|
|
218
|
+
return;
|
|
219
|
+
const u = n.map((h) => h(...r));
|
|
220
|
+
await Promise.all(u);
|
|
73
221
|
}
|
|
74
|
-
return s.length === 0 ? a(["less than a second"], c) : a(s, c);
|
|
75
222
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
|
|
223
|
+
function G(e, t, r) {
|
|
224
|
+
return e < t ? t : e > r ? r : e;
|
|
225
|
+
}
|
|
226
|
+
function Q(e, t) {
|
|
227
|
+
return Math.random() * (t - e) + e;
|
|
228
|
+
}
|
|
229
|
+
function R(e, t) {
|
|
230
|
+
const r = Math.pow(10, t ?? 0);
|
|
231
|
+
return Math.round(e * r) / r;
|
|
232
|
+
}
|
|
233
|
+
function O(e) {
|
|
234
|
+
return typeof e == "number" ? !0 : e.trim() === "" ? !1 : Number.isInteger(Number(e));
|
|
235
|
+
}
|
|
236
|
+
function C(e) {
|
|
237
|
+
return typeof e == "number" ? !0 : e.trim() === "" ? !1 : !isNaN(Number(e));
|
|
238
|
+
}
|
|
239
|
+
function A(e, t = 0) {
|
|
240
|
+
return e !== void 0 && O(e) ? Number(e) : t;
|
|
241
|
+
}
|
|
242
|
+
function L(e, t = 0) {
|
|
243
|
+
return e !== void 0 && C(e) ? parseFloat(e) : t;
|
|
244
|
+
}
|
|
245
|
+
function _(e) {
|
|
246
|
+
return e.trim().toLowerCase() === "true";
|
|
79
247
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
248
|
+
function tt(e) {
|
|
249
|
+
return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
|
|
250
|
+
}
|
|
251
|
+
function rt(e) {
|
|
252
|
+
if (!e.length) return "";
|
|
253
|
+
let t = e[0];
|
|
254
|
+
for (let r = 1; r < e.length; r++)
|
|
255
|
+
for (; e[r].indexOf(t) !== 0; )
|
|
256
|
+
if (t = t.substring(0, t.length - 1), t === "") return "";
|
|
257
|
+
return t;
|
|
258
|
+
}
|
|
259
|
+
class s {
|
|
260
|
+
/**
|
|
261
|
+
* Makes text black using {@link ANSI.fg.black}.
|
|
262
|
+
*/
|
|
263
|
+
static black(t) {
|
|
264
|
+
return s.#t(t, a.fg.black);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Makes text red using {@link ANSI.fg.red}.
|
|
268
|
+
*/
|
|
269
|
+
static red(t) {
|
|
270
|
+
return s.#t(t, a.fg.red);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Makes text green using {@link ANSI.fg.green}.
|
|
274
|
+
*/
|
|
275
|
+
static green(t) {
|
|
276
|
+
return s.#t(t, a.fg.green);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Makes text yellow using {@link ANSI.fg.yellow}.
|
|
280
|
+
*/
|
|
281
|
+
static yellow(t) {
|
|
282
|
+
return s.#t(t, a.fg.yellow);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Makes text blue using {@link ANSI.fg.blue}.
|
|
286
|
+
*/
|
|
287
|
+
static blue(t) {
|
|
288
|
+
return s.#t(t, a.fg.blue);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Makes text magenta using {@link ANSI.fg.magenta}.
|
|
292
|
+
*/
|
|
293
|
+
static magenta(t) {
|
|
294
|
+
return s.#t(t, a.fg.magenta);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Makes text cyan using {@link ANSI.fg.cyan}.
|
|
298
|
+
*/
|
|
299
|
+
static cyan(t) {
|
|
300
|
+
return s.#t(t, a.fg.cyan);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Makes text white using {@link ANSI.fg.white}.
|
|
304
|
+
*/
|
|
305
|
+
static white(t) {
|
|
306
|
+
return s.#t(t, a.fg.white);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Sets background to black using {@link ANSI.bg.black}.
|
|
310
|
+
*/
|
|
311
|
+
static blackBackground(t) {
|
|
312
|
+
return s.#t(t, a.bg.black);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Sets background to red using {@link ANSI.bg.red}.
|
|
316
|
+
*/
|
|
317
|
+
static redBackground(t) {
|
|
318
|
+
return s.#t(t, a.bg.red);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Sets background to green using {@link ANSI.bg.green}.
|
|
322
|
+
*/
|
|
323
|
+
static greenBackground(t) {
|
|
324
|
+
return s.#t(t, a.bg.green);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Sets background to yellow using {@link ANSI.bg.yellow}.
|
|
328
|
+
*/
|
|
329
|
+
static yellowBackground(t) {
|
|
330
|
+
return s.#t(t, a.bg.yellow);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Sets background to blue using {@link ANSI.bg.blue}.
|
|
334
|
+
*/
|
|
335
|
+
static blueBackground(t) {
|
|
336
|
+
return s.#t(t, a.bg.blue);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Sets background to magenta using {@link ANSI.bg.magenta}.
|
|
340
|
+
*/
|
|
341
|
+
static magentaBackground(t) {
|
|
342
|
+
return s.#t(t, a.bg.magenta);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Sets background to cyan using {@link ANSI.bg.cyan}.
|
|
346
|
+
*/
|
|
347
|
+
static cyanBackground(t) {
|
|
348
|
+
return s.#t(t, a.bg.cyan);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Sets background to white using {@link ANSI.bg.white}.
|
|
352
|
+
*/
|
|
353
|
+
static whiteBackground(t) {
|
|
354
|
+
return s.#t(t, a.bg.white);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Makes text bold using {@link ANSI.decoration.bold}.
|
|
358
|
+
*/
|
|
359
|
+
static bold(t) {
|
|
360
|
+
return s.#t(t, a.decoration.bold);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Makes text dim using {@link ANSI.decoration.dim}.
|
|
364
|
+
*/
|
|
365
|
+
static dim(t) {
|
|
366
|
+
return s.#t(t, a.decoration.dim);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Makes text italic using {@link ANSI.decoration.italic}.
|
|
370
|
+
*/
|
|
371
|
+
static italic(t) {
|
|
372
|
+
return s.#t(t, a.decoration.italic);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Underlines text using {@link ANSI.decoration.underline}.
|
|
376
|
+
*/
|
|
377
|
+
static underline(t) {
|
|
378
|
+
return s.#t(t, a.decoration.underline);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Inverts foreground and background colors using {@link ANSI.decoration.invert}.
|
|
382
|
+
*/
|
|
383
|
+
static invert(t) {
|
|
384
|
+
return s.#t(t, a.decoration.invert);
|
|
84
385
|
}
|
|
85
386
|
/**
|
|
86
|
-
*
|
|
387
|
+
* Makes text strike through using {@link ANSI.decoration.strike}.
|
|
87
388
|
*/
|
|
88
|
-
|
|
89
|
-
return
|
|
389
|
+
static strike(t) {
|
|
390
|
+
return s.#t(t, a.decoration.strike);
|
|
391
|
+
}
|
|
392
|
+
static #t(t, r) {
|
|
393
|
+
return t = t.replaceAll(a.reset, a.reset + r), r + t + a.reset;
|
|
90
394
|
}
|
|
91
395
|
/**
|
|
92
|
-
*
|
|
396
|
+
* Removes all ANSI escape sequences.
|
|
93
397
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(s) => s !== e
|
|
97
|
-
));
|
|
398
|
+
static strip(t) {
|
|
399
|
+
return t.replace(/\u001b\[[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
98
400
|
}
|
|
99
401
|
/**
|
|
100
|
-
*
|
|
402
|
+
* Removes ANSI escape sequences for colors and background colors (SGR).
|
|
101
403
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
s(e);
|
|
105
|
-
});
|
|
404
|
+
static stripColors(t) {
|
|
405
|
+
return t.replace(/\u001b\[[0-9;]*m/g, "");
|
|
106
406
|
}
|
|
107
407
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
408
|
+
var M = /* @__PURE__ */ ((e) => (e[e.Debug = 0] = "Debug", e[e.Info = 1] = "Info", e[e.Success = 2] = "Success", e[e.Warning = 3] = "Warning", e[e.Error = 4] = "Error", e))(M || {});
|
|
409
|
+
class et {
|
|
410
|
+
/**
|
|
411
|
+
* The minimum log level or an array of log levels to enable.
|
|
412
|
+
*
|
|
413
|
+
* `undefined` enables all log levels. An array enables all log levels in that array. A single level enables that log level and the ones above.
|
|
414
|
+
* @default LogLevel.Debug
|
|
415
|
+
*/
|
|
416
|
+
level;
|
|
417
|
+
/**
|
|
418
|
+
* The current level of indentation.
|
|
419
|
+
* @default 0
|
|
420
|
+
*/
|
|
421
|
+
indent = 0;
|
|
422
|
+
/**
|
|
423
|
+
* The string to use for indentation.
|
|
424
|
+
* @default "\t"
|
|
425
|
+
*/
|
|
426
|
+
indentString;
|
|
427
|
+
/**
|
|
428
|
+
* The function to use when highlighting text.
|
|
429
|
+
* @default Ansi.cyan
|
|
430
|
+
* @see {@link Ansi.cyan}
|
|
431
|
+
*/
|
|
432
|
+
highlight = s.cyan;
|
|
433
|
+
/**
|
|
434
|
+
* The function to use when emphasizing text.
|
|
435
|
+
* @default Ansi.bold
|
|
436
|
+
* @see {@link Ansi.bold}
|
|
437
|
+
*/
|
|
438
|
+
emphasize = s.bold;
|
|
439
|
+
/**
|
|
440
|
+
* The prefixes to prepend to logs.
|
|
441
|
+
* @default {
|
|
442
|
+
[LogLevel.Info]: Ansi.cyan("[info]"),
|
|
443
|
+
[LogLevel.Success]: Ansi.green("[success]"),
|
|
444
|
+
[LogLevel.Warning]: Ansi.yellow("[warning]"),
|
|
445
|
+
[LogLevel.Error]: Ansi.red("[error]"),
|
|
446
|
+
}
|
|
447
|
+
*/
|
|
448
|
+
prefix = {};
|
|
449
|
+
#t = 0;
|
|
450
|
+
#r = 0;
|
|
451
|
+
get errorCount() {
|
|
452
|
+
return this.#t;
|
|
453
|
+
}
|
|
454
|
+
set errorCount(t) {
|
|
455
|
+
this.#t = t;
|
|
456
|
+
}
|
|
457
|
+
get warningCount() {
|
|
458
|
+
return this.#r;
|
|
459
|
+
}
|
|
460
|
+
set warningCount(t) {
|
|
461
|
+
this.#r = t;
|
|
462
|
+
}
|
|
463
|
+
constructor(t) {
|
|
464
|
+
this.reset(), t !== void 0 && (Array.isArray(t) || typeof t == "number" ? this.level = t : (t.level !== void 0 && (this.level = t.level), t.prefix && (typeof t.prefix == "string" ? this.prefix.global = t.prefix : this.prefix = {
|
|
465
|
+
...this.prefix,
|
|
466
|
+
...t.prefix
|
|
467
|
+
})));
|
|
468
|
+
}
|
|
469
|
+
// ===== Modifying state =====
|
|
470
|
+
/**
|
|
471
|
+
* Resets all properties to their default values.
|
|
472
|
+
*/
|
|
473
|
+
reset() {
|
|
474
|
+
return this.level = 0, this.indent = 0, this.indentString = " ", this.highlight = s.cyan, this.emphasize = s.bold, this.prefix = {
|
|
475
|
+
1: s.cyan("[info]"),
|
|
476
|
+
2: s.green("[success]"),
|
|
477
|
+
3: s.yellow("[warning]"),
|
|
478
|
+
4: s.red("[error]")
|
|
479
|
+
}, this.#t = 0, this.#r = 0, this;
|
|
480
|
+
}
|
|
481
|
+
indented(t, r = 1, n) {
|
|
482
|
+
return n !== void 0 && !this.isLevelEnabled(n) ? this : (this.indent + r < 0 && (r = -this.indent), this.tab(r), typeof t == "function" ? t() : Array.isArray(t) ? this.lines(t, n) : this.log(t, n), this.shiftTab(r), this);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Increases the level of indentation.
|
|
486
|
+
* @param amount - The amount to increase the level of indentation with.
|
|
487
|
+
*/
|
|
488
|
+
tab(t = 1) {
|
|
489
|
+
return this.indent += t, this.indent < 0 && (this.indent = 0), this;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Decreases the level of indentation.
|
|
493
|
+
* @param amount - The amount to decrease the level of indentation with.
|
|
494
|
+
*/
|
|
495
|
+
shiftTab(t = 1) {
|
|
496
|
+
return this.indent -= t, this.indent < 0 && (this.indent = 0), this;
|
|
497
|
+
}
|
|
498
|
+
setPrefix(t, r) {
|
|
499
|
+
return typeof t == "string" ? this.prefix = {
|
|
500
|
+
global: t
|
|
501
|
+
} : typeof t == "object" ? this.prefix = t : this.prefix[t] = r, this;
|
|
502
|
+
}
|
|
503
|
+
// ===== Logging status messages =====
|
|
504
|
+
/**
|
|
505
|
+
* Logs an info message about a URL being fetched.
|
|
506
|
+
* @param url - The URL being fetched.
|
|
507
|
+
*/
|
|
508
|
+
fetching(t) {
|
|
509
|
+
return this.pending(`Fetching: ${this.highlight(t)}`);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Logs an info message that implies a pending state.
|
|
513
|
+
* @param message - The status message.
|
|
514
|
+
*/
|
|
515
|
+
pending(t) {
|
|
516
|
+
return this.info(s.yellow(t));
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Logs an error message.
|
|
520
|
+
* @param message - The error message or reason.
|
|
521
|
+
* @param details - The details of the error message.
|
|
522
|
+
*/
|
|
523
|
+
error(t, ...r) {
|
|
524
|
+
return this.#t++, this.isLevelEnabled(
|
|
525
|
+
4
|
|
526
|
+
/* Error */
|
|
527
|
+
) ? (typeof t == "string" ? this.statusMessage(
|
|
528
|
+
s.red(t),
|
|
529
|
+
r,
|
|
530
|
+
4
|
|
531
|
+
/* Error */
|
|
532
|
+
) : console.error(t, ...r), this) : this;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Logs a warning message.
|
|
536
|
+
* @param message - The warning message.
|
|
537
|
+
* @param details - The details of the warning message.
|
|
538
|
+
*/
|
|
539
|
+
warn(t, ...r) {
|
|
540
|
+
return this.#r++, this.statusMessage(
|
|
541
|
+
s.yellow(t),
|
|
542
|
+
r,
|
|
543
|
+
3
|
|
544
|
+
/* Warning */
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Logs a success message.
|
|
549
|
+
* @param message - The success message.
|
|
550
|
+
* @param details - The details of the success message.
|
|
551
|
+
*/
|
|
552
|
+
success(t, ...r) {
|
|
553
|
+
return this.statusMessage(
|
|
554
|
+
s.green(t),
|
|
555
|
+
r,
|
|
556
|
+
2
|
|
557
|
+
/* Success */
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Logs an info message.
|
|
562
|
+
* @param message - The info message.
|
|
563
|
+
* @param details - The details of the info message.
|
|
564
|
+
*/
|
|
565
|
+
info(t, ...r) {
|
|
566
|
+
return this.statusMessage(
|
|
567
|
+
t,
|
|
568
|
+
r,
|
|
569
|
+
1
|
|
570
|
+
/* Info */
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Logs a status message.
|
|
575
|
+
* @param message - The status message.
|
|
576
|
+
* @param details - The details of the status message.
|
|
577
|
+
* @param level - The log level.
|
|
578
|
+
*/
|
|
579
|
+
statusMessage(t, r, n) {
|
|
580
|
+
let u = t;
|
|
581
|
+
if (r.length) {
|
|
582
|
+
const h = this.indentString ? this.indentString.repeat(this.indent + 1) : " ";
|
|
583
|
+
u += `
|
|
584
|
+
` + r.map((p) => h + String(p)).join(`
|
|
585
|
+
`);
|
|
586
|
+
}
|
|
587
|
+
return this.text(u, n);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Logs the amount of errors and warnings that have been logged since the previous call to this function or the creation of this logger.
|
|
591
|
+
*/
|
|
592
|
+
summary() {
|
|
593
|
+
const t = `${this.#t} error${this.#t != 1 ? "s" : ""}`, r = `${this.#r} warning${this.#r != 1 ? "s" : ""}`;
|
|
594
|
+
let n = `Found ${t} and ${r}`;
|
|
595
|
+
return this.#t > 0 ? n = s.red(n) : this.#r > 0 ? n = s.yellow(n) : n = s.green(n), this.text(n), this.#t = 0, this.#r = 0, this;
|
|
596
|
+
}
|
|
597
|
+
// ===== Logging text =====
|
|
598
|
+
/**
|
|
599
|
+
* Logs a labeled parameter.
|
|
600
|
+
*
|
|
601
|
+
* The value is emphasized using {@link emphasize}.
|
|
602
|
+
* @param label - The label of the parameter.
|
|
603
|
+
* @param value - The value of the parameter.
|
|
604
|
+
* @param level - The log level.
|
|
605
|
+
*/
|
|
606
|
+
parameter(t, r, n) {
|
|
607
|
+
return this.text(`${t}: ${this.emphasize(String(r))}`, n);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Logs properties as a list of key-value pairs.
|
|
611
|
+
* @param properties - The properties to log.
|
|
612
|
+
* @param level - The log level.
|
|
613
|
+
* @see {@link value()}
|
|
614
|
+
*/
|
|
615
|
+
properties(t, r) {
|
|
616
|
+
for (const [n, u] of Object.entries(t))
|
|
617
|
+
this.value(`- ${n}`, u, r);
|
|
618
|
+
return this;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Logs a labeled value.
|
|
622
|
+
*
|
|
623
|
+
* The value is highlighted using {@link highlight}.
|
|
624
|
+
* @param label - The label of the value.
|
|
625
|
+
* @param value - The value.
|
|
626
|
+
* @param level - The log level.
|
|
627
|
+
*/
|
|
628
|
+
value(t, r, n) {
|
|
629
|
+
return this.text(`${t}: ${this.highlight(String(r))}`, n);
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Logs emphasized text.
|
|
633
|
+
* @param text - The text to log.
|
|
634
|
+
* @param level - The log level.
|
|
635
|
+
*/
|
|
636
|
+
emphasized(t, r) {
|
|
637
|
+
return this.text(this.emphasize(t), r);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Logs highlighted text.
|
|
641
|
+
* @param text - The text to log.
|
|
642
|
+
* @param level - The log level.
|
|
643
|
+
*/
|
|
644
|
+
highlighted(t, r) {
|
|
645
|
+
return this.text(this.highlight(t), r);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Logs each item on a new line.
|
|
649
|
+
* @param lines - The items to log.
|
|
650
|
+
* @param level - The log level.
|
|
651
|
+
*/
|
|
652
|
+
lines(t, r) {
|
|
653
|
+
return t.map(String).forEach((n) => this.text(n, r)), this;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Logs a message.
|
|
657
|
+
* @param message - The message to log.
|
|
658
|
+
* @param level - The log level.
|
|
659
|
+
*/
|
|
660
|
+
log(t, r) {
|
|
661
|
+
return this.text(String(t), r);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Logs text using this logger's format.
|
|
665
|
+
* @param text - The text to log.
|
|
666
|
+
* @param level - The log level.
|
|
667
|
+
*/
|
|
668
|
+
text(t, r = 0) {
|
|
669
|
+
if (!this.isLevelEnabled(r))
|
|
670
|
+
return this;
|
|
671
|
+
const n = this.format(this.applyPrefix(t, r));
|
|
672
|
+
switch (r) {
|
|
673
|
+
case 1:
|
|
674
|
+
console.info(n);
|
|
675
|
+
break;
|
|
676
|
+
case 3:
|
|
677
|
+
console.warn(n);
|
|
678
|
+
break;
|
|
679
|
+
case 4:
|
|
680
|
+
console.error(n);
|
|
681
|
+
break;
|
|
682
|
+
default:
|
|
683
|
+
console.log(n);
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
return this;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Logs an newline character.
|
|
690
|
+
*/
|
|
691
|
+
newLine() {
|
|
692
|
+
return console.log(`
|
|
693
|
+
`), this;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Checks if the given log level is enabled.
|
|
697
|
+
* @param level - The log level to check.
|
|
698
|
+
*/
|
|
699
|
+
isLevelEnabled(t) {
|
|
700
|
+
return this.level === void 0 ? !0 : Array.isArray(this.level) ? this.level.includes(t) : this.level <= t;
|
|
701
|
+
}
|
|
702
|
+
// ===== Formatting strings =====
|
|
703
|
+
/**
|
|
704
|
+
* Formats text using this logger's formatting properties.
|
|
705
|
+
* @param text - The text to format.
|
|
706
|
+
*/
|
|
707
|
+
format(t) {
|
|
708
|
+
return this.indentString ? this.applyPrefix(this.indentString.repeat(this.indent) + t) : this.applyPrefix(t);
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Prepends a prefix to text.
|
|
712
|
+
* @param text - The text to apply the prefix to.
|
|
713
|
+
* @param level - The log level.
|
|
714
|
+
*/
|
|
715
|
+
applyPrefix(t, r) {
|
|
716
|
+
const n = r ? this.prefix[r] : this.prefix.global;
|
|
717
|
+
return n ? `${n} ${t}` : t;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
function N(e) {
|
|
721
|
+
return `# ${e}`;
|
|
722
|
+
}
|
|
723
|
+
function D(e) {
|
|
724
|
+
return `## ${e}`;
|
|
725
|
+
}
|
|
726
|
+
function T(e) {
|
|
727
|
+
return `### ${e}`;
|
|
728
|
+
}
|
|
729
|
+
function z(e) {
|
|
730
|
+
return `#### ${e}`;
|
|
731
|
+
}
|
|
732
|
+
function F(e) {
|
|
733
|
+
return `##### ${e}`;
|
|
734
|
+
}
|
|
735
|
+
function P(e) {
|
|
736
|
+
return `###### ${e}`;
|
|
737
|
+
}
|
|
738
|
+
function I(e) {
|
|
739
|
+
return `**${e}**`;
|
|
111
740
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
741
|
+
function j(e) {
|
|
742
|
+
return `*${e}*`;
|
|
114
743
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
return Math.round(t * e) / e;
|
|
744
|
+
function q(e) {
|
|
745
|
+
return `\`${e}\``;
|
|
118
746
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
747
|
+
function U(e) {
|
|
748
|
+
return `\`\`\`${e}\`\`\``;
|
|
121
749
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
750
|
+
function H(e) {
|
|
751
|
+
return `~~${e}~~`;
|
|
124
752
|
}
|
|
753
|
+
function V(e, t) {
|
|
754
|
+
return `[${e}](${t})`;
|
|
755
|
+
}
|
|
756
|
+
function W(e) {
|
|
757
|
+
return `> ${e}`;
|
|
758
|
+
}
|
|
759
|
+
function X() {
|
|
760
|
+
return "---";
|
|
761
|
+
}
|
|
762
|
+
const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
763
|
+
__proto__: null,
|
|
764
|
+
bold: I,
|
|
765
|
+
code: q,
|
|
766
|
+
codeBlock: U,
|
|
767
|
+
heading1: N,
|
|
768
|
+
heading2: D,
|
|
769
|
+
heading3: T,
|
|
770
|
+
heading4: z,
|
|
771
|
+
heading5: F,
|
|
772
|
+
heading6: P,
|
|
773
|
+
horizontalRule: X,
|
|
774
|
+
italic: j,
|
|
775
|
+
link: V,
|
|
776
|
+
quote: W,
|
|
777
|
+
strikethrough: H
|
|
778
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
779
|
+
class d {
|
|
780
|
+
x;
|
|
781
|
+
y;
|
|
782
|
+
constructor(t, r) {
|
|
783
|
+
this.x = t, this.y = r ?? t;
|
|
784
|
+
}
|
|
785
|
+
static get ZERO() {
|
|
786
|
+
return new d(0, 0);
|
|
787
|
+
}
|
|
788
|
+
get clone() {
|
|
789
|
+
return new d(this.x, this.y);
|
|
790
|
+
}
|
|
791
|
+
get magnitude() {
|
|
792
|
+
return this.getDistance(this);
|
|
793
|
+
}
|
|
794
|
+
setX(t) {
|
|
795
|
+
return this.x = t, this;
|
|
796
|
+
}
|
|
797
|
+
setY(t) {
|
|
798
|
+
return this.y = t, this;
|
|
799
|
+
}
|
|
800
|
+
set(t, r) {
|
|
801
|
+
return this.x = t, this.y = r, this;
|
|
802
|
+
}
|
|
803
|
+
round() {
|
|
804
|
+
return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
|
|
805
|
+
}
|
|
806
|
+
normalize() {
|
|
807
|
+
const t = this.magnitude;
|
|
808
|
+
return this.scale(t === 0 ? 0 : 1 / t);
|
|
809
|
+
}
|
|
810
|
+
scale(t) {
|
|
811
|
+
return this.multiply(t);
|
|
812
|
+
}
|
|
813
|
+
getDistanceSquared(t, r) {
|
|
814
|
+
const n = d.parseVector(t, r), u = this.x - n.x, h = this.y - n.y;
|
|
815
|
+
return u * u + h * h;
|
|
816
|
+
}
|
|
817
|
+
getDistance(t, r) {
|
|
818
|
+
const n = d.parseVector(t, r);
|
|
819
|
+
return Math.sqrt(this.getDistanceSquared(n.x, n.y));
|
|
820
|
+
}
|
|
821
|
+
add(t, r) {
|
|
822
|
+
const n = d.parseVector(t, r);
|
|
823
|
+
return this.x += n.x, this.y += n.y, this;
|
|
824
|
+
}
|
|
825
|
+
subtract(t, r) {
|
|
826
|
+
const n = d.parseVector(t, r);
|
|
827
|
+
return this.x -= n.x, this.y -= n.y, this;
|
|
828
|
+
}
|
|
829
|
+
multiply(t, r) {
|
|
830
|
+
const n = d.parseVector(t, r);
|
|
831
|
+
return this.x *= n.x, this.y *= n.y, this;
|
|
832
|
+
}
|
|
833
|
+
divide(t, r) {
|
|
834
|
+
const n = d.parseVector(t, r);
|
|
835
|
+
return this.x /= n.x, this.y /= n.y, this;
|
|
836
|
+
}
|
|
837
|
+
lerp(t, r) {
|
|
838
|
+
return this.x += (t.x - this.x) * r, this.y += (t.y - this.y) * r, this;
|
|
839
|
+
}
|
|
840
|
+
static sum(t, r) {
|
|
841
|
+
return t.clone.add(r);
|
|
842
|
+
}
|
|
843
|
+
static difference(t, r) {
|
|
844
|
+
return t.clone.subtract(r);
|
|
845
|
+
}
|
|
846
|
+
static product(t, r) {
|
|
847
|
+
return t.clone.multiply(r);
|
|
848
|
+
}
|
|
849
|
+
static division(t, r) {
|
|
850
|
+
return t.clone.divide(r);
|
|
851
|
+
}
|
|
852
|
+
static scale(t, r) {
|
|
853
|
+
return t.clone.scale(r);
|
|
854
|
+
}
|
|
855
|
+
static normalize(t) {
|
|
856
|
+
return t.clone.normalize();
|
|
857
|
+
}
|
|
858
|
+
static lerp(t, r, n) {
|
|
859
|
+
return t.clone.lerp(r, n);
|
|
860
|
+
}
|
|
861
|
+
static from({ x: t, y: r }) {
|
|
862
|
+
return new d(t, r);
|
|
863
|
+
}
|
|
864
|
+
static parseVector(t, r) {
|
|
865
|
+
return t instanceof d ? (r = t.y, t = t.x) : r === void 0 && (r = t), { x: t, y: r };
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
class k {
|
|
869
|
+
/**
|
|
870
|
+
* Returns `true` if this result is a {@link Result.Success}.
|
|
871
|
+
*/
|
|
872
|
+
isOk() {
|
|
873
|
+
return !1;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Returns `true` if this result is a {@link Result.Failure}.
|
|
877
|
+
*/
|
|
878
|
+
isError() {
|
|
879
|
+
return !1;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Executes a callback for side effects if this result is a {@link Result.Success}.
|
|
883
|
+
*/
|
|
884
|
+
ifOk(t) {
|
|
885
|
+
return this.isOk() && t(this.value), this;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Executes a callback for side effects if this result is a {@link Result.Failure}.
|
|
889
|
+
*/
|
|
890
|
+
ifError(t) {
|
|
891
|
+
return this.isError() && t(this.error), this;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
var v;
|
|
895
|
+
((e) => {
|
|
896
|
+
class t extends k {
|
|
897
|
+
constructor(i) {
|
|
898
|
+
super(), this.value = i;
|
|
899
|
+
}
|
|
900
|
+
value;
|
|
901
|
+
isOk() {
|
|
902
|
+
return !0;
|
|
903
|
+
}
|
|
904
|
+
map(i) {
|
|
905
|
+
return n(i(this.value));
|
|
906
|
+
}
|
|
907
|
+
mapError(i) {
|
|
908
|
+
return n(this.value);
|
|
909
|
+
}
|
|
910
|
+
next(i) {
|
|
911
|
+
return i(this.value);
|
|
912
|
+
}
|
|
913
|
+
orElse(i) {
|
|
914
|
+
return this;
|
|
915
|
+
}
|
|
916
|
+
unwrapOr(i) {
|
|
917
|
+
return this.value;
|
|
918
|
+
}
|
|
919
|
+
match(i, c) {
|
|
920
|
+
return i(this.value);
|
|
921
|
+
}
|
|
922
|
+
filter(i, c) {
|
|
923
|
+
return i(this.value) ? n(this.value) : u(c(this.value));
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
e.Success = t;
|
|
927
|
+
class r extends k {
|
|
928
|
+
constructor(i) {
|
|
929
|
+
super(), this.error = i;
|
|
930
|
+
}
|
|
931
|
+
error;
|
|
932
|
+
isError() {
|
|
933
|
+
return !0;
|
|
934
|
+
}
|
|
935
|
+
map(i) {
|
|
936
|
+
return u(this.error);
|
|
937
|
+
}
|
|
938
|
+
mapError(i) {
|
|
939
|
+
return u(i(this.error));
|
|
940
|
+
}
|
|
941
|
+
next(i) {
|
|
942
|
+
return u(this.error);
|
|
943
|
+
}
|
|
944
|
+
orElse(i) {
|
|
945
|
+
return i(this.error);
|
|
946
|
+
}
|
|
947
|
+
unwrapOr(i) {
|
|
948
|
+
return i;
|
|
949
|
+
}
|
|
950
|
+
match(i, c) {
|
|
951
|
+
return c(this.error);
|
|
952
|
+
}
|
|
953
|
+
filter(i, c) {
|
|
954
|
+
return u(this.error);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
e.Failure = r;
|
|
958
|
+
function n(o) {
|
|
959
|
+
return new t(o);
|
|
960
|
+
}
|
|
961
|
+
e.ok = n;
|
|
962
|
+
function u(o) {
|
|
963
|
+
return new r(o);
|
|
964
|
+
}
|
|
965
|
+
e.error = u;
|
|
966
|
+
function h(o, i) {
|
|
967
|
+
try {
|
|
968
|
+
return n(o());
|
|
969
|
+
} catch (c) {
|
|
970
|
+
return u(i ? i(c) : c);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
e.wrap = h;
|
|
974
|
+
function p(o, i) {
|
|
975
|
+
return o != null ? n(o) : u(i);
|
|
976
|
+
}
|
|
977
|
+
e.nonNullOr = p;
|
|
978
|
+
function y(o, i) {
|
|
979
|
+
return o != null ? n(o) : i();
|
|
980
|
+
}
|
|
981
|
+
e.nonNullOrElse = y;
|
|
982
|
+
function l(o, i, c) {
|
|
983
|
+
let f = o;
|
|
984
|
+
for (; i(f); ) {
|
|
985
|
+
const x = c(f);
|
|
986
|
+
if (x.isError())
|
|
987
|
+
return x;
|
|
988
|
+
f = x.value;
|
|
989
|
+
}
|
|
990
|
+
return n(f);
|
|
991
|
+
}
|
|
992
|
+
e.repeat = l;
|
|
993
|
+
function g(o, i, c) {
|
|
994
|
+
let f = c;
|
|
995
|
+
for (const x of o) {
|
|
996
|
+
const B = i(f, x);
|
|
997
|
+
if (B.isError())
|
|
998
|
+
return B;
|
|
999
|
+
f = B.value;
|
|
1000
|
+
}
|
|
1001
|
+
return n(f);
|
|
1002
|
+
}
|
|
1003
|
+
e.reduce = g;
|
|
1004
|
+
function m(o) {
|
|
1005
|
+
const i = [];
|
|
1006
|
+
for (const c of o) {
|
|
1007
|
+
if (c.isError())
|
|
1008
|
+
return u(c.error);
|
|
1009
|
+
i.push(c.value);
|
|
1010
|
+
}
|
|
1011
|
+
return n(i);
|
|
1012
|
+
}
|
|
1013
|
+
e.all = m;
|
|
1014
|
+
function b(o, i, c) {
|
|
1015
|
+
for (const f of o) {
|
|
1016
|
+
const x = i(f);
|
|
1017
|
+
if (x.isOk())
|
|
1018
|
+
return x;
|
|
1019
|
+
}
|
|
1020
|
+
return c;
|
|
1021
|
+
}
|
|
1022
|
+
e.any = b;
|
|
1023
|
+
function $(o, i, c, f) {
|
|
1024
|
+
return i(o) ? n(c(o)) : u(f(o));
|
|
1025
|
+
}
|
|
1026
|
+
e.require = $;
|
|
1027
|
+
})(v || (v = {}));
|
|
125
1028
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1029
|
+
a as ANSI,
|
|
1030
|
+
s as Ansi,
|
|
1031
|
+
k as BaseResult,
|
|
1032
|
+
K as EventEmitter,
|
|
1033
|
+
M as LogLevel,
|
|
1034
|
+
et as Logger,
|
|
1035
|
+
nt as Markdown,
|
|
1036
|
+
v as Result,
|
|
1037
|
+
d as Vector2,
|
|
1038
|
+
G as clamp,
|
|
1039
|
+
J as formatRelativeTime,
|
|
1040
|
+
S as formatTime,
|
|
1041
|
+
rt as getLongestCommonPrefix,
|
|
1042
|
+
O as isValidInteger,
|
|
1043
|
+
C as isValidNumber,
|
|
1044
|
+
tt as kebabToCamelCase,
|
|
1045
|
+
_ as parseBool,
|
|
1046
|
+
L as parseOptionalFloat,
|
|
1047
|
+
A as parseOptionalInteger,
|
|
1048
|
+
Y as randomFromArray,
|
|
1049
|
+
Q as randomRange,
|
|
1050
|
+
Z as removeDuplicatesFromArray,
|
|
136
1051
|
E as removeFromArray,
|
|
137
|
-
|
|
1052
|
+
R as round
|
|
138
1053
|
};
|
|
139
1054
|
//# sourceMappingURL=main.js.map
|