@ztimson/utils 0.20.12 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,27 +3,27 @@ var it = (r, t, e) => t in r ? ot(r, t, { enumerable: !0, configurable: !0, writ
3
3
  var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  function ct(r, t = !1) {
5
5
  if (r == null) throw new Error("Cannot clean a NULL value");
6
- return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, s]) => {
7
- (t && s === void 0 || !t && s == null) && delete r[e];
6
+ return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, n]) => {
7
+ (t && n === void 0 || !t && n == null) && delete r[e];
8
8
  }), r;
9
9
  }
10
10
  function At(r) {
11
11
  return structuredClone(r);
12
12
  }
13
- function ut(r, ...t) {
13
+ function at(r, ...t) {
14
14
  return t.forEach((e) => {
15
- for (const s in e)
16
- e[s] && typeof e[s] == "object" && !Array.isArray(e[s]) ? (r[s] || (r[s] = {}), ut(r[s], e[s])) : r[s] = e[s];
15
+ for (const n in e)
16
+ e[n] && typeof e[n] == "object" && !Array.isArray(e[n]) ? (r[n] || (r[n] = {}), at(r[n], e[n])) : r[n] = e[n];
17
17
  }), r;
18
18
  }
19
19
  function B(r, t, e) {
20
20
  if (!(r == null || !t))
21
- return t.split(/[.[\]]/g).filter((s) => s.length).reduce((s, n, o, i) => {
22
- if ((n[0] == '"' || n[0] == "'") && (n = n.slice(1, -1)), !(s != null && s.hasOwnProperty(n))) {
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
23
  if (e == null) return;
24
- s[n] = {};
24
+ n[s] = {};
25
25
  }
26
- return e !== void 0 && o == i.length - 1 ? s[n] = e : s[n];
26
+ return e !== void 0 && o == i.length - 1 ? n[s] = e : n[s];
27
27
  }, r);
28
28
  }
29
29
  function Rt(r) {
@@ -33,34 +33,34 @@ function Rt(r) {
33
33
  }
34
34
  function K(r, t, e = {}) {
35
35
  if (typeof r == "object" && !Array.isArray(r)) {
36
- for (const s of Object.keys(r)) {
37
- const n = t ? t + "." + s : s;
38
- typeof r[s] == "object" ? K(r[s], n, e) : e[n] = r[s];
36
+ for (const n of Object.keys(r)) {
37
+ const s = t ? t + "." + n : n;
38
+ typeof r[n] == "object" ? K(r[n], s, e) : e[s] = r[n];
39
39
  }
40
40
  return e;
41
41
  }
42
42
  }
43
43
  function Ot(r) {
44
44
  const t = new FormData();
45
- return Object.entries(r).forEach(([e, s]) => t.append(e, s)), t;
45
+ return Object.entries(r).forEach(([e, n]) => t.append(e, n)), t;
46
46
  }
47
47
  function q(r, t, e = !1) {
48
48
  if (r == null) return e;
49
- if (Array.isArray(t)) return t.findIndex((n, o) => !q(r[o], t[o], e)) == -1;
50
- const s = typeof t;
51
- return s != typeof r ? !1 : s == "object" ? Object.keys(t).find((n) => !q(r[n], t[n], e)) == null : s == "function" ? r.toString() == t.toString() : r == t;
49
+ if (Array.isArray(t)) return t.findIndex((s, o) => !q(r[o], t[o], e)) == -1;
50
+ const n = typeof 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;
52
52
  }
53
53
  function O(r, t) {
54
- const e = typeof r, s = typeof t;
55
- return e != "object" || r == null || s != "object" || t == null ? e == "function" && s == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? !1 : Object.keys(r).every((o) => O(r[o], t[o]));
54
+ const e = typeof r, n = typeof t;
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) => O(r[o], t[o]));
56
56
  }
57
57
  function $t(r, t) {
58
58
  t.forEach((e) => {
59
- Object.getOwnPropertyNames(e.prototype).forEach((s) => {
59
+ Object.getOwnPropertyNames(e.prototype).forEach((n) => {
60
60
  Object.defineProperty(
61
61
  r.prototype,
62
- s,
63
- Object.getOwnPropertyDescriptor(e.prototype, s) || /* @__PURE__ */ Object.create(null)
62
+ n,
63
+ Object.getOwnPropertyDescriptor(e.prototype, n) || /* @__PURE__ */ Object.create(null)
64
64
  );
65
65
  });
66
66
  });
@@ -72,29 +72,29 @@ function I(r) {
72
72
  return r;
73
73
  }
74
74
  }
75
- function at(r, t) {
75
+ function ut(r, t) {
76
76
  let e = [];
77
- return JSON.stringify(r, (s, n) => {
78
- if (typeof n == "object" && n !== null) {
79
- if (e.includes(n)) return;
80
- e.push(n);
77
+ return JSON.stringify(r, (n, s) => {
78
+ if (typeof s == "object" && s !== null) {
79
+ if (e.includes(s)) return;
80
+ e.push(s);
81
81
  }
82
- return n;
82
+ return s;
83
83
  }, t);
84
84
  }
85
85
  function Ct(r, t) {
86
86
  return r.indexOf(t) === -1 && r.push(t), r;
87
87
  }
88
88
  function Lt(r, t) {
89
- return ft([
90
- ...r.filter((e) => !t.includes((s) => O(e, s))),
91
- ...t.filter((e) => !r.includes((s) => O(e, s)))
89
+ return ht([
90
+ ...r.filter((e) => !t.includes((n) => O(e, n))),
91
+ ...t.filter((e) => !r.includes((n) => O(e, n)))
92
92
  ]);
93
93
  }
94
94
  function Nt(r) {
95
95
  return function(t, e) {
96
- const s = B(t, r), n = B(e, r);
97
- return typeof s != "string" || typeof n != "string" ? 1 : s.toLowerCase().localeCompare(n.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());
98
98
  };
99
99
  }
100
100
  function jt(r, t) {
@@ -104,20 +104,20 @@ function lt(r, t = []) {
104
104
  return r.forEach((e) => Array.isArray(e) ? lt(e, t) : t.push(e)), t;
105
105
  }
106
106
  function Tt(r, t = !1) {
107
- return function(e, s) {
108
- const n = B(e, r), o = B(s, r);
109
- return typeof n == "number" && typeof o == "number" ? (t ? -1 : 1) * (n - o) : n > o ? t ? -1 : 1 : n < o ? t ? 1 : -1 : 0;
107
+ return function(e, n) {
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;
110
110
  };
111
111
  }
112
- function ft(r) {
112
+ function ht(r) {
113
113
  for (let t = r.length - 1; t >= 0; t--)
114
114
  r.slice(0, t).find((e) => O(e, r[t])) && r.splice(t, 1);
115
115
  return r;
116
116
  }
117
- function m(r) {
117
+ function S(r) {
118
118
  return Array.isArray(r) ? r : [r];
119
119
  }
120
- class S extends Array {
120
+ class w extends Array {
121
121
  /** Number of elements in set */
122
122
  get size() {
123
123
  return this.length;
@@ -134,17 +134,17 @@ class S extends Array {
134
134
  * @param items
135
135
  */
136
136
  add(...t) {
137
- t.filter((e) => !this.has(e)).forEach((e) => this.push(e));
137
+ return t.filter((e) => !this.has(e)).forEach((e) => this.push(e)), this;
138
138
  }
139
139
  /**
140
140
  * Delete elements from set
141
141
  * @param items Elements that will be deleted
142
142
  */
143
143
  delete(...t) {
144
- t.forEach((e) => {
145
- const s = this.indexOf(e);
146
- s != -1 && this.slice(s, 1);
147
- });
144
+ return t.forEach((e) => {
145
+ const n = this.indexOf(e);
146
+ n != -1 && this.slice(n, 1);
147
+ }), this;
148
148
  }
149
149
  /**
150
150
  * Create list of elements this set has which the comparison set does not
@@ -152,7 +152,7 @@ class S extends Array {
152
152
  * @return {ASet<T>} Different elements
153
153
  */
154
154
  difference(t) {
155
- return new S(this.filter((e) => !t.has(e)));
155
+ return new w(this.filter((e) => !t.has(e)));
156
156
  }
157
157
  /**
158
158
  * Check if set includes element
@@ -168,7 +168,7 @@ class S extends Array {
168
168
  * @return {boolean} Set of common elements
169
169
  */
170
170
  intersection(t) {
171
- return new S(this.filter((e) => t.has(e)));
171
+ return new w(this.filter((e) => t.has(e)));
172
172
  }
173
173
  /**
174
174
  * Check if this set has no elements in common with the comparison set
@@ -200,7 +200,7 @@ class S extends Array {
200
200
  * @return {ASet<T>} New set of unique elements
201
201
  */
202
202
  symmetricDifference(t) {
203
- return new S([...this.difference(t), ...t.difference(this)]);
203
+ return new w([...this.difference(t), ...t.difference(this)]);
204
204
  }
205
205
  /**
206
206
  * Create joined list of elements included in this & the comparison set
@@ -208,7 +208,7 @@ class S extends Array {
208
208
  * @return {ASet<T>} New set of both previous sets combined
209
209
  */
210
210
  union(t) {
211
- return new S([...this, ...t]);
211
+ return new w([...this, ...t]);
212
212
  }
213
213
  }
214
214
  class It {
@@ -229,16 +229,16 @@ class It {
229
229
  */
230
230
  c(this, "values", this.all());
231
231
  if (this.key = t, this.options = e, e.storageKey && !e.storage && typeof Storage < "u" && (e.storage = localStorage), e.storageKey && e.storage) {
232
- const s = e.storage.getItem(e.storageKey);
233
- if (s)
232
+ const n = e.storage.getItem(e.storageKey);
233
+ if (n)
234
234
  try {
235
- Object.assign(this.store, JSON.parse(s));
235
+ Object.assign(this.store, JSON.parse(n));
236
236
  } catch {
237
237
  }
238
238
  }
239
239
  return new Proxy(this, {
240
- get: (s, n) => n in s ? s[n] : s.store[n],
241
- set: (s, n, o) => (n in s ? s[n] = o : s.store[n] = o, !0)
240
+ get: (n, s) => s in n ? n[s] : n.store[s],
241
+ set: (n, s, o) => (s in n ? n[s] = o : n.store[s] = o, !0)
242
242
  });
243
243
  }
244
244
  getKey(t) {
@@ -261,8 +261,8 @@ class It {
261
261
  * @return {this}
262
262
  */
263
263
  add(t, e = this.ttl) {
264
- const s = this.getKey(t);
265
- return this.set(s, t, e), this;
264
+ const n = this.getKey(t);
265
+ return this.set(n, t, e), this;
266
266
  }
267
267
  /**
268
268
  * Add several rows to the cache
@@ -272,7 +272,7 @@ class It {
272
272
  * @return {this}
273
273
  */
274
274
  addAll(t, e = !0) {
275
- return t.forEach((s) => this.add(s)), this.complete = e, this;
275
+ return t.forEach((n) => this.add(n)), this.complete = e, this;
276
276
  }
277
277
  /**
278
278
  * Remove all keys from cache
@@ -327,20 +327,20 @@ class It {
327
327
  * @param {number | undefined} ttl Override default expiry in seconds
328
328
  * @return {this}
329
329
  */
330
- set(t, e, s = this.options.ttl) {
331
- return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), s && setTimeout(() => {
330
+ set(t, e, n = this.options.ttl) {
331
+ return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), n && setTimeout(() => {
332
332
  this.complete = !1, this.delete(t);
333
- }, s * 1e3), this;
333
+ }, n * 1e3), this;
334
334
  }
335
335
  }
336
336
  function Dt(r, t = !0) {
337
- const e = r.reduce((s, n) => (Object.keys(t ? K(n) : n).forEach((o) => {
338
- s.includes(o) || s.push(o);
339
- }), s), []);
337
+ const e = r.reduce((n, s) => (Object.keys(t ? K(s) : s).forEach((o) => {
338
+ n.includes(o) || n.push(o);
339
+ }), n), []);
340
340
  return [
341
341
  e.join(","),
342
- ...r.map((s) => e.map((n) => {
343
- const o = B(s, n), i = typeof o;
342
+ ...r.map((n) => e.map((s) => {
343
+ const o = B(n, s), i = typeof o;
344
344
  return i == "string" && o.includes(",") ? `"${o}"` : i == "object" ? `"${JSON.stringify(o)}"` : o;
345
345
  }).join(","))
346
346
  ].join(`
@@ -348,9 +348,9 @@ function Dt(r, t = !0) {
348
348
  }
349
349
  class b extends Promise {
350
350
  constructor(e) {
351
- super((s, n) => e(
352
- (o) => s(o),
351
+ super((n, s) => e(
353
352
  (o) => n(o),
353
+ (o) => s(o),
354
354
  (o) => this.progress = o
355
355
  ));
356
356
  c(this, "listeners", []);
@@ -360,21 +360,21 @@ class b extends Promise {
360
360
  return this._progress;
361
361
  }
362
362
  set progress(e) {
363
- e != this._progress && (this._progress = e, this.listeners.forEach((s) => s(e)));
363
+ e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
364
364
  }
365
365
  static from(e) {
366
- return e instanceof b ? e : new b((s, n) => e.then((...o) => s(...o)).catch((...o) => n(...o)));
366
+ return e instanceof b ? e : new b((n, s) => e.then((...o) => n(...o)).catch((...o) => s(...o)));
367
367
  }
368
368
  from(e) {
369
- const s = b.from(e);
370
- return this.onProgress((n) => s.progress = n), s;
369
+ const n = b.from(e);
370
+ return this.onProgress((s) => n.progress = s), n;
371
371
  }
372
372
  onProgress(e) {
373
373
  return this.listeners.push(e), this;
374
374
  }
375
- then(e, s) {
376
- const n = super.then(e, s);
377
- return this.from(n);
375
+ then(e, n) {
376
+ const s = super.then(e, n);
377
+ return this.from(s);
378
378
  }
379
379
  catch(e) {
380
380
  return this.from(super.catch(e));
@@ -384,11 +384,11 @@ class b extends Promise {
384
384
  }
385
385
  }
386
386
  function Mt(r, t) {
387
- r instanceof Blob || (r = new Blob(m(r)));
387
+ r instanceof Blob || (r = new Blob(S(r)));
388
388
  const e = URL.createObjectURL(r);
389
- ht(e, t), URL.revokeObjectURL(e);
389
+ ft(e, t), URL.revokeObjectURL(e);
390
390
  }
391
- function ht(r, t) {
391
+ function ft(r, t) {
392
392
  const e = document.createElement("a");
393
393
  e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
394
394
  }
@@ -406,9 +406,9 @@ function Pt(r, t = /* @__PURE__ */ new Date()) {
406
406
  return r ? r.replace("{{TIMESTAMP}}", e) : e;
407
407
  }
408
408
  function Gt(r) {
409
- return new b((t, e, s) => {
410
- const n = new XMLHttpRequest(), o = new FormData();
411
- r.files.forEach((i) => o.append("file", i)), n.withCredentials = !!r.withCredentials, n.upload.addEventListener("progress", (i) => i.lengthComputable ? s(i.loaded / i.total) : null), n.addEventListener("loadend", () => t(I(n.responseText))), n.addEventListener("error", () => e(I(n.responseText))), n.addEventListener("timeout", () => e({ error: "Request timed out" })), n.open("POST", r.url), Object.entries(r.headers || {}).forEach(([i, a]) => n.setRequestHeader(i, a)), n.send(o);
409
+ return new b((t, e, n) => {
410
+ const s = new XMLHttpRequest(), o = new FormData();
411
+ 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(I(s.responseText))), s.addEventListener("error", () => e(I(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", r.url), Object.entries(r.headers || {}).forEach(([i, u]) => s.setRequestHeader(i, u)), s.send(o);
412
412
  });
413
413
  }
414
414
  class W {
@@ -416,48 +416,48 @@ class W {
416
416
  c(this, "listeners", {});
417
417
  }
418
418
  static emit(t, ...e) {
419
- (this.listeners["*"] || []).forEach((s) => s(t, ...e)), (this.listeners[t.toString()] || []).forEach((s) => s(...e));
419
+ (this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t.toString()] || []).forEach((n) => n(...e));
420
420
  }
421
421
  static off(t, e) {
422
- const s = t.toString();
423
- this.listeners[s] = (this.listeners[s] || []).filter((n) => n === e);
422
+ const n = t.toString();
423
+ this.listeners[n] = (this.listeners[n] || []).filter((s) => s === e);
424
424
  }
425
425
  static on(t, e) {
426
- var n;
427
- const s = t.toString();
428
- return this.listeners[s] || (this.listeners[s] = []), (n = this.listeners[s]) == null || n.push(e), () => this.off(t, e);
426
+ var s;
427
+ const n = t.toString();
428
+ return this.listeners[n] || (this.listeners[n] = []), (s = this.listeners[n]) == null || s.push(e), () => this.off(t, e);
429
429
  }
430
430
  static once(t, e) {
431
- return new Promise((s) => {
432
- const n = this.on(t, (...o) => {
433
- s(o.length == 1 ? o[0] : o), e && e(...o), n();
431
+ return new Promise((n) => {
432
+ const s = this.on(t, (...o) => {
433
+ n(o.length == 1 ? o[0] : o), e && e(...o), s();
434
434
  });
435
435
  });
436
436
  }
437
437
  emit(t, ...e) {
438
- (this.listeners["*"] || []).forEach((s) => s(t, ...e)), (this.listeners[t] || []).forEach((s) => s(...e));
438
+ (this.listeners["*"] || []).forEach((n) => n(t, ...e)), (this.listeners[t] || []).forEach((n) => n(...e));
439
439
  }
440
440
  off(t, e) {
441
- this.listeners[t] = (this.listeners[t] || []).filter((s) => s === e);
441
+ this.listeners[t] = (this.listeners[t] || []).filter((n) => n === e);
442
442
  }
443
443
  on(t, e) {
444
- var s;
445
- return this.listeners[t] || (this.listeners[t] = []), (s = this.listeners[t]) == null || s.push(e), () => this.off(t, e);
444
+ var n;
445
+ return this.listeners[t] || (this.listeners[t] = []), (n = this.listeners[t]) == null || n.push(e), () => this.off(t, e);
446
446
  }
447
447
  once(t, e) {
448
- return new Promise((s) => {
449
- const n = this.on(t, (...o) => {
450
- s(o.length == 1 ? o[0] : o), e && e(...o), n();
448
+ return new Promise((n) => {
449
+ const s = this.on(t, (...o) => {
450
+ n(o.length == 1 ? o[0] : o), e && e(...o), s();
451
451
  });
452
452
  });
453
453
  }
454
454
  }
455
455
  c(W, "listeners", {});
456
- class g extends Error {
457
- constructor(e, s) {
456
+ class m extends Error {
457
+ constructor(e, n) {
458
458
  super(e);
459
459
  c(this, "_code");
460
- s != null && (this._code = s);
460
+ n != null && (this._code = n);
461
461
  }
462
462
  get code() {
463
463
  return this._code || this.constructor.code;
@@ -466,11 +466,11 @@ class g extends Error {
466
466
  this._code = e;
467
467
  }
468
468
  static from(e) {
469
- const s = Number(e.statusCode) ?? Number(e.code), n = new this(e.message || e.toString());
470
- return Object.assign(n, {
469
+ const n = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
470
+ return Object.assign(s, {
471
471
  stack: e.stack,
472
472
  ...e,
473
- code: s ?? void 0
473
+ code: n ?? void 0
474
474
  });
475
475
  }
476
476
  static instanceof(e) {
@@ -480,8 +480,8 @@ class g extends Error {
480
480
  return this.message || super.toString();
481
481
  }
482
482
  }
483
- c(g, "code", 500);
484
- class v extends g {
483
+ c(m, "code", 500);
484
+ class v extends m {
485
485
  constructor(t = "Bad Request") {
486
486
  super(t);
487
487
  }
@@ -490,7 +490,7 @@ class v extends g {
490
490
  }
491
491
  }
492
492
  c(v, "code", 400);
493
- class J extends g {
493
+ class J extends m {
494
494
  constructor(t = "Unauthorized") {
495
495
  super(t);
496
496
  }
@@ -499,7 +499,7 @@ class J extends g {
499
499
  }
500
500
  }
501
501
  c(J, "code", 401);
502
- class z extends g {
502
+ class z extends m {
503
503
  constructor(t = "Payment Required") {
504
504
  super(t);
505
505
  }
@@ -508,7 +508,7 @@ class z extends g {
508
508
  }
509
509
  }
510
510
  c(z, "code", 402);
511
- class Z extends g {
511
+ class Z extends m {
512
512
  constructor(t = "Forbidden") {
513
513
  super(t);
514
514
  }
@@ -517,7 +517,7 @@ class Z extends g {
517
517
  }
518
518
  }
519
519
  c(Z, "code", 403);
520
- class V extends g {
520
+ class V extends m {
521
521
  constructor(t = "Not Found") {
522
522
  super(t);
523
523
  }
@@ -526,7 +526,7 @@ class V extends g {
526
526
  }
527
527
  }
528
528
  c(V, "code", 404);
529
- class X extends g {
529
+ class X extends m {
530
530
  constructor(t = "Method Not Allowed") {
531
531
  super(t);
532
532
  }
@@ -535,7 +535,7 @@ class X extends g {
535
535
  }
536
536
  }
537
537
  c(X, "code", 405);
538
- class Q extends g {
538
+ class Q extends m {
539
539
  constructor(t = "Not Acceptable") {
540
540
  super(t);
541
541
  }
@@ -544,7 +544,7 @@ class Q extends g {
544
544
  }
545
545
  }
546
546
  c(Q, "code", 406);
547
- class _ extends g {
547
+ class _ extends m {
548
548
  constructor(t = "Internal Server Error") {
549
549
  super(t);
550
550
  }
@@ -553,7 +553,7 @@ class _ extends g {
553
553
  }
554
554
  }
555
555
  c(_, "code", 500);
556
- class tt extends g {
556
+ class tt extends m {
557
557
  constructor(t = "Not Implemented") {
558
558
  super(t);
559
559
  }
@@ -562,7 +562,7 @@ class tt extends g {
562
562
  }
563
563
  }
564
564
  c(tt, "code", 501);
565
- class et extends g {
565
+ class et extends m {
566
566
  constructor(t = "Bad Gateway") {
567
567
  super(t);
568
568
  }
@@ -571,7 +571,7 @@ class et extends g {
571
571
  }
572
572
  }
573
573
  c(et, "code", 502);
574
- class rt extends g {
574
+ class rt extends m {
575
575
  constructor(t = "Service Unavailable") {
576
576
  super(t);
577
577
  }
@@ -580,7 +580,7 @@ class rt extends g {
580
580
  }
581
581
  }
582
582
  c(rt, "code", 503);
583
- class nt extends g {
583
+ class nt extends m {
584
584
  constructor(t = "Gateway Timeout") {
585
585
  super(t);
586
586
  }
@@ -617,7 +617,7 @@ function Ut(r, t) {
617
617
  case 504:
618
618
  return new nt(t);
619
619
  default:
620
- return new g(t, r);
620
+ return new m(t, r);
621
621
  }
622
622
  }
623
623
  const E = class E {
@@ -640,50 +640,50 @@ const E = class E {
640
640
  };
641
641
  }
642
642
  request(t = {}) {
643
- var n;
643
+ var s;
644
644
  if (!this.url && !t.url) throw new Error("URL needs to be set");
645
- let e = ((n = t.url) != null && n.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
645
+ let e = ((s = t.url) != null && s.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
646
646
  if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (o, i) => `#${t.fragment}${i}`) : e += "#" + t.fragment), t.query) {
647
647
  const o = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((i) => ({ key: i, value: t.query[i] }));
648
648
  e += (e.includes("?") ? "&" : "?") + o.map((i) => `${i.key}=${i.value}`).join("&");
649
649
  }
650
- const s = ct({
650
+ const n = ct({
651
651
  "Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
652
652
  ...E.headers,
653
653
  ...this.headers,
654
654
  ...t.headers
655
655
  });
656
- return typeof t.body == "object" && t.body != null && s["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new b((o, i, a) => {
656
+ return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new b((o, i, u) => {
657
657
  try {
658
658
  fetch(e, {
659
- headers: s,
659
+ headers: n,
660
660
  method: t.method || (t.body ? "POST" : "GET"),
661
661
  body: t.body
662
- }).then(async (u) => {
662
+ }).then(async (a) => {
663
663
  var G, U;
664
664
  for (let l of [...Object.values(E.interceptors), ...Object.values(this.interceptors)])
665
- await new Promise((C) => l(u, () => C()));
666
- const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
665
+ await new Promise((C) => l(a, () => C()));
666
+ const $ = a.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
667
667
  let P = 0;
668
- const T = (G = u.body) == null ? void 0 : G.getReader(), st = new ReadableStream({
668
+ const T = (G = a.body) == null ? void 0 : G.getReader(), st = new ReadableStream({
669
669
  start(l) {
670
670
  function C() {
671
671
  T == null || T.read().then((A) => {
672
672
  if (A.done) return l.close();
673
- P += A.value.byteLength, a(P / j), l.enqueue(A.value), C();
673
+ P += A.value.byteLength, u(P / j), l.enqueue(A.value), C();
674
674
  }).catch((A) => l.error(A));
675
675
  }
676
676
  C();
677
677
  }
678
678
  });
679
- if (u.data = new Response(st), t.decode == null || t.decode) {
680
- const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
681
- 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());
679
+ if (a.data = new Response(st), t.decode == null || t.decode) {
680
+ const l = (U = a.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
681
+ l != null && l.includes("form") ? a.data = await a.data.formData() : l != null && l.includes("json") ? a.data = await a.data.json() : l != null && l.includes("text") ? a.data = await a.data.text() : l != null && l.includes("application") && (a.data = await a.data.blob());
682
682
  }
683
- u.ok ? o(u) : i(u);
684
- }).catch((u) => i(u));
685
- } catch (u) {
686
- i(u);
683
+ a.ok ? o(a) : i(a);
684
+ }).catch((a) => i(a));
685
+ } catch (a) {
686
+ i(a);
687
687
  }
688
688
  });
689
689
  }
@@ -733,49 +733,49 @@ const R = {
733
733
  GREY: "\x1B[100m"
734
734
  };
735
735
  var dt = /* @__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))(dt || {});
736
- const w = class w extends W {
736
+ const y = class y extends W {
737
737
  constructor(t) {
738
738
  super(), this.namespace = t;
739
739
  }
740
740
  format(...t) {
741
741
  const e = /* @__PURE__ */ new Date();
742
- return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}:${e.getSeconds().toString().padStart(2, "0")}.${e.getMilliseconds().toString().padEnd(3, "0")}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.map((n) => typeof n == "string" ? n : at(n, 2)).join(" ")}`;
742
+ return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}:${e.getSeconds().toString().padStart(2, "0")}.${e.getMilliseconds().toString().padEnd(3, "0")}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.map((s) => typeof s == "string" ? s : ut(s, 2)).join(" ")}`;
743
743
  }
744
744
  debug(...t) {
745
- if (w.LOG_LEVEL < 4) return;
745
+ if (y.LOG_LEVEL < 4) return;
746
746
  const e = this.format(...t);
747
- w.emit(4, e), console.debug(L.LIGHT_GREY + e + R.CLEAR);
747
+ y.emit(4, e), console.debug(L.LIGHT_GREY + e + R.CLEAR);
748
748
  }
749
749
  log(...t) {
750
- if (w.LOG_LEVEL < 3) return;
750
+ if (y.LOG_LEVEL < 3) return;
751
751
  const e = this.format(...t);
752
- w.emit(3, e), console.log(R.CLEAR + e);
752
+ y.emit(3, e), console.log(R.CLEAR + e);
753
753
  }
754
754
  info(...t) {
755
- if (w.LOG_LEVEL < 2) return;
755
+ if (y.LOG_LEVEL < 2) return;
756
756
  const e = this.format(...t);
757
- w.emit(2, e), console.info(L.BLUE + e + R.CLEAR);
757
+ y.emit(2, e), console.info(L.BLUE + e + R.CLEAR);
758
758
  }
759
759
  warn(...t) {
760
- if (w.LOG_LEVEL < 1) return;
760
+ if (y.LOG_LEVEL < 1) return;
761
761
  const e = this.format(...t);
762
- w.emit(1, e), console.warn(L.YELLOW + e + R.CLEAR);
762
+ y.emit(1, e), console.warn(L.YELLOW + e + R.CLEAR);
763
763
  }
764
764
  error(...t) {
765
- if (w.LOG_LEVEL < 0) return;
765
+ if (y.LOG_LEVEL < 0) return;
766
766
  const e = this.format(...t);
767
- w.emit(0, e), console.error(L.RED + e + R.CLEAR);
767
+ y.emit(0, e), console.error(L.RED + e + R.CLEAR);
768
768
  }
769
769
  };
770
- c(w, "LOG_LEVEL", 4);
771
- let Y = w;
770
+ c(y, "LOG_LEVEL", 4);
771
+ let Y = y;
772
772
  function Yt(r) {
773
- const t = (a, u) => u < 1e-7 ? a : t(u, ~~(a % u)), e = r.toString().length - 2;
774
- let s = Math.pow(10, e), n = r * s;
775
- const o = t(n, s);
776
- n = ~~(n / o), s = ~~(s / o);
777
- const i = ~~(n / s);
778
- return n -= i * s, `${i ? i + " " : ""}${~~n}/${~~s}`;
773
+ const t = (u, a) => a < 1e-7 ? u : t(a, ~~(u % a)), e = r.toString().length - 2;
774
+ let n = Math.pow(10, e), s = r * n;
775
+ const o = t(s, n);
776
+ s = ~~(s / o), n = ~~(n / o);
777
+ const i = ~~(s / n);
778
+ return s -= i * n, `${i ? i + " " : ""}${~~s}/${~~n}`;
779
779
  }
780
780
  function Ht(r) {
781
781
  let t = r.split(" ");
@@ -785,8 +785,8 @@ function Ht(r) {
785
785
  const D = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", M = "0123456789", k = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", pt = D + M + k;
786
786
  function Kt(r, t = 2) {
787
787
  if (r === 0) return "0 Bytes";
788
- const e = 1024, s = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], n = Math.floor(Math.log(r) / Math.log(e));
789
- return parseFloat((r / Math.pow(e, n)).toFixed(t)) + " " + s[n];
788
+ const e = 1024, n = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], s = Math.floor(Math.log(r) / Math.log(e));
789
+ return parseFloat((r / Math.pow(e, s)).toFixed(t)) + " " + n[s];
790
790
  }
791
791
  function Wt(r) {
792
792
  const t = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(r);
@@ -796,8 +796,8 @@ function Wt(r) {
796
796
  function vt(r, t, e) {
797
797
  return `${r.slice(0, e)}${t}${r.slice(e + 1)}`;
798
798
  }
799
- function Jt(r, t, e = " ", s = !0) {
800
- return s ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
799
+ function Jt(r, t, e = " ", n = !0) {
800
+ return n ? r.toString().padStart(t, e) : r.toString().padEnd(t, e);
801
801
  }
802
802
  function zt(r) {
803
803
  return Array(r).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
@@ -808,78 +808,78 @@ function Zt(r, t = pt) {
808
808
  return t[e];
809
809
  }).join("");
810
810
  }
811
- function Vt(r, t = !1, e = !1, s = !1) {
812
- if (!t && !e && !s) throw new Error("Must enable at least one: letters, numbers, symbols");
811
+ function Vt(r, t = !1, e = !1, n = !1) {
812
+ if (!t && !e && !n) throw new Error("Must enable at least one: letters, numbers, symbols");
813
813
  return Array(r).fill(null).map(() => {
814
- let n;
814
+ let s;
815
815
  do {
816
816
  const o = ~~(Math.random() * 3);
817
- t && o == 0 ? n = D[~~(Math.random() * D.length)] : e && o == 1 ? n = M[~~(Math.random() * M.length)] : s && o == 2 && (n = k[~~(Math.random() * k.length)]);
818
- } while (!n);
819
- return n;
817
+ t && o == 0 ? s = D[~~(Math.random() * D.length)] : e && o == 1 ? s = M[~~(Math.random() * M.length)] : n && o == 2 && (s = k[~~(Math.random() * k.length)]);
818
+ } while (!s);
819
+ return s;
820
820
  }).join("");
821
821
  }
822
822
  function Xt(r, t) {
823
823
  if (typeof t == "string" && (t = new RegExp(t, "g")), !t.global)
824
824
  throw new TypeError("Regular expression must be global.");
825
- let e = [], s;
826
- for (; (s = t.exec(r)) !== null; )
827
- e.push(s);
825
+ let e = [], n;
826
+ for (; (n = t.exec(r)) !== null; )
827
+ e.push(n);
828
828
  return e;
829
829
  }
830
830
  function Qt(r) {
831
831
  const t = new RegExp(
832
832
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
833
833
  "gm"
834
- ).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, s = e.domain.split(".");
835
- if (e.port != null && (e.port = Number(e.port)), s.length > 2 && (e.domain = s.splice(-2, 2).join("."), e.subdomain = s.join(".")), e.query) {
836
- const n = e.query.split("&"), o = {};
837
- n.forEach((i) => {
838
- const [a, u] = i.split("=");
839
- o[a] = u;
834
+ ).exec(r), e = (t == null ? void 0 : t.groups) ?? {}, n = e.domain.split(".");
835
+ 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) {
836
+ const s = e.query.split("&"), o = {};
837
+ s.forEach((i) => {
838
+ const [u, a] = i.split("=");
839
+ o[u] = a;
840
840
  }), e.query = o;
841
841
  }
842
842
  return e;
843
843
  }
844
- function yt(r) {
845
- var t = gt(Et(mt(wt(r), 8 * r.length)));
844
+ function gt(r) {
845
+ var t = mt(wt(Et(yt(r), 8 * r.length)));
846
846
  return t.toLowerCase();
847
847
  }
848
- function gt(r) {
849
- for (var t, e = "0123456789ABCDEF", s = "", n = 0; n < r.length; n++) t = r.charCodeAt(n), s += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
850
- return s;
848
+ function mt(r) {
849
+ 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);
850
+ return n;
851
851
  }
852
- function wt(r) {
852
+ function yt(r) {
853
853
  for (var t = Array(r.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
854
854
  for (e = 0; e < 8 * r.length; e += 8) t[e >> 5] |= (255 & r.charCodeAt(e / 8)) << e % 32;
855
855
  return t;
856
856
  }
857
- function Et(r) {
857
+ function wt(r) {
858
858
  for (var t = "", e = 0; e < 32 * r.length; e += 8) t += String.fromCharCode(r[e >> 5] >>> e % 32 & 255);
859
859
  return t;
860
860
  }
861
- function mt(r, t) {
861
+ function Et(r, t) {
862
862
  r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t;
863
- for (var e = 1732584193, s = -271733879, n = -1732584194, o = 271733878, i = 0; i < r.length; i += 16) {
864
- var a = e, u = s, $ = n, j = o;
865
- s = p(s = p(s = p(s = p(s = d(s = d(s = d(s = d(s = h(s = h(s = h(s = h(s = f(s = f(s = f(s = f(s, n = f(n, o = f(o, e = f(e, s, n, o, r[i + 0], 7, -680876936), s, n, r[i + 1], 12, -389564586), e, s, r[i + 2], 17, 606105819), o, e, r[i + 3], 22, -1044525330), n = f(n, o = f(o, e = f(e, s, n, o, r[i + 4], 7, -176418897), s, n, r[i + 5], 12, 1200080426), e, s, r[i + 6], 17, -1473231341), o, e, r[i + 7], 22, -45705983), n = f(n, o = f(o, e = f(e, s, n, o, r[i + 8], 7, 1770035416), s, n, r[i + 9], 12, -1958414417), e, s, r[i + 10], 17, -42063), o, e, r[i + 11], 22, -1990404162), n = f(n, o = f(o, e = f(e, s, n, o, r[i + 12], 7, 1804603682), s, n, r[i + 13], 12, -40341101), e, s, r[i + 14], 17, -1502002290), o, e, r[i + 15], 22, 1236535329), n = h(n, o = h(o, e = h(e, s, n, o, r[i + 1], 5, -165796510), s, n, r[i + 6], 9, -1069501632), e, s, r[i + 11], 14, 643717713), o, e, r[i + 0], 20, -373897302), n = h(n, o = h(o, e = h(e, s, n, o, r[i + 5], 5, -701558691), s, n, r[i + 10], 9, 38016083), e, s, r[i + 15], 14, -660478335), o, e, r[i + 4], 20, -405537848), n = h(n, o = h(o, e = h(e, s, n, o, r[i + 9], 5, 568446438), s, n, r[i + 14], 9, -1019803690), e, s, r[i + 3], 14, -187363961), o, e, r[i + 8], 20, 1163531501), n = h(n, o = h(o, e = h(e, s, n, o, r[i + 13], 5, -1444681467), s, n, r[i + 2], 9, -51403784), e, s, r[i + 7], 14, 1735328473), o, e, r[i + 12], 20, -1926607734), n = d(n, o = d(o, e = d(e, s, n, o, r[i + 5], 4, -378558), s, n, r[i + 8], 11, -2022574463), e, s, r[i + 11], 16, 1839030562), o, e, r[i + 14], 23, -35309556), n = d(n, o = d(o, e = d(e, s, n, o, r[i + 1], 4, -1530992060), s, n, r[i + 4], 11, 1272893353), e, s, r[i + 7], 16, -155497632), o, e, r[i + 10], 23, -1094730640), n = d(n, o = d(o, e = d(e, s, n, o, r[i + 13], 4, 681279174), s, n, r[i + 0], 11, -358537222), e, s, r[i + 3], 16, -722521979), o, e, r[i + 6], 23, 76029189), n = d(n, o = d(o, e = d(e, s, n, o, r[i + 9], 4, -640364487), s, n, r[i + 12], 11, -421815835), e, s, r[i + 15], 16, 530742520), o, e, r[i + 2], 23, -995338651), n = p(n, o = p(o, e = p(e, s, n, o, r[i + 0], 6, -198630844), s, n, r[i + 7], 10, 1126891415), e, s, r[i + 14], 15, -1416354905), o, e, r[i + 5], 21, -57434055), n = p(n, o = p(o, e = p(e, s, n, o, r[i + 12], 6, 1700485571), s, n, r[i + 3], 10, -1894986606), e, s, r[i + 10], 15, -1051523), o, e, r[i + 1], 21, -2054922799), n = p(n, o = p(o, e = p(e, s, n, o, r[i + 8], 6, 1873313359), s, n, r[i + 15], 10, -30611744), e, s, r[i + 6], 15, -1560198380), o, e, r[i + 13], 21, 1309151649), n = p(n, o = p(o, e = p(e, s, n, o, r[i + 4], 6, -145523070), s, n, r[i + 11], 10, -1120210379), e, s, r[i + 2], 15, 718787259), o, e, r[i + 9], 21, -343485551), e = x(e, a), s = x(s, u), n = x(n, $), o = x(o, j);
863
+ for (var e = 1732584193, n = -271733879, s = -1732584194, o = 271733878, i = 0; i < r.length; i += 16) {
864
+ var u = e, a = n, $ = s, j = o;
865
+ n = p(n = p(n = p(n = p(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 = p(s, o = p(o, e = p(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 = p(s, o = p(o, e = p(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 = p(s, o = p(o, e = p(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 = p(s, o = p(o, e = p(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 = x(e, u), n = x(n, a), s = x(s, $), o = x(o, j);
866
866
  }
867
- return Array(e, s, n, o);
867
+ return Array(e, n, s, o);
868
868
  }
869
- function N(r, t, e, s, n, o) {
870
- return x(St(x(x(t, r), x(s, o)), n), e);
869
+ function N(r, t, e, n, s, o) {
870
+ return x(St(x(x(t, r), x(n, o)), s), e);
871
871
  }
872
- function f(r, t, e, s, n, o, i) {
873
- return N(t & e | ~t & s, r, t, n, o, i);
872
+ function h(r, t, e, n, s, o, i) {
873
+ return N(t & e | ~t & n, r, t, s, o, i);
874
874
  }
875
- function h(r, t, e, s, n, o, i) {
876
- return N(t & s | e & ~s, r, t, n, o, i);
875
+ function f(r, t, e, n, s, o, i) {
876
+ return N(t & n | e & ~n, r, t, s, o, i);
877
877
  }
878
- function d(r, t, e, s, n, o, i) {
879
- return N(t ^ e ^ s, r, t, n, o, i);
878
+ function d(r, t, e, n, s, o, i) {
879
+ return N(t ^ e ^ n, r, t, s, o, i);
880
880
  }
881
- function p(r, t, e, s, n, o, i) {
882
- return N(e ^ (t | ~s), r, t, n, o, i);
881
+ function p(r, t, e, n, s, o, i) {
882
+ return N(e ^ (t | ~n), r, t, s, o, i);
883
883
  }
884
884
  function x(r, t) {
885
885
  var e = (65535 & r) + (65535 & t);
@@ -892,27 +892,27 @@ function _t(r) {
892
892
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(r);
893
893
  }
894
894
  function te(r, t = "mp") {
895
- return r ? `https://www.gravatar.com/avatar/${yt(r)}?d=${t}` : "";
895
+ return r ? `https://www.gravatar.com/avatar/${gt(r)}?d=${t}` : "";
896
896
  }
897
897
  function ee(r) {
898
898
  return r.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
899
899
  }
900
900
  function re(r, ...t) {
901
901
  const e = [];
902
- for (let s = 0; s < r.length || s < t.length; s++)
903
- r[s] && e.push(r[s]), t[s] && e.push(t[s]);
904
- return new y(e.join(""));
902
+ for (let n = 0; n < r.length || n < t.length; n++)
903
+ r[n] && e.push(r[n]), t[n] && e.push(t[n]);
904
+ return new g(e.join(""));
905
905
  }
906
906
  function xt(r, ...t) {
907
907
  let e = [];
908
908
  for (let o = 0; o < r.length || o < t.length; o++)
909
909
  r[o] && e.push(r[o]), t[o] && e.push(t[o]);
910
- const [s, n] = e.join("").split(":");
911
- return y.toString(s, n == null ? void 0 : n.split(""));
910
+ const [n, s] = e.join("").split(":");
911
+ return g.toString(n, s == null ? void 0 : s.split(""));
912
912
  }
913
913
  class H extends Error {
914
914
  }
915
- class y {
915
+ class g {
916
916
  constructor(t) {
917
917
  /** First directory in path */
918
918
  c(this, "module");
@@ -924,24 +924,54 @@ class y {
924
924
  c(this, "name");
925
925
  /** List of methods */
926
926
  c(this, "methods");
927
- /** All/Wildcard specified */
928
- c(this, "all");
929
- /** None specified */
930
- c(this, "none");
931
- /** Create method specified */
932
- c(this, "create");
933
- /** Read method specified */
934
- c(this, "read");
935
- /** Update method specified */
936
- c(this, "update");
937
- /** Delete method specified */
938
- c(this, "delete");
939
927
  var i;
940
928
  if (typeof t == "object") return Object.assign(this, t);
941
- let [e, s, n] = t.split(":");
942
- n || (n = s || "*"), (e == "*" || !e && n == "*") && (e = "", n = "*");
943
- let o = e.split("/").filter((a) => !!a);
944
- this.module = ((i = o.splice(0, 1)[0]) == null ? void 0 : i.toLowerCase()) || "", this.fullPath = e, this.path = o.join("/"), this.name = o.pop() || "", this.methods = n.split(""), this.all = n == null ? void 0 : n.includes("*"), this.none = n == null ? void 0 : n.includes("n"), this.create = !(n != null && n.includes("n")) && ((n == null ? void 0 : n.includes("*")) || (n == null ? void 0 : n.includes("w")) || (n == null ? void 0 : n.includes("c"))), this.read = !(n != null && n.includes("n")) && ((n == null ? void 0 : n.includes("*")) || (n == null ? void 0 : n.includes("r"))), this.update = !(n != null && n.includes("n")) && ((n == null ? void 0 : n.includes("*")) || (n == null ? void 0 : n.includes("w")) || (n == null ? void 0 : n.includes("u"))), this.delete = !(n != null && n.includes("n")) && ((n == null ? void 0 : n.includes("*")) || (n == null ? void 0 : n.includes("w")) || (n == null ? void 0 : n.includes("d")));
929
+ let [e, n, s] = t.split(":");
930
+ s || (s = n || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
931
+ let o = e.split("/").filter((u) => !!u);
932
+ this.module = ((i = o.splice(0, 1)[0]) == null ? void 0 : i.toLowerCase()) || "", this.fullPath = e, this.path = o.join("/"), this.name = o.pop() || "", this.methods = new w(s.split(""));
933
+ }
934
+ /** All/Wildcard specified */
935
+ get all() {
936
+ return this.methods.has("*");
937
+ }
938
+ set all(t) {
939
+ t ? new w(["*"]) : this.methods.delete("*");
940
+ }
941
+ /** None specified */
942
+ get none() {
943
+ return this.methods.has("n");
944
+ }
945
+ set none(t) {
946
+ t ? this.methods = new w(["n"]) : this.methods.delete("n");
947
+ }
948
+ /** Create method specified */
949
+ get create() {
950
+ return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("c"));
951
+ }
952
+ set create(t) {
953
+ t ? this.methods.delete("n").add("c") : this.methods.delete("c");
954
+ }
955
+ /** Read method specified */
956
+ get read() {
957
+ return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("r"));
958
+ }
959
+ set read(t) {
960
+ t ? this.methods.delete("n").add("r") : this.methods.delete("r");
961
+ }
962
+ /** Update method specified */
963
+ get update() {
964
+ return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("u"));
965
+ }
966
+ set update(t) {
967
+ t ? this.methods.delete("n").add("u") : this.methods.delete("u");
968
+ }
969
+ /** Delete method specified */
970
+ get delete() {
971
+ return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("d"));
972
+ }
973
+ set delete(t) {
974
+ t ? this.methods.delete("n").add("d") : this.methods.delete("d");
945
975
  }
946
976
  /**
947
977
  * Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
@@ -952,11 +982,11 @@ class y {
952
982
  */
953
983
  static combine(t) {
954
984
  let e = !1;
955
- const s = t.map((n) => new y(n)).toSorted((n, o) => {
956
- const i = n.fullPath.length, a = o.fullPath.length;
957
- return i < a ? 1 : i > a ? -1 : 0;
958
- }).reduce((n, o) => (o.none && (e = !0), n ? (e || (o.all && (n.all = !0), (o.all || o.create) && (n.create = !0), (o.all || o.read) && (n.read = !0), (o.all || o.update) && (n.update = !0), (o.all || o.delete) && (n.delete = !0), n.methods = [...n.methods, ...o.methods]), n) : o), null);
959
- return s.all && (s.methods = ["*"]), s.none && (s.methods = ["n"]), s.methods = new S(s.methods), s.raw = xt`${s.fullPath}:${s.methods}`, s;
985
+ const n = t.map((s) => new g(s)).toSorted((s, o) => {
986
+ const i = s.fullPath.length, u = o.fullPath.length;
987
+ return i < u ? 1 : i > u ? -1 : 0;
988
+ }).reduce((s, o) => (o.none && (e = !0), s ? (e || (o.all && (s.all = !0), (o.all || o.create) && (s.create = !0), (o.all || o.read) && (s.read = !0), (o.all || o.update) && (s.update = !0), (o.all || o.delete) && (s.delete = !0), s.methods = [...s.methods, ...o.methods]), s) : o), null);
989
+ return n.all && (n.methods = ["*"]), n.none && (n.methods = ["n"]), n.methods = new w(n.methods), n.raw = xt`${n.fullPath}:${n.methods}`, n;
960
990
  }
961
991
  /**
962
992
  * Squash 2 sets of paths & return true if any overlap is found
@@ -966,13 +996,13 @@ class y {
966
996
  * @return {boolean} Whether there is any overlap
967
997
  */
968
998
  static has(t, ...e) {
969
- const s = m(e).map((o) => new y(o)), n = m(t).map((o) => new y(o));
970
- return !!s.find((o) => {
999
+ const n = S(e).map((o) => new g(o)), s = S(t).map((o) => new g(o));
1000
+ return !!n.find((o) => {
971
1001
  if (!o.fullPath && o.all) return !0;
972
- const i = n.filter((u) => o.fullPath.startsWith(u.fullPath));
1002
+ const i = s.filter((a) => o.fullPath.startsWith(a.fullPath));
973
1003
  if (!i.length) return !1;
974
- const a = y.combine(i);
975
- return !a.none && (a.all || new S(a.methods).intersection(new S(o.methods)).length);
1004
+ const u = g.combine(i);
1005
+ return !u.none && (u.all || new w(u.methods).intersection(new w(o.methods)).length);
976
1006
  });
977
1007
  }
978
1008
  /**
@@ -983,7 +1013,7 @@ class y {
983
1013
  * @return {boolean} Whether there is any overlap
984
1014
  */
985
1015
  static hasAll(t, ...e) {
986
- return e.filter((s) => y.has(t, s)).length == e.length;
1016
+ return e.filter((n) => g.has(t, n)).length == e.length;
987
1017
  }
988
1018
  /**
989
1019
  * Same as `has` but raises an error if there is no overlap
@@ -992,7 +1022,7 @@ class y {
992
1022
  * @param has Target must have at least one of these path
993
1023
  */
994
1024
  static hasFatal(t, ...e) {
995
- if (!y.has(t, ...e)) throw new H(`Requires one of: ${m(e).join(", ")}`);
1025
+ if (!g.has(t, ...e)) throw new H(`Requires one of: ${S(e).join(", ")}`);
996
1026
  }
997
1027
  /**
998
1028
  * Same as `hasAll` but raises an error if the target is missing any paths
@@ -1001,7 +1031,7 @@ class y {
1001
1031
  * @param has Target must have all these paths
1002
1032
  */
1003
1033
  static hasAllFatal(t, ...e) {
1004
- if (!y.hasAll(t, ...e)) throw new H(`Requires all: ${m(e).join(", ")}`);
1034
+ if (!g.hasAll(t, ...e)) throw new H(`Requires all: ${S(e).join(", ")}`);
1005
1035
  }
1006
1036
  /**
1007
1037
  * Create event string from its components
@@ -1011,8 +1041,8 @@ class y {
1011
1041
  * @return {string} String representation of Event
1012
1042
  */
1013
1043
  static toString(t, e) {
1014
- let s = m(t).filter((n) => n != null).join("/");
1015
- return e != null && e.length && (s += `:${m(e).map((n) => n.toLowerCase()).join("")}`), s == null ? void 0 : s.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
1044
+ let n = S(t).filter((s) => s != null).join("/");
1045
+ return e != null && e.length && (n += `:${S(e).map((s) => s.toLowerCase()).join("")}`), n == null ? void 0 : n.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
1016
1046
  }
1017
1047
  /**
1018
1048
  * Create event string from its components
@@ -1020,7 +1050,7 @@ class y {
1020
1050
  * @return {string} String representation of Event
1021
1051
  */
1022
1052
  toString() {
1023
- return y.toString(this.fullPath, this.methods);
1053
+ return g.toString(this.fullPath, this.methods);
1024
1054
  }
1025
1055
  }
1026
1056
  class ne {
@@ -1028,24 +1058,24 @@ class ne {
1028
1058
  c(this, "listeners", []);
1029
1059
  }
1030
1060
  emit(t, ...e) {
1031
- const s = new y(t);
1032
- this.listeners.filter((n) => y.has(n[0], t)).forEach(async (n) => n[1](s, ...e));
1061
+ const n = new g(t);
1062
+ this.listeners.filter((s) => g.has(s[0], t)).forEach(async (s) => s[1](n, ...e));
1033
1063
  }
1034
1064
  off(t) {
1035
1065
  this.listeners = this.listeners.filter((e) => e[1] != t);
1036
1066
  }
1037
1067
  on(t, e) {
1038
- return m(t).forEach((s) => this.listeners.push([new y(s), e])), () => this.off(e);
1068
+ return S(t).forEach((n) => this.listeners.push([new g(n), e])), () => this.off(e);
1039
1069
  }
1040
1070
  once(t, e) {
1041
- return new Promise((s) => {
1042
- const n = this.on(t, (o, ...i) => {
1043
- s(i.length < 2 ? i[0] : i), e && e(o, ...i), n();
1071
+ return new Promise((n) => {
1072
+ const s = this.on(t, (o, ...i) => {
1073
+ n(i.length < 2 ? i[0] : i), e && e(o, ...i), s();
1044
1074
  });
1045
1075
  });
1046
1076
  }
1047
1077
  relayEvents(t) {
1048
- t.on("*", (e, ...s) => this.emit(e, ...s));
1078
+ t.on("*", (e, ...n) => this.emit(e, ...n));
1049
1079
  }
1050
1080
  }
1051
1081
  function se(r) {
@@ -1066,20 +1096,20 @@ function ce() {
1066
1096
  return Object.keys({});
1067
1097
  }
1068
1098
  export {
1069
- S as ASet,
1099
+ w as ASet,
1070
1100
  et as BadGatewayError,
1071
1101
  v as BadRequestError,
1072
1102
  It as Cache,
1073
1103
  Ft as CliBackground,
1074
1104
  R as CliEffects,
1075
1105
  L as CliForeground,
1076
- g as CustomError,
1106
+ m as CustomError,
1077
1107
  Z as ForbiddenError,
1078
1108
  nt as GatewayTimeoutError,
1079
1109
  F as Http,
1080
1110
  _ as InternalServerError,
1081
1111
  I as JSONAttemptParse,
1082
- at as JSONSanitize,
1112
+ ut as JSONSanitize,
1083
1113
  dt as LOG_LEVEL,
1084
1114
  Y as Logger,
1085
1115
  X as MethodNotAllowedError,
@@ -1089,7 +1119,7 @@ export {
1089
1119
  re as PE,
1090
1120
  xt as PES,
1091
1121
  H as PathError,
1092
- y as PathEvent,
1122
+ g as PathEvent,
1093
1123
  ne as PathEventEmitter,
1094
1124
  z as PaymentRequiredError,
1095
1125
  b as PromiseProgress,
@@ -1103,10 +1133,10 @@ export {
1103
1133
  Dt as csv,
1104
1134
  Yt as dec2Frac,
1105
1135
  At as deepCopy,
1106
- ut as deepMerge,
1136
+ at as deepMerge,
1107
1137
  B as dotNotation,
1108
1138
  Mt as downloadFile,
1109
- ht as downloadUrl,
1139
+ ft as downloadUrl,
1110
1140
  Rt as encodeQuery,
1111
1141
  Ut as errorFromCode,
1112
1142
  ee as escapeRegex,
@@ -1124,10 +1154,10 @@ export {
1124
1154
  vt as insertAt,
1125
1155
  O as isEqual,
1126
1156
  qt as jwtDecode,
1127
- m as makeArray,
1128
- ft as makeUnique,
1157
+ S as makeArray,
1158
+ ht as makeUnique,
1129
1159
  Xt as matchAll,
1130
- yt as md5,
1160
+ gt as md5,
1131
1161
  $t as mixin,
1132
1162
  Jt as pad,
1133
1163
  Qt as parseUrl,