szdl-utils-kit 0.2.27 → 0.2.28
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 +1672 -0
- package/dist/index.umd.cjs +2 -0
- package/dist/types/batch.d.ts +72 -0
- package/dist/types/bx-boot.d.ts +177 -0
- package/dist/types/bx-helper.d.ts +28 -0
- package/dist/types/bx-logger.d.ts +44 -0
- package/dist/types/index.d.ts +15 -0
- package/package.json +1 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,1672 @@
|
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var de = (T, e, A) => e in T ? ye(T, e, { enumerable: !0, configurable: !0, writable: !0, value: A }) : T[e] = A;
|
|
3
|
+
var C = (T, e, A) => (de(T, typeof e != "symbol" ? e + "" : e, A), A), Kt = (T, e, A) => {
|
|
4
|
+
if (!e.has(T))
|
|
5
|
+
throw TypeError("Cannot " + A);
|
|
6
|
+
};
|
|
7
|
+
var h = (T, e, A) => (Kt(T, e, "read from private field"), A ? A.call(T) : e.get(T)), O = (T, e, A) => {
|
|
8
|
+
if (e.has(T))
|
|
9
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
+
e instanceof WeakSet ? e.add(T) : e.set(T, A);
|
|
11
|
+
}, g = (T, e, A, n) => (Kt(T, e, "write to private field"), n ? n.call(T, A) : e.set(T, A), A);
|
|
12
|
+
var _ = (T, e, A) => (Kt(T, e, "access private method"), A);
|
|
13
|
+
var ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
+
function Ee(T) {
|
|
15
|
+
return T && T.__esModule && Object.prototype.hasOwnProperty.call(T, "default") ? T.default : T;
|
|
16
|
+
}
|
|
17
|
+
var vt = { exports: {} };
|
|
18
|
+
(function(T, e) {
|
|
19
|
+
(function(A) {
|
|
20
|
+
Array.prototype.indexOf || (Array.prototype.indexOf = function(t, s) {
|
|
21
|
+
var l, m;
|
|
22
|
+
for (l = s || 0, m = this.length; l < m; l += 1)
|
|
23
|
+
if (this[l] === t)
|
|
24
|
+
return l;
|
|
25
|
+
return -1;
|
|
26
|
+
});
|
|
27
|
+
var n = this, r = function(t, s) {
|
|
28
|
+
for (var l = t.toString(); l.length < s; )
|
|
29
|
+
l = "0" + l;
|
|
30
|
+
return l;
|
|
31
|
+
}, o = function(t, s) {
|
|
32
|
+
return s !== A ? (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) : A;
|
|
33
|
+
}, a = function(t, s) {
|
|
34
|
+
var l, m = "";
|
|
35
|
+
return l = t.slice(s, s + 1), l !== "" && !isNaN(Number(l)) && (m += "%H"), l = t.charAt(s + 2), l !== "" && l === ":" && (m += l), l = t.slice(s + 3, s + 4), l !== "" && !isNaN(Number(l)) && (m += "%M"), l = t.charAt(s + 5), l !== "" && l === ":" && (m += l), l = t.slice(s + 6, s + 7), l !== "" && !isNaN(Number(l)) && (m += "%S"), m;
|
|
36
|
+
}, f = function(t, s) {
|
|
37
|
+
var l, m = [
|
|
38
|
+
t.slice(s, s + 1),
|
|
39
|
+
t.charAt(s + 2),
|
|
40
|
+
t.slice(s + 3, s + 4),
|
|
41
|
+
t.charAt(s + 5),
|
|
42
|
+
t.slice(s + 6, s + 9)
|
|
43
|
+
], p;
|
|
44
|
+
return !isNaN(Number(m[0])) && !isNaN(Number(m[2])) && !isNaN(Number(m[4])) ? (m[1] === "." && m[3] === "." ? l = "%d.%m.%Y" : m[1] === "-" && m[3] === "-" ? l = "%m-%d-%Y" : m[1] === "/" && m[3] === "/" && (l = "%m/%d/%Y"), l) : (p = [
|
|
45
|
+
t.slice(s, s + 3),
|
|
46
|
+
t.charAt(s + 4),
|
|
47
|
+
t.slice(s + 5, s + 6),
|
|
48
|
+
t.charAt(s + 7),
|
|
49
|
+
t.slice(s + 8, s + 9)
|
|
50
|
+
], !isNaN(Number(p[0])) && !isNaN(Number(p[2])) && !isNaN(Number(p[4])) ? (p[1] === "-" && p[3] === "-" && (l = "%Y-%m-%d"), l) : "");
|
|
51
|
+
}, c = n.tempus, i, d, y = n.navigator || {}, u = "en", N = {
|
|
52
|
+
en: {
|
|
53
|
+
JANUARY_SHORT: "Jan",
|
|
54
|
+
FEBRUARY_SHORT: "Feb",
|
|
55
|
+
MARCH_SHORT: "Mar",
|
|
56
|
+
APRIL_SHORT: "Apr",
|
|
57
|
+
MAY_SHORT: "May",
|
|
58
|
+
JUNE_SHORT: "Jun",
|
|
59
|
+
JULY_SHORT: "Jul",
|
|
60
|
+
AUGUST_SHORT: "Aug",
|
|
61
|
+
SEPTEMBER_SHORT: "Sep",
|
|
62
|
+
OCTOBER_SHORT: "Oct",
|
|
63
|
+
NOVEMBER_SHORT: "Nov",
|
|
64
|
+
DECEMBER_SHORT: "Dec",
|
|
65
|
+
JANUARY_LONG: "January",
|
|
66
|
+
FEBRUARY_LONG: "February",
|
|
67
|
+
MARCH_LONG: "March",
|
|
68
|
+
APRIL_LONG: "April",
|
|
69
|
+
MAY_LONG: "May",
|
|
70
|
+
JUNE_LONG: "June",
|
|
71
|
+
JULY_LONG: "July",
|
|
72
|
+
AUGUST_LONG: "August",
|
|
73
|
+
SEPTEMBER_LONG: "September",
|
|
74
|
+
OCTOBER_LONG: "October",
|
|
75
|
+
NOVEMBER_LONG: "November",
|
|
76
|
+
DECEMBER_LONG: "December",
|
|
77
|
+
SUNDAY_SHORT: "Sun",
|
|
78
|
+
MONDAY_SHORT: "Mon",
|
|
79
|
+
TUESDAY_SHORT: "Tue",
|
|
80
|
+
WEDNESDAY_SHORT: "Wed",
|
|
81
|
+
THURSDAY_SHORT: "Thu",
|
|
82
|
+
FRIDAY_SHORT: "Fri",
|
|
83
|
+
SATURDAY_SHORT: "Sat",
|
|
84
|
+
SUNDAY_LONG: "Sunday",
|
|
85
|
+
MONDAY_LONG: "Monday",
|
|
86
|
+
TUESDAY_LONG: "Tuesday",
|
|
87
|
+
WEDNESDAY_LONG: "Wednesday",
|
|
88
|
+
THURSDAY_LONG: "Thursday",
|
|
89
|
+
FRIDAY_LONG: "Friday",
|
|
90
|
+
SATURDAY_LONG: "Saturday"
|
|
91
|
+
},
|
|
92
|
+
ru: {
|
|
93
|
+
JANUARY_SHORT: "Янв",
|
|
94
|
+
FEBRUARY_SHORT: "Фев",
|
|
95
|
+
MARCH_SHORT: "Мар",
|
|
96
|
+
APRIL_SHORT: "Апр",
|
|
97
|
+
MAY_SHORT: "Май",
|
|
98
|
+
JUNE_SHORT: "Июн",
|
|
99
|
+
JULY_SHORT: "Июл",
|
|
100
|
+
AUGUST_SHORT: "Авг",
|
|
101
|
+
SEPTEMBER_SHORT: "Сен",
|
|
102
|
+
OCTOBER_SHORT: "Окт",
|
|
103
|
+
NOVEMBER_SHORT: "Ноя",
|
|
104
|
+
DECEMBER_SHORT: "Дек",
|
|
105
|
+
JANUARY_LONG: "Январь",
|
|
106
|
+
FEBRUARY_LONG: "Февраль",
|
|
107
|
+
MARCH_LONG: "Март",
|
|
108
|
+
APRIL_LONG: "Апрель",
|
|
109
|
+
MAY_LONG: "Май",
|
|
110
|
+
JUNE_LONG: "Июнь",
|
|
111
|
+
JULY_LONG: "Июль",
|
|
112
|
+
AUGUST_LONG: "Август",
|
|
113
|
+
SEPTEMBER_LONG: "Сентябрь",
|
|
114
|
+
OCTOBER_LONG: "Октябрь",
|
|
115
|
+
NOVEMBER_LONG: "Ноябрь",
|
|
116
|
+
DECEMBER_LONG: "Декабрь",
|
|
117
|
+
SUNDAY_SHORT: "Вс",
|
|
118
|
+
MONDAY_SHORT: "Пн",
|
|
119
|
+
TUESDAY_SHORT: "Вт",
|
|
120
|
+
WEDNESDAY_SHORT: "Ср",
|
|
121
|
+
THURSDAY_SHORT: "Чт",
|
|
122
|
+
FRIDAY_SHORT: "Пт",
|
|
123
|
+
SATURDAY_SHORT: "Сб",
|
|
124
|
+
SUNDAY_LONG: "Воскресенье",
|
|
125
|
+
MONDAY_LONG: "Понедельник",
|
|
126
|
+
TUESDAY_LONG: "Вторник",
|
|
127
|
+
WEDNESDAY_LONG: "Среда",
|
|
128
|
+
THURSDAY_LONG: "Четверг",
|
|
129
|
+
FRIDAY_LONG: "Пятница",
|
|
130
|
+
SATURDAY_LONG: "Суббота"
|
|
131
|
+
},
|
|
132
|
+
ua: {
|
|
133
|
+
JANUARY_SHORT: "Січ",
|
|
134
|
+
FEBRUARY_SHORT: "Лют",
|
|
135
|
+
MARCH_SHORT: "Берез",
|
|
136
|
+
APRIL_SHORT: "Квіт",
|
|
137
|
+
MAY_SHORT: "Трав",
|
|
138
|
+
JUNE_SHORT: "Черв",
|
|
139
|
+
JULY_SHORT: "Лип",
|
|
140
|
+
AUGUST_SHORT: "Серп",
|
|
141
|
+
SEPTEMBER_SHORT: "Верес",
|
|
142
|
+
OCTOBER_SHORT: "Жовт",
|
|
143
|
+
NOVEMBER_SHORT: "Листоп",
|
|
144
|
+
DECEMBER_SHORT: "Груд",
|
|
145
|
+
JANUARY_LONG: "Січень",
|
|
146
|
+
FEBRUARY_LONG: "Лютий",
|
|
147
|
+
MARCH_LONG: "Березень",
|
|
148
|
+
APRIL_LONG: "Квітень",
|
|
149
|
+
MAY_LONG: "Травень",
|
|
150
|
+
JUNE_LONG: "Червень",
|
|
151
|
+
JULY_LONG: "Липень",
|
|
152
|
+
AUGUST_LONG: "Серпень",
|
|
153
|
+
SEPTEMBER_LONG: "Вересень",
|
|
154
|
+
OCTOBER_LONG: "Жовтень",
|
|
155
|
+
NOVEMBER_LONG: "Листопад",
|
|
156
|
+
DECEMBER_LONG: "Грудень",
|
|
157
|
+
SUNDAY_SHORT: "Нд",
|
|
158
|
+
MONDAY_SHORT: "Пн",
|
|
159
|
+
TUESDAY_SHORT: "Вт",
|
|
160
|
+
WEDNESDAY_SHORT: "Ср",
|
|
161
|
+
THURSDAY_SHORT: "Чт",
|
|
162
|
+
FRIDAY_SHORT: "Пт",
|
|
163
|
+
SATURDAY_SHORT: "Сб",
|
|
164
|
+
SUNDAY_LONG: "Неділя",
|
|
165
|
+
MONDAY_LONG: "Понеділок",
|
|
166
|
+
TUESDAY_LONG: "Вівторок",
|
|
167
|
+
WEDNESDAY_LONG: "Середа",
|
|
168
|
+
THURSDAY_LONG: "Четвер",
|
|
169
|
+
FRIDAY_LONG: "П’ятниця",
|
|
170
|
+
SATURDAY_LONG: "Субота"
|
|
171
|
+
},
|
|
172
|
+
de: {
|
|
173
|
+
JANUARY_SHORT: "Jan",
|
|
174
|
+
FEBRUARY_SHORT: "Feb",
|
|
175
|
+
MARCH_SHORT: "März",
|
|
176
|
+
APRIL_SHORT: "Apr",
|
|
177
|
+
MAY_SHORT: "Mai",
|
|
178
|
+
JUNE_SHORT: "Juni",
|
|
179
|
+
JULY_SHORT: "Juli",
|
|
180
|
+
AUGUST_SHORT: "Aug",
|
|
181
|
+
SEPTEMBER_SHORT: "Sept",
|
|
182
|
+
OCTOBER_SHORT: "Okt",
|
|
183
|
+
NOVEMBER_SHORT: "Nov",
|
|
184
|
+
DECEMBER_SHORT: "Dez",
|
|
185
|
+
JANUARY_LONG: "Januar",
|
|
186
|
+
FEBRUARY_LONG: "Februar",
|
|
187
|
+
MARCH_LONG: "März",
|
|
188
|
+
APRIL_LONG: "April",
|
|
189
|
+
MAY_LONG: "Mai",
|
|
190
|
+
JUNE_LONG: "Juni",
|
|
191
|
+
JULY_LONG: "Juli",
|
|
192
|
+
AUGUST_LONG: "August",
|
|
193
|
+
SEPTEMBER_LONG: "September",
|
|
194
|
+
OCTOBER_LONG: "Oktober",
|
|
195
|
+
NOVEMBER_LONG: "November",
|
|
196
|
+
DECEMBER_LONG: "Dezember",
|
|
197
|
+
SUNDAY_SHORT: "So",
|
|
198
|
+
MONDAY_SHORT: "Mo",
|
|
199
|
+
TUESDAY_SHORT: "Di",
|
|
200
|
+
WEDNESDAY_SHORT: "Mi",
|
|
201
|
+
THURSDAY_SHORT: "Do",
|
|
202
|
+
FRIDAY_SHORT: "Fr",
|
|
203
|
+
SATURDAY_SHORT: "Sa",
|
|
204
|
+
SUNDAY_LONG: "Sonntag",
|
|
205
|
+
MONDAY_LONG: "Montag",
|
|
206
|
+
TUESDAY_LONG: "Dienstag",
|
|
207
|
+
WEDNESDAY_LONG: "Mittwoch",
|
|
208
|
+
THURSDAY_LONG: "Donnerstag",
|
|
209
|
+
FRIDAY_LONG: "Freitag",
|
|
210
|
+
SATURDAY_LONG: "Samstag"
|
|
211
|
+
}
|
|
212
|
+
}, Y = function() {
|
|
213
|
+
return [
|
|
214
|
+
N[u].JANUARY_LONG,
|
|
215
|
+
N[u].FEBRUARY_LONG,
|
|
216
|
+
N[u].MARCH_LONG,
|
|
217
|
+
N[u].APRIL_LONG,
|
|
218
|
+
N[u].MAY_LONG,
|
|
219
|
+
N[u].JUNE_LONG,
|
|
220
|
+
N[u].JULY_LONG,
|
|
221
|
+
N[u].AUGUST_LONG,
|
|
222
|
+
N[u].SEPTEMBER_LONG,
|
|
223
|
+
N[u].OCTOBER_LONG,
|
|
224
|
+
N[u].NOVEMBER_LONG,
|
|
225
|
+
N[u].DECEMBER_LONG
|
|
226
|
+
];
|
|
227
|
+
}, W = function() {
|
|
228
|
+
return [
|
|
229
|
+
N[u].JANUARY_SHORT,
|
|
230
|
+
N[u].FEBRUARY_SHORT,
|
|
231
|
+
N[u].MARCH_SHORT,
|
|
232
|
+
N[u].APRIL_SHORT,
|
|
233
|
+
N[u].MAY_SHORT,
|
|
234
|
+
N[u].JUNE_SHORT,
|
|
235
|
+
N[u].JULY_SHORT,
|
|
236
|
+
N[u].AUGUST_SHORT,
|
|
237
|
+
N[u].SEPTEMBER_SHORT,
|
|
238
|
+
N[u].OCTOBER_SHORT,
|
|
239
|
+
N[u].NOVEMBER_SHORT,
|
|
240
|
+
N[u].DECEMBER_SHORT
|
|
241
|
+
];
|
|
242
|
+
}, G = function() {
|
|
243
|
+
return [
|
|
244
|
+
N[u].SUNDAY_LONG,
|
|
245
|
+
N[u].MONDAY_LONG,
|
|
246
|
+
N[u].TUESDAY_LONG,
|
|
247
|
+
N[u].WEDNESDAY_LONG,
|
|
248
|
+
N[u].THURSDAY_LONG,
|
|
249
|
+
N[u].FRIDAY_LONG,
|
|
250
|
+
N[u].SATURDAY_LONG
|
|
251
|
+
];
|
|
252
|
+
}, b = function() {
|
|
253
|
+
return [
|
|
254
|
+
N[u].SUNDAY_SHORT,
|
|
255
|
+
N[u].MONDAY_SHORT,
|
|
256
|
+
N[u].TUESDAY_SHORT,
|
|
257
|
+
N[u].WEDNESDAY_SHORT,
|
|
258
|
+
N[u].THURSDAY_SHORT,
|
|
259
|
+
N[u].FRIDAY_SHORT,
|
|
260
|
+
N[u].SATURDAY_SHORT
|
|
261
|
+
];
|
|
262
|
+
}, M, X, x, J, it = function(t, s, l) {
|
|
263
|
+
var m;
|
|
264
|
+
n.XMLHttpRequest ? m = new XMLHttpRequest() : m = new ActiveXObject("Microsoft.XMLHTTP"), m.onreadystatechange = function() {
|
|
265
|
+
m.readyState === 4 && (m.status === 200 ? s && (n.JSON === A ? alert(`Please, include json2 into your project if you want use old browsers!
|
|
266
|
+
https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : s(JSON.parse(m.responseText))) : l && l(m));
|
|
267
|
+
}, m.open("GET", t, !1), m.send();
|
|
268
|
+
}, B = {
|
|
269
|
+
"%d": {
|
|
270
|
+
format: function(t) {
|
|
271
|
+
return r(t.day() || i.MIN_DAY, 2);
|
|
272
|
+
},
|
|
273
|
+
parse: function(t) {
|
|
274
|
+
var s = Number(t);
|
|
275
|
+
return { day: isNaN(s) ? A : s };
|
|
276
|
+
},
|
|
277
|
+
minLength: 2,
|
|
278
|
+
maxLength: 2,
|
|
279
|
+
type: "number"
|
|
280
|
+
},
|
|
281
|
+
"%m": {
|
|
282
|
+
format: function(t) {
|
|
283
|
+
return r(t.month() || i.MIN_MONTH, 2);
|
|
284
|
+
},
|
|
285
|
+
parse: function(t) {
|
|
286
|
+
var s = Number(t);
|
|
287
|
+
return { month: isNaN(s) ? A : s };
|
|
288
|
+
},
|
|
289
|
+
minLength: 2,
|
|
290
|
+
maxLength: 2,
|
|
291
|
+
type: "number"
|
|
292
|
+
},
|
|
293
|
+
"%Y": {
|
|
294
|
+
format: function(t) {
|
|
295
|
+
return r(t.year() || i.MIN_YEAR, 4);
|
|
296
|
+
},
|
|
297
|
+
parse: function(t) {
|
|
298
|
+
var s = Number(t);
|
|
299
|
+
return { year: isNaN(s) ? A : s };
|
|
300
|
+
},
|
|
301
|
+
minLength: 4,
|
|
302
|
+
maxLength: 4,
|
|
303
|
+
type: "number"
|
|
304
|
+
},
|
|
305
|
+
"%w": {
|
|
306
|
+
format: function(t) {
|
|
307
|
+
return t.dayOfWeek() || i.MIN_DAY_OF_WEEK;
|
|
308
|
+
},
|
|
309
|
+
parse: function() {
|
|
310
|
+
return {};
|
|
311
|
+
},
|
|
312
|
+
minLength: 1,
|
|
313
|
+
maxLength: 1,
|
|
314
|
+
type: "number"
|
|
315
|
+
},
|
|
316
|
+
"%a": {
|
|
317
|
+
format: function(t) {
|
|
318
|
+
var s = t.dayOfWeek();
|
|
319
|
+
return J[s !== A ? s : i.MIN_DAY_OF_WEEK];
|
|
320
|
+
},
|
|
321
|
+
parse: function() {
|
|
322
|
+
return {};
|
|
323
|
+
},
|
|
324
|
+
minLength: 1,
|
|
325
|
+
maxLength: 999,
|
|
326
|
+
type: "word"
|
|
327
|
+
},
|
|
328
|
+
"%A": {
|
|
329
|
+
format: function(t) {
|
|
330
|
+
var s = t.dayOfWeek();
|
|
331
|
+
return x[s !== A ? s : i.MIN_DAY_OF_WEEK];
|
|
332
|
+
},
|
|
333
|
+
parse: function() {
|
|
334
|
+
return {};
|
|
335
|
+
},
|
|
336
|
+
minLength: 1,
|
|
337
|
+
maxLength: 999,
|
|
338
|
+
type: "word"
|
|
339
|
+
},
|
|
340
|
+
"%b": {
|
|
341
|
+
format: function(t) {
|
|
342
|
+
var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
343
|
+
return X[s !== A ? s : i.MIN_MONTH];
|
|
344
|
+
},
|
|
345
|
+
parse: function(t) {
|
|
346
|
+
var s = i.monthNames().indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
|
|
347
|
+
return { month: s !== -1 ? s : A };
|
|
348
|
+
},
|
|
349
|
+
minLength: 1,
|
|
350
|
+
maxLength: 999,
|
|
351
|
+
type: "word"
|
|
352
|
+
},
|
|
353
|
+
"%B": {
|
|
354
|
+
format: function(t) {
|
|
355
|
+
var s = i.options("monthFromZero") ? t.month() : t.month() - 1;
|
|
356
|
+
return M[s !== A ? s : i.MIN_MONTH];
|
|
357
|
+
},
|
|
358
|
+
parse: function(t) {
|
|
359
|
+
var s = i.monthNames(!0).indexOf(t) + (i.options("monthFromZero") ? 0 : 1);
|
|
360
|
+
return { month: s !== -1 ? s : A };
|
|
361
|
+
},
|
|
362
|
+
minLength: 1,
|
|
363
|
+
maxLength: 999,
|
|
364
|
+
type: "word"
|
|
365
|
+
},
|
|
366
|
+
"%H": {
|
|
367
|
+
format: function(t) {
|
|
368
|
+
return r(t.hours() || i.MIN_HOURS, 2);
|
|
369
|
+
},
|
|
370
|
+
parse: function(t) {
|
|
371
|
+
var s = Number(t);
|
|
372
|
+
return { hours: isNaN(s) ? A : s };
|
|
373
|
+
},
|
|
374
|
+
minLength: 2,
|
|
375
|
+
maxLength: 2,
|
|
376
|
+
type: "number"
|
|
377
|
+
},
|
|
378
|
+
"%M": {
|
|
379
|
+
format: function(t) {
|
|
380
|
+
return r(t.minutes() || i.MIN_MINUTES, 2);
|
|
381
|
+
},
|
|
382
|
+
parse: function(t) {
|
|
383
|
+
var s = Number(t);
|
|
384
|
+
return { minutes: isNaN(s) ? A : s };
|
|
385
|
+
},
|
|
386
|
+
minLength: 2,
|
|
387
|
+
maxLength: 2,
|
|
388
|
+
type: "number"
|
|
389
|
+
},
|
|
390
|
+
"%S": {
|
|
391
|
+
format: function(t) {
|
|
392
|
+
return r(t.seconds() || i.MIN_SECONDS, 2);
|
|
393
|
+
},
|
|
394
|
+
parse: function(t) {
|
|
395
|
+
var s = Number(t);
|
|
396
|
+
return { seconds: isNaN(s) ? A : s };
|
|
397
|
+
},
|
|
398
|
+
minLength: 2,
|
|
399
|
+
maxLength: 2,
|
|
400
|
+
type: "number"
|
|
401
|
+
},
|
|
402
|
+
"%s": {
|
|
403
|
+
format: function(t) {
|
|
404
|
+
return t.timestamp();
|
|
405
|
+
},
|
|
406
|
+
parse: function(t) {
|
|
407
|
+
return isNaN(Number(t)) ? {} : i(Number(t)).get();
|
|
408
|
+
},
|
|
409
|
+
minLength: 1,
|
|
410
|
+
maxLength: 20,
|
|
411
|
+
type: "number"
|
|
412
|
+
},
|
|
413
|
+
"%F": {
|
|
414
|
+
format: function(t) {
|
|
415
|
+
return r(t.year() || i.MIN_YEAR, 4) + "-" + r(t.month() || i.MIN_MONTH, 2) + "-" + r(t.day() || i.MIN_DAY, 2);
|
|
416
|
+
},
|
|
417
|
+
parse: function(t) {
|
|
418
|
+
var s = Number(t.slice(0, 4)), l = Number(t.slice(5, 7)), m = Number(t.slice(8, 10));
|
|
419
|
+
return {
|
|
420
|
+
year: s,
|
|
421
|
+
month: l,
|
|
422
|
+
day: m
|
|
423
|
+
};
|
|
424
|
+
},
|
|
425
|
+
minLength: 10,
|
|
426
|
+
maxLength: 10,
|
|
427
|
+
type: "string"
|
|
428
|
+
},
|
|
429
|
+
"%D": {
|
|
430
|
+
format: function(t) {
|
|
431
|
+
return r(t.month() || i.MIN_MONTH, 2) + "/" + r(t.day() || i.MIN_DAY, 2) + "/" + r(t.year() || i.MIN_YEAR, 4);
|
|
432
|
+
},
|
|
433
|
+
parse: function(t) {
|
|
434
|
+
var s = Number(t.slice(0, 2)), l = Number(t.slice(3, 5)), m = Number(t.slice(6, 10));
|
|
435
|
+
return {
|
|
436
|
+
year: m,
|
|
437
|
+
month: s,
|
|
438
|
+
day: l
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
minLength: 10,
|
|
442
|
+
maxLength: 10,
|
|
443
|
+
type: "string"
|
|
444
|
+
}
|
|
445
|
+
}, rt = {
|
|
446
|
+
useMilliseconds: !1,
|
|
447
|
+
monthFromZero: !1
|
|
448
|
+
}, R;
|
|
449
|
+
R = function(t, s, l) {
|
|
450
|
+
return this._d = /* @__PURE__ */ new Date(), this._i = {
|
|
451
|
+
year: !1,
|
|
452
|
+
month: !1,
|
|
453
|
+
day: !1,
|
|
454
|
+
hours: !1,
|
|
455
|
+
minutes: !1,
|
|
456
|
+
seconds: !1,
|
|
457
|
+
milliseconds: !1
|
|
458
|
+
}, t !== A && this.set(t, s, l), this;
|
|
459
|
+
}, R.fn = R.prototype, R.fn.dayCount = function() {
|
|
460
|
+
var t = this.month(), s = i.MAX_DAY_IN_MONTHS[t - (i.options("monthFromZero") ? 0 : 1)];
|
|
461
|
+
return this.leapYear() && t === (i.options("monthFromZero") ? 1 : 2) && (s += 1), s;
|
|
462
|
+
}, R.fn.year = function(t) {
|
|
463
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
466
|
+
return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
|
|
467
|
+
return this;
|
|
468
|
+
}, R.fn.month = function(t) {
|
|
469
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
472
|
+
return this._i.month === !1 ? i.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
|
|
473
|
+
return this;
|
|
474
|
+
}, R.fn.day = function(t) {
|
|
475
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
478
|
+
return this._i.day === !1 ? this._d.getDate() : this._i.day;
|
|
479
|
+
return this;
|
|
480
|
+
}, R.fn.hours = function(t) {
|
|
481
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
484
|
+
return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
|
|
485
|
+
return this;
|
|
486
|
+
}, R.fn.minutes = function(t) {
|
|
487
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
490
|
+
return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
|
|
491
|
+
return this;
|
|
492
|
+
}, R.fn.seconds = function(t) {
|
|
493
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
496
|
+
return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
|
|
497
|
+
return this;
|
|
498
|
+
}, R.fn.milliseconds = function(t) {
|
|
499
|
+
if (arguments.length !== 0)
|
|
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
|
+
else
|
|
502
|
+
return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
|
|
503
|
+
return this;
|
|
504
|
+
}, R.fn.week = function() {
|
|
505
|
+
var t = new Date(this.year(), 0, 1), s = i(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
|
|
506
|
+
return Math.ceil(((s - t.getTime()) / 864e5 + t.getDay() + 1) / 7);
|
|
507
|
+
}, R.fn.set = function(t, s, l) {
|
|
508
|
+
if (this._i = {
|
|
509
|
+
year: !1,
|
|
510
|
+
month: !1,
|
|
511
|
+
day: !1,
|
|
512
|
+
hours: !1,
|
|
513
|
+
minutes: !1,
|
|
514
|
+
seconds: !1,
|
|
515
|
+
milliseconds: !1
|
|
516
|
+
}, t === A)
|
|
517
|
+
return this._d = /* @__PURE__ */ new Date(), this;
|
|
518
|
+
if (t instanceof Date)
|
|
519
|
+
return this._d = t, this;
|
|
520
|
+
if (typeof t == "number")
|
|
521
|
+
return this._d = new Date(t * (i.options("useMilliseconds") ? 1 : 1e3)), this;
|
|
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 m, p = [], E, S, P = [], H = 0, w = 0, L, j, D = {}, I;
|
|
524
|
+
if (t === A)
|
|
525
|
+
return E = o(this, l), E === A && (this._i = {
|
|
526
|
+
year: -1,
|
|
527
|
+
month: -1,
|
|
528
|
+
day: -1,
|
|
529
|
+
hours: -1,
|
|
530
|
+
minutes: -1,
|
|
531
|
+
seconds: -1,
|
|
532
|
+
milliseconds: -1
|
|
533
|
+
}), E;
|
|
534
|
+
for (s === A && (s = i.detectFormat(t)); H < s.length; ) {
|
|
535
|
+
if (s.charAt(H) === "%") {
|
|
536
|
+
if (S = s.charAt(H) + s.charAt(H + 1), B[S] !== A) {
|
|
537
|
+
switch (L = 0, j = "", B[S].type) {
|
|
538
|
+
case "number":
|
|
539
|
+
for (; L < B[S].maxLength && w + L < t.length && !isNaN(Number(t.charAt(w + L))); )
|
|
540
|
+
j += t.charAt(w + L), L += 1;
|
|
541
|
+
break;
|
|
542
|
+
case "word":
|
|
543
|
+
for (; L < B[S].maxLength && w + L < t.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(t.charAt(w + L)); )
|
|
544
|
+
j += t.charAt(w + L), L += 1;
|
|
545
|
+
break;
|
|
546
|
+
case "string":
|
|
547
|
+
for (; L < B[S].maxLength && w + L < t.length; )
|
|
548
|
+
j += t.charAt(w + L), L += 1;
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
if (L < B[S].minLength)
|
|
552
|
+
return E = o(this, l), E === A && (this._i = {
|
|
553
|
+
year: -1,
|
|
554
|
+
month: -1,
|
|
555
|
+
day: -1,
|
|
556
|
+
hours: -1,
|
|
557
|
+
minutes: -1,
|
|
558
|
+
seconds: -1,
|
|
559
|
+
milliseconds: -1
|
|
560
|
+
}), E;
|
|
561
|
+
p.push(S), P.push(j), L -= 1, w += L, H += 1;
|
|
562
|
+
}
|
|
563
|
+
} else if (t.charAt(w) !== s.charAt(H))
|
|
564
|
+
return E = o(this, l), E === A && (this._i = {
|
|
565
|
+
year: -1,
|
|
566
|
+
month: -1,
|
|
567
|
+
day: -1,
|
|
568
|
+
hours: -1,
|
|
569
|
+
minutes: -1,
|
|
570
|
+
seconds: -1,
|
|
571
|
+
milliseconds: -1
|
|
572
|
+
}), E;
|
|
573
|
+
H += 1, w += 1;
|
|
574
|
+
}
|
|
575
|
+
for (m in p)
|
|
576
|
+
p.hasOwnProperty(m) && B.hasOwnProperty(p[m]) && (I = B[p[m]].parse(P[m]), D = {
|
|
577
|
+
year: I.year !== A ? I.year : D.year,
|
|
578
|
+
month: I.month !== A ? I.month : D.month,
|
|
579
|
+
day: I.day !== A ? I.day : D.day,
|
|
580
|
+
hours: I.hours !== A ? I.hours : D.hours,
|
|
581
|
+
minutes: I.minutes !== A ? I.minutes : D.minutes,
|
|
582
|
+
seconds: I.seconds !== A ? I.seconds : D.seconds
|
|
583
|
+
});
|
|
584
|
+
this.day(i.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);
|
|
585
|
+
}
|
|
586
|
+
return this;
|
|
587
|
+
}, R.fn.leapYear = function() {
|
|
588
|
+
var t = this.year();
|
|
589
|
+
return t % 4 === 0 ? t % 100 === 0 ? t % 400 === 0 : !0 : !1;
|
|
590
|
+
}, R.fn.timestamp = function(t) {
|
|
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
|
+
}, R.fn.utc = function(t) {
|
|
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
|
+
}, R.fn.dayOfWeek = function(t) {
|
|
595
|
+
if (t === "long")
|
|
596
|
+
return x[this._d.getDay()];
|
|
597
|
+
if (t === "short")
|
|
598
|
+
return J[this._d.getDay()];
|
|
599
|
+
if (t === A)
|
|
600
|
+
return this._d.getDay();
|
|
601
|
+
if (t === 0 || t === "Sunday")
|
|
602
|
+
return this.calc({ day: -this.dayOfWeek() });
|
|
603
|
+
if (t === 1 || t === "Monday")
|
|
604
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -6 : 1) - this.dayOfWeek() });
|
|
605
|
+
if (t === 2 || t === "Tuesday")
|
|
606
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -5 : 2) - this.dayOfWeek() });
|
|
607
|
+
if (t === 3 || t === "Wednesday")
|
|
608
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -4 : 3) - this.dayOfWeek() });
|
|
609
|
+
if (t === 4 || t === "Thursday")
|
|
610
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -3 : 4) - this.dayOfWeek() });
|
|
611
|
+
if (t === 5 || t === "Friday")
|
|
612
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
|
|
613
|
+
if (t === 6 || t === "Saturday")
|
|
614
|
+
return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
|
|
615
|
+
}, R.fn.timezone = function(t) {
|
|
616
|
+
switch (t) {
|
|
617
|
+
case "hours":
|
|
618
|
+
return Math.floor(this._d.getTimezoneOffset() / 60);
|
|
619
|
+
case "minutes":
|
|
620
|
+
return this._d.getTimezoneOffset();
|
|
621
|
+
default:
|
|
622
|
+
return this._d.getTimezoneOffset() * 60;
|
|
623
|
+
}
|
|
624
|
+
}, R.fn.get = function(t) {
|
|
625
|
+
switch (t) {
|
|
626
|
+
case "Date":
|
|
627
|
+
return new Date(
|
|
628
|
+
this.year(),
|
|
629
|
+
this.month() - (i.options("monthFromZero") ? 0 : 1),
|
|
630
|
+
this.day(),
|
|
631
|
+
this.hours(),
|
|
632
|
+
this.minutes(),
|
|
633
|
+
this.seconds(),
|
|
634
|
+
this.milliseconds()
|
|
635
|
+
);
|
|
636
|
+
case "DateUTC":
|
|
637
|
+
return new Date(Date.UTC(
|
|
638
|
+
this.year(),
|
|
639
|
+
this.month() - (i.options("monthFromZero") ? 0 : 1),
|
|
640
|
+
this.day(),
|
|
641
|
+
this.hours(),
|
|
642
|
+
this.minutes(),
|
|
643
|
+
this.seconds(),
|
|
644
|
+
this.milliseconds()
|
|
645
|
+
));
|
|
646
|
+
case "Array":
|
|
647
|
+
return [
|
|
648
|
+
this.year(),
|
|
649
|
+
this.month(),
|
|
650
|
+
this.day(),
|
|
651
|
+
this.hours(),
|
|
652
|
+
this.minutes(),
|
|
653
|
+
this.seconds(),
|
|
654
|
+
this.milliseconds()
|
|
655
|
+
];
|
|
656
|
+
default:
|
|
657
|
+
return {
|
|
658
|
+
year: this.year(),
|
|
659
|
+
month: this.month(),
|
|
660
|
+
week: this.week(),
|
|
661
|
+
day: this.day(),
|
|
662
|
+
hours: this.hours(),
|
|
663
|
+
minutes: this.minutes(),
|
|
664
|
+
seconds: this.seconds(),
|
|
665
|
+
milliseconds: this.milliseconds(),
|
|
666
|
+
utc: this.utc(),
|
|
667
|
+
dayOfWeek: this.dayOfWeek(),
|
|
668
|
+
dayOfWeekShort: this.dayOfWeek("short"),
|
|
669
|
+
dayOfWeekLong: this.dayOfWeek("long"),
|
|
670
|
+
timestamp: this.timestamp()
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
}, R.fn.format = function(t) {
|
|
674
|
+
for (var s = 0, l = "", m; s < t.length; )
|
|
675
|
+
t.charAt(s) === "%" ? (m = t.charAt(s) + t.charAt(s + 1), B[m] !== A ? (l += B[m].format(this), s += 1) : l += "%") : l += t.charAt(s), s += 1;
|
|
676
|
+
return l;
|
|
677
|
+
}, R.fn.valid = function() {
|
|
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
|
+
}, R.fn.errors = function() {
|
|
680
|
+
return this._i;
|
|
681
|
+
}, R.fn.between = function(t, s) {
|
|
682
|
+
var l = this.timestamp(), m = t.timestamp();
|
|
683
|
+
switch (s) {
|
|
684
|
+
case "year":
|
|
685
|
+
return Math.floor((m - l) / 31556952);
|
|
686
|
+
case "month":
|
|
687
|
+
return Math.floor((m - l) / 2629746);
|
|
688
|
+
case "day":
|
|
689
|
+
return Math.floor((m - l) / 86400);
|
|
690
|
+
case "hours":
|
|
691
|
+
return Math.floor((m - l) / 3600);
|
|
692
|
+
case "minutes":
|
|
693
|
+
return Math.floor((m - l) / 60);
|
|
694
|
+
case "seconds":
|
|
695
|
+
return m - l;
|
|
696
|
+
default:
|
|
697
|
+
return A;
|
|
698
|
+
}
|
|
699
|
+
}, R.fn.calc = function(t) {
|
|
700
|
+
return t.year !== A && this._d.setFullYear(this._d.getFullYear() + t.year), t.month !== A && this._d.setMonth(this._d.getMonth() + t.month), t.day !== A && this._d.setDate(this._d.getDate() + t.day), t.hours !== A && this._d.setHours(this._d.getHours() + t.hours), t.minutes !== A && this._d.setMinutes(this._d.getMinutes() + t.minutes), t.seconds !== A && this._d.setSeconds(this._d.getSeconds() + t.seconds), t.milliseconds !== A && this._d.setMilliseconds(this._d.getMilliseconds() + t.milliseconds), this;
|
|
701
|
+
}, i = function(t, s, l) {
|
|
702
|
+
return new R(t, s, l);
|
|
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, s) {
|
|
704
|
+
if (t === A)
|
|
705
|
+
return rt;
|
|
706
|
+
if (rt.hasOwnProperty(t)) {
|
|
707
|
+
if (s === A)
|
|
708
|
+
return rt[t];
|
|
709
|
+
rt[t] = s, t === "monthFromZero" && (i.MIN_MONTH = s ? 0 : 1, i.MAX_MONTH = s ? 11 : 12);
|
|
710
|
+
}
|
|
711
|
+
return A;
|
|
712
|
+
}, i.noConflict = function() {
|
|
713
|
+
return n.tempus = c, i;
|
|
714
|
+
}, i.generate = function(t) {
|
|
715
|
+
var s, l, m, p, E, S, P, H;
|
|
716
|
+
if (typeof t.dateFrom != "number" && (t.dateFrom instanceof R ? s = t.dateFrom.utc() : s = i(t.dateFrom, t.formatFrom).utc()), typeof t.dateTo != "number" && (t.dateTo instanceof R ? l = t.dateTo.utc() : l = i(t.dateTo, t.formatTo !== A ? t.formatTo : t.formatFrom).utc()), typeof t.period == "number" ? E = {
|
|
717
|
+
year: 0,
|
|
718
|
+
month: 0,
|
|
719
|
+
day: 0,
|
|
720
|
+
hours: 0,
|
|
721
|
+
minutes: 0,
|
|
722
|
+
seconds: t.period
|
|
723
|
+
} : typeof t.period == "string" ? E = {
|
|
724
|
+
year: t.period === "year" ? 1 : 0,
|
|
725
|
+
month: t.period === "month" ? 1 : 0,
|
|
726
|
+
day: t.period === "day" ? 1 : 0,
|
|
727
|
+
hours: t.period === "hours" ? 1 : 0,
|
|
728
|
+
minutes: t.period === "minutes" ? 1 : 0,
|
|
729
|
+
seconds: t.period === "seconds" ? 1 : 0
|
|
730
|
+
} : typeof t.period == "object" && (E = {
|
|
731
|
+
year: t.period.year !== A ? t.period.year : 0,
|
|
732
|
+
month: t.period.month !== A ? t.period.month : 0,
|
|
733
|
+
day: t.period.day !== A ? t.period.day : 0,
|
|
734
|
+
hours: t.period.hours !== A ? t.period.hours : 0,
|
|
735
|
+
minutes: t.period.minutes !== A ? t.period.minutes : 0,
|
|
736
|
+
seconds: t.period.seconds !== A ? t.period.seconds : 0
|
|
737
|
+
}), t.groupBy === A ? S = t.asObject === !0 ? {} : [] : (S = [], S.push([]), P = i(s).get()[t.groupBy]), H = function(j, D, I) {
|
|
738
|
+
return t.asObject === !0 ? t.format !== A ? j[i(D).format(t.format)] = {} : j[i(D).format("%F %H:%M:%S")] = {} : t.format !== A ? j.push(I ? null : i(D).format(t.format)) : j.push(I ? null : i(D)), j;
|
|
739
|
+
}, t.groupBy !== A && t.fillNulls) {
|
|
740
|
+
var w = {
|
|
741
|
+
year: E.year ? -E.year : A,
|
|
742
|
+
month: E.month ? -E.month : A,
|
|
743
|
+
day: E.day ? -E.day : A,
|
|
744
|
+
hours: E.hours ? -E.hours : A,
|
|
745
|
+
minutes: E.minutes ? -E.minutes : A,
|
|
746
|
+
seconds: E.seconds ? -E.seconds : A,
|
|
747
|
+
milliseconds: E.milliseconds ? -E.milliseconds : A
|
|
748
|
+
};
|
|
749
|
+
for (m = i(s).calc(w).utc(); i(m).get()[t.groupBy] === P; )
|
|
750
|
+
H(S[S.length - 1], m, !0), m = i(m).calc(w).utc();
|
|
751
|
+
if (t.groupBy === "week") {
|
|
752
|
+
var L = i(s).dayOfWeek();
|
|
753
|
+
for (m = i(s).dayOfWeek(0).utc(); S[0].length < L && m < s; )
|
|
754
|
+
H(S[S.length - 1], m, !0), m = i(m).calc(E).utc();
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
for (; s <= l; )
|
|
758
|
+
t.groupBy === A ? H(S, s) : i(s).get()[t.groupBy] === P ? H(S[S.length - 1], s) : (S.push([]), H(S[S.length - 1], s), P = i(s).get()[t.groupBy]), s = i(s).calc(E).utc();
|
|
759
|
+
if (t.groupBy !== A && t.fillNulls)
|
|
760
|
+
for (p = i(l).calc(E).utc(); i(p).get()[t.groupBy] === P; )
|
|
761
|
+
H(S[S.length - 1], p, !0), p = i(p).calc(E).utc();
|
|
762
|
+
return S;
|
|
763
|
+
}, i.monthNames = function(t) {
|
|
764
|
+
switch (t) {
|
|
765
|
+
case "long":
|
|
766
|
+
return M;
|
|
767
|
+
default:
|
|
768
|
+
return X;
|
|
769
|
+
}
|
|
770
|
+
}, i.dayNames = function(t) {
|
|
771
|
+
switch (t) {
|
|
772
|
+
case "long":
|
|
773
|
+
return x;
|
|
774
|
+
default:
|
|
775
|
+
return J;
|
|
776
|
+
}
|
|
777
|
+
}, i.lang = function(t) {
|
|
778
|
+
if (t !== A)
|
|
779
|
+
u = t, N[u] === A && (u = "en"), M = Y(), X = W(), x = G(), J = b();
|
|
780
|
+
else
|
|
781
|
+
return u;
|
|
782
|
+
return A;
|
|
783
|
+
}, i.availableLangs = function() {
|
|
784
|
+
return Object.keys(N);
|
|
785
|
+
}, i.registerFormat = function(t, s, l, m, p, E) {
|
|
786
|
+
B[t] = {
|
|
787
|
+
format: s,
|
|
788
|
+
parse: l,
|
|
789
|
+
minLength: m,
|
|
790
|
+
maxLength: p,
|
|
791
|
+
type: E
|
|
792
|
+
};
|
|
793
|
+
}, i.unregisterFormat = function(t) {
|
|
794
|
+
delete B[t];
|
|
795
|
+
}, i.detectFormat = function(t) {
|
|
796
|
+
var s, l, m;
|
|
797
|
+
return s = f(t, 0), s !== "" && (m = 10), l = t.charAt(m), (l === "T" || l === " ") && (s += l, m += 1), s += a(t, m), s;
|
|
798
|
+
}, d = {
|
|
799
|
+
TempusDate: R
|
|
800
|
+
}, i.classes = function(t, s) {
|
|
801
|
+
if (s === A)
|
|
802
|
+
return d[t];
|
|
803
|
+
d[t] = s;
|
|
804
|
+
}, i.loadTranslations = function(t) {
|
|
805
|
+
typeof t == "object" ? N = t : typeof t == "string" && it(t, function(s) {
|
|
806
|
+
N = s;
|
|
807
|
+
}, function(s) {
|
|
808
|
+
});
|
|
809
|
+
}, u = (y.language || y.systemLanguage || y.userLanguage || "en").substr(0, 2).toLowerCase(), N[u] === A && (u = "en"), M = Y(), X = W(), x = G(), J = b(), T.exports && (e = T.exports = i), e.tempus = i;
|
|
810
|
+
}).call(ge);
|
|
811
|
+
})(vt, vt.exports);
|
|
812
|
+
var Te = vt.exports;
|
|
813
|
+
const Yt = /* @__PURE__ */ Ee(Te);
|
|
814
|
+
var v, dt, q, U, Q, Z, $, tt, F, K, Ft, nt, k, et, at, ct, It, mt, Bt, gt, qt, ut, Ut, Et, $t, Tt, te, Rt, ee, kt, ae, Pt, oe, St, Ae, pt, se, Mt, ie, ft, wt, Lt, re, Wt, he, ot, yt, Nt, Gt, Ot, Ct, Jt, le;
|
|
815
|
+
class z {
|
|
816
|
+
constructor(e, A = {}) {
|
|
817
|
+
O(this, ct);
|
|
818
|
+
O(this, mt);
|
|
819
|
+
O(this, gt);
|
|
820
|
+
O(this, ut);
|
|
821
|
+
O(this, Et);
|
|
822
|
+
/* batchChunk для batchUpdateField */
|
|
823
|
+
O(this, Tt);
|
|
824
|
+
O(this, Rt);
|
|
825
|
+
O(this, kt);
|
|
826
|
+
O(this, Pt);
|
|
827
|
+
O(this, St);
|
|
828
|
+
O(this, pt);
|
|
829
|
+
O(this, Mt);
|
|
830
|
+
O(this, ft);
|
|
831
|
+
O(this, Lt);
|
|
832
|
+
O(this, Wt);
|
|
833
|
+
O(this, ot);
|
|
834
|
+
O(this, Nt);
|
|
835
|
+
O(this, Ot);
|
|
836
|
+
/* преобразование стандартного вида запроса для batch в вид запроса для batchUpdateField */
|
|
837
|
+
O(this, Jt);
|
|
838
|
+
O(this, v, null);
|
|
839
|
+
O(this, dt, null);
|
|
840
|
+
O(this, q, []);
|
|
841
|
+
O(this, U, {});
|
|
842
|
+
O(this, Q, 50);
|
|
843
|
+
O(this, Z, 50);
|
|
844
|
+
O(this, $, !0);
|
|
845
|
+
O(this, tt, null);
|
|
846
|
+
O(this, F, null);
|
|
847
|
+
O(this, K, null);
|
|
848
|
+
O(this, Ft, 100);
|
|
849
|
+
O(this, nt, "no");
|
|
850
|
+
O(this, k, !1);
|
|
851
|
+
O(this, et, !1);
|
|
852
|
+
O(this, at, !1);
|
|
853
|
+
C(this, "errors", {});
|
|
854
|
+
C(this, "answerData", {});
|
|
855
|
+
C(this, "timeLimit", !1);
|
|
856
|
+
g(this, v, e), g(this, dt, A);
|
|
857
|
+
}
|
|
858
|
+
get serial() {
|
|
859
|
+
return h(this, k);
|
|
860
|
+
}
|
|
861
|
+
get limitCommandSerial() {
|
|
862
|
+
return h(this, Z);
|
|
863
|
+
}
|
|
864
|
+
set limitCommandSerial(e) {
|
|
865
|
+
if (e < 10)
|
|
866
|
+
throw new Error("limitCommandSerial не может быть меньше 10");
|
|
867
|
+
e >= 10 && e < 50 && (g(this, Q, e), g(this, Z, e)), g(this, Z, e);
|
|
868
|
+
}
|
|
869
|
+
setSerial() {
|
|
870
|
+
g(this, k, !0), g(this, et, !0), g(this, at, !1);
|
|
871
|
+
}
|
|
872
|
+
setParallel() {
|
|
873
|
+
g(this, k, !1), g(this, et, !1), g(this, at, !0);
|
|
874
|
+
}
|
|
875
|
+
stop() {
|
|
876
|
+
g(this, $, !1);
|
|
877
|
+
}
|
|
878
|
+
async batch(e, A) {
|
|
879
|
+
h(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), h(this, et) === !1 && g(this, k, !1), Object.keys(e).length > h(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
880
|
+
const n = _(this, ut, Ut).call(this, e);
|
|
881
|
+
if (Object.keys(e).length < h(this, Z)) {
|
|
882
|
+
const r = n.map((o, a) => _(this, Et, $t).call(this, o, n[a]));
|
|
883
|
+
return Promise.allSettled(r).then((o) => {
|
|
884
|
+
let a = {};
|
|
885
|
+
for (let f of o)
|
|
886
|
+
f.status === "fulfilled" && (a = { ...a, ...f.value });
|
|
887
|
+
return a;
|
|
888
|
+
});
|
|
889
|
+
} else {
|
|
890
|
+
let r = {}, o = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
891
|
+
o += Object.keys(i).length, a = Math.round(o / f * 100);
|
|
892
|
+
};
|
|
893
|
+
for (let [i, d] of Object.entries(n)) {
|
|
894
|
+
let y = await _(this, Et, $t).call(this, d, n[i], !0);
|
|
895
|
+
c(d), A && A({ percent: a }), r = { ...r, ...y };
|
|
896
|
+
}
|
|
897
|
+
return r;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
901
|
+
async batchUpdateField(e, A) {
|
|
902
|
+
h(this, K) && _(this, mt, Bt).call(this), A && g(this, tt, A), h(this, et) === !1 && g(this, k, !1), Object.keys(e).length > h(this, Z) && g(this, k, !0), g(this, $, !0), g(this, q, []), g(this, U, {}), this.errors = {}, this.answerData = {};
|
|
903
|
+
const n = _(this, ut, Ut).call(this, e);
|
|
904
|
+
if (Object.keys(e).length < h(this, Z)) {
|
|
905
|
+
let r = {};
|
|
906
|
+
for (let [o, a] of Object.entries(n)) {
|
|
907
|
+
let f = await _(this, Tt, te).call(this, a, n[o]);
|
|
908
|
+
r = { ...r, ...f };
|
|
909
|
+
}
|
|
910
|
+
return r;
|
|
911
|
+
} else {
|
|
912
|
+
let r = {}, o = 0, a = 1, f = Object.keys(e).length || 1, c = (i) => {
|
|
913
|
+
o += Object.keys(i).length, a = Math.round(o / f * 100);
|
|
914
|
+
};
|
|
915
|
+
for (let [i, d] of Object.entries(n)) {
|
|
916
|
+
let y = await _(this, Tt, te).call(this, d, n[i], !0);
|
|
917
|
+
c(d), A && A({ percent: a }), r = { ...r, ...y }, this.timeLimit && (console.log("Был достигнут лимит operating time - сделана остановка на 2 минуты, timeLimit = ", this.timeLimit), await new Promise((u) => setTimeout(u, 12e4)), this.timeLimit = !1, console.log("Остановка в 2 минуты по лимиту operating time закончена, timeLimit = ", this.timeLimit));
|
|
918
|
+
}
|
|
919
|
+
return r;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
async batchTotalCount(e, A) {
|
|
923
|
+
g(this, U, {}), this.errors = {};
|
|
924
|
+
let n = 1, r = 0, o = Object.keys(e).length || 1, a = (c) => {
|
|
925
|
+
r += Object.keys(c).length, n = Math.round(r / o * 100);
|
|
926
|
+
};
|
|
927
|
+
A && A({ percent: n });
|
|
928
|
+
const f = _(this, ut, Ut).call(this, e);
|
|
929
|
+
if (h(this, at)) {
|
|
930
|
+
const c = f.map((i) => _(this, Rt, ee).call(this, i).then((d) => (a(i), A && A({ percent: n }), d)));
|
|
931
|
+
return Promise.allSettled(c).then((i) => {
|
|
932
|
+
let d = {};
|
|
933
|
+
for (let y of i)
|
|
934
|
+
y.status === "fulfilled" && (d = { ...d, ...y.value });
|
|
935
|
+
return d;
|
|
936
|
+
});
|
|
937
|
+
} else {
|
|
938
|
+
let c = {};
|
|
939
|
+
for (let i of f) {
|
|
940
|
+
let d = await _(this, Rt, ee).call(this, i);
|
|
941
|
+
a(i), A && A({ percent: n }), c = { ...c, ...d };
|
|
942
|
+
}
|
|
943
|
+
return c;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
v = new WeakMap(), dt = new WeakMap(), q = new WeakMap(), U = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), F = new WeakMap(), K = new WeakMap(), Ft = new WeakMap(), nt = new WeakMap(), k = new WeakMap(), et = new WeakMap(), at = new WeakMap(), ct = new WeakSet(), It = function() {
|
|
948
|
+
let e = 0;
|
|
949
|
+
if (!h(this, F))
|
|
950
|
+
return Math.round(e);
|
|
951
|
+
let A = 0, n = 0;
|
|
952
|
+
return Object.values(h(this, F)).forEach((r) => {
|
|
953
|
+
const { total: o, count: a } = r;
|
|
954
|
+
A += o ?? 0, n += a ?? 0;
|
|
955
|
+
}), A ? e = n / A * 100 : e = 100, { percent: Math.round(e), allCount: n, allTotal: A };
|
|
956
|
+
}, mt = new WeakSet(), Bt = function() {
|
|
957
|
+
clearInterval(h(this, K)), g(this, K, ""), g(this, F, ""), g(this, tt, ""), g(this, nt, "no");
|
|
958
|
+
}, gt = new WeakSet(), qt = function({ key: e, value: A }) {
|
|
959
|
+
const n = _(this, ot, yt).call(this, A.data()), r = Array.isArray(n) ? n.length : 0, o = _(this, Nt, Gt).call(this, A.total(), r);
|
|
960
|
+
let a = 1;
|
|
961
|
+
n && (a = r), h(this, tt) && (h(this, F) || g(this, F, {}), h(this, F)[e] && h(this, F)[e].count && (a += h(this, F)[e].count), h(this, F)[e] = { total: o, count: a }, h(this, K) || g(this, K, setInterval(() => {
|
|
962
|
+
const { percent: f, allCount: c, allTotal: i } = h(this, ct, It);
|
|
963
|
+
(h(this, nt) === "no" || h(this, nt) < h(this, ct, It).percent) && (h(this, tt).call(this, {
|
|
964
|
+
data: h(this, F),
|
|
965
|
+
percent: f,
|
|
966
|
+
allCount: c,
|
|
967
|
+
allTotal: i
|
|
968
|
+
}), g(this, nt, h(this, ct, It).percent)), f === 100 && _(this, mt, Bt).call(this);
|
|
969
|
+
}, h(this, Ft))));
|
|
970
|
+
}, ut = new WeakSet(), Ut = function(e) {
|
|
971
|
+
const A = [], n = Object.entries(e);
|
|
972
|
+
for (let r = 0; r < n.length; r += h(this, Q)) {
|
|
973
|
+
const o = n.slice(r, r + h(this, Q));
|
|
974
|
+
A.push(Object.fromEntries(o));
|
|
975
|
+
}
|
|
976
|
+
return A;
|
|
977
|
+
}, Et = new WeakSet(), $t = function(e, A, n) {
|
|
978
|
+
return new Promise((r) => {
|
|
979
|
+
const o = _(this, Lt, re).call(this, A), a = [];
|
|
980
|
+
let f = 0, c = 0;
|
|
981
|
+
h(this, v).call(this, e, (i) => {
|
|
982
|
+
Object.entries(i).forEach(([d, y]) => {
|
|
983
|
+
let u = {};
|
|
984
|
+
const N = y.error();
|
|
985
|
+
if (N) {
|
|
986
|
+
let { query: { method: b }, answer: M } = y;
|
|
987
|
+
this.errors[d] = { error: N, method: b }, f += 1;
|
|
988
|
+
}
|
|
989
|
+
if (y != null && y.answer && Object.keys(y.answer).length) {
|
|
990
|
+
for (let [b, M] of Object.entries(y.answer))
|
|
991
|
+
b != "result" && M && (u[b] = M);
|
|
992
|
+
Object.keys(u).length && (this.answerData[d] = u);
|
|
993
|
+
}
|
|
994
|
+
const Y = _(this, ot, yt).call(this, y.data()), W = Array.isArray(Y) ? Y.length : 0, G = _(this, Nt, Gt).call(this, y.total(), W);
|
|
995
|
+
if (Array.isArray(Y) ? h(this, U)[d] = Y : typeof Y == "object" && Y !== null && Object.keys(Y).length === 0 ? h(this, U)[d] = [] : h(this, U)[d] = Y, c += G, n || _(this, gt, qt).call(this, { key: d, value: y }), G > h(this, Q) && G > W) {
|
|
996
|
+
const b = Math.ceil(G / h(this, Q)) - 1, M = Array.from({ length: b });
|
|
997
|
+
a.push([d, o[d], M]);
|
|
998
|
+
}
|
|
999
|
+
}), c > 5e3 && h(this, et) === !1 && h(this, at) === !1 && g(this, k, !0), f > 0 && _(this, Ot, Ct).call(this), a.length ? (_(this, kt, ae).call(this, a), _(this, Pt, oe).call(this).then(() => r(_(this, ft, wt).call(this)))) : r(_(this, ft, wt).call(this));
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
}, Tt = new WeakSet(), te = function(e, A, n) {
|
|
1003
|
+
let r = _(this, Jt, le).call(this, e);
|
|
1004
|
+
return new Promise((o) => {
|
|
1005
|
+
let a = 0;
|
|
1006
|
+
h(this, v).call(this, "batch", r, (f) => {
|
|
1007
|
+
var y, u, N, Y, W, G;
|
|
1008
|
+
let c = ((u = (y = f == null ? void 0 : f.answer) == null ? void 0 : y.result) == null ? void 0 : u.result) ?? null, i = ((Y = (N = f == null ? void 0 : f.answer) == null ? void 0 : N.result) == null ? void 0 : Y.result_error) ?? null, d = ((G = (W = f == null ? void 0 : f.answer) == null ? void 0 : W.result) == null ? void 0 : G.result_time) ?? null;
|
|
1009
|
+
(c || Object.keys(c).length) && Object.entries(c).forEach(([b, M]) => {
|
|
1010
|
+
this.answerData[b] = M;
|
|
1011
|
+
}), (i || Object.keys(i).length) && Object.entries(i).forEach(([b, M]) => {
|
|
1012
|
+
var J, it;
|
|
1013
|
+
let X = ((J = e[b]) == null ? void 0 : J.method) ?? null, x = ((it = e[b]) == null ? void 0 : it.params) ?? null;
|
|
1014
|
+
this.errors[b] = {
|
|
1015
|
+
error: M,
|
|
1016
|
+
method: X,
|
|
1017
|
+
params: x
|
|
1018
|
+
}, a += 1;
|
|
1019
|
+
}), (d || Object.keys(d).length) && Object.entries(d).forEach(([b, M]) => {
|
|
1020
|
+
((M == null ? void 0 : M.operating) ?? 0) >= 475 && (this.timeLimit = !0);
|
|
1021
|
+
}), a > 0 && _(this, Ot, Ct).call(this), o(this.answerData);
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
}, Rt = new WeakSet(), ee = function(e) {
|
|
1025
|
+
return new Promise((A) => {
|
|
1026
|
+
const n = _(this, Lt, re).call(this, e);
|
|
1027
|
+
let r = 0;
|
|
1028
|
+
h(this, v).call(this, n, (o) => {
|
|
1029
|
+
Object.entries(o).forEach(([a, f]) => {
|
|
1030
|
+
const c = f.error();
|
|
1031
|
+
c && (this.errors[a] = c, r += 1);
|
|
1032
|
+
const i = _(this, ot, yt).call(this, f.data()), d = Array.isArray(i) ? i.length : 0, y = _(this, Nt, Gt).call(this, f.total(), d);
|
|
1033
|
+
h(this, U)[a] = y;
|
|
1034
|
+
}), r > 0 && _(this, Ot, Ct).call(this), A(_(this, ft, wt).call(this));
|
|
1035
|
+
});
|
|
1036
|
+
});
|
|
1037
|
+
}, kt = new WeakSet(), ae = function(e) {
|
|
1038
|
+
let A = [];
|
|
1039
|
+
e.forEach(([n, r, o]) => {
|
|
1040
|
+
o.forEach((a, f) => {
|
|
1041
|
+
const c = f + 1, i = h(this, Q) * c, y = [[n, c].join("_"), _(this, Wt, he).call(this, r, i)];
|
|
1042
|
+
A.length === h(this, Q) ? (h(this, q).push(A), A = [y]) : A.push(y);
|
|
1043
|
+
});
|
|
1044
|
+
}), A.length && h(this, q).push(A);
|
|
1045
|
+
}, Pt = new WeakSet(), oe = function() {
|
|
1046
|
+
const e = [], A = [], n = (r) => {
|
|
1047
|
+
Object.entries(r).forEach(([o, a]) => {
|
|
1048
|
+
const [f] = o.split("_"), c = _(this, ot, yt).call(this, a.data());
|
|
1049
|
+
Array.isArray(c) && h(this, U)[f].push(...c), _(this, gt, qt).call(this, { key: f, value: a });
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
return h(this, q).forEach((r, o) => {
|
|
1053
|
+
const a = Object.fromEntries(r), f = () => new Promise((c) => h(this, v).call(this, a, (i) => {
|
|
1054
|
+
h(this, k) ? n(i) : A[o] = i, c();
|
|
1055
|
+
}));
|
|
1056
|
+
e.push(f);
|
|
1057
|
+
}), h(this, k) ? _(this, pt, se).call(this, e) : _(this, Mt, ie).call(this, e).then(() => {
|
|
1058
|
+
A.forEach(n);
|
|
1059
|
+
});
|
|
1060
|
+
}, St = new WeakSet(), Ae = function() {
|
|
1061
|
+
return new Promise((e) => setTimeout(e, 500));
|
|
1062
|
+
}, pt = new WeakSet(), se = function(e) {
|
|
1063
|
+
if (!e.length)
|
|
1064
|
+
return Promise.resolve();
|
|
1065
|
+
const A = e.shift();
|
|
1066
|
+
return Promise.allSettled([
|
|
1067
|
+
A(),
|
|
1068
|
+
_(this, St, Ae).call(this)
|
|
1069
|
+
]).then(() => h(this, $) ? _(this, pt, se).call(this, e) : Promise.resolve());
|
|
1070
|
+
}, Mt = new WeakSet(), ie = function(e) {
|
|
1071
|
+
if (!e.length)
|
|
1072
|
+
return Promise.resolve();
|
|
1073
|
+
const A = e.shift();
|
|
1074
|
+
return _(this, St, Ae).call(this).then(() => A()).then(() => h(this, $) ? _(this, Mt, ie).call(this, e) : Promise.resolve());
|
|
1075
|
+
}, ft = new WeakSet(), wt = function() {
|
|
1076
|
+
return Object.entries(h(this, dt)).forEach(([e, A]) => {
|
|
1077
|
+
h(this, U)[e] && (h(this, U)[e] = A(h(this, U)[e]));
|
|
1078
|
+
}), h(this, U);
|
|
1079
|
+
}, Lt = new WeakSet(), re = function(e) {
|
|
1080
|
+
return Object.entries(e).reduce((A, [n, r]) => {
|
|
1081
|
+
if (Array.isArray(r)) {
|
|
1082
|
+
const [o, a = {}] = r;
|
|
1083
|
+
A[n] = [o, a];
|
|
1084
|
+
} else {
|
|
1085
|
+
const { method: o, params: a = {} } = r;
|
|
1086
|
+
A[n] = [o, a];
|
|
1087
|
+
}
|
|
1088
|
+
return A;
|
|
1089
|
+
}, {});
|
|
1090
|
+
}, Wt = new WeakSet(), he = function(e, A) {
|
|
1091
|
+
const [n, r] = e;
|
|
1092
|
+
return [n, { start: A, ...r }];
|
|
1093
|
+
}, ot = new WeakSet(), yt = function(e) {
|
|
1094
|
+
return ((e == null ? void 0 : e.items) || (e == null ? void 0 : e.documents) || (e == null ? void 0 : e.tasks)) ?? e;
|
|
1095
|
+
}, Nt = new WeakSet(), Gt = function(e, A) {
|
|
1096
|
+
return e !== e && (e = 0), e === 0 && A === 0 ? 0 : e || A;
|
|
1097
|
+
}, Ot = new WeakSet(), Ct = function() {
|
|
1098
|
+
console.group(`${this.constructor.name}: Ошибки в методах!`), Object.entries(this.errors).forEach(([e, A]) => {
|
|
1099
|
+
console.info(`[${e}]`, A);
|
|
1100
|
+
}), console.groupEnd();
|
|
1101
|
+
}, Jt = new WeakSet(), le = function(e) {
|
|
1102
|
+
var n, r, o, a, f, c, i, d, y, u, N, Y, W, G, b, M, X, x, J, it, B, rt, R, t;
|
|
1103
|
+
let A = {
|
|
1104
|
+
halt: 0,
|
|
1105
|
+
cmd: {}
|
|
1106
|
+
};
|
|
1107
|
+
for (let s in e) {
|
|
1108
|
+
const l = s;
|
|
1109
|
+
let m = (n = e[s]) != null && n.method ? (r = e[s]) == null ? void 0 : r.method : "", p = "", E = "", S = "";
|
|
1110
|
+
const P = (a = (o = e[s]) == null ? void 0 : o.params) == null ? void 0 : a.fields;
|
|
1111
|
+
if ((c = (f = e[s]) == null ? void 0 : f.params) != null && c.entityTypeId ? (p = `?entityTypeId=${parseInt((d = (i = e[s]) == null ? void 0 : i.params) == null ? void 0 : d.entityTypeId)}`, (u = (y = e[s]) == null ? void 0 : y.params) != null && u.id && (E = `&id=${(Y = (N = e[s]) == null ? void 0 : N.params) == null ? void 0 : Y.id}`), (G = (W = e[s]) == null ? void 0 : W.params) != null && G.ID && (E = `&ID=${(M = (b = e[s]) == null ? void 0 : b.params) == null ? void 0 : M.ID}`)) : ((x = (X = e[s]) == null ? void 0 : X.params) != null && x.id && (E = `?id=${(it = (J = e[s]) == null ? void 0 : J.params) == null ? void 0 : it.id}`), (rt = (B = e[s]) == null ? void 0 : B.params) != null && rt.ID && (E = `?ID=${(t = (R = e[s]) == null ? void 0 : R.params) == null ? void 0 : t.ID}`)), Object.keys(P).length > 0)
|
|
1112
|
+
for (let H in P)
|
|
1113
|
+
S += `&fields[${H}]=${P[H]}`;
|
|
1114
|
+
A.cmd[l] = `${m}${p}${E}${S}`.trim();
|
|
1115
|
+
}
|
|
1116
|
+
return A;
|
|
1117
|
+
};
|
|
1118
|
+
var ht;
|
|
1119
|
+
class ce {
|
|
1120
|
+
constructor() {
|
|
1121
|
+
O(this, ht, {});
|
|
1122
|
+
}
|
|
1123
|
+
get hash() {
|
|
1124
|
+
return this.createHash(8);
|
|
1125
|
+
}
|
|
1126
|
+
/** Генератор хеш-кода */
|
|
1127
|
+
createHash(e) {
|
|
1128
|
+
let A = "abcdefghijklmnopqrstuvwxyz0123456789", n = "";
|
|
1129
|
+
e = e || 6;
|
|
1130
|
+
for (let r = 0; r < e; r++)
|
|
1131
|
+
n += A.charAt(Math.floor(Math.random() * A.length));
|
|
1132
|
+
return n;
|
|
1133
|
+
}
|
|
1134
|
+
/** Фильтр часто запускаемых действий */
|
|
1135
|
+
actionFilter({ keyTimer: e, duration: A = 10, action: n }) {
|
|
1136
|
+
h(this, ht)[e] && (clearTimeout(h(this, ht)[e]), h(this, ht)[e] = null), n && (h(this, ht)[e] = setTimeout(() => {
|
|
1137
|
+
n();
|
|
1138
|
+
}, A));
|
|
1139
|
+
}
|
|
1140
|
+
/** Включение режима NO-SLEEP */
|
|
1141
|
+
async noSleep() {
|
|
1142
|
+
let e = document.createElement("video");
|
|
1143
|
+
e.classList.add("no-sleep"), e.addEventListener("loadeddata", () => {
|
|
1144
|
+
e.style.position = "fixed", e.style.left = "-9999px", document.querySelector("body").append(e), e.play();
|
|
1145
|
+
}), e.addEventListener("ended", () => {
|
|
1146
|
+
this.actionFilter({
|
|
1147
|
+
keyTimer: "no-sleep",
|
|
1148
|
+
duration: 5e3,
|
|
1149
|
+
action: () => e.play()
|
|
1150
|
+
});
|
|
1151
|
+
}), e.src = "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAP5tZGF0AAAAAQYAAADlZYiEE28FmH9jNWDBjI+Z/1tIBZsjfhbmcNNUpBFej0U3p+zhaJ3eemJRL2LUMa5tkidy6bp+eatLE3jBIY864TvaAmqEFCgLMTCwVbem1n3myAw9yDXQdR5HfU/8iYf+eneVnRf7Qx9M70XDUuPx1MJX671XJwAE0VAMpnhbcUDx0pTldvUX9KQPhkZNH3eyZHmObkAeyEJ2tl+BEBJIGc90BiqKL60+5EA6fXB6iG5UU/M5KsW8BNAAUw5CbRJIqohNk10fwKbUXwya03rqGkE8+wuYGtEbrVYXb+iOl1mHHVPLYQbIAAcGyAAHAAAFNG1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAAAAvAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAIldHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAFAAAAA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAAAAAAAAAAAQAAAAABnW1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAQAAAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAUhtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEIc3RibAAAAKRzdHNkAAAAAAAAAAEAAACUYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAC5hdmNDAU1AC//hABZnTUAL2wUH7ARAAAADAEAAAAQDxQq4AQAFaOrAZXIAAAAQcGFzcAAAAAEAAAABAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAAAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAO4AAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAAIadHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAgAAAAAAAAAvAAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAAALwAAAAAAAQAAAAABkm1kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAArEQAAAgAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAT1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAQFzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAAC7gAAAAViBYCAgAISCAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAAACAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAgAAAAEAAAAUc3RzegAAAAAAAAAEAAAAAgAAABRzdGNvAAAAAAAAAAEAAAEeAAAAGnNncGQBAAAAcm9sbAAAAAIAAAAB//8AAAAcc2JncAAAAAByb2xsAAAAAQAAAAIAAAABAAAAgXVkdGEAAAB5bWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWR0YQAAAAAAAAAAAAAAAAAAAAAfa2V5cwAAAAAAAAABAAAAD21kdGFlbmNvZGVyAAAALWlsc3QAAAAlAAAAAQAAAB1kYXRhAAAAAQAAAABMYXZmNTguMTIuMTAw";
|
|
1152
|
+
}
|
|
1153
|
+
/** Скачать данные в JSON-файл */
|
|
1154
|
+
downloadFileJson(e, A) {
|
|
1155
|
+
let n = new Blob([JSON.stringify(e)], { type: "application/json" }), r = URL.createObjectURL(n), o = document.createElement("a");
|
|
1156
|
+
o.style.display = "none", o.href = r, o.download = `${A}.json`, document.body.appendChild(o), o.click(), setTimeout(() => {
|
|
1157
|
+
document.body.removeChild(o), URL.revokeObjectURL(r);
|
|
1158
|
+
}, 200);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
ht = new WeakMap();
|
|
1162
|
+
const Ht = new ce();
|
|
1163
|
+
var V, At, jt, lt, bt, st, _t, Xt, me, Dt, ne, xt, ue, Qt, fe, Zt, Ne;
|
|
1164
|
+
class Re {
|
|
1165
|
+
constructor() {
|
|
1166
|
+
O(this, Xt);
|
|
1167
|
+
/** Вывод ошибок логера
|
|
1168
|
+
* @param {'entity'} type - тип ошибки
|
|
1169
|
+
*/
|
|
1170
|
+
O(this, Dt);
|
|
1171
|
+
O(this, xt);
|
|
1172
|
+
O(this, Qt);
|
|
1173
|
+
O(this, Zt);
|
|
1174
|
+
O(this, V, "logger");
|
|
1175
|
+
O(this, At, !1);
|
|
1176
|
+
O(this, jt, 2e3);
|
|
1177
|
+
O(this, lt, /* @__PURE__ */ new Map());
|
|
1178
|
+
O(this, bt, {});
|
|
1179
|
+
O(this, st, null);
|
|
1180
|
+
O(this, _t, !1);
|
|
1181
|
+
/** Очистка хранилища элементов старше 'N' месяцев */
|
|
1182
|
+
C(this, "periodClear", 3);
|
|
1183
|
+
_(this, Xt, me).call(this);
|
|
1184
|
+
}
|
|
1185
|
+
/** Инициализация логера */
|
|
1186
|
+
async init() {
|
|
1187
|
+
let e = new z(BX24.callBatch), { entityList: A } = await e.batch({
|
|
1188
|
+
entityList: { method: "entity.get" }
|
|
1189
|
+
});
|
|
1190
|
+
if (A && Array.isArray(A))
|
|
1191
|
+
if (A.find((r) => r.ENTITY == h(this, V)))
|
|
1192
|
+
g(this, At, !0);
|
|
1193
|
+
else {
|
|
1194
|
+
let { entityAdd: r } = await e.batch({
|
|
1195
|
+
entityAdd: {
|
|
1196
|
+
method: "entity.add",
|
|
1197
|
+
params: {
|
|
1198
|
+
ENTITY: h(this, V),
|
|
1199
|
+
NAME: h(this, V),
|
|
1200
|
+
ACCESS: { AU: "X" }
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
r && g(this, At, !0);
|
|
1205
|
+
}
|
|
1206
|
+
return _(this, Qt, fe).call(this), h(this, At);
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* @param {{ type: 'call'|'batch'|'batch-total-count';
|
|
1210
|
+
* data: {
|
|
1211
|
+
* method: string,
|
|
1212
|
+
* params: { [key]: any }
|
|
1213
|
+
* }|{ commandList: { [key]: any }
|
|
1214
|
+
* }; }}
|
|
1215
|
+
* @returns {string}
|
|
1216
|
+
*/
|
|
1217
|
+
start({ type: e, data: A }) {
|
|
1218
|
+
if (!h(this, At)) {
|
|
1219
|
+
_(this, Dt, ne).call(this, "entity");
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
const n = Ht.hash;
|
|
1223
|
+
return h(this, lt).set(n, {
|
|
1224
|
+
type: e,
|
|
1225
|
+
data: A,
|
|
1226
|
+
userInfo: h(this, bt),
|
|
1227
|
+
errorList: [],
|
|
1228
|
+
status: "",
|
|
1229
|
+
answer: null,
|
|
1230
|
+
date: (/* @__PURE__ */ new Date()).getTime()
|
|
1231
|
+
}), n;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* @param {{
|
|
1235
|
+
* key: string;
|
|
1236
|
+
* errorList: any[];
|
|
1237
|
+
* status: 'success'|'fail'|'fail-runtime',
|
|
1238
|
+
* answer: { [key]: unknown } }}
|
|
1239
|
+
*/
|
|
1240
|
+
stop({ key: e, errorList: A, status: n, answer: r }) {
|
|
1241
|
+
if (!h(this, At)) {
|
|
1242
|
+
_(this, Dt, ne).call(this, "entity");
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
let o = h(this, lt).get(e);
|
|
1246
|
+
A && (o.errorList = A), n && (o.status = n), r && (o.answer = r), Ht.actionFilter({
|
|
1247
|
+
keyTimer: "add.entity.items",
|
|
1248
|
+
duration: h(this, jt),
|
|
1249
|
+
action: async () => {
|
|
1250
|
+
var a;
|
|
1251
|
+
await _(this, xt, ue).call(this), (a = o == null ? void 0 : o.data) != null && a.updateList && g(this, _t, !0);
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
|
|
1257
|
+
*/
|
|
1258
|
+
async getEntityList(e) {
|
|
1259
|
+
var r;
|
|
1260
|
+
if ((r = h(this, st)) != null && r.length && !h(this, _t))
|
|
1261
|
+
return h(this, st);
|
|
1262
|
+
let A = new z(BX24.callBatch), { entityList: n } = await A.batch({
|
|
1263
|
+
entityList: {
|
|
1264
|
+
method: "entity.item.get",
|
|
1265
|
+
params: {
|
|
1266
|
+
ENTITY: h(this, V),
|
|
1267
|
+
SORT: { ID: "DESC" }
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}, e);
|
|
1271
|
+
return n = n.map((o) => {
|
|
1272
|
+
const { ID: a, DATE_CREATE: f, DETAIL_TEXT: c } = o;
|
|
1273
|
+
return {
|
|
1274
|
+
...JSON.parse(c),
|
|
1275
|
+
id: a,
|
|
1276
|
+
dateCreate: f
|
|
1277
|
+
};
|
|
1278
|
+
}), g(this, _t, !1), n;
|
|
1279
|
+
}
|
|
1280
|
+
/** Выгрузка всех данных из хранилища в JSON-файл */
|
|
1281
|
+
async downAllEntityJson() {
|
|
1282
|
+
let e = await this.getEntityList(), A = Yt().format("%Y-%m-%d");
|
|
1283
|
+
Ht.downloadFileJson(e, `sdklogger-entity-data__${A}`);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
V = new WeakMap(), At = new WeakMap(), jt = new WeakMap(), lt = new WeakMap(), bt = new WeakMap(), st = new WeakMap(), _t = new WeakMap(), Xt = new WeakSet(), me = async function() {
|
|
1287
|
+
const e = new z(BX24.callBatch), A = BX24.isAdmin(), { curUser: n } = await e.batch({
|
|
1288
|
+
curUser: { method: "user.current" }
|
|
1289
|
+
});
|
|
1290
|
+
g(this, bt, { isAdmin: A, curUser: n });
|
|
1291
|
+
}, Dt = new WeakSet(), ne = function(e) {
|
|
1292
|
+
e == "entity" && Ht.actionFilter({
|
|
1293
|
+
keyTimer: "error.logger.entity",
|
|
1294
|
+
duration: 500,
|
|
1295
|
+
action: () => {
|
|
1296
|
+
console.error("Хранилище для логгера не инициализировано");
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}, xt = new WeakSet(), ue = async function() {
|
|
1300
|
+
let e = {}, A = new z(BX24.callBatch);
|
|
1301
|
+
for (let [n, r] of h(this, lt).entries())
|
|
1302
|
+
r.status && (e[n] = {
|
|
1303
|
+
method: "entity.item.add",
|
|
1304
|
+
params: {
|
|
1305
|
+
ENTITY: h(this, V),
|
|
1306
|
+
NAME: h(this, V),
|
|
1307
|
+
DETAIL_TEXT: JSON.stringify(r)
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
if (Object.keys(e).length) {
|
|
1311
|
+
let n = await A.batch(e), { errors: r } = A;
|
|
1312
|
+
for (let [o, a] of Object.entries({ ...n, ...r }))
|
|
1313
|
+
h(this, lt).delete(o);
|
|
1314
|
+
return !0;
|
|
1315
|
+
}
|
|
1316
|
+
}, Qt = new WeakSet(), fe = async function() {
|
|
1317
|
+
let e = new z(BX24.callBatch), { serverTime: A } = await e.batch({
|
|
1318
|
+
serverTime: { method: "server.time" }
|
|
1319
|
+
});
|
|
1320
|
+
h(this, st) || g(this, st, await this.getEntityList());
|
|
1321
|
+
let n = h(this, st).filter((r) => {
|
|
1322
|
+
let { dateCreate: o } = r;
|
|
1323
|
+
return Yt(new Date(o)).between(Yt(new Date(A)), "month") >= this.periodClear;
|
|
1324
|
+
});
|
|
1325
|
+
_(this, Zt, Ne).call(this, n);
|
|
1326
|
+
}, Zt = new WeakSet(), Ne = async function(e) {
|
|
1327
|
+
let A = new z(BX24.callBatch), n = e.map((r) => {
|
|
1328
|
+
let { id: o } = r;
|
|
1329
|
+
return {
|
|
1330
|
+
method: "entity.item.delete",
|
|
1331
|
+
params: {
|
|
1332
|
+
ENTITY: h(this, V),
|
|
1333
|
+
ID: o
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
});
|
|
1337
|
+
return await A.batch(n);
|
|
1338
|
+
};
|
|
1339
|
+
var Vt, Oe, zt, _e;
|
|
1340
|
+
class pe {
|
|
1341
|
+
constructor(e) {
|
|
1342
|
+
/** Запрос данных о приложении */
|
|
1343
|
+
O(this, Vt);
|
|
1344
|
+
/** Запрос данных о текущем пользователе */
|
|
1345
|
+
O(this, zt);
|
|
1346
|
+
C(this, "domain", "");
|
|
1347
|
+
C(this, "isAdmin", !1);
|
|
1348
|
+
C(this, "appInfo", null);
|
|
1349
|
+
C(this, "appConst", null);
|
|
1350
|
+
C(this, "userInfo", null);
|
|
1351
|
+
C(this, "placeData", null);
|
|
1352
|
+
C(this, "placeInfo", null);
|
|
1353
|
+
C(this, "logger", new Re());
|
|
1354
|
+
this.appConst = e;
|
|
1355
|
+
}
|
|
1356
|
+
init() {
|
|
1357
|
+
return new Promise((e) => {
|
|
1358
|
+
let A = setInterval(() => {
|
|
1359
|
+
window.BX24 && BX24.init(async () => {
|
|
1360
|
+
console.info("init BX24"), clearInterval(A), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info(), await this.logger.init();
|
|
1361
|
+
const [n, r] = await Promise.all([
|
|
1362
|
+
_(this, Vt, Oe).call(this),
|
|
1363
|
+
_(this, zt, _e).call(this)
|
|
1364
|
+
]);
|
|
1365
|
+
this.appInfo = n, this.userInfo = r, new ce().noSleep(), e(!0);
|
|
1366
|
+
});
|
|
1367
|
+
}, 100);
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
userOption(e, A) {
|
|
1371
|
+
return A ? BX24.userOption.set(e, A) : BX24.userOption.get(e);
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* @param {{
|
|
1375
|
+
* method: string;
|
|
1376
|
+
* params: any;
|
|
1377
|
+
* updateList: {
|
|
1378
|
+
* method: string,
|
|
1379
|
+
* name: string,
|
|
1380
|
+
* list: {
|
|
1381
|
+
* id: string | number,
|
|
1382
|
+
* fields: {
|
|
1383
|
+
* [key: string]: {
|
|
1384
|
+
* oldValue: string | number | string[] | number[],
|
|
1385
|
+
* newValue: string | number | string[] | number[],
|
|
1386
|
+
* }
|
|
1387
|
+
* }
|
|
1388
|
+
* }[]
|
|
1389
|
+
* }[]
|
|
1390
|
+
*/
|
|
1391
|
+
call({ method: e, params: A, updateList: n }) {
|
|
1392
|
+
let r = this.logger.start({
|
|
1393
|
+
type: "call",
|
|
1394
|
+
data: { method: e, params: A, updateList: n }
|
|
1395
|
+
});
|
|
1396
|
+
return new Promise((o) => {
|
|
1397
|
+
A || (A = {}), BX24.callMethod(e, A, (a) => {
|
|
1398
|
+
let f = {};
|
|
1399
|
+
if (a != null && a.answer)
|
|
1400
|
+
for (let [c, i] of Object.entries(a.answer))
|
|
1401
|
+
c != "result" && i && (f[c] = i);
|
|
1402
|
+
if (a.error()) {
|
|
1403
|
+
let c = a.error();
|
|
1404
|
+
console.error(c), this.logger.stop({
|
|
1405
|
+
answer: f,
|
|
1406
|
+
key: r,
|
|
1407
|
+
status: "fail",
|
|
1408
|
+
errorList: [c.toString()]
|
|
1409
|
+
}), o(!1);
|
|
1410
|
+
} else {
|
|
1411
|
+
let c = a.data();
|
|
1412
|
+
c != null && c.items && (c = c.items), this.logger.stop({
|
|
1413
|
+
answer: f,
|
|
1414
|
+
key: r,
|
|
1415
|
+
status: "success"
|
|
1416
|
+
}), o(c);
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* @param commandList - объект/массив команд
|
|
1423
|
+
* @param progressCall - callback(data), в data приходят данные о загрузке данных
|
|
1424
|
+
* @param {{
|
|
1425
|
+
* updateList: {
|
|
1426
|
+
* method: string,
|
|
1427
|
+
* name: string,
|
|
1428
|
+
* list: {
|
|
1429
|
+
* id: string | number,
|
|
1430
|
+
* fields: {
|
|
1431
|
+
* [key: string]: {
|
|
1432
|
+
* oldValue: string | number | string[] | number[],
|
|
1433
|
+
* newValue: string | number | string[] | number[],
|
|
1434
|
+
* }
|
|
1435
|
+
* }
|
|
1436
|
+
* }[]
|
|
1437
|
+
* }[]
|
|
1438
|
+
* }}
|
|
1439
|
+
*/
|
|
1440
|
+
async batch(e, A, { updateList: n, errorCall: r, limitCommandSerial: o } = {}) {
|
|
1441
|
+
let a = new z(BX24.callBatch), f = this.logger.start({
|
|
1442
|
+
type: "batch",
|
|
1443
|
+
data: { commandList: e, updateList: n }
|
|
1444
|
+
});
|
|
1445
|
+
o && (a.limitCommandSerial = o);
|
|
1446
|
+
try {
|
|
1447
|
+
let c = await a.batch(e, A);
|
|
1448
|
+
if (Object.keys(a.errors).length) {
|
|
1449
|
+
let i = Object.entries(a.errors).map(([d, y]) => {
|
|
1450
|
+
var u;
|
|
1451
|
+
return {
|
|
1452
|
+
key: d,
|
|
1453
|
+
error: `${y == null ? void 0 : y.method} ${(u = y == null ? void 0 : y.error) == null ? void 0 : u.toString()}`.trim()
|
|
1454
|
+
};
|
|
1455
|
+
});
|
|
1456
|
+
r && r(a.errors), this.logger.stop({
|
|
1457
|
+
key: f,
|
|
1458
|
+
status: "fail",
|
|
1459
|
+
errorList: i,
|
|
1460
|
+
answer: a.answerData
|
|
1461
|
+
});
|
|
1462
|
+
} else
|
|
1463
|
+
this.logger.stop({
|
|
1464
|
+
key: f,
|
|
1465
|
+
status: "success",
|
|
1466
|
+
answer: a.answerData
|
|
1467
|
+
});
|
|
1468
|
+
return c;
|
|
1469
|
+
} catch (c) {
|
|
1470
|
+
let i = c == null ? void 0 : c.toString();
|
|
1471
|
+
return this.logger.stop({
|
|
1472
|
+
key: f,
|
|
1473
|
+
status: "fail-runtime",
|
|
1474
|
+
errorList: [i],
|
|
1475
|
+
answer: a.answerData
|
|
1476
|
+
}), console.error(c), !1;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
/* батч для обработки operating time и паузы, используя BX24.callMethod('batch', ...) - пока что для некоторых методов update */
|
|
1480
|
+
async batchUpdateField(e, A, { updateList: n, errorCall: r, limitCommandSerial: o } = {}) {
|
|
1481
|
+
let a = new z(BX24.callMethod), f = this.logger.start({
|
|
1482
|
+
type: "callMethod-batch",
|
|
1483
|
+
data: { commandList: e, updateList: n }
|
|
1484
|
+
});
|
|
1485
|
+
o && (a.limitCommandSerial = o);
|
|
1486
|
+
try {
|
|
1487
|
+
let c = await a.batchUpdateField(e, A);
|
|
1488
|
+
if (Object.keys(a.errors).length) {
|
|
1489
|
+
let i = Object.entries(a.errors).map(([d, y]) => {
|
|
1490
|
+
var u;
|
|
1491
|
+
return {
|
|
1492
|
+
key: d,
|
|
1493
|
+
error: `${y == null ? void 0 : y.method} ${(u = y == null ? void 0 : y.error) == null ? void 0 : u.toString()}`.trim()
|
|
1494
|
+
};
|
|
1495
|
+
});
|
|
1496
|
+
r && r(a.errors), this.logger.stop({
|
|
1497
|
+
key: f,
|
|
1498
|
+
status: "fail",
|
|
1499
|
+
errorList: i,
|
|
1500
|
+
answer: a.answerData
|
|
1501
|
+
});
|
|
1502
|
+
} else
|
|
1503
|
+
this.logger.stop({
|
|
1504
|
+
key: f,
|
|
1505
|
+
status: "success",
|
|
1506
|
+
answer: a.answerData
|
|
1507
|
+
});
|
|
1508
|
+
return c;
|
|
1509
|
+
} catch (c) {
|
|
1510
|
+
let i = c == null ? void 0 : c.toString();
|
|
1511
|
+
return this.logger.stop({
|
|
1512
|
+
key: f,
|
|
1513
|
+
status: "fail-runtime",
|
|
1514
|
+
errorList: [i],
|
|
1515
|
+
answer: a.answerData
|
|
1516
|
+
}), console.error(c), !1;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* @param commandList - объект/массив команд
|
|
1521
|
+
* @param progressCall - callback(data), в data приходят данные о загрузке данных
|
|
1522
|
+
*/
|
|
1523
|
+
async batchTotalCount(e, A) {
|
|
1524
|
+
let n = new z(BX24.callBatch), r = this.logger.start({
|
|
1525
|
+
type: "batch",
|
|
1526
|
+
data: { commandList: e }
|
|
1527
|
+
});
|
|
1528
|
+
try {
|
|
1529
|
+
let o = await n.batchTotalCount(e, A);
|
|
1530
|
+
if (Object.keys(n.errors).length) {
|
|
1531
|
+
let a = Object.entries(n.errors).map(([f, c]) => ({
|
|
1532
|
+
key: f,
|
|
1533
|
+
error: c.toString()
|
|
1534
|
+
}));
|
|
1535
|
+
this.logger.stop({
|
|
1536
|
+
key: r,
|
|
1537
|
+
status: "fail",
|
|
1538
|
+
errorList: a
|
|
1539
|
+
});
|
|
1540
|
+
} else
|
|
1541
|
+
this.logger.stop({
|
|
1542
|
+
key: r,
|
|
1543
|
+
status: "success"
|
|
1544
|
+
});
|
|
1545
|
+
return o;
|
|
1546
|
+
} catch (o) {
|
|
1547
|
+
return this.logger.stop({
|
|
1548
|
+
key: r,
|
|
1549
|
+
status: "fail",
|
|
1550
|
+
errorList: [o.toString()]
|
|
1551
|
+
}), console.error(o), !1;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
/** Запрос данных о местах встройки приложения */
|
|
1555
|
+
getPlacement() {
|
|
1556
|
+
return this.call({ method: "placement.get" }).then((e) => (this.placeData || (this.placeData = e), e));
|
|
1557
|
+
}
|
|
1558
|
+
/** Встройка приложения в place */
|
|
1559
|
+
async placementBind(e) {
|
|
1560
|
+
this.placeData || (this.placeData = await this.getPlacement());
|
|
1561
|
+
const { appName: A, pathApp: n } = this.appConst, r = this.placeData.map((a) => a.placement);
|
|
1562
|
+
let o = this.placeData.find((a) => a.placement == e);
|
|
1563
|
+
r.includes(e) ? o.handler != n && (window.placementUnBind || (window.placementUnBind = {}), window.placementUnBind[e] || this.placementUnBind(o).then(() => {
|
|
1564
|
+
window.placementUnBind[e] || (window.placementUnBind[e] = !0, this.placementBind(e));
|
|
1565
|
+
})) : this.call({
|
|
1566
|
+
method: "placement.bind",
|
|
1567
|
+
params: {
|
|
1568
|
+
PLACEMENT: e,
|
|
1569
|
+
HANDLER: n,
|
|
1570
|
+
LANG_ALL: {
|
|
1571
|
+
ru: {
|
|
1572
|
+
TITLE: A
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}).then((a) => {
|
|
1577
|
+
a ? console.info("Приложение успешно встроено в", e) : console.warn("Приложение не может быть встроено в", e);
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
/** Отвязка встройки из place */
|
|
1581
|
+
placementUnBind(e) {
|
|
1582
|
+
const { pathApp: A, appName: n } = this.appConst;
|
|
1583
|
+
return this.call({
|
|
1584
|
+
method: "placement.unbind",
|
|
1585
|
+
params: {
|
|
1586
|
+
PLACEMENT: e,
|
|
1587
|
+
HANDLER: A,
|
|
1588
|
+
LANG_ALL: {
|
|
1589
|
+
ru: {
|
|
1590
|
+
TITLE: n
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}).then((r) => (console.log("Встройка отвязана", e), r));
|
|
1595
|
+
}
|
|
1596
|
+
/** Чат-бот */
|
|
1597
|
+
/* получение списка ботов */
|
|
1598
|
+
getBotList() {
|
|
1599
|
+
return this.call({
|
|
1600
|
+
method: "imbot.bot.list",
|
|
1601
|
+
params: {}
|
|
1602
|
+
}).then((e) => {
|
|
1603
|
+
let A = Object.values(e);
|
|
1604
|
+
return console.log("chat-bot list:", A), A;
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
/* регистрация бота */
|
|
1608
|
+
regBot({ code: e, type: A, name: n }) {
|
|
1609
|
+
const { appName: r, pathApp: o, chatBotLogo: a } = this.appConst, f = this.appInfo.ID;
|
|
1610
|
+
return this.call({
|
|
1611
|
+
method: "imbot.register",
|
|
1612
|
+
params: {
|
|
1613
|
+
CODE: e ?? this.appInfo.CODE,
|
|
1614
|
+
// Строковой идентификатор бота, уникальный в рамках вашего приложения (обяз.)
|
|
1615
|
+
TYPE: A ?? "O",
|
|
1616
|
+
// Тип бота, B - чат-бот, ответы поступают сразу, H - человек, ответы поступают с задержкой от 2-х до 10 секунд, O - чат-бот для Открытых линий, S - чат-бот с повышенными привилегиями (supervisor)
|
|
1617
|
+
EVENT_HANDLER: o,
|
|
1618
|
+
// Ссылка на обработчик событий, поступивших от сервера - см. Обработчики событий ниже (обяз).
|
|
1619
|
+
OPENLINE: "Y",
|
|
1620
|
+
// Включение режима поддержки Открытых линий, можно не указывать, если TYPE = 'O'
|
|
1621
|
+
CLIENT_ID: "",
|
|
1622
|
+
// строковый идентификатор чат-бота, используется только в режиме Вебхуков
|
|
1623
|
+
PROPERTIES: {
|
|
1624
|
+
// Личные данные чат-бота (обяз.)
|
|
1625
|
+
NAME: `${n ?? r} - бот #${f}`,
|
|
1626
|
+
// Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1627
|
+
LAST_NAME: "",
|
|
1628
|
+
// Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
|
|
1629
|
+
COLOR: "GREEN",
|
|
1630
|
+
// Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
|
|
1631
|
+
EMAIL: "",
|
|
1632
|
+
// E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
|
|
1633
|
+
PERSONAL_BIRTHDAY: Yt().format("%Y-%m-%d"),
|
|
1634
|
+
// День рождения в формате YYYY-mm-dd
|
|
1635
|
+
WORK_POSITION: "Почтальон",
|
|
1636
|
+
// Занимаемая должность, используется как описание чат-бота
|
|
1637
|
+
PERSONAL_WWW: "",
|
|
1638
|
+
// Ссылка на сайт
|
|
1639
|
+
PERSONAL_GENDER: "M",
|
|
1640
|
+
// Пол чат-бота, допустимые значения M - мужской, F - женский, пусто, если не требуется указывать
|
|
1641
|
+
PERSONAL_PHOTO: a ?? ""
|
|
1642
|
+
// Аватар чат-бота - base64
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}).then((c) => (console.log("Чат-бот добавлен", c), c));
|
|
1646
|
+
}
|
|
1647
|
+
/* Убрать регистрацию бота */
|
|
1648
|
+
unRegBot(e) {
|
|
1649
|
+
return this.call({
|
|
1650
|
+
method: "imbot.unregister",
|
|
1651
|
+
params: {
|
|
1652
|
+
BOT_ID: e
|
|
1653
|
+
}
|
|
1654
|
+
}).then((A) => (console.log("чат-бот удален", A), A));
|
|
1655
|
+
}
|
|
1656
|
+
/* Получение данных логера */
|
|
1657
|
+
getLoggerList(e) {
|
|
1658
|
+
return this.logger.getEntityList(e);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
Vt = new WeakSet(), Oe = function() {
|
|
1662
|
+
return this.call({ method: "app.info" });
|
|
1663
|
+
}, zt = new WeakSet(), _e = function() {
|
|
1664
|
+
return this.call({ method: "user.current" });
|
|
1665
|
+
};
|
|
1666
|
+
export {
|
|
1667
|
+
z as Batch,
|
|
1668
|
+
pe as BxBoot,
|
|
1669
|
+
ce as BxHelper,
|
|
1670
|
+
Re as BxLogger,
|
|
1671
|
+
Yt as tempus
|
|
1672
|
+
};
|