@bitrix24/b24jssdk 0.4.5 → 0.4.8

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.5
2
+ * @version @bitrix24/b24jssdk v0.4.8
3
3
  * @copyright (c) 2025 Bitrix24
4
4
  * @licence MIT
5
5
  * @links https://github.com/bitrix24/b24jssdk - GitHub
@@ -1572,10 +1572,18 @@
1572
1572
 
1573
1573
  months(length, format = false) {
1574
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;
1575
1580
  const intl = format ? { month: length, day: "numeric" } : { month: length },
1576
1581
  formatStr = format ? "format" : "standalone";
1577
1582
  if (!this.monthsCache[formatStr][length]) {
1578
- 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);
1579
1587
  }
1580
1588
  return this.monthsCache[formatStr][length];
1581
1589
  });
@@ -1904,7 +1912,6 @@
1904
1912
  * @private
1905
1913
  */
1906
1914
 
1907
-
1908
1915
  function normalizeZone(input, defaultZone) {
1909
1916
  if (isUndefined$1(input) || input === null) {
1910
1917
  return defaultZone;
@@ -2409,7 +2416,6 @@
2409
2416
  it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.
2410
2417
  */
2411
2418
 
2412
-
2413
2419
  /**
2414
2420
  * @private
2415
2421
  */
@@ -2561,10 +2567,24 @@
2561
2567
  }
2562
2568
  }
2563
2569
 
2564
- function roundTo(number, digits, towardZero = false) {
2565
- const factor = 10 ** digits,
2566
- rounder = towardZero ? Math.trunc : Math.round;
2567
- 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
+ }
2568
2588
  }
2569
2589
 
2570
2590
  // DATE BASICS
@@ -2672,7 +2692,7 @@
2672
2692
 
2673
2693
  function asNumber(value) {
2674
2694
  const numericValue = Number(value);
2675
- if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
2695
+ if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue))
2676
2696
  throw new InvalidArgumentError(`Invalid unit value ${value}`);
2677
2697
  return numericValue;
2678
2698
  }
@@ -2931,8 +2951,12 @@
2931
2951
  for (let i = 0; i < fmt.length; i++) {
2932
2952
  const c = fmt.charAt(i);
2933
2953
  if (c === "'") {
2934
- if (currentFull.length > 0) {
2935
- 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
+ });
2936
2960
  }
2937
2961
  current = null;
2938
2962
  currentFull = "";
@@ -2996,7 +3020,7 @@
2996
3020
  return this.dtFormatter(dt, opts).resolvedOptions();
2997
3021
  }
2998
3022
 
2999
- num(n, p = 0) {
3023
+ num(n, p = 0, signDisplay = undefined) {
3000
3024
  // we get some perf out of doing this here, annoyingly
3001
3025
  if (this.opts.forceSimple) {
3002
3026
  return padStart(n, p);
@@ -3007,6 +3031,9 @@
3007
3031
  if (p > 0) {
3008
3032
  opts.padTo = p;
3009
3033
  }
3034
+ if (signDisplay) {
3035
+ opts.signDisplay = signDisplay;
3036
+ }
3010
3037
 
3011
3038
  return this.loc.numberFormatter(opts).format(n);
3012
3039
  }
@@ -3242,32 +3269,44 @@
3242
3269
  }
3243
3270
 
3244
3271
  formatDurationFromString(dur, fmt) {
3272
+ const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
3245
3273
  const tokenToField = (token) => {
3246
3274
  switch (token[0]) {
3247
3275
  case "S":
3248
- return "millisecond";
3276
+ return "milliseconds";
3249
3277
  case "s":
3250
- return "second";
3278
+ return "seconds";
3251
3279
  case "m":
3252
- return "minute";
3280
+ return "minutes";
3253
3281
  case "h":
3254
- return "hour";
3282
+ return "hours";
3255
3283
  case "d":
3256
- return "day";
3284
+ return "days";
3257
3285
  case "w":
3258
- return "week";
3286
+ return "weeks";
3259
3287
  case "M":
3260
- return "month";
3288
+ return "months";
3261
3289
  case "y":
3262
- return "year";
3290
+ return "years";
3263
3291
  default:
3264
3292
  return null;
3265
3293
  }
3266
3294
  },
3267
- tokenToString = (lildur) => (token) => {
3295
+ tokenToString = (lildur, info) => (token) => {
3268
3296
  const mapped = tokenToField(token);
3269
3297
  if (mapped) {
3270
- 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);
3271
3310
  } else {
3272
3311
  return token;
3273
3312
  }
@@ -3277,8 +3316,14 @@
3277
3316
  (found, { literal, val }) => (literal ? found : found.concat(val)),
3278
3317
  []
3279
3318
  ),
3280
- collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
3281
- 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));
3282
3327
  }
