@flemist/simple-utils 1.0.3 → 1.0.6

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.
@@ -1,25 +1,25 @@
1
- import { AbortControllerFast as tt, toAbortSignal as at, AbortError as ft } from "@flemist/abort-controller-fast";
2
- import { isPromiseLike as b } from "@flemist/async-utils";
3
- import { timeControllerDefault as ct } from "@flemist/time-controller";
4
- let P = null;
5
- function ht() {
6
- if (!P) {
7
- P = new Array(256);
1
+ import { AbortControllerFast as et, toAbortSignal as ft, AbortError as ct } from "@flemist/abort-controller-fast";
2
+ import { isPromiseLike as X } from "@flemist/async-utils";
3
+ import { timeControllerDefault as ht } from "@flemist/time-controller";
4
+ let V = null;
5
+ function mt() {
6
+ if (!V) {
7
+ V = new Array(256);
8
8
  for (let t = 0; t < 256; t++)
9
- P[t] = t.toString(16).padStart(2, "0");
9
+ V[t] = t.toString(16).padStart(2, "0");
10
10
  }
11
- return P;
11
+ return V;
12
12
  }
13
- function mt(t) {
14
- const e = ht(), r = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
13
+ function pt(t) {
14
+ const e = mt(), r = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
15
15
  let n = "";
16
16
  for (let o = 0, s = r.length; o < s; o++)
17
17
  n += e[r[o]];
18
18
  return n;
19
19
  }
20
- let G = null, et = null, L = null, rt = null;
21
- function pt() {
22
- G || (G = new Uint32Array([
20
+ let J = null, rt = null, B = null, nt = null;
21
+ function dt() {
22
+ J || (J = new Uint32Array([
23
23
  1116352408,
24
24
  1899447441,
25
25
  3049323471,
@@ -84,17 +84,17 @@ function pt() {
84
84
  2756734187,
85
85
  3204031479,
86
86
  3329325298
87
- ]), et = new Uint32Array(64), rt = new TextEncoder(), L = new Uint8Array(65536));
87
+ ]), rt = new Uint32Array(64), nt = new TextEncoder(), B = new Uint8Array(65536));
88
88
  }
89
- function dt(t) {
89
+ function yt(t) {
90
90
  if (t == null)
91
91
  return null;
92
- pt();
93
- const e = G, r = et, n = rt;
94
- let o = L, s;
92
+ dt();
93
+ const e = J, r = rt, n = nt;
94
+ let o = B, s;
95
95
  if (typeof t == "string") {
96
- const h = t.length * 3;
97
- o.length < h + 128 && (o = L = new Uint8Array(h + 128));
96
+ const c = t.length * 3;
97
+ o.length < c + 128 && (o = B = new Uint8Array(c + 128));
98
98
  const f = n.encodeInto(t, o);
99
99
  s = o.subarray(0, f.written);
100
100
  } else if (t instanceof Uint8Array)
@@ -110,72 +110,72 @@ function dt(t) {
110
110
  `[sha256Buffer] Unsupported content type: ${typeof t}`
111
111
  );
112
112
  const m = s.length, a = m + 72 >>> 6 << 6;
113
- o.length < a && (o = L = new Uint8Array(a)), s !== o && o.set(s), o[m] = 128;
114
- for (let h = m + 1; h < a; h++)
115
- o[h] = 0;
116
- const U = m * 8, C = U / 4294967296 | 0, T = U | 0;
117
- o[a - 8] = C >>> 24, o[a - 7] = C >>> 16, o[a - 6] = C >>> 8, o[a - 5] = C, o[a - 4] = T >>> 24, o[a - 3] = T >>> 16, o[a - 2] = T >>> 8, o[a - 1] = T;
118
- let $ = 1779033703, u = -1150833019, i = 1013904242, l = -1521486534, y = 1359893119, p = -1694144372, w = 528734635, g = 1541459225;
119
- for (let h = 0; h < a; h += 64) {
120
- for (let c = 0; c < 16; c++) {
121
- const d = h + (c << 2);
122
- r[c] = o[d] << 24 | o[d + 1] << 16 | o[d + 2] << 8 | o[d + 3];
113
+ o.length < a && (o = B = new Uint8Array(a)), s !== o && o.set(s), o[m] = 128;
114
+ for (let c = m + 1; c < a; c++)
115
+ o[c] = 0;
116
+ const U = m * 8, O = U / 4294967296 | 0, C = U | 0;
117
+ o[a - 8] = O >>> 24, o[a - 7] = O >>> 16, o[a - 6] = O >>> 8, o[a - 5] = O, o[a - 4] = C >>> 24, o[a - 3] = C >>> 16, o[a - 2] = C >>> 8, o[a - 1] = C;
118
+ let T = 1779033703, $ = -1150833019, u = 1013904242, i = -1521486534, l = 1359893119, y = -1694144372, p = 528734635, w = 1541459225;
119
+ for (let c = 0; c < a; c += 64) {
120
+ for (let h = 0; h < 16; h++) {
121
+ const d = c + (h << 2);
122
+ r[h] = o[d] << 24 | o[d + 1] << 16 | o[d + 2] << 8 | o[d + 3];
123
123
  }
124
- for (let c = 16; c < 64; c++) {
125
- const d = r[c - 15], A = r[c - 2], F = (d >>> 7 | d << 25) ^ (d >>> 18 | d << 14) ^ d >>> 3, D = (A >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10;
126
- r[c] = r[c - 16] + F + r[c - 7] + D | 0;
124
+ for (let h = 16; h < 64; h++) {
125
+ const d = r[h - 15], A = r[h - 2], H = (d >>> 7 | d << 25) ^ (d >>> 18 | d << 14) ^ d >>> 3, D = (A >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10;
126
+ r[h] = r[h - 16] + H + r[h - 7] + D | 0;
127
127
  }
128
- let f = $, _ = u, M = i, z = l, O = y, N = p, I = w, q = g;
129
- for (let c = 0; c < 64; c += 4)
128
+ let f = T, S = $, M = u, F = i, _ = l, P = y, k = p, q = w;
129
+ for (let h = 0; h < 64; h += 4)
130
130
  for (let d = 0; d < 4; d++) {
131
- const A = c + d, F = (O >>> 6 | O << 26) ^ (O >>> 11 | O << 21) ^ (O >>> 25 | O << 7), D = q + F + (I ^ O & (N ^ I)) + e[A] + r[A] | 0, lt = ((f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10)) + (f & _ ^ M & (f ^ _)) | 0;
132
- q = I, I = N, N = O, O = z + D | 0, z = M, M = _, _ = f, f = D + lt | 0;
131
+ const A = h + d, H = (_ >>> 6 | _ << 26) ^ (_ >>> 11 | _ << 21) ^ (_ >>> 25 | _ << 7), D = q + H + (k ^ _ & (P ^ k)) + e[A] + r[A] | 0, at = ((f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10)) + (f & S ^ M & (f ^ S)) | 0;
132
+ q = k, k = P, P = _, _ = F + D | 0, F = M, M = S, S = f, f = D + at | 0;
133
133
  }
134
- $ = $ + f | 0, u = u + _ | 0, i = i + M | 0, l = l + z | 0, y = y + O | 0, p = p + N | 0, w = w + I | 0, g = g + q | 0;
134
+ T = T + f | 0, $ = $ + S | 0, u = u + M | 0, i = i + F | 0, l = l + _ | 0, y = y + P | 0, p = p + k | 0, w = w + q | 0;
135
135
  }
136
- const S = new Uint8Array(32), B = [$, u, i, l, y, p, w, g];
137
- for (let h = 0; h < 8; h++) {
138
- const f = B[h], _ = h << 2;
139
- S[_] = f >>> 24, S[_ + 1] = f >>> 16 & 255, S[_ + 2] = f >>> 8 & 255, S[_ + 3] = f & 255;
136
+ const g = new Uint8Array(32), R = [T, $, u, i, l, y, p, w];
137
+ for (let c = 0; c < 8; c++) {
138
+ const f = R[c], S = c << 2;
139
+ g[S] = f >>> 24, g[S + 1] = f >>> 16 & 255, g[S + 2] = f >>> 8 & 255, g[S + 3] = f & 255;
140
140
  }
141
- return S;
141
+ return g;
142
142
  }
143
- function Pt(t) {
144
- const e = dt(t);
145
- return e ? mt(e) : null;
143
+ function Vt(t) {
144
+ const e = yt(t);
145
+ return e ? pt(e) : null;
146
146
  }
147
- function yt(t, e) {
147
+ function wt(t, e) {
148
148
  return t == null ? e : e == null ? t : Math.min(t, e);
149
149
  }
150
- function wt(t, e) {
150
+ function gt(t, e) {
151
151
  return t == null ? e : e == null ? t : Math.max(t, e);
152
152
  }
153
153
  function Lt(t, e, r) {
154
- return wt(yt(t, e), r);
154
+ return gt(wt(t, e), r);
155
155
  }
156
- function Vt(t, e) {
156
+ function Bt(t, e) {
157
157
  return (t % e + e) % e;
158
158
  }
159
- function gt(t) {
159
+ function St(t) {
160
160
  return function() {
161
161
  let r = t += 1831565813;
162
162
  return r = Math.imul(r ^ r >>> 15, r | 1), r ^= r + Math.imul(r ^ r >>> 7, r | 61), (r ^ r >>> 14) / 4294967296 + 0.5;
163
163
  };
164
164
  }
165
- function St() {
165
+ function _t() {
166
166
  return Math.random();
167
167
  }
168
- function Bt() {
168
+ function zt() {
169
169
  return Math.random() * 2 ** 32 >>> 0;
170
170
  }
171
- function _t(t) {
172
- return t != null ? gt(t) : St;
171
+ function Ot(t) {
172
+ return t != null ? St(t) : _t;
173
173
  }
174
- class J {
174
+ class Y {
175
175
  _seed;
176
176
  _rnd;
177
177
  constructor(e) {
178
- this._seed = e, this._rnd = _t(e);
178
+ this._seed = e, this._rnd = Ot(e);
179
179
  }
180
180
  get seed() {
181
181
  return this._seed;
@@ -184,26 +184,26 @@ class J {
184
184
  return this.next() * 2 ** 32 >>> 0;
185
185
  }
186
186
  nextRandom() {
187
- return new J(this.nextSeed());
187
+ return new Y(this.nextSeed());
188
188
  }
189
189
  next() {
190
190
  return this._rnd();
191
191
  }
192
192
  clone() {
193
- return new J(this._seed);
193
+ return new Y(this._seed);
194
194
  }
195
195
  }
196
- function nt(t, e, r) {
196
+ function ot(t, e, r) {
197
197
  if (r == null && (r = e, e = 0), r <= e)
198
198
  throw new Error(
199
199
  `[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`
200
200
  );
201
201
  return t.next() * (r - e) + e;
202
202
  }
203
- function Ot(t, e, r) {
204
- return Math.floor(nt(t, e, r));
203
+ function $t(t, e, r) {
204
+ return Math.floor(ot(t, e, r));
205
205
  }
206
- function zt(t, e) {
206
+ function Ft(t, e) {
207
207
  return t.next() < (e ?? 0.5);
208
208
  }
209
209
  function qt(t, e, r) {
@@ -218,37 +218,37 @@ function qt(t, e, r) {
218
218
  n += r(s);
219
219
  if (n === 0)
220
220
  return -1;
221
- let o = nt(t, n);
221
+ let o = ot(t, n);
222
222
  for (let s = 0; s < e; s++)
223
223
  if (o -= r(s), o < 0)
224
224
  return s;
225
225
  return e - 1;
226
226
  }
227
- function ot(t, e) {
227
+ function st(t, e) {
228
228
  if (e.length === 0)
229
229
  throw new Error("[random][randomItem] items is empty");
230
- const r = Ot(t, e.length);
230
+ const r = $t(t, e.length);
231
231
  return e[r];
232
232
  }
233
- function Ft(t, e, r) {
233
+ function Ht(t, e, r) {
234
234
  if (e.length === 0)
235
235
  throw new Error("[random][randomItems] items is empty");
236
236
  const n = [];
237
237
  for (let o = 0; o < r; o++)
238
- n.push(ot(t, e));
238
+ n.push(st(t, e));
239
239
  return n;
240
240
  }
241
- function Ht(t, e, r) {
241
+ function Wt(t, e, r) {
242
242
  let n = Object.values(e);
243
- return r && (n = n.filter(r)), ot(t, n);
243
+ return r && (n = n.filter(r)), st(t, n);
244
244
  }
245
- const st = 1073741789, H = (st >> 2) - 1;
246
- function Wt(t = H, e) {
245
+ const it = 1073741789, W = (it >> 2) - 1;
246
+ function Gt(t = W, e) {
247
247
  if (t <= 0)
248
248
  throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);
249
- if (t > H)
249
+ if (t > W)
250
250
  throw new Error(
251
- `[random][PseudoRandom] count(${t}) must be <= ${H}`
251
+ `[random][PseudoRandom] count(${t}) must be <= ${W}`
252
252
  );
253
253
  if (e == null && (e = Math.floor(Math.random() * t)), e >= t)
254
254
  throw new Error(
@@ -256,28 +256,28 @@ function Wt(t = H, e) {
256
256
  );
257
257
  let r = e;
258
258
  return function() {
259
- return r = (r + st) % t, r;
259
+ return r = (r + it) % t, r;
260
260
  };
261
261
  }
262
- let x = null;
263
- function Gt() {
262
+ let N = null;
263
+ function Jt() {
264
264
  const t = Date.now();
265
- return x == null || t > x ? (x = t, t) : (x++, x);
265
+ return N == null || t > N ? (N = t, t) : (N++, N);
266
266
  }
267
- async function Jt({
267
+ async function Yt({
268
268
  url: t,
269
269
  timeout: e
270
270
  } = {}) {
271
271
  t || (t = typeof window < "u" ? "/" : "https://google.com");
272
272
  let r;
273
273
  try {
274
- const n = new tt();
274
+ const n = new et();
275
275
  r = e ? setTimeout(() => {
276
276
  n.abort();
277
277
  }, e) : null;
278
278
  const o = await fetch(t, {
279
279
  method: "HEAD",
280
- signal: at(n.signal)
280
+ signal: ft(n.signal)
281
281
  }), s = o.headers.get("date");
282
282
  if (!s)
283
283
  throw new Error(
@@ -288,7 +288,7 @@ async function Jt({
288
288
  r && clearTimeout(r);
289
289
  }
290
290
  }
291
- function it(t, e, r) {
291
+ function ut(t, e, r) {
292
292
  const n = e == null ? t : new Date(
293
293
  t.toLocaleString("en-US", {
294
294
  timeZone: e
@@ -302,75 +302,82 @@ function it(t, e, r) {
302
302
  t.getTime() + o.getTime() - n.getTime()
303
303
  );
304
304
  }
305
- function $t(t, e) {
306
- t = it(t, "UTC", e);
305
+ function At(t, e) {
306
+ t = ut(t, "UTC", e);
307
307
  const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), m = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
308
308
  return `${r}-${n}-${o} ${s}:${m}:${a}`;
309
309
  }
310
- let At = 0;
311
- const W = /* @__PURE__ */ new WeakMap();
312
- function R(t) {
313
- if (W.has(t))
314
- return W.get(t);
315
- const e = At++;
316
- return W.set(t, e), e;
310
+ let Ut = 0;
311
+ const G = /* @__PURE__ */ new WeakMap();
312
+ function I(t) {
313
+ if (G.has(t))
314
+ return G.get(t);
315
+ const e = Ut++;
316
+ return G.set(t, e), e;
317
+ }
318
+ function L(t, e, r) {
319
+ return t == null ? t ?? null : e == null ? t : t.length > e ? e <= 0 ? "…" : r?.fromStart ? "…" + t.slice(t.length - e + 1) : t.slice(0, e - 1) + "…" : t;
317
320
  }
318
- function Y(t, e) {
321
+ function K(t, e) {
319
322
  try {
320
323
  return t[e];
321
324
  } catch (r) {
322
325
  return "Error: " + (r instanceof Error ? r.message : String(r));
323
326
  }
324
327
  }
325
- function k(t, e = {}, r = [], n = /* @__PURE__ */ new Set()) {
328
+ function x(t, e, r, n) {
326
329
  const {
327
330
  pretty: o,
328
331
  filter: s,
329
332
  maxDepth: m,
330
333
  maxItems: a,
331
- showObjectId: U,
334
+ maxStringLength: U,
335
+ showObjectId: O,
332
336
  showArrayIndex: C,
333
337
  customToString: T
334
- } = e;
335
- if (T) {
336
- const u = T(t, (i) => k(i, e, r, n));
338
+ } = e ?? {};
339
+ if (r == null && (r = []), n == null && (n = /* @__PURE__ */ new Set()), T) {
340
+ const u = T(t, (i) => x(i, e, r, n));
337
341
  if (u != null)
338
- return u;
342
+ return L(u, U);
339
343
  }
340
344
  const $ = r.length;
341
345
  if (typeof t == "string")
342
- return JSON.stringify(t);
346
+ return t = L(t, U), n.size > 0 && (t = JSON.stringify(t)), t;
343
347
  if (t == null || typeof t != "object")
344
348
  return String(t);
345
349
  if (t instanceof ArrayBuffer || ArrayBuffer.isView(t))
346
- return `${t.constructor?.name ?? ""}#${R(t)}[${t.byteLength}]`;
350
+ return `${t.constructor?.name ?? ""}#${I(t)}[${t.byteLength}]`;
347
351
  if (t instanceof RegExp)
348
- return String(t);
352
+ return L(String(t), U);
349
353
  if (t instanceof Date)
350
- return $t(t);
354
+ return At(t);
351
355
  if (t instanceof Object) {
352
356
  if (n.has(t) || m != null && $ >= m)
353
- return `${t.constructor === Object ? "" : t.constructor?.name ?? ""}#${R(t)}`;
357
+ return `${t.constructor === Object ? "" : t.constructor?.name ?? ""}#${I(t)}`;
354
358
  n.add(t);
355
359
  }
356
360
  if (t instanceof Error)
357
- return t.stack || t.message || String(t);
361
+ return L(
362
+ t.stack || t.message || String(t),
363
+ U
364
+ );
358
365
  if (Array.isArray(t)) {
359
366
  const u = o ? " ".repeat($) : "";
360
367
  let i = "";
361
- U && (i += `#${R(t)} `), i += "[";
368
+ O && (i += `#${I(t)} `), i += "[";
362
369
  let l = 0, y = !1;
363
370
  for (let p = 0; p < t.length; p++) {
364
371
  if (a != null && l >= a) {
365
372
  y = !0;
366
373
  break;
367
374
  }
368
- const w = [...r, String(p)], g = Y(t, p);
375
+ const w = [...r, String(p)], g = K(t, p);
369
376
  if (s != null && !s(w, g))
370
377
  continue;
371
- const S = k(g, e, w, n);
378
+ const R = x(g, e, w, n);
372
379
  l > 0 && (i += ","), o && (i += `
373
- `), o && (i += `${u} `), C && (i += `${p}: `), i += `${S}`, l++;
380
+ `), o && (i += `${u} `), C && (i += `${p}: `), i += `${R}`, l++;
374
381
  }
375
382
  return y ? (l > 0 && (i += ","), o ? (i += `
376
383
  `, i += `${u} ...
@@ -379,28 +386,28 @@ ${u}`), i += "]"), i;
379
386
  }
380
387
  if (t instanceof Map) {
381
388
  let u = "";
382
- return U && (u += `#${R(t)} `), u += "Map", u += k(Array.from(t.entries()), e, r, n), u;
389
+ return O && (u += `#${I(t)} `), u += "Map", u += x(Array.from(t.entries()), e, r, n), u;
383
390
  }
384
391
  if (t instanceof Set) {
385
392
  let u = "";
386
- return U && (u += `#${R(t)} `), u += "Set", u += k(Array.from(t.values()), e, r, n), u;
393
+ return O && (u += `#${I(t)} `), u += "Set", u += x(Array.from(t.values()), e, r, n), u;
387
394
  }
388
395
  {
389
396
  const u = t.constructor === Object ? "" : t.constructor?.name ?? "", i = o ? " ".repeat($) : "";
390
397
  let l = u ? `${u} ` : "";
391
- U && (l += `#${R(t)} `), l += "{";
398
+ O && (l += `#${I(t)} `), l += "{";
392
399
  let y = 0, p = !1;
393
400
  for (const w in t) {
394
401
  if (a != null && y >= a) {
395
402
  p = !0;
396
403
  break;
397
404
  }
398
- const g = [...r, w], S = Y(t, w);
399
- if (s != null && !s(g, S))
405
+ const g = [...r, w], R = K(t, w);
406
+ if (s != null && !s(g, R))
400
407
  continue;
401
- const B = k(S, e, g, n);
408
+ const c = x(R, e, g, n);
402
409
  y > 0 && (l += ","), o && (l += `
403
- `), o && (l += `${i} `), l += `${w}: ${B}`, y++;
410
+ `), o && (l += `${i} `), l += `${w}: ${c}`, y++;
404
411
  }
405
412
  return p && (y > 0 && (l += ","), o ? (l += `
406
413
  `, l += `${i} ...
@@ -408,12 +415,12 @@ ${u}`), i += "]"), i;
408
415
  ${i}`), l += "}", l;
409
416
  }
410
417
  }
411
- function bt(t, e) {
412
- t = it(t, "UTC", e);
418
+ function Xt(t, e) {
419
+ t = ut(t, "UTC", e);
413
420
  const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), m = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
414
421
  return `${r}-${n}-${o}_${s}-${m}-${a}`;
415
422
  }
416
- function Xt(t) {
423
+ function bt(t) {
417
424
  return t == null ? null : t.replace(/[&<>"']/g, (e) => {
418
425
  switch (e) {
419
426
  case "&":
@@ -429,16 +436,16 @@ function Xt(t) {
429
436
  }
430
437
  });
431
438
  }
432
- function Yt(t) {
439
+ function Kt(t) {
433
440
  return t == null ? null : t?.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
434
441
  }
435
- function K(t) {
442
+ function Q(t) {
436
443
  if (t == null)
437
444
  return null;
438
445
  if (Array.isArray(t)) {
439
446
  const e = t.length, r = [];
440
447
  for (let n = 0; n < e; n++)
441
- r.push(K(t[n]));
448
+ r.push(Q(t[n]));
442
449
  return r;
443
450
  }
444
451
  if (typeof t == "object") {
@@ -446,12 +453,12 @@ function K(t) {
446
453
  return t;
447
454
  const e = {};
448
455
  for (const r in t)
449
- Object.prototype.hasOwnProperty.call(t, r) && (e[r] = K(t[r]));
456
+ Object.prototype.hasOwnProperty.call(t, r) && (e[r] = Q(t[r]));
450
457
  return e;
451
458
  }
452
459
  return t;
453
460
  }
454
- function V(t, e) {
461
+ function z(t, e) {
455
462
  if (t === e)
456
463
  return !0;
457
464
  if (t == null)
@@ -465,7 +472,7 @@ function V(t, e) {
465
472
  if (r !== e.length)
466
473
  return !1;
467
474
  for (let n = 0; n < r; n++)
468
- if (!V(t[n], e[n]))
475
+ if (!z(t[n], e[n]))
469
476
  return !1;
470
477
  return !0;
471
478
  }
@@ -473,29 +480,29 @@ function V(t, e) {
473
480
  if (typeof e != "object" || t.constructor && t.constructor !== Object || e.constructor && e.constructor !== Object)
474
481
  return !1;
475
482
  for (const r in t)
476
- if (Object.prototype.hasOwnProperty.call(t, r) && !V(
483
+ if (Object.prototype.hasOwnProperty.call(t, r) && !z(
477
484
  t[r],
478
485
  Object.prototype.hasOwnProperty.call(e, r) ? e[r] : null
479
486
  ))
480
487
  return !1;
481
488
  for (const r in e)
482
- if (Object.prototype.hasOwnProperty.call(e, r) && !Object.prototype.hasOwnProperty.call(t, r) && !V(e[r], null))
489
+ if (Object.prototype.hasOwnProperty.call(e, r) && !Object.prototype.hasOwnProperty.call(t, r) && !z(e[r], null))
483
490
  return !1;
484
491
  return !0;
485
492
  }
486
493
  return !1;
487
494
  }
488
- function Kt(t, e) {
495
+ function Qt(t, e) {
489
496
  if (t == null || e == null)
490
497
  return t == null == (e == null);
491
498
  if (t.size !== e.size)
492
499
  return !1;
493
500
  for (const [r, n] of t)
494
- if (!V(n, e.get(r)))
501
+ if (!z(n, e.get(r)))
495
502
  return !1;
496
503
  return !0;
497
504
  }
498
- function Qt(t, e) {
505
+ function Zt(t, e) {
499
506
  const r = t.length;
500
507
  if (r !== e.length)
501
508
  return !1;
@@ -504,26 +511,29 @@ function Qt(t, e) {
504
511
  return !1;
505
512
  return !0;
506
513
  }
507
- function Q(t) {
508
- return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(Q) : t && Object.keys(t).sort().reduce((e, r) => {
509
- const n = Q(t[r]);
514
+ function Z(t) {
515
+ return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(Z) : t && Object.keys(t).sort().reduce((e, r) => {
516
+ const n = Z(t[r]);
510
517
  return n != null && (e[r] = n), e;
511
518
  }, {});
512
519
  }
513
- function Zt(t) {
520
+ function vt(t, e) {
521
+ return Object.defineProperty(t, "name", { value: e, configurable: !0 }), t;
522
+ }
523
+ function jt(t) {
514
524
  const e = alert;
515
525
  return window.alert = (r) => t(e, r), () => {
516
526
  window.alert = e;
517
527
  };
518
528
  }
519
- var ut = /* @__PURE__ */ ((t) => (t.log = "log", t.warn = "warn", t.error = "error", t.info = "info", t.debug = "debug", t.trace = "trace", t.assert = "assert", t))(ut || {});
520
- const Z = Object.values(ut);
529
+ var lt = /* @__PURE__ */ ((t) => (t.log = "log", t.warn = "warn", t.error = "error", t.info = "info", t.debug = "debug", t.trace = "trace", t.assert = "assert", t))(lt || {});
530
+ const v = Object.values(lt);
521
531
  function E(t) {
522
532
  return function() {
523
533
  t.apply(console, arguments);
524
534
  };
525
535
  }
526
- const v = {
536
+ const j = {
527
537
  log: E(console.log),
528
538
  warn: E(console.warn),
529
539
  error: E(console.error),
@@ -532,23 +542,23 @@ const v = {
532
542
  trace: E(console.trace),
533
543
  assert: E(console.assert)
534
544
  };
535
- function Ut(t) {
536
- return Z.forEach((e) => {
545
+ function Tt(t) {
546
+ return v.forEach((e) => {
537
547
  console[e] = (...r) => {
538
- t(v, e, r);
548
+ t(j, e, r);
539
549
  };
540
550
  }), () => {
541
- Z.forEach((e) => {
542
- console[e] = v[e];
551
+ v.forEach((e) => {
552
+ console[e] = j[e];
543
553
  });
544
554
  };
545
555
  }
546
- function vt(t) {
556
+ function te(t) {
547
557
  return function(r) {
548
- const n = Ut(t);
558
+ const n = Tt(t);
549
559
  try {
550
560
  const o = r();
551
- return b(o) ? o.then(
561
+ return X(o) ? o.then(
552
562
  (s) => (n(), s),
553
563
  (s) => {
554
564
  throw n(), s;
@@ -559,7 +569,7 @@ function vt(t) {
559
569
  }
560
570
  };
561
571
  }
562
- function Tt() {
572
+ function Et() {
563
573
  let t = new Error().stack;
564
574
  if (t != null) {
565
575
  const e = t.indexOf(`
@@ -568,9 +578,9 @@ function Tt() {
568
578
  }
569
579
  return t ?? "";
570
580
  }
571
- function jt(t) {
581
+ function ee(t) {
572
582
  return function(...e) {
573
- const r = Tt();
583
+ const r = Et();
574
584
  try {
575
585
  return t.apply(this, e);
576
586
  } catch (n) {
@@ -579,14 +589,14 @@ function jt(t) {
579
589
  }
580
590
  };
581
591
  }
582
- function Et(t) {
592
+ function Ct(t) {
583
593
  if (!t || t.timeout == null)
584
594
  return null;
585
- const e = new tt(), r = t.timeController ?? ct;
595
+ const e = new et(), r = t.timeController ?? ht;
586
596
  if (t.timeout) {
587
597
  const n = r.setTimeout(() => {
588
598
  e.abort(
589
- new ft(
599
+ new ct(
590
600
  `[timeoutAbortController] Timeout error: ${t.timeout}ms`
591
601
  )
592
602
  );
@@ -599,15 +609,15 @@ function Et(t) {
599
609
  e.abort(n);
600
610
  }), e;
601
611
  }
602
- async function te(t, e) {
603
- const r = Et(e);
612
+ async function re(t, e) {
613
+ const r = Ct(e);
604
614
  try {
605
615
  return await t(r?.signal ?? e?.abortSignal ?? null);
606
616
  } finally {
607
617
  r?.abort();
608
618
  }
609
619
  }
610
- class ee {
620
+ class ne {
611
621
  _options;
612
622
  _hasValue = !1;
613
623
  _promiseOrValue = null;
@@ -620,7 +630,7 @@ class ee {
620
630
  const r = (o) => (this._options.persist ? this._promiseOrValue = o : (this._promiseOrValue = null, this._hasValue = !1), o), n = (o) => {
621
631
  throw this._options.persist || (this._promiseOrValue = null, this._hasValue = !1), o;
622
632
  };
623
- if (b(e))
633
+ if (X(e))
624
634
  e = e.then(r, n);
625
635
  else if (!this._options.persist)
626
636
  return e;
@@ -634,7 +644,7 @@ class ee {
634
644
  this._hasValue = !0, this._promiseOrValue = e;
635
645
  }
636
646
  }
637
- class re {
647
+ class oe {
638
648
  _options;
639
649
  _promiseOrValues = /* @__PURE__ */ new Map();
640
650
  constructor(e) {
@@ -647,7 +657,7 @@ class re {
647
657
  const n = (s) => (this._options.persist ? this._promiseOrValues.set(e, s) : this._promiseOrValues.delete(e), s), o = (s) => {
648
658
  throw this._options.persist || this._promiseOrValues.delete(e), s;
649
659
  };
650
- if (b(r))
660
+ if (X(r))
651
661
  r = r.then(n, o);
652
662
  else if (!this._options.persist)
653
663
  return r;
@@ -661,94 +671,96 @@ class re {
661
671
  this._promiseOrValues.set(e, r);
662
672
  }
663
673
  }
664
- function j(t) {
674
+ function tt(t) {
665
675
  return t.replace(/\W/g, "").toLowerCase();
666
676
  }
667
- function Ct(t) {
677
+ function Rt(t) {
668
678
  return t instanceof URL ? t.searchParams : t instanceof URLSearchParams ? t : typeof t == "string" ? new URL(t).searchParams : typeof window < "u" ? new URL(window.location.href).searchParams : new URLSearchParams();
669
679
  }
670
- function Rt(t) {
680
+ function It(t) {
671
681
  return t == null ? null : (t = t.toLowerCase().trim(), t === "true" || t === "1" || t === "yes" ? !0 : t === "false" || t === "0" || t === "no" ? !1 : null);
672
682
  }
673
- function It(t) {
683
+ function kt(t) {
674
684
  if (t == null)
675
685
  return null;
676
686
  t = t.trim();
677
687
  const e = parseInt(t, 10);
678
688
  return isNaN(e) ? null : e;
679
689
  }
680
- function xt(t) {
690
+ function Nt(t) {
681
691
  if (t == null)
682
692
  return null;
683
693
  t = t.trim();
684
694
  const e = parseFloat(t);
685
695
  return isNaN(e) ? null : e;
686
696
  }
687
- function X(t, e) {
688
- const r = Ct(e), n = j(t);
697
+ function b(t, e) {
698
+ const r = Rt(e), n = tt(t);
689
699
  for (const [o, s] of r.entries())
690
- if (j(o) === n)
700
+ if (tt(o) === n)
691
701
  return s;
692
702
  return null;
693
703
  }
694
- function ne(t, e) {
695
- return Rt(X(t, e));
704
+ function se(t, e) {
705
+ return It(b(t, e));
696
706
  }
697
- function oe(t, e) {
698
- return It(X(t, e));
707
+ function ie(t, e) {
708
+ return kt(b(t, e));
699
709
  }
700
- function se(t, e) {
701
- return xt(X(t, e));
710
+ function ue(t, e) {
711
+ return Nt(b(t, e));
702
712
  }
703
713
  export {
704
- V as A,
705
- Kt as B,
714
+ Q as A,
715
+ z as B,
706
716
  Qt as C,
707
- Q as D,
708
- Zt as E,
709
- ut as F,
710
- Ut as G,
711
- vt as H,
712
- jt as I,
713
- Tt as J,
714
- Et as K,
715
- te as L,
716
- ee as M,
717
+ Zt as D,
718
+ Z as E,
719
+ vt as F,
720
+ jt as G,
721
+ lt as H,
722
+ Tt as I,
723
+ te as J,
724
+ ee as K,
725
+ Et as L,
726
+ Ct as M,
717
727
  re as N,
718
- Ct as O,
719
- Rt as P,
720
- It as Q,
721
- J as R,
722
- xt as S,
723
- X as T,
724
- H as U,
725
- ne as V,
726
- oe as W,
728
+ ne as O,
729
+ oe as P,
730
+ Rt as Q,
731
+ Y as R,
732
+ It as S,
733
+ kt as T,
734
+ W as U,
735
+ Nt as V,
736
+ b as W,
727
737
  se as X,
728
- Pt as a,
729
- wt as b,
738
+ ie as Y,
739
+ ue as Z,
740
+ Vt as a,
741
+ gt as b,
730
742
  Lt as c,
731
- _t as d,
732
- Ot as e,
733
- zt as f,
734
- Bt as g,
743
+ Ot as d,
744
+ $t as e,
745
+ Ft as f,
746
+ zt as g,
735
747
  qt as h,
736
- ot as i,
737
- Ft as j,
738
- Ht as k,
739
- Wt as l,
740
- yt as m,
741
- Vt as n,
742
- Gt as o,
743
- Jt as p,
744
- it as q,
745
- nt as r,
746
- dt as s,
747
- mt as t,
748
- k as u,
749
- $t as v,
750
- bt as w,
751
- Xt as x,
752
- Yt as y,
753
- K as z
748
+ st as i,
749
+ Ht as j,
750
+ Wt as k,
751
+ Gt as l,
752
+ wt as m,
753
+ Bt as n,
754
+ Jt as o,
755
+ Yt as p,
756
+ ut as q,
757
+ ot as r,
758
+ yt as s,
759
+ pt as t,
760
+ x as u,
761
+ At as v,
762
+ Xt as w,
763
+ L as x,
764
+ bt as y,
765
+ Kt as z
754
766
  };