@byloth/core 1.5.0-rc.2 → 1.5.0-rc.4
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 +183 -216
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/models/exceptions/index.ts +9 -0
- package/src/models/index.ts +1 -1
- package/src/models/promises/deferred-promise.ts +14 -90
- package/src/models/promises/smart-promise.ts +14 -15
- package/src/models/promises/timed-promise.ts +22 -64
- package/src/utils/math.ts +11 -3
package/dist/core.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var p = (s, e, t) => e in s ? g(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => (p(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class l {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
u(this, "_iterator");
|
|
7
|
+
u(this, "return");
|
|
8
|
+
u(this, "throw");
|
|
9
9
|
e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
|
|
10
10
|
}
|
|
11
11
|
every(e) {
|
|
@@ -32,7 +32,7 @@ class u {
|
|
|
32
32
|
}
|
|
33
33
|
filter(e) {
|
|
34
34
|
const t = this._iterator;
|
|
35
|
-
return new
|
|
35
|
+
return new l(function* () {
|
|
36
36
|
let n = 0;
|
|
37
37
|
for (; ; ) {
|
|
38
38
|
const r = t.next();
|
|
@@ -44,7 +44,7 @@ class u {
|
|
|
44
44
|
}
|
|
45
45
|
map(e) {
|
|
46
46
|
const t = this._iterator;
|
|
47
|
-
return new
|
|
47
|
+
return new l(function* () {
|
|
48
48
|
let n = 0;
|
|
49
49
|
for (; ; ) {
|
|
50
50
|
const r = t.next();
|
|
@@ -57,16 +57,16 @@ class u {
|
|
|
57
57
|
reduce(e, t) {
|
|
58
58
|
let n = 0, r = t;
|
|
59
59
|
if (r === void 0) {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
60
|
+
const o = this._iterator.next();
|
|
61
|
+
if (o.done)
|
|
62
62
|
throw new TypeError("Reduce of empty iterator with no initial value");
|
|
63
|
-
r =
|
|
63
|
+
r = o.value, n += 1;
|
|
64
64
|
}
|
|
65
65
|
for (; ; ) {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
66
|
+
const o = this._iterator.next();
|
|
67
|
+
if (o.done)
|
|
68
68
|
return r;
|
|
69
|
-
r = e(r,
|
|
69
|
+
r = e(r, o.value, n), n += 1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
enumerate() {
|
|
@@ -74,7 +74,7 @@ class u {
|
|
|
74
74
|
}
|
|
75
75
|
unique() {
|
|
76
76
|
const e = this._iterator;
|
|
77
|
-
return new
|
|
77
|
+
return new l(function* () {
|
|
78
78
|
const t = /* @__PURE__ */ new Set();
|
|
79
79
|
for (; ; ) {
|
|
80
80
|
const n = e.next();
|
|
@@ -114,28 +114,28 @@ class u {
|
|
|
114
114
|
return this;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
class
|
|
117
|
+
class c {
|
|
118
118
|
constructor(e) {
|
|
119
|
-
|
|
120
|
-
this._elements = new
|
|
119
|
+
u(this, "_elements");
|
|
120
|
+
this._elements = new l(e);
|
|
121
121
|
}
|
|
122
122
|
filter(e) {
|
|
123
123
|
const t = this._elements;
|
|
124
|
-
return new
|
|
125
|
-
for (const [n, [r,
|
|
126
|
-
e(r,
|
|
124
|
+
return new c(function* () {
|
|
125
|
+
for (const [n, [r, o]] of t.enumerate())
|
|
126
|
+
e(r, o, n) && (yield [r, o]);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
map(e) {
|
|
130
130
|
const t = this._elements;
|
|
131
|
-
return new
|
|
132
|
-
for (const [n, [r,
|
|
133
|
-
yield [r, e(r,
|
|
131
|
+
return new c(function* () {
|
|
132
|
+
for (const [n, [r, o]] of t.enumerate())
|
|
133
|
+
yield [r, e(r, o, n)];
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
keys() {
|
|
137
137
|
const e = this._elements;
|
|
138
|
-
return new
|
|
138
|
+
return new l(function* () {
|
|
139
139
|
for (const [t] of e)
|
|
140
140
|
yield t;
|
|
141
141
|
});
|
|
@@ -145,7 +145,7 @@ class h {
|
|
|
145
145
|
}
|
|
146
146
|
values() {
|
|
147
147
|
const e = this._elements;
|
|
148
|
-
return new
|
|
148
|
+
return new l(function* () {
|
|
149
149
|
for (const [t, n] of e)
|
|
150
150
|
yield n;
|
|
151
151
|
});
|
|
@@ -163,79 +163,79 @@ class h {
|
|
|
163
163
|
return "ReducedIterator";
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
class
|
|
166
|
+
class h {
|
|
167
167
|
constructor(e) {
|
|
168
|
-
|
|
169
|
-
this._elements = new
|
|
168
|
+
u(this, "_elements");
|
|
169
|
+
this._elements = new l(e);
|
|
170
170
|
}
|
|
171
171
|
every(e) {
|
|
172
172
|
const t = /* @__PURE__ */ new Map();
|
|
173
173
|
for (const [n, r] of this._elements) {
|
|
174
|
-
const [
|
|
175
|
-
|
|
174
|
+
const [o, i] = t.get(n) ?? [0, !0];
|
|
175
|
+
i && t.set(n, [o + 1, e(n, r, o)]);
|
|
176
176
|
}
|
|
177
|
-
return new
|
|
178
|
-
for (const [n, [r,
|
|
179
|
-
yield [n,
|
|
177
|
+
return new c(function* () {
|
|
178
|
+
for (const [n, [r, o]] of t)
|
|
179
|
+
yield [n, o];
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
some(e) {
|
|
183
183
|
const t = /* @__PURE__ */ new Map();
|
|
184
184
|
for (const [n, r] of this._elements) {
|
|
185
|
-
const [
|
|
186
|
-
|
|
185
|
+
const [o, i] = t.get(n) ?? [0, !1];
|
|
186
|
+
i || t.set(n, [o + 1, e(n, r, o)]);
|
|
187
187
|
}
|
|
188
|
-
return new
|
|
189
|
-
for (const [n, [r,
|
|
190
|
-
yield [n,
|
|
188
|
+
return new c(function* () {
|
|
189
|
+
for (const [n, [r, o]] of t)
|
|
190
|
+
yield [n, o];
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
filter(e) {
|
|
194
194
|
const t = this._elements;
|
|
195
|
-
return new
|
|
195
|
+
return new h(function* () {
|
|
196
196
|
const n = /* @__PURE__ */ new Map();
|
|
197
|
-
for (const [r,
|
|
198
|
-
const
|
|
199
|
-
n.set(r,
|
|
197
|
+
for (const [r, o] of t) {
|
|
198
|
+
const i = n.get(r) ?? 0;
|
|
199
|
+
n.set(r, i + 1), e(r, o, i) && (yield [r, o]);
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
map(e) {
|
|
204
204
|
const t = this._elements;
|
|
205
|
-
return new
|
|
205
|
+
return new h(function* () {
|
|
206
206
|
const n = /* @__PURE__ */ new Map();
|
|
207
|
-
for (const [r,
|
|
208
|
-
const
|
|
209
|
-
n.set(r,
|
|
207
|
+
for (const [r, o] of t) {
|
|
208
|
+
const i = n.get(r) ?? 0;
|
|
209
|
+
n.set(r, i + 1), yield [r, e(r, o, i)];
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
reduce(e, t) {
|
|
214
214
|
const n = /* @__PURE__ */ new Map();
|
|
215
|
-
for (const [r,
|
|
216
|
-
let
|
|
215
|
+
for (const [r, o] of this._elements) {
|
|
216
|
+
let i, a;
|
|
217
217
|
if (n.has(r))
|
|
218
|
-
[
|
|
218
|
+
[i, a] = n.get(r), i += 1;
|
|
219
219
|
else if (t !== void 0)
|
|
220
|
-
|
|
220
|
+
i = 0, a = t(r);
|
|
221
221
|
else {
|
|
222
|
-
n.set(r, [0,
|
|
222
|
+
n.set(r, [0, o]);
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
a = e(r, a, o, i), n.set(r, [i, a]);
|
|
226
226
|
}
|
|
227
|
-
return new
|
|
228
|
-
for (const [r, [
|
|
229
|
-
yield [r,
|
|
227
|
+
return new c(function* () {
|
|
228
|
+
for (const [r, [o, i]] of n)
|
|
229
|
+
yield [r, i];
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
unique() {
|
|
233
233
|
const e = this._elements;
|
|
234
|
-
return new
|
|
234
|
+
return new h(function* () {
|
|
235
235
|
const t = /* @__PURE__ */ new Map();
|
|
236
236
|
for (const [n, r] of e) {
|
|
237
|
-
const
|
|
238
|
-
|
|
237
|
+
const o = t.get(n) ?? /* @__PURE__ */ new Set();
|
|
238
|
+
o.has(r) || (o.add(r), t.set(n, o), yield [n, r]);
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
}
|
|
@@ -245,7 +245,7 @@ class d {
|
|
|
245
245
|
const n = e.get(t) ?? 0;
|
|
246
246
|
e.set(t, n + 1);
|
|
247
247
|
}
|
|
248
|
-
return new
|
|
248
|
+
return new c(function* () {
|
|
249
249
|
for (const [t, n] of e)
|
|
250
250
|
yield [t, n];
|
|
251
251
|
});
|
|
@@ -254,7 +254,7 @@ class d {
|
|
|
254
254
|
const e = /* @__PURE__ */ new Map();
|
|
255
255
|
for (const [t, n] of this._elements)
|
|
256
256
|
e.has(t) || e.set(t, n);
|
|
257
|
-
return new
|
|
257
|
+
return new c(function* () {
|
|
258
258
|
for (const [t, n] of e)
|
|
259
259
|
yield [t, n];
|
|
260
260
|
});
|
|
@@ -263,14 +263,14 @@ class d {
|
|
|
263
263
|
const e = /* @__PURE__ */ new Map();
|
|
264
264
|
for (const [t, n] of this._elements)
|
|
265
265
|
e.set(t, n);
|
|
266
|
-
return new
|
|
266
|
+
return new c(function* () {
|
|
267
267
|
for (const [t, n] of e)
|
|
268
268
|
yield [t, n];
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
keys() {
|
|
272
272
|
const e = this._elements;
|
|
273
|
-
return new
|
|
273
|
+
return new l(function* () {
|
|
274
274
|
for (const [t] of e)
|
|
275
275
|
yield t;
|
|
276
276
|
});
|
|
@@ -280,7 +280,7 @@ class d {
|
|
|
280
280
|
}
|
|
281
281
|
values() {
|
|
282
282
|
const e = this._elements;
|
|
283
|
-
return new
|
|
283
|
+
return new l(function* () {
|
|
284
284
|
for (const [t, n] of e)
|
|
285
285
|
yield n;
|
|
286
286
|
});
|
|
@@ -310,8 +310,8 @@ class d {
|
|
|
310
310
|
}
|
|
311
311
|
class m {
|
|
312
312
|
constructor(e) {
|
|
313
|
-
|
|
314
|
-
this._elements = new
|
|
313
|
+
u(this, "_elements");
|
|
314
|
+
this._elements = new l(e);
|
|
315
315
|
}
|
|
316
316
|
filter(e) {
|
|
317
317
|
return new m(this._elements.filter(e));
|
|
@@ -323,7 +323,7 @@ class m {
|
|
|
323
323
|
return new m(this._elements.unique());
|
|
324
324
|
}
|
|
325
325
|
groupBy(e) {
|
|
326
|
-
return new
|
|
326
|
+
return new h(this._elements.map((t, n) => [e(t, n), t]));
|
|
327
327
|
}
|
|
328
328
|
get [Symbol.toStringTag]() {
|
|
329
329
|
return "Aggregator";
|
|
@@ -350,7 +350,7 @@ Caused by ${t}`);
|
|
|
350
350
|
return "Exception";
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
class
|
|
353
|
+
class v extends f {
|
|
354
354
|
constructor(e, t, n = "ReferenceException") {
|
|
355
355
|
super(e, t, n);
|
|
356
356
|
}
|
|
@@ -358,7 +358,7 @@ class y extends f {
|
|
|
358
358
|
return "ReferenceException";
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class x extends f {
|
|
362
362
|
constructor(e, t, n = "TimeoutException") {
|
|
363
363
|
super(e, t, n);
|
|
364
364
|
}
|
|
@@ -366,11 +366,19 @@ class w extends f {
|
|
|
366
366
|
return "TimeoutException";
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
class
|
|
369
|
+
class _ extends f {
|
|
370
|
+
constructor(e, t, n = "ValueException") {
|
|
371
|
+
super(e, t, n);
|
|
372
|
+
}
|
|
373
|
+
get [Symbol.toStringTag]() {
|
|
374
|
+
return "ValueException";
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class T {
|
|
370
378
|
constructor(e = !0) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
379
|
+
u(this, "_preferPersistence");
|
|
380
|
+
u(this, "_volatile");
|
|
381
|
+
u(this, "_persistent");
|
|
374
382
|
this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
375
383
|
}
|
|
376
384
|
_get(e, t, n) {
|
|
@@ -504,9 +512,9 @@ class b {
|
|
|
504
512
|
return "JsonStorage";
|
|
505
513
|
}
|
|
506
514
|
}
|
|
507
|
-
class
|
|
515
|
+
class M {
|
|
508
516
|
constructor() {
|
|
509
|
-
|
|
517
|
+
u(this, "_subscribers");
|
|
510
518
|
this._subscribers = [];
|
|
511
519
|
}
|
|
512
520
|
add(e) {
|
|
@@ -515,7 +523,7 @@ class S {
|
|
|
515
523
|
remove(e) {
|
|
516
524
|
const t = this._subscribers.indexOf(e);
|
|
517
525
|
if (t < 0)
|
|
518
|
-
throw new
|
|
526
|
+
throw new v("Unable to remove the requested subscriber. It was not found.");
|
|
519
527
|
this._subscribers.splice(t, 1);
|
|
520
528
|
}
|
|
521
529
|
call(...e) {
|
|
@@ -525,61 +533,12 @@ class S {
|
|
|
525
533
|
return "Subscribers";
|
|
526
534
|
}
|
|
527
535
|
}
|
|
528
|
-
class
|
|
529
|
-
constructor(e, t) {
|
|
530
|
-
o(this, "_isPending");
|
|
531
|
-
o(this, "_isFulfilled");
|
|
532
|
-
o(this, "_isRejected");
|
|
533
|
-
o(this, "_resolve");
|
|
534
|
-
o(this, "_reject");
|
|
535
|
-
o(this, "_promise");
|
|
536
|
-
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
537
|
-
let n;
|
|
538
|
-
e ? n = (a) => (this._isPending = !1, this._isFulfilled = !0, e(a)) : n = (a) => (this._isPending = !1, this._isFulfilled = !0, a);
|
|
539
|
-
let r;
|
|
540
|
-
t ? r = (a) => (this._isPending = !1, this._isRejected = !0, t(a)) : r = (a) => {
|
|
541
|
-
throw this._isPending = !1, this._isRejected = !0, a;
|
|
542
|
-
};
|
|
543
|
-
const { promise: i, resolve: l, reject: c } = Promise.withResolvers();
|
|
544
|
-
this._promise = i.then(n, r), this._resolve = l, this._reject = c;
|
|
545
|
-
}
|
|
546
|
-
get isPending() {
|
|
547
|
-
return this._isPending;
|
|
548
|
-
}
|
|
549
|
-
get isFulfilled() {
|
|
550
|
-
return this._isFulfilled;
|
|
551
|
-
}
|
|
552
|
-
get isRejected() {
|
|
553
|
-
return this._isRejected;
|
|
554
|
-
}
|
|
555
|
-
get resolve() {
|
|
556
|
-
return this._resolve;
|
|
557
|
-
}
|
|
558
|
-
get reject() {
|
|
559
|
-
return this._reject;
|
|
560
|
-
}
|
|
561
|
-
then(e, t) {
|
|
562
|
-
return this._promise.then(e, t);
|
|
563
|
-
}
|
|
564
|
-
catch(e) {
|
|
565
|
-
return this._promise.catch(e);
|
|
566
|
-
}
|
|
567
|
-
finally(e) {
|
|
568
|
-
return this._promise.finally(e);
|
|
569
|
-
}
|
|
570
|
-
watch(e) {
|
|
571
|
-
return e.then(this.resolve, this.reject), this;
|
|
572
|
-
}
|
|
573
|
-
get [Symbol.toStringTag]() {
|
|
574
|
-
return "DeferredPromise";
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
class k {
|
|
536
|
+
class w {
|
|
578
537
|
constructor(e) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
538
|
+
u(this, "_isPending");
|
|
539
|
+
u(this, "_isFulfilled");
|
|
540
|
+
u(this, "_isRejected");
|
|
541
|
+
u(this, "_promise");
|
|
583
542
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
584
543
|
const t = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
|
|
585
544
|
throw this._isPending = !1, this._isRejected = !0, r;
|
|
@@ -608,43 +567,44 @@ class k {
|
|
|
608
567
|
return "SmartPromise";
|
|
609
568
|
}
|
|
610
569
|
}
|
|
611
|
-
class
|
|
612
|
-
constructor(
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
this
|
|
618
|
-
|
|
619
|
-
throw this._isPending = !1, this._isRejected = !0, c;
|
|
620
|
-
}, i = new Promise(e), l = new Promise((c, a) => setTimeout(() => {
|
|
621
|
-
a(new w("The operation has timed out."));
|
|
622
|
-
}, t));
|
|
623
|
-
this._promise = Promise.race([i, l]).then(n, r);
|
|
624
|
-
}
|
|
625
|
-
get isPending() {
|
|
626
|
-
return this._isPending;
|
|
570
|
+
class P extends w {
|
|
571
|
+
constructor(t, n) {
|
|
572
|
+
super((r, o) => {
|
|
573
|
+
this._resolve = r, this._reject = o;
|
|
574
|
+
});
|
|
575
|
+
u(this, "_resolve");
|
|
576
|
+
u(this, "_reject");
|
|
577
|
+
this._promise.then(t, n);
|
|
627
578
|
}
|
|
628
|
-
get
|
|
629
|
-
return this.
|
|
579
|
+
get resolve() {
|
|
580
|
+
return this._resolve;
|
|
630
581
|
}
|
|
631
|
-
get
|
|
632
|
-
return this.
|
|
582
|
+
get reject() {
|
|
583
|
+
return this._reject;
|
|
633
584
|
}
|
|
634
|
-
|
|
635
|
-
return
|
|
585
|
+
watch(t) {
|
|
586
|
+
return t.then(this.resolve, this.reject), this;
|
|
636
587
|
}
|
|
637
|
-
|
|
638
|
-
return
|
|
588
|
+
get [Symbol.toStringTag]() {
|
|
589
|
+
return "DeferredPromise";
|
|
639
590
|
}
|
|
640
|
-
|
|
641
|
-
|
|
591
|
+
}
|
|
592
|
+
class j extends w {
|
|
593
|
+
constructor(e, t) {
|
|
594
|
+
super((n, r) => {
|
|
595
|
+
const o = (d) => {
|
|
596
|
+
clearTimeout(y), n(d);
|
|
597
|
+
}, i = (d) => {
|
|
598
|
+
clearTimeout(y), r(d);
|
|
599
|
+
}, y = setTimeout(() => i(new x("The operation has timed out.")), t);
|
|
600
|
+
e(o, i);
|
|
601
|
+
});
|
|
642
602
|
}
|
|
643
603
|
get [Symbol.toStringTag]() {
|
|
644
604
|
return "TimedPromise";
|
|
645
605
|
}
|
|
646
606
|
}
|
|
647
|
-
class
|
|
607
|
+
class E {
|
|
648
608
|
static Boolean(e = 0.5) {
|
|
649
609
|
return Math.random() < e;
|
|
650
610
|
}
|
|
@@ -661,34 +621,34 @@ class M {
|
|
|
661
621
|
constructor() {
|
|
662
622
|
}
|
|
663
623
|
}
|
|
664
|
-
async function
|
|
624
|
+
async function I(s) {
|
|
665
625
|
return new Promise((e, t) => setTimeout(e, s));
|
|
666
626
|
}
|
|
667
|
-
async function
|
|
627
|
+
async function R() {
|
|
668
628
|
return new Promise((s, e) => requestAnimationFrame(() => s()));
|
|
669
629
|
}
|
|
670
|
-
var
|
|
671
|
-
function
|
|
630
|
+
var b = /* @__PURE__ */ ((s) => (s[s.Second = 1e3] = "Second", s[s.Minute = 6e4] = "Minute", s[s.Hour = 36e5] = "Hour", s[s.Day = 864e5] = "Day", s[s.Week = 6048e5] = "Week", s[s.Month = 2592e6] = "Month", s[s.Year = 31536e6] = "Year", s))(b || {});
|
|
631
|
+
function A(s, e, t = 864e5) {
|
|
672
632
|
return Math.floor((e.getTime() - s.getTime()) / t);
|
|
673
633
|
}
|
|
674
|
-
function
|
|
675
|
-
return new
|
|
634
|
+
function F(s, e, t = 864e5) {
|
|
635
|
+
return new l(function* () {
|
|
676
636
|
const n = e.getTime();
|
|
677
637
|
let r = s.getTime();
|
|
678
638
|
for (; r < n; )
|
|
679
639
|
yield new Date(r), r += t;
|
|
680
640
|
});
|
|
681
641
|
}
|
|
682
|
-
function
|
|
642
|
+
function q(s, e = 864e5) {
|
|
683
643
|
return new Date(Math.floor(s.getTime() / e) * e);
|
|
684
644
|
}
|
|
685
|
-
async function
|
|
645
|
+
async function C(s, e = "text/javascript") {
|
|
686
646
|
return new Promise((t, n) => {
|
|
687
647
|
const r = document.createElement("script");
|
|
688
648
|
r.async = !0, r.defer = !0, r.src = s, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
|
|
689
649
|
});
|
|
690
650
|
}
|
|
691
|
-
function
|
|
651
|
+
function O(s) {
|
|
692
652
|
if (Array.isArray(s))
|
|
693
653
|
return s.length;
|
|
694
654
|
let e = 0;
|
|
@@ -696,14 +656,14 @@ function q(s) {
|
|
|
696
656
|
e += 1;
|
|
697
657
|
return e;
|
|
698
658
|
}
|
|
699
|
-
function
|
|
700
|
-
return new
|
|
659
|
+
function $(s, e, t = 1) {
|
|
660
|
+
return new l(function* () {
|
|
701
661
|
e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
|
|
702
662
|
for (let n = s; n < e; n += t)
|
|
703
663
|
yield n;
|
|
704
664
|
});
|
|
705
665
|
}
|
|
706
|
-
function
|
|
666
|
+
function V(s) {
|
|
707
667
|
const e = Array.from(s);
|
|
708
668
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
709
669
|
const n = Math.floor(Math.random() * (t + 1));
|
|
@@ -711,37 +671,43 @@ function O(s) {
|
|
|
711
671
|
}
|
|
712
672
|
return e;
|
|
713
673
|
}
|
|
714
|
-
function
|
|
715
|
-
return new
|
|
674
|
+
function J(s) {
|
|
675
|
+
return new l(function* () {
|
|
716
676
|
const e = /* @__PURE__ */ new Set();
|
|
717
677
|
for (const t of s)
|
|
718
678
|
e.has(t) || (e.add(t), yield t);
|
|
719
679
|
});
|
|
720
680
|
}
|
|
721
|
-
function
|
|
722
|
-
return new
|
|
681
|
+
function S(s, e) {
|
|
682
|
+
return new l(function* () {
|
|
723
683
|
const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
724
684
|
for (; ; ) {
|
|
725
|
-
const r = t.next(),
|
|
726
|
-
if (r.done ||
|
|
685
|
+
const r = t.next(), o = n.next();
|
|
686
|
+
if (r.done || o.done)
|
|
727
687
|
break;
|
|
728
|
-
yield [r.value,
|
|
688
|
+
yield [r.value, o.value];
|
|
729
689
|
}
|
|
730
690
|
});
|
|
731
691
|
}
|
|
732
|
-
function
|
|
692
|
+
function Y(s, e) {
|
|
733
693
|
if (e === void 0) {
|
|
734
|
-
let
|
|
735
|
-
for (const
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
694
|
+
let o = 0, i = 0;
|
|
695
|
+
for (const a of s)
|
|
696
|
+
o += a, i += 1;
|
|
697
|
+
if (i === 0)
|
|
698
|
+
throw new _("You must provide at least one value.");
|
|
699
|
+
return o / i;
|
|
700
|
+
}
|
|
701
|
+
let t = 0, n = 0, r = 0;
|
|
702
|
+
for (const [o, i] of S(s, e))
|
|
703
|
+
t += o * i, n += i, r += 1;
|
|
704
|
+
if (r === 0)
|
|
705
|
+
throw new _("You must provide at least one value and weight.");
|
|
706
|
+
if (n === 0)
|
|
707
|
+
throw new _("The sum of weights must be greater than zero.");
|
|
742
708
|
return t / n;
|
|
743
709
|
}
|
|
744
|
-
function
|
|
710
|
+
function z(s) {
|
|
745
711
|
let e = 0;
|
|
746
712
|
for (let t = 0; t < s.length; t += 1) {
|
|
747
713
|
const n = s.charCodeAt(t);
|
|
@@ -749,46 +715,47 @@ function V(s) {
|
|
|
749
715
|
}
|
|
750
716
|
return e;
|
|
751
717
|
}
|
|
752
|
-
function
|
|
718
|
+
function B(s) {
|
|
753
719
|
let e = 0;
|
|
754
720
|
for (const t of s)
|
|
755
721
|
e += t;
|
|
756
722
|
return e;
|
|
757
723
|
}
|
|
758
|
-
function
|
|
724
|
+
function H(s) {
|
|
759
725
|
return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
|
|
760
726
|
}
|
|
761
|
-
const
|
|
727
|
+
const W = "1.5.0-rc.4";
|
|
762
728
|
export {
|
|
763
|
-
|
|
729
|
+
h as AggregatedIterator,
|
|
764
730
|
m as Aggregator,
|
|
765
|
-
|
|
731
|
+
b as DateUnit,
|
|
766
732
|
P as DeferredPromise,
|
|
767
733
|
f as Exception,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
734
|
+
T as JsonStorage,
|
|
735
|
+
E as Random,
|
|
736
|
+
c as ReducedIterator,
|
|
737
|
+
v as ReferenceException,
|
|
738
|
+
l as SmartIterator,
|
|
739
|
+
w as SmartPromise,
|
|
740
|
+
M as Subscribers,
|
|
775
741
|
j as TimedPromise,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
742
|
+
x as TimeoutException,
|
|
743
|
+
W as VERSION,
|
|
744
|
+
_ as ValueException,
|
|
745
|
+
Y as average,
|
|
746
|
+
H as capitalize,
|
|
747
|
+
O as count,
|
|
748
|
+
A as dateDifference,
|
|
749
|
+
F as dateRange,
|
|
750
|
+
q as dateRound,
|
|
751
|
+
I as delay,
|
|
752
|
+
z as hash,
|
|
753
|
+
C as loadScript,
|
|
754
|
+
R as nextAnimationFrame,
|
|
755
|
+
$ as range,
|
|
756
|
+
V as shuffle,
|
|
757
|
+
B as sum,
|
|
758
|
+
J as unique,
|
|
759
|
+
S as zip
|
|
793
760
|
};
|
|
794
761
|
//# sourceMappingURL=core.js.map
|