3283
3328
  }
3284
3329
 
@@ -3339,11 +3384,11 @@
3339
3384
  }
3340
3385
 
3341
3386
  // ISO and SQL parsing
3342
- const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
3387
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
3343
3388
  const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
3344
3389
  const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
3345
3390
  const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
3346
- const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
3391
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
3347
3392
  const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
3348
3393
  const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
3349
3394
  const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
@@ -4058,9 +4103,13 @@
4058
4103
  * @param {string} fmt - the format string
4059
4104
  * @param {Object} opts - options
4060
4105
  * @param {boolean} [opts.floor=true] - floor numerical values
4106
+ * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs
4061
4107
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
4062
4108
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
4063
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"
4064
4113
  * @return {string}
4065
4114
  */
4066
4115
  toFormat(fmt, opts = {}) {
@@ -4080,21 +4129,25 @@
4080
4129
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
4081
4130
  * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
4082
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
4083
4133
  * @example
4084
4134
  * ```js
4085
- * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
4086
- * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
4087
- * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
4088
- * 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'
4089
4140
  * ```
4090
4141
  */
4091
4142
  toHuman(opts = {}) {
4092
4143
  if (!this.isValid) return INVALID$2;
4093
4144
 
4145
+ const showZeros = opts.showZeros !== false;
4146
+
4094
4147
  const l = orderedUnits$1
4095
4148
  .map((unit) => {
4096
4149
  const val = this.values[unit];
4097
- if (isUndefined$1(val)) {
4150
+ if (isUndefined$1(val) || (val === 0 && !showZeros)) {
4098
4151
  return null;
4099
4152
  }
4100
4153
  return this.loc
@@ -4454,6 +4507,17 @@
4454
4507
  return clone$1(this, { values: negated }, true);
4455
4508
  }
4456
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
+
4457
4521
  /**
4458
4522
  * Get the years.
4459
4523
  * @type {number}
@@ -4764,7 +4828,8 @@
4764
4828
  }
4765
4829
 
4766
4830
  /**
4767
- * 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).
4768
4833
  * @type {DateTime}
4769
4834
  */
4770
4835
  get end() {
@@ -6195,21 +6260,22 @@
6195
6260
  : null;
6196
6261
  }
6197
6262
 
6198
- function toISODate(o, extended) {
6263
+ function toISODate(o, extended, precision) {
6199
6264
  const longFormat = o.c.year > 9999 || o.c.year < 0;
6200
6265
  let c = "";
6201
6266
  if (longFormat && o.c.year >= 0) c += "+";
6202
6267
  c += padStart(o.c.year, longFormat ? 6 : 4);
6203
-
6268
+ if (precision === "year") return c;
6204
6269
  if (extended) {
6205
6270
  c += "-";
6206
6271
  c += padStart(o.c.month);
6272
+ if (precision === "month") return c;
6207
6273
  c += "-";
6208
- c += padStart(o.c.day);
6209
6274
  } else {
6210
6275
  c += padStart(o.c.month);
6211
- c += padStart(o.c.day);
6276
+ if (precision === "month") return c;
6212
6277
  }
6278
+ c += padStart(o.c.day);
6213
6279
  return c;
6214
6280
  }
6215
6281
 
@@ -6219,26 +6285,39 @@
6219
6285
  suppressSeconds,
6220
6286
  suppressMilliseconds,
6221
6287
  includeOffset,
6222
- extendedZone
6288
+ extendedZone,
6289
+ precision
6223
6290
  ) {
6224
- let c = padStart(o.c.hour);
6225
- if (extended) {
6226
- c += ":";
6227
- c += padStart(o.c.minute);
6228
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6229
- c += ":";
6230
- }
6231
- } else {
6232
- c += padStart(o.c.minute);
6233
- }
6234
-
6235
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6236
- c += padStart(o.c.second);
6237
-
6238
- if (o.c.millisecond !== 0 || !suppressMilliseconds) {
6239
- c += ".";
6240
- c += padStart(o.c.millisecond, 3);
6241
- }
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
+ }
6242
6321
  }
6243
6322
 
6244
6323
  if (includeOffset) {
@@ -6430,8 +6509,9 @@
6430
6509
 
6431
6510
  function diffRelative(start, end, opts) {
6432
6511
  const round = isUndefined$1(opts.round) ? true : opts.round,
6512
+ rounding = isUndefined$1(opts.rounding) ? "trunc" : opts.rounding,
6433
6513
  format = (c, unit) => {
6434
- c = roundTo(c, round || opts.calendary ? 0 : 2, true);
6514
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
6435
6515
  const formatter = end.loc.clone(opts).relFormatter(opts);
6436
6516
  return formatter.format(c, unit);
6437
6517
  },
@@ -6684,7 +6764,7 @@
6684
6764
  throw new InvalidArgumentError(
6685
6765
  `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`
6686
6766
  );
6687
- } else if (milliseconds < -864e13 || milliseconds > MAX_DATE) {
6767
+ } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
6688
6768
  // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start
6689
6769
  return DateTime.invalid("Timestamp out of range");
6690
6770
  } else {
@@ -7810,10 +7890,13 @@
7810
7890
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
7811
7891
  * @param {boolean} [opts.extendedZone=false] - add the time zone format extension
7812
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.
7813
7894
  * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
7814
7895
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
7815
7896
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
7816
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'
7817
7900
  * @return {string|null}
7818
7901
  */
7819
7902
  toISO({
@@ -7822,16 +7905,26 @@
7822
7905
  suppressMilliseconds = false,
7823
7906
  includeOffset = true,
7824
7907
  extendedZone = false,
7908
+ precision = "milliseconds",
7825
7909
  } = {}) {
7826
7910
  if (!this.isValid) {
7827
7911
  return null;
7828
7912
  }
7829
7913
 
7914
+ precision = normalizeUnit(precision);
7830
7915
  const ext = format === "extended";
7831
7916
 
7832
- let c = toISODate(this, ext);
7833
- c += "T";
7834
- 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
+ );
7835
7928
  return c;
7836
7929
  }
7837
7930
 
@@ -7839,16 +7932,17 @@
7839
7932
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
7840
7933
  * @param {Object} opts - options
7841
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'.
7842
7936
  * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
7843
7937
  * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
7938
+ * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'
7844
7939
  * @return {string|null}
7845
7940
  */
7846
- toISODate({ format = "extended" } = {}) {
7941
+ toISODate({ format = "extended", precision = "day" } = {}) {
7847
7942
  if (!this.isValid) {
7848
7943
  return null;
7849
7944
  }
7850
-
7851
- return toISODate(this, format === "extended");
7945
+ return toISODate(this, format === "extended", normalizeUnit(precision));
7852
7946
  }
7853
7947
 
7854
7948
  /**
@@ -7869,10 +7963,12 @@
7869
7963
  * @param {boolean} [opts.extendedZone=true] - add the time zone format extension
7870
7964
  * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
7871
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.
7872
7967
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
7873
7968
  * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
7874
7969
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
7875
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'
7876
7972
  * @return {string}
7877
7973
  */
7878
7974
  toISOTime({
@@ -7882,12 +7978,14 @@
7882
7978
  includePrefix = false,
7883
7979
  extendedZone = false,
7884
7980
  format = "extended",
7981
+ precision = "milliseconds",
7885
7982
  } = {}) {
7886
7983
  if (!this.isValid) {
7887
7984
  return null;
7888
7985
  }
7889
7986
 
7890
- let c = includePrefix ? "T" : "";
7987
+ precision = normalizeUnit(precision);
7988
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
7891
7989
  return (
7892
7990
  c +
7893
7991
  toISOTime(
@@ -7896,7 +7994,8 @@
7896
7994
  suppressSeconds,
7897
7995
  suppressMilliseconds,
7898
7996
  includeOffset,
7899
- extendedZone
7997
+ extendedZone,
7998
+ precision
7900
7999
  )
7901
8000
  );
7902
8001
  }
@@ -8174,12 +8273,13 @@
8174
8273
 
8175
8274
  /**
8176
8275
  * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
8177
- * platform supports Intl.RelativeTimeFormat. Rounds down by default.
8276
+ * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.
8178
8277
  * @param {Object} options - options that affect the output
8179
8278
  * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
8180
8279
  * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
8181
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"
8182
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".
8183
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.
8184
8284
  * @param {string} options.locale - override the locale of this DateTime
8185
8285
  * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
@@ -9842,6 +9942,27 @@ ${this.stack}`;
9842
9942
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
9843
9943
  };
9844
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
+
9845
9966
  /**
9846
9967
  * Determine if a value is a Date
9847
9968
  *
@@ -9964,6 +10085,11 @@ ${this.stack}`;
9964
10085
  fn.call(null, obj[i], i, obj);
9965
10086
  }
9966
10087
  } else {
10088
+ // Buffer check
10089
+ if (isBuffer$1(obj)) {
10090
+ return;
10091
+ }
10092
+
9967
10093
  // Iterate over object keys
9968
10094
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
9969
10095
  const len = keys.length;
@@ -9977,6 +10103,10 @@ ${this.stack}`;
9977
10103
  }
9978
10104
 
9979
10105
  function findKey(obj, key) {
10106
+ if (isBuffer$1(obj)){
10107
+ return null;
10108
+ }
10109
+
9980
10110
  key = key.toLowerCase();
9981
10111
  const keys = Object.keys(obj);
9982
10112
  let i = keys.length;
@@ -10330,6 +10460,11 @@ ${this.stack}`;
10330
10460
  return;
10331
10461
  }
10332
10462
 
10463
+ //Buffer check
10464
+ if (isBuffer$1(source)) {
10465
+ return source;
10466
+ }
10467
+
10333
10468
  if(!('toJSON' in source)) {
10334
10469
  stack[i] = source;
10335
10470
  const target = isArray$3(source) ? [] : {};
@@ -10401,6 +10536,7 @@ ${this.stack}`;
10401
10536
  isBoolean,
10402
10537
  isObject,
10403
10538
  isPlainObject,
10539
+ isEmptyObject,
10404
10540
  isReadableStream,
10405
10541
  isRequest,
10406
10542
  isResponse,
@@ -11030,7 +11166,7 @@ ${this.stack}`;
11030
11166
  };
11031
11167
 
11032
11168
  function toURLEncodedForm(data, options) {
11033
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
11169
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
11034
11170
  visitor: function(value, key, path, helpers) {
11035
11171
  if (platform.isNode && utils$1.isBuffer(value)) {
11036
11172
  this.append(key, value.toString('base64'));
@@ -11038,8 +11174,9 @@ ${this.stack}`;
11038
11174
  }
11039
11175
 
11040
11176
  return helpers.defaultVisitor.apply(this, arguments);
11041
- }
11042
- }, options));
11177
+ },
11178
+ ...options
11179
+ });
11043
11180
  }
11044
11181
 
11045
11182
  /**
@@ -11788,7 +11925,7 @@ ${this.stack}`;
11788
11925
  clearTimeout(timer);
11789
11926
  timer = null;
11790
11927
  }
11791
- fn.apply(null, args);
11928
+ fn(...args);
11792
11929
  };
11793
11930
 
11794
11931
  const throttled = (...args) => {
@@ -12044,7 +12181,7 @@ ${this.stack}`;
12044
12181
  headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
12045
12182
  };
12046
12183
 
12047
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
12184
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
12048
12185
  const merge = mergeMap[prop] || mergeDeepProperties;
12049
12186
  const configValue = merge(config1[prop], config2[prop], prop);
12050
12187
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -12783,7 +12920,7 @@ ${this.stack}`;
12783
12920
  });
12784
12921
  }
12785
12922
 
12786
- const VERSION$1 = "1.10.0";
12923
+ const VERSION$1 = "1.11.0";
12787
12924
 
12788
12925
  const validators$1 = {};
12789
12926
 
@@ -13022,8 +13159,8 @@ ${this.stack}`;
13022
13159
 
13023
13160
  if (!synchronousRequestInterceptors) {
13024
13161
  const chain = [dispatchRequest.bind(this), undefined];
13025
- chain.unshift.apply(chain, requestInterceptorChain);
13026
- chain.push.apply(chain, responseInterceptorChain);
13162
+ chain.unshift(...requestInterceptorChain);
13163
+ chain.push(...responseInterceptorChain);
13027
13164
  len = chain.length;
13028
13165
 
13029
13166
  promise = Promise.resolve(config);
@@ -13777,7 +13914,7 @@ ${this.stack}`;
13777
13914
  let tmpSc = sideChannel;
13778
13915
  let step = 0;
13779
13916
  let findFlag = false;
13780
- while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
13917
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
13781
13918
  // Where object last appeared in the ref tree
13782
13919
  const pos = tmpSc.get(object);
13783
13920
  step += 1;
@@ -13842,7 +13979,7 @@ ${this.stack}`;
13842
13979
  if (encodeValuesOnly && encoder) {
13843
13980
  obj = maybeMap(obj, encoder);
13844
13981
  }
13845
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void 0 }];
13982
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
13846
13983
  } else if (isArray$1(filter)) {
13847
13984
  objKeys = filter;
13848
13985
  } else {
@@ -14239,7 +14376,7 @@ ${this.stack}`;
14239
14376
  #clientSideWarningMessage = "";
14240
14377
  constructor(baseURL, authActions, options) {
14241
14378
  const defaultHeaders = {
14242
- // 'X-Sdk': 'b24-js-sdk-v-0.4.5'
14379
+ // 'X-Sdk': 'b24-js-sdk-v-0.4.8'
14243
14380
  };
14244
14381
  this.#clientAxios = axios.create({
14245
14382
  baseURL,
@@ -14669,7 +14806,7 @@ ${this.stack}`;
14669
14806
  const baseUrl = `${encodeURIComponent(method)}.json`;
14670
14807
  const queryParams = new URLSearchParams({
14671
14808
  [this.#requestIdGenerator.getQueryStringParameterName()]: this.#requestIdGenerator.getRequestId(),
14672
- [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.5",
14809
+ [this.#requestIdGenerator.getQueryStringSdkParameterName()]: "0.4.8",
14673
14810
  [this.#requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
14674
14811
  });
14675
14812
  return `${baseUrl}?${queryParams.toString()}`;
@@ -15942,8 +16079,11 @@ ${this.stack}`;
15942
16079
  };
15943
16080
  } else {
15944
16081
  cmd = command.toString();
16082
+ if (params?.isRawValue !== true && paramsSend) {
16083
+ paramsSend = JSON.stringify(paramsSend);
16084
+ }
15945
16085
  const listParams = [
15946
- paramsSend ? JSON.stringify(paramsSend) : "",
16086
+ paramsSend || "",
15947
16087
  keyPromise,
15948
16088
  this.#appFrame.getAppSid()
15949
16089
  ];
@@ -16746,18 +16886,20 @@ ${this.stack}`;
16746
16886
  }
16747
16887
  /**
16748
16888
  * Call the Registered Interface Command
16749
- * @param {string} command
16750
- * @param {Record<string, any>} parameters
16751
- * @return {Promise<any>}
16889
+ * @param { string } command
16890
+ * @param { Record<string, any> } parameters
16891
+ * @return { Promise<any> }
16752
16892
  *
16753
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 }
16754
16895
  */
16755
16896
  async call(command, parameters = {}) {
16756
16897
  return this.#messageManager.send(
16757
16898
  command,
16758
16899
  {
16759
16900
  ...parameters,
16760
- isSafely: true
16901
+ isSafely: true,
16902
+ isRawValue: ["setValue"].includes(command)
16761
16903
  }
16762
16904
  );
16763
16905
  }
@@ -20739,7 +20881,7 @@ ${this.stack}`;
20739
20881
  } : create_array;
20740
20882
  Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */
20741
20883
  util.Array.prototype.slice;
20742
- Reader.prototype.uint32 = /* @__PURE__ */ function read_uint32_setup() {
20884
+ Reader.prototype.uint32 = /* @__PURE__ */ (function read_uint32_setup() {
20743
20885
  var value = 4294967295;
20744
20886
  return function read_uint32() {
20745
20887
  value = (this.buf[this.pos] & 127) >>> 0;
@@ -20758,7 +20900,7 @@ ${this.stack}`;
20758
20900
  }
20759
20901
  return value;
20760
20902
  };
