@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 +872 -798
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +3 -3
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +6 -9
- package/src/helpers.ts +7 -0
- package/src/index.ts +2 -1
- package/src/models/aggregators/aggregated-async-iterator.ts +4 -4
- package/src/models/aggregators/aggregated-iterator.ts +4 -4
- package/src/models/aggregators/reduced-iterator.ts +1 -1
- package/src/models/exceptions/core.ts +3 -3
- package/src/models/exceptions/index.ts +13 -13
- package/src/models/game-loop.ts +9 -9
- package/src/models/index.ts +1 -1
- package/src/models/iterators/smart-async-iterator.ts +6 -12
- package/src/models/iterators/smart-iterator.ts +8 -14
- package/src/models/iterators/types.ts +0 -1
- package/src/models/json/json-storage.ts +2 -3
- package/src/models/json/types.ts +5 -1
- package/src/models/promises/deferred-promise.ts +1 -1
- package/src/models/promises/index.ts +2 -1
- package/src/models/promises/smart-promise.ts +1 -1
- package/src/models/promises/thenable.ts +97 -0
- package/src/models/promises/timed-promise.ts +1 -1
- package/src/models/publisher.ts +1 -1
- package/src/models/timers/clock.ts +25 -6
- package/src/models/timers/countdown.ts +52 -14
- package/src/utils/date.ts +3 -0
- package/src/utils/random.ts +4 -3
package/dist/core.js
CHANGED
|
@@ -1,426 +1,415 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
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
|
|
21
|
+
if (e instanceof c)
|
|
12
22
|
return e;
|
|
13
23
|
if (e instanceof Error) {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
24
|
+
const n = new c(e.message);
|
|
25
|
+
return n.stack = e.stack, n.name = e.name, n;
|
|
16
26
|
}
|
|
17
|
-
return new
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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 (!
|
|
152
|
+
if (!t(n.value, e))
|
|
164
153
|
return !1;
|
|
165
|
-
|
|
154
|
+
e += 1;
|
|
166
155
|
}
|
|
167
156
|
}
|
|
168
|
-
some(
|
|
169
|
-
let
|
|
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 (
|
|
163
|
+
if (t(n.value, e))
|
|
175
164
|
return !0;
|
|
176
|
-
|
|
165
|
+
e += 1;
|
|
177
166
|
}
|
|
178
167
|
}
|
|
179
|
-
filter(
|
|
180
|
-
const
|
|
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 =
|
|
173
|
+
const r = e.next();
|
|
185
174
|
if (r.done)
|
|
186
175
|
return r.value;
|
|
187
|
-
|
|
176
|
+
t(r.value, n) && (yield r.value), n += 1;
|
|
188
177
|
}
|
|
189
178
|
});
|
|
190
179
|
}
|
|
191
|
-
map(
|
|
192
|
-
const
|
|
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 =
|
|
185
|
+
const r = e.next();
|
|
197
186
|
if (r.done)
|
|
198
187
|
return r.value;
|
|
199
|
-
yield
|
|
188
|
+
yield t(r.value, n), n += 1;
|
|
200
189
|
}
|
|
201
190
|
});
|
|
202
191
|
}
|
|
203
|
-
reduce(
|
|
204
|
-
let n = 0, r =
|
|
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
|
|
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 =
|
|
204
|
+
r = t(r, s.value, n), n += 1;
|
|
216
205
|
}
|
|
217
206
|
}
|
|
218
|
-
flatMap(
|
|
219
|
-
const
|
|
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 =
|
|
212
|
+
const r = e.next();
|
|
224
213
|
if (r.done)
|
|
225
214
|
return r.value;
|
|
226
|
-
const s =
|
|
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(
|
|
234
|
-
const
|
|
222
|
+
drop(t) {
|
|
223
|
+
const e = this._iterator;
|
|
235
224
|
return new l(function* () {
|
|
236
225
|
let n = 0;
|
|
237
|
-
for (; n <
|
|
238
|
-
if (
|
|
226
|
+
for (; n < t; ) {
|
|
227
|
+
if (e.next().done)
|
|
239
228
|
return;
|
|
240
229
|
n += 1;
|
|
241
230
|
}
|
|
242
231
|
for (; ; ) {
|
|
243
|
-
const r =
|
|
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(
|
|
251
|
-
const
|
|
239
|
+
take(t) {
|
|
240
|
+
const e = this._iterator;
|
|
252
241
|
return new l(function* () {
|
|
253
242
|
let n = 0;
|
|
254
|
-
for (; n <
|
|
255
|
-
const r =
|
|
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(
|
|
263
|
-
let
|
|
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 (
|
|
257
|
+
if (t(n.value, e))
|
|
269
258
|
return n.value;
|
|
270
|
-
|
|
259
|
+
e += 1;
|
|
271
260
|
}
|
|
272
261
|
}
|
|
273
262
|
enumerate() {
|
|
274
|
-
return this.map((
|
|
263
|
+
return this.map((t, e) => [e, t]);
|
|
275
264
|
}
|
|
276
265
|
unique() {
|
|
277
|
-
const
|
|
266
|
+
const t = this._iterator;
|
|
278
267
|
return new l(function* () {
|
|
279
|
-
const
|
|
268
|
+
const e = /* @__PURE__ */ new Set();
|
|
280
269
|
for (; ; ) {
|
|
281
|
-
const n =
|
|
270
|
+
const n = t.next();
|
|
282
271
|
if (n.done)
|
|
283
272
|
return n.value;
|
|
284
|
-
|
|
273
|
+
e.has(n.value) || (e.add(n.value), yield n.value);
|
|
285
274
|
}
|
|
286
275
|
});
|
|
287
276
|
}
|
|
288
277
|
count() {
|
|
289
|
-
let
|
|
278
|
+
let t = 0;
|
|
290
279
|
for (; ; ) {
|
|
291
280
|
if (this._iterator.next().done)
|
|
292
|
-
return
|
|
293
|
-
|
|
281
|
+
return t;
|
|
282
|
+
t += 1;
|
|
294
283
|
}
|
|
295
284
|
}
|
|
296
|
-
forEach(
|
|
297
|
-
let
|
|
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
|
-
|
|
291
|
+
t(n.value, e), e += 1;
|
|
303
292
|
}
|
|
304
293
|
}
|
|
305
|
-
next(...
|
|
306
|
-
return this._iterator.next(...
|
|
294
|
+
next(...t) {
|
|
295
|
+
return this._iterator.next(...t);
|
|
307
296
|
}
|
|
308
|
-
groupBy(
|
|
309
|
-
return new
|
|
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
|
-
|
|
315
|
-
return "SmartIterator";
|
|
316
|
-
}
|
|
317
|
-
[Symbol.iterator]() {
|
|
303
|
+
[(ce = Symbol.toStringTag, Symbol.iterator)]() {
|
|
318
304
|
return this;
|
|
319
305
|
}
|
|
320
306
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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(
|
|
333
|
-
for (const [
|
|
334
|
-
if (
|
|
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(
|
|
339
|
-
const
|
|
340
|
-
return new
|
|
341
|
-
for (const [n, [r, s]] of
|
|
342
|
-
|
|
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(
|
|
346
|
-
const
|
|
347
|
-
return new
|
|
348
|
-
for (const [n, [r, s]] of
|
|
349
|
-
yield [r,
|
|
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(
|
|
353
|
-
let n = 0, r =
|
|
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
|
|
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 =
|
|
350
|
+
r = t(s, r, o, n), n += 1;
|
|
362
351
|
return r;
|
|
363
352
|
}
|
|
364
|
-
flatMap(
|
|
365
|
-
const
|
|
366
|
-
return new
|
|
367
|
-
for (const [n, [r, s]] of
|
|
368
|
-
for (const o of
|
|
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(
|
|
373
|
-
const
|
|
374
|
-
return new
|
|
375
|
-
for (const [n, [r, s]] of
|
|
376
|
-
n >=
|
|
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(
|
|
380
|
-
const
|
|
381
|
-
return new
|
|
382
|
-
for (const [n, [r, s]] of
|
|
383
|
-
if (n >=
|
|
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((
|
|
379
|
+
return this.map((t, e, n) => [n, e]);
|
|
391
380
|
}
|
|
392
381
|
unique() {
|
|
393
|
-
const
|
|
394
|
-
return new
|
|
395
|
-
const
|
|
396
|
-
for (const [n, r] of
|
|
397
|
-
|
|
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
|
|
402
|
-
for (const
|
|
403
|
-
|
|
404
|
-
return
|
|
390
|
+
let t = 0;
|
|
391
|
+
for (const e of this._elements)
|
|
392
|
+
t += 1;
|
|
393
|
+
return t;
|
|
405
394
|
}
|
|
406
|
-
forEach(
|
|
407
|
-
for (const [
|
|
408
|
-
|
|
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
|
|
400
|
+
const t = this._elements;
|
|
412
401
|
return new l(function* () {
|
|
413
|
-
for (const [
|
|
414
|
-
yield
|
|
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
|
|
410
|
+
const t = this._elements;
|
|
422
411
|
return new l(function* () {
|
|
423
|
-
for (const [
|
|
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
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
class
|
|
441
|
-
constructor(
|
|
442
|
-
|
|
443
|
-
this
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
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] =
|
|
449
|
-
o &&
|
|
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
|
|
452
|
-
for (const [n, [r, s]] of
|
|
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(
|
|
457
|
-
const
|
|
446
|
+
async some(t) {
|
|
447
|
+
const e = /* @__PURE__ */ new Map();
|
|
458
448
|
for await (const [n, r] of this._elements) {
|
|
459
|
-
const [s, o] =
|
|
460
|
-
o ||
|
|
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
|
|
463
|
-
for (const [n, [r, s]] of
|
|
452
|
+
return new f(function* () {
|
|
453
|
+
for (const [n, [r, s]] of e)
|
|
464
454
|
yield [n, s];
|
|
465
455
|
});
|
|
466
456
|
}
|
|
467
|
-
filter(
|
|
468
|
-
const
|
|
469
|
-
return new
|
|
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
|
|
461
|
+
for await (const [r, s] of e) {
|
|
472
462
|
const o = n.get(r) ?? 0;
|
|
473
|
-
await
|
|
463
|
+
await t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
474
464
|
}
|
|
475
465
|
});
|
|
476
466
|
}
|
|
477
|
-
map(
|
|
478
|
-
const
|
|
479
|
-
return new
|
|
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
|
|
471
|
+
for await (const [r, s] of e) {
|
|
482
472
|
const o = n.get(r) ?? 0;
|
|
483
|
-
yield [r, await
|
|
473
|
+
yield [r, await t(r, s, o)], n.set(r, o + 1);
|
|
484
474
|
}
|
|
485
475
|
});
|
|
486
476
|
}
|
|
487
|
-
async reduce(
|
|
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,
|
|
480
|
+
let o, u;
|
|
491
481
|
if (n.has(r))
|
|
492
|
-
[o,
|
|
493
|
-
else if (
|
|
494
|
-
o = 0,
|
|
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
|
|
489
|
+
n.set(r, [o + 1, await t(r, u, s, o)]);
|
|
500
490
|
}
|
|
501
|
-
return new
|
|
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(
|
|
507
|
-
const
|
|
508
|
-
return new
|
|
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
|
|
511
|
-
const o = n.get(r) ?? 0,
|
|
512
|
-
for await (const
|
|
513
|
-
yield [r,
|
|
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(
|
|
519
|
-
const
|
|
520
|
-
return new
|
|
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
|
|
512
|
+
for await (const [r, s] of e) {
|
|
523
513
|
const o = n.get(r) ?? 0;
|
|
524
|
-
if (o <
|
|
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(
|
|
533
|
-
const
|
|
534
|
-
return new
|
|
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
|
|
526
|
+
for await (const [r, s] of e) {
|
|
537
527
|
const o = n.get(r) ?? 0;
|
|
538
|
-
if (o >=
|
|
539
|
-
if (n.values().every((
|
|
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(
|
|
548
|
-
const
|
|
537
|
+
async find(t) {
|
|
538
|
+
const e = /* @__PURE__ */ new Map();
|
|
549
539
|
for await (const [n, r] of this._elements) {
|
|
550
|
-
let [s, o] =
|
|
551
|
-
o === void 0 && (await
|
|
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
|
|
554
|
-
for (const [n, [r, s]] of
|
|
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
|
|
560
|
-
return new
|
|
561
|
-
const
|
|
562
|
-
for await (const [n, r] of
|
|
563
|
-
const s =
|
|
564
|
-
s.has(r) || (s.add(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
|
|
570
|
-
for await (const [
|
|
571
|
-
const n =
|
|
572
|
-
|
|
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
|
|
575
|
-
for (const [
|
|
576
|
-
yield [
|
|
564
|
+
return new f(function* () {
|
|
565
|
+
for (const [e, n] of t)
|
|
566
|
+
yield [e, n];
|
|
577
567
|
});
|
|
578
568
|
}
|
|
579
|
-
async forEach(
|
|
580
|
-
const
|
|
569
|
+
async forEach(t) {
|
|
570
|
+
const e = /* @__PURE__ */ new Map();
|
|
581
571
|
for await (const [n, r] of this._elements) {
|
|
582
|
-
const s =
|
|
583
|
-
|
|
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
|
|
577
|
+
const t = this._elements;
|
|
588
578
|
return new h(async function* () {
|
|
589
|
-
const
|
|
590
|
-
for await (const [n] of
|
|
591
|
-
|
|
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
|
|
588
|
+
const t = this._elements;
|
|
599
589
|
return new h(async function* () {
|
|
600
|
-
for await (const [
|
|
590
|
+
for await (const [e, n] of t)
|
|
601
591
|
yield n;
|
|
602
592
|
});
|
|
603
593
|
}
|
|
604
594
|
async toArray() {
|
|
605
|
-
const
|
|
606
|
-
return Array.from(
|
|
595
|
+
const t = await this.toMap();
|
|
596
|
+
return Array.from(t.values());
|
|
607
597
|
}
|
|
608
598
|
async toMap() {
|
|
609
|
-
const
|
|
610
|
-
for await (const [
|
|
611
|
-
const r =
|
|
612
|
-
r.push(n),
|
|
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
|
|
604
|
+
return t;
|
|
615
605
|
}
|
|
616
606
|
async toObject() {
|
|
617
|
-
const
|
|
618
|
-
for await (const [
|
|
619
|
-
const r = e
|
|
620
|
-
r.push(n), e
|
|
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
|
|
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(
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
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 =
|
|
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
|
|
645
|
-
this._iterator =
|
|
646
|
-
else if (Symbol.iterator in
|
|
647
|
-
const
|
|
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 =
|
|
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
|
|
648
|
+
let e = [];
|
|
659
649
|
for (; ; ) {
|
|
660
|
-
const n = await
|
|
650
|
+
const n = await t.next(...e);
|
|
661
651
|
if (n.done)
|
|
662
652
|
return n.value;
|
|
663
|
-
|
|
653
|
+
e = [yield n.value];
|
|
664
654
|
}
|
|
665
655
|
}();
|
|
666
|
-
this._iterator.return && (this.return = (
|
|
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(
|
|
669
|
-
let
|
|
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
|
|
664
|
+
if (!await t(n.value, e))
|
|
675
665
|
return !1;
|
|
676
|
-
|
|
666
|
+
e += 1;
|
|
677
667
|
}
|
|
678
668
|
}
|
|
679
|
-
async some(
|
|
680
|
-
let
|
|
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
|
|
675
|
+
if (await t(n.value, e))
|
|
686
676
|
return !0;
|
|
687
|
-
|
|
677
|
+
e += 1;
|
|
688
678
|
}
|
|
689
679
|
}
|
|
690
|
-
filter(
|
|
691
|
-
const
|
|
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
|
|
685
|
+
const r = await e.next();
|
|
696
686
|
if (r.done)
|
|
697
687
|
return r.value;
|
|
698
|
-
await
|
|
688
|
+
await t(r.value, n) && (yield r.value), n += 1;
|
|
699
689
|
}
|
|
700
690
|
});
|
|
701
691
|
}
|
|
702
|
-
map(
|
|
703
|
-
const
|
|
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
|
|
697
|
+
const r = await e.next();
|
|
708
698
|
if (r.done)
|
|
709
699
|
return r.value;
|
|
710
|
-
yield await
|
|
700
|
+
yield await t(r.value, n), n += 1;
|
|
711
701
|
}
|
|
712
702
|
});
|
|
713
703
|
}
|
|
714
|
-
async reduce(
|
|
715
|
-
let n = 0, r =
|
|
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
|
|
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
|
|
716
|
+
r = await t(r, s.value, n), n += 1;
|
|
727
717
|
}
|
|
728
718
|
}
|
|
729
|
-
flatMap(
|
|
730
|
-
const
|
|
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
|
|
724
|
+
const r = await e.next();
|
|
735
725
|
if (r.done)
|
|
736
726
|
return r.value;
|
|
737
|
-
const s = await
|
|
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(
|
|
745
|
-
const
|
|
734
|
+
drop(t) {
|
|
735
|
+
const e = this._iterator;
|
|
746
736
|
return new h(async function* () {
|
|
747
737
|
let n = 0;
|
|
748
|
-
for (; n <
|
|
749
|
-
if ((await
|
|
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
|
|
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(
|
|
762
|
-
const
|
|
751
|
+
take(t) {
|
|
752
|
+
const e = this._iterator;
|
|
763
753
|
return new h(async function* () {
|
|
764
754
|
let n = 0;
|
|
765
|
-
for (; n <
|
|
766
|
-
const r = await
|
|
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(
|
|
774
|
-
let
|
|
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
|
|
769
|
+
if (await t(n.value, e))
|
|
780
770
|
return n.value;
|
|
781
|
-
|
|
771
|
+
e += 1;
|
|
782
772
|
}
|
|
783
773
|
}
|
|
784
774
|
enumerate() {
|
|
785
|
-
return this.map((
|
|
775
|
+
return this.map((t, e) => [e, t]);
|
|
786
776
|
}
|
|
787
777
|
unique() {
|
|
788
|
-
const
|
|
778
|
+
const t = this._iterator;
|
|
789
779
|
return new h(async function* () {
|
|
790
|
-
const
|
|
780
|
+
const e = /* @__PURE__ */ new Set();
|
|
791
781
|
for (; ; ) {
|
|
792
|
-
const n = await
|
|
782
|
+
const n = await t.next();
|
|
793
783
|
if (n.done)
|
|
794
784
|
return n.value;
|
|
795
|
-
|
|
785
|
+
e.has(n.value) || (e.add(n.value), yield n.value);
|
|
796
786
|
}
|
|
797
787
|
});
|
|
798
788
|
}
|
|
799
789
|
async count() {
|
|
800
|
-
let
|
|
790
|
+
let t = 0;
|
|
801
791
|
for (; ; ) {
|
|
802
792
|
if ((await this._iterator.next()).done)
|
|
803
|
-
return
|
|
804
|
-
|
|
793
|
+
return t;
|
|
794
|
+
t += 1;
|
|
805
795
|
}
|
|
806
796
|
}
|
|
807
|
-
async forEach(
|
|
808
|
-
let
|
|
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
|
|
803
|
+
await t(n.value, e), e += 1;
|
|
814
804
|
}
|
|
815
805
|
}
|
|
816
|
-
next(...
|
|
817
|
-
return this._iterator.next(...
|
|
806
|
+
next(...t) {
|
|
807
|
+
return this._iterator.next(...t);
|
|
818
808
|
}
|
|
819
|
-
groupBy(
|
|
820
|
-
return new
|
|
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
|
-
|
|
826
|
-
return "SmartAsyncIterator";
|
|
827
|
-
}
|
|
828
|
-
[Symbol.asyncIterator]() {
|
|
815
|
+
[(de = Symbol.toStringTag, Symbol.asyncIterator)]() {
|
|
829
816
|
return this;
|
|
830
817
|
}
|
|
831
818
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
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] =
|
|
841
|
-
o &&
|
|
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
|
|
844
|
-
for (const [n, [r, s]] of
|
|
833
|
+
return new f(function* () {
|
|
834
|
+
for (const [n, [r, s]] of e)
|
|
845
835
|
yield [n, s];
|
|
846
836
|
});
|
|
847
837
|
}
|
|
848
|
-
some(
|
|
849
|
-
const
|
|
838
|
+
some(t) {
|
|
839
|
+
const e = /* @__PURE__ */ new Map();
|
|
850
840
|
for (const [n, r] of this._elements) {
|
|
851
|
-
const [s, o] =
|
|
852
|
-
o ||
|
|
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
|
|
855
|
-
for (const [n, [r, s]] of
|
|
844
|
+
return new f(function* () {
|
|
845
|
+
for (const [n, [r, s]] of e)
|
|
856
846
|
yield [n, s];
|
|
857
847
|
});
|
|
858
848
|
}
|
|
859
|
-
filter(
|
|
860
|
-
const
|
|
861
|
-
return new
|
|
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
|
|
853
|
+
for (const [r, s] of e) {
|
|
864
854
|
const o = n.get(r) ?? 0;
|
|
865
|
-
|
|
855
|
+
t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
|
|
866
856
|
}
|
|
867
857
|
});
|
|
868
858
|
}
|
|
869
|
-
map(
|
|
870
|
-
const
|
|
871
|
-
return new
|
|
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
|
|
863
|
+
for (const [r, s] of e) {
|
|
874
864
|
const o = n.get(r) ?? 0;
|
|
875
|
-
yield [r,
|
|
865
|
+
yield [r, t(r, s, o)], n.set(r, o + 1);
|
|
876
866
|
}
|
|
877
867
|
});
|
|
878
868
|
}
|
|
879
|
-
reduce(
|
|
869
|
+
reduce(t, e) {
|
|
880
870
|
const n = /* @__PURE__ */ new Map();
|
|
881
871
|
for (const [r, s] of this._elements) {
|
|
882
|
-
let o,
|
|
872
|
+
let o, u;
|
|
883
873
|
if (n.has(r))
|
|
884
|
-
[o,
|
|
885
|
-
else if (
|
|
886
|
-
o = 0,
|
|
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,
|
|
881
|
+
n.set(r, [o + 1, t(r, u, s, o)]);
|
|
892
882
|
}
|
|
893
|
-
return new
|
|
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(
|
|
899
|
-
const
|
|
900
|
-
return new
|
|
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
|
|
903
|
-
const o = n.get(r) ?? 0,
|
|
904
|
-
for (const
|
|
905
|
-
yield [r,
|
|
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(
|
|
911
|
-
const
|
|
912
|
-
return new
|
|
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
|
|
904
|
+
for (const [r, s] of e) {
|
|
915
905
|
const o = n.get(r) ?? 0;
|
|
916
|
-
if (o <
|
|
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(
|
|
925
|
-
const
|
|
926
|
-
return new
|
|
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
|
|
918
|
+
for (const [r, s] of e) {
|
|
929
919
|
const o = n.get(r) ?? 0;
|
|
930
|
-
if (o >=
|
|
931
|
-
if (n.values().every((
|
|
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(
|
|
940
|
-
const
|
|
929
|
+
find(t) {
|
|
930
|
+
const e = /* @__PURE__ */ new Map();
|
|
941
931
|
for (const [n, r] of this._elements) {
|
|
942
|
-
let [s, o] =
|
|
943
|
-
o === void 0 && (
|
|
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
|
|
946
|
-
for (const [n, [r, s]] of
|
|
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((
|
|
941
|
+
return this.map((t, e, n) => [n, e]);
|
|
952
942
|
}
|
|
953
943
|
unique() {
|
|
954
|
-
const
|
|
955
|
-
return new
|
|
956
|
-
const
|
|
957
|
-
for (const [n, r] of
|
|
958
|
-
const s =
|
|
959
|
-
s.has(r) || (s.add(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
|
|
965
|
-
for (const [
|
|
966
|
-
const n =
|
|
967
|
-
|
|
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
|
|
970
|
-
for (const [
|
|
971
|
-
yield [
|
|
959
|
+
return new f(function* () {
|
|
960
|
+
for (const [e, n] of t)
|
|
961
|
+
yield [e, n];
|
|
972
962
|
});
|
|
973
963
|
}
|
|
974
|
-
forEach(
|
|
975
|
-
const
|
|
964
|
+
forEach(t) {
|
|
965
|
+
const e = /* @__PURE__ */ new Map();
|
|
976
966
|
for (const [n, r] of this._elements) {
|
|
977
|
-
const s =
|
|
978
|
-
|
|
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
|
|
972
|
+
const t = this._elements;
|
|
983
973
|
return new l(function* () {
|
|
984
|
-
const
|
|
985
|
-
for (const [n] of
|
|
986
|
-
|
|
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
|
|
983
|
+
const t = this._elements;
|
|
994
984
|
return new l(function* () {
|
|
995
|
-
for (const [
|
|
985
|
+
for (const [e, n] of t)
|
|
996
986
|
yield n;
|
|
997
987
|
});
|
|
998
988
|
}
|
|
999
989
|
toArray() {
|
|
1000
|
-
const
|
|
1001
|
-
return Array.from(
|
|
990
|
+
const t = this.toMap();
|
|
991
|
+
return Array.from(t.values());
|
|
1002
992
|
}
|
|
1003
993
|
toMap() {
|
|
1004
|
-
const
|
|
1005
|
-
for (const [
|
|
1006
|
-
const r =
|
|
1007
|
-
r.push(n),
|
|
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
|
|
999
|
+
return t;
|
|
1010
1000
|
}
|
|
1011
1001
|
toObject() {
|
|
1012
|
-
const
|
|
1013
|
-
for (const [
|
|
1014
|
-
const r = e
|
|
1015
|
-
r.push(n), e
|
|
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
|
|
1007
|
+
return t;
|
|
1018
1008
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
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@${
|
|
1024
|
+
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
1049
1025
|
), this._start = () => {
|
|
1050
|
-
|
|
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(
|
|
1038
|
+
start(t = 0) {
|
|
1064
1039
|
if (this._isRunning)
|
|
1065
|
-
throw new
|
|
1066
|
-
this._startTime = performance.now() -
|
|
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
|
|
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
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
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(
|
|
1088
|
-
const r =
|
|
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 "${
|
|
1095
|
-
),
|
|
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(
|
|
1077
|
+
_set(t, e, n) {
|
|
1100
1078
|
const r = JSON.stringify(n);
|
|
1101
|
-
r ?
|
|
1079
|
+
r ? t.setItem(e, r) : t.removeItem(e);
|
|
1102
1080
|
}
|
|
1103
|
-
get(
|
|
1081
|
+
get(t, e, n = this._preferPersistence) {
|
|
1104
1082
|
const r = n ? this._persistent : this._volatile;
|
|
1105
|
-
return this._get(r,
|
|
1083
|
+
return this._get(r, t, e);
|
|
1106
1084
|
}
|
|
1107
|
-
recall(
|
|
1108
|
-
return this._get(this._volatile,
|
|
1085
|
+
recall(t, e) {
|
|
1086
|
+
return this._get(this._volatile, t, e);
|
|
1109
1087
|
}
|
|
1110
|
-
retrieve(
|
|
1111
|
-
return this.recall(
|
|
1088
|
+
retrieve(t, e) {
|
|
1089
|
+
return this.recall(t) ?? this.read(t, e);
|
|
1112
1090
|
}
|
|
1113
|
-
read(
|
|
1114
|
-
return this._get(this._persistent,
|
|
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(
|
|
1125
|
-
return (
|
|
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(
|
|
1135
|
-
return this._volatile.getItem(
|
|
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(
|
|
1146
|
-
return this.knows(
|
|
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(
|
|
1156
|
-
return this._persistent.getItem(
|
|
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(
|
|
1144
|
+
set(t, e, n = this._preferPersistence) {
|
|
1167
1145
|
const r = n ? this._persistent : this._volatile;
|
|
1168
|
-
this._set(r,
|
|
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(
|
|
1178
|
-
this._set(this._volatile,
|
|
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(
|
|
1188
|
-
this._set(this._persistent,
|
|
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(
|
|
1196
|
-
this._volatile.removeItem(
|
|
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(
|
|
1204
|
-
this._persistent.removeItem(
|
|
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(
|
|
1212
|
-
this._volatile.removeItem(
|
|
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
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
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
|
|
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(
|
|
1206
|
+
this._promise = new Promise(t).then(e, n);
|
|
1229
1207
|
}
|
|
1230
|
-
static FromPromise(
|
|
1231
|
-
return new
|
|
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(
|
|
1243
|
-
return this._promise.then(
|
|
1244
|
-
}
|
|
1245
|
-
catch(e) {
|
|
1246
|
-
return this._promise.catch(e);
|
|
1220
|
+
then(t, e) {
|
|
1221
|
+
return this._promise.then(t, e);
|
|
1247
1222
|
}
|
|
1248
|
-
|
|
1249
|
-
return this._promise.
|
|
1223
|
+
catch(t) {
|
|
1224
|
+
return this._promise.catch(t);
|
|
1250
1225
|
}
|
|
1251
|
-
|
|
1252
|
-
return
|
|
1226
|
+
finally(t) {
|
|
1227
|
+
return this._promise.finally(t);
|
|
1253
1228
|
}
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
|
|
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,
|
|
1259
|
-
r = o, s =
|
|
1235
|
+
super((o, u) => {
|
|
1236
|
+
r = o, s = u;
|
|
1260
1237
|
});
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
this
|
|
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(
|
|
1272
|
-
return
|
|
1249
|
+
watch(e) {
|
|
1250
|
+
return e.then(this.resolve, this.reject), this;
|
|
1273
1251
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
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
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
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
|
-
|
|
1321
|
+
var ke;
|
|
1322
|
+
ke = Symbol.toStringTag;
|
|
1323
|
+
class y {
|
|
1294
1324
|
constructor() {
|
|
1295
|
-
|
|
1325
|
+
a(this, "_subscribers");
|
|
1326
|
+
a(this, ke, "Publisher");
|
|
1296
1327
|
this._subscribers = [];
|
|
1297
1328
|
}
|
|
1298
|
-
subscribe(
|
|
1299
|
-
return this._subscribers.push(
|
|
1300
|
-
const
|
|
1301
|
-
if (
|
|
1302
|
-
throw new
|
|
1303
|
-
this._subscribers.splice(
|
|
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(...
|
|
1307
|
-
return this._subscribers.slice().map((
|
|
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
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
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(
|
|
1366
|
+
start(e = 0) {
|
|
1320
1367
|
if (this._isRunning)
|
|
1321
|
-
throw new
|
|
1322
|
-
super.start(
|
|
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
|
|
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(
|
|
1382
|
+
onTick(e, n = 0) {
|
|
1330
1383
|
if (n < 0)
|
|
1331
|
-
throw new
|
|
1384
|
+
throw new Ie("The tick step must be a non-negative number.");
|
|
1332
1385
|
if (n === 0)
|
|
1333
|
-
return this.
|
|
1386
|
+
return this._ticker.subscribe(e);
|
|
1334
1387
|
let r = 0;
|
|
1335
|
-
return this.
|
|
1336
|
-
s - r < n || (
|
|
1388
|
+
return this._ticker.subscribe((s) => {
|
|
1389
|
+
s - r < n || (e(s), r = s);
|
|
1337
1390
|
});
|
|
1338
1391
|
}
|
|
1339
1392
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
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.
|
|
1398
|
+
this._ticker.publish(s), s <= 0 && (this._deferrerStop(), this._expirer.publish());
|
|
1345
1399
|
}, n);
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
this
|
|
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
|
-
|
|
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
|
|
1424
|
+
throw new p("The countdown has already been started.");
|
|
1360
1425
|
if (this._deferrer)
|
|
1361
|
-
throw new
|
|
1362
|
-
return this._deferrer = new
|
|
1426
|
+
throw new g();
|
|
1427
|
+
return this._deferrer = new Ne(), super.start(this.duration - e), this._starter.publish(), this._deferrer;
|
|
1363
1428
|
}
|
|
1364
|
-
stop(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
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
|
-
|
|
1438
|
+
onStop(e) {
|
|
1439
|
+
return this._stopper.subscribe(e);
|
|
1440
|
+
}
|
|
1441
|
+
onTick(e, n = 0) {
|
|
1372
1442
|
if (n < 0)
|
|
1373
|
-
throw new
|
|
1443
|
+
throw new Ie("The tick step must be a non-negative number.");
|
|
1374
1444
|
if (n === 0)
|
|
1375
|
-
return this.
|
|
1445
|
+
return this._ticker.subscribe(e);
|
|
1376
1446
|
let r = 0;
|
|
1377
|
-
return this.
|
|
1378
|
-
r - s < n || (
|
|
1447
|
+
return this._ticker.subscribe((s) => {
|
|
1448
|
+
r - s < n || (e(s), r = s);
|
|
1379
1449
|
});
|
|
1380
1450
|
}
|
|
1381
1451
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1452
|
+
var Fe;
|
|
1453
|
+
Fe = Symbol.toStringTag;
|
|
1454
|
+
const M = class M {
|
|
1455
|
+
constructor() {
|
|
1456
|
+
a(this, Fe, "Random");
|
|
1385
1457
|
}
|
|
1386
|
-
static
|
|
1387
|
-
return Math.
|
|
1458
|
+
static Boolean(t = 0.5) {
|
|
1459
|
+
return Math.random() < t;
|
|
1388
1460
|
}
|
|
1389
|
-
static
|
|
1390
|
-
return
|
|
1461
|
+
static Integer(t, e) {
|
|
1462
|
+
return Math.floor(e === void 0 ? Math.random() * t : Math.random() * (e - t) + t);
|
|
1391
1463
|
}
|
|
1392
|
-
static
|
|
1393
|
-
|
|
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
|
|
1398
|
-
|
|
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
|
-
|
|
1401
|
-
|
|
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
|
|
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
|
|
1411
|
-
return new Promise((
|
|
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 =
|
|
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
|
|
1489
|
+
function at(...i) {
|
|
1417
1490
|
return new l(function* () {
|
|
1418
|
-
for (const
|
|
1419
|
-
for (const
|
|
1420
|
-
yield
|
|
1491
|
+
for (const t of i)
|
|
1492
|
+
for (const e of t)
|
|
1493
|
+
yield e;
|
|
1421
1494
|
});
|
|
1422
1495
|
}
|
|
1423
|
-
function
|
|
1496
|
+
function ut(i) {
|
|
1424
1497
|
if (Array.isArray(i))
|
|
1425
1498
|
return i.length;
|
|
1426
|
-
let
|
|
1427
|
-
for (const
|
|
1428
|
-
|
|
1429
|
-
return
|
|
1499
|
+
let t = 0;
|
|
1500
|
+
for (const e of i)
|
|
1501
|
+
t += 1;
|
|
1502
|
+
return t;
|
|
1430
1503
|
}
|
|
1431
|
-
function
|
|
1504
|
+
function lt(i) {
|
|
1432
1505
|
return new l(function* () {
|
|
1433
|
-
let
|
|
1434
|
-
for (const
|
|
1435
|
-
yield [
|
|
1506
|
+
let t = 0;
|
|
1507
|
+
for (const e of i)
|
|
1508
|
+
yield [t, e], t += 1;
|
|
1436
1509
|
});
|
|
1437
1510
|
}
|
|
1438
|
-
function
|
|
1511
|
+
function ct(i, t, e = 1) {
|
|
1439
1512
|
return new l(function* () {
|
|
1440
|
-
|
|
1441
|
-
for (let n = i; n <
|
|
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
|
|
1446
|
-
const
|
|
1447
|
-
for (let
|
|
1448
|
-
const n = Math.floor(Math.random() * (
|
|
1449
|
-
[e
|
|
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
|
|
1524
|
+
return t;
|
|
1452
1525
|
}
|
|
1453
|
-
function
|
|
1526
|
+
function ht(i) {
|
|
1454
1527
|
return new l(function* () {
|
|
1455
|
-
const
|
|
1456
|
-
for (const
|
|
1457
|
-
|
|
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
|
|
1533
|
+
function $e(i, t) {
|
|
1461
1534
|
return new l(function* () {
|
|
1462
|
-
const
|
|
1535
|
+
const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
|
|
1463
1536
|
for (; ; ) {
|
|
1464
|
-
const r =
|
|
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
|
|
1472
|
-
if (
|
|
1544
|
+
function dt(i, t) {
|
|
1545
|
+
if (t === void 0) {
|
|
1473
1546
|
let s = 0, o = 0;
|
|
1474
|
-
for (const
|
|
1475
|
-
s +=
|
|
1547
|
+
for (const u of i)
|
|
1548
|
+
s += u, o += 1;
|
|
1476
1549
|
if (o === 0)
|
|
1477
|
-
throw new
|
|
1550
|
+
throw new d("You must provide at least one value.");
|
|
1478
1551
|
return s / o;
|
|
1479
1552
|
}
|
|
1480
|
-
let
|
|
1481
|
-
for (const [s, o] of
|
|
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
|
|
1484
|
-
|
|
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
|
|
1560
|
+
throw new d("You must provide at least one value and weight.");
|
|
1488
1561
|
if (n > 0)
|
|
1489
|
-
throw new
|
|
1490
|
-
return
|
|
1562
|
+
throw new d("The sum of weights must be greater than zero.");
|
|
1563
|
+
return e / n;
|
|
1491
1564
|
}
|
|
1492
|
-
function
|
|
1493
|
-
let
|
|
1494
|
-
for (let
|
|
1495
|
-
const n = i.charCodeAt(
|
|
1496
|
-
|
|
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
|
|
1571
|
+
return t;
|
|
1499
1572
|
}
|
|
1500
|
-
function
|
|
1501
|
-
let
|
|
1502
|
-
for (const
|
|
1503
|
-
|
|
1504
|
-
return
|
|
1573
|
+
function wt(i) {
|
|
1574
|
+
let t = 0;
|
|
1575
|
+
for (const e of i)
|
|
1576
|
+
t += e;
|
|
1577
|
+
return t;
|
|
1505
1578
|
}
|
|
1506
|
-
function
|
|
1579
|
+
function _t(i) {
|
|
1507
1580
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
1508
1581
|
}
|
|
1509
|
-
const
|
|
1582
|
+
const yt = "2.0.0-rc.5";
|
|
1510
1583
|
export {
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
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
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
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
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
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
|