szdl-utils-kit 0.2.8 → 0.2.10
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/index.js +663 -652
- package/dist/index.umd.cjs +2 -2
- package/dist/types/bx-helper.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
var ue = Object.defineProperty;
|
|
2
|
-
var me = (
|
|
3
|
-
var C = (
|
|
4
|
-
if (!
|
|
2
|
+
var me = (y, A, e) => A in y ? ue(y, A, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[A] = e;
|
|
3
|
+
var C = (y, A, e) => (me(y, typeof A != "symbol" ? A + "" : A, e), e), Wt = (y, A, e) => {
|
|
4
|
+
if (!A.has(y))
|
|
5
5
|
throw TypeError("Cannot " + e);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
7
|
+
var h = (y, A, e) => (Wt(y, A, "read from private field"), e ? e.call(y) : A.get(y)), N = (y, A, e) => {
|
|
8
|
+
if (A.has(y))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
var
|
|
10
|
+
A instanceof WeakSet ? A.add(y) : A.set(y, e);
|
|
11
|
+
}, g = (y, A, e, n) => (Wt(y, A, "write to private field"), n ? n.call(y, e) : A.set(y, e), e);
|
|
12
|
+
var _ = (y, A, e) => (Wt(y, A, "access private method"), e);
|
|
13
13
|
var fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
-
function Ne(
|
|
15
|
-
return
|
|
14
|
+
function Ne(y) {
|
|
15
|
+
return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
(function(
|
|
17
|
+
var kt = { exports: {} };
|
|
18
|
+
(function(y, A) {
|
|
19
19
|
(function(e) {
|
|
20
|
-
Array.prototype.indexOf || (Array.prototype.indexOf = function(t,
|
|
21
|
-
var
|
|
22
|
-
for (
|
|
23
|
-
if (this[
|
|
24
|
-
return
|
|
20
|
+
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
|
|
21
|
+
var o, a;
|
|
22
|
+
for (o = s || 0, a = this.length; o < a; o += 1)
|
|
23
|
+
if (this[o] === t)
|
|
24
|
+
return o;
|
|
25
25
|
return -1;
|
|
26
26
|
});
|
|
27
|
-
var
|
|
28
|
-
for (var
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
var
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
var
|
|
38
|
-
t.slice(
|
|
39
|
-
t.charAt(
|
|
40
|
-
t.slice(
|
|
41
|
-
t.charAt(
|
|
42
|
-
t.slice(
|
|
27
|
+
var n = this, i = function(t, s) {
|
|
28
|
+
for (var o = t.toString(); o.length < s; )
|
|
29
|
+
o = "0" + o;
|
|
30
|
+
return o;
|
|
31
|
+
}, c = function(t, s) {
|
|
32
|
+
return s !== e ? (t.year(s.year() || s.year), t.month(s.month() || s.month), t.day(s.day() || s.day), t.hours(s.hours() || s.hours), t.minutes(s.minutes() || s.minutes), t.seconds(s.seconds() || s.seconds), t.milliseconds(s.milliseconds() || s.milliseconds), t) : e;
|
|
33
|
+
}, l = function(t, s) {
|
|
34
|
+
var o, a = "";
|
|
35
|
+
return o = t.slice(s, s + 1), o !== "" && !isNaN(Number(o)) && (a += "%H"), o = t.charAt(s + 2), o !== "" && o === ":" && (a += o), o = t.slice(s + 3, s + 4), o !== "" && !isNaN(Number(o)) && (a += "%M"), o = t.charAt(s + 5), o !== "" && o === ":" && (a += o), o = t.slice(s + 6, s + 7), o !== "" && !isNaN(Number(o)) && (a += "%S"), a;
|
|
36
|
+
}, O = function(t, s) {
|
|
37
|
+
var o, a = [
|
|
38
|
+
t.slice(s, s + 1),
|
|
39
|
+
t.charAt(s + 2),
|
|
40
|
+
t.slice(s + 3, s + 4),
|
|
41
|
+
t.charAt(s + 5),
|
|
42
|
+
t.slice(s + 6, s + 9)
|
|
43
43
|
], M;
|
|
44
|
-
return !isNaN(Number(
|
|
45
|
-
t.slice(
|
|
46
|
-
t.charAt(
|
|
47
|
-
t.slice(
|
|
48
|
-
t.charAt(
|
|
49
|
-
t.slice(
|
|
50
|
-
], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (
|
|
51
|
-
},
|
|
44
|
+
return !isNaN(Number(a[0])) && !isNaN(Number(a[2])) && !isNaN(Number(a[4])) ? (a[1] === "." && a[3] === "." ? o = "%d.%m.%Y" : a[1] === "-" && a[3] === "-" ? o = "%m-%d-%Y" : a[1] === "/" && a[3] === "/" && (o = "%m/%d/%Y"), o) : (M = [
|
|
45
|
+
t.slice(s, s + 3),
|
|
46
|
+
t.charAt(s + 4),
|
|
47
|
+
t.slice(s + 5, s + 6),
|
|
48
|
+
t.charAt(s + 7),
|
|
49
|
+
t.slice(s + 8, s + 9)
|
|
50
|
+
], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (o = "%Y-%m-%d"), o) : "");
|
|
51
|
+
}, m = n.tempus, r, d, S = n.navigator || {}, u = "en", f = {
|
|
52
52
|
en: {
|
|
53
53
|
JANUARY_SHORT: "Jan",
|
|
54
54
|
FEBRUARY_SHORT: "Feb",
|
|
@@ -209,70 +209,70 @@ var Xt = { exports: {} };
|
|
|
209
209
|
FRIDAY_LONG: "Freitag",
|
|
210
210
|
SATURDAY_LONG: "Samstag"
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, G = function() {
|
|
213
213
|
return [
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
214
|
+
f[u].JANUARY_LONG,
|
|
215
|
+
f[u].FEBRUARY_LONG,
|
|
216
|
+
f[u].MARCH_LONG,
|
|
217
|
+
f[u].APRIL_LONG,
|
|
218
|
+
f[u].MAY_LONG,
|
|
219
|
+
f[u].JUNE_LONG,
|
|
220
|
+
f[u].JULY_LONG,
|
|
221
|
+
f[u].AUGUST_LONG,
|
|
222
|
+
f[u].SEPTEMBER_LONG,
|
|
223
|
+
f[u].OCTOBER_LONG,
|
|
224
|
+
f[u].NOVEMBER_LONG,
|
|
225
|
+
f[u].DECEMBER_LONG
|
|
226
226
|
];
|
|
227
|
-
},
|
|
227
|
+
}, ot = function() {
|
|
228
228
|
return [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
229
|
+
f[u].JANUARY_SHORT,
|
|
230
|
+
f[u].FEBRUARY_SHORT,
|
|
231
|
+
f[u].MARCH_SHORT,
|
|
232
|
+
f[u].APRIL_SHORT,
|
|
233
|
+
f[u].MAY_SHORT,
|
|
234
|
+
f[u].JUNE_SHORT,
|
|
235
|
+
f[u].JULY_SHORT,
|
|
236
|
+
f[u].AUGUST_SHORT,
|
|
237
|
+
f[u].SEPTEMBER_SHORT,
|
|
238
|
+
f[u].OCTOBER_SHORT,
|
|
239
|
+
f[u].NOVEMBER_SHORT,
|
|
240
|
+
f[u].DECEMBER_SHORT
|
|
241
241
|
];
|
|
242
242
|
}, Z = function() {
|
|
243
243
|
return [
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
f[u].SUNDAY_LONG,
|
|
245
|
+
f[u].MONDAY_LONG,
|
|
246
|
+
f[u].TUESDAY_LONG,
|
|
247
|
+
f[u].WEDNESDAY_LONG,
|
|
248
|
+
f[u].THURSDAY_LONG,
|
|
249
|
+
f[u].FRIDAY_LONG,
|
|
250
|
+
f[u].SATURDAY_LONG
|
|
251
251
|
];
|
|
252
|
-
},
|
|
252
|
+
}, J = function() {
|
|
253
253
|
return [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
f[u].SUNDAY_SHORT,
|
|
255
|
+
f[u].MONDAY_SHORT,
|
|
256
|
+
f[u].TUESDAY_SHORT,
|
|
257
|
+
f[u].WEDNESDAY_SHORT,
|
|
258
|
+
f[u].THURSDAY_SHORT,
|
|
259
|
+
f[u].FRIDAY_SHORT,
|
|
260
|
+
f[u].SATURDAY_SHORT
|
|
261
261
|
];
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) :
|
|
267
|
-
},
|
|
268
|
-
},
|
|
262
|
+
}, P, St, ht, at, le = function(t, s, o) {
|
|
263
|
+
var a;
|
|
264
|
+
n.XMLHttpRequest ? a = new XMLHttpRequest() : a = new ActiveXObject("Microsoft.XMLHTTP"), a.onreadystatechange = function() {
|
|
265
|
+
a.readyState === 4 && (a.status === 200 ? s && (n.JSON === e ? alert(`Please, include json2 into your project if you want use old browsers!
|
|
266
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(a.responseText))) : o && o(a));
|
|
267
|
+
}, a.open("GET", t, !1), a.send();
|
|
268
|
+
}, I = {
|
|
269
269
|
"%d": {
|
|
270
270
|
format: function(t) {
|
|
271
|
-
return
|
|
271
|
+
return i(t.day() || r.MIN_DAY, 2);
|
|
272
272
|
},
|
|
273
273
|
parse: function(t) {
|
|
274
|
-
var
|
|
275
|
-
return { day: isNaN(
|
|
274
|
+
var s = Number(t);
|
|
275
|
+
return { day: isNaN(s) ? e : s };
|
|
276
276
|
},
|
|
277
277
|
minLength: 2,
|
|
278
278
|
maxLength: 2,
|
|
@@ -280,11 +280,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
280
280
|
},
|
|
281
281
|
"%m": {
|
|
282
282
|
format: function(t) {
|
|
283
|
-
return
|
|
283
|
+
return i(t.month() || r.MIN_MONTH, 2);
|
|
284
284
|
},
|
|
285
285
|
parse: function(t) {
|
|
286
|
-
var
|
|
287
|
-
return { month: isNaN(
|
|
286
|
+
var s = Number(t);
|
|
287
|
+
return { month: isNaN(s) ? e : s };
|
|
288
288
|
},
|
|
289
289
|
minLength: 2,
|
|
290
290
|
maxLength: 2,
|
|
@@ -292,11 +292,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
292
292
|
},
|
|
293
293
|
"%Y": {
|
|
294
294
|
format: function(t) {
|
|
295
|
-
return
|
|
295
|
+
return i(t.year() || r.MIN_YEAR, 4);
|
|
296
296
|
},
|
|
297
297
|
parse: function(t) {
|
|
298
|
-
var
|
|
299
|
-
return { year: isNaN(
|
|
298
|
+
var s = Number(t);
|
|
299
|
+
return { year: isNaN(s) ? e : s };
|
|
300
300
|
},
|
|
301
301
|
minLength: 4,
|
|
302
302
|
maxLength: 4,
|
|
@@ -304,7 +304,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
304
304
|
},
|
|
305
305
|
"%w": {
|
|
306
306
|
format: function(t) {
|
|
307
|
-
return t.dayOfWeek() ||
|
|
307
|
+
return t.dayOfWeek() || r.MIN_DAY_OF_WEEK;
|
|
308
308
|
},
|
|
309
309
|
parse: function() {
|
|
310
310
|
return {};
|
|
@@ -315,8 +315,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
315
315
|
},
|
|
316
316
|
"%a": {
|
|
317
317
|
format: function(t) {
|
|
318
|
-
var
|
|
319
|
-
return
|
|
318
|
+
var s = t.dayOfWeek();
|
|
319
|
+
return at[s !== e ? s : r.MIN_DAY_OF_WEEK];
|
|
320
320
|
},
|
|
321
321
|
parse: function() {
|
|
322
322
|
return {};
|
|
@@ -327,8 +327,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
327
327
|
},
|
|
328
328
|
"%A": {
|
|
329
329
|
format: function(t) {
|
|
330
|
-
var
|
|
331
|
-
return
|
|
330
|
+
var s = t.dayOfWeek();
|
|
331
|
+
return ht[s !== e ? s : r.MIN_DAY_OF_WEEK];
|
|
332
332
|
},
|
|
333
333
|
parse: function() {
|
|
334
334
|
return {};
|
|
@@ -339,12 +339,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
339
339
|
},
|
|
340
340
|
"%b": {
|
|
341
341
|
format: function(t) {
|
|
342
|
-
var
|
|
343
|
-
return
|
|
342
|
+
var s = r.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
343
|
+
return St[s !== e ? s : r.MIN_MONTH];
|
|
344
344
|
},
|
|
345
345
|
parse: function(t) {
|
|
346
|
-
var
|
|
347
|
-
return { month:
|
|
346
|
+
var s = r.monthNames().indexOf(t) + (r.options("monthFromZero") ? 0 : 1);
|
|
347
|
+
return { month: s !== -1 ? s : e };
|
|
348
348
|
},
|
|
349
349
|
minLength: 1,
|
|
350
350
|
maxLength: 999,
|
|
@@ -352,12 +352,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
352
352
|
},
|
|
353
353
|
"%B": {
|
|
354
354
|
format: function(t) {
|
|
355
|
-
var
|
|
356
|
-
return
|
|
355
|
+
var s = r.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
356
|
+
return P[s !== e ? s : r.MIN_MONTH];
|
|
357
357
|
},
|
|
358
358
|
parse: function(t) {
|
|
359
|
-
var
|
|
360
|
-
return { month:
|
|
359
|
+
var s = r.monthNames(!0).indexOf(t) + (r.options("monthFromZero") ? 0 : 1);
|
|
360
|
+
return { month: s !== -1 ? s : e };
|
|
361
361
|
},
|
|
362
362
|
minLength: 1,
|
|
363
363
|
maxLength: 999,
|
|
@@ -365,11 +365,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
365
365
|
},
|
|
366
366
|
"%H": {
|
|
367
367
|
format: function(t) {
|
|
368
|
-
return
|
|
368
|
+
return i(t.hours() || r.MIN_HOURS, 2);
|
|
369
369
|
},
|
|
370
370
|
parse: function(t) {
|
|
371
|
-
var
|
|
372
|
-
return { hours: isNaN(
|
|
371
|
+
var s = Number(t);
|
|
372
|
+
return { hours: isNaN(s) ? e : s };
|
|
373
373
|
},
|
|
374
374
|
minLength: 2,
|
|
375
375
|
maxLength: 2,
|
|
@@ -377,11 +377,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
377
377
|
},
|
|
378
378
|
"%M": {
|
|
379
379
|
format: function(t) {
|
|
380
|
-
return
|
|
380
|
+
return i(t.minutes() || r.MIN_MINUTES, 2);
|
|
381
381
|
},
|
|
382
382
|
parse: function(t) {
|
|
383
|
-
var
|
|
384
|
-
return { minutes: isNaN(
|
|
383
|
+
var s = Number(t);
|
|
384
|
+
return { minutes: isNaN(s) ? e : s };
|
|
385
385
|
},
|
|
386
386
|
minLength: 2,
|
|
387
387
|
maxLength: 2,
|
|
@@ -389,11 +389,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
389
389
|
},
|
|
390
390
|
"%S": {
|
|
391
391
|
format: function(t) {
|
|
392
|
-
return
|
|
392
|
+
return i(t.seconds() || r.MIN_SECONDS, 2);
|
|
393
393
|
},
|
|
394
394
|
parse: function(t) {
|
|
395
|
-
var
|
|
396
|
-
return { seconds: isNaN(
|
|
395
|
+
var s = Number(t);
|
|
396
|
+
return { seconds: isNaN(s) ? e : s };
|
|
397
397
|
},
|
|
398
398
|
minLength: 2,
|
|
399
399
|
maxLength: 2,
|
|
@@ -404,7 +404,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
404
404
|
return t.timestamp();
|
|
405
405
|
},
|
|
406
406
|
parse: function(t) {
|
|
407
|
-
return isNaN(Number(t)) ? {} :
|
|
407
|
+
return isNaN(Number(t)) ? {} : r(Number(t)).get();
|
|
408
408
|
},
|
|
409
409
|
minLength: 1,
|
|
410
410
|
maxLength: 20,
|
|
@@ -412,14 +412,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
412
412
|
},
|
|
413
413
|
"%F": {
|
|
414
414
|
format: function(t) {
|
|
415
|
-
return
|
|
415
|
+
return i(t.year() || r.MIN_YEAR, 4) + "-" + i(t.month() || r.MIN_MONTH, 2) + "-" + i(t.day() || r.MIN_DAY, 2);
|
|
416
416
|
},
|
|
417
417
|
parse: function(t) {
|
|
418
|
-
var
|
|
418
|
+
var s = Number(t.slice(0, 4)), o = Number(t.slice(5, 7)), a = Number(t.slice(8, 10));
|
|
419
419
|
return {
|
|
420
|
-
year:
|
|
421
|
-
month:
|
|
422
|
-
day:
|
|
420
|
+
year: s,
|
|
421
|
+
month: o,
|
|
422
|
+
day: a
|
|
423
423
|
};
|
|
424
424
|
},
|
|
425
425
|
minLength: 10,
|
|
@@ -428,14 +428,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
428
428
|
},
|
|
429
429
|
"%D": {
|
|
430
430
|
format: function(t) {
|
|
431
|
-
return
|
|
431
|
+
return i(t.month() || r.MIN_MONTH, 2) + "/" + i(t.day() || r.MIN_DAY, 2) + "/" + i(t.year() || r.MIN_YEAR, 4);
|
|
432
432
|
},
|
|
433
433
|
parse: function(t) {
|
|
434
|
-
var
|
|
434
|
+
var s = Number(t.slice(0, 2)), o = Number(t.slice(3, 5)), a = Number(t.slice(6, 10));
|
|
435
435
|
return {
|
|
436
|
-
year:
|
|
437
|
-
month:
|
|
438
|
-
day:
|
|
436
|
+
year: a,
|
|
437
|
+
month: s,
|
|
438
|
+
day: o
|
|
439
439
|
};
|
|
440
440
|
},
|
|
441
441
|
minLength: 10,
|
|
@@ -445,8 +445,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
445
445
|
}, Mt = {
|
|
446
446
|
useMilliseconds: !1,
|
|
447
447
|
monthFromZero: !1
|
|
448
|
-
},
|
|
449
|
-
|
|
448
|
+
}, T;
|
|
449
|
+
T = function(t, s, o) {
|
|
450
450
|
return this._d = /* @__PURE__ */ new Date(), this._i = {
|
|
451
451
|
year: !1,
|
|
452
452
|
month: !1,
|
|
@@ -455,56 +455,56 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
455
455
|
minutes: !1,
|
|
456
456
|
seconds: !1,
|
|
457
457
|
milliseconds: !1
|
|
458
|
-
}, t !== e && this.set(t,
|
|
459
|
-
},
|
|
460
|
-
var t = this.month(),
|
|
461
|
-
return this.leapYear() && t === (
|
|
462
|
-
},
|
|
458
|
+
}, t !== e && this.set(t, s, o), this;
|
|
459
|
+
}, T.fn = T.prototype, T.fn.dayCount = function() {
|
|
460
|
+
var t = this.month(), s = r.MAX_DAY_IN_MONTHS[t - (r.options("monthFromZero") ? 0 : 1)];
|
|
461
|
+
return this.leapYear() && t === (r.options("monthFromZero") ? 1 : 2) && (s += 1), s;
|
|
462
|
+
}, T.fn.year = function(t) {
|
|
463
463
|
if (arguments.length !== 0)
|
|
464
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
464
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_YEAR && Number(t) <= r.MAX_YEAR ? (this._d.setFullYear(Number(t)), this._i.year = !1) : this._i.year = Number(t) : (this._d.setFullYear(r.MIN_YEAR), this._i.year = !1);
|
|
465
465
|
else
|
|
466
466
|
return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
|
|
467
467
|
return this;
|
|
468
|
-
},
|
|
468
|
+
}, T.fn.month = function(t) {
|
|
469
469
|
if (arguments.length !== 0)
|
|
470
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
470
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MONTH && Number(t) <= r.MAX_MONTH ? (this._d.setMonth(r.options("monthFromZero") ? Number(t) : Number(t) - 1), this._i.month = !1) : this._i.month = Number(t) : (this._d.setMonth(r.options("monthFromZero") ? r.MIN_MONTH : r.MIN_MONTH - 1), this._i.month = !1);
|
|
471
471
|
else
|
|
472
|
-
return this._i.month === !1 ?
|
|
472
|
+
return this._i.month === !1 ? r.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
|
|
473
473
|
return this;
|
|
474
|
-
},
|
|
474
|
+
}, T.fn.day = function(t) {
|
|
475
475
|
if (arguments.length !== 0)
|
|
476
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
476
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_DAY && Number(t) <= this.dayCount() ? (this._d.setDate(Number(t)), this._i.day = !1) : this._i.day = Number(t) : (this._d.setDate(r.MIN_DAY), this._i.day = !1);
|
|
477
477
|
else
|
|
478
478
|
return this._i.day === !1 ? this._d.getDate() : this._i.day;
|
|
479
479
|
return this;
|
|
480
|
-
},
|
|
480
|
+
}, T.fn.hours = function(t) {
|
|
481
481
|
if (arguments.length !== 0)
|
|
482
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
482
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_HOURS && Number(t) <= r.MAX_HOURS ? (this._d.setHours(Number(t)), this._i.hours = !1) : this._i.hours = Number(t) : (this._d.setHours(r.MIN_HOURS), this._i.hours = !1);
|
|
483
483
|
else
|
|
484
484
|
return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
|
|
485
485
|
return this;
|
|
486
|
-
},
|
|
486
|
+
}, T.fn.minutes = function(t) {
|
|
487
487
|
if (arguments.length !== 0)
|
|
488
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
488
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MINUTES && Number(t) <= r.MAX_MINUTES ? (this._d.setMinutes(Number(t)), this._i.minutes = !1) : this._i.minutes = Number(t) : (this._d.setMinutes(r.MIN_MINUTES), this._i.minutes = !1);
|
|
489
489
|
else
|
|
490
490
|
return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
|
|
491
491
|
return this;
|
|
492
|
-
},
|
|
492
|
+
}, T.fn.seconds = function(t) {
|
|
493
493
|
if (arguments.length !== 0)
|
|
494
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
494
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_SECONDS && Number(t) <= r.MAX_SECONDS ? (this._d.setSeconds(Number(t)), this._i.seconds = !1) : this._i.seconds = Number(t) : (this._d.setSeconds(r.MIN_SECONDS), this._i.seconds = !1);
|
|
495
495
|
else
|
|
496
496
|
return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
|
|
497
497
|
return this;
|
|
498
|
-
},
|
|
498
|
+
}, T.fn.milliseconds = function(t) {
|
|
499
499
|
if (arguments.length !== 0)
|
|
500
|
-
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >=
|
|
500
|
+
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= r.MIN_MILLISECONDS && Number(t) <= r.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(t)), this._i.milliseconds = !1) : this._i.milliseconds = Number(t) : (this._d.setMilliseconds(r.MIN_MILLISECONDS), this._i.milliseconds = !1);
|
|
501
501
|
else
|
|
502
502
|
return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
|
|
503
503
|
return this;
|
|
504
|
-
},
|
|
505
|
-
var t = new Date(this.year(), 0, 1),
|
|
506
|
-
return Math.ceil(((
|
|
507
|
-
},
|
|
504
|
+
}, T.fn.week = function() {
|
|
505
|
+
var t = new Date(this.year(), 0, 1), s = r(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
|
+
return Math.ceil(((s - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
+
}, T.fn.set = function(t, s, o) {
|
|
508
508
|
if (this._i = {
|
|
509
509
|
year: !1,
|
|
510
510
|
month: !1,
|
|
@@ -518,11 +518,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
518
518
|
if (t instanceof Date)
|
|
519
519
|
return this._d = t, this;
|
|
520
520
|
if (typeof t == "number")
|
|
521
|
-
return this._d = new Date(t * (
|
|
522
|
-
if (typeof t == "object" && (t instanceof Array ? (this.day(
|
|
523
|
-
var
|
|
521
|
+
return this._d = new Date(t * (r.options("useMilliseconds") ? 1 : 1e3)), this;
|
|
522
|
+
if (typeof t == "object" && (t instanceof Array ? (this.day(r.MIN_DAY), this.year(t[0]), this.month(t[1]), this.day(t[2]), this.hours(t[3]), this.minutes(t[4]), this.seconds(t[5]), this.milliseconds(t[6])) : (this.day(r.MIN_DAY), this.year(t.year), this.month(t.month), this.day(t.day), this.hours(t.hours), this.minutes(t.minutes), this.seconds(t.seconds), this.milliseconds(t.milliseconds))), typeof t == "string") {
|
|
523
|
+
var a, M = [], E, R, X = [], H = 0, D = 0, L, w, p = {}, b;
|
|
524
524
|
if (t === e)
|
|
525
|
-
return
|
|
525
|
+
return E = c(this, o), E === e && (this._i = {
|
|
526
526
|
year: -1,
|
|
527
527
|
month: -1,
|
|
528
528
|
day: -1,
|
|
@@ -530,26 +530,26 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
530
530
|
minutes: -1,
|
|
531
531
|
seconds: -1,
|
|
532
532
|
milliseconds: -1
|
|
533
|
-
}),
|
|
534
|
-
for (
|
|
535
|
-
if (
|
|
536
|
-
if (R =
|
|
537
|
-
switch (L = 0, w = "",
|
|
533
|
+
}), E;
|
|
534
|
+
for (s === e && (s = r.detectFormat(t)); H < s.length; ) {
|
|
535
|
+
if (s.charAt(H) === "%") {
|
|
536
|
+
if (R = s.charAt(H) + s.charAt(H + 1), I[R] !== e) {
|
|
537
|
+
switch (L = 0, w = "", I[R].type) {
|
|
538
538
|
case "number":
|
|
539
|
-
for (; L <
|
|
540
|
-
w += t.charAt(
|
|
539
|
+
for (; L < I[R].maxLength && D + L < t.length && !isNaN(Number(t.charAt(D + L))); )
|
|
540
|
+
w += t.charAt(D + L), L += 1;
|
|
541
541
|
break;
|
|
542
542
|
case "word":
|
|
543
|
-
for (; L <
|
|
544
|
-
w += t.charAt(
|
|
543
|
+
for (; L < I[R].maxLength && D + L < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(D + L)); )
|
|
544
|
+
w += t.charAt(D + L), L += 1;
|
|
545
545
|
break;
|
|
546
546
|
case "string":
|
|
547
|
-
for (; L <
|
|
548
|
-
w += t.charAt(
|
|
547
|
+
for (; L < I[R].maxLength && D + L < t.length; )
|
|
548
|
+
w += t.charAt(D + L), L += 1;
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
|
-
if (L <
|
|
552
|
-
return
|
|
551
|
+
if (L < I[R].minLength)
|
|
552
|
+
return E = c(this, o), E === e && (this._i = {
|
|
553
553
|
year: -1,
|
|
554
554
|
month: -1,
|
|
555
555
|
day: -1,
|
|
@@ -557,11 +557,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
557
557
|
minutes: -1,
|
|
558
558
|
seconds: -1,
|
|
559
559
|
milliseconds: -1
|
|
560
|
-
}),
|
|
561
|
-
M.push(R),
|
|
560
|
+
}), E;
|
|
561
|
+
M.push(R), X.push(w), L -= 1, D += L, H += 1;
|
|
562
562
|
}
|
|
563
|
-
} else if (t.charAt(
|
|
564
|
-
return
|
|
563
|
+
} else if (t.charAt(D) !== s.charAt(H))
|
|
564
|
+
return E = c(this, o), E === e && (this._i = {
|
|
565
565
|
year: -1,
|
|
566
566
|
month: -1,
|
|
567
567
|
day: -1,
|
|
@@ -569,11 +569,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
569
569
|
minutes: -1,
|
|
570
570
|
seconds: -1,
|
|
571
571
|
milliseconds: -1
|
|
572
|
-
}),
|
|
573
|
-
|
|
572
|
+
}), E;
|
|
573
|
+
H += 1, D += 1;
|
|
574
574
|
}
|
|
575
|
-
for (
|
|
576
|
-
M.hasOwnProperty(
|
|
575
|
+
for (a in M)
|
|
576
|
+
M.hasOwnProperty(a) && I.hasOwnProperty(M[a]) && (b = I[M[a]].parse(X[a]), p = {
|
|
577
577
|
year: b.year !== e ? b.year : p.year,
|
|
578
578
|
month: b.month !== e ? b.month : p.month,
|
|
579
579
|
day: b.day !== e ? b.day : p.day,
|
|
@@ -581,21 +581,21 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
581
581
|
minutes: b.minutes !== e ? b.minutes : p.minutes,
|
|
582
582
|
seconds: b.seconds !== e ? b.seconds : p.seconds
|
|
583
583
|
});
|
|
584
|
-
this.day(
|
|
584
|
+
this.day(r.MIN_DAY), this.year(p.year), this.month(p.month), this.day(p.day), this.hours(p.hours), this.minutes(p.minutes), this.seconds(p.seconds), this.milliseconds(p.milliseconds);
|
|
585
585
|
}
|
|
586
586
|
return this;
|
|
587
|
-
},
|
|
587
|
+
}, T.fn.leapYear = function() {
|
|
588
588
|
var t = this.year();
|
|
589
589
|
return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
|
|
590
|
-
},
|
|
591
|
-
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (
|
|
592
|
-
},
|
|
593
|
-
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (
|
|
594
|
-
},
|
|
590
|
+
}, T.fn.timestamp = function(t) {
|
|
591
|
+
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (r.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : r.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
|
|
592
|
+
}, T.fn.utc = function(t) {
|
|
593
|
+
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (r.options("useMilliseconds") ? 1 : 1e3)), this) : r.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
|
|
594
|
+
}, T.fn.dayOfWeek = function(t) {
|
|
595
595
|
if (t === "long")
|
|
596
|
-
return
|
|
596
|
+
return ht[this._d.getDay()];
|
|
597
597
|
if (t === "short")
|
|
598
|
-
return
|
|
598
|
+
return at[this._d.getDay()];
|
|
599
599
|
if (t === e)
|
|
600
600
|
return this._d.getDay();
|
|
601
601
|
if (t === 0 || t === "Sunday")
|
|
@@ -612,7 +612,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
612
612
|
return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
|
|
613
613
|
if (t === 6 || t === "Saturday")
|
|
614
614
|
return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
|
|
615
|
-
},
|
|
615
|
+
}, T.fn.timezone = function(t) {
|
|
616
616
|
switch (t) {
|
|
617
617
|
case "hours":
|
|
618
618
|
return Math.floor(this._d.getTimezoneOffset() / 60);
|
|
@@ -621,12 +621,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
621
621
|
default:
|
|
622
622
|
return this._d.getTimezoneOffset() * 60;
|
|
623
623
|
}
|
|
624
|
-
},
|
|
624
|
+
}, T.fn.get = function(t) {
|
|
625
625
|
switch (t) {
|
|
626
626
|
case "Date":
|
|
627
627
|
return new Date(
|
|
628
628
|
this.year(),
|
|
629
|
-
this.month() - (
|
|
629
|
+
this.month() - (r.options("monthFromZero") ? 0 : 1),
|
|
630
630
|
this.day(),
|
|
631
631
|
this.hours(),
|
|
632
632
|
this.minutes(),
|
|
@@ -636,7 +636,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
636
636
|
case "DateUTC":
|
|
637
637
|
return new Date(Date.UTC(
|
|
638
638
|
this.year(),
|
|
639
|
-
this.month() - (
|
|
639
|
+
this.month() - (r.options("monthFromZero") ? 0 : 1),
|
|
640
640
|
this.day(),
|
|
641
641
|
this.hours(),
|
|
642
642
|
this.minutes(),
|
|
@@ -670,444 +670,455 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
670
670
|
timestamp: this.timestamp()
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
},
|
|
674
|
-
for (var
|
|
675
|
-
t.charAt(
|
|
676
|
-
return
|
|
677
|
-
},
|
|
673
|
+
}, T.fn.format = function(t) {
|
|
674
|
+
for (var s = 0, o = "", a; s < t.length; )
|
|
675
|
+
t.charAt(s) === "%" ? (a = t.charAt(s) + t.charAt(s + 1), I[a] !== e ? (o += I[a].format(this), s += 1) : o += "%") : o += t.charAt(s), s += 1;
|
|
676
|
+
return o;
|
|
677
|
+
}, T.fn.valid = function() {
|
|
678
678
|
return this._i.year === !1 && this._i.month === !1 && this._i.day === !1 && this._i.hours === !1 && this._i.minutes === !1 && this._i.seconds === !1 && this._i.milliseconds === !1;
|
|
679
|
-
},
|
|
679
|
+
}, T.fn.errors = function() {
|
|
680
680
|
return this._i;
|
|
681
|
-
},
|
|
682
|
-
var
|
|
683
|
-
switch (
|
|
681
|
+
}, T.fn.between = function(t, s) {
|
|
682
|
+
var o = this.timestamp(), a = t.timestamp();
|
|
683
|
+
switch (s) {
|
|
684
684
|
case "year":
|
|
685
|
-
return Math.floor((
|
|
685
|
+
return Math.floor((a - o) / 31556952);
|
|
686
686
|
case "month":
|
|
687
|
-
return Math.floor((
|
|
687
|
+
return Math.floor((a - o) / 2629746);
|
|
688
688
|
case "day":
|
|
689
|
-
return Math.floor((
|
|
689
|
+
return Math.floor((a - o) / 86400);
|
|
690
690
|
case "hours":
|
|
691
|
-
return Math.floor((
|
|
691
|
+
return Math.floor((a - o) / 3600);
|
|
692
692
|
case "minutes":
|
|
693
|
-
return Math.floor((
|
|
693
|
+
return Math.floor((a - o) / 60);
|
|
694
694
|
case "seconds":
|
|
695
|
-
return
|
|
695
|
+
return a - o;
|
|
696
696
|
default:
|
|
697
697
|
return e;
|
|
698
698
|
}
|
|
699
|
-
},
|
|
699
|
+
}, T.fn.calc = function(t) {
|
|
700
700
|
return t.year !== e && this._d.setFullYear(this._d.getFullYear() + t.year), t.month !== e && this._d.setMonth(this._d.getMonth() + t.month), t.day !== e && this._d.setDate(this._d.getDate() + t.day), t.hours !== e && this._d.setHours(this._d.getHours() + t.hours), t.minutes !== e && this._d.setMinutes(this._d.getMinutes() + t.minutes), t.seconds !== e && this._d.setSeconds(this._d.getSeconds() + t.seconds), t.milliseconds !== e && this._d.setMilliseconds(this._d.getMilliseconds() + t.milliseconds), this;
|
|
701
|
-
},
|
|
702
|
-
return new
|
|
703
|
-
},
|
|
701
|
+
}, r = function(t, s, o) {
|
|
702
|
+
return new T(t, s, o);
|
|
703
|
+
}, r.MIN_YEAR = 1e3, r.MAX_YEAR = 3e3, r.MIN_MONTH = 1, r.MAX_MONTH = 12, r.MIN_DAY = 1, r.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], r.MIN_DAY_OF_WEEK = 0, r.MAX_DAY_OF_WEEK = 6, r.MIN_HOURS = 0, r.MAX_HOURS = 23, r.MIN_MINUTES = 0, r.MAX_MINUTES = 59, r.MIN_SECONDS = 0, r.MAX_SECONDS = 59, r.MIN_MILLISECONDS = 0, r.MAX_MILLISECONDS = 999, r.VERSION = "0.2.18", r.options = function(t, s) {
|
|
704
704
|
if (t === e)
|
|
705
705
|
return Mt;
|
|
706
706
|
if (Mt.hasOwnProperty(t)) {
|
|
707
|
-
if (
|
|
707
|
+
if (s === e)
|
|
708
708
|
return Mt[t];
|
|
709
|
-
Mt[t] =
|
|
709
|
+
Mt[t] = s, t === "monthFromZero" && (r.MIN_MONTH = s ? 0 : 1, r.MAX_MONTH = s ? 11 : 12);
|
|
710
710
|
}
|
|
711
711
|
return e;
|
|
712
|
-
},
|
|
713
|
-
return
|
|
714
|
-
},
|
|
715
|
-
var
|
|
716
|
-
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof
|
|
712
|
+
}, r.noConflict = function() {
|
|
713
|
+
return n.tempus = m, r;
|
|
714
|
+
}, r.generate = function(t) {
|
|
715
|
+
var s, o, a, M, E, R, X, H;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof T ? s = t.dateFrom.utc() : s = r(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof T ? o = t.dateTo.utc() : o = r(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? E = {
|
|
717
717
|
year: 0,
|
|
718
718
|
month: 0,
|
|
719
719
|
day: 0,
|
|
720
720
|
hours: 0,
|
|
721
721
|
minutes: 0,
|
|
722
722
|
seconds: t.period
|
|
723
|
-
} : typeof t.period == "string" ?
|
|
723
|
+
} : typeof t.period == "string" ? E = {
|
|
724
724
|
year: t.period === "year" ? 1 : 0,
|
|
725
725
|
month: t.period === "month" ? 1 : 0,
|
|
726
726
|
day: t.period === "day" ? 1 : 0,
|
|
727
727
|
hours: t.period === "hours" ? 1 : 0,
|
|
728
728
|
minutes: t.period === "minutes" ? 1 : 0,
|
|
729
729
|
seconds: t.period === "seconds" ? 1 : 0
|
|
730
|
-
} : typeof t.period == "object" && (
|
|
730
|
+
} : typeof t.period == "object" && (E = {
|
|
731
731
|
year: t.period.year !== e ? t.period.year : 0,
|
|
732
732
|
month: t.period.month !== e ? t.period.month : 0,
|
|
733
733
|
day: t.period.day !== e ? t.period.day : 0,
|
|
734
734
|
hours: t.period.hours !== e ? t.period.hours : 0,
|
|
735
735
|
minutes: t.period.minutes !== e ? t.period.minutes : 0,
|
|
736
736
|
seconds: t.period.seconds !== e ? t.period.seconds : 0
|
|
737
|
-
}), t.groupBy === e ? R = t.asObject === !0 ? {} : [] : (R = [], R.push([]),
|
|
738
|
-
return t.asObject === !0 ? t.format !== e ? w[
|
|
737
|
+
}), t.groupBy === e ? R = t.asObject === !0 ? {} : [] : (R = [], R.push([]), X = r(s).get()[t.groupBy]), H = function(w, p, b) {
|
|
738
|
+
return t.asObject === !0 ? t.format !== e ? w[r(p).format(t.format)] = {} : w[r(p).format("%F %H:%M:%S")] = {} : t.format !== e ? w.push(b ? null : r(p).format(t.format)) : w.push(b ? null : r(p)), w;
|
|
739
739
|
}, t.groupBy !== e && t.fillNulls) {
|
|
740
|
-
var
|
|
741
|
-
year:
|
|
742
|
-
month:
|
|
743
|
-
day:
|
|
744
|
-
hours:
|
|
745
|
-
minutes:
|
|
746
|
-
seconds:
|
|
747
|
-
milliseconds:
|
|
740
|
+
var D = {
|
|
741
|
+
year: E.year ? -E.year : e,
|
|
742
|
+
month: E.month ? -E.month : e,
|
|
743
|
+
day: E.day ? -E.day : e,
|
|
744
|
+
hours: E.hours ? -E.hours : e,
|
|
745
|
+
minutes: E.minutes ? -E.minutes : e,
|
|
746
|
+
seconds: E.seconds ? -E.seconds : e,
|
|
747
|
+
milliseconds: E.milliseconds ? -E.milliseconds : e
|
|
748
748
|
};
|
|
749
|
-
for (
|
|
750
|
-
|
|
749
|
+
for (a = r(s).calc(D).utc(); r(a).get()[t.groupBy] === X; )
|
|
750
|
+
H(R[R.length - 1], a, !0), a = r(a).calc(D).utc();
|
|
751
751
|
if (t.groupBy === "week") {
|
|
752
|
-
var L =
|
|
753
|
-
for (
|
|
754
|
-
|
|
752
|
+
var L = r(s).dayOfWeek();
|
|
753
|
+
for (a = r(s).dayOfWeek(0).utc(); R[0].length < L && a < s; )
|
|
754
|
+
H(R[R.length - 1], a, !0), a = r(a).calc(E).utc();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
for (;
|
|
758
|
-
t.groupBy === e ?
|
|
757
|
+
for (; s <= o; )
|
|
758
|
+
t.groupBy === e ? H(R, s) : r(s).get()[t.groupBy] === X ? H(R[R.length - 1], s) : (R.push([]), H(R[R.length - 1], s), X = r(s).get()[t.groupBy]), s = r(s).calc(E).utc();
|
|
759
759
|
if (t.groupBy !== e && t.fillNulls)
|
|
760
|
-
for (M =
|
|
761
|
-
|
|
760
|
+
for (M = r(o).calc(E).utc(); r(M).get()[t.groupBy] === X; )
|
|
761
|
+
H(R[R.length - 1], M, !0), M = r(M).calc(E).utc();
|
|
762
762
|
return R;
|
|
763
|
-
},
|
|
763
|
+
}, r.monthNames = function(t) {
|
|
764
764
|
switch (t) {
|
|
765
765
|
case "long":
|
|
766
|
-
return
|
|
766
|
+
return P;
|
|
767
767
|
default:
|
|
768
|
-
return
|
|
768
|
+
return St;
|
|
769
769
|
}
|
|
770
|
-
},
|
|
770
|
+
}, r.dayNames = function(t) {
|
|
771
771
|
switch (t) {
|
|
772
772
|
case "long":
|
|
773
|
-
return
|
|
773
|
+
return ht;
|
|
774
774
|
default:
|
|
775
|
-
return
|
|
775
|
+
return at;
|
|
776
776
|
}
|
|
777
|
-
},
|
|
777
|
+
}, r.lang = function(t) {
|
|
778
778
|
if (t !== e)
|
|
779
|
-
|
|
779
|
+
u = t, f[u] === e && (u = "en"), P = G(), St = ot(), ht = Z(), at = J();
|
|
780
780
|
else
|
|
781
|
-
return
|
|
781
|
+
return u;
|
|
782
782
|
return e;
|
|
783
|
-
},
|
|
784
|
-
return Object.keys(
|
|
785
|
-
},
|
|
786
|
-
|
|
787
|
-
format:
|
|
788
|
-
parse:
|
|
789
|
-
minLength:
|
|
783
|
+
}, r.availableLangs = function() {
|
|
784
|
+
return Object.keys(f);
|
|
785
|
+
}, r.registerFormat = function(t, s, o, a, M, E) {
|
|
786
|
+
I[t] = {
|
|
787
|
+
format: s,
|
|
788
|
+
parse: o,
|
|
789
|
+
minLength: a,
|
|
790
790
|
maxLength: M,
|
|
791
|
-
type:
|
|
791
|
+
type: E
|
|
792
792
|
};
|
|
793
|
-
},
|
|
794
|
-
delete
|
|
795
|
-
},
|
|
796
|
-
var
|
|
797
|
-
return
|
|
798
|
-
},
|
|
799
|
-
TempusDate:
|
|
800
|
-
},
|
|
801
|
-
if (
|
|
802
|
-
return
|
|
803
|
-
|
|
804
|
-
},
|
|
805
|
-
typeof t == "object" ?
|
|
806
|
-
|
|
807
|
-
}, function(
|
|
793
|
+
}, r.unregisterFormat = function(t) {
|
|
794
|
+
delete I[t];
|
|
795
|
+
}, r.detectFormat = function(t) {
|
|
796
|
+
var s, o, a;
|
|
797
|
+
return s = O(t, 0), s !== "" && (a = 10), o = t.charAt(a), (o === "T" || o === " ") && (s += o, a += 1), s += l(t, a), s;
|
|
798
|
+
}, d = {
|
|
799
|
+
TempusDate: T
|
|
800
|
+
}, r.classes = function(t, s) {
|
|
801
|
+
if (s === e)
|
|
802
|
+
return d[t];
|
|
803
|
+
d[t] = s;
|
|
804
|
+
}, r.loadTranslations = function(t) {
|
|
805
|
+
typeof t == "object" ? f = t : typeof t == "string" && le(t, function(s) {
|
|
806
|
+
f = s;
|
|
807
|
+
}, function(s) {
|
|
808
808
|
});
|
|
809
|
-
},
|
|
809
|
+
}, u = (S.language || S.systemLanguage || S.userLanguage || "en").substr(0, 2).toLowerCase(), f[u] === e && (u = "en"), P = G(), St = ot(), ht = Z(), at = J(), y.exports && (A = y.exports = r), A.tempus = r;
|
|
810
810
|
}).call(fe);
|
|
811
|
-
})(
|
|
812
|
-
var _e =
|
|
813
|
-
const
|
|
814
|
-
var
|
|
815
|
-
class
|
|
816
|
-
constructor(
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
811
|
+
})(kt, kt.exports);
|
|
812
|
+
var _e = kt.exports;
|
|
813
|
+
const Xt = /* @__PURE__ */ Ne(_e);
|
|
814
|
+
var V, lt, z, Y, k, K, q, B, j, Ht, v, F, $, tt, rt, Lt, ut, xt, mt, jt, ft, Qt, Nt, Zt, _t, Vt, Dt, ee, Yt, Ae, Ot, zt, yt, Kt, Et, qt, it, pt, dt, vt, Bt, se, et, ct, nt, bt, Tt, $t;
|
|
815
|
+
class x {
|
|
816
|
+
constructor(A, e = {}) {
|
|
817
|
+
N(this, rt);
|
|
818
|
+
N(this, ut);
|
|
819
|
+
N(this, mt);
|
|
820
|
+
N(this, ft);
|
|
821
|
+
N(this, Nt);
|
|
822
|
+
N(this, _t);
|
|
823
|
+
N(this, Dt);
|
|
824
|
+
N(this, Yt);
|
|
825
|
+
N(this, Ot);
|
|
826
|
+
N(this, yt);
|
|
827
|
+
N(this, Et);
|
|
828
|
+
N(this, it);
|
|
829
|
+
N(this, dt);
|
|
830
|
+
N(this, Bt);
|
|
831
|
+
N(this, et);
|
|
832
|
+
N(this, nt);
|
|
833
|
+
N(this, Tt);
|
|
834
|
+
N(this, V, null);
|
|
835
|
+
N(this, lt, null);
|
|
836
|
+
N(this, z, []);
|
|
837
|
+
N(this, Y, {});
|
|
838
|
+
N(this, k, 50);
|
|
839
|
+
N(this, K, !0);
|
|
840
|
+
N(this, q, null);
|
|
841
|
+
N(this, B, null);
|
|
842
|
+
N(this, j, null);
|
|
843
|
+
N(this, Ht, 100);
|
|
844
|
+
N(this, v, "no");
|
|
845
|
+
N(this, F, !1);
|
|
846
|
+
N(this, $, !1);
|
|
847
|
+
N(this, tt, !1);
|
|
848
848
|
C(this, "errors", {});
|
|
849
849
|
C(this, "answerData", {});
|
|
850
|
-
|
|
850
|
+
g(this, V, A), g(this, lt, e);
|
|
851
851
|
}
|
|
852
852
|
get serial() {
|
|
853
|
-
return
|
|
853
|
+
return h(this, F);
|
|
854
854
|
}
|
|
855
855
|
setSerial() {
|
|
856
|
-
|
|
856
|
+
g(this, F, !0), g(this, $, !0), g(this, tt, !1);
|
|
857
857
|
}
|
|
858
858
|
setParallel() {
|
|
859
|
-
|
|
859
|
+
g(this, F, !1), g(this, $, !1), g(this, tt, !0);
|
|
860
860
|
}
|
|
861
861
|
stop() {
|
|
862
|
-
|
|
862
|
+
g(this, K, !1);
|
|
863
863
|
}
|
|
864
|
-
async batch(
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
-
if (Object.keys(
|
|
868
|
-
const
|
|
869
|
-
return Promise.allSettled(
|
|
870
|
-
let
|
|
871
|
-
for (let
|
|
872
|
-
|
|
873
|
-
return
|
|
864
|
+
async batch(A, e) {
|
|
865
|
+
h(this, j) && _(this, ut, xt).call(this), e && g(this, q, e), h(this, $) === !1 && g(this, F, !1), Object.keys(A).length > 500 && g(this, F, !0), g(this, K, !0), g(this, z, []), g(this, Y, {}), this.errors = {}, this.answerData = {};
|
|
866
|
+
const n = _(this, ft, Qt).call(this, A);
|
|
867
|
+
if (Object.keys(A).length < 500) {
|
|
868
|
+
const i = n.map((c, l) => _(this, Nt, Zt).call(this, c, n[l]));
|
|
869
|
+
return Promise.allSettled(i).then((c) => {
|
|
870
|
+
let l = {};
|
|
871
|
+
for (let O of c)
|
|
872
|
+
O.status === "fulfilled" && (l = { ...l, ...O.value });
|
|
873
|
+
return l;
|
|
874
874
|
});
|
|
875
875
|
} else {
|
|
876
|
-
let
|
|
877
|
-
|
|
876
|
+
let i = {}, c = 0, l = 1, O = Object.keys(A).length || 1, m = (r) => {
|
|
877
|
+
c += Object.keys(r).length, l = Math.round(c / O * 100);
|
|
878
878
|
};
|
|
879
|
-
for (let [
|
|
880
|
-
let
|
|
881
|
-
|
|
879
|
+
for (let [r, d] of Object.entries(n)) {
|
|
880
|
+
let S = await _(this, Nt, Zt).call(this, d, n[r], !0);
|
|
881
|
+
m(d), e && e({ percent: l }), i = { ...i, ...S };
|
|
882
882
|
}
|
|
883
|
-
return
|
|
883
|
+
return i;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
async batchTotalCount(
|
|
887
|
-
|
|
888
|
-
let
|
|
889
|
-
|
|
886
|
+
async batchTotalCount(A, e) {
|
|
887
|
+
g(this, Y, {}), this.errors = {};
|
|
888
|
+
let n = 1, i = 0, c = Object.keys(A).length || 1, l = (m) => {
|
|
889
|
+
i += Object.keys(m).length, n = Math.round(i / c * 100);
|
|
890
890
|
};
|
|
891
|
-
e && e({ percent:
|
|
892
|
-
const
|
|
893
|
-
if (
|
|
894
|
-
const
|
|
895
|
-
return Promise.allSettled(
|
|
896
|
-
let
|
|
897
|
-
for (let
|
|
898
|
-
|
|
899
|
-
return
|
|
891
|
+
e && e({ percent: n });
|
|
892
|
+
const O = _(this, ft, Qt).call(this, A);
|
|
893
|
+
if (h(this, tt)) {
|
|
894
|
+
const m = O.map((r) => _(this, _t, Vt).call(this, r).then((d) => (l(r), e && e({ percent: n }), d)));
|
|
895
|
+
return Promise.allSettled(m).then((r) => {
|
|
896
|
+
let d = {};
|
|
897
|
+
for (let S of r)
|
|
898
|
+
S.status === "fulfilled" && (d = { ...d, ...S.value });
|
|
899
|
+
return d;
|
|
900
900
|
});
|
|
901
901
|
} else {
|
|
902
|
-
let
|
|
903
|
-
for (let
|
|
904
|
-
let
|
|
905
|
-
|
|
902
|
+
let m = {};
|
|
903
|
+
for (let r of O) {
|
|
904
|
+
let d = await _(this, _t, Vt).call(this, r);
|
|
905
|
+
l(r), e && e({ percent: n }), m = { ...m, ...d };
|
|
906
906
|
}
|
|
907
|
-
return
|
|
907
|
+
return m;
|
|
908
908
|
}
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
|
|
912
|
-
let
|
|
913
|
-
if (!
|
|
914
|
-
return Math.round(
|
|
915
|
-
let e = 0,
|
|
916
|
-
return Object.values(
|
|
917
|
-
const { total:
|
|
918
|
-
e +=
|
|
919
|
-
}), e ?
|
|
920
|
-
},
|
|
921
|
-
clearInterval(
|
|
922
|
-
},
|
|
923
|
-
const
|
|
924
|
-
let
|
|
925
|
-
|
|
926
|
-
const { percent:
|
|
927
|
-
(
|
|
928
|
-
data:
|
|
929
|
-
percent:
|
|
930
|
-
allCount:
|
|
931
|
-
allTotal:
|
|
932
|
-
}),
|
|
933
|
-
},
|
|
934
|
-
},
|
|
935
|
-
const e = [],
|
|
936
|
-
for (let
|
|
937
|
-
const
|
|
938
|
-
e.push(Object.fromEntries(
|
|
911
|
+
V = new WeakMap(), lt = new WeakMap(), z = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), K = new WeakMap(), q = new WeakMap(), B = new WeakMap(), j = new WeakMap(), Ht = new WeakMap(), v = new WeakMap(), F = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), rt = new WeakSet(), Lt = function() {
|
|
912
|
+
let A = 0;
|
|
913
|
+
if (!h(this, B))
|
|
914
|
+
return Math.round(A);
|
|
915
|
+
let e = 0, n = 0;
|
|
916
|
+
return Object.values(h(this, B)).forEach((i) => {
|
|
917
|
+
const { total: c, count: l } = i;
|
|
918
|
+
e += c ?? 0, n += l ?? 0;
|
|
919
|
+
}), e ? A = n / e * 100 : A = 100, { percent: Math.round(A), allCount: n, allTotal: e };
|
|
920
|
+
}, ut = new WeakSet(), xt = function() {
|
|
921
|
+
clearInterval(h(this, j)), g(this, j, ""), g(this, B, ""), g(this, q, ""), g(this, v, "no");
|
|
922
|
+
}, mt = new WeakSet(), jt = function({ key: A, value: e }) {
|
|
923
|
+
const n = _(this, et, ct).call(this, e.data()), i = Array.isArray(n) ? n.length : 0, c = _(this, nt, bt).call(this, e.total(), i);
|
|
924
|
+
let l = 1;
|
|
925
|
+
n && (l = i), h(this, q) && (h(this, B) || g(this, B, {}), h(this, B)[A] && h(this, B)[A].count && (l += h(this, B)[A].count), h(this, B)[A] = { total: c, count: l }, h(this, j) || g(this, j, setInterval(() => {
|
|
926
|
+
const { percent: O, allCount: m, allTotal: r } = h(this, rt, Lt);
|
|
927
|
+
(h(this, v) === "no" || h(this, v) < h(this, rt, Lt).percent) && (h(this, q).call(this, {
|
|
928
|
+
data: h(this, B),
|
|
929
|
+
percent: O,
|
|
930
|
+
allCount: m,
|
|
931
|
+
allTotal: r
|
|
932
|
+
}), g(this, v, h(this, rt, Lt).percent)), O === 100 && _(this, ut, xt).call(this);
|
|
933
|
+
}, h(this, Ht))));
|
|
934
|
+
}, ft = new WeakSet(), Qt = function(A) {
|
|
935
|
+
const e = [], n = Object.entries(A);
|
|
936
|
+
for (let i = 0; i < n.length; i += h(this, k)) {
|
|
937
|
+
const c = n.slice(i, i + h(this, k));
|
|
938
|
+
e.push(Object.fromEntries(c));
|
|
939
939
|
}
|
|
940
940
|
return e;
|
|
941
|
-
},
|
|
942
|
-
return new Promise((
|
|
943
|
-
const
|
|
944
|
-
let
|
|
945
|
-
|
|
946
|
-
Object.entries(
|
|
947
|
-
let
|
|
948
|
-
const
|
|
949
|
-
if (
|
|
950
|
-
let { query: { method:
|
|
951
|
-
this.errors[
|
|
941
|
+
}, Nt = new WeakSet(), Zt = function(A, e, n) {
|
|
942
|
+
return new Promise((i) => {
|
|
943
|
+
const c = _(this, dt, vt).call(this, e), l = [];
|
|
944
|
+
let O = 0, m = 0;
|
|
945
|
+
h(this, V).call(this, A, (r) => {
|
|
946
|
+
Object.entries(r).forEach(([d, S]) => {
|
|
947
|
+
let u = {};
|
|
948
|
+
const f = S.error();
|
|
949
|
+
if (f) {
|
|
950
|
+
let { query: { method: J }, answer: P } = S;
|
|
951
|
+
this.errors[d] = { error: f, method: J }, O += 1;
|
|
952
952
|
}
|
|
953
|
-
if (
|
|
954
|
-
for (let [
|
|
955
|
-
|
|
956
|
-
Object.keys(
|
|
953
|
+
if (S != null && S.answer && Object.keys(S.answer).length) {
|
|
954
|
+
for (let [J, P] of Object.entries(S.answer))
|
|
955
|
+
J != "result" && P && (u[J] = P);
|
|
956
|
+
Object.keys(u).length && (this.answerData[d] = u);
|
|
957
957
|
}
|
|
958
|
-
const
|
|
959
|
-
if (Array.isArray(
|
|
960
|
-
const
|
|
961
|
-
|
|
958
|
+
const G = _(this, et, ct).call(this, S.data()), ot = Array.isArray(G) ? G.length : 0, Z = _(this, nt, bt).call(this, S.total(), ot);
|
|
959
|
+
if (Array.isArray(G) ? h(this, Y)[d] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? h(this, Y)[d] = [] : h(this, Y)[d] = G, m += Z, n || _(this, mt, jt).call(this, { key: d, value: S }), Z > h(this, k) && Z > ot) {
|
|
960
|
+
const J = Math.ceil(Z / h(this, k)) - 1, P = Array.from({ length: J });
|
|
961
|
+
l.push([d, c[d], P]);
|
|
962
962
|
}
|
|
963
|
-
}),
|
|
963
|
+
}), m > 5e3 && h(this, $) === !1 && h(this, tt) === !1 && g(this, F, !0), O > 0 && _(this, Tt, $t).call(this), l.length ? (_(this, Dt, ee).call(this, l), _(this, Yt, Ae).call(this).then(() => i(_(this, it, pt).call(this)))) : i(_(this, it, pt).call(this));
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
|
-
},
|
|
966
|
+
}, _t = new WeakSet(), Vt = function(A) {
|
|
967
967
|
return new Promise((e) => {
|
|
968
|
-
const
|
|
969
|
-
let
|
|
970
|
-
|
|
971
|
-
Object.entries(
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
}),
|
|
968
|
+
const n = _(this, dt, vt).call(this, A);
|
|
969
|
+
let i = 0;
|
|
970
|
+
h(this, V).call(this, n, (c) => {
|
|
971
|
+
Object.entries(c).forEach(([l, O]) => {
|
|
972
|
+
const m = O.error();
|
|
973
|
+
m && (this.errors[l] = m, i += 1);
|
|
974
|
+
const r = _(this, et, ct).call(this, O.data()), d = Array.isArray(r) ? r.length : 0, S = _(this, nt, bt).call(this, O.total(), d);
|
|
975
|
+
h(this, Y)[l] = S;
|
|
976
|
+
}), i > 0 && _(this, Tt, $t).call(this), e(_(this, it, pt).call(this));
|
|
977
977
|
});
|
|
978
978
|
});
|
|
979
|
-
},
|
|
979
|
+
}, Dt = new WeakSet(), ee = function(A) {
|
|
980
980
|
let e = [];
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
e.length ===
|
|
981
|
+
A.forEach(([n, i, c]) => {
|
|
982
|
+
c.forEach((l, O) => {
|
|
983
|
+
const m = O + 1, r = h(this, k) * m, S = [[n, m].join("_"), _(this, Bt, se).call(this, i, r)];
|
|
984
|
+
e.length === h(this, k) ? (h(this, z).push(e), e = [S]) : e.push(S);
|
|
985
985
|
});
|
|
986
|
-
}), e.length &&
|
|
987
|
-
}, Yt = new WeakSet(),
|
|
988
|
-
const
|
|
989
|
-
Object.entries(
|
|
990
|
-
const [
|
|
991
|
-
Array.isArray(
|
|
986
|
+
}), e.length && h(this, z).push(e);
|
|
987
|
+
}, Yt = new WeakSet(), Ae = function() {
|
|
988
|
+
const A = [], e = [], n = (i) => {
|
|
989
|
+
Object.entries(i).forEach(([c, l]) => {
|
|
990
|
+
const [O] = c.split("_"), m = _(this, et, ct).call(this, l.data());
|
|
991
|
+
Array.isArray(m) && h(this, Y)[O].push(...m), _(this, mt, jt).call(this, { key: O, value: l });
|
|
992
992
|
});
|
|
993
993
|
};
|
|
994
|
-
return
|
|
995
|
-
const
|
|
996
|
-
|
|
994
|
+
return h(this, z).forEach((i, c) => {
|
|
995
|
+
const l = Object.fromEntries(i), O = () => new Promise((m) => h(this, V).call(this, l, (r) => {
|
|
996
|
+
h(this, F) ? n(r) : e[c] = r, m();
|
|
997
997
|
}));
|
|
998
|
-
|
|
999
|
-
}),
|
|
1000
|
-
e.forEach(
|
|
998
|
+
A.push(O);
|
|
999
|
+
}), h(this, F) ? _(this, yt, Kt).call(this, A) : _(this, Et, qt).call(this, A).then(() => {
|
|
1000
|
+
e.forEach(n);
|
|
1001
1001
|
});
|
|
1002
|
-
},
|
|
1003
|
-
return new Promise((
|
|
1004
|
-
},
|
|
1005
|
-
if (!
|
|
1002
|
+
}, Ot = new WeakSet(), zt = function() {
|
|
1003
|
+
return new Promise((A) => setTimeout(A, 500));
|
|
1004
|
+
}, yt = new WeakSet(), Kt = function(A) {
|
|
1005
|
+
if (!A.length)
|
|
1006
1006
|
return Promise.resolve();
|
|
1007
|
-
const e =
|
|
1007
|
+
const e = A.shift();
|
|
1008
1008
|
return Promise.allSettled([
|
|
1009
1009
|
e(),
|
|
1010
|
-
|
|
1011
|
-
]).then(() =>
|
|
1012
|
-
},
|
|
1013
|
-
if (!
|
|
1010
|
+
_(this, Ot, zt).call(this)
|
|
1011
|
+
]).then(() => h(this, K) ? _(this, yt, Kt).call(this, A) : Promise.resolve());
|
|
1012
|
+
}, Et = new WeakSet(), qt = function(A) {
|
|
1013
|
+
if (!A.length)
|
|
1014
1014
|
return Promise.resolve();
|
|
1015
|
-
const e =
|
|
1016
|
-
return
|
|
1017
|
-
},
|
|
1018
|
-
return Object.entries(
|
|
1019
|
-
|
|
1020
|
-
}),
|
|
1021
|
-
},
|
|
1022
|
-
return Object.entries(
|
|
1023
|
-
if (Array.isArray(
|
|
1024
|
-
const [
|
|
1025
|
-
e[
|
|
1015
|
+
const e = A.shift();
|
|
1016
|
+
return _(this, Ot, zt).call(this).then(() => e()).then(() => h(this, K) ? _(this, Et, qt).call(this, A) : Promise.resolve());
|
|
1017
|
+
}, it = new WeakSet(), pt = function() {
|
|
1018
|
+
return Object.entries(h(this, lt)).forEach(([A, e]) => {
|
|
1019
|
+
h(this, Y)[A] && (h(this, Y)[A] = e(h(this, Y)[A]));
|
|
1020
|
+
}), h(this, Y);
|
|
1021
|
+
}, dt = new WeakSet(), vt = function(A) {
|
|
1022
|
+
return Object.entries(A).reduce((e, [n, i]) => {
|
|
1023
|
+
if (Array.isArray(i)) {
|
|
1024
|
+
const [c, l = {}] = i;
|
|
1025
|
+
e[n] = [c, l];
|
|
1026
1026
|
} else {
|
|
1027
|
-
const { method:
|
|
1028
|
-
e[
|
|
1027
|
+
const { method: c, params: l = {} } = i;
|
|
1028
|
+
e[n] = [c, l];
|
|
1029
1029
|
}
|
|
1030
1030
|
return e;
|
|
1031
1031
|
}, {});
|
|
1032
|
-
},
|
|
1033
|
-
const [
|
|
1034
|
-
return [
|
|
1035
|
-
}, et = new WeakSet(),
|
|
1036
|
-
return ((
|
|
1037
|
-
},
|
|
1038
|
-
return
|
|
1039
|
-
},
|
|
1040
|
-
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([
|
|
1041
|
-
console.info(`[${
|
|
1032
|
+
}, Bt = new WeakSet(), se = function(A, e) {
|
|
1033
|
+
const [n, i] = A;
|
|
1034
|
+
return [n, { start: e, ...i }];
|
|
1035
|
+
}, et = new WeakSet(), ct = function(A) {
|
|
1036
|
+
return ((A == null ? void 0 : A.items) || (A == null ? void 0 : A.documents)) ?? A;
|
|
1037
|
+
}, nt = new WeakSet(), bt = function(A, e) {
|
|
1038
|
+
return A !== A && (A = 0), A === 0 && e === 0 ? 0 : A || e;
|
|
1039
|
+
}, Tt = new WeakSet(), $t = function() {
|
|
1040
|
+
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([A, e]) => {
|
|
1041
|
+
console.info(`[${A}]`, e.toString());
|
|
1042
1042
|
}), console.groupEnd();
|
|
1043
1043
|
};
|
|
1044
|
-
var
|
|
1045
|
-
class
|
|
1044
|
+
var At;
|
|
1045
|
+
class re {
|
|
1046
1046
|
constructor() {
|
|
1047
|
-
|
|
1047
|
+
N(this, At, {});
|
|
1048
1048
|
}
|
|
1049
1049
|
get hash() {
|
|
1050
1050
|
return this.createHash(8);
|
|
1051
1051
|
}
|
|
1052
1052
|
/** Генератор хеш-кода */
|
|
1053
|
-
createHash(
|
|
1054
|
-
let e = "abcdefghijklmnopqrstuvwxyz0123456789",
|
|
1055
|
-
|
|
1056
|
-
for (let
|
|
1057
|
-
|
|
1058
|
-
return
|
|
1053
|
+
createHash(A) {
|
|
1054
|
+
let e = "abcdefghijklmnopqrstuvwxyz0123456789", n = "";
|
|
1055
|
+
A = A || 6;
|
|
1056
|
+
for (let i = 0; i < A; i++)
|
|
1057
|
+
n += e.charAt(Math.floor(Math.random() * e.length));
|
|
1058
|
+
return n;
|
|
1059
1059
|
}
|
|
1060
1060
|
/** Фильтр часто запускаемых действий */
|
|
1061
|
-
actionFilter({ keyTimer:
|
|
1062
|
-
|
|
1063
|
-
|
|
1061
|
+
actionFilter({ keyTimer: A, duration: e = 10, action: n }) {
|
|
1062
|
+
h(this, At)[A] && (clearTimeout(h(this, At)[A]), h(this, At)[A] = null), n && (h(this, At)[A] = setTimeout(() => {
|
|
1063
|
+
n();
|
|
1064
1064
|
}, e));
|
|
1065
1065
|
}
|
|
1066
|
+
/** Включение режима NO-SLEEP */
|
|
1067
|
+
noSleep() {
|
|
1068
|
+
let A = document.createElement("video");
|
|
1069
|
+
A.classList.add("no-sleep"), A.src = "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAP5tZGF0AAAAAQYAAADlZYiEE28FmH9jNWDBjI+Z/1tIBZsjfhbmcNNUpBFej0U3p+zhaJ3eemJRL2LUMa5tkidy6bp+eatLE3jBIY864TvaAmqEFCgLMTCwVbem1n3myAw9yDXQdR5HfU/8iYf+eneVnRf7Qx9M70XDUuPx1MJX671XJwAE0VAMpnhbcUDx0pTldvUX9KQPhkZNH3eyZHmObkAeyEJ2tl+BEBJIGc90BiqKL60+5EA6fXB6iG5UU/M5KsW8BNAAUw5CbRJIqohNk10fwKbUXwya03rqGkE8+wuYGtEbrVYXb+iOl1mHHVPLYQbIAAcGyAAHAAAFNG1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAAvAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAIldHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAFAAAAA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAAAAAAAAAAAQAAAAABnW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAUhtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEIc3RibAAAAKRzdHNkAAAAAAAAAAEAAACUYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAU1AC//hABZnTUAL2wUH7ARAAAADAEAAAAQDxQq4AQAFaOrAZXIAAAAQcGFzcAAAAAEAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAO4AAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAAIadHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAgAAAAAAAAAvAAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAALwAAAAAAAQAAAAABkm1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAArEQAAAgAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAT1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAQFzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAAC7gAAAAViBYCAgAISCAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAAACAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAgAAAAEAAAAUc3RzegAAAAAAAAAEAAAAAgAAABRzdGNvAAAAAAAAAAEAAAEeAAAAGnNncGQBAAAAcm9sbAAAAAIAAAAB//8AAAAcc2JncAAAAAByb2xsAAAAAQAAAAIAAAABAAAAgXVkdGEAAAB5bWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWR0YQAAAAAAAAAAAAAAAAAAAAAfa2V5cwAAAAAAAAABAAAAD21kdGFlbmNvZGVyAAAALWlsc3QAAAAlAAAAAQAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw", A.addEventListener("ended", () => {
|
|
1070
|
+
this.actionFilter({
|
|
1071
|
+
keyTimer: "no-sleep",
|
|
1072
|
+
duration: 5e3,
|
|
1073
|
+
action: () => A.play()
|
|
1074
|
+
});
|
|
1075
|
+
}), A.style.position = "fixed", A.style.left = "-9999px", document.querySelector("body").append(A), A.play();
|
|
1076
|
+
}
|
|
1066
1077
|
}
|
|
1067
|
-
|
|
1068
|
-
const
|
|
1069
|
-
var
|
|
1070
|
-
class
|
|
1078
|
+
At = new WeakMap();
|
|
1079
|
+
const Jt = new re();
|
|
1080
|
+
var W, Q, It, st, gt, Ut, ie, Rt, te, Gt, ne, wt, oe, Ct, he;
|
|
1081
|
+
class Oe {
|
|
1071
1082
|
constructor() {
|
|
1072
|
-
|
|
1083
|
+
N(this, Ut);
|
|
1073
1084
|
/** Вывод ошибок логера
|
|
1074
1085
|
* @param {'entity'} type - тип ошибки
|
|
1075
1086
|
*/
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1087
|
+
N(this, Rt);
|
|
1088
|
+
N(this, Gt);
|
|
1089
|
+
N(this, wt);
|
|
1090
|
+
N(this, Ct);
|
|
1091
|
+
N(this, W, "logger");
|
|
1092
|
+
N(this, Q, !1);
|
|
1093
|
+
N(this, It, 2e3);
|
|
1094
|
+
N(this, st, /* @__PURE__ */ new Map());
|
|
1095
|
+
N(this, gt, {});
|
|
1085
1096
|
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1086
1097
|
C(this, "periodClear", 3);
|
|
1087
|
-
|
|
1098
|
+
_(this, Ut, ie).call(this);
|
|
1088
1099
|
}
|
|
1089
1100
|
/** Инициализация логера */
|
|
1090
1101
|
async init() {
|
|
1091
|
-
let
|
|
1102
|
+
let A = new x(BX24.callBatch), { entityList: e } = await A.batch({
|
|
1092
1103
|
entityList: { method: "entity.get" }
|
|
1093
1104
|
});
|
|
1094
1105
|
if (e != null && e.length)
|
|
1095
|
-
if (e.find((
|
|
1096
|
-
|
|
1106
|
+
if (e.find((i) => i.ENTITY == h(this, W)))
|
|
1107
|
+
g(this, Q, !0);
|
|
1097
1108
|
else {
|
|
1098
|
-
let { entityAdd:
|
|
1109
|
+
let { entityAdd: i } = await A.batch({
|
|
1099
1110
|
entityAdd: {
|
|
1100
1111
|
method: "entity.add",
|
|
1101
1112
|
params: {
|
|
1102
|
-
ENTITY:
|
|
1103
|
-
NAME:
|
|
1113
|
+
ENTITY: h(this, W),
|
|
1114
|
+
NAME: h(this, W),
|
|
1104
1115
|
ACCESS: { AU: "X" }
|
|
1105
1116
|
}
|
|
1106
1117
|
}
|
|
1107
1118
|
});
|
|
1108
|
-
|
|
1119
|
+
i && g(this, Q, !0);
|
|
1109
1120
|
}
|
|
1110
|
-
return
|
|
1121
|
+
return _(this, wt, oe).call(this), h(this, Q);
|
|
1111
1122
|
}
|
|
1112
1123
|
/**
|
|
1113
1124
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1118,21 +1129,21 @@ class ye {
|
|
|
1118
1129
|
* }; }}
|
|
1119
1130
|
* @returns {string}
|
|
1120
1131
|
*/
|
|
1121
|
-
start({ type:
|
|
1122
|
-
if (!
|
|
1123
|
-
|
|
1132
|
+
start({ type: A, data: e }) {
|
|
1133
|
+
if (!h(this, Q)) {
|
|
1134
|
+
_(this, Rt, te).call(this, "entity");
|
|
1124
1135
|
return;
|
|
1125
1136
|
}
|
|
1126
|
-
const
|
|
1127
|
-
return
|
|
1128
|
-
type:
|
|
1137
|
+
const n = Jt.hash;
|
|
1138
|
+
return h(this, st).set(n, {
|
|
1139
|
+
type: A,
|
|
1129
1140
|
data: e,
|
|
1130
|
-
userInfo:
|
|
1141
|
+
userInfo: h(this, gt),
|
|
1131
1142
|
errorList: [],
|
|
1132
1143
|
status: "",
|
|
1133
1144
|
answer: null,
|
|
1134
1145
|
date: (/* @__PURE__ */ new Date()).getTime()
|
|
1135
|
-
}),
|
|
1146
|
+
}), n;
|
|
1136
1147
|
}
|
|
1137
1148
|
/**
|
|
1138
1149
|
* @param {{
|
|
@@ -1141,98 +1152,98 @@ class ye {
|
|
|
1141
1152
|
* status: 'success'|'fail'|'fail-runtime',
|
|
1142
1153
|
* answer: { [key]: unknown } }}
|
|
1143
1154
|
*/
|
|
1144
|
-
stop({ key:
|
|
1145
|
-
if (!
|
|
1146
|
-
|
|
1155
|
+
stop({ key: A, errorList: e, status: n, answer: i }) {
|
|
1156
|
+
if (!h(this, Q)) {
|
|
1157
|
+
_(this, Rt, te).call(this, "entity");
|
|
1147
1158
|
return;
|
|
1148
1159
|
}
|
|
1149
|
-
let
|
|
1150
|
-
e && (
|
|
1160
|
+
let c = h(this, st).get(A);
|
|
1161
|
+
e && (c.errorList = e), n && (c.status = n), i && (c.answer = i), Jt.actionFilter({
|
|
1151
1162
|
keyTimer: "add.entity.items",
|
|
1152
|
-
duration:
|
|
1163
|
+
duration: h(this, It),
|
|
1153
1164
|
action: () => {
|
|
1154
|
-
|
|
1165
|
+
_(this, Gt, ne).call(this);
|
|
1155
1166
|
}
|
|
1156
1167
|
});
|
|
1157
1168
|
}
|
|
1158
1169
|
async getEntityList() {
|
|
1159
|
-
let
|
|
1170
|
+
let A = new x(BX24.callBatch), { entityList: e } = await A.batch({
|
|
1160
1171
|
entityList: {
|
|
1161
1172
|
method: "entity.item.get",
|
|
1162
1173
|
params: {
|
|
1163
|
-
ENTITY:
|
|
1174
|
+
ENTITY: h(this, W),
|
|
1164
1175
|
SORT: { ID: "DESC" }
|
|
1165
1176
|
}
|
|
1166
1177
|
}
|
|
1167
1178
|
});
|
|
1168
|
-
return e = e.map((
|
|
1169
|
-
const { ID:
|
|
1179
|
+
return e = e.map((n) => {
|
|
1180
|
+
const { ID: i, DATE_CREATE: c, DETAIL_TEXT: l } = n;
|
|
1170
1181
|
return {
|
|
1171
|
-
...JSON.parse(
|
|
1172
|
-
id:
|
|
1173
|
-
dateCreate:
|
|
1182
|
+
...JSON.parse(l),
|
|
1183
|
+
id: i,
|
|
1184
|
+
dateCreate: c
|
|
1174
1185
|
};
|
|
1175
1186
|
}), e;
|
|
1176
1187
|
}
|
|
1177
1188
|
}
|
|
1178
|
-
|
|
1179
|
-
const
|
|
1189
|
+
W = new WeakMap(), Q = new WeakMap(), It = new WeakMap(), st = new WeakMap(), gt = new WeakMap(), Ut = new WeakSet(), ie = async function() {
|
|
1190
|
+
const A = new x(BX24.callBatch), e = BX24.isAdmin(), { curUser: n } = await A.batch({
|
|
1180
1191
|
curUser: { method: "user.current" }
|
|
1181
1192
|
});
|
|
1182
|
-
|
|
1183
|
-
}, Rt = new WeakSet(), te = function(
|
|
1184
|
-
|
|
1193
|
+
g(this, gt, { isAdmin: e, curUser: n });
|
|
1194
|
+
}, Rt = new WeakSet(), te = function(A) {
|
|
1195
|
+
A == "entity" && Jt.actionFilter({
|
|
1185
1196
|
keyTimer: "error.logger.entity",
|
|
1186
1197
|
duration: 500,
|
|
1187
1198
|
action: () => {
|
|
1188
1199
|
console.error("Хранилище для логгера не инициализировано");
|
|
1189
1200
|
}
|
|
1190
1201
|
});
|
|
1191
|
-
},
|
|
1192
|
-
let
|
|
1193
|
-
for (let [
|
|
1194
|
-
|
|
1202
|
+
}, Gt = new WeakSet(), ne = async function() {
|
|
1203
|
+
let A = {}, e = new x(BX24.callBatch);
|
|
1204
|
+
for (let [n, i] of h(this, st).entries())
|
|
1205
|
+
i.status && (A[n] = {
|
|
1195
1206
|
method: "entity.item.add",
|
|
1196
1207
|
params: {
|
|
1197
|
-
ENTITY:
|
|
1198
|
-
NAME:
|
|
1199
|
-
DETAIL_TEXT: JSON.stringify(
|
|
1208
|
+
ENTITY: h(this, W),
|
|
1209
|
+
NAME: h(this, W),
|
|
1210
|
+
DETAIL_TEXT: JSON.stringify(i)
|
|
1200
1211
|
}
|
|
1201
1212
|
});
|
|
1202
|
-
if (Object.keys(
|
|
1203
|
-
let
|
|
1204
|
-
for (let [
|
|
1205
|
-
|
|
1213
|
+
if (Object.keys(A).length) {
|
|
1214
|
+
let n = await e.batch(A), { errors: i } = e;
|
|
1215
|
+
for (let [c, l] of Object.entries({ ...n, ...i }))
|
|
1216
|
+
h(this, st).delete(c);
|
|
1206
1217
|
}
|
|
1207
1218
|
}, wt = new WeakSet(), oe = async function() {
|
|
1208
|
-
let
|
|
1219
|
+
let A = new x(BX24.callBatch), e = await this.getEntityList(), { serverTime: n } = await A.batch({
|
|
1209
1220
|
serverTime: { method: "server.time" }
|
|
1210
|
-
}),
|
|
1211
|
-
let { dateCreate:
|
|
1212
|
-
return
|
|
1221
|
+
}), i = e.filter((c) => {
|
|
1222
|
+
let { dateCreate: l } = c;
|
|
1223
|
+
return Xt(new Date(l)).between(Xt(new Date(n)), "month") >= this.periodClear;
|
|
1213
1224
|
});
|
|
1214
|
-
|
|
1215
|
-
}, Ct = new WeakSet(), he = async function(
|
|
1216
|
-
let e = new
|
|
1217
|
-
let { id:
|
|
1225
|
+
_(this, Ct, he).call(this, i);
|
|
1226
|
+
}, Ct = new WeakSet(), he = async function(A) {
|
|
1227
|
+
let e = new x(BX24.callBatch), n = A.map((i) => {
|
|
1228
|
+
let { id: c } = i;
|
|
1218
1229
|
return {
|
|
1219
1230
|
method: "entity.item.delete",
|
|
1220
1231
|
params: {
|
|
1221
|
-
ENTITY:
|
|
1222
|
-
ID:
|
|
1232
|
+
ENTITY: h(this, W),
|
|
1233
|
+
ID: c
|
|
1223
1234
|
}
|
|
1224
1235
|
};
|
|
1225
1236
|
});
|
|
1226
|
-
return await e.batch(
|
|
1237
|
+
return await e.batch(n);
|
|
1227
1238
|
};
|
|
1228
|
-
const
|
|
1229
|
-
var
|
|
1230
|
-
class
|
|
1231
|
-
constructor(
|
|
1239
|
+
const U = new Oe();
|
|
1240
|
+
var Ft, ae, Pt, ce;
|
|
1241
|
+
class Ee {
|
|
1242
|
+
constructor(A) {
|
|
1232
1243
|
/** Запрос данных о приложении */
|
|
1233
|
-
|
|
1244
|
+
N(this, Ft);
|
|
1234
1245
|
/** Запрос данных о текущем пользователе */
|
|
1235
|
-
|
|
1246
|
+
N(this, Pt);
|
|
1236
1247
|
C(this, "domain", "");
|
|
1237
1248
|
C(this, "isAdmin", !1);
|
|
1238
1249
|
C(this, "appInfo", null);
|
|
@@ -1240,24 +1251,24 @@ class Te {
|
|
|
1240
1251
|
C(this, "userInfo", null);
|
|
1241
1252
|
C(this, "placeData", null);
|
|
1242
1253
|
C(this, "placeInfo", null);
|
|
1243
|
-
this.appConst =
|
|
1254
|
+
this.appConst = A;
|
|
1244
1255
|
}
|
|
1245
1256
|
init() {
|
|
1246
|
-
return new Promise((
|
|
1257
|
+
return new Promise((A) => {
|
|
1247
1258
|
let e = setInterval(() => {
|
|
1248
1259
|
window.BX24 && BX24.init(async () => {
|
|
1249
|
-
console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await
|
|
1250
|
-
const [
|
|
1251
|
-
|
|
1252
|
-
|
|
1260
|
+
console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await U.init();
|
|
1261
|
+
const [n, i] = await Promise.all([
|
|
1262
|
+
_(this, Ft, ae).call(this),
|
|
1263
|
+
_(this, Pt, ce).call(this)
|
|
1253
1264
|
]);
|
|
1254
|
-
this.appInfo =
|
|
1265
|
+
this.appInfo = n, this.userInfo = i, new re().noSleep(), A(!0);
|
|
1255
1266
|
});
|
|
1256
1267
|
}, 100);
|
|
1257
1268
|
});
|
|
1258
1269
|
}
|
|
1259
|
-
userOption(
|
|
1260
|
-
return e ? BX24.userOption.set(
|
|
1270
|
+
userOption(A, e) {
|
|
1271
|
+
return e ? BX24.userOption.set(A, e) : BX24.userOption.get(A);
|
|
1261
1272
|
}
|
|
1262
1273
|
/**
|
|
1263
1274
|
* @param {{
|
|
@@ -1271,32 +1282,32 @@ class Te {
|
|
|
1271
1282
|
* }[]
|
|
1272
1283
|
* }[]
|
|
1273
1284
|
*/
|
|
1274
|
-
call({ method:
|
|
1275
|
-
let
|
|
1285
|
+
call({ method: A, params: e, updateList: n }) {
|
|
1286
|
+
let i = U.start({
|
|
1276
1287
|
type: "call",
|
|
1277
|
-
data: { method:
|
|
1288
|
+
data: { method: A, params: e, updateList: n }
|
|
1278
1289
|
});
|
|
1279
|
-
return new Promise((
|
|
1280
|
-
e || (e = {}), BX24.callMethod(
|
|
1281
|
-
let
|
|
1282
|
-
if (
|
|
1283
|
-
for (let [
|
|
1284
|
-
|
|
1285
|
-
if (
|
|
1286
|
-
let
|
|
1287
|
-
console.error(
|
|
1288
|
-
answer:
|
|
1289
|
-
key:
|
|
1290
|
+
return new Promise((c) => {
|
|
1291
|
+
e || (e = {}), BX24.callMethod(A, e, function(l) {
|
|
1292
|
+
let O = {};
|
|
1293
|
+
if (l != null && l.answer)
|
|
1294
|
+
for (let [m, r] of Object.entries(l.answer))
|
|
1295
|
+
m != "result" && r && (O[m] = r);
|
|
1296
|
+
if (l.error()) {
|
|
1297
|
+
let m = l.error();
|
|
1298
|
+
console.error(m), U.stop({
|
|
1299
|
+
answer: O,
|
|
1300
|
+
key: i,
|
|
1290
1301
|
status: "fail",
|
|
1291
|
-
errorList: [
|
|
1292
|
-
}),
|
|
1302
|
+
errorList: [m.toSting()]
|
|
1303
|
+
}), c(!1);
|
|
1293
1304
|
} else {
|
|
1294
|
-
let
|
|
1295
|
-
|
|
1296
|
-
answer:
|
|
1297
|
-
key:
|
|
1305
|
+
let m = l.data();
|
|
1306
|
+
m != null && m.items && (m = m.items), U.stop({
|
|
1307
|
+
answer: O,
|
|
1308
|
+
key: i,
|
|
1298
1309
|
status: "success"
|
|
1299
|
-
}),
|
|
1310
|
+
}), c(m);
|
|
1300
1311
|
}
|
|
1301
1312
|
});
|
|
1302
1313
|
});
|
|
@@ -1312,116 +1323,116 @@ class Te {
|
|
|
1312
1323
|
* }[]
|
|
1313
1324
|
* }[] }}
|
|
1314
1325
|
*/
|
|
1315
|
-
async batch(
|
|
1316
|
-
let
|
|
1326
|
+
async batch(A, e, { updateList: n, errorCall: i } = {}) {
|
|
1327
|
+
let c = new x(BX24.callBatch), l = U.start({
|
|
1317
1328
|
type: "batch",
|
|
1318
|
-
data: { commandList:
|
|
1329
|
+
data: { commandList: A, updateList: n }
|
|
1319
1330
|
});
|
|
1320
1331
|
try {
|
|
1321
|
-
let
|
|
1322
|
-
if (Object.keys(
|
|
1323
|
-
let
|
|
1324
|
-
key:
|
|
1325
|
-
error:
|
|
1332
|
+
let O = await c.batch(A, e);
|
|
1333
|
+
if (Object.keys(c.errors).length) {
|
|
1334
|
+
let m = Object.entries(c.errors).map(([r, d]) => ({
|
|
1335
|
+
key: r,
|
|
1336
|
+
error: d.toSting()
|
|
1326
1337
|
}));
|
|
1327
|
-
|
|
1328
|
-
key:
|
|
1338
|
+
i && i(c.errors), U.stop({
|
|
1339
|
+
key: l,
|
|
1329
1340
|
status: "fail",
|
|
1330
|
-
errorList:
|
|
1331
|
-
answer:
|
|
1341
|
+
errorList: m,
|
|
1342
|
+
answer: c.answerData
|
|
1332
1343
|
});
|
|
1333
1344
|
} else
|
|
1334
|
-
|
|
1335
|
-
key:
|
|
1345
|
+
U.stop({
|
|
1346
|
+
key: l,
|
|
1336
1347
|
status: "success",
|
|
1337
|
-
answer:
|
|
1348
|
+
answer: c.answerData
|
|
1338
1349
|
});
|
|
1339
|
-
return
|
|
1340
|
-
} catch (
|
|
1341
|
-
return
|
|
1342
|
-
key:
|
|
1350
|
+
return O;
|
|
1351
|
+
} catch (O) {
|
|
1352
|
+
return U.stop({
|
|
1353
|
+
key: l,
|
|
1343
1354
|
status: "fail-runtime",
|
|
1344
|
-
errorList: [
|
|
1345
|
-
answer:
|
|
1346
|
-
}), console.error(
|
|
1355
|
+
errorList: [O.toSting()],
|
|
1356
|
+
answer: c.answerData
|
|
1357
|
+
}), console.error(O), !1;
|
|
1347
1358
|
}
|
|
1348
1359
|
}
|
|
1349
1360
|
/**
|
|
1350
1361
|
* @param commandList - объект/массив команд
|
|
1351
1362
|
* @param progressCall - callback(data), в data приходят данные о загрузке данных
|
|
1352
1363
|
*/
|
|
1353
|
-
async batchTotalCount(
|
|
1354
|
-
let
|
|
1364
|
+
async batchTotalCount(A, e) {
|
|
1365
|
+
let n = new x(BX24.callBatch), i = U.start({
|
|
1355
1366
|
type: "batch",
|
|
1356
|
-
data: { commandList:
|
|
1367
|
+
data: { commandList: A }
|
|
1357
1368
|
});
|
|
1358
1369
|
try {
|
|
1359
|
-
let
|
|
1360
|
-
if (Object.keys(
|
|
1361
|
-
let
|
|
1362
|
-
key:
|
|
1363
|
-
error:
|
|
1370
|
+
let c = await n.batchTotalCount(A, e);
|
|
1371
|
+
if (Object.keys(n.errors).length) {
|
|
1372
|
+
let l = Object.entries(n.errors).map(([O, m]) => ({
|
|
1373
|
+
key: O,
|
|
1374
|
+
error: m.toSting()
|
|
1364
1375
|
}));
|
|
1365
|
-
|
|
1366
|
-
key:
|
|
1376
|
+
U.stop({
|
|
1377
|
+
key: i,
|
|
1367
1378
|
status: "fail",
|
|
1368
|
-
errorList:
|
|
1379
|
+
errorList: l
|
|
1369
1380
|
});
|
|
1370
1381
|
} else
|
|
1371
|
-
|
|
1372
|
-
key:
|
|
1382
|
+
U.stop({
|
|
1383
|
+
key: i,
|
|
1373
1384
|
status: "success"
|
|
1374
1385
|
});
|
|
1375
|
-
return
|
|
1376
|
-
} catch (
|
|
1377
|
-
return
|
|
1378
|
-
key:
|
|
1386
|
+
return c;
|
|
1387
|
+
} catch (c) {
|
|
1388
|
+
return U.stop({
|
|
1389
|
+
key: i,
|
|
1379
1390
|
status: "fail",
|
|
1380
|
-
errorList: [
|
|
1381
|
-
}), console.error(
|
|
1391
|
+
errorList: [c.toSting()]
|
|
1392
|
+
}), console.error(c), !1;
|
|
1382
1393
|
}
|
|
1383
1394
|
}
|
|
1384
1395
|
/** Запрос данных о местах встройки приложения */
|
|
1385
1396
|
getPlacement() {
|
|
1386
|
-
return this.call({ method: "placement.get" }).then((
|
|
1397
|
+
return this.call({ method: "placement.get" }).then((A) => (this.placeData || (this.placeData = A), A));
|
|
1387
1398
|
}
|
|
1388
1399
|
/** Встройка приложения в place */
|
|
1389
|
-
async placementBind(
|
|
1400
|
+
async placementBind(A) {
|
|
1390
1401
|
this.placeData || (this.placeData = await this.getPlacement());
|
|
1391
|
-
const { appName: e, pathApp:
|
|
1392
|
-
let
|
|
1393
|
-
|
|
1394
|
-
window.placementUnBind[
|
|
1402
|
+
const { appName: e, pathApp: n } = this.appConst, i = this.placeData.map((l) => l.placement);
|
|
1403
|
+
let c = this.placeData.find((l) => l.placement == A);
|
|
1404
|
+
i.includes(A) ? c.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[A] || this.placementUnBind(c).then(() => {
|
|
1405
|
+
window.placementUnBind[A] || (window.placementUnBind[A] = !0, this.placementBind(A));
|
|
1395
1406
|
})) : this.call({
|
|
1396
1407
|
method: "placement.bind",
|
|
1397
1408
|
params: {
|
|
1398
|
-
PLACEMENT:
|
|
1399
|
-
HANDLER:
|
|
1409
|
+
PLACEMENT: A,
|
|
1410
|
+
HANDLER: n,
|
|
1400
1411
|
LANG_ALL: {
|
|
1401
1412
|
ru: {
|
|
1402
1413
|
TITLE: e
|
|
1403
1414
|
}
|
|
1404
1415
|
}
|
|
1405
1416
|
}
|
|
1406
|
-
}).then((
|
|
1407
|
-
|
|
1417
|
+
}).then((l) => {
|
|
1418
|
+
l ? console.info("Приложение успешно встроено в", A) : console.warn("Приложение не может быть встроено в", A);
|
|
1408
1419
|
});
|
|
1409
1420
|
}
|
|
1410
1421
|
/** Отвязка встройки из place */
|
|
1411
|
-
placementUnBind(
|
|
1412
|
-
const { pathApp: e, appName:
|
|
1422
|
+
placementUnBind(A) {
|
|
1423
|
+
const { pathApp: e, appName: n } = this.appConst;
|
|
1413
1424
|
return this.call({
|
|
1414
1425
|
method: "placement.unbind",
|
|
1415
1426
|
params: {
|
|
1416
|
-
PLACEMENT:
|
|
1427
|
+
PLACEMENT: A,
|
|
1417
1428
|
HANDLER: e,
|
|
1418
1429
|
LANG_ALL: {
|
|
1419
1430
|
ru: {
|
|
1420
|
-
TITLE:
|
|
1431
|
+
TITLE: n
|
|
1421
1432
|
}
|
|
1422
1433
|
}
|
|
1423
1434
|
}
|
|
1424
|
-
}).then((
|
|
1435
|
+
}).then((i) => (console.log("Встройка отвязана", A), i));
|
|
1425
1436
|
}
|
|
1426
1437
|
/** Чат-бот */
|
|
1427
1438
|
/* получение списка ботов */
|
|
@@ -1429,22 +1440,22 @@ class Te {
|
|
|
1429
1440
|
return this.call({
|
|
1430
1441
|
method: "imbot.bot.list",
|
|
1431
1442
|
params: {}
|
|
1432
|
-
}).then((
|
|
1433
|
-
let e = Object.values(
|
|
1443
|
+
}).then((A) => {
|
|
1444
|
+
let e = Object.values(A);
|
|
1434
1445
|
return console.log("chat-bot list:", e), e;
|
|
1435
1446
|
});
|
|
1436
1447
|
}
|
|
1437
1448
|
/* регистрация бота */
|
|
1438
|
-
regBot({ code:
|
|
1439
|
-
const { appName:
|
|
1449
|
+
regBot({ code: A, type: e, name: n }) {
|
|
1450
|
+
const { appName: i, pathApp: c, chatBotLogo: l } = this.appConst, O = this.appInfo.ID;
|
|
1440
1451
|
return this.call({
|
|
1441
1452
|
method: "imbot.register",
|
|
1442
1453
|
params: {
|
|
1443
|
-
CODE:
|
|
1454
|
+
CODE: A ?? this.appInfo.CODE,
|
|
1444
1455
|
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1445
1456
|
TYPE: e ?? "O",
|
|
1446
1457
|
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1447
|
-
EVENT_HANDLER:
|
|
1458
|
+
EVENT_HANDLER: c,
|
|
1448
1459
|
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1449
1460
|
OPENLINE: "Y",
|
|
1450
1461
|
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|
|
@@ -1452,7 +1463,7 @@ class Te {
|
|
|
1452
1463
|
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1453
1464
|
PROPERTIES: {
|
|
1454
1465
|
// Личные данные чат-бота (обяз.)
|
|
1455
|
-
NAME: `${
|
|
1466
|
+
NAME: `${n ?? i} - бот #${O}`,
|
|
1456
1467
|
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1457
1468
|
LAST_NAME: "",
|
|
1458
1469
|
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
@@ -1460,7 +1471,7 @@ class Te {
|
|
|
1460
1471
|
// Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
|
|
1461
1472
|
EMAIL: "",
|
|
1462
1473
|
// E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
|
|
1463
|
-
PERSONAL_BIRTHDAY:
|
|
1474
|
+
PERSONAL_BIRTHDAY: Xt().format("%Y-%m-%d"),
|
|
1464
1475
|
// День рождения в формате YYYY-mm-dd
|
|
1465
1476
|
WORK_POSITION: "Почтальон",
|
|
1466
1477
|
// Занимаемая должность, используется как описание чат-бота
|
|
@@ -1468,31 +1479,31 @@ class Te {
|
|
|
1468
1479
|
// Ссылка на сайт
|
|
1469
1480
|
PERSONAL_GENDER: "M",
|
|
1470
1481
|
// Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
|
|
1471
|
-
PERSONAL_PHOTO:
|
|
1482
|
+
PERSONAL_PHOTO: l ?? ""
|
|
1472
1483
|
// Аватар чат-бота - base64
|
|
1473
1484
|
}
|
|
1474
1485
|
}
|
|
1475
|
-
}).then((
|
|
1486
|
+
}).then((m) => (console.log("Чат-бот добавлен", m), m));
|
|
1476
1487
|
}
|
|
1477
1488
|
/* Убрать регистрацию бота */
|
|
1478
|
-
unRegBot(
|
|
1489
|
+
unRegBot(A) {
|
|
1479
1490
|
return this.call({
|
|
1480
1491
|
method: "imbot.unregister",
|
|
1481
1492
|
params: {
|
|
1482
|
-
BOT_ID:
|
|
1493
|
+
BOT_ID: A
|
|
1483
1494
|
}
|
|
1484
1495
|
}).then((e) => (console.log("чат-бот удален", e), e));
|
|
1485
1496
|
}
|
|
1486
1497
|
}
|
|
1487
|
-
|
|
1498
|
+
Ft = new WeakSet(), ae = function() {
|
|
1488
1499
|
return this.call({ method: "app.info" });
|
|
1489
|
-
},
|
|
1500
|
+
}, Pt = new WeakSet(), ce = function() {
|
|
1490
1501
|
return this.call({ method: "user.current" });
|
|
1491
1502
|
};
|
|
1492
1503
|
export {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1504
|
+
x as Batch,
|
|
1505
|
+
Ee as BxBoot,
|
|
1506
|
+
re as BxHelper,
|
|
1507
|
+
Oe as BxLogger,
|
|
1508
|
+
Xt as tempus
|
|
1498
1509
|
};
|