@ztimson/utils 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/csv.d.ts +8 -0
- package/dist/files.d.ts +8 -8
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +190 -175
- package/dist/index.mjs.map +1 -1
- package/dist/string.d.ts +7 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (n, t, e) => (
|
|
4
|
-
function
|
|
1
|
+
var nt = Object.defineProperty;
|
|
2
|
+
var rt = (n, t, e) => t in n ? nt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var i = (n, t, e) => (rt(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
function ot(n, t = !1) {
|
|
5
5
|
if (n == null)
|
|
6
6
|
throw new Error("Cannot clean a NULL value");
|
|
7
7
|
return Array.isArray(n) ? n = n.filter((e) => e != null) : Object.entries(n).forEach(([e, r]) => {
|
|
8
8
|
(t && r === void 0 || !t && r == null) && delete n[e];
|
|
9
9
|
}), n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function xt(n) {
|
|
12
12
|
return structuredClone(n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function st(n, ...t) {
|
|
15
15
|
return t.forEach((e) => {
|
|
16
16
|
for (const r in e)
|
|
17
|
-
e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}),
|
|
17
|
+
e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), st(n[r], e[r])) : n[r] = e[r];
|
|
18
18
|
}), n;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function x(n, t, e) {
|
|
21
21
|
if (!(n == null || !t))
|
|
22
22
|
return t.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, c) => {
|
|
23
23
|
if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
|
|
@@ -28,21 +28,21 @@ function A(n, t, e) {
|
|
|
28
28
|
return e !== void 0 && s == c.length - 1 ? r[o] = e : r[o];
|
|
29
29
|
}, n);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Bt(n) {
|
|
32
32
|
return Object.entries(n).map(
|
|
33
33
|
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
34
34
|
).join("&");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function F(n, t, e = {}) {
|
|
37
37
|
if (typeof n == "object" && !Array.isArray(n)) {
|
|
38
38
|
for (const r of Object.keys(n)) {
|
|
39
39
|
const o = t ? t + "." + r : r;
|
|
40
|
-
typeof n[r] == "object" ?
|
|
40
|
+
typeof n[r] == "object" ? F(n[r], o, e) : e[o] = n[r];
|
|
41
41
|
}
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function St(n) {
|
|
46
46
|
const t = new FormData();
|
|
47
47
|
return Object.entries(n).forEach(([e, r]) => t.append(e, r)), t;
|
|
48
48
|
}
|
|
@@ -58,7 +58,7 @@ function b(n, t) {
|
|
|
58
58
|
const e = typeof n, r = typeof t;
|
|
59
59
|
return e != "object" || n == null || r != "object" || t == null ? e == "function" && r == "function" ? n.toString() == t.toString() : n === t : Object.keys(n).length != Object.keys(t).length ? !1 : Object.keys(n).every((s) => b(n[s], t[s]));
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function At(n, t) {
|
|
62
62
|
t.forEach((e) => {
|
|
63
63
|
Object.getOwnPropertyNames(e.prototype).forEach((r) => {
|
|
64
64
|
Object.defineProperty(
|
|
@@ -76,7 +76,7 @@ function U(n) {
|
|
|
76
76
|
return n;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function bt(n, t) {
|
|
80
80
|
let e = [];
|
|
81
81
|
return JSON.stringify(n, (r, o) => {
|
|
82
82
|
if (typeof o == "object" && o !== null) {
|
|
@@ -87,30 +87,30 @@ function At(n, t) {
|
|
|
87
87
|
return o;
|
|
88
88
|
}, t);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Rt(n, t) {
|
|
91
91
|
return n.indexOf(t) === -1 && n.push(t), n;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Ot(n, t) {
|
|
94
94
|
return it([
|
|
95
95
|
...n.filter((e) => !t.includes((r) => b(e, r))),
|
|
96
96
|
...t.filter((e) => !n.includes((r) => b(e, r)))
|
|
97
97
|
]);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function $t(n) {
|
|
100
100
|
return function(t, e) {
|
|
101
|
-
const r =
|
|
101
|
+
const r = x(t, n), o = x(e, n);
|
|
102
102
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return (e) => b(
|
|
105
|
+
function Lt(n, t) {
|
|
106
|
+
return (e) => b(x(e, n), t);
|
|
107
107
|
}
|
|
108
108
|
function ct(n, t = []) {
|
|
109
109
|
return n.forEach((e) => Array.isArray(e) ? ct(e, t) : t.push(e)), t;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Ct(n, t = !1) {
|
|
112
112
|
return function(e, r) {
|
|
113
|
-
const o =
|
|
113
|
+
const o = x(e, n), s = x(r, n);
|
|
114
114
|
return typeof o == "number" && typeof s == "number" ? (t ? -1 : 1) * (o - s) : o > s ? t ? -1 : 1 : o < s ? t ? 1 : -1 : 0;
|
|
115
115
|
};
|
|
116
116
|
}
|
|
@@ -119,10 +119,10 @@ function it(n) {
|
|
|
119
119
|
n.slice(0, t).find((e) => b(e, n[t])) && n.splice(t, 1);
|
|
120
120
|
return n;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function ut(n) {
|
|
123
123
|
return Array.isArray(n) ? n : [n];
|
|
124
124
|
}
|
|
125
|
-
class
|
|
125
|
+
class A extends Array {
|
|
126
126
|
/** Number of elements in set */
|
|
127
127
|
get size() {
|
|
128
128
|
return this.length;
|
|
@@ -155,7 +155,7 @@ class S extends Array {
|
|
|
155
155
|
* @return {ASet<T>} Different elements
|
|
156
156
|
*/
|
|
157
157
|
difference(t) {
|
|
158
|
-
return new
|
|
158
|
+
return new A(this.filter((e) => !t.has(e)));
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Check if set includes element
|
|
@@ -171,7 +171,7 @@ class S extends Array {
|
|
|
171
171
|
* @return {boolean} Set of common elements
|
|
172
172
|
*/
|
|
173
173
|
intersection(t) {
|
|
174
|
-
return new
|
|
174
|
+
return new A(this.filter((e) => t.has(e)));
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Check if this set has no elements in common with the comparison set
|
|
@@ -203,7 +203,7 @@ class S extends Array {
|
|
|
203
203
|
* @return {ASet<T>} New set of unique elements
|
|
204
204
|
*/
|
|
205
205
|
symmetricDifference(t) {
|
|
206
|
-
return new
|
|
206
|
+
return new A([...this.difference(t), ...t.difference(this)]);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Create joined list of elements included in this & the comparison set
|
|
@@ -211,8 +211,21 @@ class S extends Array {
|
|
|
211
211
|
* @return {ASet<T>} New set of both previous sets combined
|
|
212
212
|
*/
|
|
213
213
|
union(t) {
|
|
214
|
-
return new
|
|
215
|
-
}
|
|
214
|
+
return new A([...this, ...t]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function Nt(n, t = !0) {
|
|
218
|
+
const e = n.reduce((r, o) => (Object.keys(t ? F(o) : o).forEach((s) => {
|
|
219
|
+
r.includes(s) || r.push(s);
|
|
220
|
+
}), r), []);
|
|
221
|
+
return [
|
|
222
|
+
e.join(","),
|
|
223
|
+
...n.map((r) => e.map((o) => {
|
|
224
|
+
const s = x(r, o), c = typeof s;
|
|
225
|
+
return c == "string" && s.includes(",") ? `"${s}"` : c == "object" ? `"${JSON.stringify(s)}"` : s;
|
|
226
|
+
}).join(","))
|
|
227
|
+
].join(`
|
|
228
|
+
`);
|
|
216
229
|
}
|
|
217
230
|
class m extends Promise {
|
|
218
231
|
constructor(e) {
|
|
@@ -251,15 +264,16 @@ class m extends Promise {
|
|
|
251
264
|
return this.from(super.finally(e));
|
|
252
265
|
}
|
|
253
266
|
}
|
|
254
|
-
function
|
|
267
|
+
function Tt(n, t) {
|
|
268
|
+
n instanceof Blob || (n = new Blob(ut(n)));
|
|
269
|
+
const e = URL.createObjectURL(n);
|
|
270
|
+
at(e, t), URL.revokeObjectURL(e);
|
|
271
|
+
}
|
|
272
|
+
function at(n, t) {
|
|
255
273
|
const e = document.createElement("a");
|
|
256
274
|
e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
257
275
|
}
|
|
258
|
-
function
|
|
259
|
-
const e = URL.createObjectURL(n);
|
|
260
|
-
ut(e, t), URL.revokeObjectURL(e);
|
|
261
|
-
}
|
|
262
|
-
function Tt(n = {}) {
|
|
276
|
+
function It(n = {}) {
|
|
263
277
|
return new Promise((t) => {
|
|
264
278
|
const e = document.createElement("input");
|
|
265
279
|
e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
|
|
@@ -267,18 +281,18 @@ function Tt(n = {}) {
|
|
|
267
281
|
}, document.body.appendChild(e), e.click();
|
|
268
282
|
});
|
|
269
283
|
}
|
|
270
|
-
function
|
|
284
|
+
function Mt(n, t = /* @__PURE__ */ new Date()) {
|
|
271
285
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
272
286
|
const e = `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}_${t.getHours().toString().padStart(2, "0")}-${t.getMinutes().toString().padStart(2, "0")}-${t.getSeconds().toString().padStart(2, "0")}`;
|
|
273
287
|
return n ? n.replace("{{TIMESTAMP}}", e) : e;
|
|
274
288
|
}
|
|
275
|
-
function
|
|
289
|
+
function Dt(n) {
|
|
276
290
|
return new m((t, e, r) => {
|
|
277
291
|
const o = new XMLHttpRequest(), s = new FormData();
|
|
278
292
|
n.files.forEach((c) => s.append("file", c)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (c) => c.lengthComputable ? r(c.loaded / c.total) : null), o.addEventListener("loadend", () => t(U(o.responseText))), o.addEventListener("error", () => e(U(o.responseText))), o.addEventListener("timeout", () => e({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([c, y]) => o.setRequestHeader(c, y)), o.send(s);
|
|
279
293
|
});
|
|
280
294
|
}
|
|
281
|
-
class
|
|
295
|
+
class v {
|
|
282
296
|
constructor() {
|
|
283
297
|
i(this, "listeners", {});
|
|
284
298
|
}
|
|
@@ -319,7 +333,7 @@ class F {
|
|
|
319
333
|
});
|
|
320
334
|
}
|
|
321
335
|
}
|
|
322
|
-
i(
|
|
336
|
+
i(v, "listeners", {});
|
|
323
337
|
class p extends Error {
|
|
324
338
|
constructor(e, r) {
|
|
325
339
|
super(e);
|
|
@@ -366,7 +380,7 @@ class H extends p {
|
|
|
366
380
|
}
|
|
367
381
|
}
|
|
368
382
|
i(H, "code", 401);
|
|
369
|
-
class
|
|
383
|
+
class W extends p {
|
|
370
384
|
constructor(t = "Payment Required") {
|
|
371
385
|
super(t);
|
|
372
386
|
}
|
|
@@ -374,8 +388,8 @@ class v extends p {
|
|
|
374
388
|
return t.constructor.code == this.code;
|
|
375
389
|
}
|
|
376
390
|
}
|
|
377
|
-
i(
|
|
378
|
-
class
|
|
391
|
+
i(W, "code", 402);
|
|
392
|
+
class z extends p {
|
|
379
393
|
constructor(t = "Forbidden") {
|
|
380
394
|
super(t);
|
|
381
395
|
}
|
|
@@ -383,8 +397,8 @@ class W extends p {
|
|
|
383
397
|
return t.constructor.code == this.code;
|
|
384
398
|
}
|
|
385
399
|
}
|
|
386
|
-
i(
|
|
387
|
-
class
|
|
400
|
+
i(z, "code", 403);
|
|
401
|
+
class J extends p {
|
|
388
402
|
constructor(t = "Not Found") {
|
|
389
403
|
super(t);
|
|
390
404
|
}
|
|
@@ -392,8 +406,8 @@ class z extends p {
|
|
|
392
406
|
return t.constructor.code == this.code;
|
|
393
407
|
}
|
|
394
408
|
}
|
|
395
|
-
i(
|
|
396
|
-
class
|
|
409
|
+
i(J, "code", 404);
|
|
410
|
+
class K extends p {
|
|
397
411
|
constructor(t = "Method Not Allowed") {
|
|
398
412
|
super(t);
|
|
399
413
|
}
|
|
@@ -401,8 +415,8 @@ class J extends p {
|
|
|
401
415
|
return t.constructor.code == this.code;
|
|
402
416
|
}
|
|
403
417
|
}
|
|
404
|
-
i(
|
|
405
|
-
class
|
|
418
|
+
i(K, "code", 405);
|
|
419
|
+
class Z extends p {
|
|
406
420
|
constructor(t = "Not Acceptable") {
|
|
407
421
|
super(t);
|
|
408
422
|
}
|
|
@@ -410,8 +424,8 @@ class K extends p {
|
|
|
410
424
|
return t.constructor.code == this.code;
|
|
411
425
|
}
|
|
412
426
|
}
|
|
413
|
-
i(
|
|
414
|
-
class
|
|
427
|
+
i(Z, "code", 406);
|
|
428
|
+
class V extends p {
|
|
415
429
|
constructor(t = "Internal Server Error") {
|
|
416
430
|
super(t);
|
|
417
431
|
}
|
|
@@ -419,8 +433,8 @@ class Z extends p {
|
|
|
419
433
|
return t.constructor.code == this.code;
|
|
420
434
|
}
|
|
421
435
|
}
|
|
422
|
-
i(
|
|
423
|
-
class
|
|
436
|
+
i(V, "code", 500);
|
|
437
|
+
class X extends p {
|
|
424
438
|
constructor(t = "Not Implemented") {
|
|
425
439
|
super(t);
|
|
426
440
|
}
|
|
@@ -428,8 +442,8 @@ class V extends p {
|
|
|
428
442
|
return t.constructor.code == this.code;
|
|
429
443
|
}
|
|
430
444
|
}
|
|
431
|
-
i(
|
|
432
|
-
class
|
|
445
|
+
i(X, "code", 501);
|
|
446
|
+
class Q extends p {
|
|
433
447
|
constructor(t = "Bad Gateway") {
|
|
434
448
|
super(t);
|
|
435
449
|
}
|
|
@@ -437,8 +451,8 @@ class X extends p {
|
|
|
437
451
|
return t.constructor.code == this.code;
|
|
438
452
|
}
|
|
439
453
|
}
|
|
440
|
-
i(
|
|
441
|
-
class
|
|
454
|
+
i(Q, "code", 502);
|
|
455
|
+
class _ extends p {
|
|
442
456
|
constructor(t = "Service Unavailable") {
|
|
443
457
|
super(t);
|
|
444
458
|
}
|
|
@@ -446,8 +460,8 @@ class Q extends p {
|
|
|
446
460
|
return t.constructor.code == this.code;
|
|
447
461
|
}
|
|
448
462
|
}
|
|
449
|
-
i(
|
|
450
|
-
class
|
|
463
|
+
i(_, "code", 503);
|
|
464
|
+
class tt extends p {
|
|
451
465
|
constructor(t = "Gateway Timeout") {
|
|
452
466
|
super(t);
|
|
453
467
|
}
|
|
@@ -455,8 +469,8 @@ class _ extends p {
|
|
|
455
469
|
return t.constructor.code == this.code;
|
|
456
470
|
}
|
|
457
471
|
}
|
|
458
|
-
i(
|
|
459
|
-
function
|
|
472
|
+
i(tt, "code", 504);
|
|
473
|
+
function jt(n, t) {
|
|
460
474
|
if (n >= 200 && n < 300)
|
|
461
475
|
return null;
|
|
462
476
|
switch (n) {
|
|
@@ -465,25 +479,25 @@ function Dt(n, t) {
|
|
|
465
479
|
case 401:
|
|
466
480
|
return new H(t);
|
|
467
481
|
case 402:
|
|
468
|
-
return new v(t);
|
|
469
|
-
case 403:
|
|
470
482
|
return new W(t);
|
|
471
|
-
case
|
|
483
|
+
case 403:
|
|
472
484
|
return new z(t);
|
|
473
|
-
case
|
|
485
|
+
case 404:
|
|
474
486
|
return new J(t);
|
|
475
|
-
case
|
|
487
|
+
case 405:
|
|
476
488
|
return new K(t);
|
|
477
|
-
case
|
|
489
|
+
case 406:
|
|
478
490
|
return new Z(t);
|
|
479
|
-
case
|
|
491
|
+
case 500:
|
|
480
492
|
return new V(t);
|
|
481
|
-
case
|
|
493
|
+
case 501:
|
|
482
494
|
return new X(t);
|
|
483
|
-
case
|
|
495
|
+
case 502:
|
|
484
496
|
return new Q(t);
|
|
485
|
-
case
|
|
497
|
+
case 503:
|
|
486
498
|
return new _(t);
|
|
499
|
+
case 504:
|
|
500
|
+
return new tt(t);
|
|
487
501
|
default:
|
|
488
502
|
return new p(t, n);
|
|
489
503
|
}
|
|
@@ -516,7 +530,7 @@ const w = class w {
|
|
|
516
530
|
const s = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((c) => ({ key: c, value: t.query[c] }));
|
|
517
531
|
e += (e.includes("?") ? "&" : "?") + s.map((c) => `${c.key}=${c.value}`).join("&");
|
|
518
532
|
}
|
|
519
|
-
const r =
|
|
533
|
+
const r = ot({
|
|
520
534
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
521
535
|
...w.headers,
|
|
522
536
|
...this.headers,
|
|
@@ -528,25 +542,25 @@ const w = class w {
|
|
|
528
542
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
529
543
|
body: t.body
|
|
530
544
|
}).then(async (u) => {
|
|
531
|
-
var
|
|
545
|
+
var j, k;
|
|
532
546
|
for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
|
|
533
|
-
await new Promise((
|
|
547
|
+
await new Promise((O) => a(u, () => O()));
|
|
534
548
|
const R = u.headers.get("Content-Length"), C = R ? parseInt(R, 10) : 0;
|
|
535
549
|
let D = 0;
|
|
536
|
-
const N = (
|
|
550
|
+
const N = (j = u.body) == null ? void 0 : j.getReader(), et = new ReadableStream({
|
|
537
551
|
start(a) {
|
|
538
|
-
function
|
|
539
|
-
N == null || N.read().then((
|
|
540
|
-
if (
|
|
552
|
+
function O() {
|
|
553
|
+
N == null || N.read().then((B) => {
|
|
554
|
+
if (B.done)
|
|
541
555
|
return a.close();
|
|
542
|
-
D +=
|
|
543
|
-
}).catch((
|
|
556
|
+
D += B.value.byteLength, y(D / C), a.enqueue(B.value), O();
|
|
557
|
+
}).catch((B) => a.error(B));
|
|
544
558
|
}
|
|
545
|
-
|
|
559
|
+
O();
|
|
546
560
|
}
|
|
547
561
|
});
|
|
548
|
-
if (u.data = new Response(
|
|
549
|
-
const a = (
|
|
562
|
+
if (u.data = new Response(et), t.decode == null || t.decode) {
|
|
563
|
+
const a = (k = u.headers.get("Content-Type")) == null ? void 0 : k.toLowerCase();
|
|
550
564
|
a != null && a.includes("form") ? u.data = await u.data.formData() : a != null && a.includes("json") ? u.data = await u.data.json() : a != null && a.includes("text") ? u.data = await u.data.text() : a != null && a.includes("application") && (u.data = await u.data.blob());
|
|
551
565
|
}
|
|
552
566
|
u.ok ? s(u) : c(u);
|
|
@@ -556,7 +570,7 @@ const w = class w {
|
|
|
556
570
|
};
|
|
557
571
|
i(w, "interceptors", {}), i(w, "headers", {});
|
|
558
572
|
let q = w;
|
|
559
|
-
const
|
|
573
|
+
const S = {
|
|
560
574
|
CLEAR: "\x1B[0m",
|
|
561
575
|
BRIGHT: "\x1B[1m",
|
|
562
576
|
DIM: "\x1B[2m",
|
|
@@ -564,7 +578,7 @@ const B = {
|
|
|
564
578
|
BLINK: "\x1B[5m",
|
|
565
579
|
REVERSE: "\x1B[7m",
|
|
566
580
|
HIDDEN: "\x1B[8m"
|
|
567
|
-
},
|
|
581
|
+
}, $ = {
|
|
568
582
|
BLACK: "\x1B[30m",
|
|
569
583
|
RED: "\x1B[31m",
|
|
570
584
|
GREEN: "\x1B[32m",
|
|
@@ -592,8 +606,8 @@ const B = {
|
|
|
592
606
|
WHITE: "\x1B[47m",
|
|
593
607
|
GREY: "\x1B[100m"
|
|
594
608
|
};
|
|
595
|
-
var
|
|
596
|
-
const g = class g extends
|
|
609
|
+
var lt = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(lt || {});
|
|
610
|
+
const g = class g extends v {
|
|
597
611
|
constructor(t) {
|
|
598
612
|
super(), this.namespace = t;
|
|
599
613
|
}
|
|
@@ -612,36 +626,36 @@ const g = class g extends F {
|
|
|
612
626
|
if (g.LOG_LEVEL < 4)
|
|
613
627
|
return;
|
|
614
628
|
const e = this.format(...t);
|
|
615
|
-
g.emit(4, e), console.debug(
|
|
629
|
+
g.emit(4, e), console.debug($.LIGHT_GREY + e + S.CLEAR);
|
|
616
630
|
}
|
|
617
631
|
log(...t) {
|
|
618
632
|
if (g.LOG_LEVEL < 3)
|
|
619
633
|
return;
|
|
620
634
|
const e = this.format(...t);
|
|
621
|
-
g.emit(3, e), console.log(
|
|
635
|
+
g.emit(3, e), console.log(S.CLEAR + e);
|
|
622
636
|
}
|
|
623
637
|
info(...t) {
|
|
624
638
|
if (g.LOG_LEVEL < 2)
|
|
625
639
|
return;
|
|
626
640
|
const e = this.format(...t);
|
|
627
|
-
g.emit(2, e), console.info(
|
|
641
|
+
g.emit(2, e), console.info($.BLUE + e + S.CLEAR);
|
|
628
642
|
}
|
|
629
643
|
warn(...t) {
|
|
630
644
|
if (g.LOG_LEVEL < 1)
|
|
631
645
|
return;
|
|
632
646
|
const e = this.format(...t);
|
|
633
|
-
g.emit(1, e), console.warn(
|
|
647
|
+
g.emit(1, e), console.warn($.YELLOW + e + S.CLEAR);
|
|
634
648
|
}
|
|
635
649
|
error(...t) {
|
|
636
650
|
if (g.LOG_LEVEL < 0)
|
|
637
651
|
return;
|
|
638
652
|
const e = this.format(...t);
|
|
639
|
-
g.emit(0, e), console.error(
|
|
653
|
+
g.emit(0, e), console.error($.RED + e + S.CLEAR);
|
|
640
654
|
}
|
|
641
655
|
};
|
|
642
656
|
i(g, "LOG_LEVEL", 4);
|
|
643
657
|
let P = g;
|
|
644
|
-
function
|
|
658
|
+
function Gt(n) {
|
|
645
659
|
const t = (y, u) => u < 1e-7 ? y : t(u, ~~(y % u)), e = n.toString().length - 2;
|
|
646
660
|
let r = Math.pow(10, e), o = n * r;
|
|
647
661
|
const s = t(o, r);
|
|
@@ -649,15 +663,12 @@ function jt(n) {
|
|
|
649
663
|
const c = ~~(o / r);
|
|
650
664
|
return o -= c * r, `${c ? c + " " : ""}${~~o}/${~~r}`;
|
|
651
665
|
}
|
|
652
|
-
function
|
|
666
|
+
function Ut(n) {
|
|
653
667
|
let t = n.split(" ");
|
|
654
668
|
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
655
669
|
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
656
670
|
}
|
|
657
|
-
const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", M = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/",
|
|
658
|
-
function Ut(n) {
|
|
659
|
-
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
660
|
-
}
|
|
671
|
+
const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", M = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ft = T + I + M;
|
|
661
672
|
function qt(n, t = 2) {
|
|
662
673
|
if (n === 0)
|
|
663
674
|
return "0 Bytes";
|
|
@@ -673,16 +684,19 @@ function Pt(n) {
|
|
|
673
684
|
function Ft(n, t, e) {
|
|
674
685
|
return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
|
|
675
686
|
}
|
|
676
|
-
function
|
|
687
|
+
function vt(n, t, e = " ", r = !0) {
|
|
677
688
|
return r ? n.toString().padStart(t, e) : n.toString().padEnd(t, e);
|
|
678
689
|
}
|
|
679
|
-
function
|
|
690
|
+
function Yt(n) {
|
|
691
|
+
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
692
|
+
}
|
|
693
|
+
function Ht(n, t = ft) {
|
|
680
694
|
return Array(n).fill(null).map(() => {
|
|
681
695
|
const e = ~~(Math.random() * t.length);
|
|
682
696
|
return t[e];
|
|
683
697
|
}).join("");
|
|
684
698
|
}
|
|
685
|
-
function
|
|
699
|
+
function Wt(n, t = !1, e = !1, r = !1) {
|
|
686
700
|
if (!t && !e && !r)
|
|
687
701
|
throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
688
702
|
return Array(n).fill(null).map(() => {
|
|
@@ -694,7 +708,7 @@ function vt(n, t = !1, e = !1, r = !1) {
|
|
|
694
708
|
return o;
|
|
695
709
|
}).join("");
|
|
696
710
|
}
|
|
697
|
-
function
|
|
711
|
+
function zt(n, t) {
|
|
698
712
|
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
699
713
|
throw new TypeError("Regular expression must be global.");
|
|
700
714
|
let e = [], r;
|
|
@@ -702,7 +716,7 @@ function Wt(n, t) {
|
|
|
702
716
|
e.push(r);
|
|
703
717
|
return e;
|
|
704
718
|
}
|
|
705
|
-
function
|
|
719
|
+
function Jt(n) {
|
|
706
720
|
const t = new RegExp(
|
|
707
721
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
708
722
|
"gm"
|
|
@@ -716,28 +730,28 @@ function zt(n) {
|
|
|
716
730
|
}
|
|
717
731
|
return e;
|
|
718
732
|
}
|
|
719
|
-
function
|
|
720
|
-
var t =
|
|
733
|
+
function ht(n) {
|
|
734
|
+
var t = dt(yt(gt(pt(n), 8 * n.length)));
|
|
721
735
|
return t.toLowerCase();
|
|
722
736
|
}
|
|
723
|
-
function
|
|
737
|
+
function dt(n) {
|
|
724
738
|
for (var t, e = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
|
|
725
739
|
t = n.charCodeAt(o), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
726
740
|
return r;
|
|
727
741
|
}
|
|
728
|
-
function
|
|
742
|
+
function pt(n) {
|
|
729
743
|
for (var t = Array(n.length >> 2), e = 0; e < t.length; e++)
|
|
730
744
|
t[e] = 0;
|
|
731
745
|
for (e = 0; e < 8 * n.length; e += 8)
|
|
732
746
|
t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32;
|
|
733
747
|
return t;
|
|
734
748
|
}
|
|
735
|
-
function
|
|
749
|
+
function yt(n) {
|
|
736
750
|
for (var t = "", e = 0; e < 32 * n.length; e += 8)
|
|
737
751
|
t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255);
|
|
738
752
|
return t;
|
|
739
753
|
}
|
|
740
|
-
function
|
|
754
|
+
function gt(n, t) {
|
|
741
755
|
n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
|
|
742
756
|
for (var e = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < n.length; c += 16) {
|
|
743
757
|
var y = e, u = r, R = o, C = s;
|
|
@@ -745,119 +759,120 @@ function yt(n, t) {
|
|
|
745
759
|
}
|
|
746
760
|
return Array(e, r, o, s);
|
|
747
761
|
}
|
|
748
|
-
function
|
|
749
|
-
return E(
|
|
762
|
+
function L(n, t, e, r, o, s) {
|
|
763
|
+
return E(wt(E(E(t, n), E(r, s)), o), e);
|
|
750
764
|
}
|
|
751
765
|
function l(n, t, e, r, o, s, c) {
|
|
752
|
-
return
|
|
766
|
+
return L(t & e | ~t & r, n, t, o, s, c);
|
|
753
767
|
}
|
|
754
768
|
function f(n, t, e, r, o, s, c) {
|
|
755
|
-
return
|
|
769
|
+
return L(t & r | e & ~r, n, t, o, s, c);
|
|
756
770
|
}
|
|
757
771
|
function h(n, t, e, r, o, s, c) {
|
|
758
|
-
return
|
|
772
|
+
return L(t ^ e ^ r, n, t, o, s, c);
|
|
759
773
|
}
|
|
760
774
|
function d(n, t, e, r, o, s, c) {
|
|
761
|
-
return
|
|
775
|
+
return L(e ^ (t | ~r), n, t, o, s, c);
|
|
762
776
|
}
|
|
763
777
|
function E(n, t) {
|
|
764
778
|
var e = (65535 & n) + (65535 & t);
|
|
765
779
|
return (n >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
|
|
766
780
|
}
|
|
767
|
-
function
|
|
781
|
+
function wt(n, t) {
|
|
768
782
|
return n << t | n >>> 32 - t;
|
|
769
783
|
}
|
|
770
|
-
function
|
|
784
|
+
function Kt(n) {
|
|
771
785
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
|
|
772
786
|
}
|
|
773
|
-
function
|
|
774
|
-
return n ? `https://www.gravatar.com/avatar/${
|
|
787
|
+
function Zt(n, t = "mp") {
|
|
788
|
+
return n ? `https://www.gravatar.com/avatar/${ht(n)}?d=${t}` : "";
|
|
775
789
|
}
|
|
776
|
-
function
|
|
790
|
+
function Vt(n) {
|
|
777
791
|
(typeof n == "number" || typeof n == "string") && (n = new Date(n));
|
|
778
792
|
let t = n.getHours(), e = "AM";
|
|
779
793
|
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${n.getFullYear()}-${(n.getMonth() + 1).toString().padStart(2, "0")}-${n.getDate().toString().padStart(2, "0")}, ${t}:${n.getMinutes().toString().padStart(2, "0")} ${e}`;
|
|
780
794
|
}
|
|
781
|
-
function
|
|
795
|
+
function Et(n) {
|
|
782
796
|
return new Promise((t) => setTimeout(t, n));
|
|
783
797
|
}
|
|
784
|
-
async function
|
|
798
|
+
async function Xt(n, t = 100) {
|
|
785
799
|
for (; n(); )
|
|
786
|
-
await
|
|
800
|
+
await Et(t);
|
|
787
801
|
}
|
|
788
|
-
function
|
|
802
|
+
function Qt(n) {
|
|
789
803
|
return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
|
|
790
804
|
}
|
|
791
|
-
function
|
|
805
|
+
function _t() {
|
|
792
806
|
return Object.keys({});
|
|
793
807
|
}
|
|
794
808
|
export {
|
|
795
|
-
|
|
796
|
-
|
|
809
|
+
A as ASet,
|
|
810
|
+
Q as BadGatewayError,
|
|
797
811
|
Y as BadRequestError,
|
|
798
812
|
kt as CliBackground,
|
|
799
|
-
|
|
800
|
-
|
|
813
|
+
S as CliEffects,
|
|
814
|
+
$ as CliForeground,
|
|
801
815
|
p as CustomError,
|
|
802
|
-
|
|
803
|
-
|
|
816
|
+
z as ForbiddenError,
|
|
817
|
+
tt as GatewayTimeoutError,
|
|
804
818
|
q as Http,
|
|
805
|
-
|
|
819
|
+
V as InternalServerError,
|
|
806
820
|
U as JSONAttemptParse,
|
|
807
|
-
|
|
808
|
-
|
|
821
|
+
bt as JSONSanitize,
|
|
822
|
+
lt as LOG_LEVEL,
|
|
809
823
|
P as Logger,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
824
|
+
K as MethodNotAllowedError,
|
|
825
|
+
Z as NotAcceptableError,
|
|
826
|
+
J as NotFoundError,
|
|
827
|
+
X as NotImplementedError,
|
|
828
|
+
W as PaymentRequiredError,
|
|
815
829
|
m as PromiseProgress,
|
|
816
|
-
|
|
817
|
-
|
|
830
|
+
_ as ServiceUnavailableError,
|
|
831
|
+
v as TypedEmitter,
|
|
818
832
|
H as UnauthorizedError,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
+
Rt as addUnique,
|
|
834
|
+
Ot as arrayDiff,
|
|
835
|
+
$t as caseInsensitiveSort,
|
|
836
|
+
ot as clean,
|
|
837
|
+
Nt as csv,
|
|
838
|
+
Gt as dec2Frac,
|
|
839
|
+
xt as deepCopy,
|
|
840
|
+
st as deepMerge,
|
|
841
|
+
x as dotNotation,
|
|
842
|
+
Tt as downloadFile,
|
|
843
|
+
at as downloadUrl,
|
|
844
|
+
Bt as encodeQuery,
|
|
845
|
+
jt as errorFromCode,
|
|
846
|
+
It as fileBrowser,
|
|
847
|
+
Lt as findByProp,
|
|
833
848
|
ct as flattenArr,
|
|
834
|
-
|
|
835
|
-
|
|
849
|
+
F as flattenObj,
|
|
850
|
+
St as formData,
|
|
836
851
|
qt as formatBytes,
|
|
837
|
-
|
|
852
|
+
Vt as formatDate,
|
|
838
853
|
Pt as formatPhoneNumber,
|
|
839
|
-
|
|
840
|
-
|
|
854
|
+
Ut as fracToDec,
|
|
855
|
+
Zt as gravatar,
|
|
841
856
|
G as includes,
|
|
842
857
|
Ft as insertAt,
|
|
843
858
|
b as isEqual,
|
|
844
|
-
|
|
859
|
+
ut as makeArray,
|
|
845
860
|
it as makeUnique,
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
861
|
+
zt as matchAll,
|
|
862
|
+
ht as md5,
|
|
863
|
+
At as mixin,
|
|
864
|
+
vt as pad,
|
|
865
|
+
Jt as parseUrl,
|
|
866
|
+
Yt as randomHex,
|
|
852
867
|
Ht as randomString,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
868
|
+
Wt as randomStringBuilder,
|
|
869
|
+
Et as sleep,
|
|
870
|
+
Xt as sleepUntil,
|
|
871
|
+
Ct as sortByProp,
|
|
872
|
+
Qt as timeUntil,
|
|
873
|
+
Mt as timestampFilename,
|
|
874
|
+
_t as tyoeKeys,
|
|
875
|
+
Dt as uploadWithProgress,
|
|
876
|
+
Kt as validateEmail
|
|
862
877
|
};
|
|
863
878
|
//# sourceMappingURL=index.mjs.map
|