@byloth/core 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +242 -256
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +2 -2
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +5 -5
- package/src/core/types.ts +1 -1
- package/src/index.ts +5 -2
- package/src/models/callbacks/publisher.ts +152 -23
- package/src/models/callbacks/switchable-callback.ts +6 -6
- package/src/models/callbacks/types.ts +52 -20
- package/src/models/collections/map-view.ts +14 -15
- package/src/models/collections/set-view.ts +13 -16
- package/src/models/collections/types.ts +6 -6
- package/src/models/index.ts +1 -1
- package/src/models/iterators/smart-async-iterator.ts +1 -1
- package/src/models/iterators/smart-iterator.ts +1 -1
- package/src/models/promises/index.ts +2 -1
- package/src/models/promises/promise-queue.ts +222 -0
- package/src/models/timers/clock.ts +3 -3
- package/src/models/timers/countdown.ts +4 -4
- package/src/models/timers/game-loop.ts +4 -4
- package/src/models/types.ts +9 -1
package/dist/core.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (i, n, e) =>
|
|
4
|
-
const
|
|
1
|
+
var Ke = Object.defineProperty;
|
|
2
|
+
var Qe = (i, n, e) => n in i ? Ke(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
|
|
3
|
+
var a = (i, n, e) => Qe(i, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
const Ye = typeof window < "u" && typeof window.document < "u";
|
|
5
5
|
var A;
|
|
6
|
-
const
|
|
6
|
+
const ot = typeof process < "u" && !!((A = process.versions) != null && A.node);
|
|
7
7
|
var N;
|
|
8
|
-
const
|
|
9
|
-
var O,
|
|
10
|
-
class c extends (
|
|
8
|
+
const at = typeof self == "object" && ((N = self.constructor) == null ? void 0 : N.name) === "DedicatedWorkerGlobalScope";
|
|
9
|
+
var O, q;
|
|
10
|
+
class c extends (q = Error, O = Symbol.toStringTag, q) {
|
|
11
11
|
/**
|
|
12
12
|
* Initializes a new instance of the {@link Exception} class.
|
|
13
13
|
*
|
|
@@ -65,8 +65,8 @@ Caused by ${t}`);
|
|
|
65
65
|
return new c(`${e}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
69
|
-
class g extends (z = c,
|
|
68
|
+
var $, z;
|
|
69
|
+
class g extends (z = c, $ = Symbol.toStringTag, z) {
|
|
70
70
|
/**
|
|
71
71
|
* Initializes a new instance of the {@link FatalErrorException} class.
|
|
72
72
|
*
|
|
@@ -86,11 +86,11 @@ class g extends (z = c, q = Symbol.toStringTag, z) {
|
|
|
86
86
|
constructor(e, t, s = "FatalErrorException") {
|
|
87
87
|
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.");
|
|
88
88
|
super(e, t, s);
|
|
89
|
-
a(this,
|
|
89
|
+
a(this, $, "FatalErrorException");
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
var D, B;
|
|
93
|
-
class
|
|
93
|
+
class He extends (B = g, D = Symbol.toStringTag, B) {
|
|
94
94
|
/**
|
|
95
95
|
* Initializes a new instance of the {@link NotImplementedException} class.
|
|
96
96
|
*
|
|
@@ -114,7 +114,7 @@ class Ge extends (B = g, D = Symbol.toStringTag, B) {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
var J, Y;
|
|
117
|
-
class
|
|
117
|
+
class Le extends (Y = c, J = Symbol.toStringTag, Y) {
|
|
118
118
|
/**
|
|
119
119
|
* Initializes a new instance of the {@link FileException} class.
|
|
120
120
|
*
|
|
@@ -137,7 +137,7 @@ class Je extends (Y = c, J = Symbol.toStringTag, Y) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
var L, V;
|
|
140
|
-
class
|
|
140
|
+
class lt extends (V = Le, L = Symbol.toStringTag, V) {
|
|
141
141
|
/**
|
|
142
142
|
* Initializes a new instance of the {@link FileExistsException} class.
|
|
143
143
|
*
|
|
@@ -160,7 +160,7 @@ class it extends (V = Je, L = Symbol.toStringTag, V) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
var G, K;
|
|
163
|
-
class
|
|
163
|
+
class ut extends (K = Le, G = Symbol.toStringTag, K) {
|
|
164
164
|
/**
|
|
165
165
|
* Initializes a new instance of the {@link FileNotFoundException} class.
|
|
166
166
|
*
|
|
@@ -182,8 +182,8 @@ class ot extends (K = Je, G = Symbol.toStringTag, K) {
|
|
|
182
182
|
a(this, G, "FileNotFoundException");
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
var
|
|
186
|
-
class _ extends (
|
|
185
|
+
var Q, H;
|
|
186
|
+
class _ extends (H = c, Q = Symbol.toStringTag, H) {
|
|
187
187
|
/**
|
|
188
188
|
* Initializes a new instance of the {@link KeyException} class.
|
|
189
189
|
*
|
|
@@ -202,11 +202,11 @@ class _ extends (Q = c, H = Symbol.toStringTag, Q) {
|
|
|
202
202
|
*/
|
|
203
203
|
constructor(e, t, s = "KeyException") {
|
|
204
204
|
super(e, t, s);
|
|
205
|
-
a(this,
|
|
205
|
+
a(this, Q, "KeyException");
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
var X, Z;
|
|
209
|
-
class
|
|
209
|
+
class ct extends (Z = c, X = Symbol.toStringTag, Z) {
|
|
210
210
|
/**
|
|
211
211
|
* Initializes a new instance of the {@link NetworkException} class.
|
|
212
212
|
*
|
|
@@ -229,7 +229,7 @@ class at extends (Z = c, X = Symbol.toStringTag, Z) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
var W, U;
|
|
232
|
-
class
|
|
232
|
+
class ht extends (U = c, W = Symbol.toStringTag, U) {
|
|
233
233
|
/**
|
|
234
234
|
* Initializes a new instance of the {@link PermissionException} class.
|
|
235
235
|
*
|
|
@@ -298,7 +298,7 @@ class p extends (se = c, ne = Symbol.toStringTag, se) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
var re, ie;
|
|
301
|
-
class
|
|
301
|
+
class Xe extends (ie = p, re = Symbol.toStringTag, ie) {
|
|
302
302
|
/**
|
|
303
303
|
* Initializes a new instance of the {@link EnvironmentException} class.
|
|
304
304
|
*
|
|
@@ -321,7 +321,7 @@ class Ke extends (ie = p, re = Symbol.toStringTag, ie) {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
var oe, ae;
|
|
324
|
-
class
|
|
324
|
+
class Ze extends (ae = c, oe = Symbol.toStringTag, ae) {
|
|
325
325
|
/**
|
|
326
326
|
* Initializes a new instance of the {@link TimeoutException} class.
|
|
327
327
|
*
|
|
@@ -344,7 +344,7 @@ class He extends (ae = c, oe = Symbol.toStringTag, ae) {
|
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
var le, ue;
|
|
347
|
-
class
|
|
347
|
+
class ft extends (ue = c, le = Symbol.toStringTag, ue) {
|
|
348
348
|
/**
|
|
349
349
|
* Initializes a new instance of the {@link TypeException} class.
|
|
350
350
|
*
|
|
@@ -367,7 +367,7 @@ class ut extends (ue = c, le = Symbol.toStringTag, ue) {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
var ce, he;
|
|
370
|
-
class
|
|
370
|
+
class f extends (he = c, ce = Symbol.toStringTag, he) {
|
|
371
371
|
/**
|
|
372
372
|
* Initializes a new instance of the {@link ValueException} class.
|
|
373
373
|
*
|
|
@@ -390,7 +390,7 @@ class d extends (he = c, ce = Symbol.toStringTag, he) {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
var fe, de;
|
|
393
|
-
class b extends (de =
|
|
393
|
+
class b extends (de = f, fe = Symbol.toStringTag, de) {
|
|
394
394
|
/**
|
|
395
395
|
* Initializes a new instance of the {@link RangeException} class.
|
|
396
396
|
*
|
|
@@ -562,7 +562,7 @@ class u {
|
|
|
562
562
|
if (s === void 0) {
|
|
563
563
|
const r = this._iterator.next();
|
|
564
564
|
if (r.done)
|
|
565
|
-
throw new
|
|
565
|
+
throw new f("Cannot reduce an empty iterator without an initial value.");
|
|
566
566
|
s = r.value, t += 1;
|
|
567
567
|
}
|
|
568
568
|
for (; ; ) {
|
|
@@ -900,7 +900,7 @@ class u {
|
|
|
900
900
|
*
|
|
901
901
|
* for (const value of iterator)
|
|
902
902
|
* {
|
|
903
|
-
* if (value > 5) { break; } // Closing the iterator...
|
|
903
|
+
* if (value > 5) { break; } // "Closing the iterator..."
|
|
904
904
|
*
|
|
905
905
|
* console.log(value); // 1, 2, 3, 4, 5
|
|
906
906
|
* }
|
|
@@ -1161,7 +1161,7 @@ const y = class y {
|
|
|
1161
1161
|
if (s === void 0) {
|
|
1162
1162
|
const r = this._elements.next();
|
|
1163
1163
|
if (r.done)
|
|
1164
|
-
throw new
|
|
1164
|
+
throw new f("Cannot reduce an empty iterator without an initial value.");
|
|
1165
1165
|
s = r.value[1], t += 1;
|
|
1166
1166
|
}
|
|
1167
1167
|
for (const [r, o] of this._elements)
|
|
@@ -1644,7 +1644,7 @@ const w = class w {
|
|
|
1644
1644
|
*/
|
|
1645
1645
|
a(this, "_elements");
|
|
1646
1646
|
a(this, pe, "AggregatedAsyncIterator");
|
|
1647
|
-
this._elements = new
|
|
1647
|
+
this._elements = new d(n);
|
|
1648
1648
|
}
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Determines whether all elements of each group of the iterator satisfy a given condition.
|
|
@@ -1844,8 +1844,8 @@ const w = class w {
|
|
|
1844
1844
|
for await (const [s, r] of e) {
|
|
1845
1845
|
const o = t.get(s) ?? 0, l = await n(s, r, o);
|
|
1846
1846
|
if (l instanceof Array)
|
|
1847
|
-
for (const
|
|
1848
|
-
yield [s,
|
|
1847
|
+
for (const k of l)
|
|
1848
|
+
yield [s, k];
|
|
1849
1849
|
else
|
|
1850
1850
|
yield [s, l];
|
|
1851
1851
|
t.set(s, o + 1);
|
|
@@ -2145,7 +2145,7 @@ const w = class w {
|
|
|
2145
2145
|
*/
|
|
2146
2146
|
keys() {
|
|
2147
2147
|
const n = this._elements;
|
|
2148
|
-
return new
|
|
2148
|
+
return new d(async function* () {
|
|
2149
2149
|
const e = /* @__PURE__ */ new Set();
|
|
2150
2150
|
for await (const [t] of n)
|
|
2151
2151
|
e.has(t) || (e.add(t), yield t);
|
|
@@ -2209,7 +2209,7 @@ const w = class w {
|
|
|
2209
2209
|
*/
|
|
2210
2210
|
values() {
|
|
2211
2211
|
const n = this._elements;
|
|
2212
|
-
return new
|
|
2212
|
+
return new d(async function* () {
|
|
2213
2213
|
for await (const [e, t] of n)
|
|
2214
2214
|
yield t;
|
|
2215
2215
|
});
|
|
@@ -2297,7 +2297,7 @@ const w = class w {
|
|
|
2297
2297
|
};
|
|
2298
2298
|
let M = w;
|
|
2299
2299
|
var _e;
|
|
2300
|
-
class
|
|
2300
|
+
class d {
|
|
2301
2301
|
constructor(n) {
|
|
2302
2302
|
/**
|
|
2303
2303
|
* The native {@link AsyncIterator} object that is being wrapped by this instance.
|
|
@@ -2422,7 +2422,7 @@ class f {
|
|
|
2422
2422
|
}
|
|
2423
2423
|
filter(n) {
|
|
2424
2424
|
const e = this._iterator;
|
|
2425
|
-
return new
|
|
2425
|
+
return new d(async function* () {
|
|
2426
2426
|
let t = 0;
|
|
2427
2427
|
for (; ; ) {
|
|
2428
2428
|
const s = await e.next();
|
|
@@ -2465,7 +2465,7 @@ class f {
|
|
|
2465
2465
|
*/
|
|
2466
2466
|
map(n) {
|
|
2467
2467
|
const e = this._iterator;
|
|
2468
|
-
return new
|
|
2468
|
+
return new d(async function* () {
|
|
2469
2469
|
let t = 0;
|
|
2470
2470
|
for (; ; ) {
|
|
2471
2471
|
const s = await e.next();
|
|
@@ -2480,7 +2480,7 @@ class f {
|
|
|
2480
2480
|
if (s === void 0) {
|
|
2481
2481
|
const r = await this._iterator.next();
|
|
2482
2482
|
if (r.done)
|
|
2483
|
-
throw new
|
|
2483
|
+
throw new f("Cannot reduce an empty iterator without an initial value.");
|
|
2484
2484
|
s = r.value, t += 1;
|
|
2485
2485
|
}
|
|
2486
2486
|
for (; ; ) {
|
|
@@ -2523,7 +2523,7 @@ class f {
|
|
|
2523
2523
|
*/
|
|
2524
2524
|
flatMap(n) {
|
|
2525
2525
|
const e = this._iterator;
|
|
2526
|
-
return new
|
|
2526
|
+
return new d(async function* () {
|
|
2527
2527
|
let t = 0;
|
|
2528
2528
|
for (; ; ) {
|
|
2529
2529
|
const s = await e.next();
|
|
@@ -2572,7 +2572,7 @@ class f {
|
|
|
2572
2572
|
*/
|
|
2573
2573
|
drop(n) {
|
|
2574
2574
|
const e = this._iterator;
|
|
2575
|
-
return new
|
|
2575
|
+
return new d(async function* () {
|
|
2576
2576
|
let t = 0;
|
|
2577
2577
|
for (; t < n; ) {
|
|
2578
2578
|
if ((await e.next()).done)
|
|
@@ -2621,7 +2621,7 @@ class f {
|
|
|
2621
2621
|
*/
|
|
2622
2622
|
take(n) {
|
|
2623
2623
|
const e = this._iterator;
|
|
2624
|
-
return new
|
|
2624
|
+
return new d(async function* () {
|
|
2625
2625
|
let t = 0;
|
|
2626
2626
|
for (; t < n; ) {
|
|
2627
2627
|
const s = await e.next();
|
|
@@ -2700,7 +2700,7 @@ class f {
|
|
|
2700
2700
|
*/
|
|
2701
2701
|
unique() {
|
|
2702
2702
|
const n = this._iterator;
|
|
2703
|
-
return new
|
|
2703
|
+
return new d(async function* () {
|
|
2704
2704
|
const e = /* @__PURE__ */ new Set();
|
|
2705
2705
|
for (; ; ) {
|
|
2706
2706
|
const t = await n.next();
|
|
@@ -2824,7 +2824,7 @@ class f {
|
|
|
2824
2824
|
*
|
|
2825
2825
|
* for await (const value of iterator)
|
|
2826
2826
|
* {
|
|
2827
|
-
* if (value > 5) { break; } // Closing the iterator...
|
|
2827
|
+
* if (value > 5) { break; } // "Closing the iterator..."
|
|
2828
2828
|
*
|
|
2829
2829
|
* console.log(value); // 1, 2, 3, 4, 5
|
|
2830
2830
|
* }
|
|
@@ -3156,8 +3156,8 @@ const m = class m {
|
|
|
3156
3156
|
for (const [s, r] of e) {
|
|
3157
3157
|
const o = t.get(s) ?? 0, l = n(s, r, o);
|
|
3158
3158
|
if (l instanceof Array)
|
|
3159
|
-
for (const
|
|
3160
|
-
yield [s,
|
|
3159
|
+
for (const k of l)
|
|
3160
|
+
yield [s, k];
|
|
3161
3161
|
else
|
|
3162
3162
|
yield [s, l];
|
|
3163
3163
|
t.set(s, o + 1);
|
|
@@ -3605,9 +3605,9 @@ const m = class m {
|
|
|
3605
3605
|
}
|
|
3606
3606
|
};
|
|
3607
3607
|
let x = m;
|
|
3608
|
-
const
|
|
3608
|
+
const We = Function;
|
|
3609
3609
|
var be, ge;
|
|
3610
|
-
class
|
|
3610
|
+
class Ue extends (ge = We, be = Symbol.toStringTag, ge) {
|
|
3611
3611
|
/**
|
|
3612
3612
|
* Initializes a new instance of the {@link CallableObject} class.
|
|
3613
3613
|
*/
|
|
@@ -3680,10 +3680,10 @@ const F = class F {
|
|
|
3680
3680
|
* const publisher = new Publisher();
|
|
3681
3681
|
* const context = publisher.createScope();
|
|
3682
3682
|
*
|
|
3683
|
-
* publisher.subscribe("player:death", () =>
|
|
3684
|
-
* context.subscribe("player:spawn", () =>
|
|
3683
|
+
* publisher.subscribe("player:death", () => console.log(`Player has died.`));
|
|
3684
|
+
* context.subscribe("player:spawn", () => console.log(`Player has spawned.`));
|
|
3685
3685
|
*
|
|
3686
|
-
* publisher.publish("player:spawn"); // Player has spawned.
|
|
3686
|
+
* publisher.publish("player:spawn"); // "Player has spawned."
|
|
3687
3687
|
* context.publish("player:death"); // * no output *
|
|
3688
3688
|
* ```
|
|
3689
3689
|
*
|
|
@@ -3694,65 +3694,20 @@ const F = class F {
|
|
|
3694
3694
|
* related callback signatures that can be subscribed to them.
|
|
3695
3695
|
* Default is `T`.
|
|
3696
3696
|
*
|
|
3697
|
-
* @
|
|
3697
|
+
* @return
|
|
3698
|
+
* A new instance of the {@link Publisher} class that can be
|
|
3699
|
+
* used to publish and subscribe events within a specific context.
|
|
3698
3700
|
*/
|
|
3699
3701
|
createScope() {
|
|
3700
|
-
const n = new F()
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3702
|
+
const n = new F();
|
|
3703
|
+
return this.subscribe("__internals__:clear", () => n.clear()), this.subscribe("*", (e, ...t) => {
|
|
3704
|
+
n.publish(e, ...t);
|
|
3705
|
+
}), n;
|
|
3704
3706
|
}
|
|
3705
|
-
/**
|
|
3706
|
-
* Publishes an event to all the subscribers.
|
|
3707
|
-
*
|
|
3708
|
-
* ---
|
|
3709
|
-
*
|
|
3710
|
-
* @example
|
|
3711
|
-
* ```ts
|
|
3712
|
-
* publisher.subscribe("player:move", (coords) => { [...] });
|
|
3713
|
-
* publisher.subscribe("player:move", ({ x, y }) => { [...] });
|
|
3714
|
-
* publisher.subscribe("player:move", (evt) => { [...] });
|
|
3715
|
-
*
|
|
3716
|
-
* publisher.publish("player:move", { x: 10, y: 20 });
|
|
3717
|
-
* ```
|
|
3718
|
-
*
|
|
3719
|
-
* ---
|
|
3720
|
-
*
|
|
3721
|
-
* @template K The key of the map containing the callback signature to publish.
|
|
3722
|
-
*
|
|
3723
|
-
* @param event The name of the event to publish.
|
|
3724
|
-
* @param args The arguments to pass to the subscribers.
|
|
3725
|
-
*
|
|
3726
|
-
* @returns An array containing the return values of all the subscribers.
|
|
3727
|
-
*/
|
|
3728
3707
|
publish(n, ...e) {
|
|
3729
3708
|
let t, s = this._subscribers.get(n);
|
|
3730
3709
|
return s ? t = s.slice().map((r) => r(...e)) : t = [], n.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((r) => r(n, ...e))), t;
|
|
3731
3710
|
}
|
|
3732
|
-
/**
|
|
3733
|
-
* Subscribes to an event and adds a subscriber to be executed when the event is published.
|
|
3734
|
-
*
|
|
3735
|
-
* ---
|
|
3736
|
-
*
|
|
3737
|
-
* @example
|
|
3738
|
-
* ```ts
|
|
3739
|
-
* let unsubscribe: () => void;
|
|
3740
|
-
* publisher.subscribe("player:death", unsubscribe);
|
|
3741
|
-
* publisher.subscribe("player:spawn", (evt) =>
|
|
3742
|
-
* {
|
|
3743
|
-
* unsubscribe = publisher.subscribe("player:move", ({ x, y }) => { [...] });
|
|
3744
|
-
* });
|
|
3745
|
-
* ```
|
|
3746
|
-
*
|
|
3747
|
-
* ---
|
|
3748
|
-
*
|
|
3749
|
-
* @template K The key of the map containing the callback signature to subscribe.
|
|
3750
|
-
*
|
|
3751
|
-
* @param event The name of the event to subscribe to.
|
|
3752
|
-
* @param subscriber The subscriber to execute when the event is published.
|
|
3753
|
-
*
|
|
3754
|
-
* @returns A function that can be used to unsubscribe the subscriber from the event.
|
|
3755
|
-
*/
|
|
3756
3711
|
subscribe(n, e) {
|
|
3757
3712
|
const t = this._subscribers.get(n) ?? [];
|
|
3758
3713
|
return t.push(e), this._subscribers.set(n, t), () => {
|
|
@@ -3762,26 +3717,6 @@ const F = class F {
|
|
|
3762
3717
|
t.splice(s, 1);
|
|
3763
3718
|
};
|
|
3764
3719
|
}
|
|
3765
|
-
/**
|
|
3766
|
-
* Unsubscribes from an event and removes a subscriber from being executed when the event is published.
|
|
3767
|
-
*
|
|
3768
|
-
* ---
|
|
3769
|
-
*
|
|
3770
|
-
* @example
|
|
3771
|
-
* ```ts
|
|
3772
|
-
* const onPlayerMove = ({ x, y }: Point) => { [...] };
|
|
3773
|
-
*
|
|
3774
|
-
* publisher.subscribe("player:spawn", (evt) => publisher.subscribe("player:move", onPlayerMove));
|
|
3775
|
-
* publisher.subscribe("player:death", () => publisher.unsubscribe("player:move", onPlayerMove));
|
|
3776
|
-
* ```
|
|
3777
|
-
*
|
|
3778
|
-
* ---
|
|
3779
|
-
*
|
|
3780
|
-
* @template K The key of the map containing the callback signature to unsubscribe.
|
|
3781
|
-
*
|
|
3782
|
-
* @param event The name of the event to unsubscribe from.
|
|
3783
|
-
* @param subscriber The subscriber to remove from the event.
|
|
3784
|
-
*/
|
|
3785
3720
|
unsubscribe(n, e) {
|
|
3786
3721
|
const t = this._subscribers.get(n);
|
|
3787
3722
|
if (!t)
|
|
@@ -3793,10 +3728,10 @@ const F = class F {
|
|
|
3793
3728
|
}
|
|
3794
3729
|
};
|
|
3795
3730
|
let v = F;
|
|
3796
|
-
const
|
|
3731
|
+
const et = () => {
|
|
3797
3732
|
};
|
|
3798
3733
|
var ve, Se;
|
|
3799
|
-
class
|
|
3734
|
+
class dt extends (Se = Ue, ve = Symbol.toStringTag, Se) {
|
|
3800
3735
|
constructor(e, t = "default") {
|
|
3801
3736
|
super();
|
|
3802
3737
|
/**
|
|
@@ -3831,7 +3766,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3831
3766
|
a(this, "_invoke");
|
|
3832
3767
|
a(this, ve, "SwitchableCallback");
|
|
3833
3768
|
this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = () => {
|
|
3834
|
-
throw new
|
|
3769
|
+
throw new He(
|
|
3835
3770
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3836
3771
|
);
|
|
3837
3772
|
}), this._key = t, this._callback = e, this._invoke = (...s) => this._callback(...s);
|
|
@@ -3864,7 +3799,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3864
3799
|
*
|
|
3865
3800
|
* @example
|
|
3866
3801
|
* ```ts
|
|
3867
|
-
* window.addEventListener("pointerdown", () =>
|
|
3802
|
+
* window.addEventListener("pointerdown", () => onPointerMove.enable());
|
|
3868
3803
|
* window.addEventListener("pointermove", onPointerMove);
|
|
3869
3804
|
* ```
|
|
3870
3805
|
*
|
|
@@ -3898,13 +3833,13 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3898
3833
|
* @example
|
|
3899
3834
|
* ```ts
|
|
3900
3835
|
* window.addEventListener("pointermove", onPointerMove);
|
|
3901
|
-
* window.addEventListener("pointerup", () =>
|
|
3836
|
+
* window.addEventListener("pointerup", () => onPointerMove.disable());
|
|
3902
3837
|
* ```
|
|
3903
3838
|
*/
|
|
3904
3839
|
disable() {
|
|
3905
3840
|
if (!this._isEnabled)
|
|
3906
3841
|
throw new p("The `SwitchableCallback` is already disabled.");
|
|
3907
|
-
this._callback =
|
|
3842
|
+
this._callback = et, this._isEnabled = !1;
|
|
3908
3843
|
}
|
|
3909
3844
|
/**
|
|
3910
3845
|
* Registers a new implementation for the callback.
|
|
@@ -3967,9 +3902,9 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3967
3902
|
*
|
|
3968
3903
|
* @example
|
|
3969
3904
|
* ```ts
|
|
3970
|
-
* window.addEventListener("pointerdown", () =>
|
|
3905
|
+
* window.addEventListener("pointerdown", () => onPointerMove.switch("pressed"));
|
|
3971
3906
|
* window.addEventListener("pointermove", onPointerMove);
|
|
3972
|
-
* window.addEventListener("pointerup", () =>
|
|
3907
|
+
* window.addEventListener("pointerup", () => onPointerMove.switch("released"));
|
|
3973
3908
|
* ```
|
|
3974
3909
|
*
|
|
3975
3910
|
* ---
|
|
@@ -3983,7 +3918,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3983
3918
|
}
|
|
3984
3919
|
}
|
|
3985
3920
|
var ke, Te;
|
|
3986
|
-
class
|
|
3921
|
+
class wt extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
3987
3922
|
/**
|
|
3988
3923
|
* Initializes a new instance of the {@link MapView} class.
|
|
3989
3924
|
*
|
|
@@ -4090,8 +4025,8 @@ class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
|
4090
4025
|
* console.log(`Added ${key}: ${value}`);
|
|
4091
4026
|
* });
|
|
4092
4027
|
*
|
|
4093
|
-
* map.set("key1", 2); // Added key1: 2
|
|
4094
|
-
* map.set("answer", 42); // Added answer: 42
|
|
4028
|
+
* map.set("key1", 2); // "Added key1: 2"
|
|
4029
|
+
* map.set("answer", 42); // "Added answer: 42"
|
|
4095
4030
|
* map.set("key2", 4);
|
|
4096
4031
|
* map.set("key3", 8);
|
|
4097
4032
|
* ```
|
|
@@ -4101,7 +4036,7 @@ class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
|
4101
4036
|
* @template T The key of the map containing the callback signature to subscribe.
|
|
4102
4037
|
*
|
|
4103
4038
|
* @param event The name of the event to subscribe to.
|
|
4104
|
-
* @param
|
|
4039
|
+
* @param subscriber The callback to execute when the event is published.
|
|
4105
4040
|
*
|
|
4106
4041
|
* @returns A function that can be used to unsubscribe the callback from the event.
|
|
4107
4042
|
*/
|
|
@@ -4119,7 +4054,7 @@ class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
|
4119
4054
|
* const map = new MapView<string, number>();
|
|
4120
4055
|
*
|
|
4121
4056
|
* map.subscribe("entry:add", callback);
|
|
4122
|
-
* map.set("key1", 2); // Added key1: 2
|
|
4057
|
+
* map.set("key1", 2); // "Added key1: 2"
|
|
4123
4058
|
*
|
|
4124
4059
|
* map.unsubscribe("entry:add", callback);
|
|
4125
4060
|
* map.set("key2", 4);
|
|
@@ -4130,14 +4065,14 @@ class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
|
4130
4065
|
* @template T The key of the map containing the callback signature to unsubscribe.
|
|
4131
4066
|
*
|
|
4132
4067
|
* @param event The name of the event to unsubscribe from.
|
|
4133
|
-
* @param
|
|
4068
|
+
* @param subscriber The callback to remove from the event.
|
|
4134
4069
|
*/
|
|
4135
4070
|
unsubscribe(e, t) {
|
|
4136
4071
|
this._publisher.unsubscribe(e, t);
|
|
4137
4072
|
}
|
|
4138
4073
|
}
|
|
4139
4074
|
var Ee, Me;
|
|
4140
|
-
class
|
|
4075
|
+
class mt extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
4141
4076
|
/**
|
|
4142
4077
|
* Initializes a new instance of the {@link SetView} class.
|
|
4143
4078
|
*
|
|
@@ -4243,8 +4178,8 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4243
4178
|
* console.log(`Added ${value}`);
|
|
4244
4179
|
* });
|
|
4245
4180
|
*
|
|
4246
|
-
* set.add(2); // Added 2
|
|
4247
|
-
* set.add(42); // Added 42
|
|
4181
|
+
* set.add(2); // "Added 2"
|
|
4182
|
+
* set.add(42); // "Added 42"
|
|
4248
4183
|
* set.add(4);
|
|
4249
4184
|
* set.add(8);
|
|
4250
4185
|
* ```
|
|
@@ -4254,7 +4189,7 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4254
4189
|
* @template K The key of the map containing the callback signature to subscribe.
|
|
4255
4190
|
*
|
|
4256
4191
|
* @param event The name of the event to subscribe to.
|
|
4257
|
-
* @param
|
|
4192
|
+
* @param subscriber The callback to execute when the event is published.
|
|
4258
4193
|
*
|
|
4259
4194
|
* @returns A function that can be used to unsubscribe the callback from the event.
|
|
4260
4195
|
*/
|
|
@@ -4272,7 +4207,7 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4272
4207
|
* const set = new SetView<number>();
|
|
4273
4208
|
*
|
|
4274
4209
|
* set.subscribe("entry:add", callback);
|
|
4275
|
-
* set.add(2); // Added 2
|
|
4210
|
+
* set.add(2); // "Added 2"
|
|
4276
4211
|
*
|
|
4277
4212
|
* set.unsubscribe("entry:add", callback);
|
|
4278
4213
|
* set.add(4);
|
|
@@ -4283,7 +4218,7 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4283
4218
|
* @template K The key of the map containing the callback signature to unsubscribe.
|
|
4284
4219
|
*
|
|
4285
4220
|
* @param event The name of the event to unsubscribe from.
|
|
4286
|
-
* @param
|
|
4221
|
+
* @param subscriber The callback to remove from the event.
|
|
4287
4222
|
*/
|
|
4288
4223
|
unsubscribe(e, t) {
|
|
4289
4224
|
this._publisher.unsubscribe(e, t);
|
|
@@ -4291,7 +4226,7 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4291
4226
|
}
|
|
4292
4227
|
var Re;
|
|
4293
4228
|
Re = Symbol.toStringTag;
|
|
4294
|
-
class
|
|
4229
|
+
class pt {
|
|
4295
4230
|
/**
|
|
4296
4231
|
* Initializes a new instance of the {@link JSONStorage} class.
|
|
4297
4232
|
* It cannot be instantiated outside of a browser environment or an {@link EnvironmentException} is thrown.
|
|
@@ -4326,8 +4261,8 @@ class dt {
|
|
|
4326
4261
|
*/
|
|
4327
4262
|
a(this, "_persistent");
|
|
4328
4263
|
a(this, Re, "JSONStorage");
|
|
4329
|
-
if (!
|
|
4330
|
-
throw new
|
|
4264
|
+
if (!Ye)
|
|
4265
|
+
throw new Xe(
|
|
4331
4266
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
4332
4267
|
);
|
|
4333
4268
|
this._preferPersistence = n, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -4601,7 +4536,7 @@ class dt {
|
|
|
4601
4536
|
}
|
|
4602
4537
|
var Fe;
|
|
4603
4538
|
Fe = Symbol.toStringTag;
|
|
4604
|
-
const
|
|
4539
|
+
const P = class P {
|
|
4605
4540
|
/**
|
|
4606
4541
|
* Initializes a new instance of the {@link SmartPromise} class.
|
|
4607
4542
|
*
|
|
@@ -4678,7 +4613,7 @@ const C = class C {
|
|
|
4678
4613
|
* @returns A new {@link SmartPromise} object that wraps the provided promise.
|
|
4679
4614
|
*/
|
|
4680
4615
|
static FromPromise(n) {
|
|
4681
|
-
return new
|
|
4616
|
+
return new P((e, t) => n.then(e, t));
|
|
4682
4617
|
}
|
|
4683
4618
|
/**
|
|
4684
4619
|
* A flag indicating whether the promise is still pending or not.
|
|
@@ -4734,9 +4669,9 @@ const C = class C {
|
|
|
4734
4669
|
return this._promise.finally(n);
|
|
4735
4670
|
}
|
|
4736
4671
|
};
|
|
4737
|
-
let
|
|
4738
|
-
var
|
|
4739
|
-
class
|
|
4672
|
+
let S = P;
|
|
4673
|
+
var Pe, je;
|
|
4674
|
+
class Ve extends (je = S, Pe = Symbol.toStringTag, je) {
|
|
4740
4675
|
/**
|
|
4741
4676
|
* Initializes a new instance of the {@link DeferredPromise} class.
|
|
4742
4677
|
*
|
|
@@ -4771,7 +4706,7 @@ class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
|
4771
4706
|
* If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
|
|
4772
4707
|
*/
|
|
4773
4708
|
a(this, "_reject");
|
|
4774
|
-
a(this,
|
|
4709
|
+
a(this, Pe, "DeferredPromise");
|
|
4775
4710
|
this._promise = this._promise.then(e, t), this._resolve = s, this._reject = r;
|
|
4776
4711
|
}
|
|
4777
4712
|
/**
|
|
@@ -4810,8 +4745,8 @@ class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
|
4810
4745
|
return e.then(this.resolve, this.reject), this;
|
|
4811
4746
|
}
|
|
4812
4747
|
}
|
|
4813
|
-
var
|
|
4814
|
-
class
|
|
4748
|
+
var Ce, Ie;
|
|
4749
|
+
class tt extends (Ie = S, Ce = Symbol.toStringTag, Ie) {
|
|
4815
4750
|
/**
|
|
4816
4751
|
* Initializes a new instance of the {@link TimedPromise} class.
|
|
4817
4752
|
*
|
|
@@ -4837,21 +4772,71 @@ class wt extends (Ie = k, je = Symbol.toStringTag, Ie) {
|
|
|
4837
4772
|
constructor(e, t) {
|
|
4838
4773
|
super((s, r) => {
|
|
4839
4774
|
const o = (T) => {
|
|
4840
|
-
clearTimeout(
|
|
4775
|
+
clearTimeout(C), s(T);
|
|
4841
4776
|
}, l = (T) => {
|
|
4842
|
-
clearTimeout(
|
|
4843
|
-
},
|
|
4777
|
+
clearTimeout(C), r(T);
|
|
4778
|
+
}, C = setTimeout(() => l(new Ze("The operation has timed out.")), t);
|
|
4844
4779
|
e(o, l);
|
|
4845
4780
|
});
|
|
4846
|
-
a(this,
|
|
4781
|
+
a(this, Ce, "TimedPromise");
|
|
4847
4782
|
}
|
|
4848
4783
|
}
|
|
4849
|
-
var
|
|
4850
|
-
|
|
4784
|
+
var Ae, Ne;
|
|
4785
|
+
class _t extends (Ne = S, Ae = Symbol.toStringTag, Ne) {
|
|
4786
|
+
/**
|
|
4787
|
+
* Initializes a new instance of the {@link PromiseQueue} class.
|
|
4788
|
+
*/
|
|
4789
|
+
constructor() {
|
|
4790
|
+
super((e) => e());
|
|
4791
|
+
/**
|
|
4792
|
+
* The number of promises currently in the queue.
|
|
4793
|
+
*/
|
|
4794
|
+
a(this, "_count");
|
|
4795
|
+
a(this, Ae, "PromiseQueue");
|
|
4796
|
+
this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
|
|
4797
|
+
}
|
|
4798
|
+
/**
|
|
4799
|
+
* A flag indicating whether the promise is still pending or not.
|
|
4800
|
+
*/
|
|
4801
|
+
get isPending() {
|
|
4802
|
+
return this._count > 0;
|
|
4803
|
+
}
|
|
4804
|
+
/**
|
|
4805
|
+
* A flag indicating whether the promise has been fulfilled or not.
|
|
4806
|
+
*/
|
|
4807
|
+
get isFulfilled() {
|
|
4808
|
+
return this._count === 0;
|
|
4809
|
+
}
|
|
4810
|
+
/**
|
|
4811
|
+
* A flag indicating whether the promise has been rejected or not.
|
|
4812
|
+
*
|
|
4813
|
+
* Please note the {@link PromiseQueue} doesn't support rejection states.
|
|
4814
|
+
* Accessing this property will always result in a {@link ValueException}.
|
|
4815
|
+
*/
|
|
4816
|
+
get isRejected() {
|
|
4817
|
+
throw new f("`PromiseQueue` doesn't support rejection states.");
|
|
4818
|
+
}
|
|
4819
|
+
enqueue(e, t) {
|
|
4820
|
+
if (this._count += 1, e instanceof Ve) {
|
|
4821
|
+
const r = e;
|
|
4822
|
+
e = () => (r.resolve(), r);
|
|
4823
|
+
}
|
|
4824
|
+
const s = (r, o) => {
|
|
4825
|
+
this._promise = this._promise.then(e).then((l) => {
|
|
4826
|
+
this._count -= 1, r(l);
|
|
4827
|
+
}).catch((l) => {
|
|
4828
|
+
this._count -= 1, o(l);
|
|
4829
|
+
});
|
|
4830
|
+
};
|
|
4831
|
+
return t ? new tt(s, t) : new Promise(s);
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
var R = /* @__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))(R || {}), nt = /* @__PURE__ */ ((i) => (i[i.Sunday = 0] = "Sunday", i[i.Monday = 1] = "Monday", i[i.Tuesday = 2] = "Tuesday", i[i.Wednesday = 3] = "Wednesday", i[i.Thursday = 4] = "Thursday", i[i.Friday = 5] = "Friday", i[i.Saturday = 6] = "Saturday", i))(nt || {});
|
|
4835
|
+
function yt(i, n, e = 864e5) {
|
|
4851
4836
|
let t;
|
|
4852
4837
|
return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
|
|
4853
4838
|
}
|
|
4854
|
-
function
|
|
4839
|
+
function bt(i, n, e = 864e5) {
|
|
4855
4840
|
if (i = new Date(i), n = new Date(n), i >= n)
|
|
4856
4841
|
throw new b("The end date must be greater than the start date.");
|
|
4857
4842
|
return new u(function* () {
|
|
@@ -4861,7 +4846,7 @@ function pt(i, n, e = 864e5) {
|
|
|
4861
4846
|
yield new Date(s), s += e;
|
|
4862
4847
|
});
|
|
4863
4848
|
}
|
|
4864
|
-
function
|
|
4849
|
+
function st(i, n = 864e5) {
|
|
4865
4850
|
if (n <= 1)
|
|
4866
4851
|
throw new b(
|
|
4867
4852
|
"Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
|
|
@@ -4872,14 +4857,14 @@ function et(i, n = 864e5) {
|
|
|
4872
4857
|
);
|
|
4873
4858
|
return i = new Date(i), new Date(Math.floor(i.getTime() / n) * n);
|
|
4874
4859
|
}
|
|
4875
|
-
function
|
|
4860
|
+
function gt(i, n = 0) {
|
|
4876
4861
|
i = new Date(i);
|
|
4877
4862
|
const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
|
|
4878
|
-
return
|
|
4863
|
+
return st(new Date(s));
|
|
4879
4864
|
}
|
|
4880
|
-
var
|
|
4881
|
-
|
|
4882
|
-
class
|
|
4865
|
+
var Oe;
|
|
4866
|
+
Oe = Symbol.toStringTag;
|
|
4867
|
+
class Ge {
|
|
4883
4868
|
/**
|
|
4884
4869
|
* Initializes a new instance of the {@link GameLoop} class.
|
|
4885
4870
|
*
|
|
@@ -4936,8 +4921,8 @@ class Ye {
|
|
|
4936
4921
|
* {@link cancelAnimationFrame} or the {@link clearInterval} function.
|
|
4937
4922
|
*/
|
|
4938
4923
|
a(this, "_stop");
|
|
4939
|
-
a(this,
|
|
4940
|
-
this._startTime = 0, this._isRunning = !1,
|
|
4924
|
+
a(this, Oe, "GameLoop");
|
|
4925
|
+
this._startTime = 0, this._isRunning = !1, Ye ? (this._start = () => {
|
|
4941
4926
|
n(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
4942
4927
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
4943
4928
|
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
@@ -5015,7 +5000,7 @@ class Ye {
|
|
|
5015
5000
|
*
|
|
5016
5001
|
* @example
|
|
5017
5002
|
* ```ts
|
|
5018
|
-
* loop.onStart(() =>
|
|
5003
|
+
* loop.onStart(() => console.log("The game loop has started."));
|
|
5019
5004
|
* ```
|
|
5020
5005
|
*
|
|
5021
5006
|
* ---
|
|
@@ -5034,7 +5019,7 @@ class Ye {
|
|
|
5034
5019
|
*
|
|
5035
5020
|
* @example
|
|
5036
5021
|
* ```ts
|
|
5037
|
-
* loop.onStop(() =>
|
|
5022
|
+
* loop.onStop(() => console.log("The game loop has stopped."));
|
|
5038
5023
|
* ```
|
|
5039
5024
|
*
|
|
5040
5025
|
* ---
|
|
@@ -5047,8 +5032,8 @@ class Ye {
|
|
|
5047
5032
|
return this._publisher.subscribe("stop", n);
|
|
5048
5033
|
}
|
|
5049
5034
|
}
|
|
5050
|
-
var
|
|
5051
|
-
class
|
|
5035
|
+
var qe, $e;
|
|
5036
|
+
class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
|
|
5052
5037
|
/**
|
|
5053
5038
|
* Initializes a new instance of the {@link Clock} class.
|
|
5054
5039
|
*
|
|
@@ -5067,7 +5052,7 @@ class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
|
5067
5052
|
*/
|
|
5068
5053
|
constructor(e = R.Second) {
|
|
5069
5054
|
super((t) => this._publisher.publish("tick", t), e);
|
|
5070
|
-
a(this,
|
|
5055
|
+
a(this, qe, "Clock");
|
|
5071
5056
|
}
|
|
5072
5057
|
/**
|
|
5073
5058
|
* Starts the execution of the clock.
|
|
@@ -5146,8 +5131,8 @@ class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
|
5146
5131
|
});
|
|
5147
5132
|
}
|
|
5148
5133
|
}
|
|
5149
|
-
var
|
|
5150
|
-
class
|
|
5134
|
+
var ze, De;
|
|
5135
|
+
class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
|
|
5151
5136
|
/**
|
|
5152
5137
|
* Initializes a new instance of the {@link Countdown} class.
|
|
5153
5138
|
*
|
|
@@ -5183,7 +5168,7 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5183
5168
|
* The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
|
|
5184
5169
|
*/
|
|
5185
5170
|
a(this, "_deferrer");
|
|
5186
|
-
a(this,
|
|
5171
|
+
a(this, ze, "Countdown");
|
|
5187
5172
|
this._duration = e;
|
|
5188
5173
|
}
|
|
5189
5174
|
/**
|
|
@@ -5244,7 +5229,7 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5244
5229
|
throw new p("The countdown had already stopped or hadn't yet started.");
|
|
5245
5230
|
if (this._deferrer)
|
|
5246
5231
|
throw new g();
|
|
5247
|
-
return this._deferrer = new
|
|
5232
|
+
return this._deferrer = new Ve(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
|
|
5248
5233
|
}
|
|
5249
5234
|
/**
|
|
5250
5235
|
* Stops the execution of the countdown.
|
|
@@ -5325,11 +5310,11 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5325
5310
|
});
|
|
5326
5311
|
}
|
|
5327
5312
|
}
|
|
5328
|
-
var
|
|
5329
|
-
|
|
5330
|
-
class
|
|
5313
|
+
var Be;
|
|
5314
|
+
Be = Symbol.toStringTag;
|
|
5315
|
+
class St {
|
|
5331
5316
|
constructor() {
|
|
5332
|
-
a(this,
|
|
5317
|
+
a(this, Be, "Curve");
|
|
5333
5318
|
}
|
|
5334
5319
|
/**
|
|
5335
5320
|
* Generates a given number of values following a linear curve.
|
|
@@ -5388,7 +5373,7 @@ class gt {
|
|
|
5388
5373
|
*/
|
|
5389
5374
|
static Exponential(n, e = 2) {
|
|
5390
5375
|
if (e < 0)
|
|
5391
|
-
throw new
|
|
5376
|
+
throw new f("The base of the exponential curve cannot be negative.");
|
|
5392
5377
|
const t = n - 1;
|
|
5393
5378
|
return new u(function* () {
|
|
5394
5379
|
for (let s = 0; s < n; s += 1)
|
|
@@ -5396,11 +5381,11 @@ class gt {
|
|
|
5396
5381
|
});
|
|
5397
5382
|
}
|
|
5398
5383
|
}
|
|
5399
|
-
var
|
|
5400
|
-
|
|
5401
|
-
const
|
|
5384
|
+
var Je;
|
|
5385
|
+
Je = Symbol.toStringTag;
|
|
5386
|
+
const j = class j {
|
|
5402
5387
|
constructor() {
|
|
5403
|
-
a(this,
|
|
5388
|
+
a(this, Je, "Random");
|
|
5404
5389
|
}
|
|
5405
5390
|
/**
|
|
5406
5391
|
* Generates a random boolean value.
|
|
@@ -5449,7 +5434,7 @@ const P = class P {
|
|
|
5449
5434
|
*/
|
|
5450
5435
|
static Index(n) {
|
|
5451
5436
|
if (n.length === 0)
|
|
5452
|
-
throw new
|
|
5437
|
+
throw new f("You must provide at least one element.");
|
|
5453
5438
|
return this.Integer(n.length);
|
|
5454
5439
|
}
|
|
5455
5440
|
/**
|
|
@@ -5467,33 +5452,33 @@ const P = class P {
|
|
|
5467
5452
|
* @returns A random element from the given array.
|
|
5468
5453
|
*/
|
|
5469
5454
|
static Choice(n) {
|
|
5470
|
-
return n[
|
|
5455
|
+
return n[j.Index(n)];
|
|
5471
5456
|
}
|
|
5472
5457
|
};
|
|
5473
|
-
let I =
|
|
5474
|
-
function
|
|
5458
|
+
let I = j;
|
|
5459
|
+
function kt(i) {
|
|
5475
5460
|
return new Promise((n) => setTimeout(n, i));
|
|
5476
5461
|
}
|
|
5477
|
-
function
|
|
5462
|
+
function Tt() {
|
|
5478
5463
|
return new Promise((i) => requestAnimationFrame(() => i()));
|
|
5479
5464
|
}
|
|
5480
|
-
function
|
|
5465
|
+
function Et() {
|
|
5481
5466
|
return new Promise((i) => setTimeout(i));
|
|
5482
5467
|
}
|
|
5483
|
-
function
|
|
5468
|
+
function Mt(i, n = "text/javascript") {
|
|
5484
5469
|
return new Promise((e, t) => {
|
|
5485
5470
|
const s = document.createElement("script");
|
|
5486
5471
|
s.async = !0, s.defer = !0, s.src = i, s.type = n, s.onload = (r) => e(), s.onerror = (r) => t(r), document.body.appendChild(s);
|
|
5487
5472
|
});
|
|
5488
5473
|
}
|
|
5489
|
-
function
|
|
5474
|
+
function Rt(...i) {
|
|
5490
5475
|
return new u(function* () {
|
|
5491
5476
|
for (const n of i)
|
|
5492
5477
|
for (const e of n)
|
|
5493
5478
|
yield e;
|
|
5494
5479
|
});
|
|
5495
5480
|
}
|
|
5496
|
-
function
|
|
5481
|
+
function Ft(i) {
|
|
5497
5482
|
if (i instanceof Array)
|
|
5498
5483
|
return i.length;
|
|
5499
5484
|
let n = 0;
|
|
@@ -5501,14 +5486,14 @@ function Et(i) {
|
|
|
5501
5486
|
n += 1;
|
|
5502
5487
|
return n;
|
|
5503
5488
|
}
|
|
5504
|
-
function
|
|
5489
|
+
function Pt(i) {
|
|
5505
5490
|
return new u(function* () {
|
|
5506
5491
|
let n = 0;
|
|
5507
5492
|
for (const e of i)
|
|
5508
5493
|
yield [n, e], n += 1;
|
|
5509
5494
|
});
|
|
5510
5495
|
}
|
|
5511
|
-
function
|
|
5496
|
+
function jt(i, n, e = 1) {
|
|
5512
5497
|
if (e <= 0)
|
|
5513
5498
|
throw new b(
|
|
5514
5499
|
"Step must be always a positive number, even when generating numbers in reverse order."
|
|
@@ -5521,7 +5506,7 @@ function Rt(i, n, e = 1) {
|
|
|
5521
5506
|
yield t;
|
|
5522
5507
|
});
|
|
5523
5508
|
}
|
|
5524
|
-
function
|
|
5509
|
+
function Ct(i) {
|
|
5525
5510
|
const n = Array.from(i);
|
|
5526
5511
|
for (let e = n.length - 1; e > 0; e -= 1) {
|
|
5527
5512
|
const t = Math.floor(Math.random() * (e + 1));
|
|
@@ -5529,14 +5514,14 @@ function Ft(i) {
|
|
|
5529
5514
|
}
|
|
5530
5515
|
return n;
|
|
5531
5516
|
}
|
|
5532
|
-
function
|
|
5517
|
+
function It(i) {
|
|
5533
5518
|
return new u(function* () {
|
|
5534
5519
|
const n = /* @__PURE__ */ new Set();
|
|
5535
5520
|
for (const e of i)
|
|
5536
5521
|
n.has(e) || (n.add(e), yield e);
|
|
5537
5522
|
});
|
|
5538
5523
|
}
|
|
5539
|
-
function
|
|
5524
|
+
function rt(i, n) {
|
|
5540
5525
|
const e = i[Symbol.iterator](), t = n[Symbol.iterator]();
|
|
5541
5526
|
return new u(function* () {
|
|
5542
5527
|
for (; ; ) {
|
|
@@ -5547,28 +5532,28 @@ function tt(i, n) {
|
|
|
5547
5532
|
}
|
|
5548
5533
|
});
|
|
5549
5534
|
}
|
|
5550
|
-
function
|
|
5535
|
+
function At(i, n) {
|
|
5551
5536
|
if (n === void 0) {
|
|
5552
5537
|
let r = 0, o = 0;
|
|
5553
5538
|
for (const l of i)
|
|
5554
5539
|
r += l, o += 1;
|
|
5555
5540
|
if (o === 0)
|
|
5556
|
-
throw new
|
|
5541
|
+
throw new f("You must provide at least one value.");
|
|
5557
5542
|
return r / o;
|
|
5558
5543
|
}
|
|
5559
5544
|
let e = 0, t = 0, s = 0;
|
|
5560
|
-
for (const [r, o] of
|
|
5545
|
+
for (const [r, o] of rt(i, n)) {
|
|
5561
5546
|
if (o <= 0)
|
|
5562
|
-
throw new
|
|
5547
|
+
throw new f(`The weight for the value #${s} must be greater than zero.`);
|
|
5563
5548
|
e += r * o, t += o, s += 1;
|
|
5564
5549
|
}
|
|
5565
5550
|
if (s === 0)
|
|
5566
|
-
throw new
|
|
5551
|
+
throw new f("You must provide at least one value and weight.");
|
|
5567
5552
|
if (t <= 0)
|
|
5568
|
-
throw new
|
|
5553
|
+
throw new f("The sum of weights must be greater than zero.");
|
|
5569
5554
|
return e / t;
|
|
5570
5555
|
}
|
|
5571
|
-
function
|
|
5556
|
+
function Nt(i) {
|
|
5572
5557
|
let n = 0;
|
|
5573
5558
|
for (let e = 0; e < i.length; e += 1) {
|
|
5574
5559
|
const t = i.charCodeAt(e);
|
|
@@ -5576,76 +5561,77 @@ function jt(i) {
|
|
|
5576
5561
|
}
|
|
5577
5562
|
return n;
|
|
5578
5563
|
}
|
|
5579
|
-
function
|
|
5564
|
+
function Ot(i) {
|
|
5580
5565
|
let n = 0;
|
|
5581
5566
|
for (const e of i)
|
|
5582
5567
|
n += e;
|
|
5583
5568
|
return n;
|
|
5584
5569
|
}
|
|
5585
|
-
function
|
|
5570
|
+
function qt(i) {
|
|
5586
5571
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
5587
5572
|
}
|
|
5588
|
-
const
|
|
5573
|
+
const $t = "2.1.6";
|
|
5589
5574
|
export {
|
|
5590
5575
|
M as AggregatedAsyncIterator,
|
|
5591
5576
|
x as AggregatedIterator,
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5577
|
+
Ue as CallableObject,
|
|
5578
|
+
xt as Clock,
|
|
5579
|
+
vt as Countdown,
|
|
5580
|
+
St as Curve,
|
|
5581
|
+
Ve as DeferredPromise,
|
|
5582
|
+
Xe as EnvironmentException,
|
|
5598
5583
|
c as Exception,
|
|
5599
5584
|
g as FatalErrorException,
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5585
|
+
Le as FileException,
|
|
5586
|
+
lt as FileExistsException,
|
|
5587
|
+
ut as FileNotFoundException,
|
|
5588
|
+
Ge as GameLoop,
|
|
5589
|
+
pt as JSONStorage,
|
|
5605
5590
|
_ as KeyException,
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5591
|
+
wt as MapView,
|
|
5592
|
+
ct as NetworkException,
|
|
5593
|
+
He as NotImplementedException,
|
|
5594
|
+
ht as PermissionException,
|
|
5595
|
+
_t as PromiseQueue,
|
|
5610
5596
|
v as Publisher,
|
|
5611
5597
|
I as Random,
|
|
5612
5598
|
b as RangeException,
|
|
5613
5599
|
h as ReducedIterator,
|
|
5614
5600
|
E as ReferenceException,
|
|
5615
5601
|
p as RuntimeException,
|
|
5616
|
-
|
|
5617
|
-
|
|
5602
|
+
mt as SetView,
|
|
5603
|
+
d as SmartAsyncIterator,
|
|
5618
5604
|
u as SmartIterator,
|
|
5619
|
-
|
|
5620
|
-
|
|
5605
|
+
S as SmartPromise,
|
|
5606
|
+
dt as SwitchableCallback,
|
|
5621
5607
|
R as TimeUnit,
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5608
|
+
tt as TimedPromise,
|
|
5609
|
+
Ze as TimeoutException,
|
|
5610
|
+
ft as TypeException,
|
|
5611
|
+
$t as VERSION,
|
|
5612
|
+
f as ValueException,
|
|
5613
|
+
nt as WeekDay,
|
|
5614
|
+
At as average,
|
|
5615
|
+
qt as capitalize,
|
|
5616
|
+
Rt as chain,
|
|
5617
|
+
Ft as count,
|
|
5618
|
+
yt as dateDifference,
|
|
5619
|
+
bt as dateRange,
|
|
5620
|
+
st as dateRound,
|
|
5621
|
+
kt as delay,
|
|
5622
|
+
Pt as enumerate,
|
|
5623
|
+
gt as getWeek,
|
|
5624
|
+
Nt as hash,
|
|
5625
|
+
Ye as isBrowser,
|
|
5626
|
+
ot as isNode,
|
|
5627
|
+
at as isWorker,
|
|
5628
|
+
Mt as loadScript,
|
|
5629
|
+
Tt as nextAnimationFrame,
|
|
5630
|
+
jt as range,
|
|
5631
|
+
Ct as shuffle,
|
|
5632
|
+
Ot as sum,
|
|
5633
|
+
It as unique,
|
|
5634
|
+
Et as yieldToEventLoop,
|
|
5635
|
+
rt as zip
|
|
5650
5636
|
};
|
|
5651
5637
|
//# sourceMappingURL=core.esm.js.map
|