@ztimson/utils 0.16.10 → 0.17.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
@@ -1,64 +1,60 @@
1
- var rt = Object.defineProperty;
2
- var nt = (r, t, e) => t in r ? rt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var c = (r, t, e) => (nt(r, typeof t != "symbol" ? t + "" : t, e), e);
4
- function ot(r, t = !1) {
5
- if (r == null)
6
- throw new Error("Cannot clean a NULL value");
1
+ var it = Object.defineProperty;
2
+ var ct = (r, t, e) => t in r ? it(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var c = (r, t, e) => ct(r, typeof t != "symbol" ? t + "" : t, e);
4
+ function ut(r, t = !1) {
5
+ if (r == null) throw new Error("Cannot clean a NULL value");
7
6
  return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, n]) => {
8
7
  (t && n === void 0 || !t && n == null) && delete r[e];
9
8
  }), r;
10
9
  }
11
- function xt(r) {
10
+ function Rt(r) {
12
11
  return structuredClone(r);
13
12
  }
14
- function st(r, ...t) {
13
+ function at(r, ...t) {
15
14
  return t.forEach((e) => {
16
15
  for (const n in e)
17
- e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), st(r[n], e[n])) : r[n] = e[n];
16
+ e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), at(r[n], e[n])) : r[n] = e[n];
18
17
  }), r;
19
18
  }
