@ztimson/utils 0.16.9 → 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,11 +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) {
235
+ if (!this.key) throw new Error("No key defined");
240
236
  return t[this.key];
241
237
  }
242
238
  /**
@@ -299,6 +295,14 @@ class Nt {
299
295
  keys() {
300
296
  return Object.keys(this.store);
301
297
  }
298
+ /**
299
+ * Get map of cached items
300
+ *
301
+ * @return {Record<K, T>}
302
+ */
303
+ map() {
304
+ return structuredClone(this.store);
305
+ }
302
306
  /**
303
307
  * Add an item to the cache manually specifying the key
304
308
  *
@@ -313,25 +317,25 @@ class Nt {
313
317
  }, n), this;
314
318
  }
315
319
  }
316
- function Tt(r, t = !0) {
317
- const e = r.reduce((n, o) => (Object.keys(t ? F(o) : o).forEach((s) => {
318
- 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);
319
323
  }), n), []);
320
324
  return [
321
325
  e.join(","),
322
- ...r.map((n) => e.map((o) => {
323
- const s = x(n, o), i = typeof s;
324
- 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;
325
329
  }).join(","))
326
330
  ].join(`
327
331
  `);
328
332
  }
329
333
  class E extends Promise {
330
334
  constructor(e) {
331
- super((n, o) => e(
332
- (s) => n(s),
333
- (s) => o(s),
334
- (s) => this.progress = s
335
+ super((n, s) => e(
336
+ (o) => n(o),
337
+ (o) => s(o),
338
+ (o) => this.progress = o
335
339
  ));
336
340
  c(this, "listeners", []);
337
341
  c(this, "_progress", 0);
@@ -343,18 +347,18 @@ class E extends Promise {
343
347
  e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
344
348
  }
345
349
  static from(e) {
346
- 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)));
347
351
  }
348
352
  from(e) {
349
353
  const n = E.from(e);
350
- return this.onProgress((o) => n.progress = o), n;
354
+ return this.onProgress((s) => n.progress = s), n;
351
355
  }
352
356
  onProgress(e) {
353
357
  return this.listeners.push(e), this;
354
358
  }
355
359
  then(e, n) {
356
- const o = super.then(e, n);
357
- return this.from(o);
360
+ const s = super.then(e, n);
361
+ return this.from(s);
358
362
  }
359
363
  catch(e) {
360
364
  return this.from(super.catch(e));
@@ -363,16 +367,16 @@ class E extends Promise {
363
367
  return this.from(super.finally(e));
364
368
  }
365
369
  }
366
- function jt(r, t) {
367
- r instanceof Blob || (r = new Blob(ut(r)));
370
+ function Gt(r, t) {
371
+ r instanceof Blob || (r = new Blob(ft(r)));
368
372
  const e = URL.createObjectURL(r);
369
- at(e, t), URL.revokeObjectURL(e);
373
+ dt(e, t), URL.revokeObjectURL(e);
370
374
  }
371
- function at(r, t) {
375
+ function dt(r, t) {
372
376
  const e = document.createElement("a");
373
377
  e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
374
378
  }
375
- function It(r = {}) {
379
+ function Ut(r = {}) {
376
380
  return new Promise((t) => {
377
381
  const e = document.createElement("input");
378
382
  e.type = "file", e.accept = r.accept || "*", e.style.display = "none", e.multiple = !!r.multiple, e.onblur = e.onchange = async () => {
@@ -380,18 +384,18 @@ function It(r = {}) {
380
384
  }, document.body.appendChild(e), e.click();
381
385
  });
382
386
  }
383
- function Dt(r, t = /* @__PURE__ */ new Date()) {
387
+ function qt(r, t = /* @__PURE__ */ new Date()) {
384
388
  (typeof t == "number" || typeof t == "string") && (t = new Date(t));
385
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")}`;
386
390
  return r ? r.replace("{{TIMESTAMP}}", e) : e;
387
391
  }
388
- function Mt(r) {
392
+ function Ft(r) {
389
393
  return new E((t, e, n) => {
390
- const o = new XMLHttpRequest(), s = new FormData();
391
- 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);
392
396
  });
393
397
  }
394
- class v {
398
+ class _ {
395
399
  constructor() {
396
400
  c(this, "listeners", {});
397
401
  }
@@ -400,17 +404,17 @@ class v {
400
404
  }
401
405
  static off(t, e) {
402
406
  const n = t.toString();
403
- this.listeners[n] = (this.listeners[n] || []).filter((o) => o === e);
407
+ this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
404
408
  }
405
409
  static on(t, e) {
406
- var o;
410
+ var s;
407
411
  const n = t.toString();
408
- 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);
409
413
  }
410
414
  static once(t, e) {
411
415
  return new Promise((n) => {
412
- const o = this.on(t, (...s) => {
413
- 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();
414
418
  });
415
419
  });
416
420
  }
@@ -426,13 +430,13 @@ class v {
426
430
  }
427
431
  once(t, e) {
428
432
  return new Promise((n) => {
429
- const o = this.on(t, (...s) => {
430
- 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();
431
435
  });
432
436
  });
433
437
  }
434
438
  }
435
- c(v, "listeners", {});
439
+ c(_, "listeners", {});
436
440
  class p extends Error {
437
441
  constructor(e, n) {
438
442
  super(e);
@@ -446,8 +450,8 @@ class p extends Error {
446
450
  this._code = e;
447
451
  }
448
452
  static from(e) {
449
- const n = Number(e.statusCode) ?? Number(e.code), o = new this(e.message || e.toString());
450
- 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, {
451
455
  stack: e.stack,
452
456
  ...e,
453
457
  code: n ?? void 0
@@ -461,7 +465,7 @@ class p extends Error {
461
465
  }
462
466
  }
463
467
  c(p, "code", 500);
464
- class Y extends p {
468
+ class W extends p {
465
469
  constructor(t = "Bad Request") {
466
470
  super(t);
467
471
  }
@@ -469,8 +473,8 @@ class Y extends p {
469
473
  return t.constructor.code == this.code;
470
474
  }
471
475
  }
472
- c(Y, "code", 400);
473
- class H extends p {
476
+ c(W, "code", 400);
477
+ class J extends p {
474
478
  constructor(t = "Unauthorized") {
475
479
  super(t);
476
480
  }
@@ -478,8 +482,8 @@ class H extends p {
478
482
  return t.constructor.code == this.code;
479
483
  }
480
484
  }
481
- c(H, "code", 401);
482
- class W extends p {
485
+ c(J, "code", 401);
486
+ class z extends p {
483
487
  constructor(t = "Payment Required") {
484
488
  super(t);
485
489
  }
@@ -487,8 +491,8 @@ class W extends p {
487
491
  return t.constructor.code == this.code;
488
492
  }
489
493
  }
490
- c(W, "code", 402);
491
- class z extends p {
494
+ c(z, "code", 402);
495
+ class K extends p {
492
496
  constructor(t = "Forbidden") {
493
497
  super(t);
494
498
  }
@@ -496,8 +500,8 @@ class z extends p {
496
500
  return t.constructor.code == this.code;
497
501
  }
498
502
  }
499
- c(z, "code", 403);
500
- class K extends p {
503
+ c(K, "code", 403);
504
+ class Z extends p {
501
505
  constructor(t = "Not Found") {
502
506
  super(t);
503
507
  }
@@ -505,8 +509,8 @@ class K extends p {
505
509
  return t.constructor.code == this.code;
506
510
  }
507
511
  }
508
- c(K, "code", 404);
509
- class J extends p {
512
+ c(Z, "code", 404);
513
+ class V extends p {
510
514
  constructor(t = "Method Not Allowed") {
511
515
  super(t);
512
516
  }
@@ -514,8 +518,8 @@ class J extends p {
514
518
  return t.constructor.code == this.code;
515
519
  }
516
520
  }
517
- c(J, "code", 405);
518
- class Z extends p {
521
+ c(V, "code", 405);
522
+ class X extends p {
519
523
  constructor(t = "Not Acceptable") {
520
524
  super(t);
521
525
  }
@@ -523,8 +527,8 @@ class Z extends p {
523
527
  return t.constructor.code == this.code;
524
528
  }
525
529
  }
526
- c(Z, "code", 406);
527
- class V extends p {
530
+ c(X, "code", 406);
531
+ class Q extends p {
528
532
  constructor(t = "Internal Server Error") {
529
533
  super(t);
530
534
  }
@@ -532,8 +536,8 @@ class V extends p {
532
536
  return t.constructor.code == this.code;
533
537
  }
534
538
  }
535
- c(V, "code", 500);
536
- class X extends p {
539
+ c(Q, "code", 500);
540
+ class tt extends p {
537
541
  constructor(t = "Not Implemented") {
538
542
  super(t);
539
543
  }
@@ -541,8 +545,8 @@ class X extends p {
541
545
  return t.constructor.code == this.code;
542
546
  }
543
547
  }
544
- c(X, "code", 501);
545
- class Q extends p {
548
+ c(tt, "code", 501);
549
+ class et extends p {
546
550
  constructor(t = "Bad Gateway") {
547
551
  super(t);
548
552
  }
@@ -550,8 +554,8 @@ class Q extends p {
550
554
  return t.constructor.code == this.code;
551
555
  }
552
556
  }
553
- c(Q, "code", 502);
554
- class _ extends p {
557
+ c(et, "code", 502);
558
+ class rt extends p {
555
559
  constructor(t = "Service Unavailable") {
556
560
  super(t);
557
561
  }
@@ -559,8 +563,8 @@ class _ extends p {
559
563
  return t.constructor.code == this.code;
560
564
  }
561
565
  }
562
- c(_, "code", 503);
563
- class tt extends p {
566
+ c(rt, "code", 503);
567
+ class nt extends p {
564
568
  constructor(t = "Gateway Timeout") {
565
569
  super(t);
566
570
  }
@@ -568,35 +572,34 @@ class tt extends p {
568
572
  return t.constructor.code == this.code;
569
573
  }
570
574
  }
571
- c(tt, "code", 504);
572
- function kt(r, t) {
573
- if (r >= 200 && r < 300)
574
- return null;
575
+ c(nt, "code", 504);
576
+ function Yt(r, t) {
577
+ if (r >= 200 && r < 300) return null;
575
578
  switch (r) {
576
579
  case 400:
577
- return new Y(t);
580
+ return new W(t);
578
581
  case 401:
579
- return new H(t);
582
+ return new J(t);
580
583
  case 402:
581
- return new W(t);
582
- case 403:
583
584
  return new z(t);
584
- case 404:
585
+ case 403:
585
586
  return new K(t);
587
+ case 404:
588
+ return new Z(t);
586
589
  case 405:
587
- return new J(t);
590
+ return new V(t);
588
591
  case 406:
589
- return new Z(t);
592
+ return new X(t);
590
593
  case 500:
591
- return new V(t);
594
+ return new Q(t);
592
595
  case 501:
593
- return new X(t);
596
+ return new tt(t);
594
597
  case 502:
595
- return new Q(t);
598
+ return new et(t);
596
599
  case 503:
597
- return new _(t);
600
+ return new rt(t);
598
601
  case 504:
599
- return new tt(t);
602
+ return new nt(t);
600
603
  default:
601
604
  return new p(t, r);
602
605
  }
@@ -621,61 +624,59 @@ const w = class w {
621
624
  };
622
625
  }
623
626
  request(t = {}) {
624
- var o;
625
- if (!this.url && !t.url)
626
- throw new Error("URL needs to be set");
627
- let e = ((o = t.url) != null && o.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
628
- if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (s, i) => `#${t.fragment}${i}`) : e += "#" + t.fragment), t.query) {
629
- const s = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((i) => ({ key: i, value: t.query[i] }));
630
- 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("&");
631
633
  }
632
- const n = ot({
634
+ const n = ut({
633
635
  "Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
634
636
  ...w.headers,
635
637
  ...this.headers,
636
638
  ...t.headers
637
639
  });
638
- 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) => {
639
641
  fetch(e, {
640
642
  headers: n,
641
643
  method: t.method || (t.body ? "POST" : "GET"),
642
644
  body: t.body
643
645
  }).then(async (u) => {
644
- var k, U;
645
- for (let a of [...Object.values(w.interceptors), ...Object.values(this.interceptors)])
646
- await new Promise((O) => a(u, () => O()));
647
- const R = u.headers.get("Content-Length"), L = R ? parseInt(R, 10) : 0;
648
- let M = 0;
649
- const N = (k = u.body) == null ? void 0 : k.getReader(), et = new ReadableStream({
650
- start(a) {
651
- function O() {
652
- N == null || N.read().then((B) => {
653
- if (B.done)
654
- return a.close();
655
- M += B.value.byteLength, y(M / L), a.enqueue(B.value), O();
656
- }).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));
657
658
  }
658
- O();
659
+ R();
659
660
  }
660
661
  });
661
- if (u.data = new Response(et), t.decode == null || t.decode) {
662
- const a = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
663
- 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());
664
665
  }
665
- u.ok ? s(u) : i(u);
666
+ u.ok ? o(u) : i(u);
666
667
  });
667
668
  });
668
669
  }
669
670
  };
670
671
  c(w, "interceptors", {}), c(w, "headers", {});
671
- let P = w;
672
- function Ut(r) {
672
+ let F = w;
673
+ function Ht(r) {
673
674
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
674
- return T(decodeURIComponent(atob(t).split("").map(function(e) {
675
+ return M(decodeURIComponent(atob(t).split("").map(function(e) {
675
676
  return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
676
677
  }).join("")));
677
678
  }
678
- const S = {
679
+ const x = {
679
680
  CLEAR: "\x1B[0m",
680
681
  BRIGHT: "\x1B[1m",
681
682
  DIM: "\x1B[2m",
@@ -683,7 +684,7 @@ const S = {
683
684
  BLINK: "\x1B[5m",
684
685
  REVERSE: "\x1B[7m",
685
686
  HIDDEN: "\x1B[8m"
686
- }, C = {
687
+ }, j = {
687
688
  BLACK: "\x1B[30m",
688
689
  RED: "\x1B[31m",
689
690
  GREEN: "\x1B[32m",
@@ -700,7 +701,7 @@ const S = {
700
701
  LIGHT_MAGENTA: "\x1B[95m",
701
702
  LIGHT_CYAN: "\x1B[96m",
702
703
  WHITE: "\x1B[97m"
703
- }, Gt = {
704
+ }, _t = {
704
705
  BLACK: "\x1B[40m",
705
706
  RED: "\x1B[41m",
706
707
  GREEN: "\x1B[42m",
@@ -711,109 +712,100 @@ const S = {
711
712
  WHITE: "\x1B[47m",
712
713
  GREY: "\x1B[100m"
713
714
  };
714
- 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 || {});
715
- 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 _ {
716
717
  constructor(t) {
717
718
  super(), this.namespace = t;
718
719
  }
719
- pad(t, e, n, o = !1) {
720
- const s = t.toString(), i = e - s.length;
721
- if (i <= 0)
722
- return s;
723
- const y = Array(~~(i / n.length)).fill(n).join("");
724
- 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;
725
725
  }
726
726
  format(...t) {
727
727
  const e = /* @__PURE__ */ new Date();
728
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(" ")}`;
729
729
  }
730
730
  debug(...t) {
731
- if (g.LOG_LEVEL < 4)
732
- return;
731
+ if (g.LOG_LEVEL < 4) return;
733
732
  const e = this.format(...t);
734
- 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);
735
734
  }
736
735
  log(...t) {
737
- if (g.LOG_LEVEL < 3)
738
- return;
736
+ if (g.LOG_LEVEL < 3) return;
739
737
  const e = this.format(...t);
740
- g.emit(3, e), console.log(S.CLEAR + e);
738
+ g.emit(3, e), console.log(x.CLEAR + e);
741
739
  }
742
740
  info(...t) {
743
- if (g.LOG_LEVEL < 2)
744
- return;
741
+ if (g.LOG_LEVEL < 2) return;
745
742
  const e = this.format(...t);
746
- g.emit(2, e), console.info(C.BLUE + e + S.CLEAR);
743
+ g.emit(2, e), console.info(j.BLUE + e + x.CLEAR);
747
744
  }
748
745
  warn(...t) {
749
- if (g.LOG_LEVEL < 1)
750
- return;
746
+ if (g.LOG_LEVEL < 1) return;
751
747
  const e = this.format(...t);
752
- g.emit(1, e), console.warn(C.YELLOW + e + S.CLEAR);
748
+ g.emit(1, e), console.warn(j.YELLOW + e + x.CLEAR);
753
749
  }
754
750
  error(...t) {
755
- if (g.LOG_LEVEL < 0)
756
- return;
751
+ if (g.LOG_LEVEL < 0) return;
757
752
  const e = this.format(...t);
758
- g.emit(0, e), console.error(C.RED + e + S.CLEAR);
753
+ g.emit(0, e), console.error(j.RED + e + x.CLEAR);
759
754
  }
760
755
  };
761
756
  c(g, "LOG_LEVEL", 4);
762
- let q = g;
763
- function Pt(r) {
764
- const t = (y, u) => u < 1e-7 ? y : t(u, ~~(y % u)), e = r.toString().length - 2;
765
- let n = Math.pow(10, e), o = r * n;
766
- const s = t(o, n);
767
- o = ~~(o / s), n = ~~(n / s);
768
- const i = ~~(o / n);
769
- return o -= i * n, `${i ? i + " " : ""}${~~o}/${~~n}`;
770
- }
771
- 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) {
772
767
  let t = r.split(" ");
773
768
  const e = t.length == 2 ? Number(t[0]) : 0;
774
769
  return t = t.pop().split("/"), e + Number(t[0]) / Number(t[1]);
775
770
  }
776
- const j = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", I = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", ht = j + I + D;
777
- function Ft(r, t = 2) {
778
- if (r === 0)
779
- return "0 Bytes";
780
- const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], o = Math.floor(Math.log(r) / Math.log(e));
781
- 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];
782
776
  }
783
- function vt(r) {
777
+ function Kt(r) {
784
778
  const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
785
- if (!t)
786
- throw new Error(`Number cannot be parsed: ${r}`);
779
+ if (!t) throw new Error(`Number cannot be parsed: ${r}`);
787
780
  return `${t[1] ?? ""} (${t[2]}) ${t[3]}-${t[4]}`.trim();
788
781
  }
789
- function Yt(r, t, e) {
782
+ function Zt(r, t, e) {
790
783
  return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
791
784
  }
792
- function Ht(r, t, e = " ", n = !0) {
785
+ function Vt(r, t, e = " ", n = !0) {
793
786
  return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
794
787
  }
795
- function Wt(r) {
788
+ function Xt(r) {
796
789
  return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
797
790
  }
798
- function zt(r, t = ht) {
791
+ function Qt(r, t = pt) {
799
792
  return Array(r).fill(null).map(() => {
800
793
  const e = ~~(Math.random() * t.length);
801
794
  return t[e];
802
795
  }).join("");
803
796
  }
804
- function Kt(r, t = !1, e = !1, n = !1) {
805
- if (!t && !e && !n)
806
- 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");
807
799
  return Array(r).fill(null).map(() => {
808
- let o;
800
+ let s;
809
801
  do {
810
- const s = ~~(Math.random() * 3);
811
- 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)]);
812
- } while (!o);
813
- 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;
814
806
  }).join("");
815
807
  }
816
- function Jt(r, t) {
808
+ function ee(r, t) {
817
809
  if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
818
810
  throw new TypeError("Regular expression must be global.");
819
811
  let e = [], n;
@@ -821,165 +813,296 @@ function Jt(r, t) {
821
813
  e.push(n);
822
814
  return e;
823
815
  }
824
- function Zt(r) {
816
+ function re(r) {
825
817
  const t = new RegExp(
826
818
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
827
819
  "gm"
828
820
  ).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
829
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) {
830
- const o = e.query.split("&"), s = {};
831
- o.forEach((i) => {
832
- const [y, u] = i.split("=");
833
- s[y] = u;
834
- }), 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;
835
827
  }
836
828
  return e;
837
829
  }
838
- function ft(r) {
839
- 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)));
840
832
  return t.toLowerCase();
841
833
  }
842
- function dt(r) {
843
- for (var t, e = "0123456789ABCDEF", n = "", o = 0; o < r.length; o++)
844
- 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);
845
836
  return n;
846
837
  }
847
- function pt(r) {
848
- for (var t = Array(r.length >> 2), e = 0; e < t.length; e++)
849
- t[e] = 0;
850
- for (e = 0; e < 8 * r.length; e += 8)
851
- 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;
852
841
  return t;
853
842
  }
854
- function yt(r) {
855
- for (var t = "", e = 0; e < 32 * r.length; e += 8)
856
- 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);
857
845
  return t;
858
846
  }
859
- function gt(r, t) {
847
+ function bt(r, t) {
860
848
  r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
861
- for (var e = 1732584193, n = -271733879, o = -1732584194, s = 271733878, i = 0; i < r.length; i += 16) {
862
- var y = e, u = n, R = o, L = s;
863
- 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);
864
852
  }
865
- return Array(e, n, o, s);
853
+ return Array(e, n, s, o);
866
854
  }
867
- function $(r, t, e, n, o, s) {
868
- 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);
869
857
  }
870
- function l(r, t, e, n, o, s, i) {
871
- 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);
872
860
  }
873
- function h(r, t, e, n, o, s, i) {
874
- 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);
875
863
  }
876
- function f(r, t, e, n, o, s, i) {
877
- 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);
878
866
  }
879
- function d(r, t, e, n, o, s, i) {
880
- 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);
881
869
  }
882
870
  function m(r, t) {
883
871
  var e = (65535 & r) + (65535 & t);
884
872
  return (r >> 16) + (t >> 16) + (e >> 16) << 16 | 65535 & e;
885
873
  }
886
- function wt(r, t) {
874
+ function St(r, t) {
887
875
  return r << t | r >>> 32 - t;
888
876
  }
889
- function Vt(r) {
877
+ function ne(r) {
890
878
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
891
879
  }
892
- function Xt(r, t = "mp") {
893
- 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}` : "";
894
882
  }
895
- function Qt(r) {
883
+ function oe(r) {
896
884
  (typeof r == "number" || typeof r == "string") && (r = new Date(r));
897
885
  let t = r.getHours(), e = "AM";
898
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}`;
899
887
  }
900
- function mt(r) {
888
+ function Ot(r) {
901
889
  return new Promise((t) => setTimeout(t, r));
902
890
  }
903
- async function _t(r, t = 100) {
904
- for (; await r(); )
905
- await mt(t);
891
+ async function ie(r, t = 100) {
892
+ for (; await r(); ) await Ot(t);
906
893
  }
907
- function te(r) {
894
+ function ce(r) {
908
895
  return (r instanceof Date ? r.getTime() : r) - (/* @__PURE__ */ new Date()).getTime();
909
896
  }
910
- function ee() {
897
+ function ue() {
911
898
  return Object.keys({});
912
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);
913
1036
  export {
914
- A as ASet,
915
- Q as BadGatewayError,
916
- Y as BadRequestError,
917
- Nt as Cache,
918
- Gt as CliBackground,
919
- S as CliEffects,
920
- 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,
921
1044
  p as CustomError,
922
- z as ForbiddenError,
923
- tt as GatewayTimeoutError,
924
- P as Http,
925
- V as InternalServerError,
926
- T as JSONAttemptParse,
927
- bt as JSONSanitize,
928
- lt as LOG_LEVEL,
929
- q as Logger,
930
- J as MethodNotAllowedError,
931
- Z as NotAcceptableError,
932
- K as NotFoundError,
933
- X as NotImplementedError,
934
- 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,
935
1058
  E as PromiseProgress,
936
- _ as ServiceUnavailableError,
937
- v as TypedEmitter,
938
- H as UnauthorizedError,
939
- Rt as addUnique,
940
- Ot as arrayDiff,
941
- Ct as caseInsensitiveSort,
942
- ot as clean,
943
- Tt as csv,
944
- Pt as dec2Frac,
945
- xt as deepCopy,
946
- st as deepMerge,
947
- x as dotNotation,
948
- jt as downloadFile,
949
- at as downloadUrl,
950
- Bt as encodeQuery,
951
- kt as errorFromCode,
952
- It as fileBrowser,
953
- $t as findByProp,
954
- it as flattenArr,
955
- F as flattenObj,
956
- St as formData,
957
- Ft as formatBytes,
958
- Qt as formatDate,
959
- vt as formatPhoneNumber,
960
- qt as fracToDec,
961
- Xt as gravatar,
962
- G as includes,
963
- Yt as insertAt,
964
- b as isEqual,
965
- Ut as jwtDecode,
966
- ut as makeArray,
967
- ct as makeUnique,
968
- Jt as matchAll,
969
- ft as md5,
970
- At as mixin,
971
- Ht as pad,
972
- Zt as parseUrl,
973
- Wt as randomHex,
974
- zt as randomString,
975
- Kt as randomStringBuilder,
976
- mt as sleep,
977
- _t as sleepUntil,
978
- Lt as sortByProp,
979
- te as timeUntil,
980
- Dt as timestampFilename,
981
- ee as tyoeKeys,
982
- Mt as uploadWithProgress,
983
- 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
984
1107
  };
985
1108
  //# sourceMappingURL=index.mjs.map