@byloth/core 2.1.4 → 2.1.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.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +218 -163
- 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 +3 -3
- package/src/core/types.ts +1 -1
- package/src/index.ts +2 -1
- package/src/models/callbacks/publisher.ts +4 -0
- package/src/models/index.ts +1 -1
- package/src/models/promises/index.ts +2 -1
- package/src/models/promises/promise-queue.ts +222 -0
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 (; ; ) {
|
|
@@ -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();
|
|
@@ -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
|
*/
|
|
@@ -3695,6 +3695,10 @@ const F = class F {
|
|
|
3695
3695
|
* Default is `T`.
|
|
3696
3696
|
*
|
|
3697
3697
|
* @template X An utility type that extends the `U` map with a wildcard event.
|
|
3698
|
+
*
|
|
3699
|
+
* @return
|
|
3700
|
+
* A new instance of the {@link Publisher} class that can be
|
|
3701
|
+
* used to publish and subscribe events within a specific context.
|
|
3698
3702
|
*/
|
|
3699
3703
|
createScope() {
|
|
3700
3704
|
const n = new F(), e = (t, ...s) => {
|
|
@@ -3793,10 +3797,10 @@ const F = class F {
|
|
|
3793
3797
|
}
|
|
3794
3798
|
};
|
|
3795
3799
|
let v = F;
|
|
3796
|
-
const
|
|
3800
|
+
const et = () => {
|
|
3797
3801
|
};
|
|
3798
3802
|
var ve, Se;
|
|
3799
|
-
class
|
|
3803
|
+
class dt extends (Se = Ue, ve = Symbol.toStringTag, Se) {
|
|
3800
3804
|
constructor(e, t = "default") {
|
|
3801
3805
|
super();
|
|
3802
3806
|
/**
|
|
@@ -3831,7 +3835,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3831
3835
|
a(this, "_invoke");
|
|
3832
3836
|
a(this, ve, "SwitchableCallback");
|
|
3833
3837
|
this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = () => {
|
|
3834
|
-
throw new
|
|
3838
|
+
throw new He(
|
|
3835
3839
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3836
3840
|
);
|
|
3837
3841
|
}), this._key = t, this._callback = e, this._invoke = (...s) => this._callback(...s);
|
|
@@ -3904,7 +3908,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3904
3908
|
disable() {
|
|
3905
3909
|
if (!this._isEnabled)
|
|
3906
3910
|
throw new p("The `SwitchableCallback` is already disabled.");
|
|
3907
|
-
this._callback =
|
|
3911
|
+
this._callback = et, this._isEnabled = !1;
|
|
3908
3912
|
}
|
|
3909
3913
|
/**
|
|
3910
3914
|
* Registers a new implementation for the callback.
|
|
@@ -3983,7 +3987,7 @@ class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
|
3983
3987
|
}
|
|
3984
3988
|
}
|
|
3985
3989
|
var ke, Te;
|
|
3986
|
-
class
|
|
3990
|
+
class wt extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
3987
3991
|
/**
|
|
3988
3992
|
* Initializes a new instance of the {@link MapView} class.
|
|
3989
3993
|
*
|
|
@@ -4137,7 +4141,7 @@ class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
|
4137
4141
|
}
|
|
4138
4142
|
}
|
|
4139
4143
|
var Ee, Me;
|
|
4140
|
-
class
|
|
4144
|
+
class mt extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
4141
4145
|
/**
|
|
4142
4146
|
* Initializes a new instance of the {@link SetView} class.
|
|
4143
4147
|
*
|
|
@@ -4291,7 +4295,7 @@ class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
|
4291
4295
|
}
|
|
4292
4296
|
var Re;
|
|
4293
4297
|
Re = Symbol.toStringTag;
|
|
4294
|
-
class
|
|
4298
|
+
class pt {
|
|
4295
4299
|
/**
|
|
4296
4300
|
* Initializes a new instance of the {@link JSONStorage} class.
|
|
4297
4301
|
* It cannot be instantiated outside of a browser environment or an {@link EnvironmentException} is thrown.
|
|
@@ -4326,8 +4330,8 @@ class dt {
|
|
|
4326
4330
|
*/
|
|
4327
4331
|
a(this, "_persistent");
|
|
4328
4332
|
a(this, Re, "JSONStorage");
|
|
4329
|
-
if (!
|
|
4330
|
-
throw new
|
|
4333
|
+
if (!Ye)
|
|
4334
|
+
throw new Xe(
|
|
4331
4335
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
4332
4336
|
);
|
|
4333
4337
|
this._preferPersistence = n, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -4601,7 +4605,7 @@ class dt {
|
|
|
4601
4605
|
}
|
|
4602
4606
|
var Fe;
|
|
4603
4607
|
Fe = Symbol.toStringTag;
|
|
4604
|
-
const
|
|
4608
|
+
const P = class P {
|
|
4605
4609
|
/**
|
|
4606
4610
|
* Initializes a new instance of the {@link SmartPromise} class.
|
|
4607
4611
|
*
|
|
@@ -4678,7 +4682,7 @@ const C = class C {
|
|
|
4678
4682
|
* @returns A new {@link SmartPromise} object that wraps the provided promise.
|
|
4679
4683
|
*/
|
|
4680
4684
|
static FromPromise(n) {
|
|
4681
|
-
return new
|
|
4685
|
+
return new P((e, t) => n.then(e, t));
|
|
4682
4686
|
}
|
|
4683
4687
|
/**
|
|
4684
4688
|
* A flag indicating whether the promise is still pending or not.
|
|
@@ -4734,9 +4738,9 @@ const C = class C {
|
|
|
4734
4738
|
return this._promise.finally(n);
|
|
4735
4739
|
}
|
|
4736
4740
|
};
|
|
4737
|
-
let
|
|
4738
|
-
var
|
|
4739
|
-
class
|
|
4741
|
+
let S = P;
|
|
4742
|
+
var Pe, je;
|
|
4743
|
+
class Ve extends (je = S, Pe = Symbol.toStringTag, je) {
|
|
4740
4744
|
/**
|
|
4741
4745
|
* Initializes a new instance of the {@link DeferredPromise} class.
|
|
4742
4746
|
*
|
|
@@ -4771,7 +4775,7 @@ class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
|
4771
4775
|
* If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
|
|
4772
4776
|
*/
|
|
4773
4777
|
a(this, "_reject");
|
|
4774
|
-
a(this,
|
|
4778
|
+
a(this, Pe, "DeferredPromise");
|
|
4775
4779
|
this._promise = this._promise.then(e, t), this._resolve = s, this._reject = r;
|
|
4776
4780
|
}
|
|
4777
4781
|
/**
|
|
@@ -4810,8 +4814,8 @@ class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
|
4810
4814
|
return e.then(this.resolve, this.reject), this;
|
|
4811
4815
|
}
|
|
4812
4816
|
}
|
|
4813
|
-
var
|
|
4814
|
-
class
|
|
4817
|
+
var Ce, Ie;
|
|
4818
|
+
class tt extends (Ie = S, Ce = Symbol.toStringTag, Ie) {
|
|
4815
4819
|
/**
|
|
4816
4820
|
* Initializes a new instance of the {@link TimedPromise} class.
|
|
4817
4821
|
*
|
|
@@ -4837,21 +4841,71 @@ class wt extends (Ie = k, je = Symbol.toStringTag, Ie) {
|
|
|
4837
4841
|
constructor(e, t) {
|
|
4838
4842
|
super((s, r) => {
|
|
4839
4843
|
const o = (T) => {
|
|
4840
|
-
clearTimeout(
|
|
4844
|
+
clearTimeout(C), s(T);
|
|
4841
4845
|
}, l = (T) => {
|
|
4842
|
-
clearTimeout(
|
|
4843
|
-
},
|
|
4846
|
+
clearTimeout(C), r(T);
|
|
4847
|
+
}, C = setTimeout(() => l(new Ze("The operation has timed out.")), t);
|
|
4844
4848
|
e(o, l);
|
|
4845
4849
|
});
|
|
4846
|
-
a(this,
|
|
4850
|
+
a(this, Ce, "TimedPromise");
|
|
4847
4851
|
}
|
|
4848
4852
|
}
|
|
4849
|
-
var
|
|
4850
|
-
|
|
4853
|
+
var Ae, Ne;
|
|
4854
|
+
class _t extends (Ne = S, Ae = Symbol.toStringTag, Ne) {
|
|
4855
|
+
/**
|
|
4856
|
+
* Initializes a new instance of the {@link PromiseQueue} class.
|
|
4857
|
+
*/
|
|
4858
|
+
constructor() {
|
|
4859
|
+
super((e) => e());
|
|
4860
|
+
/**
|
|
4861
|
+
* The number of promises currently in the queue.
|
|
4862
|
+
*/
|
|
4863
|
+
a(this, "_count");
|
|
4864
|
+
a(this, Ae, "PromiseQueue");
|
|
4865
|
+
this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
|
|
4866
|
+
}
|
|
4867
|
+
/**
|
|
4868
|
+
* A flag indicating whether the promise is still pending or not.
|
|
4869
|
+
*/
|
|
4870
|
+
get isPending() {
|
|
4871
|
+
return this._count > 0;
|
|
4872
|
+
}
|
|
4873
|
+
/**
|
|
4874
|
+
* A flag indicating whether the promise has been fulfilled or not.
|
|
4875
|
+
*/
|
|
4876
|
+
get isFulfilled() {
|
|
4877
|
+
return this._count === 0;
|
|
4878
|
+
}
|
|
4879
|
+
/**
|
|
4880
|
+
* A flag indicating whether the promise has been rejected or not.
|
|
4881
|
+
*
|
|
4882
|
+
* Please note the {@link PromiseQueue} doesn't support rejection states.
|
|
4883
|
+
* Accessing this property will always result in a {@link ValueException}.
|
|
4884
|
+
*/
|
|
4885
|
+
get isRejected() {
|
|
4886
|
+
throw new f("`PromiseQueue` doesn't support rejection states.");
|
|
4887
|
+
}
|
|
4888
|
+
enqueue(e, t) {
|
|
4889
|
+
if (this._count += 1, e instanceof Ve) {
|
|
4890
|
+
const r = e;
|
|
4891
|
+
e = () => (r.resolve(), r);
|
|
4892
|
+
}
|
|
4893
|
+
const s = (r, o) => {
|
|
4894
|
+
this._promise = this._promise.then(e).then((l) => {
|
|
4895
|
+
this._count -= 1, r(l);
|
|
4896
|
+
}).catch((l) => {
|
|
4897
|
+
this._count -= 1, o(l);
|
|
4898
|
+
});
|
|
4899
|
+
};
|
|
4900
|
+
return t ? new tt(s, t) : new Promise(s);
|
|
4901
|
+
}
|
|
4902
|
+
}
|
|
4903
|
+
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 || {});
|
|
4904
|
+
function yt(i, n, e = 864e5) {
|
|
4851
4905
|
let t;
|
|
4852
4906
|
return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
|
|
4853
4907
|
}
|
|
4854
|
-
function
|
|
4908
|
+
function bt(i, n, e = 864e5) {
|
|
4855
4909
|
if (i = new Date(i), n = new Date(n), i >= n)
|
|
4856
4910
|
throw new b("The end date must be greater than the start date.");
|
|
4857
4911
|
return new u(function* () {
|
|
@@ -4861,7 +4915,7 @@ function pt(i, n, e = 864e5) {
|
|
|
4861
4915
|
yield new Date(s), s += e;
|
|
4862
4916
|
});
|
|
4863
4917
|
}
|
|
4864
|
-
function
|
|
4918
|
+
function st(i, n = 864e5) {
|
|
4865
4919
|
if (n <= 1)
|
|
4866
4920
|
throw new b(
|
|
4867
4921
|
"Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
|
|
@@ -4872,14 +4926,14 @@ function et(i, n = 864e5) {
|
|
|
4872
4926
|
);
|
|
4873
4927
|
return i = new Date(i), new Date(Math.floor(i.getTime() / n) * n);
|
|
4874
4928
|
}
|
|
4875
|
-
function
|
|
4929
|
+
function gt(i, n = 0) {
|
|
4876
4930
|
i = new Date(i);
|
|
4877
4931
|
const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
|
|
4878
|
-
return
|
|
4932
|
+
return st(new Date(s));
|
|
4879
4933
|
}
|
|
4880
|
-
var
|
|
4881
|
-
|
|
4882
|
-
class
|
|
4934
|
+
var Oe;
|
|
4935
|
+
Oe = Symbol.toStringTag;
|
|
4936
|
+
class Ge {
|
|
4883
4937
|
/**
|
|
4884
4938
|
* Initializes a new instance of the {@link GameLoop} class.
|
|
4885
4939
|
*
|
|
@@ -4936,8 +4990,8 @@ class Ye {
|
|
|
4936
4990
|
* {@link cancelAnimationFrame} or the {@link clearInterval} function.
|
|
4937
4991
|
*/
|
|
4938
4992
|
a(this, "_stop");
|
|
4939
|
-
a(this,
|
|
4940
|
-
this._startTime = 0, this._isRunning = !1,
|
|
4993
|
+
a(this, Oe, "GameLoop");
|
|
4994
|
+
this._startTime = 0, this._isRunning = !1, Ye ? (this._start = () => {
|
|
4941
4995
|
n(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
4942
4996
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
4943
4997
|
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
@@ -5047,8 +5101,8 @@ class Ye {
|
|
|
5047
5101
|
return this._publisher.subscribe("stop", n);
|
|
5048
5102
|
}
|
|
5049
5103
|
}
|
|
5050
|
-
var
|
|
5051
|
-
class
|
|
5104
|
+
var qe, $e;
|
|
5105
|
+
class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
|
|
5052
5106
|
/**
|
|
5053
5107
|
* Initializes a new instance of the {@link Clock} class.
|
|
5054
5108
|
*
|
|
@@ -5067,7 +5121,7 @@ class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
|
5067
5121
|
*/
|
|
5068
5122
|
constructor(e = R.Second) {
|
|
5069
5123
|
super((t) => this._publisher.publish("tick", t), e);
|
|
5070
|
-
a(this,
|
|
5124
|
+
a(this, qe, "Clock");
|
|
5071
5125
|
}
|
|
5072
5126
|
/**
|
|
5073
5127
|
* Starts the execution of the clock.
|
|
@@ -5146,8 +5200,8 @@ class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
|
5146
5200
|
});
|
|
5147
5201
|
}
|
|
5148
5202
|
}
|
|
5149
|
-
var
|
|
5150
|
-
class
|
|
5203
|
+
var ze, De;
|
|
5204
|
+
class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
|
|
5151
5205
|
/**
|
|
5152
5206
|
* Initializes a new instance of the {@link Countdown} class.
|
|
5153
5207
|
*
|
|
@@ -5183,7 +5237,7 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5183
5237
|
* The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
|
|
5184
5238
|
*/
|
|
5185
5239
|
a(this, "_deferrer");
|
|
5186
|
-
a(this,
|
|
5240
|
+
a(this, ze, "Countdown");
|
|
5187
5241
|
this._duration = e;
|
|
5188
5242
|
}
|
|
5189
5243
|
/**
|
|
@@ -5244,7 +5298,7 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5244
5298
|
throw new p("The countdown had already stopped or hadn't yet started.");
|
|
5245
5299
|
if (this._deferrer)
|
|
5246
5300
|
throw new g();
|
|
5247
|
-
return this._deferrer = new
|
|
5301
|
+
return this._deferrer = new Ve(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
|
|
5248
5302
|
}
|
|
5249
5303
|
/**
|
|
5250
5304
|
* Stops the execution of the countdown.
|
|
@@ -5325,11 +5379,11 @@ class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
|
5325
5379
|
});
|
|
5326
5380
|
}
|
|
5327
5381
|
}
|
|
5328
|
-
var
|
|
5329
|
-
|
|
5330
|
-
class
|
|
5382
|
+
var Be;
|
|
5383
|
+
Be = Symbol.toStringTag;
|
|
5384
|
+
class St {
|
|
5331
5385
|
constructor() {
|
|
5332
|
-
a(this,
|
|
5386
|
+
a(this, Be, "Curve");
|
|
5333
5387
|
}
|
|
5334
5388
|
/**
|
|
5335
5389
|
* Generates a given number of values following a linear curve.
|
|
@@ -5388,7 +5442,7 @@ class gt {
|
|
|
5388
5442
|
*/
|
|
5389
5443
|
static Exponential(n, e = 2) {
|
|
5390
5444
|
if (e < 0)
|
|
5391
|
-
throw new
|
|
5445
|
+
throw new f("The base of the exponential curve cannot be negative.");
|
|
5392
5446
|
const t = n - 1;
|
|
5393
5447
|
return new u(function* () {
|
|
5394
5448
|
for (let s = 0; s < n; s += 1)
|
|
@@ -5396,11 +5450,11 @@ class gt {
|
|
|
5396
5450
|
});
|
|
5397
5451
|
}
|
|
5398
5452
|
}
|
|
5399
|
-
var
|
|
5400
|
-
|
|
5401
|
-
const
|
|
5453
|
+
var Je;
|
|
5454
|
+
Je = Symbol.toStringTag;
|
|
5455
|
+
const j = class j {
|
|
5402
5456
|
constructor() {
|
|
5403
|
-
a(this,
|
|
5457
|
+
a(this, Je, "Random");
|
|
5404
5458
|
}
|
|
5405
5459
|
/**
|
|
5406
5460
|
* Generates a random boolean value.
|
|
@@ -5449,7 +5503,7 @@ const P = class P {
|
|
|
5449
5503
|
*/
|
|
5450
5504
|
static Index(n) {
|
|
5451
5505
|
if (n.length === 0)
|
|
5452
|
-
throw new
|
|
5506
|
+
throw new f("You must provide at least one element.");
|
|
5453
5507
|
return this.Integer(n.length);
|
|
5454
5508
|
}
|
|
5455
5509
|
/**
|
|
@@ -5467,33 +5521,33 @@ const P = class P {
|
|
|
5467
5521
|
* @returns A random element from the given array.
|
|
5468
5522
|
*/
|
|
5469
5523
|
static Choice(n) {
|
|
5470
|
-
return n[
|
|
5524
|
+
return n[j.Index(n)];
|
|
5471
5525
|
}
|
|
5472
5526
|
};
|
|
5473
|
-
let I =
|
|
5474
|
-
function
|
|
5527
|
+
let I = j;
|
|
5528
|
+
function kt(i) {
|
|
5475
5529
|
return new Promise((n) => setTimeout(n, i));
|
|
5476
5530
|
}
|
|
5477
|
-
function
|
|
5531
|
+
function Tt() {
|
|
5478
5532
|
return new Promise((i) => requestAnimationFrame(() => i()));
|
|
5479
5533
|
}
|
|
5480
|
-
function
|
|
5534
|
+
function Et() {
|
|
5481
5535
|
return new Promise((i) => setTimeout(i));
|
|
5482
5536
|
}
|
|
5483
|
-
function
|
|
5537
|
+
function Mt(i, n = "text/javascript") {
|
|
5484
5538
|
return new Promise((e, t) => {
|
|
5485
5539
|
const s = document.createElement("script");
|
|
5486
5540
|
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
5541
|
});
|
|
5488
5542
|
}
|
|
5489
|
-
function
|
|
5543
|
+
function Rt(...i) {
|
|
5490
5544
|
return new u(function* () {
|
|
5491
5545
|
for (const n of i)
|
|
5492
5546
|
for (const e of n)
|
|
5493
5547
|
yield e;
|
|
5494
5548
|
});
|
|
5495
5549
|
}
|
|
5496
|
-
function
|
|
5550
|
+
function Ft(i) {
|
|
5497
5551
|
if (i instanceof Array)
|
|
5498
5552
|
return i.length;
|
|
5499
5553
|
let n = 0;
|
|
@@ -5501,14 +5555,14 @@ function Et(i) {
|
|
|
5501
5555
|
n += 1;
|
|
5502
5556
|
return n;
|
|
5503
5557
|
}
|
|
5504
|
-
function
|
|
5558
|
+
function Pt(i) {
|
|
5505
5559
|
return new u(function* () {
|
|
5506
5560
|
let n = 0;
|
|
5507
5561
|
for (const e of i)
|
|
5508
5562
|
yield [n, e], n += 1;
|
|
5509
5563
|
});
|
|
5510
5564
|
}
|
|
5511
|
-
function
|
|
5565
|
+
function jt(i, n, e = 1) {
|
|
5512
5566
|
if (e <= 0)
|
|
5513
5567
|
throw new b(
|
|
5514
5568
|
"Step must be always a positive number, even when generating numbers in reverse order."
|
|
@@ -5521,7 +5575,7 @@ function Rt(i, n, e = 1) {
|
|
|
5521
5575
|
yield t;
|
|
5522
5576
|
});
|
|
5523
5577
|
}
|
|
5524
|
-
function
|
|
5578
|
+
function Ct(i) {
|
|
5525
5579
|
const n = Array.from(i);
|
|
5526
5580
|
for (let e = n.length - 1; e > 0; e -= 1) {
|
|
5527
5581
|
const t = Math.floor(Math.random() * (e + 1));
|
|
@@ -5529,14 +5583,14 @@ function Ft(i) {
|
|
|
5529
5583
|
}
|
|
5530
5584
|
return n;
|
|
5531
5585
|
}
|
|
5532
|
-
function
|
|
5586
|
+
function It(i) {
|
|
5533
5587
|
return new u(function* () {
|
|
5534
5588
|
const n = /* @__PURE__ */ new Set();
|
|
5535
5589
|
for (const e of i)
|
|
5536
5590
|
n.has(e) || (n.add(e), yield e);
|
|
5537
5591
|
});
|
|
5538
5592
|
}
|
|
5539
|
-
function
|
|
5593
|
+
function rt(i, n) {
|
|
5540
5594
|
const e = i[Symbol.iterator](), t = n[Symbol.iterator]();
|
|
5541
5595
|
return new u(function* () {
|
|
5542
5596
|
for (; ; ) {
|
|
@@ -5547,28 +5601,28 @@ function tt(i, n) {
|
|
|
5547
5601
|
}
|
|
5548
5602
|
});
|
|
5549
5603
|
}
|
|
5550
|
-
function
|
|
5604
|
+
function At(i, n) {
|
|
5551
5605
|
if (n === void 0) {
|
|
5552
5606
|
let r = 0, o = 0;
|
|
5553
5607
|
for (const l of i)
|
|
5554
5608
|
r += l, o += 1;
|
|
5555
5609
|
if (o === 0)
|
|
5556
|
-
throw new
|
|
5610
|
+
throw new f("You must provide at least one value.");
|
|
5557
5611
|
return r / o;
|
|
5558
5612
|
}
|
|
5559
5613
|
let e = 0, t = 0, s = 0;
|
|
5560
|
-
for (const [r, o] of
|
|
5614
|
+
for (const [r, o] of rt(i, n)) {
|
|
5561
5615
|
if (o <= 0)
|
|
5562
|
-
throw new
|
|
5616
|
+
throw new f(`The weight for the value #${s} must be greater than zero.`);
|
|
5563
5617
|
e += r * o, t += o, s += 1;
|
|
5564
5618
|
}
|
|
5565
5619
|
if (s === 0)
|
|
5566
|
-
throw new
|
|
5620
|
+
throw new f("You must provide at least one value and weight.");
|
|
5567
5621
|
if (t <= 0)
|
|
5568
|
-
throw new
|
|
5622
|
+
throw new f("The sum of weights must be greater than zero.");
|
|
5569
5623
|
return e / t;
|
|
5570
5624
|
}
|
|
5571
|
-
function
|
|
5625
|
+
function Nt(i) {
|
|
5572
5626
|
let n = 0;
|
|
5573
5627
|
for (let e = 0; e < i.length; e += 1) {
|
|
5574
5628
|
const t = i.charCodeAt(e);
|
|
@@ -5576,76 +5630,77 @@ function jt(i) {
|
|
|
5576
5630
|
}
|
|
5577
5631
|
return n;
|
|
5578
5632
|
}
|
|
5579
|
-
function
|
|
5633
|
+
function Ot(i) {
|
|
5580
5634
|
let n = 0;
|
|
5581
5635
|
for (const e of i)
|
|
5582
5636
|
n += e;
|
|
5583
5637
|
return n;
|
|
5584
5638
|
}
|
|
5585
|
-
function
|
|
5639
|
+
function qt(i) {
|
|
5586
5640
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
5587
5641
|
}
|
|
5588
|
-
const
|
|
5642
|
+
const $t = "2.1.5";
|
|
5589
5643
|
export {
|
|
5590
5644
|
M as AggregatedAsyncIterator,
|
|
5591
5645
|
x as AggregatedIterator,
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5646
|
+
Ue as CallableObject,
|
|
5647
|
+
xt as Clock,
|
|
5648
|
+
vt as Countdown,
|
|
5649
|
+
St as Curve,
|
|
5650
|
+
Ve as DeferredPromise,
|
|
5651
|
+
Xe as EnvironmentException,
|
|
5598
5652
|
c as Exception,
|
|
5599
5653
|
g as FatalErrorException,
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5654
|
+
Le as FileException,
|
|
5655
|
+
lt as FileExistsException,
|
|
5656
|
+
ut as FileNotFoundException,
|
|
5657
|
+
Ge as GameLoop,
|
|
5658
|
+
pt as JSONStorage,
|
|
5605
5659
|
_ as KeyException,
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5660
|
+
wt as MapView,
|
|
5661
|
+
ct as NetworkException,
|
|
5662
|
+
He as NotImplementedException,
|
|
5663
|
+
ht as PermissionException,
|
|
5664
|
+
_t as PromiseQueue,
|
|
5610
5665
|
v as Publisher,
|
|
5611
5666
|
I as Random,
|
|
5612
5667
|
b as RangeException,
|
|
5613
5668
|
h as ReducedIterator,
|
|
5614
5669
|
E as ReferenceException,
|
|
5615
5670
|
p as RuntimeException,
|
|
5616
|
-
|
|
5617
|
-
|
|
5671
|
+
mt as SetView,
|
|
5672
|
+
d as SmartAsyncIterator,
|
|
5618
5673
|
u as SmartIterator,
|
|
5619
|
-
|
|
5620
|
-
|
|
5674
|
+
S as SmartPromise,
|
|
5675
|
+
dt as SwitchableCallback,
|
|
5621
5676
|
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
|
-
|
|
5677
|
+
tt as TimedPromise,
|
|
5678
|
+
Ze as TimeoutException,
|
|
5679
|
+
ft as TypeException,
|
|
5680
|
+
$t as VERSION,
|
|
5681
|
+
f as ValueException,
|
|
5682
|
+
nt as WeekDay,
|
|
5683
|
+
At as average,
|
|
5684
|
+
qt as capitalize,
|
|
5685
|
+
Rt as chain,
|
|
5686
|
+
Ft as count,
|
|
5687
|
+
yt as dateDifference,
|
|
5688
|
+
bt as dateRange,
|
|
5689
|
+
st as dateRound,
|
|
5690
|
+
kt as delay,
|
|
5691
|
+
Pt as enumerate,
|
|
5692
|
+
gt as getWeek,
|
|
5693
|
+
Nt as hash,
|
|
5694
|
+
Ye as isBrowser,
|
|
5695
|
+
ot as isNode,
|
|
5696
|
+
at as isWorker,
|
|
5697
|
+
Mt as loadScript,
|
|
5698
|
+
Tt as nextAnimationFrame,
|
|
5699
|
+
jt as range,
|
|
5700
|
+
Ct as shuffle,
|
|
5701
|
+
Ot as sum,
|
|
5702
|
+
It as unique,
|
|
5703
|
+
Et as yieldToEventLoop,
|
|
5704
|
+
rt as zip
|
|
5650
5705
|
};
|
|
5651
5706
|
//# sourceMappingURL=core.esm.js.map
|