szdl-utils-kit 0.2.16 → 0.2.17
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 +73 -70
- package/dist/index.umd.cjs +2 -2
- package/dist/types/bx-logger.d.ts +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var h = (y, A, e) => (kt(y, A, "read from private field"), e ? e.call(y) : A.get
|
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
A instanceof WeakSet ? A.add(y) : A.set(y, e);
|
|
11
11
|
}, T = (y, A, e, n) => (kt(y, A, "write to private field"), n ? n.call(y, e) : A.set(y, e), e);
|
|
12
|
-
var
|
|
12
|
+
var O = (y, A, e) => (kt(y, A, "access private method"), e);
|
|
13
13
|
var fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
14
|
function Ne(y) {
|
|
15
15
|
return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
|
|
@@ -33,7 +33,7 @@ var Xt = { exports: {} };
|
|
|
33
33
|
}, l = function(t, s) {
|
|
34
34
|
var o, c = "";
|
|
35
35
|
return o = t.slice(s, s + 1), o !== "" && !isNaN(Number(o)) && (c += "%H"), o = t.charAt(s + 2), o !== "" && o === ":" && (c += o), o = t.slice(s + 3, s + 4), o !== "" && !isNaN(Number(o)) && (c += "%M"), o = t.charAt(s + 5), o !== "" && o === ":" && (c += o), o = t.slice(s + 6, s + 7), o !== "" && !isNaN(Number(o)) && (c += "%S"), c;
|
|
36
|
-
},
|
|
36
|
+
}, _ = function(t, s) {
|
|
37
37
|
var o, c = [
|
|
38
38
|
t.slice(s, s + 1),
|
|
39
39
|
t.charAt(s + 2),
|
|
@@ -794,7 +794,7 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.pars
|
|
|
794
794
|
delete I[t];
|
|
795
795
|
}, r.detectFormat = function(t) {
|
|
796
796
|
var s, o, c;
|
|
797
|
-
return s =
|
|
797
|
+
return s = _(t, 0), s !== "" && (c = 10), o = t.charAt(c), (o === "T" || o === " ") && (s += o, c += 1), s += l(t, c), s;
|
|
798
798
|
}, E = {
|
|
799
799
|
TempusDate: g
|
|
800
800
|
}, r.classes = function(t, s) {
|
|
@@ -862,22 +862,22 @@ class x {
|
|
|
862
862
|
T(this, K, !1);
|
|
863
863
|
}
|
|
864
864
|
async batch(A, e) {
|
|
865
|
-
h(this, j) &&
|
|
866
|
-
const n =
|
|
865
|
+
h(this, j) && O(this, ut, xt).call(this), e && T(this, q, e), h(this, $) === !1 && T(this, F, !1), Object.keys(A).length > 500 && T(this, F, !0), T(this, K, !0), T(this, z, []), T(this, Y, {}), this.errors = {}, this.answerData = {};
|
|
866
|
+
const n = O(this, ft, Qt).call(this, A);
|
|
867
867
|
if (Object.keys(A).length < 500) {
|
|
868
|
-
const i = n.map((a, l) =>
|
|
868
|
+
const i = n.map((a, l) => O(this, Nt, Zt).call(this, a, n[l]));
|
|
869
869
|
return Promise.allSettled(i).then((a) => {
|
|
870
870
|
let l = {};
|
|
871
|
-
for (let
|
|
872
|
-
|
|
871
|
+
for (let _ of a)
|
|
872
|
+
_.status === "fulfilled" && (l = { ...l, ..._.value });
|
|
873
873
|
return l;
|
|
874
874
|
});
|
|
875
875
|
} else {
|
|
876
|
-
let i = {}, a = 0, l = 1,
|
|
877
|
-
a += Object.keys(r).length, l = Math.round(a /
|
|
876
|
+
let i = {}, a = 0, l = 1, _ = Object.keys(A).length || 1, m = (r) => {
|
|
877
|
+
a += Object.keys(r).length, l = Math.round(a / _ * 100);
|
|
878
878
|
};
|
|
879
879
|
for (let [r, E] of Object.entries(n)) {
|
|
880
|
-
let S = await
|
|
880
|
+
let S = await O(this, Nt, Zt).call(this, E, n[r], !0);
|
|
881
881
|
m(E), e && e({ percent: l }), i = { ...i, ...S };
|
|
882
882
|
}
|
|
883
883
|
return i;
|
|
@@ -889,9 +889,9 @@ class x {
|
|
|
889
889
|
i += Object.keys(m).length, n = Math.round(i / a * 100);
|
|
890
890
|
};
|
|
891
891
|
e && e({ percent: n });
|
|
892
|
-
const
|
|
892
|
+
const _ = O(this, ft, Qt).call(this, A);
|
|
893
893
|
if (h(this, tt)) {
|
|
894
|
-
const m =
|
|
894
|
+
const m = _.map((r) => O(this, _t, Vt).call(this, r).then((E) => (l(r), e && e({ percent: n }), E)));
|
|
895
895
|
return Promise.allSettled(m).then((r) => {
|
|
896
896
|
let E = {};
|
|
897
897
|
for (let S of r)
|
|
@@ -900,8 +900,8 @@ class x {
|
|
|
900
900
|
});
|
|
901
901
|
} else {
|
|
902
902
|
let m = {};
|
|
903
|
-
for (let r of
|
|
904
|
-
let E = await
|
|
903
|
+
for (let r of _) {
|
|
904
|
+
let E = await O(this, _t, Vt).call(this, r);
|
|
905
905
|
l(r), e && e({ percent: n }), m = { ...m, ...E };
|
|
906
906
|
}
|
|
907
907
|
return m;
|
|
@@ -920,16 +920,16 @@ V = new WeakMap(), lt = new WeakMap(), z = new WeakMap(), Y = new WeakMap(), k =
|
|
|
920
920
|
}, ut = new WeakSet(), xt = function() {
|
|
921
921
|
clearInterval(h(this, j)), T(this, j, ""), T(this, B, ""), T(this, q, ""), T(this, v, "no");
|
|
922
922
|
}, mt = new WeakSet(), jt = function({ key: A, value: e }) {
|
|
923
|
-
const n =
|
|
923
|
+
const n = O(this, et, ct).call(this, e.data()), i = Array.isArray(n) ? n.length : 0, a = O(this, nt, Dt).call(this, e.total(), i);
|
|
924
924
|
let l = 1;
|
|
925
925
|
n && (l = i), h(this, q) && (h(this, B) || T(this, B, {}), h(this, B)[A] && h(this, B)[A].count && (l += h(this, B)[A].count), h(this, B)[A] = { total: a, count: l }, h(this, j) || T(this, j, setInterval(() => {
|
|
926
|
-
const { percent:
|
|
926
|
+
const { percent: _, allCount: m, allTotal: r } = h(this, rt, bt);
|
|
927
927
|
(h(this, v) === "no" || h(this, v) < h(this, rt, bt).percent) && (h(this, q).call(this, {
|
|
928
928
|
data: h(this, B),
|
|
929
|
-
percent:
|
|
929
|
+
percent: _,
|
|
930
930
|
allCount: m,
|
|
931
931
|
allTotal: r
|
|
932
|
-
}), T(this, v, h(this, rt, bt).percent)),
|
|
932
|
+
}), T(this, v, h(this, rt, bt).percent)), _ === 100 && O(this, ut, xt).call(this);
|
|
933
933
|
}, h(this, Yt))));
|
|
934
934
|
}, ft = new WeakSet(), Qt = function(A) {
|
|
935
935
|
const e = [], n = Object.entries(A);
|
|
@@ -940,63 +940,63 @@ V = new WeakMap(), lt = new WeakMap(), z = new WeakMap(), Y = new WeakMap(), k =
|
|
|
940
940
|
return e;
|
|
941
941
|
}, Nt = new WeakSet(), Zt = function(A, e, n) {
|
|
942
942
|
return new Promise((i) => {
|
|
943
|
-
const a =
|
|
944
|
-
let
|
|
943
|
+
const a = O(this, Et, vt).call(this, e), l = [];
|
|
944
|
+
let _ = 0, m = 0;
|
|
945
945
|
h(this, V).call(this, A, (r) => {
|
|
946
946
|
Object.entries(r).forEach(([E, S]) => {
|
|
947
947
|
let u = {};
|
|
948
948
|
const f = S.error();
|
|
949
949
|
if (f) {
|
|
950
950
|
let { query: { method: J }, answer: P } = S;
|
|
951
|
-
this.errors[E] = { error: f, method: J },
|
|
951
|
+
this.errors[E] = { error: f, method: J }, _ += 1;
|
|
952
952
|
}
|
|
953
953
|
if (S != null && S.answer && Object.keys(S.answer).length) {
|
|
954
954
|
for (let [J, P] of Object.entries(S.answer))
|
|
955
955
|
J != "result" && P && (u[J] = P);
|
|
956
956
|
Object.keys(u).length && (this.answerData[E] = u);
|
|
957
957
|
}
|
|
958
|
-
const G =
|
|
959
|
-
if (Array.isArray(G) ? h(this, Y)[E] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? h(this, Y)[E] = [] : h(this, Y)[E] = G, m += Z, n ||
|
|
958
|
+
const G = O(this, et, ct).call(this, S.data()), ot = Array.isArray(G) ? G.length : 0, Z = O(this, nt, Dt).call(this, S.total(), ot);
|
|
959
|
+
if (Array.isArray(G) ? h(this, Y)[E] = G : typeof G == "object" && G !== null && Object.keys(G).length === 0 ? h(this, Y)[E] = [] : h(this, Y)[E] = G, m += Z, n || O(this, mt, jt).call(this, { key: E, value: S }), Z > h(this, k) && Z > ot) {
|
|
960
960
|
const J = Math.ceil(Z / h(this, k)) - 1, P = Array.from({ length: J });
|
|
961
961
|
l.push([E, a[E], P]);
|
|
962
962
|
}
|
|
963
|
-
}), m > 5e3 && h(this, $) === !1 && h(this, tt) === !1 && T(this, F, !0),
|
|
963
|
+
}), m > 5e3 && h(this, $) === !1 && h(this, tt) === !1 && T(this, F, !0), _ > 0 && O(this, gt, $t).call(this), l.length ? (O(this, Bt, ee).call(this, l), O(this, It, Ae).call(this).then(() => i(O(this, it, Ht).call(this)))) : i(O(this, it, Ht).call(this));
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
966
|
}, _t = new WeakSet(), Vt = function(A) {
|
|
967
967
|
return new Promise((e) => {
|
|
968
|
-
const n =
|
|
968
|
+
const n = O(this, Et, vt).call(this, A);
|
|
969
969
|
let i = 0;
|
|
970
970
|
h(this, V).call(this, n, (a) => {
|
|
971
|
-
Object.entries(a).forEach(([l,
|
|
972
|
-
const m =
|
|
971
|
+
Object.entries(a).forEach(([l, _]) => {
|
|
972
|
+
const m = _.error();
|
|
973
973
|
m && (this.errors[l] = m, i += 1);
|
|
974
|
-
const r =
|
|
974
|
+
const r = O(this, et, ct).call(this, _.data()), E = Array.isArray(r) ? r.length : 0, S = O(this, nt, Dt).call(this, _.total(), E);
|
|
975
975
|
h(this, Y)[l] = S;
|
|
976
|
-
}), i > 0 &&
|
|
976
|
+
}), i > 0 && O(this, gt, $t).call(this), e(O(this, it, Ht).call(this));
|
|
977
977
|
});
|
|
978
978
|
});
|
|
979
979
|
}, Bt = new WeakSet(), ee = function(A) {
|
|
980
980
|
let e = [];
|
|
981
981
|
A.forEach(([n, i, a]) => {
|
|
982
|
-
a.forEach((l,
|
|
983
|
-
const m =
|
|
982
|
+
a.forEach((l, _) => {
|
|
983
|
+
const m = _ + 1, r = h(this, k) * m, S = [[n, m].join("_"), O(this, Ut, se).call(this, i, r)];
|
|
984
984
|
e.length === h(this, k) ? (h(this, z).push(e), e = [S]) : e.push(S);
|
|
985
985
|
});
|
|
986
986
|
}), e.length && h(this, z).push(e);
|
|
987
987
|
}, It = new WeakSet(), Ae = function() {
|
|
988
988
|
const A = [], e = [], n = (i) => {
|
|
989
989
|
Object.entries(i).forEach(([a, l]) => {
|
|
990
|
-
const [
|
|
991
|
-
Array.isArray(m) && h(this, Y)[
|
|
990
|
+
const [_] = a.split("_"), m = O(this, et, ct).call(this, l.data());
|
|
991
|
+
Array.isArray(m) && h(this, Y)[_].push(...m), O(this, mt, jt).call(this, { key: _, value: l });
|
|
992
992
|
});
|
|
993
993
|
};
|
|
994
994
|
return h(this, z).forEach((i, a) => {
|
|
995
|
-
const l = Object.fromEntries(i),
|
|
995
|
+
const l = Object.fromEntries(i), _ = () => new Promise((m) => h(this, V).call(this, l, (r) => {
|
|
996
996
|
h(this, F) ? n(r) : e[a] = r, m();
|
|
997
997
|
}));
|
|
998
|
-
A.push(
|
|
999
|
-
}), h(this, F) ?
|
|
998
|
+
A.push(_);
|
|
999
|
+
}), h(this, F) ? O(this, yt, Kt).call(this, A) : O(this, dt, qt).call(this, A).then(() => {
|
|
1000
1000
|
e.forEach(n);
|
|
1001
1001
|
});
|
|
1002
1002
|
}, Ot = new WeakSet(), zt = function() {
|
|
@@ -1007,13 +1007,13 @@ V = new WeakMap(), lt = new WeakMap(), z = new WeakMap(), Y = new WeakMap(), k =
|
|
|
1007
1007
|
const e = A.shift();
|
|
1008
1008
|
return Promise.allSettled([
|
|
1009
1009
|
e(),
|
|
1010
|
-
|
|
1011
|
-
]).then(() => h(this, K) ?
|
|
1010
|
+
O(this, Ot, zt).call(this)
|
|
1011
|
+
]).then(() => h(this, K) ? O(this, yt, Kt).call(this, A) : Promise.resolve());
|
|
1012
1012
|
}, dt = new WeakSet(), qt = function(A) {
|
|
1013
1013
|
if (!A.length)
|
|
1014
1014
|
return Promise.resolve();
|
|
1015
1015
|
const e = A.shift();
|
|
1016
|
-
return
|
|
1016
|
+
return O(this, Ot, zt).call(this).then(() => e()).then(() => h(this, K) ? O(this, dt, qt).call(this, A) : Promise.resolve());
|
|
1017
1017
|
}, it = new WeakSet(), Ht = function() {
|
|
1018
1018
|
return Object.entries(h(this, lt)).forEach(([A, e]) => {
|
|
1019
1019
|
h(this, Y)[A] && (h(this, Y)[A] = e(h(this, Y)[A]));
|
|
@@ -1104,7 +1104,7 @@ class Oe {
|
|
|
1104
1104
|
N(this, Tt, {});
|
|
1105
1105
|
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1106
1106
|
C(this, "periodClear", 3);
|
|
1107
|
-
|
|
1107
|
+
O(this, wt, ie).call(this);
|
|
1108
1108
|
}
|
|
1109
1109
|
/** Инициализация логера */
|
|
1110
1110
|
async init() {
|
|
@@ -1127,7 +1127,7 @@ class Oe {
|
|
|
1127
1127
|
});
|
|
1128
1128
|
i && T(this, Q, !0);
|
|
1129
1129
|
}
|
|
1130
|
-
return
|
|
1130
|
+
return O(this, Ft, oe).call(this), h(this, Q);
|
|
1131
1131
|
}
|
|
1132
1132
|
/**
|
|
1133
1133
|
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
@@ -1140,7 +1140,7 @@ class Oe {
|
|
|
1140
1140
|
*/
|
|
1141
1141
|
start({ type: A, data: e }) {
|
|
1142
1142
|
if (!h(this, Q)) {
|
|
1143
|
-
|
|
1143
|
+
O(this, Rt, te).call(this, "entity");
|
|
1144
1144
|
return;
|
|
1145
1145
|
}
|
|
1146
1146
|
const n = Lt.hash;
|
|
@@ -1163,7 +1163,7 @@ class Oe {
|
|
|
1163
1163
|
*/
|
|
1164
1164
|
stop({ key: A, errorList: e, status: n, answer: i }) {
|
|
1165
1165
|
if (!h(this, Q)) {
|
|
1166
|
-
|
|
1166
|
+
O(this, Rt, te).call(this, "entity");
|
|
1167
1167
|
return;
|
|
1168
1168
|
}
|
|
1169
1169
|
let a = h(this, st).get(A);
|
|
@@ -1171,12 +1171,15 @@ class Oe {
|
|
|
1171
1171
|
keyTimer: "add.entity.items",
|
|
1172
1172
|
duration: h(this, Gt),
|
|
1173
1173
|
action: () => {
|
|
1174
|
-
|
|
1174
|
+
O(this, Ct, ne).call(this);
|
|
1175
1175
|
}
|
|
1176
1176
|
});
|
|
1177
1177
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1178
|
+
/**
|
|
1179
|
+
* @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
|
|
1180
|
+
*/
|
|
1181
|
+
async getEntityList(A) {
|
|
1182
|
+
let e = new x(BX24.callBatch), { entityList: n } = await e.batch({
|
|
1180
1183
|
entityList: {
|
|
1181
1184
|
method: "entity.item.get",
|
|
1182
1185
|
params: {
|
|
@@ -1184,15 +1187,15 @@ class Oe {
|
|
|
1184
1187
|
SORT: { ID: "DESC" }
|
|
1185
1188
|
}
|
|
1186
1189
|
}
|
|
1187
|
-
});
|
|
1188
|
-
return
|
|
1189
|
-
const { ID:
|
|
1190
|
+
}, A);
|
|
1191
|
+
return n = n.map((i) => {
|
|
1192
|
+
const { ID: a, DATE_CREATE: l, DETAIL_TEXT: _ } = i;
|
|
1190
1193
|
return {
|
|
1191
|
-
...JSON.parse(
|
|
1192
|
-
id:
|
|
1193
|
-
dateCreate:
|
|
1194
|
+
...JSON.parse(_),
|
|
1195
|
+
id: a,
|
|
1196
|
+
dateCreate: l
|
|
1194
1197
|
};
|
|
1195
|
-
}),
|
|
1198
|
+
}), n;
|
|
1196
1199
|
}
|
|
1197
1200
|
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
1198
1201
|
async downAllEntityJson() {
|
|
@@ -1236,7 +1239,7 @@ W = new WeakMap(), Q = new WeakMap(), Gt = new WeakMap(), st = new WeakMap(), Tt
|
|
|
1236
1239
|
let { dateCreate: l } = a;
|
|
1237
1240
|
return pt(new Date(l)).between(pt(new Date(n)), "month") >= this.periodClear;
|
|
1238
1241
|
});
|
|
1239
|
-
|
|
1242
|
+
O(this, Pt, ae).call(this, i);
|
|
1240
1243
|
}, Pt = new WeakSet(), ae = async function(A) {
|
|
1241
1244
|
let e = new x(BX24.callBatch), n = A.map((i) => {
|
|
1242
1245
|
let { id: a } = i;
|
|
@@ -1273,8 +1276,8 @@ class de {
|
|
|
1273
1276
|
window.BX24 && BX24.init(async () => {
|
|
1274
1277
|
console.info("init BX24"), clearInterval(e), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await U.init();
|
|
1275
1278
|
const [n, i] = await Promise.all([
|
|
1276
|
-
|
|
1277
|
-
|
|
1279
|
+
O(this, Wt, he).call(this),
|
|
1280
|
+
O(this, Jt, ce).call(this)
|
|
1278
1281
|
]);
|
|
1279
1282
|
this.appInfo = n, this.userInfo = i, new re().noSleep(), A(!0);
|
|
1280
1283
|
});
|
|
@@ -1309,14 +1312,14 @@ class de {
|
|
|
1309
1312
|
});
|
|
1310
1313
|
return new Promise((a) => {
|
|
1311
1314
|
e || (e = {}), BX24.callMethod(A, e, function(l) {
|
|
1312
|
-
let
|
|
1315
|
+
let _ = {};
|
|
1313
1316
|
if (l != null && l.answer)
|
|
1314
1317
|
for (let [m, r] of Object.entries(l.answer))
|
|
1315
|
-
m != "result" && r && (
|
|
1318
|
+
m != "result" && r && (_[m] = r);
|
|
1316
1319
|
if (l.error()) {
|
|
1317
1320
|
let m = l.error();
|
|
1318
1321
|
console.error(m), U.stop({
|
|
1319
|
-
answer:
|
|
1322
|
+
answer: _,
|
|
1320
1323
|
key: i,
|
|
1321
1324
|
status: "fail",
|
|
1322
1325
|
errorList: [m.toSting()]
|
|
@@ -1324,7 +1327,7 @@ class de {
|
|
|
1324
1327
|
} else {
|
|
1325
1328
|
let m = l.data();
|
|
1326
1329
|
m != null && m.items && (m = m.items), U.stop({
|
|
1327
|
-
answer:
|
|
1330
|
+
answer: _,
|
|
1328
1331
|
key: i,
|
|
1329
1332
|
status: "success"
|
|
1330
1333
|
}), a(m);
|
|
@@ -1357,7 +1360,7 @@ class de {
|
|
|
1357
1360
|
data: { commandList: A, updateList: n }
|
|
1358
1361
|
});
|
|
1359
1362
|
try {
|
|
1360
|
-
let
|
|
1363
|
+
let _ = await a.batch(A, e);
|
|
1361
1364
|
if (Object.keys(a.errors).length) {
|
|
1362
1365
|
let m = Object.entries(a.errors).map(([r, E]) => ({
|
|
1363
1366
|
key: r,
|
|
@@ -1375,14 +1378,14 @@ class de {
|
|
|
1375
1378
|
status: "success",
|
|
1376
1379
|
answer: a.answerData
|
|
1377
1380
|
});
|
|
1378
|
-
return
|
|
1379
|
-
} catch (
|
|
1381
|
+
return _;
|
|
1382
|
+
} catch (_) {
|
|
1380
1383
|
return U.stop({
|
|
1381
1384
|
key: l,
|
|
1382
1385
|
status: "fail-runtime",
|
|
1383
|
-
errorList: [
|
|
1386
|
+
errorList: [_.toSting()],
|
|
1384
1387
|
answer: a.answerData
|
|
1385
|
-
}), console.error(
|
|
1388
|
+
}), console.error(_), !1;
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
1388
1391
|
/**
|
|
@@ -1397,8 +1400,8 @@ class de {
|
|
|
1397
1400
|
try {
|
|
1398
1401
|
let a = await n.batchTotalCount(A, e);
|
|
1399
1402
|
if (Object.keys(n.errors).length) {
|
|
1400
|
-
let l = Object.entries(n.errors).map(([
|
|
1401
|
-
key:
|
|
1403
|
+
let l = Object.entries(n.errors).map(([_, m]) => ({
|
|
1404
|
+
key: _,
|
|
1402
1405
|
error: m.toSting()
|
|
1403
1406
|
}));
|
|
1404
1407
|
U.stop({
|
|
@@ -1475,7 +1478,7 @@ class de {
|
|
|
1475
1478
|
}
|
|
1476
1479
|
/* регистрация бота */
|
|
1477
1480
|
regBot({ code: A, type: e, name: n }) {
|
|
1478
|
-
const { appName: i, pathApp: a, chatBotLogo: l } = this.appConst,
|
|
1481
|
+
const { appName: i, pathApp: a, chatBotLogo: l } = this.appConst, _ = this.appInfo.ID;
|
|
1479
1482
|
return this.call({
|
|
1480
1483
|
method: "imbot.register",
|
|
1481
1484
|
params: {
|
|
@@ -1491,7 +1494,7 @@ class de {
|
|
|
1491
1494
|
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1492
1495
|
PROPERTIES: {
|
|
1493
1496
|
// Личные данные чат-бота (обяз.)
|
|
1494
|
-
NAME: `${n ?? i} - бот #${
|
|
1497
|
+
NAME: `${n ?? i} - бот #${_}`,
|
|
1495
1498
|
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1496
1499
|
LAST_NAME: "",
|
|
1497
1500
|
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ye=Object.defineProperty;var de=(d,E,L)=>E in d?ye(d,E,{enumerable:!0,configurable:!0,writable:!0,value:L}):d[E]=L;var J=(d,E,L)=>(de(d,typeof E!="symbol"?E+"":E,L),L),Zt=(d,E,L)=>{if(!E.has(d))throw TypeError("Cannot "+L)};var h=(d,E,L)=>(Zt(d,E,"read from private field"),L?L.call(d):E.get(d)),N=(d,E,L)=>{if(E.has(d))throw TypeError("Cannot add the same private member more than once");E instanceof WeakSet?E.add(d):E.set(d,L)},R=(d,E,L,ot)=>(Zt(d,E,"write to private field"),ot?ot.call(d,L):E.set(d,L),L);var
|
|
2
|
-
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`):s(JSON.parse(c.responseText))):o&&o(c))},c.open("GET",t,!1),c.send()},C={"%d":{format:function(t){return i(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 i(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 i(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 pt[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 Lt[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 i(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 i(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 i(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 i(t.year()||r.MIN_YEAR,4)+"-"+i(t.month()||r.MIN_MONTH,2)+"-"+i(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),o=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:o,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return i(t.month()||r.MIN_MONTH,2)+"/"+i(t.day()||r.MIN_DAY,2)+"/"+i(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),o=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:o}},minLength:10,maxLength:10,type:"string"}},kt={useMilliseconds:!1,monthFromZero:!1},T;T=function(t,s,o){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,o),this},T.fn=T.prototype,T.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},T.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},T.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},T.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},T.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},T.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},T.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},T.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},T.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)},T.fn.set=function(t,s,o){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=[],y,S,z=[],Y=0,I=0,b,W,H={},D;if(t===e)return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;for(s===e&&(s=r.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(S=s.charAt(Y)+s.charAt(Y+1),C[S]!==e){switch(b=0,W="",C[S].type){case"number":for(;b<C[S].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<C[S].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<C[S].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<C[S].minLength)return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;p.push(S),z.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&C.hasOwnProperty(p[c])&&(D=C[p[c]].parse(z[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(r.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},T.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},T.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},T.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)},T.fn.dayOfWeek=function(t){if(t==="long")return Lt[this._d.getDay()];if(t==="short")return pt[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()})},T.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}},T.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()}}},T.fn.format=function(t){for(var s=0,o="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),C[c]!==e?(o+=C[c].format(this),s+=1):o+="%"):o+=t.charAt(s),s+=1;return o},T.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},T.fn.errors=function(){return this._i},T.fn.between=function(t,s){var o=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-o)/31556952);case"month":return Math.floor((c-o)/2629746);case"day":return Math.floor((c-o)/86400);case"hours":return Math.floor((c-o)/3600);case"minutes":return Math.floor((c-o)/60);case"seconds":return c-o;default:return e}},T.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,o){return new T(t,s,o)},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 kt;if(kt.hasOwnProperty(t)){if(s===e)return kt[t];kt[t]=s,t==="monthFromZero"&&(r.MIN_MONTH=s?0:1,r.MAX_MONTH=s?11:12)}return e},r.noConflict=function(){return n.tempus=m,r},r.generate=function(t){var s,o,c,p,y,S,z,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof T?s=t.dateFrom.utc():s=r(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof T?o=t.dateTo.utc():o=r(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?y={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?y={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"&&(y={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?S=t.asObject===!0?{}:[]:(S=[],S.push([]),z=r(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[r(H).format(t.format)]={}:W[r(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:r(H).format(t.format)):W.push(D?null:r(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:y.year?-y.year:e,month:y.month?-y.month:e,day:y.day?-y.day:e,hours:y.hours?-y.hours:e,minutes:y.minutes?-y.minutes:e,seconds:y.seconds?-y.seconds:e,milliseconds:y.milliseconds?-y.milliseconds:e};for(c=r(s).calc(I).utc();r(c).get()[t.groupBy]===z;)Y(S[S.length-1],c,!0),c=r(c).calc(I).utc();if(t.groupBy==="week"){var b=r(s).dayOfWeek();for(c=r(s).dayOfWeek(0).utc();S[0].length<b&&c<s;)Y(S[S.length-1],c,!0),c=r(c).calc(y).utc()}}for(;s<=o;)t.groupBy===e?Y(S,s):r(s).get()[t.groupBy]===z?Y(S[S.length-1],s):(S.push([]),Y(S[S.length-1],s),z=r(s).get()[t.groupBy]),s=r(s).calc(y).utc();if(t.groupBy!==e&&t.fillNulls)for(p=r(o).calc(y).utc();r(p).get()[t.groupBy]===z;)Y(S[S.length-1],p,!0),p=r(p).calc(y).utc();return S},r.monthNames=function(t){switch(t){case"long":return X;default:return Jt}},r.dayNames=function(t){switch(t){case"long":return Lt;default:return pt}},r.lang=function(t){if(t!==e)u=t,f[u]===e&&(u="en"),X=P(),Jt=Mt(),Lt=nt(),pt=Q();else return u;return e},r.availableLangs=function(){return Object.keys(f)},r.registerFormat=function(t,s,o,c,p,y){C[t]={format:s,parse:o,minLength:c,maxLength:p,type:y}},r.unregisterFormat=function(t){delete C[t]},r.detectFormat=function(t){var s,o,c;return s=O(t,0),s!==""&&(c=10),o=t.charAt(c),(o==="T"||o===" ")&&(s+=o,c+=1),s+=l(t,c),s},g={TempusDate:T},r.classes=function(t,s){if(s===e)return g[t];g[t]=s},r.loadTranslations=function(t){typeof t=="object"?f=t:typeof t=="string"&&Oe(t,function(s){f=s},function(s){})},u=(M.language||M.systemLanguage||M.userLanguage||"en").substr(0,2).toLowerCase(),f[u]===e&&(u="en"),X=P(),Jt=Mt(),Lt=nt(),pt=Q(),w.exports&&(A=w.exports=r),A.tempus=r}).call(E)})(ot,ot.exports);var Ne=ot.exports;const lt=L(Ne);class j{constructor(A,e={}){N(this,at);N(this,mt);N(this,ft);N(this,Nt);N(this,_t);N(this,Ot);N(this,Yt);N(this,Bt);N(this,yt);N(this,dt);N(this,Et);N(this,ht);N(this,gt);N(this,It);N(this,st);N(this,ct);N(this,Tt);N(this,K,null);N(this,ut,null);N(this,q,[]);N(this,B,{});N(this,x,50);N(this,v,!0);N(this,$,null);N(this,U,null);N(this,Z,null);N(this,Dt,100);N(this,tt,"no");N(this,F,!1);N(this,et,!1);N(this,At,!1);J(this,"errors",{});J(this,"answerData",{});R(this,K,A),R(this,ut,e)}get serial(){return h(this,F)}setSerial(){R(this,F,!0),R(this,et,!0),R(this,At,!1)}setParallel(){R(this,F,!1),R(this,et,!1),R(this,At,!0)}stop(){R(this,v,!1)}async batch(A,e){h(this,Z)&&_(this,mt,Vt).call(this),e&&R(this,$,e),h(this,et)===!1&&R(this,F,!1),Object.keys(A).length>500&&R(this,F,!0),R(this,v,!0),R(this,q,[]),R(this,B,{}),this.errors={},this.answerData={};const n=_(this,Nt,Kt).call(this,A);if(Object.keys(A).length<500){const i=n.map((a,l)=>_(this,_t,qt).call(this,a,n[l]));return Promise.allSettled(i).then(a=>{let l={};for(let O of a)O.status==="fulfilled"&&(l={...l,...O.value});return l})}else{let i={},a=0,l=1,O=Object.keys(A).length||1,m=r=>{a+=Object.keys(r).length,l=Math.round(a/O*100)};for(let[r,g]of Object.entries(n)){let M=await _(this,_t,qt).call(this,g,n[r],!0);m(g),e&&e({percent:l}),i={...i,...M}}return i}}async batchTotalCount(A,e){R(this,B,{}),this.errors={};let n=1,i=0,a=Object.keys(A).length||1,l=m=>{i+=Object.keys(m).length,n=Math.round(i/a*100)};e&&e({percent:n});const O=_(this,Nt,Kt).call(this,A);if(h(this,At)){const m=O.map(r=>_(this,Ot,vt).call(this,r).then(g=>(l(r),e&&e({percent:n}),g)));return Promise.allSettled(m).then(r=>{let g={};for(let M of r)M.status==="fulfilled"&&(g={...g,...M.value});return g})}else{let m={};for(let r of O){let g=await _(this,Ot,vt).call(this,r);l(r),e&&e({percent:n}),m={...m,...g}}return m}}}K=new WeakMap,ut=new WeakMap,q=new WeakMap,B=new WeakMap,x=new WeakMap,v=new WeakMap,$=new WeakMap,U=new WeakMap,Z=new WeakMap,Dt=new WeakMap,tt=new WeakMap,F=new WeakMap,et=new WeakMap,At=new WeakMap,at=new WeakSet,Xt=function(){let A=0;if(!h(this,U))return Math.round(A);let e=0,n=0;return Object.values(h(this,U)).forEach(i=>{const{total:a,count:l}=i;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},mt=new WeakSet,Vt=function(){clearInterval(h(this,Z)),R(this,Z,""),R(this,U,""),R(this,$,""),R(this,tt,"no")},ft=new WeakSet,zt=function({key:A,value:e}){const n=_(this,st,bt).call(this,e.data()),i=Array.isArray(n)?n.length:0,a=_(this,ct,xt).call(this,e.total(),i);let l=1;n&&(l=i),h(this,$)&&(h(this,U)||R(this,U,{}),h(this,U)[A]&&h(this,U)[A].count&&(l+=h(this,U)[A].count),h(this,U)[A]={total:a,count:l},h(this,Z)||R(this,Z,setInterval(()=>{const{percent:O,allCount:m,allTotal:r}=h(this,at,Xt);(h(this,tt)==="no"||h(this,tt)<h(this,at,Xt).percent)&&(h(this,$).call(this,{data:h(this,U),percent:O,allCount:m,allTotal:r}),R(this,tt,h(this,at,Xt).percent)),O===100&&_(this,mt,Vt).call(this)},h(this,Dt))))},Nt=new WeakSet,Kt=function(A){const e=[],n=Object.entries(A);for(let i=0;i<n.length;i+=h(this,x)){const a=n.slice(i,i+h(this,x));e.push(Object.fromEntries(a))}return e},_t=new WeakSet,qt=function(A,e,n){return new Promise(i=>{const a=_(this,gt,Ae).call(this,e),l=[];let O=0,m=0;h(this,K).call(this,A,r=>{Object.entries(r).forEach(([g,M])=>{let u={};const f=M.error();if(f){let{query:{method:Q},answer:X}=M;this.errors[g]={error:f,method:Q},O+=1}if(M!=null&&M.answer&&Object.keys(M.answer).length){for(let[Q,X]of Object.entries(M.answer))Q!="result"&&X&&(u[Q]=X);Object.keys(u).length&&(this.answerData[g]=u)}const P=_(this,st,bt).call(this,M.data()),Mt=Array.isArray(P)?P.length:0,nt=_(this,ct,xt).call(this,M.total(),Mt);if(Array.isArray(P)?h(this,B)[g]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?h(this,B)[g]=[]:h(this,B)[g]=P,m+=nt,n||_(this,ft,zt).call(this,{key:g,value:M}),nt>h(this,x)&&nt>Mt){const Q=Math.ceil(nt/h(this,x))-1,X=Array.from({length:Q});l.push([g,a[g],X])}}),m>5e3&&h(this,et)===!1&&h(this,At)===!1&&R(this,F,!0),O>0&&_(this,Tt,se).call(this),l.length?(_(this,Yt,ne).call(this,l),_(this,Bt,oe).call(this).then(()=>i(_(this,ht,jt).call(this)))):i(_(this,ht,jt).call(this))})})},Ot=new WeakSet,vt=function(A){return new Promise(e=>{const n=_(this,gt,Ae).call(this,A);let i=0;h(this,K).call(this,n,a=>{Object.entries(a).forEach(([l,O])=>{const m=O.error();m&&(this.errors[l]=m,i+=1);const r=_(this,st,bt).call(this,O.data()),g=Array.isArray(r)?r.length:0,M=_(this,ct,xt).call(this,O.total(),g);h(this,B)[l]=M}),i>0&&_(this,Tt,se).call(this),e(_(this,ht,jt).call(this))})})},Yt=new WeakSet,ne=function(A){let e=[];A.forEach(([n,i,a])=>{a.forEach((l,O)=>{const m=O+1,r=h(this,x)*m,M=[[n,m].join("_"),_(this,It,ae).call(this,i,r)];e.length===h(this,x)?(h(this,q).push(e),e=[M]):e.push(M)})}),e.length&&h(this,q).push(e)},Bt=new WeakSet,oe=function(){const A=[],e=[],n=i=>{Object.entries(i).forEach(([a,l])=>{const[O]=a.split("_"),m=_(this,st,bt).call(this,l.data());Array.isArray(m)&&h(this,B)[O].push(...m),_(this,ft,zt).call(this,{key:O,value:l})})};return h(this,q).forEach((i,a)=>{const l=Object.fromEntries(i),O=()=>new Promise(m=>h(this,K).call(this,l,r=>{h(this,F)?n(r):e[a]=r,m()}));A.push(O)}),h(this,F)?_(this,dt,te).call(this,A):_(this,Et,ee).call(this,A).then(()=>{e.forEach(n)})},yt=new WeakSet,$t=function(){return new Promise(A=>setTimeout(A,500))},dt=new WeakSet,te=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),_(this,yt,$t).call(this)]).then(()=>h(this,v)?_(this,dt,te).call(this,A):Promise.resolve())},Et=new WeakSet,ee=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return _(this,yt,$t).call(this).then(()=>e()).then(()=>h(this,v)?_(this,Et,ee).call(this,A):Promise.resolve())},ht=new WeakSet,jt=function(){return Object.entries(h(this,ut)).forEach(([A,e])=>{h(this,B)[A]&&(h(this,B)[A]=e(h(this,B)[A]))}),h(this,B)},gt=new WeakSet,Ae=function(A){return Object.entries(A).reduce((e,[n,i])=>{if(Array.isArray(i)){const[a,l={}]=i;e[n]=[a,l]}else{const{method:a,params:l={}}=i;e[n]=[a,l]}return e},{})},It=new WeakSet,ae=function(A,e){const[n,i]=A;return[n,{start:e,...i}]},st=new WeakSet,bt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,xt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},Tt=new WeakSet,se=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e.toString())}),console.groupEnd()};class Qt{constructor(){N(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let i=0;i<A;i++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){h(this,rt)[A]&&(clearTimeout(h(this,rt)[A]),h(this,rt)[A]=null),n&&(h(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,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"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),i=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=i,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(i)},200)}}rt=new WeakMap;const Ht=new Qt;class ie{constructor(){N(this,Gt);N(this,St);N(this,wt);N(this,Ct);N(this,Ft);N(this,k,"logger");N(this,V,!1);N(this,Ut,2e3);N(this,it,new Map);N(this,Rt,{});J(this,"periodClear",3);_(this,Gt,he).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(i=>i.ENTITY==h(this,k)))R(this,V,!0);else{let{entityAdd:i}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:h(this,k),NAME:h(this,k),ACCESS:{AU:"X"}}}});i&&R(this,V,!0)}return _(this,Ct,le).call(this),h(this,V)}start({type:A,data:e}){if(!h(this,V)){_(this,St,re).call(this,"entity");return}const n=Ht.hash;return h(this,it).set(n,{type:A,data:e,userInfo:h(this,Rt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:i}){if(!h(this,V)){_(this,St,re).call(this,"entity");return}let a=h(this,it).get(A);e&&(a.errorList=e),n&&(a.status=n),i&&(a.answer=i),Ht.actionFilter({keyTimer:"add.entity.items",duration:h(this,Ut),action:()=>{_(this,wt,ce).call(this)}})}async getEntityList(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.item.get",params:{ENTITY:h(this,k),SORT:{ID:"DESC"}}}});return e=e.map(n=>{const{ID:i,DATE_CREATE:a,DETAIL_TEXT:l}=n;return{...JSON.parse(l),id:i,dateCreate:a}}),e}async downAllEntityJson(){let A=await this.getEntityList(),e=lt().format("%Y-%m-%d");Ht.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,Ut=new WeakMap,it=new WeakMap,Rt=new WeakMap,Gt=new WeakSet,he=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});R(this,Rt,{isAdmin:e,curUser:n})},St=new WeakSet,re=function(A){A=="entity"&&Ht.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},wt=new WeakSet,ce=async function(){let A={},e=new j(BX24.callBatch);for(let[n,i]of h(this,it).entries())i.status&&(A[n]={method:"entity.item.add",params:{ENTITY:h(this,k),NAME:h(this,k),DETAIL_TEXT:JSON.stringify(i)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:i}=e;for(let[a,l]of Object.entries({...n,...i}))h(this,it).delete(a)}},Ct=new WeakSet,le=async function(){let A=new j(BX24.callBatch),e=await this.getEntityList(),{serverTime:n}=await A.batch({serverTime:{method:"server.time"}}),i=e.filter(a=>{let{dateCreate:l}=a;return lt(new Date(l)).between(lt(new Date(n)),"month")>=this.periodClear});_(this,Ft,ue).call(this,i)},Ft=new WeakSet,ue=async function(A){let e=new j(BX24.callBatch),n=A.map(i=>{let{id:a}=i;return{method:"entity.item.delete",params:{ENTITY:h(this,k),ID:a}}});return await e.batch(n)};const G=new ie;class _e{constructor(A){N(this,Pt);N(this,Wt);J(this,"domain","");J(this,"isAdmin",!1);J(this,"appInfo",null);J(this,"appConst",null);J(this,"userInfo",null);J(this,"placeData",null);J(this,"placeInfo",null);this.appConst=A}init(){return new Promise(A=>{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[n,i]=await Promise.all([_(this,Pt,me).call(this),_(this,Wt,fe).call(this)]);this.appInfo=n,this.userInfo=i,new Qt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let i=G.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,function(l){let O={};if(l!=null&&l.answer)for(let[m,r]of Object.entries(l.answer))m!="result"&&r&&(O[m]=r);if(l.error()){let m=l.error();console.error(m),G.stop({answer:O,key:i,status:"fail",errorList:[m.toSting()]}),a(!1)}else{let m=l.data();m!=null&&m.items&&(m=m.items),G.stop({answer:O,key:i,status:"success"}),a(m)}})})}async batch(A,e,{updateList:n,errorCall:i}={}){let a=new j(BX24.callBatch),l=G.start({type:"batch",data:{commandList:A,updateList:n}});try{let O=await a.batch(A,e);if(Object.keys(a.errors).length){let m=Object.entries(a.errors).map(([r,g])=>({key:r,error:g.toSting()}));i&&i(a.errors),G.stop({key:l,status:"fail",errorList:m,answer:a.answerData})}else G.stop({key:l,status:"success",answer:a.answerData});return O}catch(O){return G.stop({key:l,status:"fail-runtime",errorList:[O.toSting()],answer:a.answerData}),console.error(O),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),i=G.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([O,m])=>({key:O,error:m.toSting()}));G.stop({key:i,status:"fail",errorList:l})}else G.stop({key:i,status:"success"});return a}catch(a){return G.stop({key:i,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,i=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);i.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(i=>(console.log("Встройка отвязана",A),i))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:i,pathApp:a,chatBotLogo:l}=this.appConst,O=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??i} - бот #${O}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:lt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(m=>(console.log("Чат-бот добавлен",m),m))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}}Pt=new WeakSet,me=function(){return this.call({method:"app.info"})},Wt=new WeakSet,fe=function(){return this.call({method:"user.current"})},d.Batch=j,d.BxBoot=_e,d.BxHelper=Qt,d.BxLogger=ie,d.tempus=lt,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
var ye=Object.defineProperty;var de=(d,E,L)=>E in d?ye(d,E,{enumerable:!0,configurable:!0,writable:!0,value:L}):d[E]=L;var J=(d,E,L)=>(de(d,typeof E!="symbol"?E+"":E,L),L),Zt=(d,E,L)=>{if(!E.has(d))throw TypeError("Cannot "+L)};var h=(d,E,L)=>(Zt(d,E,"read from private field"),L?L.call(d):E.get(d)),N=(d,E,L)=>{if(E.has(d))throw TypeError("Cannot add the same private member more than once");E instanceof WeakSet?E.add(d):E.set(d,L)},R=(d,E,L,ot)=>(Zt(d,E,"write to private field"),ot?ot.call(d,L):E.set(d,L),L);var O=(d,E,L)=>(Zt(d,E,"access private method"),L);(function(d,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(d=typeof globalThis<"u"?globalThis:d||self,E(d["szdl-utils-kit"]={}))})(this,function(d){var K,ut,q,B,x,v,$,U,Z,Dt,tt,F,et,At,at,Xt,mt,Vt,ft,zt,Nt,Kt,_t,qt,Ot,vt,Yt,ne,Bt,oe,yt,$t,dt,te,Et,ee,ht,jt,gt,Ae,It,ae,st,bt,ct,xt,Tt,se,rt,k,V,Ut,it,Rt,Gt,he,St,re,wt,ce,Ct,le,Ft,ue,Pt,me,Wt,fe;"use strict";var E=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 ot={exports:{}};(function(w,A){(function(e){Array.prototype.indexOf||(Array.prototype.indexOf=function(t,s){var o,c;for(o=s||0,c=this.length;o<c;o+=1)if(this[o]===t)return o;return-1});var n=this,i=function(t,s){for(var o=t.toString();o.length<s;)o="0"+o;return o},a=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},l=function(t,s){var o,c="";return o=t.slice(s,s+1),o!==""&&!isNaN(Number(o))&&(c+="%H"),o=t.charAt(s+2),o!==""&&o===":"&&(c+=o),o=t.slice(s+3,s+4),o!==""&&!isNaN(Number(o))&&(c+="%M"),o=t.charAt(s+5),o!==""&&o===":"&&(c+=o),o=t.slice(s+6,s+7),o!==""&&!isNaN(Number(o))&&(c+="%S"),c},_=function(t,s){var o,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]==="."?o="%d.%m.%Y":c[1]==="-"&&c[3]==="-"?o="%m-%d-%Y":c[1]==="/"&&c[3]==="/"&&(o="%m/%d/%Y"),o):(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]==="-"&&(o="%Y-%m-%d"),o):"")},m=n.tempus,r,g,M=n.navigator||{},u="en",f={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"}},P=function(){return[f[u].JANUARY_LONG,f[u].FEBRUARY_LONG,f[u].MARCH_LONG,f[u].APRIL_LONG,f[u].MAY_LONG,f[u].JUNE_LONG,f[u].JULY_LONG,f[u].AUGUST_LONG,f[u].SEPTEMBER_LONG,f[u].OCTOBER_LONG,f[u].NOVEMBER_LONG,f[u].DECEMBER_LONG]},Mt=function(){return[f[u].JANUARY_SHORT,f[u].FEBRUARY_SHORT,f[u].MARCH_SHORT,f[u].APRIL_SHORT,f[u].MAY_SHORT,f[u].JUNE_SHORT,f[u].JULY_SHORT,f[u].AUGUST_SHORT,f[u].SEPTEMBER_SHORT,f[u].OCTOBER_SHORT,f[u].NOVEMBER_SHORT,f[u].DECEMBER_SHORT]},nt=function(){return[f[u].SUNDAY_LONG,f[u].MONDAY_LONG,f[u].TUESDAY_LONG,f[u].WEDNESDAY_LONG,f[u].THURSDAY_LONG,f[u].FRIDAY_LONG,f[u].SATURDAY_LONG]},Q=function(){return[f[u].SUNDAY_SHORT,f[u].MONDAY_SHORT,f[u].TUESDAY_SHORT,f[u].WEDNESDAY_SHORT,f[u].THURSDAY_SHORT,f[u].FRIDAY_SHORT,f[u].SATURDAY_SHORT]},X,Jt,Lt,pt,Oe=function(t,s,o){var c;n.XMLHttpRequest?c=new XMLHttpRequest:c=new ActiveXObject("Microsoft.XMLHTTP"),c.onreadystatechange=function(){c.readyState===4&&(c.status===200?s&&(n.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))):o&&o(c))},c.open("GET",t,!1),c.send()},C={"%d":{format:function(t){return i(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 i(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 i(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 pt[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 Lt[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 i(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 i(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 i(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 i(t.year()||r.MIN_YEAR,4)+"-"+i(t.month()||r.MIN_MONTH,2)+"-"+i(t.day()||r.MIN_DAY,2)},parse:function(t){var s=Number(t.slice(0,4)),o=Number(t.slice(5,7)),c=Number(t.slice(8,10));return{year:s,month:o,day:c}},minLength:10,maxLength:10,type:"string"},"%D":{format:function(t){return i(t.month()||r.MIN_MONTH,2)+"/"+i(t.day()||r.MIN_DAY,2)+"/"+i(t.year()||r.MIN_YEAR,4)},parse:function(t){var s=Number(t.slice(0,2)),o=Number(t.slice(3,5)),c=Number(t.slice(6,10));return{year:c,month:s,day:o}},minLength:10,maxLength:10,type:"string"}},kt={useMilliseconds:!1,monthFromZero:!1},T;T=function(t,s,o){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,o),this},T.fn=T.prototype,T.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},T.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},T.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},T.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},T.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},T.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},T.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},T.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},T.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)},T.fn.set=function(t,s,o){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=[],y,S,z=[],Y=0,I=0,b,W,H={},D;if(t===e)return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;for(s===e&&(s=r.detectFormat(t));Y<s.length;){if(s.charAt(Y)==="%"){if(S=s.charAt(Y)+s.charAt(Y+1),C[S]!==e){switch(b=0,W="",C[S].type){case"number":for(;b<C[S].maxLength&&I+b<t.length&&!isNaN(Number(t.charAt(I+b)));)W+=t.charAt(I+b),b+=1;break;case"word":for(;b<C[S].maxLength&&I+b<t.length&&/^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(I+b));)W+=t.charAt(I+b),b+=1;break;case"string":for(;b<C[S].maxLength&&I+b<t.length;)W+=t.charAt(I+b),b+=1;break}if(b<C[S].minLength)return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;p.push(S),z.push(W),b-=1,I+=b,Y+=1}}else if(t.charAt(I)!==s.charAt(Y))return y=a(this,o),y===e&&(this._i={year:-1,month:-1,day:-1,hours:-1,minutes:-1,seconds:-1,milliseconds:-1}),y;Y+=1,I+=1}for(c in p)p.hasOwnProperty(c)&&C.hasOwnProperty(p[c])&&(D=C[p[c]].parse(z[c]),H={year:D.year!==e?D.year:H.year,month:D.month!==e?D.month:H.month,day:D.day!==e?D.day:H.day,hours:D.hours!==e?D.hours:H.hours,minutes:D.minutes!==e?D.minutes:H.minutes,seconds:D.seconds!==e?D.seconds:H.seconds});this.day(r.MIN_DAY),this.year(H.year),this.month(H.month),this.day(H.day),this.hours(H.hours),this.minutes(H.minutes),this.seconds(H.seconds),this.milliseconds(H.milliseconds)}return this},T.fn.leapYear=function(){var t=this.year();return t%4===0?t%100===0?t%400===0:!0:!1},T.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},T.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)},T.fn.dayOfWeek=function(t){if(t==="long")return Lt[this._d.getDay()];if(t==="short")return pt[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()})},T.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}},T.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()}}},T.fn.format=function(t){for(var s=0,o="",c;s<t.length;)t.charAt(s)==="%"?(c=t.charAt(s)+t.charAt(s+1),C[c]!==e?(o+=C[c].format(this),s+=1):o+="%"):o+=t.charAt(s),s+=1;return o},T.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},T.fn.errors=function(){return this._i},T.fn.between=function(t,s){var o=this.timestamp(),c=t.timestamp();switch(s){case"year":return Math.floor((c-o)/31556952);case"month":return Math.floor((c-o)/2629746);case"day":return Math.floor((c-o)/86400);case"hours":return Math.floor((c-o)/3600);case"minutes":return Math.floor((c-o)/60);case"seconds":return c-o;default:return e}},T.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,o){return new T(t,s,o)},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 kt;if(kt.hasOwnProperty(t)){if(s===e)return kt[t];kt[t]=s,t==="monthFromZero"&&(r.MIN_MONTH=s?0:1,r.MAX_MONTH=s?11:12)}return e},r.noConflict=function(){return n.tempus=m,r},r.generate=function(t){var s,o,c,p,y,S,z,Y;if(typeof t.dateFrom!="number"&&(t.dateFrom instanceof T?s=t.dateFrom.utc():s=r(t.dateFrom,t.formatFrom).utc()),typeof t.dateTo!="number"&&(t.dateTo instanceof T?o=t.dateTo.utc():o=r(t.dateTo,t.formatTo!==e?t.formatTo:t.formatFrom).utc()),typeof t.period=="number"?y={year:0,month:0,day:0,hours:0,minutes:0,seconds:t.period}:typeof t.period=="string"?y={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"&&(y={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?S=t.asObject===!0?{}:[]:(S=[],S.push([]),z=r(s).get()[t.groupBy]),Y=function(W,H,D){return t.asObject===!0?t.format!==e?W[r(H).format(t.format)]={}:W[r(H).format("%F %H:%M:%S")]={}:t.format!==e?W.push(D?null:r(H).format(t.format)):W.push(D?null:r(H)),W},t.groupBy!==e&&t.fillNulls){var I={year:y.year?-y.year:e,month:y.month?-y.month:e,day:y.day?-y.day:e,hours:y.hours?-y.hours:e,minutes:y.minutes?-y.minutes:e,seconds:y.seconds?-y.seconds:e,milliseconds:y.milliseconds?-y.milliseconds:e};for(c=r(s).calc(I).utc();r(c).get()[t.groupBy]===z;)Y(S[S.length-1],c,!0),c=r(c).calc(I).utc();if(t.groupBy==="week"){var b=r(s).dayOfWeek();for(c=r(s).dayOfWeek(0).utc();S[0].length<b&&c<s;)Y(S[S.length-1],c,!0),c=r(c).calc(y).utc()}}for(;s<=o;)t.groupBy===e?Y(S,s):r(s).get()[t.groupBy]===z?Y(S[S.length-1],s):(S.push([]),Y(S[S.length-1],s),z=r(s).get()[t.groupBy]),s=r(s).calc(y).utc();if(t.groupBy!==e&&t.fillNulls)for(p=r(o).calc(y).utc();r(p).get()[t.groupBy]===z;)Y(S[S.length-1],p,!0),p=r(p).calc(y).utc();return S},r.monthNames=function(t){switch(t){case"long":return X;default:return Jt}},r.dayNames=function(t){switch(t){case"long":return Lt;default:return pt}},r.lang=function(t){if(t!==e)u=t,f[u]===e&&(u="en"),X=P(),Jt=Mt(),Lt=nt(),pt=Q();else return u;return e},r.availableLangs=function(){return Object.keys(f)},r.registerFormat=function(t,s,o,c,p,y){C[t]={format:s,parse:o,minLength:c,maxLength:p,type:y}},r.unregisterFormat=function(t){delete C[t]},r.detectFormat=function(t){var s,o,c;return s=_(t,0),s!==""&&(c=10),o=t.charAt(c),(o==="T"||o===" ")&&(s+=o,c+=1),s+=l(t,c),s},g={TempusDate:T},r.classes=function(t,s){if(s===e)return g[t];g[t]=s},r.loadTranslations=function(t){typeof t=="object"?f=t:typeof t=="string"&&Oe(t,function(s){f=s},function(s){})},u=(M.language||M.systemLanguage||M.userLanguage||"en").substr(0,2).toLowerCase(),f[u]===e&&(u="en"),X=P(),Jt=Mt(),Lt=nt(),pt=Q(),w.exports&&(A=w.exports=r),A.tempus=r}).call(E)})(ot,ot.exports);var Ne=ot.exports;const lt=L(Ne);class j{constructor(A,e={}){N(this,at);N(this,mt);N(this,ft);N(this,Nt);N(this,_t);N(this,Ot);N(this,Yt);N(this,Bt);N(this,yt);N(this,dt);N(this,Et);N(this,ht);N(this,gt);N(this,It);N(this,st);N(this,ct);N(this,Tt);N(this,K,null);N(this,ut,null);N(this,q,[]);N(this,B,{});N(this,x,50);N(this,v,!0);N(this,$,null);N(this,U,null);N(this,Z,null);N(this,Dt,100);N(this,tt,"no");N(this,F,!1);N(this,et,!1);N(this,At,!1);J(this,"errors",{});J(this,"answerData",{});R(this,K,A),R(this,ut,e)}get serial(){return h(this,F)}setSerial(){R(this,F,!0),R(this,et,!0),R(this,At,!1)}setParallel(){R(this,F,!1),R(this,et,!1),R(this,At,!0)}stop(){R(this,v,!1)}async batch(A,e){h(this,Z)&&O(this,mt,Vt).call(this),e&&R(this,$,e),h(this,et)===!1&&R(this,F,!1),Object.keys(A).length>500&&R(this,F,!0),R(this,v,!0),R(this,q,[]),R(this,B,{}),this.errors={},this.answerData={};const n=O(this,Nt,Kt).call(this,A);if(Object.keys(A).length<500){const i=n.map((a,l)=>O(this,_t,qt).call(this,a,n[l]));return Promise.allSettled(i).then(a=>{let l={};for(let _ of a)_.status==="fulfilled"&&(l={...l,..._.value});return l})}else{let i={},a=0,l=1,_=Object.keys(A).length||1,m=r=>{a+=Object.keys(r).length,l=Math.round(a/_*100)};for(let[r,g]of Object.entries(n)){let M=await O(this,_t,qt).call(this,g,n[r],!0);m(g),e&&e({percent:l}),i={...i,...M}}return i}}async batchTotalCount(A,e){R(this,B,{}),this.errors={};let n=1,i=0,a=Object.keys(A).length||1,l=m=>{i+=Object.keys(m).length,n=Math.round(i/a*100)};e&&e({percent:n});const _=O(this,Nt,Kt).call(this,A);if(h(this,At)){const m=_.map(r=>O(this,Ot,vt).call(this,r).then(g=>(l(r),e&&e({percent:n}),g)));return Promise.allSettled(m).then(r=>{let g={};for(let M of r)M.status==="fulfilled"&&(g={...g,...M.value});return g})}else{let m={};for(let r of _){let g=await O(this,Ot,vt).call(this,r);l(r),e&&e({percent:n}),m={...m,...g}}return m}}}K=new WeakMap,ut=new WeakMap,q=new WeakMap,B=new WeakMap,x=new WeakMap,v=new WeakMap,$=new WeakMap,U=new WeakMap,Z=new WeakMap,Dt=new WeakMap,tt=new WeakMap,F=new WeakMap,et=new WeakMap,At=new WeakMap,at=new WeakSet,Xt=function(){let A=0;if(!h(this,U))return Math.round(A);let e=0,n=0;return Object.values(h(this,U)).forEach(i=>{const{total:a,count:l}=i;e+=a??0,n+=l??0}),e?A=n/e*100:A=100,{percent:Math.round(A),allCount:n,allTotal:e}},mt=new WeakSet,Vt=function(){clearInterval(h(this,Z)),R(this,Z,""),R(this,U,""),R(this,$,""),R(this,tt,"no")},ft=new WeakSet,zt=function({key:A,value:e}){const n=O(this,st,bt).call(this,e.data()),i=Array.isArray(n)?n.length:0,a=O(this,ct,xt).call(this,e.total(),i);let l=1;n&&(l=i),h(this,$)&&(h(this,U)||R(this,U,{}),h(this,U)[A]&&h(this,U)[A].count&&(l+=h(this,U)[A].count),h(this,U)[A]={total:a,count:l},h(this,Z)||R(this,Z,setInterval(()=>{const{percent:_,allCount:m,allTotal:r}=h(this,at,Xt);(h(this,tt)==="no"||h(this,tt)<h(this,at,Xt).percent)&&(h(this,$).call(this,{data:h(this,U),percent:_,allCount:m,allTotal:r}),R(this,tt,h(this,at,Xt).percent)),_===100&&O(this,mt,Vt).call(this)},h(this,Dt))))},Nt=new WeakSet,Kt=function(A){const e=[],n=Object.entries(A);for(let i=0;i<n.length;i+=h(this,x)){const a=n.slice(i,i+h(this,x));e.push(Object.fromEntries(a))}return e},_t=new WeakSet,qt=function(A,e,n){return new Promise(i=>{const a=O(this,gt,Ae).call(this,e),l=[];let _=0,m=0;h(this,K).call(this,A,r=>{Object.entries(r).forEach(([g,M])=>{let u={};const f=M.error();if(f){let{query:{method:Q},answer:X}=M;this.errors[g]={error:f,method:Q},_+=1}if(M!=null&&M.answer&&Object.keys(M.answer).length){for(let[Q,X]of Object.entries(M.answer))Q!="result"&&X&&(u[Q]=X);Object.keys(u).length&&(this.answerData[g]=u)}const P=O(this,st,bt).call(this,M.data()),Mt=Array.isArray(P)?P.length:0,nt=O(this,ct,xt).call(this,M.total(),Mt);if(Array.isArray(P)?h(this,B)[g]=P:typeof P=="object"&&P!==null&&Object.keys(P).length===0?h(this,B)[g]=[]:h(this,B)[g]=P,m+=nt,n||O(this,ft,zt).call(this,{key:g,value:M}),nt>h(this,x)&&nt>Mt){const Q=Math.ceil(nt/h(this,x))-1,X=Array.from({length:Q});l.push([g,a[g],X])}}),m>5e3&&h(this,et)===!1&&h(this,At)===!1&&R(this,F,!0),_>0&&O(this,Tt,se).call(this),l.length?(O(this,Yt,ne).call(this,l),O(this,Bt,oe).call(this).then(()=>i(O(this,ht,jt).call(this)))):i(O(this,ht,jt).call(this))})})},Ot=new WeakSet,vt=function(A){return new Promise(e=>{const n=O(this,gt,Ae).call(this,A);let i=0;h(this,K).call(this,n,a=>{Object.entries(a).forEach(([l,_])=>{const m=_.error();m&&(this.errors[l]=m,i+=1);const r=O(this,st,bt).call(this,_.data()),g=Array.isArray(r)?r.length:0,M=O(this,ct,xt).call(this,_.total(),g);h(this,B)[l]=M}),i>0&&O(this,Tt,se).call(this),e(O(this,ht,jt).call(this))})})},Yt=new WeakSet,ne=function(A){let e=[];A.forEach(([n,i,a])=>{a.forEach((l,_)=>{const m=_+1,r=h(this,x)*m,M=[[n,m].join("_"),O(this,It,ae).call(this,i,r)];e.length===h(this,x)?(h(this,q).push(e),e=[M]):e.push(M)})}),e.length&&h(this,q).push(e)},Bt=new WeakSet,oe=function(){const A=[],e=[],n=i=>{Object.entries(i).forEach(([a,l])=>{const[_]=a.split("_"),m=O(this,st,bt).call(this,l.data());Array.isArray(m)&&h(this,B)[_].push(...m),O(this,ft,zt).call(this,{key:_,value:l})})};return h(this,q).forEach((i,a)=>{const l=Object.fromEntries(i),_=()=>new Promise(m=>h(this,K).call(this,l,r=>{h(this,F)?n(r):e[a]=r,m()}));A.push(_)}),h(this,F)?O(this,dt,te).call(this,A):O(this,Et,ee).call(this,A).then(()=>{e.forEach(n)})},yt=new WeakSet,$t=function(){return new Promise(A=>setTimeout(A,500))},dt=new WeakSet,te=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return Promise.allSettled([e(),O(this,yt,$t).call(this)]).then(()=>h(this,v)?O(this,dt,te).call(this,A):Promise.resolve())},Et=new WeakSet,ee=function(A){if(!A.length)return Promise.resolve();const e=A.shift();return O(this,yt,$t).call(this).then(()=>e()).then(()=>h(this,v)?O(this,Et,ee).call(this,A):Promise.resolve())},ht=new WeakSet,jt=function(){return Object.entries(h(this,ut)).forEach(([A,e])=>{h(this,B)[A]&&(h(this,B)[A]=e(h(this,B)[A]))}),h(this,B)},gt=new WeakSet,Ae=function(A){return Object.entries(A).reduce((e,[n,i])=>{if(Array.isArray(i)){const[a,l={}]=i;e[n]=[a,l]}else{const{method:a,params:l={}}=i;e[n]=[a,l]}return e},{})},It=new WeakSet,ae=function(A,e){const[n,i]=A;return[n,{start:e,...i}]},st=new WeakSet,bt=function(A){return((A==null?void 0:A.items)||(A==null?void 0:A.documents))??A},ct=new WeakSet,xt=function(A,e){return A!==A&&(A=0),A===0&&e===0?0:A||e},Tt=new WeakSet,se=function(){console.group(`${this.constructor.name}: Ошибки в методах!`),Object.entries(this.errors).forEach(([A,e])=>{console.info(`[${A}]`,e.toString())}),console.groupEnd()};class Qt{constructor(){N(this,rt,{})}get hash(){return this.createHash(8)}createHash(A){let e="abcdefghijklmnopqrstuvwxyz0123456789",n="";A=A||6;for(let i=0;i<A;i++)n+=e.charAt(Math.floor(Math.random()*e.length));return n}actionFilter({keyTimer:A,duration:e=10,action:n}){h(this,rt)[A]&&(clearTimeout(h(this,rt)[A]),h(this,rt)[A]=null),n&&(h(this,rt)[A]=setTimeout(()=>{n()},e))}async noSleep(){let A=document.createElement("video");A.classList.add("no-sleep"),A.addEventListener("loadeddata",()=>{A.style.position="fixed",A.style.left="-9999px",document.querySelector("body").append(A),A.play()}),A.addEventListener("ended",()=>{this.actionFilter({keyTimer:"no-sleep",duration:5e3,action:()=>A.play()})}),A.src="data:video/mp4;base64,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"}downloadFileJson(A,e){let n=new Blob([JSON.stringify(A)],{type:"application/json"}),i=URL.createObjectURL(n),a=document.createElement("a");a.style.display="none",a.href=i,a.download=`${e}.json`,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(i)},200)}}rt=new WeakMap;const Ht=new Qt;class ie{constructor(){N(this,Gt);N(this,St);N(this,wt);N(this,Ct);N(this,Ft);N(this,k,"logger");N(this,V,!1);N(this,Ut,2e3);N(this,it,new Map);N(this,Rt,{});J(this,"periodClear",3);O(this,Gt,he).call(this)}async init(){let A=new j(BX24.callBatch),{entityList:e}=await A.batch({entityList:{method:"entity.get"}});if(e!=null&&e.length)if(e.find(i=>i.ENTITY==h(this,k)))R(this,V,!0);else{let{entityAdd:i}=await A.batch({entityAdd:{method:"entity.add",params:{ENTITY:h(this,k),NAME:h(this,k),ACCESS:{AU:"X"}}}});i&&R(this,V,!0)}return O(this,Ct,le).call(this),h(this,V)}start({type:A,data:e}){if(!h(this,V)){O(this,St,re).call(this,"entity");return}const n=Ht.hash;return h(this,it).set(n,{type:A,data:e,userInfo:h(this,Rt),errorList:[],status:"",answer:null,date:new Date().getTime()}),n}stop({key:A,errorList:e,status:n,answer:i}){if(!h(this,V)){O(this,St,re).call(this,"entity");return}let a=h(this,it).get(A);e&&(a.errorList=e),n&&(a.status=n),i&&(a.answer=i),Ht.actionFilter({keyTimer:"add.entity.items",duration:h(this,Ut),action:()=>{O(this,wt,ce).call(this)}})}async getEntityList(A){let e=new j(BX24.callBatch),{entityList:n}=await e.batch({entityList:{method:"entity.item.get",params:{ENTITY:h(this,k),SORT:{ID:"DESC"}}}},A);return n=n.map(i=>{const{ID:a,DATE_CREATE:l,DETAIL_TEXT:_}=i;return{...JSON.parse(_),id:a,dateCreate:l}}),n}async downAllEntityJson(){let A=await this.getEntityList(),e=lt().format("%Y-%m-%d");Ht.downloadFileJson(A,`sdklogger-entity-data__${e}`)}}k=new WeakMap,V=new WeakMap,Ut=new WeakMap,it=new WeakMap,Rt=new WeakMap,Gt=new WeakSet,he=async function(){const A=new j(BX24.callBatch),e=BX24.isAdmin(),{curUser:n}=await A.batch({curUser:{method:"user.current"}});R(this,Rt,{isAdmin:e,curUser:n})},St=new WeakSet,re=function(A){A=="entity"&&Ht.actionFilter({keyTimer:"error.logger.entity",duration:500,action:()=>{console.error("Хранилище для логгера не инициализировано")}})},wt=new WeakSet,ce=async function(){let A={},e=new j(BX24.callBatch);for(let[n,i]of h(this,it).entries())i.status&&(A[n]={method:"entity.item.add",params:{ENTITY:h(this,k),NAME:h(this,k),DETAIL_TEXT:JSON.stringify(i)}});if(Object.keys(A).length){let n=await e.batch(A),{errors:i}=e;for(let[a,l]of Object.entries({...n,...i}))h(this,it).delete(a)}},Ct=new WeakSet,le=async function(){let A=new j(BX24.callBatch),e=await this.getEntityList(),{serverTime:n}=await A.batch({serverTime:{method:"server.time"}}),i=e.filter(a=>{let{dateCreate:l}=a;return lt(new Date(l)).between(lt(new Date(n)),"month")>=this.periodClear});O(this,Ft,ue).call(this,i)},Ft=new WeakSet,ue=async function(A){let e=new j(BX24.callBatch),n=A.map(i=>{let{id:a}=i;return{method:"entity.item.delete",params:{ENTITY:h(this,k),ID:a}}});return await e.batch(n)};const G=new ie;class _e{constructor(A){N(this,Pt);N(this,Wt);J(this,"domain","");J(this,"isAdmin",!1);J(this,"appInfo",null);J(this,"appConst",null);J(this,"userInfo",null);J(this,"placeData",null);J(this,"placeInfo",null);this.appConst=A}init(){return new Promise(A=>{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[n,i]=await Promise.all([O(this,Pt,me).call(this),O(this,Wt,fe).call(this)]);this.appInfo=n,this.userInfo=i,new Qt().noSleep(),A(!0)})},100)})}userOption(A,e){return e?BX24.userOption.set(A,e):BX24.userOption.get(A)}call({method:A,params:e,updateList:n}){let i=G.start({type:"call",data:{method:A,params:e,updateList:n}});return new Promise(a=>{e||(e={}),BX24.callMethod(A,e,function(l){let _={};if(l!=null&&l.answer)for(let[m,r]of Object.entries(l.answer))m!="result"&&r&&(_[m]=r);if(l.error()){let m=l.error();console.error(m),G.stop({answer:_,key:i,status:"fail",errorList:[m.toSting()]}),a(!1)}else{let m=l.data();m!=null&&m.items&&(m=m.items),G.stop({answer:_,key:i,status:"success"}),a(m)}})})}async batch(A,e,{updateList:n,errorCall:i}={}){let a=new j(BX24.callBatch),l=G.start({type:"batch",data:{commandList:A,updateList:n}});try{let _=await a.batch(A,e);if(Object.keys(a.errors).length){let m=Object.entries(a.errors).map(([r,g])=>({key:r,error:g.toSting()}));i&&i(a.errors),G.stop({key:l,status:"fail",errorList:m,answer:a.answerData})}else G.stop({key:l,status:"success",answer:a.answerData});return _}catch(_){return G.stop({key:l,status:"fail-runtime",errorList:[_.toSting()],answer:a.answerData}),console.error(_),!1}}async batchTotalCount(A,e){let n=new j(BX24.callBatch),i=G.start({type:"batch",data:{commandList:A}});try{let a=await n.batchTotalCount(A,e);if(Object.keys(n.errors).length){let l=Object.entries(n.errors).map(([_,m])=>({key:_,error:m.toSting()}));G.stop({key:i,status:"fail",errorList:l})}else G.stop({key:i,status:"success"});return a}catch(a){return G.stop({key:i,status:"fail",errorList:[a.toSting()]}),console.error(a),!1}}getPlacement(){return this.call({method:"placement.get"}).then(A=>(this.placeData||(this.placeData=A),A))}async placementBind(A){this.placeData||(this.placeData=await this.getPlacement());const{appName:e,pathApp:n}=this.appConst,i=this.placeData.map(l=>l.placement);let a=this.placeData.find(l=>l.placement==A);i.includes(A)?a.handler!=n&&(window.placementUnBind||(window.placementUnBind={}),window.placementUnBind[A]||this.placementUnBind(a).then(()=>{window.placementUnBind[A]||(window.placementUnBind[A]=!0,this.placementBind(A))})):this.call({method:"placement.bind",params:{PLACEMENT:A,HANDLER:n,LANG_ALL:{ru:{TITLE:e}}}}).then(l=>{l?console.info("Приложение успешно встроено в",A):console.warn("Приложение не может быть встроено в",A)})}placementUnBind(A){const{pathApp:e,appName:n}=this.appConst;return this.call({method:"placement.unbind",params:{PLACEMENT:A,HANDLER:e,LANG_ALL:{ru:{TITLE:n}}}}).then(i=>(console.log("Встройка отвязана",A),i))}getBotList(){return this.call({method:"imbot.bot.list",params:{}}).then(A=>{let e=Object.values(A);return console.log("chat-bot list:",e),e})}regBot({code:A,type:e,name:n}){const{appName:i,pathApp:a,chatBotLogo:l}=this.appConst,_=this.appInfo.ID;return this.call({method:"imbot.register",params:{CODE:A??this.appInfo.CODE,TYPE:e??"O",EVENT_HANDLER:a,OPENLINE:"Y",CLIENT_ID:"",PROPERTIES:{NAME:`${n??i} - бот #${_}`,LAST_NAME:"",COLOR:"GREEN",EMAIL:"",PERSONAL_BIRTHDAY:lt().format("%Y-%m-%d"),WORK_POSITION:"Почтальон",PERSONAL_WWW:"",PERSONAL_GENDER:"M",PERSONAL_PHOTO:l??""}}}).then(m=>(console.log("Чат-бот добавлен",m),m))}unRegBot(A){return this.call({method:"imbot.unregister",params:{BOT_ID:A}}).then(e=>(console.log("чат-бот удален",e),e))}}Pt=new WeakSet,me=function(){return this.call({method:"app.info"})},Wt=new WeakSet,fe=function(){return this.call({method:"user.current"})},d.Batch=j,d.BxBoot=_e,d.BxHelper=Qt,d.BxLogger=ie,d.tempus=lt,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -31,8 +31,11 @@ declare class BxLogger {
|
|
|
31
31
|
answer: { [key]: unknown };
|
|
32
32
|
}):void
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Получение списка логирования
|
|
36
|
+
* @param progressCall - коллбэк
|
|
37
|
+
*/
|
|
38
|
+
async getEntityList(progressCall: (data:{ percent: number })=>void): Promise<{[key]: any}[]>
|
|
36
39
|
|
|
37
40
|
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
38
41
|
downAllEntityJson(): void
|