@byloth/core 2.0.0-rc.3 → 2.0.0-rc.5

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/core.js CHANGED
@@ -1,426 +1,415 @@
1
- var P = Object.defineProperty;
2
- var j = (i, e, t) => e in i ? P(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var u = (i, e, t) => j(i, typeof e != "symbol" ? e + "" : e, t);
4
- const S = typeof window < "u" && typeof window.document < "u";
5
- var b;
6
- const $ = typeof process < "u" && ((b = process.versions) == null ? void 0 : b.node);
7
- var k;
8
- const A = typeof self == "object" && ((k = self.constructor) == null ? void 0 : k.name) === "DedicatedWorkerGlobalScope";
9
- class f extends Error {
1
+ var Ae = Object.defineProperty;
2
+ var Oe = (i, t, e) => t in i ? Ae(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var a = (i, t, e) => Oe(i, typeof t != "symbol" ? t + "" : t, e);
4
+ const Re = typeof window < "u" && typeof window.document < "u";
5
+ var P;
6
+ const Ve = typeof process < "u" && ((P = process.versions) == null ? void 0 : P.node);
7
+ var I;
8
+ const We = typeof self == "object" && ((I = self.constructor) == null ? void 0 : I.name) === "DedicatedWorkerGlobalScope";
9
+ var j, A;
10
+ class c extends (A = Error, j = Symbol.toStringTag, A) {
11
+ constructor(e, n, r = "Exception") {
12
+ super(e);
13
+ a(this, j, "Exception");
14
+ this.cause = n, this.name = r, n && (n instanceof Error ? this.stack += `
15
+
16
+ Caused by ${n.stack}` : this.stack += `
17
+
18
+ Caused by ${n}`);
19
+ }
10
20
  static FromUnknown(e) {
11
- if (e instanceof f)
21
+ if (e instanceof c)
12
22
  return e;
13
23
  if (e instanceof Error) {
14
- const t = new f(e.message);
15
- return t.stack = e.stack, t.name = e.name, t;
24
+ const n = new c(e.message);
25
+ return n.stack = e.stack, n.name = e.name, n;
16
26
  }
17
- return new f(`${e}`);
18
- }
19
- constructor(e, t, n = "Exception") {
20
- super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
21
-
22
- Caused by ${t.stack}` : this.stack += `
23
-
24
- Caused by ${t}`);
25
- }
26
- get [Symbol.toStringTag]() {
27
- return "Exception";
27
+ return new c(`${e}`);
28
28
  }
29
29
  }
30
- class _ extends f {
31
- constructor(e, t, n = "FatalErrorException") {
32
- e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team."), super(e, t, n);
33
- }
34
- get [Symbol.toStringTag]() {
35
- return "FatalErrorException";
30
+ var O, C;
31
+ class g extends (C = c, O = Symbol.toStringTag, C) {
32
+ constructor(e, n, r = "FatalErrorException") {
33
+ e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");
34
+ super(e, n, r);
35
+ a(this, O, "FatalErrorException");
36
36
  }
37
37
  }
38
- class J extends _ {
39
- constructor(e, t, n = "NotImplementedException") {
40
- e === void 0 && (e = "This feature is not implemented yet. Please, try again later."), super(e, t, n);
41
- }
42
- get [Symbol.toStringTag]() {
43
- return "NotImplementedException";
38
+ var D, q;
39
+ class Ye extends (q = g, D = Symbol.toStringTag, q) {
40
+ constructor(e, n, r = "NotImplementedException") {
41
+ e === void 0 && (e = "This feature is not implemented yet. Please, try again later.");
42
+ super(e, n, r);
43
+ a(this, D, "NotImplementedException");
44
44
  }
45
45
  }
46
- class E extends f {
47
- constructor(e, t, n = "FileException") {
48
- super(e, t, n);
49
- }
50
- get [Symbol.toStringTag]() {
51
- return "FileException";
46
+ var N, $;
47
+ class Pe extends ($ = c, N = Symbol.toStringTag, $) {
48
+ constructor(e, n, r = "FileException") {
49
+ super(e, n, r);
50
+ a(this, N, "FileException");
52
51
  }
53
52
  }
54
- class V extends E {
55
- constructor(e, t, n = "FileExistsException") {
56
- super(e, t, n);
57
- }
58
- get [Symbol.toStringTag]() {
59
- return "FileExistsException";
53
+ var J, V;
54
+ class ze extends (V = Pe, J = Symbol.toStringTag, V) {
55
+ constructor(e, n, r = "FileExistsException") {
56
+ super(e, n, r);
57
+ a(this, J, "FileExistsException");
60
58
  }
61
59
  }
62
- class W extends E {
63
- constructor(e, t, n = "FileNotFoundException") {
64
- super(e, t, n);
65
- }
66
- get [Symbol.toStringTag]() {
67
- return "FileNotFoundException";
60
+ var W, Y;
61
+ class Be extends (Y = Pe, W = Symbol.toStringTag, Y) {
62
+ constructor(e, n, r = "FileNotFoundException") {
63
+ super(e, n, r);
64
+ a(this, W, "FileNotFoundException");
68
65
  }
69
66
  }
70
- class Y extends f {
71
- constructor(e, t, n = "KeyException") {
72
- super(e, t, n);
73
- }
74
- get [Symbol.toStringTag]() {
75
- return "KeyException";
67
+ var z, B;
68
+ class Ge extends (B = c, z = Symbol.toStringTag, B) {
69
+ constructor(e, n, r = "KeyException") {
70
+ super(e, n, r);
71
+ a(this, z, "KeyException");
76
72
  }
77
73
  }
78
- class z extends f {
79
- constructor(e, t, n = "NetworkException") {
80
- super(e, t, n);
81
- }
82
- get [Symbol.toStringTag]() {
83
- return "NetworkException";
74
+ var G, K;
75
+ class Ke extends (K = c, G = Symbol.toStringTag, K) {
76
+ constructor(e, n, r = "NetworkException") {
77
+ super(e, n, r);
78
+ a(this, G, "NetworkException");
84
79
  }
85
80
  }
86
- class B extends f {
87
- constructor(e, t, n = "PermissionException") {
88
- super(e, t, n);
89
- }
90
- get [Symbol.toStringTag]() {
91
- return "PermissionException";
81
+ var H, L;
82
+ class He extends (L = c, H = Symbol.toStringTag, L) {
83
+ constructor(e, n, r = "PermissionException") {
84
+ super(e, n, r);
85
+ a(this, H, "PermissionException");
92
86
  }
93
87
  }
94
- class D extends f {
95
- constructor(e, t, n = "ReferenceException") {
96
- super(e, t, n);
97
- }
98
- get [Symbol.toStringTag]() {
99
- return "ReferenceException";
88
+ var Q, X;
89
+ class Ce extends (X = c, Q = Symbol.toStringTag, X) {
90
+ constructor(e, n, r = "ReferenceException") {
91
+ super(e, n, r);
92
+ a(this, Q, "ReferenceException");
100
93
  }
101
94
  }
102
- class y extends f {
103
- constructor(e, t, n = "RuntimeException") {
104
- super(e, t, n);
105
- }
106
- get [Symbol.toStringTag]() {
107
- return "RuntimeException";
95
+ var Z, U;
96
+ class p extends (U = c, Z = Symbol.toStringTag, U) {
97
+ constructor(e, n, r = "RuntimeException") {
98
+ super(e, n, r);
99
+ a(this, Z, "RuntimeException");
108
100
  }
109
101
  }
110
- class C extends y {
111
- constructor(e, t, n = "EnvironmentException") {
112
- super(e, t, n);
113
- }
114
- get [Symbol.toStringTag]() {
115
- return "EnvironmentException";
102
+ var ee, te;
103
+ class De extends (te = p, ee = Symbol.toStringTag, te) {
104
+ constructor(e, n, r = "EnvironmentException") {
105
+ super(e, n, r);
106
+ a(this, ee, "EnvironmentException");
116
107
  }
117
108
  }
118
- class O extends f {
119
- constructor(e, t, n = "TimeoutException") {
120
- super(e, t, n);
121
- }
122
- get [Symbol.toStringTag]() {
123
- return "TimeoutException";
109
+ var ne, re;
110
+ class qe extends (re = c, ne = Symbol.toStringTag, re) {
111
+ constructor(e, n, r = "TimeoutException") {
112
+ super(e, n, r);
113
+ a(this, ne, "TimeoutException");
124
114
  }
125
115
  }
126
- class K extends f {
127
- constructor(e, t, n = "TypeException") {
128
- super(e, t, n);
129
- }
130
- get [Symbol.toStringTag]() {
131
- return "TypeException";
116
+ var se, ie;
117
+ class Le extends (ie = c, se = Symbol.toStringTag, ie) {
118
+ constructor(e, n, r = "TypeException") {
119
+ super(e, n, r);
120
+ a(this, se, "TypeException");
132
121
  }
133
122
  }
134
- class m extends f {
135
- constructor(e, t, n = "ValueException") {
136
- super(e, t, n);
137
- }
138
- get [Symbol.toStringTag]() {
139
- return "ValueException";
123
+ var oe, ae;
124
+ class d extends (ae = c, oe = Symbol.toStringTag, ae) {
125
+ constructor(e, n, r = "ValueException") {
126
+ super(e, n, r);
127
+ a(this, oe, "ValueException");
140
128
  }
141
129
  }
142
- class T extends m {
143
- constructor(e, t, n = "RangeException") {
144
- super(e, t, n);
145
- }
146
- get [Symbol.toStringTag]() {
147
- return "RangeException";
130
+ var ue, le;
131
+ class Ie extends (le = d, ue = Symbol.toStringTag, le) {
132
+ constructor(e, n, r = "RangeException") {
133
+ super(e, n, r);
134
+ a(this, ue, "RangeException");
148
135
  }
149
136
  }
137
+ var ce;
150
138
  class l {
151
- constructor(e) {
152
- u(this, "_iterator");
153
- u(this, "return");
154
- u(this, "throw");
155
- e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
156
- }
157
- every(e) {
158
- let t = 0;
139
+ constructor(t) {
140
+ a(this, "_iterator");
141
+ a(this, "return");
142
+ a(this, "throw");
143
+ a(this, ce, "SmartIterator");
144
+ t instanceof Function ? this._iterator = t() : Symbol.iterator in t ? this._iterator = t[Symbol.iterator]() : this._iterator = t, this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
145
+ }
146
+ every(t) {
147
+ let e = 0;
159
148
  for (; ; ) {
160
149
  const n = this._iterator.next();
161
150
  if (n.done)
162
151
  return !0;
163
- if (!e(n.value, t))
152
+ if (!t(n.value, e))
164
153
  return !1;
165
- t += 1;
154
+ e += 1;
166
155
  }
167
156
  }
168
- some(e) {
169
- let t = 0;
157
+ some(t) {
158
+ let e = 0;
170
159
  for (; ; ) {
171
160
  const n = this._iterator.next();
172
161
  if (n.done)
173
162
  return !1;
174
- if (e(n.value, t))
163
+ if (t(n.value, e))
175
164
  return !0;
176
- t += 1;
165
+ e += 1;
177
166
  }
178
167
  }
179
- filter(e) {
180
- const t = this._iterator;
168
+ filter(t) {
169
+ const e = this._iterator;
181
170
  return new l(function* () {
182
171
  let n = 0;
183
172
  for (; ; ) {
184
- const r = t.next();
173
+ const r = e.next();
185
174
  if (r.done)
186
175
  return r.value;
187
- e(r.value, n) && (yield r.value), n += 1;
176
+ t(r.value, n) && (yield r.value), n += 1;
188
177
  }
189
178
  });
190
179
  }
191
- map(e) {
192
- const t = this._iterator;
180
+ map(t) {
181
+ const e = this._iterator;
193
182
  return new l(function* () {
194
183
  let n = 0;
195
184
  for (; ; ) {
196
- const r = t.next();
185
+ const r = e.next();
197
186
  if (r.done)
198
187
  return r.value;
199
- yield e(r.value, n), n += 1;
188
+ yield t(r.value, n), n += 1;
200
189
  }
201
190
  });
202
191
  }
203
- reduce(e, t) {
204
- let n = 0, r = t;
192
+ reduce(t, e) {
193
+ let n = 0, r = e;
205
194
  if (r === void 0) {
206
195
  const s = this._iterator.next();
207
196
  if (s.done)
208
- throw new m("Cannot reduce an empty iterator without an initial value.");
197
+ throw new d("Cannot reduce an empty iterator without an initial value.");
209
198
  r = s.value, n += 1;
210
199
  }
211
200
  for (; ; ) {
212
201
  const s = this._iterator.next();
213
202
  if (s.done)
214
203
  return r;
215
- r = e(r, s.value, n), n += 1;
204
+ r = t(r, s.value, n), n += 1;
216
205
  }
217
206
  }
218
- flatMap(e) {
219
- const t = this._iterator;
207
+ flatMap(t) {
208
+ const e = this._iterator;
220
209
  return new l(function* () {
221
210
  let n = 0;
222
211
  for (; ; ) {
223
- const r = t.next();
212
+ const r = e.next();
224
213
  if (r.done)
225
214
  return r.value;
226
- const s = e(r.value, n);
215
+ const s = t(r.value, n);
227
216
  for (const o of s)
228
217
  yield o;
229
218
  n += 1;
230
219
  }
231
220
  });
232
221
  }
233
- drop(e) {
234
- const t = this._iterator;
222
+ drop(t) {
223
+ const e = this._iterator;
235
224
  return new l(function* () {
236
225
  let n = 0;
237
- for (; n < e; ) {
238
- if (t.next().done)
226
+ for (; n < t; ) {
227
+ if (e.next().done)
239
228
  return;
240
229
  n += 1;
241
230
  }
242
231
  for (; ; ) {
243
- const r = t.next();
232
+ const r = e.next();
244
233
  if (r.done)
245
234
  return r.value;
246
235
  yield r.value;
247
236
  }
248
237
  });
249
238
  }
250
- take(e) {
251
- const t = this._iterator;
239
+ take(t) {
240
+ const e = this._iterator;
252
241
  return new l(function* () {
253
242
  let n = 0;
254
- for (; n < e; ) {
255
- const r = t.next();
243
+ for (; n < t; ) {
244
+ const r = e.next();
256
245
  if (r.done)
257
246
  return r.value;
258
247
  yield r.value, n += 1;
259
248
  }
260
249
  });
261
250
  }
262
- find(e) {
263
- let t = 0;
251
+ find(t) {
252
+ let e = 0;
264
253
  for (; ; ) {
265
254
  const n = this._iterator.next();
266
255
  if (n.done)
267
256
  return;
268
- if (e(n.value, t))
257
+ if (t(n.value, e))
269
258
  return n.value;
270
- t += 1;
259
+ e += 1;
271
260
  }
272
261
  }
273
262
  enumerate() {
274
- return this.map((e, t) => [t, e]);
263
+ return this.map((t, e) => [e, t]);
275
264
  }
276
265
  unique() {
277
- const e = this._iterator;
266
+ const t = this._iterator;
278
267
  return new l(function* () {
279
- const t = /* @__PURE__ */ new Set();
268
+ const e = /* @__PURE__ */ new Set();
280
269
  for (; ; ) {
281
- const n = e.next();
270
+ const n = t.next();
282
271
  if (n.done)
283
272
  return n.value;
284
- t.has(n.value) || (t.add(n.value), yield n.value);
273
+ e.has(n.value) || (e.add(n.value), yield n.value);
285
274
  }
286
275
  });
287
276
  }
288
277
  count() {
289
- let e = 0;
278
+ let t = 0;
290
279
  for (; ; ) {
291
280
  if (this._iterator.next().done)
292
- return e;
293
- e += 1;
281
+ return t;
282
+ t += 1;
294
283
  }
295
284
  }
296
- forEach(e) {
297
- let t = 0;
285
+ forEach(t) {
286
+ let e = 0;
298
287
  for (; ; ) {
299
288
  const n = this._iterator.next();
300
289
  if (n.done)
301
290
  return;
302
- e(n.value, t), t += 1;
291
+ t(n.value, e), e += 1;
303
292
  }
304
293
  }
305
- next(...e) {
306
- return this._iterator.next(...e);
294
+ next(...t) {
295
+ return this._iterator.next(...t);
307
296
  }
308
- groupBy(e) {
309
- return new d(this.map((t, n) => [e(t, n), t]));
297
+ groupBy(t) {
298
+ return new v(this.map((e, n) => [t(e, n), e]));
310
299
  }
311
300
  toArray() {
312
301
  return Array.from(this);
313
302
  }
314
- get [Symbol.toStringTag]() {
315
- return "SmartIterator";
316
- }
317
- [Symbol.iterator]() {
303
+ [(ce = Symbol.toStringTag, Symbol.iterator)]() {
318
304
  return this;
319
305
  }
320
306
  }
321
- class c {
322
- constructor(e) {
323
- u(this, "_elements");
324
- this._elements = new l(e);
325
- }
326
- every(e) {
327
- for (const [t, [n, r]] of this._elements.enumerate())
328
- if (!e(n, r, t))
307
+ var fe;
308
+ fe = Symbol.toStringTag;
309
+ const _ = class _ {
310
+ constructor(t) {
311
+ a(this, "_elements");
312
+ a(this, fe, "ReducedIterator");
313
+ this._elements = new l(t);
314
+ }
315
+ every(t) {
316
+ for (const [e, [n, r]] of this._elements.enumerate())
317
+ if (!t(n, r, e))
329
318
  return !1;
330
319
  return !0;
331
320
  }
332
- some(e) {
333
- for (const [t, [n, r]] of this._elements.enumerate())
334
- if (e(n, r, t))
321
+ some(t) {
322
+ for (const [e, [n, r]] of this._elements.enumerate())
323
+ if (t(n, r, e))
335
324
  return !0;
336
325
  return !1;
337
326
  }
338
- filter(e) {
339
- const t = this._elements.enumerate();
340
- return new c(function* () {
341
- for (const [n, [r, s]] of t)
342
- e(r, s, n) && (yield [r, s]);
327
+ filter(t) {
328
+ const e = this._elements.enumerate();
329
+ return new _(function* () {
330
+ for (const [n, [r, s]] of e)
331
+ t(r, s, n) && (yield [r, s]);
343
332
  });
344
333
  }
345
- map(e) {
346
- const t = this._elements.enumerate();
347
- return new c(function* () {
348
- for (const [n, [r, s]] of t)
349
- yield [r, e(r, s, n)];
334
+ map(t) {
335
+ const e = this._elements.enumerate();
336
+ return new _(function* () {
337
+ for (const [n, [r, s]] of e)
338
+ yield [r, t(r, s, n)];
350
339
  });
351
340
  }
352
- reduce(e, t) {
353
- let n = 0, r = t;
341
+ reduce(t, e) {
342
+ let n = 0, r = e;
354
343
  if (r === void 0) {
355
344
  const s = this._elements.next();
356
345
  if (s.done)
357
- throw new m("Cannot reduce an empty iterator without an initial value.");
346
+ throw new d("Cannot reduce an empty iterator without an initial value.");
358
347
  r = s.value[1], n += 1;
359
348
  }
360
349
  for (const [s, o] of this._elements)
361
- r = e(s, r, o, n), n += 1;
350
+ r = t(s, r, o, n), n += 1;
362
351
  return r;
363
352
  }
364
- flatMap(e) {
365
- const t = this._elements.enumerate();
366
- return new d(function* () {
367
- for (const [n, [r, s]] of t)
368
- for (const o of e(r, s, n))
353
+ flatMap(t) {
354
+ const e = this._elements.enumerate();
355
+ return new v(function* () {
356
+ for (const [n, [r, s]] of e)
357
+ for (const o of t(r, s, n))
369
358
  yield [r, o];
370
359
  });
371
360
  }
372
- drop(e) {
373
- const t = this._elements.enumerate();
374
- return new c(function* () {
375
- for (const [n, [r, s]] of t)
376
- n >= e && (yield [r, s]);
361
+ drop(t) {
362
+ const e = this._elements.enumerate();
363
+ return new _(function* () {
364
+ for (const [n, [r, s]] of e)
365
+ n >= t && (yield [r, s]);
377
366
  });
378
367
  }
379
- take(e) {
380
- const t = this._elements.enumerate();
381
- return new c(function* () {
382
- for (const [n, [r, s]] of t) {
383
- if (n >= e)
368
+ take(t) {
369
+ const e = this._elements.enumerate();
370
+ return new _(function* () {
371
+ for (const [n, [r, s]] of e) {
372
+ if (n >= t)
384
373
  break;
385
374
  yield [r, s];
386
375
  }
387
376
  });
388
377
  }
389
378
  enumerate() {
390
- return this.map((e, t, n) => [n, t]);
379
+ return this.map((t, e, n) => [n, e]);
391
380
  }
392
381
  unique() {
393
- const e = this._elements;
394
- return new c(function* () {
395
- const t = /* @__PURE__ */ new Set();
396
- for (const [n, r] of e)
397
- t.has(r) || (t.add(r), yield [n, r]);
382
+ const t = this._elements;
383
+ return new _(function* () {
384
+ const e = /* @__PURE__ */ new Set();
385
+ for (const [n, r] of t)
386
+ e.has(r) || (e.add(r), yield [n, r]);
398
387
  });
399
388
  }
400
389
  count() {
401
- let e = 0;
402
- for (const t of this._elements)
403
- e += 1;
404
- return e;
390
+ let t = 0;
391
+ for (const e of this._elements)
392
+ t += 1;
393
+ return t;
405
394
  }
406
- forEach(e) {
407
- for (const [t, [n, r]] of this._elements.enumerate())
408
- e(n, r, t);
395
+ forEach(t) {
396
+ for (const [e, [n, r]] of this._elements.enumerate())
397
+ t(n, r, e);
409
398
  }
410
399
  keys() {
411
- const e = this._elements;
400
+ const t = this._elements;
412
401
  return new l(function* () {
413
- for (const [t] of e)
414
- yield t;
402
+ for (const [e] of t)
403
+ yield e;
415
404
  });
416
405
  }
417
406
  items() {
418
407
  return this._elements;
419
408
  }
420
409
  values() {
421
- const e = this._elements;
410
+ const t = this._elements;
422
411
  return new l(function* () {
423
- for (const [t, n] of e)
412
+ for (const [e, n] of t)
424
413
  yield n;
425
414
  });
426
415
  }
@@ -433,95 +422,96 @@ class c {
433
422
  toObject() {
434
423
  return Object.fromEntries(this.items());
435
424
  }
436
- get [Symbol.toStringTag]() {
437
- return "ReducedIterator";
438
- }
439
- }
440
- class w {
441
- constructor(e) {
442
- u(this, "_elements");
443
- this._elements = new h(e);
444
- }
445
- async every(e) {
446
- const t = /* @__PURE__ */ new Map();
425
+ };
426
+ let f = _;
427
+ var he;
428
+ he = Symbol.toStringTag;
429
+ const m = class m {
430
+ constructor(t) {
431
+ a(this, "_elements");
432
+ a(this, he, "AggregatedAsyncIterator");
433
+ this._elements = new h(t);
434
+ }
435
+ async every(t) {
436
+ const e = /* @__PURE__ */ new Map();
447
437
  for await (const [n, r] of this._elements) {
448
- const [s, o] = t.get(n) ?? [0, !0];
449
- o && t.set(n, [s + 1, await e(n, r, s)]);
438
+ const [s, o] = e.get(n) ?? [0, !0];
439
+ o && e.set(n, [s + 1, await t(n, r, s)]);
450
440
  }
451
- return new c(function* () {
452
- for (const [n, [r, s]] of t)
441
+ return new f(function* () {
442
+ for (const [n, [r, s]] of e)
453
443
  yield [n, s];
454
444
  });
455
445
  }
456
- async some(e) {
457
- const t = /* @__PURE__ */ new Map();
446
+ async some(t) {
447
+ const e = /* @__PURE__ */ new Map();
458
448
  for await (const [n, r] of this._elements) {
459
- const [s, o] = t.get(n) ?? [0, !1];
460
- o || t.set(n, [s + 1, await e(n, r, s)]);
449
+ const [s, o] = e.get(n) ?? [0, !1];
450
+ o || e.set(n, [s + 1, await t(n, r, s)]);
461
451
  }
462
- return new c(function* () {
463
- for (const [n, [r, s]] of t)
452
+ return new f(function* () {
453
+ for (const [n, [r, s]] of e)
464
454
  yield [n, s];
465
455
  });
466
456
  }
467
- filter(e) {
468
- const t = this._elements;
469
- return new w(async function* () {
457
+ filter(t) {
458
+ const e = this._elements;
459
+ return new m(async function* () {
470
460
  const n = /* @__PURE__ */ new Map();
471
- for await (const [r, s] of t) {
461
+ for await (const [r, s] of e) {
472
462
  const o = n.get(r) ?? 0;
473
- await e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
463
+ await t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
474
464
  }
475
465
  });
476
466
  }
477
- map(e) {
478
- const t = this._elements;
479
- return new w(async function* () {
467
+ map(t) {
468
+ const e = this._elements;
469
+ return new m(async function* () {
480
470
  const n = /* @__PURE__ */ new Map();
481
- for await (const [r, s] of t) {
471
+ for await (const [r, s] of e) {
482
472
  const o = n.get(r) ?? 0;
483
- yield [r, await e(r, s, o)], n.set(r, o + 1);
473
+ yield [r, await t(r, s, o)], n.set(r, o + 1);
484
474
  }
485
475
  });
486
476
  }
487
- async reduce(e, t) {
477
+ async reduce(t, e) {
488
478
  const n = /* @__PURE__ */ new Map();
489
479
  for await (const [r, s] of this._elements) {
490
- let o, a;
480
+ let o, u;
491
481
  if (n.has(r))
492
- [o, a] = n.get(r);
493
- else if (t !== void 0)
494
- o = 0, a = await t(r);
482
+ [o, u] = n.get(r);
483
+ else if (e !== void 0)
484
+ o = 0, u = await e(r);
495
485
  else {
496
486
  n.set(r, [0, s]);
497
487
  continue;
498
488
  }
499
- n.set(r, [o + 1, await e(r, a, s, o)]);
489
+ n.set(r, [o + 1, await t(r, u, s, o)]);
500
490
  }
501
- return new c(function* () {
491
+ return new f(function* () {
502
492
  for (const [r, [s, o]] of n)
503
493
  yield [r, o];
504
494
  });
505
495
  }
506
- flatMap(e) {
507
- const t = this._elements;
508
- return new w(async function* () {
496
+ flatMap(t) {
497
+ const e = this._elements;
498
+ return new m(async function* () {
509
499
  const n = /* @__PURE__ */ new Map();
510
- for await (const [r, s] of t) {
511
- const o = n.get(r) ?? 0, a = await e(r, s, o);
512
- for await (const p of a)
513
- yield [r, p];
500
+ for await (const [r, s] of e) {
501
+ const o = n.get(r) ?? 0, u = await t(r, s, o);
502
+ for await (const x of u)
503
+ yield [r, x];
514
504
  n.set(r, o + 1);
515
505
  }
516
506
  });
517
507
  }
518
- drop(e) {
519
- const t = this._elements;
520
- return new w(async function* () {
508
+ drop(t) {
509
+ const e = this._elements;
510
+ return new m(async function* () {
521
511
  const n = /* @__PURE__ */ new Map();
522
- for await (const [r, s] of t) {
512
+ for await (const [r, s] of e) {
523
513
  const o = n.get(r) ?? 0;
524
- if (o < e) {
514
+ if (o < t) {
525
515
  n.set(r, o + 1);
526
516
  continue;
527
517
  }
@@ -529,14 +519,14 @@ class w {
529
519
  }
530
520
  });
531
521
  }
532
- take(e) {
533
- const t = this._elements;
534
- return new w(async function* () {
522
+ take(t) {
523
+ const e = this._elements;
524
+ return new m(async function* () {
535
525
  const n = /* @__PURE__ */ new Map();
536
- for await (const [r, s] of t) {
526
+ for await (const [r, s] of e) {
537
527
  const o = n.get(r) ?? 0;
538
- if (o >= e) {
539
- if (n.values().every((a) => a >= e))
528
+ if (o >= t) {
529
+ if (n.values().every((u) => u >= t))
540
530
  break;
541
531
  continue;
542
532
  }
@@ -544,110 +534,110 @@ class w {
544
534
  }
545
535
  });
546
536
  }
547
- async find(e) {
548
- const t = /* @__PURE__ */ new Map();
537
+ async find(t) {
538
+ const e = /* @__PURE__ */ new Map();
549
539
  for await (const [n, r] of this._elements) {
550
- let [s, o] = t.get(n) ?? [0, void 0];
551
- o === void 0 && (await e(n, r, s) && (o = r), t.set(n, [s + 1, o]));
540
+ let [s, o] = e.get(n) ?? [0, void 0];
541
+ o === void 0 && (await t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
552
542
  }
553
- return new c(function* () {
554
- for (const [n, [r, s]] of t)
543
+ return new f(function* () {
544
+ for (const [n, [r, s]] of e)
555
545
  yield [n, s];
556
546
  });
557
547
  }
558
548
  unique() {
559
- const e = this._elements;
560
- return new w(async function* () {
561
- const t = /* @__PURE__ */ new Map();
562
- for await (const [n, r] of e) {
563
- const s = t.get(n) ?? /* @__PURE__ */ new Set();
564
- s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
549
+ const t = this._elements;
550
+ return new m(async function* () {
551
+ const e = /* @__PURE__ */ new Map();
552
+ for await (const [n, r] of t) {
553
+ const s = e.get(n) ?? /* @__PURE__ */ new Set();
554
+ s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
565
555
  }
566
556
  });
567
557
  }
568
558
  async count() {
569
- const e = /* @__PURE__ */ new Map();
570
- for await (const [t] of this._elements) {
571
- const n = e.get(t) ?? 0;
572
- e.set(t, n + 1);
559
+ const t = /* @__PURE__ */ new Map();
560
+ for await (const [e] of this._elements) {
561
+ const n = t.get(e) ?? 0;
562
+ t.set(e, n + 1);
573
563
  }
574
- return new c(function* () {
575
- for (const [t, n] of e)
576
- yield [t, n];
564
+ return new f(function* () {
565
+ for (const [e, n] of t)
566
+ yield [e, n];
577
567
  });
578
568
  }
579
- async forEach(e) {
580
- const t = /* @__PURE__ */ new Map();
569
+ async forEach(t) {
570
+ const e = /* @__PURE__ */ new Map();
581
571
  for await (const [n, r] of this._elements) {
582
- const s = t.get(n) ?? 0;
583
- e(n, r, s), t.set(n, s + 1);
572
+ const s = e.get(n) ?? 0;
573
+ t(n, r, s), e.set(n, s + 1);
584
574
  }
585
575
  }
586
576
  keys() {
587
- const e = this._elements;
577
+ const t = this._elements;
588
578
  return new h(async function* () {
589
- const t = /* @__PURE__ */ new Set();
590
- for await (const [n] of e)
591
- t.has(n) || (t.add(n), yield n);
579
+ const e = /* @__PURE__ */ new Set();
580
+ for await (const [n] of t)
581
+ e.has(n) || (e.add(n), yield n);
592
582
  });
593
583
  }
594
584
  items() {
595
585
  return this._elements;
596
586
  }
597
587
  values() {
598
- const e = this._elements;
588
+ const t = this._elements;
599
589
  return new h(async function* () {
600
- for await (const [t, n] of e)
590
+ for await (const [e, n] of t)
601
591
  yield n;
602
592
  });
603
593
  }
604
594
  async toArray() {
605
- const e = await this.toMap();
606
- return Array.from(e.values());
595
+ const t = await this.toMap();
596
+ return Array.from(t.values());
607
597
  }
608
598
  async toMap() {
609
- const e = /* @__PURE__ */ new Map();
610
- for await (const [t, n] of this._elements) {
611
- const r = e.get(t) ?? [];
612
- r.push(n), e.set(t, r);
599
+ const t = /* @__PURE__ */ new Map();
600
+ for await (const [e, n] of this._elements) {
601
+ const r = t.get(e) ?? [];
602
+ r.push(n), t.set(e, r);
613
603
  }
614
- return e;
604
+ return t;
615
605
  }
616
606
  async toObject() {
617
- const e = {};
618
- for await (const [t, n] of this._elements) {
619
- const r = e[t] ?? [];
620
- r.push(n), e[t] = r;
607
+ const t = {};
608
+ for await (const [e, n] of this._elements) {
609
+ const r = t[e] ?? [];
610
+ r.push(n), t[e] = r;
621
611
  }
622
- return e;
623
- }
624
- get [Symbol.toStringTag]() {
625
- return "AggregatedAsyncIterator";
612
+ return t;
626
613
  }
627
- }
614
+ };
615
+ let S = m;
616
+ var de;
628
617
  class h {
629
- constructor(e) {
630
- u(this, "_iterator");
631
- u(this, "return");
632
- u(this, "throw");
633
- if (e instanceof Function) {
634
- const t = e();
635
- Symbol.asyncIterator in t ? this._iterator = t : this._iterator = async function* () {
618
+ constructor(t) {
619
+ a(this, "_iterator");
620
+ a(this, "return");
621
+ a(this, "throw");
622
+ a(this, de, "SmartAsyncIterator");
623
+ if (t instanceof Function) {
624
+ const e = t();
625
+ Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
636
626
  let n = [];
637
627
  for (; ; ) {
638
- const r = t.next(...n);
628
+ const r = e.next(...n);
639
629
  if (r.done)
640
630
  return r.value;
641
631
  n = [yield r.value];
642
632
  }
643
633
  }();
644
- } else if (Symbol.asyncIterator in e)
645
- this._iterator = e[Symbol.asyncIterator]();
646
- else if (Symbol.iterator in e) {
647
- const t = e[Symbol.iterator]();
634
+ } else if (Symbol.asyncIterator in t)
635
+ this._iterator = t[Symbol.asyncIterator]();
636
+ else if (Symbol.iterator in t) {
637
+ const e = t[Symbol.iterator]();
648
638
  this._iterator = async function* () {
649
639
  for (; ; ) {
650
- const n = t.next();
640
+ const n = e.next();
651
641
  if (n.done)
652
642
  return n.value;
653
643
  yield n.value;
@@ -655,265 +645,265 @@ class h {
655
645
  }();
656
646
  } else
657
647
  this._iterator = async function* () {
658
- let t = [];
648
+ let e = [];
659
649
  for (; ; ) {
660
- const n = await e.next(...t);
650
+ const n = await t.next(...e);
661
651
  if (n.done)
662
652
  return n.value;
663
- t = [yield n.value];
653
+ e = [yield n.value];
664
654
  }
665
655
  }();
666
- this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
656
+ this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
667
657
  }
668
- async every(e) {
669
- let t = 0;
658
+ async every(t) {
659
+ let e = 0;
670
660
  for (; ; ) {
671
661
  const n = await this._iterator.next();
672
662
  if (n.done)
673
663
  return !0;
674
- if (!await e(n.value, t))
664
+ if (!await t(n.value, e))
675
665
  return !1;
676
- t += 1;
666
+ e += 1;
677
667
  }
678
668
  }
679
- async some(e) {
680
- let t = 0;
669
+ async some(t) {
670
+ let e = 0;
681
671
  for (; ; ) {
682
672
  const n = await this._iterator.next();
683
673
  if (n.done)
684
674
  return !1;
685
- if (await e(n.value, t))
675
+ if (await t(n.value, e))
686
676
  return !0;
687
- t += 1;
677
+ e += 1;
688
678
  }
689
679
  }
690
- filter(e) {
691
- const t = this._iterator;
680
+ filter(t) {
681
+ const e = this._iterator;
692
682
  return new h(async function* () {
693
683
  let n = 0;
694
684
  for (; ; ) {
695
- const r = await t.next();
685
+ const r = await e.next();
696
686
  if (r.done)
697
687
  return r.value;
698
- await e(r.value, n) && (yield r.value), n += 1;
688
+ await t(r.value, n) && (yield r.value), n += 1;
699
689
  }
700
690
  });
701
691
  }
702
- map(e) {
703
- const t = this._iterator;
692
+ map(t) {
693
+ const e = this._iterator;
704
694
  return new h(async function* () {
705
695
  let n = 0;
706
696
  for (; ; ) {
707
- const r = await t.next();
697
+ const r = await e.next();
708
698
  if (r.done)
709
699
  return r.value;
710
- yield await e(r.value, n), n += 1;
700
+ yield await t(r.value, n), n += 1;
711
701
  }
712
702
  });
713
703
  }
714
- async reduce(e, t) {
715
- let n = 0, r = t;
704
+ async reduce(t, e) {
705
+ let n = 0, r = e;
716
706
  if (r === void 0) {
717
707
  const s = await this._iterator.next();
718
708
  if (s.done)
719
- throw new m("Cannot reduce an empty iterator without an initial value.");
709
+ throw new d("Cannot reduce an empty iterator without an initial value.");
720
710
  r = s.value, n += 1;
721
711
  }
722
712
  for (; ; ) {
723
713
  const s = await this._iterator.next();
724
714
  if (s.done)
725
715
  return r;
726
- r = await e(r, s.value, n), n += 1;
716
+ r = await t(r, s.value, n), n += 1;
727
717
  }
728
718
  }
729
- flatMap(e) {
730
- const t = this._iterator;
719
+ flatMap(t) {
720
+ const e = this._iterator;
731
721
  return new h(async function* () {
732
722
  let n = 0;
733
723
  for (; ; ) {
734
- const r = await t.next();
724
+ const r = await e.next();
735
725
  if (r.done)
736
726
  return r.value;
737
- const s = await e(r.value, n);
727
+ const s = await t(r.value, n);
738
728
  for await (const o of s)
739
729
  yield o;
740
730
  n += 1;
741
731
  }
742
732
  });
743
733
  }
744
- drop(e) {
745
- const t = this._iterator;
734
+ drop(t) {
735
+ const e = this._iterator;
746
736
  return new h(async function* () {
747
737
  let n = 0;
748
- for (; n < e; ) {
749
- if ((await t.next()).done)
738
+ for (; n < t; ) {
739
+ if ((await e.next()).done)
750
740
  return;
751
741
  n += 1;
752
742
  }
753
743
  for (; ; ) {
754
- const r = await t.next();
744
+ const r = await e.next();
755
745
  if (r.done)
756
746
  return r.value;
757
747
  yield r.value;
758
748
  }
759
749
  });
760
750
  }
761
- take(e) {
762
- const t = this._iterator;
751
+ take(t) {
752
+ const e = this._iterator;
763
753
  return new h(async function* () {
764
754
  let n = 0;
765
- for (; n < e; ) {
766
- const r = await t.next();
755
+ for (; n < t; ) {
756
+ const r = await e.next();
767
757
  if (r.done)
768
758
  return r.value;
769
759
  yield r.value, n += 1;
770
760
  }
771
761
  });
772
762
  }
773
- async find(e) {
774
- let t = 0;
763
+ async find(t) {
764
+ let e = 0;
775
765
  for (; ; ) {
776
766
  const n = await this._iterator.next();
777
767
  if (n.done)
778
768
  return;
779
- if (await e(n.value, t))
769
+ if (await t(n.value, e))
780
770
  return n.value;
781
- t += 1;
771
+ e += 1;
782
772
  }
783
773
  }
784
774
  enumerate() {
785
- return this.map((e, t) => [t, e]);
775
+ return this.map((t, e) => [e, t]);
786
776
  }
787
777
  unique() {
788
- const e = this._iterator;
778
+ const t = this._iterator;
789
779
  return new h(async function* () {
790
- const t = /* @__PURE__ */ new Set();
780
+ const e = /* @__PURE__ */ new Set();
791
781
  for (; ; ) {
792
- const n = await e.next();
782
+ const n = await t.next();
793
783
  if (n.done)
794
784
  return n.value;
795
- t.has(n.value) || (t.add(n.value), yield n.value);
785
+ e.has(n.value) || (e.add(n.value), yield n.value);
796
786
  }
797
787
  });
798
788
  }
799
789
  async count() {
800
- let e = 0;
790
+ let t = 0;
801
791
  for (; ; ) {
802
792
  if ((await this._iterator.next()).done)
803
- return e;
804
- e += 1;
793
+ return t;
794
+ t += 1;
805
795
  }
806
796
  }
807
- async forEach(e) {
808
- let t = 0;
797
+ async forEach(t) {
798
+ let e = 0;
809
799
  for (; ; ) {
810
800
  const n = await this._iterator.next();
811
801
  if (n.done)
812
802
  return;
813
- await e(n.value, t), t += 1;
803
+ await t(n.value, e), e += 1;
814
804
  }
815
805
  }
816
- next(...e) {
817
- return this._iterator.next(...e);
806
+ next(...t) {
807
+ return this._iterator.next(...t);
818
808
  }
819
- groupBy(e) {
820
- return new w(this.map(async (t, n) => [await e(t, n), t]));
809
+ groupBy(t) {
810
+ return new S(this.map(async (e, n) => [await t(e, n), e]));
821
811
  }
822
812
  toArray() {
823
813
  return Array.fromAsync(this);
824
814
  }
825
- get [Symbol.toStringTag]() {
826
- return "SmartAsyncIterator";
827
- }
828
- [Symbol.asyncIterator]() {
815
+ [(de = Symbol.toStringTag, Symbol.asyncIterator)]() {
829
816
  return this;
830
817
  }
831
818
  }
832
- class d {
833
- constructor(e) {
834
- u(this, "_elements");
835
- this._elements = new l(e);
836
- }
837
- every(e) {
838
- const t = /* @__PURE__ */ new Map();
819
+ var me;
820
+ me = Symbol.toStringTag;
821
+ const w = class w {
822
+ constructor(t) {
823
+ a(this, "_elements");
824
+ a(this, me, "AggregatedIterator");
825
+ this._elements = new l(t);
826
+ }
827
+ every(t) {
828
+ const e = /* @__PURE__ */ new Map();
839
829
  for (const [n, r] of this._elements) {
840
- const [s, o] = t.get(n) ?? [0, !0];
841
- o && t.set(n, [s + 1, e(n, r, s)]);
830
+ const [s, o] = e.get(n) ?? [0, !0];
831
+ o && e.set(n, [s + 1, t(n, r, s)]);
842
832
  }
843
- return new c(function* () {
844
- for (const [n, [r, s]] of t)
833
+ return new f(function* () {
834
+ for (const [n, [r, s]] of e)
845
835
  yield [n, s];
846
836
  });
847
837
  }
848
- some(e) {
849
- const t = /* @__PURE__ */ new Map();
838
+ some(t) {
839
+ const e = /* @__PURE__ */ new Map();
850
840
  for (const [n, r] of this._elements) {
851
- const [s, o] = t.get(n) ?? [0, !1];
852
- o || t.set(n, [s + 1, e(n, r, s)]);
841
+ const [s, o] = e.get(n) ?? [0, !1];
842
+ o || e.set(n, [s + 1, t(n, r, s)]);
853
843
  }
854
- return new c(function* () {
855
- for (const [n, [r, s]] of t)
844
+ return new f(function* () {
845
+ for (const [n, [r, s]] of e)
856
846
  yield [n, s];
857
847
  });
858
848
  }
859
- filter(e) {
860
- const t = this._elements;
861
- return new d(function* () {
849
+ filter(t) {
850
+ const e = this._elements;
851
+ return new w(function* () {
862
852
  const n = /* @__PURE__ */ new Map();
863
- for (const [r, s] of t) {
853
+ for (const [r, s] of e) {
864
854
  const o = n.get(r) ?? 0;
865
- e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
855
+ t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
866
856
  }
867
857
  });
868
858
  }
869
- map(e) {
870
- const t = this._elements;
871
- return new d(function* () {
859
+ map(t) {
860
+ const e = this._elements;
861
+ return new w(function* () {
872
862
  const n = /* @__PURE__ */ new Map();
873
- for (const [r, s] of t) {
863
+ for (const [r, s] of e) {
874
864
  const o = n.get(r) ?? 0;
875
- yield [r, e(r, s, o)], n.set(r, o + 1);
865
+ yield [r, t(r, s, o)], n.set(r, o + 1);
876
866
  }
877
867
  });
878
868
  }
879
- reduce(e, t) {
869
+ reduce(t, e) {
880
870
  const n = /* @__PURE__ */ new Map();
881
871
  for (const [r, s] of this._elements) {
882
- let o, a;
872
+ let o, u;
883
873
  if (n.has(r))
884
- [o, a] = n.get(r);
885
- else if (t !== void 0)
886
- o = 0, a = t(r);
874
+ [o, u] = n.get(r);
875
+ else if (e !== void 0)
876
+ o = 0, u = e(r);
887
877
  else {
888
878
  n.set(r, [0, s]);
889
879
  continue;
890
880
  }
891
- n.set(r, [o + 1, e(r, a, s, o)]);
881
+ n.set(r, [o + 1, t(r, u, s, o)]);
892
882
  }
893
- return new c(function* () {
883
+ return new f(function* () {
894
884
  for (const [r, [s, o]] of n)
895
885
  yield [r, o];
896
886
  });
897
887
  }
898
- flatMap(e) {
899
- const t = this._elements;
900
- return new d(function* () {
888
+ flatMap(t) {
889
+ const e = this._elements;
890
+ return new w(function* () {
901
891
  const n = /* @__PURE__ */ new Map();
902
- for (const [r, s] of t) {
903
- const o = n.get(r) ?? 0, a = e(r, s, o);
904
- for (const p of a)
905
- yield [r, p];
892
+ for (const [r, s] of e) {
893
+ const o = n.get(r) ?? 0, u = t(r, s, o);
894
+ for (const x of u)
895
+ yield [r, x];
906
896
  n.set(r, o + 1);
907
897
  }
908
898
  });
909
899
  }
910
- drop(e) {
911
- const t = this._elements;
912
- return new d(function* () {
900
+ drop(t) {
901
+ const e = this._elements;
902
+ return new w(function* () {
913
903
  const n = /* @__PURE__ */ new Map();
914
- for (const [r, s] of t) {
904
+ for (const [r, s] of e) {
915
905
  const o = n.get(r) ?? 0;
916
- if (o < e) {
906
+ if (o < t) {
917
907
  n.set(r, o + 1);
918
908
  continue;
919
909
  }
@@ -921,14 +911,14 @@ class d {
921
911
  }
922
912
  });
923
913
  }
924
- take(e) {
925
- const t = this._elements;
926
- return new d(function* () {
914
+ take(t) {
915
+ const e = this._elements;
916
+ return new w(function* () {
927
917
  const n = /* @__PURE__ */ new Map();
928
- for (const [r, s] of t) {
918
+ for (const [r, s] of e) {
929
919
  const o = n.get(r) ?? 0;
930
- if (o >= e) {
931
- if (n.values().every((a) => a >= e))
920
+ if (o >= t) {
921
+ if (n.values().every((u) => u >= t))
932
922
  break;
933
923
  continue;
934
924
  }
@@ -936,119 +926,104 @@ class d {
936
926
  }
937
927
  });
938
928
  }
939
- find(e) {
940
- const t = /* @__PURE__ */ new Map();
929
+ find(t) {
930
+ const e = /* @__PURE__ */ new Map();
941
931
  for (const [n, r] of this._elements) {
942
- let [s, o] = t.get(n) ?? [0, void 0];
943
- o === void 0 && (e(n, r, s) && (o = r), t.set(n, [s + 1, o]));
932
+ let [s, o] = e.get(n) ?? [0, void 0];
933
+ o === void 0 && (t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
944
934
  }
945
- return new c(function* () {
946
- for (const [n, [r, s]] of t)
935
+ return new f(function* () {
936
+ for (const [n, [r, s]] of e)
947
937
  yield [n, s];
948
938
  });
949
939
  }
950
940
  enumerate() {
951
- return this.map((e, t, n) => [n, t]);
941
+ return this.map((t, e, n) => [n, e]);
952
942
  }
953
943
  unique() {
954
- const e = this._elements;
955
- return new d(function* () {
956
- const t = /* @__PURE__ */ new Map();
957
- for (const [n, r] of e) {
958
- const s = t.get(n) ?? /* @__PURE__ */ new Set();
959
- s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
944
+ const t = this._elements;
945
+ return new w(function* () {
946
+ const e = /* @__PURE__ */ new Map();
947
+ for (const [n, r] of t) {
948
+ const s = e.get(n) ?? /* @__PURE__ */ new Set();
949
+ s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
960
950
  }
961
951
  });
962
952
  }
963
953
  count() {
964
- const e = /* @__PURE__ */ new Map();
965
- for (const [t] of this._elements) {
966
- const n = e.get(t) ?? 0;
967
- e.set(t, n + 1);
954
+ const t = /* @__PURE__ */ new Map();
955
+ for (const [e] of this._elements) {
956
+ const n = t.get(e) ?? 0;
957
+ t.set(e, n + 1);
968
958
  }
969
- return new c(function* () {
970
- for (const [t, n] of e)
971
- yield [t, n];
959
+ return new f(function* () {
960
+ for (const [e, n] of t)
961
+ yield [e, n];
972
962
  });
973
963
  }
974
- forEach(e) {
975
- const t = /* @__PURE__ */ new Map();
964
+ forEach(t) {
965
+ const e = /* @__PURE__ */ new Map();
976
966
  for (const [n, r] of this._elements) {
977
- const s = t.get(n) ?? 0;
978
- e(n, r, s), t.set(n, s + 1);
967
+ const s = e.get(n) ?? 0;
968
+ t(n, r, s), e.set(n, s + 1);
979
969
  }
980
970
  }
981
971
  keys() {
982
- const e = this._elements;
972
+ const t = this._elements;
983
973
  return new l(function* () {
984
- const t = /* @__PURE__ */ new Set();
985
- for (const [n] of e)
986
- t.has(n) || (t.add(n), yield n);
974
+ const e = /* @__PURE__ */ new Set();
975
+ for (const [n] of t)
976
+ e.has(n) || (e.add(n), yield n);
987
977
  });
988
978
  }
989
979
  items() {
990
980
  return this._elements;
991
981
  }
992
982
  values() {
993
- const e = this._elements;
983
+ const t = this._elements;
994
984
  return new l(function* () {
995
- for (const [t, n] of e)
985
+ for (const [e, n] of t)
996
986
  yield n;
997
987
  });
998
988
  }
999
989
  toArray() {
1000
- const e = this.toMap();
1001
- return Array.from(e.values());
990
+ const t = this.toMap();
991
+ return Array.from(t.values());
1002
992
  }
1003
993
  toMap() {
1004
- const e = /* @__PURE__ */ new Map();
1005
- for (const [t, n] of this._elements) {
1006
- const r = e.get(t) ?? [];
1007
- r.push(n), e.set(t, r);
994
+ const t = /* @__PURE__ */ new Map();
995
+ for (const [e, n] of this._elements) {
996
+ const r = t.get(e) ?? [];
997
+ r.push(n), t.set(e, r);
1008
998
  }
1009
- return e;
999
+ return t;
1010
1000
  }
1011
1001
  toObject() {
1012
- const e = {};
1013
- for (const [t, n] of this._elements) {
1014
- const r = e[t] ?? [];
1015
- r.push(n), e[t] = r;
1002
+ const t = {};
1003
+ for (const [e, n] of this._elements) {
1004
+ const r = t[e] ?? [];
1005
+ r.push(n), t[e] = r;
1016
1006
  }
1017
- return e;
1007
+ return t;
1018
1008
  }
1019
- get [Symbol.toStringTag]() {
1020
- return "AggregatedIterator";
1021
- }
1022
- }
1023
- var x = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(x || {});
1024
- function G(i, e, t = 864e5) {
1025
- return i = new Date(i), e = new Date(e), Math.floor((e.getTime() - i.getTime()) / t);
1026
- }
1027
- function H(i, e, t = 864e5) {
1028
- return i = new Date(i), e = new Date(e), new l(function* () {
1029
- const n = e.getTime();
1030
- let r = i.getTime();
1031
- for (; r < n; )
1032
- yield new Date(r), r += t;
1033
- });
1034
- }
1035
- function L(i, e = 864e5) {
1036
- return i = new Date(i), new Date(Math.floor(i.getTime() / e) * e);
1037
- }
1038
- class M {
1039
- constructor(e, t = 30) {
1040
- u(this, "_handle");
1041
- u(this, "_startTime");
1042
- u(this, "_isRunning");
1043
- u(this, "_start");
1044
- u(this, "_stop");
1045
- this._startTime = 0, this._isRunning = !1, S ? (this._start = () => {
1046
- e(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
1009
+ };
1010
+ let v = w;
1011
+ var we;
1012
+ we = Symbol.toStringTag;
1013
+ class je {
1014
+ constructor(t, e = 40) {
1015
+ a(this, "_handle");
1016
+ a(this, "_startTime");
1017
+ a(this, "_isRunning");
1018
+ a(this, "_start");
1019
+ a(this, "_stop");
1020
+ a(this, we, "GameLoop");
1021
+ this._startTime = 0, this._isRunning = !1, Re ? (this._start = () => {
1022
+ t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
1047
1023
  }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
1048
- `Not a browser environment detected. Using setInterval@${t}fps instead of requestAnimationFrame...`
1024
+ `Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
1049
1025
  ), this._start = () => {
1050
- const n = x.Second / t;
1051
- this._handle = setInterval(() => e(this.elapsedTime), n);
1026
+ this._handle = setInterval(() => t(this.elapsedTime), e);
1052
1027
  }, this._stop = () => clearInterval(this._handle));
1053
1028
  }
1054
1029
  get startTime() {
@@ -1060,58 +1035,61 @@ class M {
1060
1035
  get elapsedTime() {
1061
1036
  return performance.now() - this._startTime;
1062
1037
  }
1063
- start(e = 0) {
1038
+ start(t = 0) {
1064
1039
  if (this._isRunning)
1065
- throw new y("The game loop has already been started.");
1066
- this._startTime = performance.now() - e, this._start(), this._isRunning = !0;
1040
+ throw new p("The game loop has already been started.");
1041
+ this._startTime = performance.now() - t, this._start(), this._isRunning = !0;
1067
1042
  }
1068
1043
  stop() {
1069
1044
  if (!this._isRunning)
1070
- throw new y("The game loop hadn't yet started.");
1045
+ throw new p("The game loop hadn't yet started.");
1071
1046
  if (!this._handle)
1072
- throw new _();
1047
+ throw new g();
1073
1048
  this._stop(), this._handle = void 0, this._isRunning = !1;
1074
1049
  }
1075
1050
  }
1076
- class Q {
1077
- constructor(e = !0) {
1078
- u(this, "_preferPersistence");
1079
- u(this, "_volatile");
1080
- u(this, "_persistent");
1081
- if (this._preferPersistence = e, !S)
1082
- throw new C(
1051
+ var _e;
1052
+ _e = Symbol.toStringTag;
1053
+ class Qe {
1054
+ constructor(t = !0) {
1055
+ a(this, "_preferPersistence");
1056
+ a(this, "_volatile");
1057
+ a(this, "_persistent");
1058
+ a(this, _e, "JSONStorage");
1059
+ if (this._preferPersistence = t, !Re)
1060
+ throw new De(
1083
1061
  "The `JSONStorage` class can only be instantiated within a browser environment."
1084
1062
  );
1085
1063
  this._volatile = window.sessionStorage, this._persistent = window.localStorage;
1086
1064
  }
1087
- _get(e, t, n) {
1088
- const r = e.getItem(t);
1065
+ _get(t, e, n) {
1066
+ const r = t.getItem(e);
1089
1067
  if (r)
1090
1068
  try {
1091
1069
  return JSON.parse(r);
1092
1070
  } catch {
1093
1071
  console.warn(
1094
- `The "${r}" value for "${t}" property cannot be parsed. Clearing the storage...`
1095
- ), e.removeItem(t);
1072
+ `The "${r}" value for "${e}" property cannot be parsed. Clearing the storage...`
1073
+ ), t.removeItem(e);
1096
1074
  }
1097
1075
  return n;
1098
1076
  }
1099
- _set(e, t, n) {
1077
+ _set(t, e, n) {
1100
1078
  const r = JSON.stringify(n);
1101
- r ? e.setItem(t, r) : e.removeItem(t);
1079
+ r ? t.setItem(e, r) : t.removeItem(e);
1102
1080
  }
1103
- get(e, t, n = this._preferPersistence) {
1081
+ get(t, e, n = this._preferPersistence) {
1104
1082
  const r = n ? this._persistent : this._volatile;
1105
- return this._get(r, e, t);
1083
+ return this._get(r, t, e);
1106
1084
  }
1107
- recall(e, t) {
1108
- return this._get(this._volatile, e, t);
1085
+ recall(t, e) {
1086
+ return this._get(this._volatile, t, e);
1109
1087
  }
1110
- retrieve(e, t) {
1111
- return this.recall(e) ?? this.read(e, t);
1088
+ retrieve(t, e) {
1089
+ return this.recall(t) ?? this.read(t, e);
1112
1090
  }
1113
- read(e, t) {
1114
- return this._get(this._persistent, e, t);
1091
+ read(t, e) {
1092
+ return this._get(this._persistent, t, e);
1115
1093
  }
1116
1094
  /**
1117
1095
  * Checks whether the property with the specified name exists in the corresponding storage.
@@ -1121,8 +1099,8 @@ class Q {
1121
1099
  *
1122
1100
  * @returns `true` if the property exists, `false` otherwise.
1123
1101
  */
1124
- has(e, t) {
1125
- return (t ? this._persistent : this._volatile).getItem(e) !== null;
1102
+ has(t, e) {
1103
+ return (e ? this._persistent : this._volatile).getItem(t) !== null;
1126
1104
  }
1127
1105
  /**
1128
1106
  * Checks whether the property with the specified name exists in the volatile `sessionStorage`.
@@ -1131,8 +1109,8 @@ class Q {
1131
1109
  *
1132
1110
  * @returns `true` if the property exists, `false` otherwise.
1133
1111
  */
1134
- knows(e) {
1135
- return this._volatile.getItem(e) !== null;
1112
+ knows(t) {
1113
+ return this._volatile.getItem(t) !== null;
1136
1114
  }
1137
1115
  /**
1138
1116
  * Checks whether the property with the specified name exists looking first in the
@@ -1142,8 +1120,8 @@ class Q {
1142
1120
  *
1143
1121
  * @returns `true` if the property exists, `false` otherwise.
1144
1122
  */
1145
- find(e) {
1146
- return this.knows(e) ?? this.exists(e);
1123
+ find(t) {
1124
+ return this.knows(t) ?? this.exists(t);
1147
1125
  }
1148
1126
  /**
1149
1127
  * Checks whether the property with the specified name exists in the persistent `localStorage`.
@@ -1152,8 +1130,8 @@ class Q {
1152
1130
  *
1153
1131
  * @returns `true` if the property exists, `false` otherwise.
1154
1132
  */
1155
- exists(e) {
1156
- return this._persistent.getItem(e) !== null;
1133
+ exists(t) {
1134
+ return this._persistent.getItem(t) !== null;
1157
1135
  }
1158
1136
  /**
1159
1137
  * Sets the value with the specified name in the corresponding storage.
@@ -1163,9 +1141,9 @@ class Q {
1163
1141
  * @param newValue The new value to set.
1164
1142
  * @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
1165
1143
  */
1166
- set(e, t, n = this._preferPersistence) {
1144
+ set(t, e, n = this._preferPersistence) {
1167
1145
  const r = n ? this._persistent : this._volatile;
1168
- this._set(r, e, t);
1146
+ this._set(r, t, e);
1169
1147
  }
1170
1148
  /**
1171
1149
  * Sets the value with the specified name in the volatile `sessionStorage`.
@@ -1174,8 +1152,8 @@ class Q {
1174
1152
  * @param propertyName The name of the property to set.
1175
1153
  * @param newValue The new value to set.
1176
1154
  */
1177
- remember(e, t) {
1178
- this._set(this._volatile, e, t);
1155
+ remember(t, e) {
1156
+ this._set(this._volatile, t, e);
1179
1157
  }
1180
1158
  /**
1181
1159
  * Sets the value with the specified name in the persistent `localStorage`.
@@ -1184,51 +1162,51 @@ class Q {
1184
1162
  * @param propertyName The name of the property to set.
1185
1163
  * @param newValue The new value to set.
1186
1164
  */
1187
- write(e, t) {
1188
- this._set(this._persistent, e, t);
1165
+ write(t, e) {
1166
+ this._set(this._persistent, t, e);
1189
1167
  }
1190
1168
  /**
1191
1169
  * Removes the value with the specified name from the volatile `sessionStorage`.
1192
1170
  *
1193
1171
  * @param propertyName The name of the property to remove.
1194
1172
  */
1195
- forget(e) {
1196
- this._volatile.removeItem(e);
1173
+ forget(t) {
1174
+ this._volatile.removeItem(t);
1197
1175
  }
1198
1176
  /**
1199
1177
  * Removes the value with the specified name from the persistent `localStorage`.
1200
1178
  *
1201
1179
  * @param propertyName The name of the property to remove.
1202
1180
  */
1203
- erase(e) {
1204
- this._persistent.removeItem(e);
1181
+ erase(t) {
1182
+ this._persistent.removeItem(t);
1205
1183
  }
1206
1184
  /**
1207
1185
  * Removes the value with the specified name from all the storages.
1208
1186
  *
1209
1187
  * @param propertyName The name of the property to remove.
1210
1188
  */
1211
- clear(e) {
1212
- this._volatile.removeItem(e), this._persistent.removeItem(e);
1213
- }
1214
- get [Symbol.toStringTag]() {
1215
- return "JSONStorage";
1189
+ clear(t) {
1190
+ this._volatile.removeItem(t), this._persistent.removeItem(t);
1216
1191
  }
1217
1192
  }
1218
- class v {
1219
- constructor(e) {
1220
- u(this, "_isPending");
1221
- u(this, "_isFulfilled");
1222
- u(this, "_isRejected");
1223
- u(this, "_promise");
1193
+ var ye;
1194
+ ye = Symbol.toStringTag;
1195
+ const T = class T {
1196
+ constructor(t) {
1197
+ a(this, "_isPending");
1198
+ a(this, "_isFulfilled");
1199
+ a(this, "_isRejected");
1200
+ a(this, "_promise");
1201
+ a(this, ye, "SmartPromise");
1224
1202
  this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
1225
- const t = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
1203
+ const e = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
1226
1204
  throw this._isPending = !1, this._isRejected = !0, r;
1227
1205
  };
1228
- this._promise = new Promise(e).then(t, n);
1206
+ this._promise = new Promise(t).then(e, n);
1229
1207
  }
1230
- static FromPromise(e) {
1231
- return new v((t, n) => e.then(t, n));
1208
+ static FromPromise(t) {
1209
+ return new T((e, n) => t.then(e, n));
1232
1210
  }
1233
1211
  get isPending() {
1234
1212
  return this._isPending;
@@ -1239,28 +1217,28 @@ class v {
1239
1217
  get isRejected() {
1240
1218
  return this._isRejected;
1241
1219
  }
1242
- then(e, t) {
1243
- return this._promise.then(e, t);
1244
- }
1245
- catch(e) {
1246
- return this._promise.catch(e);
1220
+ then(t, e) {
1221
+ return this._promise.then(t, e);
1247
1222
  }
1248
- finally(e) {
1249
- return this._promise.finally(e);
1223
+ catch(t) {
1224
+ return this._promise.catch(t);
1250
1225
  }
1251
- get [Symbol.toStringTag]() {
1252
- return "SmartPromise";
1226
+ finally(t) {
1227
+ return this._promise.finally(t);
1253
1228
  }
1254
- }
1255
- class q extends v {
1256
- constructor(t, n) {
1229
+ };
1230
+ let b = T;
1231
+ var pe, xe;
1232
+ class Ne extends (xe = b, pe = Symbol.toStringTag, xe) {
1233
+ constructor(e, n) {
1257
1234
  let r, s;
1258
- super((o, a) => {
1259
- r = o, s = a;
1235
+ super((o, u) => {
1236
+ r = o, s = u;
1260
1237
  });
1261
- u(this, "_resolve");
1262
- u(this, "_reject");
1263
- this._promise.then(t, n), this._resolve = r, this._reject = s;
1238
+ a(this, "_resolve");
1239
+ a(this, "_reject");
1240
+ a(this, pe, "DeferredPromise");
1241
+ this._promise.then(e, n), this._resolve = r, this._reject = s;
1264
1242
  }
1265
1243
  get resolve() {
1266
1244
  return this._resolve;
@@ -1268,85 +1246,165 @@ class q extends v {
1268
1246
  get reject() {
1269
1247
  return this._reject;
1270
1248
  }
1271
- watch(t) {
1272
- return t.then(this.resolve, this.reject), this;
1249
+ watch(e) {
1250
+ return e.then(this.resolve, this.reject), this;
1273
1251
  }
1274
- get [Symbol.toStringTag]() {
1275
- return "DeferredPromise";
1252
+ }
1253
+ var ge;
1254
+ ge = Symbol.toStringTag;
1255
+ class Xe {
1256
+ constructor() {
1257
+ a(this, "_onFulfilled");
1258
+ a(this, ge, "Thenable");
1259
+ this._onFulfilled = (t) => t;
1260
+ }
1261
+ _resolve(t) {
1262
+ return this._onFulfilled(t);
1263
+ }
1264
+ then(t, e) {
1265
+ if (e) {
1266
+ const n = this._onFulfilled;
1267
+ this._onFulfilled = (r) => {
1268
+ try {
1269
+ return r = n(r), t(r);
1270
+ } catch (s) {
1271
+ return e(s);
1272
+ }
1273
+ };
1274
+ } else if (t) {
1275
+ const n = this._onFulfilled;
1276
+ this._onFulfilled = (r) => (r = n(r), t(r));
1277
+ }
1278
+ return this;
1279
+ }
1280
+ catch(t) {
1281
+ if (t) {
1282
+ const e = this._onFulfilled;
1283
+ this._onFulfilled = (n) => {
1284
+ try {
1285
+ return e(n);
1286
+ } catch (r) {
1287
+ return t(r);
1288
+ }
1289
+ };
1290
+ }
1291
+ return this;
1292
+ }
1293
+ finally(t) {
1294
+ if (t) {
1295
+ const e = this._onFulfilled;
1296
+ this._onFulfilled = (n) => {
1297
+ try {
1298
+ return e(n);
1299
+ } finally {
1300
+ t();
1301
+ }
1302
+ };
1303
+ }
1304
+ return this;
1276
1305
  }
1277
1306
  }
1278
- class X extends v {
1279
- constructor(e, t) {
1280
- super((n, r) => {
1281
- const s = (g) => {
1282
- clearTimeout(p), n(g);
1283
- }, o = (g) => {
1284
- clearTimeout(p), r(g);
1285
- }, p = setTimeout(() => o(new O("The operation has timed out.")), t);
1286
- e(s, o);
1307
+ var ve, be;
1308
+ class Ze extends (be = b, ve = Symbol.toStringTag, be) {
1309
+ constructor(e, n) {
1310
+ super((r, s) => {
1311
+ const o = (k) => {
1312
+ clearTimeout(F), r(k);
1313
+ }, u = (k) => {
1314
+ clearTimeout(F), s(k);
1315
+ }, F = setTimeout(() => u(new qe("The operation has timed out.")), n);
1316
+ e(o, u);
1287
1317
  });
1288
- }
1289
- get [Symbol.toStringTag]() {
1290
- return "TimedPromise";
1318
+ a(this, ve, "TimedPromise");
1291
1319
  }
1292
1320
  }
1293
- class F {
1321
+ var ke;
1322
+ ke = Symbol.toStringTag;
1323
+ class y {
1294
1324
  constructor() {
1295
- u(this, "_subscribers");
1325
+ a(this, "_subscribers");
1326
+ a(this, ke, "Publisher");
1296
1327
  this._subscribers = [];
1297
1328
  }
1298
- subscribe(e) {
1299
- return this._subscribers.push(e), () => {
1300
- const t = this._subscribers.indexOf(e);
1301
- if (t < 0)
1302
- throw new D("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1303
- this._subscribers.splice(t, 1);
1329
+ subscribe(t) {
1330
+ return this._subscribers.push(t), () => {
1331
+ const e = this._subscribers.indexOf(t);
1332
+ if (e < 0)
1333
+ throw new Ce("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1334
+ this._subscribers.splice(e, 1);
1304
1335
  };
1305
1336
  }
1306
- publish(...e) {
1307
- return this._subscribers.slice().map((t) => t(...e));
1308
- }
1309
- get [Symbol.toStringTag]() {
1310
- return "Publisher";
1337
+ publish(...t) {
1338
+ return this._subscribers.slice().map((e) => e(...t));
1311
1339
  }
1312
1340
  }
1313
- class Z extends M {
1314
- constructor(t = x.Second) {
1315
- super((n) => this._publisher.publish(n), t);
1316
- u(this, "_publisher");
1317
- this._publisher = new F();
1341
+ var E = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(E || {});
1342
+ function Ue(i, t, e = 864e5) {
1343
+ return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
1344
+ }
1345
+ function et(i, t, e = 864e5) {
1346
+ return i = new Date(i), t = new Date(t), new l(function* () {
1347
+ const n = t.getTime();
1348
+ let r = i.getTime();
1349
+ for (; r < n; )
1350
+ yield new Date(r), r += e;
1351
+ });
1352
+ }
1353
+ function tt(i, t = 864e5) {
1354
+ return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
1355
+ }
1356
+ var Se, Ee;
1357
+ class nt extends (Ee = je, Se = Symbol.toStringTag, Ee) {
1358
+ constructor(e = E.Second) {
1359
+ super((n) => this._ticker.publish(n), e);
1360
+ a(this, "_starter");
1361
+ a(this, "_stopper");
1362
+ a(this, "_ticker");
1363
+ a(this, Se, "Clock");
1364
+ this._starter = new y(), this._stopper = new y(), this._ticker = new y();
1318
1365
  }
1319
- start(t = 0) {
1366
+ start(e = 0) {
1320
1367
  if (this._isRunning)
1321
- throw new y("The clock has already been started.");
1322
- super.start(t);
1368
+ throw new p("The clock has already been started.");
1369
+ super.start(e), this._starter.publish();
1323
1370
  }
1324
1371
  stop() {
1325
1372
  if (!this._isRunning)
1326
- throw new y("The clock hadn't yet started.");
1327
- super.stop();
1373
+ throw new p("The clock hadn't yet started.");
1374
+ super.stop(), this._stopper.publish();
1375
+ }
1376
+ onStart(e) {
1377
+ return this._starter.subscribe(e);
1378
+ }
1379
+ onStop(e) {
1380
+ return this._stopper.subscribe(e);
1328
1381
  }
1329
- onTick(t, n = 0) {
1382
+ onTick(e, n = 0) {
1330
1383
  if (n < 0)
1331
- throw new T("The tick step must be a non-negative number.");
1384
+ throw new Ie("The tick step must be a non-negative number.");
1332
1385
  if (n === 0)
1333
- return this._publisher.subscribe(t);
1386
+ return this._ticker.subscribe(e);
1334
1387
  let r = 0;
1335
- return this._publisher.subscribe((s) => {
1336
- s - r < n || (t(s), r = s);
1388
+ return this._ticker.subscribe((s) => {
1389
+ s - r < n || (e(s), r = s);
1337
1390
  });
1338
1391
  }
1339
1392
  }
1340
- class U extends M {
1341
- constructor(t, n = x.Second) {
1393
+ var Te, Me;
1394
+ class rt extends (Me = je, Te = Symbol.toStringTag, Me) {
1395
+ constructor(e, n = E.Second) {
1342
1396
  super(() => {
1343
1397
  const s = this.remainingTime;
1344
- this._publisher.publish(s), s <= 0 && this.stop();
1398
+ this._ticker.publish(s), s <= 0 && (this._deferrerStop(), this._expirer.publish());
1345
1399
  }, n);
1346
- u(this, "_deferrer");
1347
- u(this, "_publisher");
1348
- u(this, "_duration");
1349
- this._publisher = new F(), this._duration = t;
1400
+ a(this, "_deferrer");
1401
+ a(this, "_expirer");
1402
+ a(this, "_starter");
1403
+ a(this, "_stopper");
1404
+ a(this, "_ticker");
1405
+ a(this, "_duration");
1406
+ a(this, Te, "Countdown");
1407
+ this._expirer = new y(), this._starter = new y(), this._stopper = new y(), this._ticker = new y(), this._duration = e;
1350
1408
  }
1351
1409
  get duration() {
1352
1410
  return this._duration;
@@ -1354,210 +1412,226 @@ class U extends M {
1354
1412
  get remainingTime() {
1355
1413
  return this._duration - this.elapsedTime;
1356
1414
  }
1357
- start(t = this.duration) {
1415
+ _deferrerStop(e) {
1416
+ if (!this._isRunning)
1417
+ throw new p("The countdown hadn't yet started.");
1418
+ if (!this._deferrer)
1419
+ throw new g();
1420
+ super.stop(), e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
1421
+ }
1422
+ start(e = this.duration) {
1358
1423
  if (this._isRunning)
1359
- throw new y("The countdown has already been started.");
1424
+ throw new p("The countdown has already been started.");
1360
1425
  if (this._deferrer)
1361
- throw new _();
1362
- return this._deferrer = new q(), super.start(this.duration - t), this._deferrer;
1426
+ throw new g();
1427
+ return this._deferrer = new Ne(), super.start(this.duration - e), this._starter.publish(), this._deferrer;
1363
1428
  }
1364
- stop(t) {
1365
- if (!this._isRunning)
1366
- throw new y("The countdown hadn't yet started.");
1367
- if (!this._deferrer)
1368
- throw new _();
1369
- super.stop(), t !== void 0 ? this._deferrer.reject(t) : this._deferrer.resolve(), this._deferrer = void 0;
1429
+ stop(e) {
1430
+ this._deferrerStop(e), this._stopper.publish(e);
1431
+ }
1432
+ onExpire(e) {
1433
+ return this._expirer.subscribe(e);
1434
+ }
1435
+ onStart(e) {
1436
+ return this._starter.subscribe(e);
1370
1437
  }
1371
- onTick(t, n = 0) {
1438
+ onStop(e) {
1439
+ return this._stopper.subscribe(e);
1440
+ }
1441
+ onTick(e, n = 0) {
1372
1442
  if (n < 0)
1373
- throw new T("The tick step must be a non-negative number.");
1443
+ throw new Ie("The tick step must be a non-negative number.");
1374
1444
  if (n === 0)
1375
- return this._publisher.subscribe(t);
1445
+ return this._ticker.subscribe(e);
1376
1446
  let r = 0;
1377
- return this._publisher.subscribe((s) => {
1378
- r - s < n || (t(s), r = s);
1447
+ return this._ticker.subscribe((s) => {
1448
+ r - s < n || (e(s), r = s);
1379
1449
  });
1380
1450
  }
1381
1451
  }
1382
- class R {
1383
- static Boolean(e = 0.5) {
1384
- return Math.random() < e;
1452
+ var Fe;
1453
+ Fe = Symbol.toStringTag;
1454
+ const M = class M {
1455
+ constructor() {
1456
+ a(this, Fe, "Random");
1385
1457
  }
1386
- static Integer(e, t) {
1387
- return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
1458
+ static Boolean(t = 0.5) {
1459
+ return Math.random() < t;
1388
1460
  }
1389
- static Decimal(e, t) {
1390
- return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
1461
+ static Integer(t, e) {
1462
+ return Math.floor(e === void 0 ? Math.random() * t : Math.random() * (e - t) + t);
1391
1463
  }
1392
- static Index(e) {
1393
- if (e.length === 0)
1394
- throw new m("You must provide at least one element.");
1395
- return this.Integer(e.length);
1464
+ static Decimal(t, e) {
1465
+ return t === void 0 ? Math.random() : e === void 0 ? Math.random() * t : Math.random() * (e - t) + t;
1396
1466
  }
1397
- static Choice(e) {
1398
- return e[R.Index(e)];
1467
+ static Index(t) {
1468
+ if (t.length === 0)
1469
+ throw new d("You must provide at least one element.");
1470
+ return this.Integer(t.length);
1399
1471
  }
1400
- // eslint-disable-next-line no-useless-constructor
1401
- constructor() {
1472
+ static Choice(t) {
1473
+ return t[M.Index(t)];
1402
1474
  }
1475
+ };
1476
+ let R = M;
1477
+ function st(i) {
1478
+ return new Promise((t) => setTimeout(t, i));
1403
1479
  }
1404
- function ee(i) {
1405
- return new Promise((e) => setTimeout(e, i));
1406
- }
1407
- function te() {
1480
+ function it() {
1408
1481
  return new Promise((i) => requestAnimationFrame(() => i()));
1409
1482
  }
1410
- function ne(i, e = "text/javascript") {
1411
- return new Promise((t, n) => {
1483
+ function ot(i, t = "text/javascript") {
1484
+ return new Promise((e, n) => {
1412
1485
  const r = document.createElement("script");
1413
- r.async = !0, r.defer = !0, r.src = i, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
1486
+ r.async = !0, r.defer = !0, r.src = i, r.type = t, r.onload = () => e(), r.onerror = () => n(), document.body.appendChild(r);
1414
1487
  });
1415
1488
  }
1416
- function re(...i) {
1489
+ function at(...i) {
1417
1490
  return new l(function* () {
1418
- for (const e of i)
1419
- for (const t of e)
1420
- yield t;
1491
+ for (const t of i)
1492
+ for (const e of t)
1493
+ yield e;
1421
1494
  });
1422
1495
  }
1423
- function se(i) {
1496
+ function ut(i) {
1424
1497
  if (Array.isArray(i))
1425
1498
  return i.length;
1426
- let e = 0;
1427
- for (const t of i)
1428
- e += 1;
1429
- return e;
1499
+ let t = 0;
1500
+ for (const e of i)
1501
+ t += 1;
1502
+ return t;
1430
1503
  }
1431
- function ie(i) {
1504
+ function lt(i) {
1432
1505
  return new l(function* () {
1433
- let e = 0;
1434
- for (const t of i)
1435
- yield [e, t], e += 1;
1506
+ let t = 0;
1507
+ for (const e of i)
1508
+ yield [t, e], t += 1;
1436
1509
  });
1437
1510
  }
1438
- function oe(i, e, t = 1) {
1511
+ function ct(i, t, e = 1) {
1439
1512
  return new l(function* () {
1440
- e === void 0 && (e = i, i = 0), i > e && (t = t ?? -1);
1441
- for (let n = i; n < e; n += t)
1513
+ t === void 0 && (t = i, i = 0), i > t && (e = e ?? -1);
1514
+ for (let n = i; n < t; n += e)
1442
1515
  yield n;
1443
1516
  });
1444
1517
  }
1445
- function ue(i) {
1446
- const e = Array.from(i);
1447
- for (let t = e.length - 1; t > 0; t -= 1) {
1448
- const n = Math.floor(Math.random() * (t + 1));
1449
- [e[t], e[n]] = [e[n], e[t]];
1518
+ function ft(i) {
1519
+ const t = Array.from(i);
1520
+ for (let e = t.length - 1; e > 0; e -= 1) {
1521
+ const n = Math.floor(Math.random() * (e + 1));
1522
+ [t[e], t[n]] = [t[n], t[e]];
1450
1523
  }
1451
- return e;
1524
+ return t;
1452
1525
  }
1453
- function ae(i) {
1526
+ function ht(i) {
1454
1527
  return new l(function* () {
1455
- const e = /* @__PURE__ */ new Set();
1456
- for (const t of i)
1457
- e.has(t) || (e.add(t), yield t);
1528
+ const t = /* @__PURE__ */ new Set();
1529
+ for (const e of i)
1530
+ t.has(e) || (t.add(e), yield e);
1458
1531
  });
1459
1532
  }
1460
- function I(i, e) {
1533
+ function $e(i, t) {
1461
1534
  return new l(function* () {
1462
- const t = i[Symbol.iterator](), n = e[Symbol.iterator]();
1535
+ const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
1463
1536
  for (; ; ) {
1464
- const r = t.next(), s = n.next();
1537
+ const r = e.next(), s = n.next();
1465
1538
  if (r.done || s.done)
1466
1539
  break;
1467
1540
  yield [r.value, s.value];
1468
1541
  }
1469
1542
  });
1470
1543
  }
1471
- function le(i, e) {
1472
- if (e === void 0) {
1544
+ function dt(i, t) {
1545
+ if (t === void 0) {
1473
1546
  let s = 0, o = 0;
1474
- for (const a of i)
1475
- s += a, o += 1;
1547
+ for (const u of i)
1548
+ s += u, o += 1;
1476
1549
  if (o === 0)
1477
- throw new m("You must provide at least one value.");
1550
+ throw new d("You must provide at least one value.");
1478
1551
  return s / o;
1479
1552
  }
1480
- let t = 0, n = 0, r = 0;
1481
- for (const [s, o] of I(i, e)) {
1553
+ let e = 0, n = 0, r = 0;
1554
+ for (const [s, o] of $e(i, t)) {
1482
1555
  if (o <= 0)
1483
- throw new m(`The weight for the value #${r} must be greater than zero.`);
1484
- t += s * o, n += o, r += 1;
1556
+ throw new d(`The weight for the value #${r} must be greater than zero.`);
1557
+ e += s * o, n += o, r += 1;
1485
1558
  }
1486
1559
  if (r === 0)
1487
- throw new m("You must provide at least one value and weight.");
1560
+ throw new d("You must provide at least one value and weight.");
1488
1561
  if (n > 0)
1489
- throw new m("The sum of weights must be greater than zero.");
1490
- return t / n;
1562
+ throw new d("The sum of weights must be greater than zero.");
1563
+ return e / n;
1491
1564
  }
1492
- function ce(i) {
1493
- let e = 0;
1494
- for (let t = 0; t < i.length; t += 1) {
1495
- const n = i.charCodeAt(t);
1496
- e = (e << 5) - e + n, e |= 0;
1565
+ function mt(i) {
1566
+ let t = 0;
1567
+ for (let e = 0; e < i.length; e += 1) {
1568
+ const n = i.charCodeAt(e);
1569
+ t = (t << 5) - t + n, t |= 0;
1497
1570
  }
1498
- return e;
1571
+ return t;
1499
1572
  }
1500
- function fe(i) {
1501
- let e = 0;
1502
- for (const t of i)
1503
- e += t;
1504
- return e;
1573
+ function wt(i) {
1574
+ let t = 0;
1575
+ for (const e of i)
1576
+ t += e;
1577
+ return t;
1505
1578
  }
1506
- function he(i) {
1579
+ function _t(i) {
1507
1580
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
1508
1581
  }
1509
- const de = "2.0.0-rc.3";
1582
+ const yt = "2.0.0-rc.5";
1510
1583
  export {
1511
- w as AggregatedAsyncIterator,
1512
- d as AggregatedIterator,
1513
- Z as Clock,
1514
- U as Countdown,
1515
- q as DeferredPromise,
1516
- f as Exception,
1517
- _ as FatalErrorException,
1518
- E as FileException,
1519
- V as FileExistsException,
1520
- W as FileNotFoundException,
1521
- M as GameLoop,
1522
- Q as JSONStorage,
1523
- Y as KeyException,
1524
- z as NetworkException,
1525
- J as NotImplementedException,
1526
- B as PermissionException,
1527
- F as Publisher,
1584
+ S as AggregatedAsyncIterator,
1585
+ v as AggregatedIterator,
1586
+ nt as Clock,
1587
+ rt as Countdown,
1588
+ Ne as DeferredPromise,
1589
+ c as Exception,
1590
+ g as FatalErrorException,
1591
+ Pe as FileException,
1592
+ ze as FileExistsException,
1593
+ Be as FileNotFoundException,
1594
+ je as GameLoop,
1595
+ Qe as JSONStorage,
1596
+ Ge as KeyException,
1597
+ Ke as NetworkException,
1598
+ Ye as NotImplementedException,
1599
+ He as PermissionException,
1600
+ y as Publisher,
1528
1601
  R as Random,
1529
- T as RangeException,
1530
- c as ReducedIterator,
1531
- D as ReferenceException,
1532
- y as RuntimeException,
1602
+ Ie as RangeException,
1603
+ f as ReducedIterator,
1604
+ Ce as ReferenceException,
1605
+ p as RuntimeException,
1533
1606
  h as SmartAsyncIterator,
1534
1607
  l as SmartIterator,
1535
- v as SmartPromise,
1536
- x as TimeUnit,
1537
- X as TimedPromise,
1538
- O as TimeoutException,
1539
- K as TypeException,
1540
- de as VERSION,
1541
- m as ValueException,
1542
- le as average,
1543
- he as capitalize,
1544
- re as chain,
1545
- se as count,
1546
- G as dateDifference,
1547
- H as dateRange,
1548
- L as dateRound,
1549
- ee as delay,
1550
- ie as enumerate,
1551
- ce as hash,
1552
- S as isBrowser,
1553
- $ as isNode,
1554
- A as isWebWorker,
1555
- ne as loadScript,
1556
- te as nextAnimationFrame,
1557
- oe as range,
1558
- ue as shuffle,
1559
- fe as sum,
1560
- ae as unique,
1561
- I as zip
1608
+ b as SmartPromise,
1609
+ Xe as Thenable,
1610
+ E as TimeUnit,
1611
+ Ze as TimedPromise,
1612
+ qe as TimeoutException,
1613
+ Le as TypeException,
1614
+ yt as VERSION,
1615
+ d as ValueException,
1616
+ dt as average,
1617
+ _t as capitalize,
1618
+ at as chain,
1619
+ ut as count,
1620
+ Ue as dateDifference,
1621
+ et as dateRange,
1622
+ tt as dateRound,
1623
+ st as delay,
1624
+ lt as enumerate,
1625
+ mt as hash,
1626
+ Re as isBrowser,
1627
+ Ve as isNode,
1628
+ We as isWebWorker,
1629
+ ot as loadScript,
1630
+ it as nextAnimationFrame,
1631
+ ct as range,
1632
+ ft as shuffle,
1633
+ wt as sum,
1634
+ ht as unique,
1635
+ $e as zip
1562
1636
  };
1563
1637
  //# sourceMappingURL=core.js.map