@ztimson/utils 0.20.1 → 0.20.3
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/cache.d.ts +4 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +310 -300
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
|
-
var it = (
|
|
3
|
-
var c = (
|
|
4
|
-
function ot(
|
|
5
|
-
if (
|
|
6
|
-
return Array.isArray(
|
|
7
|
-
(t &&
|
|
8
|
-
}),
|
|
9
|
-
}
|
|
10
|
-
function xt(
|
|
11
|
-
return structuredClone(
|
|
12
|
-
}
|
|
13
|
-
function ct(
|
|
2
|
+
var it = (r, t, e) => t in r ? st(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function ot(r, t = !1) {
|
|
5
|
+
if (r == null) throw new Error("Cannot clean a NULL value");
|
|
6
|
+
return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, n]) => {
|
|
7
|
+
(t && n === void 0 || !t && n == null) && delete r[e];
|
|
8
|
+
}), r;
|
|
9
|
+
}
|
|
10
|
+
function xt(r) {
|
|
11
|
+
return structuredClone(r);
|
|
12
|
+
}
|
|
13
|
+
function ct(r, ...t) {
|
|
14
14
|
return t.forEach((e) => {
|
|
15
|
-
for (const
|
|
16
|
-
e[
|
|
17
|
-
}),
|
|
18
|
-
}
|
|
19
|
-
function B(
|
|
20
|
-
if (!(
|
|
21
|
-
return t.split(/[.[\]]/g).filter((
|
|
22
|
-
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(
|
|
15
|
+
for (const n in e)
|
|
16
|
+
e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), ct(r[n], e[n])) : r[n] = e[n];
|
|
17
|
+
}), r;
|
|
18
|
+
}
|
|
19
|
+
function B(r, t, e) {
|
|
20
|
+
if (!(r == null || !t))
|
|
21
|
+
return t.split(/[.[\]]/g).filter((n) => n.length).reduce((n, s, i, o) => {
|
|
22
|
+
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(n != null && n.hasOwnProperty(s))) {
|
|
23
23
|
if (e == null) return;
|
|
24
|
-
|
|
24
|
+
n[s] = {};
|
|
25
25
|
}
|
|
26
|
-
return e !== void 0 && i == o.length - 1 ?
|
|
27
|
-
},
|
|
26
|
+
return e !== void 0 && i == o.length - 1 ? n[s] = e : n[s];
|
|
27
|
+
}, r);
|
|
28
28
|
}
|
|
29
|
-
function Bt(
|
|
30
|
-
return Object.entries(
|
|
29
|
+
function Bt(r) {
|
|
30
|
+
return Object.entries(r).map(
|
|
31
31
|
([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
|
|
32
32
|
).join("&");
|
|
33
33
|
}
|
|
34
|
-
function H(
|
|
35
|
-
if (typeof
|
|
36
|
-
for (const
|
|
37
|
-
const s = t ? t + "." +
|
|
38
|
-
typeof n
|
|
34
|
+
function H(r, t, e = {}) {
|
|
35
|
+
if (typeof r == "object" && !Array.isArray(r)) {
|
|
36
|
+
for (const n of Object.keys(r)) {
|
|
37
|
+
const s = t ? t + "." + n : n;
|
|
38
|
+
typeof r[n] == "object" ? H(r[n], s, e) : e[s] = r[n];
|
|
39
39
|
}
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function At(
|
|
43
|
+
function At(r) {
|
|
44
44
|
const t = new FormData();
|
|
45
|
-
return Object.entries(
|
|
45
|
+
return Object.entries(r).forEach(([e, n]) => t.append(e, n)), t;
|
|
46
46
|
}
|
|
47
|
-
function q(
|
|
48
|
-
if (
|
|
49
|
-
if (Array.isArray(t)) return t.findIndex((s, i) => !q(
|
|
50
|
-
const
|
|
51
|
-
return
|
|
47
|
+
function q(r, t, e = !1) {
|
|
48
|
+
if (r == null) return e;
|
|
49
|
+
if (Array.isArray(t)) return t.findIndex((s, i) => !q(r[i], t[i], e)) == -1;
|
|
50
|
+
const n = typeof t;
|
|
51
|
+
return n != typeof r ? !1 : n == "object" ? Object.keys(t).find((s) => !q(r[s], t[s], e)) == null : n == "function" ? r.toString() == t.toString() : r == t;
|
|
52
52
|
}
|
|
53
|
-
function O(
|
|
54
|
-
const e = typeof
|
|
55
|
-
return e != "object" ||
|
|
53
|
+
function O(r, t) {
|
|
54
|
+
const e = typeof r, n = typeof t;
|
|
55
|
+
return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? !1 : Object.keys(r).every((i) => O(r[i], t[i]));
|
|
56
56
|
}
|
|
57
|
-
function Rt(
|
|
57
|
+
function Rt(r, t) {
|
|
58
58
|
t.forEach((e) => {
|
|
59
|
-
Object.getOwnPropertyNames(e.prototype).forEach((
|
|
59
|
+
Object.getOwnPropertyNames(e.prototype).forEach((n) => {
|
|
60
60
|
Object.defineProperty(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Object.getOwnPropertyDescriptor(e.prototype,
|
|
61
|
+
r.prototype,
|
|
62
|
+
n,
|
|
63
|
+
Object.getOwnPropertyDescriptor(e.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function I(
|
|
68
|
+
function I(r) {
|
|
69
69
|
try {
|
|
70
|
-
return JSON.parse(
|
|
70
|
+
return JSON.parse(r);
|
|
71
71
|
} catch {
|
|
72
|
-
return
|
|
72
|
+
return r;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function Ot(
|
|
75
|
+
function Ot(r, t) {
|
|
76
76
|
let e = [];
|
|
77
|
-
return JSON.stringify(
|
|
77
|
+
return JSON.stringify(r, (n, s) => {
|
|
78
78
|
if (typeof s == "object" && s !== null) {
|
|
79
79
|
if (e.includes(s)) return;
|
|
80
80
|
e.push(s);
|
|
@@ -82,40 +82,40 @@ function Ot(n, t) {
|
|
|
82
82
|
return s;
|
|
83
83
|
}, t);
|
|
84
84
|
}
|
|
85
|
-
function $t(
|
|
86
|
-
return
|
|
85
|
+
function $t(r, t) {
|
|
86
|
+
return r.indexOf(t) === -1 && r.push(t), r;
|
|
87
87
|
}
|
|
88
|
-
function Ct(
|
|
88
|
+
function Ct(r, t) {
|
|
89
89
|
return at([
|
|
90
|
-
...
|
|
91
|
-
...t.filter((e) => !
|
|
90
|
+
...r.filter((e) => !t.includes((n) => O(e, n))),
|
|
91
|
+
...t.filter((e) => !r.includes((n) => O(e, n)))
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
94
|
-
function Lt(
|
|
94
|
+
function Lt(r) {
|
|
95
95
|
return function(t, e) {
|
|
96
|
-
const
|
|
97
|
-
return typeof
|
|
96
|
+
const n = B(t, r), s = B(e, r);
|
|
97
|
+
return typeof n != "string" || typeof s != "string" ? 1 : n.toLowerCase().localeCompare(s.toLowerCase());
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return (e) => O(B(e,
|
|
100
|
+
function Nt(r, t) {
|
|
101
|
+
return (e) => O(B(e, r), t);
|
|
102
102
|
}
|
|
103
|
-
function ut(
|
|
104
|
-
return
|
|
103
|
+
function ut(r, t = []) {
|
|
104
|
+
return r.forEach((e) => Array.isArray(e) ? ut(e, t) : t.push(e)), t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
return function(e,
|
|
108
|
-
const s = B(e,
|
|
106
|
+
function jt(r, t = !1) {
|
|
107
|
+
return function(e, n) {
|
|
108
|
+
const s = B(e, r), i = B(n, r);
|
|
109
109
|
return typeof s == "number" && typeof i == "number" ? (t ? -1 : 1) * (s - i) : s > i ? t ? -1 : 1 : s < i ? t ? 1 : -1 : 0;
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function at(
|
|
113
|
-
for (let t =
|
|
114
|
-
|
|
115
|
-
return
|
|
112
|
+
function at(r) {
|
|
113
|
+
for (let t = r.length - 1; t >= 0; t--)
|
|
114
|
+
r.slice(0, t).find((e) => O(e, r[t])) && r.splice(t, 1);
|
|
115
|
+
return r;
|
|
116
116
|
}
|
|
117
|
-
function m(
|
|
118
|
-
return Array.isArray(
|
|
117
|
+
function m(r) {
|
|
118
|
+
return Array.isArray(r) ? r : [r];
|
|
119
119
|
}
|
|
120
120
|
class S extends Array {
|
|
121
121
|
/** Number of elements in set */
|
|
@@ -142,8 +142,8 @@ class S extends Array {
|
|
|
142
142
|
*/
|
|
143
143
|
delete(...t) {
|
|
144
144
|
t.forEach((e) => {
|
|
145
|
-
const
|
|
146
|
-
|
|
145
|
+
const n = this.indexOf(e);
|
|
146
|
+
n != -1 && this.slice(n, 1);
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -229,16 +229,16 @@ class Tt {
|
|
|
229
229
|
*/
|
|
230
230
|
c(this, "values", this.all());
|
|
231
231
|
if (this.key = t, this.options = e, e.storageKey && !e.storage && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
232
|
+
const n = e.storage.getItem(e.storageKey);
|
|
233
|
+
if (n)
|
|
234
234
|
try {
|
|
235
|
-
Object.assign(this.store, JSON.parse(
|
|
235
|
+
Object.assign(this.store, JSON.parse(n));
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
return new Proxy(this, {
|
|
240
|
-
get: (
|
|
241
|
-
set: (
|
|
240
|
+
get: (n, s) => s in n ? n[s] : n.store[s],
|
|
241
|
+
set: (n, s, i) => (s in n ? n[s] = i : n.store[s] = i, !0)
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
getKey(t) {
|
|
@@ -261,8 +261,8 @@ class Tt {
|
|
|
261
261
|
* @return {this}
|
|
262
262
|
*/
|
|
263
263
|
add(t, e = this.ttl) {
|
|
264
|
-
const
|
|
265
|
-
return this.set(
|
|
264
|
+
const n = this.getKey(t);
|
|
265
|
+
return this.set(n, t, e), this;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Add several rows to the cache
|
|
@@ -272,7 +272,13 @@ class Tt {
|
|
|
272
272
|
* @return {this}
|
|
273
273
|
*/
|
|
274
274
|
addAll(t, e = !0) {
|
|
275
|
-
return t.forEach((
|
|
275
|
+
return t.forEach((n) => this.add(n)), this.complete = e, this;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Remove all keys from cache
|
|
279
|
+
*/
|
|
280
|
+
clear() {
|
|
281
|
+
this.store = {};
|
|
276
282
|
}
|
|
277
283
|
/**
|
|
278
284
|
* Delete an item from the cache
|
|
@@ -321,20 +327,20 @@ class Tt {
|
|
|
321
327
|
* @param {number | undefined} ttl Override default expiry in seconds
|
|
322
328
|
* @return {this}
|
|
323
329
|
*/
|
|
324
|
-
set(t, e,
|
|
325
|
-
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)),
|
|
330
|
+
set(t, e, n = this.options.ttl) {
|
|
331
|
+
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), n && setTimeout(() => {
|
|
326
332
|
this.complete = !1, this.delete(t);
|
|
327
|
-
},
|
|
333
|
+
}, n * 1e3), this;
|
|
328
334
|
}
|
|
329
335
|
}
|
|
330
|
-
function It(
|
|
331
|
-
const e =
|
|
332
|
-
|
|
333
|
-
}),
|
|
336
|
+
function It(r, t = !0) {
|
|
337
|
+
const e = r.reduce((n, s) => (Object.keys(t ? H(s) : s).forEach((i) => {
|
|
338
|
+
n.includes(i) || n.push(i);
|
|
339
|
+
}), n), []);
|
|
334
340
|
return [
|
|
335
341
|
e.join(","),
|
|
336
|
-
...
|
|
337
|
-
const i = B(
|
|
342
|
+
...r.map((n) => e.map((s) => {
|
|
343
|
+
const i = B(n, s), o = typeof i;
|
|
338
344
|
return o == "string" && i.includes(",") ? `"${i}"` : o == "object" ? `"${JSON.stringify(i)}"` : i;
|
|
339
345
|
}).join(","))
|
|
340
346
|
].join(`
|
|
@@ -342,8 +348,8 @@ function It(n, t = !0) {
|
|
|
342
348
|
}
|
|
343
349
|
class x extends Promise {
|
|
344
350
|
constructor(e) {
|
|
345
|
-
super((
|
|
346
|
-
(i) =>
|
|
351
|
+
super((n, s) => e(
|
|
352
|
+
(i) => n(i),
|
|
347
353
|
(i) => s(i),
|
|
348
354
|
(i) => this.progress = i
|
|
349
355
|
));
|
|
@@ -354,20 +360,20 @@ class x extends Promise {
|
|
|
354
360
|
return this._progress;
|
|
355
361
|
}
|
|
356
362
|
set progress(e) {
|
|
357
|
-
e != this._progress && (this._progress = e, this.listeners.forEach((
|
|
363
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
|
|
358
364
|
}
|
|
359
365
|
static from(e) {
|
|
360
|
-
return e instanceof x ? e : new x((
|
|
366
|
+
return e instanceof x ? e : new x((n, s) => e.then((...i) => n(...i)).catch((...i) => s(...i)));
|
|
361
367
|
}
|
|
362
368
|
from(e) {
|
|
363
|
-
const
|
|
364
|
-
return this.onProgress((s) =>
|
|
369
|
+
const n = x.from(e);
|
|
370
|
+
return this.onProgress((s) => n.progress = s), n;
|
|
365
371
|
}
|
|
366
372
|
onProgress(e) {
|
|
367
373
|
return this.listeners.push(e), this;
|
|
368
374
|
}
|
|
369
|
-
then(e,
|
|
370
|
-
const s = super.then(e,
|
|
375
|
+
then(e, n) {
|
|
376
|
+
const s = super.then(e, n);
|
|
371
377
|
return this.from(s);
|
|
372
378
|
}
|
|
373
379
|
catch(e) {
|
|
@@ -377,32 +383,32 @@ class x extends Promise {
|
|
|
377
383
|
return this.from(super.finally(e));
|
|
378
384
|
}
|
|
379
385
|
}
|
|
380
|
-
function Dt(
|
|
381
|
-
|
|
382
|
-
const e = URL.createObjectURL(
|
|
386
|
+
function Dt(r, t) {
|
|
387
|
+
r instanceof Blob || (r = new Blob(m(r)));
|
|
388
|
+
const e = URL.createObjectURL(r);
|
|
383
389
|
lt(e, t), URL.revokeObjectURL(e);
|
|
384
390
|
}
|
|
385
|
-
function lt(
|
|
391
|
+
function lt(r, t) {
|
|
386
392
|
const e = document.createElement("a");
|
|
387
|
-
e.href =
|
|
393
|
+
e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
388
394
|
}
|
|
389
|
-
function Mt(
|
|
395
|
+
function Mt(r = {}) {
|
|
390
396
|
return new Promise((t) => {
|
|
391
397
|
const e = document.createElement("input");
|
|
392
|
-
e.type = "file", e.accept =
|
|
398
|
+
e.type = "file", e.accept = r.accept || "*", e.style.display = "none", e.multiple = !!r.multiple, e.onblur = e.onchange = async () => {
|
|
393
399
|
t(Array.from(e.files)), e.remove();
|
|
394
400
|
}, document.body.appendChild(e), e.click();
|
|
395
401
|
});
|
|
396
402
|
}
|
|
397
|
-
function kt(
|
|
403
|
+
function kt(r, t = /* @__PURE__ */ new Date()) {
|
|
398
404
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
399
405
|
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")}`;
|
|
400
|
-
return
|
|
406
|
+
return r ? r.replace("{{TIMESTAMP}}", e) : e;
|
|
401
407
|
}
|
|
402
|
-
function Pt(
|
|
403
|
-
return new x((t, e,
|
|
408
|
+
function Pt(r) {
|
|
409
|
+
return new x((t, e, n) => {
|
|
404
410
|
const s = new XMLHttpRequest(), i = new FormData();
|
|
405
|
-
|
|
411
|
+
r.files.forEach((o) => i.append("file", o)), s.withCredentials = !!r.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? n(o.loaded / o.total) : null), s.addEventListener("loadend", () => t(I(s.responseText))), s.addEventListener("error", () => e(I(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", r.url), Object.entries(r.headers || {}).forEach(([o, a]) => s.setRequestHeader(o, a)), s.send(i);
|
|
406
412
|
});
|
|
407
413
|
}
|
|
408
414
|
class K {
|
|
@@ -410,48 +416,48 @@ class K {
|
|
|
410
416
|
c(this, "listeners", {});
|
|
411
417
|
}
|
|
412
418
|
static emit(t, ...e) {
|
|
413
|
-
(this.listeners["*"] || []).forEach((
|
|
419
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t.toString()] || []).forEach((n) => n(...e));
|
|
414
420
|
}
|
|
415
421
|
static off(t, e) {
|
|
416
|
-
const
|
|
417
|
-
this.listeners[
|
|
422
|
+
const n = t.toString();
|
|
423
|
+
this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
|
|
418
424
|
}
|
|
419
425
|
static on(t, e) {
|
|
420
426
|
var s;
|
|
421
|
-
const
|
|
422
|
-
return this.listeners[
|
|
427
|
+
const n = t.toString();
|
|
428
|
+
return this.listeners[n] || (this.listeners[n] = []), (s = this.listeners[n]) == null || s.push(e), () => this.off(t, e);
|
|
423
429
|
}
|
|
424
430
|
static once(t, e) {
|
|
425
|
-
return new Promise((
|
|
431
|
+
return new Promise((n) => {
|
|
426
432
|
const s = this.on(t, (...i) => {
|
|
427
|
-
|
|
433
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
428
434
|
});
|
|
429
435
|
});
|
|
430
436
|
}
|
|
431
437
|
emit(t, ...e) {
|
|
432
|
-
(this.listeners["*"] || []).forEach((
|
|
438
|
+
(this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t] || []).forEach((n) => n(...e));
|
|
433
439
|
}
|
|
434
440
|
off(t, e) {
|
|
435
|
-
this.listeners[t] = (this.listeners[t] || []).filter((
|
|
441
|
+
this.listeners[t] = (this.listeners[t] || []).filter((n) => n === e);
|
|
436
442
|
}
|
|
437
443
|
on(t, e) {
|
|
438
|
-
var
|
|
439
|
-
return this.listeners[t] || (this.listeners[t] = []), (
|
|
444
|
+
var n;
|
|
445
|
+
return this.listeners[t] || (this.listeners[t] = []), (n = this.listeners[t]) == null || n.push(e), () => this.off(t, e);
|
|
440
446
|
}
|
|
441
447
|
once(t, e) {
|
|
442
|
-
return new Promise((
|
|
448
|
+
return new Promise((n) => {
|
|
443
449
|
const s = this.on(t, (...i) => {
|
|
444
|
-
|
|
450
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
445
451
|
});
|
|
446
452
|
});
|
|
447
453
|
}
|
|
448
454
|
}
|
|
449
455
|
c(K, "listeners", {});
|
|
450
|
-
class
|
|
451
|
-
constructor(e,
|
|
456
|
+
class g extends Error {
|
|
457
|
+
constructor(e, n) {
|
|
452
458
|
super(e);
|
|
453
459
|
c(this, "_code");
|
|
454
|
-
|
|
460
|
+
n != null && (this._code = n);
|
|
455
461
|
}
|
|
456
462
|
get code() {
|
|
457
463
|
return this._code || this.constructor.code;
|
|
@@ -460,11 +466,11 @@ class y extends Error {
|
|
|
460
466
|
this._code = e;
|
|
461
467
|
}
|
|
462
468
|
static from(e) {
|
|
463
|
-
const
|
|
469
|
+
const n = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
|
|
464
470
|
return Object.assign(s, {
|
|
465
471
|
stack: e.stack,
|
|
466
472
|
...e,
|
|
467
|
-
code:
|
|
473
|
+
code: n ?? void 0
|
|
468
474
|
});
|
|
469
475
|
}
|
|
470
476
|
static instanceof(e) {
|
|
@@ -474,8 +480,8 @@ class y extends Error {
|
|
|
474
480
|
return this.message || super.toString();
|
|
475
481
|
}
|
|
476
482
|
}
|
|
477
|
-
c(
|
|
478
|
-
class W extends
|
|
483
|
+
c(g, "code", 500);
|
|
484
|
+
class W extends g {
|
|
479
485
|
constructor(t = "Bad Request") {
|
|
480
486
|
super(t);
|
|
481
487
|
}
|
|
@@ -484,7 +490,7 @@ class W extends y {
|
|
|
484
490
|
}
|
|
485
491
|
}
|
|
486
492
|
c(W, "code", 400);
|
|
487
|
-
class v extends
|
|
493
|
+
class v extends g {
|
|
488
494
|
constructor(t = "Unauthorized") {
|
|
489
495
|
super(t);
|
|
490
496
|
}
|
|
@@ -493,7 +499,7 @@ class v extends y {
|
|
|
493
499
|
}
|
|
494
500
|
}
|
|
495
501
|
c(v, "code", 401);
|
|
496
|
-
class J extends
|
|
502
|
+
class J extends g {
|
|
497
503
|
constructor(t = "Payment Required") {
|
|
498
504
|
super(t);
|
|
499
505
|
}
|
|
@@ -502,7 +508,7 @@ class J extends y {
|
|
|
502
508
|
}
|
|
503
509
|
}
|
|
504
510
|
c(J, "code", 402);
|
|
505
|
-
class z extends
|
|
511
|
+
class z extends g {
|
|
506
512
|
constructor(t = "Forbidden") {
|
|
507
513
|
super(t);
|
|
508
514
|
}
|
|
@@ -511,7 +517,7 @@ class z extends y {
|
|
|
511
517
|
}
|
|
512
518
|
}
|
|
513
519
|
c(z, "code", 403);
|
|
514
|
-
class Z extends
|
|
520
|
+
class Z extends g {
|
|
515
521
|
constructor(t = "Not Found") {
|
|
516
522
|
super(t);
|
|
517
523
|
}
|
|
@@ -520,7 +526,7 @@ class Z extends y {
|
|
|
520
526
|
}
|
|
521
527
|
}
|
|
522
528
|
c(Z, "code", 404);
|
|
523
|
-
class V extends
|
|
529
|
+
class V extends g {
|
|
524
530
|
constructor(t = "Method Not Allowed") {
|
|
525
531
|
super(t);
|
|
526
532
|
}
|
|
@@ -529,7 +535,7 @@ class V extends y {
|
|
|
529
535
|
}
|
|
530
536
|
}
|
|
531
537
|
c(V, "code", 405);
|
|
532
|
-
class X extends
|
|
538
|
+
class X extends g {
|
|
533
539
|
constructor(t = "Not Acceptable") {
|
|
534
540
|
super(t);
|
|
535
541
|
}
|
|
@@ -538,7 +544,7 @@ class X extends y {
|
|
|
538
544
|
}
|
|
539
545
|
}
|
|
540
546
|
c(X, "code", 406);
|
|
541
|
-
class Q extends
|
|
547
|
+
class Q extends g {
|
|
542
548
|
constructor(t = "Internal Server Error") {
|
|
543
549
|
super(t);
|
|
544
550
|
}
|
|
@@ -547,7 +553,7 @@ class Q extends y {
|
|
|
547
553
|
}
|
|
548
554
|
}
|
|
549
555
|
c(Q, "code", 500);
|
|
550
|
-
class _ extends
|
|
556
|
+
class _ extends g {
|
|
551
557
|
constructor(t = "Not Implemented") {
|
|
552
558
|
super(t);
|
|
553
559
|
}
|
|
@@ -556,7 +562,7 @@ class _ extends y {
|
|
|
556
562
|
}
|
|
557
563
|
}
|
|
558
564
|
c(_, "code", 501);
|
|
559
|
-
class tt extends
|
|
565
|
+
class tt extends g {
|
|
560
566
|
constructor(t = "Bad Gateway") {
|
|
561
567
|
super(t);
|
|
562
568
|
}
|
|
@@ -565,7 +571,7 @@ class tt extends y {
|
|
|
565
571
|
}
|
|
566
572
|
}
|
|
567
573
|
c(tt, "code", 502);
|
|
568
|
-
class et extends
|
|
574
|
+
class et extends g {
|
|
569
575
|
constructor(t = "Service Unavailable") {
|
|
570
576
|
super(t);
|
|
571
577
|
}
|
|
@@ -574,7 +580,7 @@ class et extends y {
|
|
|
574
580
|
}
|
|
575
581
|
}
|
|
576
582
|
c(et, "code", 503);
|
|
577
|
-
class
|
|
583
|
+
class rt extends g {
|
|
578
584
|
constructor(t = "Gateway Timeout") {
|
|
579
585
|
super(t);
|
|
580
586
|
}
|
|
@@ -582,10 +588,10 @@ class nt extends y {
|
|
|
582
588
|
return t.constructor.code == this.code;
|
|
583
589
|
}
|
|
584
590
|
}
|
|
585
|
-
c(
|
|
586
|
-
function Gt(
|
|
587
|
-
if (
|
|
588
|
-
switch (
|
|
591
|
+
c(rt, "code", 504);
|
|
592
|
+
function Gt(r, t) {
|
|
593
|
+
if (r >= 200 && r < 300) return null;
|
|
594
|
+
switch (r) {
|
|
589
595
|
case 400:
|
|
590
596
|
return new W(t);
|
|
591
597
|
case 401:
|
|
@@ -609,9 +615,9 @@ function Gt(n, t) {
|
|
|
609
615
|
case 503:
|
|
610
616
|
return new et(t);
|
|
611
617
|
case 504:
|
|
612
|
-
return new
|
|
618
|
+
return new rt(t);
|
|
613
619
|
default:
|
|
614
|
-
return new
|
|
620
|
+
return new g(t, r);
|
|
615
621
|
}
|
|
616
622
|
}
|
|
617
623
|
const E = class E {
|
|
@@ -641,47 +647,51 @@ const E = class E {
|
|
|
641
647
|
const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
|
|
642
648
|
e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
|
|
643
649
|
}
|
|
644
|
-
const
|
|
650
|
+
const n = ot({
|
|
645
651
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
646
652
|
...E.headers,
|
|
647
653
|
...this.headers,
|
|
648
654
|
...t.headers
|
|
649
655
|
});
|
|
650
|
-
return typeof t.body == "object" && t.body != null &&
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
656
|
+
return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
|
|
657
|
+
try {
|
|
658
|
+
fetch(e, {
|
|
659
|
+
headers: n,
|
|
660
|
+
method: t.method || (t.body ? "POST" : "GET"),
|
|
661
|
+
body: t.body
|
|
662
|
+
}).then(async (u) => {
|
|
663
|
+
var G, U;
|
|
664
|
+
for (let l of [...Object.values(E.interceptors), ...Object.values(this.interceptors)])
|
|
665
|
+
await new Promise((C) => l(u, () => C()));
|
|
666
|
+
const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
667
|
+
let P = 0;
|
|
668
|
+
const T = (G = u.body) == null ? void 0 : G.getReader(), nt = new ReadableStream({
|
|
669
|
+
start(l) {
|
|
670
|
+
function C() {
|
|
671
|
+
T == null || T.read().then((A) => {
|
|
672
|
+
if (A.done) return l.close();
|
|
673
|
+
P += A.value.byteLength, a(P / j), l.enqueue(A.value), C();
|
|
674
|
+
}).catch((A) => l.error(A));
|
|
675
|
+
}
|
|
676
|
+
C();
|
|
668
677
|
}
|
|
669
|
-
|
|
678
|
+
});
|
|
679
|
+
if (u.data = new Response(nt), t.decode == null || t.decode) {
|
|
680
|
+
const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
681
|
+
l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
|
|
670
682
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
u.ok ? i(u) : o(u);
|
|
677
|
-
});
|
|
683
|
+
u.ok ? i(u) : o(u);
|
|
684
|
+
}).catch((u) => o(u));
|
|
685
|
+
} catch (u) {
|
|
686
|
+
o(u);
|
|
687
|
+
}
|
|
678
688
|
});
|
|
679
689
|
}
|
|
680
690
|
};
|
|
681
691
|
c(E, "interceptors", {}), c(E, "headers", {});
|
|
682
692
|
let F = E;
|
|
683
|
-
function Ut(
|
|
684
|
-
const t =
|
|
693
|
+
function Ut(r) {
|
|
694
|
+
const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
685
695
|
return I(decodeURIComponent(atob(t).split("").map(function(e) {
|
|
686
696
|
return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
|
|
687
697
|
}).join("")));
|
|
@@ -722,15 +732,15 @@ const R = {
|
|
|
722
732
|
WHITE: "\x1B[47m",
|
|
723
733
|
GREY: "\x1B[100m"
|
|
724
734
|
};
|
|
725
|
-
var ft = /* @__PURE__ */ ((
|
|
735
|
+
var ft = /* @__PURE__ */ ((r) => (r[r.ERROR = 0] = "ERROR", r[r.WARN = 1] = "WARN", r[r.INFO = 2] = "INFO", r[r.LOG = 3] = "LOG", r[r.DEBUG = 4] = "DEBUG", r))(ft || {});
|
|
726
736
|
const w = class w extends K {
|
|
727
737
|
constructor(t) {
|
|
728
738
|
super(), this.namespace = t;
|
|
729
739
|
}
|
|
730
|
-
pad(t, e,
|
|
740
|
+
pad(t, e, n, s = !1) {
|
|
731
741
|
const i = t.toString(), o = e - i.length;
|
|
732
742
|
if (o <= 0) return i;
|
|
733
|
-
const a = Array(~~(o /
|
|
743
|
+
const a = Array(~~(o / n.length)).fill(n).join("");
|
|
734
744
|
return s ? i + a : a + i;
|
|
735
745
|
}
|
|
736
746
|
format(...t) {
|
|
@@ -765,70 +775,70 @@ const w = class w extends K {
|
|
|
765
775
|
};
|
|
766
776
|
c(w, "LOG_LEVEL", 4);
|
|
767
777
|
let Y = w;
|
|
768
|
-
function Ft(
|
|
769
|
-
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e =
|
|
770
|
-
let
|
|
771
|
-
const i = t(s,
|
|
772
|
-
s = ~~(s / i),
|
|
773
|
-
const o = ~~(s /
|
|
774
|
-
return s -= o *
|
|
775
|
-
}
|
|
776
|
-
function Yt(
|
|
777
|
-
let t =
|
|
778
|
+
function Ft(r) {
|
|
779
|
+
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = r.toString().length - 2;
|
|
780
|
+
let n = Math.pow(10, e), s = r * n;
|
|
781
|
+
const i = t(s, n);
|
|
782
|
+
s = ~~(s / i), n = ~~(n / i);
|
|
783
|
+
const o = ~~(s / n);
|
|
784
|
+
return s -= o * n, `${o ? o + " " : ""}${~~s}/${~~n}`;
|
|
785
|
+
}
|
|
786
|
+
function Yt(r) {
|
|
787
|
+
let t = r.split(" ");
|
|
778
788
|
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
779
789
|
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
780
790
|
}
|
|
781
791
|
const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = D + M + k;
|
|
782
|
-
function Ht(
|
|
783
|
-
if (
|
|
784
|
-
const e = 1024,
|
|
785
|
-
return parseFloat((
|
|
786
|
-
}
|
|
787
|
-
function Kt(
|
|
788
|
-
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(
|
|
789
|
-
if (!t) throw new Error(`Number cannot be parsed: ${
|
|
792
|
+
function Ht(r, t = 2) {
|
|
793
|
+
if (r === 0) return "0 Bytes";
|
|
794
|
+
const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(r) / Math.log(e));
|
|
795
|
+
return parseFloat((r / Math.pow(e, s)).toFixed(t)) + " " + n[s];
|
|
796
|
+
}
|
|
797
|
+
function Kt(r) {
|
|
798
|
+
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
|
|
799
|
+
if (!t) throw new Error(`Number cannot be parsed: ${r}`);
|
|
790
800
|
return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
|
|
791
801
|
}
|
|
792
|
-
function Wt(
|
|
793
|
-
return `${
|
|
802
|
+
function Wt(r, t, e) {
|
|
803
|
+
return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
|
|
794
804
|
}
|
|
795
|
-
function vt(
|
|
796
|
-
return
|
|
805
|
+
function vt(r, t, e = " ", n = !0) {
|
|
806
|
+
return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
|
|
797
807
|
}
|
|
798
|
-
function Jt(
|
|
799
|
-
return Array(
|
|
808
|
+
function Jt(r) {
|
|
809
|
+
return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
800
810
|
}
|
|
801
|
-
function zt(
|
|
802
|
-
return Array(
|
|
811
|
+
function zt(r, t = ht) {
|
|
812
|
+
return Array(r).fill(null).map(() => {
|
|
803
813
|
const e = ~~(Math.random() * t.length);
|
|
804
814
|
return t[e];
|
|
805
815
|
}).join("");
|
|
806
816
|
}
|
|
807
|
-
function Zt(
|
|
808
|
-
if (!t && !e && !
|
|
809
|
-
return Array(
|
|
817
|
+
function Zt(r, t = !1, e = !1, n = !1) {
|
|
818
|
+
if (!t && !e && !n) throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
819
|
+
return Array(r).fill(null).map(() => {
|
|
810
820
|
let s;
|
|
811
821
|
do {
|
|
812
822
|
const i = ~~(Math.random() * 3);
|
|
813
|
-
t && i == 0 ? s = D[~~(Math.random() * D.length)] : e && i == 1 ? s = M[~~(Math.random() * M.length)] :
|
|
823
|
+
t && i == 0 ? s = D[~~(Math.random() * D.length)] : e && i == 1 ? s = M[~~(Math.random() * M.length)] : n && i == 2 && (s = k[~~(Math.random() * k.length)]);
|
|
814
824
|
} while (!s);
|
|
815
825
|
return s;
|
|
816
826
|
}).join("");
|
|
817
827
|
}
|
|
818
|
-
function Vt(
|
|
828
|
+
function Vt(r, t) {
|
|
819
829
|
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
820
830
|
throw new TypeError("Regular expression must be global.");
|
|
821
|
-
let e = [],
|
|
822
|
-
for (; (
|
|
823
|
-
e.push(
|
|
831
|
+
let e = [], n;
|
|
832
|
+
for (; (n = t.exec(r)) !== null; )
|
|
833
|
+
e.push(n);
|
|
824
834
|
return e;
|
|
825
835
|
}
|
|
826
|
-
function Xt(
|
|
836
|
+
function Xt(r) {
|
|
827
837
|
const t = new RegExp(
|
|
828
838
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
829
839
|
"gm"
|
|
830
|
-
).exec(
|
|
831
|
-
if (e.port != null && (e.port = Number(e.port)),
|
|
840
|
+
).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
|
|
841
|
+
if (e.port != null && (e.port = Number(e.port)), n.length > 2 && (e.domain = n.splice(-2, 2).join("."), e.subdomain = n.join(".")), e.query) {
|
|
832
842
|
const s = e.query.split("&"), i = {};
|
|
833
843
|
s.forEach((o) => {
|
|
834
844
|
const [a, u] = o.split("=");
|
|
@@ -837,76 +847,76 @@ function Xt(n) {
|
|
|
837
847
|
}
|
|
838
848
|
return e;
|
|
839
849
|
}
|
|
840
|
-
function dt(
|
|
841
|
-
var t = pt(
|
|
850
|
+
function dt(r) {
|
|
851
|
+
var t = pt(gt(wt(yt(r), 8 * r.length)));
|
|
842
852
|
return t.toLowerCase();
|
|
843
853
|
}
|
|
844
|
-
function pt(
|
|
845
|
-
for (var t, e = "0123456789ABCDEF",
|
|
846
|
-
return
|
|
854
|
+
function pt(r) {
|
|
855
|
+
for (var t, e = "0123456789ABCDEF", n = "", s = 0; s < r.length; s++) t = r.charCodeAt(s), n += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
856
|
+
return n;
|
|
847
857
|
}
|
|
848
|
-
function
|
|
849
|
-
for (var t = Array(
|
|
850
|
-
for (e = 0; e < 8 *
|
|
858
|
+
function yt(r) {
|
|
859
|
+
for (var t = Array(r.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
|
|
860
|
+
for (e = 0; e < 8 * r.length; e += 8) t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
|
|
851
861
|
return t;
|
|
852
862
|
}
|
|
853
|
-
function
|
|
854
|
-
for (var t = "", e = 0; e < 32 *
|
|
863
|
+
function gt(r) {
|
|
864
|
+
for (var t = "", e = 0; e < 32 * r.length; e += 8) t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
|
|
855
865
|
return t;
|
|
856
866
|
}
|
|
857
|
-
function wt(
|
|
858
|
-
|
|
859
|
-
for (var e = 1732584193,
|
|
860
|
-
var a = e, u =
|
|
861
|
-
|
|
867
|
+
function wt(r, t) {
|
|
868
|
+
r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
|
|
869
|
+
for (var e = 1732584193, n = -271733879, s = -1732584194, i = 271733878, o = 0; o < r.length; o += 16) {
|
|
870
|
+
var a = e, u = n, $ = s, j = i;
|
|
871
|
+
n = p(n = p(n = p(n = p(n = d(n = d(n = d(n = d(n = h(n = h(n = h(n = h(n = f(n = f(n = f(n = f(n, s = f(s, i = f(i, e = f(e, n, s, i, r[o + 0], 7, -680876936), n, s, r[o + 1], 12, -389564586), e, n, r[o + 2], 17, 606105819), i, e, r[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 4], 7, -176418897), n, s, r[o + 5], 12, 1200080426), e, n, r[o + 6], 17, -1473231341), i, e, r[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 8], 7, 1770035416), n, s, r[o + 9], 12, -1958414417), e, n, r[o + 10], 17, -42063), i, e, r[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, n, s, i, r[o + 12], 7, 1804603682), n, s, r[o + 13], 12, -40341101), e, n, r[o + 14], 17, -1502002290), i, e, r[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 1], 5, -165796510), n, s, r[o + 6], 9, -1069501632), e, n, r[o + 11], 14, 643717713), i, e, r[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 5], 5, -701558691), n, s, r[o + 10], 9, 38016083), e, n, r[o + 15], 14, -660478335), i, e, r[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 9], 5, 568446438), n, s, r[o + 14], 9, -1019803690), e, n, r[o + 3], 14, -187363961), i, e, r[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, n, s, i, r[o + 13], 5, -1444681467), n, s, r[o + 2], 9, -51403784), e, n, r[o + 7], 14, 1735328473), i, e, r[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 5], 4, -378558), n, s, r[o + 8], 11, -2022574463), e, n, r[o + 11], 16, 1839030562), i, e, r[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 1], 4, -1530992060), n, s, r[o + 4], 11, 1272893353), e, n, r[o + 7], 16, -155497632), i, e, r[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 13], 4, 681279174), n, s, r[o + 0], 11, -358537222), e, n, r[o + 3], 16, -722521979), i, e, r[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, n, s, i, r[o + 9], 4, -640364487), n, s, r[o + 12], 11, -421815835), e, n, r[o + 15], 16, 530742520), i, e, r[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 0], 6, -198630844), n, s, r[o + 7], 10, 1126891415), e, n, r[o + 14], 15, -1416354905), i, e, r[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 12], 6, 1700485571), n, s, r[o + 3], 10, -1894986606), e, n, r[o + 10], 15, -1051523), i, e, r[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 8], 6, 1873313359), n, s, r[o + 15], 10, -30611744), e, n, r[o + 6], 15, -1560198380), i, e, r[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, n, s, i, r[o + 4], 6, -145523070), n, s, r[o + 11], 10, -1120210379), e, n, r[o + 2], 15, 718787259), i, e, r[o + 9], 21, -343485551), e = b(e, a), n = b(n, u), s = b(s, $), i = b(i, j);
|
|
862
872
|
}
|
|
863
|
-
return Array(e,
|
|
873
|
+
return Array(e, n, s, i);
|
|
864
874
|
}
|
|
865
|
-
function
|
|
866
|
-
return b(Et(b(b(t,
|
|
875
|
+
function N(r, t, e, n, s, i) {
|
|
876
|
+
return b(Et(b(b(t, r), b(n, i)), s), e);
|
|
867
877
|
}
|
|
868
|
-
function f(
|
|
869
|
-
return
|
|
878
|
+
function f(r, t, e, n, s, i, o) {
|
|
879
|
+
return N(t & e | ~t & n, r, t, s, i, o);
|
|
870
880
|
}
|
|
871
|
-
function h(
|
|
872
|
-
return
|
|
881
|
+
function h(r, t, e, n, s, i, o) {
|
|
882
|
+
return N(t & n | e & ~n, r, t, s, i, o);
|
|
873
883
|
}
|
|
874
|
-
function d(
|
|
875
|
-
return
|
|
884
|
+
function d(r, t, e, n, s, i, o) {
|
|
885
|
+
return N(t ^ e ^ n, r, t, s, i, o);
|
|
876
886
|
}
|
|
877
|
-
function p(
|
|
878
|
-
return
|
|
887
|
+
function p(r, t, e, n, s, i, o) {
|
|
888
|
+
return N(e ^ (t | ~n), r, t, s, i, o);
|
|
879
889
|
}
|
|
880
|
-
function b(
|
|
881
|
-
var e = (65535 &
|
|
882
|
-
return (
|
|
890
|
+
function b(r, t) {
|
|
891
|
+
var e = (65535 & r) + (65535 & t);
|
|
892
|
+
return (r >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
|
|
883
893
|
}
|
|
884
|
-
function Et(
|
|
885
|
-
return
|
|
894
|
+
function Et(r, t) {
|
|
895
|
+
return r << t | r >>> 32 - t;
|
|
886
896
|
}
|
|
887
|
-
function Qt(
|
|
888
|
-
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
897
|
+
function Qt(r) {
|
|
898
|
+
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
|
|
889
899
|
}
|
|
890
|
-
function _t(
|
|
891
|
-
return
|
|
900
|
+
function _t(r, t = "mp") {
|
|
901
|
+
return r ? `https://www.gravatar.com/avatar/${dt(r)}?d=${t}` : "";
|
|
892
902
|
}
|
|
893
|
-
function te(
|
|
894
|
-
return
|
|
903
|
+
function te(r) {
|
|
904
|
+
return r.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
895
905
|
}
|
|
896
|
-
function ee(
|
|
906
|
+
function ee(r, ...t) {
|
|
897
907
|
const e = [];
|
|
898
|
-
for (let
|
|
899
|
-
n
|
|
900
|
-
return new
|
|
908
|
+
for (let n = 0; n < r.length || n < t.length; n++)
|
|
909
|
+
r[n] && e.push(r[n]), t[n] && e.push(t[n]);
|
|
910
|
+
return new y(e.join(""));
|
|
901
911
|
}
|
|
902
|
-
function mt(
|
|
912
|
+
function mt(r, ...t) {
|
|
903
913
|
let e = [];
|
|
904
|
-
for (let i = 0; i <
|
|
905
|
-
|
|
906
|
-
const [
|
|
907
|
-
return
|
|
914
|
+
for (let i = 0; i < r.length || i < t.length; i++)
|
|
915
|
+
r[i] && e.push(r[i]), t[i] && e.push(t[i]);
|
|
916
|
+
const [n, s] = e.join("").split(":");
|
|
917
|
+
return y.toString(n, s == null ? void 0 : s.split(""));
|
|
908
918
|
}
|
|
909
|
-
class
|
|
919
|
+
class y {
|
|
910
920
|
constructor(t) {
|
|
911
921
|
/** First directory in path */
|
|
912
922
|
c(this, "module");
|
|
@@ -932,8 +942,8 @@ class g {
|
|
|
932
942
|
c(this, "delete");
|
|
933
943
|
var o;
|
|
934
944
|
if (typeof t == "object") return Object.assign(this, t);
|
|
935
|
-
let [e,
|
|
936
|
-
s || (s =
|
|
945
|
+
let [e, n, s] = t.split(":");
|
|
946
|
+
s || (s = n || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
937
947
|
let i = e.split("/").filter((a) => !!a);
|
|
938
948
|
this.module = ((o = i.splice(0, 1)[0]) == null ? void 0 : o.toLowerCase()) || "", this.fullPath = e, this.path = i.join("/"), this.name = i.pop() || "", this.methods = s.split(""), this.all = s == null ? void 0 : s.includes("*"), this.none = s == null ? void 0 : s.includes("n"), this.create = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("c"))), this.read = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("r"))), this.update = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("u"))), this.delete = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("d")));
|
|
939
949
|
}
|
|
@@ -946,11 +956,11 @@ class g {
|
|
|
946
956
|
*/
|
|
947
957
|
static combine(t) {
|
|
948
958
|
let e = !1;
|
|
949
|
-
const
|
|
959
|
+
const n = t.map((s) => new y(s)).toSorted((s, i) => {
|
|
950
960
|
const o = s.fullPath.length, a = i.fullPath.length;
|
|
951
961
|
return o < a ? 1 : o > a ? -1 : 0;
|
|
952
962
|
}).reduce((s, i) => (i.none && (e = !0), s ? (e || (i.all && (s.all = !0), (i.all || i.create) && (s.create = !0), (i.all || i.read) && (s.read = !0), (i.all || i.update) && (s.update = !0), (i.all || i.delete) && (s.delete = !0), s.methods = [...s.methods, ...i.methods]), s) : i), null);
|
|
953
|
-
return
|
|
963
|
+
return n.all && (n.methods = ["*"]), n.none && (n.methods = ["n"]), n.methods = new S(n.methods), n.raw = mt`${n.fullPath}:${n.methods}`, n;
|
|
954
964
|
}
|
|
955
965
|
/**
|
|
956
966
|
* Squash 2 sets of paths & return true if any overlap is found
|
|
@@ -960,12 +970,12 @@ class g {
|
|
|
960
970
|
* @return {boolean} Whether there is any overlap
|
|
961
971
|
*/
|
|
962
972
|
static has(t, ...e) {
|
|
963
|
-
const
|
|
964
|
-
return !!
|
|
973
|
+
const n = m(e).map((i) => new y(i)), s = m(t).map((i) => new y(i));
|
|
974
|
+
return !!n.find((i) => {
|
|
965
975
|
if (!i.fullPath && i.all) return !0;
|
|
966
976
|
const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
|
|
967
977
|
if (!o.length) return !1;
|
|
968
|
-
const a =
|
|
978
|
+
const a = y.combine(o);
|
|
969
979
|
return !a.none && (a.all || new S(a.methods).intersection(new S(i.methods)).length);
|
|
970
980
|
});
|
|
971
981
|
}
|
|
@@ -977,7 +987,7 @@ class g {
|
|
|
977
987
|
* @return {boolean} Whether there is any overlap
|
|
978
988
|
*/
|
|
979
989
|
static hasAll(t, ...e) {
|
|
980
|
-
return e.filter((
|
|
990
|
+
return e.filter((n) => y.has(t, n)).length == e.length;
|
|
981
991
|
}
|
|
982
992
|
/**
|
|
983
993
|
* Same as `has` but raises an error if there is no overlap
|
|
@@ -986,7 +996,7 @@ class g {
|
|
|
986
996
|
* @param has Target must have at least one of these path
|
|
987
997
|
*/
|
|
988
998
|
static hasFatal(t, ...e) {
|
|
989
|
-
if (!
|
|
999
|
+
if (!y.has(t, ...e)) throw new Error(`Requires one of: ${m(e).join(", ")}`);
|
|
990
1000
|
}
|
|
991
1001
|
/**
|
|
992
1002
|
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
@@ -995,7 +1005,7 @@ class g {
|
|
|
995
1005
|
* @param has Target must have all these paths
|
|
996
1006
|
*/
|
|
997
1007
|
static hasAllFatal(t, ...e) {
|
|
998
|
-
if (!
|
|
1008
|
+
if (!y.hasAll(t, ...e)) throw new Error(`Requires all: ${m(e).join(", ")}`);
|
|
999
1009
|
}
|
|
1000
1010
|
/**
|
|
1001
1011
|
* Create event string from its components
|
|
@@ -1005,8 +1015,8 @@ class g {
|
|
|
1005
1015
|
* @return {string} String representation of Event
|
|
1006
1016
|
*/
|
|
1007
1017
|
static toString(t, e) {
|
|
1008
|
-
let
|
|
1009
|
-
return e != null && e.length && (
|
|
1018
|
+
let n = m(t).filter((s) => s != null).join("/");
|
|
1019
|
+
return e != null && e.length && (n += `:${m(e).map((s) => s.toLowerCase()).join("")}`), n == null ? void 0 : n.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
1010
1020
|
}
|
|
1011
1021
|
/**
|
|
1012
1022
|
* Create event string from its components
|
|
@@ -1014,47 +1024,47 @@ class g {
|
|
|
1014
1024
|
* @return {string} String representation of Event
|
|
1015
1025
|
*/
|
|
1016
1026
|
toString() {
|
|
1017
|
-
return
|
|
1027
|
+
return y.toString(this.fullPath, this.methods);
|
|
1018
1028
|
}
|
|
1019
1029
|
}
|
|
1020
|
-
class
|
|
1030
|
+
class re {
|
|
1021
1031
|
constructor() {
|
|
1022
1032
|
c(this, "listeners", []);
|
|
1023
1033
|
}
|
|
1024
1034
|
emit(t, ...e) {
|
|
1025
|
-
const
|
|
1026
|
-
this.listeners.filter((s) =>
|
|
1035
|
+
const n = new y(t);
|
|
1036
|
+
this.listeners.filter((s) => y.has(s[0], t)).forEach(async (s) => s[1](n, ...e));
|
|
1027
1037
|
}
|
|
1028
1038
|
off(t) {
|
|
1029
1039
|
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
1030
1040
|
}
|
|
1031
1041
|
on(t, e) {
|
|
1032
|
-
return m(t).forEach((
|
|
1042
|
+
return m(t).forEach((n) => this.listeners.push([new y(n), e])), () => this.off(e);
|
|
1033
1043
|
}
|
|
1034
1044
|
once(t, e) {
|
|
1035
|
-
return new Promise((
|
|
1045
|
+
return new Promise((n) => {
|
|
1036
1046
|
const s = this.on(t, (i, ...o) => {
|
|
1037
|
-
|
|
1047
|
+
n(o.length < 2 ? o[0] : o), e && e(i, ...o), s();
|
|
1038
1048
|
});
|
|
1039
1049
|
});
|
|
1040
1050
|
}
|
|
1041
1051
|
relayEvents(t) {
|
|
1042
|
-
t.on("*", (e, ...
|
|
1052
|
+
t.on("*", (e, ...n) => this.emit(e, ...n));
|
|
1043
1053
|
}
|
|
1044
1054
|
}
|
|
1045
|
-
function
|
|
1046
|
-
(typeof
|
|
1047
|
-
let t =
|
|
1048
|
-
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${
|
|
1055
|
+
function ne(r) {
|
|
1056
|
+
(typeof r == "number" || typeof r == "string") && (r = new Date(r));
|
|
1057
|
+
let t = r.getHours(), e = "AM";
|
|
1058
|
+
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${r.getFullYear()}-${(r.getMonth() + 1).toString().padStart(2, "0")}-${r.getDate().toString().padStart(2, "0")}, ${t}:${r.getMinutes().toString().padStart(2, "0")} ${e}`;
|
|
1049
1059
|
}
|
|
1050
|
-
function St(
|
|
1051
|
-
return new Promise((t) => setTimeout(t,
|
|
1060
|
+
function St(r) {
|
|
1061
|
+
return new Promise((t) => setTimeout(t, r));
|
|
1052
1062
|
}
|
|
1053
|
-
async function se(
|
|
1054
|
-
for (; await
|
|
1063
|
+
async function se(r, t = 100) {
|
|
1064
|
+
for (; await r(); ) await St(t);
|
|
1055
1065
|
}
|
|
1056
|
-
function ie(
|
|
1057
|
-
return (
|
|
1066
|
+
function ie(r) {
|
|
1067
|
+
return (r instanceof Date ? r.getTime() : r) - (/* @__PURE__ */ new Date()).getTime();
|
|
1058
1068
|
}
|
|
1059
1069
|
function oe() {
|
|
1060
1070
|
return Object.keys({});
|
|
@@ -1067,9 +1077,9 @@ export {
|
|
|
1067
1077
|
qt as CliBackground,
|
|
1068
1078
|
R as CliEffects,
|
|
1069
1079
|
L as CliForeground,
|
|
1070
|
-
|
|
1080
|
+
g as CustomError,
|
|
1071
1081
|
z as ForbiddenError,
|
|
1072
|
-
|
|
1082
|
+
rt as GatewayTimeoutError,
|
|
1073
1083
|
F as Http,
|
|
1074
1084
|
Q as InternalServerError,
|
|
1075
1085
|
I as JSONAttemptParse,
|
|
@@ -1082,8 +1092,8 @@ export {
|
|
|
1082
1092
|
_ as NotImplementedError,
|
|
1083
1093
|
ee as PE,
|
|
1084
1094
|
mt as PES,
|
|
1085
|
-
|
|
1086
|
-
|
|
1095
|
+
y as PathEvent,
|
|
1096
|
+
re as PathEventEmitter,
|
|
1087
1097
|
J as PaymentRequiredError,
|
|
1088
1098
|
x as PromiseProgress,
|
|
1089
1099
|
et as ServiceUnavailableError,
|
|
@@ -1104,12 +1114,12 @@ export {
|
|
|
1104
1114
|
Gt as errorFromCode,
|
|
1105
1115
|
te as escapeRegex,
|
|
1106
1116
|
Mt as fileBrowser,
|
|
1107
|
-
|
|
1117
|
+
Nt as findByProp,
|
|
1108
1118
|
ut as flattenArr,
|
|
1109
1119
|
H as flattenObj,
|
|
1110
1120
|
At as formData,
|
|
1111
1121
|
Ht as formatBytes,
|
|
1112
|
-
|
|
1122
|
+
ne as formatDate,
|
|
1113
1123
|
Kt as formatPhoneNumber,
|
|
1114
1124
|
Yt as fracToDec,
|
|
1115
1125
|
_t as gravatar,
|
|
@@ -1129,7 +1139,7 @@ export {
|
|
|
1129
1139
|
Zt as randomStringBuilder,
|
|
1130
1140
|
St as sleep,
|
|
1131
1141
|
se as sleepWhile,
|
|
1132
|
-
|
|
1142
|
+
jt as sortByProp,
|
|
1133
1143
|
ie as timeUntil,
|
|
1134
1144
|
kt as timestampFilename,
|
|
1135
1145
|
oe as tyoeKeys,
|