@ztimson/utils 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.mjs CHANGED
@@ -1,17 +1,17 @@
1
- var U = Object.defineProperty;
2
- var Y = (n, e, t) => e in n ? U(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var l = (n, e, t) => (Y(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- function P(n, e = !1) {
1
+ var H = Object.defineProperty;
2
+ var W = (n, e, t) => e in n ? H(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var l = (n, e, t) => (W(n, typeof e != "symbol" ? e + "" : e, t), t);
4
+ function q(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 _(n) {
11
+ function rt(n) {
12
12
  return JSON.parse(JSON.stringify(n));
13
13
  }
14
- function m(n, e, t) {
14
+ function S(n, e, t) {
15
15
  if (!(n == null || !e))
16
16
  return e.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, i) => {
17
17
  if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
@@ -22,28 +22,28 @@ function m(n, e, t) {
22
22
  return t !== void 0 && s == i.length - 1 ? r[o] = t : r[o];
23
23
  }, n);
24
24
  }
25
- function H(n, e, t = {}) {
25
+ function v(n, e, t = {}) {
26
26
  if (typeof n == "object" && !Array.isArray(n)) {
27
27
  for (const r of Object.keys(n)) {
28
28
  const o = e ? e + "." + r : r;
29
- typeof n[r] == "object" ? H(n[r], o, t) : t[o] = n[r];
29
+ typeof n[r] == "object" ? v(n[r], o, t) : t[o] = n[r];
30
30
  }
31
31
  return t;
32
32
  }
33
33
  }
34
- function L(n, e, t = !1) {
34
+ function D(n, e, t = !1) {
35
35
  if (n == null)
36
36
  return t;
37
37
  if (Array.isArray(e))
38
- return e.findIndex((o, s) => !L(n[s], e[s], t)) == -1;
38
+ return e.findIndex((o, s) => !D(n[s], e[s], t)) == -1;
39
39
  const r = typeof e;
40
- return r != typeof n ? !1 : r == "object" ? Object.keys(e).find((o) => !L(n[o], e[o], t)) == null : r == "function" ? n.toString() == e.toString() : n == e;
40
+ return r != typeof n ? !1 : r == "object" ? Object.keys(e).find((o) => !D(n[o], e[o], t)) == null : r == "function" ? n.toString() == e.toString() : n == e;
41
41
  }
42
- function B(n, e) {
42
+ function R(n, e) {
43
43
  const t = typeof n, r = typeof e;
44
- 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]));
44
+ 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) => R(n[s], e[s]));
45
45
  }
46
- function tt(n, e) {
46
+ function ot(n, e) {
47
47
  e.forEach((t) => {
48
48
  Object.getOwnPropertyNames(t.prototype).forEach((r) => {
49
49
  Object.defineProperty(
@@ -54,7 +54,7 @@ function tt(n, e) {
54
54
  });
55
55
  });
56
56
  }
57
- function et(n, e) {
57
+ function st(n, e) {
58
58
  let t = [];
59
59
  return JSON.parse(JSON.stringify(n, (r, o) => {
60
60
  if (typeof o == "object" && o !== null) {
@@ -65,42 +65,42 @@ function et(n, e) {
65
65
  return o;
66
66
  }, e));
67
67
  }
68
- function nt(n, e) {
68
+ function it(n, e) {
69
69
  return n.indexOf(e) === -1 && n.push(e), n;
70
70
  }
71
- function rt(n, e) {
72
- return q([
73
- ...n.filter((t) => !e.includes((r) => B(t, r))),
74
- ...e.filter((t) => !n.includes((r) => B(t, r)))
71
+ function ct(n, e) {
72
+ return z([
73
+ ...n.filter((t) => !e.includes((r) => R(t, r))),
74
+ ...e.filter((t) => !n.includes((r) => R(t, r)))
75
75
  ]);
76
76
  }
77
- function ot(n) {
77
+ function ut(n) {
78
78
  return function(e, t) {
79
- const r = m(e, n), o = m(t, n);
79
+ const r = S(e, n), o = S(t, n);
80
80
  return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
81
81
  };
82
82
  }
83
- function W(n, e = []) {
84
- return n.forEach((t) => Array.isArray(t) ? W(t, e) : e.push(t)), e;
83
+ function F(n, e = []) {
84
+ return n.forEach((t) => Array.isArray(t) ? F(t, e) : e.push(t)), e;
85
85
  }
86
- function st(n, e = !1) {
86
+ function at(n, e = !1) {
87
87
  return function(t, r) {
88
- const o = m(t, n), s = m(r, n);
88
+ const o = S(t, n), s = S(r, n);
89
89
  return typeof o == "number" && typeof s == "number" ? (e ? -1 : 1) * (o - s) : o > s ? e ? -1 : 1 : o < s ? e ? 1 : -1 : 0;
90
90
  };
91
91
  }
92
- function it(n, e) {
93
- return (t) => B(t[n], e);
92
+ function ht(n, e) {
93
+ return (t) => R(t[n], e);
94
94
  }
95
- function q(n) {
95
+ function z(n) {
96
96
  for (let e = n.length - 1; e >= 0; e--)
97
- n.slice(0, e).find((t) => B(t, n[e])) && n.splice(e, 1);
97
+ n.slice(0, e).find((t) => R(t, n[e])) && n.splice(e, 1);
98
98
  return n;
99
99
  }
100
- function ct(n) {
100
+ function lt(n) {
101
101
  return Array.isArray(n) ? n : [n];
102
102
  }
103
- class w extends Array {
103
+ class A extends Array {
104
104
  get size() {
105
105
  return this.length;
106
106
  }
@@ -115,13 +115,13 @@ class w extends Array {
115
115
  t != -1 && this.slice(t, 1);
116
116
  }
117
117
  difference(e) {
118
- return new w(this.reduce((t, r) => (e.has(r) || t.push(r), t), []));
118
+ return new A(this.reduce((t, r) => (e.has(r) || t.push(r), t), []));
119
119
  }
120
120
  has(e) {
121
121
  return this.indexOf(e) != -1;
122
122
  }
123
123
  intersection(e) {
124
- return new w(this.reduce((t, r) => (e.has(r) && t.push(r), t), []));
124
+ return new A(this.reduce((t, r) => (e.has(r) && t.push(r), t), []));
125
125
  }
126
126
  isDisjointFrom(e) {
127
127
  return this.intersection(e).size == 0;
@@ -133,13 +133,13 @@ class w extends Array {
133
133
  return e.findIndex((t) => !this.has(t)) == -1;
134
134
  }
135
135
  symmetricDifference(e) {
136
- return new w([...this.difference(e), ...e.difference(this)]);
136
+ return new A([...this.difference(e), ...e.difference(this)]);
137
137
  }
138
138
  union(e) {
139
- return new w([...this, ...e]);
139
+ return new A([...this, ...e]);
140
140
  }
141
141
  }
142
- class $ {
142
+ class k {
143
143
  constructor() {
144
144
  l(this, "listeners", {});
145
145
  }
@@ -180,17 +180,46 @@ class $ {
180
180
  });
181
181
  }
182
182
  }
183
- l($, "listeners", {});
184
- const d = class d {
183
+ l(k, "listeners", {});
184
+ function J(n, e) {
185
+ const t = document.createElement("a");
186
+ t.href = n, t.download = e, document.body.appendChild(t), t.click(), document.body.removeChild(t);
187
+ }
188
+ function ft(n, e) {
189
+ const t = new k();
190
+ return fetch(n).then((r) => {
191
+ var w;
192
+ const o = r.headers.get("Content-Length") || "0", s = parseInt(o, 10);
193
+ let i = [], d = 0;
194
+ const g = (w = r.body) == null ? void 0 : w.getReader();
195
+ g == null || g.read().then(function x($) {
196
+ if ($.done) {
197
+ const m = new Blob(i);
198
+ if (t.emit("progress", 1), e) {
199
+ const O = URL.createObjectURL(m);
200
+ J(O, e), URL.revokeObjectURL(O);
201
+ }
202
+ t.emit("complete", m);
203
+ return;
204
+ } else {
205
+ const m = $.value;
206
+ i.push(m), d += m.length;
207
+ const O = Math.round(d / s * 100);
208
+ t.emit("progress", O), g.read().then(x);
209
+ }
210
+ });
211
+ }), t;
212
+ }
213
+ const p = class p {
185
214
  constructor(e = {}) {
186
215
  l(this, "interceptors", {});
187
216
  l(this, "headers", {});
188
- this.opts = e, this.headers = e.headers || {}, e.interceptors && e.interceptors.forEach((t) => d.addInterceptor(t));
217
+ this.opts = e, this.headers = e.headers || {}, e.interceptors && e.interceptors.forEach((t) => p.addInterceptor(t));
189
218
  }
190
219
  static addInterceptor(e) {
191
- const t = Object.keys(d.interceptors).length.toString();
192
- return d.interceptors[t] = e, () => {
193
- d.interceptors[t] = null;
220
+ const t = Object.keys(p.interceptors).length.toString();
221
+ return p.interceptors[t] = e, () => {
222
+ p.interceptors[t] = null;
194
223
  };
195
224
  }
196
225
  addInterceptor(e) {
@@ -203,9 +232,9 @@ const d = class d {
203
232
  var o, s;
204
233
  if (!this.opts.url && !e.url)
205
234
  throw new Error("URL needs to be set");
206
- const t = ((o = e.url) != null && o.startsWith("http") ? e.url : (this.opts.url || "") + (e.url || "")).replace(/([^:]\/)\/+/g, "$1"), r = P({
235
+ const t = ((o = e.url) != null && o.startsWith("http") ? e.url : (this.opts.url || "") + (e.url || "")).replace(/([^:]\/)\/+/g, "$1"), r = q({
207
236
  "Content-Type": e.body && !(e.body instanceof FormData) ? "application/json" : void 0,
208
- ...d.headers,
237
+ ...p.headers,
209
238
  ...this.headers,
210
239
  ...e.headers
211
240
  });
@@ -214,23 +243,23 @@ const d = class d {
214
243
  method: e.method || (e.body ? "POST" : "GET"),
215
244
  body: (s = r["Content-Type"]) != null && s.startsWith("application/json") && e.body ? JSON.stringify(e.body) : e.body
216
245
  }).then(async (i) => {
217
- var y, E;
218
- for (let S of [...Object.values(d.interceptors), ...Object.values(this.interceptors)])
219
- await new Promise((T) => S(i, () => T()));
246
+ var d, g;
247
+ for (let w of [...Object.values(p.interceptors), ...Object.values(this.interceptors)])
248
+ await new Promise((x) => w(i, () => x()));
220
249
  if (!i.ok)
221
250
  throw new Error(i.statusText);
222
- return (y = i.headers.get("Content-Type")) != null && y.startsWith("application/json") ? await i.json() : (E = i.headers.get("Content-Type")) != null && E.startsWith("text/plain") ? await i.text() : i;
251
+ return !e.skipConverting && ((d = i.headers.get("Content-Type")) != null && d.startsWith("application/json")) ? await i.json() : !e.skipConverting && ((g = i.headers.get("Content-Type")) != null && g.startsWith("text/plain")) ? await i.text() : i;
223
252
  });
224
253
  }
225
254
  };
226
- l(d, "interceptors", {}), l(d, "headers", {});
227
- let R = d;
228
- R.addInterceptor((n, e) => {
255
+ l(p, "interceptors", {}), l(p, "headers", {});
256
+ let L = p;
257
+ L.addInterceptor((n, e) => {
229
258
  if (n.status == 200)
230
259
  return e();
231
- throw n.status == 400 ? new D(n.statusText) : n.status == 401 ? new G(n.statusText) : n.status == 403 ? new k(n.statusText) : n.status == 404 ? new j(n.statusText) : n.status == 500 ? new M(n.statusText) : new p(n.statusText, n.status);
260
+ throw n.status == 400 ? new j(n.statusText) : n.status == 401 ? new U(n.statusText) : n.status == 403 ? new M(n.statusText) : n.status == 404 ? new Y(n.statusText) : n.status == 500 ? new P(n.statusText) : new E(n.statusText, n.status);
232
261
  });
233
- class p extends Error {
262
+ class E extends Error {
234
263
  constructor(t, r) {
235
264
  super(t);
236
265
  l(this, "_code");
@@ -257,8 +286,8 @@ class p extends Error {
257
286
  return this.message || super.toString();
258
287
  }
259
288
  }
260
- l(p, "code", 500);
261
- class D extends p {
289
+ l(E, "code", 500);
290
+ class j extends E {
262
291
  constructor(e = "Bad Request") {
263
292
  super(e);
264
293
  }
@@ -266,8 +295,8 @@ class D extends p {
266
295
  return e.constructor.code == this.code;
267
296
  }
268
297
  }
269
- l(D, "code", 400);
270
- class G extends p {
298
+ l(j, "code", 400);
299
+ class U extends E {
271
300
  constructor(e = "Unauthorized") {
272
301
  super(e);
273
302
  }
@@ -275,8 +304,8 @@ class G extends p {
275
304
  return e.constructor.code == this.code;
276
305
  }
277
306
  }
278
- l(G, "code", 401);
279
- class k extends p {
307
+ l(U, "code", 401);
308
+ class M extends E {
280
309
  constructor(e = "Forbidden") {
281
310
  super(e);
282
311
  }
@@ -284,8 +313,8 @@ class k extends p {
284
313
  return e.constructor.code == this.code;
285
314
  }
286
315
  }
287
- l(k, "code", 403);
288
- class j extends p {
316
+ l(M, "code", 403);
317
+ class Y extends E {
289
318
  constructor(e = "Not Found") {
290
319
  super(e);
291
320
  }
@@ -293,8 +322,8 @@ class j extends p {
293
322
  return e.constructor.code == this.code;
294
323
  }
295
324
  }
296
- l(j, "code", 404);
297
- class M extends p {
325
+ l(Y, "code", 404);
326
+ class P extends E {
298
327
  constructor(e = "Internal Server Error") {
299
328
  super(e);
300
329
  }
@@ -302,8 +331,8 @@ class M extends p {
302
331
  return e.constructor.code == this.code;
303
332
  }
304
333
  }
305
- l(M, "code", 500);
306
- const x = {
334
+ l(P, "code", 500);
335
+ const B = {
307
336
  CLEAR: "\x1B[0m",
308
337
  BRIGHT: "\x1B[1m",
309
338
  DIM: "\x1B[2m",
@@ -311,7 +340,7 @@ const x = {
311
340
  BLINK: "\x1B[5m",
312
341
  REVERSE: "\x1B[7m",
313
342
  HIDDEN: "\x1B[8m"
314
- }, A = {
343
+ }, C = {
315
344
  BLACK: "\x1B[30m",
316
345
  RED: "\x1B[31m",
317
346
  GREEN: "\x1B[32m",
@@ -328,7 +357,7 @@ const x = {
328
357
  LIGHT_MAGENTA: "\x1B[95m",
329
358
  LIGHT_CYAN: "\x1B[96m",
330
359
  WHITE: "\x1B[97m"
331
- }, ut = {
360
+ }, dt = {
332
361
  BLACK: "\x1B[40m",
333
362
  RED: "\x1B[41m",
334
363
  GREEN: "\x1B[42m",
@@ -339,8 +368,8 @@ const x = {
339
368
  WHITE: "\x1B[47m",
340
369
  GREY: "\x1B[100m"
341
370
  };
342
- var F = /* @__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))(F || {});
343
- const f = class f extends $ {
371
+ var K = /* @__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))(K || {});
372
+ const f = class f extends k {
344
373
  constructor(e) {
345
374
  super(), this.namespace = e;
346
375
  }
@@ -348,8 +377,8 @@ const f = class f extends $ {
348
377
  const s = e.toString(), i = t - s.length;
349
378
  if (i <= 0)
350
379
  return s;
351
- const y = Array(~~(i / r.length)).fill(r).join("");
352
- return o ? s + y : y + s;
380
+ const d = Array(~~(i / r.length)).fill(r).join("");
381
+ return o ? s + d : d + s;
353
382
  }
354
383
  format(...e) {
355
384
  const t = /* @__PURE__ */ new Date();
@@ -359,77 +388,77 @@ const f = class f extends $ {
359
388
  if (f.LOG_LEVEL < 4)
360
389
  return;
361
390
  const t = this.format(...e);
362
- f.emit(4, t), console.debug(A.LIGHT_GREY + t + x.CLEAR);
391
+ f.emit(4, t), console.debug(C.LIGHT_GREY + t + B.CLEAR);
363
392
  }
364
393
  log(...e) {
365
394
  if (f.LOG_LEVEL < 3)
366
395
  return;
367
396
  const t = this.format(...e);
368
- f.emit(3, t), console.log(x.CLEAR + t);
397
+ f.emit(3, t), console.log(B.CLEAR + t);
369
398
  }
370
399
  info(...e) {
371
400
  if (f.LOG_LEVEL < 2)
372
401
  return;
373
402
  const t = this.format(...e);
374
- f.emit(2, t), console.info(A.BLUE + t + x.CLEAR);
403
+ f.emit(2, t), console.info(C.BLUE + t + B.CLEAR);
375
404
  }
376
405
  warn(...e) {
377
406
  if (f.LOG_LEVEL < 1)
378
407
  return;
379
408
  const t = this.format(...e);
380
- f.emit(1, t), console.warn(A.YELLOW + t + x.CLEAR);
409
+ f.emit(1, t), console.warn(C.YELLOW + t + B.CLEAR);
381
410
  }
382
411
  error(...e) {
383
412
  if (f.LOG_LEVEL < 0)
384
413
  return;
385
414
  const t = this.format(...e);
386
- f.emit(0, t), console.error(A.RED + t + x.CLEAR);
415
+ f.emit(0, t), console.error(C.RED + t + B.CLEAR);
387
416
  }
388
417
  };
389
418
  l(f, "LOG_LEVEL", 4);
390
- let b = f;
391
- function at(n, e) {
419
+ let G = f;
420
+ function gt(n, e) {
392
421
  return n.length - n.replaceAll(e, "").length;
393
422
  }
394
- function ht(n) {
423
+ function pt(n) {
395
424
  return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
396
425
  }
397
- const C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", N = "0123456789", I = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", z = C + N + I;
398
- function lt(n) {
426
+ const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", N = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", V = T + I + N;
427
+ function yt(n) {
399
428
  const e = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
400
429
  if (!e)
401
430
  throw new Error(`Number cannot be parsed: ${n}`);
402
431
  return `${e[1] ?? ""} (${e[2]}) ${e[3]}-${e[4]}`.trim();
403
432
  }
404
- function ft(n, e, t) {
433
+ function Et(n, e, t) {
405
434
  return `${n.slice(0, t)}${e}${n.slice(t + 1)}`;
406
435
  }
407
- function dt(n, e, t, r = !0) {
436
+ function wt(n, e, t, r = !0) {
408
437
  const o = n.toString(), s = e - o.length;
409
438
  if (s <= 0)
410
439
  return o;
411
440
  const i = Array(~~(s / t.length)).fill(t).join("");
412
441
  return r ? i + o : o + i;
413
442
  }
414
- function yt(n, e = z) {
443
+ function xt(n, e = V) {
415
444
  return Array(n).fill(null).map(() => {
416
445
  const t = ~~(Math.random() * e.length);
417
446
  return e[t];
418
447
  }).join("");
419
448
  }
420
- function gt(n, e = !1, t = !1, r = !1) {
449
+ function mt(n, e = !1, t = !1, r = !1) {
421
450
  if (!e && !t && !r)
422
451
  throw new Error("Must enable at least one: letters, numbers, symbols");
423
452
  return Array(n).fill(null).map(() => {
424
453
  let o;
425
454
  do {
426
455
  const s = ~~(Math.random() * 3);
427
- e && s == 0 ? o = C[~~(Math.random() * C.length)] : t && s == 1 ? o = N[~~(Math.random() * N.length)] : r && s == 2 && (o = I[~~(Math.random() * I.length)]);
456
+ e && s == 0 ? o = T[~~(Math.random() * T.length)] : t && s == 1 ? o = I[~~(Math.random() * I.length)] : r && s == 2 && (o = N[~~(Math.random() * N.length)]);
428
457
  } while (!o);
429
458
  return o;
430
459
  }).join("");
431
460
  }
432
- function pt(n, e) {
461
+ function Bt(n, e) {
433
462
  if (typeof e == "string" && (e = new RegExp(e, "g")), !e.global)
434
463
  throw new TypeError("Regular expression must be global.");
435
464
  let t = [], r;
@@ -437,69 +466,69 @@ function pt(n, e) {
437
466
  t.push(r);
438
467
  return t;
439
468
  }
440
- function J(n) {
441
- var e = v(V(Z(K(n), 8 * n.length)));
469
+ function Z(n) {
470
+ var e = Q(_(tt(X(n), 8 * n.length)));
442
471
  return e.toLowerCase();
443
472
  }
444
- function v(n) {
473
+ function Q(n) {
445
474
  for (var e, t = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
446
475
  e = n.charCodeAt(o), r += t.charAt(e >>> 4 & 15) + t.charAt(15 & e);
447
476
  return r;
448
477
  }
449
- function K(n) {
478
+ function X(n) {
450
479
  for (var e = Array(n.length >> 2), t = 0; t < e.length; t++)
451
480
  e[t] = 0;
452
481
  for (t = 0; t < 8 * n.length; t += 8)
453
482
  e[t >> 5] |= (255 & n.charCodeAt(t / 8)) << t % 32;
454
483
  return e;
455
484
  }
456
- function V(n) {
485
+ function _(n) {
457
486
  for (var e = "", t = 0; t < 32 * n.length; t += 8)
458
487
  e += String.fromCharCode(n[t >> 5] >>> t % 32 & 255);
459
488
  return e;
460
489
  }
461
- function Z(n, e) {
490
+ function tt(n, e) {
462
491
  n[e >> 5] |= 128 << e % 32, n[14 + (e + 64 >>> 9 << 4)] = e;
463
492
  for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878, i = 0; i < n.length; i += 16) {
464
- var y = t, E = r, S = o, T = s;
465
- r = h(r = h(r = h(r = h(r = a(r = a(r = a(r = a(r = u(r = u(r = u(r = u(r = c(r = c(r = c(r = c(r, o = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = g(t, y), r = g(r, E), o = g(o, S), s = g(s, T);
493
+ var d = t, g = r, w = o, x = s;
494
+ r = h(r = h(r = h(r = h(r = a(r = a(r = a(r = a(r = u(r = u(r = u(r = u(r = c(r = c(r = c(r = c(r, o = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = c(o, s = c(s, t = c(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = u(o, s = u(s, t = u(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = a(o, s = a(s, t = a(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = h(o, s = h(s, t = h(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 = y(t, d), r = y(r, g), o = y(o, w), s = y(s, x);
466
495
  }
467
496
  return Array(t, r, o, s);
468
497
  }
469
- function O(n, e, t, r, o, s) {
470
- return g(Q(g(g(e, n), g(r, s)), o), t);
498
+ function b(n, e, t, r, o, s) {
499
+ return y(et(y(y(e, n), y(r, s)), o), t);
471
500
  }
472
501
  function c(n, e, t, r, o, s, i) {
473
- return O(e & t | ~e & r, n, e, o, s, i);
502
+ return b(e & t | ~e & r, n, e, o, s, i);
474
503
  }
475
504
  function u(n, e, t, r, o, s, i) {
476
- return O(e & r | t & ~r, n, e, o, s, i);
505
+ return b(e & r | t & ~r, n, e, o, s, i);
477
506
  }
478
507
  function a(n, e, t, r, o, s, i) {
479
- return O(e ^ t ^ r, n, e, o, s, i);
508
+ return b(e ^ t ^ r, n, e, o, s, i);
480
509
  }
481
510
  function h(n, e, t, r, o, s, i) {
482
- return O(t ^ (e | ~r), n, e, o, s, i);
511
+ return b(t ^ (e | ~r), n, e, o, s, i);
483
512
  }
484
- function g(n, e) {
513
+ function y(n, e) {
485
514
  var t = (65535 & n) + (65535 & e);
486
515
  return (n >> 16) + (e >> 16) + (t >> 16) << 16 | 65535 & t;
487
516
  }
488
- function Q(n, e) {
517
+ function et(n, e) {
489
518
  return n << e | n >>> 32 - e;
490
519
  }
491
- function Et(n) {
520
+ function At(n) {
492
521
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
493
522
  }
494
- function xt(n) {
523
+ function Rt(n) {
495
524
  return Object.entries(n).map(
496
525
  ([e, t]) => encodeURIComponent(e) + "=" + encodeURIComponent(t)
497
526
  ).join("&");
498
527
  }
499
- function wt(n, e = "mp") {
500
- return n ? `https://www.gravatar.com/avatar/${J(n)}?d=${e}` : "";
528
+ function Ot(n, e = "mp") {
529
+ return n ? `https://www.gravatar.com/avatar/${Z(n)}?d=${e}` : "";
501
530
  }
502
- function Bt(n) {
531
+ function Ct(n) {
503
532
  const e = new RegExp(
504
533
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
505
534
  "gm"
@@ -507,19 +536,19 @@ function Bt(n) {
507
536
  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) {
508
537
  const o = t.query.split("&"), s = {};
509
538
  o.forEach((i) => {
510
- const [y, E] = i.split("=");
511
- s[y] = E;
539
+ const [d, g] = i.split("=");
540
+ s[d] = g;
512
541
  }), t.query = s;
513
542
  }
514
543
  return t;
515
544
  }
516
- function At(n) {
545
+ function St(n) {
517
546
  return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
518
547
  }
519
- function mt(n) {
548
+ function bt(n) {
520
549
  return new Promise((e) => setTimeout(e, n));
521
550
  }
522
- function Ot(n) {
551
+ function Lt(n) {
523
552
  const e = n instanceof Date ? n : new Date(n);
524
553
  return new Intl.DateTimeFormat("en-us", {
525
554
  weekday: "long",
@@ -531,51 +560,53 @@ function Ot(n) {
531
560
  }).format(e);
532
561
  }
533
562
  export {
534
- w as ASet,
535
- D as BadRequestError,
536
- ut as CliBackground,
537
- x as CliEffects,
538
- A as CliForeground,
539
- p as CustomError,
540
- k as ForbiddenError,
541
- M as InternalServerError,
542
- F as LOG_LEVEL,
543
- b as Logger,
544
- j as NotFoundError,
545
- $ as TypedEmitter,
546
- G as UnauthorizedError,
547
- R as XHR,
548
- nt as addUnique,
549
- rt as arrayDiff,
550
- ot as caseInsensitiveSort,
551
- P as clean,
552
- at as countChars,
553
- ht as createHex,
554
- _ as deepCopy,
555
- m as dotNotation,
556
- it as findByProp,
557
- W as flattenArr,
558
- H as flattenObj,
559
- xt as formEncode,
560
- Ot as formatDate,
561
- lt as formatPhoneNumber,
562
- wt as gravatar,
563
- L as includes,
564
- ft as insertAt,
565
- B as isEqual,
566
- ct as makeArray,
567
- q as makeUnique,
568
- pt as matchAll,
569
- J as md5,
570
- tt as mixin,
571
- dt as pad,
572
- yt as randomString,
573
- gt as randomStringBuilder,
574
- et as sanitizedJSON,
575
- mt as sleep,
576
- st as sortByProp,
577
- At as timeUntil,
578
- Bt as urlParser,
579
- Et as validateEmail
563
+ A as ASet,
564
+ j as BadRequestError,
565
+ dt as CliBackground,
566
+ B as CliEffects,
567
+ C as CliForeground,
568
+ E as CustomError,
569
+ M as ForbiddenError,
570
+ P as InternalServerError,
571
+ K as LOG_LEVEL,
572
+ G as Logger,
573
+ Y as NotFoundError,
574
+ k as TypedEmitter,
575
+ U as UnauthorizedError,
576
+ L as XHR,
577
+ it as addUnique,
578
+ ct as arrayDiff,
579
+ ut as caseInsensitiveSort,
580
+ q as clean,
581
+ gt as countChars,
582
+ pt as createHex,
583
+ rt as deepCopy,
584
+ S as dotNotation,
585
+ J as download,
586
+ ft as downloadStream,
587
+ ht as findByProp,
588
+ F as flattenArr,
589
+ v as flattenObj,
590
+ Rt as formEncode,
591
+ Lt as formatDate,
592
+ yt as formatPhoneNumber,
593
+ Ot as gravatar,
594
+ D as includes,
595
+ Et as insertAt,
596
+ R as isEqual,
597
+ lt as makeArray,
598
+ z as makeUnique,
599
+ Bt as matchAll,
600
+ Z as md5,
601
+ ot as mixin,
602
+ wt as pad,
603
+ xt as randomString,
604
+ mt as randomStringBuilder,
605
+ st as sanitizedJSON,
606
+ bt as sleep,
607
+ at as sortByProp,
608
+ St as timeUntil,
609
+ Ct as urlParser,
610
+ At as validateEmail
580
611
  };
581
612
  //# sourceMappingURL=utils.mjs.map