@ztimson/utils 0.20.4 → 0.20.6
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +256 -256
- 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 = (n, t, e) => t in n ? st(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var c = (n, t, e) => it(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function ot(n, t = !1) {
|
|
5
|
+
if (n == null) throw new Error("Cannot clean a NULL value");
|
|
6
|
+
return Array.isArray(n) ? n = n.filter((e) => e != null) : Object.entries(n).forEach(([e, r]) => {
|
|
7
|
+
(t && r === void 0 || !t && r == null) && delete n[e];
|
|
8
|
+
}), n;
|
|
9
|
+
}
|
|
10
|
+
function xt(n) {
|
|
11
|
+
return structuredClone(n);
|
|
12
|
+
}
|
|
13
|
+
function ct(n, ...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 r in e)
|
|
16
|
+
e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ct(n[r], e[r])) : n[r] = e[r];
|
|
17
|
+
}), n;
|
|
18
|
+
}
|
|
19
|
+
function B(n, t, e) {
|
|
20
|
+
if (!(n == null || !t))
|
|
21
|
+
return t.split(/[.[\]]/g).filter((r) => r.length).reduce((r, s, i, o) => {
|
|
22
|
+
if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(r != null && r.hasOwnProperty(s))) {
|
|
23
23
|
if (e == null) return;
|
|
24
|
-
|
|
24
|
+
r[s] = {};
|
|
25
25
|
}
|
|
26
|
-
return e !== void 0 && i == o.length - 1 ?
|
|
27
|
-
},
|
|
26
|
+
return e !== void 0 && i == o.length - 1 ? r[s] = e : r[s];
|
|
27
|
+
}, n);
|
|
28
28
|
}
|
|
29
|
-
function Bt(
|
|
30
|
-
return Object.entries(
|
|
29
|
+
function Bt(n) {
|
|
30
|
+
return Object.entries(n).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 r
|
|
34
|
+
function H(n, t, e = {}) {
|
|
35
|
+
if (typeof n == "object" && !Array.isArray(n)) {
|
|
36
|
+
for (const r of Object.keys(n)) {
|
|
37
|
+
const s = t ? t + "." + r : r;
|
|
38
|
+
typeof n[r] == "object" ? H(n[r], s, e) : e[s] = n[r];
|
|
39
39
|
}
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function At(
|
|
43
|
+
function At(n) {
|
|
44
44
|
const t = new FormData();
|
|
45
|
-
return Object.entries(
|
|
45
|
+
return Object.entries(n).forEach(([e, r]) => t.append(e, r)), 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(n, t, e = !1) {
|
|
48
|
+
if (n == null) return e;
|
|
49
|
+
if (Array.isArray(t)) return t.findIndex((s, i) => !q(n[i], t[i], e)) == -1;
|
|
50
|
+
const r = typeof t;
|
|
51
|
+
return r != typeof n ? !1 : r == "object" ? Object.keys(t).find((s) => !q(n[s], t[s], e)) == null : r == "function" ? n.toString() == t.toString() : n == t;
|
|
52
52
|
}
|
|
53
|
-
function O(
|
|
54
|
-
const e = typeof
|
|
55
|
-
return e != "object" ||
|
|
53
|
+
function O(n, t) {
|
|
54
|
+
const e = typeof n, r = typeof t;
|
|
55
|
+
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((i) => O(n[i], t[i]));
|
|
56
56
|
}
|
|
57
|
-
function Rt(
|
|
57
|
+
function Rt(n, t) {
|
|
58
58
|
t.forEach((e) => {
|
|
59
|
-
Object.getOwnPropertyNames(e.prototype).forEach((
|
|
59
|
+
Object.getOwnPropertyNames(e.prototype).forEach((r) => {
|
|
60
60
|
Object.defineProperty(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Object.getOwnPropertyDescriptor(e.prototype,
|
|
61
|
+
n.prototype,
|
|
62
|
+
r,
|
|
63
|
+
Object.getOwnPropertyDescriptor(e.prototype, r) || /* @__PURE__ */ Object.create(null)
|
|
64
64
|
);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function I(
|
|
68
|
+
function I(n) {
|
|
69
69
|
try {
|
|
70
|
-
return JSON.parse(
|
|
70
|
+
return JSON.parse(n);
|
|
71
71
|
} catch {
|
|
72
|
-
return
|
|
72
|
+
return n;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
function Ot(
|
|
75
|
+
function Ot(n, t) {
|
|
76
76
|
let e = [];
|
|
77
|
-
return JSON.stringify(
|
|
77
|
+
return JSON.stringify(n, (r, 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(r, t) {
|
|
|
82
82
|
return s;
|
|
83
83
|
}, t);
|
|
84
84
|
}
|
|
85
|
-
function $t(
|
|
86
|
-
return
|
|
85
|
+
function $t(n, t) {
|
|
86
|
+
return n.indexOf(t) === -1 && n.push(t), n;
|
|
87
87
|
}
|
|
88
|
-
function Ct(
|
|
88
|
+
function Ct(n, t) {
|
|
89
89
|
return at([
|
|
90
|
-
...
|
|
91
|
-
...t.filter((e) => !
|
|
90
|
+
...n.filter((e) => !t.includes((r) => O(e, r))),
|
|
91
|
+
...t.filter((e) => !n.includes((r) => O(e, r)))
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
94
|
-
function Lt(
|
|
94
|
+
function Lt(n) {
|
|
95
95
|
return function(t, e) {
|
|
96
|
-
const
|
|
97
|
-
return typeof
|
|
96
|
+
const r = B(t, n), s = B(e, n);
|
|
97
|
+
return typeof r != "string" || typeof s != "string" ? 1 : r.toLowerCase().localeCompare(s.toLowerCase());
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function Nt(
|
|
101
|
-
return (e) => O(B(e,
|
|
100
|
+
function Nt(n, t) {
|
|
101
|
+
return (e) => O(B(e, n), t);
|
|
102
102
|
}
|
|
103
|
-
function ut(
|
|
104
|
-
return
|
|
103
|
+
function ut(n, t = []) {
|
|
104
|
+
return n.forEach((e) => Array.isArray(e) ? ut(e, t) : t.push(e)), t;
|
|
105
105
|
}
|
|
106
|
-
function jt(
|
|
107
|
-
return function(e,
|
|
108
|
-
const s = B(e,
|
|
106
|
+
function jt(n, t = !1) {
|
|
107
|
+
return function(e, r) {
|
|
108
|
+
const s = B(e, n), i = B(r, n);
|
|
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(n) {
|
|
113
|
+
for (let t = n.length - 1; t >= 0; t--)
|
|
114
|
+
n.slice(0, t).find((e) => O(e, n[t])) && n.splice(t, 1);
|
|
115
|
+
return n;
|
|
116
116
|
}
|
|
117
|
-
function m(
|
|
118
|
-
return Array.isArray(
|
|
117
|
+
function m(n) {
|
|
118
|
+
return Array.isArray(n) ? n : [n];
|
|
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 r = this.indexOf(e);
|
|
146
|
+
r != -1 && this.slice(r, 1);
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -228,17 +228,17 @@ class Tt {
|
|
|
228
228
|
* @return {T[]} Array of items
|
|
229
229
|
*/
|
|
230
230
|
c(this, "values", this.all());
|
|
231
|
-
if (this.key = t, this.options = e, e.storageKey && !e.storage && localStorage && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
231
|
+
if (this.key = t, this.options = e, e.storageKey && !e.storage && window && (window != null && window.localStorage) && (e.storage = window.localStorage), e.storageKey && e.storage) {
|
|
232
|
+
const r = e.storage.getItem(e.storageKey);
|
|
233
|
+
if (r)
|
|
234
234
|
try {
|
|
235
|
-
Object.assign(this.store, JSON.parse(
|
|
235
|
+
Object.assign(this.store, JSON.parse(r));
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
return new Proxy(this, {
|
|
240
|
-
get: (
|
|
241
|
-
set: (
|
|
240
|
+
get: (r, s) => s in r ? r[s] : r.store[s],
|
|
241
|
+
set: (r, s, i) => (s in r ? r[s] = i : r.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 r = this.getKey(t);
|
|
265
|
+
return this.set(r, t, e), this;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Add several rows to the cache
|
|
@@ -272,7 +272,7 @@ class Tt {
|
|
|
272
272
|
* @return {this}
|
|
273
273
|
*/
|
|
274
274
|
addAll(t, e = !0) {
|
|
275
|
-
return t.forEach((
|
|
275
|
+
return t.forEach((r) => this.add(r)), this.complete = e, this;
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Remove all keys from cache
|
|
@@ -327,20 +327,20 @@ class Tt {
|
|
|
327
327
|
* @param {number | undefined} ttl Override default expiry in seconds
|
|
328
328
|
* @return {this}
|
|
329
329
|
*/
|
|
330
|
-
set(t, e,
|
|
331
|
-
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, r = 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)), r && setTimeout(() => {
|
|
332
332
|
this.complete = !1, this.delete(t);
|
|
333
|
-
},
|
|
333
|
+
}, r * 1e3), this;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
function It(
|
|
337
|
-
const e =
|
|
338
|
-
|
|
339
|
-
}),
|
|
336
|
+
function It(n, t = !0) {
|
|
337
|
+
const e = n.reduce((r, s) => (Object.keys(t ? H(s) : s).forEach((i) => {
|
|
338
|
+
r.includes(i) || r.push(i);
|
|
339
|
+
}), r), []);
|
|
340
340
|
return [
|
|
341
341
|
e.join(","),
|
|
342
|
-
...
|
|
343
|
-
const i = B(
|
|
342
|
+
...n.map((r) => e.map((s) => {
|
|
343
|
+
const i = B(r, s), o = typeof i;
|
|
344
344
|
return o == "string" && i.includes(",") ? `"${i}"` : o == "object" ? `"${JSON.stringify(i)}"` : i;
|
|
345
345
|
}).join(","))
|
|
346
346
|
].join(`
|
|
@@ -348,8 +348,8 @@ function It(r, t = !0) {
|
|
|
348
348
|
}
|
|
349
349
|
class x extends Promise {
|
|
350
350
|
constructor(e) {
|
|
351
|
-
super((
|
|
352
|
-
(i) =>
|
|
351
|
+
super((r, s) => e(
|
|
352
|
+
(i) => r(i),
|
|
353
353
|
(i) => s(i),
|
|
354
354
|
(i) => this.progress = i
|
|
355
355
|
));
|
|
@@ -360,20 +360,20 @@ class x extends Promise {
|
|
|
360
360
|
return this._progress;
|
|
361
361
|
}
|
|
362
362
|
set progress(e) {
|
|
363
|
-
e != this._progress && (this._progress = e, this.listeners.forEach((
|
|
363
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((r) => r(e)));
|
|
364
364
|
}
|
|
365
365
|
static from(e) {
|
|
366
|
-
return e instanceof x ? e : new x((
|
|
366
|
+
return e instanceof x ? e : new x((r, s) => e.then((...i) => r(...i)).catch((...i) => s(...i)));
|
|
367
367
|
}
|
|
368
368
|
from(e) {
|
|
369
|
-
const
|
|
370
|
-
return this.onProgress((s) =>
|
|
369
|
+
const r = x.from(e);
|
|
370
|
+
return this.onProgress((s) => r.progress = s), r;
|
|
371
371
|
}
|
|
372
372
|
onProgress(e) {
|
|
373
373
|
return this.listeners.push(e), this;
|
|
374
374
|
}
|
|
375
|
-
then(e,
|
|
376
|
-
const s = super.then(e,
|
|
375
|
+
then(e, r) {
|
|
376
|
+
const s = super.then(e, r);
|
|
377
377
|
return this.from(s);
|
|
378
378
|
}
|
|
379
379
|
catch(e) {
|
|
@@ -383,32 +383,32 @@ class x extends Promise {
|
|
|
383
383
|
return this.from(super.finally(e));
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
function Dt(
|
|
387
|
-
|
|
388
|
-
const e = URL.createObjectURL(
|
|
386
|
+
function Dt(n, t) {
|
|
387
|
+
n instanceof Blob || (n = new Blob(m(n)));
|
|
388
|
+
const e = URL.createObjectURL(n);
|
|
389
389
|
lt(e, t), URL.revokeObjectURL(e);
|
|
390
390
|
}
|
|
391
|
-
function lt(
|
|
391
|
+
function lt(n, t) {
|
|
392
392
|
const e = document.createElement("a");
|
|
393
|
-
e.href =
|
|
393
|
+
e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
394
394
|
}
|
|
395
|
-
function Mt(
|
|
395
|
+
function Mt(n = {}) {
|
|
396
396
|
return new Promise((t) => {
|
|
397
397
|
const e = document.createElement("input");
|
|
398
|
-
e.type = "file", e.accept =
|
|
398
|
+
e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
|
|
399
399
|
t(Array.from(e.files)), e.remove();
|
|
400
400
|
}, document.body.appendChild(e), e.click();
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
function kt(
|
|
403
|
+
function kt(n, t = /* @__PURE__ */ new Date()) {
|
|
404
404
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
405
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")}`;
|
|
406
|
-
return
|
|
406
|
+
return n ? n.replace("{{TIMESTAMP}}", e) : e;
|
|
407
407
|
}
|
|
408
|
-
function Pt(
|
|
409
|
-
return new x((t, e,
|
|
408
|
+
function Pt(n) {
|
|
409
|
+
return new x((t, e, r) => {
|
|
410
410
|
const s = new XMLHttpRequest(), i = new FormData();
|
|
411
|
-
|
|
411
|
+
n.files.forEach((o) => i.append("file", o)), s.withCredentials = !!n.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? r(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", n.url), Object.entries(n.headers || {}).forEach(([o, a]) => s.setRequestHeader(o, a)), s.send(i);
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
class K {
|
|
@@ -416,48 +416,48 @@ class K {
|
|
|
416
416
|
c(this, "listeners", {});
|
|
417
417
|
}
|
|
418
418
|
static emit(t, ...e) {
|
|
419
|
-
(this.listeners["*"] || []).forEach((
|
|
419
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t.toString()] || []).forEach((r) => r(...e));
|
|
420
420
|
}
|
|
421
421
|
static off(t, e) {
|
|
422
|
-
const
|
|
423
|
-
this.listeners[
|
|
422
|
+
const r = t.toString();
|
|
423
|
+
this.listeners[r] = (this.listeners[r] || []).filter((s) => s === e);
|
|
424
424
|
}
|
|
425
425
|
static on(t, e) {
|
|
426
426
|
var s;
|
|
427
|
-
const
|
|
428
|
-
return this.listeners[
|
|
427
|
+
const r = t.toString();
|
|
428
|
+
return this.listeners[r] || (this.listeners[r] = []), (s = this.listeners[r]) == null || s.push(e), () => this.off(t, e);
|
|
429
429
|
}
|
|
430
430
|
static once(t, e) {
|
|
431
|
-
return new Promise((
|
|
431
|
+
return new Promise((r) => {
|
|
432
432
|
const s = this.on(t, (...i) => {
|
|
433
|
-
|
|
433
|
+
r(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
434
434
|
});
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
437
|
emit(t, ...e) {
|
|
438
|
-
(this.listeners["*"] || []).forEach((
|
|
438
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t] || []).forEach((r) => r(...e));
|
|
439
439
|
}
|
|
440
440
|
off(t, e) {
|
|
441
|
-
this.listeners[t] = (this.listeners[t] || []).filter((
|
|
441
|
+
this.listeners[t] = (this.listeners[t] || []).filter((r) => r === e);
|
|
442
442
|
}
|
|
443
443
|
on(t, e) {
|
|
444
|
-
var
|
|
445
|
-
return this.listeners[t] || (this.listeners[t] = []), (
|
|
444
|
+
var r;
|
|
445
|
+
return this.listeners[t] || (this.listeners[t] = []), (r = this.listeners[t]) == null || r.push(e), () => this.off(t, e);
|
|
446
446
|
}
|
|
447
447
|
once(t, e) {
|
|
448
|
-
return new Promise((
|
|
448
|
+
return new Promise((r) => {
|
|
449
449
|
const s = this.on(t, (...i) => {
|
|
450
|
-
|
|
450
|
+
r(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
451
451
|
});
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
c(K, "listeners", {});
|
|
456
456
|
class y extends Error {
|
|
457
|
-
constructor(e,
|
|
457
|
+
constructor(e, r) {
|
|
458
458
|
super(e);
|
|
459
459
|
c(this, "_code");
|
|
460
|
-
|
|
460
|
+
r != null && (this._code = r);
|
|
461
461
|
}
|
|
462
462
|
get code() {
|
|
463
463
|
return this._code || this.constructor.code;
|
|
@@ -466,11 +466,11 @@ class y extends Error {
|
|
|
466
466
|
this._code = e;
|
|
467
467
|
}
|
|
468
468
|
static from(e) {
|
|
469
|
-
const
|
|
469
|
+
const r = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
|
|
470
470
|
return Object.assign(s, {
|
|
471
471
|
stack: e.stack,
|
|
472
472
|
...e,
|
|
473
|
-
code:
|
|
473
|
+
code: r ?? void 0
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
static instanceof(e) {
|
|
@@ -580,7 +580,7 @@ class et extends y {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
c(et, "code", 503);
|
|
583
|
-
class
|
|
583
|
+
class nt extends y {
|
|
584
584
|
constructor(t = "Gateway Timeout") {
|
|
585
585
|
super(t);
|
|
586
586
|
}
|
|
@@ -588,10 +588,10 @@ class rt extends y {
|
|
|
588
588
|
return t.constructor.code == this.code;
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
c(
|
|
592
|
-
function Gt(
|
|
593
|
-
if (
|
|
594
|
-
switch (
|
|
591
|
+
c(nt, "code", 504);
|
|
592
|
+
function Gt(n, t) {
|
|
593
|
+
if (n >= 200 && n < 300) return null;
|
|
594
|
+
switch (n) {
|
|
595
595
|
case 400:
|
|
596
596
|
return new W(t);
|
|
597
597
|
case 401:
|
|
@@ -615,9 +615,9 @@ function Gt(r, t) {
|
|
|
615
615
|
case 503:
|
|
616
616
|
return new et(t);
|
|
617
617
|
case 504:
|
|
618
|
-
return new
|
|
618
|
+
return new nt(t);
|
|
619
619
|
default:
|
|
620
|
-
return new y(t,
|
|
620
|
+
return new y(t, n);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
const E = class E {
|
|
@@ -647,16 +647,16 @@ const E = class E {
|
|
|
647
647
|
const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
|
|
648
648
|
e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
|
|
649
649
|
}
|
|
650
|
-
const
|
|
650
|
+
const r = ot({
|
|
651
651
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
652
652
|
...E.headers,
|
|
653
653
|
...this.headers,
|
|
654
654
|
...t.headers
|
|
655
655
|
});
|
|
656
|
-
return typeof t.body == "object" && t.body != null &&
|
|
656
|
+
return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
|
|
657
657
|
try {
|
|
658
658
|
fetch(e, {
|
|
659
|
-
headers:
|
|
659
|
+
headers: r,
|
|
660
660
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
661
661
|
body: t.body
|
|
662
662
|
}).then(async (u) => {
|
|
@@ -665,7 +665,7 @@ const E = class E {
|
|
|
665
665
|
await new Promise((C) => l(u, () => C()));
|
|
666
666
|
const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
667
667
|
let P = 0;
|
|
668
|
-
const T = (G = u.body) == null ? void 0 : G.getReader(),
|
|
668
|
+
const T = (G = u.body) == null ? void 0 : G.getReader(), rt = new ReadableStream({
|
|
669
669
|
start(l) {
|
|
670
670
|
function C() {
|
|
671
671
|
T == null || T.read().then((A) => {
|
|
@@ -676,7 +676,7 @@ const E = class E {
|
|
|
676
676
|
C();
|
|
677
677
|
}
|
|
678
678
|
});
|
|
679
|
-
if (u.data = new Response(
|
|
679
|
+
if (u.data = new Response(rt), t.decode == null || t.decode) {
|
|
680
680
|
const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
681
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());
|
|
682
682
|
}
|
|
@@ -690,8 +690,8 @@ const E = class E {
|
|
|
690
690
|
};
|
|
691
691
|
c(E, "interceptors", {}), c(E, "headers", {});
|
|
692
692
|
let F = E;
|
|
693
|
-
function Ut(
|
|
694
|
-
const t =
|
|
693
|
+
function Ut(n) {
|
|
694
|
+
const t = n.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
695
695
|
return I(decodeURIComponent(atob(t).split("").map(function(e) {
|
|
696
696
|
return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
|
|
697
697
|
}).join("")));
|
|
@@ -732,15 +732,15 @@ const R = {
|
|
|
732
732
|
WHITE: "\x1B[47m",
|
|
733
733
|
GREY: "\x1B[100m"
|
|
734
734
|
};
|
|
735
|
-
var ft = /* @__PURE__ */ ((
|
|
735
|
+
var ft = /* @__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))(ft || {});
|
|
736
736
|
const w = class w extends K {
|
|
737
737
|
constructor(t) {
|
|
738
738
|
super(), this.namespace = t;
|
|
739
739
|
}
|
|
740
|
-
pad(t, e,
|
|
740
|
+
pad(t, e, r, s = !1) {
|
|
741
741
|
const i = t.toString(), o = e - i.length;
|
|
742
742
|
if (o <= 0) return i;
|
|
743
|
-
const a = Array(~~(o /
|
|
743
|
+
const a = Array(~~(o / r.length)).fill(r).join("");
|
|
744
744
|
return s ? i + a : a + i;
|
|
745
745
|
}
|
|
746
746
|
format(...t) {
|
|
@@ -775,70 +775,70 @@ const w = class w extends K {
|
|
|
775
775
|
};
|
|
776
776
|
c(w, "LOG_LEVEL", 4);
|
|
777
777
|
let Y = w;
|
|
778
|
-
function Ft(
|
|
779
|
-
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e =
|
|
780
|
-
let
|
|
781
|
-
const i = t(s,
|
|
782
|
-
s = ~~(s / i),
|
|
783
|
-
const o = ~~(s /
|
|
784
|
-
return s -= o *
|
|
785
|
-
}
|
|
786
|
-
function Yt(
|
|
787
|
-
let t =
|
|
778
|
+
function Ft(n) {
|
|
779
|
+
const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = n.toString().length - 2;
|
|
780
|
+
let r = Math.pow(10, e), s = n * r;
|
|
781
|
+
const i = t(s, r);
|
|
782
|
+
s = ~~(s / i), r = ~~(r / i);
|
|
783
|
+
const o = ~~(s / r);
|
|
784
|
+
return s -= o * r, `${o ? o + " " : ""}${~~s}/${~~r}`;
|
|
785
|
+
}
|
|
786
|
+
function Yt(n) {
|
|
787
|
+
let t = n.split(" ");
|
|
788
788
|
const e = t.length == 2 ? Number(t[0]) : 0;
|
|
789
789
|
return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
|
|
790
790
|
}
|
|
791
791
|
const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = D + M + k;
|
|
792
|
-
function Ht(
|
|
793
|
-
if (
|
|
794
|
-
const e = 1024,
|
|
795
|
-
return parseFloat((
|
|
796
|
-
}
|
|
797
|
-
function Kt(
|
|
798
|
-
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(
|
|
799
|
-
if (!t) throw new Error(`Number cannot be parsed: ${
|
|
792
|
+
function Ht(n, t = 2) {
|
|
793
|
+
if (n === 0) return "0 Bytes";
|
|
794
|
+
const e = 1024, r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(n) / Math.log(e));
|
|
795
|
+
return parseFloat((n / Math.pow(e, s)).toFixed(t)) + " " + r[s];
|
|
796
|
+
}
|
|
797
|
+
function Kt(n) {
|
|
798
|
+
const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
|
|
799
|
+
if (!t) throw new Error(`Number cannot be parsed: ${n}`);
|
|
800
800
|
return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
|
|
801
801
|
}
|
|
802
|
-
function Wt(
|
|
803
|
-
return `${
|
|
802
|
+
function Wt(n, t, e) {
|
|
803
|
+
return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
|
|
804
804
|
}
|
|
805
|
-
function vt(
|
|
806
|
-
return
|
|
805
|
+
function vt(n, t, e = " ", r = !0) {
|
|
806
|
+
return r ? n.toString().padStart(t, e) : n.toString().padEnd(t, e);
|
|
807
807
|
}
|
|
808
|
-
function Jt(
|
|
809
|
-
return Array(
|
|
808
|
+
function Jt(n) {
|
|
809
|
+
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
810
810
|
}
|
|
811
|
-
function zt(
|
|
812
|
-
return Array(
|
|
811
|
+
function zt(n, t = ht) {
|
|
812
|
+
return Array(n).fill(null).map(() => {
|
|
813
813
|
const e = ~~(Math.random() * t.length);
|
|
814
814
|
return t[e];
|
|
815
815
|
}).join("");
|
|
816
816
|
}
|
|
817
|
-
function Zt(
|
|
818
|
-
if (!t && !e && !
|
|
819
|
-
return Array(
|
|
817
|
+
function Zt(n, t = !1, e = !1, r = !1) {
|
|
818
|
+
if (!t && !e && !r) throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
819
|
+
return Array(n).fill(null).map(() => {
|
|
820
820
|
let s;
|
|
821
821
|
do {
|
|
822
822
|
const i = ~~(Math.random() * 3);
|
|
823
|
-
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)] : r && i == 2 && (s = k[~~(Math.random() * k.length)]);
|
|
824
824
|
} while (!s);
|
|
825
825
|
return s;
|
|
826
826
|
}).join("");
|
|
827
827
|
}
|
|
828
|
-
function Vt(
|
|
828
|
+
function Vt(n, t) {
|
|
829
829
|
if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
|
|
830
830
|
throw new TypeError("Regular expression must be global.");
|
|
831
|
-
let e = [],
|
|
832
|
-
for (; (
|
|
833
|
-
e.push(
|
|
831
|
+
let e = [], r;
|
|
832
|
+
for (; (r = t.exec(n)) !== null; )
|
|
833
|
+
e.push(r);
|
|
834
834
|
return e;
|
|
835
835
|
}
|
|
836
|
-
function Xt(
|
|
836
|
+
function Xt(n) {
|
|
837
837
|
const t = new RegExp(
|
|
838
838
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
839
839
|
"gm"
|
|
840
|
-
).exec(
|
|
841
|
-
if (e.port != null && (e.port = Number(e.port)),
|
|
840
|
+
).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
|
|
841
|
+
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) {
|
|
842
842
|
const s = e.query.split("&"), i = {};
|
|
843
843
|
s.forEach((o) => {
|
|
844
844
|
const [a, u] = o.split("=");
|
|
@@ -847,74 +847,74 @@ function Xt(r) {
|
|
|
847
847
|
}
|
|
848
848
|
return e;
|
|
849
849
|
}
|
|
850
|
-
function dt(
|
|
851
|
-
var t = pt(yt(wt(gt(
|
|
850
|
+
function dt(n) {
|
|
851
|
+
var t = pt(yt(wt(gt(n), 8 * n.length)));
|
|
852
852
|
return t.toLowerCase();
|
|
853
853
|
}
|
|
854
|
-
function pt(
|
|
855
|
-
for (var t, e = "0123456789ABCDEF",
|
|
856
|
-
return
|
|
854
|
+
function pt(n) {
|
|
855
|
+
for (var t, e = "0123456789ABCDEF", r = "", s = 0; s < n.length; s++) t = n.charCodeAt(s), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
856
|
+
return r;
|
|
857
857
|
}
|
|
858
|
-
function gt(
|
|
859
|
-
for (var t = Array(
|
|
860
|
-
for (e = 0; e < 8 *
|
|
858
|
+
function gt(n) {
|
|
859
|
+
for (var t = Array(n.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
|
|
860
|
+
for (e = 0; e < 8 * n.length; e += 8) t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32;
|
|
861
861
|
return t;
|
|
862
862
|
}
|
|
863
|
-
function yt(
|
|
864
|
-
for (var t = "", e = 0; e < 32 *
|
|
863
|
+
function yt(n) {
|
|
864
|
+
for (var t = "", e = 0; e < 32 * n.length; e += 8) t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255);
|
|
865
865
|
return t;
|
|
866
866
|
}
|
|
867
|
-
function wt(
|
|
868
|
-
|
|
869
|
-
for (var e = 1732584193,
|
|
870
|
-
var a = e, u =
|
|
871
|
-
|
|
867
|
+
function wt(n, t) {
|
|
868
|
+
n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
|
|
869
|
+
for (var e = 1732584193, r = -271733879, s = -1732584194, i = 271733878, o = 0; o < n.length; o += 16) {
|
|
870
|
+
var a = e, u = r, $ = s, j = i;
|
|
871
|
+
r = p(r = p(r = p(r = p(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, s = f(s, i = f(i, e = f(e, r, s, i, n[o + 0], 7, -680876936), r, s, n[o + 1], 12, -389564586), e, r, n[o + 2], 17, 606105819), i, e, n[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 4], 7, -176418897), r, s, n[o + 5], 12, 1200080426), e, r, n[o + 6], 17, -1473231341), i, e, n[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 8], 7, 1770035416), r, s, n[o + 9], 12, -1958414417), e, r, n[o + 10], 17, -42063), i, e, n[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 12], 7, 1804603682), r, s, n[o + 13], 12, -40341101), e, r, n[o + 14], 17, -1502002290), i, e, n[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 1], 5, -165796510), r, s, n[o + 6], 9, -1069501632), e, r, n[o + 11], 14, 643717713), i, e, n[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 5], 5, -701558691), r, s, n[o + 10], 9, 38016083), e, r, n[o + 15], 14, -660478335), i, e, n[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 9], 5, 568446438), r, s, n[o + 14], 9, -1019803690), e, r, n[o + 3], 14, -187363961), i, e, n[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 13], 5, -1444681467), r, s, n[o + 2], 9, -51403784), e, r, n[o + 7], 14, 1735328473), i, e, n[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 5], 4, -378558), r, s, n[o + 8], 11, -2022574463), e, r, n[o + 11], 16, 1839030562), i, e, n[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 1], 4, -1530992060), r, s, n[o + 4], 11, 1272893353), e, r, n[o + 7], 16, -155497632), i, e, n[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 13], 4, 681279174), r, s, n[o + 0], 11, -358537222), e, r, n[o + 3], 16, -722521979), i, e, n[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 9], 4, -640364487), r, s, n[o + 12], 11, -421815835), e, r, n[o + 15], 16, 530742520), i, e, n[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 0], 6, -198630844), r, s, n[o + 7], 10, 1126891415), e, r, n[o + 14], 15, -1416354905), i, e, n[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 12], 6, 1700485571), r, s, n[o + 3], 10, -1894986606), e, r, n[o + 10], 15, -1051523), i, e, n[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 8], 6, 1873313359), r, s, n[o + 15], 10, -30611744), e, r, n[o + 6], 15, -1560198380), i, e, n[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 4], 6, -145523070), r, s, n[o + 11], 10, -1120210379), e, r, n[o + 2], 15, 718787259), i, e, n[o + 9], 21, -343485551), e = b(e, a), r = b(r, u), s = b(s, $), i = b(i, j);
|
|
872
872
|
}
|
|
873
|
-
return Array(e,
|
|
873
|
+
return Array(e, r, s, i);
|
|
874
874
|
}
|
|
875
|
-
function N(
|
|
876
|
-
return b(Et(b(b(t,
|
|
875
|
+
function N(n, t, e, r, s, i) {
|
|
876
|
+
return b(Et(b(b(t, n), b(r, i)), s), e);
|
|
877
877
|
}
|
|
878
|
-
function f(
|
|
879
|
-
return N(t & e | ~t &
|
|
878
|
+
function f(n, t, e, r, s, i, o) {
|
|
879
|
+
return N(t & e | ~t & r, n, t, s, i, o);
|
|
880
880
|
}
|
|
881
|
-
function h(
|
|
882
|
-
return N(t &
|
|
881
|
+
function h(n, t, e, r, s, i, o) {
|
|
882
|
+
return N(t & r | e & ~r, n, t, s, i, o);
|
|
883
883
|
}
|
|
884
|
-
function d(
|
|
885
|
-
return N(t ^ e ^
|
|
884
|
+
function d(n, t, e, r, s, i, o) {
|
|
885
|
+
return N(t ^ e ^ r, n, t, s, i, o);
|
|
886
886
|
}
|
|
887
|
-
function p(
|
|
888
|
-
return N(e ^ (t | ~
|
|
887
|
+
function p(n, t, e, r, s, i, o) {
|
|
888
|
+
return N(e ^ (t | ~r), n, t, s, i, o);
|
|
889
889
|
}
|
|
890
|
-
function b(
|
|
891
|
-
var e = (65535 &
|
|
892
|
-
return (
|
|
890
|
+
function b(n, t) {
|
|
891
|
+
var e = (65535 & n) + (65535 & t);
|
|
892
|
+
return (n >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
|
|
893
893
|
}
|
|
894
|
-
function Et(
|
|
895
|
-
return
|
|
894
|
+
function Et(n, t) {
|
|
895
|
+
return n << t | n >>> 32 - t;
|
|
896
896
|
}
|
|
897
|
-
function Qt(
|
|
898
|
-
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
897
|
+
function Qt(n) {
|
|
898
|
+
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
|
|
899
899
|
}
|
|
900
|
-
function _t(
|
|
901
|
-
return
|
|
900
|
+
function _t(n, t = "mp") {
|
|
901
|
+
return n ? `https://www.gravatar.com/avatar/${dt(n)}?d=${t}` : "";
|
|
902
902
|
}
|
|
903
|
-
function te(
|
|
904
|
-
return
|
|
903
|
+
function te(n) {
|
|
904
|
+
return n.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
905
905
|
}
|
|
906
|
-
function ee(
|
|
906
|
+
function ee(n, ...t) {
|
|
907
907
|
const e = [];
|
|
908
|
-
for (let
|
|
909
|
-
r
|
|
908
|
+
for (let r = 0; r < n.length || r < t.length; r++)
|
|
909
|
+
n[r] && e.push(n[r]), t[r] && e.push(t[r]);
|
|
910
910
|
return new g(e.join(""));
|
|
911
911
|
}
|
|
912
|
-
function mt(
|
|
912
|
+
function mt(n, ...t) {
|
|
913
913
|
let e = [];
|
|
914
|
-
for (let i = 0; i <
|
|
915
|
-
|
|
916
|
-
const [
|
|
917
|
-
return g.toString(
|
|
914
|
+
for (let i = 0; i < n.length || i < t.length; i++)
|
|
915
|
+
n[i] && e.push(n[i]), t[i] && e.push(t[i]);
|
|
916
|
+
const [r, s] = e.join("").split(":");
|
|
917
|
+
return g.toString(r, s == null ? void 0 : s.split(""));
|
|
918
918
|
}
|
|
919
919
|
class g {
|
|
920
920
|
constructor(t) {
|
|
@@ -942,8 +942,8 @@ class g {
|
|
|
942
942
|
c(this, "delete");
|
|
943
943
|
var o;
|
|
944
944
|
if (typeof t == "object") return Object.assign(this, t);
|
|
945
|
-
let [e,
|
|
946
|
-
s || (s =
|
|
945
|
+
let [e, r, s] = t.split(":");
|
|
946
|
+
s || (s = r || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
947
947
|
let i = e.split("/").filter((a) => !!a);
|
|
948
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")));
|
|
949
949
|
}
|
|
@@ -956,11 +956,11 @@ class g {
|
|
|
956
956
|
*/
|
|
957
957
|
static combine(t) {
|
|
958
958
|
let e = !1;
|
|
959
|
-
const
|
|
959
|
+
const r = t.map((s) => new g(s)).toSorted((s, i) => {
|
|
960
960
|
const o = s.fullPath.length, a = i.fullPath.length;
|
|
961
961
|
return o < a ? 1 : o > a ? -1 : 0;
|
|
962
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);
|
|
963
|
-
return
|
|
963
|
+
return r.all && (r.methods = ["*"]), r.none && (r.methods = ["n"]), r.methods = new S(r.methods), r.raw = mt`${r.fullPath}:${r.methods}`, r;
|
|
964
964
|
}
|
|
965
965
|
/**
|
|
966
966
|
* Squash 2 sets of paths & return true if any overlap is found
|
|
@@ -970,8 +970,8 @@ class g {
|
|
|
970
970
|
* @return {boolean} Whether there is any overlap
|
|
971
971
|
*/
|
|
972
972
|
static has(t, ...e) {
|
|
973
|
-
const
|
|
974
|
-
return !!
|
|
973
|
+
const r = m(e).map((i) => new g(i)), s = m(t).map((i) => new g(i));
|
|
974
|
+
return !!r.find((i) => {
|
|
975
975
|
if (!i.fullPath && i.all) return !0;
|
|
976
976
|
const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
|
|
977
977
|
if (!o.length) return !1;
|
|
@@ -987,7 +987,7 @@ class g {
|
|
|
987
987
|
* @return {boolean} Whether there is any overlap
|
|
988
988
|
*/
|
|
989
989
|
static hasAll(t, ...e) {
|
|
990
|
-
return e.filter((
|
|
990
|
+
return e.filter((r) => g.has(t, r)).length == e.length;
|
|
991
991
|
}
|
|
992
992
|
/**
|
|
993
993
|
* Same as `has` but raises an error if there is no overlap
|
|
@@ -1015,8 +1015,8 @@ class g {
|
|
|
1015
1015
|
* @return {string} String representation of Event
|
|
1016
1016
|
*/
|
|
1017
1017
|
static toString(t, e) {
|
|
1018
|
-
let
|
|
1019
|
-
return e != null && e.length && (
|
|
1018
|
+
let r = m(t).filter((s) => s != null).join("/");
|
|
1019
|
+
return e != null && e.length && (r += `:${m(e).map((s) => s.toLowerCase()).join("")}`), r == null ? void 0 : r.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
1022
1022
|
* Create event string from its components
|
|
@@ -1027,44 +1027,44 @@ class g {
|
|
|
1027
1027
|
return g.toString(this.fullPath, this.methods);
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
-
class
|
|
1030
|
+
class ne {
|
|
1031
1031
|
constructor() {
|
|
1032
1032
|
c(this, "listeners", []);
|
|
1033
1033
|
}
|
|
1034
1034
|
emit(t, ...e) {
|
|
1035
|
-
const
|
|
1036
|
-
this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](
|
|
1035
|
+
const r = new g(t);
|
|
1036
|
+
this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](r, ...e));
|
|
1037
1037
|
}
|
|
1038
1038
|
off(t) {
|
|
1039
1039
|
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
1040
1040
|
}
|
|
1041
1041
|
on(t, e) {
|
|
1042
|
-
return m(t).forEach((
|
|
1042
|
+
return m(t).forEach((r) => this.listeners.push([new g(r), e])), () => this.off(e);
|
|
1043
1043
|
}
|
|
1044
1044
|
once(t, e) {
|
|
1045
|
-
return new Promise((
|
|
1045
|
+
return new Promise((r) => {
|
|
1046
1046
|
const s = this.on(t, (i, ...o) => {
|
|
1047
|
-
|
|
1047
|
+
r(o.length < 2 ? o[0] : o), e && e(i, ...o), s();
|
|
1048
1048
|
});
|
|
1049
1049
|
});
|
|
1050
1050
|
}
|
|
1051
1051
|
relayEvents(t) {
|
|
1052
|
-
t.on("*", (e, ...
|
|
1052
|
+
t.on("*", (e, ...r) => this.emit(e, ...r));
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
(typeof
|
|
1057
|
-
let t =
|
|
1058
|
-
return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${
|
|
1055
|
+
function re(n) {
|
|
1056
|
+
(typeof n == "number" || typeof n == "string") && (n = new Date(n));
|
|
1057
|
+
let t = n.getHours(), e = "AM";
|
|
1058
|
+
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}`;
|
|
1059
1059
|
}
|
|
1060
|
-
function St(
|
|
1061
|
-
return new Promise((t) => setTimeout(t,
|
|
1060
|
+
function St(n) {
|
|
1061
|
+
return new Promise((t) => setTimeout(t, n));
|
|
1062
1062
|
}
|
|
1063
|
-
async function se(
|
|
1064
|
-
for (; await
|
|
1063
|
+
async function se(n, t = 100) {
|
|
1064
|
+
for (; await n(); ) await St(t);
|
|
1065
1065
|
}
|
|
1066
|
-
function ie(
|
|
1067
|
-
return (
|
|
1066
|
+
function ie(n) {
|
|
1067
|
+
return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
|
|
1068
1068
|
}
|
|
1069
1069
|
function oe() {
|
|
1070
1070
|
return Object.keys({});
|
|
@@ -1079,7 +1079,7 @@ export {
|
|
|
1079
1079
|
L as CliForeground,
|
|
1080
1080
|
y as CustomError,
|
|
1081
1081
|
z as ForbiddenError,
|
|
1082
|
-
|
|
1082
|
+
nt as GatewayTimeoutError,
|
|
1083
1083
|
F as Http,
|
|
1084
1084
|
Q as InternalServerError,
|
|
1085
1085
|
I as JSONAttemptParse,
|
|
@@ -1093,7 +1093,7 @@ export {
|
|
|
1093
1093
|
ee as PE,
|
|
1094
1094
|
mt as PES,
|
|
1095
1095
|
g as PathEvent,
|
|
1096
|
-
|
|
1096
|
+
ne as PathEventEmitter,
|
|
1097
1097
|
J as PaymentRequiredError,
|
|
1098
1098
|
x as PromiseProgress,
|
|
1099
1099
|
et as ServiceUnavailableError,
|
|
@@ -1119,7 +1119,7 @@ export {
|
|
|
1119
1119
|
H as flattenObj,
|
|
1120
1120
|
At as formData,
|
|
1121
1121
|
Ht as formatBytes,
|
|
1122
|
-
|
|
1122
|
+
re as formatDate,
|
|
1123
1123
|
Kt as formatPhoneNumber,
|
|
1124
1124
|
Yt as fracToDec,
|
|
1125
1125
|
_t as gravatar,
|