20
- function x(r, t, e) {
19
+ function b(r, t, e) {
21
20
  if (!(r == null || !t))
22
- return t.split(/[.[\]]/g).filter((n) => n.length).reduce((n, o, s, i) => {
23
- if ((o[0] == '"' || o[0] == "'") && (o = o.slice(1, -1)), !(n != null && n.hasOwnProperty(o))) {
24
- if (e == null)
25
- return;
26
- n[o] = {};
21
+ return t.split(/[.[\]]/g).filter((n) => n.length).reduce((n, s, o, i) => {
22
+ if ((s[0] == '"' || s[0] == "'") && (s = s.slice(1, -1)), !(n != null && n.hasOwnProperty(s))) {
23
+ if (e == null) return;
24
+ n[s] = {};
27
25
  }
28
- return e !== void 0 && s == i.length - 1 ? n[o] = e : n[o];
26
+ return e !== void 0 && o == i.length - 1 ? n[s] = e : n[s];
29
27
  }, r);
30
28
  }
31
- function Bt(r) {
29
+ function jt(r) {
32
30
  return Object.entries(r).map(
33
31
  ([t, e]) => encodeURIComponent(t) + "=" + encodeURIComponent(e)
34
32
  ).join("&");
35
33
  }
36
- function F(r, t, e = {}) {
34
+ function H(r, t, e = {}) {
37
35
  if (typeof r == "object" && !Array.isArray(r)) {
38
36
  for (const n of Object.keys(r)) {
39
- const o = t ? t + "." + n : n;
40
- typeof r[n] == "object" ? F(r[n], o, e) : e[o] = r[n];
37
+ const s = t ? t + "." + n : n;
38
+ typeof r[n] == "object" ? H(r[n], s, e) : e[s] = r[n];
41
39
  }
42
40
  return e;
43
41
  }
44
42
  }
45
- function St(r) {
43
+ function $t(r) {
46
44
  const t = new FormData();
47
45
  return Object.entries(r).forEach(([e, n]) => t.append(e, n)), t;
48
46
  }
49
- function G(r, t, e = !1) {
50
- if (r == null)
51
- return e;
52
- if (Array.isArray(t))
53
- return t.findIndex((o, s) => !G(r[s], t[s], e)) == -1;
47
+ function q(r, t, e = !1) {
48
+ if (r == null) return e;
49
+ if (Array.isArray(t)) return t.findIndex((s, o) => !q(r[o], t[o], e)) == -1;
54
50
  const n = typeof t;
55
- return n != typeof r ? !1 : n == "object" ? Object.keys(t).find((o) => !G(r[o], t[o], e)) == null : n == "function" ? r.toString() == t.toString() : r == t;
51
+ return n != typeof r ? !1 : n == "object" ? Object.keys(t).find((s) => !q(r[s], t[s], e)) == null : n == "function" ? r.toString() == t.toString() : r == t;
56
52
  }
57
- function b(r, t) {
53
+ function A(r, t) {
58
54
  const e = typeof r, n = typeof t;
59
- return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? !1 : Object.keys(r).every((s) => b(r[s], t[s]));
55
+ return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? !1 : Object.keys(r).every((o) => A(r[o], t[o]));
60
56
  }
61
- function At(r, t) {
57
+ function Ct(r, t) {
62
58
  t.forEach((e) => {
63
59
  Object.getOwnPropertyNames(e.prototype).forEach((n) => {
64
60
  Object.defineProperty(
@@ -69,60 +65,59 @@ function At(r, t) {
69
65
  });
70
66
  });
71
67
  }
72
- function T(r) {
68
+ function M(r) {
73
69
  try {
74
70
  return JSON.parse(r);
75
71
  } catch {
76
72
  return r;
77
73
  }
78
74
  }
79
- function bt(r, t) {
75
+ function Lt(r, t) {
80
76
  let e = [];
81
- return JSON.stringify(r, (n, o) => {
82
- if (typeof o == "object" && o !== null) {
83
- if (e.includes(o))
84
- return;
85
- e.push(o);
77
+ return JSON.stringify(r, (n, s) => {
78
+ if (typeof s == "object" && s !== null) {
79
+ if (e.includes(s)) return;
80
+ e.push(s);
86
81
  }
87
- return o;
82
+ return s;
88
83
  }, t);
89
84
  }
90
- function Rt(r, t) {
85
+ function Nt(r, t) {
91
86
  return r.indexOf(t) === -1 && r.push(t), r;
92
87
  }
93
- function Ot(r, t) {
94
- return ct([
95
- ...r.filter((e) => !t.includes((n) => b(e, n))),
96
- ...t.filter((e) => !r.includes((n) => b(e, n)))
88
+ function It(r, t) {
89
+ return ht([
90
+ ...r.filter((e) => !t.includes((n) => A(e, n))),
91
+ ...t.filter((e) => !r.includes((n) => A(e, n)))
97
92
  ]);
98
93
  }
99
- function Ct(r) {
94
+ function Mt(r) {
100
95
  return function(t, e) {
101
- const n = x(t, r), o = x(e, r);
102
- return typeof n != "string" || typeof o != "string" ? 1 : n.toLowerCase().localeCompare(o.toLowerCase());
96
+ const n = b(t, r), s = b(e, r);
97
+ return typeof n != "string" || typeof s != "string" ? 1 : n.toLowerCase().localeCompare(s.toLowerCase());
103
98
  };
104
99
  }
105
- function $t(r, t) {
106
- return (e) => b(x(e, r), t);
100
+ function Tt(r, t) {
101
+ return (e) => A(b(e, r), t);
107
102
  }
108
- function it(r, t = []) {
109
- return r.forEach((e) => Array.isArray(e) ? it(e, t) : t.push(e)), t;
103
+ function lt(r, t = []) {
104
+ return r.forEach((e) => Array.isArray(e) ? lt(e, t) : t.push(e)), t;
110
105
  }
111
- function Lt(r, t = !1) {
106
+ function kt(r, t = !1) {
112
107
  return function(e, n) {
113
- const o = x(e, r), s = x(n, r);
114
- return typeof o == "number" && typeof s == "number" ? (t ? -1 : 1) * (o - s) : o > s ? t ? -1 : 1 : o < s ? t ? 1 : -1 : 0;
108
+ const s = b(e, r), o = b(n, r);
109
+ return typeof s == "number" && typeof o == "number" ? (t ? -1 : 1) * (s - o) : s > o ? t ? -1 : 1 : s < o ? t ? 1 : -1 : 0;
115
110
  };
116
111
  }
117
- function ct(r) {
112
+ function ht(r) {
118
113
  for (let t = r.length - 1; t >= 0; t--)
119
- r.slice(0, t).find((e) => b(e, r[t])) && r.splice(t, 1);
114
+ r.slice(0, t).find((e) => A(e, r[t])) && r.splice(t, 1);
120
115
  return r;
121
116
  }
122
- function ut(r) {
117
+ function ft(r) {
123
118
  return Array.isArray(r) ? r : [r];
124
119
  }
125
- class A extends Array {
120
+ class B extends Array {
126
121
  /** Number of elements in set */
127
122
  get size() {
128
123
  return this.length;
@@ -155,7 +150,7 @@ class A extends Array {
155
150
  * @return {ASet<T>} Different elements
156
151
  */
157
152
  difference(t) {
158
- return new A(this.filter((e) => !t.has(e)));
153
+ return new B(this.filter((e) => !t.has(e)));
159
154
  }
160
155
  /**
161
156
  * Check if set includes element
@@ -171,7 +166,7 @@ class A extends Array {
171
166
  * @return {boolean} Set of common elements
172
167
  */
173
168
  intersection(t) {
174
- return new A(this.filter((e) => t.has(e)));
169
+ return new B(this.filter((e) => t.has(e)));
175
170
  }
176
171
  /**
177
172
  * Check if this set has no elements in common with the comparison set
@@ -203,7 +198,7 @@ class A extends Array {
203
198
  * @return {ASet<T>} New set of unique elements
204
199
  */
205
200
  symmetricDifference(t) {
206
- return new A([...this.difference(t), ...t.difference(this)]);
201
+ return new B([...this.difference(t), ...t.difference(this)]);
207
202
  }
208
203
  /**
209
204
  * Create joined list of elements included in this & the comparison set
@@ -211,10 +206,10 @@ class A extends Array {
211
206
  * @return {ASet<T>} New set of both previous sets combined
212
207
  */
213
208
  union(t) {
214
- return new A([...this, ...t]);
209
+ return new B([...this, ...t]);
215
210
  }
216
211
  }
217
- class Nt {
212
+ class Dt {
218
213
  /**
219
214
  * Create new cache
220
215
  *
@@ -232,13 +227,12 @@ class Nt {
232
227
  */
233
228
  c(this, "values", this.all());
234
229
  return this.key = t, this.ttl = e, new Proxy(this, {
235
- get: (n, o) => o in n ? n[o] : n.store[o],
236
- set: (n, o, s) => (o in n ? n[o] = s : n.store[o] = s, !0)
230
+ get: (n, s) => s in n ? n[s] : n.store[s],
231
+ set: (n, s, o) => (s in n ? n[s] = o : n.store[s] = o, !0)
237
232
  });
238
233
  }
239
234
  getKey(t) {
240
- if (!this.key)
241
- throw new Error("No key defined");
235
+ if (!this.key) throw new Error("No key defined");
242
236
  return t[this.key];
243
237
  }
244
238
  /**
@@ -323,25 +317,25 @@ class Nt {
323
317
  }, n), this;
324
318
  }
325
319
  }
326
- function Tt(r, t = !0) {
327
- const e = r.reduce((n, o) => (Object.keys(t ? F(o) : o).forEach((s) => {
328
- n.includes(s) || n.push(s);
320
+ function Pt(r, t = !0) {
321
+ const e = r.reduce((n, s) => (Object.keys(t ? H(s) : s).forEach((o) => {
322
+ n.includes(o) || n.push(o);
329
323
  }), n), []);
330
324
  return [
331
325
  e.join(","),
332
- ...r.map((n) => e.map((o) => {
333
- const s = x(n, o), i = typeof s;
334
- return i == "string" && s.includes(",") ? `"${s}"` : i == "object" ? `"${JSON.stringify(s)}"` : s;
326
+ ...r.map((n) => e.map((s) => {
327
+ const o = b(n, s), i = typeof o;
328
+ return i == "string" && o.includes(",") ? `"${o}"` : i == "object" ? `"${JSON.stringify(o)}"` : o;
335
329
  }).join(","))
336
330
  ].join(`
337
331
  `);
338
332
  }
339
333
  class E extends Promise {
340
334
  constructor(e) {
341
- super((n, o) => e(
342
- (s) => n(s),
343
- (s) => o(s),
344
- (s) => this.progress = s
335
+ super((n, s) => e(
336
+ (o) => n(o),
337
+ (o) => s(o),
338
+ (o) => this.progress = o
345
339
  ));
346
340
  c(this, "listeners", []);
347
341
  c(this, "_progress", 0);
@@ -353,18 +347,18 @@ class E extends Promise {
353
347
  e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
354
348
  }
355
349
  static from(e) {
356
- return e instanceof E ? e : new E((n, o) => e.then((...s) => n(...s)).catch((...s) => o(...s)));
350
+ return e instanceof E ? e : new E((n, s) => e.then((...o) => n(...o)).catch((...o) => s(...o)));
357
351
  }
358
352
  from(e) {
359
353
  const n = E.from(e);
360
- return this.onProgress((o) => n.progress = o), n;
354
+ return this.onProgress((s) => n.progress = s), n;
361
355
  }
362
356
  onProgress(e) {
363
357
  return this.listeners.push(e), this;
364
358
  }
365
359
  then(e, n) {
366
- const o = super.then(e, n);
367
- return this.from(o);
360
+ const s = super.then(e, n);
361
+ return this.from(s);
368
362
  }
369
363
  catch(e) {
370
364
  return this.from(super.catch(e));
@@ -373,16 +367,16 @@ class E extends Promise {
373
367
  return this.from(super.finally(e));
374
368
  }
375
369
  }
376
- function jt(r, t) {
377
- r instanceof Blob || (r = new Blob(ut(r)));
370
+ function Gt(r, t) {
371
+ r instanceof Blob || (r = new Blob(ft(r)));
378
372
  const e = URL.createObjectURL(r);
379
- at(e, t), URL.revokeObjectURL(e);
373
+ dt(e, t), URL.revokeObjectURL(e);
380
374
  }
381
- function at(r, t) {
375
+ function dt(r, t) {
382
376
  const e = document.createElement("a");
383
377
  e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
384
378
  }
385
- function It(r = {}) {
379
+ function Ut(r = {}) {
386
380
  return new Promise((t) => {
387
381
  const e = document.createElement("input");
388
382
  e.type = "file", e.accept = r.accept || "*", e.style.display = "none", e.multiple = !!r.multiple, e.onblur = e.onchange = async () => {
@@ -390,18 +384,18 @@ function It(r = {}) {
390
384
  }, document.body.appendChild(e), e.click();
391
385
  });
392
386
  }
393
- function Dt(r, t = /* @__PURE__ */ new Date()) {
387
+ function qt(r, t = /* @__PURE__ */ new Date()) {
394
388
  (typeof t == "number" || typeof t == "string") && (t = new Date(t));
395
389
  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")}`;
396
390
  return r ? r.replace("{{TIMESTAMP}}", e) : e;
397
391
  }
398
- function Mt(r) {
392
+ function Ft(r) {
399
393
  return new E((t, e, n) => {
400
- const o = new XMLHttpRequest(), s = new FormData();
401
- r.files.forEach((i) => s.append("file", i)), o.withCredentials = !!r.withCredentials, o.upload.addEventListener("progress", (i) => i.lengthComputable ? n(i.loaded / i.total) : null), o.addEventListener("loadend", () => t(T(o.responseText))), o.addEventListener("error", () => e(T(o.responseText))), o.addEventListener("timeout", () => e({ error: "Request timed out" })), o.open("POST", r.url), Object.entries(r.headers || {}).forEach(([i, y]) => o.setRequestHeader(i, y)), o.send(s);
394
+ const s = new XMLHttpRequest(), o = new FormData();
395
+ r.files.forEach((i) => o.append("file", i)), s.withCredentials = !!r.withCredentials, s.upload.addEventListener("progress", (i) => i.lengthComputable ? n(i.loaded / i.total) : null), s.addEventListener("loadend", () => t(M(s.responseText))), s.addEventListener("error", () => e(M(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", r.url), Object.entries(r.headers || {}).forEach(([i, a]) => s.setRequestHeader(i, a)), s.send(o);
402
396
  });
403
397
  }
404
- class v {
398
+ class _ {
405
399
  constructor() {
406
400
  c(this, "listeners", {});
407
401
  }
@@ -410,17 +404,17 @@ class v {
410
404
  }
411
405
  static off(t, e) {
412
406
  const n = t.toString();
413
- this.listeners[n] = (this.listeners[n] || []).filter((o) => o === e);
407
+ this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
414
408
  }
415
409
  static on(t, e) {
416
- var o;
410
+ var s;
417
411
  const n = t.toString();
418
- return this.listeners[n] || (this.listeners[n] = []), (o = this.listeners[n]) == null || o.push(e), () => this.off(t, e);
412
+ return this.listeners[n] || (this.listeners[n] = []), (s = this.listeners[n]) == null || s.push(e), () => this.off(t, e);
419
413
  }
420
414
  static once(t, e) {
421
415
  return new Promise((n) => {
422
- const o = this.on(t, (...s) => {
423
- n(s.length == 1 ? s[0] : s), e && e(...s), o();
416
+ const s = this.on(t, (...o) => {
417
+ n(o.length == 1 ? o[0] : o), e && e(...o), s();
424
418
  });
425
419
  });
426
420
  }
@@ -436,13 +430,13 @@ class v {
436
430
  }
437
431
  once(t, e) {
438
432
  return new Promise((n) => {
439
- const o = this.on(t, (...s) => {
440
- n(s.length == 1 ? s[0] : s), e && e(...s), o();
433
+ const s = this.on(t, (...o) => {
434
+ n(o.length == 1 ? o[0] : o), e && e(...o), s();
441
435
  });
442
436
  });
443
437
  }
444
438
  }
445
- c(v, "listeners", {});
439
+ c(_, "listeners", {});
446
440
  class p extends Error {
447
441
  constructor(e, n) {
448
442
  super(e);
@@ -456,8 +450,8 @@ class p extends Error {
456
450
  this._code = e;
457
451
  }
458
452
  static from(e) {
459
- const n = Number(e.statusCode) ?? Number(e.code), o = new this(e.message || e.toString());
460
- return Object.assign(o, {
453
+ const n = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
454
+ return Object.assign(s, {
461
455
  stack: e.stack,
462
456
  ...e,
463
457
  code: n ?? void 0
@@ -471,7 +465,7 @@ class p extends Error {
471
465
  }
472
466
  }
473
467
  c(p, "code", 500);
474
- class Y extends p {
468
+ class W extends p {
475
469
  constructor(t = "Bad Request") {
476
470
  super(t);
477
471
  }
@@ -479,8 +473,8 @@ class Y extends p {
479
473
  return t.constructor.code == this.code;
480
474
  }
481
475
  }
482
- c(Y, "code", 400);
483
- class H extends p {
476
+ c(W, "code", 400);
477
+ class J extends p {
484
478
  constructor(t = "Unauthorized") {
485
479
  super(t);
486
480
  }
@@ -488,8 +482,8 @@ class H extends p {
488
482
  return t.constructor.code == this.code;
489
483
  }
490
484
  }
491
- c(H, "code", 401);
492
- class W extends p {
485
+ c(J, "code", 401);
486
+ class z extends p {
493
487
  constructor(t = "Payment Required") {
494
488
  super(t);
495
489
  }
@@ -497,8 +491,8 @@ class W extends p {
497
491
  return t.constructor.code == this.code;
498
492
  }
499
493
  }
500
- c(W, "code", 402);
501
- class z extends p {
494
+ c(z, "code", 402);
495
+ class K extends p {
502
496
  constructor(t = "Forbidden") {
503
497
  super(t);
504
498
  }
@@ -506,8 +500,8 @@ class z extends p {
506
500
  return t.constructor.code == this.code;
507
501
  }
508
502
  }
509
- c(z, "code", 403);
510
- class K extends p {
503
+ c(K, "code", 403);
504
+ class Z extends p {
511
505
  constructor(t = "Not Found") {
512
506
  super(t);
513
507
  }
@@ -515,8 +509,8 @@ class K extends p {
515
509
  return t.constructor.code == this.code;
516
510
  }
517
511
  }
518
- c(K, "code", 404);
519
- class J extends p {
512
+ c(Z, "code", 404);
513
+ class V extends p {
520
514
  constructor(t = "Method Not Allowed") {
521
515
  super(t);
522
516
  }
@@ -524,8 +518,8 @@ class J extends p {
524
518
  return t.constructor.code == this.code;
525
519
  }
526
520
  }
527
- c(J, "code", 405);
528
- class Z extends p {
521
+ c(V, "code", 405);
522
+ class X extends p {
529
523
  constructor(t = "Not Acceptable") {
530
524
  super(t);
531
525
  }
@@ -533,8 +527,8 @@ class Z extends p {
533
527
  return t.constructor.code == this.code;
534
528
  }
535
529
  }
536
- c(Z, "code", 406);
537
- class V extends p {
530
+ c(X, "code", 406);
531
+ class Q extends p {
538
532
  constructor(t = "Internal Server Error") {
539
533
  super(t);
540
534
  }
@@ -542,8 +536,8 @@ class V extends p {
542
536
  return t.constructor.code == this.code;
543
537
  }
544
538
  }
545
- c(V, "code", 500);
546
- class X extends p {
539
+ c(Q, "code", 500);
540
+ class tt extends p {
547
541
  constructor(t = "Not Implemented") {
548
542
  super(t);
549
543
  }
@@ -551,8 +545,8 @@ class X extends p {
551
545
  return t.constructor.code == this.code;
552
546
  }
553
547
  }
554
- c(X, "code", 501);
555
- class Q extends p {
548
+ c(tt, "code", 501);
549
+ class et extends p {
556
550
  constructor(t = "Bad Gateway") {
557
551
  super(t);
558
552
  }
@@ -560,8 +554,8 @@ class Q extends p {
560
554
  return t.constructor.code == this.code;
561
555
  }
562
556
  }
563
- c(Q, "code", 502);
564
- class _ extends p {
557
+ c(et, "code", 502);
558
+ class rt extends p {
565
559
  constructor(t = "Service Unavailable") {
566
560
  super(t);
567
561
  }
@@ -569,8 +563,8 @@ class _ extends p {
569
563
  return t.constructor.code == this.code;
570
564
  }
571
565
  }
572
- c(_, "code", 503);
573
- class tt extends p {
566
+ c(rt, "code", 503);
567
+ class nt extends p {
574
568
  constructor(t = "Gateway Timeout") {
575
569
  super(t);
576
570
  }
@@ -578,35 +572,34 @@ class tt extends p {
578
572
  return t.constructor.code == this.code;
579
573
  }
580
574
  }
581
- c(tt, "code", 504);
582
- function kt(r, t) {
583
- if (r >= 200 && r < 300)
584
- return null;
575
+ c(nt, "code", 504);
576
+ function Yt(r, t) {
577
+ if (r >= 200 && r < 300) return null;
585
578
  switch (r) {
586
579
  case 400:
587
- return new Y(t);
580
+ return new W(t);
588
581
  case 401:
589
- return new H(t);
582
+ return new J(t);
590
583
  case 402:
591
- return new W(t);
592
- case 403:
593
584
  return new z(t);
594
- case 404:
585
+ case 403:
595
586
  return new K(t);
587
+ case 404:
588
+ return new Z(t);
596
589
  case 405:
597
- return new J(t);
590
+ return new V(t);
598
591
  case 406:
599
- return new Z(t);
592
+ return new X(t);
600
593
  case 500:
601
- return new V(t);
594
+ return new Q(t);
602
595
  case 501:
603
- return new X(t);
596
+ return new tt(t);
604
597
  case 502:
605
- return new Q(t);
598
+ return new et(t);
606
599
  case 503:
607
- return new _(t);
600
+ return new rt(t);
608
601
  case 504:
609
- return new tt(t);
602
+ return new nt(t);
610
603
  default:
611
604
  return new p(t, r);
612
605
  }
@@ -631,61 +624,59 @@ const w = class w {
631
624
  };
632
625
  }
633
626
  request(t = {}) {
634
- var o;
635
- if (!this.url && !t.url)
636
- throw new Error("URL needs to be set");
637
- let e = ((o = t.url) != null && o.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
638
- if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (s, i) => `#${t.fragment}${i}`) : e += "#" + t.fragment), t.query) {
639
- const s = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((i) => ({ key: i, value: t.query[i] }));
640
- e += (e.includes("?") ? "&" : "?") + s.map((i) => `${i.key}=${i.value}`).join("&");
627
+ var s;
628
+ if (!this.url && !t.url) throw new Error("URL needs to be set");
629
+ let e = ((s = t.url) != null && s.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
630
+ if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (o, i) => `#${t.fragment}${i}`) : e += "#" + t.fragment), t.query) {
631
+ const o = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((i) => ({ key: i, value: t.query[i] }));
632
+ e += (e.includes("?") ? "&" : "?") + o.map((i) => `${i.key}=${i.value}`).join("&");
641
633
  }
642
- const n = ot({
634
+ const n = ut({
643
635
  "Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
644
636
  ...w.headers,
645
637
  ...this.headers,
646
638
  ...t.headers
647
639
  });
648
- return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new E((s, i, y) => {
640
+ return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new E((o, i, a) => {
649
641
  fetch(e, {
650
642
  headers: n,
651
643
  method: t.method || (t.body ? "POST" : "GET"),
652
644
  body: t.body
653
645
  }).then(async (u) => {
654
- var k, U;
655
- for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
656
- await new Promise((O) => a(u, () => O()));
657
- const R = u.headers.get("Content-Length"), L = R ? parseInt(R, 10) : 0;
658
- let M = 0;
659
- const N = (k = u.body) == null ? void 0 : k.getReader(), et = new ReadableStream({
660
- start(a) {
661
- function O() {
662
- N == null || N.read().then((B) => {
663
- if (B.done)
664
- return a.close();
665
- M += B.value.byteLength, y(M / L), a.enqueue(B.value), O();
666
- }).catch((B) => a.error(B));
646
+ var G, U;
647
+ for (let l of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
648
+ await new Promise((R) => l(u, () => R()));
649
+ const v = u.headers.get("Content-Length"), N = v ? parseInt(v, 10) : 0;
650
+ let P = 0;
651
+ const I = (G = u.body) == null ? void 0 : G.getReader(), ot = new ReadableStream({
652
+ start(l) {
653
+ function R() {
654
+ I == null || I.read().then((O) => {
655
+ if (O.done) return l.close();
656
+ P += O.value.byteLength, a(P / N), l.enqueue(O.value), R();
657
+ }).catch((O) => l.error(O));
667
658
  }
668
- O();
659
+ R();
669
660
  }
670
661
  });
671
- if (u.data = new Response(et), t.decode == null || t.decode) {
672
- const a = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
673
- 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());
662
+ if (u.data = new Response(ot), t.decode == null || t.decode) {
663
+ const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
664
+ l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
674
665
  }
675
- u.ok ? s(u) : i(u);
666
+ u.ok ? o(u) : i(u);
676
667
  });
677
668
  });
678
669
  }
679
670
  };
680
671
  c(w, "interceptors", {}), c(w, "headers", {});
681
- let P = w;
682
- function Ut(r) {
672
+ let F = w;
673
+ function Ht(r) {
683
674
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
684
- return T(decodeURIComponent(atob(t).split("").map(function(e) {
675
+ return M(decodeURIComponent(atob(t).split("").map(function(e) {
685
676
  return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
686
677
  }).join("")));
687
678
  }
688
- const S = {
679
+ const x = {
689
680
  CLEAR: "\x1B[0m",
690
681
  BRIGHT: "\x1B[1m",
691
682
  DIM: "\x1B[2m",
@@ -693,7 +684,7 @@ const S = {
693
684
  BLINK: "\x1B[5m",
694
685
  REVERSE: "\x1B[7m",
695
686
  HIDDEN: "\x1B[8m"
696
- }, C = {
687
+ }, j = {
697
688
  BLACK: "\x1B[30m",
698
689
  RED: "\x1B[31m",
699
690
  GREEN: "\x1B[32m",
@@ -710,7 +701,7 @@ const S = {
710
701
  LIGHT_MAGENTA: "\x1B[95m",
711
702
  LIGHT_CYAN: "\x1B[96m",
712
703
  WHITE: "\x1B[97m"
713
- }, Gt = {
704
+ }, _t = {
714
705
  BLACK: "\x1B[40m",
715
706
  RED: "\x1B[41m",
716
707
  GREEN: "\x1B[42m",
@@ -721,109 +712,100 @@ const S = {
721
712
  WHITE: "\x1B[47m",
722
713
  GREY: "\x1B[100m"
723
714
  };
724
- var lt = /* @__PURE__ */ ((r) => (r[r.ERROR = 0] = "ERROR", r[r.WARN = 1] = "WARN", r[r.INFO = 2] = "INFO", r[r.LOG = 3] = "LOG", r[r.DEBUG = 4] = "DEBUG", r))(lt || {});
725
- const g = class g extends v {
715
+ var yt = /* @__PURE__ */ ((r) => (r[r.ERROR = 0] = "ERROR", r[r.WARN = 1] = "WARN", r[r.INFO = 2] = "INFO", r[r.LOG = 3] = "LOG", r[r.DEBUG = 4] = "DEBUG", r))(yt || {});
716
+ const g = class g extends _ {
726
717
  constructor(t) {
727
718
  super(), this.namespace = t;
728
719
  }
729
- pad(t, e, n, o = !1) {
730
- const s = t.toString(), i = e - s.length;
731
- if (i <= 0)
732
- return s;
733
- const y = Array(~~(i / n.length)).fill(n).join("");
734
- return o ? s + y : y + s;
720
+ pad(t, e, n, s = !1) {
721
+ const o = t.toString(), i = e - o.length;
722
+ if (i <= 0) return o;
723
+ const a = Array(~~(i / n.length)).fill(n).join("");
724
+ return s ? o + a : a + o;
735
725
  }
736
726
  format(...t) {
737
727
  const e = /* @__PURE__ */ new Date();
738
728
  return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${this.pad(e.getHours().toString(), 2, "0")}:${this.pad(e.getMinutes().toString(), 2, "0")}:${this.pad(e.getSeconds().toString(), 2, "0")}.${this.pad(e.getMilliseconds().toString(), 3, "0", !0)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.join(" ")}`;
739
729
  }
740
730
  debug(...t) {
741
- if (g.LOG_LEVEL < 4)
742
- return;
731
+ if (g.LOG_LEVEL < 4) return;
743
732
  const e = this.format(...t);
744
- g.emit(4, e), console.debug(C.LIGHT_GREY + e + S.CLEAR);
733
+ g.emit(4, e), console.debug(j.LIGHT_GREY + e + x.CLEAR);
745
734
  }
746
735
  log(...t) {
747
- if (g.LOG_LEVEL < 3)
748
- return;
736
+ if (g.LOG_LEVEL < 3) return;
749
737
  const e = this.format(...t);
750
- g.emit(3, e), console.log(S.CLEAR + e);
738
+ g.emit(3, e), console.log(x.CLEAR + e);
751
739
  }
752
740
  info(...t) {
753
- if (g.LOG_LEVEL < 2)
754
- return;
741
+ if (g.LOG_LEVEL < 2) return;
755
742
  const e = this.format(...t);
756
- g.emit(2, e), console.info(C.BLUE + e + S.CLEAR);
743
+ g.emit(2, e), console.info(j.BLUE + e + x.CLEAR);
757
744
  }
758
745
  warn(...t) {
759
- if (g.LOG_LEVEL < 1)
760
- return;
746
+ if (g.LOG_LEVEL < 1) return;
761
747
  const e = this.format(...t);
762
- g.emit(1, e), console.warn(C.YELLOW + e + S.CLEAR);
748
+ g.emit(1, e), console.warn(j.YELLOW + e + x.CLEAR);
763
749
  }
764
750
  error(...t) {
765
- if (g.LOG_LEVEL < 0)
766
- return;
751
+ if (g.LOG_LEVEL < 0) return;
767
752
  const e = this.format(...t);
768
- g.emit(0, e), console.error(C.RED + e + S.CLEAR);
753
+ g.emit(0, e), console.error(j.RED + e + x.CLEAR);
769
754
  }
770
755
  };
771
756
  c(g, "LOG_LEVEL", 4);
772
- let q = g;
773
- function Pt(r) {
774
- const t = (y, u) => u < 1e-7 ? y : t(u, ~~(y % u)), e = r.toString().length - 2;
775
- let n = Math.pow(10, e), o = r * n;
776
- const s = t(o, n);
777
- o = ~~(o / s), n = ~~(n / s);
778
- const i = ~~(o / n);
779
- return o -= i * n, `${i ? i + " " : ""}${~~o}/${~~n}`;
780
- }
781
- function qt(r) {
757
+ let Y = g;
758
+ function Wt(r) {
759
+ const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = r.toString().length - 2;
760
+ let n = Math.pow(10, e), s = r * n;
761
+ const o = t(s, n);
762
+ s = ~~(s / o), n = ~~(n / o);
763
+ const i = ~~(s / n);
764
+ return s -= i * n, `${i ? i + " " : ""}${~~s}/${~~n}`;
765
+ }
766
+ function Jt(r) {
782
767
  let t = r.split(" ");
783
768
  const e = t.length == 2 ? Number(t[0]) : 0;
784
769
  return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
785
770
  }
786
- const j = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = j + I + D;
787
- function Ft(r, t = 2) {
788
- if (r === 0)
789
- return "0 Bytes";
790
- const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = Math.floor(Math.log(r) / Math.log(e));
791
- return parseFloat((r / Math.pow(e, o)).toFixed(t)) + " " + n[o];
771
+ const T = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", k = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", pt = T + k + D;
772
+ function zt(r, t = 2) {
773
+ if (r === 0) return "0 Bytes";
774
+ const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(r) / Math.log(e));
775
+ return parseFloat((r / Math.pow(e, s)).toFixed(t)) + " " + n[s];
792
776
  }
793
- function vt(r) {
777
+ function Kt(r) {
794
778
  const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
795
- if (!t)
796
- throw new Error(`Number cannot be parsed: ${r}`);
779
+ if (!t) throw new Error(`Number cannot be parsed: ${r}`);
797
780
  return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
798
781
  }
799
- function Yt(r, t, e) {
782
+ function Zt(r, t, e) {
800
783
  return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
801
784
  }
802
- function Ht(r, t, e = " ", n = !0) {
785
+ function Vt(r, t, e = " ", n = !0) {
803
786
  return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
804
787
  }
805
- function Wt(r) {
788
+ function Xt(r) {
806
789
  return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
807
790
  }
808
- function zt(r, t = ht) {
791
+ function Qt(r, t = pt) {
809
792
  return Array(r).fill(null).map(() => {
810
793
  const e = ~~(Math.random() * t.length);
811
794
  return t[e];
812
795
  }).join("");
813
796
  }
814
- function Kt(r, t = !1, e = !1, n = !1) {
815
- if (!t && !e && !n)
816
- throw new Error("Must enable at least one: letters, numbers, symbols");
797
+ function te(r, t = !1, e = !1, n = !1) {
798
+ if (!t && !e && !n) throw new Error("Must enable at least one: letters, numbers, symbols");
817
799
  return Array(r).fill(null).map(() => {
818
- let o;
800
+ let s;
819
801
  do {
820
- const s = ~~(Math.random() * 3);
821
- t && s == 0 ? o = j[~~(Math.random() * j.length)] : e && s == 1 ? o = I[~~(Math.random() * I.length)] : n && s == 2 && (o = D[~~(Math.random() * D.length)]);
822
- } while (!o);
823
- return o;
802
+ const o = ~~(Math.random() * 3);
803
+ t && o == 0 ? s = T[~~(Math.random() * T.length)] : e && o == 1 ? s = k[~~(Math.random() * k.length)] : n && o == 2 && (s = D[~~(Math.random() * D.length)]);
804
+ } while (!s);
805
+ return s;
824
806
  }).join("");
825
807
  }
826
- function Jt(r, t) {
808
+ function ee(r, t) {
827
809
  if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
828
810
  throw new TypeError("Regular expression must be global.");
829
811
  let e = [], n;
@@ -831,165 +813,296 @@ function Jt(r, t) {
831
813
  e.push(n);
832
814
  return e;
833
815
  }
834
- function Zt(r) {
816
+ function re(r) {
835
817
  const t = new RegExp(
836
818
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
837
819
  "gm"
838
820
  ).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
839
821
  if (e.port != null && (e.port = Number(e.port)), n.length > 2 && (e.domain = n.splice(-2, 2).join("."), e.subdomain = n.join(".")), e.query) {
840
- const o = e.query.split("&"), s = {};
841
- o.forEach((i) => {
842
- const [y, u] = i.split("=");
843
- s[y] = u;
844
- }), e.query = s;
822
+ const s = e.query.split("&"), o = {};
823
+ s.forEach((i) => {
824
+ const [a, u] = i.split("=");
825
+ o[a] = u;
826
+ }), e.query = o;
845
827
  }
846
828
  return e;
847
829
  }
848
- function ft(r) {
849
- var t = dt(yt(gt(pt(r), 8 * r.length)));
830
+ function gt(r) {
831
+ var t = wt(Et(bt(mt(r), 8 * r.length)));
850
832
  return t.toLowerCase();
851
833
  }
852
- function dt(r) {
853
- for (var t, e = "0123456789ABCDEF", n = "", o = 0; o < r.length; o++)
854
- t = r.charCodeAt(o), n += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
834
+ function wt(r) {
835
+ for (var t, e = "0123456789ABCDEF", n = "", s = 0; s < r.length; s++) t = r.charCodeAt(s), n += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
855
836
  return n;
856
837
  }
857
- function pt(r) {
858
- for (var t = Array(r.length >> 2), e = 0; e < t.length; e++)
859
- t[e] = 0;
860
- for (e = 0; e < 8 * r.length; e += 8)
861
- t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
838
+ function mt(r) {
839
+ for (var t = Array(r.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
840
+ for (e = 0; e < 8 * r.length; e += 8) t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
862
841
  return t;
863
842
  }
864
- function yt(r) {
865
- for (var t = "", e = 0; e < 32 * r.length; e += 8)
866
- t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
843
+ function Et(r) {
844
+ for (var t = "", e = 0; e < 32 * r.length; e += 8) t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
867
845
  return t;
868
846
  }
869
- function gt(r, t) {
847
+ function bt(r, t) {
870
848
  r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
871
- for (var e = 1732584193, n = -271733879, o = -1732584194, s = 271733878, i = 0; i < r.length; i += 16) {
872
- var y = e, u = n, R = o, L = s;
873
- n = d(n = d(n = d(n = d(n = f(n = f(n = f(n = f(n = h(n = h(n = h(n = h(n = l(n = l(n = l(n = l(n, o = l(o, s = l(s, e = l(e, n, o, s, r[i + 0], 7, -680876936), n, o, r[i + 1], 12, -389564586), e, n, r[i + 2], 17, 606105819), s, e, r[i + 3], 22, -1044525330), o = l(o, s = l(s, e = l(e, n, o, s, r[i + 4], 7, -176418897), n, o, r[i + 5], 12, 1200080426), e, n, r[i + 6], 17, -1473231341), s, e, r[i + 7], 22, -45705983), o = l(o, s = l(s, e = l(e, n, o, s, r[i + 8], 7, 1770035416), n, o, r[i + 9], 12, -1958414417), e, n, r[i + 10], 17, -42063), s, e, r[i + 11], 22, -1990404162), o = l(o, s = l(s, e = l(e, n, o, s, r[i + 12], 7, 1804603682), n, o, r[i + 13], 12, -40341101), e, n, r[i + 14], 17, -1502002290), s, e, r[i + 15], 22, 1236535329), o = h(o, s = h(s, e = h(e, n, o, s, r[i + 1], 5, -165796510), n, o, r[i + 6], 9, -1069501632), e, n, r[i + 11], 14, 643717713), s, e, r[i + 0], 20, -373897302), o = h(o, s = h(s, e = h(e, n, o, s, r[i + 5], 5, -701558691), n, o, r[i + 10], 9, 38016083), e, n, r[i + 15], 14, -660478335), s, e, r[i + 4], 20, -405537848), o = h(o, s = h(s, e = h(e, n, o, s, r[i + 9], 5, 568446438), n, o, r[i + 14], 9, -1019803690), e, n, r[i + 3], 14, -187363961), s, e, r[i + 8], 20, 1163531501), o = h(o, s = h(s, e = h(e, n, o, s, r[i + 13], 5, -1444681467), n, o, r[i + 2], 9, -51403784), e, n, r[i + 7], 14, 1735328473), s, e, r[i + 12], 20, -1926607734), o = f(o, s = f(s, e = f(e, n, o, s, r[i + 5], 4, -378558), n, o, r[i + 8], 11, -2022574463), e, n, r[i + 11], 16, 1839030562), s, e, r[i + 14], 23, -35309556), o = f(o, s = f(s, e = f(e, n, o, s, r[i + 1], 4, -1530992060), n, o, r[i + 4], 11, 1272893353), e, n, r[i + 7], 16, -155497632), s, e, r[i + 10], 23, -1094730640), o = f(o, s = f(s, e = f(e, n, o, s, r[i + 13], 4, 681279174), n, o, r[i + 0], 11, -358537222), e, n, r[i + 3], 16, -722521979), s, e, r[i + 6], 23, 76029189), o = f(o, s = f(s, e = f(e, n, o, s, r[i + 9], 4, -640364487), n, o, r[i + 12], 11, -421815835), e, n, r[i + 15], 16, 530742520), s, e, r[i + 2], 23, -995338651), o = d(o, s = d(s, e = d(e, n, o, s, r[i + 0], 6, -198630844), n, o, r[i + 7], 10, 1126891415), e, n, r[i + 14], 15, -1416354905), s, e, r[i + 5], 21, -57434055), o = d(o, s = d(s, e = d(e, n, o, s, r[i + 12], 6, 1700485571), n, o, r[i + 3], 10, -1894986606), e, n, r[i + 10], 15, -1051523), s, e, r[i + 1], 21, -2054922799), o = d(o, s = d(s, e = d(e, n, o, s, r[i + 8], 6, 1873313359), n, o, r[i + 15], 10, -30611744), e, n, r[i + 6], 15, -1560198380), s, e, r[i + 13], 21, 1309151649), o = d(o, s = d(s, e = d(e, n, o, s, r[i + 4], 6, -145523070), n, o, r[i + 11], 10, -1120210379), e, n, r[i + 2], 15, 718787259), s, e, r[i + 9], 21, -343485551), e = m(e, y), n = m(n, u), o = m(o, R), s = m(s, L);
849
+ for (var e = 1732584193, n = -271733879, s = -1732584194, o = 271733878, i = 0; i < r.length; i += 16) {
850
+ var a = e, u = n, v = s, N = o;
851
+ n = y(n = y(n = y(n = y(n = d(n = d(n = d(n = d(n = f(n = f(n = f(n = f(n = h(n = h(n = h(n = h(n, s = h(s, o = h(o, e = h(e, n, s, o, r[i + 0], 7, -680876936), n, s, r[i + 1], 12, -389564586), e, n, r[i + 2], 17, 606105819), o, e, r[i + 3], 22, -1044525330), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 4], 7, -176418897), n, s, r[i + 5], 12, 1200080426), e, n, r[i + 6], 17, -1473231341), o, e, r[i + 7], 22, -45705983), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 8], 7, 1770035416), n, s, r[i + 9], 12, -1958414417), e, n, r[i + 10], 17, -42063), o, e, r[i + 11], 22, -1990404162), s = h(s, o = h(o, e = h(e, n, s, o, r[i + 12], 7, 1804603682), n, s, r[i + 13], 12, -40341101), e, n, r[i + 14], 17, -1502002290), o, e, r[i + 15], 22, 1236535329), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 1], 5, -165796510), n, s, r[i + 6], 9, -1069501632), e, n, r[i + 11], 14, 643717713), o, e, r[i + 0], 20, -373897302), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 5], 5, -701558691), n, s, r[i + 10], 9, 38016083), e, n, r[i + 15], 14, -660478335), o, e, r[i + 4], 20, -405537848), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 9], 5, 568446438), n, s, r[i + 14], 9, -1019803690), e, n, r[i + 3], 14, -187363961), o, e, r[i + 8], 20, 1163531501), s = f(s, o = f(o, e = f(e, n, s, o, r[i + 13], 5, -1444681467), n, s, r[i + 2], 9, -51403784), e, n, r[i + 7], 14, 1735328473), o, e, r[i + 12], 20, -1926607734), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 5], 4, -378558), n, s, r[i + 8], 11, -2022574463), e, n, r[i + 11], 16, 1839030562), o, e, r[i + 14], 23, -35309556), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 1], 4, -1530992060), n, s, r[i + 4], 11, 1272893353), e, n, r[i + 7], 16, -155497632), o, e, r[i + 10], 23, -1094730640), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 13], 4, 681279174), n, s, r[i + 0], 11, -358537222), e, n, r[i + 3], 16, -722521979), o, e, r[i + 6], 23, 76029189), s = d(s, o = d(o, e = d(e, n, s, o, r[i + 9], 4, -640364487), n, s, r[i + 12], 11, -421815835), e, n, r[i + 15], 16, 530742520), o, e, r[i + 2], 23, -995338651), s = y(s, o = y(o, e = y(e, n, s, o, r[i + 0], 6, -198630844), n, s, r[i + 7], 10, 1126891415), e, n, r[i + 14], 15, -1416354905), o, e, r[i + 5], 21, -57434055), s = y(s, o = y(o, e = y(e, n, s, o, r[i + 12], 6, 1700485571), n, s, r[i + 3], 10, -1894986606), e, n, r[i + 10], 15, -1051523), o, e, r[i + 1], 21, -2054922799), s = y(s, o = y(o, e = y(e, n, s, o, r[i + 8], 6, 1873313359), n, s, r[i + 15], 10, -30611744), e, n, r[i + 6], 15, -1560198380), o, e, r[i + 13], 21, 1309151649), s = y(s, o = y(o, e = y(e, n, s, o, r[i + 4], 6, -145523070), n, s, r[i + 11], 10, -1120210379), e, n, r[i + 2], 15, 718787259), o, e, r[i + 9], 21, -343485551), e = m(e, a), n = m(n, u), s = m(s, v), o = m(o, N);
874
852
  }
875
- return Array(e, n, o, s);
853
+ return Array(e, n, s, o);
876
854
  }
877
- function $(r, t, e, n, o, s) {
878
- return m(wt(m(m(t, r), m(n, s)), o), e);
855
+ function C(r, t, e, n, s, o) {
856
+ return m(St(m(m(t, r), m(n, o)), s), e);
879
857
  }
880
- function l(r, t, e, n, o, s, i) {
881
- return $(t & e | ~t & n, r, t, o, s, i);
858
+ function h(r, t, e, n, s, o, i) {
859
+ return C(t & e | ~t & n, r, t, s, o, i);
882
860
  }
883
- function h(r, t, e, n, o, s, i) {
884
- return $(t & n | e & ~n, r, t, o, s, i);
861
+ function f(r, t, e, n, s, o, i) {
862
+ return C(t & n | e & ~n, r, t, s, o, i);
885
863
  }
886
- function f(r, t, e, n, o, s, i) {
887
- return $(t ^ e ^ n, r, t, o, s, i);
864
+ function d(r, t, e, n, s, o, i) {
865
+ return C(t ^ e ^ n, r, t, s, o, i);
888
866
  }
889
- function d(r, t, e, n, o, s, i) {
890
- return $(e ^ (t | ~n), r, t, o, s, i);
867
+ function y(r, t, e, n, s, o, i) {
868
+ return C(e ^ (t | ~n), r, t, s, o, i);
891
869
  }
892
870
  function m(r, t) {
893
871
  var e = (65535 & r) + (65535 & t);
894
872
  return (r >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
895
873
  }
896
- function wt(r, t) {
874
+ function St(r, t) {
897
875
  return r << t | r >>> 32 - t;
898
876
  }
899
- function Vt(r) {
877
+ function ne(r) {
900
878
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
901
879
  }
902
- function Xt(r, t = "mp") {
903
- return r ? `https://www.gravatar.com/avatar/${ft(r)}?d=${t}` : "";
880
+ function se(r, t = "mp") {
881
+ return r ? `https://www.gravatar.com/avatar/${gt(r)}?d=${t}` : "";
904
882
  }
905
- function Qt(r) {
883
+ function oe(r) {
906
884
  (typeof r == "number" || typeof r == "string") && (r = new Date(r));
907
885
  let t = r.getHours(), e = "AM";
908
886
  return t >= 12 ? (t > 12 && (t -= 12), e = "PM") : t == 0 && (t = 12), `${r.getFullYear()}-${(r.getMonth() + 1).toString().padStart(2, "0")}-${r.getDate().toString().padStart(2, "0")}, ${t}:${r.getMinutes().toString().padStart(2, "0")} ${e}`;
909
887
  }
910
- function mt(r) {
888
+ function Ot(r) {
911
889
  return new Promise((t) => setTimeout(t, r));
912
890
  }
913
- async function _t(r, t = 100) {
914
- for (; await r(); )
915
- await mt(t);
891
+ async function ie(r, t = 100) {
892
+ for (; await r(); ) await Ot(t);
916
893
  }
917
- function te(r) {
894
+ function ce(r) {
918
895
  return (r instanceof Date ? r.getTime() : r) - (/* @__PURE__ */ new Date()).getTime();
919
896
  }
920
- function ee() {
897
+ function ue() {
921
898
  return Object.keys({});
922
899
  }
900
+ var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, xt = {}, S = {};
901
+ Object.defineProperty(S, "__esModule", { value: !0 });
902
+ S.persist = S.Persist = void 0;
903
+ class st {
904
+ /**
905
+ * @param {string} key Primary key value will be stored under
906
+ * @param {PersistOptions<T>} options Configure using {@link PersistOptions}
907
+ */
908
+ constructor(t, e = {}) {
909
+ c(this, "key");
910
+ c(this, "options");
911
+ /** Backend service to store data, must implement `Storage` interface */
912
+ c(this, "storage");
913
+ /** Listeners which should be notified on changes */
914
+ c(this, "watches", {});
915
+ /** Private value field */
916
+ c(this, "_value");
917
+ this.key = t, this.options = e, this.storage = e.storage || localStorage, this.load();
918
+ }
919
+ /** Current value or default if undefined */
920
+ get value() {
921
+ var t;
922
+ return this._value !== void 0 ? this._value : (t = this.options) == null ? void 0 : t.default;
923
+ }
924
+ /** Set value with proxy object wrapper to sync future changes */
925
+ set value(t) {
926
+ t == null || typeof t != "object" ? this._value = t : this._value = new Proxy(t, {
927
+ get: (e, n) => typeof e[n] == "function" ? (...o) => {
928
+ const i = e[n](...o);
929
+ return this.save(), i;
930
+ } : e[n],
931
+ set: (e, n, s) => (e[n] = s, this.save(), !0)
932
+ }), this.save();
933
+ }
934
+ /** Notify listeners of change */
935
+ notify(t) {
936
+ Object.values(this.watches).forEach((e) => e(t));
937
+ }
938
+ /** Delete value from storage */
939
+ clear() {
940
+ this.storage.removeItem(this.key);
941
+ }
942
+ /** Save current value to storage */
943
+ save() {
944
+ this._value === void 0 ? this.clear() : this.storage.setItem(this.key, JSON.stringify(this._value)), this.notify(this.value);
945
+ }
946
+ /** Load value from storage */
947
+ load() {
948
+ if (this.storage[this.key] != null) {
949
+ let t = JSON.parse(this.storage.getItem(this.key));
950
+ t != null && typeof t == "object" && this.options.type && (t.__proto__ = this.options.type.prototype), this.value = t;
951
+ } else
952
+ this.value = this.options.default || void 0;
953
+ }
954
+ /**
955
+ * Callback function which is run when there are changes
956
+ *
957
+ * @param {(value: T) => any} fn Callback will run on each change; it's passed the next value & it's return is ignored
958
+ * @returns {() => void} Function which will unsubscribe the watch/callback when called
959
+ */
960
+ watch(t) {
961
+ const e = Object.keys(this.watches).length;
962
+ return this.watches[e] = t, () => {
963
+ delete this.watches[e];
964
+ };
965
+ }
966
+ /**
967
+ * Return value as JSON string
968
+ *
969
+ * @returns {string} Stringified object as JSON
970
+ */
971
+ toString() {
972
+ return JSON.stringify(this.value);
973
+ }
974
+ /**
975
+ * Return current value
976
+ *
977
+ * @returns {T} Current value
978
+ */
979
+ valueOf() {
980
+ return this.value;
981
+ }
982
+ }
983
+ S.Persist = st;
984
+ function Bt(r) {
985
+ return (t, e) => {
986
+ const n = (r == null ? void 0 : r.key) || `${t.constructor.name}.${e.toString()}`, s = new st(n, r);
987
+ Object.defineProperty(t, e, {
988
+ get: function() {
989
+ return s.value;
990
+ },
991
+ set: function(o) {
992
+ s.value = o;
993
+ }
994
+ });
995
+ };
996
+ }
997
+ S.persist = Bt;
998
+ var L = {};
999
+ Object.defineProperty(L, "__esModule", { value: !0 });
1000
+ L.MemoryStorage = void 0;
1001
+ class At {
1002
+ get length() {
1003
+ return Object.keys(this).length;
1004
+ }
1005
+ clear() {
1006
+ Object.keys(this).forEach((t) => this.removeItem(t));
1007
+ }
1008
+ getItem(t) {
1009
+ return this[t];
1010
+ }
1011
+ key(t) {
1012
+ return Object.keys(this)[t];
1013
+ }
1014
+ removeItem(t) {
1015
+ delete this[t];
1016
+ }
1017
+ setItem(t, e) {
1018
+ this[t] = e;
1019
+ }
1020
+ }
1021
+ L.MemoryStorage = At;
1022
+ (function(r) {
1023
+ var t = $ && $.__createBinding || (Object.create ? function(n, s, o, i) {
1024
+ i === void 0 && (i = o);
1025
+ var a = Object.getOwnPropertyDescriptor(s, o);
1026
+ (!a || ("get" in a ? !s.__esModule : a.writable || a.configurable)) && (a = { enumerable: !0, get: function() {
1027
+ return s[o];
1028
+ } }), Object.defineProperty(n, i, a);
1029
+ } : function(n, s, o, i) {
1030
+ i === void 0 && (i = o), n[i] = s[o];
1031
+ }), e = $ && $.__exportStar || function(n, s) {
1032
+ for (var o in n) o !== "default" && !Object.prototype.hasOwnProperty.call(s, o) && t(s, n, o);
1033
+ };
1034
+ Object.defineProperty(r, "__esModule", { value: !0 }), e(S, r), e(L, r);
1035
+ })(xt);
923
1036
  export {
924
- A as ASet,
925
- Q as BadGatewayError,
926
- Y as BadRequestError,
927
- Nt as Cache,
928
- Gt as CliBackground,
929
- S as CliEffects,
930
- C as CliForeground,
1037
+ B as ASet,
1038
+ et as BadGatewayError,
1039
+ W as BadRequestError,
1040
+ Dt as Cache,
1041
+ _t as CliBackground,
1042
+ x as CliEffects,
1043
+ j as CliForeground,
931
1044
  p as CustomError,
932
- z as ForbiddenError,
933
- tt as GatewayTimeoutError,
934
- P as Http,
935
- V as InternalServerError,
936
- T as JSONAttemptParse,
937
- bt as JSONSanitize,
938
- lt as LOG_LEVEL,
939
- q as Logger,
940
- J as MethodNotAllowedError,
941
- Z as NotAcceptableError,
942
- K as NotFoundError,
943
- X as NotImplementedError,
944
- W as PaymentRequiredError,
1045
+ K as ForbiddenError,
1046
+ nt as GatewayTimeoutError,
1047
+ F as Http,
1048
+ Q as InternalServerError,
1049
+ M as JSONAttemptParse,
1050
+ Lt as JSONSanitize,
1051
+ yt as LOG_LEVEL,
1052
+ Y as Logger,
1053
+ V as MethodNotAllowedError,
1054
+ X as NotAcceptableError,
1055
+ Z as NotFoundError,
1056
+ tt as NotImplementedError,
1057
+ z as PaymentRequiredError,
945
1058
  E as PromiseProgress,
946
- _ as ServiceUnavailableError,
947
- v as TypedEmitter,
948
- H as UnauthorizedError,
949
- Rt as addUnique,
950
- Ot as arrayDiff,
951
- Ct as caseInsensitiveSort,
952
- ot as clean,
953
- Tt as csv,
954
- Pt as dec2Frac,
955
- xt as deepCopy,
956
- st as deepMerge,
957
- x as dotNotation,
958
- jt as downloadFile,
959
- at as downloadUrl,
960
- Bt as encodeQuery,
961
- kt as errorFromCode,
962
- It as fileBrowser,
963
- $t as findByProp,
964
- it as flattenArr,
965
- F as flattenObj,
966
- St as formData,
967
- Ft as formatBytes,
968
- Qt as formatDate,
969
- vt as formatPhoneNumber,
970
- qt as fracToDec,
971
- Xt as gravatar,
972
- G as includes,
973
- Yt as insertAt,
974
- b as isEqual,
975
- Ut as jwtDecode,
976
- ut as makeArray,
977
- ct as makeUnique,
978
- Jt as matchAll,
979
- ft as md5,
980
- At as mixin,
981
- Ht as pad,
982
- Zt as parseUrl,
983
- Wt as randomHex,
984
- zt as randomString,
985
- Kt as randomStringBuilder,
986
- mt as sleep,
987
- _t as sleepUntil,
988
- Lt as sortByProp,
989
- te as timeUntil,
990
- Dt as timestampFilename,
991
- ee as tyoeKeys,
992
- Mt as uploadWithProgress,
993
- Vt as validateEmail
1059
+ rt as ServiceUnavailableError,
1060
+ _ as TypedEmitter,
1061
+ J as UnauthorizedError,
1062
+ Nt as addUnique,
1063
+ It as arrayDiff,
1064
+ Mt as caseInsensitiveSort,
1065
+ ut as clean,
1066
+ Pt as csv,
1067
+ Wt as dec2Frac,
1068
+ Rt as deepCopy,
1069
+ at as deepMerge,
1070
+ b as dotNotation,
1071
+ Gt as downloadFile,
1072
+ dt as downloadUrl,
1073
+ jt as encodeQuery,
1074
+ Yt as errorFromCode,
1075
+ Ut as fileBrowser,
1076
+ Tt as findByProp,
1077
+ lt as flattenArr,
1078
+ H as flattenObj,
1079
+ $t as formData,
1080
+ zt as formatBytes,
1081
+ oe as formatDate,
1082
+ Kt as formatPhoneNumber,
1083
+ Jt as fracToDec,
1084
+ se as gravatar,
1085
+ q as includes,
1086
+ Zt as insertAt,
1087
+ A as isEqual,
1088
+ Ht as jwtDecode,
1089
+ ft as makeArray,
1090
+ ht as makeUnique,
1091
+ ee as matchAll,
1092
+ gt as md5,
1093
+ Ct as mixin,
1094
+ Vt as pad,
1095
+ re as parseUrl,
1096
+ Xt as randomHex,
1097
+ Qt as randomString,
1098
+ te as randomStringBuilder,
1099
+ Ot as sleep,
1100
+ ie as sleepUntil,
1101
+ kt as sortByProp,
1102
+ ce as timeUntil,
1103
+ qt as timestampFilename,
1104
+ ue as tyoeKeys,
1105
+ Ft as uploadWithProgress,
1106
+ ne as validateEmail
994
1107
  };
995
1108
  //# sourceMappingURL=index.mjs.map