@ztimson/utils 0.1.9 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/objects.d.ts +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.mjs +159 -149
- package/dist/utils.mjs.map +1 -1
- package/dist/xhr.d.ts +3 -0
- package/package.json +1 -1
package/dist/utils.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var U = (e, n, t) => n in e ? M(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var h = (e, n, t) => (U(e, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
function Y(e, n = !1) {
|
|
5
5
|
if (e == null)
|
|
6
6
|
throw new Error("Cannot clean a NULL value");
|
|
7
7
|
return Array.isArray(e) ? e = e.filter((t) => t != null) : Object.entries(e).forEach(([t, r]) => {
|
|
8
8
|
(n && r === void 0 || !n && r == null) && delete e[t];
|
|
9
9
|
}), e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function X(e) {
|
|
12
12
|
return JSON.parse(JSON.stringify(e));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function B(e, n, t) {
|
|
15
15
|
if (!(e == null || !n))
|
|
16
16
|
return n.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, c) => {
|
|
17
17
|
if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
|
|
@@ -22,65 +22,76 @@ function m(e, n, t) {
|
|
|
22
22
|
return t !== void 0 && s == c.length - 1 ? r[o] = t : r[o];
|
|
23
23
|
}, e);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function P(e, n, t = {}) {
|
|
26
26
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
27
27
|
for (const r of Object.keys(e)) {
|
|
28
28
|
const o = n ? n + "." + r : r;
|
|
29
|
-
typeof e[r] == "object" ?
|
|
29
|
+
typeof e[r] == "object" ? P(e[r], o, t) : t[o] = e[r];
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function I(e, n, t = !1) {
|
|
35
35
|
if (e == null)
|
|
36
36
|
return t;
|
|
37
37
|
if (Array.isArray(n))
|
|
38
|
-
return n.findIndex((o, s) => !
|
|
38
|
+
return n.findIndex((o, s) => !I(e[s], n[s], t)) == -1;
|
|
39
39
|
const r = typeof n;
|
|
40
|
-
return r != typeof e ? !1 : r == "object" ? Object.keys(n).find((o) => !
|
|
40
|
+
return r != typeof e ? !1 : r == "object" ? Object.keys(n).find((o) => !I(e[o], n[o], t)) == null : r == "function" ? e.toString() == n.toString() : e == n;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function w(e, n) {
|
|
43
43
|
const t = typeof e, r = typeof n;
|
|
44
|
-
return t != "object" || e == null || r != "object" || n == null ? t == "function" && r == "function" ? e.toString() == n.toString() : e === n : Object.keys(e).length != Object.keys(n).length ? !1 : Object.keys(e).every((s) =>
|
|
44
|
+
return t != "object" || e == null || r != "object" || n == null ? t == "function" && r == "function" ? e.toString() == n.toString() : e === n : Object.keys(e).length != Object.keys(n).length ? !1 : Object.keys(e).every((s) => w(e[s], n[s]));
|
|
45
|
+
}
|
|
46
|
+
function _(e, n) {
|
|
47
|
+
n.forEach((t) => {
|
|
48
|
+
Object.getOwnPropertyNames(t.prototype).forEach((r) => {
|
|
49
|
+
Object.defineProperty(
|
|
50
|
+
e.prototype,
|
|
51
|
+
r,
|
|
52
|
+
Object.getOwnPropertyDescriptor(t.prototype, r) || /* @__PURE__ */ Object.create(null)
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
45
56
|
}
|
|
46
|
-
function
|
|
57
|
+
function tt(e, n) {
|
|
47
58
|
return e.indexOf(n) === -1 && e.push(n), e;
|
|
48
59
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
51
|
-
...e.filter((t) => !n.includes((r) =>
|
|
52
|
-
...n.filter((t) => !e.includes((r) =>
|
|
60
|
+
function et(e, n) {
|
|
61
|
+
return W([
|
|
62
|
+
...e.filter((t) => !n.includes((r) => w(t, r))),
|
|
63
|
+
...n.filter((t) => !e.includes((r) => w(t, r)))
|
|
53
64
|
]);
|
|
54
65
|
}
|
|
55
|
-
function
|
|
66
|
+
function nt(e) {
|
|
56
67
|
return function(n, t) {
|
|
57
|
-
const r =
|
|
68
|
+
const r = B(n, e), o = B(t, e);
|
|
58
69
|
return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
|
|
59
70
|
};
|
|
60
71
|
}
|
|
61
|
-
function
|
|
62
|
-
return e.forEach((t) => Array.isArray(t) ?
|
|
72
|
+
function H(e, n = []) {
|
|
73
|
+
return e.forEach((t) => Array.isArray(t) ? H(t, n) : n.push(t)), n;
|
|
63
74
|
}
|
|
64
|
-
function
|
|
75
|
+
function rt(e, n = !1) {
|
|
65
76
|
return function(t, r) {
|
|
66
|
-
const o =
|
|
77
|
+
const o = B(t, e), s = B(r, e);
|
|
67
78
|
return typeof o == "number" && typeof s == "number" ? (n ? -1 : 1) * (o - s) : o > s ? n ? -1 : 1 : o < s ? n ? 1 : -1 : 0;
|
|
68
79
|
};
|
|
69
80
|
}
|
|
70
|
-
function
|
|
71
|
-
return (t) =>
|
|
81
|
+
function ot(e, n) {
|
|
82
|
+
return (t) => w(t[e], n);
|
|
72
83
|
}
|
|
73
|
-
function
|
|
84
|
+
function W(e) {
|
|
74
85
|
for (let n = e.length - 1; n >= 0; n--)
|
|
75
|
-
e.slice(0, n).find((t) =>
|
|
86
|
+
e.slice(0, n).find((t) => w(t, e[n])) && e.splice(n, 1);
|
|
76
87
|
return e;
|
|
77
88
|
}
|
|
78
|
-
function
|
|
89
|
+
function st(e) {
|
|
79
90
|
return Array.isArray(e) ? e : [e];
|
|
80
91
|
}
|
|
81
|
-
class
|
|
92
|
+
class b {
|
|
82
93
|
constructor() {
|
|
83
|
-
|
|
94
|
+
h(this, "listeners", {});
|
|
84
95
|
}
|
|
85
96
|
static emit(n, ...t) {
|
|
86
97
|
(this.listeners["*"] || []).forEach((r) => r(n, ...t)), (this.listeners[n.toString()] || []).forEach((r) => r(...t));
|
|
@@ -119,12 +130,12 @@ class $ {
|
|
|
119
130
|
});
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
|
-
|
|
133
|
+
h(b, "listeners", {});
|
|
123
134
|
const y = class y {
|
|
124
135
|
constructor(n = {}) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.opts = n, n.interceptors && n.interceptors.forEach((t) => y.addInterceptor(t));
|
|
136
|
+
h(this, "interceptors", {});
|
|
137
|
+
h(this, "headers", {});
|
|
138
|
+
this.opts = n, this.headers = n.headers || {}, n.interceptors && n.interceptors.forEach((t) => y.addInterceptor(t));
|
|
128
139
|
}
|
|
129
140
|
static addInterceptor(n) {
|
|
130
141
|
const t = Object.keys(y.interceptors).length.toString();
|
|
@@ -139,10 +150,10 @@ const y = class y {
|
|
|
139
150
|
};
|
|
140
151
|
}
|
|
141
152
|
async request(n = {}) {
|
|
142
|
-
var
|
|
153
|
+
var o, s;
|
|
143
154
|
if (!this.opts.url && !n.url)
|
|
144
|
-
throw new Error("
|
|
145
|
-
const t = ((
|
|
155
|
+
throw new Error("URL needs to be set");
|
|
156
|
+
const t = ((o = n.url) != null && o.startsWith("http") ? n.url : (this.opts.url || "") + n.url).replace(/([^:]\/)\/+/g, "$1"), r = Y({
|
|
146
157
|
"Content-Type": n.body && !(n.body instanceof FormData) ? "application/json" : void 0,
|
|
147
158
|
...y.headers,
|
|
148
159
|
...this.headers,
|
|
@@ -151,30 +162,28 @@ const y = class y {
|
|
|
151
162
|
return fetch(t, {
|
|
152
163
|
headers: r,
|
|
153
164
|
method: n.method || (n.body ? "POST" : "GET"),
|
|
154
|
-
body: (
|
|
155
|
-
}).then(async (
|
|
156
|
-
var
|
|
157
|
-
for (let
|
|
158
|
-
await new Promise((
|
|
159
|
-
if (!
|
|
160
|
-
throw Error(
|
|
161
|
-
return (
|
|
162
|
-
}).catch((i) => {
|
|
163
|
-
throw i;
|
|
165
|
+
body: (s = r["Content-Type"]) != null && s.startsWith("application/json") && n.body ? JSON.stringify(n.body) : n.body
|
|
166
|
+
}).then(async (c) => {
|
|
167
|
+
var g, p;
|
|
168
|
+
for (let T of [...Object.values(y.interceptors), ...Object.values(this.interceptors)])
|
|
169
|
+
await new Promise((R) => T(c, () => R()));
|
|
170
|
+
if (!c.ok)
|
|
171
|
+
throw Error(c.statusText);
|
|
172
|
+
return (g = c.headers.get("Content-Type")) != null && g.startsWith("application/json") ? await c.json() : (p = c.headers.get("Content-Type")) != null && p.startsWith("text/plain") ? await c.text() : c;
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
};
|
|
167
|
-
|
|
176
|
+
h(y, "interceptors", {}), h(y, "headers", {});
|
|
168
177
|
let S = y;
|
|
169
178
|
S.addInterceptor((e, n) => {
|
|
170
179
|
if (e.status == 200)
|
|
171
180
|
return n();
|
|
172
|
-
throw e.status == 400 ? new
|
|
181
|
+
throw e.status == 400 ? new $(e.statusText) : e.status == 401 ? new D(e.statusText) : e.status == 403 ? new G(e.statusText) : e.status == 404 ? new k(e.statusText) : e.status == 500 ? new j(e.statusText) : new E(e.statusText, e.status);
|
|
173
182
|
});
|
|
174
183
|
class E extends Error {
|
|
175
184
|
constructor(t, r) {
|
|
176
185
|
super(t);
|
|
177
|
-
|
|
186
|
+
h(this, "_code");
|
|
178
187
|
r != null && (this._code = r);
|
|
179
188
|
}
|
|
180
189
|
get code() {
|
|
@@ -198,8 +207,8 @@ class E extends Error {
|
|
|
198
207
|
return this.message || super.toString();
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
|
-
|
|
202
|
-
class
|
|
210
|
+
h(E, "code", 500);
|
|
211
|
+
class $ extends E {
|
|
203
212
|
constructor(n = "Bad Request") {
|
|
204
213
|
super(n);
|
|
205
214
|
}
|
|
@@ -207,7 +216,7 @@ class b extends E {
|
|
|
207
216
|
return n.constructor.code == this.code;
|
|
208
217
|
}
|
|
209
218
|
}
|
|
210
|
-
|
|
219
|
+
h($, "code", 400);
|
|
211
220
|
class D extends E {
|
|
212
221
|
constructor(n = "Unauthorized") {
|
|
213
222
|
super(n);
|
|
@@ -216,7 +225,7 @@ class D extends E {
|
|
|
216
225
|
return n.constructor.code == this.code;
|
|
217
226
|
}
|
|
218
227
|
}
|
|
219
|
-
|
|
228
|
+
h(D, "code", 401);
|
|
220
229
|
class G extends E {
|
|
221
230
|
constructor(n = "Forbidden") {
|
|
222
231
|
super(n);
|
|
@@ -225,7 +234,7 @@ class G extends E {
|
|
|
225
234
|
return n.constructor.code == this.code;
|
|
226
235
|
}
|
|
227
236
|
}
|
|
228
|
-
|
|
237
|
+
h(G, "code", 403);
|
|
229
238
|
class k extends E {
|
|
230
239
|
constructor(n = "Not Found") {
|
|
231
240
|
super(n);
|
|
@@ -234,8 +243,8 @@ class k extends E {
|
|
|
234
243
|
return n.constructor.code == this.code;
|
|
235
244
|
}
|
|
236
245
|
}
|
|
237
|
-
|
|
238
|
-
class
|
|
246
|
+
h(k, "code", 404);
|
|
247
|
+
class j extends E {
|
|
239
248
|
constructor(n = "Internal Server Error") {
|
|
240
249
|
super(n);
|
|
241
250
|
}
|
|
@@ -243,8 +252,8 @@ class M extends E {
|
|
|
243
252
|
return n.constructor.code == this.code;
|
|
244
253
|
}
|
|
245
254
|
}
|
|
246
|
-
|
|
247
|
-
const
|
|
255
|
+
h(j, "code", 500);
|
|
256
|
+
const x = {
|
|
248
257
|
CLEAR: "\x1B[0m",
|
|
249
258
|
BRIGHT: "\x1B[1m",
|
|
250
259
|
DIM: "\x1B[2m",
|
|
@@ -252,7 +261,7 @@ const w = {
|
|
|
252
261
|
BLINK: "\x1B[5m",
|
|
253
262
|
REVERSE: "\x1B[7m",
|
|
254
263
|
HIDDEN: "\x1B[8m"
|
|
255
|
-
},
|
|
264
|
+
}, A = {
|
|
256
265
|
BLACK: "\x1B[30m",
|
|
257
266
|
RED: "\x1B[31m",
|
|
258
267
|
GREEN: "\x1B[32m",
|
|
@@ -269,7 +278,7 @@ const w = {
|
|
|
269
278
|
LIGHT_MAGENTA: "\x1B[95m",
|
|
270
279
|
LIGHT_CYAN: "\x1B[96m",
|
|
271
280
|
WHITE: "\x1B[97m"
|
|
272
|
-
},
|
|
281
|
+
}, ct = {
|
|
273
282
|
BLACK: "\x1B[40m",
|
|
274
283
|
RED: "\x1B[41m",
|
|
275
284
|
GREEN: "\x1B[42m",
|
|
@@ -280,8 +289,8 @@ const w = {
|
|
|
280
289
|
WHITE: "\x1B[47m",
|
|
281
290
|
GREY: "\x1B[100m"
|
|
282
291
|
};
|
|
283
|
-
var
|
|
284
|
-
const
|
|
292
|
+
var q = /* @__PURE__ */ ((e) => (e[e.ERROR = 0] = "ERROR", e[e.WARN = 1] = "WARN", e[e.INFO = 2] = "INFO", e[e.LOG = 3] = "LOG", e[e.DEBUG = 4] = "DEBUG", e))(q || {});
|
|
293
|
+
const f = class f extends b {
|
|
285
294
|
constructor(n) {
|
|
286
295
|
super(), this.namespace = n;
|
|
287
296
|
}
|
|
@@ -289,70 +298,70 @@ const g = class g extends $ {
|
|
|
289
298
|
const s = n.toString(), c = t - s.length;
|
|
290
299
|
if (c <= 0)
|
|
291
300
|
return s;
|
|
292
|
-
const
|
|
293
|
-
return o ? s +
|
|
301
|
+
const g = Array(~~(c / r.length)).fill(r).join("");
|
|
302
|
+
return o ? s + g : g + s;
|
|
294
303
|
}
|
|
295
304
|
format(...n) {
|
|
296
305
|
const t = /* @__PURE__ */ new Date();
|
|
297
306
|
return `${`${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()} ${this.pad(t.getHours().toString(), 2, "0")}:${this.pad(t.getMinutes().toString(), 2, "0")}:${this.pad(t.getSeconds().toString(), 2, "0")}.${this.pad(t.getMilliseconds().toString(), 3, "0", !0)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${n.join(" ")}`;
|
|
298
307
|
}
|
|
299
308
|
debug(...n) {
|
|
300
|
-
if (
|
|
309
|
+
if (f.LOG_LEVEL < 4)
|
|
301
310
|
return;
|
|
302
311
|
const t = this.format(...n);
|
|
303
|
-
|
|
312
|
+
f.emit(4, t), console.debug(A.LIGHT_GREY + t + x.CLEAR);
|
|
304
313
|
}
|
|
305
314
|
log(...n) {
|
|
306
|
-
if (
|
|
315
|
+
if (f.LOG_LEVEL < 3)
|
|
307
316
|
return;
|
|
308
317
|
const t = this.format(...n);
|
|
309
|
-
|
|
318
|
+
f.emit(3, t), console.log(x.CLEAR + t);
|
|
310
319
|
}
|
|
311
320
|
info(...n) {
|
|
312
|
-
if (
|
|
321
|
+
if (f.LOG_LEVEL < 2)
|
|
313
322
|
return;
|
|
314
323
|
const t = this.format(...n);
|
|
315
|
-
|
|
324
|
+
f.emit(2, t), console.info(A.BLUE + t + x.CLEAR);
|
|
316
325
|
}
|
|
317
326
|
warn(...n) {
|
|
318
|
-
if (
|
|
327
|
+
if (f.LOG_LEVEL < 1)
|
|
319
328
|
return;
|
|
320
329
|
const t = this.format(...n);
|
|
321
|
-
|
|
330
|
+
f.emit(1, t), console.warn(A.YELLOW + t + x.CLEAR);
|
|
322
331
|
}
|
|
323
332
|
error(...n) {
|
|
324
|
-
if (
|
|
333
|
+
if (f.LOG_LEVEL < 0)
|
|
325
334
|
return;
|
|
326
335
|
const t = this.format(...n);
|
|
327
|
-
|
|
336
|
+
f.emit(0, t), console.error(A.RED + t + x.CLEAR);
|
|
328
337
|
}
|
|
329
338
|
};
|
|
330
|
-
f
|
|
331
|
-
let
|
|
332
|
-
function
|
|
339
|
+
h(f, "LOG_LEVEL", 4);
|
|
340
|
+
let N = f;
|
|
341
|
+
function it(e, n) {
|
|
333
342
|
return e.length - e.replaceAll(n, "").length;
|
|
334
343
|
}
|
|
335
|
-
function
|
|
344
|
+
function ut(e) {
|
|
336
345
|
return Array(e).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
|
|
337
346
|
}
|
|
338
|
-
const C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
339
|
-
function
|
|
347
|
+
const C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", O = "0123456789", L = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", v = C + O + L;
|
|
348
|
+
function at(e) {
|
|
340
349
|
const n = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(e);
|
|
341
350
|
if (!n)
|
|
342
351
|
throw new Error(`Number cannot be parsed: ${e}`);
|
|
343
352
|
return `${n[1] ?? ""} (${n[2]}) ${n[3]}-${n[4]}`.trim();
|
|
344
353
|
}
|
|
345
|
-
function
|
|
354
|
+
function lt(e, n, t) {
|
|
346
355
|
return `${e.slice(0, t)}${n}${e.slice(t + 1)}`;
|
|
347
356
|
}
|
|
348
|
-
function
|
|
357
|
+
function ht(e, n, t, r = !0) {
|
|
349
358
|
const o = e.toString(), s = n - o.length;
|
|
350
359
|
if (s <= 0)
|
|
351
360
|
return o;
|
|
352
361
|
const c = Array(~~(s / t.length)).fill(t).join("");
|
|
353
362
|
return r ? c + o : o + c;
|
|
354
363
|
}
|
|
355
|
-
function
|
|
364
|
+
function ft(e, n = v) {
|
|
356
365
|
return Array(e).fill(null).map(() => {
|
|
357
366
|
const t = ~~(Math.random() * n.length);
|
|
358
367
|
return n[t];
|
|
@@ -365,12 +374,12 @@ function yt(e, n = !1, t = !1, r = !1) {
|
|
|
365
374
|
let o;
|
|
366
375
|
do {
|
|
367
376
|
const s = ~~(Math.random() * 3);
|
|
368
|
-
n && s == 0 ? o = C[~~(Math.random() * C.length)] : t && s == 1 ? o =
|
|
377
|
+
n && s == 0 ? o = C[~~(Math.random() * C.length)] : t && s == 1 ? o = O[~~(Math.random() * O.length)] : r && s == 2 && (o = L[~~(Math.random() * L.length)]);
|
|
369
378
|
} while (!o);
|
|
370
379
|
return o;
|
|
371
380
|
}).join("");
|
|
372
381
|
}
|
|
373
|
-
function
|
|
382
|
+
function gt(e, n) {
|
|
374
383
|
if (typeof n == "string" && (n = new RegExp(n, "g")), !n.global)
|
|
375
384
|
throw new TypeError("Regular expression must be global.");
|
|
376
385
|
let t = [], r;
|
|
@@ -378,67 +387,67 @@ function dt(e, n) {
|
|
|
378
387
|
t.push(r);
|
|
379
388
|
return t;
|
|
380
389
|
}
|
|
381
|
-
function
|
|
382
|
-
var n =
|
|
390
|
+
function F(e) {
|
|
391
|
+
var n = z(K(V(J(e), 8 * e.length)));
|
|
383
392
|
return n.toLowerCase();
|
|
384
393
|
}
|
|
385
|
-
function
|
|
394
|
+
function z(e) {
|
|
386
395
|
for (var n, t = "0123456789ABCDEF", r = "", o = 0; o < e.length; o++)
|
|
387
396
|
n = e.charCodeAt(o), r += t.charAt(n >>> 4 & 15) + t.charAt(15 & n);
|
|
388
397
|
return r;
|
|
389
398
|
}
|
|
390
|
-
function
|
|
399
|
+
function J(e) {
|
|
391
400
|
for (var n = Array(e.length >> 2), t = 0; t < n.length; t++)
|
|
392
401
|
n[t] = 0;
|
|
393
402
|
for (t = 0; t < 8 * e.length; t += 8)
|
|
394
403
|
n[t >> 5] |= (255 & e.charCodeAt(t / 8)) << t % 32;
|
|
395
404
|
return n;
|
|
396
405
|
}
|
|
397
|
-
function
|
|
406
|
+
function K(e) {
|
|
398
407
|
for (var n = "", t = 0; t < 32 * e.length; t += 8)
|
|
399
408
|
n += String.fromCharCode(e[t >> 5] >>> t % 32 & 255);
|
|
400
409
|
return n;
|
|
401
410
|
}
|
|
402
|
-
function
|
|
411
|
+
function V(e, n) {
|
|
403
412
|
e[n >> 5] |= 128 << n % 32, e[14 + (n + 64 >>> 9 << 4)] = n;
|
|
404
413
|
for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < e.length; c += 16) {
|
|
405
|
-
var
|
|
406
|
-
r =
|
|
414
|
+
var g = t, p = r, T = o, R = s;
|
|
415
|
+
r = l(r = l(r = l(r = l(r = a(r = a(r = a(r = a(r = u(r = u(r = u(r = u(r = i(r = i(r = i(r = i(r, o = i(o, s = i(s, t = i(t, r, o, s, e[c + 0], 7, -680876936), r, o, e[c + 1], 12, -389564586), t, r, e[c + 2], 17, 606105819), s, t, e[c + 3], 22, -1044525330), o = i(o, s = i(s, t = i(t, r, o, s, e[c + 4], 7, -176418897), r, o, e[c + 5], 12, 1200080426), t, r, e[c + 6], 17, -1473231341), s, t, e[c + 7], 22, -45705983), o = i(o, s = i(s, t = i(t, r, o, s, e[c + 8], 7, 1770035416), r, o, e[c + 9], 12, -1958414417), t, r, e[c + 10], 17, -42063), s, t, e[c + 11], 22, -1990404162), o = i(o, s = i(s, t = i(t, r, o, s, e[c + 12], 7, 1804603682), r, o, e[c + 13], 12, -40341101), t, r, e[c + 14], 17, -1502002290), s, t, e[c + 15], 22, 1236535329), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 1], 5, -165796510), r, o, e[c + 6], 9, -1069501632), t, r, e[c + 11], 14, 643717713), s, t, e[c + 0], 20, -373897302), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 5], 5, -701558691), r, o, e[c + 10], 9, 38016083), t, r, e[c + 15], 14, -660478335), s, t, e[c + 4], 20, -405537848), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 9], 5, 568446438), r, o, e[c + 14], 9, -1019803690), t, r, e[c + 3], 14, -187363961), s, t, e[c + 8], 20, 1163531501), o = u(o, s = u(s, t = u(t, r, o, s, e[c + 13], 5, -1444681467), r, o, e[c + 2], 9, -51403784), t, r, e[c + 7], 14, 1735328473), s, t, e[c + 12], 20, -1926607734), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 5], 4, -378558), r, o, e[c + 8], 11, -2022574463), t, r, e[c + 11], 16, 1839030562), s, t, e[c + 14], 23, -35309556), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 1], 4, -1530992060), r, o, e[c + 4], 11, 1272893353), t, r, e[c + 7], 16, -155497632), s, t, e[c + 10], 23, -1094730640), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 13], 4, 681279174), r, o, e[c + 0], 11, -358537222), t, r, e[c + 3], 16, -722521979), s, t, e[c + 6], 23, 76029189), o = a(o, s = a(s, t = a(t, r, o, s, e[c + 9], 4, -640364487), r, o, e[c + 12], 11, -421815835), t, r, e[c + 15], 16, 530742520), s, t, e[c + 2], 23, -995338651), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 0], 6, -198630844), r, o, e[c + 7], 10, 1126891415), t, r, e[c + 14], 15, -1416354905), s, t, e[c + 5], 21, -57434055), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 12], 6, 1700485571), r, o, e[c + 3], 10, -1894986606), t, r, e[c + 10], 15, -1051523), s, t, e[c + 1], 21, -2054922799), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 8], 6, 1873313359), r, o, e[c + 15], 10, -30611744), t, r, e[c + 6], 15, -1560198380), s, t, e[c + 13], 21, 1309151649), o = l(o, s = l(s, t = l(t, r, o, s, e[c + 4], 6, -145523070), r, o, e[c + 11], 10, -1120210379), t, r, e[c + 2], 15, 718787259), s, t, e[c + 9], 21, -343485551), t = d(t, g), r = d(r, p), o = d(o, T), s = d(s, R);
|
|
407
416
|
}
|
|
408
417
|
return Array(t, r, o, s);
|
|
409
418
|
}
|
|
410
|
-
function
|
|
411
|
-
return d(
|
|
419
|
+
function m(e, n, t, r, o, s) {
|
|
420
|
+
return d(Z(d(d(n, e), d(r, s)), o), t);
|
|
421
|
+
}
|
|
422
|
+
function i(e, n, t, r, o, s, c) {
|
|
423
|
+
return m(n & t | ~n & r, e, n, o, s, c);
|
|
412
424
|
}
|
|
413
425
|
function u(e, n, t, r, o, s, c) {
|
|
414
|
-
return
|
|
426
|
+
return m(n & r | t & ~r, e, n, o, s, c);
|
|
415
427
|
}
|
|
416
428
|
function a(e, n, t, r, o, s, c) {
|
|
417
|
-
return
|
|
429
|
+
return m(n ^ t ^ r, e, n, o, s, c);
|
|
418
430
|
}
|
|
419
431
|
function l(e, n, t, r, o, s, c) {
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
function h(e, n, t, r, o, s, c) {
|
|
423
|
-
return T(t ^ (n | ~r), e, n, o, s, c);
|
|
432
|
+
return m(t ^ (n | ~r), e, n, o, s, c);
|
|
424
433
|
}
|
|
425
434
|
function d(e, n) {
|
|
426
435
|
var t = (65535 & e) + (65535 & n);
|
|
427
436
|
return (e >> 16) + (n >> 16) + (t >> 16) << 16 | 65535 & t;
|
|
428
437
|
}
|
|
429
|
-
function
|
|
438
|
+
function Z(e, n) {
|
|
430
439
|
return e << n | e >>> 32 - n;
|
|
431
440
|
}
|
|
432
|
-
function
|
|
441
|
+
function dt(e) {
|
|
433
442
|
return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(e);
|
|
434
443
|
}
|
|
435
|
-
function
|
|
444
|
+
function Et(e) {
|
|
436
445
|
return Object.entries(e).map(
|
|
437
446
|
([n, t]) => encodeURIComponent(n) + "=" + encodeURIComponent(t)
|
|
438
447
|
).join("&");
|
|
439
448
|
}
|
|
440
|
-
function
|
|
441
|
-
return e ? `https://www.gravatar.com/avatar/${
|
|
449
|
+
function pt(e, n = "mp") {
|
|
450
|
+
return e ? `https://www.gravatar.com/avatar/${F(e)}?d=${n}` : "";
|
|
442
451
|
}
|
|
443
452
|
function xt(e) {
|
|
444
453
|
const n = new RegExp(
|
|
@@ -448,19 +457,19 @@ function xt(e) {
|
|
|
448
457
|
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) {
|
|
449
458
|
const o = t.query.split("&"), s = {};
|
|
450
459
|
o.forEach((c) => {
|
|
451
|
-
const [
|
|
452
|
-
s[
|
|
460
|
+
const [g, p] = c.split("=");
|
|
461
|
+
s[g] = p;
|
|
453
462
|
}), t.query = s;
|
|
454
463
|
}
|
|
455
464
|
return t;
|
|
456
465
|
}
|
|
457
|
-
function
|
|
466
|
+
function wt(e) {
|
|
458
467
|
return (e instanceof Date ? e.getTime() : e) - (/* @__PURE__ */ new Date()).getTime();
|
|
459
468
|
}
|
|
460
|
-
function
|
|
469
|
+
function At(e) {
|
|
461
470
|
return new Promise((n) => setTimeout(n, e));
|
|
462
471
|
}
|
|
463
|
-
function
|
|
472
|
+
function Bt(e) {
|
|
464
473
|
const n = e instanceof Date ? e : new Date(e);
|
|
465
474
|
return new Intl.DateTimeFormat("en-us", {
|
|
466
475
|
weekday: "long",
|
|
@@ -472,48 +481,49 @@ function mt(e) {
|
|
|
472
481
|
}).format(n);
|
|
473
482
|
}
|
|
474
483
|
export {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
484
|
+
$ as BadRequestError,
|
|
485
|
+
ct as CliBackground,
|
|
486
|
+
x as CliEffects,
|
|
487
|
+
A as CliForeground,
|
|
479
488
|
E as CustomError,
|
|
480
489
|
G as ForbiddenError,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
490
|
+
j as InternalServerError,
|
|
491
|
+
q as LOG_LEVEL,
|
|
492
|
+
N as Logger,
|
|
484
493
|
k as NotFoundError,
|
|
485
|
-
|
|
494
|
+
b as TypedEmitter,
|
|
486
495
|
D as UnauthorizedError,
|
|
487
496
|
S as XHR,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
497
|
+
tt as addUnique,
|
|
498
|
+
et as arrayDiff,
|
|
499
|
+
nt as caseInsensitiveSort,
|
|
500
|
+
Y as clean,
|
|
501
|
+
it as countChars,
|
|
502
|
+
ut as createHex,
|
|
503
|
+
X as deepCopy,
|
|
504
|
+
B as dotNotation,
|
|
505
|
+
ot as findByProp,
|
|
506
|
+
H as flattenArr,
|
|
507
|
+
P as flattenObj,
|
|
508
|
+
Et as formEncode,
|
|
509
|
+
Bt as formatDate,
|
|
510
|
+
at as formatPhoneNumber,
|
|
511
|
+
pt as gravatar,
|
|
512
|
+
I as includes,
|
|
513
|
+
lt as insertAt,
|
|
514
|
+
w as isEqual,
|
|
515
|
+
st as makeArray,
|
|
516
|
+
W as makeUnique,
|
|
517
|
+
gt as matchAll,
|
|
518
|
+
F as md5,
|
|
519
|
+
_ as mixin,
|
|
520
|
+
ht as pad,
|
|
521
|
+
ft as randomString,
|
|
512
522
|
yt as randomStringBuilder,
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
523
|
+
At as sleep,
|
|
524
|
+
rt as sortByProp,
|
|
525
|
+
wt as timeUntil,
|
|
516
526
|
xt as urlParser,
|
|
517
|
-
|
|
527
|
+
dt as validateEmail
|
|
518
528
|
};
|
|
519
529
|
//# sourceMappingURL=utils.mjs.map
|