szdl-utils-kit 0.3.23 → 0.3.24

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 CHANGED
@@ -1,54 +1,54 @@
1
- var Ne = Object.defineProperty;
2
- var Oe = (y, e, t) => e in y ? Ne(y, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : y[e] = t;
3
- var B = (y, e, t) => (Oe(y, typeof e != "symbol" ? e + "" : e, t), t), Ft = (y, e, t) => {
4
- if (!e.has(y))
1
+ var Ee = Object.defineProperty;
2
+ var be = (g, e, t) => e in g ? Ee(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t;
3
+ var w = (g, e, t) => (be(g, typeof e != "symbol" ? e + "" : e, t), t), Jt = (g, e, t) => {
4
+ if (!e.has(g))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var S = (y, e, t) => (Ft(y, e, "read from private field"), t ? t.call(y) : e.get(y)), R = (y, e, t) => {
8
- if (e.has(y))
7
+ var I = (g, e, t) => (Jt(g, e, "read from private field"), t ? t.call(g) : e.get(g)), L = (g, e, t) => {
8
+ if (e.has(g))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- e instanceof WeakSet ? e.add(y) : e.set(y, t);
11
- }, x = (y, e, t, r) => (Ft(y, e, "write to private field"), r ? r.call(y, t) : e.set(y, t), t);
12
- var _ = (y, e, t) => (Ft(y, e, "access private method"), t);
13
- var _e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function Te(y) {
15
- return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
10
+ e instanceof WeakSet ? e.add(g) : e.set(g, t);
11
+ }, x = (g, e, t, s) => (Jt(g, e, "write to private field"), s ? s.call(g, t) : e.set(g, t), t);
12
+ var O = (g, e, t) => (Jt(g, e, "access private method"), t);
13
+ var Le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
+ function Re(g) {
15
+ return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g;
16
16
  }
17
- var Jt = { exports: {} };
18
- (function(y, e) {
17
+ var qt = { exports: {} };
18
+ (function(g, e) {
19
19
  (function(t) {
20
- Array.prototype.indexOf || (Array.prototype.indexOf = function(s, o) {
21
- var d, g;
22
- for (d = o || 0, g = this.length; d < g; d += 1)
23
- if (this[d] === s)
24
- return d;
20
+ Array.prototype.indexOf || (Array.prototype.indexOf = function(r, o) {
21
+ var m, p;
22
+ for (m = o || 0, p = this.length; m < p; m += 1)
23
+ if (this[m] === r)
24
+ return m;
25
25
  return -1;
26
26
  });
27
- var r = this, i = function(s, o) {
28
- for (var d = s.toString(); d.length < o; )
29
- d = "0" + d;
30
- return d;
31
- }, a = function(s, o) {
32
- return o !== t ? (s.year(o.year() || o.year), s.month(o.month() || o.month), s.day(o.day() || o.day), s.hours(o.hours() || o.hours), s.minutes(o.minutes() || o.minutes), s.seconds(o.seconds() || o.seconds), s.milliseconds(o.milliseconds() || o.milliseconds), s) : t;
33
- }, c = function(s, o) {
34
- var d, g = "";
35
- return d = s.slice(o, o + 1), d !== "" && !isNaN(Number(d)) && (g += "%H"), d = s.charAt(o + 2), d !== "" && d === ":" && (g += d), d = s.slice(o + 3, o + 4), d !== "" && !isNaN(Number(d)) && (g += "%M"), d = s.charAt(o + 5), d !== "" && d === ":" && (g += d), d = s.slice(o + 6, o + 7), d !== "" && !isNaN(Number(d)) && (g += "%S"), g;
36
- }, l = function(s, o) {
37
- var d, g = [
38
- s.slice(o, o + 1),
39
- s.charAt(o + 2),
40
- s.slice(o + 3, o + 4),
41
- s.charAt(o + 5),
42
- s.slice(o + 6, o + 9)
27
+ var s = this, i = function(r, o) {
28
+ for (var m = r.toString(); m.length < o; )
29
+ m = "0" + m;
30
+ return m;
31
+ }, a = function(r, o) {
32
+ return o !== t ? (r.year(o.year() || o.year), r.month(o.month() || o.month), r.day(o.day() || o.day), r.hours(o.hours() || o.hours), r.minutes(o.minutes() || o.minutes), r.seconds(o.seconds() || o.seconds), r.milliseconds(o.milliseconds() || o.milliseconds), r) : t;
33
+ }, c = function(r, o) {
34
+ var m, p = "";
35
+ return m = r.slice(o, o + 1), m !== "" && !isNaN(Number(m)) && (p += "%H"), m = r.charAt(o + 2), m !== "" && m === ":" && (p += m), m = r.slice(o + 3, o + 4), m !== "" && !isNaN(Number(m)) && (p += "%M"), m = r.charAt(o + 5), m !== "" && m === ":" && (p += m), m = r.slice(o + 6, o + 7), m !== "" && !isNaN(Number(m)) && (p += "%S"), p;
36
+ }, h = function(r, o) {
37
+ var m, p = [
38
+ r.slice(o, o + 1),
39
+ r.charAt(o + 2),
40
+ r.slice(o + 3, o + 4),
41
+ r.charAt(o + 5),
42
+ r.slice(o + 6, o + 9)
43
43
  ], C;
44
- return !isNaN(Number(g[0])) && !isNaN(Number(g[2])) && !isNaN(Number(g[4])) ? (g[1] === "." && g[3] === "." ? d = "%d.%m.%Y" : g[1] === "-" && g[3] === "-" ? d = "%m-%d-%Y" : g[1] === "/" && g[3] === "/" && (d = "%m/%d/%Y"), d) : (C = [
45
- s.slice(o, o + 3),
46
- s.charAt(o + 4),
47
- s.slice(o + 5, o + 6),
48
- s.charAt(o + 7),
49
- s.slice(o + 8, o + 9)
50
- ], !isNaN(Number(C[0])) && !isNaN(Number(C[2])) && !isNaN(Number(C[4])) ? (C[1] === "-" && C[3] === "-" && (d = "%Y-%m-%d"), d) : "");
51
- }, h = r.tempus, n, f, m = r.navigator || {}, A = "en", u = {
44
+ return !isNaN(Number(p[0])) && !isNaN(Number(p[2])) && !isNaN(Number(p[4])) ? (p[1] === "." && p[3] === "." ? m = "%d.%m.%Y" : p[1] === "-" && p[3] === "-" ? m = "%m-%d-%Y" : p[1] === "/" && p[3] === "/" && (m = "%m/%d/%Y"), m) : (C = [
45
+ r.slice(o, o + 3),
46
+ r.charAt(o + 4),
47
+ r.slice(o + 5, o + 6),
48
+ r.charAt(o + 7),
49
+ r.slice(o + 8, o + 9)
50
+ ], !isNaN(Number(C[0])) && !isNaN(Number(C[2])) && !isNaN(Number(C[4])) ? (C[1] === "-" && C[3] === "-" && (m = "%Y-%m-%d"), m) : "");
51
+ }, f = s.tempus, n, u, d = s.navigator || {}, A = "en", l = {
52
52
  en: {
53
53
  JANUARY_SHORT: "Jan",
54
54
  FEBRUARY_SHORT: "Feb",
@@ -209,69 +209,69 @@ var Jt = { exports: {} };
209
209
  FRIDAY_LONG: "Freitag",
210
210
  SATURDAY_LONG: "Samstag"
211
211
  }
212
- }, O = function() {
212
+ }, _ = function() {
213
213
  return [
214
- u[A].JANUARY_LONG,
215
- u[A].FEBRUARY_LONG,
216
- u[A].MARCH_LONG,
217
- u[A].APRIL_LONG,
218
- u[A].MAY_LONG,
219
- u[A].JUNE_LONG,
220
- u[A].JULY_LONG,
221
- u[A].AUGUST_LONG,
222
- u[A].SEPTEMBER_LONG,
223
- u[A].OCTOBER_LONG,
224
- u[A].NOVEMBER_LONG,
225
- u[A].DECEMBER_LONG
214
+ l[A].JANUARY_LONG,
215
+ l[A].FEBRUARY_LONG,
216
+ l[A].MARCH_LONG,
217
+ l[A].APRIL_LONG,
218
+ l[A].MAY_LONG,
219
+ l[A].JUNE_LONG,
220
+ l[A].JULY_LONG,
221
+ l[A].AUGUST_LONG,
222
+ l[A].SEPTEMBER_LONG,
223
+ l[A].OCTOBER_LONG,
224
+ l[A].NOVEMBER_LONG,
225
+ l[A].DECEMBER_LONG
226
226
  ];
227
227
  }, T = function() {
228
228
  return [
229
- u[A].JANUARY_SHORT,
230
- u[A].FEBRUARY_SHORT,
231
- u[A].MARCH_SHORT,
232
- u[A].APRIL_SHORT,
233
- u[A].MAY_SHORT,
234
- u[A].JUNE_SHORT,
235
- u[A].JULY_SHORT,
236
- u[A].AUGUST_SHORT,
237
- u[A].SEPTEMBER_SHORT,
238
- u[A].OCTOBER_SHORT,
239
- u[A].NOVEMBER_SHORT,
240
- u[A].DECEMBER_SHORT
229
+ l[A].JANUARY_SHORT,
230
+ l[A].FEBRUARY_SHORT,
231
+ l[A].MARCH_SHORT,
232
+ l[A].APRIL_SHORT,
233
+ l[A].MAY_SHORT,
234
+ l[A].JUNE_SHORT,
235
+ l[A].JULY_SHORT,
236
+ l[A].AUGUST_SHORT,
237
+ l[A].SEPTEMBER_SHORT,
238
+ l[A].OCTOBER_SHORT,
239
+ l[A].NOVEMBER_SHORT,
240
+ l[A].DECEMBER_SHORT
241
241
  ];
242
242
  }, E = function() {
243
243
  return [
244
- u[A].SUNDAY_LONG,
245
- u[A].MONDAY_LONG,
246
- u[A].TUESDAY_LONG,
247
- u[A].WEDNESDAY_LONG,
248
- u[A].THURSDAY_LONG,
249
- u[A].FRIDAY_LONG,
250
- u[A].SATURDAY_LONG
244
+ l[A].SUNDAY_LONG,
245
+ l[A].MONDAY_LONG,
246
+ l[A].TUESDAY_LONG,
247
+ l[A].WEDNESDAY_LONG,
248
+ l[A].THURSDAY_LONG,
249
+ l[A].FRIDAY_LONG,
250
+ l[A].SATURDAY_LONG
251
251
  ];
252
252
  }, M = function() {
253
253
  return [
254
- u[A].SUNDAY_SHORT,
255
- u[A].MONDAY_SHORT,
256
- u[A].TUESDAY_SHORT,
257
- u[A].WEDNESDAY_SHORT,
258
- u[A].THURSDAY_SHORT,
259
- u[A].FRIDAY_SHORT,
260
- u[A].SATURDAY_SHORT
254
+ l[A].SUNDAY_SHORT,
255
+ l[A].MONDAY_SHORT,
256
+ l[A].TUESDAY_SHORT,
257
+ l[A].WEDNESDAY_SHORT,
258
+ l[A].THURSDAY_SHORT,
259
+ l[A].FRIDAY_SHORT,
260
+ l[A].SATURDAY_SHORT
261
261
  ];
262
- }, p, b, H, N, I = function(s, o, d) {
263
- var g;
264
- r.XMLHttpRequest ? g = new XMLHttpRequest() : g = new ActiveXObject("Microsoft.XMLHTTP"), g.onreadystatechange = function() {
265
- g.readyState === 4 && (g.status === 200 ? o && (r.JSON === t ? alert(`Please, include json2 into your project if you want use old browsers!
266
- https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.parse(g.responseText))) : d && d(g));
267
- }, g.open("GET", s, !1), g.send();
268
- }, L = {
262
+ }, N, b, H, y, S = function(r, o, m) {
263
+ var p;
264
+ s.XMLHttpRequest ? p = new XMLHttpRequest() : p = new ActiveXObject("Microsoft.XMLHTTP"), p.onreadystatechange = function() {
265
+ p.readyState === 4 && (p.status === 200 ? o && (s.JSON === t ? alert(`Please, include json2 into your project if you want use old browsers!
266
+ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.parse(p.responseText))) : m && m(p));
267
+ }, p.open("GET", r, !1), p.send();
268
+ }, R = {
269
269
  "%d": {
270
- format: function(s) {
271
- return i(s.day() || n.MIN_DAY, 2);
270
+ format: function(r) {
271
+ return i(r.day() || n.MIN_DAY, 2);
272
272
  },
273
- parse: function(s) {
274
- var o = Number(s);
273
+ parse: function(r) {
274
+ var o = Number(r);
275
275
  return { day: isNaN(o) ? t : o };
276
276
  },
277
277
  minLength: 2,
@@ -279,11 +279,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
279
279
  type: "number"
280
280
  },
281
281
  "%m": {
282
- format: function(s) {
283
- return i(s.month() || n.MIN_MONTH, 2);
282
+ format: function(r) {
283
+ return i(r.month() || n.MIN_MONTH, 2);
284
284
  },
285
- parse: function(s) {
286
- var o = Number(s);
285
+ parse: function(r) {
286
+ var o = Number(r);
287
287
  return { month: isNaN(o) ? t : o };
288
288
  },
289
289
  minLength: 2,
@@ -291,11 +291,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
291
291
  type: "number"
292
292
  },
293
293
  "%Y": {
294
- format: function(s) {
295
- return i(s.year() || n.MIN_YEAR, 4);
294
+ format: function(r) {
295
+ return i(r.year() || n.MIN_YEAR, 4);
296
296
  },
297
- parse: function(s) {
298
- var o = Number(s);
297
+ parse: function(r) {
298
+ var o = Number(r);
299
299
  return { year: isNaN(o) ? t : o };
300
300
  },
301
301
  minLength: 4,
@@ -303,8 +303,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
303
303
  type: "number"
304
304
  },
305
305
  "%w": {
306
- format: function(s) {
307
- return s.dayOfWeek() || n.MIN_DAY_OF_WEEK;
306
+ format: function(r) {
307
+ return r.dayOfWeek() || n.MIN_DAY_OF_WEEK;
308
308
  },
309
309
  parse: function() {
310
310
  return {};
@@ -314,9 +314,9 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
314
314
  type: "number"
315
315
  },
316
316
  "%a": {
317
- format: function(s) {
318
- var o = s.dayOfWeek();
319
- return N[o !== t ? o : n.MIN_DAY_OF_WEEK];
317
+ format: function(r) {
318
+ var o = r.dayOfWeek();
319
+ return y[o !== t ? o : n.MIN_DAY_OF_WEEK];
320
320
  },
321
321
  parse: function() {
322
322
  return {};
@@ -326,8 +326,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
326
326
  type: "word"
327
327
  },
328
328
  "%A": {
329
- format: function(s) {
330
- var o = s.dayOfWeek();
329
+ format: function(r) {
330
+ var o = r.dayOfWeek();
331
331
  return H[o !== t ? o : n.MIN_DAY_OF_WEEK];
332
332
  },
333
333
  parse: function() {
@@ -338,12 +338,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
338
338
  type: "word"
339
339
  },
340
340
  "%b": {
341
- format: function(s) {
342
- var o = n.options("monthFromZero") ? s.month() : s.month() - 1;
341
+ format: function(r) {
342
+ var o = n.options("monthFromZero") ? r.month() : r.month() - 1;
343
343
  return b[o !== t ? o : n.MIN_MONTH];
344
344
  },
345
- parse: function(s) {
346
- var o = n.monthNames().indexOf(s) + (n.options("monthFromZero") ? 0 : 1);
345
+ parse: function(r) {
346
+ var o = n.monthNames().indexOf(r) + (n.options("monthFromZero") ? 0 : 1);
347
347
  return { month: o !== -1 ? o : t };
348
348
  },
349
349
  minLength: 1,
@@ -351,12 +351,12 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
351
351
  type: "word"
352
352
  },
353
353
  "%B": {
354
- format: function(s) {
355
- var o = n.options("monthFromZero") ? s.month() : s.month() - 1;
356
- return p[o !== t ? o : n.MIN_MONTH];
354
+ format: function(r) {
355
+ var o = n.options("monthFromZero") ? r.month() : r.month() - 1;
356
+ return N[o !== t ? o : n.MIN_MONTH];
357
357
  },
358
- parse: function(s) {
359
- var o = n.monthNames(!0).indexOf(s) + (n.options("monthFromZero") ? 0 : 1);
358
+ parse: function(r) {
359
+ var o = n.monthNames(!0).indexOf(r) + (n.options("monthFromZero") ? 0 : 1);
360
360
  return { month: o !== -1 ? o : t };
361
361
  },
362
362
  minLength: 1,
@@ -364,11 +364,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
364
364
  type: "word"
365
365
  },
366
366
  "%H": {
367
- format: function(s) {
368
- return i(s.hours() || n.MIN_HOURS, 2);
367
+ format: function(r) {
368
+ return i(r.hours() || n.MIN_HOURS, 2);
369
369
  },
370
- parse: function(s) {
371
- var o = Number(s);
370
+ parse: function(r) {
371
+ var o = Number(r);
372
372
  return { hours: isNaN(o) ? t : o };
373
373
  },
374
374
  minLength: 2,
@@ -376,11 +376,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
376
376
  type: "number"
377
377
  },
378
378
  "%M": {
379
- format: function(s) {
380
- return i(s.minutes() || n.MIN_MINUTES, 2);
379
+ format: function(r) {
380
+ return i(r.minutes() || n.MIN_MINUTES, 2);
381
381
  },
382
- parse: function(s) {
383
- var o = Number(s);
382
+ parse: function(r) {
383
+ var o = Number(r);
384
384
  return { minutes: isNaN(o) ? t : o };
385
385
  },
386
386
  minLength: 2,
@@ -388,11 +388,11 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
388
388
  type: "number"
389
389
  },
390
390
  "%S": {
391
- format: function(s) {
392
- return i(s.seconds() || n.MIN_SECONDS, 2);
391
+ format: function(r) {
392
+ return i(r.seconds() || n.MIN_SECONDS, 2);
393
393
  },
394
- parse: function(s) {
395
- var o = Number(s);
394
+ parse: function(r) {
395
+ var o = Number(r);
396
396
  return { seconds: isNaN(o) ? t : o };
397
397
  },
398
398
  minLength: 2,
@@ -400,26 +400,26 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
400
400
  type: "number"
401
401
  },
402
402
  "%s": {
403
- format: function(s) {
404
- return s.timestamp();
403
+ format: function(r) {
404
+ return r.timestamp();
405
405
  },
406
- parse: function(s) {
407
- return isNaN(Number(s)) ? {} : n(Number(s)).get();
406
+ parse: function(r) {
407
+ return isNaN(Number(r)) ? {} : n(Number(r)).get();
408
408
  },
409
409
  minLength: 1,
410
410
  maxLength: 20,
411
411
  type: "number"
412
412
  },
413
413
  "%F": {
414
- format: function(s) {
415
- return i(s.year() || n.MIN_YEAR, 4) + "-" + i(s.month() || n.MIN_MONTH, 2) + "-" + i(s.day() || n.MIN_DAY, 2);
414
+ format: function(r) {
415
+ return i(r.year() || n.MIN_YEAR, 4) + "-" + i(r.month() || n.MIN_MONTH, 2) + "-" + i(r.day() || n.MIN_DAY, 2);
416
416
  },
417
- parse: function(s) {
418
- var o = Number(s.slice(0, 4)), d = Number(s.slice(5, 7)), g = Number(s.slice(8, 10));
417
+ parse: function(r) {
418
+ var o = Number(r.slice(0, 4)), m = Number(r.slice(5, 7)), p = Number(r.slice(8, 10));
419
419
  return {
420
420
  year: o,
421
- month: d,
422
- day: g
421
+ month: m,
422
+ day: p
423
423
  };
424
424
  },
425
425
  minLength: 10,
@@ -427,26 +427,26 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
427
427
  type: "string"
428
428
  },
429
429
  "%D": {
430
- format: function(s) {
431
- return i(s.month() || n.MIN_MONTH, 2) + "/" + i(s.day() || n.MIN_DAY, 2) + "/" + i(s.year() || n.MIN_YEAR, 4);
430
+ format: function(r) {
431
+ return i(r.month() || n.MIN_MONTH, 2) + "/" + i(r.day() || n.MIN_DAY, 2) + "/" + i(r.year() || n.MIN_YEAR, 4);
432
432
  },
433
- parse: function(s) {
434
- var o = Number(s.slice(0, 2)), d = Number(s.slice(3, 5)), g = Number(s.slice(6, 10));
433
+ parse: function(r) {
434
+ var o = Number(r.slice(0, 2)), m = Number(r.slice(3, 5)), p = Number(r.slice(6, 10));
435
435
  return {
436
- year: g,
436
+ year: p,
437
437
  month: o,
438
- day: d
438
+ day: m
439
439
  };
440
440
  },
441
441
  minLength: 10,
442
442
  maxLength: 10,
443
443
  type: "string"
444
444
  }
445
- }, w = {
445
+ }, B = {
446
446
  useMilliseconds: !1,
447
447
  monthFromZero: !1
448
448
  }, k;
449
- k = function(s, o, d) {
449
+ k = function(r, o, m) {
450
450
  return this._d = /* @__PURE__ */ new Date(), this._i = {
451
451
  year: !1,
452
452
  month: !1,
@@ -455,56 +455,56 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
455
455
  minutes: !1,
456
456
  seconds: !1,
457
457
  milliseconds: !1
458
- }, s !== t && this.set(s, o, d), this;
458
+ }, r !== t && this.set(r, o, m), this;
459
459
  }, k.fn = k.prototype, k.fn.dayCount = function() {
460
- var s = this.month(), o = n.MAX_DAY_IN_MONTHS[s - (n.options("monthFromZero") ? 0 : 1)];
461
- return this.leapYear() && s === (n.options("monthFromZero") ? 1 : 2) && (o += 1), o;
462
- }, k.fn.year = function(s) {
460
+ var r = this.month(), o = n.MAX_DAY_IN_MONTHS[r - (n.options("monthFromZero") ? 0 : 1)];
461
+ return this.leapYear() && r === (n.options("monthFromZero") ? 1 : 2) && (o += 1), o;
462
+ }, k.fn.year = function(r) {
463
463
  if (arguments.length !== 0)
464
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_YEAR && Number(s) <= n.MAX_YEAR ? (this._d.setFullYear(Number(s)), this._i.year = !1) : this._i.year = Number(s) : (this._d.setFullYear(n.MIN_YEAR), this._i.year = !1);
464
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_YEAR && Number(r) <= n.MAX_YEAR ? (this._d.setFullYear(Number(r)), this._i.year = !1) : this._i.year = Number(r) : (this._d.setFullYear(n.MIN_YEAR), this._i.year = !1);
465
465
  else
466
466
  return this._i.year === !1 ? this._d.getFullYear() : this._i.year;
467
467
  return this;
468
- }, k.fn.month = function(s) {
468
+ }, k.fn.month = function(r) {
469
469
  if (arguments.length !== 0)
470
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MONTH && Number(s) <= n.MAX_MONTH ? (this._d.setMonth(n.options("monthFromZero") ? Number(s) : Number(s) - 1), this._i.month = !1) : this._i.month = Number(s) : (this._d.setMonth(n.options("monthFromZero") ? n.MIN_MONTH : n.MIN_MONTH - 1), this._i.month = !1);
470
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_MONTH && Number(r) <= n.MAX_MONTH ? (this._d.setMonth(n.options("monthFromZero") ? Number(r) : Number(r) - 1), this._i.month = !1) : this._i.month = Number(r) : (this._d.setMonth(n.options("monthFromZero") ? n.MIN_MONTH : n.MIN_MONTH - 1), this._i.month = !1);
471
471
  else
472
472
  return this._i.month === !1 ? n.options("monthFromZero") ? this._d.getMonth() : this._d.getMonth() + 1 : this._i.month;
473
473
  return this;
474
- }, k.fn.day = function(s) {
474
+ }, k.fn.day = function(r) {
475
475
  if (arguments.length !== 0)
476
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_DAY && Number(s) <= this.dayCount() ? (this._d.setDate(Number(s)), this._i.day = !1) : this._i.day = Number(s) : (this._d.setDate(n.MIN_DAY), this._i.day = !1);
476
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_DAY && Number(r) <= this.dayCount() ? (this._d.setDate(Number(r)), this._i.day = !1) : this._i.day = Number(r) : (this._d.setDate(n.MIN_DAY), this._i.day = !1);
477
477
  else
478
478
  return this._i.day === !1 ? this._d.getDate() : this._i.day;
479
479
  return this;
480
- }, k.fn.hours = function(s) {
480
+ }, k.fn.hours = function(r) {
481
481
  if (arguments.length !== 0)
482
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_HOURS && Number(s) <= n.MAX_HOURS ? (this._d.setHours(Number(s)), this._i.hours = !1) : this._i.hours = Number(s) : (this._d.setHours(n.MIN_HOURS), this._i.hours = !1);
482
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_HOURS && Number(r) <= n.MAX_HOURS ? (this._d.setHours(Number(r)), this._i.hours = !1) : this._i.hours = Number(r) : (this._d.setHours(n.MIN_HOURS), this._i.hours = !1);
483
483
  else
484
484
  return this._i.hours === !1 ? this._d.getHours() : this._i.hours;
485
485
  return this;
486
- }, k.fn.minutes = function(s) {
486
+ }, k.fn.minutes = function(r) {
487
487
  if (arguments.length !== 0)
488
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MINUTES && Number(s) <= n.MAX_MINUTES ? (this._d.setMinutes(Number(s)), this._i.minutes = !1) : this._i.minutes = Number(s) : (this._d.setMinutes(n.MIN_MINUTES), this._i.minutes = !1);
488
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_MINUTES && Number(r) <= n.MAX_MINUTES ? (this._d.setMinutes(Number(r)), this._i.minutes = !1) : this._i.minutes = Number(r) : (this._d.setMinutes(n.MIN_MINUTES), this._i.minutes = !1);
489
489
  else
490
490
  return this._i.minutes === !1 ? this._d.getMinutes() : this._i.minutes;
491
491
  return this;
492
- }, k.fn.seconds = function(s) {
492
+ }, k.fn.seconds = function(r) {
493
493
  if (arguments.length !== 0)
494
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_SECONDS && Number(s) <= n.MAX_SECONDS ? (this._d.setSeconds(Number(s)), this._i.seconds = !1) : this._i.seconds = Number(s) : (this._d.setSeconds(n.MIN_SECONDS), this._i.seconds = !1);
494
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_SECONDS && Number(r) <= n.MAX_SECONDS ? (this._d.setSeconds(Number(r)), this._i.seconds = !1) : this._i.seconds = Number(r) : (this._d.setSeconds(n.MIN_SECONDS), this._i.seconds = !1);
495
495
  else
496
496
  return this._i.seconds === !1 ? this._d.getSeconds() : this._i.seconds;
497
497
  return this;
498
- }, k.fn.milliseconds = function(s) {
498
+ }, k.fn.milliseconds = function(r) {
499
499
  if (arguments.length !== 0)
500
- (typeof s == "number" || typeof s == "string") && !isNaN(Number(s)) ? Number(s) >= n.MIN_MILLISECONDS && Number(s) <= n.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(s)), this._i.milliseconds = !1) : this._i.milliseconds = Number(s) : (this._d.setMilliseconds(n.MIN_MILLISECONDS), this._i.milliseconds = !1);
500
+ (typeof r == "number" || typeof r == "string") && !isNaN(Number(r)) ? Number(r) >= n.MIN_MILLISECONDS && Number(r) <= n.MAX_MILLISECONDS ? (this._d.setMilliseconds(Number(r)), this._i.milliseconds = !1) : this._i.milliseconds = Number(r) : (this._d.setMilliseconds(n.MIN_MILLISECONDS), this._i.milliseconds = !1);
501
501
  else
502
502
  return this._i.milliseconds === !1 ? this._d.getMilliseconds() : this._i.milliseconds;
503
503
  return this;
504
504
  }, k.fn.week = function() {
505
- var s = new Date(this.year(), 0, 1), o = n(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
506
- return Math.ceil(((o - s.getTime()) / 864e5 + s.getDay() + 1) / 7);
507
- }, k.fn.set = function(s, o, d) {
505
+ var r = new Date(this.year(), 0, 1), o = n(this.utc()).hours(0).minutes(0).seconds(0).milliseconds(0).utc() * 1e3;
506
+ return Math.ceil(((o - r.getTime()) / 864e5 + r.getDay() + 1) / 7);
507
+ }, k.fn.set = function(r, o, m) {
508
508
  if (this._i = {
509
509
  year: !1,
510
510
  month: !1,
@@ -513,16 +513,16 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
513
513
  minutes: !1,
514
514
  seconds: !1,
515
515
  milliseconds: !1
516
- }, s === t)
516
+ }, r === t)
517
517
  return this._d = /* @__PURE__ */ new Date(), this;
518
- if (s instanceof Date)
519
- return this._d = s, this;
520
- if (typeof s == "number")
521
- return this._d = new Date(s * (n.options("useMilliseconds") ? 1 : 1e3)), this;
522
- if (typeof s == "object" && (s instanceof Array ? (this.day(n.MIN_DAY), this.year(s[0]), this.month(s[1]), this.day(s[2]), this.hours(s[3]), this.minutes(s[4]), this.seconds(s[5]), this.milliseconds(s[6])) : (this.day(n.MIN_DAY), this.year(s.year), this.month(s.month), this.day(s.day), this.hours(s.hours), this.minutes(s.minutes), this.seconds(s.seconds), this.milliseconds(s.milliseconds))), typeof s == "string") {
523
- var g, C = [], D, U, Q = [], W = 0, F = 0, P, X, G = {}, Y;
524
- if (s === t)
525
- return D = a(this, d), D === t && (this._i = {
518
+ if (r instanceof Date)
519
+ return this._d = r, this;
520
+ if (typeof r == "number")
521
+ return this._d = new Date(r * (n.options("useMilliseconds") ? 1 : 1e3)), this;
522
+ if (typeof r == "object" && (r instanceof Array ? (this.day(n.MIN_DAY), this.year(r[0]), this.month(r[1]), this.day(r[2]), this.hours(r[3]), this.minutes(r[4]), this.seconds(r[5]), this.milliseconds(r[6])) : (this.day(n.MIN_DAY), this.year(r.year), this.month(r.month), this.day(r.day), this.hours(r.hours), this.minutes(r.minutes), this.seconds(r.seconds), this.milliseconds(r.milliseconds))), typeof r == "string") {
523
+ var p, C = [], D, U, Q = [], W = 0, F = 0, P, X, G = {}, Y;
524
+ if (r === t)
525
+ return D = a(this, m), D === t && (this._i = {
526
526
  year: -1,
527
527
  month: -1,
528
528
  day: -1,
@@ -531,25 +531,25 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
531
531
  seconds: -1,
532
532
  milliseconds: -1
533
533
  }), D;
534
- for (o === t && (o = n.detectFormat(s)); W < o.length; ) {
534
+ for (o === t && (o = n.detectFormat(r)); W < o.length; ) {
535
535
  if (o.charAt(W) === "%") {
536
- if (U = o.charAt(W) + o.charAt(W + 1), L[U] !== t) {
537
- switch (P = 0, X = "", L[U].type) {
536
+ if (U = o.charAt(W) + o.charAt(W + 1), R[U] !== t) {
537
+ switch (P = 0, X = "", R[U].type) {
538
538
  case "number":
539
- for (; P < L[U].maxLength && F + P < s.length && !isNaN(Number(s.charAt(F + P))); )
540
- X += s.charAt(F + P), P += 1;
539
+ for (; P < R[U].maxLength && F + P < r.length && !isNaN(Number(r.charAt(F + P))); )
540
+ X += r.charAt(F + P), P += 1;
541
541
  break;
542
542
  case "word":
543
- for (; P < L[U].maxLength && F + P < s.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(s.charAt(F + P)); )
544
- X += s.charAt(F + P), P += 1;
543
+ for (; P < R[U].maxLength && F + P < r.length && /^[\u00BF-\u1FFF\u2C00-\uD7FF\w]+$/.test(r.charAt(F + P)); )
544
+ X += r.charAt(F + P), P += 1;
545
545
  break;
546
546
  case "string":
547
- for (; P < L[U].maxLength && F + P < s.length; )
548
- X += s.charAt(F + P), P += 1;
547
+ for (; P < R[U].maxLength && F + P < r.length; )
548
+ X += r.charAt(F + P), P += 1;
549
549
  break;
550
550
  }
551
- if (P < L[U].minLength)
552
- return D = a(this, d), D === t && (this._i = {
551
+ if (P < R[U].minLength)
552
+ return D = a(this, m), D === t && (this._i = {
553
553
  year: -1,
554
554
  month: -1,
555
555
  day: -1,
@@ -560,8 +560,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
560
560
  }), D;
561
561
  C.push(U), Q.push(X), P -= 1, F += P, W += 1;
562
562
  }
563
- } else if (s.charAt(F) !== o.charAt(W))
564
- return D = a(this, d), D === t && (this._i = {
563
+ } else if (r.charAt(F) !== o.charAt(W))
564
+ return D = a(this, m), D === t && (this._i = {
565
565
  year: -1,
566
566
  month: -1,
567
567
  day: -1,
@@ -572,8 +572,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
572
572
  }), D;
573
573
  W += 1, F += 1;
574
574
  }
575
- for (g in C)
576
- C.hasOwnProperty(g) && L.hasOwnProperty(C[g]) && (Y = L[C[g]].parse(Q[g]), G = {
575
+ for (p in C)
576
+ C.hasOwnProperty(p) && R.hasOwnProperty(C[p]) && (Y = R[C[p]].parse(Q[p]), G = {
577
577
  year: Y.year !== t ? Y.year : G.year,
578
578
  month: Y.month !== t ? Y.month : G.month,
579
579
  day: Y.day !== t ? Y.day : G.day,
@@ -585,35 +585,35 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
585
585
  }
586
586
  return this;
587
587
  }, k.fn.leapYear = function() {
588
- var s = this.year();
589
- return s % 4 === 0 ? s % 100 === 0 ? s % 400 === 0 : !0 : !1;
590
- }, k.fn.timestamp = function(s) {
591
- return arguments.length !== 0 ? (this._d = new Date(Number(s) * (n.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : n.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
592
- }, k.fn.utc = function(s) {
593
- return arguments.length !== 0 ? (this._d = new Date(Number(s) * (n.options("useMilliseconds") ? 1 : 1e3)), this) : n.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
594
- }, k.fn.dayOfWeek = function(s) {
595
- if (s === "long")
588
+ var r = this.year();
589
+ return r % 4 === 0 ? r % 100 === 0 ? r % 400 === 0 : !0 : !1;
590
+ }, k.fn.timestamp = function(r) {
591
+ return arguments.length !== 0 ? (this._d = new Date(Number(r) * (n.options("useMilliseconds") ? 1 : 1e3) + this._d.getTimezoneOffset() * 6e4), this) : n.options("useMilliseconds") ? this._d.getTime() - this._d.getTimezoneOffset() * 6e4 : Math.floor(this._d.getTime() / 1e3) - this._d.getTimezoneOffset() * 60;
592
+ }, k.fn.utc = function(r) {
593
+ return arguments.length !== 0 ? (this._d = new Date(Number(r) * (n.options("useMilliseconds") ? 1 : 1e3)), this) : n.options("useMilliseconds") ? this._d.getTime() : Math.floor(this._d.getTime() / 1e3);
594
+ }, k.fn.dayOfWeek = function(r) {
595
+ if (r === "long")
596
596
  return H[this._d.getDay()];
597
- if (s === "short")
598
- return N[this._d.getDay()];
599
- if (s === t)
597
+ if (r === "short")
598
+ return y[this._d.getDay()];
599
+ if (r === t)
600
600
  return this._d.getDay();
601
- if (s === 0 || s === "Sunday")
601
+ if (r === 0 || r === "Sunday")
602
602
  return this.calc({ day: -this.dayOfWeek() });
603
- if (s === 1 || s === "Monday")
603
+ if (r === 1 || r === "Monday")
604
604
  return this.calc({ day: (this.dayOfWeek() === 0 ? -6 : 1) - this.dayOfWeek() });
605
- if (s === 2 || s === "Tuesday")
605
+ if (r === 2 || r === "Tuesday")
606
606
  return this.calc({ day: (this.dayOfWeek() === 0 ? -5 : 2) - this.dayOfWeek() });
607
- if (s === 3 || s === "Wednesday")
607
+ if (r === 3 || r === "Wednesday")
608
608
  return this.calc({ day: (this.dayOfWeek() === 0 ? -4 : 3) - this.dayOfWeek() });
609
- if (s === 4 || s === "Thursday")
609
+ if (r === 4 || r === "Thursday")
610
610
  return this.calc({ day: (this.dayOfWeek() === 0 ? -3 : 4) - this.dayOfWeek() });
611
- if (s === 5 || s === "Friday")
611
+ if (r === 5 || r === "Friday")
612
612
  return this.calc({ day: (this.dayOfWeek() === 0 ? -2 : 5) - this.dayOfWeek() });
613
- if (s === 6 || s === "Saturday")
613
+ if (r === 6 || r === "Saturday")
614
614
  return this.calc({ day: (this.dayOfWeek() === 0 ? -1 : 6) - this.dayOfWeek() });
615
- }, k.fn.timezone = function(s) {
616
- switch (s) {
615
+ }, k.fn.timezone = function(r) {
616
+ switch (r) {
617
617
  case "hours":
618
618
  return Math.floor(this._d.getTimezoneOffset() / 60);
619
619
  case "minutes":
@@ -621,8 +621,8 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
621
621
  default:
622
622
  return this._d.getTimezoneOffset() * 60;
623
623
  }
624
- }, k.fn.get = function(s) {
625
- switch (s) {
624
+ }, k.fn.get = function(r) {
625
+ switch (r) {
626
626
  case "Date":
627
627
  return new Date(
628
628
  this.year(),
@@ -670,73 +670,73 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
670
670
  timestamp: this.timestamp()
671
671
  };
672
672
  }
673
- }, k.fn.format = function(s) {
674
- for (var o = 0, d = "", g; o < s.length; )
675
- s.charAt(o) === "%" ? (g = s.charAt(o) + s.charAt(o + 1), L[g] !== t ? (d += L[g].format(this), o += 1) : d += "%") : d += s.charAt(o), o += 1;
676
- return d;
673
+ }, k.fn.format = function(r) {
674
+ for (var o = 0, m = "", p; o < r.length; )
675
+ r.charAt(o) === "%" ? (p = r.charAt(o) + r.charAt(o + 1), R[p] !== t ? (m += R[p].format(this), o += 1) : m += "%") : m += r.charAt(o), o += 1;
676
+ return m;
677
677
  }, k.fn.valid = function() {
678
678
  return this._i.year === !1 && this._i.month === !1 && this._i.day === !1 && this._i.hours === !1 && this._i.minutes === !1 && this._i.seconds === !1 && this._i.milliseconds === !1;
679
679
  }, k.fn.errors = function() {
680
680
  return this._i;
681
- }, k.fn.between = function(s, o) {
682
- var d = this.timestamp(), g = s.timestamp();
681
+ }, k.fn.between = function(r, o) {
682
+ var m = this.timestamp(), p = r.timestamp();
683
683
  switch (o) {
684
684
  case "year":
685
- return Math.floor((g - d) / 31556952);
685
+ return Math.floor((p - m) / 31556952);
686
686
  case "month":
687
- return Math.floor((g - d) / 2629746);
687
+ return Math.floor((p - m) / 2629746);
688
688
  case "day":
689
- return Math.floor((g - d) / 86400);
689
+ return Math.floor((p - m) / 86400);
690
690
  case "hours":
691
- return Math.floor((g - d) / 3600);
691
+ return Math.floor((p - m) / 3600);
692
692
  case "minutes":
693
- return Math.floor((g - d) / 60);
693
+ return Math.floor((p - m) / 60);
694
694
  case "seconds":
695
- return g - d;
695
+ return p - m;
696
696
  default:
697
697
  return t;
698
698
  }
699
- }, k.fn.calc = function(s) {
700
- return s.year !== t && this._d.setFullYear(this._d.getFullYear() + s.year), s.month !== t && this._d.setMonth(this._d.getMonth() + s.month), s.day !== t && this._d.setDate(this._d.getDate() + s.day), s.hours !== t && this._d.setHours(this._d.getHours() + s.hours), s.minutes !== t && this._d.setMinutes(this._d.getMinutes() + s.minutes), s.seconds !== t && this._d.setSeconds(this._d.getSeconds() + s.seconds), s.milliseconds !== t && this._d.setMilliseconds(this._d.getMilliseconds() + s.milliseconds), this;
701
- }, n = function(s, o, d) {
702
- return new k(s, o, d);
703
- }, n.MIN_YEAR = 1e3, n.MAX_YEAR = 3e3, n.MIN_MONTH = 1, n.MAX_MONTH = 12, n.MIN_DAY = 1, n.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], n.MIN_DAY_OF_WEEK = 0, n.MAX_DAY_OF_WEEK = 6, n.MIN_HOURS = 0, n.MAX_HOURS = 23, n.MIN_MINUTES = 0, n.MAX_MINUTES = 59, n.MIN_SECONDS = 0, n.MAX_SECONDS = 59, n.MIN_MILLISECONDS = 0, n.MAX_MILLISECONDS = 999, n.VERSION = "0.2.18", n.options = function(s, o) {
704
- if (s === t)
705
- return w;
706
- if (w.hasOwnProperty(s)) {
699
+ }, k.fn.calc = function(r) {
700
+ return r.year !== t && this._d.setFullYear(this._d.getFullYear() + r.year), r.month !== t && this._d.setMonth(this._d.getMonth() + r.month), r.day !== t && this._d.setDate(this._d.getDate() + r.day), r.hours !== t && this._d.setHours(this._d.getHours() + r.hours), r.minutes !== t && this._d.setMinutes(this._d.getMinutes() + r.minutes), r.seconds !== t && this._d.setSeconds(this._d.getSeconds() + r.seconds), r.milliseconds !== t && this._d.setMilliseconds(this._d.getMilliseconds() + r.milliseconds), this;
701
+ }, n = function(r, o, m) {
702
+ return new k(r, o, m);
703
+ }, n.MIN_YEAR = 1e3, n.MAX_YEAR = 3e3, n.MIN_MONTH = 1, n.MAX_MONTH = 12, n.MIN_DAY = 1, n.MAX_DAY_IN_MONTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], n.MIN_DAY_OF_WEEK = 0, n.MAX_DAY_OF_WEEK = 6, n.MIN_HOURS = 0, n.MAX_HOURS = 23, n.MIN_MINUTES = 0, n.MAX_MINUTES = 59, n.MIN_SECONDS = 0, n.MAX_SECONDS = 59, n.MIN_MILLISECONDS = 0, n.MAX_MILLISECONDS = 999, n.VERSION = "0.2.18", n.options = function(r, o) {
704
+ if (r === t)
705
+ return B;
706
+ if (B.hasOwnProperty(r)) {
707
707
  if (o === t)
708
- return w[s];
709
- w[s] = o, s === "monthFromZero" && (n.MIN_MONTH = o ? 0 : 1, n.MAX_MONTH = o ? 11 : 12);
708
+ return B[r];
709
+ B[r] = o, r === "monthFromZero" && (n.MIN_MONTH = o ? 0 : 1, n.MAX_MONTH = o ? 11 : 12);
710
710
  }
711
711
  return t;
712
712
  }, n.noConflict = function() {
713
- return r.tempus = h, n;
714
- }, n.generate = function(s) {
715
- var o, d, g, C, D, U, Q, W;
716
- if (typeof s.dateFrom != "number" && (s.dateFrom instanceof k ? o = s.dateFrom.utc() : o = n(s.dateFrom, s.formatFrom).utc()), typeof s.dateTo != "number" && (s.dateTo instanceof k ? d = s.dateTo.utc() : d = n(s.dateTo, s.formatTo !== t ? s.formatTo : s.formatFrom).utc()), typeof s.period == "number" ? D = {
713
+ return s.tempus = f, n;
714
+ }, n.generate = function(r) {
715
+ var o, m, p, C, D, U, Q, W;
716
+ if (typeof r.dateFrom != "number" && (r.dateFrom instanceof k ? o = r.dateFrom.utc() : o = n(r.dateFrom, r.formatFrom).utc()), typeof r.dateTo != "number" && (r.dateTo instanceof k ? m = r.dateTo.utc() : m = n(r.dateTo, r.formatTo !== t ? r.formatTo : r.formatFrom).utc()), typeof r.period == "number" ? D = {
717
717
  year: 0,
718
718
  month: 0,
719
719
  day: 0,
720
720
  hours: 0,
721
721
  minutes: 0,
722
- seconds: s.period
723
- } : typeof s.period == "string" ? D = {
724
- year: s.period === "year" ? 1 : 0,
725
- month: s.period === "month" ? 1 : 0,
726
- day: s.period === "day" ? 1 : 0,
727
- hours: s.period === "hours" ? 1 : 0,
728
- minutes: s.period === "minutes" ? 1 : 0,
729
- seconds: s.period === "seconds" ? 1 : 0
730
- } : typeof s.period == "object" && (D = {
731
- year: s.period.year !== t ? s.period.year : 0,
732
- month: s.period.month !== t ? s.period.month : 0,
733
- day: s.period.day !== t ? s.period.day : 0,
734
- hours: s.period.hours !== t ? s.period.hours : 0,
735
- minutes: s.period.minutes !== t ? s.period.minutes : 0,
736
- seconds: s.period.seconds !== t ? s.period.seconds : 0
737
- }), s.groupBy === t ? U = s.asObject === !0 ? {} : [] : (U = [], U.push([]), Q = n(o).get()[s.groupBy]), W = function(X, G, Y) {
738
- return s.asObject === !0 ? s.format !== t ? X[n(G).format(s.format)] = {} : X[n(G).format("%F %H:%M:%S")] = {} : s.format !== t ? X.push(Y ? null : n(G).format(s.format)) : X.push(Y ? null : n(G)), X;
739
- }, s.groupBy !== t && s.fillNulls) {
722
+ seconds: r.period
723
+ } : typeof r.period == "string" ? D = {
724
+ year: r.period === "year" ? 1 : 0,
725
+ month: r.period === "month" ? 1 : 0,
726
+ day: r.period === "day" ? 1 : 0,
727
+ hours: r.period === "hours" ? 1 : 0,
728
+ minutes: r.period === "minutes" ? 1 : 0,
729
+ seconds: r.period === "seconds" ? 1 : 0
730
+ } : typeof r.period == "object" && (D = {
731
+ year: r.period.year !== t ? r.period.year : 0,
732
+ month: r.period.month !== t ? r.period.month : 0,
733
+ day: r.period.day !== t ? r.period.day : 0,
734
+ hours: r.period.hours !== t ? r.period.hours : 0,
735
+ minutes: r.period.minutes !== t ? r.period.minutes : 0,
736
+ seconds: r.period.seconds !== t ? r.period.seconds : 0
737
+ }), r.groupBy === t ? U = r.asObject === !0 ? {} : [] : (U = [], U.push([]), Q = n(o).get()[r.groupBy]), W = function(X, G, Y) {
738
+ return r.asObject === !0 ? r.format !== t ? X[n(G).format(r.format)] = {} : X[n(G).format("%F %H:%M:%S")] = {} : r.format !== t ? X.push(Y ? null : n(G).format(r.format)) : X.push(Y ? null : n(G)), X;
739
+ }, r.groupBy !== t && r.fillNulls) {
740
740
  var F = {
741
741
  year: D.year ? -D.year : t,
742
742
  month: D.month ? -D.month : t,
@@ -746,72 +746,72 @@ https://github.com/douglascrockford/JSON-js/blob/master/json2.js`) : o(JSON.pars
746
746
  seconds: D.seconds ? -D.seconds : t,
747
747
  milliseconds: D.milliseconds ? -D.milliseconds : t
748
748
  };
749
- for (g = n(o).calc(F).utc(); n(g).get()[s.groupBy] === Q; )
750
- W(U[U.length - 1], g, !0), g = n(g).calc(F).utc();
751
- if (s.groupBy === "week") {
749
+ for (p = n(o).calc(F).utc(); n(p).get()[r.groupBy] === Q; )
750
+ W(U[U.length - 1], p, !0), p = n(p).calc(F).utc();
751
+ if (r.groupBy === "week") {
752
752
  var P = n(o).dayOfWeek();
753
- for (g = n(o).dayOfWeek(0).utc(); U[0].length < P && g < o; )
754
- W(U[U.length - 1], g, !0), g = n(g).calc(D).utc();
753
+ for (p = n(o).dayOfWeek(0).utc(); U[0].length < P && p < o; )
754
+ W(U[U.length - 1], p, !0), p = n(p).calc(D).utc();
755
755
  }
756
756
  }
757
- for (; o <= d; )
758
- s.groupBy === t ? W(U, o) : n(o).get()[s.groupBy] === Q ? W(U[U.length - 1], o) : (U.push([]), W(U[U.length - 1], o), Q = n(o).get()[s.groupBy]), o = n(o).calc(D).utc();
759
- if (s.groupBy !== t && s.fillNulls)
760
- for (C = n(d).calc(D).utc(); n(C).get()[s.groupBy] === Q; )
757
+ for (; o <= m; )
758
+ r.groupBy === t ? W(U, o) : n(o).get()[r.groupBy] === Q ? W(U[U.length - 1], o) : (U.push([]), W(U[U.length - 1], o), Q = n(o).get()[r.groupBy]), o = n(o).calc(D).utc();
759
+ if (r.groupBy !== t && r.fillNulls)
760
+ for (C = n(m).calc(D).utc(); n(C).get()[r.groupBy] === Q; )
761
761
  W(U[U.length - 1], C, !0), C = n(C).calc(D).utc();
762
762
  return U;
763
- }, n.monthNames = function(s) {
764
- switch (s) {
763
+ }, n.monthNames = function(r) {
764
+ switch (r) {
765
765
  case "long":
766
- return p;
766
+ return N;
767
767
  default:
768
768
  return b;
769
769
  }
770
- }, n.dayNames = function(s) {
771
- switch (s) {
770
+ }, n.dayNames = function(r) {
771
+ switch (r) {
772
772
  case "long":
773
773
  return H;
774
774
  default:
775
- return N;
775
+ return y;
776
776
  }
777
- }, n.lang = function(s) {
778
- if (s !== t)
779
- A = s, u[A] === t && (A = "en"), p = O(), b = T(), H = E(), N = M();
777
+ }, n.lang = function(r) {
778
+ if (r !== t)
779
+ A = r, l[A] === t && (A = "en"), N = _(), b = T(), H = E(), y = M();
780
780
  else
781
781
  return A;
782
782
  return t;
783
783
  }, n.availableLangs = function() {
784
- return Object.keys(u);
785
- }, n.registerFormat = function(s, o, d, g, C, D) {
786
- L[s] = {
784
+ return Object.keys(l);
785
+ }, n.registerFormat = function(r, o, m, p, C, D) {
786
+ R[r] = {
787
787
  format: o,
788
- parse: d,
789
- minLength: g,
788
+ parse: m,
789
+ minLength: p,
790
790
  maxLength: C,
791
791
  type: D
792
792
  };
793
- }, n.unregisterFormat = function(s) {
794
- delete L[s];
795
- }, n.detectFormat = function(s) {
796
- var o, d, g;
797
- return o = l(s, 0), o !== "" && (g = 10), d = s.charAt(g), (d === "T" || d === " ") && (o += d, g += 1), o += c(s, g), o;
798
- }, f = {
793
+ }, n.unregisterFormat = function(r) {
794
+ delete R[r];
795
+ }, n.detectFormat = function(r) {
796
+ var o, m, p;
797
+ return o = h(r, 0), o !== "" && (p = 10), m = r.charAt(p), (m === "T" || m === " ") && (o += m, p += 1), o += c(r, p), o;
798
+ }, u = {
799
799
  TempusDate: k
800
- }, n.classes = function(s, o) {
800
+ }, n.classes = function(r, o) {
801
801
  if (o === t)
802
- return f[s];
803
- f[s] = o;
804
- }, n.loadTranslations = function(s) {
805
- typeof s == "object" ? u = s : typeof s == "string" && I(s, function(o) {
806
- u = o;
802
+ return u[r];
803
+ u[r] = o;
804
+ }, n.loadTranslations = function(r) {
805
+ typeof r == "object" ? l = r : typeof r == "string" && S(r, function(o) {
806
+ l = o;
807
807
  }, function(o) {
808
808
  });
809
- }, A = (m.language || m.systemLanguage || m.userLanguage || "en").substr(0, 2).toLowerCase(), u[A] === t && (A = "en"), p = O(), b = T(), H = E(), N = M(), y.exports && (e = y.exports = n), e.tempus = n;
810
- }).call(_e);
811
- })(Jt, Jt.exports);
812
- var Ee = Jt.exports;
813
- const Ot = /* @__PURE__ */ Te(Ee);
814
- var Et, ee, bt, Lt, Rt, Mt, ot, _t, It, se, St, re, Z, nt, tt, ht, et, ut, Dt, ie, ft, jt;
809
+ }, A = (d.language || d.systemLanguage || d.userLanguage || "en").substr(0, 2).toLowerCase(), l[A] === t && (A = "en"), N = _(), b = T(), H = E(), y = M(), g.exports && (e = g.exports = n), e.tempus = n;
810
+ }).call(Le);
811
+ })(qt, qt.exports);
812
+ var Me = qt.exports;
813
+ const Tt = /* @__PURE__ */ Re(Me);
814
+ var Lt, ie, Rt, Mt, St, It, At, Et, Dt, ne, kt, ae, Z, at, tt, ut, et, ft, wt, oe, mt, zt;
815
815
  const J = class J {
816
816
  constructor(e) {
817
817
  /**
@@ -820,25 +820,25 @@ const J = class J {
820
820
  * формула sum(count)/sum(total)×chunkRate (один длинный list, batchTotalCount, смешанные batch).
821
821
  * @returns {boolean}
822
822
  */
823
- R(this, Et);
823
+ L(this, Lt);
824
824
  /**
825
825
  * Одно обновление колбэка прогресса, если снимок изменился.
826
826
  * @returns {void}
827
827
  */
828
- R(this, ot);
828
+ L(this, At);
829
829
  /**
830
830
  * Проверяет, изменились ли метрики прогресса относительно предыдущей отправки.
831
831
  *
832
832
  * @param {{percent: number, allCount: number, allTotal: number}} snapshot - Текущий снимок прогресса.
833
833
  * @returns {boolean} `true`, если нужно отправить callback прогресса.
834
834
  */
835
- R(this, It);
835
+ L(this, Dt);
836
836
  /**
837
837
  * Уведомляет подписчиков о текущем состоянии лимита.
838
838
  *
839
839
  * @returns {void}
840
840
  */
841
- R(this, St);
841
+ L(this, kt);
842
842
  /**
843
843
  * Включает состояние лимита, выдерживает паузу и затем выключает лимит.
844
844
  * Используется как единый "cooldown" перед повторной отправкой chunk.
@@ -846,7 +846,7 @@ const J = class J {
846
846
  * @param {number} [pauseMs=this.defaultPauseMs] - Длительность паузы; для batch по умолчанию 120 с, для `call()` — `callLimitPauseMs` (30 с).
847
847
  * @returns {Promise<void>}
848
848
  */
849
- R(this, Z);
849
+ L(this, Z);
850
850
  /**
851
851
  * Проверяет operating-time в результате batch и ставит паузу,
852
852
  * если сервер приблизился к лимиту выполнения.
@@ -854,7 +854,7 @@ const J = class J {
854
854
  * @param {Object} result - Результат текущего batch-запроса.
855
855
  * @returns {Promise<number>} Максимальный operating-time среди команд.
856
856
  */
857
- R(this, tt);
857
+ L(this, tt);
858
858
  /**
859
859
  * Выполняет один chunk с автоматическим повтором после лимит-паузы.
860
860
  * Повтор запускается при ошибках QUERY_LIMIT_EXCEEDED, OPERATION_TIME_LIMIT или TIMEOUT.
@@ -863,7 +863,7 @@ const J = class J {
863
863
  * @param {(result: Object) => Promise<void>} processResult - Обработчик успешного результата chunk.
864
864
  * @returns {Promise<void>}
865
865
  */
866
- R(this, et);
866
+ L(this, et);
867
867
  /**
868
868
  * Выполняет BX24.callMethod с таймаутом ожидания ответа.
869
869
  *
@@ -871,13 +871,13 @@ const J = class J {
871
871
  * @param {Object} params - Параметры REST-метода.
872
872
  * @returns {Promise<Object|null>} Raw-result BX24 или null при таймауте/ошибке вызова.
873
873
  */
874
- R(this, Dt);
874
+ L(this, wt);
875
875
  /**
876
876
  * Resets mutable runtime state before each public batch run.
877
877
  * @param {Function} progressCall - Progress callback for current run.
878
878
  * @returns {void}
879
879
  */
880
- R(this, ft);
880
+ L(this, mt);
881
881
  typeof e == "function" ? (this.callBatch = e, this.callMethod = null) : (this.callBatch = (e == null ? void 0 : e.callBatch) || null, this.callMethod = (e == null ? void 0 : e.callMethod) || null), this.result = {}, this.errors = {}, this.timeLimit = {
882
882
  limit: !1,
883
883
  date: void 0,
@@ -892,31 +892,31 @@ const J = class J {
892
892
  if (!this.progressData)
893
893
  return { percent: 0, allCount: 0, allTotal: 0 };
894
894
  const e = this.totalBatchCommands || 0;
895
- if (e > 0 && Array.isArray(this.batchCommandKeyOrder) && this.batchCommandKeyOrder.length && _(this, Et, ee).call(this)) {
896
- let h = 0;
897
- for (const u of this.batchCommandKeyOrder) {
898
- const O = this.progressData[u];
899
- if (!O)
895
+ if (e > 0 && Array.isArray(this.batchCommandKeyOrder) && this.batchCommandKeyOrder.length && O(this, Lt, ie).call(this)) {
896
+ let f = 0;
897
+ for (const l of this.batchCommandKeyOrder) {
898
+ const _ = this.progressData[l];
899
+ if (!_)
900
900
  continue;
901
- const T = Number(O.total) || 0, E = Number(O.count) || 0;
902
- T === 0 && E === 0 ? h += 1 : T > 0 && (h += Math.min(1, E / T));
901
+ const T = Number(_.total) || 0, E = Number(_.count) || 0;
902
+ T === 0 && E === 0 ? f += 1 : T > 0 && (f += Math.min(1, E / T));
903
903
  }
904
- const n = h / e * 100;
905
- let f = Math.max(0, Math.min(100, Math.floor(n)));
906
- const m = e, A = Math.min(e, Math.floor(h));
907
- return { percent: f, allCount: A, allTotal: m };
904
+ const n = f / e * 100;
905
+ let u = Math.max(0, Math.min(100, Math.floor(n)));
906
+ const d = e, A = Math.min(e, Math.floor(f));
907
+ return { percent: u, allCount: A, allTotal: d };
908
908
  }
909
- let t = 0, r = 0;
910
- for (const h of Object.values(this.progressData)) {
911
- const { total: n, count: f } = h;
912
- t += n ?? 0, r += f ?? 0;
909
+ let t = 0, s = 0;
910
+ for (const f of Object.values(this.progressData)) {
911
+ const { total: n, count: u } = f;
912
+ t += n ?? 0, s += u ?? 0;
913
913
  }
914
914
  const i = Number(this.chunkRate) || 0;
915
915
  let a = 0;
916
- t ? a = r / t * 100 * i + this.totalProgress : r === 0 && t === 0 ? a = i < 1 ? this.totalProgress : 100 * i + this.totalProgress : a = 100, a = Math.max(0, Math.min(a, 100));
916
+ t ? a = s / t * 100 * i + this.totalProgress : s === 0 && t === 0 ? a = i < 1 ? this.totalProgress : 100 * i + this.totalProgress : a = 100, a = Math.max(0, Math.min(a, 100));
917
917
  let c = Math.floor(a);
918
- const l = Number(this.chunkRate) || 0;
919
- return t > 0 && r >= t && l >= 1 && (c = 100), { percent: c, allCount: r, allTotal: t };
918
+ const h = Number(this.chunkRate) || 0;
919
+ return t > 0 && s >= t && h >= 1 && (c = 100), { percent: c, allCount: s, allTotal: t };
920
920
  }
921
921
  /**
922
922
  * Обновление данных прогресса выполнения
@@ -925,8 +925,8 @@ const J = class J {
925
925
  * @param {Object} params.value - Значение ответа от API
926
926
  * @param {string} params.type - Тип обработки ('count' или undefined)
927
927
  */
928
- setProgressData({ key: e, value: t, type: r }) {
929
- var u, O;
928
+ setProgressData({ key: e, value: t, type: s }) {
929
+ var l, _;
930
930
  if (!this.progressCall)
931
931
  return;
932
932
  const i = this.getData(t.data()), a = Array.isArray(i) ? i.length : 0;
@@ -938,22 +938,22 @@ const J = class J {
938
938
  Number.isFinite(E) && (c = E);
939
939
  }
940
940
  }
941
- let l = 1;
942
- r === "count" ? (c || (c = a), l = c > 0 ? c : a > 0 ? a : 1) : i && (l = a), this.progressData || (this.progressData = {});
943
- const h = ((u = this.progressData[e]) == null ? void 0 : u.total) ?? 0, n = ((O = this.progressData[e]) == null ? void 0 : O.count) ?? 0, f = l + n, m = Math.max(h, c ?? 0, f);
941
+ let h = 1;
942
+ s === "count" ? (c || (c = a), h = c > 0 ? c : a > 0 ? a : 1) : i && (h = a), this.progressData || (this.progressData = {});
943
+ const f = ((l = this.progressData[e]) == null ? void 0 : l.total) ?? 0, n = ((_ = this.progressData[e]) == null ? void 0 : _.count) ?? 0, u = h + n, d = Math.max(f, c ?? 0, u);
944
944
  if (this.progressData[e] = {
945
- total: m,
946
- count: Math.min(f, m)
945
+ total: d,
946
+ count: Math.min(u, d)
947
947
  }, typeof document < "u" && (document == null ? void 0 : document.hidden) === !0) {
948
- _(this, ot, _t).call(this);
948
+ O(this, At, Et).call(this);
949
949
  return;
950
950
  }
951
- _(this, ot, _t).call(this), this.progressTimer || (this.progressTimer = setInterval(() => {
951
+ O(this, At, Et).call(this), this.progressTimer || (this.progressTimer = setInterval(() => {
952
952
  if (!this.progressCall) {
953
953
  this.clearProgressData();
954
954
  return;
955
955
  }
956
- _(this, ot, _t).call(this);
956
+ O(this, At, Et).call(this);
957
957
  const { percent: T } = this.progressPercent;
958
958
  T >= 100 && (clearInterval(this.progressTimer), this.progressTimer = "");
959
959
  }, this.progressDelay));
@@ -977,8 +977,8 @@ const J = class J {
977
977
  * @param {number|undefined} pauseMs - Длительность текущей лимит-паузы (мс); при снятии лимита не передаётся.
978
978
  * @returns {void}
979
979
  */
980
- setTimeLimitState(e, t, r) {
981
- this.timeLimit.limit = !!e, this.timeLimit.date = e ? t : void 0, e && typeof r == "number" && r > 0 ? this.timeLimit.pauseMs = r : this.timeLimit.pauseMs = void 0, _(this, St, re).call(this);
980
+ setTimeLimitState(e, t, s) {
981
+ this.timeLimit.limit = !!e, this.timeLimit.date = e ? t : void 0, e && typeof s == "number" && s > 0 ? this.timeLimit.pauseMs = s : this.timeLimit.pauseMs = void 0, O(this, kt, ae).call(this);
982
982
  }
983
983
  /**
984
984
  * Подписывает внешний код на изменения состояния лимита.
@@ -1005,26 +1005,26 @@ const J = class J {
1005
1005
  * @returns {Array} Массив запросов (может быть один или несколько)
1006
1006
  */
1007
1007
  splitLargeFilters(e, t) {
1008
- const { method: r, params: i } = t;
1008
+ const { method: s, params: i } = t;
1009
1009
  if (!i)
1010
1010
  return [{ key: e, request: t }];
1011
1011
  const a = i.filter || i.FILTER;
1012
1012
  if (!a || typeof a != "object" || Array.isArray(a))
1013
1013
  return [{ key: e, request: t }];
1014
- for (const [c, l] of Object.entries(a))
1015
- if (!String(c).trim().startsWith("!") && Array.isArray(l) && l.length > this.filterChunkSize) {
1016
- const h = [];
1017
- for (let n = 0; n < l.length; n += this.filterChunkSize) {
1018
- const f = l.slice(n, n + this.filterChunkSize), m = n === 0 ? e : `${e}__chunk_${Math.floor(n / this.filterChunkSize)}`, A = { ...i };
1019
- i.filter ? (A.filter = { ...a }, A.filter[c] = f) : i.FILTER && (A.FILTER = { ...a }, A.FILTER[c] = f), h.push({
1020
- key: m,
1021
- request: { method: r, params: A },
1014
+ for (const [c, h] of Object.entries(a))
1015
+ if (!String(c).trim().startsWith("!") && Array.isArray(h) && h.length > this.filterChunkSize) {
1016
+ const f = [];
1017
+ for (let n = 0; n < h.length; n += this.filterChunkSize) {
1018
+ const u = h.slice(n, n + this.filterChunkSize), d = n === 0 ? e : `${e}__chunk_${Math.floor(n / this.filterChunkSize)}`, A = { ...i };
1019
+ i.filter ? (A.filter = { ...a }, A.filter[c] = u) : i.FILTER && (A.FILTER = { ...a }, A.FILTER[c] = u), f.push({
1020
+ key: d,
1021
+ request: { method: s, params: A },
1022
1022
  originalKey: e,
1023
1023
  filterKey: c,
1024
1024
  chunkIndex: Math.floor(n / this.filterChunkSize)
1025
1025
  });
1026
1026
  }
1027
- return h;
1027
+ return f;
1028
1028
  }
1029
1029
  return [{ key: e, request: t }];
1030
1030
  }
@@ -1035,15 +1035,15 @@ const J = class J {
1035
1035
  * @returns {Array} Объединенный массив результатов
1036
1036
  */
1037
1037
  mergeSplitResults(e, t) {
1038
- const r = [], i = String(t).replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(`^${i}(?:__chunk_\\d+)?$`), c = Object.keys(e).filter((l) => a.test(l)).sort((l, h) => {
1039
- const n = l.match(/__chunk_(\d+)$/), f = h.match(/__chunk_(\d+)$/);
1040
- return n ? f ? parseInt(n[1]) - parseInt(f[1]) : 1 : -1;
1038
+ const s = [], i = String(t).replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(`^${i}(?:__chunk_\\d+)?$`), c = Object.keys(e).filter((h) => a.test(h)).sort((h, f) => {
1039
+ const n = h.match(/__chunk_(\d+)$/), u = f.match(/__chunk_(\d+)$/);
1040
+ return n ? u ? parseInt(n[1]) - parseInt(u[1]) : 1 : -1;
1041
1041
  });
1042
- for (const l of c) {
1043
- const h = e[l];
1044
- Array.isArray(h) ? r.push(...h) : h && r.push(h);
1042
+ for (const h of c) {
1043
+ const f = e[h];
1044
+ Array.isArray(f) ? s.push(...f) : f && s.push(f);
1045
1045
  }
1046
- return r;
1046
+ return s;
1047
1047
  }
1048
1048
  /**
1049
1049
  * Задержка между запросами
@@ -1061,25 +1061,25 @@ const J = class J {
1061
1061
  * @returns {Promise<void>}
1062
1062
  */
1063
1063
  callBatchWithTimeout(e, t) {
1064
- return new Promise((r, i) => {
1064
+ return new Promise((s, i) => {
1065
1065
  let a = !1, c = null;
1066
- const l = async (n) => {
1066
+ const h = async (n) => {
1067
1067
  if (!a) {
1068
1068
  a = !0, c && clearTimeout(c);
1069
1069
  try {
1070
- await Promise.resolve(t(n)), r();
1071
- } catch (f) {
1072
- console.error("Error in callBatch callback:", f), i(f);
1070
+ await Promise.resolve(t(n)), s();
1071
+ } catch (u) {
1072
+ console.error("Error in callBatch callback:", u), i(u);
1073
1073
  }
1074
1074
  }
1075
- }, h = async () => {
1075
+ }, f = async () => {
1076
1076
  if (!a) {
1077
1077
  a = !0, c && clearTimeout(c), console.warn(
1078
1078
  `Batch request timeout after ${this.requestTimeoutMs}ms. This may indicate a CORS or network error.`
1079
1079
  );
1080
1080
  const n = {};
1081
- Object.keys(e).forEach((f) => {
1082
- n[f] = {
1081
+ Object.keys(e).forEach((u) => {
1082
+ n[u] = {
1083
1083
  error: () => ({
1084
1084
  ex: {
1085
1085
  error: "TIMEOUT",
@@ -1091,15 +1091,15 @@ const J = class J {
1091
1091
  };
1092
1092
  });
1093
1093
  try {
1094
- await Promise.resolve(t(n)), r();
1095
- } catch (f) {
1096
- console.error("Error in timeout callback:", f), r();
1094
+ await Promise.resolve(t(n)), s();
1095
+ } catch (u) {
1096
+ console.error("Error in timeout callback:", u), s();
1097
1097
  }
1098
1098
  }
1099
1099
  };
1100
1100
  try {
1101
1101
  this.callBatch(e, async (n) => {
1102
- await l(n);
1102
+ await h(n);
1103
1103
  });
1104
1104
  } catch (n) {
1105
1105
  a || console.error("Error calling callBatch:", n);
@@ -1107,7 +1107,7 @@ const J = class J {
1107
1107
  c = setTimeout(async () => {
1108
1108
  a || (console.warn(
1109
1109
  `Batch request attempt timeout after ${this.requestTimeoutMs}ms. Switching to timeout fallback result.`
1110
- ), await h());
1110
+ ), await f());
1111
1111
  }, this.requestTimeoutMs);
1112
1112
  });
1113
1113
  }
@@ -1129,57 +1129,57 @@ const J = class J {
1129
1129
  * @param {{oneBatch?: boolean}} [options] - Опции выполнения.
1130
1130
  * @returns {Promise<Object>}
1131
1131
  */
1132
- async batch(e, t, r = {}) {
1133
- _(this, ft, jt).call(this, t);
1132
+ async batch(e, t, s = {}) {
1133
+ O(this, mt, zt).call(this, t);
1134
1134
  const i = {}, a = {}, c = {};
1135
- for (const [f, m] of Object.entries(e)) {
1136
- const A = this.arrayChunk(m);
1135
+ for (const [u, d] of Object.entries(e)) {
1136
+ const A = this.arrayChunk(d);
1137
1137
  if (!A)
1138
1138
  continue;
1139
- const u = this.splitLargeFilters(f, A);
1140
- if (u.length === 1)
1141
- a[f] = A;
1139
+ const l = this.splitLargeFilters(u, A);
1140
+ if (l.length === 1)
1141
+ a[u] = A;
1142
1142
  else {
1143
- c[f] = [];
1144
- for (const O of u)
1145
- a[O.key] = O.request, c[f].push(O.key);
1143
+ c[u] = [];
1144
+ for (const _ of l)
1145
+ a[_.key] = _.request, c[u].push(_.key);
1146
1146
  }
1147
1147
  }
1148
1148
  this.batchCommandKeyOrder = Object.keys(a), this.totalBatchCommands = this.batchCommandKeyOrder.length, this.batchCommandMethods = this.batchCommandKeyOrder.map(
1149
- (f) => {
1150
- var m;
1151
- return String(((m = a[f]) == null ? void 0 : m.method) || "");
1149
+ (u) => {
1150
+ var d;
1151
+ return String(((d = a[u]) == null ? void 0 : d.method) || "");
1152
1152
  }
1153
1153
  ), this.chunkRate = (1 / Math.ceil(Object.keys(a).length / this.limit)).toFixed(5);
1154
- let l = {}, h = 0;
1154
+ let h = {}, f = 0;
1155
1155
  const n = Object.keys(a).length;
1156
- for (const [f, m] of Object.entries(a)) {
1156
+ for (const [u, d] of Object.entries(a)) {
1157
1157
  if (!this.canContinue)
1158
1158
  break;
1159
- if (l[f] = m, Object.keys(l).length >= this.limit || h + 1 === n) {
1160
- const A = h + 1 === n;
1159
+ if (h[u] = d, Object.keys(h).length >= this.limit || f + 1 === n) {
1160
+ const A = f + 1 === n;
1161
1161
  await this.batchChunk(
1162
- l,
1162
+ h,
1163
1163
  void 0,
1164
1164
  !A,
1165
1165
  {
1166
1166
  disablePagination: !1,
1167
- oneBatch: !!(r != null && r.oneBatch)
1167
+ oneBatch: !!(s != null && s.oneBatch)
1168
1168
  }
1169
- ), Object.entries(this.result).forEach(([u, O]) => {
1170
- i[u] = O;
1169
+ ), Object.entries(this.result).forEach(([l, _]) => {
1170
+ i[l] = _;
1171
1171
  }), this.totalProgress = Math.round(
1172
- h / n * 100
1173
- ), l = {};
1172
+ f / n * 100
1173
+ ), h = {};
1174
1174
  }
1175
- h++;
1175
+ f++;
1176
1176
  }
1177
- for (const [f, m] of Object.entries(c))
1178
- if (m && m.length > 0) {
1179
- const A = this.mergeSplitResults(i, f);
1180
- for (const u of m)
1181
- delete i[u];
1182
- i[f] = A;
1177
+ for (const [u, d] of Object.entries(c))
1178
+ if (d && d.length > 0) {
1179
+ const A = this.mergeSplitResults(i, u);
1180
+ for (const l of d)
1181
+ delete i[l];
1182
+ i[u] = A;
1183
1183
  }
1184
1184
  return Object.entries(this.errors).length && (i.errorsList = this.errors), t && t({ percent: 100 }), Promise.resolve(i);
1185
1185
  }
@@ -1193,61 +1193,61 @@ const J = class J {
1193
1193
  * @returns {Promise<Object>} Объект с количеством элементов для каждого ключа
1194
1194
  */
1195
1195
  async batchTotalCount(e, t) {
1196
- _(this, ft, jt).call(this, t);
1197
- const r = {}, i = {}, a = {};
1198
- for (const [h, n] of Object.entries(e)) {
1199
- const f = this.arrayChunk(n);
1200
- if (!f)
1196
+ O(this, mt, zt).call(this, t);
1197
+ const s = {}, i = {}, a = {};
1198
+ for (const [f, n] of Object.entries(e)) {
1199
+ const u = this.arrayChunk(n);
1200
+ if (!u)
1201
1201
  continue;
1202
- const m = this.splitLargeFilters(h, f);
1203
- if (m.length === 1)
1204
- i[h] = f;
1202
+ const d = this.splitLargeFilters(f, u);
1203
+ if (d.length === 1)
1204
+ i[f] = u;
1205
1205
  else {
1206
- a[h] = [];
1207
- for (const A of m)
1208
- i[A.key] = A.request, a[h].push(A.key);
1206
+ a[f] = [];
1207
+ for (const A of d)
1208
+ i[A.key] = A.request, a[f].push(A.key);
1209
1209
  }
1210
1210
  }
1211
- const c = [], l = Object.entries(i);
1212
- for (let h = 0; h < l.length; h += this.limit) {
1213
- const n = l.slice(h, h + this.limit), f = {};
1214
- for (const [m, A] of n) {
1211
+ const c = [], h = Object.entries(i);
1212
+ for (let f = 0; f < h.length; f += this.limit) {
1213
+ const n = h.slice(f, f + this.limit), u = {};
1214
+ for (const [d, A] of n) {
1215
1215
  if (!this.canContinue)
1216
1216
  break;
1217
- f[m] = A;
1217
+ u[d] = A;
1218
1218
  }
1219
- Object.keys(f).length > 0 && c.push(f);
1219
+ Object.keys(u).length > 0 && c.push(u);
1220
1220
  }
1221
1221
  this.chunkRate = (1 / c.length).toFixed(5);
1222
- for (const [h, n] of Object.entries(c)) {
1222
+ for (const [f, n] of Object.entries(c)) {
1223
1223
  if (!this.canContinue)
1224
1224
  break;
1225
- this.totalProgress = Math.round(Number(h) / c.length * 100), this.progressData = {}, this.lastProgressSnapshot = null;
1226
- const f = Number(h) === c.length - 1;
1227
- await _(this, et, ut).call(this, n, async (m) => {
1228
- var A, u, O, T, E;
1229
- for (const [M, p] of Object.entries(m)) {
1225
+ this.totalProgress = Math.round(Number(f) / c.length * 100), this.progressData = {}, this.lastProgressSnapshot = null;
1226
+ const u = Number(f) === c.length - 1;
1227
+ await O(this, et, ft).call(this, n, async (d) => {
1228
+ var A, l, _, T, E;
1229
+ for (const [M, N] of Object.entries(d)) {
1230
1230
  if (!this.canContinue)
1231
1231
  return;
1232
- if (p.error()) {
1233
- const L = (u = (A = p.error()) == null ? void 0 : A.ex) == null ? void 0 : u.error, w = (T = (O = p.error()) == null ? void 0 : O.ex) == null ? void 0 : T.error_description;
1234
- this.errors[M] = L && L.trim() || w && w.trim() || ((E = p.error()) == null ? void 0 : E.toString()) || "Неизвестная ошибка", r[M] = 0;
1232
+ if (N.error()) {
1233
+ const R = (l = (A = N.error()) == null ? void 0 : A.ex) == null ? void 0 : l.error, B = (T = (_ = N.error()) == null ? void 0 : _.ex) == null ? void 0 : T.error_description;
1234
+ this.errors[M] = R && R.trim() || B && B.trim() || ((E = N.error()) == null ? void 0 : E.toString()) || "Неизвестная ошибка", s[M] = 0;
1235
1235
  continue;
1236
1236
  }
1237
- const b = this.getData(p.data()), H = Array.isArray(b) ? b.length : 0, I = typeof p.total == "function" && p.total() !== void 0 ? p.total() : H;
1238
- r[M] = I, this.setProgressData({ key: M, value: p, type: "count" });
1237
+ const b = this.getData(N.data()), H = Array.isArray(b) ? b.length : 0, S = typeof N.total == "function" && N.total() !== void 0 ? N.total() : H;
1238
+ s[M] = S, this.setProgressData({ key: M, value: N, type: "count" });
1239
1239
  }
1240
- await _(this, tt, ht).call(this, m, !f);
1240
+ await O(this, tt, ut).call(this, d, !u);
1241
1241
  });
1242
1242
  }
1243
- for (const [h, n] of Object.entries(a))
1243
+ for (const [f, n] of Object.entries(a))
1244
1244
  if (n && n.length > 0) {
1245
- let f = 0;
1246
- for (const m of n)
1247
- r[m] !== void 0 && (f += r[m] || 0), delete r[m];
1248
- r[h] = f;
1245
+ let u = 0;
1246
+ for (const d of n)
1247
+ s[d] !== void 0 && (u += s[d] || 0), delete s[d];
1248
+ s[f] = u;
1249
1249
  }
1250
- return Object.entries(this.errors).length && (r.errorsList = this.errors, this.errorLogger()), t && t({ percent: 100 }), Promise.resolve(r);
1250
+ return Object.entries(this.errors).length && (s.errorsList = this.errors, this.errorLogger()), t && t({ percent: 100 }), Promise.resolve(s);
1251
1251
  }
1252
1252
  /**
1253
1253
  * Выполняет одиночный REST-вызов с таймаутом и авто-повтором после лимит-паузы.
@@ -1257,36 +1257,36 @@ const J = class J {
1257
1257
  * @returns {Promise<{success: boolean, data: any, answer: Object, error: string|null}>}
1258
1258
  */
1259
1259
  async call({ method: e, params: t = {} }) {
1260
- var r, i, a, c, l, h, n;
1260
+ var s, i, a, c, h, f, n;
1261
1261
  for (; ; ) {
1262
- const f = await _(this, Dt, ie).call(this, e, t);
1263
- if (!f) {
1264
- await _(this, Z, nt).call(this, this.callLimitPauseMs);
1262
+ const u = await O(this, wt, oe).call(this, e, t);
1263
+ if (!u) {
1264
+ await O(this, Z, at).call(this, this.callLimitPauseMs);
1265
1265
  continue;
1266
1266
  }
1267
- const m = {};
1268
- if (f != null && f.answer)
1269
- for (const [u, O] of Object.entries(f.answer))
1270
- u !== "result" && O && (m[u] = O);
1271
- if (f.error()) {
1272
- const u = ((i = (r = f.error()) == null ? void 0 : r.ex) == null ? void 0 : i.error) ?? "";
1273
- if (["QUERY_LIMIT_EXCEEDED", "OPERATION_TIME_LIMIT", "TIMEOUT"].includes(u)) {
1274
- await _(this, Z, nt).call(this, this.callLimitPauseMs);
1267
+ const d = {};
1268
+ if (u != null && u.answer)
1269
+ for (const [l, _] of Object.entries(u.answer))
1270
+ l !== "result" && _ && (d[l] = _);
1271
+ if (u.error()) {
1272
+ const l = ((i = (s = u.error()) == null ? void 0 : s.ex) == null ? void 0 : i.error) ?? "";
1273
+ if (["QUERY_LIMIT_EXCEEDED", "OPERATION_TIME_LIMIT", "TIMEOUT"].includes(l)) {
1274
+ await O(this, Z, at).call(this, this.callLimitPauseMs);
1275
1275
  continue;
1276
1276
  }
1277
- const O = ((a = f.error()) == null ? void 0 : a.toString()) || ((l = (c = f.error()) == null ? void 0 : c.ex) == null ? void 0 : l.error_description) || ((n = (h = f.error()) == null ? void 0 : h.ex) == null ? void 0 : n.error) || "Неизвестная ошибка";
1277
+ const _ = ((a = u.error()) == null ? void 0 : a.toString()) || ((h = (c = u.error()) == null ? void 0 : c.ex) == null ? void 0 : h.error_description) || ((n = (f = u.error()) == null ? void 0 : f.ex) == null ? void 0 : n.error) || "Неизвестная ошибка";
1278
1278
  return {
1279
1279
  success: !1,
1280
1280
  data: !1,
1281
- answer: m,
1282
- error: O
1281
+ answer: d,
1282
+ error: _
1283
1283
  };
1284
1284
  }
1285
- let A = f.data();
1285
+ let A = u.data();
1286
1286
  return A != null && A.items && (A = A.items), {
1287
1287
  success: !0,
1288
1288
  data: A,
1289
- answer: m,
1289
+ answer: d,
1290
1290
  error: null
1291
1291
  };
1292
1292
  }
@@ -1297,30 +1297,30 @@ const J = class J {
1297
1297
  * @param {Array/Object} request - Массив/объект методов
1298
1298
  */
1299
1299
  arrayChunk(e) {
1300
- let t = "", r = {};
1301
- if (Array.isArray(e) ? [t] = e : (t = e.method, r = e.params), (t.includes("list") || t === "user.get" || t === "entity.item.get") && t !== "task.item.list") {
1302
- if (!r)
1303
- r = t === "entity.item.get" ? { SORT: { ID: "ASC" } } : {
1300
+ let t = "", s = {};
1301
+ if (Array.isArray(e) ? [t] = e : (t = e.method, s = e.params), (t.includes("list") || t === "user.get" || t === "entity.item.get") && t !== "task.item.list") {
1302
+ if (!s)
1303
+ s = t === "entity.item.get" ? { SORT: { ID: "ASC" } } : {
1304
1304
  order: { ID: "ASC", id: "ASC" }
1305
1305
  };
1306
1306
  else {
1307
- t === "entity.item.get" ? (r.SORT || (r.SORT = { ID: "ASC" }), Array.isArray(r.select) ? r.select.includes("ID") || r.select.push("ID") : r.select = ["ID"]) : t === "tasks.task.list" ? (r.order || (r.order = {}), r.order.ID = "asc") : t === "user.get" ? (r.sort || (r.sort = "ID"), r.order || (r.order = "ASC")) : r.order = { ID: "ASC", id: "ASC" }, Array.isArray(r.select) && !r.select.includes("ID") && r.select.push("ID");
1308
- const i = t === "user.get" || t === "entity.item.get" ? r.FILTER : r.filter;
1307
+ t === "entity.item.get" ? (s.SORT || (s.SORT = { ID: "ASC" }), Array.isArray(s.select) ? s.select.includes("ID") || s.select.push("ID") : s.select = ["ID"]) : t === "tasks.task.list" ? (s.order || (s.order = {}), s.order.ID = "asc") : t === "user.get" ? (s.sort || (s.sort = "ID"), s.order || (s.order = "ASC")) : s.order = { ID: "ASC", id: "ASC" }, Array.isArray(s.select) && !s.select.includes("ID") && s.select.push("ID");
1308
+ const i = t === "user.get" || t === "entity.item.get" ? s.FILTER : s.filter;
1309
1309
  typeof i == "object" && i !== null && !Array.isArray(i) && Object.entries(i).forEach(([a, c]) => {
1310
- (r.start === void 0 || r.start !== -1) && ["id", "ID"].includes(a) && (typeof c == "string" || Array.isArray(c) && c.length <= 50) && (r.start = -1);
1310
+ (s.start === void 0 || s.start !== -1) && ["id", "ID"].includes(a) && (typeof c == "string" || Array.isArray(c) && c.length <= 50) && (s.start = -1);
1311
1311
  });
1312
1312
  }
1313
- t === "crm.type.list" && r.order && delete r.order.ID;
1313
+ t === "crm.type.list" && s.order && delete s.order.ID;
1314
1314
  }
1315
1315
  if (t === "task.item.list")
1316
- if (!r)
1317
- r = [{ ID: "ASC" }, [""], [""], ["ID"]];
1316
+ if (!s)
1317
+ s = [{ ID: "ASC" }, [""], [""], ["ID"]];
1318
1318
  else {
1319
- Array.isArray(r[0]) && (r[0] = {});
1320
- const [i, a, c, l] = r;
1321
- i.ID = "ASC", l[0] !== "" && l.includes("ID") || l.push("ID");
1319
+ Array.isArray(s[0]) && (s[0] = {});
1320
+ const [i, a, c, h] = s;
1321
+ i.ID = "ASC", h[0] !== "" && h.includes("ID") || h.push("ID");
1322
1322
  }
1323
- return { method: t, params: r };
1323
+ return { method: t, params: s };
1324
1324
  }
1325
1325
  /** Выполняет первичный запрос с массивом методов
1326
1326
  * При наличии более 50 элементов в нем, подготоваливаем данные и передаем в this.batchPayload
@@ -1328,44 +1328,44 @@ const J = class J {
1328
1328
  * @param {Array} query - Тот же массив с методами
1329
1329
  * @returns {Object} Объект с результатами запросов
1330
1330
  */
1331
- async batchChunk(e, t, r = !0, i = {}) {
1331
+ async batchChunk(e, t, s = !0, i = {}) {
1332
1332
  return new Promise((a) => {
1333
1333
  const c = [];
1334
- let l;
1335
- const h = !!(i != null && i.disablePagination);
1334
+ let h;
1335
+ const f = !!(i != null && i.disablePagination);
1336
1336
  (async () => {
1337
- await _(this, et, ut).call(this, e, async (f) => {
1338
- var A, u, O, T, E;
1339
- for (const [M, p] of Object.entries(f)) {
1337
+ await O(this, et, ft).call(this, e, async (u) => {
1338
+ var A, l, _, T, E;
1339
+ for (const [M, N] of Object.entries(u)) {
1340
1340
  if (!this.canContinue)
1341
1341
  return;
1342
- if (p.error()) {
1343
- const g = (u = (A = p.error()) == null ? void 0 : A.ex) == null ? void 0 : u.error, C = (T = (O = p.error()) == null ? void 0 : O.ex) == null ? void 0 : T.error_description;
1344
- this.errors[M] = g && g.trim() || C && C.trim() || ((E = p.error()) == null ? void 0 : E.toString()) || "Неизвестная ошибка", l = !0;
1342
+ if (N.error()) {
1343
+ const p = (l = (A = N.error()) == null ? void 0 : A.ex) == null ? void 0 : l.error, C = (T = (_ = N.error()) == null ? void 0 : _.ex) == null ? void 0 : T.error_description;
1344
+ this.errors[M] = p && p.trim() || C && C.trim() || ((E = N.error()) == null ? void 0 : E.toString()) || "Неизвестная ошибка", h = !0;
1345
1345
  }
1346
- const b = this.getData(p.data()), H = Array.isArray(b) ? b.length : 0, N = typeof p.total == "function" && p.total() !== void 0, I = N ? p.total() : H;
1347
- t === "count" ? this.result[M] ? this.result[M] += H : this.result[M] = I : this.result[M] = b, this.setProgressData({ key: M, value: p, type: t });
1348
- const L = e[M], w = Array.isArray(L) ? L[0] : L == null ? void 0 : L.method, k = typeof w == "string" && (w.includes(".list") || w === "user.get" || w === "entity.item.get"), s = t === "count" ? !N && H === this.limit : k ? H === this.limit : I > this.limit && I > H, o = t !== "count" && w === "entity.item.get" && H === this.limit && !s, d = s || o;
1349
- if (!h && (!this.canContinue || d)) {
1350
- let g = e[M];
1351
- if (Array.isArray(g)) {
1352
- const [C, D = {}] = g;
1353
- g = [C, D];
1346
+ const b = this.getData(N.data()), H = Array.isArray(b) ? b.length : 0, y = typeof N.total == "function" && N.total() !== void 0, S = y ? N.total() : H;
1347
+ t === "count" ? this.result[M] ? this.result[M] += H : this.result[M] = S : this.result[M] = b, this.setProgressData({ key: M, value: N, type: t });
1348
+ const R = e[M], B = Array.isArray(R) ? R[0] : R == null ? void 0 : R.method, k = typeof B == "string" && (B.includes(".list") || B === "user.get" || B === "entity.item.get"), r = t === "count" ? !y && H === this.limit : k ? H === this.limit : S > this.limit && S > H, o = t !== "count" && B === "entity.item.get" && H === this.limit && !r, m = r || o;
1349
+ if (!f && (!this.canContinue || m)) {
1350
+ let p = e[M];
1351
+ if (Array.isArray(p)) {
1352
+ const [C, D = {}] = p;
1353
+ p = [C, D];
1354
1354
  } else {
1355
- const { method: C, params: D = {} } = g;
1356
- g = [C, D];
1355
+ const { method: C, params: D = {} } = p;
1356
+ p = [C, D];
1357
1357
  }
1358
1358
  c.push([
1359
1359
  M,
1360
- g,
1361
- I,
1360
+ p,
1361
+ S,
1362
1362
  { entityItemGetScan: o }
1363
1363
  ]);
1364
1364
  }
1365
1365
  }
1366
- l > 0 && this.errorLogger();
1367
- const m = c.length > 0 || r;
1368
- await _(this, tt, ht).call(this, f, m), c.length ? await this.batchPayload(c, t, i).then(
1366
+ h > 0 && this.errorLogger();
1367
+ const d = c.length > 0 || s;
1368
+ await O(this, tt, ut).call(this, u, d), c.length ? await this.batchPayload(c, t, i).then(
1369
1369
  () => a(this.result)
1370
1370
  ) : a(this.result);
1371
1371
  });
@@ -1377,100 +1377,100 @@ const J = class J {
1377
1377
  * @param {String} type - Тип обработки результатов ('count' или undefined)
1378
1378
  * @param {{oneBatch?: boolean}} [options] - Опции выполнения payload.
1379
1379
  */
1380
- async batchPayload(e, t, r = {}) {
1381
- const i = !!(r != null && r.oneBatch), a = (O, T, E, M) => {
1382
- let p = "ID";
1383
- this.result[O][this.result[O].length - 1].ID || (p = "id");
1384
- let b = `${p}`;
1380
+ async batchPayload(e, t, s = {}) {
1381
+ const i = !!(s != null && s.oneBatch), a = (_, T, E, M) => {
1382
+ let N = "ID";
1383
+ this.result[_][this.result[_].length - 1].ID || (N = "id");
1384
+ let b = `${N}`;
1385
1385
  if (JSON.stringify(M[1]).toLocaleLowerCase().includes('"id":"desc"') ? b = "<" + b : b = ">" + b, T === 1 || E.length === 0)
1386
1386
  return {
1387
1387
  field: b,
1388
- id: this.result[O][this.result[O].length - 1][p]
1388
+ id: this.result[_][this.result[_].length - 1][N]
1389
1389
  };
1390
- let N = "";
1391
- const [I, L] = M;
1392
- return (I === "tasks.task.list" || I === "task.item.list") && (N = "[tasks]"), ["crm.item.list", "crm.stagehistory.list"].includes(I) && (N = "[items]"), I === "crm.type.list" && (N = "[types]"), I === "socialnetwork.api.workgroup.list" && (N = "[workgroups]"), {
1390
+ let y = "";
1391
+ const [S, R] = M;
1392
+ return (S === "tasks.task.list" || S === "task.item.list") && (y = "[tasks]"), ["crm.item.list", "crm.stagehistory.list"].includes(S) && (y = "[items]"), S === "crm.type.list" && (y = "[types]"), S === "socialnetwork.api.workgroup.list" && (y = "[workgroups]"), {
1393
1393
  field: b,
1394
- id: `$result[${[O, T - 1].join("__")}]${N}[49][${p}]`
1394
+ id: `$result[${[_, T - 1].join("__")}]${y}[49][${N}]`
1395
1395
  };
1396
- }, c = (O, T) => {
1397
- const [E, M] = O;
1398
- let p = JSON.parse(JSON.stringify(M)), b;
1396
+ }, c = (_, T) => {
1397
+ const [E, M] = _;
1398
+ let N = JSON.parse(JSON.stringify(M)), b;
1399
1399
  if (E === "task.item.list") {
1400
- p = [...p];
1401
- const [H, N, I, L] = p;
1402
- return N[T.field] = T.id, [E, p];
1400
+ N = [...N];
1401
+ const [H, y, S, R] = N;
1402
+ return y[T.field] = T.id, [E, N];
1403
1403
  }
1404
- return ["user.get"].includes(E) || p.FILTER ? (p.FILTER || (p.FILTER = {}), b = p.FILTER) : (p.filter || (p.filter = {}), b = p.filter), [
1404
+ return ["user.get"].includes(E) || N.FILTER ? (N.FILTER || (N.FILTER = {}), b = N.FILTER) : (N.filter || (N.filter = {}), b = N.filter), [
1405
1405
  "socialnetwork.api.workgroup.list",
1406
1406
  "tasks.task.list"
1407
- ].includes(E) ? b[">ID"] = T.id : b[T.field] = T.id, [E, { ...p, start: -1 }];
1408
- }, l = (O) => {
1409
- Object.entries(O).forEach(([T, E]) => {
1410
- var b, H, N, I, L;
1411
- const [M] = T.split("__"), p = this.getData(E.data());
1412
- if (Array.isArray(p) && (t === "count" ? this.result[M] += p.length : this.result[M].push(...p)), E.error()) {
1413
- const w = (H = (b = E.error()) == null ? void 0 : b.ex) == null ? void 0 : H.error, k = (I = (N = E.error()) == null ? void 0 : N.ex) == null ? void 0 : I.error_description;
1414
- this.errors[M] = w && w.trim() || k && k.trim() || ((L = E.error()) == null ? void 0 : L.toString()) || "Неизвестная ошибка";
1407
+ ].includes(E) ? b[">ID"] = T.id : b[T.field] = T.id, [E, { ...N, start: -1 }];
1408
+ }, h = (_) => {
1409
+ Object.entries(_).forEach(([T, E]) => {
1410
+ var b, H, y, S, R;
1411
+ const [M] = T.split("__"), N = this.getData(E.data());
1412
+ if (Array.isArray(N) && (t === "count" ? this.result[M] += N.length : this.result[M].push(...N)), E.error()) {
1413
+ const B = (H = (b = E.error()) == null ? void 0 : b.ex) == null ? void 0 : H.error, k = (S = (y = E.error()) == null ? void 0 : y.ex) == null ? void 0 : S.error_description;
1414
+ this.errors[M] = B && B.trim() || k && k.trim() || ((R = E.error()) == null ? void 0 : R.toString()) || "Неизвестная ошибка";
1415
1415
  }
1416
1416
  this.setProgressData({ key: M, value: E, type: t });
1417
1417
  });
1418
- }, h = (O, T) => {
1419
- if (!Array.isArray(O) || O.length === 0)
1418
+ }, f = (_, T) => {
1419
+ if (!Array.isArray(_) || _.length === 0)
1420
1420
  return null;
1421
- const E = O[O.length - 1];
1421
+ const E = _[_.length - 1];
1422
1422
  let M = "ID";
1423
1423
  E.ID || (M = "id");
1424
- let p = M;
1425
- return JSON.stringify(T[1]).toLocaleLowerCase().includes('"id":"desc"') ? p = "<" + p : p = ">" + p, { field: p, id: E[M] };
1426
- }, n = 1e4, f = async (O, T) => {
1427
- var M, p;
1424
+ let N = M;
1425
+ return JSON.stringify(T[1]).toLocaleLowerCase().includes('"id":"desc"') ? N = "<" + N : N = ">" + N, { field: N, id: E[M] };
1426
+ }, n = 1e4, u = async (_, T) => {
1427
+ var M, N;
1428
1428
  let E = this.limit;
1429
1429
  for (let b = 1; this.canContinue && E === this.limit && b <= n; b++) {
1430
- const H = this.result[O], N = h(H, T);
1431
- if (!N)
1430
+ const H = this.result[_], y = f(H, T);
1431
+ if (!y)
1432
1432
  break;
1433
- const I = `${O}__eiscan_${b}`, L = c(T, N);
1434
- let w = null;
1435
- await _(this, et, ut).call(this, { [I]: L }, async (d) => {
1436
- w = d, l(d);
1433
+ const S = `${_}__eiscan_${b}`, R = c(T, y);
1434
+ let B = null;
1435
+ await O(this, et, ft).call(this, { [S]: R }, async (m) => {
1436
+ B = m, h(m);
1437
1437
  });
1438
1438
  const k = b < n;
1439
- await _(this, tt, ht).call(this, w, k), await this.delay();
1440
- const s = w == null ? void 0 : w[I];
1441
- if ((M = s == null ? void 0 : s.error) != null && M.call(s)) {
1439
+ await O(this, tt, ut).call(this, B, k), await this.delay();
1440
+ const r = B == null ? void 0 : B[S];
1441
+ if ((M = r == null ? void 0 : r.error) != null && M.call(r)) {
1442
1442
  E = 0;
1443
1443
  break;
1444
1444
  }
1445
- const o = this.getData((p = s == null ? void 0 : s.data) == null ? void 0 : p.call(s));
1445
+ const o = this.getData((N = r == null ? void 0 : r.data) == null ? void 0 : N.call(r));
1446
1446
  E = Array.isArray(o) ? o.length : 0;
1447
1447
  }
1448
1448
  };
1449
- let m = [], A = 0;
1450
- const u = async (O = !0) => m.length ? (await _(this, et, ut).call(this, Object.fromEntries(m), async (T) => {
1451
- l(T), await _(this, tt, ht).call(this, T, O);
1452
- }), A++, m = [], i && A >= 1 ? !0 : (await this.delay(), !1)) : !1;
1453
- for await (const O of e) {
1449
+ let d = [], A = 0;
1450
+ const l = async (_ = !0) => d.length ? (await O(this, et, ft).call(this, Object.fromEntries(d), async (T) => {
1451
+ h(T), await O(this, tt, ut).call(this, T, _);
1452
+ }), A++, d = [], i && A >= 1 ? !0 : (await this.delay(), !1)) : !1;
1453
+ for await (const _ of e) {
1454
1454
  if (!this.canContinue)
1455
1455
  return;
1456
- const [T, E, M, p = {}] = O;
1457
- if (p.entityItemGetScan) {
1458
- if (await u(!0))
1456
+ const [T, E, M, N = {}] = _;
1457
+ if (N.entityItemGetScan) {
1458
+ if (await l(!0))
1459
1459
  return;
1460
1460
  if (i)
1461
1461
  continue;
1462
- await f(T, E);
1462
+ await u(T, E);
1463
1463
  continue;
1464
1464
  }
1465
1465
  let b = 1;
1466
1466
  for (; M > b * this.limit; ) {
1467
- const H = [T, b].join("__"), N = a(T, b, m, E);
1468
- if (m.push([H, c(E, N)]), i && m.length === 49 && await u(!0) || m.length % 50 === 0 && await u(!0))
1467
+ const H = [T, b].join("__"), y = a(T, b, d, E);
1468
+ if (d.push([H, c(E, y)]), i && d.length === 49 && await l(!0) || d.length % 50 === 0 && await l(!0))
1469
1469
  return;
1470
1470
  b++;
1471
1471
  }
1472
1472
  }
1473
- await u(!1);
1473
+ await l(!1);
1474
1474
  }
1475
1475
  /**
1476
1476
  * Вывод ошибок в консоль в группированном виде
@@ -1481,29 +1481,29 @@ const J = class J {
1481
1481
  }), console.groupEnd();
1482
1482
  }
1483
1483
  };
1484
- Et = new WeakSet(), ee = function() {
1484
+ Lt = new WeakSet(), ie = function() {
1485
1485
  const e = this.totalBatchCommands || 0, t = this.batchCommandMethods;
1486
- if (e < S(J, bt) || !Array.isArray(t) || t.length !== e)
1486
+ if (e < I(J, Rt) || !Array.isArray(t) || t.length !== e)
1487
1487
  return !1;
1488
- if (t.filter((a) => a === "crm.deal.list").length >= S(J, Lt))
1488
+ if (t.filter((a) => a === "crm.deal.list").length >= I(J, Mt))
1489
1489
  return !0;
1490
1490
  const i = t.filter(
1491
1491
  (a) => typeof a == "string" && a.includes(".list")
1492
1492
  ).length;
1493
- return i >= S(J, Rt) && i / e >= S(J, Mt);
1494
- }, bt = new WeakMap(), Lt = new WeakMap(), Rt = new WeakMap(), Mt = new WeakMap(), ot = new WeakSet(), _t = function() {
1493
+ return i >= I(J, St) && i / e >= I(J, It);
1494
+ }, Rt = new WeakMap(), Mt = new WeakMap(), St = new WeakMap(), It = new WeakMap(), At = new WeakSet(), Et = function() {
1495
1495
  if (!this.progressCall || !this.progressData)
1496
1496
  return;
1497
- const { percent: e, allCount: t, allTotal: r } = this.progressPercent, i = { percent: e, allCount: t, allTotal: r };
1498
- _(this, It, se).call(this, i) && (this.progressCall({
1497
+ const { percent: e, allCount: t, allTotal: s } = this.progressPercent, i = { percent: e, allCount: t, allTotal: s };
1498
+ O(this, Dt, ne).call(this, i) && (this.progressCall({
1499
1499
  data: this.progressData,
1500
1500
  percent: e,
1501
1501
  allCount: t,
1502
- allTotal: r
1502
+ allTotal: s
1503
1503
  }), this.lastProgressSnapshot = i);
1504
- }, It = new WeakSet(), se = function(e) {
1504
+ }, Dt = new WeakSet(), ne = function(e) {
1505
1505
  return this.lastProgressSnapshot ? this.lastProgressSnapshot.percent !== e.percent || this.lastProgressSnapshot.allCount !== e.allCount || this.lastProgressSnapshot.allTotal !== e.allTotal : !0;
1506
- }, St = new WeakSet(), re = function() {
1506
+ }, kt = new WeakSet(), ae = function() {
1507
1507
  const e = {
1508
1508
  limit: this.timeLimit.limit,
1509
1509
  date: this.timeLimit.date,
@@ -1512,15 +1512,15 @@ Et = new WeakSet(), ee = function() {
1512
1512
  for (const t of this.timeLimitListeners)
1513
1513
  try {
1514
1514
  t(e);
1515
- } catch (r) {
1516
- console.warn("Batch timeLimit listener error:", r);
1515
+ } catch (s) {
1516
+ console.warn("Batch timeLimit listener error:", s);
1517
1517
  }
1518
- }, Z = new WeakSet(), nt = async function(e = this.defaultPauseMs) {
1518
+ }, Z = new WeakSet(), at = async function(e = this.defaultPauseMs) {
1519
1519
  this.setTimeLimitState(!0, (/* @__PURE__ */ new Date()).toISOString(), e), await new Promise((t) => setTimeout(t, e)), this.setTimeLimitState(!1, void 0);
1520
- }, tt = new WeakSet(), ht = async function(e, t = !0) {
1520
+ }, tt = new WeakSet(), ut = async function(e, t = !0) {
1521
1521
  if (!t)
1522
1522
  return 0;
1523
- let r = 0;
1523
+ let s = 0;
1524
1524
  if (!e || typeof e != "object")
1525
1525
  return 0;
1526
1526
  for (const i of Object.values(e))
@@ -1528,75 +1528,75 @@ Et = new WeakSet(), ee = function() {
1528
1528
  try {
1529
1529
  if (typeof i.time == "function") {
1530
1530
  const a = i.time();
1531
- a && typeof a.operating == "number" && (r = Math.max(r, a.operating));
1531
+ a && typeof a.operating == "number" && (s = Math.max(s, a.operating));
1532
1532
  }
1533
1533
  } catch {
1534
1534
  }
1535
- r >= this.operatingThreshold && await _(this, Z, nt).call(this);
1536
- }, et = new WeakSet(), ut = async function(e, t) {
1537
- let r = !1, i = e;
1535
+ s >= this.operatingThreshold && await O(this, Z, at).call(this);
1536
+ }, et = new WeakSet(), ft = async function(e, t) {
1537
+ let s = !1, i = e;
1538
1538
  do
1539
- r = !1, await this.callBatchWithTimeout(i, async (a) => {
1540
- var h, n;
1539
+ s = !1, await this.callBatchWithTimeout(i, async (a) => {
1540
+ var f, n;
1541
1541
  let c = !1;
1542
- const l = /* @__PURE__ */ new Set();
1543
- for (const [f, m] of Object.entries(a || {})) {
1544
- if (!(m != null && m.error) || !m.error())
1542
+ const h = /* @__PURE__ */ new Set();
1543
+ for (const [u, d] of Object.entries(a || {})) {
1544
+ if (!(d != null && d.error) || !d.error())
1545
1545
  continue;
1546
- const A = ((n = (h = m.error()) == null ? void 0 : h.ex) == null ? void 0 : n.error) ?? "";
1546
+ const A = ((n = (f = d.error()) == null ? void 0 : f.ex) == null ? void 0 : n.error) ?? "";
1547
1547
  if (A === "TIMEOUT") {
1548
1548
  c = !0;
1549
1549
  break;
1550
1550
  }
1551
- ["QUERY_LIMIT_EXCEEDED", "OPERATION_TIME_LIMIT"].includes(A) && l.add(f);
1551
+ ["QUERY_LIMIT_EXCEEDED", "OPERATION_TIME_LIMIT"].includes(A) && h.add(u);
1552
1552
  }
1553
1553
  if (c) {
1554
- r = !0, await _(this, Z, nt).call(this);
1554
+ s = !0, await O(this, Z, at).call(this);
1555
1555
  return;
1556
1556
  }
1557
- if (l.size > 0) {
1558
- const f = {};
1559
- for (const [A, u] of Object.entries(a || {}))
1560
- l.has(A) || (f[A] = u);
1561
- Object.keys(f).length && await t(f);
1562
- const m = {};
1563
- for (const A of l)
1564
- i[A] && (m[A] = i[A]);
1565
- i = m, Object.keys(i).length && (r = !0, await _(this, Z, nt).call(this));
1557
+ if (h.size > 0) {
1558
+ const u = {};
1559
+ for (const [A, l] of Object.entries(a || {}))
1560
+ h.has(A) || (u[A] = l);
1561
+ Object.keys(u).length && await t(u);
1562
+ const d = {};
1563
+ for (const A of h)
1564
+ i[A] && (d[A] = i[A]);
1565
+ i = d, Object.keys(i).length && (s = !0, await O(this, Z, at).call(this));
1566
1566
  return;
1567
1567
  }
1568
1568
  await t(a);
1569
1569
  });
1570
- while (r);
1571
- }, Dt = new WeakSet(), ie = function(e, t) {
1572
- return new Promise((r) => {
1570
+ while (s);
1571
+ }, wt = new WeakSet(), oe = function(e, t) {
1572
+ return new Promise((s) => {
1573
1573
  if (typeof this.callMethod != "function") {
1574
- r(null);
1574
+ s(null);
1575
1575
  return;
1576
1576
  }
1577
1577
  let i = !1;
1578
1578
  const a = setTimeout(() => {
1579
- i || (i = !0, r(null));
1579
+ i || (i = !0, s(null));
1580
1580
  }, this.requestTimeoutMs);
1581
1581
  try {
1582
1582
  this.callMethod(e, t, (c) => {
1583
- i || (i = !0, clearTimeout(a), r(c));
1583
+ i || (i = !0, clearTimeout(a), s(c));
1584
1584
  });
1585
1585
  } catch {
1586
- i || (i = !0, clearTimeout(a), r(null));
1586
+ i || (i = !0, clearTimeout(a), s(null));
1587
1587
  }
1588
1588
  });
1589
- }, ft = new WeakSet(), jt = function(e) {
1589
+ }, mt = new WeakSet(), zt = function(e) {
1590
1590
  this.clearProgressData(), this.progressCall = typeof e == "function" ? e : "", this.canContinue = !0, this.result = {}, this.errors = {}, this.chunkRate = 1, this.totalProgress = 0, this.batchCommandKeyOrder = [], this.totalBatchCommands = 0, this.batchCommandMethods = [], this.setTimeLimitState(!1, void 0);
1591
1591
  }, /** Не включать вес по командам для совсем маленьких batch. */
1592
- R(J, bt, 5), /** Явный сигнал: много отдельных выборок сделок по фильтрам. */
1593
- R(J, Lt, 5), /** Достаточно «list»-методов в пачке и доля list от всех команд. */
1594
- R(J, Rt, 8), R(J, Mt, 0.65);
1592
+ L(J, Rt, 5), /** Явный сигнал: много отдельных выборок сделок по фильтрам. */
1593
+ L(J, Mt, 5), /** Достаточно «list»-методов в пачке и доля list от всех команд. */
1594
+ L(J, St, 8), L(J, It, 0.65);
1595
1595
  let K = J;
1596
- var st;
1597
- class ne {
1596
+ var rt;
1597
+ class Ae {
1598
1598
  constructor() {
1599
- R(this, st, {});
1599
+ L(this, rt, {});
1600
1600
  }
1601
1601
  /**
1602
1602
  * Получить случайный хеш-код длиной 8 символов
@@ -1611,11 +1611,11 @@ class ne {
1611
1611
  * @returns {string}
1612
1612
  */
1613
1613
  createHash(e) {
1614
- let t = "abcdefghijklmnopqrstuvwxyz0123456789", r = "";
1614
+ let t = "abcdefghijklmnopqrstuvwxyz0123456789", s = "";
1615
1615
  e = e || 6;
1616
1616
  for (let i = 0; i < e; i++)
1617
- r += t.charAt(Math.floor(Math.random() * t.length));
1618
- return r;
1617
+ s += t.charAt(Math.floor(Math.random() * t.length));
1618
+ return s;
1619
1619
  }
1620
1620
  /**
1621
1621
  * Фильтр часто запускаемых действий (debounce)
@@ -1624,9 +1624,9 @@ class ne {
1624
1624
  * @param {number} params.duration - Задержка в миллисекундах (по умолчанию 10)
1625
1625
  * @param {Function} params.action - Функция для выполнения
1626
1626
  */
1627
- actionFilter({ keyTimer: e, duration: t = 10, action: r }) {
1628
- S(this, st)[e] && (clearTimeout(S(this, st)[e]), S(this, st)[e] = null), r && (S(this, st)[e] = setTimeout(() => {
1629
- r();
1627
+ actionFilter({ keyTimer: e, duration: t = 10, action: s }) {
1628
+ I(this, rt)[e] && (clearTimeout(I(this, rt)[e]), I(this, rt)[e] = null), s && (I(this, rt)[e] = setTimeout(() => {
1629
+ s();
1630
1630
  }, t));
1631
1631
  }
1632
1632
  /**
@@ -1657,37 +1657,37 @@ class ne {
1657
1657
  * @param {string} filename - Имя файла без расширения
1658
1658
  */
1659
1659
  downloadFileJson(e, t) {
1660
- let r = new Blob([JSON.stringify(e)], { type: "application/json" }), i = URL.createObjectURL(r), a = document.createElement("a");
1660
+ let s = new Blob([JSON.stringify(e)], { type: "application/json" }), i = URL.createObjectURL(s), a = document.createElement("a");
1661
1661
  a.style.display = "none", a.href = i, a.download = `${t}.json`, document.body.appendChild(a), a.click(), setTimeout(() => {
1662
1662
  document.body.removeChild(a), URL.revokeObjectURL(i);
1663
1663
  }, 200);
1664
1664
  }
1665
1665
  }
1666
- st = new WeakMap();
1667
- const vt = new ne();
1668
- var j, z, rt, At, dt, V, v, it, ct, kt, ae, mt, Kt, wt, oe, Bt, Ae, Ct, ce;
1669
- class be {
1666
+ rt = new WeakMap();
1667
+ const jt = new Ae();
1668
+ var j, z, st, ct, gt, V, v, it, lt, Bt, ce, pt, Qt, Ct, le, Ht, he, Ut, ue;
1669
+ class Se {
1670
1670
  constructor() {
1671
1671
  /** user.current — только при первом реальном использовании (сохранение лога, выгрузка). */
1672
- R(this, kt);
1672
+ L(this, Bt);
1673
1673
  /** Вывод ошибок логера
1674
1674
  * @param {'entity'} type - тип ошибки
1675
1675
  */
1676
- R(this, mt);
1677
- R(this, wt);
1678
- R(this, Bt);
1679
- R(this, Ct);
1680
- R(this, j, "logger");
1681
- R(this, z, !1);
1682
- R(this, rt, /* @__PURE__ */ new Map());
1683
- R(this, At, {});
1684
- R(this, dt, !1);
1685
- R(this, V, null);
1686
- R(this, v, null);
1687
- R(this, it, !1);
1688
- R(this, ct, !1);
1676
+ L(this, pt);
1677
+ L(this, Ct);
1678
+ L(this, Ht);
1679
+ L(this, Ut);
1680
+ L(this, j, "logger");
1681
+ L(this, z, !1);
1682
+ L(this, st, /* @__PURE__ */ new Map());
1683
+ L(this, ct, {});
1684
+ L(this, gt, !1);
1685
+ L(this, V, null);
1686
+ L(this, v, null);
1687
+ L(this, it, !1);
1688
+ L(this, lt, !1);
1689
1689
  /** Очистка хранилища элементов старше 'N' месяцев */
1690
- B(this, "periodClear", 3);
1690
+ w(this, "periodClear", 3);
1691
1691
  }
1692
1692
  /** Инициализация логера */
1693
1693
  async init() {
@@ -1697,7 +1697,7 @@ class be {
1697
1697
  });
1698
1698
  if (t && Array.isArray(t))
1699
1699
  if (t.find(
1700
- (i) => i.ENTITY == S(this, j)
1700
+ (i) => i.ENTITY == I(this, j)
1701
1701
  ))
1702
1702
  x(this, z, !0);
1703
1703
  else {
@@ -1705,15 +1705,15 @@ class be {
1705
1705
  entityAdd: {
1706
1706
  method: "entity.add",
1707
1707
  params: {
1708
- ENTITY: S(this, j),
1709
- NAME: S(this, j),
1708
+ ENTITY: I(this, j),
1709
+ NAME: I(this, j),
1710
1710
  ACCESS: { AU: "X" }
1711
1711
  }
1712
1712
  }
1713
1713
  });
1714
1714
  i && x(this, z, !0);
1715
1715
  }
1716
- return S(this, z);
1716
+ return I(this, z);
1717
1717
  } catch (e) {
1718
1718
  return console.error("Ошибка при инициализации логера:", e), !1;
1719
1719
  }
@@ -1735,11 +1735,11 @@ class be {
1735
1735
  * @returns {string|null}
1736
1736
  */
1737
1737
  start({ type: e, data: t }) {
1738
- if (!S(this, z))
1739
- return _(this, mt, Kt).call(this, "entity"), null;
1738
+ if (!I(this, z))
1739
+ return O(this, pt, Qt).call(this, "entity"), null;
1740
1740
  if (!e || !t)
1741
1741
  return console.error("Невалидные данные для логирования:", { type: e, data: t }), null;
1742
- const r = vt.hash, i = {
1742
+ const s = jt.hash, i = {
1743
1743
  type: e,
1744
1744
  data: t,
1745
1745
  userInfo: null,
@@ -1748,7 +1748,7 @@ class be {
1748
1748
  answer: null,
1749
1749
  date: (/* @__PURE__ */ new Date()).getTime()
1750
1750
  };
1751
- return S(this, rt).set(r, i), x(this, ct, !0), r;
1751
+ return I(this, st).set(s, i), x(this, lt, !0), s;
1752
1752
  }
1753
1753
  /**
1754
1754
  * @param {{
@@ -1757,20 +1757,20 @@ class be {
1757
1757
  * status: 'success'|'fail'|'fail-runtime',
1758
1758
  * answer: { [key]: unknown } }}
1759
1759
  */
1760
- async stop({ key: e, errorList: t, status: r, answer: i }) {
1760
+ async stop({ key: e, errorList: t, status: s, answer: i }) {
1761
1761
  var c;
1762
- if (!S(this, ct))
1762
+ if (!I(this, lt))
1763
1763
  return;
1764
- if (!S(this, z)) {
1765
- _(this, mt, Kt).call(this, "entity");
1764
+ if (!I(this, z)) {
1765
+ O(this, pt, Qt).call(this, "entity");
1766
1766
  return;
1767
1767
  }
1768
- let a = S(this, rt).get(e);
1768
+ let a = I(this, st).get(e);
1769
1769
  if (!a) {
1770
1770
  console.error(`Не найдены данные логирования для ключа: ${e}`);
1771
1771
  return;
1772
1772
  }
1773
- t && (a.errorList = t), r && (a.status = r), i && (a.answer = i), await _(this, kt, ae).call(this), a.userInfo = S(this, At), await _(this, wt, oe).call(this), (c = a == null ? void 0 : a.data) != null && c.updateList && x(this, it, !0), x(this, ct, !1);
1773
+ t && (a.errorList = t), s && (a.status = s), i && (a.answer = i), await O(this, Bt, ce).call(this), a.userInfo = I(this, ct), await O(this, Ct, le).call(this), (c = a == null ? void 0 : a.data) != null && c.updateList && x(this, it, !0), x(this, lt, !1);
1774
1774
  }
1775
1775
  /**
1776
1776
  * @param { ({percent}:{percent:number})=>{} } progressCall - коллбэк
@@ -1778,14 +1778,14 @@ class be {
1778
1778
  async getEntityList(e) {
1779
1779
  var t;
1780
1780
  try {
1781
- if ((t = S(this, v)) != null && t.length && !S(this, it))
1782
- return S(this, v);
1783
- let r = new K(BX24.callBatch), { entityList: i } = await r.batch(
1781
+ if ((t = I(this, v)) != null && t.length && !I(this, it))
1782
+ return I(this, v);
1783
+ let s = new K(BX24.callBatch), { entityList: i } = await s.batch(
1784
1784
  {
1785
1785
  entityList: {
1786
1786
  method: "entity.item.get",
1787
1787
  params: {
1788
- ENTITY: S(this, j),
1788
+ ENTITY: I(this, j),
1789
1789
  SORT: { ID: "DESC" }
1790
1790
  }
1791
1791
  }
@@ -1794,11 +1794,11 @@ class be {
1794
1794
  );
1795
1795
  return !i || !Array.isArray(i) ? (console.warn("Получен невалидный список записей"), []) : (i = i.map((a) => {
1796
1796
  try {
1797
- const { ID: c, DATE_CREATE: l, DETAIL_TEXT: h } = a;
1797
+ const { ID: c, DATE_CREATE: h, DETAIL_TEXT: f } = a;
1798
1798
  return {
1799
- ...JSON.parse(h),
1799
+ ...JSON.parse(f),
1800
1800
  id: c,
1801
- dateCreate: l
1801
+ dateCreate: h
1802
1802
  };
1803
1803
  } catch (c) {
1804
1804
  return console.error(
@@ -1807,8 +1807,8 @@ class be {
1807
1807
  ), null;
1808
1808
  }
1809
1809
  }).filter((a) => a !== null), x(this, it, !1), x(this, v, i), i);
1810
- } catch (r) {
1811
- return console.error("Ошибка при получении списка записей:", r), [];
1810
+ } catch (s) {
1811
+ return console.error("Ошибка при получении списка записей:", s), [];
1812
1812
  }
1813
1813
  }
1814
1814
  /**
@@ -1816,16 +1816,16 @@ class be {
1816
1816
  * Не вызывается из `init` — вызывайте явно (например, из настроек или планировщика).
1817
1817
  */
1818
1818
  runStorageMaintenance() {
1819
- return _(this, Bt, Ae).call(this);
1819
+ return O(this, Ht, he).call(this);
1820
1820
  }
1821
1821
  /** Выгрузка всех данных из хранилища в JSON-файл */
1822
1822
  async downAllEntityJson() {
1823
1823
  try {
1824
- if (S(this, v) || await this.getEntityList(), !S(this, v) || S(this, v).length === 0)
1824
+ if (I(this, v) || await this.getEntityList(), !I(this, v) || I(this, v).length === 0)
1825
1825
  return console.warn("Нет данных для выгрузки"), !1;
1826
- let e = Ot().format("%Y-%m-%d");
1827
- return vt.downloadFileJson(
1828
- S(this, v),
1826
+ let e = Tt().format("%Y-%m-%d");
1827
+ return jt.downloadFileJson(
1828
+ I(this, v),
1829
1829
  `sdklogger-entity-data__${e}`
1830
1830
  ), !0;
1831
1831
  } catch (e) {
@@ -1833,57 +1833,57 @@ class be {
1833
1833
  }
1834
1834
  }
1835
1835
  }
1836
- j = new WeakMap(), z = new WeakMap(), rt = new WeakMap(), At = new WeakMap(), dt = new WeakMap(), V = new WeakMap(), v = new WeakMap(), it = new WeakMap(), ct = new WeakMap(), kt = new WeakSet(), ae = async function() {
1837
- if (!S(this, dt))
1838
- return S(this, V) ? S(this, V) : (x(this, V, (async () => {
1836
+ j = new WeakMap(), z = new WeakMap(), st = new WeakMap(), ct = new WeakMap(), gt = new WeakMap(), V = new WeakMap(), v = new WeakMap(), it = new WeakMap(), lt = new WeakMap(), Bt = new WeakSet(), ce = async function() {
1837
+ if (!I(this, gt))
1838
+ return I(this, V) ? I(this, V) : (x(this, V, (async () => {
1839
1839
  try {
1840
- const e = new K(BX24.callBatch), t = BX24.isAdmin(), { curUser: r } = await e.batch({
1840
+ const e = new K(BX24.callBatch), t = BX24.isAdmin(), { curUser: s } = await e.batch({
1841
1841
  curUser: { method: "user.current" }
1842
1842
  });
1843
- x(this, At, { isAdmin: t, curUser: r });
1843
+ x(this, ct, { isAdmin: t, curUser: s });
1844
1844
  } catch (e) {
1845
1845
  console.error(
1846
1846
  "Ошибка при получении информации о пользователе:",
1847
1847
  e
1848
- ), x(this, At, { isAdmin: !1, curUser: null });
1848
+ ), x(this, ct, { isAdmin: !1, curUser: null });
1849
1849
  } finally {
1850
- x(this, dt, !0), x(this, V, null);
1850
+ x(this, gt, !0), x(this, V, null);
1851
1851
  }
1852
- })()), S(this, V));
1853
- }, mt = new WeakSet(), Kt = function(e) {
1854
- e == "entity" && vt.actionFilter({
1852
+ })()), I(this, V));
1853
+ }, pt = new WeakSet(), Qt = function(e) {
1854
+ e == "entity" && jt.actionFilter({
1855
1855
  keyTimer: "error.logger.entity",
1856
1856
  duration: 500,
1857
1857
  action: () => {
1858
1858
  console.error("Хранилище для логгера не инициализировано");
1859
1859
  }
1860
1860
  });
1861
- }, wt = new WeakSet(), oe = async function() {
1861
+ }, Ct = new WeakSet(), le = async function() {
1862
1862
  try {
1863
1863
  let e = {}, t = new K(BX24.callBatch);
1864
- for (let [r, i] of S(this, rt).entries())
1864
+ for (let [s, i] of I(this, st).entries())
1865
1865
  if (i.status) {
1866
1866
  const a = JSON.stringify(i);
1867
- e[r] = {
1867
+ e[s] = {
1868
1868
  method: "entity.item.add",
1869
1869
  params: {
1870
- ENTITY: S(this, j),
1871
- NAME: S(this, j),
1870
+ ENTITY: I(this, j),
1871
+ NAME: I(this, j),
1872
1872
  DETAIL_TEXT: a
1873
1873
  }
1874
1874
  };
1875
1875
  }
1876
1876
  if (Object.keys(e).length) {
1877
- let r = await t.batch(e), { errors: i } = t;
1878
- for (let [a, c] of Object.entries({ ...r, ...i }))
1879
- S(this, rt).delete(a);
1877
+ let s = await t.batch(e), { errors: i } = t;
1878
+ for (let [a, c] of Object.entries({ ...s, ...i }))
1879
+ I(this, st).delete(a);
1880
1880
  return !0;
1881
1881
  }
1882
1882
  return !1;
1883
1883
  } catch (e) {
1884
1884
  return console.error("Ошибка при добавлении записей в хранилище:", e), !1;
1885
1885
  }
1886
- }, Bt = new WeakSet(), Ae = async function() {
1886
+ }, Ht = new WeakSet(), he = async function() {
1887
1887
  try {
1888
1888
  let e = new K(BX24.callBatch), { serverTime: t } = await e.batch({
1889
1889
  serverTime: { method: "server.time" }
@@ -1892,77 +1892,77 @@ j = new WeakMap(), z = new WeakMap(), rt = new WeakMap(), At = new WeakMap(), dt
1892
1892
  console.error("Не удалось получить время сервера");
1893
1893
  return;
1894
1894
  }
1895
- if (S(this, v) || await this.getEntityList(), !S(this, v) || S(this, v).length === 0)
1895
+ if (I(this, v) || await this.getEntityList(), !I(this, v) || I(this, v).length === 0)
1896
1896
  return;
1897
- let r = S(this, v).filter((i) => {
1897
+ let s = I(this, v).filter((i) => {
1898
1898
  try {
1899
1899
  let { dateCreate: a } = i;
1900
- return a ? Ot(new Date(a)).between(
1901
- Ot(new Date(t)),
1900
+ return a ? Tt(new Date(a)).between(
1901
+ Tt(new Date(t)),
1902
1902
  "month"
1903
1903
  ) >= this.periodClear : !1;
1904
1904
  } catch (a) {
1905
1905
  return console.error("Ошибка при проверке даты записи:", a), !1;
1906
1906
  }
1907
1907
  });
1908
- r.length > 0 && (console.log(
1909
- `Найдено ${r.length} записей для очистки (старше ${this.periodClear} месяцев)`
1910
- ), await _(this, Ct, ce).call(this, r));
1908
+ s.length > 0 && (console.log(
1909
+ `Найдено ${s.length} записей для очистки (старше ${this.periodClear} месяцев)`
1910
+ ), await O(this, Ut, ue).call(this, s));
1911
1911
  } catch (e) {
1912
1912
  console.error("Ошибка при проверке периода очистки:", e);
1913
1913
  }
1914
- }, Ct = new WeakSet(), ce = async function(e) {
1914
+ }, Ut = new WeakSet(), ue = async function(e) {
1915
1915
  try {
1916
1916
  if (!e || e.length === 0)
1917
1917
  return !1;
1918
- let t = new K(BX24.callBatch), r = e.filter((a) => a && a.id).map((a) => {
1918
+ let t = new K(BX24.callBatch), s = e.filter((a) => a && a.id).map((a) => {
1919
1919
  let { id: c } = a;
1920
1920
  return {
1921
1921
  method: "entity.item.delete",
1922
1922
  params: {
1923
- ENTITY: S(this, j),
1923
+ ENTITY: I(this, j),
1924
1924
  ID: c
1925
1925
  }
1926
1926
  };
1927
1927
  });
1928
- if (r.length === 0)
1928
+ if (s.length === 0)
1929
1929
  return !1;
1930
- const i = await t.batch(r);
1931
- return console.log(`Успешно удалено ${r.length} записей`), x(this, it, !0), i;
1930
+ const i = await t.batch(s);
1931
+ return console.log(`Успешно удалено ${s.length} записей`), x(this, it, !0), i;
1932
1932
  } catch (t) {
1933
1933
  return console.error("Ошибка при очистке устаревших записей:", t), !1;
1934
1934
  }
1935
1935
  };
1936
- function $t(y) {
1937
- if (!y || typeof y != "string")
1936
+ function re(g) {
1937
+ if (!g || typeof g != "string")
1938
1938
  return "";
1939
1939
  try {
1940
- const e = new URL(y);
1940
+ const e = new URL(g);
1941
1941
  e.search = "", e.hash = "";
1942
1942
  let t = e.toString();
1943
1943
  return t.endsWith("/") && e.pathname !== "/" && (t = t.slice(0, -1)), t;
1944
1944
  } catch {
1945
- return y.split("?")[0].split("#")[0].replace(/\/$/, "");
1945
+ return g.split("?")[0].split("#")[0].replace(/\/$/, "");
1946
1946
  }
1947
1947
  }
1948
- function le(y) {
1949
- return !y || typeof y != "string" ? !1 : y.toLowerCase().includes("/marketplace/app");
1948
+ function fe(g) {
1949
+ return !g || typeof g != "string" ? !1 : g.toLowerCase().includes("/marketplace/app");
1950
1950
  }
1951
- function Le() {
1951
+ function Ie() {
1952
1952
  var e;
1953
1953
  if (typeof window > "u" || !((e = window.location) != null && e.href))
1954
1954
  return "";
1955
- const y = $t(window.location.href);
1956
- return le(y) ? "" : y;
1955
+ const g = re(window.location.href);
1956
+ return fe(g) ? "" : g;
1957
1957
  }
1958
- function qt(y) {
1959
- if (!(y != null && y.appConst) || typeof y.appConst != "object")
1958
+ function Zt(g) {
1959
+ if (!(g != null && g.appConst) || typeof g.appConst != "object")
1960
1960
  return "";
1961
- const e = Le();
1962
- return e ? (y.appConst.pathApp = e, e) : $t(y.appConst.pathApp ?? "");
1961
+ const e = Ie();
1962
+ return e ? (g.appConst.pathApp = e, e) : re(g.appConst.pathApp ?? "");
1963
1963
  }
1964
- var lt, Tt, Ht, he, gt, zt, Ut, ue, Pt, fe, Gt, de, $, at, yt, Qt, Yt, me, pt, Zt, Wt, ge;
1965
- class we {
1964
+ var ht, bt, Pt, de, yt, Vt, Gt, me, Yt, ge, Wt, pe, $, ot, Nt, $t, xt, ye, Ot, te, Ft, Ne;
1965
+ class Pe {
1966
1966
  /**
1967
1967
  * @param {Object} appConst - Константы приложения
1968
1968
  * @param {string} appConst.appName - Название приложения
@@ -1975,24 +1975,24 @@ class we {
1975
1975
  *
1976
1976
  * @returns {Batch} Shared Batch instance.
1977
1977
  */
1978
- R(this, lt);
1979
- R(this, Ht);
1978
+ L(this, ht);
1979
+ L(this, Pt);
1980
1980
  /**
1981
1981
  * `this.logger === true` → `BxLogger` + лёгкий `init` (сущность хранилища, без полной выгрузки);
1982
1982
  * иначе — заглушка.
1983
1983
  * @param {boolean} runLoggerMaintenance
1984
1984
  */
1985
- R(this, gt);
1985
+ L(this, yt);
1986
1986
  /**
1987
1987
  * @returns {boolean}
1988
1988
  */
1989
- R(this, Ut);
1989
+ L(this, Gt);
1990
1990
  /** Запрос данных о приложении */
1991
- R(this, Pt);
1991
+ L(this, Yt);
1992
1992
  /** Запрос данных о текущем пользователе */
1993
- R(this, Gt);
1994
- R(this, $);
1995
- R(this, yt);
1993
+ L(this, Wt);
1994
+ L(this, $);
1995
+ L(this, Nt);
1996
1996
  /**
1997
1997
  * Расширяет errorList для случаев TIMEOUT и LIMIT
1998
1998
  * Если есть ошибки TIMEOUT или LIMIT, добавляет все необработанные сущности из commandList
@@ -2002,31 +2002,31 @@ class we {
2002
2002
  * @param {Array} updateList - Список обновлений для логирования (опционально)
2003
2003
  * @returns {Object} Расширенный список ошибок
2004
2004
  */
2005
- R(this, Yt);
2005
+ L(this, xt);
2006
2006
  /**
2007
2007
  * Нормализует входные данные в массив объектов {placement, handler?}
2008
2008
  * @private
2009
2009
  */
2010
- R(this, pt);
2010
+ L(this, Ot);
2011
2011
  /**
2012
2012
  * Находит встройки с устаревшим handler (не содержащим текущий pathApp)
2013
2013
  * @private
2014
2014
  */
2015
- R(this, Wt);
2016
- B(this, "domain", "");
2017
- B(this, "isAdmin", !1);
2018
- B(this, "appInfo", null);
2019
- B(this, "appConst", null);
2020
- B(this, "userInfo", null);
2021
- B(this, "placeData", null);
2022
- B(this, "placeInfo", null);
2023
- B(this, "logger", !1);
2024
- B(this, "timeLimit", {
2015
+ L(this, Ft);
2016
+ w(this, "domain", "");
2017
+ w(this, "isAdmin", !1);
2018
+ w(this, "appInfo", null);
2019
+ w(this, "appConst", null);
2020
+ w(this, "userInfo", null);
2021
+ w(this, "placeData", null);
2022
+ w(this, "placeInfo", null);
2023
+ w(this, "logger", !1);
2024
+ w(this, "timeLimit", {
2025
2025
  limit: !1,
2026
2026
  date: void 0,
2027
2027
  pauseMs: void 0
2028
2028
  });
2029
- B(this, "batchClient", null);
2029
+ w(this, "batchClient", null);
2030
2030
  this.appConst = e;
2031
2031
  }
2032
2032
  /**
@@ -2036,7 +2036,7 @@ class we {
2036
2036
  * @returns {() => void} Функция отписки.
2037
2037
  */
2038
2038
  subscribeTimeLimit(e) {
2039
- return _(this, lt, Tt).call(this).subscribeTimeLimit(e);
2039
+ return O(this, ht, bt).call(this).subscribeTimeLimit(e);
2040
2040
  }
2041
2041
  /**
2042
2042
  * Единая инициализация: внутри автоматически выбирается ветка обычного приложения или
@@ -2060,22 +2060,22 @@ class we {
2060
2060
  let a = setInterval(() => {
2061
2061
  window.BX24 && BX24.init(async () => {
2062
2062
  clearInterval(a), clearTimeout(i), this.domain = BX24.getDomain(), this.isAdmin = BX24.isAdmin(), this.placeInfo = BX24.placement.info();
2063
- const c = _(this, Ut, ue).call(this);
2063
+ const c = O(this, Gt, me).call(this);
2064
2064
  if (console.info(
2065
2065
  c ? "init BX24 (background worker)" : "init BX24"
2066
- ), this.appInfo = await _(this, Pt, fe).call(this), this.userInfo = await _(this, Gt, de).call(this), qt(this), c)
2067
- await _(this, gt, zt).call(this, !1, {
2066
+ ), this.appInfo = await O(this, Yt, ge).call(this), this.userInfo = await O(this, Wt, pe).call(this), Zt(this), c)
2067
+ await O(this, yt, Vt).call(this, !1, {
2068
2068
  skipInit: !0
2069
2069
  });
2070
2070
  else {
2071
- await _(this, gt, zt).call(this, !0);
2072
- const l = new ne();
2071
+ await O(this, yt, Vt).call(this, !0);
2072
+ const h = new Ae();
2073
2073
  try {
2074
- l.noSleep();
2075
- } catch (h) {
2074
+ h.noSleep();
2075
+ } catch (f) {
2076
2076
  console.warn(
2077
2077
  "Failed to initialize noSleep:",
2078
- h
2078
+ f
2079
2079
  );
2080
2080
  }
2081
2081
  }
@@ -2126,20 +2126,20 @@ class we {
2126
2126
  * }[]
2127
2127
  * }[]
2128
2128
  */
2129
- async call({ method: e, params: t, updateList: r }) {
2129
+ async call({ method: e, params: t, updateList: s }) {
2130
2130
  let i;
2131
- if (r && (i = this.logger.start({
2131
+ if (s && (i = this.logger.start({
2132
2132
  type: "call",
2133
- data: { method: e, params: t, updateList: r }
2133
+ data: { method: e, params: t, updateList: s }
2134
2134
  })), t || (t = {}), typeof BX24 > "u" || !BX24.callMethod) {
2135
- const l = new Error("BX24 is not initialized");
2136
- throw console.error(l), l;
2135
+ const h = new Error("BX24 is not initialized");
2136
+ throw console.error(h), h;
2137
2137
  }
2138
- const c = await _(this, lt, Tt).call(this).call({ method: e, params: t });
2139
- return c.success ? (await _(this, $, at).call(this, i, {
2138
+ const c = await O(this, ht, bt).call(this).call({ method: e, params: t });
2139
+ return c.success ? (await O(this, $, ot).call(this, i, {
2140
2140
  answer: c.answer,
2141
2141
  status: "success"
2142
- }), c.data) : (console.error(c.error), await _(this, $, at).call(this, i, {
2142
+ }), c.data) : (console.error(c.error), await O(this, $, ot).call(this, i, {
2143
2143
  answer: c.answer,
2144
2144
  status: "fail",
2145
2145
  errorList: { 0: c.error || "Unknown call error" }
@@ -2164,16 +2164,16 @@ class we {
2164
2164
  * }[]
2165
2165
  * }}
2166
2166
  */
2167
- async batch(e, t, { errorCall: r, updateList: i, batchOptions: a } = {}) {
2167
+ async batch(e, t, { errorCall: s, updateList: i, batchOptions: a } = {}) {
2168
2168
  if (typeof BX24 > "u" || !BX24.callBatch) {
2169
2169
  const c = new Error("BX24 is not initialized");
2170
2170
  return console.error(c), !1;
2171
2171
  }
2172
- return _(this, yt, Qt).call(this, {
2172
+ return O(this, Nt, $t).call(this, {
2173
2173
  mode: "batch",
2174
2174
  commandList: e,
2175
2175
  progressCall: t,
2176
- errorCall: r,
2176
+ errorCall: s,
2177
2177
  updateList: i,
2178
2178
  batchOptions: a
2179
2179
  });
@@ -2200,16 +2200,16 @@ class we {
2200
2200
  * }}
2201
2201
  * @returns {Promise<Object|false>}
2202
2202
  */
2203
- async batchTotalCount(e, t, { errorCall: r, updateList: i } = {}) {
2203
+ async batchTotalCount(e, t, { errorCall: s, updateList: i } = {}) {
2204
2204
  if (typeof BX24 > "u" || !BX24.callBatch) {
2205
2205
  const a = new Error("BX24 is not initialized");
2206
2206
  return console.error(a), !1;
2207
2207
  }
2208
- return _(this, yt, Qt).call(this, {
2208
+ return O(this, Nt, $t).call(this, {
2209
2209
  mode: "batch-total-count",
2210
2210
  commandList: e,
2211
2211
  progressCall: t,
2212
- errorCall: r,
2212
+ errorCall: s,
2213
2213
  updateList: i
2214
2214
  });
2215
2215
  }
@@ -2226,54 +2226,54 @@ class we {
2226
2226
  var A;
2227
2227
  if (!this.isAdmin || (this.placeData = await this.getPlacement(), !this.placeData))
2228
2228
  return;
2229
- const { appName: t, pathApp: r } = this.appConst;
2230
- let i = _(this, pt, Zt).call(this, e);
2229
+ const { appName: t, pathApp: s } = this.appConst;
2230
+ let i = O(this, Ot, te).call(this, e);
2231
2231
  i = i.filter(
2232
- (u) => u.placement !== "PAGE_BACKGROUND_WORKER" && u.placement !== "PAGE_BACKGROUND_WORKER_ALL"
2232
+ (l) => l.placement !== "PAGE_BACKGROUND_WORKER" && l.placement !== "PAGE_BACKGROUND_WORKER_ALL"
2233
2233
  );
2234
- const a = _(this, Wt, ge).call(this, r), c = new Set(i.map((u) => u.placement));
2235
- for (const u of a)
2236
- c.has(u.placement) || i.push({ placement: u.placement });
2234
+ const a = O(this, Ft, Ne).call(this, s), c = new Set(i.map((l) => l.placement));
2235
+ for (const l of a)
2236
+ c.has(l.placement) || i.push({ placement: l.placement });
2237
2237
  if (i.length === 0)
2238
2238
  return;
2239
- let l = t;
2240
- this.domain === "szdl.bitrix24.ru" && ((A = this.appInfo) != null && A.ID) && (l = `${t}: #${this.appInfo.ID}`);
2241
- const h = l.replace(" CRM", ""), n = {}, f = [], m = /* @__PURE__ */ new Map();
2242
- for (const u of this.placeData)
2243
- m.has(u.placement) || m.set(u.placement, []), m.get(u.placement).push(u);
2244
- for (let u = 0; u < i.length; u++) {
2245
- const { placement: O, options: T } = i[u], E = m.get(O) || [];
2239
+ let h = t;
2240
+ this.domain === "szdl.bitrix24.ru" && ((A = this.appInfo) != null && A.ID) && (h = `${t}: #${this.appInfo.ID}`);
2241
+ const f = h.replace(" CRM", ""), n = {}, u = [], d = /* @__PURE__ */ new Map();
2242
+ for (const l of this.placeData)
2243
+ d.has(l.placement) || d.set(l.placement, []), d.get(l.placement).push(l);
2244
+ for (let l = 0; l < i.length; l++) {
2245
+ const { placement: _, options: T } = i[l], E = d.get(_) || [];
2246
2246
  if (E.some(
2247
- (b) => b.handler === r
2247
+ (b) => b.handler === s
2248
2248
  ))
2249
2249
  continue;
2250
- const p = E.filter(
2251
- (b) => b.handler !== r
2250
+ const N = E.filter(
2251
+ (b) => b.handler !== s
2252
2252
  );
2253
- for (const b of p)
2254
- f.push({
2255
- placement: O,
2253
+ for (const b of N)
2254
+ u.push({
2255
+ placement: _,
2256
2256
  handler: b.handler
2257
2257
  });
2258
- n[`bind_${u}`] = {
2258
+ n[`bind_${l}`] = {
2259
2259
  method: "placement.bind",
2260
2260
  params: {
2261
- PLACEMENT: O,
2262
- HANDLER: r,
2261
+ PLACEMENT: _,
2262
+ HANDLER: s,
2263
2263
  LANG_ALL: {
2264
2264
  ru: {
2265
- TITLE: O === "USER_PROFILE_TOOLBAR" ? h : l
2265
+ TITLE: _ === "USER_PROFILE_TOOLBAR" ? f : h
2266
2266
  }
2267
2267
  },
2268
2268
  OPTIONS: {
2269
- errorHandlerUrl: r,
2269
+ errorHandlerUrl: s,
2270
2270
  ...T && typeof T == "object" ? T : {}
2271
2271
  }
2272
2272
  }
2273
2273
  };
2274
2274
  }
2275
- f.length > 0 && await this.placementUnBind(f), Object.keys(n).length > 0 && (await this.batch(n), this.placeData = await this.getPlacement(), Object.values(n).forEach((u) => {
2276
- console.log("Приложение успешно встроено в", u.params.PLACEMENT);
2275
+ u.length > 0 && await this.placementUnBind(u), Object.keys(n).length > 0 && (await this.batch(n), this.placeData = await this.getPlacement(), Object.values(n).forEach((l) => {
2276
+ console.log("Приложение успешно встроено в", l.params.PLACEMENT);
2277
2277
  }));
2278
2278
  }
2279
2279
  /**
@@ -2281,22 +2281,22 @@ class we {
2281
2281
  * @param {string|string[]|Object|Object[]} place - Место или массив мест для отвязки
2282
2282
  */
2283
2283
  async placementUnBind(e) {
2284
- let t = _(this, pt, Zt).call(this, e);
2284
+ let t = O(this, Ot, te).call(this, e);
2285
2285
  if (t = t.filter(
2286
2286
  (i) => i.placement !== "PAGE_BACKGROUND_WORKER" && i.placement !== "PAGE_BACKGROUND_WORKER_ALL"
2287
2287
  ), t.length === 0)
2288
2288
  return;
2289
- const r = {};
2289
+ const s = {};
2290
2290
  for (let i = 0; i < t.length; i++) {
2291
2291
  const a = {
2292
2292
  PLACEMENT: t[i].placement
2293
2293
  };
2294
- t[i].handler && (a.HANDLER = t[i].handler), r[`unbind_${i}`] = {
2294
+ t[i].handler && (a.HANDLER = t[i].handler), s[`unbind_${i}`] = {
2295
2295
  method: "placement.unbind",
2296
2296
  params: a
2297
2297
  };
2298
2298
  }
2299
- await this.batch(r), t.forEach((i) => {
2299
+ await this.batch(s), t.forEach((i) => {
2300
2300
  console.log("Встройка отвязана", i.placement);
2301
2301
  });
2302
2302
  }
@@ -2310,8 +2310,8 @@ class we {
2310
2310
  return console.log("chat-bot list:", t), t;
2311
2311
  }
2312
2312
  /* регистрация бота */
2313
- async regBot({ code: e, type: t, name: r }) {
2314
- const { appName: i, pathApp: a, chatBotLogo: c } = this.appConst, l = this.appInfo.ID, h = await this.call({
2313
+ async regBot({ code: e, type: t, name: s }) {
2314
+ const { appName: i, pathApp: a, chatBotLogo: c } = this.appConst, h = this.appInfo.ID, f = await this.call({
2315
2315
  method: "imbot.register",
2316
2316
  params: {
2317
2317
  CODE: e ?? this.appInfo.CODE,
@@ -2326,7 +2326,7 @@ class we {
2326
2326
  // строковый идентификатор чат-бота, используется только в режиме Вебхуков
2327
2327
  PROPERTIES: {
2328
2328
  // Личные данные чат-бота (обяз.)
2329
- NAME: `${r ?? i} - бот #${l}`,
2329
+ NAME: `${s ?? i} - бот #${h}`,
2330
2330
  // Имя чат-бота (обязательное одно из полей NAME или LAST_NAME)
2331
2331
  LAST_NAME: "",
2332
2332
  // Фамилия чат-бота (обязательное одно из полей NAME или LAST_NAME)
@@ -2334,7 +2334,7 @@ class we {
2334
2334
  // Цвет чат-бота для мобильного приложения RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, PINK, LIME, BROWN, AZURE, KHAKI, SAND, MARENGO, GRAY, GRAPHITE
2335
2335
  EMAIL: "",
2336
2336
  // E-mail для связи. НЕЛЬЗЯ использовать e-mail, дублирующий e-mail реальных пользователей
2337
- PERSONAL_BIRTHDAY: Ot().format("%Y-%m-%d"),
2337
+ PERSONAL_BIRTHDAY: Tt().format("%Y-%m-%d"),
2338
2338
  // День рождения в формате YYYY-mm-dd
2339
2339
  WORK_POSITION: "Почтальон",
2340
2340
  // Занимаемая должность, используется как описание чат-бота
@@ -2347,7 +2347,7 @@ class we {
2347
2347
  }
2348
2348
  }
2349
2349
  });
2350
- return console.log("Чат-бот добавлен", h), h;
2350
+ return console.log("Чат-бот добавлен", f), f;
2351
2351
  }
2352
2352
  /* Убрать регистрацию бота */
2353
2353
  async unRegBot(e) {
@@ -2364,12 +2364,12 @@ class we {
2364
2364
  return this.logger.getEntityList(e);
2365
2365
  }
2366
2366
  }
2367
- lt = new WeakSet(), Tt = function() {
2367
+ ht = new WeakSet(), bt = function() {
2368
2368
  return this.batchClient || (this.batchClient = new K({
2369
2369
  callBatch: BX24.callBatch,
2370
2370
  callMethod: BX24.callMethod
2371
2371
  }), this.timeLimit = this.batchClient.timeLimit), this.batchClient;
2372
- }, Ht = new WeakSet(), he = function() {
2372
+ }, Pt = new WeakSet(), de = function() {
2373
2373
  return {
2374
2374
  start: () => {
2375
2375
  },
@@ -2378,133 +2378,133 @@ lt = new WeakSet(), Tt = function() {
2378
2378
  getEntityList: () => {
2379
2379
  }
2380
2380
  };
2381
- }, gt = new WeakSet(), zt = async function(e, { skipInit: t = !1 } = {}) {
2382
- this.logger ? (this.logger = new be(), t ? this.logger.enableBackworkerMode() : await this.logger.init(), e && typeof this.logger.runStorageMaintenance == "function" && this.logger.runStorageMaintenance()) : this.logger = _(this, Ht, he).call(this);
2383
- }, Ut = new WeakSet(), ue = function() {
2384
- var r, i, a;
2385
- const e = (r = this.placeInfo) == null ? void 0 : r.placement, t = (a = (i = this.placeInfo) == null ? void 0 : i.options) == null ? void 0 : a.ID;
2381
+ }, yt = new WeakSet(), Vt = async function(e, { skipInit: t = !1 } = {}) {
2382
+ this.logger ? (this.logger = new Se(), t ? this.logger.enableBackworkerMode() : await this.logger.init(), e && typeof this.logger.runStorageMaintenance == "function" && this.logger.runStorageMaintenance()) : this.logger = O(this, Pt, de).call(this);
2383
+ }, Gt = new WeakSet(), me = function() {
2384
+ var s, i, a;
2385
+ const e = (s = this.placeInfo) == null ? void 0 : s.placement, t = (a = (i = this.placeInfo) == null ? void 0 : i.options) == null ? void 0 : a.ID;
2386
2386
  return e === "PAGE_BACKGROUND_WORKER" || t === "PAGE_BACKGROUND_WORKER";
2387
- }, Pt = new WeakSet(), fe = function() {
2387
+ }, Yt = new WeakSet(), ge = function() {
2388
2388
  return this.call({ method: "app.info" });
2389
- }, Gt = new WeakSet(), de = function() {
2389
+ }, Wt = new WeakSet(), pe = function() {
2390
2390
  return this.call({ method: "user.current" });
2391
- }, $ = new WeakSet(), at = async function(e, t) {
2391
+ }, $ = new WeakSet(), ot = async function(e, t) {
2392
2392
  if (e)
2393
2393
  try {
2394
2394
  await this.logger.stop({
2395
2395
  key: e,
2396
2396
  ...t
2397
2397
  });
2398
- } catch (r) {
2399
- console.error("Logger error:", r);
2398
+ } catch (s) {
2399
+ console.error("Logger error:", s);
2400
2400
  }
2401
- }, yt = new WeakSet(), Qt = async function({
2401
+ }, Nt = new WeakSet(), $t = async function({
2402
2402
  mode: e,
2403
2403
  commandList: t,
2404
- progressCall: r,
2404
+ progressCall: s,
2405
2405
  errorCall: i,
2406
2406
  updateList: a,
2407
2407
  batchOptions: c
2408
2408
  }) {
2409
- const l = _(this, lt, Tt).call(this), h = a ? this.logger.start({
2409
+ const h = O(this, ht, bt).call(this), f = a ? this.logger.start({
2410
2410
  type: e,
2411
2411
  data: e === "batch" ? { commandList: t, updateList: a } : { commandList: t }
2412
2412
  }) : void 0;
2413
2413
  try {
2414
- const n = e === "batch" ? await l.batch(t, r, c) : await l.batchTotalCount(t, r), f = _(this, Yt, me).call(this, l, n, t, a);
2415
- return Object.keys(f).length ? (i && i(f), await _(this, $, at).call(this, h, {
2414
+ const n = e === "batch" ? await h.batch(t, s, c) : await h.batchTotalCount(t, s), u = O(this, xt, ye).call(this, h, n, t, a);
2415
+ return Object.keys(u).length ? (i && i(u), await O(this, $, ot).call(this, f, {
2416
2416
  status: "fail",
2417
- errorList: f
2418
- })) : await _(this, $, at).call(this, h, { status: "success" }), n;
2417
+ errorList: u
2418
+ })) : await O(this, $, ot).call(this, f, { status: "success" }), n;
2419
2419
  } catch (n) {
2420
- return await _(this, $, at).call(this, h, {
2420
+ return await O(this, $, ot).call(this, f, {
2421
2421
  status: "fail-runtime",
2422
2422
  errorList: { 0: n == null ? void 0 : n.toString() }
2423
2423
  }), console.error(n), !1;
2424
2424
  }
2425
- }, Yt = new WeakSet(), me = function(e, t, r, i) {
2425
+ }, xt = new WeakSet(), ye = function(e, t, s, i) {
2426
2426
  let a = { ...e.errors };
2427
2427
  if (Object.values(e.errors).some(
2428
- (l) => {
2429
- if (typeof l != "string")
2428
+ (h) => {
2429
+ if (typeof h != "string")
2430
2430
  return !1;
2431
- const h = l.toUpperCase();
2432
- return h === "TIMEOUT" || h === "OPERATION_TIME_LIMIT" || h.includes("TIMEOUT") || h.includes("OPERATION_TIME_LIMIT");
2431
+ const f = h.toUpperCase();
2432
+ return f === "TIMEOUT" || f === "OPERATION_TIME_LIMIT" || f.includes("TIMEOUT") || f.includes("OPERATION_TIME_LIMIT");
2433
2433
  }
2434
2434
  ) && i) {
2435
- const l = t ? Object.keys(t).filter((m) => m !== "errorsList") : [], h = new Set(Object.keys(e.errors || {})), n = /* @__PURE__ */ new Set();
2435
+ const h = t ? Object.keys(t).filter((d) => d !== "errorsList") : [], f = new Set(Object.keys(e.errors || {})), n = /* @__PURE__ */ new Set();
2436
2436
  if (t) {
2437
- for (const m of l)
2438
- if (!h.has(m)) {
2439
- const A = t[m];
2440
- A != null && n.add(m);
2437
+ for (const d of h)
2438
+ if (!f.has(d)) {
2439
+ const A = t[d];
2440
+ A != null && n.add(d);
2441
2441
  }
2442
2442
  }
2443
- const f = Object.values(e.errors).find(
2444
- (m) => {
2445
- if (typeof m != "string")
2443
+ const u = Object.values(e.errors).find(
2444
+ (d) => {
2445
+ if (typeof d != "string")
2446
2446
  return !1;
2447
- const A = m.toUpperCase();
2447
+ const A = d.toUpperCase();
2448
2448
  return A === "TIMEOUT" || A === "OPERATION_TIME_LIMIT" || A.includes("TIMEOUT") || A.includes("OPERATION_TIME_LIMIT");
2449
2449
  }
2450
2450
  );
2451
- for (const m of Object.keys(r))
2452
- !n.has(m) && !e.errors[m] && (a[m] = f || "TIMEOUT или OPERATION_TIME_LIMIT: запрос не был обработан");
2451
+ for (const d of Object.keys(s))
2452
+ !n.has(d) && !e.errors[d] && (a[d] = u || "TIMEOUT или OPERATION_TIME_LIMIT: запрос не был обработан");
2453
2453
  }
2454
2454
  return a;
2455
- }, pt = new WeakSet(), Zt = function(e) {
2455
+ }, Ot = new WeakSet(), te = function(e) {
2456
2456
  if (!e)
2457
2457
  return [];
2458
2458
  let t = [];
2459
2459
  return Array.isArray(e) ? t = e.map(
2460
- (r) => typeof r == "string" ? { placement: r } : r
2460
+ (s) => typeof s == "string" ? { placement: s } : s
2461
2461
  ) : typeof e == "string" ? t = [{ placement: e }] : t = [e], t;
2462
- }, Wt = new WeakSet(), ge = function(e) {
2462
+ }, Ft = new WeakSet(), Ne = function(e) {
2463
2463
  return this.placeData ? this.placeData.filter((t) => !(t.placement === "PAGE_BACKGROUND_WORKER" || !t.handler || t.handler.includes(e))) : [];
2464
2464
  };
2465
- const ye = "szdl-utils-kit|";
2466
- function Re() {
2465
+ const Oe = "szdl-utils-kit|";
2466
+ function De() {
2467
2467
  if (typeof sessionStorage > "u")
2468
2468
  return `ephemeral-${Date.now()}-${Math.random().toString(16).slice(2)}`;
2469
- let y = sessionStorage.getItem("szdl-cross-tab-instance-id");
2470
- return y || (y = `${Date.now()}-${Math.random().toString(16).slice(2)}`, sessionStorage.setItem("szdl-cross-tab-instance-id", y)), y;
2469
+ let g = sessionStorage.getItem("szdl-cross-tab-instance-id");
2470
+ return g || (g = `${Date.now()}-${Math.random().toString(16).slice(2)}`, sessionStorage.setItem("szdl-cross-tab-instance-id", g)), g;
2471
2471
  }
2472
- function Me() {
2472
+ function ke() {
2473
2473
  return typeof navigator < "u" && typeof navigator.locks < "u" && typeof navigator.locks.request == "function";
2474
2474
  }
2475
- const Xt = /* @__PURE__ */ new Map();
2476
- function Ie(y = "default") {
2475
+ const Kt = /* @__PURE__ */ new Map();
2476
+ function we(g = "default") {
2477
2477
  if (typeof BroadcastChannel > "u")
2478
2478
  return null;
2479
- const e = `${ye}bc:${y}`;
2480
- return Xt.has(e) || Xt.set(e, new BroadcastChannel(e)), Xt.get(e);
2479
+ const e = `${Oe}bc:${g}`;
2480
+ return Kt.has(e) || Kt.set(e, new BroadcastChannel(e)), Kt.get(e);
2481
2481
  }
2482
- function te(y, e) {
2483
- const t = Ie(y);
2482
+ function se(g, e) {
2483
+ const t = we(g);
2484
2484
  if (t)
2485
2485
  try {
2486
- const r = e && typeof e == "object" && !Array.isArray(e) ? e : { data: e };
2486
+ const s = e && typeof e == "object" && !Array.isArray(e) ? e : { data: e };
2487
2487
  t.postMessage({
2488
- ...r,
2489
- tabId: Re(),
2488
+ ...s,
2489
+ tabId: De(),
2490
2490
  ts: Date.now()
2491
2491
  });
2492
2492
  } catch {
2493
2493
  }
2494
2494
  }
2495
- async function Se(y, e, t = {}) {
2496
- const { ifAvailable: r = !1 } = t, i = typeof y == "string" && y.length > 0 ? y : "default", a = `${ye}${i}`;
2497
- return Me() ? navigator.locks.request(
2495
+ async function Be(g, e, t = {}) {
2496
+ const { ifAvailable: s = !1 } = t, i = typeof g == "string" && g.length > 0 ? g : "default", a = `${Oe}${i}`;
2497
+ return ke() ? navigator.locks.request(
2498
2498
  a,
2499
- { mode: "exclusive", ifAvailable: !!r },
2499
+ { mode: "exclusive", ifAvailable: !!s },
2500
2500
  async (c) => {
2501
- if (r && c == null)
2501
+ if (s && c == null)
2502
2502
  return { skipped: !0, coordination: "locks" };
2503
- te(i, { type: "lock-acquired", resource: i });
2503
+ se(i, { type: "lock-acquired", resource: i });
2504
2504
  try {
2505
2505
  return { skipped: !1, result: await e(), coordination: "locks" };
2506
2506
  } finally {
2507
- te(i, { type: "lock-released", resource: i });
2507
+ se(i, { type: "lock-released", resource: i });
2508
2508
  }
2509
2509
  }
2510
2510
  ) : { skipped: !1, result: await e(), coordination: "none" };
@@ -2525,11 +2525,16 @@ const q = {
2525
2525
  /** Heartbeat лидера во время appInit; null — вычислить из poll/activeMaxPause. */
2526
2526
  leaderHeartbeatMs: null
2527
2527
  };
2528
- function De(y = {}) {
2529
- const e = { ...q, ...y };
2528
+ function Ce(g) {
2529
+ return g == null ? "user" : g === "user" || g === "portal" ? g : (console.warn(
2530
+ `BackgroundWorker: coordinationScope должен быть 'user' или 'portal', получено ${JSON.stringify(g)} — используется 'user'`
2531
+ ), "user");
2532
+ }
2533
+ function He(g = {}) {
2534
+ const e = { ...q, ...g };
2530
2535
  for (const t of Object.keys(q)) {
2531
2536
  if (t === "leaderHeartbeatMs") {
2532
- const i = y == null ? void 0 : y.leaderHeartbeatMs;
2537
+ const i = g == null ? void 0 : g.leaderHeartbeatMs;
2533
2538
  if (i == null) {
2534
2539
  e.leaderHeartbeatMs = null;
2535
2540
  continue;
@@ -2538,45 +2543,58 @@ function De(y = {}) {
2538
2543
  e.leaderHeartbeatMs = Number.isFinite(a) && a >= 0 ? a : null;
2539
2544
  continue;
2540
2545
  }
2541
- const r = Number(e[t]);
2542
- e[t] = Number.isFinite(r) && r >= 0 ? r : q[t];
2546
+ const s = Number(e[t]);
2547
+ e[t] = Number.isFinite(s) && s >= 0 ? s : q[t];
2543
2548
  }
2544
2549
  return e;
2545
2550
  }
2546
- var xt, pe, Nt, Vt;
2547
- class Be {
2551
+ var vt, _e, _t, ee, nt, dt, Xt, Te;
2552
+ class Ge {
2548
2553
  constructor(e) {
2549
- R(this, xt);
2554
+ L(this, vt);
2550
2555
  /**
2551
2556
  * Канонический base URL для placement (без завершающего `/`).
2552
2557
  * Пустая строка — не биндить (некорректный или marketplace URL).
2553
2558
  */
2554
- R(this, Nt);
2555
- B(this, "entityName", "tabs");
2556
- B(this, "maxTabs", 20);
2557
- B(this, "tabList", []);
2558
- B(this, "id", 0);
2559
- B(this, "hasStarted", !1);
2560
- B(this, "heartbeat");
2561
- B(this, "runHeartbeat");
2562
- B(this, "startDelay", 0);
2563
- B(this, "activeMaxPause", q.activeMaxPauseMs);
2564
- B(this, "quickCleanupThreshold", q.quickCleanupThresholdMs);
2565
- B(this, "pollInterval", q.pollIntervalMs);
2566
- B(this, "pollIntervalBase", q.pollIntervalMs);
2567
- B(this, "pollIntervalJitter", q.pollIntervalJitterMs);
2568
- B(this, "leaderConfirmDelay", q.leaderConfirmDelayMs);
2569
- B(this, "leaderHeartbeatMs", null);
2570
- B(this, "sessionId", `${Date.now()}-${Math.random().toString(16).slice(2)}`);
2571
- B(this, "continueCondition");
2572
- B(this, "defaultContinueBackground", () => !0);
2573
- var l, h, n;
2559
+ L(this, _t);
2560
+ /** Ключ NAME в entity: userId или общий ключ портала. */
2561
+ L(this, nt);
2562
+ /** Имя Web Lock для подтверждения лидерства. */
2563
+ L(this, Xt);
2564
+ w(this, "entityName", "tabs");
2565
+ w(this, "maxTabs", 20);
2566
+ w(this, "tabList", []);
2567
+ w(this, "id", 0);
2568
+ w(this, "hasStarted", !1);
2569
+ w(this, "heartbeat");
2570
+ w(this, "runHeartbeat");
2571
+ w(this, "startDelay", 0);
2572
+ w(this, "activeMaxPause", q.activeMaxPauseMs);
2573
+ w(this, "quickCleanupThreshold", q.quickCleanupThresholdMs);
2574
+ w(this, "pollInterval", q.pollIntervalMs);
2575
+ w(this, "pollIntervalBase", q.pollIntervalMs);
2576
+ w(this, "pollIntervalJitter", q.pollIntervalJitterMs);
2577
+ w(this, "leaderConfirmDelay", q.leaderConfirmDelayMs);
2578
+ w(this, "leaderHeartbeatMs", null);
2579
+ w(this, "sessionId", `${Date.now()}-${Math.random().toString(16).slice(2)}`);
2580
+ w(this, "continueCondition");
2581
+ w(this, "defaultContinueBackground", () => !0);
2582
+ /** @type {'user' | 'portal'} */
2583
+ w(this, "coordinationScope", "user");
2584
+ var f, n, u;
2574
2585
  if (!e) {
2575
2586
  console.error("BackgroundWorker: Нет опций конструктора");
2576
2587
  return;
2577
2588
  }
2578
- const { appFunc: t, bx: r, users: i, continueBackground: a, timing: c } = e;
2579
- this.bx = r, this.appInit = t, this.users = i, _(this, xt, pe).call(this, c), qt(r), this.appPath = _(this, Nt, Vt).call(this, ((l = r == null ? void 0 : r.appConst) == null ? void 0 : l.pathApp) ?? ""), this.appName = ((h = r == null ? void 0 : r.appConst) == null ? void 0 : h.appName) ?? "", this.appCodeName = ((n = r == null ? void 0 : r.appConst) == null ? void 0 : n.appCodeName) ?? "", this.start = /* @__PURE__ */ new Date(), this.continueCondition = typeof a == "function" ? a : this.defaultContinueBackground;
2589
+ const {
2590
+ appFunc: t,
2591
+ bx: s,
2592
+ users: i,
2593
+ continueBackground: a,
2594
+ timing: c,
2595
+ coordinationScope: h
2596
+ } = e;
2597
+ this.bx = s, this.appInit = t, this.users = i, this.coordinationScope = Ce(h), O(this, vt, _e).call(this, c), Zt(s), this.appPath = O(this, _t, ee).call(this, ((f = s == null ? void 0 : s.appConst) == null ? void 0 : f.pathApp) ?? ""), this.appName = ((n = s == null ? void 0 : s.appConst) == null ? void 0 : n.appName) ?? "", this.appCodeName = ((u = s == null ? void 0 : s.appConst) == null ? void 0 : u.appCodeName) ?? "", this.start = /* @__PURE__ */ new Date(), this.continueCondition = typeof a == "function" ? a : this.defaultContinueBackground;
2580
2598
  }
2581
2599
  async init() {
2582
2600
  if (!this.appInit) {
@@ -2609,8 +2627,8 @@ class Be {
2609
2627
  return;
2610
2628
  }
2611
2629
  await this.refreshTabs(!0), await this.ensureTabRegistered();
2612
- const t = this.selectLeaderId(), r = t && +this.id == +t;
2613
- await this.updateTabState(r), r && !this.hasStarted && await this.runAsLeader();
2630
+ const t = this.selectLeaderId(), s = t && +this.id == +t;
2631
+ await this.updateTabState(s), s && !this.hasStarted && await this.runAsLeader();
2614
2632
  }
2615
2633
  stopTimers() {
2616
2634
  this.heartbeat && (clearInterval(this.heartbeat), this.heartbeat = void 0), this.runHeartbeat && (clearInterval(this.runHeartbeat), this.runHeartbeat = void 0);
@@ -2620,18 +2638,18 @@ class Be {
2620
2638
  if (typeof BX24 > "u" || !((e = BX24.placement) != null && e.info))
2621
2639
  return !1;
2622
2640
  try {
2623
- const t = BX24.placement.info(), r = t == null ? void 0 : t.placement, i = (t == null ? void 0 : t.options) || {}, a = (i == null ? void 0 : i.URI) || "", c = r === "PAGE_BACKGROUND_WORKER" || (i == null ? void 0 : i.ID) === "PAGE_BACKGROUND_WORKER", l = typeof a == "string" && (a.includes("marketplace/app") || a.includes("marketplace/apps") || a.includes("placement") || a.includes("sozdavatel" + this.appCodeName));
2624
- return !c || l;
2641
+ const t = BX24.placement.info(), s = t == null ? void 0 : t.placement, i = (t == null ? void 0 : t.options) || {}, a = (i == null ? void 0 : i.URI) || "", c = s === "PAGE_BACKGROUND_WORKER" || (i == null ? void 0 : i.ID) === "PAGE_BACKGROUND_WORKER", h = typeof a == "string" && (a.includes("marketplace/app") || a.includes("marketplace/apps") || a.includes("placement") || a.includes("sozdavatel" + this.appCodeName));
2642
+ return !c || h;
2625
2643
  } catch {
2626
2644
  return !1;
2627
2645
  }
2628
2646
  }
2629
2647
  async checkEntity() {
2630
- var r;
2648
+ var s;
2631
2649
  const e = await this.safeCall(
2632
2650
  () => this.bx.call({ method: "entity.get" })
2633
2651
  );
2634
- ((r = e == null ? void 0 : e.find) == null ? void 0 : r.call(
2652
+ ((s = e == null ? void 0 : e.find) == null ? void 0 : s.call(
2635
2653
  e,
2636
2654
  (i) => i.ENTITY === this.entityName
2637
2655
  )) || await this.safeCall(
@@ -2646,31 +2664,29 @@ class Be {
2646
2664
  );
2647
2665
  }
2648
2666
  async getTabs() {
2649
- const e = await this.safeCall(
2650
- () => {
2651
- var t;
2652
- return this.bx.call({
2653
- method: "entity.item.get",
2654
- params: {
2655
- ENTITY: this.entityName,
2656
- FILTER: { NAME: (t = this.bx.userInfo) == null ? void 0 : t.ID },
2657
- SORT: { DATE_CREATE: "DESC" }
2658
- }
2659
- });
2660
- }
2667
+ const e = O(this, nt, dt).call(this), t = await this.safeCall(
2668
+ () => this.bx.call({
2669
+ method: "entity.item.get",
2670
+ params: {
2671
+ ENTITY: this.entityName,
2672
+ FILTER: { NAME: e },
2673
+ SORT: { DATE_CREATE: "DESC" }
2674
+ }
2675
+ })
2661
2676
  );
2662
- return !Array.isArray(e) || !e.length ? [] : e.map((t) => {
2663
- if (!t)
2677
+ return !Array.isArray(t) || !t.length ? [] : t.map((s) => {
2678
+ if (!s)
2664
2679
  return { id: void 0, data: void 0 };
2665
2680
  try {
2666
- const r = JSON.parse(t.DETAIL_TEXT);
2667
- return { id: +t.ID || 0, data: r };
2668
- } catch (r) {
2669
- return console.log("BackgroundWorker: parse tab error", r), { id: +t.ID || 0, data: void 0 };
2681
+ const i = JSON.parse(s.DETAIL_TEXT);
2682
+ return { id: +s.ID || 0, data: i };
2683
+ } catch (i) {
2684
+ return console.log("BackgroundWorker: parse tab error", i), { id: +s.ID || 0, data: void 0 };
2670
2685
  }
2671
2686
  });
2672
2687
  }
2673
2688
  async ensureTabRegistered() {
2689
+ var s, i;
2674
2690
  if (this.id)
2675
2691
  return +this.id || 0;
2676
2692
  if (this.tabList.length >= this.maxTabs && await this.refreshTabs(!0, this.quickCleanupThreshold), this.tabList.length >= this.maxTabs)
@@ -2681,52 +2697,49 @@ class Be {
2681
2697
  lastActive: (/* @__PURE__ */ new Date()).toISOString(),
2682
2698
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2683
2699
  start: !1,
2684
- sessionId: this.sessionId
2700
+ sessionId: this.sessionId,
2701
+ userId: (i = (s = this.bx) == null ? void 0 : s.userInfo) == null ? void 0 : i.ID
2685
2702
  }, t = await this.safeCall(
2686
- () => {
2687
- var r;
2688
- return this.bx.call({
2689
- method: "entity.item.add",
2690
- params: {
2691
- ENTITY: this.entityName,
2692
- NAME: (r = this.bx.userInfo) == null ? void 0 : r.ID,
2693
- DETAIL_TEXT: JSON.stringify(e)
2694
- }
2695
- });
2696
- }
2703
+ () => this.bx.call({
2704
+ method: "entity.item.add",
2705
+ params: {
2706
+ ENTITY: this.entityName,
2707
+ NAME: O(this, nt, dt).call(this),
2708
+ DETAIL_TEXT: JSON.stringify(e)
2709
+ }
2710
+ })
2697
2711
  ) || 0;
2698
2712
  return this.id = +t || 0, this.id;
2699
2713
  }
2700
2714
  async updateTabState(e) {
2715
+ var s, i;
2701
2716
  if (!this.id)
2702
2717
  return;
2703
2718
  const t = {
2704
2719
  lastActive: (/* @__PURE__ */ new Date()).toISOString(),
2705
2720
  createdAt: this.start.toISOString(),
2706
2721
  start: e,
2707
- sessionId: this.sessionId
2722
+ sessionId: this.sessionId,
2723
+ userId: (i = (s = this.bx) == null ? void 0 : s.userInfo) == null ? void 0 : i.ID
2708
2724
  };
2709
2725
  await this.safeCall(
2710
- () => {
2711
- var r;
2712
- return this.bx.call({
2713
- method: "entity.item.update",
2714
- params: {
2715
- ENTITY: this.entityName,
2716
- ID: this.id,
2717
- NAME: (r = this.bx.userInfo) == null ? void 0 : r.ID,
2718
- DETAIL_TEXT: JSON.stringify(t)
2719
- }
2720
- });
2721
- }
2726
+ () => this.bx.call({
2727
+ method: "entity.item.update",
2728
+ params: {
2729
+ ENTITY: this.entityName,
2730
+ ID: this.id,
2731
+ NAME: O(this, nt, dt).call(this),
2732
+ DETAIL_TEXT: JSON.stringify(t)
2733
+ }
2734
+ })
2722
2735
  );
2723
2736
  }
2724
2737
  async deleteTabs(e = []) {
2725
2738
  if (!e.length)
2726
2739
  return;
2727
- const t = e.map((r) => ({
2740
+ const t = e.map((s) => ({
2728
2741
  method: "entity.item.delete",
2729
- params: { ENTITY: this.entityName, ID: r.id }
2742
+ params: { ENTITY: this.entityName, ID: s.id }
2730
2743
  }));
2731
2744
  await this.safeCall(() => this.bx.batch(t));
2732
2745
  }
@@ -2735,10 +2748,10 @@ class Be {
2735
2748
  try {
2736
2749
  if (!((e = this.bx) != null && e.isAdmin))
2737
2750
  return !0;
2738
- const r = await this.safeCall(
2751
+ const s = await this.safeCall(
2739
2752
  () => this.bx.getPlacement()
2740
2753
  );
2741
- if (!r || !Array.isArray(r))
2754
+ if (!s || !Array.isArray(s))
2742
2755
  return console.log(
2743
2756
  "BackgroundWorker: Не получили список размещений, продолжаем"
2744
2757
  ), !0;
@@ -2747,27 +2760,27 @@ class Be {
2747
2760
  ), c = !a;
2748
2761
  if (!i)
2749
2762
  return !0;
2750
- let l = !1;
2751
- for (const h of r) {
2752
- if (h.placement !== "PAGE_BACKGROUND_WORKER" || !(h.userId || h.handler && h.handler.includes("USER_ID=")))
2763
+ let h = !1;
2764
+ for (const f of s) {
2765
+ if (f.placement !== "PAGE_BACKGROUND_WORKER" || !(f.userId || f.handler && f.handler.includes("USER_ID=")))
2753
2766
  continue;
2754
- const f = h.userId || (h.handler ? this.extractUserIdFromHandler(h.handler) : null);
2755
- if (f && +f === i) {
2756
- l = !0;
2767
+ const u = f.userId || (f.handler ? this.extractUserIdFromHandler(f.handler) : null);
2768
+ if (u && +u === i) {
2769
+ h = !0;
2757
2770
  break;
2758
2771
  }
2759
2772
  }
2760
2773
  return a ? (console.log(
2761
2774
  "BackgroundWorker: Индивидуальная встройка - разрешено"
2762
- ), !0) : c && l ? (console.log(
2775
+ ), !0) : c && h ? (console.log(
2763
2776
  "BackgroundWorker: Есть личная встройка, общую не запускаем"
2764
2777
  ), !1) : (console.log(
2765
2778
  "BackgroundWorker: Проверка типа встройки пройдена, продолжаем"
2766
2779
  ), !0);
2767
- } catch (r) {
2780
+ } catch (s) {
2768
2781
  return console.error(
2769
2782
  "BackgroundWorker: Ошибка при проверке типа встройки",
2770
- r
2783
+ s
2771
2784
  ), !0;
2772
2785
  }
2773
2786
  }
@@ -2794,30 +2807,30 @@ class Be {
2794
2807
  }
2795
2808
  }
2796
2809
  async refreshTabs(e = !1, t = this.activeMaxPause) {
2797
- const r = [], i = [], a = Date.now(), c = await this.getTabs();
2798
- for (const l of c) {
2799
- if (!(l != null && l.data)) {
2800
- r.push(l);
2810
+ const s = [], i = [], a = Date.now(), c = await this.getTabs();
2811
+ for (const h of c) {
2812
+ if (!(h != null && h.data)) {
2813
+ s.push(h);
2801
2814
  continue;
2802
2815
  }
2803
- if (a - new Date(l.data.lastActive || 0).getTime() > t) {
2804
- r.push(l);
2816
+ if (a - new Date(h.data.lastActive || 0).getTime() > t) {
2817
+ s.push(h);
2805
2818
  continue;
2806
2819
  }
2807
- i.push(l);
2820
+ i.push(h);
2808
2821
  }
2809
- return e && r.length && await this.deleteTabs(r), this.tabList = i, i;
2822
+ return e && s.length && await this.deleteTabs(s), this.tabList = i, i;
2810
2823
  }
2811
2824
  selectLeaderId() {
2812
2825
  var t;
2813
- return this.tabList.length && +((t = [...this.tabList].sort((r, i) => {
2814
- var l, h, n, f;
2826
+ return this.tabList.length && +((t = [...this.tabList].sort((s, i) => {
2827
+ var h, f, n, u;
2815
2828
  const a = new Date(
2816
- ((l = r.data) == null ? void 0 : l.createdAt) || ((h = r.data) == null ? void 0 : h.lastActive) || 0
2829
+ ((h = s.data) == null ? void 0 : h.createdAt) || ((f = s.data) == null ? void 0 : f.lastActive) || 0
2817
2830
  ).getTime(), c = new Date(
2818
- ((n = i.data) == null ? void 0 : n.createdAt) || ((f = i.data) == null ? void 0 : f.lastActive) || 0
2831
+ ((n = i.data) == null ? void 0 : n.createdAt) || ((u = i.data) == null ? void 0 : u.lastActive) || 0
2819
2832
  ).getTime();
2820
- return a === c ? (+r.id || 0) - (+i.id || 0) : a - c;
2833
+ return a === c ? (+s.id || 0) - (+i.id || 0) : a - c;
2821
2834
  })[0]) == null ? void 0 : t.id) || 0;
2822
2835
  }
2823
2836
  async confirmLeaderAfterLock() {
@@ -2826,10 +2839,9 @@ class Be {
2826
2839
  return !!(e && +this.id == +e);
2827
2840
  }
2828
2841
  async runAsLeader() {
2829
- var i, a;
2830
- const e = String(((a = (i = this.bx) == null ? void 0 : i.userInfo) == null ? void 0 : a.ID) ?? "0"), t = `background-worker:${this.entityName}:${e}`;
2831
- (await Se(
2832
- t,
2842
+ const e = O(this, Xt, Te).call(this);
2843
+ (await Be(
2844
+ e,
2833
2845
  async () => {
2834
2846
  if (await this.updateTabState(!0), console.log(
2835
2847
  `BackgroundWorker: захват лидерства, пауза ${this.leaderConfirmDelay} мс перед запуском`
@@ -2840,25 +2852,25 @@ class Be {
2840
2852
  return;
2841
2853
  }
2842
2854
  this.hasStarted = !0;
2843
- const l = this.leaderHeartbeatMs ?? Math.min(
2855
+ const i = this.leaderHeartbeatMs ?? Math.min(
2844
2856
  this.activeMaxPause - 1500,
2845
2857
  Math.max(2500, Math.floor(this.pollInterval / 2))
2846
2858
  );
2847
2859
  this.runHeartbeat = setInterval(
2848
2860
  () => {
2849
2861
  this.updateTabState(!0).catch(
2850
- (h) => console.error(
2862
+ (a) => console.error(
2851
2863
  "BackgroundWorker: heartbeat update failed",
2852
- h
2864
+ a
2853
2865
  )
2854
2866
  );
2855
2867
  },
2856
- l
2868
+ i
2857
2869
  );
2858
2870
  try {
2859
2871
  await this.appInit();
2860
- } catch (h) {
2861
- console.error("BackgroundWorker: appInit failed", h);
2872
+ } catch (a) {
2873
+ console.error("BackgroundWorker: appInit failed", a);
2862
2874
  }
2863
2875
  this.stopTimers(), this.id && (await this.deleteTabs([{ id: this.id }]), this.id = 0);
2864
2876
  },
@@ -2868,15 +2880,15 @@ class Be {
2868
2880
  );
2869
2881
  }
2870
2882
  async setBackgroundWorkerAll() {
2871
- var M, p, b, H;
2883
+ var M, N, b, H;
2872
2884
  if (!((M = this.bx) != null && M.isAdmin)) {
2873
2885
  console.log(
2874
2886
  "BackgroundWorker: setBackgroundWorkerAll доступен только админам"
2875
2887
  );
2876
2888
  return;
2877
2889
  }
2878
- (p = this.users) != null && p.length || await this.getEntityData(), qt(this.bx);
2879
- const e = _(this, Nt, Vt).call(this, ((H = (b = this.bx) == null ? void 0 : b.appConst) == null ? void 0 : H.pathApp) ?? "");
2890
+ (N = this.users) != null && N.length || await this.getEntityData(), Zt(this.bx);
2891
+ const e = O(this, _t, ee).call(this, ((H = (b = this.bx) == null ? void 0 : b.appConst) == null ? void 0 : H.pathApp) ?? "");
2880
2892
  if (!e) {
2881
2893
  console.error(
2882
2894
  "BackgroundWorker: setBackgroundWorkerAll — нет валидного pathApp, привязка PAGE_BACKGROUND_WORKER пропущена"
@@ -2885,77 +2897,80 @@ class Be {
2885
2897
  }
2886
2898
  const t = await this.safeCall(
2887
2899
  () => this.bx.getPlacement()
2888
- ), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2900
+ ), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2889
2901
  let a = null;
2890
- (t || []).forEach((N) => {
2891
- if (N.placement !== "PAGE_BACKGROUND_WORKER")
2902
+ (t || []).forEach((y) => {
2903
+ if (y.placement !== "PAGE_BACKGROUND_WORKER")
2892
2904
  return;
2893
- if (N.userId || N.handler && N.handler.includes("USER_ID=")) {
2894
- const L = N.userId || (N.handler ? this.extractUserIdFromHandler(N.handler) : null);
2895
- if (L) {
2896
- const w = +L;
2897
- r.set(w, N), i.has(w) || i.set(w, []), i.get(w).push(N);
2905
+ if (y.userId || y.handler && y.handler.includes("USER_ID=")) {
2906
+ const R = y.userId || (y.handler ? this.extractUserIdFromHandler(y.handler) : null);
2907
+ if (R) {
2908
+ const B = +R;
2909
+ s.set(B, y), i.has(B) || i.set(B, []), i.get(B).push(y);
2898
2910
  }
2899
2911
  } else
2900
- a = N;
2912
+ a = y;
2901
2913
  });
2902
- const c = await this.resolveAdmins(), l = await this.getEligibleUsersForBackgroundWorker(c);
2903
- l.sort((N, I) => {
2904
- const L = N.LAST_LOGIN ? new Date(N.LAST_LOGIN) : /* @__PURE__ */ new Date(0);
2905
- return (I.LAST_LOGIN ? new Date(I.LAST_LOGIN) : /* @__PURE__ */ new Date(0)) - L;
2914
+ const c = await this.resolveAdmins(), h = await this.getEligibleUsersForBackgroundWorker(c);
2915
+ h.sort((y, S) => {
2916
+ const R = y.LAST_LOGIN ? new Date(y.LAST_LOGIN) : /* @__PURE__ */ new Date(0);
2917
+ return (S.LAST_LOGIN ? new Date(S.LAST_LOGIN) : /* @__PURE__ */ new Date(0)) - R;
2906
2918
  });
2907
- const h = 10, n = l.slice(0, h), f = n.filter((N) => {
2908
- const I = r.get(+N.ID);
2909
- if (!I)
2919
+ const f = 10, n = this.coordinationScope === "portal" ? [] : h.slice(0, f), u = n.filter((y) => {
2920
+ const S = s.get(+y.ID);
2921
+ if (!S)
2910
2922
  return !0;
2911
- const L = `${e}?USER_ID=${N.ID}/`;
2912
- return I.handler !== L;
2913
- }), m = [];
2914
- for (const [N] of r) {
2915
- const I = +N || 0;
2916
- l.find((w) => +w.ID === I) || m.push(I);
2923
+ const R = `${e}?USER_ID=${y.ID}/`;
2924
+ return S.handler !== R;
2925
+ }), d = [];
2926
+ if (this.coordinationScope === "portal")
2927
+ for (const y of s.keys())
2928
+ d.push(+y);
2929
+ for (const [y] of s) {
2930
+ const S = +y || 0;
2931
+ h.find((B) => +B.ID === S) || d.push(S);
2917
2932
  }
2918
- for (const N of n) {
2919
- const I = r.get(+N.ID);
2920
- if (!I)
2933
+ for (const y of n) {
2934
+ const S = s.get(+y.ID);
2935
+ if (!S)
2921
2936
  continue;
2922
- const L = `${e}?USER_ID=${N.ID}/`;
2923
- I.handler !== L && m.push(+N.ID);
2937
+ const R = `${e}?USER_ID=${y.ID}/`;
2938
+ S.handler !== R && d.push(+y.ID);
2924
2939
  }
2925
- const A = [], u = [...new Set(m)];
2926
- for (const N of u) {
2927
- const I = i.get(+N) || [];
2928
- for (const L of I)
2929
- L != null && L.handler && A.push({
2940
+ const A = [], l = [...new Set(d)];
2941
+ for (const y of l) {
2942
+ const S = i.get(+y) || [];
2943
+ for (const R of S)
2944
+ R != null && R.handler && A.push({
2930
2945
  method: "placement.unbind",
2931
2946
  params: {
2932
2947
  PLACEMENT: "PAGE_BACKGROUND_WORKER",
2933
- HANDLER: L.handler
2948
+ HANDLER: R.handler
2934
2949
  }
2935
2950
  });
2936
2951
  }
2937
- const O = a && (f.length > 0 || a.handler !== `${e}`);
2938
- O && A.push({
2952
+ const _ = a && (u.length > 0 || a.handler !== `${e}`);
2953
+ _ && A.push({
2939
2954
  method: "placement.unbind",
2940
2955
  params: {
2941
2956
  PLACEMENT: "PAGE_BACKGROUND_WORKER",
2942
2957
  HANDLER: a.handler || `${e}`
2943
2958
  }
2944
2959
  });
2945
- for (const N of f)
2960
+ for (const y of u)
2946
2961
  A.push({
2947
2962
  method: "placement.bind",
2948
2963
  params: {
2949
2964
  PLACEMENT: "PAGE_BACKGROUND_WORKER",
2950
- HANDLER: `${e}?USER_ID=${N.ID}/`,
2965
+ HANDLER: `${e}?USER_ID=${y.ID}/`,
2951
2966
  LANG_ALL: { ru: { TITLE: this.appName } },
2952
2967
  OPTIONS: {
2953
- errorHandlerUrl: `${e}?USER_ID=${N.ID}/`
2968
+ errorHandlerUrl: `${e}?USER_ID=${y.ID}/`
2954
2969
  },
2955
- USER_ID: N.ID
2970
+ USER_ID: y.ID
2956
2971
  }
2957
2972
  });
2958
- (!a || O) && A.push({
2973
+ (!a || _) && A.push({
2959
2974
  method: "placement.bind",
2960
2975
  params: {
2961
2976
  PLACEMENT: "PAGE_BACKGROUND_WORKER",
@@ -2965,20 +2980,20 @@ class Be {
2965
2980
  }
2966
2981
  });
2967
2982
  const T = A.filter(
2968
- (N) => N.method === "placement.unbind"
2983
+ (y) => y.method === "placement.unbind"
2969
2984
  ), E = A.filter(
2970
- (N) => N.method === "placement.bind"
2985
+ (y) => y.method === "placement.bind"
2971
2986
  );
2972
2987
  T.length && await this.safeCall(
2973
2988
  () => this.bx.batch(
2974
2989
  Object.fromEntries(
2975
- T.map((N, I) => [`unbind_${I}`, N])
2990
+ T.map((y, S) => [`unbind_${S}`, y])
2976
2991
  )
2977
2992
  )
2978
2993
  ), E.length && await this.safeCall(
2979
2994
  () => this.bx.batch(
2980
2995
  Object.fromEntries(
2981
- E.map((N, I) => [`bind_${I}`, N])
2996
+ E.map((y, S) => [`bind_${S}`, y])
2982
2997
  )
2983
2998
  )
2984
2999
  ), A.length || console.log("setBackgroundWorkerAll: Нет операций");
@@ -2986,29 +3001,29 @@ class Be {
2986
3001
  async resolveAdmins() {
2987
3002
  var e, t;
2988
3003
  try {
2989
- const r = +(((e = this.bx.userInfo) == null ? void 0 : e.ID) ?? 0), i = !!((t = this.bx) != null && t.isAdmin), a = await this.getAdminsList() || [];
3004
+ const s = +(((e = this.bx.userInfo) == null ? void 0 : e.ID) ?? 0), i = !!((t = this.bx) != null && t.isAdmin), a = await this.getAdminsList() || [];
2990
3005
  if (!i) {
2991
- if (r && a.includes(+r)) {
2992
- const h = a.filter(
2993
- (n) => +n != +r
3006
+ if (s && a.includes(+s)) {
3007
+ const f = a.filter(
3008
+ (n) => +n != +s
2994
3009
  );
2995
- return await this.saveAdminsList(h), h;
3010
+ return await this.saveAdminsList(f), f;
2996
3011
  }
2997
3012
  return a;
2998
3013
  }
2999
3014
  const c = /* @__PURE__ */ new Set([...a || []]);
3000
- r && c.add(+r);
3001
- const l = [...c].filter(Boolean);
3002
- return await this.saveAdminsList(l), l;
3003
- } catch (r) {
3004
- return console.error("BackgroundWorker: resolveAdmins error", r), [];
3015
+ s && c.add(+s);
3016
+ const h = [...c].filter(Boolean);
3017
+ return await this.saveAdminsList(h), h;
3018
+ } catch (s) {
3019
+ return console.error("BackgroundWorker: resolveAdmins error", s), [];
3005
3020
  }
3006
3021
  }
3007
3022
  async getEligibleUsersForBackgroundWorker(e = []) {
3008
3023
  const t = (this.users ?? []).filter(
3009
3024
  (i) => i.ACTIVE === "Y" || i.ACTIVE === !0
3010
- ), r = e.map((i) => +i || 0).filter(Boolean);
3011
- return t.filter((i) => r.includes(+i.ID || 0));
3025
+ ), s = e.map((i) => +i || 0).filter(Boolean);
3026
+ return t.filter((i) => s.includes(+i.ID || 0));
3012
3027
  }
3013
3028
  async saveAdminsList(e = []) {
3014
3029
  try {
@@ -3020,7 +3035,7 @@ class Be {
3020
3035
  async getAdminsList() {
3021
3036
  try {
3022
3037
  const e = BX24.appOption.get("adminsList"), t = e ? JSON.parse(e) : [];
3023
- return Array.isArray(t) ? t.map((r) => +r || 0).filter(Boolean) : [];
3038
+ return Array.isArray(t) ? t.map((s) => +s || 0).filter(Boolean) : [];
3024
3039
  } catch (e) {
3025
3040
  return console.error("BackgroundWorker: getAdminsList error", e), [];
3026
3041
  }
@@ -3029,7 +3044,7 @@ class Be {
3029
3044
  const e = {
3030
3045
  users: { method: "user.get", params: { filter: { ACTIVE: "Y" } } }
3031
3046
  }, { users: t } = await this.safeCall(
3032
- () => this.bx.batch(e).then((r) => r ? (Array.isArray(r.users) || (r.users = []), r) : { users: [] })
3047
+ () => this.bx.batch(e).then((s) => s ? (Array.isArray(s.users) || (s.users = []), s) : { users: [] })
3033
3048
  );
3034
3049
  this.users = t;
3035
3050
  }
@@ -3042,9 +3057,9 @@ class Be {
3042
3057
  (e = this.bx) != null && e.isAdmin && ((t = this.users) != null && t.length || await this.getEntityData(), await this.setBackgroundWorkerAll());
3043
3058
  }
3044
3059
  pause(e = 500, t) {
3045
- return new Promise((r) => {
3060
+ return new Promise((s) => {
3046
3061
  setTimeout(() => {
3047
- t && t(), r(!0);
3062
+ t && t(), s(!0);
3048
3063
  }, e);
3049
3064
  });
3050
3065
  }
@@ -3057,28 +3072,33 @@ class Be {
3057
3072
  }
3058
3073
  }
3059
3074
  }
3060
- xt = new WeakSet(), pe = function(e) {
3061
- const t = De(e);
3075
+ vt = new WeakSet(), _e = function(e) {
3076
+ const t = He(e);
3062
3077
  this.startDelay = t.startDelayMs, this.leaderConfirmDelay = t.leaderConfirmDelayMs, this.activeMaxPause = t.activeMaxPauseMs, this.quickCleanupThreshold = t.quickCleanupThresholdMs, this.pollIntervalBase = t.pollIntervalMs, this.pollIntervalJitter = t.pollIntervalJitterMs, this.pollInterval = t.pollIntervalMs + (t.pollIntervalJitterMs > 0 ? Math.floor(Math.random() * t.pollIntervalJitterMs) : 0), this.leaderHeartbeatMs = t.leaderHeartbeatMs;
3063
- const r = t.pollIntervalMs + t.pollIntervalJitterMs + t.leaderConfirmDelayMs;
3064
- t.activeMaxPauseMs < r && console.warn(
3065
- `BackgroundWorker: activeMaxPauseMs (${t.activeMaxPauseMs}) меньше poll+jitter+leaderConfirm (${r}) — «живые» вкладки могут удаляться раньше следующего тика`
3078
+ const s = t.pollIntervalMs + t.pollIntervalJitterMs + t.leaderConfirmDelayMs;
3079
+ t.activeMaxPauseMs < s && console.warn(
3080
+ `BackgroundWorker: activeMaxPauseMs (${t.activeMaxPauseMs}) меньше poll+jitter+leaderConfirm (${s}) — «живые» вкладки могут удаляться раньше следующего тика`
3066
3081
  );
3067
- }, Nt = new WeakSet(), Vt = function(e) {
3082
+ }, _t = new WeakSet(), ee = function(e) {
3068
3083
  if (!e || typeof e != "string")
3069
3084
  return "";
3070
- const t = $t(e).replace(/\/+$/, "");
3071
- return t ? le(t) ? (console.error(
3085
+ const t = re(e).replace(/\/+$/, "");
3086
+ return t ? fe(t) ? (console.error(
3072
3087
  "BackgroundWorker: pathApp не должен указывать на /marketplace/app/… Откройте приложение во встроенном iframe (entry CDN), не в оболочке маркетплейса."
3073
3088
  ), "") : t : "";
3089
+ }, nt = new WeakSet(), dt = function() {
3090
+ var e, t;
3091
+ return this.coordinationScope === "portal" ? `${this.appCodeName || "app"}:portal` : String(((t = (e = this.bx) == null ? void 0 : e.userInfo) == null ? void 0 : t.ID) ?? "");
3092
+ }, Xt = new WeakSet(), Te = function() {
3093
+ return `background-worker:${this.entityName}:${O(this, nt, dt).call(this)}`;
3074
3094
  };
3075
3095
  export {
3076
- Be as BackgroundWorker,
3096
+ Ge as BackgroundWorker,
3077
3097
  K as Batch,
3078
- we as BxBoot,
3079
- ne as BxHelper,
3080
- be as BxLogger,
3098
+ Pe as BxBoot,
3099
+ Ae as BxHelper,
3100
+ Se as BxLogger,
3081
3101
  q as DEFAULT_BACKGROUND_WORKER_TIMING,
3082
- De as resolveBackgroundWorkerTiming,
3083
- Ot as tempus
3102
+ He as resolveBackgroundWorkerTiming,
3103
+ Tt as tempus
3084
3104
  };