@ztimson/utils 0.15.6 → 0.16.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 +91 -0
- package/dist/array.d.ts +47 -2
- package/dist/files.d.ts +33 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +145 -149
- package/dist/index.mjs.map +1 -1
- package/dist/misc.d.ts +0 -19
- package/dist/objects.d.ts +34 -8
- package/dist/promise-progress.d.ts +20 -0
- package/dist/string.d.ts +60 -4
- package/dist/time.d.ts +8 -0
- package/dist/types.d.ts +18 -0
- package/package.json +4 -1
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ function rt(n, t = !1) {
|
|
|
9
9
|
}), n;
|
|
10
10
|
}
|
|
11
11
|
function mt(n) {
|
|
12
|
-
return
|
|
12
|
+
return structuredClone(n);
|
|
13
13
|
}
|
|
14
14
|
function ot(n, ...t) {
|
|
15
15
|
return t.forEach((e) => {
|
|
@@ -17,7 +17,7 @@ function ot(n, ...t) {
|
|
|
17
17
|
e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ot(n[r], e[r])) : n[r] = e[r];
|
|
18
18
|
}), n;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function A(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,6 +28,11 @@ function S(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 xt(n) {
|
|
32
|
+
return Object.entries(n).map(
|
|
33
|
+
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
34
|
+
).join("&");
|
|
35
|
+
}
|
|
31
36
|
function st(n, t, e = {}) {
|
|
32
37
|
if (typeof n == "object" && !Array.isArray(n)) {
|
|
33
38
|
for (const r of Object.keys(n)) {
|
|
@@ -37,7 +42,7 @@ function st(n, t, e = {}) {
|
|
|
37
42
|
return e;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
|
-
function
|
|
45
|
+
function Bt(n) {
|
|
41
46
|
const t = new FormData();
|
|
42
47
|
return Object.entries(n).forEach(([e, r]) => t.append(e, r)), t;
|
|
43
48
|
}
|
|
@@ -53,7 +58,7 @@ function b(n, t) {
|
|
|
53
58
|
const e = typeof n, r = typeof t;
|
|
54
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]));
|
|
55
60
|
}
|
|
56
|
-
function
|
|
61
|
+
function St(n, t) {
|
|
57
62
|
t.forEach((e) => {
|
|
58
63
|
Object.getOwnPropertyNames(e.prototype).forEach((r) => {
|
|
59
64
|
Object.defineProperty(
|
|
@@ -73,24 +78,19 @@ function U(n) {
|
|
|
73
78
|
}
|
|
74
79
|
function At(n, t) {
|
|
75
80
|
let e = [];
|
|
76
|
-
return JSON.
|
|
81
|
+
return JSON.stringify(n, (r, o) => {
|
|
77
82
|
if (typeof o == "object" && o !== null) {
|
|
78
83
|
if (e.includes(o))
|
|
79
84
|
return;
|
|
80
85
|
e.push(o);
|
|
81
86
|
}
|
|
82
87
|
return o;
|
|
83
|
-
}, t)
|
|
88
|
+
}, t);
|
|
84
89
|
}
|
|
85
|
-
function bt(n) {
|
|
86
|
-
return Object.entries(n).map(
|
|
87
|
-
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
88
|
-
).join("&");
|
|
89
|
-
}
|
|
90
|
-
function Rt(n, t) {
|
|
90
|
+
function bt(n, t) {
|
|
91
91
|
return n.indexOf(t) === -1 && n.push(t), n;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Rt(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)))
|
|
@@ -98,31 +98,31 @@ function Ot(n, t) {
|
|
|
98
98
|
}
|
|
99
99
|
function Lt(n) {
|
|
100
100
|
return function(t, e) {
|
|
101
|
-
const r =
|
|
101
|
+
const r = A(t, n), o = A(e, n);
|
|
102
102
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
function Ot(n, t) {
|
|
106
|
+
return (e) => b(A(e, n), t);
|
|
107
|
+
}
|
|
105
108
|
function ct(n, t = []) {
|
|
106
109
|
return n.forEach((e) => Array.isArray(e) ? ct(e, t) : t.push(e)), t;
|
|
107
110
|
}
|
|
108
|
-
function
|
|
111
|
+
function $t(n, t = !1) {
|
|
109
112
|
return function(e, r) {
|
|
110
|
-
const o =
|
|
113
|
+
const o = A(e, n), s = A(r, n);
|
|
111
114
|
return typeof o == "number" && typeof s == "number" ? (t ? -1 : 1) * (o - s) : o > s ? t ? -1 : 1 : o < s ? t ? 1 : -1 : 0;
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
|
-
function Ct(n, t) {
|
|
115
|
-
return (e) => b(e[n], t);
|
|
116
|
-
}
|
|
117
117
|
function it(n) {
|
|
118
118
|
for (let t = n.length - 1; t >= 0; t--)
|
|
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 Ct(n) {
|
|
123
123
|
return Array.isArray(n) ? n : [n];
|
|
124
124
|
}
|
|
125
|
-
class
|
|
125
|
+
class S extends Array {
|
|
126
126
|
/** Number of elements in set */
|
|
127
127
|
get size() {
|
|
128
128
|
return this.length;
|
|
@@ -155,7 +155,7 @@ class A extends Array {
|
|
|
155
155
|
* @return {ASet<T>} Different elements
|
|
156
156
|
*/
|
|
157
157
|
difference(t) {
|
|
158
|
-
return new
|
|
158
|
+
return new S(this.filter((e) => !t.has(e)));
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Check if set includes element
|
|
@@ -171,7 +171,7 @@ class A extends Array {
|
|
|
171
171
|
* @return {boolean} Set of common elements
|
|
172
172
|
*/
|
|
173
173
|
intersection(t) {
|
|
174
|
-
return new
|
|
174
|
+
return new S(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 A extends Array {
|
|
|
203
203
|
* @return {ASet<T>} New set of unique elements
|
|
204
204
|
*/
|
|
205
205
|
symmetricDifference(t) {
|
|
206
|
-
return new
|
|
206
|
+
return new S([...this.difference(t), ...t.difference(this)]);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Create joined list of elements included in this & the comparison set
|
|
@@ -211,7 +211,7 @@ class A extends Array {
|
|
|
211
211
|
* @return {ASet<T>} New set of both previous sets combined
|
|
212
212
|
*/
|
|
213
213
|
union(t) {
|
|
214
|
-
return new
|
|
214
|
+
return new S([...this, ...t]);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
class m extends Promise {
|
|
@@ -251,15 +251,15 @@ class m extends Promise {
|
|
|
251
251
|
return this.from(super.finally(e));
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function ut(n, t) {
|
|
255
255
|
const e = document.createElement("a");
|
|
256
|
-
e.href = n, e.download = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
256
|
+
e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Nt(n, t) {
|
|
259
259
|
const e = URL.createObjectURL(n);
|
|
260
|
-
|
|
260
|
+
ut(e, t), URL.revokeObjectURL(e);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Tt(n = {}) {
|
|
263
263
|
return new Promise((t) => {
|
|
264
264
|
const e = document.createElement("input");
|
|
265
265
|
e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
|
|
@@ -267,7 +267,12 @@ function It(n = {}) {
|
|
|
267
267
|
}, document.body.appendChild(e), e.click();
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function It(n, t = /* @__PURE__ */ new Date()) {
|
|
271
|
+
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
272
|
+
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
|
+
return n ? n.replace("{{TIMESTAMP}}", e) : e;
|
|
274
|
+
}
|
|
275
|
+
function Mt(n) {
|
|
271
276
|
return new m((t, e, r) => {
|
|
272
277
|
const o = new XMLHttpRequest(), s = new FormData();
|
|
273
278
|
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);
|
|
@@ -343,7 +348,7 @@ class p extends Error {
|
|
|
343
348
|
}
|
|
344
349
|
}
|
|
345
350
|
i(p, "code", 500);
|
|
346
|
-
class
|
|
351
|
+
class Y extends p {
|
|
347
352
|
constructor(t = "Bad Request") {
|
|
348
353
|
super(t);
|
|
349
354
|
}
|
|
@@ -351,8 +356,8 @@ class v extends p {
|
|
|
351
356
|
return t.constructor.code == this.code;
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
|
-
i(
|
|
355
|
-
class
|
|
359
|
+
i(Y, "code", 400);
|
|
360
|
+
class H extends p {
|
|
356
361
|
constructor(t = "Unauthorized") {
|
|
357
362
|
super(t);
|
|
358
363
|
}
|
|
@@ -360,8 +365,8 @@ class Y extends p {
|
|
|
360
365
|
return t.constructor.code == this.code;
|
|
361
366
|
}
|
|
362
367
|
}
|
|
363
|
-
i(
|
|
364
|
-
class
|
|
368
|
+
i(H, "code", 401);
|
|
369
|
+
class v extends p {
|
|
365
370
|
constructor(t = "Payment Required") {
|
|
366
371
|
super(t);
|
|
367
372
|
}
|
|
@@ -369,7 +374,7 @@ class H extends p {
|
|
|
369
374
|
return t.constructor.code == this.code;
|
|
370
375
|
}
|
|
371
376
|
}
|
|
372
|
-
i(
|
|
377
|
+
i(v, "code", 402);
|
|
373
378
|
class W extends p {
|
|
374
379
|
constructor(t = "Forbidden") {
|
|
375
380
|
super(t);
|
|
@@ -456,11 +461,11 @@ function Dt(n, t) {
|
|
|
456
461
|
return null;
|
|
457
462
|
switch (n) {
|
|
458
463
|
case 400:
|
|
459
|
-
return new v(t);
|
|
460
|
-
case 401:
|
|
461
464
|
return new Y(t);
|
|
462
|
-
case
|
|
465
|
+
case 401:
|
|
463
466
|
return new H(t);
|
|
467
|
+
case 402:
|
|
468
|
+
return new v(t);
|
|
464
469
|
case 403:
|
|
465
470
|
return new W(t);
|
|
466
471
|
case 404:
|
|
@@ -522,29 +527,29 @@ const w = class w {
|
|
|
522
527
|
headers: r,
|
|
523
528
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
524
529
|
body: t.body
|
|
525
|
-
}).then(async (
|
|
526
|
-
var
|
|
527
|
-
for (let
|
|
528
|
-
await new Promise((
|
|
529
|
-
const R =
|
|
530
|
-
let
|
|
531
|
-
const
|
|
532
|
-
start(
|
|
533
|
-
function
|
|
534
|
-
|
|
530
|
+
}).then(async (u) => {
|
|
531
|
+
var k, j;
|
|
532
|
+
for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
|
|
533
|
+
await new Promise((L) => a(u, () => L()));
|
|
534
|
+
const R = u.headers.get("Content-Length"), C = R ? parseInt(R, 10) : 0;
|
|
535
|
+
let D = 0;
|
|
536
|
+
const N = (k = u.body) == null ? void 0 : k.getReader(), tt = new ReadableStream({
|
|
537
|
+
start(a) {
|
|
538
|
+
function L() {
|
|
539
|
+
N == null || N.read().then((x) => {
|
|
535
540
|
if (x.done)
|
|
536
|
-
return
|
|
537
|
-
|
|
538
|
-
}).catch((x) =>
|
|
541
|
+
return a.close();
|
|
542
|
+
D += x.value.byteLength, y(D / C), a.enqueue(x.value), L();
|
|
543
|
+
}).catch((x) => a.error(x));
|
|
539
544
|
}
|
|
540
|
-
|
|
545
|
+
L();
|
|
541
546
|
}
|
|
542
547
|
});
|
|
543
|
-
if (
|
|
544
|
-
const
|
|
545
|
-
|
|
548
|
+
if (u.data = new Response(tt), t.decode == null || t.decode) {
|
|
549
|
+
const a = (j = u.headers.get("Content-Type")) == null ? void 0 : j.toLowerCase();
|
|
550
|
+
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());
|
|
546
551
|
}
|
|
547
|
-
|
|
552
|
+
u.ok ? s(u) : c(u);
|
|
548
553
|
});
|
|
549
554
|
});
|
|
550
555
|
}
|
|
@@ -559,7 +564,7 @@ const B = {
|
|
|
559
564
|
BLINK: "\x1B[5m",
|
|
560
565
|
REVERSE: "\x1B[7m",
|
|
561
566
|
HIDDEN: "\x1B[8m"
|
|
562
|
-
},
|
|
567
|
+
}, O = {
|
|
563
568
|
BLACK: "\x1B[30m",
|
|
564
569
|
RED: "\x1B[31m",
|
|
565
570
|
GREEN: "\x1B[32m",
|
|
@@ -587,7 +592,7 @@ const B = {
|
|
|
587
592
|
WHITE: "\x1B[47m",
|
|
588
593
|
GREY: "\x1B[100m"
|
|
589
594
|
};
|
|
590
|
-
var
|
|
595
|
+
var at = /* @__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))(at || {});
|
|
591
596
|
const g = class g extends F {
|
|
592
597
|
constructor(t) {
|
|
593
598
|
super(), this.namespace = t;
|
|
@@ -607,7 +612,7 @@ const g = class g extends F {
|
|
|
607
612
|
if (g.LOG_LEVEL < 4)
|
|
608
613
|
return;
|
|
609
614
|
const e = this.format(...t);
|
|
610
|
-
g.emit(4, e), console.debug(
|
|
615
|
+
g.emit(4, e), console.debug(O.LIGHT_GREY + e + B.CLEAR);
|
|
611
616
|
}
|
|
612
617
|
log(...t) {
|
|
613
618
|
if (g.LOG_LEVEL < 3)
|
|
@@ -619,39 +624,37 @@ const g = class g extends F {
|
|
|
619
624
|
if (g.LOG_LEVEL < 2)
|
|
620
625
|
return;
|
|
621
626
|
const e = this.format(...t);
|
|
622
|
-
g.emit(2, e), console.info(
|
|
627
|
+
g.emit(2, e), console.info(O.BLUE + e + B.CLEAR);
|
|
623
628
|
}
|
|
624
629
|
warn(...t) {
|
|
625
630
|
if (g.LOG_LEVEL < 1)
|
|
626
631
|
return;
|
|
627
632
|
const e = this.format(...t);
|
|
628
|
-
g.emit(1, e), console.warn(
|
|
633
|
+
g.emit(1, e), console.warn(O.YELLOW + e + B.CLEAR);
|
|
629
634
|
}
|
|
630
635
|
error(...t) {
|
|
631
636
|
if (g.LOG_LEVEL < 0)
|
|
632
637
|
return;
|
|
633
638
|
const e = this.format(...t);
|
|
634
|
-
g.emit(0, e), console.error(
|
|
639
|
+
g.emit(0, e), console.error(O.RED + e + B.CLEAR);
|
|
635
640
|
}
|
|
636
641
|
};
|
|
637
642
|
i(g, "LOG_LEVEL", 4);
|
|
638
643
|
let P = g;
|
|
639
|
-
function
|
|
640
|
-
const t = (y,
|
|
644
|
+
function jt(n) {
|
|
645
|
+
const t = (y, u) => u < 1e-7 ? y : t(u, ~~(y % u)), e = n.toString().length - 2;
|
|
641
646
|
let r = Math.pow(10, e), o = n * r;
|
|
642
647
|
const s = t(o, r);
|
|
643
648
|
o = ~~(o / s), r = ~~(r / s);
|
|
644
649
|
const c = ~~(o / r);
|
|
645
650
|
return o -= c * r, `${c ? c + " " : ""}${~~o}/${~~r}`;
|
|
646
651
|
}
|
|
647
|
-
function
|
|
652
|
+
function Gt(n) {
|
|
648
653
|
let t = n.split(" ");
|
|
649
654
|
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
650
655
|
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
651
656
|
}
|
|
652
|
-
|
|
653
|
-
return n.length - n.replaceAll(t, "").length;
|
|
654
|
-
}
|
|
657
|
+
const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", M = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", lt = T + I + M;
|
|
655
658
|
function Ut(n) {
|
|
656
659
|
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
657
660
|
}
|
|
@@ -661,7 +664,6 @@ function qt(n, t = 2) {
|
|
|
661
664
|
const e = 1024, r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = Math.floor(Math.log(n) / Math.log(e));
|
|
662
665
|
return parseFloat((n / Math.pow(e, o)).toFixed(t)) + " " + r[o];
|
|
663
666
|
}
|
|
664
|
-
const I = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", $ = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", lt = I + $ + D;
|
|
665
667
|
function Pt(n) {
|
|
666
668
|
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
|
|
667
669
|
if (!t)
|
|
@@ -671,27 +673,23 @@ function Pt(n) {
|
|
|
671
673
|
function Ft(n, t, e) {
|
|
672
674
|
return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
|
|
673
675
|
}
|
|
674
|
-
function
|
|
675
|
-
|
|
676
|
-
if (s <= 0)
|
|
677
|
-
return o;
|
|
678
|
-
const c = Array(~~(s / e.length)).fill(e).join("");
|
|
679
|
-
return r ? c + o : o + c;
|
|
676
|
+
function Yt(n, t, e = " ", r = !0) {
|
|
677
|
+
return r ? n.toString().padStart(t, e) : n.toString().padEnd(t, e);
|
|
680
678
|
}
|
|
681
|
-
function
|
|
679
|
+
function Ht(n, t = lt) {
|
|
682
680
|
return Array(n).fill(null).map(() => {
|
|
683
681
|
const e = ~~(Math.random() * t.length);
|
|
684
682
|
return t[e];
|
|
685
683
|
}).join("");
|
|
686
684
|
}
|
|
687
|
-
function
|
|
685
|
+
function vt(n, t = !1, e = !1, r = !1) {
|
|
688
686
|
if (!t && !e && !r)
|
|
689
687
|
throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
690
688
|
return Array(n).fill(null).map(() => {
|
|
691
689
|
let o;
|
|
692
690
|
do {
|
|
693
691
|
const s = ~~(Math.random() * 3);
|
|
694
|
-
t && s == 0 ? o =
|
|
692
|
+
t && s == 0 ? o = T[~~(Math.random() * T.length)] : e && s == 1 ? o = I[~~(Math.random() * I.length)] : r && s == 2 && (o = M[~~(Math.random() * M.length)]);
|
|
695
693
|
} while (!o);
|
|
696
694
|
return o;
|
|
697
695
|
}).join("");
|
|
@@ -704,11 +702,25 @@ function Wt(n, t) {
|
|
|
704
702
|
e.push(r);
|
|
705
703
|
return e;
|
|
706
704
|
}
|
|
707
|
-
function
|
|
708
|
-
|
|
709
|
-
|
|
705
|
+
function zt(n) {
|
|
706
|
+
const t = new RegExp(
|
|
707
|
+
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
708
|
+
"gm"
|
|
709
|
+
).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
|
|
710
|
+
if (e.port != null && (e.port = Number(e.port)), r.length > 2 && (e.domain = r.splice(-2, 2).join("."), e.subdomain = r.join(".")), e.query) {
|
|
711
|
+
const o = e.query.split("&"), s = {};
|
|
712
|
+
o.forEach((c) => {
|
|
713
|
+
const [y, u] = c.split("=");
|
|
714
|
+
s[y] = u;
|
|
715
|
+
}), e.query = s;
|
|
716
|
+
}
|
|
717
|
+
return e;
|
|
710
718
|
}
|
|
711
719
|
function ft(n) {
|
|
720
|
+
var t = ht(pt(yt(dt(n), 8 * n.length)));
|
|
721
|
+
return t.toLowerCase();
|
|
722
|
+
}
|
|
723
|
+
function ht(n) {
|
|
712
724
|
for (var t, e = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
|
|
713
725
|
t = n.charCodeAt(o), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
714
726
|
return r;
|
|
@@ -728,25 +740,25 @@ function pt(n) {
|
|
|
728
740
|
function yt(n, t) {
|
|
729
741
|
n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
|
|
730
742
|
for (var e = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < n.length; c += 16) {
|
|
731
|
-
var y = e,
|
|
732
|
-
r = d(r = d(r = d(r = d(r =
|
|
743
|
+
var y = e, u = r, R = o, C = s;
|
|
744
|
+
r = d(r = d(r = d(r = d(r = h(r = h(r = h(r = h(r = f(r = f(r = f(r = f(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s, e = l(e, r, o, s, n[c + 0], 7, -680876936), r, o, n[c + 1], 12, -389564586), e, r, n[c + 2], 17, 606105819), s, e, n[c + 3], 22, -1044525330), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 4], 7, -176418897), r, o, n[c + 5], 12, 1200080426), e, r, n[c + 6], 17, -1473231341), s, e, n[c + 7], 22, -45705983), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 8], 7, 1770035416), r, o, n[c + 9], 12, -1958414417), e, r, n[c + 10], 17, -42063), s, e, n[c + 11], 22, -1990404162), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 12], 7, 1804603682), r, o, n[c + 13], 12, -40341101), e, r, n[c + 14], 17, -1502002290), s, e, n[c + 15], 22, 1236535329), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 1], 5, -165796510), r, o, n[c + 6], 9, -1069501632), e, r, n[c + 11], 14, 643717713), s, e, n[c + 0], 20, -373897302), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 5], 5, -701558691), r, o, n[c + 10], 9, 38016083), e, r, n[c + 15], 14, -660478335), s, e, n[c + 4], 20, -405537848), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 9], 5, 568446438), r, o, n[c + 14], 9, -1019803690), e, r, n[c + 3], 14, -187363961), s, e, n[c + 8], 20, 1163531501), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 13], 5, -1444681467), r, o, n[c + 2], 9, -51403784), e, r, n[c + 7], 14, 1735328473), s, e, n[c + 12], 20, -1926607734), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 5], 4, -378558), r, o, n[c + 8], 11, -2022574463), e, r, n[c + 11], 16, 1839030562), s, e, n[c + 14], 23, -35309556), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 1], 4, -1530992060), r, o, n[c + 4], 11, 1272893353), e, r, n[c + 7], 16, -155497632), s, e, n[c + 10], 23, -1094730640), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 13], 4, 681279174), r, o, n[c + 0], 11, -358537222), e, r, n[c + 3], 16, -722521979), s, e, n[c + 6], 23, 76029189), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 9], 4, -640364487), r, o, n[c + 12], 11, -421815835), e, r, n[c + 15], 16, 530742520), s, e, n[c + 2], 23, -995338651), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 0], 6, -198630844), r, o, n[c + 7], 10, 1126891415), e, r, n[c + 14], 15, -1416354905), s, e, n[c + 5], 21, -57434055), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 12], 6, 1700485571), r, o, n[c + 3], 10, -1894986606), e, r, n[c + 10], 15, -1051523), s, e, n[c + 1], 21, -2054922799), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 8], 6, 1873313359), r, o, n[c + 15], 10, -30611744), e, r, n[c + 6], 15, -1560198380), s, e, n[c + 13], 21, 1309151649), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 4], 6, -145523070), r, o, n[c + 11], 10, -1120210379), e, r, n[c + 2], 15, 718787259), s, e, n[c + 9], 21, -343485551), e = E(e, y), r = E(r, u), o = E(o, R), s = E(s, C);
|
|
733
745
|
}
|
|
734
746
|
return Array(e, r, o, s);
|
|
735
747
|
}
|
|
736
|
-
function
|
|
748
|
+
function $(n, t, e, r, o, s) {
|
|
737
749
|
return E(gt(E(E(t, n), E(r, s)), o), e);
|
|
738
750
|
}
|
|
739
751
|
function l(n, t, e, r, o, s, c) {
|
|
740
|
-
return
|
|
741
|
-
}
|
|
742
|
-
function h(n, t, e, r, o, s, c) {
|
|
743
|
-
return C(t & r | e & ~r, n, t, o, s, c);
|
|
752
|
+
return $(t & e | ~t & r, n, t, o, s, c);
|
|
744
753
|
}
|
|
745
754
|
function f(n, t, e, r, o, s, c) {
|
|
746
|
-
return
|
|
755
|
+
return $(t & r | e & ~r, n, t, o, s, c);
|
|
756
|
+
}
|
|
757
|
+
function h(n, t, e, r, o, s, c) {
|
|
758
|
+
return $(t ^ e ^ r, n, t, o, s, c);
|
|
747
759
|
}
|
|
748
760
|
function d(n, t, e, r, o, s, c) {
|
|
749
|
-
return
|
|
761
|
+
return $(e ^ (t | ~r), n, t, o, s, c);
|
|
750
762
|
}
|
|
751
763
|
function E(n, t) {
|
|
752
764
|
var e = (65535 & n) + (65535 & t);
|
|
@@ -755,36 +767,16 @@ function E(n, t) {
|
|
|
755
767
|
function gt(n, t) {
|
|
756
768
|
return n << t | n >>> 32 - t;
|
|
757
769
|
}
|
|
758
|
-
function
|
|
770
|
+
function Jt(n) {
|
|
759
771
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
|
|
760
772
|
}
|
|
761
|
-
function
|
|
762
|
-
return n ? `https://www.gravatar.com/avatar/${
|
|
763
|
-
}
|
|
764
|
-
function Kt(n) {
|
|
765
|
-
const t = new RegExp(
|
|
766
|
-
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
767
|
-
"gm"
|
|
768
|
-
).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
|
|
769
|
-
if (e.port != null && (e.port = Number(e.port)), r.length > 2 && (e.domain = r.splice(-2, 2).join("."), e.subdomain = r.join(".")), e.query) {
|
|
770
|
-
const o = e.query.split("&"), s = {};
|
|
771
|
-
o.forEach((c) => {
|
|
772
|
-
const [y, a] = c.split("=");
|
|
773
|
-
s[y] = a;
|
|
774
|
-
}), e.query = s;
|
|
775
|
-
}
|
|
776
|
-
return e;
|
|
773
|
+
function Kt(n, t = "mp") {
|
|
774
|
+
return n ? `https://www.gravatar.com/avatar/${ft(n)}?d=${t}` : "";
|
|
777
775
|
}
|
|
778
776
|
function Zt(n) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
month: "short",
|
|
783
|
-
day: "numeric",
|
|
784
|
-
hour: "numeric",
|
|
785
|
-
minute: "numeric",
|
|
786
|
-
hour12: !0
|
|
787
|
-
}).format(t);
|
|
777
|
+
(typeof n == "number" || typeof n == "string") && (n = new Date(n));
|
|
778
|
+
let t = n.getHours(), e = "AM";
|
|
779
|
+
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}`;
|
|
788
780
|
}
|
|
789
781
|
function wt(n) {
|
|
790
782
|
return new Promise((t) => setTimeout(t, n));
|
|
@@ -796,72 +788,76 @@ async function Vt(n, t = 100) {
|
|
|
796
788
|
function Xt(n) {
|
|
797
789
|
return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
|
|
798
790
|
}
|
|
791
|
+
function Qt() {
|
|
792
|
+
return Object.keys({});
|
|
793
|
+
}
|
|
799
794
|
export {
|
|
800
|
-
|
|
795
|
+
S as ASet,
|
|
801
796
|
X as BadGatewayError,
|
|
802
|
-
|
|
797
|
+
Y as BadRequestError,
|
|
803
798
|
kt as CliBackground,
|
|
804
799
|
B as CliEffects,
|
|
805
|
-
|
|
800
|
+
O as CliForeground,
|
|
806
801
|
p as CustomError,
|
|
807
802
|
W as ForbiddenError,
|
|
808
803
|
_ as GatewayTimeoutError,
|
|
809
804
|
q as Http,
|
|
810
805
|
Z as InternalServerError,
|
|
811
806
|
U as JSONAttemptParse,
|
|
812
|
-
At as
|
|
813
|
-
|
|
807
|
+
At as JSONSanitize,
|
|
808
|
+
at as LOG_LEVEL,
|
|
814
809
|
P as Logger,
|
|
815
810
|
J as MethodNotAllowedError,
|
|
816
811
|
K as NotAcceptableError,
|
|
817
812
|
z as NotFoundError,
|
|
818
813
|
V as NotImplementedError,
|
|
819
|
-
|
|
814
|
+
v as PaymentRequiredError,
|
|
820
815
|
m as PromiseProgress,
|
|
821
816
|
Q as ServiceUnavailableError,
|
|
822
817
|
F as TypedEmitter,
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
818
|
+
H as UnauthorizedError,
|
|
819
|
+
bt as addUnique,
|
|
820
|
+
Rt as arrayDiff,
|
|
826
821
|
Lt as caseInsensitiveSort,
|
|
827
822
|
rt as clean,
|
|
828
|
-
|
|
829
|
-
Ut as createHex,
|
|
830
|
-
Mt as dec2Frac,
|
|
823
|
+
jt as dec2Frac,
|
|
831
824
|
mt as deepCopy,
|
|
832
825
|
ot as deepMerge,
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
826
|
+
A as dotNotation,
|
|
827
|
+
ut as download,
|
|
828
|
+
Nt as downloadBlob,
|
|
829
|
+
xt as encodeQuery,
|
|
836
830
|
Dt as errorFromCode,
|
|
837
|
-
|
|
838
|
-
|
|
831
|
+
Tt as fileBrowser,
|
|
832
|
+
Ot as findByProp,
|
|
839
833
|
ct as flattenArr,
|
|
840
834
|
st as flattenObj,
|
|
841
|
-
|
|
835
|
+
Bt as formData,
|
|
842
836
|
qt as formatBytes,
|
|
843
837
|
Zt as formatDate,
|
|
844
838
|
Pt as formatPhoneNumber,
|
|
845
|
-
|
|
846
|
-
|
|
839
|
+
Gt as fracToDec,
|
|
840
|
+
Kt as gravatar,
|
|
847
841
|
G as includes,
|
|
848
842
|
Ft as insertAt,
|
|
849
843
|
b as isEqual,
|
|
850
|
-
|
|
844
|
+
Ct as makeArray,
|
|
851
845
|
it as makeUnique,
|
|
852
846
|
Wt as matchAll,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
847
|
+
ft as md5,
|
|
848
|
+
St as mixin,
|
|
849
|
+
Yt as pad,
|
|
850
|
+
zt as parseUrl,
|
|
851
|
+
Ut as randomHex,
|
|
852
|
+
Ht as randomString,
|
|
853
|
+
vt as randomStringBuilder,
|
|
858
854
|
wt as sleep,
|
|
859
855
|
Vt as sleepUntil,
|
|
860
|
-
|
|
856
|
+
$t as sortByProp,
|
|
861
857
|
Xt as timeUntil,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
858
|
+
It as timestampFilename,
|
|
859
|
+
Qt as tyoeKeys,
|
|
860
|
+
Mt as uploadWithProgress,
|
|
861
|
+
Jt as validateEmail
|
|
866
862
|
};
|
|
867
863
|
//# sourceMappingURL=index.mjs.map
|