@ztimson/utils 0.15.5 → 0.16.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/index.mjs CHANGED
@@ -9,7 +9,7 @@ function rt(n, t = !1) {
9
9
  }), n;
10
10
  }
11
11
  function mt(n) {
12
- return JSON.parse(JSON.stringify(n));
12
+ return structuredClone(n);
13
13
  }
14
14
  function ot(n, ...t) {
15
15
  return t.forEach((e) => {
@@ -17,7 +17,7 @@ function ot(n, ...t) {
17
17
  e[r] && typeof e[r] == "object" && !Array.isArray(e[r]) ? (n[r] || (n[r] = {}), ot(n[r], e[r])) : n[r] = e[r];
18
18
  }), n;
19
19
  }
20
- function S(n, t, e) {
20
+ function A(n, t, e) {
21
21
  if (!(n == null || !t))
22
22
  return t.split(/[.[\]]/g).filter((r) => r.length).reduce((r, o, s, c) => {
23
23
  if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(r != null && r.hasOwnProperty(o))) {
@@ -28,6 +28,11 @@ function S(n, t, e) {
28
28
  return e !== void 0 && s == c.length - 1 ? r[o] = e : r[o];
29
29
  }, n);
30
30
  }
31
+ function xt(n) {
32
+ return Object.entries(n).map(
33
+ ([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
34
+ ).join("&");
35
+ }
31
36
  function st(n, t, e = {}) {
32
37
  if (typeof n == "object" && !Array.isArray(n)) {
33
38
  for (const r of Object.keys(n)) {
@@ -37,23 +42,23 @@ function st(n, t, e = {}) {
37
42
  return e;
38
43
  }
39
44
  }
40
- function xt(n) {
45
+ function Bt(n) {
41
46
  const t = new FormData();
42
47
  return Object.entries(n).forEach(([e, r]) => t.append(e, r)), t;
43
48
  }
44
- function U(n, t, e = !1) {
49
+ function G(n, t, e = !1) {
45
50
  if (n == null)
46
51
  return e;
47
52
  if (Array.isArray(t))
48
- return t.findIndex((o, s) => !U(n[s], t[s], e)) == -1;
53
+ return t.findIndex((o, s) => !G(n[s], t[s], e)) == -1;
49
54
  const r = typeof t;
50
- return r != typeof n ? !1 : r == "object" ? Object.keys(t).find((o) => !U(n[o], t[o], e)) == null : r == "function" ? n.toString() == t.toString() : n == t;
55
+ return r != typeof n ? !1 : r == "object" ? Object.keys(t).find((o) => !G(n[o], t[o], e)) == null : r == "function" ? n.toString() == t.toString() : n == t;
51
56
  }
52
- function B(n, t) {
57
+ function b(n, t) {
53
58
  const e = typeof n, r = typeof t;
54
- 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((s) => B(n[s], t[s]));
59
+ 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((s) => b(n[s], t[s]));
55
60
  }
56
- function At(n, t) {
61
+ function St(n, t) {
57
62
  t.forEach((e) => {
58
63
  Object.getOwnPropertyNames(e.prototype).forEach((r) => {
59
64
  Object.defineProperty(
@@ -64,65 +69,60 @@ function At(n, t) {
64
69
  });
65
70
  });
66
71
  }
67
- function q(n) {
72
+ function U(n) {
68
73
  try {
69
74
  return JSON.parse(n);
70
75
  } catch {
71
76
  return n;
72
77
  }
73
78
  }
74
- function bt(n, t) {
79
+ function At(n, t) {
75
80
  let e = [];
76
- return JSON.parse(JSON.stringify(n, (r, o) => {
81
+ return JSON.stringify(n, (r, o) => {
77
82
  if (typeof o == "object" && o !== null) {
78
83
  if (e.includes(o))
79
84
  return;
80
85
  e.push(o);
81
86
  }
82
87
  return o;
83
- }, t));
84
- }
85
- function Bt(n) {
86
- return Object.entries(n).map(
87
- ([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
88
- ).join("&");
88
+ }, t);
89
89
  }
90
- function Rt(n, t) {
90
+ function bt(n, t) {
91
91
  return n.indexOf(t) === -1 && n.push(t), n;
92
92
  }
93
- function Ot(n, t) {
93
+ function Rt(n, t) {
94
94
  return it([
95
- ...n.filter((e) => !t.includes((r) => B(e, r))),
96
- ...t.filter((e) => !n.includes((r) => B(e, r)))
95
+ ...n.filter((e) => !t.includes((r) => b(e, r))),
96
+ ...t.filter((e) => !n.includes((r) => b(e, r)))
97
97
  ]);
98
98
  }
99
99
  function Lt(n) {
100
100
  return function(t, e) {
101
- const r = S(t, n), o = S(e, n);
101
+ const r = A(t, n), o = A(e, n);
102
102
  return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
103
103
  };
104
104
  }
105
+ function Ot(n, t) {
106
+ return (e) => b(A(e, n), t);
107
+ }
105
108
  function ct(n, t = []) {
106
109
  return n.forEach((e) => Array.isArray(e) ? ct(e, t) : t.push(e)), t;
107
110
  }
108
- function St(n, t = !1) {
111
+ function $t(n, t = !1) {
109
112
  return function(e, r) {
110
- const o = S(e, n), s = S(r, n);
113
+ const o = A(e, n), s = A(r, n);
111
114
  return typeof o == "number" && typeof s == "number" ? (t ? -1 : 1) * (o - s) : o > s ? t ? -1 : 1 : o < s ? t ? 1 : -1 : 0;
112
115
  };
113
116
  }
114
- function Ct(n, t) {
115
- return (e) => B(e[n], t);
116
- }
117
117
  function it(n) {
118
118
  for (let t = n.length - 1; t >= 0; t--)
119
- n.slice(0, t).find((e) => B(e, n[t])) && n.splice(t, 1);
119
+ n.slice(0, t).find((e) => b(e, n[t])) && n.splice(t, 1);
120
120
  return n;
121
121
  }
122
- function Nt(n) {
122
+ function Ct(n) {
123
123
  return Array.isArray(n) ? n : [n];
124
124
  }
125
- class b extends Array {
125
+ class S extends Array {
126
126
  /** Number of elements in set */
127
127
  get size() {
128
128
  return this.length;
@@ -155,7 +155,7 @@ class b extends Array {
155
155
  * @return {ASet<T>} Different elements
156
156
  */
157
157
  difference(t) {
158
- return new b(this.filter((e) => !t.has(e)));
158
+ return new S(this.filter((e) => !t.has(e)));
159
159
  }
160
160
  /**
161
161
  * Check if set includes element
@@ -171,7 +171,7 @@ class b extends Array {
171
171
  * @return {boolean} Set of common elements
172
172
  */
173
173
  intersection(t) {
174
- return new b(this.filter((e) => t.has(e)));
174
+ return new S(this.filter((e) => t.has(e)));
175
175
  }
176
176
  /**
177
177
  * Check if this set has no elements in common with the comparison set
@@ -203,7 +203,7 @@ class b extends Array {
203
203
  * @return {ASet<T>} New set of unique elements
204
204
  */
205
205
  symmetricDifference(t) {
206
- return new b([...this.difference(t), ...t.difference(this)]);
206
+ return new S([...this.difference(t), ...t.difference(this)]);
207
207
  }
208
208
  /**
209
209
  * Create joined list of elements included in this & the comparison set
@@ -211,7 +211,7 @@ class b extends Array {
211
211
  * @return {ASet<T>} New set of both previous sets combined
212
212
  */
213
213
  union(t) {
214
- return new b([...this, ...t]);
214
+ return new S([...this, ...t]);
215
215
  }
216
216
  }
217
217
  class m extends Promise {
@@ -253,13 +253,13 @@ class m extends Promise {
253
253
  }
254
254
  function ut(n, t) {
255
255
  const e = document.createElement("a");
256
- e.href = n, e.download = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
256
+ e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
257
257
  }
258
- function Tt(n, t) {
258
+ function Nt(n, t) {
259
259
  const e = URL.createObjectURL(n);
260
260
  ut(e, t), URL.revokeObjectURL(e);
261
261
  }
262
- function It(n = {}) {
262
+ function Tt(n = {}) {
263
263
  return new Promise((t) => {
264
264
  const e = document.createElement("input");
265
265
  e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
@@ -267,13 +267,18 @@ function It(n = {}) {
267
267
  }, document.body.appendChild(e), e.click();
268
268
  });
269
269
  }
270
- function $t(n) {
270
+ function It(n, t = /* @__PURE__ */ new Date()) {
271
+ (typeof t == "number" || typeof t == "string") && (t = new Date(t));
272
+ 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")}`;
273
+ return n ? n.replace("{{TIMESTAMP}}", e) : e;
274
+ }
275
+ function Mt(n) {
271
276
  return new m((t, e, r) => {
272
277
  const o = new XMLHttpRequest(), s = new FormData();
273
- n.files.forEach((c) => s.append("file", c)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (c) => c.lengthComputable ? r(c.loaded / c.total) : null), o.addEventListener("loadend", () => t(q(o.responseText))), o.addEventListener("error", () => e(q(o.responseText))), o.addEventListener("timeout", () => e({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([c, y]) => o.setRequestHeader(c, y)), o.send(s);
278
+ n.files.forEach((c) => s.append("file", c)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (c) => c.lengthComputable ? r(c.loaded / c.total) : null), o.addEventListener("loadend", () => t(U(o.responseText))), o.addEventListener("error", () => e(U(o.responseText))), o.addEventListener("timeout", () => e({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([c, y]) => o.setRequestHeader(c, y)), o.send(s);
274
279
  });
275
280
  }
276
- class v {
281
+ class F {
277
282
  constructor() {
278
283
  i(this, "listeners", {});
279
284
  }
@@ -314,7 +319,7 @@ class v {
314
319
  });
315
320
  }
316
321
  }
317
- i(v, "listeners", {});
322
+ i(F, "listeners", {});
318
323
  class p extends Error {
319
324
  constructor(e, r) {
320
325
  super(e);
@@ -343,7 +348,7 @@ class p extends Error {
343
348
  }
344
349
  }
345
350
  i(p, "code", 500);
346
- class F extends p {
351
+ class Y extends p {
347
352
  constructor(t = "Bad Request") {
348
353
  super(t);
349
354
  }
@@ -351,7 +356,7 @@ class F extends p {
351
356
  return t.constructor.code == this.code;
352
357
  }
353
358
  }
354
- i(F, "code", 400);
359
+ i(Y, "code", 400);
355
360
  class H extends p {
356
361
  constructor(t = "Unauthorized") {
357
362
  super(t);
@@ -361,7 +366,7 @@ class H extends p {
361
366
  }
362
367
  }
363
368
  i(H, "code", 401);
364
- class Y extends p {
369
+ class v extends p {
365
370
  constructor(t = "Payment Required") {
366
371
  super(t);
367
372
  }
@@ -369,7 +374,7 @@ class Y extends p {
369
374
  return t.constructor.code == this.code;
370
375
  }
371
376
  }
372
- i(Y, "code", 402);
377
+ i(v, "code", 402);
373
378
  class W extends p {
374
379
  constructor(t = "Forbidden") {
375
380
  super(t);
@@ -379,7 +384,7 @@ class W extends p {
379
384
  }
380
385
  }
381
386
  i(W, "code", 403);
382
- class J extends p {
387
+ class z extends p {
383
388
  constructor(t = "Not Found") {
384
389
  super(t);
385
390
  }
@@ -387,8 +392,8 @@ class J extends p {
387
392
  return t.constructor.code == this.code;
388
393
  }
389
394
  }
390
- i(J, "code", 404);
391
- class z extends p {
395
+ i(z, "code", 404);
396
+ class J extends p {
392
397
  constructor(t = "Method Not Allowed") {
393
398
  super(t);
394
399
  }
@@ -396,7 +401,7 @@ class z extends p {
396
401
  return t.constructor.code == this.code;
397
402
  }
398
403
  }
399
- i(z, "code", 405);
404
+ i(J, "code", 405);
400
405
  class K extends p {
401
406
  constructor(t = "Not Acceptable") {
402
407
  super(t);
@@ -406,7 +411,7 @@ class K extends p {
406
411
  }
407
412
  }
408
413
  i(K, "code", 406);
409
- class V extends p {
414
+ class Z extends p {
410
415
  constructor(t = "Internal Server Error") {
411
416
  super(t);
412
417
  }
@@ -414,8 +419,8 @@ class V extends p {
414
419
  return t.constructor.code == this.code;
415
420
  }
416
421
  }
417
- i(V, "code", 500);
418
- class Z extends p {
422
+ i(Z, "code", 500);
423
+ class V extends p {
419
424
  constructor(t = "Not Implemented") {
420
425
  super(t);
421
426
  }
@@ -423,7 +428,7 @@ class Z extends p {
423
428
  return t.constructor.code == this.code;
424
429
  }
425
430
  }
426
- i(Z, "code", 501);
431
+ i(V, "code", 501);
427
432
  class X extends p {
428
433
  constructor(t = "Bad Gateway") {
429
434
  super(t);
@@ -456,23 +461,23 @@ function Dt(n, t) {
456
461
  return null;
457
462
  switch (n) {
458
463
  case 400:
459
- return new F(t);
464
+ return new Y(t);
460
465
  case 401:
461
466
  return new H(t);
462
467
  case 402:
463
- return new Y(t);
468
+ return new v(t);
464
469
  case 403:
465
470
  return new W(t);
466
471
  case 404:
467
- return new J(t);
468
- case 405:
469
472
  return new z(t);
473
+ case 405:
474
+ return new J(t);
470
475
  case 406:
471
476
  return new K(t);
472
477
  case 500:
473
- return new V(t);
474
- case 501:
475
478
  return new Z(t);
479
+ case 501:
480
+ return new V(t);
476
481
  case 502:
477
482
  return new X(t);
478
483
  case 503:
@@ -523,25 +528,25 @@ const w = class w {
523
528
  method: t.method || (t.body ? "POST" : "GET"),
524
529
  body: t.body
525
530
  }).then(async (u) => {
526
- var j, G;
531
+ var k, j;
527
532
  for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
528
- await new Promise((O) => a(u, () => O()));
529
- const R = u.headers.get("Content-Length"), N = R ? parseInt(R, 10) : 0;
530
- let k = 0;
531
- const T = (j = u.body) == null ? void 0 : j.getReader(), tt = new ReadableStream({
533
+ await new Promise((L) => a(u, () => L()));
534
+ const R = u.headers.get("Content-Length"), C = R ? parseInt(R, 10) : 0;
535
+ let D = 0;
536
+ const N = (k = u.body) == null ? void 0 : k.getReader(), tt = new ReadableStream({
532
537
  start(a) {
533
- function O() {
534
- T == null || T.read().then((x) => {
538
+ function L() {
539
+ N == null || N.read().then((x) => {
535
540
  if (x.done)
536
541
  return a.close();
537
- k += x.value.byteLength, y(k / N), a.enqueue(x.value), O();
542
+ D += x.value.byteLength, y(D / C), a.enqueue(x.value), L();
538
543
  }).catch((x) => a.error(x));
539
544
  }
540
- O();
545
+ L();
541
546
  }
542
547
  });
543
548
  if (u.data = new Response(tt), t.decode == null || t.decode) {
544
- const a = (G = u.headers.get("Content-Type")) == null ? void 0 : G.toLowerCase();
549
+ const a = (j = u.headers.get("Content-Type")) == null ? void 0 : j.toLowerCase();
545
550
  a != null && a.includes("form") ? u.data = await u.data.formData() : a != null && a.includes("json") ? u.data = await u.data.json() : a != null && a.includes("text") ? u.data = await u.data.text() : a != null && a.includes("application") && (u.data = await u.data.blob());
546
551
  }
547
552
  u.ok ? s(u) : c(u);
@@ -550,8 +555,8 @@ const w = class w {
550
555
  }
551
556
  };
552
557
  i(w, "interceptors", {}), i(w, "headers", {});
553
- let M = w;
554
- const A = {
558
+ let q = w;
559
+ const B = {
555
560
  CLEAR: "\x1B[0m",
556
561
  BRIGHT: "\x1B[1m",
557
562
  DIM: "\x1B[2m",
@@ -559,7 +564,7 @@ const A = {
559
564
  BLINK: "\x1B[5m",
560
565
  REVERSE: "\x1B[7m",
561
566
  HIDDEN: "\x1B[8m"
562
- }, L = {
567
+ }, O = {
563
568
  BLACK: "\x1B[30m",
564
569
  RED: "\x1B[31m",
565
570
  GREEN: "\x1B[32m",
@@ -588,7 +593,7 @@ const A = {
588
593
  GREY: "\x1B[100m"
589
594
  };
590
595
  var at = /* @__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))(at || {});
591
- const g = class g extends v {
596
+ const g = class g extends F {
592
597
  constructor(t) {
593
598
  super(), this.namespace = t;
594
599
  }
@@ -607,31 +612,31 @@ const g = class g extends v {
607
612
  if (g.LOG_LEVEL < 4)
608
613
  return;
609
614
  const e = this.format(...t);
610
- g.emit(4, e), console.debug(L.LIGHT_GREY + e + A.CLEAR);
615
+ g.emit(4, e), console.debug(O.LIGHT_GREY + e + B.CLEAR);
611
616
  }
612
617
  log(...t) {
613
618
  if (g.LOG_LEVEL < 3)
614
619
  return;
615
620
  const e = this.format(...t);
616
- g.emit(3, e), console.log(A.CLEAR + e);
621
+ g.emit(3, e), console.log(B.CLEAR + e);
617
622
  }
618
623
  info(...t) {
619
624
  if (g.LOG_LEVEL < 2)
620
625
  return;
621
626
  const e = this.format(...t);
622
- g.emit(2, e), console.info(L.BLUE + e + A.CLEAR);
627
+ g.emit(2, e), console.info(O.BLUE + e + B.CLEAR);
623
628
  }
624
629
  warn(...t) {
625
630
  if (g.LOG_LEVEL < 1)
626
631
  return;
627
632
  const e = this.format(...t);
628
- g.emit(1, e), console.warn(L.YELLOW + e + A.CLEAR);
633
+ g.emit(1, e), console.warn(O.YELLOW + e + B.CLEAR);
629
634
  }
630
635
  error(...t) {
631
636
  if (g.LOG_LEVEL < 0)
632
637
  return;
633
638
  const e = this.format(...t);
634
- g.emit(0, e), console.error(L.RED + e + A.CLEAR);
639
+ g.emit(0, e), console.error(O.RED + e + B.CLEAR);
635
640
  }
636
641
  };
637
642
  i(g, "LOG_LEVEL", 4);
@@ -649,48 +654,47 @@ function Gt(n) {
649
654
  const e = t.length == 2 ? Number(t[0]) : 0;
650
655
  return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
651
656
  }
652
- function Ut(n, t) {
653
- return n.length - n.replaceAll(t, "").length;
654
- }
655
- function qt(n) {
657
+ const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", M = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", lt = T + I + M;
658
+ function Ut(n) {
656
659
  return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
657
660
  }
658
- const I = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", $ = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", lt = I + $ + D;
659
- function Mt(n) {
661
+ function qt(n, t = 2) {
662
+ if (n === 0)
663
+ return "0 Bytes";
664
+ const e = 1024, r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = Math.floor(Math.log(n) / Math.log(e));
665
+ return parseFloat((n / Math.pow(e, o)).toFixed(t)) + " " + r[o];
666
+ }
667
+ function Pt(n) {
660
668
  const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
661
669
  if (!t)
662
670
  throw new Error(`Number cannot be parsed: ${n}`);
663
671
  return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
664
672
  }
665
- function Pt(n, t, e) {
673
+ function Ft(n, t, e) {
666
674
  return `${n.slice(0, e)}${t}${n.slice(e + 1)}`;
667
675
  }
668
- function vt(n, t, e, r = !0) {
669
- const o = n.toString(), s = t - o.length;
670
- if (s <= 0)
671
- return o;
672
- const c = Array(~~(s / e.length)).fill(e).join("");
673
- return r ? c + o : o + c;
676
+ function Yt(n, t, e = " ", r = !0) {
677
+ return r ? n.toString().padStart(t, e) : n.toString().padEnd(t, e);
674
678
  }
675
- function Ft(n, t = lt) {
679
+ function Ht(n, t = lt) {
676
680
  return Array(n).fill(null).map(() => {
677
681
  const e = ~~(Math.random() * t.length);
678
682
  return t[e];
679
683
  }).join("");
680
684
  }
681
- function Ht(n, t = !1, e = !1, r = !1) {
685
+ function vt(n, t = !1, e = !1, r = !1) {
682
686
  if (!t && !e && !r)
683
687
  throw new Error("Must enable at least one: letters, numbers, symbols");
684
688
  return Array(n).fill(null).map(() => {
685
689
  let o;
686
690
  do {
687
691
  const s = ~~(Math.random() * 3);
688
- t && s == 0 ? o = I[~~(Math.random() * I.length)] : e && s == 1 ? o = $[~~(Math.random() * $.length)] : r && s == 2 && (o = D[~~(Math.random() * D.length)]);
692
+ t && s == 0 ? o = T[~~(Math.random() * T.length)] : e && s == 1 ? o = I[~~(Math.random() * I.length)] : r && s == 2 && (o = M[~~(Math.random() * M.length)]);
689
693
  } while (!o);
690
694
  return o;
691
695
  }).join("");
692
696
  }
693
- function Yt(n, t) {
697
+ function Wt(n, t) {
694
698
  if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
695
699
  throw new TypeError("Regular expression must be global.");
696
700
  let e = [], r;
@@ -698,11 +702,25 @@ function Yt(n, t) {
698
702
  e.push(r);
699
703
  return e;
700
704
  }
701
- function ht(n) {
702
- var t = ft(pt(yt(dt(n), 8 * n.length)));
703
- return t.toLowerCase();
705
+ function zt(n) {
706
+ const t = new RegExp(
707
+ "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
708
+ "gm"
709
+ ).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
710
+ 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) {
711
+ const o = e.query.split("&"), s = {};
712
+ o.forEach((c) => {
713
+ const [y, u] = c.split("=");
714
+ s[y] = u;
715
+ }), e.query = s;
716
+ }
717
+ return e;
704
718
  }
705
719
  function ft(n) {
720
+ var t = ht(pt(yt(dt(n), 8 * n.length)));
721
+ return t.toLowerCase();
722
+ }
723
+ function ht(n) {
706
724
  for (var t, e = "0123456789ABCDEF", r = "", o = 0; o < n.length; o++)
707
725
  t = n.charCodeAt(o), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
708
726
  return r;
@@ -722,25 +740,25 @@ function pt(n) {
722
740
  function yt(n, t) {
723
741
  n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
724
742
  for (var e = 1732584193, r = -271733879, o = -1732584194, s = 271733878, c = 0; c < n.length; c += 16) {
725
- var y = e, u = r, R = o, N = s;
726
- 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, e = l(e, r, o, s, n[c + 0], 7, -680876936), r, o, n[c + 1], 12, -389564586), e, r, n[c + 2], 17, 606105819), s, e, n[c + 3], 22, -1044525330), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 4], 7, -176418897), r, o, n[c + 5], 12, 1200080426), e, r, n[c + 6], 17, -1473231341), s, e, n[c + 7], 22, -45705983), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 8], 7, 1770035416), r, o, n[c + 9], 12, -1958414417), e, r, n[c + 10], 17, -42063), s, e, n[c + 11], 22, -1990404162), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 12], 7, 1804603682), r, o, n[c + 13], 12, -40341101), e, r, n[c + 14], 17, -1502002290), s, e, n[c + 15], 22, 1236535329), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 1], 5, -165796510), r, o, n[c + 6], 9, -1069501632), e, r, n[c + 11], 14, 643717713), s, e, n[c + 0], 20, -373897302), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 5], 5, -701558691), r, o, n[c + 10], 9, 38016083), e, r, n[c + 15], 14, -660478335), s, e, n[c + 4], 20, -405537848), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 9], 5, 568446438), r, o, n[c + 14], 9, -1019803690), e, r, n[c + 3], 14, -187363961), s, e, n[c + 8], 20, 1163531501), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 13], 5, -1444681467), r, o, n[c + 2], 9, -51403784), e, r, n[c + 7], 14, 1735328473), s, e, n[c + 12], 20, -1926607734), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 5], 4, -378558), r, o, n[c + 8], 11, -2022574463), e, r, n[c + 11], 16, 1839030562), s, e, n[c + 14], 23, -35309556), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 1], 4, -1530992060), r, o, n[c + 4], 11, 1272893353), e, r, n[c + 7], 16, -155497632), s, e, n[c + 10], 23, -1094730640), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 13], 4, 681279174), r, o, n[c + 0], 11, -358537222), e, r, n[c + 3], 16, -722521979), s, e, n[c + 6], 23, 76029189), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 9], 4, -640364487), r, o, n[c + 12], 11, -421815835), e, r, n[c + 15], 16, 530742520), s, e, n[c + 2], 23, -995338651), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 0], 6, -198630844), r, o, n[c + 7], 10, 1126891415), e, r, n[c + 14], 15, -1416354905), s, e, n[c + 5], 21, -57434055), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 12], 6, 1700485571), r, o, n[c + 3], 10, -1894986606), e, r, n[c + 10], 15, -1051523), s, e, n[c + 1], 21, -2054922799), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 8], 6, 1873313359), r, o, n[c + 15], 10, -30611744), e, r, n[c + 6], 15, -1560198380), s, e, n[c + 13], 21, 1309151649), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 4], 6, -145523070), r, o, n[c + 11], 10, -1120210379), e, r, n[c + 2], 15, 718787259), s, e, n[c + 9], 21, -343485551), e = E(e, y), r = E(r, u), o = E(o, R), s = E(s, N);
743
+ var y = e, u = r, R = o, C = s;
744
+ 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 = l(r = l(r = l(r = l(r, o = l(o, s = l(s, e = l(e, r, o, s, n[c + 0], 7, -680876936), r, o, n[c + 1], 12, -389564586), e, r, n[c + 2], 17, 606105819), s, e, n[c + 3], 22, -1044525330), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 4], 7, -176418897), r, o, n[c + 5], 12, 1200080426), e, r, n[c + 6], 17, -1473231341), s, e, n[c + 7], 22, -45705983), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 8], 7, 1770035416), r, o, n[c + 9], 12, -1958414417), e, r, n[c + 10], 17, -42063), s, e, n[c + 11], 22, -1990404162), o = l(o, s = l(s, e = l(e, r, o, s, n[c + 12], 7, 1804603682), r, o, n[c + 13], 12, -40341101), e, r, n[c + 14], 17, -1502002290), s, e, n[c + 15], 22, 1236535329), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 1], 5, -165796510), r, o, n[c + 6], 9, -1069501632), e, r, n[c + 11], 14, 643717713), s, e, n[c + 0], 20, -373897302), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 5], 5, -701558691), r, o, n[c + 10], 9, 38016083), e, r, n[c + 15], 14, -660478335), s, e, n[c + 4], 20, -405537848), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 9], 5, 568446438), r, o, n[c + 14], 9, -1019803690), e, r, n[c + 3], 14, -187363961), s, e, n[c + 8], 20, 1163531501), o = f(o, s = f(s, e = f(e, r, o, s, n[c + 13], 5, -1444681467), r, o, n[c + 2], 9, -51403784), e, r, n[c + 7], 14, 1735328473), s, e, n[c + 12], 20, -1926607734), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 5], 4, -378558), r, o, n[c + 8], 11, -2022574463), e, r, n[c + 11], 16, 1839030562), s, e, n[c + 14], 23, -35309556), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 1], 4, -1530992060), r, o, n[c + 4], 11, 1272893353), e, r, n[c + 7], 16, -155497632), s, e, n[c + 10], 23, -1094730640), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 13], 4, 681279174), r, o, n[c + 0], 11, -358537222), e, r, n[c + 3], 16, -722521979), s, e, n[c + 6], 23, 76029189), o = h(o, s = h(s, e = h(e, r, o, s, n[c + 9], 4, -640364487), r, o, n[c + 12], 11, -421815835), e, r, n[c + 15], 16, 530742520), s, e, n[c + 2], 23, -995338651), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 0], 6, -198630844), r, o, n[c + 7], 10, 1126891415), e, r, n[c + 14], 15, -1416354905), s, e, n[c + 5], 21, -57434055), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 12], 6, 1700485571), r, o, n[c + 3], 10, -1894986606), e, r, n[c + 10], 15, -1051523), s, e, n[c + 1], 21, -2054922799), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 8], 6, 1873313359), r, o, n[c + 15], 10, -30611744), e, r, n[c + 6], 15, -1560198380), s, e, n[c + 13], 21, 1309151649), o = d(o, s = d(s, e = d(e, r, o, s, n[c + 4], 6, -145523070), r, o, n[c + 11], 10, -1120210379), e, r, n[c + 2], 15, 718787259), s, e, n[c + 9], 21, -343485551), e = E(e, y), r = E(r, u), o = E(o, R), s = E(s, C);
727
745
  }
728
746
  return Array(e, r, o, s);
729
747
  }
730
- function C(n, t, e, r, o, s) {
748
+ function $(n, t, e, r, o, s) {
731
749
  return E(gt(E(E(t, n), E(r, s)), o), e);
732
750
  }
733
751
  function l(n, t, e, r, o, s, c) {
734
- return C(t & e | ~t & r, n, t, o, s, c);
735
- }
736
- function h(n, t, e, r, o, s, c) {
737
- return C(t & r | e & ~r, n, t, o, s, c);
752
+ return $(t & e | ~t & r, n, t, o, s, c);
738
753
  }
739
754
  function f(n, t, e, r, o, s, c) {
740
- return C(t ^ e ^ r, n, t, o, s, c);
755
+ return $(t & r | e & ~r, n, t, o, s, c);
756
+ }
757
+ function h(n, t, e, r, o, s, c) {
758
+ return $(t ^ e ^ r, n, t, o, s, c);
741
759
  }
742
760
  function d(n, t, e, r, o, s, c) {
743
- return C(e ^ (t | ~r), n, t, o, s, c);
761
+ return $(e ^ (t | ~r), n, t, o, s, c);
744
762
  }
745
763
  function E(n, t) {
746
764
  var e = (65535 & n) + (65535 & t);
@@ -749,36 +767,16 @@ function E(n, t) {
749
767
  function gt(n, t) {
750
768
  return n << t | n >>> 32 - t;
751
769
  }
752
- function Wt(n) {
770
+ function Jt(n) {
753
771
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
754
772
  }
755
- function Jt(n, t = "mp") {
756
- return n ? `https://www.gravatar.com/avatar/${ht(n)}?d=${t}` : "";
773
+ function Kt(n, t = "mp") {
774
+ return n ? `https://www.gravatar.com/avatar/${ft(n)}?d=${t}` : "";
757
775
  }
758
- function zt(n) {
759
- const t = new RegExp(
760
- "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
761
- "gm"
762
- ).exec(n), e = (t == null ? void 0 : t.groups) ?? {}, r = e.domain.split(".");
763
- 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) {
764
- const o = e.query.split("&"), s = {};
765
- o.forEach((c) => {
766
- const [y, u] = c.split("=");
767
- s[y] = u;
768
- }), e.query = s;
769
- }
770
- return e;
771
- }
772
- function Kt(n) {
773
- const t = n instanceof Date ? n : new Date(n);
774
- return new Intl.DateTimeFormat("en-us", {
775
- weekday: "long",
776
- month: "short",
777
- day: "numeric",
778
- hour: "numeric",
779
- minute: "numeric",
780
- hour12: !0
781
- }).format(t);
776
+ function Zt(n) {
777
+ (typeof n == "number" || typeof n == "string") && (n = new Date(n));
778
+ let t = n.getHours(), e = "AM";
779
+ 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}`;
782
780
  }
783
781
  function wt(n) {
784
782
  return new Promise((t) => setTimeout(t, n));
@@ -787,74 +785,79 @@ async function Vt(n, t = 100) {
787
785
  for (; n(); )
788
786
  await wt(t);
789
787
  }
790
- function Zt(n) {
788
+ function Xt(n) {
791
789
  return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
792
790
  }
791
+ function Qt() {
792
+ return Object.keys({});
793
+ }
793
794
  export {
794
- b as ASet,
795
+ S as ASet,
795
796
  X as BadGatewayError,
796
- F as BadRequestError,
797
+ Y as BadRequestError,
797
798
  kt as CliBackground,
798
- A as CliEffects,
799
- L as CliForeground,
799
+ B as CliEffects,
800
+ O as CliForeground,
800
801
  p as CustomError,
801
802
  W as ForbiddenError,
802
803
  _ as GatewayTimeoutError,
803
- M as Http,
804
- V as InternalServerError,
805
- q as JSONAttemptParse,
806
- bt as JSONSanitized,
804
+ q as Http,
805
+ Z as InternalServerError,
806
+ U as JSONAttemptParse,
807
+ At as JSONSanitize,
807
808
  at as LOG_LEVEL,
808
809
  P as Logger,
809
- z as MethodNotAllowedError,
810
+ J as MethodNotAllowedError,
810
811
  K as NotAcceptableError,
811
- J as NotFoundError,
812
- Z as NotImplementedError,
813
- Y as PaymentRequiredError,
812
+ z as NotFoundError,
813
+ V as NotImplementedError,
814
+ v as PaymentRequiredError,
814
815
  m as PromiseProgress,
815
816
  Q as ServiceUnavailableError,
816
- v as TypedEmitter,
817
+ F as TypedEmitter,
817
818
  H as UnauthorizedError,
818
- Rt as addUnique,
819
- Ot as arrayDiff,
819
+ bt as addUnique,
820
+ Rt as arrayDiff,
820
821
  Lt as caseInsensitiveSort,
821
822
  rt as clean,
822
- Ut as countChars,
823
- qt as createHex,
824
823
  jt as dec2Frac,
825
824
  mt as deepCopy,
826
825
  ot as deepMerge,
827
- S as dotNotation,
826
+ A as dotNotation,
828
827
  ut as download,
829
- Tt as downloadBlob,
828
+ Nt as downloadBlob,
829
+ xt as encodeQuery,
830
830
  Dt as errorFromCode,
831
- It as fileBrowser,
832
- Ct as findByProp,
831
+ Tt as fileBrowser,
832
+ Ot as findByProp,
833
833
  ct as flattenArr,
834
834
  st as flattenObj,
835
- xt as formData,
836
- Kt as formatDate,
837
- Mt as formatPhoneNumber,
835
+ Bt as formData,
836
+ qt as formatBytes,
837
+ Zt as formatDate,
838
+ Pt as formatPhoneNumber,
838
839
  Gt as fracToDec,
839
- Jt as gravatar,
840
- U as includes,
841
- Pt as insertAt,
842
- B as isEqual,
843
- Nt as makeArray,
840
+ Kt as gravatar,
841
+ G as includes,
842
+ Ft as insertAt,
843
+ b as isEqual,
844
+ Ct as makeArray,
844
845
  it as makeUnique,
845
- Yt as matchAll,
846
- ht as md5,
847
- At as mixin,
848
- vt as pad,
849
- Ft as randomString,
850
- Ht as randomStringBuilder,
846
+ Wt as matchAll,
847
+ ft as md5,
848
+ St as mixin,
849
+ Yt as pad,
850
+ zt as parseUrl,
851
+ Ut as randomHex,
852
+ Ht as randomString,
853
+ vt as randomStringBuilder,
851
854
  wt as sleep,
852
855
  Vt as sleepUntil,
853
- St as sortByProp,
854
- Zt as timeUntil,
855
- $t as uploadWithProgress,
856
- Bt as urlEncode,
857
- zt as urlParser,
858
- Wt as validateEmail
856
+ $t as sortByProp,
857
+ Xt as timeUntil,
858
+ It as timestampFilename,
859
+ Qt as tyoeKeys,
860
+ Mt as uploadWithProgress,
861
+ Jt as validateEmail
859
862
  };
860
863
  //# sourceMappingURL=index.mjs.map