szdl-utils-kit 0.2.4 → 0.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/index.js +203 -199
- package/dist/index.umd.cjs +2 -2
- package/dist/types/bx-boot.d.ts +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var a = (A, s, e) => (Jt(A, s, "read from private field"), e ? e.call(A) : s.get
|
|
|
8
8
|
if (s.has(A))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
s instanceof WeakSet ? s.add(A) : s.set(A, e);
|
|
11
|
-
},
|
|
11
|
+
}, E = (A, s, e, o) => (Jt(A, s, "write to private field"), o ? o.call(A, e) : s.set(A, e), e);
|
|
12
12
|
var O = (A, s, e) => (Jt(A, s, "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
14
|
function Ne(A) {
|
|
@@ -28,9 +28,9 @@ var Xt = { exports: {} };
|
|
|
28
28
|
for (var h = t.toString(); h.length < r; )
|
|
29
29
|
h = "0" + h;
|
|
30
30
|
return h;
|
|
31
|
-
}, u = function(t, r) {
|
|
32
|
-
return r !== e ? (t.year(r.year() || r.year), t.month(r.month() || r.month), t.day(r.day() || r.day), t.hours(r.hours() || r.hours), t.minutes(r.minutes() || r.minutes), t.seconds(r.seconds() || r.seconds), t.milliseconds(r.milliseconds() || r.milliseconds), t) : e;
|
|
33
31
|
}, l = function(t, r) {
|
|
32
|
+
return r !== e ? (t.year(r.year() || r.year), t.month(r.month() || r.month), t.day(r.day() || r.day), t.hours(r.hours() || r.hours), t.minutes(r.minutes() || r.minutes), t.seconds(r.seconds() || r.seconds), t.milliseconds(r.milliseconds() || r.milliseconds), t) : e;
|
|
33
|
+
}, u = function(t, r) {
|
|
34
34
|
var h, c = "";
|
|
35
35
|
return h = t.slice(r, r + 1), h !== "" && !isNaN(Number(h)) && (c += "%H"), h = t.charAt(r + 2), h !== "" && h === ":" && (c += h), h = t.slice(r + 3, r + 4), h !== "" && !isNaN(Number(h)) && (c += "%M"), h = t.charAt(r + 5), h !== "" && h === ":" && (c += h), h = t.slice(r + 6, r + 7), h !== "" && !isNaN(Number(h)) && (c += "%S"), c;
|
|
36
36
|
}, y = function(t, r) {
|
|
@@ -48,7 +48,7 @@ var Xt = { exports: {} };
|
|
|
48
48
|
t.charAt(r + 7),
|
|
49
49
|
t.slice(r + 8, r + 9)
|
|
50
50
|
], !isNaN(Number(M[0])) && !isNaN(Number(M[2])) && !isNaN(Number(M[4])) ? (M[1] === "-" && M[3] === "-" && (h = "%Y-%m-%d"), h) : "");
|
|
51
|
-
}, f = o.tempus, i,
|
|
51
|
+
}, f = o.tempus, i, S, d = o.navigator || {}, m = "en", N = {
|
|
52
52
|
en: {
|
|
53
53
|
JANUARY_SHORT: "Jan",
|
|
54
54
|
FEBRUARY_SHORT: "Feb",
|
|
@@ -239,7 +239,7 @@ var Xt = { exports: {} };
|
|
|
239
239
|
N[m].NOVEMBER_SHORT,
|
|
240
240
|
N[m].DECEMBER_SHORT
|
|
241
241
|
];
|
|
242
|
-
},
|
|
242
|
+
}, Z = function() {
|
|
243
243
|
return [
|
|
244
244
|
N[m].SUNDAY_LONG,
|
|
245
245
|
N[m].MONDAY_LONG,
|
|
@@ -249,7 +249,7 @@ var Xt = { exports: {} };
|
|
|
249
249
|
N[m].FRIDAY_LONG,
|
|
250
250
|
N[m].SATURDAY_LONG
|
|
251
251
|
];
|
|
252
|
-
},
|
|
252
|
+
}, W = function() {
|
|
253
253
|
return [
|
|
254
254
|
N[m].SUNDAY_SHORT,
|
|
255
255
|
N[m].MONDAY_SHORT,
|
|
@@ -259,7 +259,7 @@ var Xt = { exports: {} };
|
|
|
259
259
|
N[m].FRIDAY_SHORT,
|
|
260
260
|
N[m].SATURDAY_SHORT
|
|
261
261
|
];
|
|
262
|
-
},
|
|
262
|
+
}, F, dt, at, ct, le = function(t, r, h) {
|
|
263
263
|
var c;
|
|
264
264
|
o.XMLHttpRequest ? c = new XMLHttpRequest() : c = new ActiveXObject("Microsoft.XMLHTTP"), c.onreadystatechange = function() {
|
|
265
265
|
c.readyState === 4 && (c.status === 200 ? r && (o.JSON === e ? alert(`Please, include json2 into your project if you want use old browsers!
|
|
@@ -353,7 +353,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
353
353
|
"%B": {
|
|
354
354
|
format: function(t) {
|
|
355
355
|
var r = i.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
356
|
-
return
|
|
356
|
+
return F[r !== e ? r : i.MIN_MONTH];
|
|
357
357
|
},
|
|
358
358
|
parse: function(t) {
|
|
359
359
|
var r = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
|
|
@@ -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
|
+
}, g;
|
|
449
|
+
g = function(t, r, h) {
|
|
450
450
|
return this._d = /* @__PURE__ */ new Date(), this._i = {
|
|
451
451
|
year: !1,
|
|
452
452
|
month: !1,
|
|
@@ -456,55 +456,55 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
456
456
|
seconds: !1,
|
|
457
457
|
milliseconds: !1
|
|
458
458
|
}, t !== e && this.set(t, r, h), this;
|
|
459
|
-
},
|
|
459
|
+
}, g.fn = g.prototype, g.fn.dayCount = function() {
|
|
460
460
|
var t = this.month(), r = i.MAX_DAY_IN_MONTHS[t - (i.options("monthFromZero") ? 0 : 1)];
|
|
461
461
|
return this.leapYear() && t === (i.options("monthFromZero") ? 1 : 2) && (r += 1), r;
|
|
462
|
-
},
|
|
462
|
+
}, g.fn.year = function(t) {
|
|
463
463
|
if (arguments.length !== 0)
|
|
464
464
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_YEAR && Number(t) <= i.MAX_YEAR ? (this._d.setFullYear(Number(t)), this._i.year = !1) : this._i.year = Number(t) : (this._d.setFullYear(i.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
|
+
}, g.fn.month = function(t) {
|
|
469
469
|
if (arguments.length !== 0)
|
|
470
470
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MONTH && Number(t) <= i.MAX_MONTH ? (this._d.setMonth(i.options("monthFromZero") ? Number(t) : Number(t) - 1), this._i.month = !1) : this._i.month = Number(t) : (this._d.setMonth(i.options("monthFromZero") ? i.MIN_MONTH : i.MIN_MONTH - 1), this._i.month = !1);
|
|
471
471
|
else
|
|
472
472
|
return this._i.month === !1 ? i.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
|
|
473
473
|
return this;
|
|
474
|
-
},
|
|
474
|
+
}, g.fn.day = function(t) {
|
|
475
475
|
if (arguments.length !== 0)
|
|
476
476
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_DAY && Number(t) <= this.dayCount() ? (this._d.setDate(Number(t)), this._i.day = !1) : this._i.day = Number(t) : (this._d.setDate(i.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
|
+
}, g.fn.hours = function(t) {
|
|
481
481
|
if (arguments.length !== 0)
|
|
482
482
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_HOURS && Number(t) <= i.MAX_HOURS ? (this._d.setHours(Number(t)), this._i.hours = !1) : this._i.hours = Number(t) : (this._d.setHours(i.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
|
+
}, g.fn.minutes = function(t) {
|
|
487
487
|
if (arguments.length !== 0)
|
|
488
488
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MINUTES && Number(t) <= i.MAX_MINUTES ? (this._d.setMinutes(Number(t)), this._i.minutes = !1) : this._i.minutes = Number(t) : (this._d.setMinutes(i.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
|
+
}, g.fn.seconds = function(t) {
|
|
493
493
|
if (arguments.length !== 0)
|
|
494
494
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_SECONDS && Number(t) <= i.MAX_SECONDS ? (this._d.setSeconds(Number(t)), this._i.seconds = !1) : this._i.seconds = Number(t) : (this._d.setSeconds(i.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
|
+
}, g.fn.milliseconds = function(t) {
|
|
499
499
|
if (arguments.length !== 0)
|
|
500
500
|
(typeof t == "number" || typeof t == "string") && !isNaN(Number(t)) ? Number(t) >= i.MIN_MILLISECONDS && Number(t) <= i.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(t)), this._i.milliseconds = !1) : this._i.milliseconds = Number(t) : (this._d.setMilliseconds(i.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
|
-
},
|
|
504
|
+
}, g.fn.week = function() {
|
|
505
505
|
var t = new Date(this.year(), 0, 1), r = i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
506
|
return Math.ceil(((r - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
-
},
|
|
507
|
+
}, g.fn.set = function(t, r, h) {
|
|
508
508
|
if (this._i = {
|
|
509
509
|
year: !1,
|
|
510
510
|
month: !1,
|
|
@@ -520,9 +520,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
520
520
|
if (typeof t == "number")
|
|
521
521
|
return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
|
|
522
522
|
if (typeof t == "object" && (t instanceof Array ? (this.day(i.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(i.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 c, M = [], T, R,
|
|
523
|
+
var c, M = [], T, R, j = [], D = 0, H = 0, L, w, p = {}, b;
|
|
524
524
|
if (t === e)
|
|
525
|
-
return T =
|
|
525
|
+
return T = l(this, h), T === e && (this._i = {
|
|
526
526
|
year: -1,
|
|
527
527
|
month: -1,
|
|
528
528
|
day: -1,
|
|
@@ -549,7 +549,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
551
|
if (L < U[R].minLength)
|
|
552
|
-
return T =
|
|
552
|
+
return T = l(this, h), T === e && (this._i = {
|
|
553
553
|
year: -1,
|
|
554
554
|
month: -1,
|
|
555
555
|
day: -1,
|
|
@@ -558,10 +558,10 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
558
558
|
seconds: -1,
|
|
559
559
|
milliseconds: -1
|
|
560
560
|
}), T;
|
|
561
|
-
M.push(R),
|
|
561
|
+
M.push(R), j.push(w), L -= 1, H += L, D += 1;
|
|
562
562
|
}
|
|
563
563
|
} else if (t.charAt(H) !== r.charAt(D))
|
|
564
|
-
return T =
|
|
564
|
+
return T = l(this, h), T === e && (this._i = {
|
|
565
565
|
year: -1,
|
|
566
566
|
month: -1,
|
|
567
567
|
day: -1,
|
|
@@ -573,7 +573,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
573
573
|
D += 1, H += 1;
|
|
574
574
|
}
|
|
575
575
|
for (c in M)
|
|
576
|
-
M.hasOwnProperty(c) && U.hasOwnProperty(M[c]) && (b = U[M[c]].parse(
|
|
576
|
+
M.hasOwnProperty(c) && U.hasOwnProperty(M[c]) && (b = U[M[c]].parse(j[c]), 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,
|
|
@@ -584,14 +584,14 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
584
584
|
this.day(i.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
|
+
}, g.fn.leapYear = function() {
|
|
588
588
|
var t = this.year();
|
|
589
589
|
return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
|
|
590
|
-
},
|
|
590
|
+
}, g.fn.timestamp = function(t) {
|
|
591
591
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : i.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
|
|
592
|
-
},
|
|
592
|
+
}, g.fn.utc = function(t) {
|
|
593
593
|
return arguments.length !== 0 ? (this._d = new Date(Number(t) * (i.options("useMilliseconds") ? 1 : 1e3)), this) : i.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
|
|
594
|
-
},
|
|
594
|
+
}, g.fn.dayOfWeek = function(t) {
|
|
595
595
|
if (t === "long")
|
|
596
596
|
return at[this._d.getDay()];
|
|
597
597
|
if (t === "short")
|
|
@@ -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
|
+
}, g.fn.timezone = function(t) {
|
|
616
616
|
switch (t) {
|
|
617
617
|
case "hours":
|
|
618
618
|
return Math.floor(this._d.getTimezoneOffset() / 60);
|
|
@@ -621,7 +621,7 @@ 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
|
+
}, g.fn.get = function(t) {
|
|
625
625
|
switch (t) {
|
|
626
626
|
case "Date":
|
|
627
627
|
return new Date(
|
|
@@ -670,15 +670,15 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
670
670
|
timestamp: this.timestamp()
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
},
|
|
673
|
+
}, g.fn.format = function(t) {
|
|
674
674
|
for (var r = 0, h = "", c; r < t.length; )
|
|
675
675
|
t.charAt(r) === "%" ? (c = t.charAt(r) + t.charAt(r + 1), U[c] !== e ? (h += U[c].format(this), r += 1) : h += "%") : h += t.charAt(r), r += 1;
|
|
676
676
|
return h;
|
|
677
|
-
},
|
|
677
|
+
}, g.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
|
+
}, g.fn.errors = function() {
|
|
680
680
|
return this._i;
|
|
681
|
-
},
|
|
681
|
+
}, g.fn.between = function(t, r) {
|
|
682
682
|
var h = this.timestamp(), c = t.timestamp();
|
|
683
683
|
switch (r) {
|
|
684
684
|
case "year":
|
|
@@ -696,10 +696,10 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
696
696
|
default:
|
|
697
697
|
return e;
|
|
698
698
|
}
|
|
699
|
-
},
|
|
699
|
+
}, g.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
701
|
}, i = function(t, r, h) {
|
|
702
|
-
return new
|
|
702
|
+
return new g(t, r, h);
|
|
703
703
|
}, i.MIN_YEAR = 1e3, i.MAX_YEAR = 3e3, i.MIN_MONTH = 1, i.MAX_MONTH = 12, i.MIN_DAY = 1, i.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], i.MIN_DAY_OF_WEEK = 0, i.MAX_DAY_OF_WEEK = 6, i.MIN_HOURS = 0, i.MAX_HOURS = 23, i.MIN_MINUTES = 0, i.MAX_MINUTES = 59, i.MIN_SECONDS = 0, i.MAX_SECONDS = 59, i.MIN_MILLISECONDS = 0, i.MAX_MILLISECONDS = 999, i.VERSION = "0.2.18", i.options = function(t, r) {
|
|
704
704
|
if (t === e)
|
|
705
705
|
return Mt;
|
|
@@ -712,8 +712,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
712
712
|
}, i.noConflict = function() {
|
|
713
713
|
return o.tempus = f, i;
|
|
714
714
|
}, i.generate = function(t) {
|
|
715
|
-
var r, h, c, M, T, R,
|
|
716
|
-
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof
|
|
715
|
+
var r, h, c, M, T, R, j, D;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof g ? r = t.dateFrom.utc() : r = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof g ? h = t.dateTo.utc() : h = i(t.dateTo, t.formatTo !== e ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? T = {
|
|
717
717
|
year: 0,
|
|
718
718
|
month: 0,
|
|
719
719
|
day: 0,
|
|
@@ -734,7 +734,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
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([]),
|
|
737
|
+
}), t.groupBy === e ? R = t.asObject === !0 ? {} : [] : (R = [], R.push([]), j = i(r).get()[t.groupBy]), D = function(w, p, b) {
|
|
738
738
|
return t.asObject === !0 ? t.format !== e ? w[i(p).format(t.format)] = {} : w[i(p).format("%F %H:%M:%S")] = {} : t.format !== e ? w.push(b ? null : i(p).format(t.format)) : w.push(b ? null : i(p)), w;
|
|
739
739
|
}, t.groupBy !== e && t.fillNulls) {
|
|
740
740
|
var H = {
|
|
@@ -746,7 +746,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
746
746
|
seconds: T.seconds ? -T.seconds : e,
|
|
747
747
|
milliseconds: T.milliseconds ? -T.milliseconds : e
|
|
748
748
|
};
|
|
749
|
-
for (c = i(r).calc(H).utc(); i(c).get()[t.groupBy] ===
|
|
749
|
+
for (c = i(r).calc(H).utc(); i(c).get()[t.groupBy] === j; )
|
|
750
750
|
D(R[R.length - 1], c, !0), c = i(c).calc(H).utc();
|
|
751
751
|
if (t.groupBy === "week") {
|
|
752
752
|
var L = i(r).dayOfWeek();
|
|
@@ -755,15 +755,15 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
for (; r <= h; )
|
|
758
|
-
t.groupBy === e ? D(R, r) : i(r).get()[t.groupBy] ===
|
|
758
|
+
t.groupBy === e ? D(R, r) : i(r).get()[t.groupBy] === j ? D(R[R.length - 1], r) : (R.push([]), D(R[R.length - 1], r), j = i(r).get()[t.groupBy]), r = i(r).calc(T).utc();
|
|
759
759
|
if (t.groupBy !== e && t.fillNulls)
|
|
760
|
-
for (M = i(h).calc(T).utc(); i(M).get()[t.groupBy] ===
|
|
760
|
+
for (M = i(h).calc(T).utc(); i(M).get()[t.groupBy] === j; )
|
|
761
761
|
D(R[R.length - 1], M, !0), M = i(M).calc(T).utc();
|
|
762
762
|
return R;
|
|
763
763
|
}, i.monthNames = function(t) {
|
|
764
764
|
switch (t) {
|
|
765
765
|
case "long":
|
|
766
|
-
return
|
|
766
|
+
return F;
|
|
767
767
|
default:
|
|
768
768
|
return dt;
|
|
769
769
|
}
|
|
@@ -776,7 +776,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
776
776
|
}
|
|
777
777
|
}, i.lang = function(t) {
|
|
778
778
|
if (t !== e)
|
|
779
|
-
m = t, N[m] === e && (m = "en"),
|
|
779
|
+
m = t, N[m] === e && (m = "en"), F = B(), dt = ht(), at = Z(), ct = W();
|
|
780
780
|
else
|
|
781
781
|
return m;
|
|
782
782
|
return e;
|
|
@@ -794,25 +794,25 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : r(JSON.pars
|
|
|
794
794
|
delete U[t];
|
|
795
795
|
}, i.detectFormat = function(t) {
|
|
796
796
|
var r, h, c;
|
|
797
|
-
return r = y(t, 0), r !== "" && (c = 10), h = t.charAt(c), (h === "T" || h === " ") && (r += h, c += 1), r +=
|
|
798
|
-
},
|
|
799
|
-
TempusDate:
|
|
797
|
+
return r = y(t, 0), r !== "" && (c = 10), h = t.charAt(c), (h === "T" || h === " ") && (r += h, c += 1), r += u(t, c), r;
|
|
798
|
+
}, S = {
|
|
799
|
+
TempusDate: g
|
|
800
800
|
}, i.classes = function(t, r) {
|
|
801
801
|
if (r === e)
|
|
802
|
-
return
|
|
803
|
-
|
|
802
|
+
return S[t];
|
|
803
|
+
S[t] = r;
|
|
804
804
|
}, i.loadTranslations = function(t) {
|
|
805
805
|
typeof t == "object" ? N = t : typeof t == "string" && le(t, function(r) {
|
|
806
806
|
N = r;
|
|
807
807
|
}, function(r) {
|
|
808
808
|
});
|
|
809
|
-
}, m = (d.language || d.systemLanguage || d.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"),
|
|
809
|
+
}, m = (d.language || d.systemLanguage || d.userLanguage || "en").substr(0, 2).toLowerCase(), N[m] === e && (m = "en"), F = B(), dt = ht(), at = Z(), ct = W(), A.exports && (s = A.exports = i), s.tempus = i;
|
|
810
810
|
}).call(fe);
|
|
811
811
|
})(Xt, Xt.exports);
|
|
812
812
|
var _e = Xt.exports;
|
|
813
813
|
const jt = /* @__PURE__ */ Ne(_e);
|
|
814
|
-
var z, ut, K, Y,
|
|
815
|
-
class
|
|
814
|
+
var z, ut, K, Y, X, q, Q, I, x, Dt, v, P, $, tt, it, Lt, mt, kt, ft, xt, Nt, Vt, _t, Zt, Ot, zt, Ht, ee, Yt, se, yt, Kt, At, qt, Tt, Qt, nt, pt, St, vt, It, re, et, lt, ot, bt, gt, $t;
|
|
815
|
+
class k {
|
|
816
816
|
constructor(s, e = {}) {
|
|
817
817
|
_(this, it);
|
|
818
818
|
_(this, mt);
|
|
@@ -835,11 +835,11 @@ class j {
|
|
|
835
835
|
_(this, ut, null);
|
|
836
836
|
_(this, K, []);
|
|
837
837
|
_(this, Y, {});
|
|
838
|
-
_(this,
|
|
838
|
+
_(this, X, 50);
|
|
839
839
|
_(this, q, !0);
|
|
840
840
|
_(this, Q, null);
|
|
841
841
|
_(this, I, null);
|
|
842
|
-
_(this,
|
|
842
|
+
_(this, x, null);
|
|
843
843
|
_(this, Dt, 100);
|
|
844
844
|
_(this, v, "no");
|
|
845
845
|
_(this, P, !1);
|
|
@@ -847,149 +847,153 @@ class j {
|
|
|
847
847
|
_(this, tt, !1);
|
|
848
848
|
C(this, "errors", {});
|
|
849
849
|
C(this, "answerData", {});
|
|
850
|
-
|
|
850
|
+
E(this, z, s), E(this, ut, e);
|
|
851
851
|
}
|
|
852
852
|
get serial() {
|
|
853
853
|
return a(this, P);
|
|
854
854
|
}
|
|
855
855
|
setSerial() {
|
|
856
|
-
|
|
856
|
+
E(this, P, !0), E(this, $, !0), E(this, tt, !1);
|
|
857
857
|
}
|
|
858
858
|
setParallel() {
|
|
859
|
-
|
|
859
|
+
E(this, P, !1), E(this, $, !1), E(this, tt, !0);
|
|
860
860
|
}
|
|
861
861
|
stop() {
|
|
862
|
-
|
|
862
|
+
E(this, q, !1);
|
|
863
863
|
}
|
|
864
864
|
async batch(s, e) {
|
|
865
|
-
a(this,
|
|
865
|
+
a(this, x) && O(this, mt, kt).call(this), e && E(this, Q, e), a(this, $) === !1 && E(this, P, !1), Object.keys(s).length > 500 && E(this, P, !0), E(this, q, !0), E(this, K, []), E(this, Y, {}), this.errors = {}, this.answerData = {};
|
|
866
866
|
const o = O(this, Nt, Vt).call(this, s);
|
|
867
867
|
if (Object.keys(s).length < 500) {
|
|
868
|
-
const n = o.map((
|
|
869
|
-
return Promise.allSettled(n).then((
|
|
870
|
-
let
|
|
871
|
-
for (let y of
|
|
872
|
-
y.status === "fulfilled" && (
|
|
873
|
-
return
|
|
868
|
+
const n = o.map((l, u) => O(this, _t, Zt).call(this, l, o[u]));
|
|
869
|
+
return Promise.allSettled(n).then((l) => {
|
|
870
|
+
let u = {};
|
|
871
|
+
for (let y of l)
|
|
872
|
+
y.status === "fulfilled" && (u = { ...u, ...y.value });
|
|
873
|
+
return u;
|
|
874
874
|
});
|
|
875
875
|
} else {
|
|
876
|
-
let n = {},
|
|
877
|
-
|
|
876
|
+
let n = {}, l = 0, u = 1, y = Object.keys(s).length || 1, f = (i) => {
|
|
877
|
+
l += Object.keys(i).length, u = Math.round(l / y * 100);
|
|
878
878
|
};
|
|
879
|
-
for (let [i,
|
|
880
|
-
let d = await O(this, _t, Zt).call(this,
|
|
881
|
-
f(
|
|
879
|
+
for (let [i, S] of Object.entries(o)) {
|
|
880
|
+
let d = await O(this, _t, Zt).call(this, S, o[i], !0);
|
|
881
|
+
f(S), e && e({ percent: u }), n = { ...n, ...d };
|
|
882
882
|
}
|
|
883
883
|
return n;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
async batchTotalCount(s, e) {
|
|
887
|
-
|
|
888
|
-
let o = 1, n = 0,
|
|
889
|
-
n += Object.keys(f).length, o = Math.round(n /
|
|
887
|
+
E(this, Y, {}), this.errors = {};
|
|
888
|
+
let o = 1, n = 0, l = Object.keys(s).length || 1, u = (f) => {
|
|
889
|
+
n += Object.keys(f).length, o = Math.round(n / l * 100);
|
|
890
890
|
};
|
|
891
891
|
e && e({ percent: o });
|
|
892
892
|
const y = O(this, Nt, Vt).call(this, s);
|
|
893
893
|
if (a(this, tt)) {
|
|
894
|
-
const f = y.map((i) => O(this, Ot, zt).call(this, i).then((
|
|
894
|
+
const f = y.map((i) => O(this, Ot, zt).call(this, i).then((S) => (u(i), e && e({ percent: o }), S)));
|
|
895
895
|
return Promise.allSettled(f).then((i) => {
|
|
896
|
-
let
|
|
896
|
+
let S = {};
|
|
897
897
|
for (let d of i)
|
|
898
|
-
d.status === "fulfilled" && (
|
|
899
|
-
return
|
|
898
|
+
d.status === "fulfilled" && (S = { ...S, ...d.value });
|
|
899
|
+
return S;
|
|
900
900
|
});
|
|
901
901
|
} else {
|
|
902
902
|
let f = {};
|
|
903
903
|
for (let i of y) {
|
|
904
|
-
let
|
|
905
|
-
|
|
904
|
+
let S = await O(this, Ot, zt).call(this, i);
|
|
905
|
+
u(i), e && e({ percent: o }), f = { ...f, ...S };
|
|
906
906
|
}
|
|
907
907
|
return f;
|
|
908
908
|
}
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
z = new WeakMap(), ut = new WeakMap(), K = new WeakMap(), Y = new WeakMap(),
|
|
911
|
+
z = new WeakMap(), ut = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), X = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), I = new WeakMap(), x = new WeakMap(), Dt = new WeakMap(), v = new WeakMap(), P = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), it = new WeakSet(), Lt = function() {
|
|
912
912
|
let s = 0;
|
|
913
913
|
if (!a(this, I))
|
|
914
914
|
return Math.round(s);
|
|
915
915
|
let e = 0, o = 0;
|
|
916
916
|
return Object.values(a(this, I)).forEach((n) => {
|
|
917
|
-
const { total:
|
|
918
|
-
e +=
|
|
917
|
+
const { total: l, count: u } = n;
|
|
918
|
+
e += l ?? 0, o += u ?? 0;
|
|
919
919
|
}), e ? s = o / e * 100 : s = 100, { percent: Math.round(s), allCount: o, allTotal: e };
|
|
920
920
|
}, mt = new WeakSet(), kt = function() {
|
|
921
|
-
clearInterval(a(this,
|
|
921
|
+
clearInterval(a(this, x)), E(this, x, ""), E(this, I, ""), E(this, Q, ""), E(this, v, "no");
|
|
922
922
|
}, ft = new WeakSet(), xt = function({ key: s, value: e }) {
|
|
923
|
-
const o = O(this, et, lt).call(this, e.data()), n = Array.isArray(o) ? o.length : 0,
|
|
924
|
-
let
|
|
925
|
-
o && (
|
|
923
|
+
const o = O(this, et, lt).call(this, e.data()), n = Array.isArray(o) ? o.length : 0, l = O(this, ot, bt).call(this, e.total(), n);
|
|
924
|
+
let u = 1;
|
|
925
|
+
o && (u = n), a(this, Q) && (a(this, I) || E(this, I, {}), a(this, I)[s] && a(this, I)[s].count && (u += a(this, I)[s].count), a(this, I)[s] = { total: l, count: u }, a(this, x) || E(this, x, setInterval(() => {
|
|
926
926
|
const { percent: y, allCount: f, allTotal: i } = a(this, it, Lt);
|
|
927
927
|
(a(this, v) === "no" || a(this, v) < a(this, it, Lt).percent) && (a(this, Q).call(this, {
|
|
928
928
|
data: a(this, I),
|
|
929
929
|
percent: y,
|
|
930
930
|
allCount: f,
|
|
931
931
|
allTotal: i
|
|
932
|
-
}),
|
|
932
|
+
}), E(this, v, a(this, it, Lt).percent)), y === 100 && O(this, mt, kt).call(this);
|
|
933
933
|
}, a(this, Dt))));
|
|
934
934
|
}, Nt = new WeakSet(), Vt = function(s) {
|
|
935
935
|
const e = [], o = Object.entries(s);
|
|
936
|
-
for (let n = 0; n < o.length; n += a(this,
|
|
937
|
-
const
|
|
938
|
-
e.push(Object.fromEntries(
|
|
936
|
+
for (let n = 0; n < o.length; n += a(this, X)) {
|
|
937
|
+
const l = o.slice(n, n + a(this, X));
|
|
938
|
+
e.push(Object.fromEntries(l));
|
|
939
939
|
}
|
|
940
940
|
return e;
|
|
941
941
|
}, _t = new WeakSet(), Zt = function(s, e, o) {
|
|
942
942
|
return new Promise((n) => {
|
|
943
|
-
const
|
|
943
|
+
const l = O(this, St, vt).call(this, e), u = [];
|
|
944
944
|
let y = 0, f = 0;
|
|
945
945
|
a(this, z).call(this, s, (i) => {
|
|
946
|
-
Object.entries(i).forEach(([
|
|
946
|
+
Object.entries(i).forEach(([S, d]) => {
|
|
947
947
|
let m = {};
|
|
948
948
|
const N = d.error();
|
|
949
|
-
if (N
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
949
|
+
if (N) {
|
|
950
|
+
let { query: { method: W }, answer: F } = d;
|
|
951
|
+
this.errors[S] = { error: N, method: W }, y += 1;
|
|
952
|
+
}
|
|
953
|
+
if (d != null && d.answer && Object.keys(d.answer).length) {
|
|
954
|
+
for (let [W, F] of Object.entries(d.answer))
|
|
955
|
+
W != "result" && F && (m[W] = F);
|
|
956
|
+
Object.keys(m).length && (this.answerData[S] = m);
|
|
953
957
|
}
|
|
954
|
-
const B = O(this, et, lt).call(this, d.data()), ht = Array.isArray(B) ? B.length : 0,
|
|
955
|
-
if (Array.isArray(B) ? a(this, Y)[
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
+
const B = O(this, et, lt).call(this, d.data()), ht = Array.isArray(B) ? B.length : 0, Z = O(this, ot, bt).call(this, d.total(), ht);
|
|
959
|
+
if (Array.isArray(B) ? a(this, Y)[S] = B : typeof B == "object" && B !== null && Object.keys(B).length === 0 ? a(this, Y)[S] = [] : a(this, Y)[S] = B, f += Z, o || O(this, ft, xt).call(this, { key: S, value: d }), Z > a(this, X) && Z > ht) {
|
|
960
|
+
const W = Math.ceil(Z / a(this, X)) - 1, F = Array.from({ length: W });
|
|
961
|
+
u.push([S, l[S], F]);
|
|
958
962
|
}
|
|
959
|
-
}), f > 5e3 && a(this, $) === !1 && a(this, tt) === !1 &&
|
|
963
|
+
}), f > 5e3 && a(this, $) === !1 && a(this, tt) === !1 && E(this, P, !0), y > 0 && O(this, gt, $t).call(this), u.length ? (O(this, Ht, ee).call(this, u), O(this, Yt, se).call(this).then(() => n(O(this, nt, pt).call(this)))) : n(O(this, nt, pt).call(this));
|
|
960
964
|
});
|
|
961
965
|
});
|
|
962
966
|
}, Ot = new WeakSet(), zt = function(s) {
|
|
963
967
|
return new Promise((e) => {
|
|
964
968
|
const o = O(this, St, vt).call(this, s);
|
|
965
969
|
let n = 0;
|
|
966
|
-
a(this, z).call(this, o, (
|
|
967
|
-
Object.entries(
|
|
970
|
+
a(this, z).call(this, o, (l) => {
|
|
971
|
+
Object.entries(l).forEach(([u, y]) => {
|
|
968
972
|
const f = y.error();
|
|
969
|
-
f && (this.errors[
|
|
970
|
-
const i = O(this, et, lt).call(this, y.data()),
|
|
971
|
-
a(this, Y)[
|
|
973
|
+
f && (this.errors[u] = f, n += 1);
|
|
974
|
+
const i = O(this, et, lt).call(this, y.data()), S = Array.isArray(i) ? i.length : 0, d = O(this, ot, bt).call(this, y.total(), S);
|
|
975
|
+
a(this, Y)[u] = d;
|
|
972
976
|
}), n > 0 && O(this, gt, $t).call(this), e(O(this, nt, pt).call(this));
|
|
973
977
|
});
|
|
974
978
|
});
|
|
975
979
|
}, Ht = new WeakSet(), ee = function(s) {
|
|
976
980
|
let e = [];
|
|
977
|
-
s.forEach(([o, n,
|
|
978
|
-
|
|
979
|
-
const f = y + 1, i = a(this,
|
|
980
|
-
e.length === a(this,
|
|
981
|
+
s.forEach(([o, n, l]) => {
|
|
982
|
+
l.forEach((u, y) => {
|
|
983
|
+
const f = y + 1, i = a(this, X) * f, d = [[o, f].join("_"), O(this, It, re).call(this, n, i)];
|
|
984
|
+
e.length === a(this, X) ? (a(this, K).push(e), e = [d]) : e.push(d);
|
|
981
985
|
});
|
|
982
986
|
}), e.length && a(this, K).push(e);
|
|
983
987
|
}, Yt = new WeakSet(), se = function() {
|
|
984
988
|
const s = [], e = [], o = (n) => {
|
|
985
|
-
Object.entries(n).forEach(([
|
|
986
|
-
const [y] =
|
|
987
|
-
Array.isArray(f) && a(this, Y)[y].push(...f), O(this, ft, xt).call(this, { key: y, value:
|
|
989
|
+
Object.entries(n).forEach(([l, u]) => {
|
|
990
|
+
const [y] = l.split("_"), f = O(this, et, lt).call(this, u.data());
|
|
991
|
+
Array.isArray(f) && a(this, Y)[y].push(...f), O(this, ft, xt).call(this, { key: y, value: u });
|
|
988
992
|
});
|
|
989
993
|
};
|
|
990
|
-
return a(this, K).forEach((n,
|
|
991
|
-
const
|
|
992
|
-
a(this, P) ? o(i) : e[
|
|
994
|
+
return a(this, K).forEach((n, l) => {
|
|
995
|
+
const u = Object.fromEntries(n), y = () => new Promise((f) => a(this, z).call(this, u, (i) => {
|
|
996
|
+
a(this, P) ? o(i) : e[l] = i, f();
|
|
993
997
|
}));
|
|
994
998
|
s.push(y);
|
|
995
999
|
}), a(this, P) ? O(this, At, qt).call(this, s) : O(this, Tt, Qt).call(this, s).then(() => {
|
|
@@ -1017,11 +1021,11 @@ z = new WeakMap(), ut = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), W =
|
|
|
1017
1021
|
}, St = new WeakSet(), vt = function(s) {
|
|
1018
1022
|
return Object.entries(s).reduce((e, [o, n]) => {
|
|
1019
1023
|
if (Array.isArray(n)) {
|
|
1020
|
-
const [
|
|
1021
|
-
e[o] = [
|
|
1024
|
+
const [l, u = {}] = n;
|
|
1025
|
+
e[o] = [l, u];
|
|
1022
1026
|
} else {
|
|
1023
|
-
const { method:
|
|
1024
|
-
e[o] = [
|
|
1027
|
+
const { method: l, params: u = {} } = n;
|
|
1028
|
+
e[o] = [l, u];
|
|
1025
1029
|
}
|
|
1026
1030
|
return e;
|
|
1027
1031
|
}, {});
|
|
@@ -1062,7 +1066,7 @@ class Oe {
|
|
|
1062
1066
|
}
|
|
1063
1067
|
st = new WeakMap();
|
|
1064
1068
|
const Wt = new Oe();
|
|
1065
|
-
var
|
|
1069
|
+
var J, V, Ut, rt, Et, Gt, ie, Rt, te, Bt, ne, wt, oe, Ct, he;
|
|
1066
1070
|
class ye {
|
|
1067
1071
|
constructor() {
|
|
1068
1072
|
_(this, Gt);
|
|
@@ -1073,8 +1077,8 @@ class ye {
|
|
|
1073
1077
|
_(this, Bt);
|
|
1074
1078
|
_(this, wt);
|
|
1075
1079
|
_(this, Ct);
|
|
1076
|
-
_(this,
|
|
1077
|
-
_(this,
|
|
1080
|
+
_(this, J, "logger");
|
|
1081
|
+
_(this, V, !1);
|
|
1078
1082
|
_(this, Ut, 2e3);
|
|
1079
1083
|
_(this, rt, /* @__PURE__ */ new Map());
|
|
1080
1084
|
_(this, Et, {});
|
|
@@ -1084,26 +1088,26 @@ class ye {
|
|
|
1084
1088
|
}
|
|
1085
1089
|
/** Инициализация логера */
|
|
1086
1090
|
async init() {
|
|
1087
|
-
let s = new
|
|
1091
|
+
let s = new k(BX24.callBatch), { entityList: e } = await s.batch({
|
|
1088
1092
|
entityList: { method: "entity.get" }
|
|
1089
1093
|
});
|
|
1090
1094
|
if (e != null && e.length)
|
|
1091
|
-
if (e.find((n) => n.ENTITY == a(this,
|
|
1092
|
-
|
|
1095
|
+
if (e.find((n) => n.ENTITY == a(this, J)))
|
|
1096
|
+
E(this, V, !0);
|
|
1093
1097
|
else {
|
|
1094
1098
|
let { entityAdd: n } = await s.batch({
|
|
1095
1099
|
entityAdd: {
|
|
1096
1100
|
method: "entity.add",
|
|
1097
1101
|
params: {
|
|
1098
|
-
ENTITY: a(this,
|
|
1099
|
-
NAME: a(this,
|
|
1102
|
+
ENTITY: a(this, J),
|
|
1103
|
+
NAME: a(this, J),
|
|
1100
1104
|
ACCESS: { AU: "X" }
|
|
1101
1105
|
}
|
|
1102
1106
|
}
|
|
1103
1107
|
});
|
|
1104
|
-
n &&
|
|
1108
|
+
n && E(this, V, !0);
|
|
1105
1109
|
}
|
|
1106
|
-
return O(this, wt, oe).call(this), a(this,
|
|
1110
|
+
return O(this, wt, oe).call(this), a(this, V);
|
|
1107
1111
|
}
|
|
1108
1112
|
/**
|
|
1109
1113
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1115,7 +1119,7 @@ class ye {
|
|
|
1115
1119
|
* @returns {string}
|
|
1116
1120
|
*/
|
|
1117
1121
|
start({ type: s, data: e }) {
|
|
1118
|
-
if (!a(this,
|
|
1122
|
+
if (!a(this, V)) {
|
|
1119
1123
|
O(this, Rt, te).call(this, "entity");
|
|
1120
1124
|
return;
|
|
1121
1125
|
}
|
|
@@ -1138,12 +1142,12 @@ class ye {
|
|
|
1138
1142
|
* answer: { [key]: unknown } }}
|
|
1139
1143
|
*/
|
|
1140
1144
|
stop({ key: s, errorList: e, status: o, answer: n }) {
|
|
1141
|
-
if (!a(this,
|
|
1145
|
+
if (!a(this, V)) {
|
|
1142
1146
|
O(this, Rt, te).call(this, "entity");
|
|
1143
1147
|
return;
|
|
1144
1148
|
}
|
|
1145
|
-
let
|
|
1146
|
-
e && (
|
|
1149
|
+
let l = a(this, rt).get(s);
|
|
1150
|
+
e && (l.errorList = e), o && (l.status = o), n && (l.answer = n), Wt.actionFilter({
|
|
1147
1151
|
keyTimer: "add.entity.items",
|
|
1148
1152
|
duration: a(this, Ut),
|
|
1149
1153
|
action: () => {
|
|
@@ -1152,30 +1156,30 @@ class ye {
|
|
|
1152
1156
|
});
|
|
1153
1157
|
}
|
|
1154
1158
|
async getEntityList() {
|
|
1155
|
-
let s = new
|
|
1159
|
+
let s = new k(BX24.callBatch), { entityList: e } = await s.batch({
|
|
1156
1160
|
entityList: {
|
|
1157
1161
|
method: "entity.item.get",
|
|
1158
1162
|
params: {
|
|
1159
|
-
ENTITY: a(this,
|
|
1163
|
+
ENTITY: a(this, J),
|
|
1160
1164
|
SORT: { ID: "DESC" }
|
|
1161
1165
|
}
|
|
1162
1166
|
}
|
|
1163
1167
|
});
|
|
1164
1168
|
return e = e.map((o) => {
|
|
1165
|
-
const { ID: n, DATE_CREATE:
|
|
1169
|
+
const { ID: n, DATE_CREATE: l, DETAIL_TEXT: u } = o;
|
|
1166
1170
|
return {
|
|
1167
|
-
...JSON.parse(
|
|
1171
|
+
...JSON.parse(u),
|
|
1168
1172
|
id: n,
|
|
1169
|
-
dateCreate:
|
|
1173
|
+
dateCreate: l
|
|
1170
1174
|
};
|
|
1171
1175
|
}), e;
|
|
1172
1176
|
}
|
|
1173
1177
|
}
|
|
1174
|
-
|
|
1175
|
-
const s = new
|
|
1178
|
+
J = new WeakMap(), V = new WeakMap(), Ut = new WeakMap(), rt = new WeakMap(), Et = new WeakMap(), Gt = new WeakSet(), ie = async function() {
|
|
1179
|
+
const s = new k(BX24.callBatch), e = BX24.isAdmin(), { curUser: o } = await s.batch({
|
|
1176
1180
|
curUser: { method: "user.current" }
|
|
1177
1181
|
});
|
|
1178
|
-
|
|
1182
|
+
E(this, Et, { isAdmin: e, curUser: o });
|
|
1179
1183
|
}, Rt = new WeakSet(), te = function(s) {
|
|
1180
1184
|
s == "entity" && Wt.actionFilter({
|
|
1181
1185
|
keyTimer: "error.logger.entity",
|
|
@@ -1185,37 +1189,37 @@ F = new WeakMap(), x = new WeakMap(), Ut = new WeakMap(), rt = new WeakMap(), Et
|
|
|
1185
1189
|
}
|
|
1186
1190
|
});
|
|
1187
1191
|
}, Bt = new WeakSet(), ne = async function() {
|
|
1188
|
-
let s = {}, e = new
|
|
1192
|
+
let s = {}, e = new k(BX24.callBatch);
|
|
1189
1193
|
for (let [o, n] of a(this, rt).entries())
|
|
1190
1194
|
n.status && (s[o] = {
|
|
1191
1195
|
method: "entity.item.add",
|
|
1192
1196
|
params: {
|
|
1193
|
-
ENTITY: a(this,
|
|
1194
|
-
NAME: a(this,
|
|
1197
|
+
ENTITY: a(this, J),
|
|
1198
|
+
NAME: a(this, J),
|
|
1195
1199
|
DETAIL_TEXT: JSON.stringify(n)
|
|
1196
1200
|
}
|
|
1197
1201
|
});
|
|
1198
1202
|
if (Object.keys(s).length) {
|
|
1199
1203
|
let o = await e.batch(s), { errors: n } = e;
|
|
1200
|
-
for (let [
|
|
1201
|
-
a(this, rt).delete(
|
|
1204
|
+
for (let [l, u] of Object.entries({ ...o, ...n }))
|
|
1205
|
+
a(this, rt).delete(l);
|
|
1202
1206
|
}
|
|
1203
1207
|
}, wt = new WeakSet(), oe = async function() {
|
|
1204
|
-
let s = new
|
|
1208
|
+
let s = new k(BX24.callBatch), e = await this.getEntityList(), { serverTime: o } = await s.batch({
|
|
1205
1209
|
serverTime: { method: "server.time" }
|
|
1206
|
-
}), n = e.filter((
|
|
1207
|
-
let { dateCreate:
|
|
1208
|
-
return jt(new Date(
|
|
1210
|
+
}), n = e.filter((l) => {
|
|
1211
|
+
let { dateCreate: u } = l;
|
|
1212
|
+
return jt(new Date(u)).between(jt(new Date(o)), "month") >= this.periodClear;
|
|
1209
1213
|
});
|
|
1210
1214
|
O(this, Ct, he).call(this, n);
|
|
1211
1215
|
}, Ct = new WeakSet(), he = async function(s) {
|
|
1212
|
-
let e = new
|
|
1213
|
-
let { id:
|
|
1216
|
+
let e = new k(BX24.callBatch), o = s.map((n) => {
|
|
1217
|
+
let { id: l } = n;
|
|
1214
1218
|
return {
|
|
1215
1219
|
method: "entity.item.delete",
|
|
1216
1220
|
params: {
|
|
1217
|
-
ENTITY: a(this,
|
|
1218
|
-
ID:
|
|
1221
|
+
ENTITY: a(this, J),
|
|
1222
|
+
ID: l
|
|
1219
1223
|
}
|
|
1220
1224
|
};
|
|
1221
1225
|
});
|
|
@@ -1272,27 +1276,27 @@ class Te {
|
|
|
1272
1276
|
type: "call",
|
|
1273
1277
|
data: { method: s, params: e, updateList: o }
|
|
1274
1278
|
});
|
|
1275
|
-
return new Promise((
|
|
1276
|
-
e || (e = {}), BX24.callMethod(s, e, function(
|
|
1279
|
+
return new Promise((l) => {
|
|
1280
|
+
e || (e = {}), BX24.callMethod(s, e, function(u) {
|
|
1277
1281
|
let y = {};
|
|
1278
|
-
if (
|
|
1279
|
-
for (let [f, i] of Object.entries(
|
|
1282
|
+
if (u != null && u.answer)
|
|
1283
|
+
for (let [f, i] of Object.entries(u.answer))
|
|
1280
1284
|
f != "result" && i && (y[f] = i);
|
|
1281
|
-
if (
|
|
1282
|
-
let f =
|
|
1285
|
+
if (u.error()) {
|
|
1286
|
+
let f = u.error();
|
|
1283
1287
|
console.error(f), G.stop({
|
|
1284
1288
|
answer: y,
|
|
1285
1289
|
key: n,
|
|
1286
1290
|
status: "fail",
|
|
1287
1291
|
errorList: [f.toSting()]
|
|
1288
|
-
}),
|
|
1292
|
+
}), l(!1);
|
|
1289
1293
|
} else {
|
|
1290
|
-
let f =
|
|
1294
|
+
let f = u.data();
|
|
1291
1295
|
f != null && f.items && (f = f.items), G.stop({
|
|
1292
1296
|
answer: y,
|
|
1293
1297
|
key: n,
|
|
1294
1298
|
status: "success"
|
|
1295
|
-
}),
|
|
1299
|
+
}), l(f);
|
|
1296
1300
|
}
|
|
1297
1301
|
});
|
|
1298
1302
|
});
|
|
@@ -1308,38 +1312,38 @@ class Te {
|
|
|
1308
1312
|
* }[]
|
|
1309
1313
|
* }[] }}
|
|
1310
1314
|
*/
|
|
1311
|
-
async batch(s, e, { updateList: o } = {}) {
|
|
1312
|
-
let
|
|
1315
|
+
async batch(s, e, { updateList: o, errorCall: n } = {}) {
|
|
1316
|
+
let l = new k(BX24.callBatch), u = G.start({
|
|
1313
1317
|
type: "batch",
|
|
1314
1318
|
data: { commandList: s, updateList: o }
|
|
1315
1319
|
});
|
|
1316
1320
|
try {
|
|
1317
|
-
let
|
|
1318
|
-
if (Object.keys(
|
|
1319
|
-
let
|
|
1320
|
-
key:
|
|
1321
|
-
error:
|
|
1321
|
+
let y = await l.batch(s, e);
|
|
1322
|
+
if (Object.keys(l.errors).length) {
|
|
1323
|
+
let f = Object.entries(l.errors).map(([i, S]) => ({
|
|
1324
|
+
key: i,
|
|
1325
|
+
error: S.toSting()
|
|
1322
1326
|
}));
|
|
1323
|
-
G.stop({
|
|
1327
|
+
n && n(l.errors), G.stop({
|
|
1324
1328
|
key: u,
|
|
1325
1329
|
status: "fail",
|
|
1326
|
-
errorList:
|
|
1327
|
-
answer:
|
|
1330
|
+
errorList: f,
|
|
1331
|
+
answer: l.answerData
|
|
1328
1332
|
});
|
|
1329
1333
|
} else
|
|
1330
1334
|
G.stop({
|
|
1331
1335
|
key: u,
|
|
1332
1336
|
status: "success",
|
|
1333
|
-
answer:
|
|
1337
|
+
answer: l.answerData
|
|
1334
1338
|
});
|
|
1335
|
-
return
|
|
1336
|
-
} catch (
|
|
1339
|
+
return y;
|
|
1340
|
+
} catch (y) {
|
|
1337
1341
|
return G.stop({
|
|
1338
1342
|
key: u,
|
|
1339
1343
|
status: "fail-runtime",
|
|
1340
|
-
errorList: [
|
|
1341
|
-
answer:
|
|
1342
|
-
}), console.error(
|
|
1344
|
+
errorList: [y.toSting()],
|
|
1345
|
+
answer: l.answerData
|
|
1346
|
+
}), console.error(y), !1;
|
|
1343
1347
|
}
|
|
1344
1348
|
}
|
|
1345
1349
|
/**
|
|
@@ -1347,34 +1351,34 @@ class Te {
|
|
|
1347
1351
|
* @param progressCall - callback(data), в data приходят данные о загрузке данных
|
|
1348
1352
|
*/
|
|
1349
1353
|
async batchTotalCount(s, e) {
|
|
1350
|
-
let o = new
|
|
1354
|
+
let o = new k(BX24.callBatch), n = G.start({
|
|
1351
1355
|
type: "batch",
|
|
1352
1356
|
data: { commandList: s }
|
|
1353
1357
|
});
|
|
1354
1358
|
try {
|
|
1355
|
-
let
|
|
1359
|
+
let l = await o.batchTotalCount(s, e);
|
|
1356
1360
|
if (Object.keys(o.errors).length) {
|
|
1357
|
-
let
|
|
1361
|
+
let u = Object.entries(o.errors).map(([y, f]) => ({
|
|
1358
1362
|
key: y,
|
|
1359
1363
|
error: f.toSting()
|
|
1360
1364
|
}));
|
|
1361
1365
|
G.stop({
|
|
1362
1366
|
key: n,
|
|
1363
1367
|
status: "fail",
|
|
1364
|
-
errorList:
|
|
1368
|
+
errorList: u
|
|
1365
1369
|
});
|
|
1366
1370
|
} else
|
|
1367
1371
|
G.stop({
|
|
1368
1372
|
key: n,
|
|
1369
1373
|
status: "success"
|
|
1370
1374
|
});
|
|
1371
|
-
return
|
|
1372
|
-
} catch (
|
|
1375
|
+
return l;
|
|
1376
|
+
} catch (l) {
|
|
1373
1377
|
return G.stop({
|
|
1374
1378
|
key: n,
|
|
1375
1379
|
status: "fail",
|
|
1376
|
-
errorList: [
|
|
1377
|
-
}), console.error(
|
|
1380
|
+
errorList: [l.toSting()]
|
|
1381
|
+
}), console.error(l), !1;
|
|
1378
1382
|
}
|
|
1379
1383
|
}
|
|
1380
1384
|
/** Запрос данных о местах встройки приложения */
|
|
@@ -1384,9 +1388,9 @@ class Te {
|
|
|
1384
1388
|
/** Встройка приложения в place */
|
|
1385
1389
|
async placementBind(s) {
|
|
1386
1390
|
this.placeData || (this.placeData = await this.getPlacement());
|
|
1387
|
-
const { appName: e, pathApp: o } = this.appConst, n = this.placeData.map((
|
|
1388
|
-
let
|
|
1389
|
-
n.includes(s) ?
|
|
1391
|
+
const { appName: e, pathApp: o } = this.appConst, n = this.placeData.map((u) => u.placement);
|
|
1392
|
+
let l = this.placeData.find((u) => u.placement == s);
|
|
1393
|
+
n.includes(s) ? l.handler != o && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[s] || this.placementUnBind(l).then(() => {
|
|
1390
1394
|
window.placementUnBind[s] || (window.placementUnBind[s] = !0, this.placementBind(s));
|
|
1391
1395
|
})) : this.call({
|
|
1392
1396
|
method: "placement.bind",
|
|
@@ -1399,8 +1403,8 @@ class Te {
|
|
|
1399
1403
|
}
|
|
1400
1404
|
}
|
|
1401
1405
|
}
|
|
1402
|
-
}).then((
|
|
1403
|
-
|
|
1406
|
+
}).then((u) => {
|
|
1407
|
+
u ? console.info("Приложение успешно встроено в", s) : console.warn("Приложение не может быть встроено в", s);
|
|
1404
1408
|
});
|
|
1405
1409
|
}
|
|
1406
1410
|
/** Отвязка встройки из place */
|
|
@@ -1432,7 +1436,7 @@ class Te {
|
|
|
1432
1436
|
}
|
|
1433
1437
|
/* регистрация бота */
|
|
1434
1438
|
regBot({ code: s, type: e, name: o }) {
|
|
1435
|
-
const { appName: n, pathApp:
|
|
1439
|
+
const { appName: n, pathApp: l, chatBotLogo: u } = this.appConst, y = this.appInfo.ID;
|
|
1436
1440
|
return this.call({
|
|
1437
1441
|
method: "imbot.register",
|
|
1438
1442
|
params: {
|
|
@@ -1440,7 +1444,7 @@ class Te {
|
|
|
1440
1444
|
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1441
1445
|
TYPE: e ?? "O",
|
|
1442
1446
|
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1443
|
-
EVENT_HANDLER:
|
|
1447
|
+
EVENT_HANDLER: l,
|
|
1444
1448
|
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1445
1449
|
OPENLINE: "Y",
|
|
1446
1450
|
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|
|
@@ -1464,7 +1468,7 @@ class Te {
|
|
|
1464
1468
|
// Ссылка на сайт
|
|
1465
1469
|
PERSONAL_GENDER: "M",
|
|
1466
1470
|
// Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
|
|
1467
|
-
PERSONAL_PHOTO:
|
|
1471
|
+
PERSONAL_PHOTO: u ?? ""
|
|
1468
1472
|
// Аватар чат-бота - base64
|
|
1469
1473
|
}
|
|
1470
1474
|
}
|
|
@@ -1486,7 +1490,7 @@ Pt = new WeakSet(), ae = function() {
|
|
|
1486
1490
|
return this.call({ method: "user.current" });
|
|
1487
1491
|
};
|
|
1488
1492
|
export {
|
|
1489
|
-
|
|
1493
|
+
k as Batch,
|
|
1490
1494
|
Te as BxBoot,
|
|
1491
1495
|
Oe as BxHelper,
|
|
1492
1496
|
ye as BxLogger,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Ae=Object.defineProperty;var Te=(T,S,L)=>S in T?Ae(T,S,{enumerable:!0,configurable:!0,writable:!0,value:L}):T[S]=L;var W=(T,S,L)=>(Te(T,typeof S!="symbol"?S+"":S,L),L),zt=(T,S,L)=>{if(!S.has(T))throw TypeError("Cannot "+L)};var a=(T,S,L)=>(zt(T,S,"read from private field"),L?L.call(T):S.get(T)),_=(T,S,L)=>{if(S.has(T))throw TypeError("Cannot add the same private member more than once");S instanceof WeakSet?S.add(T):S.set(T,L)},
|
|
2
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},C={"%d":{format:function(t){return n(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return n(t.month()||r.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return n(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||r.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Lt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return Mt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return Jt[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames().indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return x[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames(!0).indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return n(t.hours()||r.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return n(t.minutes()||r.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return n(t.seconds()||r.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:r(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return n(t.year()||r.MIN_YEAR,4)+"-"+n(t.month()||r.MIN_MONTH,2)+"-"+n(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return n(t.month()||r.MIN_MONTH,2)+"/"+n(t.day()||r.MIN_DAY,2)+"/"+n(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},Wt={useMilliseconds:!1,monthFromZero:!1},d;d=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},d.fn=d.prototype,d.fn.dayCount=function(){var t=this.month(),s=r.MAX_DAY_IN_MONTHS[t-(r.options("monthFromZero")?0:1)];return this.leapYear()&&t===(r.options("monthFromZero")?1:2)&&(s+=1),s},d.fn.year=function(t){if(arguments.length!==0)(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);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},d.fn.month=function(t){if(arguments.length!==0)(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);else return this._i.month===!1?r.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},d.fn.day=function(t){if(arguments.length!==0)(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);else return this._i.day===!1?this._d.getDate():this._i.day;return this},d.fn.hours=function(t){if(arguments.length!==0)(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);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},d.fn.minutes=function(t){if(arguments.length!==0)(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);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},d.fn.seconds=function(t){if(arguments.length!==0)(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);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},d.fn.milliseconds=function(t){if(arguments.length!==0)(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);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},d.fn.week=function(){var t=new Date(this.year(),0,1),s=r(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},d.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(r.options("useMilliseconds")?1:1e3)),this;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"){var c,p=[],A,R,Z=[],Y=0,U=0,b,J,D={},H;if(t===e)return A=u(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;for(s===e&&(s=r.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(R=s.charAt(Y)+s.charAt(Y+1),C[R]!==e){switch(b=0,J="",C[R].type){case"number":for(;b<C[R].maxLength&&U+b<t.length&&!isNaN(Number(t.charAt(U+b)));)J+=t.charAt(U+b),b+=1;break;case"word":for(;b<C[R].maxLength&&U+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(U+b));)J+=t.charAt(U+b),b+=1;break;case"string":for(;b<C[R].maxLength&&U+b<t.length;)J+=t.charAt(U+b),b+=1;break}if(b<C[R].minLength)return A=u(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;p.push(R),Z.push(J),b-=1,U+=b,Y+=1}}else if(t.charAt(U)!==s.charAt(Y))return A=u(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;Y+=1,U+=1}for(c in p)p.hasOwnProperty(c)&&C.hasOwnProperty(p[c])&&(H=C[p[c]].parse(Z[c]),D={year:H.year!==e?H.year:D.year,month:H.month!==e?H.month:D.month,day:H.day!==e?H.day:D.day,hours:H.hours!==e?H.hours:D.hours,minutes:H.minutes!==e?H.minutes:D.minutes,seconds:H.seconds!==e?H.seconds:D.seconds});this.day(r.MIN_DAY),this.year(D.year),this.month(D.month),this.day(D.day),this.hours(D.hours),this.minutes(D.minutes),this.seconds(D.seconds),this.milliseconds(D.milliseconds)}return this},d.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},d.fn.timestamp=function(t){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},d.fn.utc=function(t){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)},d.fn.dayOfWeek=function(t){if(t==="long")return Mt[this._d.getDay()];if(t==="short")return Lt[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},d.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},d.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(r.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(r.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},d.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),C[c]!==e?(h+=C[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},d.fn.valid=function(){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},d.fn.errors=function(){return this._i},d.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},d.fn.calc=function(t){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},r=function(t,s,h){return new d(t,s,h)},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){if(t===e)return Wt;if(Wt.hasOwnProperty(t)){if(s===e)return Wt[t];Wt[t]=s,t==="monthFromZero"&&(r.MIN_MONTH=s?0:1,r.MAX_MONTH=s?11:12)}return e},r.noConflict=function(){return o.tempus=f,r},r.generate=function(t){var s,h,c,p,A,R,Z,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof d?s=t.dateFrom.utc():s=r(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof d?h=t.dateTo.utc():h=r(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?A={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?A={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(A={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?R=t.asObject===!0?{}:[]:(R=[],R.push([]),Z=r(s).get()[t.groupBy]),Y=function(J,D,H){return t.asObject===!0?t.format!==e?J[r(D).format(t.format)]={}:J[r(D).format("%F %H:%M:%S")]={}:t.format!==e?J.push(H?null:r(D).format(t.format)):J.push(H?null:r(D)),J},t.groupBy!==e&&t.fillNulls){var U={year:A.year?-A.year:e,month:A.month?-A.month:e,day:A.day?-A.day:e,hours:A.hours?-A.hours:e,minutes:A.minutes?-A.minutes:e,seconds:A.seconds?-A.seconds:e,milliseconds:A.milliseconds?-A.milliseconds:e};for(c=r(s).calc(U).utc();r(c).get()[t.groupBy]===Z;)Y(R[R.length-1],c,!0),c=r(c).calc(U).utc();if(t.groupBy==="week"){var b=r(s).dayOfWeek();for(c=r(s).dayOfWeek(0).utc();R[0].length<b&&c<s;)Y(R[R.length-1],c,!0),c=r(c).calc(A).utc()}}for(;s<=h;)t.groupBy===e?Y(R,s):r(s).get()[t.groupBy]===Z?Y(R[R.length-1],s):(R.push([]),Y(R[R.length-1],s),Z=r(s).get()[t.groupBy]),s=r(s).calc(A).utc();if(t.groupBy!==e&&t.fillNulls)for(p=r(h).calc(A).utc();r(p).get()[t.groupBy]===Z;)Y(R[R.length-1],p,!0),p=r(p).calc(A).utc();return R},r.monthNames=function(t){switch(t){case"long":return x;default:return Jt}},r.dayNames=function(t){switch(t){case"long":return Mt;default:return Lt}},r.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),x=F(),Jt=Rt(),Mt=nt(),Lt=ot();else return m;return e},r.availableLangs=function(){return Object.keys(N)},r.registerFormat=function(t,s,h,c,p,A){C[t]={format:s,parse:h,minLength:c,maxLength:p,type:A}},r.unregisterFormat=function(t){delete C[t]},r.detectFormat=function(t){var s,h,c;return s=y(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=l(t,c),s},E={TempusDate:d},r.classes=function(t,s){if(s===e)return E[t];E[t]=s},r.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&ye(t,function(s){N=s},function(s){})},m=(M.language||M.systemLanguage||M.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),x=F(),Jt=Rt(),Mt=nt(),Lt=ot(),w.exports&&(i=w.exports=r),i.tempus=r}).call(S)})(ht,ht.exports);var _e=ht.exports;const bt=L(_e);class j{constructor(i,e={}){_(this,at);_(this,mt);_(this,ft);_(this,Nt);_(this,_t);_(this,Ot);_(this,Ht);_(this,Yt);_(this,yt);_(this,At);_(this,Tt);_(this,ct);_(this,St);_(this,It);_(this,st);_(this,lt);_(this,dt);_(this,K,null);_(this,ut,null);_(this,q,[]);_(this,I,{});_(this,k,50);_(this,Q,!0);_(this,v,null);_(this,B,null);_(this,z,null);_(this,Dt,100);_(this,$,"no");_(this,P,!1);_(this,tt,!1);_(this,et,!1);W(this,"errors",{});W(this,"answerData",{});g(this,K,i),g(this,ut,e)}get serial(){return a(this,P)}setSerial(){g(this,P,!0),g(this,tt,!0),g(this,et,!1)}setParallel(){g(this,P,!1),g(this,tt,!1),g(this,et,!0)}stop(){g(this,Q,!1)}async batch(i,e){a(this,z)&&O(this,mt,Vt).call(this),e&&g(this,v,e),a(this,tt)===!1&&g(this,P,!1),Object.keys(i).length>500&&g(this,P,!0),g(this,Q,!0),g(this,q,[]),g(this,I,{}),this.errors={},this.answerData={};const o=O(this,Nt,Kt).call(this,i);if(Object.keys(i).length<500){const n=o.map((u,l)=>O(this,_t,qt).call(this,u,o[l]));return Promise.allSettled(n).then(u=>{let l={};for(let y of u)y.status==="fulfilled"&&(l={...l,...y.value});return l})}else{let n={},u=0,l=1,y=Object.keys(i).length||1,f=r=>{u+=Object.keys(r).length,l=Math.round(u/y*100)};for(let[r,E]of Object.entries(o)){let M=await O(this,_t,qt).call(this,E,o[r],!0);f(E),e&&e({percent:l}),n={...n,...M}}return n}}async batchTotalCount(i,e){g(this,I,{}),this.errors={};let o=1,n=0,u=Object.keys(i).length||1,l=f=>{n+=Object.keys(f).length,o=Math.round(n/u*100)};e&&e({percent:o});const y=O(this,Nt,Kt).call(this,i);if(a(this,et)){const f=y.map(r=>O(this,Ot,Qt).call(this,r).then(E=>(l(r),e&&e({percent:o}),E)));return Promise.allSettled(f).then(r=>{let E={};for(let M of r)M.status==="fulfilled"&&(E={...E,...M.value});return E})}else{let f={};for(let r of y){let E=await O(this,Ot,Qt).call(this,r);l(r),e&&e({percent:o}),f={...f,...E}}return f}}}K=new WeakMap,ut=new WeakMap,q=new WeakMap,I=new WeakMap,k=new WeakMap,Q=new WeakMap,v=new WeakMap,B=new WeakMap,z=new WeakMap,Dt=new WeakMap,$=new WeakMap,P=new WeakMap,tt=new WeakMap,et=new WeakMap,at=new WeakSet,Xt=function(){let i=0;if(!a(this,B))return Math.round(i);let e=0,o=0;return Object.values(a(this,B)).forEach(n=>{const{total:u,count:l}=n;e+=u??0,o+=l??0}),e?i=o/e*100:i=100,{percent:Math.round(i),allCount:o,allTotal:e}},mt=new WeakSet,Vt=function(){clearInterval(a(this,z)),g(this,z,""),g(this,B,""),g(this,v,""),g(this,$,"no")},ft=new WeakSet,Zt=function({key:i,value:e}){const o=O(this,st,pt).call(this,e.data()),n=Array.isArray(o)?o.length:0,u=O(this,lt,kt).call(this,e.total(),n);let l=1;o&&(l=n),a(this,v)&&(a(this,B)||g(this,B,{}),a(this,B)[i]&&a(this,B)[i].count&&(l+=a(this,B)[i].count),a(this,B)[i]={total:u,count:l},a(this,z)||g(this,z,setInterval(()=>{const{percent:y,allCount:f,allTotal:r}=a(this,at,Xt);(a(this,$)==="no"||a(this,$)<a(this,at,Xt).percent)&&(a(this,v).call(this,{data:a(this,B),percent:y,allCount:f,allTotal:r}),g(this,$,a(this,at,Xt).percent)),y===100&&O(this,mt,Vt).call(this)},a(this,Dt))))},Nt=new WeakSet,Kt=function(i){const e=[],o=Object.entries(i);for(let n=0;n<o.length;n+=a(this,k)){const u=o.slice(n,n+a(this,k));e.push(Object.fromEntries(u))}return e},_t=new WeakSet,qt=function(i,e,o){return new Promise(n=>{const u=O(this,St,ee).call(this,e),l=[];let y=0,f=0;a(this,K).call(this,i,r=>{Object.entries(r).forEach(([E,M])=>{let m={};const N=M.error();if(N&&(this.errors[E]=N,y+=1),M!=null&&M.answer&&Object.keys(M.answer).length){for(let[ot,x]of Object.entries(M.answer))ot!="result"&&x&&(m[ot]=x);Object.keys(m).length&&(this.answerData[E]=m)}const F=O(this,st,pt).call(this,M.data()),Rt=Array.isArray(F)?F.length:0,nt=O(this,lt,kt).call(this,M.total(),Rt);if(Array.isArray(F)?a(this,I)[E]=F:typeof F=="object"&&F!==null?a(this,I)[E]=Object.values(F):a(this,I)[E]=F,f+=nt,o||O(this,ft,Zt).call(this,{key:E,value:M}),nt>a(this,k)&&nt>Rt){const ot=Math.ceil(nt/a(this,k))-1,x=Array.from({length:ot});l.push([E,u[E],x])}}),f>5e3&&a(this,tt)===!1&&a(this,et)===!1&&g(this,P,!0),y>0&&O(this,dt,se).call(this),l.length?(O(this,Ht,oe).call(this,l),O(this,Yt,he).call(this).then(()=>n(O(this,ct,jt).call(this)))):n(O(this,ct,jt).call(this))})})},Ot=new WeakSet,Qt=function(i){return new Promise(e=>{const o=O(this,St,ee).call(this,i);let n=0;a(this,K).call(this,o,u=>{Object.entries(u).forEach(([l,y])=>{const f=y.error();f&&(this.errors[l]=f,n+=1);const r=O(this,st,pt).call(this,y.data()),E=Array.isArray(r)?r.length:0,M=O(this,lt,kt).call(this,y.total(),E);a(this,I)[l]=M}),n>0&&O(this,dt,se).call(this),e(O(this,ct,jt).call(this))})})},Ht=new WeakSet,oe=function(i){let e=[];i.forEach(([o,n,u])=>{u.forEach((l,y)=>{const f=y+1,r=a(this,k)*f,M=[[o,f].join("_"),O(this,It,ae).call(this,n,r)];e.length===a(this,k)?(a(this,q).push(e),e=[M]):e.push(M)})}),e.length&&a(this,q).push(e)},Yt=new WeakSet,he=function(){const i=[],e=[],o=n=>{Object.entries(n).forEach(([u,l])=>{const[y]=u.split("_"),f=O(this,st,pt).call(this,l.data());Array.isArray(f)&&a(this,I)[y].push(...f),O(this,ft,Zt).call(this,{key:y,value:l})})};return a(this,q).forEach((n,u)=>{const l=Object.fromEntries(n),y=()=>new Promise(f=>a(this,K).call(this,l,r=>{a(this,P)?o(r):e[u]=r,f()}));i.push(y)}),a(this,P)?O(this,At,$t).call(this,i):O(this,Tt,te).call(this,i).then(()=>{e.forEach(o)})},yt=new WeakSet,vt=function(){return new Promise(i=>setTimeout(i,500))},At=new WeakSet,$t=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return Promise.allSettled([e(),O(this,yt,vt).call(this)]).then(()=>a(this,Q)?O(this,At,$t).call(this,i):Promise.resolve())},Tt=new WeakSet,te=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return O(this,yt,vt).call(this).then(()=>e()).then(()=>a(this,Q)?O(this,Tt,te).call(this,i):Promise.resolve())},ct=new WeakSet,jt=function(){return Object.entries(a(this,ut)).forEach(([i,e])=>{a(this,I)[i]&&(a(this,I)[i]=e(a(this,I)[i]))}),a(this,I)},St=new WeakSet,ee=function(i){return Object.entries(i).reduce((e,[o,n])=>{if(Array.isArray(n)){const[u,l={}]=n;e[o]=[u,l]}else{const{method:u,params:l={}}=n;e[o]=[u,l]}return e},{})},It=new WeakSet,ae=function(i,e){const[o,n]=i;return[o,{start:e,...n}]},st=new WeakSet,pt=function(i){return((i==null?void 0:i.items)||(i==null?void 0:i.documents))??i},lt=new WeakSet,kt=function(i,e){return i!==i&&(i=0),i===0&&e===0?0:i||e},dt=new WeakSet,se=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([i,e])=>{console.info(`[${i}]`,e.toString())}),console.groupEnd()};class ie{constructor(){_(this,rt,{})}get hash(){return this.createHash(8)}createHash(i){let e="abcdefghijklmnopqrstuvwxyz0123456789",o="";i=i||6;for(let n=0;n<i;n++)o+=e.charAt(Math.floor(Math.random()*e.length));return o}actionFilter({keyTimer:i,duration:e=10,action:o}){a(this,rt)[i]&&(clearTimeout(a(this,rt)[i]),a(this,rt)[i]=null),o&&(a(this,rt)[i]=setTimeout(()=>{o()},e))}}rt=new WeakMap;const xt=new ie;class ne{constructor(){_(this,Bt);_(this,Et);_(this,Gt);_(this,wt);_(this,Ct);_(this,X,"logger");_(this,V,!1);_(this,Ut,2e3);_(this,it,new Map);_(this,gt,{});W(this,"periodClear",3);O(this,Bt,ce).call(this)}async init(){let i=new j(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(n=>n.ENTITY==a(this,X)))g(this,V,!0);else{let{entityAdd:n}=await i.batch({entityAdd:{method:"entity.add",params:{ENTITY:a(this,X),NAME:a(this,X),ACCESS:{AU:"X"}}}});n&&g(this,V,!0)}return O(this,wt,ue).call(this),a(this,V)}start({type:i,data:e}){if(!a(this,V)){O(this,Et,re).call(this,"entity");return}const o=xt.hash;return a(this,it).set(o,{type:i,data:e,userInfo:a(this,gt),errorList:[],status:"",answer:null,date:new Date().getTime()}),o}stop({key:i,errorList:e,status:o,answer:n}){if(!a(this,V)){O(this,Et,re).call(this,"entity");return}let u=a(this,it).get(i);e&&(u.errorList=e),o&&(u.status=o),n&&(u.answer=n),xt.actionFilter({keyTimer:"add.entity.items",duration:a(this,Ut),action:()=>{O(this,Gt,le).call(this)}})}async getEntityList(){let i=new j(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.item.get",params:{ENTITY:a(this,X),SORT:{ID:"DESC"}}}});return e=e.map(o=>{const{ID:n,DATE_CREATE:u,DETAIL_TEXT:l}=o;return{...JSON.parse(l),id:n,dateCreate:u}}),e}}X=new WeakMap,V=new WeakMap,Ut=new WeakMap,it=new WeakMap,gt=new WeakMap,Bt=new WeakSet,ce=async function(){const i=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:o}=await i.batch({curUser:{method:"user.current"}});g(this,gt,{isAdmin:e,curUser:o})},Et=new WeakSet,re=function(i){i=="entity"&&xt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Gt=new WeakSet,le=async function(){let i={},e=new j(BX24.callBatch);for(let[o,n]of a(this,it).entries())n.status&&(i[o]={method:"entity.item.add",params:{ENTITY:a(this,X),NAME:a(this,X),DETAIL_TEXT:JSON.stringify(n)}});if(Object.keys(i).length){let o=await e.batch(i),{errors:n}=e;for(let[u,l]of Object.entries({...o,...n}))a(this,it).delete(u)}},wt=new WeakSet,ue=async function(){let i=new j(BX24.callBatch),e=await this.getEntityList(),{serverTime:o}=await i.batch({serverTime:{method:"server.time"}}),n=e.filter(u=>{let{dateCreate:l}=u;return bt(new Date(l)).between(bt(new Date(o)),"month")>=this.periodClear});O(this,Ct,me).call(this,n)},Ct=new WeakSet,me=async function(i){let e=new j(BX24.callBatch),o=i.map(n=>{let{id:u}=n;return{method:"entity.item.delete",params:{ENTITY:a(this,X),ID:u}}});return await e.batch(o)};const G=new ne;class Oe{constructor(i){_(this,Pt);_(this,Ft);W(this,"domain","");W(this,"isAdmin",!1);W(this,"appInfo",null);W(this,"appConst",null);W(this,"userInfo",null);W(this,"placeData",null);W(this,"placeInfo",null);this.appConst=i}init(){return new Promise(i=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await G.init();const[o,n]=await Promise.all([O(this,Pt,fe).call(this),O(this,Ft,Ne).call(this)]);this.appInfo=o,this.userInfo=n,i(!0)})},100)})}userOption(i,e){return e?BX24.userOption.set(i,e):BX24.userOption.get(i)}call({method:i,params:e,updateList:o}){let n=G.start({type:"call",data:{method:i,params:e,updateList:o}});return new Promise(u=>{e||(e={}),BX24.callMethod(i,e,function(l){let y={};if(l!=null&&l.answer)for(let[f,r]of Object.entries(l.answer))f!="result"&&r&&(y[f]=r);if(l.error()){let f=l.error();console.error(f),G.stop({answer:y,key:n,status:"fail",errorList:[f.toSting()]}),u(!1)}else{let f=l.data();f!=null&&f.items&&(f=f.items),G.stop({answer:y,key:n,status:"success"}),u(f)}})})}async batch(i,e,{updateList:o}={}){let n=new j(BX24.callBatch),u=G.start({type:"batch",data:{commandList:i,updateList:o}});try{let l=await n.batch(i,e);if(Object.keys(n.errors).length){let y=Object.entries(n.errors).map(([f,r])=>({key:f,error:r.toSting()}));G.stop({key:u,status:"fail",errorList:y,answer:n.answerData})}else G.stop({key:u,status:"success",answer:n.answerData});return l}catch(l){return G.stop({key:u,status:"fail-runtime",errorList:[l.toSting()],answer:n.answerData}),console.error(l),!1}}async batchTotalCount(i,e){let o=new j(BX24.callBatch),n=G.start({type:"batch",data:{commandList:i}});try{let u=await o.batchTotalCount(i,e);if(Object.keys(o.errors).length){let l=Object.entries(o.errors).map(([y,f])=>({key:y,error:f.toSting()}));G.stop({key:n,status:"fail",errorList:l})}else G.stop({key:n,status:"success"});return u}catch(u){return G.stop({key:n,status:"fail",errorList:[u.toSting()]}),console.error(u),!1}}getPlacement(){return this.call({method:"placement.get"}).then(i=>(this.placeData||(this.placeData=i),i))}async placementBind(i){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:o}=this.appConst,n=this.placeData.map(l=>l.placement);let u=this.placeData.find(l=>l.placement==i);n.includes(i)?u.handler!=o&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[i]||this.placementUnBind(u).then(()=>{window.placementUnBind[i]||(window.placementUnBind[i]=!0,this.placementBind(i))})):this.call({method:"placement.bind",params:{PLACEMENT:i,HANDLER:o,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",i):console.warn("Приложение не может быть встроено в",i)})}placementUnBind(i){const{pathApp:e,appName:o}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:i,HANDLER:e,LANG_ALL:{ru:{TITLE:o}}}}).then(n=>(console.log("Встройка отвязана",i),n))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(i=>{let e=Object.values(i);return console.log("chat-bot list:",e),e})}regBot({code:i,type:e,name:o}){const{appName:n,pathApp:u,chatBotLogo:l}=this.appConst,y=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:i??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:u,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${o??n} - бот #${y}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:bt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(f=>(console.log("Чат-бот добавлен",f),f))}unRegBot(i){return this.call({method:"imbot.unregister",params:{BOT_ID:i}}).then(e=>(console.log("чат-бот удален",e),e))}}Pt=new WeakSet,fe=function(){return this.call({method:"app.info"})},Ft=new WeakSet,Ne=function(){return this.call({method:"user.current"})},T.Batch=j,T.BxBoot=Oe,T.BxHelper=ie,T.BxLogger=ne,T.tempus=bt,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
var Ae=Object.defineProperty;var Te=(T,S,L)=>S in T?Ae(T,S,{enumerable:!0,configurable:!0,writable:!0,value:L}):T[S]=L;var W=(T,S,L)=>(Te(T,typeof S!="symbol"?S+"":S,L),L),zt=(T,S,L)=>{if(!S.has(T))throw TypeError("Cannot "+L)};var a=(T,S,L)=>(zt(T,S,"read from private field"),L?L.call(T):S.get(T)),_=(T,S,L)=>{if(S.has(T))throw TypeError("Cannot add the same private member more than once");S instanceof WeakSet?S.add(T):S.set(T,L)},E=(T,S,L,ht)=>(zt(T,S,"write to private field"),ht?ht.call(T,L):S.set(T,L),L);var O=(T,S,L)=>(zt(T,S,"access private method"),L);(function(T,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(T=typeof globalThis<"u"?globalThis:T||self,S(T["szdl-utils-kit"]={}))})(this,function(T){var q,ut,Q,I,x,v,$,B,V,Dt,tt,P,et,st,at,Xt,mt,Vt,ft,Zt,Nt,Kt,_t,qt,Ot,Qt,Ht,oe,Yt,he,yt,vt,At,$t,Tt,te,ct,jt,St,ee,It,ae,rt,pt,lt,kt,dt,se,it,X,Z,Ut,nt,gt,Bt,ce,Et,re,Gt,le,wt,ue,Ct,me,Pt,fe,Ft,Ne;"use strict";var S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function L(w){return w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w}var ht={exports:{}};(function(w,i){(function(e){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,s){var h,c;for(h=s||0,c=this.length;h<c;h+=1)if(this[h]===t)return h;return-1});var o=this,n=function(t,s){for(var h=t.toString();h.length<s;)h="0"+h;return h},l=function(t,s){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},u=function(t,s){var h,c="";return h=t.slice(s,s+1),h!==""&&!isNaN(Number(h))&&(c+="%H"),h=t.charAt(s+2),h!==""&&h===":"&&(c+=h),h=t.slice(s+3,s+4),h!==""&&!isNaN(Number(h))&&(c+="%M"),h=t.charAt(s+5),h!==""&&h===":"&&(c+=h),h=t.slice(s+6,s+7),h!==""&&!isNaN(Number(h))&&(c+="%S"),c},y=function(t,s){var h,c=[t.slice(s,s+1),t.charAt(s+2),t.slice(s+3,s+4),t.charAt(s+5),t.slice(s+6,s+9)],p;return!isNaN(Number(c[0]))&&!isNaN(Number(c[2]))&&!isNaN(Number(c[4]))?(c[1]==="."&&c[3]==="."?h="%d.%m.%Y":c[1]==="-"&&c[3]==="-"?h="%m-%d-%Y":c[1]==="/"&&c[3]==="/"&&(h="%m/%d/%Y"),h):(p=[t.slice(s,s+3),t.charAt(s+4),t.slice(s+5,s+6),t.charAt(s+7),t.slice(s+8,s+9)],!isNaN(Number(p[0]))&&!isNaN(Number(p[2]))&&!isNaN(Number(p[4]))?(p[1]==="-"&&p[3]==="-"&&(h="%Y-%m-%d"),h):"")},f=o.tempus,r,d,M=o.navigator||{},m="en",N={en:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"Mar",APRIL_SHORT:"Apr",MAY_SHORT:"May",JUNE_SHORT:"Jun",JULY_SHORT:"Jul",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sep",OCTOBER_SHORT:"Oct",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dec",JANUARY_LONG:"January",FEBRUARY_LONG:"February",MARCH_LONG:"March",APRIL_LONG:"April",MAY_LONG:"May",JUNE_LONG:"June",JULY_LONG:"July",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"October",NOVEMBER_LONG:"November",DECEMBER_LONG:"December",SUNDAY_SHORT:"Sun",MONDAY_SHORT:"Mon",TUESDAY_SHORT:"Tue",WEDNESDAY_SHORT:"Wed",THURSDAY_SHORT:"Thu",FRIDAY_SHORT:"Fri",SATURDAY_SHORT:"Sat",SUNDAY_LONG:"Sunday",MONDAY_LONG:"Monday",TUESDAY_LONG:"Tuesday",WEDNESDAY_LONG:"Wednesday",THURSDAY_LONG:"Thursday",FRIDAY_LONG:"Friday",SATURDAY_LONG:"Saturday"},ru:{JANUARY_SHORT:"Янв",FEBRUARY_SHORT:"Фев",MARCH_SHORT:"Мар",APRIL_SHORT:"Апр",MAY_SHORT:"Май",JUNE_SHORT:"Июн",JULY_SHORT:"Июл",AUGUST_SHORT:"Авг",SEPTEMBER_SHORT:"Сен",OCTOBER_SHORT:"Окт",NOVEMBER_SHORT:"Ноя",DECEMBER_SHORT:"Дек",JANUARY_LONG:"Январь",FEBRUARY_LONG:"Февраль",MARCH_LONG:"Март",APRIL_LONG:"Апрель",MAY_LONG:"Май",JUNE_LONG:"Июнь",JULY_LONG:"Июль",AUGUST_LONG:"Август",SEPTEMBER_LONG:"Сентябрь",OCTOBER_LONG:"Октябрь",NOVEMBER_LONG:"Ноябрь",DECEMBER_LONG:"Декабрь",SUNDAY_SHORT:"Вс",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Воскресенье",MONDAY_LONG:"Понедельник",TUESDAY_LONG:"Вторник",WEDNESDAY_LONG:"Среда",THURSDAY_LONG:"Четверг",FRIDAY_LONG:"Пятница",SATURDAY_LONG:"Суббота"},ua:{JANUARY_SHORT:"Січ",FEBRUARY_SHORT:"Лют",MARCH_SHORT:"Берез",APRIL_SHORT:"Квіт",MAY_SHORT:"Трав",JUNE_SHORT:"Черв",JULY_SHORT:"Лип",AUGUST_SHORT:"Серп",SEPTEMBER_SHORT:"Верес",OCTOBER_SHORT:"Жовт",NOVEMBER_SHORT:"Листоп",DECEMBER_SHORT:"Груд",JANUARY_LONG:"Січень",FEBRUARY_LONG:"Лютий",MARCH_LONG:"Березень",APRIL_LONG:"Квітень",MAY_LONG:"Травень",JUNE_LONG:"Червень",JULY_LONG:"Липень",AUGUST_LONG:"Серпень",SEPTEMBER_LONG:"Вересень",OCTOBER_LONG:"Жовтень",NOVEMBER_LONG:"Листопад",DECEMBER_LONG:"Грудень",SUNDAY_SHORT:"Нд",MONDAY_SHORT:"Пн",TUESDAY_SHORT:"Вт",WEDNESDAY_SHORT:"Ср",THURSDAY_SHORT:"Чт",FRIDAY_SHORT:"Пт",SATURDAY_SHORT:"Сб",SUNDAY_LONG:"Неділя",MONDAY_LONG:"Понеділок",TUESDAY_LONG:"Вівторок",WEDNESDAY_LONG:"Середа",THURSDAY_LONG:"Четвер",FRIDAY_LONG:"П’ятниця",SATURDAY_LONG:"Субота"},de:{JANUARY_SHORT:"Jan",FEBRUARY_SHORT:"Feb",MARCH_SHORT:"März",APRIL_SHORT:"Apr",MAY_SHORT:"Mai",JUNE_SHORT:"Juni",JULY_SHORT:"Juli",AUGUST_SHORT:"Aug",SEPTEMBER_SHORT:"Sept",OCTOBER_SHORT:"Okt",NOVEMBER_SHORT:"Nov",DECEMBER_SHORT:"Dez",JANUARY_LONG:"Januar",FEBRUARY_LONG:"Februar",MARCH_LONG:"März",APRIL_LONG:"April",MAY_LONG:"Mai",JUNE_LONG:"Juni",JULY_LONG:"Juli",AUGUST_LONG:"August",SEPTEMBER_LONG:"September",OCTOBER_LONG:"Oktober",NOVEMBER_LONG:"November",DECEMBER_LONG:"Dezember",SUNDAY_SHORT:"So",MONDAY_SHORT:"Mo",TUESDAY_SHORT:"Di",WEDNESDAY_SHORT:"Mi",THURSDAY_SHORT:"Do",FRIDAY_SHORT:"Fr",SATURDAY_SHORT:"Sa",SUNDAY_LONG:"Sonntag",MONDAY_LONG:"Montag",TUESDAY_LONG:"Dienstag",WEDNESDAY_LONG:"Mittwoch",THURSDAY_LONG:"Donnerstag",FRIDAY_LONG:"Freitag",SATURDAY_LONG:"Samstag"}},F=function(){return[N[m].JANUARY_LONG,N[m].FEBRUARY_LONG,N[m].MARCH_LONG,N[m].APRIL_LONG,N[m].MAY_LONG,N[m].JUNE_LONG,N[m].JULY_LONG,N[m].AUGUST_LONG,N[m].SEPTEMBER_LONG,N[m].OCTOBER_LONG,N[m].NOVEMBER_LONG,N[m].DECEMBER_LONG]},Rt=function(){return[N[m].JANUARY_SHORT,N[m].FEBRUARY_SHORT,N[m].MARCH_SHORT,N[m].APRIL_SHORT,N[m].MAY_SHORT,N[m].JUNE_SHORT,N[m].JULY_SHORT,N[m].AUGUST_SHORT,N[m].SEPTEMBER_SHORT,N[m].OCTOBER_SHORT,N[m].NOVEMBER_SHORT,N[m].DECEMBER_SHORT]},ot=function(){return[N[m].SUNDAY_LONG,N[m].MONDAY_LONG,N[m].TUESDAY_LONG,N[m].WEDNESDAY_LONG,N[m].THURSDAY_LONG,N[m].FRIDAY_LONG,N[m].SATURDAY_LONG]},z=function(){return[N[m].SUNDAY_SHORT,N[m].MONDAY_SHORT,N[m].TUESDAY_SHORT,N[m].WEDNESDAY_SHORT,N[m].THURSDAY_SHORT,N[m].FRIDAY_SHORT,N[m].SATURDAY_SHORT]},j,Jt,Mt,Lt,ye=function(t,s,h){var c;o.XMLHttpRequest?c=new XMLHttpRequest:c=new ActiveXObject("Microsoft.XMLHTTP"),c.onreadystatechange=function(){c.readyState===4&&(c.status===200?s&&(o.JSON===e?alert(`Please, include json2 into your project if you want use old browsers!
|
|
2
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):h&&h(c))},c.open("GET",t,!1),c.send()},C={"%d":{format:function(t){return n(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t);return{day:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%m":{format:function(t){return n(t.month()||r.MIN_MONTH,2)},parse:function(t){var s=Number(t);return{month:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%Y":{format:function(t){return n(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t);return{year:isNaN(s)?e:s}},minLength:4,maxLength:4,type:"number"},"%w":{format:function(t){return t.dayOfWeek()||r.MIN_DAY_OF_WEEK},parse:function(){return{}},minLength:1,maxLength:1,type:"number"},"%a":{format:function(t){var s=t.dayOfWeek();return Lt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%A":{format:function(t){var s=t.dayOfWeek();return Mt[s!==e?s:r.MIN_DAY_OF_WEEK]},parse:function(){return{}},minLength:1,maxLength:999,type:"word"},"%b":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return Jt[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames().indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%B":{format:function(t){var s=r.options("monthFromZero")?t.month():t.month()-1;return j[s!==e?s:r.MIN_MONTH]},parse:function(t){var s=r.monthNames(!0).indexOf(t)+(r.options("monthFromZero")?0:1);return{month:s!==-1?s:e}},minLength:1,maxLength:999,type:"word"},"%H":{format:function(t){return n(t.hours()||r.MIN_HOURS,2)},parse:function(t){var s=Number(t);return{hours:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%M":{format:function(t){return n(t.minutes()||r.MIN_MINUTES,2)},parse:function(t){var s=Number(t);return{minutes:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%S":{format:function(t){return n(t.seconds()||r.MIN_SECONDS,2)},parse:function(t){var s=Number(t);return{seconds:isNaN(s)?e:s}},minLength:2,maxLength:2,type:"number"},"%s":{format:function(t){return t.timestamp()},parse:function(t){return isNaN(Number(t))?{}:r(Number(t)).get()},minLength:1,maxLength:20,type:"number"},"%F":{format:function(t){return n(t.year()||r.MIN_YEAR,4)+"-"+n(t.month()||r.MIN_MONTH,2)+"-"+n(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),h=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:h,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return n(t.month()||r.MIN_MONTH,2)+"/"+n(t.day()||r.MIN_DAY,2)+"/"+n(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),h=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:h}},minLength:10,maxLength:10,type:"string"}},Wt={useMilliseconds:!1,monthFromZero:!1},g;g=function(t,s,h){return this._d=new Date,this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t!==e&&this.set(t,s,h),this},g.fn=g.prototype,g.fn.dayCount=function(){var t=this.month(),s=r.MAX_DAY_IN_MONTHS[t-(r.options("monthFromZero")?0:1)];return this.leapYear()&&t===(r.options("monthFromZero")?1:2)&&(s+=1),s},g.fn.year=function(t){if(arguments.length!==0)(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);else return this._i.year===!1?this._d.getFullYear():this._i.year;return this},g.fn.month=function(t){if(arguments.length!==0)(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);else return this._i.month===!1?r.options("monthFromZero")?this._d.getMonth():this._d.getMonth()+1:this._i.month;return this},g.fn.day=function(t){if(arguments.length!==0)(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);else return this._i.day===!1?this._d.getDate():this._i.day;return this},g.fn.hours=function(t){if(arguments.length!==0)(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);else return this._i.hours===!1?this._d.getHours():this._i.hours;return this},g.fn.minutes=function(t){if(arguments.length!==0)(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);else return this._i.minutes===!1?this._d.getMinutes():this._i.minutes;return this},g.fn.seconds=function(t){if(arguments.length!==0)(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);else return this._i.seconds===!1?this._d.getSeconds():this._i.seconds;return this},g.fn.milliseconds=function(t){if(arguments.length!==0)(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);else return this._i.milliseconds===!1?this._d.getMilliseconds():this._i.milliseconds;return this},g.fn.week=function(){var t=new Date(this.year(),0,1),s=r(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc()*1e3;return Math.ceil(((s-t.getTime())/864e5+t.getDay()+1)/7)},g.fn.set=function(t,s,h){if(this._i={year:!1,month:!1,day:!1,hours:!1,minutes:!1,seconds:!1,milliseconds:!1},t===e)return this._d=new Date,this;if(t instanceof Date)return this._d=t,this;if(typeof t=="number")return this._d=new Date(t*(r.options("useMilliseconds")?1:1e3)),this;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"){var c,p=[],A,R,K=[],Y=0,U=0,b,J,D={},H;if(t===e)return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;for(s===e&&(s=r.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(R=s.charAt(Y)+s.charAt(Y+1),C[R]!==e){switch(b=0,J="",C[R].type){case"number":for(;b<C[R].maxLength&&U+b<t.length&&!isNaN(Number(t.charAt(U+b)));)J+=t.charAt(U+b),b+=1;break;case"word":for(;b<C[R].maxLength&&U+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(U+b));)J+=t.charAt(U+b),b+=1;break;case"string":for(;b<C[R].maxLength&&U+b<t.length;)J+=t.charAt(U+b),b+=1;break}if(b<C[R].minLength)return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;p.push(R),K.push(J),b-=1,U+=b,Y+=1}}else if(t.charAt(U)!==s.charAt(Y))return A=l(this,h),A===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),A;Y+=1,U+=1}for(c in p)p.hasOwnProperty(c)&&C.hasOwnProperty(p[c])&&(H=C[p[c]].parse(K[c]),D={year:H.year!==e?H.year:D.year,month:H.month!==e?H.month:D.month,day:H.day!==e?H.day:D.day,hours:H.hours!==e?H.hours:D.hours,minutes:H.minutes!==e?H.minutes:D.minutes,seconds:H.seconds!==e?H.seconds:D.seconds});this.day(r.MIN_DAY),this.year(D.year),this.month(D.month),this.day(D.day),this.hours(D.hours),this.minutes(D.minutes),this.seconds(D.seconds),this.milliseconds(D.milliseconds)}return this},g.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},g.fn.timestamp=function(t){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},g.fn.utc=function(t){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)},g.fn.dayOfWeek=function(t){if(t==="long")return Mt[this._d.getDay()];if(t==="short")return Lt[this._d.getDay()];if(t===e)return this._d.getDay();if(t===0||t==="Sunday")return this.calc({day:-this.dayOfWeek()});if(t===1||t==="Monday")return this.calc({day:(this.dayOfWeek()===0?-6:1)-this.dayOfWeek()});if(t===2||t==="Tuesday")return this.calc({day:(this.dayOfWeek()===0?-5:2)-this.dayOfWeek()});if(t===3||t==="Wednesday")return this.calc({day:(this.dayOfWeek()===0?-4:3)-this.dayOfWeek()});if(t===4||t==="Thursday")return this.calc({day:(this.dayOfWeek()===0?-3:4)-this.dayOfWeek()});if(t===5||t==="Friday")return this.calc({day:(this.dayOfWeek()===0?-2:5)-this.dayOfWeek()});if(t===6||t==="Saturday")return this.calc({day:(this.dayOfWeek()===0?-1:6)-this.dayOfWeek()})},g.fn.timezone=function(t){switch(t){case"hours":return Math.floor(this._d.getTimezoneOffset()/60);case"minutes":return this._d.getTimezoneOffset();default:return this._d.getTimezoneOffset()*60}},g.fn.get=function(t){switch(t){case"Date":return new Date(this.year(),this.month()-(r.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds());case"DateUTC":return new Date(Date.UTC(this.year(),this.month()-(r.options("monthFromZero")?0:1),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()));case"Array":return[this.year(),this.month(),this.day(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()];default:return{year:this.year(),month:this.month(),week:this.week(),day:this.day(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds(),utc:this.utc(),dayOfWeek:this.dayOfWeek(),dayOfWeekShort:this.dayOfWeek("short"),dayOfWeekLong:this.dayOfWeek("long"),timestamp:this.timestamp()}}},g.fn.format=function(t){for(var s=0,h="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),C[c]!==e?(h+=C[c].format(this),s+=1):h+="%"):h+=t.charAt(s),s+=1;return h},g.fn.valid=function(){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},g.fn.errors=function(){return this._i},g.fn.between=function(t,s){var h=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-h)/31556952);case"month":return Math.floor((c-h)/2629746);case"day":return Math.floor((c-h)/86400);case"hours":return Math.floor((c-h)/3600);case"minutes":return Math.floor((c-h)/60);case"seconds":return c-h;default:return e}},g.fn.calc=function(t){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},r=function(t,s,h){return new g(t,s,h)},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){if(t===e)return Wt;if(Wt.hasOwnProperty(t)){if(s===e)return Wt[t];Wt[t]=s,t==="monthFromZero"&&(r.MIN_MONTH=s?0:1,r.MAX_MONTH=s?11:12)}return e},r.noConflict=function(){return o.tempus=f,r},r.generate=function(t){var s,h,c,p,A,R,K,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof g?s=t.dateFrom.utc():s=r(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof g?h=t.dateTo.utc():h=r(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?A={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?A={year:t.period==="year"?1:0,month:t.period==="month"?1:0,day:t.period==="day"?1:0,hours:t.period==="hours"?1:0,minutes:t.period==="minutes"?1:0,seconds:t.period==="seconds"?1:0}:typeof t.period=="object"&&(A={year:t.period.year!==e?t.period.year:0,month:t.period.month!==e?t.period.month:0,day:t.period.day!==e?t.period.day:0,hours:t.period.hours!==e?t.period.hours:0,minutes:t.period.minutes!==e?t.period.minutes:0,seconds:t.period.seconds!==e?t.period.seconds:0}),t.groupBy===e?R=t.asObject===!0?{}:[]:(R=[],R.push([]),K=r(s).get()[t.groupBy]),Y=function(J,D,H){return t.asObject===!0?t.format!==e?J[r(D).format(t.format)]={}:J[r(D).format("%F %H:%M:%S")]={}:t.format!==e?J.push(H?null:r(D).format(t.format)):J.push(H?null:r(D)),J},t.groupBy!==e&&t.fillNulls){var U={year:A.year?-A.year:e,month:A.month?-A.month:e,day:A.day?-A.day:e,hours:A.hours?-A.hours:e,minutes:A.minutes?-A.minutes:e,seconds:A.seconds?-A.seconds:e,milliseconds:A.milliseconds?-A.milliseconds:e};for(c=r(s).calc(U).utc();r(c).get()[t.groupBy]===K;)Y(R[R.length-1],c,!0),c=r(c).calc(U).utc();if(t.groupBy==="week"){var b=r(s).dayOfWeek();for(c=r(s).dayOfWeek(0).utc();R[0].length<b&&c<s;)Y(R[R.length-1],c,!0),c=r(c).calc(A).utc()}}for(;s<=h;)t.groupBy===e?Y(R,s):r(s).get()[t.groupBy]===K?Y(R[R.length-1],s):(R.push([]),Y(R[R.length-1],s),K=r(s).get()[t.groupBy]),s=r(s).calc(A).utc();if(t.groupBy!==e&&t.fillNulls)for(p=r(h).calc(A).utc();r(p).get()[t.groupBy]===K;)Y(R[R.length-1],p,!0),p=r(p).calc(A).utc();return R},r.monthNames=function(t){switch(t){case"long":return j;default:return Jt}},r.dayNames=function(t){switch(t){case"long":return Mt;default:return Lt}},r.lang=function(t){if(t!==e)m=t,N[m]===e&&(m="en"),j=F(),Jt=Rt(),Mt=ot(),Lt=z();else return m;return e},r.availableLangs=function(){return Object.keys(N)},r.registerFormat=function(t,s,h,c,p,A){C[t]={format:s,parse:h,minLength:c,maxLength:p,type:A}},r.unregisterFormat=function(t){delete C[t]},r.detectFormat=function(t){var s,h,c;return s=y(t,0),s!==""&&(c=10),h=t.charAt(c),(h==="T"||h===" ")&&(s+=h,c+=1),s+=u(t,c),s},d={TempusDate:g},r.classes=function(t,s){if(s===e)return d[t];d[t]=s},r.loadTranslations=function(t){typeof t=="object"?N=t:typeof t=="string"&&ye(t,function(s){N=s},function(s){})},m=(M.language||M.systemLanguage||M.userLanguage||"en").substr(0,2).toLowerCase(),N[m]===e&&(m="en"),j=F(),Jt=Rt(),Mt=ot(),Lt=z(),w.exports&&(i=w.exports=r),i.tempus=r}).call(S)})(ht,ht.exports);var _e=ht.exports;const bt=L(_e);class k{constructor(i,e={}){_(this,at);_(this,mt);_(this,ft);_(this,Nt);_(this,_t);_(this,Ot);_(this,Ht);_(this,Yt);_(this,yt);_(this,At);_(this,Tt);_(this,ct);_(this,St);_(this,It);_(this,rt);_(this,lt);_(this,dt);_(this,q,null);_(this,ut,null);_(this,Q,[]);_(this,I,{});_(this,x,50);_(this,v,!0);_(this,$,null);_(this,B,null);_(this,V,null);_(this,Dt,100);_(this,tt,"no");_(this,P,!1);_(this,et,!1);_(this,st,!1);W(this,"errors",{});W(this,"answerData",{});E(this,q,i),E(this,ut,e)}get serial(){return a(this,P)}setSerial(){E(this,P,!0),E(this,et,!0),E(this,st,!1)}setParallel(){E(this,P,!1),E(this,et,!1),E(this,st,!0)}stop(){E(this,v,!1)}async batch(i,e){a(this,V)&&O(this,mt,Vt).call(this),e&&E(this,$,e),a(this,et)===!1&&E(this,P,!1),Object.keys(i).length>500&&E(this,P,!0),E(this,v,!0),E(this,Q,[]),E(this,I,{}),this.errors={},this.answerData={};const o=O(this,Nt,Kt).call(this,i);if(Object.keys(i).length<500){const n=o.map((l,u)=>O(this,_t,qt).call(this,l,o[u]));return Promise.allSettled(n).then(l=>{let u={};for(let y of l)y.status==="fulfilled"&&(u={...u,...y.value});return u})}else{let n={},l=0,u=1,y=Object.keys(i).length||1,f=r=>{l+=Object.keys(r).length,u=Math.round(l/y*100)};for(let[r,d]of Object.entries(o)){let M=await O(this,_t,qt).call(this,d,o[r],!0);f(d),e&&e({percent:u}),n={...n,...M}}return n}}async batchTotalCount(i,e){E(this,I,{}),this.errors={};let o=1,n=0,l=Object.keys(i).length||1,u=f=>{n+=Object.keys(f).length,o=Math.round(n/l*100)};e&&e({percent:o});const y=O(this,Nt,Kt).call(this,i);if(a(this,st)){const f=y.map(r=>O(this,Ot,Qt).call(this,r).then(d=>(u(r),e&&e({percent:o}),d)));return Promise.allSettled(f).then(r=>{let d={};for(let M of r)M.status==="fulfilled"&&(d={...d,...M.value});return d})}else{let f={};for(let r of y){let d=await O(this,Ot,Qt).call(this,r);u(r),e&&e({percent:o}),f={...f,...d}}return f}}}q=new WeakMap,ut=new WeakMap,Q=new WeakMap,I=new WeakMap,x=new WeakMap,v=new WeakMap,$=new WeakMap,B=new WeakMap,V=new WeakMap,Dt=new WeakMap,tt=new WeakMap,P=new WeakMap,et=new WeakMap,st=new WeakMap,at=new WeakSet,Xt=function(){let i=0;if(!a(this,B))return Math.round(i);let e=0,o=0;return Object.values(a(this,B)).forEach(n=>{const{total:l,count:u}=n;e+=l??0,o+=u??0}),e?i=o/e*100:i=100,{percent:Math.round(i),allCount:o,allTotal:e}},mt=new WeakSet,Vt=function(){clearInterval(a(this,V)),E(this,V,""),E(this,B,""),E(this,$,""),E(this,tt,"no")},ft=new WeakSet,Zt=function({key:i,value:e}){const o=O(this,rt,pt).call(this,e.data()),n=Array.isArray(o)?o.length:0,l=O(this,lt,kt).call(this,e.total(),n);let u=1;o&&(u=n),a(this,$)&&(a(this,B)||E(this,B,{}),a(this,B)[i]&&a(this,B)[i].count&&(u+=a(this,B)[i].count),a(this,B)[i]={total:l,count:u},a(this,V)||E(this,V,setInterval(()=>{const{percent:y,allCount:f,allTotal:r}=a(this,at,Xt);(a(this,tt)==="no"||a(this,tt)<a(this,at,Xt).percent)&&(a(this,$).call(this,{data:a(this,B),percent:y,allCount:f,allTotal:r}),E(this,tt,a(this,at,Xt).percent)),y===100&&O(this,mt,Vt).call(this)},a(this,Dt))))},Nt=new WeakSet,Kt=function(i){const e=[],o=Object.entries(i);for(let n=0;n<o.length;n+=a(this,x)){const l=o.slice(n,n+a(this,x));e.push(Object.fromEntries(l))}return e},_t=new WeakSet,qt=function(i,e,o){return new Promise(n=>{const l=O(this,St,ee).call(this,e),u=[];let y=0,f=0;a(this,q).call(this,i,r=>{Object.entries(r).forEach(([d,M])=>{let m={};const N=M.error();if(N){let{query:{method:z},answer:j}=M;this.errors[d]={error:N,method:z},y+=1}if(M!=null&&M.answer&&Object.keys(M.answer).length){for(let[z,j]of Object.entries(M.answer))z!="result"&&j&&(m[z]=j);Object.keys(m).length&&(this.answerData[d]=m)}const F=O(this,rt,pt).call(this,M.data()),Rt=Array.isArray(F)?F.length:0,ot=O(this,lt,kt).call(this,M.total(),Rt);if(Array.isArray(F)?a(this,I)[d]=F:typeof F=="object"&&F!==null&&Object.keys(F).length===0?a(this,I)[d]=[]:a(this,I)[d]=F,f+=ot,o||O(this,ft,Zt).call(this,{key:d,value:M}),ot>a(this,x)&&ot>Rt){const z=Math.ceil(ot/a(this,x))-1,j=Array.from({length:z});u.push([d,l[d],j])}}),f>5e3&&a(this,et)===!1&&a(this,st)===!1&&E(this,P,!0),y>0&&O(this,dt,se).call(this),u.length?(O(this,Ht,oe).call(this,u),O(this,Yt,he).call(this).then(()=>n(O(this,ct,jt).call(this)))):n(O(this,ct,jt).call(this))})})},Ot=new WeakSet,Qt=function(i){return new Promise(e=>{const o=O(this,St,ee).call(this,i);let n=0;a(this,q).call(this,o,l=>{Object.entries(l).forEach(([u,y])=>{const f=y.error();f&&(this.errors[u]=f,n+=1);const r=O(this,rt,pt).call(this,y.data()),d=Array.isArray(r)?r.length:0,M=O(this,lt,kt).call(this,y.total(),d);a(this,I)[u]=M}),n>0&&O(this,dt,se).call(this),e(O(this,ct,jt).call(this))})})},Ht=new WeakSet,oe=function(i){let e=[];i.forEach(([o,n,l])=>{l.forEach((u,y)=>{const f=y+1,r=a(this,x)*f,M=[[o,f].join("_"),O(this,It,ae).call(this,n,r)];e.length===a(this,x)?(a(this,Q).push(e),e=[M]):e.push(M)})}),e.length&&a(this,Q).push(e)},Yt=new WeakSet,he=function(){const i=[],e=[],o=n=>{Object.entries(n).forEach(([l,u])=>{const[y]=l.split("_"),f=O(this,rt,pt).call(this,u.data());Array.isArray(f)&&a(this,I)[y].push(...f),O(this,ft,Zt).call(this,{key:y,value:u})})};return a(this,Q).forEach((n,l)=>{const u=Object.fromEntries(n),y=()=>new Promise(f=>a(this,q).call(this,u,r=>{a(this,P)?o(r):e[l]=r,f()}));i.push(y)}),a(this,P)?O(this,At,$t).call(this,i):O(this,Tt,te).call(this,i).then(()=>{e.forEach(o)})},yt=new WeakSet,vt=function(){return new Promise(i=>setTimeout(i,500))},At=new WeakSet,$t=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return Promise.allSettled([e(),O(this,yt,vt).call(this)]).then(()=>a(this,v)?O(this,At,$t).call(this,i):Promise.resolve())},Tt=new WeakSet,te=function(i){if(!i.length)return Promise.resolve();const e=i.shift();return O(this,yt,vt).call(this).then(()=>e()).then(()=>a(this,v)?O(this,Tt,te).call(this,i):Promise.resolve())},ct=new WeakSet,jt=function(){return Object.entries(a(this,ut)).forEach(([i,e])=>{a(this,I)[i]&&(a(this,I)[i]=e(a(this,I)[i]))}),a(this,I)},St=new WeakSet,ee=function(i){return Object.entries(i).reduce((e,[o,n])=>{if(Array.isArray(n)){const[l,u={}]=n;e[o]=[l,u]}else{const{method:l,params:u={}}=n;e[o]=[l,u]}return e},{})},It=new WeakSet,ae=function(i,e){const[o,n]=i;return[o,{start:e,...n}]},rt=new WeakSet,pt=function(i){return((i==null?void 0:i.items)||(i==null?void 0:i.documents))??i},lt=new WeakSet,kt=function(i,e){return i!==i&&(i=0),i===0&&e===0?0:i||e},dt=new WeakSet,se=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([i,e])=>{console.info(`[${i}]`,e.toString())}),console.groupEnd()};class ie{constructor(){_(this,it,{})}get hash(){return this.createHash(8)}createHash(i){let e="abcdefghijklmnopqrstuvwxyz0123456789",o="";i=i||6;for(let n=0;n<i;n++)o+=e.charAt(Math.floor(Math.random()*e.length));return o}actionFilter({keyTimer:i,duration:e=10,action:o}){a(this,it)[i]&&(clearTimeout(a(this,it)[i]),a(this,it)[i]=null),o&&(a(this,it)[i]=setTimeout(()=>{o()},e))}}it=new WeakMap;const xt=new ie;class ne{constructor(){_(this,Bt);_(this,Et);_(this,Gt);_(this,wt);_(this,Ct);_(this,X,"logger");_(this,Z,!1);_(this,Ut,2e3);_(this,nt,new Map);_(this,gt,{});W(this,"periodClear",3);O(this,Bt,ce).call(this)}async init(){let i=new k(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(n=>n.ENTITY==a(this,X)))E(this,Z,!0);else{let{entityAdd:n}=await i.batch({entityAdd:{method:"entity.add",params:{ENTITY:a(this,X),NAME:a(this,X),ACCESS:{AU:"X"}}}});n&&E(this,Z,!0)}return O(this,wt,ue).call(this),a(this,Z)}start({type:i,data:e}){if(!a(this,Z)){O(this,Et,re).call(this,"entity");return}const o=xt.hash;return a(this,nt).set(o,{type:i,data:e,userInfo:a(this,gt),errorList:[],status:"",answer:null,date:new Date().getTime()}),o}stop({key:i,errorList:e,status:o,answer:n}){if(!a(this,Z)){O(this,Et,re).call(this,"entity");return}let l=a(this,nt).get(i);e&&(l.errorList=e),o&&(l.status=o),n&&(l.answer=n),xt.actionFilter({keyTimer:"add.entity.items",duration:a(this,Ut),action:()=>{O(this,Gt,le).call(this)}})}async getEntityList(){let i=new k(BX24.callBatch),{entityList:e}=await i.batch({entityList:{method:"entity.item.get",params:{ENTITY:a(this,X),SORT:{ID:"DESC"}}}});return e=e.map(o=>{const{ID:n,DATE_CREATE:l,DETAIL_TEXT:u}=o;return{...JSON.parse(u),id:n,dateCreate:l}}),e}}X=new WeakMap,Z=new WeakMap,Ut=new WeakMap,nt=new WeakMap,gt=new WeakMap,Bt=new WeakSet,ce=async function(){const i=new k(BX24.callBatch),e=BX24.isAdmin(),{curUser:o}=await i.batch({curUser:{method:"user.current"}});E(this,gt,{isAdmin:e,curUser:o})},Et=new WeakSet,re=function(i){i=="entity"&&xt.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},Gt=new WeakSet,le=async function(){let i={},e=new k(BX24.callBatch);for(let[o,n]of a(this,nt).entries())n.status&&(i[o]={method:"entity.item.add",params:{ENTITY:a(this,X),NAME:a(this,X),DETAIL_TEXT:JSON.stringify(n)}});if(Object.keys(i).length){let o=await e.batch(i),{errors:n}=e;for(let[l,u]of Object.entries({...o,...n}))a(this,nt).delete(l)}},wt=new WeakSet,ue=async function(){let i=new k(BX24.callBatch),e=await this.getEntityList(),{serverTime:o}=await i.batch({serverTime:{method:"server.time"}}),n=e.filter(l=>{let{dateCreate:u}=l;return bt(new Date(u)).between(bt(new Date(o)),"month")>=this.periodClear});O(this,Ct,me).call(this,n)},Ct=new WeakSet,me=async function(i){let e=new k(BX24.callBatch),o=i.map(n=>{let{id:l}=n;return{method:"entity.item.delete",params:{ENTITY:a(this,X),ID:l}}});return await e.batch(o)};const G=new ne;class Oe{constructor(i){_(this,Pt);_(this,Ft);W(this,"domain","");W(this,"isAdmin",!1);W(this,"appInfo",null);W(this,"appConst",null);W(this,"userInfo",null);W(this,"placeData",null);W(this,"placeInfo",null);this.appConst=i}init(){return new Promise(i=>{let e=setInterval(()=>{window.BX24&&BX24.init(async()=>{console.info("init BX24"),clearInterval(e),this.domain=BX24.getDomain(),this.isAdmin=BX24.isAdmin(),this.placeInfo=BX24.placement.info(),await G.init();const[o,n]=await Promise.all([O(this,Pt,fe).call(this),O(this,Ft,Ne).call(this)]);this.appInfo=o,this.userInfo=n,i(!0)})},100)})}userOption(i,e){return e?BX24.userOption.set(i,e):BX24.userOption.get(i)}call({method:i,params:e,updateList:o}){let n=G.start({type:"call",data:{method:i,params:e,updateList:o}});return new Promise(l=>{e||(e={}),BX24.callMethod(i,e,function(u){let y={};if(u!=null&&u.answer)for(let[f,r]of Object.entries(u.answer))f!="result"&&r&&(y[f]=r);if(u.error()){let f=u.error();console.error(f),G.stop({answer:y,key:n,status:"fail",errorList:[f.toSting()]}),l(!1)}else{let f=u.data();f!=null&&f.items&&(f=f.items),G.stop({answer:y,key:n,status:"success"}),l(f)}})})}async batch(i,e,{updateList:o,errorCall:n}={}){let l=new k(BX24.callBatch),u=G.start({type:"batch",data:{commandList:i,updateList:o}});try{let y=await l.batch(i,e);if(Object.keys(l.errors).length){let f=Object.entries(l.errors).map(([r,d])=>({key:r,error:d.toSting()}));n&&n(l.errors),G.stop({key:u,status:"fail",errorList:f,answer:l.answerData})}else G.stop({key:u,status:"success",answer:l.answerData});return y}catch(y){return G.stop({key:u,status:"fail-runtime",errorList:[y.toSting()],answer:l.answerData}),console.error(y),!1}}async batchTotalCount(i,e){let o=new k(BX24.callBatch),n=G.start({type:"batch",data:{commandList:i}});try{let l=await o.batchTotalCount(i,e);if(Object.keys(o.errors).length){let u=Object.entries(o.errors).map(([y,f])=>({key:y,error:f.toSting()}));G.stop({key:n,status:"fail",errorList:u})}else G.stop({key:n,status:"success"});return l}catch(l){return G.stop({key:n,status:"fail",errorList:[l.toSting()]}),console.error(l),!1}}getPlacement(){return this.call({method:"placement.get"}).then(i=>(this.placeData||(this.placeData=i),i))}async placementBind(i){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:o}=this.appConst,n=this.placeData.map(u=>u.placement);let l=this.placeData.find(u=>u.placement==i);n.includes(i)?l.handler!=o&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[i]||this.placementUnBind(l).then(()=>{window.placementUnBind[i]||(window.placementUnBind[i]=!0,this.placementBind(i))})):this.call({method:"placement.bind",params:{PLACEMENT:i,HANDLER:o,LANG_ALL:{ru:{TITLE:e}}}}).then(u=>{u?console.info("Приложение успешно встроено в",i):console.warn("Приложение не может быть встроено в",i)})}placementUnBind(i){const{pathApp:e,appName:o}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:i,HANDLER:e,LANG_ALL:{ru:{TITLE:o}}}}).then(n=>(console.log("Встройка отвязана",i),n))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(i=>{let e=Object.values(i);return console.log("chat-bot list:",e),e})}regBot({code:i,type:e,name:o}){const{appName:n,pathApp:l,chatBotLogo:u}=this.appConst,y=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:i??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:l,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${o??n} - бот #${y}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:bt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:u??""}}}).then(f=>(console.log("Чат-бот добавлен",f),f))}unRegBot(i){return this.call({method:"imbot.unregister",params:{BOT_ID:i}}).then(e=>(console.log("чат-бот удален",e),e))}}Pt=new WeakSet,fe=function(){return this.call({method:"app.info"})},Ft=new WeakSet,Ne=function(){return this.call({method:"user.current"})},T.Batch=k,T.BxBoot=Oe,T.BxHelper=ie,T.BxLogger=ne,T.tempus=bt,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
package/dist/types/bx-boot.d.ts
CHANGED
|
@@ -105,14 +105,18 @@ declare class BxBoot{
|
|
|
105
105
|
/**
|
|
106
106
|
* Пакетный запрос данных
|
|
107
107
|
* @param commandList - лист команд можно передавать как в виде объекта, так и в виде массива команд
|
|
108
|
-
* @param progressCall - принимает callback в
|
|
108
|
+
* @param progressCall - принимает callback, в котором возвращается передается статус загрузки данных в процентах
|
|
109
109
|
* @param updateList - лист update данных, которые нужно записать в сессию логгера,
|
|
110
110
|
* для возможности отката к старым значениям
|
|
111
|
+
* @param errorCall - принимает callback, в котором возвращается объект ошибок
|
|
111
112
|
*/
|
|
112
113
|
batch(
|
|
113
114
|
commandList: Record<string, TCommand>,
|
|
114
115
|
progressCall?: (data:{ percent: number })=>void,
|
|
115
|
-
|
|
116
|
+
param:{
|
|
117
|
+
updateList: TUpdateList,
|
|
118
|
+
errorCall: (errors)=>void,
|
|
119
|
+
}
|
|
116
120
|
): Promise<Record<string, unknown[]> | boolean>;
|
|
117
121
|
|
|
118
122
|
/**
|