@ztimson/utils 0.15.0 → 0.15.2

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,6 +1,6 @@
1
1
  var v = Object.defineProperty;
2
2
  var F = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var a = (n, e, t) => (F(n, typeof e != "symbol" ? e + "" : e, t), t);
3
+ var u = (n, e, t) => (F(n, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  function W(n, e = !1) {
5
5
  if (n == null)
6
6
  throw new Error("Cannot clean a NULL value");
@@ -8,7 +8,7 @@ function W(n, e = !1) {
8
8
  (e && r === void 0 || !e && r == null) && delete n[t];
9
9
  }), n;
10
10
  }
11
- function ht(n) {
11
+ function ft(n) {
12
12
  return JSON.parse(JSON.stringify(n));
13
13
  }
14
14
  function J(n, ...e) {
@@ -37,7 +37,7 @@ function z(n, e, t = {}) {
37
37
  return t;
38
38
  }
39
39
  }
40
- function ft(n) {
40
+ function dt(n) {
41
41
  const e = new FormData();
42
42
  return Object.entries(n).forEach(([t, r]) => e.append(t, r)), e;
43
43
  }
@@ -53,7 +53,7 @@ function b(n, e) {
53
53
  const t = typeof n, r = typeof e;
54
54
  return t != "object" || n == null || r != "object" || e == null ? t == "function" && r == "function" ? n.toString() == e.toString() : n === e : Object.keys(n).length != Object.keys(e).length ? !1 : Object.keys(n).every((s) => b(n[s], e[s]));
55
55
  }
56
- function dt(n, e) {
56
+ function yt(n, e) {
57
57
  e.forEach((t) => {
58
58
  Object.getOwnPropertyNames(t.prototype).forEach((r) => {
59
59
  Object.defineProperty(
@@ -82,21 +82,21 @@ function pt(n, e) {
82
82
  return o;
83
83
  }, e));
84
84
  }
85
- function yt(n) {
85
+ function gt(n) {
86
86
  return Object.entries(n).map(
87
87
  ([e, t]) => encodeURIComponent(e) + "=" + encodeURIComponent(t)
88
88
  ).join("&");
89
89
  }
90
- function gt(n, e) {
90
+ function mt(n, e) {
91
91
  return n.indexOf(e) === -1 && n.push(e), n;
92
92
  }
93
- function mt(n, e) {
93
+ function Et(n, e) {
94
94
  return V([
95
95
  ...n.filter((t) => !e.includes((r) => b(t, r))),
96
96
  ...e.filter((t) => !n.includes((r) => b(t, r)))
97
97
  ]);
98
98
  }
99
- function Et(n) {
99
+ function wt(n) {
100
100
  return function(e, t) {
101
101
  const r = S(e, n), o = S(t, n);
102
102
  return typeof r != "string" || typeof o != "string" ? 1 : r.toLowerCase().localeCompare(o.toLowerCase());
@@ -105,13 +105,13 @@ function Et(n) {
105
105
  function K(n, e = []) {
106
106
  return n.forEach((t) => Array.isArray(t) ? K(t, e) : e.push(t)), e;
107
107
  }
108
- function wt(n, e = !1) {
108
+ function xt(n, e = !1) {
109
109
  return function(t, r) {
110
110
  const o = S(t, n), s = S(r, n);
111
111
  return typeof o == "number" && typeof s == "number" ? (e ? -1 : 1) * (o - s) : o > s ? e ? -1 : 1 : o < s ? e ? 1 : -1 : 0;
112
112
  };
113
113
  }
114
- function xt(n, e) {
114
+ function At(n, e) {
115
115
  return (t) => b(t[n], e);
116
116
  }
117
117
  function V(n) {
@@ -119,44 +119,97 @@ function V(n) {
119
119
  n.slice(0, e).find((t) => b(t, n[e])) && n.splice(e, 1);
120
120
  return n;
121
121
  }
122
- function At(n) {
122
+ function Bt(n) {
123
123
  return Array.isArray(n) ? n : [n];
124
124
  }
125
125
  class B extends Array {
126
+ /** Number of elements in set */
126
127
  get size() {
127
128
  return this.length;
128
129
  }
130
+ /**
131
+ * Array to create set from, duplicate values will be removed
132
+ * @param {T[]} elements Elements which will be added to set
133
+ */
129
134
  constructor(e = []) {
130
135
  super(), e != null && e.forEach && e.forEach((t) => this.add(t));
131
136
  }
137
+ /**
138
+ * Add single element to set if unique
139
+ * @param {T} el Element to add
140
+ */
132
141
  add(e) {
133
142
  this.has(e) || this.push(e);
134
143
  }
144
+ /**
145
+ * Delete element from set
146
+ * @param {T} el Element that will be deleted
147
+ */
135
148
  delete(e) {
136
149
  const t = this.indexOf(e);
137
150
  t != -1 && this.slice(t, 1);
138
151
  }
152
+ /**
153
+ * Create list of elements this set has which the comparison set does not
154
+ * @param {ASet<T>} set Set to compare against
155
+ * @return {ASet<T>} Different elements
156
+ */
139
157
  difference(e) {
140
- return new B(this.reduce((t, r) => (e.has(r) || t.push(r), t), []));
158
+ return new B(this.filter((t) => !e.has(t)));
141
159
  }
160
+ /**
161
+ * Check if set includes element
162
+ * @param {T} el Element to look for
163
+ * @return {boolean} True if element was found, false otherwise
164
+ */
142
165
  has(e) {
143
166
  return this.indexOf(e) != -1;
144
167
  }
168
+ /**
169
+ * Create list of elements this set has in common with the comparison set
170
+ * @param {ASet<T>} set Set to compare against
171
+ * @return {boolean} Set of common elements
172
+ */
145
173
  intersection(e) {
146
- return new B(this.reduce((t, r) => (e.has(r) && t.push(r), t), []));
174
+ return new B(this.filter((t) => e.has(t)));
147
175
  }
176
+ /**
177
+ * Check if this set has no elements in common with the comparison set
178
+ * @param {ASet<T>} set Set to compare against
179
+ * @return {boolean} True if nothing in common, false otherwise
180
+ */
148
181
  isDisjointFrom(e) {
149
182
  return this.intersection(e).size == 0;
150
183
  }
184
+ /**
185
+ * Check if all elements in this set are included in the comparison set
186
+ * @param {ASet<T>} set Set to compare against
187
+ * @return {boolean} True if all elements are included, false otherwise
188
+ */
151
189
  isSubsetOf(e) {
152
190
  return this.findIndex((t) => !e.has(t)) == -1;
153
191
  }
192
+ /**
193
+ * Check if all elements from comparison set are included in this set
194
+ * @param {ASet<T>} set Set to compare against
195
+ * @return {boolean} True if all elements are included, false otherwise
196
+ */
154
197
  isSuperset(e) {
155
198
  return e.findIndex((t) => !this.has(t)) == -1;
156
199
  }
200
+ /**
201
+ * Create list of elements that are only in one set but not both (XOR)
202
+ * @param {ASet<T>} set Set to compare against
203
+ * @return {ASet<T>} New set of unique elements
204
+ */
157
205
  symmetricDifference(e) {
158
206
  return new B([...this.difference(e), ...e.difference(this)]);
159
207
  }
208
+ /**
209
+ * Create joined list of elements included in this & the comparison set
210
+ * @param {ASet<T>} set Set join
211
+ * @return {ASet<T>} New set of both previous sets combined
212
+ */
160
213
  union(e) {
161
214
  return new B([...this, ...e]);
162
215
  }
@@ -168,8 +221,8 @@ class E extends Promise {
168
221
  (s) => o(s),
169
222
  (s) => this.progress = s
170
223
  ));
171
- a(this, "listeners", []);
172
- a(this, "_progress", 0);
224
+ u(this, "listeners", []);
225
+ u(this, "_progress", 0);
173
226
  }
174
227
  get progress() {
175
228
  return this._progress;
@@ -202,11 +255,11 @@ function Z(n, e) {
202
255
  const t = document.createElement("a");
203
256
  t.href = n, t.download = e, document.body.appendChild(t), t.click(), document.body.removeChild(t);
204
257
  }
205
- function Bt(n, e) {
258
+ function bt(n, e) {
206
259
  const t = URL.createObjectURL(n);
207
260
  Z(t, e), URL.revokeObjectURL(t);
208
261
  }
209
- function bt(n = {}) {
262
+ function Rt(n = {}) {
210
263
  return new Promise((e) => {
211
264
  const t = document.createElement("input");
212
265
  t.type = "file", t.accept = n.accept || "*", t.style.display = "none", t.multiple = !!n.multiple, t.onblur = t.onchange = async () => {
@@ -214,15 +267,15 @@ function bt(n = {}) {
214
267
  }, document.body.appendChild(t), t.click();
215
268
  });
216
269
  }
217
- function Rt(n) {
270
+ function Ot(n) {
218
271
  return new E((e, t, r) => {
219
272
  const o = new XMLHttpRequest(), s = new FormData();
220
- n.files.forEach((i) => s.append("file", i)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (i) => i.lengthComputable ? r(i.loaded / i.total) : null), o.addEventListener("loadend", () => e(q(o.responseText))), o.addEventListener("error", () => t(q(o.responseText))), o.addEventListener("timeout", () => t({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([i, p]) => o.setRequestHeader(i, p)), o.send(s);
273
+ n.files.forEach((i) => s.append("file", i)), o.withCredentials = !!n.withCredentials, o.upload.addEventListener("progress", (i) => i.lengthComputable ? r(i.loaded / i.total) : null), o.addEventListener("loadend", () => e(q(o.responseText))), o.addEventListener("error", () => t(q(o.responseText))), o.addEventListener("timeout", () => t({ error: "Request timed out" })), o.open("POST", n.url), Object.entries(n.headers || {}).forEach(([i, y]) => o.setRequestHeader(i, y)), o.send(s);
221
274
  });
222
275
  }
223
276
  class H {
224
277
  constructor() {
225
- a(this, "listeners", {});
278
+ u(this, "listeners", {});
226
279
  }
227
280
  static emit(e, ...t) {
228
281
  (this.listeners["*"] || []).forEach((r) => r(e, ...t)), (this.listeners[e.toString()] || []).forEach((r) => r(...t));
@@ -261,11 +314,11 @@ class H {
261
314
  });
262
315
  }
263
316
  }
264
- a(H, "listeners", {});
317
+ u(H, "listeners", {});
265
318
  class w extends Error {
266
319
  constructor(t, r) {
267
320
  super(t);
268
- a(this, "_code");
321
+ u(this, "_code");
269
322
  r != null && (this._code = r);
270
323
  }
271
324
  get code() {
@@ -289,7 +342,7 @@ class w extends Error {
289
342
  return this.message || super.toString();
290
343
  }
291
344
  }
292
- a(w, "code", 500);
345
+ u(w, "code", 500);
293
346
  class X extends w {
294
347
  constructor(e = "Bad Request") {
295
348
  super(e);
@@ -298,7 +351,7 @@ class X extends w {
298
351
  return e.constructor.code == this.code;
299
352
  }
300
353
  }
301
- a(X, "code", 400);
354
+ u(X, "code", 400);
302
355
  class Q extends w {
303
356
  constructor(e = "Unauthorized") {
304
357
  super(e);
@@ -307,7 +360,7 @@ class Q extends w {
307
360
  return e.constructor.code == this.code;
308
361
  }
309
362
  }
310
- a(Q, "code", 401);
363
+ u(Q, "code", 401);
311
364
  class _ extends w {
312
365
  constructor(e = "Forbidden") {
313
366
  super(e);
@@ -316,7 +369,7 @@ class _ extends w {
316
369
  return e.constructor.code == this.code;
317
370
  }
318
371
  }
319
- a(_, "code", 403);
372
+ u(_, "code", 403);
320
373
  class tt extends w {
321
374
  constructor(e = "Not Found") {
322
375
  super(e);
@@ -325,7 +378,7 @@ class tt extends w {
325
378
  return e.constructor.code == this.code;
326
379
  }
327
380
  }
328
- a(tt, "code", 404);
381
+ u(tt, "code", 404);
329
382
  class et extends w {
330
383
  constructor(e = "Internal Server Error") {
331
384
  super(e);
@@ -334,12 +387,12 @@ class et extends w {
334
387
  return e.constructor.code == this.code;
335
388
  }
336
389
  }
337
- a(et, "code", 500);
390
+ u(et, "code", 500);
338
391
  const g = class g {
339
392
  constructor(e = {}) {
340
- a(this, "interceptors", {});
341
- a(this, "headers", {});
342
- a(this, "url");
393
+ u(this, "interceptors", {});
394
+ u(this, "headers", {});
395
+ u(this, "url");
343
396
  this.url = e.url ?? null, this.headers = e.headers || {}, e.interceptors && e.interceptors.forEach((t) => g.addInterceptor(t));
344
397
  }
345
398
  static addInterceptor(e) {
@@ -369,39 +422,39 @@ const g = class g {
369
422
  ...this.headers,
370
423
  ...e.headers
371
424
  });
372
- return typeof e.body == "object" && e.body != null && r["Content-Type"] == "application/json" && (e.body = JSON.stringify(e.body)), new E((s, i, p) => {
425
+ return typeof e.body == "object" && e.body != null && r["Content-Type"] == "application/json" && (e.body = JSON.stringify(e.body)), new E((s, i, y) => {
373
426
  fetch(t, {
374
427
  headers: r,
375
428
  method: e.method || (e.body ? "POST" : "GET"),
376
429
  body: e.body
377
430
  }).then(async (c) => {
378
431
  var j, G;
379
- for (let u of [...Object.values(g.interceptors), ...Object.values(this.interceptors)])
380
- await new Promise((O) => u(c, () => O()));
432
+ for (let a of [...Object.values(g.interceptors), ...Object.values(this.interceptors)])
433
+ await new Promise((O) => a(c, () => O()));
381
434
  const R = c.headers.get("Content-Length"), N = R ? parseInt(R, 10) : 0;
382
435
  let k = 0;
383
436
  const T = (j = c.body) == null ? void 0 : j.getReader(), Y = new ReadableStream({
384
- start(u) {
437
+ start(a) {
385
438
  function O() {
386
439
  T == null || T.read().then((x) => {
387
440
  if (x.done)
388
- return u.close();
389
- k += x.value.byteLength, p(k / N), u.enqueue(x.value), O();
390
- }).catch((x) => u.error(x));
441
+ return a.close();
442
+ k += x.value.byteLength, y(k / N), a.enqueue(x.value), O();
443
+ }).catch((x) => a.error(x));
391
444
  }
392
445
  O();
393
446
  }
394
447
  });
395
448
  if (c.data = new Response(Y), e.decode == null || e.decode) {
396
- const u = (G = c.headers.get("Content-Type")) == null ? void 0 : G.toLowerCase();
397
- u != null && u.includes("form") ? c.data = await c.data.formData() : u != null && u.includes("json") ? c.data = await c.data.json() : u != null && u.includes("text") ? c.data = await c.data.text() : u != null && u.includes("application") && (c.data = await c.data.blob());
449
+ const a = (G = c.headers.get("Content-Type")) == null ? void 0 : G.toLowerCase();
450
+ a != null && a.includes("form") ? c.data = await c.data.formData() : a != null && a.includes("json") ? c.data = await c.data.json() : a != null && a.includes("text") ? c.data = await c.data.text() : a != null && a.includes("application") && (c.data = await c.data.blob());
398
451
  }
399
452
  c.ok ? s(c) : i(c);
400
453
  });
401
454
  });
402
455
  }
403
456
  };
404
- a(g, "interceptors", {}), a(g, "headers", {});
457
+ u(g, "interceptors", {}), u(g, "headers", {});
405
458
  let M = g;
406
459
  const A = {
407
460
  CLEAR: "\x1B[0m",
@@ -428,7 +481,7 @@ const A = {
428
481
  LIGHT_MAGENTA: "\x1B[95m",
429
482
  LIGHT_CYAN: "\x1B[96m",
430
483
  WHITE: "\x1B[97m"
431
- }, Ot = {
484
+ }, Lt = {
432
485
  BLACK: "\x1B[40m",
433
486
  RED: "\x1B[41m",
434
487
  GREEN: "\x1B[42m",
@@ -440,7 +493,7 @@ const A = {
440
493
  GREY: "\x1B[100m"
441
494
  };
442
495
  var nt = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(nt || {});
443
- const y = class y extends H {
496
+ const p = class p extends H {
444
497
  constructor(e) {
445
498
  super(), this.namespace = e;
446
499
  }
@@ -448,89 +501,89 @@ const y = class y extends H {
448
501
  const s = e.toString(), i = t - s.length;
449
502
  if (i <= 0)
450
503
  return s;
451
- const p = Array(~~(i / r.length)).fill(r).join("");
452
- return o ? s + p : p + s;
504
+ const y = Array(~~(i / r.length)).fill(r).join("");
505
+ return o ? s + y : y + s;
453
506
  }
454
507
  format(...e) {
455
508
  const t = /* @__PURE__ */ new Date();
456
509
  return `${`${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()} ${this.pad(t.getHours().toString(), 2, "0")}:${this.pad(t.getMinutes().toString(), 2, "0")}:${this.pad(t.getSeconds().toString(), 2, "0")}.${this.pad(t.getMilliseconds().toString(), 3, "0", !0)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${e.join(" ")}`;
457
510
  }
458
511
  debug(...e) {
459
- if (y.LOG_LEVEL < 4)
512
+ if (p.LOG_LEVEL < 4)
460
513
  return;
461
514
  const t = this.format(...e);
462
- y.emit(4, t), console.debug(L.LIGHT_GREY + t + A.CLEAR);
515
+ p.emit(4, t), console.debug(L.LIGHT_GREY + t + A.CLEAR);
463
516
  }
464
517
  log(...e) {
465
- if (y.LOG_LEVEL < 3)
518
+ if (p.LOG_LEVEL < 3)
466
519
  return;
467
520
  const t = this.format(...e);
468
- y.emit(3, t), console.log(A.CLEAR + t);
521
+ p.emit(3, t), console.log(A.CLEAR + t);
469
522
  }
470
523
  info(...e) {
471
- if (y.LOG_LEVEL < 2)
524
+ if (p.LOG_LEVEL < 2)
472
525
  return;
473
526
  const t = this.format(...e);
474
- y.emit(2, t), console.info(L.BLUE + t + A.CLEAR);
527
+ p.emit(2, t), console.info(L.BLUE + t + A.CLEAR);
475
528
  }
476
529
  warn(...e) {
477
- if (y.LOG_LEVEL < 1)
530
+ if (p.LOG_LEVEL < 1)
478
531
  return;
479
532
  const t = this.format(...e);
480
- y.emit(1, t), console.warn(L.YELLOW + t + A.CLEAR);
533
+ p.emit(1, t), console.warn(L.YELLOW + t + A.CLEAR);
481
534
  }
482
535
  error(...e) {
483
- if (y.LOG_LEVEL < 0)
536
+ if (p.LOG_LEVEL < 0)
484
537
  return;
485
538
  const t = this.format(...e);
486
- y.emit(0, t), console.error(L.RED + t + A.CLEAR);
539
+ p.emit(0, t), console.error(L.RED + t + A.CLEAR);
487
540
  }
488
541
  };
489
- a(y, "LOG_LEVEL", 4);
490
- let P = y;
491
- function Lt(n) {
492
- const e = (p, c) => c < 1e-7 ? p : e(c, ~~(p % c)), t = n.toString().length - 2;
542
+ u(p, "LOG_LEVEL", 4);
543
+ let P = p;
544
+ function St(n) {
545
+ const e = (y, c) => c < 1e-7 ? y : e(c, ~~(y % c)), t = n.toString().length - 2;
493
546
  let r = Math.pow(10, t), o = n * r;
494
547
  const s = e(o, r);
495
548
  o = ~~(o / s), r = ~~(r / s);
496
549
  const i = ~~(o / r);
497
550
  return o -= i * r, `${i ? i + " " : ""}${~~o}/${~~r}`;
498
551
  }
499
- function St(n) {
552
+ function Ct(n) {
500
553
  let e = n.split(" ");
501
554
  const t = e.length == 2 ? Number(e[0]) : 0;
502
555
  return e = e.pop().split("/"), t + Number(e[0]) / Number(e[1]);
503
556
  }
504
- function Ct(n, e) {
557
+ function Nt(n, e) {
505
558
  return n.length - n.replaceAll(e, "").length;
506
559
  }
507
- function Nt(n) {
560
+ function Tt(n) {
508
561
  return Array(n).fill(null).map(() => Math.round(Math.random() * 15).toString(16)).join("");
509
562
  }
510
563
  const I = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", $ = "0123456789", D = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/", rt = I + $ + D;
511
- function Tt(n) {
564
+ function It(n) {
512
565
  const e = /(\+?1)?.*?(\d{3}).*?(\d{3}).*?(\d{4})/g.exec(n);
513
566
  if (!e)
514
567
  throw new Error(`Number cannot be parsed: ${n}`);
515
568
  return `${e[1] ?? ""} (${e[2]}) ${e[3]}-${e[4]}`.trim();
516
569
  }
517
- function It(n, e, t) {
570
+ function $t(n, e, t) {
518
571
  return `${n.slice(0, t)}${e}${n.slice(t + 1)}`;
519
572
  }
520
- function $t(n, e, t, r = !0) {
573
+ function Dt(n, e, t, r = !0) {
521
574
  const o = n.toString(), s = e - o.length;
522
575
  if (s <= 0)
523
576
  return o;
524
577
  const i = Array(~~(s / t.length)).fill(t).join("");
525
578
  return r ? i + o : o + i;
526
579
  }
527
- function Dt(n, e = rt) {
580
+ function kt(n, e = rt) {
528
581
  return Array(n).fill(null).map(() => {
529
582
  const t = ~~(Math.random() * e.length);
530
583
  return e[t];
531
584
  }).join("");
532
585
  }
533
- function kt(n, e = !1, t = !1, r = !1) {
586
+ function jt(n, e = !1, t = !1, r = !1) {
534
587
  if (!e && !t && !r)
535
588
  throw new Error("Must enable at least one: letters, numbers, symbols");
536
589
  return Array(n).fill(null).map(() => {
@@ -542,7 +595,7 @@ function kt(n, e = !1, t = !1, r = !1) {
542
595
  return o;
543
596
  }).join("");
544
597
  }
545
- function jt(n, e) {
598
+ function Gt(n, e) {
546
599
  if (typeof e == "string" && (e = new RegExp(e, "g")), !e.global)
547
600
  throw new TypeError("Regular expression must be global.");
548
601
  let t = [], r;
@@ -551,7 +604,7 @@ function jt(n, e) {
551
604
  return t;
552
605
  }
553
606
  function ot(n) {
554
- var e = st(ct(ut(it(n), 8 * n.length)));
607
+ var e = st(ct(at(it(n), 8 * n.length)));
555
608
  return e.toLowerCase();
556
609
  }
557
610
  function st(n) {
@@ -571,16 +624,16 @@ function ct(n) {
571
624
  e += String.fromCharCode(n[t >> 5] >>> t % 32 & 255);
572
625
  return e;
573
626
  }
574
- function ut(n, e) {
627
+ function at(n, e) {
575
628
  n[e >> 5] |= 128 << e % 32, n[14 + (e + 64 >>> 9 << 4)] = e;
576
629
  for (var t = 1732584193, r = -271733879, o = -1732584194, s = 271733878, i = 0; i < n.length; i += 16) {
577
- var p = t, c = r, R = o, N = s;
578
- r = d(r = d(r = d(r = d(r = f(r = f(r = f(r = f(r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s, t = l(t, r, o, s, n[i + 0], 7, -680876936), r, o, n[i + 1], 12, -389564586), t, r, n[i + 2], 17, 606105819), s, t, n[i + 3], 22, -1044525330), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 4], 7, -176418897), r, o, n[i + 5], 12, 1200080426), t, r, n[i + 6], 17, -1473231341), s, t, n[i + 7], 22, -45705983), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 8], 7, 1770035416), r, o, n[i + 9], 12, -1958414417), t, r, n[i + 10], 17, -42063), s, t, n[i + 11], 22, -1990404162), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 12], 7, 1804603682), r, o, n[i + 13], 12, -40341101), t, r, n[i + 14], 17, -1502002290), s, t, n[i + 15], 22, 1236535329), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 1], 5, -165796510), r, o, n[i + 6], 9, -1069501632), t, r, n[i + 11], 14, 643717713), s, t, n[i + 0], 20, -373897302), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 5], 5, -701558691), r, o, n[i + 10], 9, 38016083), t, r, n[i + 15], 14, -660478335), s, t, n[i + 4], 20, -405537848), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 9], 5, 568446438), r, o, n[i + 14], 9, -1019803690), t, r, n[i + 3], 14, -187363961), s, t, n[i + 8], 20, 1163531501), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 13], 5, -1444681467), r, o, n[i + 2], 9, -51403784), t, r, n[i + 7], 14, 1735328473), s, t, n[i + 12], 20, -1926607734), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 5], 4, -378558), r, o, n[i + 8], 11, -2022574463), t, r, n[i + 11], 16, 1839030562), s, t, n[i + 14], 23, -35309556), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 1], 4, -1530992060), r, o, n[i + 4], 11, 1272893353), t, r, n[i + 7], 16, -155497632), s, t, n[i + 10], 23, -1094730640), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 13], 4, 681279174), r, o, n[i + 0], 11, -358537222), t, r, n[i + 3], 16, -722521979), s, t, n[i + 6], 23, 76029189), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 9], 4, -640364487), r, o, n[i + 12], 11, -421815835), t, r, n[i + 15], 16, 530742520), s, t, n[i + 2], 23, -995338651), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 0], 6, -198630844), r, o, n[i + 7], 10, 1126891415), t, r, n[i + 14], 15, -1416354905), s, t, n[i + 5], 21, -57434055), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 12], 6, 1700485571), r, o, n[i + 3], 10, -1894986606), t, r, n[i + 10], 15, -1051523), s, t, n[i + 1], 21, -2054922799), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 8], 6, 1873313359), r, o, n[i + 15], 10, -30611744), t, r, n[i + 6], 15, -1560198380), s, t, n[i + 13], 21, 1309151649), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 4], 6, -145523070), r, o, n[i + 11], 10, -1120210379), t, r, n[i + 2], 15, 718787259), s, t, n[i + 9], 21, -343485551), t = m(t, p), r = m(r, c), o = m(o, R), s = m(s, N);
630
+ var y = t, c = r, R = o, N = s;
631
+ r = d(r = d(r = d(r = d(r = f(r = f(r = f(r = f(r = h(r = h(r = h(r = h(r = l(r = l(r = l(r = l(r, o = l(o, s = l(s, t = l(t, r, o, s, n[i + 0], 7, -680876936), r, o, n[i + 1], 12, -389564586), t, r, n[i + 2], 17, 606105819), s, t, n[i + 3], 22, -1044525330), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 4], 7, -176418897), r, o, n[i + 5], 12, 1200080426), t, r, n[i + 6], 17, -1473231341), s, t, n[i + 7], 22, -45705983), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 8], 7, 1770035416), r, o, n[i + 9], 12, -1958414417), t, r, n[i + 10], 17, -42063), s, t, n[i + 11], 22, -1990404162), o = l(o, s = l(s, t = l(t, r, o, s, n[i + 12], 7, 1804603682), r, o, n[i + 13], 12, -40341101), t, r, n[i + 14], 17, -1502002290), s, t, n[i + 15], 22, 1236535329), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 1], 5, -165796510), r, o, n[i + 6], 9, -1069501632), t, r, n[i + 11], 14, 643717713), s, t, n[i + 0], 20, -373897302), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 5], 5, -701558691), r, o, n[i + 10], 9, 38016083), t, r, n[i + 15], 14, -660478335), s, t, n[i + 4], 20, -405537848), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 9], 5, 568446438), r, o, n[i + 14], 9, -1019803690), t, r, n[i + 3], 14, -187363961), s, t, n[i + 8], 20, 1163531501), o = h(o, s = h(s, t = h(t, r, o, s, n[i + 13], 5, -1444681467), r, o, n[i + 2], 9, -51403784), t, r, n[i + 7], 14, 1735328473), s, t, n[i + 12], 20, -1926607734), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 5], 4, -378558), r, o, n[i + 8], 11, -2022574463), t, r, n[i + 11], 16, 1839030562), s, t, n[i + 14], 23, -35309556), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 1], 4, -1530992060), r, o, n[i + 4], 11, 1272893353), t, r, n[i + 7], 16, -155497632), s, t, n[i + 10], 23, -1094730640), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 13], 4, 681279174), r, o, n[i + 0], 11, -358537222), t, r, n[i + 3], 16, -722521979), s, t, n[i + 6], 23, 76029189), o = f(o, s = f(s, t = f(t, r, o, s, n[i + 9], 4, -640364487), r, o, n[i + 12], 11, -421815835), t, r, n[i + 15], 16, 530742520), s, t, n[i + 2], 23, -995338651), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 0], 6, -198630844), r, o, n[i + 7], 10, 1126891415), t, r, n[i + 14], 15, -1416354905), s, t, n[i + 5], 21, -57434055), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 12], 6, 1700485571), r, o, n[i + 3], 10, -1894986606), t, r, n[i + 10], 15, -1051523), s, t, n[i + 1], 21, -2054922799), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 8], 6, 1873313359), r, o, n[i + 15], 10, -30611744), t, r, n[i + 6], 15, -1560198380), s, t, n[i + 13], 21, 1309151649), o = d(o, s = d(s, t = d(t, r, o, s, n[i + 4], 6, -145523070), r, o, n[i + 11], 10, -1120210379), t, r, n[i + 2], 15, 718787259), s, t, n[i + 9], 21, -343485551), t = m(t, y), r = m(r, c), o = m(o, R), s = m(s, N);
579
632
  }
580
633
  return Array(t, r, o, s);
581
634
  }
582
635
  function C(n, e, t, r, o, s) {
583
- return m(at(m(m(e, n), m(r, s)), o), t);
636
+ return m(ut(m(m(e, n), m(r, s)), o), t);
584
637
  }
585
638
  function l(n, e, t, r, o, s, i) {
586
639
  return C(e & t | ~e & r, n, e, o, s, i);
@@ -598,16 +651,16 @@ function m(n, e) {
598
651
  var t = (65535 & n) + (65535 & e);
599
652
  return (n >> 16) + (e >> 16) + (t >> 16) << 16 | 65535 & t;
600
653
  }
601
- function at(n, e) {
654
+ function ut(n, e) {
602
655
  return n << e | n >>> 32 - e;
603
656
  }
604
- function Gt(n) {
657
+ function Ut(n) {
605
658
  return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(n);
606
659
  }
607
- function Ut(n, e = "mp") {
660
+ function qt(n, e = "mp") {
608
661
  return n ? `https://www.gravatar.com/avatar/${ot(n)}?d=${e}` : "";
609
662
  }
610
- function qt(n) {
663
+ function Mt(n) {
611
664
  const e = new RegExp(
612
665
  "(?:(?<protocol>[\\w\\d]+)\\:\\/\\/)?(?:(?<user>.+)\\@)?(?<host>(?<domain>[^:\\/\\?#@\\n]+)(?:\\:(?<port>\\d*))?)(?<path>\\/.*?)?(?:\\?(?<query>.*?))?(?:#(?<fragment>.*?))?$",
613
666
  "gm"
@@ -615,19 +668,13 @@ function qt(n) {
615
668
  if (t.port != null && (t.port = Number(t.port)), r.length > 2 && (t.domain = r.splice(-2, 2).join("."), t.subdomain = r.join(".")), t.query) {
616
669
  const o = t.query.split("&"), s = {};
617
670
  o.forEach((i) => {
618
- const [p, c] = i.split("=");
619
- s[p] = c;
671
+ const [y, c] = i.split("=");
672
+ s[y] = c;
620
673
  }), t.query = s;
621
674
  }
622
675
  return t;
623
676
  }
624
- function Mt(n) {
625
- return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
626
- }
627
677
  function Pt(n) {
628
- return new Promise((e) => setTimeout(e, n));
629
- }
630
- function Ht(n) {
631
678
  const e = n instanceof Date ? n : new Date(n);
632
679
  return new Intl.DateTimeFormat("en-us", {
633
680
  weekday: "long",
@@ -638,10 +685,20 @@ function Ht(n) {
638
685
  hour12: !0
639
686
  }).format(e);
640
687
  }
688
+ function lt(n) {
689
+ return new Promise((e) => setTimeout(e, n));
690
+ }
691
+ async function Ht(n, e = 100) {
692
+ for (; n(); )
693
+ await lt(e);
694
+ }
695
+ function Yt(n) {
696
+ return (n instanceof Date ? n.getTime() : n) - (/* @__PURE__ */ new Date()).getTime();
697
+ }
641
698
  export {
642
699
  B as ASet,
643
700
  X as BadRequestError,
644
- Ot as CliBackground,
701
+ Lt as CliBackground,
645
702
  A as CliEffects,
646
703
  L as CliForeground,
647
704
  w as CustomError,
@@ -656,44 +713,45 @@ export {
656
713
  E as PromiseProgress,
657
714
  H as TypedEmitter,
658
715
  Q as UnauthorizedError,
659
- gt as addUnique,
660
- mt as arrayDiff,
661
- Et as caseInsensitiveSort,
716
+ mt as addUnique,
717
+ Et as arrayDiff,
718
+ wt as caseInsensitiveSort,
662
719
  W as clean,
663
- Ct as countChars,
664
- Nt as createHex,
665
- Lt as dec2Frac,
666
- ht as deepCopy,
720
+ Nt as countChars,
721
+ Tt as createHex,
722
+ St as dec2Frac,
723
+ ft as deepCopy,
667
724
  J as deepMerge,
668
725
  S as dotNotation,
669
726
  Z as download,
670
- Bt as downloadBlob,
671
- bt as fileBrowser,
672
- xt as findByProp,
727
+ bt as downloadBlob,
728
+ Rt as fileBrowser,
729
+ At as findByProp,
673
730
  K as flattenArr,
674
731
  z as flattenObj,
675
- ft as formData,
676
- Ht as formatDate,
677
- Tt as formatPhoneNumber,
678
- St as fracToDec,
679
- Ut as gravatar,
732
+ dt as formData,
733
+ Pt as formatDate,
734
+ It as formatPhoneNumber,
735
+ Ct as fracToDec,
736
+ qt as gravatar,
680
737
  U as includes,
681
- It as insertAt,
738
+ $t as insertAt,
682
739
  b as isEqual,
683
- At as makeArray,
740
+ Bt as makeArray,
684
741
  V as makeUnique,
685
- jt as matchAll,
742
+ Gt as matchAll,
686
743
  ot as md5,
687
- dt as mixin,
688
- $t as pad,
689
- Dt as randomString,
690
- kt as randomStringBuilder,
691
- Pt as sleep,
692
- wt as sortByProp,
693
- Mt as timeUntil,
694
- Rt as uploadWithProgress,
695
- yt as urlEncode,
696
- qt as urlParser,
697
- Gt as validateEmail
744
+ yt as mixin,
745
+ Dt as pad,
746
+ kt as randomString,
747
+ jt as randomStringBuilder,
748
+ lt as sleep,
749
+ Ht as sleepUntil,
750
+ xt as sortByProp,
751
+ Yt as timeUntil,
752
+ Ot as uploadWithProgress,
753
+ gt as urlEncode,
754
+ Mt as urlParser,
755
+ Ut as validateEmail
698
756
  };
699
757
  //# sourceMappingURL=index.mjs.map