@byloth/core 1.2.0 → 1.3.0-rc.1
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 +408 -221
- 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 +4 -4
- package/src/index.ts +14 -3
- package/src/models/aggregators/_index.old.ts +384 -0
- package/src/models/aggregators/aggregated-iterator.ts +214 -0
- package/src/models/aggregators/index.ts +45 -0
- package/src/models/aggregators/reduced-iterator.ts +59 -0
- package/src/models/aggregators/types.ts +2 -0
- package/src/models/index.ts +14 -3
- package/src/models/smart-iterator.ts +56 -6
- package/src/utils/index.ts +5 -1
- package/src/utils/iterator.ts +19 -4
- package/src/utils/math.ts +3 -51
- package/src/utils/random.ts +39 -0
package/dist/core.js
CHANGED
|
@@ -1,15 +1,297 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var _ = (s, e, t) => e in s ? d(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => (_(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class h extends Error {
|
|
5
|
+
static FromUnknown(e) {
|
|
6
|
+
if (e instanceof h)
|
|
7
|
+
return e;
|
|
8
|
+
if (e instanceof Error) {
|
|
9
|
+
const t = new h(e.message);
|
|
10
|
+
return t.stack = e.stack, t.name = e.name, t;
|
|
11
|
+
}
|
|
12
|
+
return new h(`${e}`);
|
|
13
|
+
}
|
|
14
|
+
constructor(e, t, r = "Exception") {
|
|
15
|
+
super(e), this.cause = t, this.name = r, t && (t instanceof Error ? this.stack += `
|
|
16
|
+
|
|
17
|
+
Caused by ${t.stack}` : this.stack += `
|
|
18
|
+
|
|
19
|
+
Caused by ${t}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class c {
|
|
23
|
+
constructor(e) {
|
|
24
|
+
u(this, "_iterator");
|
|
25
|
+
u(this, "return");
|
|
26
|
+
u(this, "throw");
|
|
27
|
+
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));
|
|
28
|
+
}
|
|
29
|
+
every(e) {
|
|
30
|
+
let t = 0;
|
|
31
|
+
for (; ; ) {
|
|
32
|
+
const r = this._iterator.next();
|
|
33
|
+
if (r.done)
|
|
34
|
+
return !0;
|
|
35
|
+
if (!e(r.value, t))
|
|
36
|
+
return !1;
|
|
37
|
+
t += 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
some(e) {
|
|
41
|
+
let t = 0;
|
|
42
|
+
for (; ; ) {
|
|
43
|
+
const r = this._iterator.next();
|
|
44
|
+
if (r.done)
|
|
45
|
+
return !1;
|
|
46
|
+
if (e(r.value, t))
|
|
47
|
+
return !0;
|
|
48
|
+
t += 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
filter(e) {
|
|
52
|
+
const t = this._iterator;
|
|
53
|
+
return new c(function* () {
|
|
54
|
+
let r = 0;
|
|
55
|
+
for (; ; ) {
|
|
56
|
+
const n = t.next();
|
|
57
|
+
if (n.done)
|
|
58
|
+
return n.value;
|
|
59
|
+
e(n.value, r) && (yield n.value), r += 1;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
map(e) {
|
|
64
|
+
const t = this._iterator;
|
|
65
|
+
return new c(function* () {
|
|
66
|
+
let r = 0;
|
|
67
|
+
for (; ; ) {
|
|
68
|
+
const n = t.next();
|
|
69
|
+
if (n.done)
|
|
70
|
+
return n.value;
|
|
71
|
+
yield e(n.value, r), r += 1;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
reduce(e, t) {
|
|
76
|
+
let r = 0, n = t;
|
|
77
|
+
if (n === void 0) {
|
|
78
|
+
const o = this._iterator.next();
|
|
79
|
+
if (o.done)
|
|
80
|
+
throw new TypeError("Reduce of empty iterator with no initial value");
|
|
81
|
+
n = o.value, r += 1;
|
|
82
|
+
}
|
|
83
|
+
for (; ; ) {
|
|
84
|
+
const o = this._iterator.next();
|
|
85
|
+
if (o.done)
|
|
86
|
+
return n;
|
|
87
|
+
n = e(n, o.value, r), r += 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
enumerate() {
|
|
91
|
+
return this.map((e, t) => [t, e]);
|
|
92
|
+
}
|
|
93
|
+
unique() {
|
|
94
|
+
const e = this._iterator;
|
|
95
|
+
return new c(function* () {
|
|
96
|
+
const t = /* @__PURE__ */ new Set();
|
|
97
|
+
for (; ; ) {
|
|
98
|
+
const r = e.next();
|
|
99
|
+
if (r.done)
|
|
100
|
+
return r.value;
|
|
101
|
+
t.has(r.value) || (t.add(r.value), yield r.value);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
count() {
|
|
106
|
+
let e = 0;
|
|
107
|
+
for (; ; ) {
|
|
108
|
+
if (this._iterator.next().done)
|
|
109
|
+
return e;
|
|
110
|
+
e += 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
forEach(e) {
|
|
114
|
+
let t = 0;
|
|
115
|
+
for (; ; ) {
|
|
116
|
+
const r = this._iterator.next();
|
|
117
|
+
if (r.done)
|
|
118
|
+
return;
|
|
119
|
+
e(r.value, t), t += 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
next(...e) {
|
|
123
|
+
return this._iterator.next(...e);
|
|
124
|
+
}
|
|
125
|
+
toArray() {
|
|
126
|
+
return Array.from(this);
|
|
127
|
+
}
|
|
128
|
+
[Symbol.iterator]() {
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
class l {
|
|
133
|
+
constructor(e) {
|
|
134
|
+
u(this, "_elements");
|
|
135
|
+
this._elements = new c(e);
|
|
136
|
+
}
|
|
137
|
+
filter(e) {
|
|
138
|
+
const t = this._elements;
|
|
139
|
+
return new l(function* () {
|
|
140
|
+
for (const [r, [n, o]] of t.enumerate())
|
|
141
|
+
e(n, o, r) && (yield [n, o]);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
map(e) {
|
|
145
|
+
const t = this._elements;
|
|
146
|
+
return new l(function* () {
|
|
147
|
+
for (const [r, [n, o]] of t.enumerate())
|
|
148
|
+
yield [n, e(n, o, r)];
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
toArray() {
|
|
152
|
+
return Array.from(this.toMap().values());
|
|
153
|
+
}
|
|
154
|
+
toMap() {
|
|
155
|
+
return new Map(this._elements.toArray());
|
|
156
|
+
}
|
|
157
|
+
toObject() {
|
|
158
|
+
return Object.fromEntries(this._elements.toArray());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
class f {
|
|
162
|
+
constructor(e) {
|
|
163
|
+
u(this, "_elements");
|
|
164
|
+
this._elements = new c(e);
|
|
165
|
+
}
|
|
166
|
+
every(e) {
|
|
167
|
+
const t = /* @__PURE__ */ new Map();
|
|
168
|
+
for (const [r, n] of this._elements) {
|
|
169
|
+
const [o, i] = t.get(r) ?? [0, !0];
|
|
170
|
+
i && t.set(r, [o + 1, e(r, n, o)]);
|
|
171
|
+
}
|
|
172
|
+
return new l(function* () {
|
|
173
|
+
for (const [r, [n, o]] of t)
|
|
174
|
+
yield [r, o];
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
some(e) {
|
|
178
|
+
const t = /* @__PURE__ */ new Map();
|
|
179
|
+
for (const [r, n] of this._elements) {
|
|
180
|
+
const [o, i] = t.get(r) ?? [0, !1];
|
|
181
|
+
i || t.set(r, [o + 1, e(r, n, o)]);
|
|
182
|
+
}
|
|
183
|
+
return new l(function* () {
|
|
184
|
+
for (const [r, [n, o]] of t)
|
|
185
|
+
yield [r, o];
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
filter(e) {
|
|
189
|
+
const t = this._elements;
|
|
190
|
+
return new f(function* () {
|
|
191
|
+
const r = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const [n, o] of t) {
|
|
193
|
+
const i = r.get(n) ?? 0;
|
|
194
|
+
r.set(n, i + 1), e(n, o, i) && (yield [n, o]);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
map(e) {
|
|
199
|
+
const t = this._elements;
|
|
200
|
+
return new f(function* () {
|
|
201
|
+
const r = /* @__PURE__ */ new Map();
|
|
202
|
+
for (const [n, o] of t) {
|
|
203
|
+
const i = r.get(n) ?? 0;
|
|
204
|
+
r.set(n, i + 1), yield [n, e(n, o, i)];
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
reduce(e, t) {
|
|
209
|
+
const r = /* @__PURE__ */ new Map();
|
|
210
|
+
for (const [n, o] of this._elements) {
|
|
211
|
+
let i, a;
|
|
212
|
+
if (r.has(n))
|
|
213
|
+
[i, a] = r.get(n), i += 1;
|
|
214
|
+
else if (t !== void 0)
|
|
215
|
+
i = 0, a = t;
|
|
216
|
+
else {
|
|
217
|
+
r.set(n, [0, o]);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
a = e(n, a, o, i), r.set(n, [i, a]);
|
|
221
|
+
}
|
|
222
|
+
return new l(function* () {
|
|
223
|
+
for (const [n, [o, i]] of r)
|
|
224
|
+
yield [n, i];
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
unique() {
|
|
228
|
+
const e = this._elements;
|
|
229
|
+
return new f(function* () {
|
|
230
|
+
const t = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const [r, n] of e) {
|
|
232
|
+
const o = t.get(r) ?? /* @__PURE__ */ new Set();
|
|
233
|
+
o.has(n) || (o.add(n), t.set(r, o), yield [r, n]);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
count() {
|
|
238
|
+
const e = /* @__PURE__ */ new Map();
|
|
239
|
+
for (const [t] of this._elements) {
|
|
240
|
+
const r = e.get(t) ?? 0;
|
|
241
|
+
e.set(t, r + 1);
|
|
242
|
+
}
|
|
243
|
+
return new l(function* () {
|
|
244
|
+
for (const [t, r] of e)
|
|
245
|
+
yield [t, r];
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
toArray() {
|
|
249
|
+
return Array.from(this.toMap().values());
|
|
250
|
+
}
|
|
251
|
+
toMap() {
|
|
252
|
+
const e = /* @__PURE__ */ new Map();
|
|
253
|
+
for (const [t, r] of this._elements) {
|
|
254
|
+
const n = e.get(t) ?? [];
|
|
255
|
+
n.push(r), e.set(t, n);
|
|
256
|
+
}
|
|
257
|
+
return e;
|
|
258
|
+
}
|
|
259
|
+
toObject() {
|
|
260
|
+
const e = {};
|
|
261
|
+
for (const [t, r] of this._elements) {
|
|
262
|
+
const n = e[t] ?? [];
|
|
263
|
+
n.push(r), e[t] = n;
|
|
264
|
+
}
|
|
265
|
+
return e;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
class m {
|
|
269
|
+
constructor(e) {
|
|
270
|
+
u(this, "_elements");
|
|
271
|
+
this._elements = new c(e);
|
|
272
|
+
}
|
|
273
|
+
filter(e) {
|
|
274
|
+
return new m(this._elements.filter(e));
|
|
275
|
+
}
|
|
276
|
+
map(e) {
|
|
277
|
+
return new m(this._elements.map(e));
|
|
278
|
+
}
|
|
279
|
+
unique() {
|
|
280
|
+
return new m(this._elements.unique());
|
|
281
|
+
}
|
|
282
|
+
byKey(e) {
|
|
283
|
+
return new f(this._elements.map((t, r) => [e(t, r), t]));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
class p {
|
|
5
287
|
constructor(e, t) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
this._promise = new Promise((
|
|
11
|
-
|
|
12
|
-
}).then(e, t), this._resolve =
|
|
288
|
+
u(this, "_resolve");
|
|
289
|
+
u(this, "_reject");
|
|
290
|
+
u(this, "_promise");
|
|
291
|
+
let r, n;
|
|
292
|
+
this._promise = new Promise((o, i) => {
|
|
293
|
+
r = o, n = i;
|
|
294
|
+
}).then(e, t), this._resolve = r, this._reject = n;
|
|
13
295
|
}
|
|
14
296
|
get resolve() {
|
|
15
297
|
return this._resolve;
|
|
@@ -33,32 +315,14 @@ class v {
|
|
|
33
315
|
return "DeferredPromise";
|
|
34
316
|
}
|
|
35
317
|
}
|
|
36
|
-
class
|
|
37
|
-
static FromUnknown(e) {
|
|
38
|
-
if (e instanceof l)
|
|
39
|
-
return e;
|
|
40
|
-
if (e instanceof Error) {
|
|
41
|
-
const t = new l(e.message);
|
|
42
|
-
return t.stack = e.stack, t.name = e.name, t;
|
|
43
|
-
}
|
|
44
|
-
return new l(`${e}`);
|
|
45
|
-
}
|
|
46
|
-
constructor(e, t, s = "Exception") {
|
|
47
|
-
super(e), this.cause = t, this.name = s, t && (t instanceof Error ? this.stack += `
|
|
48
|
-
|
|
49
|
-
Caused by ${t.stack}` : this.stack += `
|
|
50
|
-
|
|
51
|
-
Caused by ${t}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
class m {
|
|
318
|
+
class x {
|
|
55
319
|
constructor(e = !0) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
320
|
+
u(this, "_preferPersistence");
|
|
321
|
+
u(this, "_volatile");
|
|
322
|
+
u(this, "_persistent");
|
|
59
323
|
this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
60
324
|
}
|
|
61
|
-
_get(e, t,
|
|
325
|
+
_get(e, t, r) {
|
|
62
326
|
const n = e.getItem(t);
|
|
63
327
|
if (n)
|
|
64
328
|
try {
|
|
@@ -68,14 +332,14 @@ class m {
|
|
|
68
332
|
`The "${n}" value for "${t}" property cannot be parsed. Clearing the storage...`
|
|
69
333
|
), e.removeItem(t);
|
|
70
334
|
}
|
|
71
|
-
return
|
|
335
|
+
return r;
|
|
72
336
|
}
|
|
73
|
-
_set(e, t,
|
|
74
|
-
const n = JSON.stringify(
|
|
337
|
+
_set(e, t, r) {
|
|
338
|
+
const n = JSON.stringify(r);
|
|
75
339
|
n ? e.setItem(t, n) : e.removeItem(t);
|
|
76
340
|
}
|
|
77
|
-
get(e, t,
|
|
78
|
-
const n =
|
|
341
|
+
get(e, t, r = this._preferPersistence) {
|
|
342
|
+
const n = r ? this._persistent : this._volatile;
|
|
79
343
|
return this._get(n, e, t);
|
|
80
344
|
}
|
|
81
345
|
recall(e, t) {
|
|
@@ -137,8 +401,8 @@ class m {
|
|
|
137
401
|
* @param newValue The new value to set.
|
|
138
402
|
* @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
|
|
139
403
|
*/
|
|
140
|
-
set(e, t,
|
|
141
|
-
const n =
|
|
404
|
+
set(e, t, r = this._preferPersistence) {
|
|
405
|
+
const n = r ? this._persistent : this._volatile;
|
|
142
406
|
this._set(n, e, t);
|
|
143
407
|
}
|
|
144
408
|
/**
|
|
@@ -186,90 +450,9 @@ class m {
|
|
|
186
450
|
this._volatile.removeItem(e), this._persistent.removeItem(e);
|
|
187
451
|
}
|
|
188
452
|
}
|
|
189
|
-
class
|
|
190
|
-
constructor(e) {
|
|
191
|
-
o(this, "_iterator");
|
|
192
|
-
o(this, "return");
|
|
193
|
-
o(this, "throw");
|
|
194
|
-
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));
|
|
195
|
-
}
|
|
196
|
-
every(e) {
|
|
197
|
-
let t = 0;
|
|
198
|
-
for (; ; ) {
|
|
199
|
-
const s = this._iterator.next();
|
|
200
|
-
if (s.done)
|
|
201
|
-
return !0;
|
|
202
|
-
if (!e(s.value, t))
|
|
203
|
-
return !1;
|
|
204
|
-
t += 1;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
some(e) {
|
|
208
|
-
let t = 0;
|
|
209
|
-
for (; ; ) {
|
|
210
|
-
const s = this._iterator.next();
|
|
211
|
-
if (s.done)
|
|
212
|
-
return !1;
|
|
213
|
-
if (e(s.value, t))
|
|
214
|
-
return !0;
|
|
215
|
-
t += 1;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
filter(e) {
|
|
219
|
-
let t = 0;
|
|
220
|
-
const s = this._iterator;
|
|
221
|
-
return new u(function* () {
|
|
222
|
-
for (; ; ) {
|
|
223
|
-
const n = s.next();
|
|
224
|
-
if (n.done)
|
|
225
|
-
return n.value;
|
|
226
|
-
e(n.value, t) && (yield n.value), t += 1;
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
map(e) {
|
|
231
|
-
let t = 0;
|
|
232
|
-
const s = this._iterator;
|
|
233
|
-
return new u(function* () {
|
|
234
|
-
for (; ; ) {
|
|
235
|
-
const n = s.next();
|
|
236
|
-
if (n.done)
|
|
237
|
-
return n.value;
|
|
238
|
-
yield e(n.value, t), t += 1;
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
reduce(e, t) {
|
|
243
|
-
let s = 0, n = t;
|
|
244
|
-
for (; ; ) {
|
|
245
|
-
const i = this._iterator.next();
|
|
246
|
-
if (i.done)
|
|
247
|
-
return n;
|
|
248
|
-
n = e(n, i.value, s), s += 1;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
forEach(e) {
|
|
252
|
-
let t = 0;
|
|
253
|
-
for (; ; ) {
|
|
254
|
-
const s = this._iterator.next();
|
|
255
|
-
if (s.done)
|
|
256
|
-
return;
|
|
257
|
-
e(s.value, t), t += 1;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
next(...e) {
|
|
261
|
-
return this._iterator.next(...e);
|
|
262
|
-
}
|
|
263
|
-
toArray() {
|
|
264
|
-
return [...this];
|
|
265
|
-
}
|
|
266
|
-
[Symbol.iterator]() {
|
|
267
|
-
return this;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
class w {
|
|
453
|
+
class b {
|
|
271
454
|
constructor() {
|
|
272
|
-
|
|
455
|
+
u(this, "_subscribers");
|
|
273
456
|
this._subscribers = [];
|
|
274
457
|
}
|
|
275
458
|
add(e) {
|
|
@@ -278,150 +461,154 @@ class w {
|
|
|
278
461
|
remove(e) {
|
|
279
462
|
const t = this._subscribers.indexOf(e);
|
|
280
463
|
if (t < 0)
|
|
281
|
-
throw new
|
|
464
|
+
throw new h("Unable to remove the requested subscriber. It was not found.");
|
|
282
465
|
this._subscribers.splice(t, 1);
|
|
283
466
|
}
|
|
284
467
|
call(...e) {
|
|
285
468
|
return this._subscribers.slice().map((t) => t(...e));
|
|
286
469
|
}
|
|
287
470
|
}
|
|
288
|
-
|
|
289
|
-
|
|
471
|
+
class g {
|
|
472
|
+
static Boolean(e = 0.5) {
|
|
473
|
+
return Math.random() < e;
|
|
474
|
+
}
|
|
475
|
+
static Integer(e, t) {
|
|
476
|
+
return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
|
|
477
|
+
}
|
|
478
|
+
static Decimal(e, t) {
|
|
479
|
+
return t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
|
|
480
|
+
}
|
|
481
|
+
static Choice(e) {
|
|
482
|
+
return e[this.Integer(e.length)];
|
|
483
|
+
}
|
|
484
|
+
// eslint-disable-next-line no-useless-constructor
|
|
485
|
+
constructor() {
|
|
486
|
+
}
|
|
290
487
|
}
|
|
291
|
-
async function
|
|
292
|
-
return new Promise((
|
|
488
|
+
async function k(s) {
|
|
489
|
+
return new Promise((e, t) => setTimeout(e, s));
|
|
293
490
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return Math.floor((e.getTime() - r.getTime()) / t);
|
|
491
|
+
async function M() {
|
|
492
|
+
return new Promise((s, e) => requestAnimationFrame(() => s()));
|
|
297
493
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
494
|
+
var w = /* @__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))(w || {});
|
|
495
|
+
function S(s, e, t = 864e5) {
|
|
496
|
+
return Math.floor((e.getTime() - s.getTime()) / t);
|
|
497
|
+
}
|
|
498
|
+
function j(s, e, t = 864e5) {
|
|
499
|
+
return new c(function* () {
|
|
500
|
+
const r = e.getTime();
|
|
501
|
+
let n = s.getTime();
|
|
502
|
+
for (; n < r; )
|
|
303
503
|
yield new Date(n), n += t;
|
|
304
504
|
});
|
|
305
505
|
}
|
|
306
|
-
function
|
|
307
|
-
return new Date(Math.floor(
|
|
506
|
+
function I(s, e = 864e5) {
|
|
507
|
+
return new Date(Math.floor(s.getTime() / e) * e);
|
|
308
508
|
}
|
|
309
|
-
async function
|
|
310
|
-
return new Promise((t,
|
|
509
|
+
async function A(s, e = "text/javascript") {
|
|
510
|
+
return new Promise((t, r) => {
|
|
311
511
|
const n = document.createElement("script");
|
|
312
|
-
n.async = !0, n.defer = !0, n.src =
|
|
512
|
+
n.async = !0, n.defer = !0, n.src = s, n.type = e, n.onload = () => t(), n.onerror = () => r(), document.body.appendChild(n);
|
|
313
513
|
});
|
|
314
514
|
}
|
|
315
|
-
function
|
|
316
|
-
if (Array.isArray(
|
|
317
|
-
return
|
|
515
|
+
function T(s) {
|
|
516
|
+
if (Array.isArray(s))
|
|
517
|
+
return s.length;
|
|
318
518
|
let e = 0;
|
|
319
|
-
for (const t of
|
|
519
|
+
for (const t of s)
|
|
320
520
|
e += 1;
|
|
321
521
|
return e;
|
|
322
522
|
}
|
|
323
|
-
function
|
|
324
|
-
return new
|
|
325
|
-
e === void 0 && (e =
|
|
326
|
-
for (let
|
|
327
|
-
yield
|
|
523
|
+
function P(s, e, t = 1) {
|
|
524
|
+
return new c(function* () {
|
|
525
|
+
e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
|
|
526
|
+
for (let r = s; r < e; r += t)
|
|
527
|
+
yield r;
|
|
328
528
|
});
|
|
329
529
|
}
|
|
330
|
-
function
|
|
331
|
-
const e =
|
|
530
|
+
function q(s) {
|
|
531
|
+
const e = Array.from(s);
|
|
332
532
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
333
|
-
const
|
|
334
|
-
[e[t], e[
|
|
533
|
+
const r = Math.floor(Math.random() * (t + 1));
|
|
534
|
+
[e[t], e[r]] = [e[r], e[t]];
|
|
335
535
|
}
|
|
336
536
|
return e;
|
|
337
537
|
}
|
|
338
|
-
function
|
|
339
|
-
return new
|
|
538
|
+
function C(s) {
|
|
539
|
+
return new c(function* () {
|
|
340
540
|
const e = /* @__PURE__ */ new Set();
|
|
341
|
-
for (const t of
|
|
541
|
+
for (const t of s)
|
|
342
542
|
e.has(t) || (e.add(t), yield t);
|
|
343
543
|
});
|
|
344
544
|
}
|
|
345
|
-
function
|
|
346
|
-
return new
|
|
347
|
-
const t =
|
|
545
|
+
function y(s, e) {
|
|
546
|
+
return new c(function* () {
|
|
547
|
+
const t = s[Symbol.iterator](), r = e[Symbol.iterator]();
|
|
348
548
|
for (; ; ) {
|
|
349
|
-
const n = t.next(),
|
|
350
|
-
if (n.done ||
|
|
549
|
+
const n = t.next(), o = r.next();
|
|
550
|
+
if (n.done || o.done)
|
|
351
551
|
break;
|
|
352
|
-
yield [n.value,
|
|
552
|
+
yield [n.value, o.value];
|
|
353
553
|
}
|
|
354
554
|
});
|
|
355
555
|
}
|
|
356
|
-
function
|
|
556
|
+
function E(s, e) {
|
|
357
557
|
if (e === void 0) {
|
|
358
|
-
let n = 0,
|
|
359
|
-
for (const
|
|
360
|
-
n +=
|
|
361
|
-
return n /
|
|
362
|
-
}
|
|
363
|
-
let t = 0,
|
|
364
|
-
for (const [n,
|
|
365
|
-
t += n *
|
|
366
|
-
return t /
|
|
558
|
+
let n = 0, o = 0;
|
|
559
|
+
for (const i of s)
|
|
560
|
+
n += i, o += 1;
|
|
561
|
+
return n / o;
|
|
562
|
+
}
|
|
563
|
+
let t = 0, r = 0;
|
|
564
|
+
for (const [n, o] of y(s, e))
|
|
565
|
+
t += n * o, r += o;
|
|
566
|
+
return t / r;
|
|
367
567
|
}
|
|
368
|
-
function
|
|
568
|
+
function O(s) {
|
|
369
569
|
let e = 0;
|
|
370
|
-
for (let t = 0; t <
|
|
371
|
-
const
|
|
372
|
-
e = (e << 5) - e +
|
|
570
|
+
for (let t = 0; t < s.length; t += 1) {
|
|
571
|
+
const r = s.charCodeAt(t);
|
|
572
|
+
e = (e << 5) - e + r, e |= 0;
|
|
373
573
|
}
|
|
374
574
|
return e;
|
|
375
575
|
}
|
|
376
|
-
function
|
|
377
|
-
if (e === void 0 && (e = r, r = 0), r === e)
|
|
378
|
-
return r;
|
|
379
|
-
let s;
|
|
380
|
-
if (t === !0)
|
|
381
|
-
s = (n) => n;
|
|
382
|
-
else if (t === void 0)
|
|
383
|
-
Math.abs(e - r) <= 1 ? s = (n) => n : s = Math.floor;
|
|
384
|
-
else if (t === !1)
|
|
385
|
-
s = Math.floor;
|
|
386
|
-
else {
|
|
387
|
-
const n = 10 ** t;
|
|
388
|
-
s = (i) => Math.floor(i * n) / n;
|
|
389
|
-
}
|
|
390
|
-
return s(Math.random() * (e - r) + r);
|
|
391
|
-
}
|
|
392
|
-
function $(r) {
|
|
576
|
+
function $(s) {
|
|
393
577
|
let e = 0;
|
|
394
|
-
for (const t of
|
|
578
|
+
for (const t of s)
|
|
395
579
|
e += t;
|
|
396
580
|
return e;
|
|
397
581
|
}
|
|
398
|
-
function
|
|
399
|
-
return `${
|
|
582
|
+
function R(s) {
|
|
583
|
+
return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
|
|
400
584
|
}
|
|
401
|
-
const
|
|
585
|
+
const F = "1.3.0-rc.1";
|
|
402
586
|
export {
|
|
403
|
-
f as
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
587
|
+
f as AggregatedIterator,
|
|
588
|
+
m as Aggregator,
|
|
589
|
+
w as DateUnit,
|
|
590
|
+
p as DeferredPromise,
|
|
591
|
+
h as Exception,
|
|
592
|
+
x as JsonStorage,
|
|
593
|
+
g as Random,
|
|
594
|
+
l as ReducedIterator,
|
|
595
|
+
c as SmartIterator,
|
|
596
|
+
b as Subscribers,
|
|
597
|
+
F as VERSION,
|
|
598
|
+
E as average,
|
|
599
|
+
R as capitalize,
|
|
600
|
+
T as count,
|
|
601
|
+
S as dateDifference,
|
|
602
|
+
j as dateRange,
|
|
603
|
+
I as dateRound,
|
|
604
|
+
k as delay,
|
|
605
|
+
O as hash,
|
|
606
|
+
A as loadScript,
|
|
607
|
+
M as nextAnimationFrame,
|
|
608
|
+
P as range,
|
|
609
|
+
q as shuffle,
|
|
423
610
|
$ as sum,
|
|
424
|
-
|
|
425
|
-
|
|
611
|
+
C as unique,
|
|
612
|
+
y as zip
|
|
426
613
|
};
|
|
427
614
|
//# sourceMappingURL=core.js.map
|