esexts 1.2.4 → 1.2.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/esexts.js +446 -703
- package/dist/esexts.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/esexts.js
CHANGED
|
@@ -1,1111 +1,882 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const l = Object.defineProperties, n = { enumerable: !1, configurable: !0, writable: !0 };
|
|
2
|
+
function p(t = { array: !1 }) {
|
|
3
|
+
return function(e = {}, ...r) {
|
|
4
|
+
const u = (i, s) => {
|
|
5
|
+
const o = Object.prototype.toString.call(i), f = Object.prototype.toString.call(s);
|
|
6
|
+
if (o !== f)
|
|
7
|
+
return s;
|
|
8
|
+
if (o === "[object Array]")
|
|
9
|
+
return t.array ? i.concat(...s) : s;
|
|
10
|
+
if (o === "[object Object]") {
|
|
11
|
+
for (const c in s)
|
|
12
|
+
i[c] = u(i[c], s[c]);
|
|
13
|
+
return i;
|
|
13
14
|
} else
|
|
14
|
-
return
|
|
15
|
+
return s;
|
|
15
16
|
};
|
|
16
|
-
for (const
|
|
17
|
-
|
|
18
|
-
return
|
|
17
|
+
for (const i of r)
|
|
18
|
+
e = u(e, i);
|
|
19
|
+
return e;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const b = p({ array: !1 }), d = p({ array: !0 });
|
|
23
|
+
l(Object, {
|
|
23
24
|
isObject: {
|
|
24
|
-
value: function(
|
|
25
|
-
return Object.prototype.toString.call(
|
|
25
|
+
value: function(t) {
|
|
26
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
26
27
|
},
|
|
27
|
-
|
|
28
|
-
configurable: !0,
|
|
29
|
-
writable: !0
|
|
28
|
+
...n
|
|
30
29
|
},
|
|
31
30
|
merge0: {
|
|
32
|
-
value: function(...
|
|
33
|
-
return
|
|
31
|
+
value: function(...t) {
|
|
32
|
+
return b(this, ...t);
|
|
34
33
|
},
|
|
35
|
-
|
|
36
|
-
configurable: !0,
|
|
37
|
-
writable: !0
|
|
34
|
+
...n
|
|
38
35
|
},
|
|
39
36
|
concat0: {
|
|
40
|
-
value: function(...
|
|
41
|
-
return
|
|
37
|
+
value: function(...t) {
|
|
38
|
+
return d(this, ...t);
|
|
42
39
|
},
|
|
43
|
-
|
|
44
|
-
configurable: !0,
|
|
45
|
-
writable: !0
|
|
40
|
+
...n
|
|
46
41
|
}
|
|
47
42
|
});
|
|
48
|
-
|
|
43
|
+
l(Object.prototype, {
|
|
49
44
|
clone0: {
|
|
50
45
|
value: function() {
|
|
51
46
|
return JSON.parse(JSON.stringify(this));
|
|
52
47
|
},
|
|
53
|
-
|
|
54
|
-
configurable: !0,
|
|
55
|
-
writable: !0
|
|
48
|
+
...n
|
|
56
49
|
},
|
|
57
50
|
length0: {
|
|
58
51
|
value: function() {
|
|
59
52
|
return Object.keys(this).length;
|
|
60
53
|
},
|
|
61
|
-
|
|
62
|
-
configurable: !0,
|
|
63
|
-
writable: !0
|
|
54
|
+
...n
|
|
64
55
|
},
|
|
65
56
|
entries0: {
|
|
66
57
|
value: function() {
|
|
67
58
|
return Object.entries(this);
|
|
68
59
|
},
|
|
69
|
-
|
|
70
|
-
configurable: !0,
|
|
71
|
-
writable: !0
|
|
60
|
+
...n
|
|
72
61
|
},
|
|
73
62
|
keys0: {
|
|
74
63
|
value: function() {
|
|
75
64
|
return Object.keys(this);
|
|
76
65
|
},
|
|
77
|
-
|
|
78
|
-
configurable: !0,
|
|
79
|
-
writable: !0
|
|
66
|
+
...n
|
|
80
67
|
},
|
|
81
68
|
values0: {
|
|
82
69
|
value: function() {
|
|
83
70
|
return Object.values(this);
|
|
84
71
|
},
|
|
85
|
-
|
|
86
|
-
configurable: !0,
|
|
87
|
-
writable: !0
|
|
72
|
+
...n
|
|
88
73
|
},
|
|
89
74
|
merge0: {
|
|
90
|
-
value: function(...
|
|
91
|
-
return
|
|
75
|
+
value: function(...t) {
|
|
76
|
+
return b(this, ...t);
|
|
92
77
|
},
|
|
93
|
-
|
|
94
|
-
configurable: !0,
|
|
95
|
-
writable: !0
|
|
78
|
+
...n
|
|
96
79
|
},
|
|
97
80
|
concat0: {
|
|
98
|
-
value: function(...
|
|
99
|
-
return
|
|
81
|
+
value: function(...t) {
|
|
82
|
+
return d(this, ...t);
|
|
100
83
|
},
|
|
101
|
-
|
|
102
|
-
configurable: !0,
|
|
103
|
-
writable: !0
|
|
84
|
+
...n
|
|
104
85
|
},
|
|
105
86
|
map0: {
|
|
106
|
-
value: function(
|
|
107
|
-
return Object.entries(this).map(([r, u]) =>
|
|
87
|
+
value: function(t = (r, u, i) => [r, u], e = 0) {
|
|
88
|
+
return Object.entries(this).map(([r, u]) => t(r, u, e++));
|
|
108
89
|
},
|
|
109
|
-
|
|
110
|
-
configurable: !0,
|
|
111
|
-
writable: !0
|
|
90
|
+
...n
|
|
112
91
|
},
|
|
113
92
|
pick0: {
|
|
114
|
-
value: function(...
|
|
115
|
-
const
|
|
116
|
-
for (const r of
|
|
117
|
-
|
|
118
|
-
return
|
|
93
|
+
value: function(...t) {
|
|
94
|
+
const e = {};
|
|
95
|
+
for (const r of t)
|
|
96
|
+
e[r] = this[r];
|
|
97
|
+
return e;
|
|
119
98
|
},
|
|
120
|
-
|
|
121
|
-
configurable: !0,
|
|
122
|
-
writable: !0
|
|
99
|
+
...n
|
|
123
100
|
},
|
|
124
101
|
omit0: {
|
|
125
|
-
value: function(...
|
|
126
|
-
const
|
|
102
|
+
value: function(...t) {
|
|
103
|
+
const e = {}, r = new Set(t);
|
|
127
104
|
for (const u in this)
|
|
128
|
-
r.has(u) || (
|
|
129
|
-
return
|
|
105
|
+
r.has(u) || (e[u] = this[u]);
|
|
106
|
+
return e;
|
|
130
107
|
},
|
|
131
|
-
|
|
132
|
-
configurable: !0,
|
|
133
|
-
writable: !0
|
|
108
|
+
...n
|
|
134
109
|
},
|
|
135
110
|
attr0: {
|
|
136
|
-
value: function(
|
|
137
|
-
return typeof this != "object" ? this : typeof
|
|
111
|
+
value: function(t, ...e) {
|
|
112
|
+
return typeof this != "object" ? this : typeof t == "function" ? t(this, ...e) : this[t];
|
|
138
113
|
},
|
|
139
|
-
|
|
140
|
-
configurable: !0,
|
|
141
|
-
writable: !0
|
|
114
|
+
...n
|
|
142
115
|
},
|
|
143
116
|
log0: {
|
|
144
|
-
value: function(...
|
|
145
|
-
return console.log(...
|
|
117
|
+
value: function(...t) {
|
|
118
|
+
return console.log(...t, this), this;
|
|
146
119
|
},
|
|
147
|
-
|
|
148
|
-
configurable: !0,
|
|
149
|
-
writable: !0
|
|
120
|
+
...n
|
|
150
121
|
},
|
|
151
122
|
debug0: {
|
|
152
|
-
value: function(...
|
|
153
|
-
return console.debug(...
|
|
123
|
+
value: function(...t) {
|
|
124
|
+
return console.debug(...t, this), this;
|
|
154
125
|
},
|
|
155
|
-
|
|
156
|
-
configurable: !0,
|
|
157
|
-
writable: !0
|
|
126
|
+
...n
|
|
158
127
|
},
|
|
159
128
|
// ====== Tree ======
|
|
160
129
|
getParents0: {
|
|
161
|
-
value: function(
|
|
162
|
-
const u =
|
|
163
|
-
let
|
|
164
|
-
for (;
|
|
165
|
-
u.push(
|
|
130
|
+
value: function(t = !1, e = -1, r = "parent") {
|
|
131
|
+
const u = t ? [this] : [];
|
|
132
|
+
let i = this[r];
|
|
133
|
+
for (; i && e-- != 0; )
|
|
134
|
+
u.push(i), i = i[r];
|
|
166
135
|
return u;
|
|
167
136
|
},
|
|
168
|
-
|
|
169
|
-
configurable: !0,
|
|
170
|
-
writable: !0
|
|
137
|
+
...n
|
|
171
138
|
},
|
|
172
139
|
getChildrens0: {
|
|
173
|
-
value: function(
|
|
174
|
-
const u = [],
|
|
175
|
-
if (
|
|
176
|
-
for (const
|
|
177
|
-
|
|
140
|
+
value: function(t = !1, e = -1, r = "children") {
|
|
141
|
+
const u = [], i = (s, o, f) => {
|
|
142
|
+
if (o && u.push(s), !(f == 0 || !s[r] || s[r].length == 0))
|
|
143
|
+
for (const c of s[r])
|
|
144
|
+
i(c, !0, f - 1);
|
|
178
145
|
};
|
|
179
|
-
return
|
|
146
|
+
return i(this, t, e), u;
|
|
180
147
|
},
|
|
181
|
-
|
|
182
|
-
configurable: !0,
|
|
183
|
-
writable: !0
|
|
148
|
+
...n
|
|
184
149
|
},
|
|
185
150
|
treeFind0: {
|
|
186
|
-
value: function(
|
|
187
|
-
if (
|
|
151
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
152
|
+
if (e && t(this))
|
|
188
153
|
return this;
|
|
189
154
|
if (r == 0 || !this[u] || this[u].length == 0)
|
|
190
155
|
return null;
|
|
191
|
-
for (const
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
156
|
+
for (const i of this[u]) {
|
|
157
|
+
const s = i.treeFind0(t, !0, r - 1, u);
|
|
158
|
+
if (s !== null)
|
|
159
|
+
return s;
|
|
195
160
|
}
|
|
196
161
|
return null;
|
|
197
162
|
},
|
|
198
|
-
|
|
199
|
-
configurable: !0,
|
|
200
|
-
writable: !0
|
|
163
|
+
...n
|
|
201
164
|
},
|
|
202
165
|
treeEach0: {
|
|
203
|
-
value: function(
|
|
204
|
-
if (
|
|
205
|
-
for (const
|
|
206
|
-
|
|
166
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
167
|
+
if (e && t(this), !(r == 0 || !this[u] || this[u].length == 0)) {
|
|
168
|
+
for (const i of this[u])
|
|
169
|
+
i.treeEach0(t, !0, r - 1, u);
|
|
207
170
|
return this;
|
|
208
171
|
}
|
|
209
172
|
},
|
|
210
|
-
|
|
211
|
-
configurable: !0,
|
|
212
|
-
writable: !0
|
|
173
|
+
...n
|
|
213
174
|
},
|
|
214
175
|
treeMap0: {
|
|
215
|
-
value: function(
|
|
216
|
-
const
|
|
176
|
+
value: function(t, e = !0, r = -1, u = "children", i = null) {
|
|
177
|
+
const s = e ? t(this) : this, o = [];
|
|
217
178
|
if (r == 0 || !this[u] || this[u].length == 0)
|
|
218
|
-
return
|
|
219
|
-
for (const
|
|
220
|
-
|
|
221
|
-
return
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
configurable: !0,
|
|
225
|
-
writable: !0
|
|
179
|
+
return s;
|
|
180
|
+
for (const f of this[u])
|
|
181
|
+
o.push(f.treeMap0(t, !0, r - 1, u, i));
|
|
182
|
+
return s[u] = o, s;
|
|
183
|
+
},
|
|
184
|
+
...n
|
|
226
185
|
}
|
|
227
186
|
});
|
|
228
|
-
|
|
187
|
+
l(Number.prototype, {
|
|
229
188
|
ceil: {
|
|
230
189
|
value: function() {
|
|
231
190
|
return Math.ceil(this);
|
|
232
191
|
},
|
|
233
|
-
|
|
234
|
-
configurable: !0,
|
|
235
|
-
writable: !0
|
|
192
|
+
...n
|
|
236
193
|
},
|
|
237
194
|
floor: {
|
|
238
195
|
value: function() {
|
|
239
196
|
return Math.floor(this);
|
|
240
197
|
},
|
|
241
|
-
|
|
242
|
-
configurable: !0,
|
|
243
|
-
writable: !0
|
|
198
|
+
...n
|
|
244
199
|
},
|
|
245
200
|
round: {
|
|
246
|
-
value: function(
|
|
247
|
-
return
|
|
201
|
+
value: function(t = 0) {
|
|
202
|
+
return t == 0 ? Math.round(this) : Math.round(this * 10 ** t) / 10 ** t;
|
|
248
203
|
},
|
|
249
|
-
|
|
250
|
-
configurable: !0,
|
|
251
|
-
writable: !0
|
|
204
|
+
...n
|
|
252
205
|
},
|
|
253
206
|
trunc: {
|
|
254
207
|
value: function() {
|
|
255
208
|
return Math.trunc(this);
|
|
256
209
|
},
|
|
257
|
-
|
|
258
|
-
configurable: !0,
|
|
259
|
-
writable: !0
|
|
210
|
+
...n
|
|
260
211
|
},
|
|
261
212
|
abs: {
|
|
262
213
|
value: function() {
|
|
263
214
|
return Math.abs(this);
|
|
264
215
|
},
|
|
265
|
-
|
|
266
|
-
configurable: !0,
|
|
267
|
-
writable: !0
|
|
216
|
+
...n
|
|
268
217
|
},
|
|
269
218
|
max: {
|
|
270
|
-
value: function(...
|
|
271
|
-
return Math.max(this, ...
|
|
219
|
+
value: function(...t) {
|
|
220
|
+
return Math.max(this, ...t);
|
|
272
221
|
},
|
|
273
|
-
|
|
274
|
-
configurable: !0,
|
|
275
|
-
writable: !0
|
|
222
|
+
...n
|
|
276
223
|
},
|
|
277
224
|
min: {
|
|
278
|
-
value: function(...
|
|
279
|
-
return Math.min(this, ...
|
|
225
|
+
value: function(...t) {
|
|
226
|
+
return Math.min(this, ...t);
|
|
280
227
|
},
|
|
281
|
-
|
|
282
|
-
configurable: !0,
|
|
283
|
-
writable: !0
|
|
228
|
+
...n
|
|
284
229
|
},
|
|
285
230
|
baseConvert: {
|
|
286
|
-
value: function(
|
|
287
|
-
let
|
|
231
|
+
value: function(t = 64) {
|
|
232
|
+
let e = "", r = this, u = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
288
233
|
for (; r > 0; )
|
|
289
|
-
|
|
290
|
-
return
|
|
234
|
+
e = u.at(r % t) + e, r = Math.floor(r / t);
|
|
235
|
+
return e || "0";
|
|
291
236
|
},
|
|
292
|
-
|
|
293
|
-
configurable: !0,
|
|
294
|
-
writable: !0
|
|
237
|
+
...n
|
|
295
238
|
},
|
|
296
239
|
toFixed0: {
|
|
297
|
-
value: function(...
|
|
298
|
-
return +this.toFixed(...
|
|
240
|
+
value: function(...t) {
|
|
241
|
+
return +this.toFixed(...t);
|
|
299
242
|
},
|
|
300
|
-
|
|
301
|
-
configurable: !0,
|
|
302
|
-
writable: !0
|
|
243
|
+
...n
|
|
303
244
|
},
|
|
304
245
|
toDate: {
|
|
305
246
|
value: function() {
|
|
306
247
|
return Date.new(this);
|
|
307
248
|
},
|
|
308
|
-
|
|
309
|
-
configurable: !0,
|
|
310
|
-
writable: !0
|
|
249
|
+
...n
|
|
311
250
|
}
|
|
312
251
|
});
|
|
313
|
-
|
|
252
|
+
l(BigInt.prototype, {
|
|
314
253
|
toJSON: {
|
|
315
254
|
value: function() {
|
|
316
255
|
return this > 9007199254740991n || this < -9007199254740991n ? this.toString() : Number(this);
|
|
317
256
|
},
|
|
318
|
-
|
|
319
|
-
configurable: !0,
|
|
320
|
-
writable: !0
|
|
257
|
+
...n
|
|
321
258
|
}
|
|
322
259
|
});
|
|
323
|
-
|
|
260
|
+
l(String.prototype, {
|
|
324
261
|
length0: {
|
|
325
262
|
value: function() {
|
|
326
263
|
return this.length;
|
|
327
264
|
},
|
|
328
|
-
|
|
329
|
-
configurable: !0,
|
|
330
|
-
writable: !0
|
|
265
|
+
...n
|
|
331
266
|
},
|
|
332
267
|
substring0: {
|
|
333
|
-
value: function(
|
|
334
|
-
return
|
|
268
|
+
value: function(t = 0, e = this.length) {
|
|
269
|
+
return t = t >= 0 ? t : this.length + t, e = e >= 0 ? e : this.length + e, this.substring(t, e);
|
|
335
270
|
},
|
|
336
|
-
|
|
337
|
-
configurable: !0,
|
|
338
|
-
writable: !0
|
|
271
|
+
...n
|
|
339
272
|
},
|
|
340
273
|
substr0: {
|
|
341
|
-
value: function(
|
|
342
|
-
return
|
|
274
|
+
value: function(t = 0, e = this.length) {
|
|
275
|
+
return t = t >= 0 ? t : this.length + t, e = t + e, this.substring(t, e);
|
|
343
276
|
},
|
|
344
|
-
|
|
345
|
-
configurable: !0,
|
|
346
|
-
writable: !0
|
|
277
|
+
...n
|
|
347
278
|
},
|
|
348
279
|
split0: {
|
|
349
|
-
value: function(
|
|
350
|
-
const r = this ? this.split(
|
|
351
|
-
return
|
|
280
|
+
value: function(t = ",", e = -1) {
|
|
281
|
+
const r = this ? this.split(t) : [];
|
|
282
|
+
return e === -1 ? r : r.push0(r.splice(e - 1).join(t));
|
|
352
283
|
},
|
|
353
|
-
|
|
354
|
-
configurable: !0,
|
|
355
|
-
writable: !0
|
|
284
|
+
...n
|
|
356
285
|
},
|
|
357
286
|
splitNumber: {
|
|
358
|
-
value: function(
|
|
359
|
-
return this.split0(
|
|
287
|
+
value: function(t = ",") {
|
|
288
|
+
return this.split0(t).map((e) => +e);
|
|
360
289
|
},
|
|
361
|
-
|
|
362
|
-
configurable: !0,
|
|
363
|
-
writable: !0
|
|
290
|
+
...n
|
|
364
291
|
},
|
|
365
292
|
splitSegment: {
|
|
366
|
-
value: function(
|
|
367
|
-
const
|
|
368
|
-
for (let r = 0; r < this.length; r +=
|
|
369
|
-
|
|
370
|
-
return
|
|
293
|
+
value: function(t = 1) {
|
|
294
|
+
const e = [];
|
|
295
|
+
for (let r = 0; r < this.length; r += t)
|
|
296
|
+
e.push(this.substring(r, t));
|
|
297
|
+
return e;
|
|
371
298
|
},
|
|
372
|
-
|
|
373
|
-
configurable: !0,
|
|
374
|
-
writable: !0
|
|
299
|
+
...n
|
|
375
300
|
},
|
|
376
301
|
sprintf: {
|
|
377
|
-
value: function(...
|
|
378
|
-
let [
|
|
302
|
+
value: function(...t) {
|
|
303
|
+
let [e, ...r] = this.split(/%[sd]/);
|
|
379
304
|
for (let u = 0; u < r.length; u++)
|
|
380
|
-
|
|
381
|
-
return
|
|
305
|
+
e += t[u] + r[u];
|
|
306
|
+
return e;
|
|
382
307
|
},
|
|
383
|
-
|
|
384
|
-
configurable: !0,
|
|
385
|
-
writable: !0
|
|
308
|
+
...n
|
|
386
309
|
},
|
|
387
310
|
subOf: {
|
|
388
|
-
value: function(
|
|
389
|
-
for (let
|
|
390
|
-
u = this.indexOf(
|
|
391
|
-
let
|
|
392
|
-
return
|
|
311
|
+
value: function(t, e, r = 0, u = 0) {
|
|
312
|
+
for (let o = 0; o < r && u != -1; o++, u++)
|
|
313
|
+
u = this.indexOf(t, u);
|
|
314
|
+
let i = this.indexOf(t, u), s = this.indexOf(e, i);
|
|
315
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
393
316
|
},
|
|
394
|
-
|
|
395
|
-
configurable: !0,
|
|
396
|
-
writable: !0
|
|
317
|
+
...n
|
|
397
318
|
},
|
|
398
319
|
lastSubOf: {
|
|
399
|
-
value: function(
|
|
400
|
-
for (let
|
|
401
|
-
u = this.lastIndexOf(
|
|
402
|
-
let
|
|
403
|
-
return
|
|
320
|
+
value: function(t, e, r = 0, u = 1 / 0) {
|
|
321
|
+
for (let o = 0; o < r && u != -1; o++, u--)
|
|
322
|
+
u = this.lastIndexOf(t, u);
|
|
323
|
+
let i = this.lastIndexOf(t, u), s = this.indexOf(e, i);
|
|
324
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
404
325
|
},
|
|
405
|
-
|
|
406
|
-
configurable: !0,
|
|
407
|
-
writable: !0
|
|
326
|
+
...n
|
|
408
327
|
},
|
|
409
328
|
camel2under: {
|
|
410
329
|
value: function() {
|
|
411
|
-
return this.substr(0, 1).toLowerCase() + this.substr(1).replace(/([A-Z])/g, (
|
|
330
|
+
return this.substr(0, 1).toLowerCase() + this.substr(1).replace(/([A-Z])/g, (t, e) => "_" + e.toLowerCase());
|
|
412
331
|
},
|
|
413
|
-
|
|
414
|
-
configurable: !0,
|
|
415
|
-
writable: !0
|
|
332
|
+
...n
|
|
416
333
|
},
|
|
417
334
|
under2camel: {
|
|
418
335
|
value: function() {
|
|
419
|
-
return this.replace(/_([a-z])/g, (
|
|
336
|
+
return this.replace(/_([a-z])/g, (t, e) => e.toUpperCase());
|
|
420
337
|
},
|
|
421
|
-
|
|
422
|
-
configurable: !0,
|
|
423
|
-
writable: !0
|
|
338
|
+
...n
|
|
424
339
|
},
|
|
425
340
|
camel2pascal: {
|
|
426
341
|
value: function() {
|
|
427
342
|
return this.substr(0, 1).toUpperCase() + this.substr(1);
|
|
428
343
|
},
|
|
429
|
-
|
|
430
|
-
configurable: !0,
|
|
431
|
-
writable: !0
|
|
344
|
+
...n
|
|
432
345
|
},
|
|
433
346
|
pascal2camel: {
|
|
434
347
|
value: function() {
|
|
435
348
|
return this.substr(0, 1).toLowerCase() + this.substr(1);
|
|
436
349
|
},
|
|
437
|
-
|
|
438
|
-
configurable: !0,
|
|
439
|
-
writable: !0
|
|
350
|
+
...n
|
|
440
351
|
},
|
|
441
352
|
under2kebab: {
|
|
442
353
|
value: function() {
|
|
443
354
|
return this.replace(/_/g, "-");
|
|
444
355
|
},
|
|
445
|
-
|
|
446
|
-
configurable: !0,
|
|
447
|
-
writable: !0
|
|
356
|
+
...n
|
|
448
357
|
},
|
|
449
358
|
kebab2under: {
|
|
450
359
|
value: function() {
|
|
451
360
|
return this.replace(/-/g, "_");
|
|
452
361
|
},
|
|
453
|
-
|
|
454
|
-
configurable: !0,
|
|
455
|
-
writable: !0
|
|
362
|
+
...n
|
|
456
363
|
},
|
|
457
364
|
baseConvert: {
|
|
458
|
-
value: function(
|
|
459
|
-
let
|
|
365
|
+
value: function(t = 64) {
|
|
366
|
+
let e = 0, r = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
460
367
|
for (let u = 0; u < this.length; u++)
|
|
461
|
-
|
|
462
|
-
return
|
|
368
|
+
e = e * t + r.indexOf(this.at(u));
|
|
369
|
+
return e;
|
|
463
370
|
},
|
|
464
|
-
|
|
465
|
-
configurable: !0,
|
|
466
|
-
writable: !0
|
|
371
|
+
...n
|
|
467
372
|
},
|
|
468
373
|
toFixed0: {
|
|
469
|
-
value: function(...
|
|
470
|
-
return +(+this).toFixed(...
|
|
374
|
+
value: function(...t) {
|
|
375
|
+
return +(+this).toFixed(...t);
|
|
471
376
|
},
|
|
472
|
-
|
|
473
|
-
configurable: !0,
|
|
474
|
-
writable: !0
|
|
377
|
+
...n
|
|
475
378
|
},
|
|
476
379
|
toDate: {
|
|
477
380
|
value: function() {
|
|
478
381
|
return Date.new(this);
|
|
479
382
|
},
|
|
480
|
-
|
|
481
|
-
configurable: !0,
|
|
482
|
-
writable: !0
|
|
383
|
+
...n
|
|
483
384
|
},
|
|
484
385
|
hex2bytes: {
|
|
485
386
|
value: function() {
|
|
486
|
-
const
|
|
487
|
-
for (let
|
|
488
|
-
|
|
489
|
-
return
|
|
387
|
+
const t = [];
|
|
388
|
+
for (let e = 0; e < this.length; e += 2)
|
|
389
|
+
t.push(Number.parseInt(this.substring(e, e + 2), 16));
|
|
390
|
+
return t;
|
|
490
391
|
},
|
|
491
|
-
|
|
492
|
-
configurable: !0,
|
|
493
|
-
writable: !0
|
|
392
|
+
...n
|
|
494
393
|
},
|
|
495
394
|
string2bytes: {
|
|
496
395
|
value: function() {
|
|
497
396
|
if (typeof TextEncoder < "u")
|
|
498
397
|
return Array.from(new TextEncoder().encode(this));
|
|
499
|
-
const
|
|
500
|
-
for (let r = 0; r <
|
|
501
|
-
|
|
502
|
-
return
|
|
398
|
+
const t = [], e = encodeURIComponent(this);
|
|
399
|
+
for (let r = 0; r < e.length; )
|
|
400
|
+
t.push(e.charAt(r) == "%" ? Number.parseInt(e.substring(r + 1, r += 3), 16) : e.charCodeAt(r++));
|
|
401
|
+
return t;
|
|
503
402
|
},
|
|
504
|
-
|
|
505
|
-
configurable: !0,
|
|
506
|
-
writable: !0
|
|
403
|
+
...n
|
|
507
404
|
},
|
|
508
405
|
base64decode: {
|
|
509
|
-
value: function(
|
|
510
|
-
const
|
|
511
|
-
for (let
|
|
512
|
-
r[u.charAt(
|
|
513
|
-
const
|
|
514
|
-
for (let
|
|
515
|
-
const
|
|
516
|
-
|
|
406
|
+
value: function(t) {
|
|
407
|
+
const e = [], r = {}, u = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
408
|
+
for (let s = 0; s < u.length; s++)
|
|
409
|
+
r[u.charAt(s)] = s;
|
|
410
|
+
const i = this.charAt(this.length - 1) != "=" ? this.length : this.charAt(this.length - 2) != "=" ? this.length - 1 : this.length - 2;
|
|
411
|
+
for (let s = 3; s < i; s += 4) {
|
|
412
|
+
const o = (r[this.charAt(s - 3)] << 18) + (r[this.charAt(s - 2)] << 12) + (r[this.charAt(s - 1)] << 6) + r[this.charAt(s)];
|
|
413
|
+
e.push((o & 16711680) >> 16, (o & 65280) >> 8, o & 255);
|
|
517
414
|
}
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
} else if (
|
|
522
|
-
const
|
|
523
|
-
|
|
415
|
+
if (i % 4 == 3) {
|
|
416
|
+
const s = (r[this.charAt(i - 3)] << 18) + (r[this.charAt(i - 2)] << 12) + (r[this.charAt(i - 1)] << 6);
|
|
417
|
+
e.push((s & 16711680) >> 16, (s & 65280) >> 8);
|
|
418
|
+
} else if (i % 4 == 2) {
|
|
419
|
+
const s = (r[this.charAt(i - 2)] << 18) + (r[this.charAt(i - 1)] << 12);
|
|
420
|
+
e.push((s & 16711680) >> 16);
|
|
524
421
|
}
|
|
525
|
-
return
|
|
422
|
+
return e;
|
|
526
423
|
},
|
|
527
|
-
|
|
528
|
-
configurable: !0,
|
|
529
|
-
writable: !0
|
|
424
|
+
...n
|
|
530
425
|
}
|
|
531
426
|
});
|
|
532
|
-
typeof Iterator < "u" &&
|
|
427
|
+
typeof Iterator < "u" && l(Iterator.prototype, {
|
|
533
428
|
toArray: {
|
|
534
429
|
value: function() {
|
|
535
430
|
return Array.from(this);
|
|
536
431
|
},
|
|
537
|
-
|
|
538
|
-
configurable: !0,
|
|
539
|
-
writable: !0
|
|
432
|
+
...n
|
|
540
433
|
}
|
|
541
434
|
});
|
|
542
|
-
|
|
435
|
+
l(Array.prototype, {
|
|
543
436
|
length0: {
|
|
544
437
|
value: function() {
|
|
545
438
|
return this.length;
|
|
546
439
|
},
|
|
547
|
-
|
|
548
|
-
configurable: !0,
|
|
549
|
-
writable: !0
|
|
440
|
+
...n
|
|
550
441
|
},
|
|
551
442
|
entries0: {
|
|
552
443
|
value: function() {
|
|
553
444
|
return this.entries();
|
|
554
445
|
},
|
|
555
|
-
|
|
556
|
-
configurable: !0,
|
|
557
|
-
writable: !0
|
|
446
|
+
...n
|
|
558
447
|
},
|
|
559
448
|
push0: {
|
|
560
|
-
value: function(...
|
|
561
|
-
return this.push(...
|
|
449
|
+
value: function(...t) {
|
|
450
|
+
return this.push(...t), this;
|
|
562
451
|
},
|
|
563
|
-
|
|
564
|
-
configurable: !0,
|
|
565
|
-
writable: !0
|
|
452
|
+
...n
|
|
566
453
|
},
|
|
567
454
|
push1: {
|
|
568
|
-
value: function(...
|
|
569
|
-
return this.push(...
|
|
455
|
+
value: function(...t) {
|
|
456
|
+
return this.push(...t), t[0];
|
|
570
457
|
},
|
|
571
|
-
|
|
572
|
-
configurable: !0,
|
|
573
|
-
writable: !0
|
|
458
|
+
...n
|
|
574
459
|
},
|
|
575
460
|
push3: {
|
|
576
|
-
value: function(...
|
|
577
|
-
return this.push(...
|
|
461
|
+
value: function(...t) {
|
|
462
|
+
return this.push(...t), t;
|
|
578
463
|
},
|
|
579
|
-
|
|
580
|
-
configurable: !0,
|
|
581
|
-
writable: !0
|
|
464
|
+
...n
|
|
582
465
|
},
|
|
583
466
|
pop0: {
|
|
584
|
-
value: function(...
|
|
585
|
-
return this.pop(...
|
|
467
|
+
value: function(...t) {
|
|
468
|
+
return this.pop(...t), this;
|
|
586
469
|
},
|
|
587
|
-
|
|
588
|
-
configurable: !0,
|
|
589
|
-
writable: !0
|
|
470
|
+
...n
|
|
590
471
|
},
|
|
591
472
|
pop1: {
|
|
592
|
-
value: function(...
|
|
593
|
-
return this.pop(...
|
|
473
|
+
value: function(...t) {
|
|
474
|
+
return this.pop(...t), t[0];
|
|
594
475
|
},
|
|
595
|
-
|
|
596
|
-
configurable: !0,
|
|
597
|
-
writable: !0
|
|
476
|
+
...n
|
|
598
477
|
},
|
|
599
478
|
pop3: {
|
|
600
|
-
value: function(...
|
|
601
|
-
return this.pop(...
|
|
479
|
+
value: function(...t) {
|
|
480
|
+
return this.pop(...t), t;
|
|
602
481
|
},
|
|
603
|
-
|
|
604
|
-
configurable: !0,
|
|
605
|
-
writable: !0
|
|
482
|
+
...n
|
|
606
483
|
},
|
|
607
484
|
unshift0: {
|
|
608
|
-
value: function(...
|
|
609
|
-
return this.unshift(...
|
|
485
|
+
value: function(...t) {
|
|
486
|
+
return this.unshift(...t), this;
|
|
610
487
|
},
|
|
611
|
-
|
|
612
|
-
configurable: !0,
|
|
613
|
-
writable: !0
|
|
488
|
+
...n
|
|
614
489
|
},
|
|
615
490
|
unshift1: {
|
|
616
|
-
value: function(...
|
|
617
|
-
return this.unshift(...
|
|
491
|
+
value: function(...t) {
|
|
492
|
+
return this.unshift(...t), t[0];
|
|
618
493
|
},
|
|
619
|
-
|
|
620
|
-
configurable: !0,
|
|
621
|
-
writable: !0
|
|
494
|
+
...n
|
|
622
495
|
},
|
|
623
496
|
unshift3: {
|
|
624
|
-
value: function(...
|
|
625
|
-
return this.unshift(...
|
|
497
|
+
value: function(...t) {
|
|
498
|
+
return this.unshift(...t), t;
|
|
626
499
|
},
|
|
627
|
-
|
|
628
|
-
configurable: !0,
|
|
629
|
-
writable: !0
|
|
500
|
+
...n
|
|
630
501
|
},
|
|
631
502
|
shift0: {
|
|
632
|
-
value: function(...
|
|
633
|
-
return this.shift(...
|
|
503
|
+
value: function(...t) {
|
|
504
|
+
return this.shift(...t), this;
|
|
634
505
|
},
|
|
635
|
-
|
|
636
|
-
configurable: !0,
|
|
637
|
-
writable: !0
|
|
506
|
+
...n
|
|
638
507
|
},
|
|
639
508
|
shift1: {
|
|
640
|
-
value: function(...
|
|
641
|
-
return this.shift(...
|
|
509
|
+
value: function(...t) {
|
|
510
|
+
return this.shift(...t), t[0];
|
|
642
511
|
},
|
|
643
|
-
|
|
644
|
-
configurable: !0,
|
|
645
|
-
writable: !0
|
|
512
|
+
...n
|
|
646
513
|
},
|
|
647
514
|
shift3: {
|
|
648
|
-
value: function(...
|
|
649
|
-
return this.shift(...
|
|
515
|
+
value: function(...t) {
|
|
516
|
+
return this.shift(...t), t;
|
|
650
517
|
},
|
|
651
|
-
|
|
652
|
-
configurable: !0,
|
|
653
|
-
writable: !0
|
|
518
|
+
...n
|
|
654
519
|
},
|
|
655
520
|
first0: {
|
|
656
|
-
value: function(
|
|
657
|
-
return this.length ? this[0] :
|
|
521
|
+
value: function(t = null) {
|
|
522
|
+
return this.length ? this[0] : t;
|
|
658
523
|
},
|
|
659
|
-
|
|
660
|
-
configurable: !0,
|
|
661
|
-
writable: !0
|
|
524
|
+
...n
|
|
662
525
|
},
|
|
663
526
|
last0: {
|
|
664
|
-
value: function(
|
|
665
|
-
return this.length ? this[this.length - 1] :
|
|
527
|
+
value: function(t = null) {
|
|
528
|
+
return this.length ? this[this.length - 1] : t;
|
|
666
529
|
},
|
|
667
|
-
|
|
668
|
-
configurable: !0,
|
|
669
|
-
writable: !0
|
|
530
|
+
...n
|
|
670
531
|
},
|
|
671
532
|
find0: {
|
|
672
|
-
value: function(
|
|
673
|
-
return this.find(
|
|
533
|
+
value: function(t, e = null) {
|
|
534
|
+
return this.find(t) ?? e;
|
|
674
535
|
},
|
|
675
|
-
|
|
676
|
-
configurable: !0,
|
|
677
|
-
writable: !0
|
|
536
|
+
...n
|
|
678
537
|
},
|
|
679
538
|
equals0: {
|
|
680
|
-
value: function(
|
|
681
|
-
return this.length ===
|
|
539
|
+
value: function(t) {
|
|
540
|
+
return this.length === t.length && (this === t || this.length === 0 || this.every((e, r) => e === t[r]));
|
|
682
541
|
},
|
|
683
|
-
|
|
684
|
-
configurable: !0,
|
|
685
|
-
writable: !0
|
|
542
|
+
...n
|
|
686
543
|
},
|
|
687
544
|
unique0: {
|
|
688
|
-
value: function(
|
|
689
|
-
const
|
|
690
|
-
return this.filter((r) =>
|
|
545
|
+
value: function(t = (e) => e) {
|
|
546
|
+
const e = /* @__PURE__ */ new Set();
|
|
547
|
+
return this.filter((r) => e.has(t(r)) ? !1 : !!e.add(t(r)));
|
|
691
548
|
},
|
|
692
|
-
|
|
693
|
-
configurable: !0,
|
|
694
|
-
writable: !0
|
|
549
|
+
...n
|
|
695
550
|
},
|
|
696
551
|
each0: {
|
|
697
|
-
value: function(
|
|
698
|
-
return this.forEach(
|
|
552
|
+
value: function(t) {
|
|
553
|
+
return this.forEach(t), this;
|
|
699
554
|
},
|
|
700
|
-
|
|
701
|
-
configurable: !0,
|
|
702
|
-
writable: !0
|
|
555
|
+
...n
|
|
703
556
|
},
|
|
704
557
|
toObject: {
|
|
705
|
-
value: function(
|
|
706
|
-
return Object.fromEntries(this.map(
|
|
558
|
+
value: function(t = (e, r) => [r, e]) {
|
|
559
|
+
return Object.fromEntries(this.map(t));
|
|
707
560
|
},
|
|
708
|
-
|
|
709
|
-
configurable: !0,
|
|
710
|
-
writable: !0
|
|
561
|
+
...n
|
|
711
562
|
},
|
|
712
563
|
toMap: {
|
|
713
|
-
value: function(
|
|
714
|
-
return new Map(this.map(
|
|
564
|
+
value: function(t = (e, r) => [r, e]) {
|
|
565
|
+
return new Map(this.map(t));
|
|
715
566
|
},
|
|
716
|
-
|
|
717
|
-
configurable: !0,
|
|
718
|
-
writable: !0
|
|
567
|
+
...n
|
|
719
568
|
},
|
|
720
569
|
toSet: {
|
|
721
570
|
value: function() {
|
|
722
571
|
return new Set(this);
|
|
723
572
|
},
|
|
724
|
-
|
|
725
|
-
configurable: !0,
|
|
726
|
-
writable: !0
|
|
573
|
+
...n
|
|
727
574
|
},
|
|
728
575
|
toGroup: {
|
|
729
|
-
value: function(
|
|
730
|
-
const
|
|
576
|
+
value: function(t = (e) => [e.id, e]) {
|
|
577
|
+
const e = {};
|
|
731
578
|
for (const r of this) {
|
|
732
|
-
const [u,
|
|
733
|
-
u in
|
|
579
|
+
const [u, i] = t(r);
|
|
580
|
+
u in e || (e[u] = []), e[u].push(i);
|
|
734
581
|
}
|
|
735
|
-
return
|
|
582
|
+
return e;
|
|
736
583
|
},
|
|
737
|
-
|
|
738
|
-
configurable: !0,
|
|
739
|
-
writable: !0
|
|
584
|
+
...n
|
|
740
585
|
},
|
|
741
586
|
toMerge: {
|
|
742
|
-
value: function(
|
|
587
|
+
value: function(t = (u) => u.id, e = (u) => ({ ...u, children: u.children || [] }), r = (u, i) => u.children.push(i)) {
|
|
743
588
|
const u = [];
|
|
744
|
-
for (const
|
|
745
|
-
r(u.find((
|
|
589
|
+
for (const i of this)
|
|
590
|
+
r(u.find((s) => t(s) == t(i)) ?? u.push1(e(i)), i);
|
|
746
591
|
return u;
|
|
747
592
|
},
|
|
748
|
-
|
|
749
|
-
configurable: !0,
|
|
750
|
-
writable: !0
|
|
593
|
+
...n
|
|
751
594
|
},
|
|
752
595
|
bytes2hex: {
|
|
753
596
|
value: function() {
|
|
754
|
-
let
|
|
755
|
-
for (let
|
|
756
|
-
|
|
757
|
-
return
|
|
597
|
+
let t = "";
|
|
598
|
+
for (let e = 0; e < this.length; e++)
|
|
599
|
+
t += (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
600
|
+
return t;
|
|
758
601
|
},
|
|
759
|
-
|
|
760
|
-
configurable: !0,
|
|
761
|
-
writable: !0
|
|
602
|
+
...n
|
|
762
603
|
},
|
|
763
604
|
bytes2string: {
|
|
764
605
|
value: function() {
|
|
765
606
|
if (typeof TextDecoder < "u")
|
|
766
607
|
return new TextDecoder().decode(new Uint8Array(this));
|
|
767
|
-
let
|
|
768
|
-
for (let
|
|
769
|
-
|
|
770
|
-
return decodeURIComponent(
|
|
608
|
+
let t = "";
|
|
609
|
+
for (let e = 0; e < this.length; e++)
|
|
610
|
+
t += "%" + (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
611
|
+
return decodeURIComponent(t);
|
|
771
612
|
},
|
|
772
|
-
|
|
773
|
-
configurable: !0,
|
|
774
|
-
writable: !0
|
|
613
|
+
...n
|
|
775
614
|
},
|
|
776
615
|
base64encode: {
|
|
777
|
-
value: function(
|
|
778
|
-
let r = "", u =
|
|
779
|
-
for (let
|
|
780
|
-
const
|
|
781
|
-
r += u.charAt((
|
|
616
|
+
value: function(t = !1, e = !0) {
|
|
617
|
+
let r = "", u = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
618
|
+
for (let i = 2; i < this.length; i += 3) {
|
|
619
|
+
const s = (this[i - 2] << 16) + (this[i - 1] << 8) + this[i];
|
|
620
|
+
r += u.charAt((s & 16515072) >> 18) + u.charAt((s & 258048) >> 12) + u.charAt((s & 4032) >> 6) + u.charAt(s & 63);
|
|
782
621
|
}
|
|
783
622
|
if (this.length % 3 == 2) {
|
|
784
|
-
const
|
|
785
|
-
r += u.charAt((
|
|
623
|
+
const i = (this[this.length - 2] << 16) + (this[this.length - 1] << 8);
|
|
624
|
+
r += u.charAt((i & 16515072) >> 18) + u.charAt((i & 258048) >> 12) + u.charAt((i & 4032) >> 6) + (e === !1 ? "" : "=");
|
|
786
625
|
} else if (this.length % 3 == 1) {
|
|
787
|
-
const
|
|
788
|
-
r += u.charAt((
|
|
626
|
+
const i = this[this.length - 1] << 16;
|
|
627
|
+
r += u.charAt((i & 16515072) >> 18) + u.charAt((i & 258048) >> 12) + (e === !1 ? "" : "==");
|
|
789
628
|
}
|
|
790
629
|
return r;
|
|
791
630
|
},
|
|
792
|
-
|
|
793
|
-
configurable: !0,
|
|
794
|
-
writable: !0
|
|
631
|
+
...n
|
|
795
632
|
},
|
|
796
633
|
toUint8Array: {
|
|
797
634
|
value: function() {
|
|
798
635
|
return new Uint8Array(this);
|
|
799
636
|
},
|
|
800
|
-
|
|
801
|
-
configurable: !0,
|
|
802
|
-
writable: !0
|
|
637
|
+
...n
|
|
803
638
|
},
|
|
804
639
|
// ====== Relational ======
|
|
805
640
|
assoc: {
|
|
806
|
-
value: function(
|
|
807
|
-
const u = this.unique0((
|
|
808
|
-
return this.each0((
|
|
641
|
+
value: function(t, e, r = {}) {
|
|
642
|
+
const u = this.unique0((s) => s[t]), i = u.length == 0 ? {} : typeof r == "function" ? r(u) : r;
|
|
643
|
+
return this.each0((s) => s[e] = i[s[t]] ?? null);
|
|
809
644
|
},
|
|
810
|
-
|
|
811
|
-
configurable: !0,
|
|
812
|
-
writable: !0
|
|
645
|
+
...n
|
|
813
646
|
},
|
|
814
647
|
// ====== Tree ======
|
|
815
648
|
toTree: {
|
|
816
|
-
value: function(
|
|
817
|
-
const {
|
|
818
|
-
|
|
819
|
-
for (const
|
|
820
|
-
|
|
821
|
-
[
|
|
822
|
-
[
|
|
823
|
-
}),
|
|
824
|
-
return
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
configurable: !0,
|
|
828
|
-
writable: !0
|
|
649
|
+
value: function(t = {}) {
|
|
650
|
+
const { id: e = "id", pid: r = "pid", level: u = "level", root: i = "root", parent: s = "parent", children: o = "children", empty: f = null, hasRoot: c = !0 } = t, v = this.toObject((h) => [h[e], h]), g = this.toGroup((h) => [h[r], h]), a = this.length && c ? this.find((h) => h[r] === 0) : { [e]: 0, [r]: -1, [i]: null, [s]: null, [o]: g[0] };
|
|
651
|
+
l(a, { [i]: { value: a, enumerable: !1, configurable: !0, writable: !0 } });
|
|
652
|
+
for (const h of this)
|
|
653
|
+
l(h, {
|
|
654
|
+
[i]: { value: a, enumerable: !1, configurable: !0, writable: !0 },
|
|
655
|
+
[s]: { value: v[h[r]], enumerable: !1, configurable: !0, writable: !0 }
|
|
656
|
+
}), h[o] = g[h[e]] ?? f;
|
|
657
|
+
return a.treeEach0((h) => h[u] = h[s] ? h[s][u] + 1 : 0, -1, o), a;
|
|
658
|
+
},
|
|
659
|
+
...n
|
|
829
660
|
},
|
|
830
661
|
tree2tree: {
|
|
831
|
-
value: function(
|
|
832
|
-
var
|
|
833
|
-
const {
|
|
834
|
-
|
|
835
|
-
for (const
|
|
836
|
-
|
|
837
|
-
[
|
|
838
|
-
[
|
|
839
|
-
}), i
|
|
840
|
-
return
|
|
662
|
+
value: function(t = {}, e = null, r = null) {
|
|
663
|
+
var g;
|
|
664
|
+
const { id: u = "id", pid: i = "pid", level: s = "level", root: o = "root", parent: f = "parent", children: c = "children", empty: v = null } = t;
|
|
665
|
+
e = e ?? { [u]: 0, [i]: -1, [s]: 0, [o]: null, [f]: null, [c]: this }, r = r ?? e;
|
|
666
|
+
for (const a of this)
|
|
667
|
+
l(a, {
|
|
668
|
+
[o]: { value: e, enumerable: !1, configurable: !0, writable: !0 },
|
|
669
|
+
[f]: { value: r, enumerable: !1, configurable: !0, writable: !0 }
|
|
670
|
+
}), a[i] = r[u], a[s] = r[s] + 1, a[c] = a[c] && a[c].length ? a[c] : v, (g = a[c]) == null || g.tree2tree(t, e, a);
|
|
671
|
+
return e;
|
|
841
672
|
},
|
|
842
|
-
|
|
843
|
-
configurable: !0,
|
|
844
|
-
writable: !0
|
|
673
|
+
...n
|
|
845
674
|
},
|
|
846
675
|
treeFind0: {
|
|
847
|
-
value: function(
|
|
848
|
-
for (const
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
return
|
|
676
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
677
|
+
for (const i of this) {
|
|
678
|
+
const s = i.treeFind0(t, e, r, u);
|
|
679
|
+
if (s !== null)
|
|
680
|
+
return s;
|
|
852
681
|
}
|
|
853
682
|
return null;
|
|
854
683
|
},
|
|
855
|
-
|
|
856
|
-
configurable: !0,
|
|
857
|
-
writable: !0
|
|
684
|
+
...n
|
|
858
685
|
},
|
|
859
686
|
treeEach0: {
|
|
860
|
-
value: function(
|
|
861
|
-
for (const
|
|
862
|
-
|
|
687
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
688
|
+
for (const i of this)
|
|
689
|
+
i.treeEach0(t, e, r, u);
|
|
863
690
|
return this;
|
|
864
691
|
},
|
|
865
|
-
|
|
866
|
-
configurable: !0,
|
|
867
|
-
writable: !0
|
|
692
|
+
...n
|
|
868
693
|
},
|
|
869
694
|
treeMap0: {
|
|
870
|
-
value: function(
|
|
871
|
-
return this.map((
|
|
695
|
+
value: function(t, e = !0, r = -1, u = "children", i = null) {
|
|
696
|
+
return this.map((s) => s.treeMap0(t, e, r, u, i));
|
|
872
697
|
},
|
|
873
|
-
|
|
874
|
-
configurable: !0,
|
|
875
|
-
writable: !0
|
|
698
|
+
...n
|
|
876
699
|
}
|
|
877
700
|
});
|
|
878
|
-
|
|
701
|
+
l(ArrayBuffer.prototype, {
|
|
879
702
|
toUint8Array: {
|
|
880
703
|
value: function() {
|
|
881
704
|
return new Uint8Array(this);
|
|
882
705
|
},
|
|
883
|
-
|
|
884
|
-
configurable: !0,
|
|
885
|
-
writable: !0
|
|
706
|
+
...n
|
|
886
707
|
}
|
|
887
708
|
});
|
|
888
|
-
|
|
709
|
+
l(Uint8Array.prototype, {
|
|
889
710
|
bytes2hex: {
|
|
890
711
|
value: Array.prototype.bytes2hex,
|
|
891
|
-
|
|
892
|
-
configurable: !0,
|
|
893
|
-
writable: !0
|
|
712
|
+
...n
|
|
894
713
|
},
|
|
895
714
|
bytes2string: {
|
|
896
715
|
value: Array.prototype.bytes2string,
|
|
897
|
-
|
|
898
|
-
configurable: !0,
|
|
899
|
-
writable: !0
|
|
716
|
+
...n
|
|
900
717
|
},
|
|
901
718
|
base64encode: {
|
|
902
719
|
value: Array.prototype.base64encode,
|
|
903
|
-
|
|
904
|
-
configurable: !0,
|
|
905
|
-
writable: !0
|
|
720
|
+
...n
|
|
906
721
|
},
|
|
907
722
|
toArray: {
|
|
908
723
|
value: function() {
|
|
909
724
|
return new Array(...this);
|
|
910
725
|
},
|
|
911
|
-
|
|
912
|
-
configurable: !0,
|
|
913
|
-
writable: !0
|
|
726
|
+
...n
|
|
914
727
|
}
|
|
915
728
|
});
|
|
916
|
-
|
|
729
|
+
l(Map.prototype, {
|
|
917
730
|
length0: {
|
|
918
731
|
value: function() {
|
|
919
732
|
return this.size;
|
|
920
733
|
},
|
|
921
|
-
|
|
922
|
-
configurable: !0,
|
|
923
|
-
writable: !0
|
|
734
|
+
...n
|
|
924
735
|
},
|
|
925
736
|
entries0: {
|
|
926
737
|
value: function() {
|
|
927
738
|
return [...this.entries()];
|
|
928
739
|
},
|
|
929
|
-
|
|
930
|
-
configurable: !0,
|
|
931
|
-
writable: !0
|
|
740
|
+
...n
|
|
932
741
|
},
|
|
933
742
|
keys0: {
|
|
934
743
|
value: function() {
|
|
935
744
|
return [...this.keys()];
|
|
936
745
|
},
|
|
937
|
-
|
|
938
|
-
configurable: !0,
|
|
939
|
-
writable: !0
|
|
746
|
+
...n
|
|
940
747
|
},
|
|
941
748
|
values0: {
|
|
942
749
|
value: function() {
|
|
943
750
|
return [...this.values()];
|
|
944
751
|
},
|
|
945
|
-
|
|
946
|
-
configurable: !0,
|
|
947
|
-
writable: !0
|
|
752
|
+
...n
|
|
948
753
|
},
|
|
949
754
|
get0: {
|
|
950
|
-
value: function(
|
|
951
|
-
if (this.has(
|
|
952
|
-
return this.get(
|
|
953
|
-
const u = typeof
|
|
954
|
-
return this.set(
|
|
755
|
+
value: function(t, e = null, ...r) {
|
|
756
|
+
if (this.has(t))
|
|
757
|
+
return this.get(t);
|
|
758
|
+
const u = typeof e != "function" ? e : e(t, ...r);
|
|
759
|
+
return this.set(t, u), u;
|
|
955
760
|
},
|
|
956
|
-
|
|
957
|
-
configurable: !0,
|
|
958
|
-
writable: !0
|
|
761
|
+
...n
|
|
959
762
|
},
|
|
960
763
|
get1: {
|
|
961
|
-
value: async function(
|
|
962
|
-
if (this.has(
|
|
963
|
-
return this.get(
|
|
964
|
-
const u = typeof
|
|
965
|
-
return this.set(
|
|
764
|
+
value: async function(t, e = null, ...r) {
|
|
765
|
+
if (this.has(t))
|
|
766
|
+
return this.get(t);
|
|
767
|
+
const u = typeof e != "function" ? e : await e(t, ...r);
|
|
768
|
+
return this.set(t, u), u;
|
|
966
769
|
},
|
|
967
|
-
|
|
968
|
-
configurable: !0,
|
|
969
|
-
writable: !0
|
|
770
|
+
...n
|
|
970
771
|
},
|
|
971
772
|
toObject: {
|
|
972
773
|
value: function() {
|
|
973
774
|
return Object.fromEntries(this);
|
|
974
775
|
},
|
|
975
|
-
|
|
976
|
-
configurable: !0,
|
|
977
|
-
writable: !0
|
|
776
|
+
...n
|
|
978
777
|
},
|
|
979
778
|
toJSON: {
|
|
980
779
|
value: function() {
|
|
981
780
|
return [...this];
|
|
982
781
|
},
|
|
983
|
-
|
|
984
|
-
configurable: !0,
|
|
985
|
-
writable: !0
|
|
782
|
+
...n
|
|
986
783
|
}
|
|
987
784
|
});
|
|
988
|
-
|
|
785
|
+
l(Set.prototype, {
|
|
989
786
|
length0: {
|
|
990
787
|
value: function() {
|
|
991
788
|
return this.size;
|
|
992
789
|
},
|
|
993
|
-
|
|
994
|
-
configurable: !0,
|
|
995
|
-
writable: !0
|
|
790
|
+
...n
|
|
996
791
|
},
|
|
997
792
|
entries0: {
|
|
998
793
|
value: function() {
|
|
999
794
|
return this.entries();
|
|
1000
795
|
},
|
|
1001
|
-
|
|
1002
|
-
configurable: !0,
|
|
1003
|
-
writable: !0
|
|
796
|
+
...n
|
|
1004
797
|
},
|
|
1005
798
|
toArray: {
|
|
1006
799
|
value: function() {
|
|
1007
800
|
return [...this];
|
|
1008
801
|
},
|
|
1009
|
-
|
|
1010
|
-
configurable: !0,
|
|
1011
|
-
writable: !0
|
|
802
|
+
...n
|
|
1012
803
|
},
|
|
1013
804
|
toJSON: {
|
|
1014
805
|
value: function() {
|
|
1015
806
|
return [...this];
|
|
1016
807
|
},
|
|
1017
|
-
|
|
1018
|
-
configurable: !0,
|
|
1019
|
-
writable: !0
|
|
808
|
+
...n
|
|
1020
809
|
}
|
|
1021
810
|
});
|
|
1022
|
-
|
|
811
|
+
l(Date, {
|
|
1023
812
|
new: {
|
|
1024
|
-
value: function(...
|
|
1025
|
-
return
|
|
813
|
+
value: function(...t) {
|
|
814
|
+
return t.length != 1 ? new Date(...t) : Number.isNaN(+t[0]) ? new Date(t[0].includes("T") ? t[0] : t[0].replace(/-/g, "/")) : new Date(t[0] > 25e8 ? t[0] : t[0] * 1e3);
|
|
1026
815
|
},
|
|
1027
|
-
|
|
1028
|
-
configurable: !0,
|
|
1029
|
-
writable: !0
|
|
816
|
+
...n
|
|
1030
817
|
},
|
|
1031
818
|
format: {
|
|
1032
|
-
value: function(
|
|
1033
|
-
return (/* @__PURE__ */ new Date()).format(
|
|
819
|
+
value: function(t = "y-m-d h:i:s") {
|
|
820
|
+
return (/* @__PURE__ */ new Date()).format(t);
|
|
1034
821
|
},
|
|
1035
|
-
|
|
1036
|
-
configurable: !0,
|
|
1037
|
-
writable: !0
|
|
822
|
+
...n
|
|
1038
823
|
},
|
|
1039
824
|
unix: {
|
|
1040
825
|
value: function() {
|
|
1041
826
|
return this.now() / 1e3 | 0;
|
|
1042
827
|
},
|
|
1043
|
-
|
|
1044
|
-
configurable: !0,
|
|
1045
|
-
writable: !0
|
|
828
|
+
...n
|
|
1046
829
|
},
|
|
1047
830
|
fromUnix: {
|
|
1048
|
-
value: function(
|
|
1049
|
-
return this.new((
|
|
831
|
+
value: function(t = 0) {
|
|
832
|
+
return this.new((t || 0) * 1e3);
|
|
1050
833
|
},
|
|
1051
|
-
|
|
1052
|
-
configurable: !0,
|
|
1053
|
-
writable: !0
|
|
834
|
+
...n
|
|
1054
835
|
},
|
|
1055
836
|
expr: {
|
|
1056
|
-
value: function(
|
|
1057
|
-
return (/* @__PURE__ */ new Date()).expr(
|
|
837
|
+
value: function(t = {}) {
|
|
838
|
+
return (/* @__PURE__ */ new Date()).expr(t);
|
|
1058
839
|
},
|
|
1059
|
-
|
|
1060
|
-
configurable: !0,
|
|
1061
|
-
writable: !0
|
|
840
|
+
...n
|
|
1062
841
|
},
|
|
1063
842
|
toDayRange: {
|
|
1064
843
|
value: function() {
|
|
1065
|
-
const
|
|
1066
|
-
return [
|
|
844
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), r = t.getMonth(), u = t.getDate(), i = new Date(e, r, u).getTime() / 1e3 | 0;
|
|
845
|
+
return [i, i + 86400 - 1];
|
|
1067
846
|
},
|
|
1068
|
-
|
|
1069
|
-
configurable: !0,
|
|
1070
|
-
writable: !0
|
|
847
|
+
...n
|
|
1071
848
|
},
|
|
1072
849
|
toWeekRange: {
|
|
1073
850
|
value: function() {
|
|
1074
|
-
let
|
|
1075
|
-
for (;
|
|
1076
|
-
|
|
1077
|
-
const
|
|
1078
|
-
return [
|
|
851
|
+
let t = /* @__PURE__ */ new Date();
|
|
852
|
+
for (; t.getDay() != 1; )
|
|
853
|
+
t = new Date(t.getTime() - 86400);
|
|
854
|
+
const e = t.getFullYear(), r = t.getMonth(), u = t.getDate(), i = new Date(e, r, u).getTime() / 1e3 | 0;
|
|
855
|
+
return [i, i + 86400 * 7 - 1];
|
|
1079
856
|
},
|
|
1080
|
-
|
|
1081
|
-
configurable: !0,
|
|
1082
|
-
writable: !0
|
|
857
|
+
...n
|
|
1083
858
|
},
|
|
1084
859
|
toMonthRange: {
|
|
1085
860
|
value: function() {
|
|
1086
|
-
const
|
|
1087
|
-
return [u,
|
|
861
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), r = t.getMonth(), u = new Date(e, r, 1).getTime() / 1e3 | 0, i = new Date(e, r + 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
862
|
+
return [u, i];
|
|
1088
863
|
},
|
|
1089
|
-
|
|
1090
|
-
configurable: !0,
|
|
1091
|
-
writable: !0
|
|
864
|
+
...n
|
|
1092
865
|
},
|
|
1093
866
|
toYearRange: {
|
|
1094
867
|
value: function() {
|
|
1095
|
-
const
|
|
868
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear(), r = new Date(e, 1, 1).getTime() / 1e3 | 0, u = new Date(e + 1, 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
1096
869
|
return [r, u];
|
|
1097
870
|
},
|
|
1098
|
-
|
|
1099
|
-
configurable: !0,
|
|
1100
|
-
writable: !0
|
|
871
|
+
...n
|
|
1101
872
|
}
|
|
1102
873
|
});
|
|
1103
|
-
|
|
874
|
+
l(Date.prototype, {
|
|
1104
875
|
format: {
|
|
1105
|
-
value: function(
|
|
876
|
+
value: function(t = "y-m-d h:i:s") {
|
|
1106
877
|
if (this.getTime() === 0)
|
|
1107
878
|
return "-";
|
|
1108
|
-
const
|
|
879
|
+
const e = {
|
|
1109
880
|
y: this.getFullYear(),
|
|
1110
881
|
m: this.getMonth() + 1,
|
|
1111
882
|
d: this.getDate(),
|
|
@@ -1115,140 +886,112 @@ Object.defineProperties(Date.prototype, {
|
|
|
1115
886
|
l: this.getMilliseconds(),
|
|
1116
887
|
e: this.getMonthDay()
|
|
1117
888
|
};
|
|
1118
|
-
return
|
|
889
|
+
return t.replace(/([ymdhisle])/ig, (r, u) => u >= "A" && u <= "Z" ? e[u.toLowerCase()] : e[u].toString().padStart(u === "l" ? 3 : 2, "0"));
|
|
1119
890
|
},
|
|
1120
|
-
|
|
1121
|
-
configurable: !0,
|
|
1122
|
-
writable: !0
|
|
891
|
+
...n
|
|
1123
892
|
},
|
|
1124
893
|
unix: {
|
|
1125
894
|
value: function() {
|
|
1126
895
|
return this.getTime() / 1e3 | 0;
|
|
1127
896
|
},
|
|
1128
|
-
|
|
1129
|
-
configurable: !0,
|
|
1130
|
-
writable: !0
|
|
897
|
+
...n
|
|
1131
898
|
},
|
|
1132
899
|
isLeapYear: {
|
|
1133
900
|
value: function() {
|
|
1134
901
|
return this.getFullYear() % 4 === 0 && this.getFullYear() % 400 !== 0;
|
|
1135
902
|
},
|
|
1136
|
-
|
|
1137
|
-
configurable: !0,
|
|
1138
|
-
writable: !0
|
|
903
|
+
...n
|
|
1139
904
|
},
|
|
1140
905
|
getMonthDay: {
|
|
1141
906
|
value: function() {
|
|
1142
907
|
return [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()] || (this.isLeapYear() ? 29 : 28);
|
|
1143
908
|
},
|
|
1144
|
-
|
|
1145
|
-
configurable: !0,
|
|
1146
|
-
writable: !0
|
|
909
|
+
...n
|
|
1147
910
|
},
|
|
1148
911
|
expr: {
|
|
1149
|
-
value: function({ y:
|
|
1150
|
-
const
|
|
1151
|
-
return new Date(this.getFullYear() +
|
|
912
|
+
value: function({ y: t = 0, m: e = 0, d: r = 0, h: u = 0, i = 0, s = 0 }) {
|
|
913
|
+
const o = new Date(this.getFullYear() + t, this.getMonth() + e + 1, 0);
|
|
914
|
+
return new Date(this.getFullYear() + t, this.getMonth() + e, Math.min(o.getDate(), this.getDate()) + r, this.getHours() + u, this.getMinutes() + i, this.getSeconds() + s);
|
|
1152
915
|
},
|
|
1153
|
-
|
|
1154
|
-
configurable: !0,
|
|
1155
|
-
writable: !0
|
|
916
|
+
...n
|
|
1156
917
|
},
|
|
1157
918
|
begin: {
|
|
1158
|
-
value: function(
|
|
1159
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0,
|
|
919
|
+
value: function(t = 3) {
|
|
920
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 0, 1, 0, 0, 0].slice(t));
|
|
1160
921
|
},
|
|
1161
|
-
|
|
1162
|
-
configurable: !0,
|
|
1163
|
-
writable: !0
|
|
922
|
+
...n
|
|
1164
923
|
},
|
|
1165
924
|
end: {
|
|
1166
|
-
value: function(
|
|
1167
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0,
|
|
925
|
+
value: function(t = 3) {
|
|
926
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 11, t < 2 ? 31 : this.getMonthDay(), 23, 59, 59].slice(t));
|
|
1168
927
|
},
|
|
1169
|
-
|
|
1170
|
-
configurable: !0,
|
|
1171
|
-
writable: !0
|
|
928
|
+
...n
|
|
1172
929
|
},
|
|
1173
930
|
week: {
|
|
1174
|
-
value: function(
|
|
931
|
+
value: function(t, e = 1) {
|
|
1175
932
|
let r = new Date(this.getTime());
|
|
1176
|
-
for (; r.getDay() !==
|
|
1177
|
-
r = new Date(r.getTime() + 864e5 *
|
|
933
|
+
for (; r.getDay() !== t; )
|
|
934
|
+
r = new Date(r.getTime() + 864e5 * e);
|
|
1178
935
|
return r;
|
|
1179
936
|
},
|
|
1180
|
-
|
|
1181
|
-
configurable: !0,
|
|
1182
|
-
writable: !0
|
|
937
|
+
...n
|
|
1183
938
|
},
|
|
1184
939
|
toJSON: {
|
|
1185
940
|
value: function() {
|
|
1186
941
|
return this.getTime();
|
|
1187
942
|
},
|
|
1188
|
-
|
|
1189
|
-
configurable: !0,
|
|
1190
|
-
writable: !0
|
|
943
|
+
...n
|
|
1191
944
|
}
|
|
1192
945
|
});
|
|
1193
|
-
|
|
946
|
+
l(RegExp.prototype, {
|
|
1194
947
|
toJSON: {
|
|
1195
948
|
value: function() {
|
|
1196
949
|
return this.toString();
|
|
1197
950
|
},
|
|
1198
|
-
|
|
1199
|
-
configurable: !0,
|
|
1200
|
-
writable: !0
|
|
951
|
+
...n
|
|
1201
952
|
}
|
|
1202
953
|
});
|
|
1203
|
-
|
|
954
|
+
l(Promise.prototype, {
|
|
1204
955
|
tryCatch: {
|
|
1205
956
|
value: function() {
|
|
1206
|
-
return new Promise((
|
|
957
|
+
return new Promise((t) => this.then((e) => t([e, null])).catch((e) => t([null, e])));
|
|
1207
958
|
},
|
|
1208
|
-
|
|
1209
|
-
configurable: !0,
|
|
1210
|
-
writable: !0
|
|
959
|
+
...n
|
|
1211
960
|
}
|
|
1212
961
|
});
|
|
1213
|
-
typeof Promise.withResolvers > "u" &&
|
|
962
|
+
typeof Promise.withResolvers > "u" && l(Promise, {
|
|
1214
963
|
withResolvers: {
|
|
1215
964
|
value: function() {
|
|
1216
|
-
let
|
|
1217
|
-
return { promise: new this((u,
|
|
1218
|
-
|
|
1219
|
-
}), resolve:
|
|
1220
|
-
},
|
|
1221
|
-
|
|
1222
|
-
configurable: !0,
|
|
1223
|
-
writable: !0
|
|
965
|
+
let t = null, e = null;
|
|
966
|
+
return { promise: new this((u, i) => {
|
|
967
|
+
t = u, e = i;
|
|
968
|
+
}), resolve: t, reject: e };
|
|
969
|
+
},
|
|
970
|
+
...n
|
|
1224
971
|
}
|
|
1225
972
|
});
|
|
1226
|
-
|
|
973
|
+
l(Promise, {
|
|
1227
974
|
channel: {
|
|
1228
975
|
value: function() {
|
|
1229
|
-
let
|
|
1230
|
-
return [new this((u,
|
|
1231
|
-
|
|
1232
|
-
}),
|
|
1233
|
-
},
|
|
1234
|
-
|
|
1235
|
-
configurable: !0,
|
|
1236
|
-
writable: !0
|
|
976
|
+
let t = null, e = null;
|
|
977
|
+
return [new this((u, i) => {
|
|
978
|
+
t = u, e = i;
|
|
979
|
+
}), t, e];
|
|
980
|
+
},
|
|
981
|
+
...n
|
|
1237
982
|
}
|
|
1238
983
|
});
|
|
1239
|
-
|
|
984
|
+
l(JSON, {
|
|
1240
985
|
parse0: {
|
|
1241
|
-
value: function(
|
|
986
|
+
value: function(t, e = null) {
|
|
1242
987
|
try {
|
|
1243
|
-
if (typeof
|
|
988
|
+
if (typeof t != "string")
|
|
1244
989
|
throw new Error("not string");
|
|
1245
|
-
return JSON.parse(
|
|
990
|
+
return JSON.parse(t);
|
|
1246
991
|
} catch {
|
|
1247
|
-
return
|
|
992
|
+
return e;
|
|
1248
993
|
}
|
|
1249
994
|
},
|
|
1250
|
-
|
|
1251
|
-
configurable: !0,
|
|
1252
|
-
writable: !0
|
|
995
|
+
...n
|
|
1253
996
|
}
|
|
1254
997
|
});
|