20761
- }();
20903
+ })();
20762
20904
  Reader.prototype.int32 = function read_int32() {
20763
20905
  return this.uint32() | 0;
20764
20906
  };
@@ -22212,7 +22354,7 @@ ${this.stack}`;
22212
22354
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
22213
22355
  return false;
22214
22356
  };
22215
- util.Buffer = function() {
22357
+ util.Buffer = (function() {
22216
22358
  try {
22217
22359
  var Buffer = util.inquire("buffer").Buffer;
22218
22360
  return Buffer.prototype.utf8Write ? Buffer : (
@@ -22222,7 +22364,7 @@ ${this.stack}`;
22222
22364
  } catch (e) {
22223
22365
  return null;
22224
22366
  }
22225
- }();
22367
+ })();
22226
22368
  util._Buffer_from = null;
22227
22369
  util._Buffer_allocUnsafe = null;
22228
22370
  util.newBuffer = function newBuffer(sizeOrArray) {
@@ -22678,7 +22820,7 @@ ${this.stack}`;
22678
22820
 
22679
22821
  let $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
22680
22822
  const $root = $protobuf.roots["push-server"] || ($protobuf.roots["push-server"] = {});
22681
- $root.RequestBatch = function() {
22823
+ $root.RequestBatch = (function() {
22682
22824
  function RequestBatch(properties) {
22683
22825
  this.requests = [];
22684
22826
  if (properties) {
@@ -22730,8 +22872,8 @@ ${this.stack}`;
22730
22872
  return message;
22731
22873
  };
