@bitrix24/b24jssdk 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @version @bitrix24/b24jssdk v0.4.4
2
+ * @version @bitrix24/b24jssdk v0.4.6
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -171,7 +171,7 @@
171
171
  return DataType2;
172
172
  })(DataType || {});
173
173
 
174
- const objectCtorString = Function.prototype.toString.call(Object);
174
+ const OBJECT_CONSTRUCTOR_STRING = Function.prototype.toString.call(Object);
175
175
  class TypeManager {
176
176
  getTag(value) {
177
177
  return Object.prototype.toString.call(value);
@@ -184,10 +184,7 @@
184
184
  * @memo get from pull.client.Utils
185
185
  */
186
186
  isString(value) {
187
- return value === "" ? true : (
188
- // eslint-disable-next-line unicorn/no-nested-ternary
189
- value ? typeof value === "string" || value instanceof String : false
190
- );
187
+ return typeof value === "string" || value instanceof String;
191
188
  }
192
189
  /**
193
190
  * Returns true if a value is not an empty string
@@ -204,14 +201,19 @@
204
201
  *
205
202
  * @memo get from pull.client.Utils
206
203
  */
204
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
207
205
  isFunction(value) {
208
- return value === null ? false : typeof value === "function" || value instanceof Function;
206
+ return value === null ? false : (
207
+ // eslint-disable-next-line unicorn/no-instanceof-builtins
208
+ typeof value === "function" || value instanceof Function
209
+ );
209
210
  }
210
211
  /**
211
212
  * Checks that value is an object
212
213
  * @param value
213
214
  * @return {boolean}
214
215
  */
216
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
215
217
  isObject(value) {
216
218
  return !!value && (typeof value === "object" || typeof value === "function");
217
219
  }
@@ -237,7 +239,7 @@
237
239
  return true;
238
240
  }
239
241
  const ctor = proto.hasOwnProperty("constructor") && proto.constructor;
240
- return typeof ctor === "function" && Function.prototype.toString.call(ctor) === objectCtorString;
242
+ return typeof ctor === "function" && Function.prototype.toString.call(ctor) === OBJECT_CONSTRUCTOR_STRING;
241
243
  }
