@byloth/core 2.0.0-rc.1 → 2.0.0-rc.3
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 +727 -517
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +8 -7
- package/src/index.ts +10 -12
- package/src/models/aggregators/aggregated-async-iterator.ts +133 -80
- package/src/models/aggregators/aggregated-iterator.ts +132 -81
- package/src/models/aggregators/index.ts +1 -3
- package/src/models/aggregators/reduced-iterator.ts +117 -29
- package/src/models/aggregators/types.ts +15 -10
- package/src/models/index.ts +0 -2
- package/src/models/iterators/smart-async-iterator.ts +109 -17
- package/src/models/iterators/smart-iterator.ts +105 -6
- package/src/models/iterators/types.ts +18 -7
- package/src/models/promises/smart-promise.ts +5 -0
- package/src/models/timers/clock.ts +2 -2
- package/src/models/timers/countdown.ts +6 -8
- package/src/models/types.ts +9 -9
- package/src/utils/async.ts +4 -4
- package/src/models/aggregators/aggregator.ts +0 -46
- package/src/models/aggregators/async-aggregator.ts +0 -56
package/dist/core.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
const
|
|
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
7
|
var k;
|
|
8
|
-
const
|
|
9
|
-
class
|
|
8
|
+
const A = typeof self == "object" && ((k = self.constructor) == null ? void 0 : k.name) === "DedicatedWorkerGlobalScope";
|
|
9
|
+
class f extends Error {
|
|
10
10
|
static FromUnknown(e) {
|
|
11
|
-
if (e instanceof
|
|
11
|
+
if (e instanceof f)
|
|
12
12
|
return e;
|
|
13
13
|
if (e instanceof Error) {
|
|
14
|
-
const t = new
|
|
14
|
+
const t = new f(e.message);
|
|
15
15
|
return t.stack = e.stack, t.name = e.name, t;
|
|
16
16
|
}
|
|
17
|
-
return new
|
|
17
|
+
return new f(`${e}`);
|
|
18
18
|
}
|
|
19
19
|
constructor(e, t, n = "Exception") {
|
|
20
20
|
super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
|
|
@@ -27,7 +27,7 @@ Caused by ${t}`);
|
|
|
27
27
|
return "Exception";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
class
|
|
30
|
+
class _ extends f {
|
|
31
31
|
constructor(e, t, n = "FatalErrorException") {
|
|
32
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
33
|
}
|
|
@@ -35,7 +35,7 @@ class g extends h {
|
|
|
35
35
|
return "FatalErrorException";
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class J extends _ {
|
|
39
39
|
constructor(e, t, n = "NotImplementedException") {
|
|
40
40
|
e === void 0 && (e = "This feature is not implemented yet. Please, try again later."), super(e, t, n);
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ class Y extends g {
|
|
|
43
43
|
return "NotImplementedException";
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
class
|
|
46
|
+
class E extends f {
|
|
47
47
|
constructor(e, t, n = "FileException") {
|
|
48
48
|
super(e, t, n);
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ class T extends h {
|
|
|
51
51
|
return "FileException";
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class V extends E {
|
|
55
55
|
constructor(e, t, n = "FileExistsException") {
|
|
56
56
|
super(e, t, n);
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ class z extends T {
|
|
|
59
59
|
return "FileExistsException";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
class
|
|
62
|
+
class W extends E {
|
|
63
63
|
constructor(e, t, n = "FileNotFoundException") {
|
|
64
64
|
super(e, t, n);
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ class V extends T {
|
|
|
67
67
|
return "FileNotFoundException";
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
class
|
|
70
|
+
class Y extends f {
|
|
71
71
|
constructor(e, t, n = "KeyException") {
|
|
72
72
|
super(e, t, n);
|
|
73
73
|
}
|
|
@@ -75,7 +75,7 @@ class B extends h {
|
|
|
75
75
|
return "KeyException";
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
class
|
|
78
|
+
class z extends f {
|
|
79
79
|
constructor(e, t, n = "NetworkException") {
|
|
80
80
|
super(e, t, n);
|
|
81
81
|
}
|
|
@@ -83,7 +83,7 @@ class K extends h {
|
|
|
83
83
|
return "NetworkException";
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
class
|
|
86
|
+
class B extends f {
|
|
87
87
|
constructor(e, t, n = "PermissionException") {
|
|
88
88
|
super(e, t, n);
|
|
89
89
|
}
|
|
@@ -91,7 +91,7 @@ class G extends h {
|
|
|
91
91
|
return "PermissionException";
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class D extends f {
|
|
95
95
|
constructor(e, t, n = "ReferenceException") {
|
|
96
96
|
super(e, t, n);
|
|
97
97
|
}
|
|
@@ -99,7 +99,7 @@ class q extends h {
|
|
|
99
99
|
return "ReferenceException";
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
class
|
|
102
|
+
class y extends f {
|
|
103
103
|
constructor(e, t, n = "RuntimeException") {
|
|
104
104
|
super(e, t, n);
|
|
105
105
|
}
|
|
@@ -107,7 +107,7 @@ class m extends h {
|
|
|
107
107
|
return "RuntimeException";
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
class
|
|
110
|
+
class C extends y {
|
|
111
111
|
constructor(e, t, n = "EnvironmentException") {
|
|
112
112
|
super(e, t, n);
|
|
113
113
|
}
|
|
@@ -115,7 +115,7 @@ class A extends m {
|
|
|
115
115
|
return "EnvironmentException";
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class O extends f {
|
|
119
119
|
constructor(e, t, n = "TimeoutException") {
|
|
120
120
|
super(e, t, n);
|
|
121
121
|
}
|
|
@@ -123,7 +123,7 @@ class C extends h {
|
|
|
123
123
|
return "TimeoutException";
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class K extends f {
|
|
127
127
|
constructor(e, t, n = "TypeException") {
|
|
128
128
|
super(e, t, n);
|
|
129
129
|
}
|
|
@@ -131,7 +131,7 @@ class H extends h {
|
|
|
131
131
|
return "TypeException";
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
class
|
|
134
|
+
class m extends f {
|
|
135
135
|
constructor(e, t, n = "ValueException") {
|
|
136
136
|
super(e, t, n);
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ class f extends h {
|
|
|
139
139
|
return "ValueException";
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
class
|
|
142
|
+
class T extends m {
|
|
143
143
|
constructor(e, t, n = "RangeException") {
|
|
144
144
|
super(e, t, n);
|
|
145
145
|
}
|
|
@@ -147,7 +147,7 @@ class M extends f {
|
|
|
147
147
|
return "RangeException";
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
class
|
|
150
|
+
class l {
|
|
151
151
|
constructor(e) {
|
|
152
152
|
u(this, "_iterator");
|
|
153
153
|
u(this, "return");
|
|
@@ -178,7 +178,7 @@ class a {
|
|
|
178
178
|
}
|
|
179
179
|
filter(e) {
|
|
180
180
|
const t = this._iterator;
|
|
181
|
-
return new
|
|
181
|
+
return new l(function* () {
|
|
182
182
|
let n = 0;
|
|
183
183
|
for (; ; ) {
|
|
184
184
|
const r = t.next();
|
|
@@ -190,7 +190,7 @@ class a {
|
|
|
190
190
|
}
|
|
191
191
|
map(e) {
|
|
192
192
|
const t = this._iterator;
|
|
193
|
-
return new
|
|
193
|
+
return new l(function* () {
|
|
194
194
|
let n = 0;
|
|
195
195
|
for (; ; ) {
|
|
196
196
|
const r = t.next();
|
|
@@ -203,16 +203,71 @@ class a {
|
|
|
203
203
|
reduce(e, t) {
|
|
204
204
|
let n = 0, r = t;
|
|
205
205
|
if (r === void 0) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
throw new
|
|
209
|
-
r =
|
|
206
|
+
const s = this._iterator.next();
|
|
207
|
+
if (s.done)
|
|
208
|
+
throw new m("Cannot reduce an empty iterator without an initial value.");
|
|
209
|
+
r = s.value, n += 1;
|
|
210
210
|
}
|
|
211
211
|
for (; ; ) {
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
212
|
+
const s = this._iterator.next();
|
|
213
|
+
if (s.done)
|
|
214
214
|
return r;
|
|
215
|
-
r = e(r,
|
|
215
|
+
r = e(r, s.value, n), n += 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
flatMap(e) {
|
|
219
|
+
const t = this._iterator;
|
|
220
|
+
return new l(function* () {
|
|
221
|
+
let n = 0;
|
|
222
|
+
for (; ; ) {
|
|
223
|
+
const r = t.next();
|
|
224
|
+
if (r.done)
|
|
225
|
+
return r.value;
|
|
226
|
+
const s = e(r.value, n);
|
|
227
|
+
for (const o of s)
|
|
228
|
+
yield o;
|
|
229
|
+
n += 1;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
drop(e) {
|
|
234
|
+
const t = this._iterator;
|
|
235
|
+
return new l(function* () {
|
|
236
|
+
let n = 0;
|
|
237
|
+
for (; n < e; ) {
|
|
238
|
+
if (t.next().done)
|
|
239
|
+
return;
|
|
240
|
+
n += 1;
|
|
241
|
+
}
|
|
242
|
+
for (; ; ) {
|
|
243
|
+
const r = t.next();
|
|
244
|
+
if (r.done)
|
|
245
|
+
return r.value;
|
|
246
|
+
yield r.value;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
take(e) {
|
|
251
|
+
const t = this._iterator;
|
|
252
|
+
return new l(function* () {
|
|
253
|
+
let n = 0;
|
|
254
|
+
for (; n < e; ) {
|
|
255
|
+
const r = t.next();
|
|
256
|
+
if (r.done)
|
|
257
|
+
return r.value;
|
|
258
|
+
yield r.value, n += 1;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
find(e) {
|
|
263
|
+
let t = 0;
|
|
264
|
+
for (; ; ) {
|
|
265
|
+
const n = this._iterator.next();
|
|
266
|
+
if (n.done)
|
|
267
|
+
return;
|
|
268
|
+
if (e(n.value, t))
|
|
269
|
+
return n.value;
|
|
270
|
+
t += 1;
|
|
216
271
|
}
|
|
217
272
|
}
|
|
218
273
|
enumerate() {
|
|
@@ -220,7 +275,7 @@ class a {
|
|
|
220
275
|
}
|
|
221
276
|
unique() {
|
|
222
277
|
const e = this._iterator;
|
|
223
|
-
return new
|
|
278
|
+
return new l(function* () {
|
|
224
279
|
const t = /* @__PURE__ */ new Set();
|
|
225
280
|
for (; ; ) {
|
|
226
281
|
const n = e.next();
|
|
@@ -250,6 +305,9 @@ class a {
|
|
|
250
305
|
next(...e) {
|
|
251
306
|
return this._iterator.next(...e);
|
|
252
307
|
}
|
|
308
|
+
groupBy(e) {
|
|
309
|
+
return new d(this.map((t, n) => [e(t, n), t]));
|
|
310
|
+
}
|
|
253
311
|
toArray() {
|
|
254
312
|
return Array.from(this);
|
|
255
313
|
}
|
|
@@ -260,7 +318,314 @@ class a {
|
|
|
260
318
|
return this;
|
|
261
319
|
}
|
|
262
320
|
}
|
|
263
|
-
class
|
|
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))
|
|
329
|
+
return !1;
|
|
330
|
+
return !0;
|
|
331
|
+
}
|
|
332
|
+
some(e) {
|
|
333
|
+
for (const [t, [n, r]] of this._elements.enumerate())
|
|
334
|
+
if (e(n, r, t))
|
|
335
|
+
return !0;
|
|
336
|
+
return !1;
|
|
337
|
+
}
|
|
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]);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
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)];
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
reduce(e, t) {
|
|
353
|
+
let n = 0, r = t;
|
|
354
|
+
if (r === void 0) {
|
|
355
|
+
const s = this._elements.next();
|
|
356
|
+
if (s.done)
|
|
357
|
+
throw new m("Cannot reduce an empty iterator without an initial value.");
|
|
358
|
+
r = s.value[1], n += 1;
|
|
359
|
+
}
|
|
360
|
+
for (const [s, o] of this._elements)
|
|
361
|
+
r = e(s, r, o, n), n += 1;
|
|
362
|
+
return r;
|
|
363
|
+
}
|
|
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))
|
|
369
|
+
yield [r, o];
|
|
370
|
+
});
|
|
371
|
+
}
|
|
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]);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
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)
|
|
384
|
+
break;
|
|
385
|
+
yield [r, s];
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
enumerate() {
|
|
390
|
+
return this.map((e, t, n) => [n, t]);
|
|
391
|
+
}
|
|
392
|
+
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]);
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
count() {
|
|
401
|
+
let e = 0;
|
|
402
|
+
for (const t of this._elements)
|
|
403
|
+
e += 1;
|
|
404
|
+
return e;
|
|
405
|
+
}
|
|
406
|
+
forEach(e) {
|
|
407
|
+
for (const [t, [n, r]] of this._elements.enumerate())
|
|
408
|
+
e(n, r, t);
|
|
409
|
+
}
|
|
410
|
+
keys() {
|
|
411
|
+
const e = this._elements;
|
|
412
|
+
return new l(function* () {
|
|
413
|
+
for (const [t] of e)
|
|
414
|
+
yield t;
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
items() {
|
|
418
|
+
return this._elements;
|
|
419
|
+
}
|
|
420
|
+
values() {
|
|
421
|
+
const e = this._elements;
|
|
422
|
+
return new l(function* () {
|
|
423
|
+
for (const [t, n] of e)
|
|
424
|
+
yield n;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
toArray() {
|
|
428
|
+
return Array.from(this.values());
|
|
429
|
+
}
|
|
430
|
+
toMap() {
|
|
431
|
+
return new Map(this.items());
|
|
432
|
+
}
|
|
433
|
+
toObject() {
|
|
434
|
+
return Object.fromEntries(this.items());
|
|
435
|
+
}
|
|
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();
|
|
447
|
+
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)]);
|
|
450
|
+
}
|
|
451
|
+
return new c(function* () {
|
|
452
|
+
for (const [n, [r, s]] of t)
|
|
453
|
+
yield [n, s];
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
async some(e) {
|
|
457
|
+
const t = /* @__PURE__ */ new Map();
|
|
458
|
+
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)]);
|
|
461
|
+
}
|
|
462
|
+
return new c(function* () {
|
|
463
|
+
for (const [n, [r, s]] of t)
|
|
464
|
+
yield [n, s];
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
filter(e) {
|
|
468
|
+
const t = this._elements;
|
|
469
|
+
return new w(async function* () {
|
|
470
|
+
const n = /* @__PURE__ */ new Map();
|
|
471
|
+
for await (const [r, s] of t) {
|
|
472
|
+
const o = n.get(r) ?? 0;
|
|
473
|
+
await e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
map(e) {
|
|
478
|
+
const t = this._elements;
|
|
479
|
+
return new w(async function* () {
|
|
480
|
+
const n = /* @__PURE__ */ new Map();
|
|
481
|
+
for await (const [r, s] of t) {
|
|
482
|
+
const o = n.get(r) ?? 0;
|
|
483
|
+
yield [r, await e(r, s, o)], n.set(r, o + 1);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
async reduce(e, t) {
|
|
488
|
+
const n = /* @__PURE__ */ new Map();
|
|
489
|
+
for await (const [r, s] of this._elements) {
|
|
490
|
+
let o, a;
|
|
491
|
+
if (n.has(r))
|
|
492
|
+
[o, a] = n.get(r);
|
|
493
|
+
else if (t !== void 0)
|
|
494
|
+
o = 0, a = await t(r);
|
|
495
|
+
else {
|
|
496
|
+
n.set(r, [0, s]);
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
n.set(r, [o + 1, await e(r, a, s, o)]);
|
|
500
|
+
}
|
|
501
|
+
return new c(function* () {
|
|
502
|
+
for (const [r, [s, o]] of n)
|
|
503
|
+
yield [r, o];
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
flatMap(e) {
|
|
507
|
+
const t = this._elements;
|
|
508
|
+
return new w(async function* () {
|
|
509
|
+
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];
|
|
514
|
+
n.set(r, o + 1);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
drop(e) {
|
|
519
|
+
const t = this._elements;
|
|
520
|
+
return new w(async function* () {
|
|
521
|
+
const n = /* @__PURE__ */ new Map();
|
|
522
|
+
for await (const [r, s] of t) {
|
|
523
|
+
const o = n.get(r) ?? 0;
|
|
524
|
+
if (o < e) {
|
|
525
|
+
n.set(r, o + 1);
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
yield [r, s];
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
take(e) {
|
|
533
|
+
const t = this._elements;
|
|
534
|
+
return new w(async function* () {
|
|
535
|
+
const n = /* @__PURE__ */ new Map();
|
|
536
|
+
for await (const [r, s] of t) {
|
|
537
|
+
const o = n.get(r) ?? 0;
|
|
538
|
+
if (o >= e) {
|
|
539
|
+
if (n.values().every((a) => a >= e))
|
|
540
|
+
break;
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
yield [r, s], n.set(r, o + 1);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async find(e) {
|
|
548
|
+
const t = /* @__PURE__ */ new Map();
|
|
549
|
+
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]));
|
|
552
|
+
}
|
|
553
|
+
return new c(function* () {
|
|
554
|
+
for (const [n, [r, s]] of t)
|
|
555
|
+
yield [n, s];
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
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]);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
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);
|
|
573
|
+
}
|
|
574
|
+
return new c(function* () {
|
|
575
|
+
for (const [t, n] of e)
|
|
576
|
+
yield [t, n];
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
async forEach(e) {
|
|
580
|
+
const t = /* @__PURE__ */ new Map();
|
|
581
|
+
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);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
keys() {
|
|
587
|
+
const e = this._elements;
|
|
588
|
+
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);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
items() {
|
|
595
|
+
return this._elements;
|
|
596
|
+
}
|
|
597
|
+
values() {
|
|
598
|
+
const e = this._elements;
|
|
599
|
+
return new h(async function* () {
|
|
600
|
+
for await (const [t, n] of e)
|
|
601
|
+
yield n;
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
async toArray() {
|
|
605
|
+
const e = await this.toMap();
|
|
606
|
+
return Array.from(e.values());
|
|
607
|
+
}
|
|
608
|
+
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);
|
|
613
|
+
}
|
|
614
|
+
return e;
|
|
615
|
+
}
|
|
616
|
+
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;
|
|
621
|
+
}
|
|
622
|
+
return e;
|
|
623
|
+
}
|
|
624
|
+
get [Symbol.toStringTag]() {
|
|
625
|
+
return "AggregatedAsyncIterator";
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
class h {
|
|
264
629
|
constructor(e) {
|
|
265
630
|
u(this, "_iterator");
|
|
266
631
|
u(this, "return");
|
|
@@ -306,7 +671,7 @@ class d {
|
|
|
306
671
|
const n = await this._iterator.next();
|
|
307
672
|
if (n.done)
|
|
308
673
|
return !0;
|
|
309
|
-
if (!e(n.value, t))
|
|
674
|
+
if (!await e(n.value, t))
|
|
310
675
|
return !1;
|
|
311
676
|
t += 1;
|
|
312
677
|
}
|
|
@@ -317,48 +682,103 @@ class d {
|
|
|
317
682
|
const n = await this._iterator.next();
|
|
318
683
|
if (n.done)
|
|
319
684
|
return !1;
|
|
320
|
-
if (e(n.value, t))
|
|
685
|
+
if (await e(n.value, t))
|
|
321
686
|
return !0;
|
|
322
687
|
t += 1;
|
|
323
688
|
}
|
|
324
689
|
}
|
|
325
690
|
filter(e) {
|
|
326
691
|
const t = this._iterator;
|
|
327
|
-
return new
|
|
692
|
+
return new h(async function* () {
|
|
693
|
+
let n = 0;
|
|
694
|
+
for (; ; ) {
|
|
695
|
+
const r = await t.next();
|
|
696
|
+
if (r.done)
|
|
697
|
+
return r.value;
|
|
698
|
+
await e(r.value, n) && (yield r.value), n += 1;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
map(e) {
|
|
703
|
+
const t = this._iterator;
|
|
704
|
+
return new h(async function* () {
|
|
705
|
+
let n = 0;
|
|
706
|
+
for (; ; ) {
|
|
707
|
+
const r = await t.next();
|
|
708
|
+
if (r.done)
|
|
709
|
+
return r.value;
|
|
710
|
+
yield await e(r.value, n), n += 1;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
async reduce(e, t) {
|
|
715
|
+
let n = 0, r = t;
|
|
716
|
+
if (r === void 0) {
|
|
717
|
+
const s = await this._iterator.next();
|
|
718
|
+
if (s.done)
|
|
719
|
+
throw new m("Cannot reduce an empty iterator without an initial value.");
|
|
720
|
+
r = s.value, n += 1;
|
|
721
|
+
}
|
|
722
|
+
for (; ; ) {
|
|
723
|
+
const s = await this._iterator.next();
|
|
724
|
+
if (s.done)
|
|
725
|
+
return r;
|
|
726
|
+
r = await e(r, s.value, n), n += 1;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
flatMap(e) {
|
|
730
|
+
const t = this._iterator;
|
|
731
|
+
return new h(async function* () {
|
|
328
732
|
let n = 0;
|
|
329
733
|
for (; ; ) {
|
|
330
734
|
const r = await t.next();
|
|
331
735
|
if (r.done)
|
|
332
736
|
return r.value;
|
|
333
|
-
|
|
737
|
+
const s = await e(r.value, n);
|
|
738
|
+
for await (const o of s)
|
|
739
|
+
yield o;
|
|
740
|
+
n += 1;
|
|
334
741
|
}
|
|
335
742
|
});
|
|
336
743
|
}
|
|
337
|
-
|
|
744
|
+
drop(e) {
|
|
338
745
|
const t = this._iterator;
|
|
339
|
-
return new
|
|
746
|
+
return new h(async function* () {
|
|
340
747
|
let n = 0;
|
|
748
|
+
for (; n < e; ) {
|
|
749
|
+
if ((await t.next()).done)
|
|
750
|
+
return;
|
|
751
|
+
n += 1;
|
|
752
|
+
}
|
|
341
753
|
for (; ; ) {
|
|
342
754
|
const r = await t.next();
|
|
343
755
|
if (r.done)
|
|
344
756
|
return r.value;
|
|
345
|
-
yield
|
|
757
|
+
yield r.value;
|
|
346
758
|
}
|
|
347
759
|
});
|
|
348
760
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
761
|
+
take(e) {
|
|
762
|
+
const t = this._iterator;
|
|
763
|
+
return new h(async function* () {
|
|
764
|
+
let n = 0;
|
|
765
|
+
for (; n < e; ) {
|
|
766
|
+
const r = await t.next();
|
|
767
|
+
if (r.done)
|
|
768
|
+
return r.value;
|
|
769
|
+
yield r.value, n += 1;
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
async find(e) {
|
|
774
|
+
let t = 0;
|
|
357
775
|
for (; ; ) {
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
return
|
|
361
|
-
|
|
776
|
+
const n = await this._iterator.next();
|
|
777
|
+
if (n.done)
|
|
778
|
+
return;
|
|
779
|
+
if (await e(n.value, t))
|
|
780
|
+
return n.value;
|
|
781
|
+
t += 1;
|
|
362
782
|
}
|
|
363
783
|
}
|
|
364
784
|
enumerate() {
|
|
@@ -366,7 +786,7 @@ class d {
|
|
|
366
786
|
}
|
|
367
787
|
unique() {
|
|
368
788
|
const e = this._iterator;
|
|
369
|
-
return new
|
|
789
|
+
return new h(async function* () {
|
|
370
790
|
const t = /* @__PURE__ */ new Set();
|
|
371
791
|
for (; ; ) {
|
|
372
792
|
const n = await e.next();
|
|
@@ -396,14 +816,11 @@ class d {
|
|
|
396
816
|
next(...e) {
|
|
397
817
|
return this._iterator.next(...e);
|
|
398
818
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return e;
|
|
405
|
-
e.push(t.value);
|
|
406
|
-
}
|
|
819
|
+
groupBy(e) {
|
|
820
|
+
return new w(this.map(async (t, n) => [await e(t, n), t]));
|
|
821
|
+
}
|
|
822
|
+
toArray() {
|
|
823
|
+
return Array.fromAsync(this);
|
|
407
824
|
}
|
|
408
825
|
get [Symbol.toStringTag]() {
|
|
409
826
|
return "SmartAsyncIterator";
|
|
@@ -412,346 +829,160 @@ class d {
|
|
|
412
829
|
return this;
|
|
413
830
|
}
|
|
414
831
|
}
|
|
415
|
-
class
|
|
416
|
-
constructor(e) {
|
|
417
|
-
u(this, "_elements");
|
|
418
|
-
this._elements = new a(e);
|
|
419
|
-
}
|
|
420
|
-
filter(e) {
|
|
421
|
-
const t = this._elements;
|
|
422
|
-
return new l(function* () {
|
|
423
|
-
for (const [n, [r, i]] of t.enumerate())
|
|
424
|
-
e(r, i, n) && (yield [r, i]);
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
map(e) {
|
|
428
|
-
const t = this._elements;
|
|
429
|
-
return new l(function* () {
|
|
430
|
-
for (const [n, [r, i]] of t.enumerate())
|
|
431
|
-
yield [r, e(r, i, n)];
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
reduce(e, t) {
|
|
435
|
-
let n = 0, r;
|
|
436
|
-
if (t !== void 0)
|
|
437
|
-
r = t;
|
|
438
|
-
else {
|
|
439
|
-
const i = this._elements.next();
|
|
440
|
-
if (i.done)
|
|
441
|
-
throw new f("Cannot reduce an empty iterator without an initial value.");
|
|
442
|
-
n += 1, r = i.value[1];
|
|
443
|
-
}
|
|
444
|
-
for (const [i, o] of this._elements)
|
|
445
|
-
r = e(i, r, o, n), n += 1;
|
|
446
|
-
return r;
|
|
447
|
-
}
|
|
448
|
-
keys() {
|
|
449
|
-
const e = this._elements;
|
|
450
|
-
return new a(function* () {
|
|
451
|
-
for (const [t] of e)
|
|
452
|
-
yield t;
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
items() {
|
|
456
|
-
return this._elements;
|
|
457
|
-
}
|
|
458
|
-
values() {
|
|
459
|
-
const e = this._elements;
|
|
460
|
-
return new a(function* () {
|
|
461
|
-
for (const [t, n] of e)
|
|
462
|
-
yield n;
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
toArray() {
|
|
466
|
-
return Array.from(this.values());
|
|
467
|
-
}
|
|
468
|
-
toMap() {
|
|
469
|
-
return new Map(this.items());
|
|
470
|
-
}
|
|
471
|
-
toObject() {
|
|
472
|
-
return Object.fromEntries(this.items());
|
|
473
|
-
}
|
|
474
|
-
get [Symbol.toStringTag]() {
|
|
475
|
-
return "ReducedIterator";
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
class w {
|
|
832
|
+
class d {
|
|
479
833
|
constructor(e) {
|
|
480
834
|
u(this, "_elements");
|
|
481
|
-
this._elements = new
|
|
835
|
+
this._elements = new l(e);
|
|
482
836
|
}
|
|
483
837
|
every(e) {
|
|
484
838
|
const t = /* @__PURE__ */ new Map();
|
|
485
839
|
for (const [n, r] of this._elements) {
|
|
486
|
-
const [
|
|
487
|
-
o && t.set(n, [
|
|
840
|
+
const [s, o] = t.get(n) ?? [0, !0];
|
|
841
|
+
o && t.set(n, [s + 1, e(n, r, s)]);
|
|
488
842
|
}
|
|
489
|
-
return new
|
|
490
|
-
for (const [n, [r,
|
|
491
|
-
yield [n,
|
|
843
|
+
return new c(function* () {
|
|
844
|
+
for (const [n, [r, s]] of t)
|
|
845
|
+
yield [n, s];
|
|
492
846
|
});
|
|
493
847
|
}
|
|
494
848
|
some(e) {
|
|
495
849
|
const t = /* @__PURE__ */ new Map();
|
|
496
850
|
for (const [n, r] of this._elements) {
|
|
497
|
-
const [
|
|
498
|
-
o || t.set(n, [
|
|
851
|
+
const [s, o] = t.get(n) ?? [0, !1];
|
|
852
|
+
o || t.set(n, [s + 1, e(n, r, s)]);
|
|
499
853
|
}
|
|
500
|
-
return new
|
|
501
|
-
for (const [n, [r,
|
|
502
|
-
yield [n,
|
|
854
|
+
return new c(function* () {
|
|
855
|
+
for (const [n, [r, s]] of t)
|
|
856
|
+
yield [n, s];
|
|
503
857
|
});
|
|
504
858
|
}
|
|
505
859
|
filter(e) {
|
|
506
860
|
const t = this._elements;
|
|
507
|
-
return new
|
|
861
|
+
return new d(function* () {
|
|
508
862
|
const n = /* @__PURE__ */ new Map();
|
|
509
|
-
for (const [r,
|
|
863
|
+
for (const [r, s] of t) {
|
|
510
864
|
const o = n.get(r) ?? 0;
|
|
511
|
-
|
|
865
|
+
e(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
512
866
|
}
|
|
513
867
|
});
|
|
514
868
|
}
|
|
515
869
|
map(e) {
|
|
516
870
|
const t = this._elements;
|
|
517
|
-
return new
|
|
871
|
+
return new d(function* () {
|
|
518
872
|
const n = /* @__PURE__ */ new Map();
|
|
519
|
-
for (const [r,
|
|
873
|
+
for (const [r, s] of t) {
|
|
520
874
|
const o = n.get(r) ?? 0;
|
|
521
|
-
|
|
875
|
+
yield [r, e(r, s, o)], n.set(r, o + 1);
|
|
522
876
|
}
|
|
523
877
|
});
|
|
524
878
|
}
|
|
525
879
|
reduce(e, t) {
|
|
526
880
|
const n = /* @__PURE__ */ new Map();
|
|
527
|
-
for (const [r,
|
|
528
|
-
let o,
|
|
881
|
+
for (const [r, s] of this._elements) {
|
|
882
|
+
let o, a;
|
|
529
883
|
if (n.has(r))
|
|
530
|
-
[o,
|
|
884
|
+
[o, a] = n.get(r);
|
|
531
885
|
else if (t !== void 0)
|
|
532
|
-
o = 0,
|
|
886
|
+
o = 0, a = t(r);
|
|
533
887
|
else {
|
|
534
|
-
n.set(r, [0,
|
|
888
|
+
n.set(r, [0, s]);
|
|
535
889
|
continue;
|
|
536
890
|
}
|
|
537
|
-
|
|
891
|
+
n.set(r, [o + 1, e(r, a, s, o)]);
|
|
538
892
|
}
|
|
539
|
-
return new
|
|
540
|
-
for (const [r, [
|
|
893
|
+
return new c(function* () {
|
|
894
|
+
for (const [r, [s, o]] of n)
|
|
541
895
|
yield [r, o];
|
|
542
896
|
});
|
|
543
897
|
}
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
return new
|
|
547
|
-
const
|
|
548
|
-
for (const [
|
|
549
|
-
const
|
|
550
|
-
|
|
898
|
+
flatMap(e) {
|
|
899
|
+
const t = this._elements;
|
|
900
|
+
return new d(function* () {
|
|
901
|
+
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];
|
|
906
|
+
n.set(r, o + 1);
|
|
551
907
|
}
|
|
552
908
|
});
|
|
553
909
|
}
|
|
554
|
-
|
|
555
|
-
const e = /* @__PURE__ */ new Map();
|
|
556
|
-
for (const [t] of this._elements) {
|
|
557
|
-
const n = e.get(t) ?? 0;
|
|
558
|
-
e.set(t, n + 1);
|
|
559
|
-
}
|
|
560
|
-
return new l(function* () {
|
|
561
|
-
for (const [t, n] of e)
|
|
562
|
-
yield [t, n];
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
first() {
|
|
566
|
-
const e = /* @__PURE__ */ new Map();
|
|
567
|
-
for (const [t, n] of this._elements)
|
|
568
|
-
e.has(t) || e.set(t, n);
|
|
569
|
-
return new l(function* () {
|
|
570
|
-
for (const [t, n] of e)
|
|
571
|
-
yield [t, n];
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
last() {
|
|
575
|
-
const e = /* @__PURE__ */ new Map();
|
|
576
|
-
for (const [t, n] of this._elements)
|
|
577
|
-
e.set(t, n);
|
|
578
|
-
return new l(function* () {
|
|
579
|
-
for (const [t, n] of e)
|
|
580
|
-
yield [t, n];
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
keys() {
|
|
584
|
-
const e = this._elements;
|
|
585
|
-
return new a(function* () {
|
|
586
|
-
const t = /* @__PURE__ */ new Set();
|
|
587
|
-
for (const [n] of e)
|
|
588
|
-
t.has(n) || (t.add(n), yield n);
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
items() {
|
|
592
|
-
return this._elements;
|
|
593
|
-
}
|
|
594
|
-
values() {
|
|
595
|
-
const e = this._elements;
|
|
596
|
-
return new a(function* () {
|
|
597
|
-
for (const [t, n] of e)
|
|
598
|
-
yield n;
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
toArray() {
|
|
602
|
-
return Array.from(this.toMap().values());
|
|
603
|
-
}
|
|
604
|
-
toMap() {
|
|
605
|
-
const e = /* @__PURE__ */ new Map();
|
|
606
|
-
for (const [t, n] of this._elements) {
|
|
607
|
-
const r = e.get(t) ?? [];
|
|
608
|
-
r.push(n), e.set(t, r);
|
|
609
|
-
}
|
|
610
|
-
return e;
|
|
611
|
-
}
|
|
612
|
-
toObject() {
|
|
613
|
-
const e = {};
|
|
614
|
-
for (const [t, n] of this._elements) {
|
|
615
|
-
const r = e[t] ?? [];
|
|
616
|
-
r.push(n), e[t] = r;
|
|
617
|
-
}
|
|
618
|
-
return e;
|
|
619
|
-
}
|
|
620
|
-
get [Symbol.toStringTag]() {
|
|
621
|
-
return "AggregatedIterator";
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
class _ {
|
|
625
|
-
constructor(e) {
|
|
626
|
-
u(this, "_elements");
|
|
627
|
-
this._elements = new a(e);
|
|
628
|
-
}
|
|
629
|
-
filter(e) {
|
|
630
|
-
return new _(this._elements.filter(e));
|
|
631
|
-
}
|
|
632
|
-
map(e) {
|
|
633
|
-
return new _(this._elements.map(e));
|
|
634
|
-
}
|
|
635
|
-
unique() {
|
|
636
|
-
return new _(this._elements.unique());
|
|
637
|
-
}
|
|
638
|
-
groupBy(e) {
|
|
639
|
-
return new w(this._elements.map((t, n) => [e(t, n), t]));
|
|
640
|
-
}
|
|
641
|
-
get [Symbol.toStringTag]() {
|
|
642
|
-
return "Aggregator";
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
class y {
|
|
646
|
-
constructor(e) {
|
|
647
|
-
u(this, "_elements");
|
|
648
|
-
this._elements = new d(e);
|
|
649
|
-
}
|
|
650
|
-
async every(e) {
|
|
651
|
-
const t = /* @__PURE__ */ new Map();
|
|
652
|
-
for await (const [n, r] of this._elements) {
|
|
653
|
-
const [i, o] = t.get(n) ?? [0, !0];
|
|
654
|
-
o && t.set(n, [i + 1, await e(n, r, i)]);
|
|
655
|
-
}
|
|
656
|
-
return new l(function* () {
|
|
657
|
-
for (const [n, [r, i]] of t)
|
|
658
|
-
yield [n, i];
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
async some(e) {
|
|
662
|
-
const t = /* @__PURE__ */ new Map();
|
|
663
|
-
for await (const [n, r] of this._elements) {
|
|
664
|
-
const [i, o] = t.get(n) ?? [0, !1];
|
|
665
|
-
o || t.set(n, [i + 1, await e(n, r, i)]);
|
|
666
|
-
}
|
|
667
|
-
return new l(function* () {
|
|
668
|
-
for (const [n, [r, i]] of t)
|
|
669
|
-
yield [n, i];
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
filter(e) {
|
|
910
|
+
drop(e) {
|
|
673
911
|
const t = this._elements;
|
|
674
|
-
return new
|
|
912
|
+
return new d(function* () {
|
|
675
913
|
const n = /* @__PURE__ */ new Map();
|
|
676
|
-
for
|
|
914
|
+
for (const [r, s] of t) {
|
|
677
915
|
const o = n.get(r) ?? 0;
|
|
678
|
-
|
|
916
|
+
if (o < e) {
|
|
917
|
+
n.set(r, o + 1);
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
yield [r, s];
|
|
679
921
|
}
|
|
680
922
|
});
|
|
681
923
|
}
|
|
682
|
-
|
|
924
|
+
take(e) {
|
|
683
925
|
const t = this._elements;
|
|
684
|
-
return new
|
|
926
|
+
return new d(function* () {
|
|
685
927
|
const n = /* @__PURE__ */ new Map();
|
|
686
|
-
for
|
|
928
|
+
for (const [r, s] of t) {
|
|
687
929
|
const o = n.get(r) ?? 0;
|
|
688
|
-
|
|
930
|
+
if (o >= e) {
|
|
931
|
+
if (n.values().every((a) => a >= e))
|
|
932
|
+
break;
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
yield [r, s], n.set(r, o + 1);
|
|
689
936
|
}
|
|
690
937
|
});
|
|
691
938
|
}
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
for
|
|
695
|
-
let o,
|
|
696
|
-
|
|
697
|
-
[o, c] = n.get(r), o += 1;
|
|
698
|
-
else if (t !== void 0)
|
|
699
|
-
o = 0, c = await t(r);
|
|
700
|
-
else {
|
|
701
|
-
n.set(r, [0, i]);
|
|
702
|
-
continue;
|
|
703
|
-
}
|
|
704
|
-
c = await e(r, c, i, o), n.set(r, [o, c]);
|
|
939
|
+
find(e) {
|
|
940
|
+
const t = /* @__PURE__ */ new Map();
|
|
941
|
+
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]));
|
|
705
944
|
}
|
|
706
|
-
return new
|
|
707
|
-
for (const [
|
|
708
|
-
yield [
|
|
945
|
+
return new c(function* () {
|
|
946
|
+
for (const [n, [r, s]] of t)
|
|
947
|
+
yield [n, s];
|
|
709
948
|
});
|
|
710
949
|
}
|
|
950
|
+
enumerate() {
|
|
951
|
+
return this.map((e, t, n) => [n, t]);
|
|
952
|
+
}
|
|
711
953
|
unique() {
|
|
712
954
|
const e = this._elements;
|
|
713
|
-
return new
|
|
955
|
+
return new d(function* () {
|
|
714
956
|
const t = /* @__PURE__ */ new Map();
|
|
715
|
-
for
|
|
716
|
-
const
|
|
717
|
-
|
|
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]);
|
|
718
960
|
}
|
|
719
961
|
});
|
|
720
962
|
}
|
|
721
|
-
|
|
963
|
+
count() {
|
|
722
964
|
const e = /* @__PURE__ */ new Map();
|
|
723
|
-
for
|
|
965
|
+
for (const [t] of this._elements) {
|
|
724
966
|
const n = e.get(t) ?? 0;
|
|
725
967
|
e.set(t, n + 1);
|
|
726
968
|
}
|
|
727
|
-
return new
|
|
728
|
-
for (const [t, n] of e)
|
|
729
|
-
yield [t, n];
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
async first() {
|
|
733
|
-
const e = /* @__PURE__ */ new Map();
|
|
734
|
-
for await (const [t, n] of this._elements)
|
|
735
|
-
e.has(t) || e.set(t, n);
|
|
736
|
-
return new l(function* () {
|
|
969
|
+
return new c(function* () {
|
|
737
970
|
for (const [t, n] of e)
|
|
738
971
|
yield [t, n];
|
|
739
972
|
});
|
|
740
973
|
}
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
for
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
yield [t, n];
|
|
748
|
-
});
|
|
974
|
+
forEach(e) {
|
|
975
|
+
const t = /* @__PURE__ */ new Map();
|
|
976
|
+
for (const [n, r] of this._elements) {
|
|
977
|
+
const s = t.get(n) ?? 0;
|
|
978
|
+
e(n, r, s), t.set(n, s + 1);
|
|
979
|
+
}
|
|
749
980
|
}
|
|
750
981
|
keys() {
|
|
751
982
|
const e = this._elements;
|
|
752
|
-
return new
|
|
983
|
+
return new l(function* () {
|
|
753
984
|
const t = /* @__PURE__ */ new Set();
|
|
754
|
-
for
|
|
985
|
+
for (const [n] of e)
|
|
755
986
|
t.has(n) || (t.add(n), yield n);
|
|
756
987
|
});
|
|
757
988
|
}
|
|
@@ -760,79 +991,58 @@ class y {
|
|
|
760
991
|
}
|
|
761
992
|
values() {
|
|
762
993
|
const e = this._elements;
|
|
763
|
-
return new
|
|
764
|
-
for
|
|
994
|
+
return new l(function* () {
|
|
995
|
+
for (const [t, n] of e)
|
|
765
996
|
yield n;
|
|
766
997
|
});
|
|
767
998
|
}
|
|
768
|
-
|
|
769
|
-
const e =
|
|
999
|
+
toArray() {
|
|
1000
|
+
const e = this.toMap();
|
|
770
1001
|
return Array.from(e.values());
|
|
771
1002
|
}
|
|
772
|
-
|
|
1003
|
+
toMap() {
|
|
773
1004
|
const e = /* @__PURE__ */ new Map();
|
|
774
|
-
for
|
|
1005
|
+
for (const [t, n] of this._elements) {
|
|
775
1006
|
const r = e.get(t) ?? [];
|
|
776
1007
|
r.push(n), e.set(t, r);
|
|
777
1008
|
}
|
|
778
1009
|
return e;
|
|
779
1010
|
}
|
|
780
|
-
|
|
1011
|
+
toObject() {
|
|
781
1012
|
const e = {};
|
|
782
|
-
for
|
|
1013
|
+
for (const [t, n] of this._elements) {
|
|
783
1014
|
const r = e[t] ?? [];
|
|
784
1015
|
r.push(n), e[t] = r;
|
|
785
1016
|
}
|
|
786
1017
|
return e;
|
|
787
1018
|
}
|
|
788
1019
|
get [Symbol.toStringTag]() {
|
|
789
|
-
return "
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
class p {
|
|
793
|
-
constructor(e) {
|
|
794
|
-
u(this, "_elements");
|
|
795
|
-
this._elements = new d(e);
|
|
796
|
-
}
|
|
797
|
-
filter(e) {
|
|
798
|
-
return new p(this._elements.filter(e));
|
|
799
|
-
}
|
|
800
|
-
map(e) {
|
|
801
|
-
return new p(this._elements.map(e));
|
|
802
|
-
}
|
|
803
|
-
unique() {
|
|
804
|
-
return new p(this._elements.unique());
|
|
805
|
-
}
|
|
806
|
-
groupBy(e) {
|
|
807
|
-
return new y(this._elements.map(async (t, n) => [await e(t, n), t]));
|
|
808
|
-
}
|
|
809
|
-
get [Symbol.toStringTag]() {
|
|
810
|
-
return "AsyncAggregator";
|
|
1020
|
+
return "AggregatedIterator";
|
|
811
1021
|
}
|
|
812
1022
|
}
|
|
813
|
-
var x = /* @__PURE__ */ ((
|
|
814
|
-
function
|
|
815
|
-
return
|
|
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);
|
|
816
1026
|
}
|
|
817
|
-
function
|
|
818
|
-
return
|
|
1027
|
+
function H(i, e, t = 864e5) {
|
|
1028
|
+
return i = new Date(i), e = new Date(e), new l(function* () {
|
|
819
1029
|
const n = e.getTime();
|
|
820
|
-
let r =
|
|
1030
|
+
let r = i.getTime();
|
|
821
1031
|
for (; r < n; )
|
|
822
1032
|
yield new Date(r), r += t;
|
|
823
1033
|
});
|
|
824
1034
|
}
|
|
825
|
-
function
|
|
826
|
-
return
|
|
1035
|
+
function L(i, e = 864e5) {
|
|
1036
|
+
return i = new Date(i), new Date(Math.floor(i.getTime() / e) * e);
|
|
827
1037
|
}
|
|
828
|
-
class
|
|
1038
|
+
class M {
|
|
829
1039
|
constructor(e, t = 30) {
|
|
830
1040
|
u(this, "_handle");
|
|
831
1041
|
u(this, "_startTime");
|
|
832
1042
|
u(this, "_isRunning");
|
|
833
1043
|
u(this, "_start");
|
|
834
1044
|
u(this, "_stop");
|
|
835
|
-
this._startTime = 0, this._isRunning = !1,
|
|
1045
|
+
this._startTime = 0, this._isRunning = !1, S ? (this._start = () => {
|
|
836
1046
|
e(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
837
1047
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
838
1048
|
`Not a browser environment detected. Using setInterval@${t}fps instead of requestAnimationFrame...`
|
|
@@ -852,24 +1062,24 @@ class R {
|
|
|
852
1062
|
}
|
|
853
1063
|
start(e = 0) {
|
|
854
1064
|
if (this._isRunning)
|
|
855
|
-
throw new
|
|
1065
|
+
throw new y("The game loop has already been started.");
|
|
856
1066
|
this._startTime = performance.now() - e, this._start(), this._isRunning = !0;
|
|
857
1067
|
}
|
|
858
1068
|
stop() {
|
|
859
1069
|
if (!this._isRunning)
|
|
860
|
-
throw new
|
|
1070
|
+
throw new y("The game loop hadn't yet started.");
|
|
861
1071
|
if (!this._handle)
|
|
862
|
-
throw new
|
|
1072
|
+
throw new _();
|
|
863
1073
|
this._stop(), this._handle = void 0, this._isRunning = !1;
|
|
864
1074
|
}
|
|
865
1075
|
}
|
|
866
|
-
class
|
|
1076
|
+
class Q {
|
|
867
1077
|
constructor(e = !0) {
|
|
868
1078
|
u(this, "_preferPersistence");
|
|
869
1079
|
u(this, "_volatile");
|
|
870
1080
|
u(this, "_persistent");
|
|
871
|
-
if (this._preferPersistence = e, !
|
|
872
|
-
throw new
|
|
1081
|
+
if (this._preferPersistence = e, !S)
|
|
1082
|
+
throw new C(
|
|
873
1083
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
874
1084
|
);
|
|
875
1085
|
this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -1005,7 +1215,7 @@ class Z {
|
|
|
1005
1215
|
return "JSONStorage";
|
|
1006
1216
|
}
|
|
1007
1217
|
}
|
|
1008
|
-
class
|
|
1218
|
+
class v {
|
|
1009
1219
|
constructor(e) {
|
|
1010
1220
|
u(this, "_isPending");
|
|
1011
1221
|
u(this, "_isFulfilled");
|
|
@@ -1017,6 +1227,9 @@ class F {
|
|
|
1017
1227
|
};
|
|
1018
1228
|
this._promise = new Promise(e).then(t, n);
|
|
1019
1229
|
}
|
|
1230
|
+
static FromPromise(e) {
|
|
1231
|
+
return new v((t, n) => e.then(t, n));
|
|
1232
|
+
}
|
|
1020
1233
|
get isPending() {
|
|
1021
1234
|
return this._isPending;
|
|
1022
1235
|
}
|
|
@@ -1039,15 +1252,15 @@ class F {
|
|
|
1039
1252
|
return "SmartPromise";
|
|
1040
1253
|
}
|
|
1041
1254
|
}
|
|
1042
|
-
class
|
|
1255
|
+
class q extends v {
|
|
1043
1256
|
constructor(t, n) {
|
|
1044
|
-
let r,
|
|
1045
|
-
super((o,
|
|
1046
|
-
r = o,
|
|
1257
|
+
let r, s;
|
|
1258
|
+
super((o, a) => {
|
|
1259
|
+
r = o, s = a;
|
|
1047
1260
|
});
|
|
1048
1261
|
u(this, "_resolve");
|
|
1049
1262
|
u(this, "_reject");
|
|
1050
|
-
this._promise.then(t, n), this._resolve = r, this._reject =
|
|
1263
|
+
this._promise.then(t, n), this._resolve = r, this._reject = s;
|
|
1051
1264
|
}
|
|
1052
1265
|
get resolve() {
|
|
1053
1266
|
return this._resolve;
|
|
@@ -1062,22 +1275,22 @@ class O extends F {
|
|
|
1062
1275
|
return "DeferredPromise";
|
|
1063
1276
|
}
|
|
1064
1277
|
}
|
|
1065
|
-
class
|
|
1278
|
+
class X extends v {
|
|
1066
1279
|
constructor(e, t) {
|
|
1067
1280
|
super((n, r) => {
|
|
1068
|
-
const
|
|
1069
|
-
clearTimeout(
|
|
1070
|
-
}, o = (
|
|
1071
|
-
clearTimeout(
|
|
1072
|
-
},
|
|
1073
|
-
e(
|
|
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);
|
|
1074
1287
|
});
|
|
1075
1288
|
}
|
|
1076
1289
|
get [Symbol.toStringTag]() {
|
|
1077
1290
|
return "TimedPromise";
|
|
1078
1291
|
}
|
|
1079
1292
|
}
|
|
1080
|
-
class
|
|
1293
|
+
class F {
|
|
1081
1294
|
constructor() {
|
|
1082
1295
|
u(this, "_subscribers");
|
|
1083
1296
|
this._subscribers = [];
|
|
@@ -1086,7 +1299,7 @@ class P {
|
|
|
1086
1299
|
return this._subscribers.push(e), () => {
|
|
1087
1300
|
const t = this._subscribers.indexOf(e);
|
|
1088
1301
|
if (t < 0)
|
|
1089
|
-
throw new
|
|
1302
|
+
throw new D("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
|
|
1090
1303
|
this._subscribers.splice(t, 1);
|
|
1091
1304
|
};
|
|
1092
1305
|
}
|
|
@@ -1097,44 +1310,43 @@ class P {
|
|
|
1097
1310
|
return "Publisher";
|
|
1098
1311
|
}
|
|
1099
1312
|
}
|
|
1100
|
-
class
|
|
1313
|
+
class Z extends M {
|
|
1101
1314
|
constructor(t = x.Second) {
|
|
1102
1315
|
super((n) => this._publisher.publish(n), t);
|
|
1103
1316
|
u(this, "_publisher");
|
|
1104
|
-
this._publisher = new
|
|
1317
|
+
this._publisher = new F();
|
|
1105
1318
|
}
|
|
1106
1319
|
start(t = 0) {
|
|
1107
1320
|
if (this._isRunning)
|
|
1108
|
-
throw new
|
|
1321
|
+
throw new y("The clock has already been started.");
|
|
1109
1322
|
super.start(t);
|
|
1110
1323
|
}
|
|
1111
1324
|
stop() {
|
|
1112
1325
|
if (!this._isRunning)
|
|
1113
|
-
throw new
|
|
1326
|
+
throw new y("The clock hadn't yet started.");
|
|
1114
1327
|
super.stop();
|
|
1115
1328
|
}
|
|
1116
1329
|
onTick(t, n = 0) {
|
|
1117
1330
|
if (n < 0)
|
|
1118
|
-
throw new
|
|
1331
|
+
throw new T("The tick step must be a non-negative number.");
|
|
1119
1332
|
if (n === 0)
|
|
1120
1333
|
return this._publisher.subscribe(t);
|
|
1121
1334
|
let r = 0;
|
|
1122
|
-
return this._publisher.subscribe((
|
|
1123
|
-
|
|
1335
|
+
return this._publisher.subscribe((s) => {
|
|
1336
|
+
s - r < n || (t(s), r = s);
|
|
1124
1337
|
});
|
|
1125
1338
|
}
|
|
1126
1339
|
}
|
|
1127
|
-
class
|
|
1340
|
+
class U extends M {
|
|
1128
1341
|
constructor(t, n = x.Second) {
|
|
1129
|
-
super((
|
|
1130
|
-
this.
|
|
1131
|
-
|
|
1132
|
-
this._publisher.publish(o), o <= 0 && this.stop();
|
|
1342
|
+
super(() => {
|
|
1343
|
+
const s = this.remainingTime;
|
|
1344
|
+
this._publisher.publish(s), s <= 0 && this.stop();
|
|
1133
1345
|
}, n);
|
|
1134
1346
|
u(this, "_deferrer");
|
|
1135
1347
|
u(this, "_publisher");
|
|
1136
1348
|
u(this, "_duration");
|
|
1137
|
-
this._publisher = new
|
|
1349
|
+
this._publisher = new F(), this._duration = t;
|
|
1138
1350
|
}
|
|
1139
1351
|
get duration() {
|
|
1140
1352
|
return this._duration;
|
|
@@ -1144,30 +1356,30 @@ class te extends R {
|
|
|
1144
1356
|
}
|
|
1145
1357
|
start(t = this.duration) {
|
|
1146
1358
|
if (this._isRunning)
|
|
1147
|
-
throw new
|
|
1359
|
+
throw new y("The countdown has already been started.");
|
|
1148
1360
|
if (this._deferrer)
|
|
1149
|
-
throw new
|
|
1150
|
-
return this._deferrer = new
|
|
1361
|
+
throw new _();
|
|
1362
|
+
return this._deferrer = new q(), super.start(this.duration - t), this._deferrer;
|
|
1151
1363
|
}
|
|
1152
1364
|
stop(t) {
|
|
1153
1365
|
if (!this._isRunning)
|
|
1154
|
-
throw new
|
|
1366
|
+
throw new y("The countdown hadn't yet started.");
|
|
1155
1367
|
if (!this._deferrer)
|
|
1156
|
-
throw new
|
|
1368
|
+
throw new _();
|
|
1157
1369
|
super.stop(), t !== void 0 ? this._deferrer.reject(t) : this._deferrer.resolve(), this._deferrer = void 0;
|
|
1158
1370
|
}
|
|
1159
1371
|
onTick(t, n = 0) {
|
|
1160
1372
|
if (n < 0)
|
|
1161
|
-
throw new
|
|
1373
|
+
throw new T("The tick step must be a non-negative number.");
|
|
1162
1374
|
if (n === 0)
|
|
1163
1375
|
return this._publisher.subscribe(t);
|
|
1164
1376
|
let r = 0;
|
|
1165
|
-
return this._publisher.subscribe((
|
|
1166
|
-
r -
|
|
1377
|
+
return this._publisher.subscribe((s) => {
|
|
1378
|
+
r - s < n || (t(s), r = s);
|
|
1167
1379
|
});
|
|
1168
1380
|
}
|
|
1169
1381
|
}
|
|
1170
|
-
class
|
|
1382
|
+
class R {
|
|
1171
1383
|
static Boolean(e = 0.5) {
|
|
1172
1384
|
return Math.random() < e;
|
|
1173
1385
|
}
|
|
@@ -1179,175 +1391,173 @@ class I {
|
|
|
1179
1391
|
}
|
|
1180
1392
|
static Index(e) {
|
|
1181
1393
|
if (e.length === 0)
|
|
1182
|
-
throw new
|
|
1394
|
+
throw new m("You must provide at least one element.");
|
|
1183
1395
|
return this.Integer(e.length);
|
|
1184
1396
|
}
|
|
1185
1397
|
static Choice(e) {
|
|
1186
|
-
return e[
|
|
1398
|
+
return e[R.Index(e)];
|
|
1187
1399
|
}
|
|
1188
1400
|
// eslint-disable-next-line no-useless-constructor
|
|
1189
1401
|
constructor() {
|
|
1190
1402
|
}
|
|
1191
1403
|
}
|
|
1192
|
-
|
|
1193
|
-
return new Promise((e
|
|
1404
|
+
function ee(i) {
|
|
1405
|
+
return new Promise((e) => setTimeout(e, i));
|
|
1194
1406
|
}
|
|
1195
|
-
|
|
1196
|
-
return new Promise((
|
|
1407
|
+
function te() {
|
|
1408
|
+
return new Promise((i) => requestAnimationFrame(() => i()));
|
|
1197
1409
|
}
|
|
1198
|
-
function
|
|
1410
|
+
function ne(i, e = "text/javascript") {
|
|
1199
1411
|
return new Promise((t, n) => {
|
|
1200
1412
|
const r = document.createElement("script");
|
|
1201
|
-
r.async = !0, r.defer = !0, r.src =
|
|
1413
|
+
r.async = !0, r.defer = !0, r.src = i, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
|
|
1202
1414
|
});
|
|
1203
1415
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return new
|
|
1206
|
-
for (const e of
|
|
1416
|
+
function re(...i) {
|
|
1417
|
+
return new l(function* () {
|
|
1418
|
+
for (const e of i)
|
|
1207
1419
|
for (const t of e)
|
|
1208
1420
|
yield t;
|
|
1209
1421
|
});
|
|
1210
1422
|
}
|
|
1211
|
-
function
|
|
1212
|
-
if (Array.isArray(
|
|
1213
|
-
return
|
|
1423
|
+
function se(i) {
|
|
1424
|
+
if (Array.isArray(i))
|
|
1425
|
+
return i.length;
|
|
1214
1426
|
let e = 0;
|
|
1215
|
-
for (const t of
|
|
1427
|
+
for (const t of i)
|
|
1216
1428
|
e += 1;
|
|
1217
1429
|
return e;
|
|
1218
1430
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return new
|
|
1431
|
+
function ie(i) {
|
|
1432
|
+
return new l(function* () {
|
|
1221
1433
|
let e = 0;
|
|
1222
|
-
for (const t of
|
|
1434
|
+
for (const t of i)
|
|
1223
1435
|
yield [e, t], e += 1;
|
|
1224
1436
|
});
|
|
1225
1437
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return new
|
|
1228
|
-
e === void 0 && (e =
|
|
1229
|
-
for (let n =
|
|
1438
|
+
function oe(i, e, t = 1) {
|
|
1439
|
+
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)
|
|
1230
1442
|
yield n;
|
|
1231
1443
|
});
|
|
1232
1444
|
}
|
|
1233
|
-
function
|
|
1234
|
-
const e = Array.from(
|
|
1445
|
+
function ue(i) {
|
|
1446
|
+
const e = Array.from(i);
|
|
1235
1447
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
1236
1448
|
const n = Math.floor(Math.random() * (t + 1));
|
|
1237
1449
|
[e[t], e[n]] = [e[n], e[t]];
|
|
1238
1450
|
}
|
|
1239
1451
|
return e;
|
|
1240
1452
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return new
|
|
1453
|
+
function ae(i) {
|
|
1454
|
+
return new l(function* () {
|
|
1243
1455
|
const e = /* @__PURE__ */ new Set();
|
|
1244
|
-
for (const t of
|
|
1456
|
+
for (const t of i)
|
|
1245
1457
|
e.has(t) || (e.add(t), yield t);
|
|
1246
1458
|
});
|
|
1247
1459
|
}
|
|
1248
|
-
function
|
|
1249
|
-
return new
|
|
1250
|
-
const t =
|
|
1460
|
+
function I(i, e) {
|
|
1461
|
+
return new l(function* () {
|
|
1462
|
+
const t = i[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
1251
1463
|
for (; ; ) {
|
|
1252
|
-
const r = t.next(),
|
|
1253
|
-
if (r.done ||
|
|
1464
|
+
const r = t.next(), s = n.next();
|
|
1465
|
+
if (r.done || s.done)
|
|
1254
1466
|
break;
|
|
1255
|
-
yield [r.value,
|
|
1467
|
+
yield [r.value, s.value];
|
|
1256
1468
|
}
|
|
1257
1469
|
});
|
|
1258
1470
|
}
|
|
1259
|
-
function
|
|
1471
|
+
function le(i, e) {
|
|
1260
1472
|
if (e === void 0) {
|
|
1261
|
-
let
|
|
1262
|
-
for (const
|
|
1263
|
-
|
|
1473
|
+
let s = 0, o = 0;
|
|
1474
|
+
for (const a of i)
|
|
1475
|
+
s += a, o += 1;
|
|
1264
1476
|
if (o === 0)
|
|
1265
|
-
throw new
|
|
1266
|
-
return
|
|
1477
|
+
throw new m("You must provide at least one value.");
|
|
1478
|
+
return s / o;
|
|
1267
1479
|
}
|
|
1268
1480
|
let t = 0, n = 0, r = 0;
|
|
1269
|
-
for (const [
|
|
1481
|
+
for (const [s, o] of I(i, e)) {
|
|
1270
1482
|
if (o <= 0)
|
|
1271
|
-
throw new
|
|
1272
|
-
t +=
|
|
1483
|
+
throw new m(`The weight for the value #${r} must be greater than zero.`);
|
|
1484
|
+
t += s * o, n += o, r += 1;
|
|
1273
1485
|
}
|
|
1274
1486
|
if (r === 0)
|
|
1275
|
-
throw new
|
|
1487
|
+
throw new m("You must provide at least one value and weight.");
|
|
1276
1488
|
if (n > 0)
|
|
1277
|
-
throw new
|
|
1489
|
+
throw new m("The sum of weights must be greater than zero.");
|
|
1278
1490
|
return t / n;
|
|
1279
1491
|
}
|
|
1280
|
-
function
|
|
1492
|
+
function ce(i) {
|
|
1281
1493
|
let e = 0;
|
|
1282
|
-
for (let t = 0; t <
|
|
1283
|
-
const n =
|
|
1494
|
+
for (let t = 0; t < i.length; t += 1) {
|
|
1495
|
+
const n = i.charCodeAt(t);
|
|
1284
1496
|
e = (e << 5) - e + n, e |= 0;
|
|
1285
1497
|
}
|
|
1286
1498
|
return e;
|
|
1287
1499
|
}
|
|
1288
|
-
function
|
|
1500
|
+
function fe(i) {
|
|
1289
1501
|
let e = 0;
|
|
1290
|
-
for (const t of
|
|
1502
|
+
for (const t of i)
|
|
1291
1503
|
e += t;
|
|
1292
1504
|
return e;
|
|
1293
1505
|
}
|
|
1294
|
-
function
|
|
1295
|
-
return `${
|
|
1506
|
+
function he(i) {
|
|
1507
|
+
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
1296
1508
|
}
|
|
1297
|
-
const
|
|
1509
|
+
const de = "2.0.0-rc.3";
|
|
1298
1510
|
export {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
a as SmartIterator,
|
|
1325
|
-
F as SmartPromise,
|
|
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,
|
|
1528
|
+
R as Random,
|
|
1529
|
+
T as RangeException,
|
|
1530
|
+
c as ReducedIterator,
|
|
1531
|
+
D as ReferenceException,
|
|
1532
|
+
y as RuntimeException,
|
|
1533
|
+
h as SmartAsyncIterator,
|
|
1534
|
+
l as SmartIterator,
|
|
1535
|
+
v as SmartPromise,
|
|
1326
1536
|
x as TimeUnit,
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
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
|
|
1352
1562
|
};
|
|
1353
1563
|
//# sourceMappingURL=core.js.map
|