@ztimson/utils 0.14.6 → 0.14.7
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/http.d.ts +7 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +194 -190
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var v = (n, e, t) => e in n ? Y(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var a = (n, e, t) => (v(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
function F(n, e = !1) {
|
|
5
5
|
if (n == null)
|
|
6
6
|
throw new Error("Cannot clean a NULL value");
|
|
7
7
|
return Array.isArray(n) ? n = n.filter((t) => t != null) : Object.entries(n).forEach(([t, r]) => {
|
|
8
8
|
(e && r === void 0 || !e && r == null) && delete n[t];
|
|
9
9
|
}), n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function lt(n) {
|
|
12
12
|
return JSON.parse(JSON.stringify(n));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function W(n, ...e) {
|
|
15
15
|
return e.forEach((t) => {
|
|
16
16
|
for (const r in t)
|
|
17
|
-
t[r] && typeof t[r] == "object" && !Array.isArray(t[r]) ? (n[r] || (n[r] = {}),
|
|
17
|
+
t[r] && typeof t[r] == "object" && !Array.isArray(t[r]) ? (n[r] || (n[r] = {}), W(n[r], t[r])) : n[r] = t[r];
|
|
18
18
|
}), n;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function C(n, e, t) {
|
|
21
21
|
if (!(n == null || !e))
|
|
22
22
|
return e.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, i) => {
|
|
23
23
|
if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
|
|
@@ -28,28 +28,28 @@ function N(n, e, t) {
|
|
|
28
28
|
return t !== void 0 && s == i.length - 1 ? r[o] = t : r[o];
|
|
29
29
|
}, n);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function z(n, e, t = {}) {
|
|
32
32
|
if (typeof n == "object" && !Array.isArray(n)) {
|
|
33
33
|
for (const r of Object.keys(n)) {
|
|
34
34
|
const o = e ? e + "." + r : r;
|
|
35
|
-
typeof n[r] == "object" ?
|
|
35
|
+
typeof n[r] == "object" ? z(n[r], o, t) : t[o] = n[r];
|
|
36
36
|
}
|
|
37
37
|
return t;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function U(n, e, t = !1) {
|
|
41
41
|
if (n == null)
|
|
42
42
|
return t;
|
|
43
43
|
if (Array.isArray(e))
|
|
44
|
-
return e.findIndex((o, s) => !
|
|
44
|
+
return e.findIndex((o, s) => !U(n[s], e[s], t)) == -1;
|
|
45
45
|
const r = typeof e;
|
|
46
|
-
return r != typeof n ? !1 : r == "object" ? Object.keys(e).find((o) => !
|
|
46
|
+
return r != typeof n ? !1 : r == "object" ? Object.keys(e).find((o) => !U(n[o], e[o], t)) == null : r == "function" ? n.toString() == e.toString() : n == e;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function b(n, e) {
|
|
49
49
|
const t = typeof n, r = typeof e;
|
|
50
|
-
return t != "object" || n == null || r != "object" || e == null ? t == "function" && r == "function" ? n.toString() == e.toString() : n === e : Object.keys(n).length != Object.keys(e).length ? !1 : Object.keys(n).every((s) =>
|
|
50
|
+
return t != "object" || n == null || r != "object" || e == null ? t == "function" && r == "function" ? n.toString() == e.toString() : n === e : Object.keys(n).length != Object.keys(e).length ? !1 : Object.keys(n).every((s) => b(n[s], e[s]));
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ht(n, e) {
|
|
53
53
|
e.forEach((t) => {
|
|
54
54
|
Object.getOwnPropertyNames(t.prototype).forEach((r) => {
|
|
55
55
|
Object.defineProperty(
|
|
@@ -60,7 +60,7 @@ function dt(n, e) {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ft(n, e) {
|
|
64
64
|
let t = [];
|
|
65
65
|
return JSON.parse(JSON.stringify(n, (r, o) => {
|
|
66
66
|
if (typeof o == "object" && o !== null) {
|
|
@@ -71,42 +71,42 @@ function pt(n, e) {
|
|
|
71
71
|
return o;
|
|
72
72
|
}, e));
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function dt(n, e) {
|
|
75
75
|
return n.indexOf(e) === -1 && n.push(e), n;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
79
|
-
...n.filter((t) => !e.includes((r) =>
|
|
80
|
-
...e.filter((t) => !n.includes((r) =>
|
|
77
|
+
function yt(n, e) {
|
|
78
|
+
return K([
|
|
79
|
+
...n.filter((t) => !e.includes((r) => b(t, r))),
|
|
80
|
+
...e.filter((t) => !n.includes((r) => b(t, r)))
|
|
81
81
|
]);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function pt(n) {
|
|
84
84
|
return function(e, t) {
|
|
85
|
-
const r =
|
|
85
|
+
const r = C(e, n), o = C(t, n);
|
|
86
86
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
return n.forEach((t) => Array.isArray(t) ?
|
|
89
|
+
function J(n, e = []) {
|
|
90
|
+
return n.forEach((t) => Array.isArray(t) ? J(t, e) : e.push(t)), e;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function gt(n, e = !1) {
|
|
93
93
|
return function(t, r) {
|
|
94
|
-
const o =
|
|
94
|
+
const o = C(t, n), s = C(r, n);
|
|
95
95
|
return typeof o == "number" && typeof s == "number" ? (e ? -1 : 1) * (o - s) : o > s ? e ? -1 : 1 : o < s ? e ? 1 : -1 : 0;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return (t) =>
|
|
98
|
+
function mt(n, e) {
|
|
99
|
+
return (t) => b(t[n], e);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function K(n) {
|
|
102
102
|
for (let e = n.length - 1; e >= 0; e--)
|
|
103
|
-
n.slice(0, e).find((t) =>
|
|
103
|
+
n.slice(0, e).find((t) => b(t, n[e])) && n.splice(e, 1);
|
|
104
104
|
return n;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Et(n) {
|
|
107
107
|
return Array.isArray(n) ? n : [n];
|
|
108
108
|
}
|
|
109
|
-
class
|
|
109
|
+
class B extends Array {
|
|
110
110
|
get size() {
|
|
111
111
|
return this.length;
|
|
112
112
|
}
|
|
@@ -121,13 +121,13 @@ class b extends Array {
|
|
|
121
121
|
t != -1 && this.slice(t, 1);
|
|
122
122
|
}
|
|
123
123
|
difference(e) {
|
|
124
|
-
return new
|
|
124
|
+
return new B(this.reduce((t, r) => (e.has(r) || t.push(r), t), []));
|
|
125
125
|
}
|
|
126
126
|
has(e) {
|
|
127
127
|
return this.indexOf(e) != -1;
|
|
128
128
|
}
|
|
129
129
|
intersection(e) {
|
|
130
|
-
return new
|
|
130
|
+
return new B(this.reduce((t, r) => (e.has(r) && t.push(r), t), []));
|
|
131
131
|
}
|
|
132
132
|
isDisjointFrom(e) {
|
|
133
133
|
return this.intersection(e).size == 0;
|
|
@@ -139,10 +139,10 @@ class b extends Array {
|
|
|
139
139
|
return e.findIndex((t) => !this.has(t)) == -1;
|
|
140
140
|
}
|
|
141
141
|
symmetricDifference(e) {
|
|
142
|
-
return new
|
|
142
|
+
return new B([...this.difference(e), ...e.difference(this)]);
|
|
143
143
|
}
|
|
144
144
|
union(e) {
|
|
145
|
-
return new
|
|
145
|
+
return new B([...this, ...e]);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
class E extends Promise {
|
|
@@ -152,8 +152,8 @@ class E extends Promise {
|
|
|
152
152
|
(s) => o(s),
|
|
153
153
|
(s) => this.progress = s
|
|
154
154
|
));
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
a(this, "listeners", []);
|
|
156
|
+
a(this, "_progress", 0);
|
|
157
157
|
}
|
|
158
158
|
get progress() {
|
|
159
159
|
return this._progress;
|
|
@@ -182,15 +182,15 @@ class E extends Promise {
|
|
|
182
182
|
return this.from(super.finally(t));
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function V(n, e) {
|
|
186
186
|
const t = document.createElement("a");
|
|
187
187
|
t.href = n, t.download = e, document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function wt(n, e) {
|
|
190
190
|
const t = URL.createObjectURL(n);
|
|
191
|
-
|
|
191
|
+
V(t, e), URL.revokeObjectURL(t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function xt(n = {}) {
|
|
194
194
|
return new Promise((e) => {
|
|
195
195
|
const t = document.createElement("input");
|
|
196
196
|
t.type = "file", t.accept = n.accept || "*", t.style.display = "none", t.multiple = !!n.multiple, t.onblur = t.onchange = async () => {
|
|
@@ -198,15 +198,15 @@ function Bt(n = {}) {
|
|
|
198
198
|
}, document.body.appendChild(t), t.click();
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function At(n) {
|
|
202
202
|
return new E((e, t, r) => {
|
|
203
203
|
const o = new XMLHttpRequest(), s = new FormData();
|
|
204
|
-
n.files.forEach((i) => s.append("file", i)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (i) => i.lengthComputable ? r(i.loaded / i.total) : null), o.upload.addEventListener("load", (i) => e(i)), o.upload.addEventListener("error", (i) => t(i)), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([i,
|
|
204
|
+
n.files.forEach((i) => s.append("file", i)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (i) => i.lengthComputable ? r(i.loaded / i.total) : null), o.upload.addEventListener("load", (i) => e(i)), o.upload.addEventListener("error", (i) => t(i)), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([i, y]) => o.setRequestHeader(i, y)), o.send(s);
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
class
|
|
207
|
+
class P {
|
|
208
208
|
constructor() {
|
|
209
|
-
|
|
209
|
+
a(this, "listeners", {});
|
|
210
210
|
}
|
|
211
211
|
static emit(e, ...t) {
|
|
212
212
|
(this.listeners["*"] || []).forEach((r) => r(e, ...t)), (this.listeners[e.toString()] || []).forEach((r) => r(...t));
|
|
@@ -245,11 +245,11 @@ class Y {
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
a(P, "listeners", {});
|
|
249
249
|
class w extends Error {
|
|
250
250
|
constructor(t, r) {
|
|
251
251
|
super(t);
|
|
252
|
-
|
|
252
|
+
a(this, "_code");
|
|
253
253
|
r != null && (this._code = r);
|
|
254
254
|
}
|
|
255
255
|
get code() {
|
|
@@ -273,8 +273,8 @@ class w extends Error {
|
|
|
273
273
|
return this.message || super.toString();
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
class
|
|
276
|
+
a(w, "code", 500);
|
|
277
|
+
class Z extends w {
|
|
278
278
|
constructor(e = "Bad Request") {
|
|
279
279
|
super(e);
|
|
280
280
|
}
|
|
@@ -282,8 +282,8 @@ class Q extends w {
|
|
|
282
282
|
return e.constructor.code == this.code;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
|
|
286
|
-
class
|
|
285
|
+
a(Z, "code", 400);
|
|
286
|
+
class X extends w {
|
|
287
287
|
constructor(e = "Unauthorized") {
|
|
288
288
|
super(e);
|
|
289
289
|
}
|
|
@@ -291,8 +291,8 @@ class _ extends w {
|
|
|
291
291
|
return e.constructor.code == this.code;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
class
|
|
294
|
+
a(X, "code", 401);
|
|
295
|
+
class Q extends w {
|
|
296
296
|
constructor(e = "Forbidden") {
|
|
297
297
|
super(e);
|
|
298
298
|
}
|
|
@@ -300,8 +300,8 @@ class tt extends w {
|
|
|
300
300
|
return e.constructor.code == this.code;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
class
|
|
303
|
+
a(Q, "code", 403);
|
|
304
|
+
class _ extends w {
|
|
305
305
|
constructor(e = "Not Found") {
|
|
306
306
|
super(e);
|
|
307
307
|
}
|
|
@@ -309,8 +309,8 @@ class et extends w {
|
|
|
309
309
|
return e.constructor.code == this.code;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
313
|
-
class
|
|
312
|
+
a(_, "code", 404);
|
|
313
|
+
class tt extends w {
|
|
314
314
|
constructor(e = "Internal Server Error") {
|
|
315
315
|
super(e);
|
|
316
316
|
}
|
|
@@ -318,12 +318,12 @@ class nt extends w {
|
|
|
318
318
|
return e.constructor.code == this.code;
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
a(tt, "code", 500);
|
|
322
322
|
const g = class g {
|
|
323
323
|
constructor(e = {}) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
a(this, "interceptors", {});
|
|
325
|
+
a(this, "headers", {});
|
|
326
|
+
a(this, "url");
|
|
327
327
|
this.url = e.url ?? null, this.headers = e.headers || {}, e.interceptors && e.interceptors.forEach((t) => g.addInterceptor(t));
|
|
328
328
|
}
|
|
329
329
|
static addInterceptor(e) {
|
|
@@ -347,43 +347,47 @@ const g = class g {
|
|
|
347
347
|
const s = Array.isArray(e.query) ? e.query : Object.keys(e.query).map((i) => ({ key: i, value: e.query[i] }));
|
|
348
348
|
t += (t.includes("?") ? "&" : "?") + s.map((i) => `${i.key}=${i.value}`).join("&");
|
|
349
349
|
}
|
|
350
|
-
const r =
|
|
350
|
+
const r = F({
|
|
351
351
|
"Content-Type": e.body ? e.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
352
352
|
...g.headers,
|
|
353
353
|
...this.headers,
|
|
354
354
|
...e.headers
|
|
355
355
|
});
|
|
356
|
-
return typeof e.body == "object" && e.body != null && r["Content-Type"] == "application/json" && (e.body = JSON.stringify(e.body)), new E((s, i,
|
|
356
|
+
return typeof e.body == "object" && e.body != null && r["Content-Type"] == "application/json" && (e.body = JSON.stringify(e.body)), new E((s, i, y) => {
|
|
357
357
|
fetch(t, {
|
|
358
358
|
headers: r,
|
|
359
359
|
method: e.method || (e.body ? "POST" : "GET"),
|
|
360
360
|
body: e.body
|
|
361
361
|
}).then(async (c) => {
|
|
362
|
-
var
|
|
363
|
-
for (let
|
|
364
|
-
await new Promise((
|
|
365
|
-
const
|
|
366
|
-
let
|
|
367
|
-
const
|
|
368
|
-
start(
|
|
369
|
-
function
|
|
370
|
-
|
|
371
|
-
if (
|
|
372
|
-
return
|
|
373
|
-
|
|
374
|
-
}).catch((
|
|
362
|
+
var k, G;
|
|
363
|
+
for (let u of [...Object.values(g.interceptors), ...Object.values(this.interceptors)])
|
|
364
|
+
await new Promise((L) => u(c, () => L()));
|
|
365
|
+
const R = c.headers.get("Content-Length"), N = R ? parseInt(R, 10) : 0;
|
|
366
|
+
let j = 0;
|
|
367
|
+
const I = (k = c.body) == null ? void 0 : k.getReader(), H = new ReadableStream({
|
|
368
|
+
start(u) {
|
|
369
|
+
function L() {
|
|
370
|
+
I == null || I.read().then((x) => {
|
|
371
|
+
if (x.done)
|
|
372
|
+
return u.close();
|
|
373
|
+
j += x.value.byteLength, y(j / N), u.enqueue(x.value), L();
|
|
374
|
+
}).catch((x) => u.error(x));
|
|
375
375
|
}
|
|
376
|
-
|
|
376
|
+
L();
|
|
377
377
|
}
|
|
378
|
-
})
|
|
379
|
-
|
|
378
|
+
});
|
|
379
|
+
if (c.data = new Response(H), e.decode !== !1) {
|
|
380
|
+
const u = (G = c.headers.get("Content-Type")) == null ? void 0 : G.toLowerCase();
|
|
381
|
+
u != null && u.includes("json") ? c.data = await c.data.json() : u != null && u.includes("text") ? c.data = await c.data.text() : u != null && u.includes("form") ? c.data = await c.data.formData() : u != null && u.includes("application") && (c.data = await c.data.blob());
|
|
382
|
+
}
|
|
383
|
+
c.ok ? s(c) : i(c);
|
|
380
384
|
});
|
|
381
385
|
});
|
|
382
386
|
}
|
|
383
387
|
};
|
|
384
|
-
|
|
385
|
-
let
|
|
386
|
-
const
|
|
388
|
+
a(g, "interceptors", {}), a(g, "headers", {});
|
|
389
|
+
let M = g;
|
|
390
|
+
const A = {
|
|
387
391
|
CLEAR: "\x1B[0m",
|
|
388
392
|
BRIGHT: "\x1B[1m",
|
|
389
393
|
DIM: "\x1B[2m",
|
|
@@ -391,7 +395,7 @@ const B = {
|
|
|
391
395
|
BLINK: "\x1B[5m",
|
|
392
396
|
REVERSE: "\x1B[7m",
|
|
393
397
|
HIDDEN: "\x1B[8m"
|
|
394
|
-
},
|
|
398
|
+
}, O = {
|
|
395
399
|
BLACK: "\x1B[30m",
|
|
396
400
|
RED: "\x1B[31m",
|
|
397
401
|
GREEN: "\x1B[32m",
|
|
@@ -408,7 +412,7 @@ const B = {
|
|
|
408
412
|
LIGHT_MAGENTA: "\x1B[95m",
|
|
409
413
|
LIGHT_CYAN: "\x1B[96m",
|
|
410
414
|
WHITE: "\x1B[97m"
|
|
411
|
-
},
|
|
415
|
+
}, Bt = {
|
|
412
416
|
BLACK: "\x1B[40m",
|
|
413
417
|
RED: "\x1B[41m",
|
|
414
418
|
GREEN: "\x1B[42m",
|
|
@@ -419,8 +423,8 @@ const B = {
|
|
|
419
423
|
WHITE: "\x1B[47m",
|
|
420
424
|
GREY: "\x1B[100m"
|
|
421
425
|
};
|
|
422
|
-
var
|
|
423
|
-
const p = class p extends
|
|
426
|
+
var et = /* @__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))(et || {});
|
|
427
|
+
const p = class p extends P {
|
|
424
428
|
constructor(e) {
|
|
425
429
|
super(), this.namespace = e;
|
|
426
430
|
}
|
|
@@ -428,8 +432,8 @@ const p = class p extends Y {
|
|
|
428
432
|
const s = e.toString(), i = t - s.length;
|
|
429
433
|
if (i <= 0)
|
|
430
434
|
return s;
|
|
431
|
-
const
|
|
432
|
-
return o ? s +
|
|
435
|
+
const y = Array(~~(i / r.length)).fill(r).join("");
|
|
436
|
+
return o ? s + y : y + s;
|
|
433
437
|
}
|
|
434
438
|
format(...e) {
|
|
435
439
|
const t = /* @__PURE__ */ new Date();
|
|
@@ -439,90 +443,90 @@ const p = class p extends Y {
|
|
|
439
443
|
if (p.LOG_LEVEL < 4)
|
|
440
444
|
return;
|
|
441
445
|
const t = this.format(...e);
|
|
442
|
-
p.emit(4, t), console.debug(
|
|
446
|
+
p.emit(4, t), console.debug(O.LIGHT_GREY + t + A.CLEAR);
|
|
443
447
|
}
|
|
444
448
|
log(...e) {
|
|
445
449
|
if (p.LOG_LEVEL < 3)
|
|
446
450
|
return;
|
|
447
451
|
const t = this.format(...e);
|
|
448
|
-
p.emit(3, t), console.log(
|
|
452
|
+
p.emit(3, t), console.log(A.CLEAR + t);
|
|
449
453
|
}
|
|
450
454
|
info(...e) {
|
|
451
455
|
if (p.LOG_LEVEL < 2)
|
|
452
456
|
return;
|
|
453
457
|
const t = this.format(...e);
|
|
454
|
-
p.emit(2, t), console.info(
|
|
458
|
+
p.emit(2, t), console.info(O.BLUE + t + A.CLEAR);
|
|
455
459
|
}
|
|
456
460
|
warn(...e) {
|
|
457
461
|
if (p.LOG_LEVEL < 1)
|
|
458
462
|
return;
|
|
459
463
|
const t = this.format(...e);
|
|
460
|
-
p.emit(1, t), console.warn(
|
|
464
|
+
p.emit(1, t), console.warn(O.YELLOW + t + A.CLEAR);
|
|
461
465
|
}
|
|
462
466
|
error(...e) {
|
|
463
467
|
if (p.LOG_LEVEL < 0)
|
|
464
468
|
return;
|
|
465
469
|
const t = this.format(...e);
|
|
466
|
-
p.emit(0, t), console.error(
|
|
470
|
+
p.emit(0, t), console.error(O.RED + t + A.CLEAR);
|
|
467
471
|
}
|
|
468
472
|
};
|
|
469
|
-
|
|
470
|
-
let
|
|
471
|
-
function
|
|
472
|
-
const e = (
|
|
473
|
+
a(p, "LOG_LEVEL", 4);
|
|
474
|
+
let q = p;
|
|
475
|
+
function bt(n) {
|
|
476
|
+
const e = (y, c) => c < 1e-7 ? y : e(c, ~~(y % c)), t = n.toString().length - 2;
|
|
473
477
|
let r = Math.pow(10, t), o = n * r;
|
|
474
478
|
const s = e(o, r);
|
|
475
479
|
o = ~~(o / s), r = ~~(r / s);
|
|
476
480
|
const i = ~~(o / r);
|
|
477
481
|
return o -= i * r, `${i ? i + " " : ""}${~~o}/${~~r}`;
|
|
478
482
|
}
|
|
479
|
-
function
|
|
483
|
+
function Rt(n) {
|
|
480
484
|
let e = n.split(" ");
|
|
481
485
|
const t = e.length == 2 ? Number(e[0]) : 0;
|
|
482
486
|
return e = e.pop().split("/"), t + Number(e[0]) / Number(e[1]);
|
|
483
487
|
}
|
|
484
|
-
function
|
|
488
|
+
function Lt(n, e) {
|
|
485
489
|
return n.length - n.replaceAll(e, "").length;
|
|
486
490
|
}
|
|
487
|
-
function
|
|
491
|
+
function Ot(n) {
|
|
488
492
|
return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
489
493
|
}
|
|
490
|
-
const
|
|
491
|
-
function
|
|
494
|
+
const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", $ = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", nt = T + $ + D;
|
|
495
|
+
function Ct(n) {
|
|
492
496
|
const e = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
|
|
493
497
|
if (!e)
|
|
494
498
|
throw new Error(`Number cannot be parsed: ${n}`);
|
|
495
499
|
return `${e[1] ?? ""} (${e[2]}) ${e[3]}-${e[4]}`.trim();
|
|
496
500
|
}
|
|
497
|
-
function
|
|
501
|
+
function St(n, e, t) {
|
|
498
502
|
return `${n.slice(0, t)}${e}${n.slice(t + 1)}`;
|
|
499
503
|
}
|
|
500
|
-
function
|
|
504
|
+
function Nt(n, e, t, r = !0) {
|
|
501
505
|
const o = n.toString(), s = e - o.length;
|
|
502
506
|
if (s <= 0)
|
|
503
507
|
return o;
|
|
504
508
|
const i = Array(~~(s / t.length)).fill(t).join("");
|
|
505
509
|
return r ? i + o : o + i;
|
|
506
510
|
}
|
|
507
|
-
function
|
|
511
|
+
function It(n, e = nt) {
|
|
508
512
|
return Array(n).fill(null).map(() => {
|
|
509
513
|
const t = ~~(Math.random() * e.length);
|
|
510
514
|
return e[t];
|
|
511
515
|
}).join("");
|
|
512
516
|
}
|
|
513
|
-
function
|
|
517
|
+
function Tt(n, e = !1, t = !1, r = !1) {
|
|
514
518
|
if (!e && !t && !r)
|
|
515
519
|
throw new Error("Must enable at least one: letters, numbers, symbols");
|
|
516
520
|
return Array(n).fill(null).map(() => {
|
|
517
521
|
let o;
|
|
518
522
|
do {
|
|
519
523
|
const s = ~~(Math.random() * 3);
|
|
520
|
-
e && s == 0 ? o =
|
|
524
|
+
e && s == 0 ? o = T[~~(Math.random() * T.length)] : t && s == 1 ? o = $[~~(Math.random() * $.length)] : r && s == 2 && (o = D[~~(Math.random() * D.length)]);
|
|
521
525
|
} while (!o);
|
|
522
526
|
return o;
|
|
523
527
|
}).join("");
|
|
524
528
|
}
|
|
525
|
-
function
|
|
529
|
+
function $t(n, e) {
|
|
526
530
|
if (typeof e == "string" && (e = new RegExp(e, "g")), !e.global)
|
|
527
531
|
throw new TypeError("Regular expression must be global.");
|
|
528
532
|
let t = [], r;
|
|
@@ -530,69 +534,69 @@ function jt(n, e) {
|
|
|
530
534
|
t.push(r);
|
|
531
535
|
return t;
|
|
532
536
|
}
|
|
533
|
-
function
|
|
534
|
-
var e = it(
|
|
537
|
+
function rt(n) {
|
|
538
|
+
var e = ot(it(ct(st(n), 8 * n.length)));
|
|
535
539
|
return e.toLowerCase();
|
|
536
540
|
}
|
|
537
|
-
function
|
|
541
|
+
function ot(n) {
|
|
538
542
|
for (var e, t = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
|
|
539
543
|
e = n.charCodeAt(o), r += t.charAt(e >>> 4 & 15) + t.charAt(15 & e);
|
|
540
544
|
return r;
|
|
541
545
|
}
|
|
542
|
-
function
|
|
546
|
+
function st(n) {
|
|
543
547
|
for (var e = Array(n.length >> 2), t = 0; t < e.length; t++)
|
|
544
548
|
e[t] = 0;
|
|
545
549
|
for (t = 0; t < 8 * n.length; t += 8)
|
|
546
550
|
e[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32;
|
|
547
551
|
return e;
|
|
548
552
|
}
|
|
549
|
-
function
|
|
553
|
+
function it(n) {
|
|
550
554
|
for (var e = "", t = 0; t < 32 * n.length; t += 8)
|
|
551
555
|
e += String.fromCharCode(n[t >> 5] >>> t % 32 & 255);
|
|
552
556
|
return e;
|
|
553
557
|
}
|
|
554
|
-
function
|
|
558
|
+
function ct(n, e) {
|
|
555
559
|
n[e >> 5] |= 128 << e % 32, n[14 + (e + 64 >>> 9 << 4)] = e;
|
|
556
560
|
for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878, i = 0; i < n.length; i += 16) {
|
|
557
|
-
var
|
|
558
|
-
r =
|
|
561
|
+
var y = t, c = r, R = o, N = s;
|
|
562
|
+
r = d(r = d(r = d(r = d(r = f(r = f(r = f(r = f(r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s, t = l(t, r, o, s, n[i + 0], 7, -680876936), r, o, n[i + 1], 12, -389564586), t, r, n[i + 2], 17, 606105819), s, t, n[i + 3], 22, -1044525330), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 4], 7, -176418897), r, o, n[i + 5], 12, 1200080426), t, r, n[i + 6], 17, -1473231341), s, t, n[i + 7], 22, -45705983), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 8], 7, 1770035416), r, o, n[i + 9], 12, -1958414417), t, r, n[i + 10], 17, -42063), s, t, n[i + 11], 22, -1990404162), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 12], 7, 1804603682), r, o, n[i + 13], 12, -40341101), t, r, n[i + 14], 17, -1502002290), s, t, n[i + 15], 22, 1236535329), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 1], 5, -165796510), r, o, n[i + 6], 9, -1069501632), t, r, n[i + 11], 14, 643717713), s, t, n[i + 0], 20, -373897302), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 5], 5, -701558691), r, o, n[i + 10], 9, 38016083), t, r, n[i + 15], 14, -660478335), s, t, n[i + 4], 20, -405537848), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 9], 5, 568446438), r, o, n[i + 14], 9, -1019803690), t, r, n[i + 3], 14, -187363961), s, t, n[i + 8], 20, 1163531501), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 13], 5, -1444681467), r, o, n[i + 2], 9, -51403784), t, r, n[i + 7], 14, 1735328473), s, t, n[i + 12], 20, -1926607734), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 5], 4, -378558), r, o, n[i + 8], 11, -2022574463), t, r, n[i + 11], 16, 1839030562), s, t, n[i + 14], 23, -35309556), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 1], 4, -1530992060), r, o, n[i + 4], 11, 1272893353), t, r, n[i + 7], 16, -155497632), s, t, n[i + 10], 23, -1094730640), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 13], 4, 681279174), r, o, n[i + 0], 11, -358537222), t, r, n[i + 3], 16, -722521979), s, t, n[i + 6], 23, 76029189), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 9], 4, -640364487), r, o, n[i + 12], 11, -421815835), t, r, n[i + 15], 16, 530742520), s, t, n[i + 2], 23, -995338651), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 0], 6, -198630844), r, o, n[i + 7], 10, 1126891415), t, r, n[i + 14], 15, -1416354905), s, t, n[i + 5], 21, -57434055), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 12], 6, 1700485571), r, o, n[i + 3], 10, -1894986606), t, r, n[i + 10], 15, -1051523), s, t, n[i + 1], 21, -2054922799), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 8], 6, 1873313359), r, o, n[i + 15], 10, -30611744), t, r, n[i + 6], 15, -1560198380), s, t, n[i + 13], 21, 1309151649), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 4], 6, -145523070), r, o, n[i + 11], 10, -1120210379), t, r, n[i + 2], 15, 718787259), s, t, n[i + 9], 21, -343485551), t = m(t, y), r = m(r, c), o = m(o, R), s = m(s, N);
|
|
559
563
|
}
|
|
560
564
|
return Array(t, r, o, s);
|
|
561
565
|
}
|
|
562
|
-
function
|
|
563
|
-
return m(
|
|
564
|
-
}
|
|
565
|
-
function a(n, e, t, r, o, s, i) {
|
|
566
|
-
return I(e & t | ~e & r, n, e, o, s, i);
|
|
566
|
+
function S(n, e, t, r, o, s) {
|
|
567
|
+
return m(ut(m(m(e, n), m(r, s)), o), t);
|
|
567
568
|
}
|
|
568
569
|
function l(n, e, t, r, o, s, i) {
|
|
569
|
-
return
|
|
570
|
+
return S(e & t | ~e & r, n, e, o, s, i);
|
|
570
571
|
}
|
|
571
572
|
function h(n, e, t, r, o, s, i) {
|
|
572
|
-
return
|
|
573
|
+
return S(e & r | t & ~r, n, e, o, s, i);
|
|
573
574
|
}
|
|
574
575
|
function f(n, e, t, r, o, s, i) {
|
|
575
|
-
return
|
|
576
|
+
return S(e ^ t ^ r, n, e, o, s, i);
|
|
577
|
+
}
|
|
578
|
+
function d(n, e, t, r, o, s, i) {
|
|
579
|
+
return S(t ^ (e | ~r), n, e, o, s, i);
|
|
576
580
|
}
|
|
577
581
|
function m(n, e) {
|
|
578
582
|
var t = (65535 & n) + (65535 & e);
|
|
579
583
|
return (n >> 16) + (e >> 16) + (t >> 16) << 16 | 65535 & t;
|
|
580
584
|
}
|
|
581
|
-
function
|
|
585
|
+
function ut(n, e) {
|
|
582
586
|
return n << e | n >>> 32 - e;
|
|
583
587
|
}
|
|
584
|
-
function
|
|
588
|
+
function Dt(n) {
|
|
585
589
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
|
|
586
590
|
}
|
|
587
|
-
function
|
|
591
|
+
function jt(n) {
|
|
588
592
|
return Object.entries(n).map(
|
|
589
593
|
([e, t]) => encodeURIComponent(e) + "=" + encodeURIComponent(t)
|
|
590
594
|
).join("&");
|
|
591
595
|
}
|
|
592
|
-
function
|
|
593
|
-
return n ? `https://www.gravatar.com/avatar/${
|
|
596
|
+
function kt(n, e = "mp") {
|
|
597
|
+
return n ? `https://www.gravatar.com/avatar/${rt(n)}?d=${e}` : "";
|
|
594
598
|
}
|
|
595
|
-
function
|
|
599
|
+
function Gt(n) {
|
|
596
600
|
const e = new RegExp(
|
|
597
601
|
"(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
|
|
598
602
|
"gm"
|
|
@@ -600,19 +604,19 @@ function Mt(n) {
|
|
|
600
604
|
if (t.port != null && (t.port = Number(t.port)), r.length > 2 && (t.domain = r.splice(-2, 2).join("."), t.subdomain = r.join(".")), t.query) {
|
|
601
605
|
const o = t.query.split("&"), s = {};
|
|
602
606
|
o.forEach((i) => {
|
|
603
|
-
const [
|
|
604
|
-
s[
|
|
607
|
+
const [y, c] = i.split("=");
|
|
608
|
+
s[y] = c;
|
|
605
609
|
}), t.query = s;
|
|
606
610
|
}
|
|
607
611
|
return t;
|
|
608
612
|
}
|
|
609
|
-
function
|
|
613
|
+
function Ut(n) {
|
|
610
614
|
return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
|
|
611
615
|
}
|
|
612
|
-
function
|
|
616
|
+
function Mt(n) {
|
|
613
617
|
return new Promise((e) => setTimeout(e, n));
|
|
614
618
|
}
|
|
615
|
-
function
|
|
619
|
+
function qt(n) {
|
|
616
620
|
const e = n instanceof Date ? n : new Date(n);
|
|
617
621
|
return new Intl.DateTimeFormat("en-us", {
|
|
618
622
|
weekday: "long",
|
|
@@ -624,59 +628,59 @@ function Ht(n) {
|
|
|
624
628
|
}).format(e);
|
|
625
629
|
}
|
|
626
630
|
export {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
631
|
+
B as ASet,
|
|
632
|
+
Z as BadRequestError,
|
|
633
|
+
Bt as CliBackground,
|
|
634
|
+
A as CliEffects,
|
|
635
|
+
O as CliForeground,
|
|
632
636
|
w as CustomError,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
637
|
+
Q as ForbiddenError,
|
|
638
|
+
M as Http,
|
|
639
|
+
tt as InternalServerError,
|
|
640
|
+
et as LOG_LEVEL,
|
|
641
|
+
q as Logger,
|
|
642
|
+
_ as NotFoundError,
|
|
639
643
|
E as PromiseProgress,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
644
|
+
P as TypedEmitter,
|
|
645
|
+
X as UnauthorizedError,
|
|
646
|
+
dt as addUnique,
|
|
647
|
+
yt as arrayDiff,
|
|
648
|
+
pt as caseInsensitiveSort,
|
|
649
|
+
F as clean,
|
|
650
|
+
Lt as countChars,
|
|
651
|
+
Ot as createHex,
|
|
652
|
+
bt as dec2Frac,
|
|
653
|
+
lt as deepCopy,
|
|
654
|
+
W as deepMerge,
|
|
655
|
+
C as dotNotation,
|
|
656
|
+
V as download,
|
|
657
|
+
wt as downloadBlob,
|
|
658
|
+
xt as fileBrowser,
|
|
659
|
+
mt as findByProp,
|
|
660
|
+
J as flattenArr,
|
|
661
|
+
z as flattenObj,
|
|
662
|
+
jt as formEncode,
|
|
663
|
+
qt as formatDate,
|
|
664
|
+
Ct as formatPhoneNumber,
|
|
665
|
+
Rt as fracToDec,
|
|
666
|
+
kt as gravatar,
|
|
667
|
+
U as includes,
|
|
668
|
+
St as insertAt,
|
|
669
|
+
b as isEqual,
|
|
670
|
+
Et as makeArray,
|
|
671
|
+
K as makeUnique,
|
|
672
|
+
$t as matchAll,
|
|
673
|
+
rt as md5,
|
|
674
|
+
ht as mixin,
|
|
675
|
+
Nt as pad,
|
|
676
|
+
It as randomString,
|
|
677
|
+
Tt as randomStringBuilder,
|
|
678
|
+
ft as sanitizedJSON,
|
|
679
|
+
Mt as sleep,
|
|
680
|
+
gt as sortByProp,
|
|
681
|
+
Ut as timeUntil,
|
|
682
|
+
At as uploadWithProgress,
|
|
683
|
+
Gt as urlParser,
|
|
684
|
+
Dt as validateEmail
|
|
681
685
|
};
|
|
682
686
|
//# sourceMappingURL=index.mjs.map
|