242
244
  isJsonRpcRequest(value) {
243
245
  return typeof value === "object" && value && "jsonrpc" in value && this.isStringFilled(value.jsonrpc) && "method" in value && this.isStringFilled(value.method);
@@ -259,7 +261,7 @@
259
261
  * @return {boolean}
260
262
  */
261
263
  isNumber(value) {
262
- return !Number.isNaN(value) && typeof value === "number";
264
+ return typeof value === "number" && !Number.isNaN(value);
263
265
  }
264
266
  /**
265
267
  * Checks that value is integer
@@ -267,7 +269,7 @@
267
269
  * @return {boolean}
268
270
  */
269
271
  isInteger(value) {
270
- return this.isNumber(value) && value % 1 === 0;
272
+ return Number.isInteger(value);
271
273
  }
272
274
  /**
273
275
  * Checks that value is float
@@ -315,7 +317,7 @@
315
317
  * @return {boolean}
316
318
  */
317
319
  isDate(value) {
318
- return this.isObjectLike(value) && this.getTag(value) === "[object Date]";
320
+ return value instanceof Date;
319
321
  }
320
322
  /**
321
323
  * Checks that is a DOM node
@@ -444,12 +446,15 @@
444
446
  * @return {boolean}
445
447
  */
446
448
  isFormData(value) {
447
- return value instanceof FormData;
449
+ if (typeof FormData !== "undefined" && value instanceof FormData) {
450
+ return true;
451
+ }
452
+ return this.isObjectLike(value) && this.getTag(value) === "[object FormData]";
448
453
  }
449
454
  clone(obj, bCopyObj = true) {
450
455
  let _obj, i, l;
451
- if (obj === null) {
452
- return null;
456
+ if (this.isNil(obj) || typeof obj !== "object") {
457
+ return obj;
453
458
  }
454
459
  if (this.isDomNode(obj)) {
455
460
  _obj = obj.cloneNode(bCopyObj);
@@ -1567,10 +1572,18 @@
1567
1572
 
1568
1573
  months(length, format = false) {
1569
1574
  return listStuff(this, length, months, () => {
1575
+ // Workaround for "ja" locale: formatToParts does not label all parts of the month
1576
+ // as "month" and for this locale there is no difference between "format" and "non-format".
1577
+ // As such, just use format() instead of formatToParts() and take the whole string
1578
+ const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-");
1579
+ format &= !monthSpecialCase;
1570
1580
  const intl = format ? { month: length, day: "numeric" } : { month: length },
1571
1581
  formatStr = format ? "format" : "standalone";
1572
1582
  if (!this.monthsCache[formatStr][length]) {
1573
- this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
1583
+ const mapper = !monthSpecialCase
1584
+ ? (dt) => this.extract(dt, intl, "month")
1585
+ : (dt) => this.dtFormatter(dt, intl).format();
1586
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
1574
1587
  }
1575
1588
  return this.monthsCache[formatStr][length];
1576
1589
  });
@@ -1899,7 +1912,6 @@
1899
1912
  * @private
1900
1913
  */
1901
1914
 
1902
-
1903
1915
  function normalizeZone(input, defaultZone) {
1904
1916
  if (isUndefined$1(input) || input === null) {
1905
1917
  return defaultZone;
@@ -2404,7 +2416,6 @@
2404
2416
  it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.
2405
2417
  */
2406
2418
 
2407
-
2408
2419
  /**
2409
2420
  * @private
2410
2421
  */
@@ -2556,10 +2567,24 @@
2556
2567
  }
2557
2568
  }
2558
2569
 
2559
- function roundTo(number, digits, towardZero = false) {
2560
- const factor = 10 ** digits,
2561
- rounder = towardZero ? Math.trunc : Math.round;
2562
- return rounder(number * factor) / factor;
2570
+ function roundTo(number, digits, rounding = "round") {
2571
+ const factor = 10 ** digits;
2572
+ switch (rounding) {
2573
+ case "expand":
2574
+ return number > 0
2575
+ ? Math.ceil(number * factor) / factor
2576
+ : Math.floor(number * factor) / factor;
2577
+ case "trunc":
2578
+ return Math.trunc(number * factor) / factor;
2579
+ case "round":
2580
+ return Math.round(number * factor) / factor;
2581
+ case "floor":
2582
+ return Math.floor(number * factor) / factor;
2583
+ case "ceil":
2584
+ return Math.ceil(number * factor) / factor;
2585
+ default:
2586
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
2587
+ }
2563
2588
  }
2564
2589
 
2565
2590
  // DATE BASICS
@@ -2667,7 +2692,7 @@
2667
2692
 
2668
2693
  function asNumber(value) {
2669
2694
  const numericValue = Number(value);
2670
- if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
2695
+ if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue))
2671
2696
  throw new InvalidArgumentError(`Invalid unit value ${value}`);
2672
2697
  return numericValue;
2673
2698
  }
@@ -2926,8 +2951,12 @@
2926
2951
  for (let i = 0; i < fmt.length; i++) {
2927
2952
  const c = fmt.charAt(i);
2928
2953
  if (c === "'") {
2929
- if (currentFull.length > 0) {
2930
- splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull });
2954
+ // turn '' into a literal signal quote instead of just skipping the empty literal
2955
+ if (currentFull.length > 0 || bracketed) {
2956
+ splits.push({
2957
+ literal: bracketed || /^\s+$/.test(currentFull),
2958
+ val: currentFull === "" ? "'" : currentFull,
2959
+ });
2931
2960
  }
2932
2961
  current = null;
2933
2962
  currentFull = "";
@@ -2991,7 +3020,7 @@
2991
3020
  return this.dtFormatter(dt, opts).resolvedOptions();
2992
3021
  }
2993
3022
 
2994
- num(n, p = 0) {
3023
+ num(n, p = 0, signDisplay = undefined) {
2995
3024
  // we get some perf out of doing this here, annoyingly
2996
3025
  if (this.opts.forceSimple) {
2997
3026
  return padStart(n, p);
@@ -3002,6 +3031,9 @@
3002
3031
  if (p > 0) {
3003
3032
  opts.padTo = p;
3004
3033
  }
3034
+ if (signDisplay) {
3035
+ opts.signDisplay = signDisplay;
3036
+ }
3005
3037
 
3006
3038
  return this.loc.numberFormatter(opts).format(n);
3007
3039
  }
@@ -3237,32 +3269,44 @@
3237
3269
  }
3238
3270
 
3239
3271
  formatDurationFromString(dur, fmt) {
3272
+ const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
3240
3273
  const tokenToField = (token) => {
3241
3274
  switch (token[0]) {
3242
3275
  case "S":
3243
- return "millisecond";
3276
+ return "milliseconds";
3244
3277
  case "s":
3245
- return "second";
3278
+ return "seconds";
3246
3279
  case "m":
3247
- return "minute";
3280
+ return "minutes";
3248
3281
  case "h":
3249
- return "hour";
3282
+ return "hours";
3250
3283
  case "d":
3251
- return "day";
3284
+ return "days";
3252
3285
  case "w":
3253
- return "week";
3286
+ return "weeks";
3254
3287
  case "M":
3255
- return "month";
3288
+ return "months";
3256
3289
  case "y":
3257
- return "year";
3290
+ return "years";
3258
3291
  default:
3259
3292
  return null;
3260
3293
  }
3261
3294
  },
3262
- tokenToString = (lildur) => (token) => {
3295
+ tokenToString = (lildur, info) => (token) => {
3263
3296
  const mapped = tokenToField(token);
3264
3297
  if (mapped) {
3265
- return this.num(lildur.get(mapped), token.length);
3298
+ const inversionFactor =
3299
+ info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
3300
+ let signDisplay;
3301
+ if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) {
3302
+ signDisplay = "never";
3303
+ } else if (this.opts.signMode === "all") {
3304
+ signDisplay = "always";
3305
+ } else {
3306
+ // "auto" and "negative" are the same, but "auto" has better support
3307
+ signDisplay = "auto";
3308
+ }
3309
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
3266
3310
  } else {
3267
3311
  return token;
3268
3312
  }
@@ -3272,8 +3316,14 @@
3272
3316
  (found, { literal, val }) => (literal ? found : found.concat(val)),
3273
3317
  []
3274
3318
  ),
3275
- collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
3276
- return stringifyTokens(tokens, tokenToString(collapsed));
3319
+ collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),
3320
+ durationInfo = {
3321
+ isNegativeDuration: collapsed < 0,
3322
+ // this relies on "collapsed" being based on "shiftTo", which builds up the object
3323
+ // in order
3324
+ largestUnit: Object.keys(collapsed.values)[0],
3325
+ };
3326
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
3277
3327
  }
3278
3328
  }
3279
3329
 
@@ -3334,11 +3384,11 @@
3334
3384
  }
3335
3385
 
3336
3386
  // ISO and SQL parsing
3337
- const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
3387
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
3338
3388
  const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
3339
3389
  const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
3340
3390
  const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
3341
- const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
3391
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
3342
3392
  const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
3343
3393
  const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
3344
3394
  const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
@@ -4053,9 +4103,13 @@
4053
4103
  * @param {string} fmt - the format string
4054
4104
  * @param {Object} opts - options
4055
4105
  * @param {boolean} [opts.floor=true] - floor numerical values
4106
+ * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs
4056
4107
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
4057
4108
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
4058
4109
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
4110
+ * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2"
4111
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2"
4112
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2"
4059
4113
  * @return {string}
4060
4114
  */
4061
4115
  toFormat(fmt, opts = {}) {
@@ -4075,21 +4129,25 @@
4075
4129
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
4076
4130
  * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
4077
4131
  * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
4132
+ * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero
4078
4133
  * @example
4079
4134
  * ```js
4080
- * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
4081
- * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
4082
- * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
4083
- * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
4135
+ * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })
4136
+ * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'
4137
+ * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'
4138
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min'
4139
+ * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'
4084
4140
  * ```
4085
4141
  */
4086
4142
  toHuman(opts = {}) {
4087
4143
  if (!this.isValid) return INVALID$2;
4088
4144
 
4145
+ const showZeros = opts.showZeros !== false;
4146
+
4089
4147
  const l = orderedUnits$1
4090
4148
  .map((unit) => {
4091
4149
  const val = this.values[unit];
4092
- if (isUndefined$1(val)) {
4150
+ if (isUndefined$1(val) || (val === 0 && !showZeros)) {
4093
4151
  return null;
4094
4152
  }
4095
4153
  return this.loc
@@ -4449,6 +4507,17 @@
4449
4507
  return clone$1(this, { values: negated }, true);
4450
4508
  }
4451
4509
 
4510
+ /**
4511
+ * Removes all units with values equal to 0 from this Duration.
4512
+ * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }
4513
+ * @return {Duration}
4514
+ */
4515
+ removeZeros() {
4516
+ if (!this.isValid) return this;
4517
+ const vals = removeZeroes(this.values);
4518
+ return clone$1(this, { values: vals }, true);
4519
+ }
4520
+
4452
4521
  /**
4453
4522
  * Get the years.
4454
4523
  * @type {number}
@@ -4759,7 +4828,8 @@
4759
4828
  }
4760
4829
 
4761
4830
  /**
4762
- * Returns the end of the Interval
4831
+ * Returns the end of the Interval. This is the first instant which is not part of the interval
4832
+ * (Interval is half-open).
4763
4833
  * @type {DateTime}
4764
4834
  */
4765
4835
  get end() {
@@ -6190,21 +6260,22 @@
6190
6260
  : null;
6191
6261
  }
6192
6262
 
6193
- function toISODate(o, extended) {
6263
+ function toISODate(o, extended, precision) {
6194
6264
  const longFormat = o.c.year > 9999 || o.c.year < 0;
6195
6265
  let c = "";
6196
6266
  if (longFormat && o.c.year >= 0) c += "+";
6197
6267
  c += padStart(o.c.year, longFormat ? 6 : 4);
6198
-
6268
+ if (precision === "year") return c;
6199
6269
  if (extended) {
6200
6270
  c += "-";
6201
6271
  c += padStart(o.c.month);
6272
+ if (precision === "month") return c;
6202
6273
  c += "-";
6203
- c += padStart(o.c.day);
6204
6274
  } else {
6205
6275
  c += padStart(o.c.month);
6206
- c += padStart(o.c.day);
6276
+ if (precision === "month") return c;
6207
6277
  }
6278
+ c += padStart(o.c.day);
6208
6279
  return c;
6209
6280
  }
6210
6281
 
@@ -6214,26 +6285,39 @@
6214
6285
  suppressSeconds,
6215
6286
  suppressMilliseconds,
6216
6287
  includeOffset,
6217
- extendedZone
6288
+ extendedZone,
6289
+ precision
6218
6290
  ) {
6219
- let c = padStart(o.c.hour);
6220
- if (extended) {
6221
- c += ":";
6222
- c += padStart(o.c.minute);
6223
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6224
- c += ":";
6225
- }
6226
- } else {
6227
- c += padStart(o.c.minute);
6228
- }
6229
-
6230
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6231
- c += padStart(o.c.second);
6232
-
6233
- if (o.c.millisecond !== 0 || !suppressMilliseconds) {
6234
- c += ".";
6235
- c += padStart(o.c.millisecond, 3);
6236
- }
6291
+ let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,
6292
+ c = "";
6293
+ switch (precision) {
6294
+ case "day":
6295
+ case "month":
6296
+ case "year":
6297
+ break;
6298
+ default:
6299
+ c += padStart(o.c.hour);
6300
+ if (precision === "hour") break;
6301
+ if (extended) {
6302
+ c += ":";
6303
+ c += padStart(o.c.minute);
6304
+ if (precision === "minute") break;
6305
+ if (showSeconds) {
6306
+ c += ":";
6307
+ c += padStart(o.c.second);
6308
+ }
6309
+ } else {
6310
+ c += padStart(o.c.minute);
6311
+ if (precision === "minute") break;
6312
+ if (showSeconds) {
6313
+ c += padStart(o.c.second);
6314
+ }
6315
+ }
6316
+ if (precision === "second") break;
6317
+ if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
6318
+ c += ".";
6319
+ c += padStart(o.c.millisecond, 3);
6320
+ }
6237
6321
  }
6238
6322
 
6239
6323
  if (includeOffset) {
@@ -6425,8 +6509,9 @@
6425
6509
 
6426
6510
  function diffRelative(start, end, opts) {
6427
6511
  const round = isUndefined$1(opts.round) ? true : opts.round,
6512
+ rounding = isUndefined$1(opts.rounding) ? "trunc" : opts.rounding,
6428
6513
  format = (c, unit) => {
6429
- c = roundTo(c, round || opts.calendary ? 0 : 2, true);
6514
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
6430
6515
  const formatter = end.loc.clone(opts).relFormatter(opts);
6431
6516
  return formatter.format(c, unit);
6432
6517
  },
@@ -6679,7 +6764,7 @@
6679
6764
  throw new InvalidArgumentError(
6680
6765
  `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`
6681
6766
  );
6682
- } else if (milliseconds < -864e13 || milliseconds > MAX_DATE) {
6767
+ } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
6683
6768
  // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start
6684
6769
  return DateTime.invalid("Timestamp out of range");
6685
6770
  } else {
@@ -7805,10 +7890,13 @@
7805
7890
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
7806
7891
  * @param {boolean} [opts.extendedZone=false] - add the time zone format extension
7807
7892
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
7893
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
7808
7894
  * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
7809
7895
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
7810
7896
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
7811
7897
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
7898
+ * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'
7899
+ * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'
7812
7900
  * @return {string|null}
7813
7901
  */
7814
7902
  toISO({
@@ -7817,16 +7905,26 @@
7817
7905
  suppressMilliseconds = false,
7818
7906
  includeOffset = true,
7819
7907
  extendedZone = false,
7908
+ precision = "milliseconds",
7820
7909
  } = {}) {
7821
7910
  if (!this.isValid) {
7822
7911
  return null;
7823
7912
  }
7824
7913
 
7914
+ precision = normalizeUnit(precision);
7825
7915
  const ext = format === "extended";
7826
7916
 
7827
- let c = toISODate(this, ext);
7828
- c += "T";
7829
- c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
7917
+ let c = toISODate(this, ext, precision);
7918
+ if (orderedUnits.indexOf(precision) >= 3) c += "T";
7919
+ c += toISOTime(
7920
+ this,
7921
+ ext,
7922
+ suppressSeconds,
7923
+ suppressMilliseconds,
7924
+ includeOffset,
7925
+ extendedZone,
7926
+ precision
7927
+ );
7830
7928
  return c;
7831
7929
  }
7832
7930
 
@@ -7834,16 +7932,17 @@
7834
7932
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
7835
7933
  * @param {Object} opts - options
7836
7934
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
7935
+ * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.
7837
7936
  * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
7838
7937
  * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
7938
+ * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'
7839
7939
  * @return {string|null}
7840
7940
  */
7841
- toISODate({ format = "extended" } = {}) {
7941
+ toISODate({ format = "extended", precision = "day" } = {}) {
7842
7942
  if (!this.isValid) {
7843
7943
  return null;
7844
7944
  }
7845
-
7846
- return toISODate(this, format === "extended");
7945
+ return toISODate(this, format === "extended", normalizeUnit(precision));
7847
7946
  }
7848
7947
 
7849
7948
  /**
@@ -7864,10 +7963,12 @@
7864
7963
  * @param {boolean} [opts.extendedZone=true] - add the time zone format extension
7865
7964
  * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
7866
7965
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
7966
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
7867
7967
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
7868
7968
  * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
7869
7969
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
7870
7970
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
7971
+ * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'
7871
7972
  * @return {string}
7872
7973
  */
7873
7974
  toISOTime({
@@ -7877,12 +7978,14 @@
7877
7978
  includePrefix = false,
7878
7979
  extendedZone = false,
7879
7980
  format = "extended",
7981
+ precision = "milliseconds",
7880
7982
  } = {}) {
7881
7983
  if (!this.isValid) {
7882
7984
  return null;
7883
7985
  }
7884
7986
 
7885
- let c = includePrefix ? "T" : "";
7987
+ precision = normalizeUnit(precision);
7988
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
7886
7989
  return (
7887
7990
  c +
7888
7991
  toISOTime(
@@ -7891,7 +7994,8 @@
7891
7994
  suppressSeconds,
7892
7995
  suppressMilliseconds,
7893
7996
  includeOffset,
7894
- extendedZone
7997
+ extendedZone,
7998
+ precision
7895
7999
  )
7896
8000
  );
7897
8001
  }
@@ -8169,12 +8273,13 @@
8169
8273
 
8170
8274
  /**
8171
8275
  * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
8172
- * platform supports Intl.RelativeTimeFormat. Rounds down by default.
8276
+ * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.
8173
8277
  * @param {Object} options - options that affect the output
8174
8278
  * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
8175
8279
  * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
8176
8280
  * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
8177
8281
  * @param {boolean} [options.round=true] - whether to round the numbers in the output.
8282
+ * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil".
8178
8283
  * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
8179
8284
  * @param {string} options.locale - override the locale of this DateTime
8180
8285
  * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
@@ -9837,6 +9942,27 @@ ${this.stack}`;
9837
9942
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
9838
9943
  };
9839
9944
 
9945
+ /**
9946
+ * Determine if a value is an empty object (safely handles Buffers)
9947
+ *
9948
+ * @param {*} val The value to test
9949
+ *
9950
+ * @returns {boolean} True if value is an empty object, otherwise false
9951
+ */
9952
+ const isEmptyObject = (val) => {
9953
+ // Early return for non-objects or Buffers to prevent RangeError
9954
+ if (!isObject(val) || isBuffer$1(val)) {
9955
+ return false;
9956
+ }
9957
+
9958
+ try {
9959
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
9960
+ } catch (e) {
9961
+ // Fallback for any other objects that might cause RangeError with Object.keys()
9962
+ return false;
9963
+ }
9964
+ };
9965
+
9840
9966
  /**
9841
9967
  * Determine if a value is a Date
9842
9968
  *
@@ -9959,6 +10085,11 @@ ${this.stack}`;
9959
10085
  fn.call(null, obj[i], i, obj);
9960
10086
  }
9961
10087
  } else {
10088
+ // Buffer check
10089
+ if (isBuffer$1(obj)) {
10090
+ return;
10091
+ }
10092
+
9962
10093
  // Iterate over object keys
9963
10094
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
9964
10095
  const len = keys.length;
@@ -9972,6 +10103,10 @@ ${this.stack}`;
9972
10103
  }
9973
10104
 
9974
10105
  function findKey(obj, key) {
10106
+ if (isBuffer$1(obj)){
10107
+ return null;
10108
+ }
10109
+
9975
10110
  key = key.toLowerCase();
9976
10111
  const keys = Object.keys(obj);
9977
10112
  let i = keys.length;
@@ -10325,6 +10460,11 @@ ${this.stack}`;
10325
10460
  return;
10326
10461
  }
10327
10462
 
10463
+ //Buffer check
10464
+ if (isBuffer$1(source)) {
10465
+ return source;
10466
+ }
10467
+
10328
10468
  if(!('toJSON' in source)) {
10329
10469
  stack[i] = source;
10330
10470
  const target = isArray$3(source) ? [] : {};
@@ -10396,6 +10536,7 @@ ${this.stack}`;
10396
10536
  isBoolean,
10397
10537
  isObject,
10398
10538
  isPlainObject,
10539
+ isEmptyObject,
10399
10540
  isReadableStream,
10400
10541
  isRequest,
10401
10542
  isResponse,
@@ -10660,6 +10801,10 @@ ${this.stack}`;
10660
10801
  return value.toISOString();
10661
10802
  }
10662
10803
 
10804
+ if (utils$1.isBoolean(value)) {
10805
+ return value.toString();
10806
+ }
10807
+
10663
10808
  if (!useBlob && utils$1.isBlob(value)) {
10664
10809
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
10665
10810
  }
@@ -11021,7 +11166,7 @@ ${this.stack}`;
11021
11166
  };
11022
11167
 
11023
11168
  function toURLEncodedForm(data, options) {
11024
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
11169
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
11025
11170
  visitor: function(value, key, path, helpers) {
11026
11171
  if (platform.isNode && utils$1.isBuffer(value)) {
11027
11172
  this.append(key, value.toString('base64'));
@@ -11029,8 +11174,9 @@ ${this.stack}`;
11029
11174
  }
11030
11175
 
11031
11176
  return helpers.defaultVisitor.apply(this, arguments);
11032
- }
11033
- }, options));
11177
+ },
11178
+ ...options
11179
+ });
11034
11180
  }
11035
11181
 
11036
11182
  /**
@@ -11779,7 +11925,7 @@ ${this.stack}`;
11779
11925
  clearTimeout(timer);
11780
11926
  timer = null;
11781
11927
  }
11782
- fn.apply(null, args);
11928
+ fn(...args);
11783
11929
  };
11784
11930
 
11785
11931
  const throttled = (...args) => {
@@ -12035,7 +12181,7 @@ ${this.stack}`;
12035
12181
  headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
12036
12182
  };
12037
12183
 
12038
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
12184
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
12039
12185
  const merge = mergeMap[prop] || mergeDeepProperties;
12040
12186
  const configValue = merge(config1[prop], config2[prop], prop);
12041
12187
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -12568,7 +12714,7 @@ ${this.stack}`;
12568
12714
  credentials: isCredentialsSupported ? withCredentials : undefined
12569
12715
  });
12570
12716
 
12571
- let response = await fetch(request);
12717
+ let response = await fetch(request, fetchOptions);
12572
12718
 
12573
12719
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
12574
12720
 
@@ -12774,7 +12920,7 @@ ${this.stack}`;
12774
12920
  });
12775
12921
  }
12776
12922
 
12777
- const VERSION$1 = "1.9.0";
12923
+ const VERSION$1 = "1.11.0";
12778
12924
 
12779
12925
  const validators$1 = {};
12780
12926
 
@@ -13013,8 +13159,8 @@ ${this.stack}`;
13013
13159
 
13014
13160
  if (!synchronousRequestInterceptors) {
13015
13161
  const chain = [dispatchRequest.bind(this), undefined];
13016
- chain.unshift.apply(chain, requestInterceptorChain);
13017
- chain.push.apply(chain, responseInterceptorChain);
13162
+ chain.unshift(...requestInterceptorChain);
13163
+ chain.push(...responseInterceptorChain);
13018
13164
  len = chain.length;
13019
13165
 
13020
13166
  promise = Promise.resolve(config);
@@ -13768,7 +13914,7 @@ ${this.stack}`;
13768
13914
  let tmpSc = sideChannel;
13769
13915
  let step = 0;
13770
13916
  let findFlag = false;
13771
- while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
13917
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
13772
13918
  // Where object last appeared in the ref tree
13773
13919
  const pos = tmpSc.get(object);
13774
13920
  step += 1;
@@ -13833,7 +13979,7 @@ ${this.stack}`;
13833
13979
  if (encodeValuesOnly && encoder) {
13834
13980
  obj = maybeMap(obj, encoder);
13835
13981
  }
13836
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void 0 }];
13982
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
13837
13983
  } else if (isArray$1(filter)) {
13838
13984
  objKeys = filter;
13839
13985
  } else {
@@ -14230,7 +14376,7 @@ ${this.stack}`;
14230
14376
  #clientSideWarningMessage = "";
14231
14377
  constructor(baseURL, authActions, options) {
14232
14378
  const defaultHeaders = {
14233
- // 'X-Sdk': 'b24-js-sdk-v-0.4.4'
14379
+ // 'X-Sdk': 'b24-js-sdk-v-0.4.6'
14234
14380
  };
14235
14381
  this.#clientAxios = axios.create({
14236
14382
  baseURL,
@@ -14295,19 +14441,21 @@ ${this.stack}`;
14295
14441
  }
14296
14442
  // endregion ////
14297
14443
  // region Actions Call ////
14298
- async batch(calls, isHaltOnError = true) {
14444
+ async batch(calls, isHaltOnError = true, returnAjaxResult = false) {
14299
14445
  if (Array.isArray(calls)) {
14300
14446
  return this.#batchAsArray(
14301
14447
  calls,
14302
- isHaltOnError
14448
+ isHaltOnError,
14449
+ returnAjaxResult
14303
14450
  );
14304
14451
  }
14305
14452
  return this.#batchAsObject(
14306
14453
  calls,
14307
- isHaltOnError
14454
+ isHaltOnError,
14455
+ returnAjaxResult
14308
14456
  );
14309
14457
  }
14310
- async #batchAsObject(calls, isHaltOnError = true) {
14458
+ async #batchAsObject(calls, isHaltOnError = true, returnAjaxResult = false) {
14311
14459
  const cmd = {};
14312
14460
  let cnt = 0;
14313
14461
  const processRow = (row, index) => {
@@ -14403,13 +14551,13 @@ ${this.stack}`;
14403
14551
  }
14404
14552
  return Promise.reject(error);
14405
14553
  }
14406
- dataResult[key] = data.getData().result;
14554
+ dataResult[key] = returnAjaxResult ? data : data.getData().result;
14407
14555
  }
14408
14556
  result.setData(dataResult);
14409
14557
  return Promise.resolve(result);
14410
14558
  });
14411
14559
  }
14412
- async #batchAsArray(calls, isHaltOnError = true) {
14560
+ async #batchAsArray(calls, isHaltOnError = true, returnAjaxResult = false) {
14413
14561
  const cmd = [];
14414
14562
  let cnt = 0;
14415
14563
  const processRow = (row) => {
@@ -14506,7 +14654,7 @@ ${this.stack}`;
14506
14654
  }
14507
14655
  return Promise.reject(error);
14508
14656
  }
14509
- dataResult.push(data.getData().result);
14657
+ dataResult.push(returnAjaxResult ? data : data.getData().result);
14510
14658
  }
14511
14659
  result.setData(dataResult);
14512
14660
  return Promise.resolve(result);
@@ -14658,7 +14806,7 @@ ${this.stack}`;
14658
14806
  const baseUrl = `${encodeURIComponent(method)}.json`;
14659
14807
  const queryParams = new URLSearchParams({
14660
14808
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
14661
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.4",
14809
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.6",
14662
14810
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
14663
14811
  });
14664
14812
  return `${baseUrl}?${queryParams.toString()}`;
@@ -14806,8 +14954,8 @@ ${this.stack}`;
14806
14954
  /**
14807
14955
  * @inheritDoc
14808
14956
  */
14809
- async callBatch(calls, isHaltOnError = true) {
14810
- return this.getHttpClient().batch(calls, isHaltOnError);
14957
+ async callBatch(calls, isHaltOnError = true, returnAjaxResult = false) {
14958
+ return this.getHttpClient().batch(calls, isHaltOnError, returnAjaxResult);
14811
14959
  }
14812
14960
  chunkArray(array, chunkSize = 50) {
14813
14961
  const result = [];
@@ -15159,7 +15307,7 @@ ${this.stack}`;
15159
15307
  * @returns {boolean} true if the passed IBAN is valid, false otherwise
15160
15308
  */
15161
15309
  isValid(iban) {
15162
- if (!this._isString(iban)) {
15310
+ if (!Type.isString(iban)) {
15163
15311
  return false;
15164
15312
  }
15165
15313
  iban = this.electronicFormat(iban);
@@ -15234,7 +15382,7 @@ ${this.stack}`;
15234
15382
  * @param bban the BBAN to check the validity of
15235
15383
  */
15236
15384
  isValidBBAN(countryCode, bban) {
15237
- if (!this._isString(bban)) {
15385
+ if (!Type.isString(bban)) {
15238
15386
  return false;
15239
15387
  }
15240
15388
  if (!this._countries.has(countryCode)) {
@@ -15244,11 +15392,6 @@ ${this.stack}`;
15244
15392
  return !!countryStructure && countryStructure.isValidBBAN(this.electronicFormat(bban));
15245
15393
  }
15246
15394
  // endregion ////
15247
- // region Tools ////
15248
- _isString(value) {
15249
- return typeof value == "string" || value instanceof String;
15250
- }
15251
- // endregion ////
15252
15395
  }
15253
15396
 
15254
15397
  const useFormatter = () => {
@@ -15936,8 +16079,11 @@ ${this.stack}`;
15936
16079
  };
15937
16080
  } else {
15938
16081
  cmd = command.toString();
16082
+ if (params?.isRawValue !== true) {
16083
+ paramsSend = JSON.stringify(paramsSend);
16084
+ }
15939
16085
  const listParams = [
15940
- paramsSend ? JSON.stringify(paramsSend) : "",
16086
+ paramsSend || "",
15941
16087
  keyPromise,
15942
16088
  this.#appFrame.getAppSid()
15943
16089
  ];
@@ -16740,18 +16886,20 @@ ${this.stack}`;
16740
16886
  }
16741
16887
  /**
16742
16888
  * Call the Registered Interface Command
16743
- * @param {string} command
16744
- * @param {Record<string, any>} parameters
16745
- * @return {Promise<any>}
16889
+ * @param { string } command
16890
+ * @param { Record<string, any> } parameters
16891
+ * @return { Promise<any> }
16746
16892
  *
16747
16893
  * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
16894
+ * @memo For the `setValue` command, use the following parameters { value: string }
16748
16895
  */
16749
16896
  async call(command, parameters = {}) {
16750
16897
  return this.#messageManager.send(
16751
16898
  command,
16752
16899
  {
16753
16900
  ...parameters,
16754
- isSafely: true
16901
+ isSafely: true,
16902
+ isRawValue: ["setValue"].includes(command)
16755
16903
  }
16756
16904
  );
16757
16905
  }
@@ -20733,7 +20881,7 @@ ${this.stack}`;
20733
20881
  } : create_array;
20734
20882
  Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */
20735
20883
  util.Array.prototype.slice;
20736
- Reader.prototype.uint32 = /* @__PURE__ */ function read_uint32_setup() {
20884
+ Reader.prototype.uint32 = /* @__PURE__ */ (function read_uint32_setup() {
20737
20885
  var value = 4294967295;
20738
20886
  return function read_uint32() {
20739
20887
  value = (this.buf[this.pos] & 127) >>> 0;
@@ -20752,7 +20900,7 @@ ${this.stack}`;
20752
20900
  }
20753
20901
  return value;
20754
20902
  };
20755
- }();
20903
+ })();
20756
20904
  Reader.prototype.int32 = function read_int32() {
20757
20905
  return this.uint32() | 0;
20758
20906
  };
@@ -22206,7 +22354,7 @@ ${this.stack}`;
22206
22354
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
22207
22355
  return false;
22208
22356
  };
22209
- util.Buffer = function() {
22357
+ util.Buffer = (function() {
22210
22358
  try {
22211
22359
  var Buffer = util.inquire("buffer").Buffer;
22212
22360
  return Buffer.prototype.utf8Write ? Buffer : (
@@ -22216,7 +22364,7 @@ ${this.stack}`;
22216
22364
  } catch (e) {
22217
22365
  return null;
22218
22366
  }
22219
- }();
22367
+ })();
22220
22368
  util._Buffer_from = null;
22221
22369
  util._Buffer_allocUnsafe = null;
22222
22370
  util.newBuffer = function newBuffer(sizeOrArray) {
@@ -22672,7 +22820,7 @@ ${this.stack}`;
22672
22820
 
22673
22821
  let $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
22674
22822
  const $root = $protobuf.roots["push-server"] || ($protobuf.roots["push-server"] = {});
22675
- $root.RequestBatch = function() {
22823
+ $root.RequestBatch = (function() {
22676
22824
  function RequestBatch(properties) {
22677
22825
  this.requests = [];
22678
22826
  if (properties) {
@@ -22724,8 +22872,8 @@ ${this.stack}`;
22724
22872
  return message;
22725
22873
  };
22726
22874
  return RequestBatch;
22727
- }();
22728
- $root.Request = function() {
22875
+ })();
22876
+ $root.Request = (function() {
22729
22877
  function Request(properties) {
22730
22878
  if (properties) {
22731
22879
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -22814,8 +22962,8 @@ ${this.stack}`;
22814
22962
  return message;
22815
22963
  };
22816
22964
  return Request;
22817
- }();
22818
- $root.IncomingMessagesRequest = function() {
22965
+ })();
22966
+ $root.IncomingMessagesRequest = (function() {
22819
22967
  function IncomingMessagesRequest(properties) {
22820
22968
  this.messages = [];
22821
22969
  if (properties) {
@@ -22869,8 +23017,8 @@ ${this.stack}`;
22869
23017
  return message;
22870
23018
  };
22871
23019
  return IncomingMessagesRequest;
22872
- }();
22873
- $root.IncomingMessage = function() {
23020
+ })();
23021
+ $root.IncomingMessage = (function() {
22874
23022
  function IncomingMessage(properties) {
22875
23023
  this.receivers = [];
22876
23024
  if (properties) {
@@ -22965,8 +23113,8 @@ ${this.stack}`;
22965
23113
  return message;
22966
23114
  };
22967
23115
  return IncomingMessage;
22968
- }();
22969
- $root.ChannelStatsRequest = function() {
23116
+ })();
23117
+ $root.ChannelStatsRequest = (function() {
22970
23118
  function ChannelStatsRequest(properties) {
22971
23119
  this.channels = [];
22972
23120
  if (properties) {
@@ -23018,8 +23166,8 @@ ${this.stack}`;
23018
23166
  return message;
23019
23167
  };
23020
23168
  return ChannelStatsRequest;
23021
- }();
23022
- $root.ChannelId = function() {
23169
+ })();
23170
+ $root.ChannelId = (function() {
23023
23171
  function ChannelId(properties) {
23024
23172
  if (properties) {
23025
23173
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23083,8 +23231,8 @@ ${this.stack}`;
23083
23231
  return message;
23084
23232
  };
23085
23233
  return ChannelId;
23086
- }();
23087
- $root.ServerStatsRequest = function() {
23234
+ })();
23235
+ $root.ServerStatsRequest = (function() {
23088
23236
  function ServerStatsRequest(properties) {
23089
23237
  if (properties) {
23090
23238
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23118,8 +23266,8 @@ ${this.stack}`;
23118
23266
  return message;
23119
23267
  };
23120
23268
  return ServerStatsRequest;
23121
- }();
23122
- $root.Sender = function() {
23269
+ })();
23270
+ $root.Sender = (function() {
23123
23271
  function Sender(properties) {
23124
23272
  if (properties) {
23125
23273
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23173,15 +23321,15 @@ ${this.stack}`;
23173
23321
  return message;
23174
23322
  };
23175
23323
  return Sender;
23176
- }();
23177
- $root.SenderType = function() {
23324
+ })();
23325
+ $root.SenderType = (function() {
23178
23326
  var valuesById = {}, values = Object.create(valuesById);
23179
23327
  values[valuesById[0] = "UNKNOWN"] = 0;
23180
23328
  values[valuesById[1] = "CLIENT"] = 1;
23181
23329
  values[valuesById[2] = "BACKEND"] = 2;
23182
23330
  return values;
23183
- }();
23184
- $root.Receiver = function() {
23331
+ })();
23332
+ $root.Receiver = (function() {
23185
23333
  function Receiver(properties) {
23186
23334
  if (properties) {
23187
23335
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23245,8 +23393,8 @@ ${this.stack}`;
23245
23393
  return message;
23246
23394
  };
23247
23395
  return Receiver;
23248
- }();
23249
- $root.ResponseBatch = function() {
23396
+ })();
23397
+ $root.ResponseBatch = (function() {
23250
23398
  function ResponseBatch(properties) {
23251
23399
  this.responses = [];
23252
23400
  if (properties) {
@@ -23298,8 +23446,8 @@ ${this.stack}`;
23298
23446
  return message;
23299
23447
  };
23300
23448
  return ResponseBatch;
23301
- }();
23302
- $root.Response = function() {
23449
+ })();
23450
+ $root.Response = (function() {
23303
23451
  function Response(properties) {
23304
23452
  if (properties) {
23305
23453
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23388,8 +23536,8 @@ ${this.stack}`;
23388
23536
  return message;
23389
23537
  };
23390
23538
  return Response;
23391
- }();
23392
- $root.OutgoingMessagesResponse = function() {
23539
+ })();
23540
+ $root.OutgoingMessagesResponse = (function() {
23393
23541
  function OutgoingMessagesResponse(properties) {
23394
23542
  this.messages = [];
23395
23543
  if (properties) {
@@ -23443,8 +23591,8 @@ ${this.stack}`;
23443
23591
  return message;
23444
23592
  };
23445
23593
  return OutgoingMessagesResponse;
23446
- }();
23447
- $root.OutgoingMessage = function() {
23594
+ })();
23595
+ $root.OutgoingMessage = (function() {
23448
23596
  function OutgoingMessage(properties) {
23449
23597
  if (properties) {
23450
23598
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23531,8 +23679,8 @@ ${this.stack}`;
23531
23679
  return message;
23532
23680
  };
23533
23681
  return OutgoingMessage;
23534
- }();
23535
- $root.ChannelStatsResponse = function() {
23682
+ })();
23683
+ $root.ChannelStatsResponse = (function() {
23536
23684
  function ChannelStatsResponse(properties) {
23537
23685
  this.channels = [];
23538
23686
  if (properties) {
@@ -23586,8 +23734,8 @@ ${this.stack}`;
23586
23734
  return message;
23587
23735
  };
23588
23736
  return ChannelStatsResponse;
23589
- }();
23590
- $root.ChannelStats = function() {
23737
+ })();
23738
+ $root.ChannelStats = (function() {
23591
23739
  function ChannelStats(properties) {
23592
23740
  if (properties) {
23593
23741
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23651,8 +23799,8 @@ ${this.stack}`;
23651
23799
  return message;
23652
23800
  };
23653
23801
  return ChannelStats;
23654
- }();
23655
- $root.JsonResponse = function() {
23802
+ })();
23803
+ $root.JsonResponse = (function() {
23656
23804
  function JsonResponse(properties) {
23657
23805
  if (properties) {
23658
23806
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23696,7 +23844,7 @@ ${this.stack}`;
23696
23844
  return message;
23697
23845
  };
23698
23846
  return JsonResponse;
23699
- }();
23847
+ })();
23700
23848
 
23701
23849
  const ResponseBatch = $root["ResponseBatch"];
23702
23850
  const RequestBatch = $root["RequestBatch"];
@@ -24409,8 +24557,8 @@ ${this.stack}`;
24409
24557
  if (!skipReconnectToLastSession && this._storage) {
24410
24558
  oldSession = this._storage.get(LS_SESSION, null);
24411
24559
  }
24412
- if (Type.isPlainObject(oldSession) && oldSession.hasOwnProperty("ttl") && oldSession.ttl >= now) {
24413
- this._session.mid = oldSession.mid;
24560
+ if (Type.isPlainObject(oldSession) && oldSession.hasOwnProperty("ttl") && oldSession["ttl"] >= now) {
24561
+ this._session.mid = oldSession["mid"];
24414
24562
  }
24415
24563
  this._starting = true;
24416
24564
  return this._startingPromise = new Promise((resolve, reject) => {
@@ -25233,22 +25381,22 @@ ${this.stack}`;
25233
25381
  if (!Type.isPlainObject(config)) {
25234
25382
  return false;
25235
25383
  }
25236
- if (Number(config.server.config_timestamp) !== this._configTimestamp) {
25384
+ if (Number(config["server"].config_timestamp) !== this._configTimestamp) {
25237
25385
  return false;
25238
25386
  }
25239
25387
  const now = /* @__PURE__ */ new Date();
25240
- if (Type.isNumber(config.exp) && config.exp > 0 && config.exp < now.getTime() / 1e3) {
25388
+ if (Type.isNumber(config["exp"]) && config["exp"] > 0 && config["exp"] < now.getTime() / 1e3) {
25241
25389
  return false;
25242
25390
  }
25243
- const channelCount = Object.keys(config.channels).length;
25391
+ const channelCount = Object.keys(config["channels"]).length;
25244
25392
  if (channelCount === 0) {
25245
25393
  return false;
25246
25394
  }
25247
- for (const channelType in config.channels) {
25248
- if (!config.channels.hasOwnProperty(channelType)) {
25395
+ for (const channelType in config["channels"]) {
25396
+ if (!config["channels"].hasOwnProperty(channelType)) {
25249
25397
  continue;
25250
25398
  }
25251
- const channel = config.channels[channelType];
25399
+ const channel = config["channels"][channelType];
25252
25400
  const channelEnd = new Date(channel.end);
25253
25401
  if (channelEnd < now) {
25254
25402
  return false;
@@ -26008,7 +26156,7 @@ Data string: ${pullEvent}
26008
26156
  }
26009
26157
  trimDuplicates() {
26010
26158
  if (this._session.lastMessageIds.length > MAX_IDS_TO_STORE) {
26011
- this._session.lastMessageIds = this._session.lastMessageIds.slice(-10);
26159
+ this._session.lastMessageIds = this._session.lastMessageIds.slice(-MAX_IDS_TO_STORE);
26012
26160
  }
26013
26161
  }
26014
26162
  // endregion ////