22732
22874
  return RequestBatch;
22733
- }();
22734
- $root.Request = function() {
22875
+ })();
22876
+ $root.Request = (function() {
22735
22877
  function Request(properties) {
22736
22878
  if (properties) {
22737
22879
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -22820,8 +22962,8 @@ ${this.stack}`;
22820
22962
  return message;
22821
22963
  };
22822
22964
  return Request;
22823
- }();
22824
- $root.IncomingMessagesRequest = function() {
22965
+ })();
22966
+ $root.IncomingMessagesRequest = (function() {
22825
22967
  function IncomingMessagesRequest(properties) {
22826
22968
  this.messages = [];
22827
22969
  if (properties) {
@@ -22875,8 +23017,8 @@ ${this.stack}`;
22875
23017
  return message;
22876
23018
  };
22877
23019
  return IncomingMessagesRequest;
22878
- }();
22879
- $root.IncomingMessage = function() {
23020
+ })();
23021
+ $root.IncomingMessage = (function() {
22880
23022
  function IncomingMessage(properties) {
22881
23023
  this.receivers = [];
22882
23024
  if (properties) {
@@ -22971,8 +23113,8 @@ ${this.stack}`;
22971
23113
  return message;
22972
23114
  };
22973
23115
  return IncomingMessage;
22974
- }();
22975
- $root.ChannelStatsRequest = function() {
23116
+ })();
23117
+ $root.ChannelStatsRequest = (function() {
22976
23118
  function ChannelStatsRequest(properties) {
22977
23119
  this.channels = [];
22978
23120
  if (properties) {
@@ -23024,8 +23166,8 @@ ${this.stack}`;
23024
23166
  return message;
23025
23167
  };
23026
23168
  return ChannelStatsRequest;
23027
- }();
23028
- $root.ChannelId = function() {
23169
+ })();
23170
+ $root.ChannelId = (function() {
23029
23171
  function ChannelId(properties) {
23030
23172
  if (properties) {
23031
23173
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23089,8 +23231,8 @@ ${this.stack}`;
23089
23231
  return message;
23090
23232
  };
23091
23233
  return ChannelId;
23092
- }();
23093
- $root.ServerStatsRequest = function() {
23234
+ })();
23235
+ $root.ServerStatsRequest = (function() {
23094
23236
  function ServerStatsRequest(properties) {
23095
23237
  if (properties) {
23096
23238
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23124,8 +23266,8 @@ ${this.stack}`;
23124
23266
  return message;
23125
23267
  };
23126
23268
  return ServerStatsRequest;
23127
- }();
23128
- $root.Sender = function() {
23269
+ })();
23270
+ $root.Sender = (function() {
23129
23271
  function Sender(properties) {
23130
23272
  if (properties) {
23131
23273
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23179,15 +23321,15 @@ ${this.stack}`;
23179
23321
  return message;
23180
23322
  };
23181
23323
  return Sender;
23182
- }();
23183
- $root.SenderType = function() {
23324
+ })();
23325
+ $root.SenderType = (function() {
23184
23326
  var valuesById = {}, values = Object.create(valuesById);
23185
23327
  values[valuesById[0] = "UNKNOWN"] = 0;
23186
23328
  values[valuesById[1] = "CLIENT"] = 1;
23187
23329
  values[valuesById[2] = "BACKEND"] = 2;
23188
23330
  return values;
23189
- }();
23190
- $root.Receiver = function() {
23331
+ })();
23332
+ $root.Receiver = (function() {
23191
23333
  function Receiver(properties) {
23192
23334
  if (properties) {
23193
23335
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23251,8 +23393,8 @@ ${this.stack}`;
23251
23393
  return message;
23252
23394
  };
23253
23395
  return Receiver;
23254
- }();
23255
- $root.ResponseBatch = function() {
23396
+ })();
23397
+ $root.ResponseBatch = (function() {
23256
23398
  function ResponseBatch(properties) {
23257
23399
  this.responses = [];
23258
23400
  if (properties) {
@@ -23304,8 +23446,8 @@ ${this.stack}`;
23304
23446
  return message;
23305
23447
  };
23306
23448
  return ResponseBatch;
23307
- }();
23308
- $root.Response = function() {
23449
+ })();
23450
+ $root.Response = (function() {
23309
23451
  function Response(properties) {
23310
23452
  if (properties) {
23311
23453
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23394,8 +23536,8 @@ ${this.stack}`;
23394
23536
  return message;
23395
23537
  };
23396
23538
  return Response;
23397
- }();
23398
- $root.OutgoingMessagesResponse = function() {
23539
+ })();
23540
+ $root.OutgoingMessagesResponse = (function() {
23399
23541
  function OutgoingMessagesResponse(properties) {
23400
23542
  this.messages = [];
23401
23543
  if (properties) {
@@ -23449,8 +23591,8 @@ ${this.stack}`;
23449
23591
  return message;
23450
23592
  };
23451
23593
  return OutgoingMessagesResponse;
23452
- }();
23453
- $root.OutgoingMessage = function() {
23594
+ })();
23595
+ $root.OutgoingMessage = (function() {
23454
23596
  function OutgoingMessage(properties) {
23455
23597
  if (properties) {
23456
23598
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23537,8 +23679,8 @@ ${this.stack}`;
23537
23679
  return message;
23538
23680
  };
23539
23681
  return OutgoingMessage;
23540
- }();
23541
- $root.ChannelStatsResponse = function() {
23682
+ })();
23683
+ $root.ChannelStatsResponse = (function() {
23542
23684
  function ChannelStatsResponse(properties) {
23543
23685
  this.channels = [];
23544
23686
  if (properties) {
@@ -23592,8 +23734,8 @@ ${this.stack}`;
23592
23734
  return message;
23593
23735
  };
23594
23736
  return ChannelStatsResponse;
23595
- }();
23596
- $root.ChannelStats = function() {
23737
+ })();
23738
+ $root.ChannelStats = (function() {
23597
23739
  function ChannelStats(properties) {
23598
23740
  if (properties) {
23599
23741
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23657,8 +23799,8 @@ ${this.stack}`;
23657
23799
  return message;
23658
23800
  };
23659
23801
  return ChannelStats;
23660
- }();
23661
- $root.JsonResponse = function() {
23802
+ })();
23803
+ $root.JsonResponse = (function() {
23662
23804
  function JsonResponse(properties) {
23663
23805
  if (properties) {
23664
23806
  for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
@@ -23702,7 +23844,7 @@ ${this.stack}`;
23702
23844
  return message;
23703
23845
  };
23704
23846
  return JsonResponse;
23705
- }();
23847
+ })();
23706
23848
 
23707
23849
  const ResponseBatch = $root["ResponseBatch"];
23708
23850
  const RequestBatch = $root["RequestBatch"];
@@ -26014,7 +26156,7 @@ Data string: ${pullEvent}
26014
26156
  }
26015
26157
  trimDuplicates() {
26016
26158
  if (this._session.lastMessageIds.length > MAX_IDS_TO_STORE) {
26017
- this._session.lastMessageIds = this._session.lastMessageIds.slice(-10);
26159
+ this._session.lastMessageIds = this._session.lastMessageIds.slice(-MAX_IDS_TO_STORE);
26018
26160
  }
26019
26161
  }
26020
26162
  // endregion ////